Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4260
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/60/4260/1
String=>OUString yet another random batch starting from svtools
Change-Id: Ib96e44732db8d9172bf1f804a20281343766ed33
---
M dbaccess/source/ui/app/AppDetailView.hxx
M extensions/source/bibliography/general.cxx
M framework/source/services/backingwindow.cxx
M framework/source/uielement/menubarmanager.cxx
M include/svtools/imagemgr.hxx
M include/vcl/menu.hxx
M include/vcl/mnemonic.hxx
M include/vcl/outdev.hxx
M reportdesign/source/ui/dlg/GroupsSorting.cxx
M sfx2/source/menu/virtmenu.cxx
M svtools/source/contnr/imivctl1.cxx
M svtools/source/misc/imagemgr.cxx
M svtools/source/uno/contextmenuhelper.cxx
M vcl/source/gdi/outdev3.cxx
M vcl/source/gdi/pdfwriter_impl.cxx
M vcl/source/window/dialog.cxx
M vcl/source/window/menu.cxx
M vcl/source/window/mnemonic.cxx
M vcl/source/window/msgbox.cxx
19 files changed, 240 insertions(+), 228 deletions(-)
diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx
index 67c9b57..a85368a 100644
--- a/dbaccess/source/ui/app/AppDetailView.hxx
+++ b/dbaccess/source/ui/app/AppDetailView.hxx
@@ -91,7 +91,7 @@
{
OUString sUNOCommand;
sal_uInt16 nHelpID;
- String sTitle;
+ OUString sTitle;
bool bHideWhenDisabled;
// TODO: we should be consistent in the task pane and the menus/toolbars:
// If an entry is disabled in the latter, it should also be disabled in the former.
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 25bc0f9..5456f34 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -615,39 +615,39 @@
void BibGeneralPage::InitFixedTexts( void )
{
- String aFixedStrings[ FIELD_COUNT ] =
+ OUString aFixedStrings[ FIELD_COUNT ] =
{
- String( BibResId( ST_IDENTIFIER ) ),
- String( BibResId( ST_AUTHTYPE ) ),
- String( BibResId( ST_AUTHOR ) ),
- String( BibResId( ST_TITLE ) ),
- String( BibResId( ST_MONTH ) ),
- String( BibResId( ST_YEAR ) ),
- String( BibResId( ST_ISBN ) ),
- String( BibResId( ST_BOOKTITLE ) ),
- String( BibResId( ST_CHAPTER ) ),
- String( BibResId( ST_EDITION ) ),
- String( BibResId( ST_EDITOR ) ),
- String( BibResId( ST_HOWPUBLISHED ) ),
- String( BibResId( ST_INSTITUTION ) ),
- String( BibResId( ST_JOURNAL ) ),
- String( BibResId( ST_NOTE ) ),
- String( BibResId( ST_ANNOTE ) ),
- String( BibResId( ST_NUMBER ) ),
- String( BibResId( ST_ORGANIZATION ) ),
- String( BibResId( ST_PAGE ) ),
- String( BibResId( ST_PUBLISHER ) ),
- String( BibResId( ST_ADDRESS ) ),
- String( BibResId( ST_SCHOOL ) ),
- String( BibResId( ST_SERIES ) ),
- String( BibResId( ST_REPORT ) ),
- String( BibResId( ST_VOLUME ) ),
- String( BibResId( ST_URL ) ),
- String( BibResId( ST_CUSTOM1 ) ),
- String( BibResId( ST_CUSTOM2 ) ),
- String( BibResId( ST_CUSTOM3 ) ),
- String( BibResId( ST_CUSTOM4 ) ),
- String( BibResId( ST_CUSTOM5 ) )
+ OUString( BibResId( ST_IDENTIFIER ) ),
+ OUString( BibResId( ST_AUTHTYPE ) ),
+ OUString( BibResId( ST_AUTHOR ) ),
+ OUString( BibResId( ST_TITLE ) ),
+ OUString( BibResId( ST_MONTH ) ),
+ OUString( BibResId( ST_YEAR ) ),
+ OUString( BibResId( ST_ISBN ) ),
+ OUString( BibResId( ST_BOOKTITLE ) ),
+ OUString( BibResId( ST_CHAPTER ) ),
+ OUString( BibResId( ST_EDITION ) ),
+ OUString( BibResId( ST_EDITOR ) ),
+ OUString( BibResId( ST_HOWPUBLISHED ) ),
+ OUString( BibResId( ST_INSTITUTION ) ),
+ OUString( BibResId( ST_JOURNAL ) ),
+ OUString( BibResId( ST_NOTE ) ),
+ OUString( BibResId( ST_ANNOTE ) ),
+ OUString( BibResId( ST_NUMBER ) ),
+ OUString( BibResId( ST_ORGANIZATION ) ),
+ OUString( BibResId( ST_PAGE ) ),
+ OUString( BibResId( ST_PUBLISHER ) ),
+ OUString( BibResId( ST_ADDRESS ) ),
+ OUString( BibResId( ST_SCHOOL ) ),
+ OUString( BibResId( ST_SERIES ) ),
+ OUString( BibResId( ST_REPORT ) ),
+ OUString( BibResId( ST_VOLUME ) ),
+ OUString( BibResId( ST_URL ) ),
+ OUString( BibResId( ST_CUSTOM1 ) ),
+ OUString( BibResId( ST_CUSTOM2 ) ),
+ OUString( BibResId( ST_CUSTOM3 ) ),
+ OUString( BibResId( ST_CUSTOM4 ) ),
+ OUString( BibResId( ST_CUSTOM5 ) )
};
aFixedTexts[0] = &aIdentifierFT;
diff --git a/framework/source/services/backingwindow.cxx
b/framework/source/services/backingwindow.cxx
index 7dab8c9..415f3bd 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -594,7 +594,7 @@
// setup text
i_rBtn.SetFont( maTextFont );
i_rBtn.SetControlFont( maTextFont );
- String aText( i_rStr.Len() ? i_rStr : SvFileInformationManager::GetDescription( INetURLObject(
aURL ) ) );
+ OUString aText( i_rStr.Len() ? OUString(i_rStr) : SvFileInformationManager::GetDescription(
INetURLObject( aURL ) ) );
i_rMnemns.CreateMnemonic( aText );
i_rBtn.SetText( aText );
diff --git a/framework/source/uielement/menubarmanager.cxx
b/framework/source/uielement/menubarmanager.cxx
index 4f31d40..dccc11d 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -868,7 +868,7 @@
{
sal_uInt16 nItemId = pMenu->GetItemId( nPos );
if (( pMenu->GetItemType( nPos ) != MENUITEM_SEPARATOR ) &&
- ( pMenu->GetItemText( nItemId ).Len() == 0 ))
+ ( pMenu->GetItemText( nItemId ).isEmpty()))
{
String aCommand = pMenu->GetItemCommand( nItemId );
if ( aCommand.Len() > 0 ) {
@@ -1280,7 +1280,7 @@
}
if (( pMenu->IsMenuBar() || bAccessibilityEnabled ) &&
- ( pMenu->GetItemText( nItemId ).Len() == 0 ))
+ ( pMenu->GetItemText( nItemId ).isEmpty() ))
{
if ( !aItemCommand.isEmpty() )
pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aItemCommand ));
@@ -1300,7 +1300,7 @@
{
// Retrieve module identifier from Help Command entry
OUString aModuleIdentifier( rModuleIdentifier );
- if ( pMenu->GetHelpCommand( nItemId ).Len() > 0 )
+ if ( !pMenu->GetHelpCommand( nItemId ).isEmpty() )
{
aModuleIdentifier = pMenu->GetHelpCommand( nItemId );
pMenu->SetHelpCommand( nItemId, aEmpty );
diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx
index 860190f..b8ebdf6 100644
--- a/include/svtools/imagemgr.hxx
+++ b/include/svtools/imagemgr.hxx
@@ -22,9 +22,9 @@
#include "svtools/svtdllapi.h"
#include "sal/types.h"
+#include <rtl/ustring.hxx>
class Image;
-class String;
class INetURLObject;
namespace svtools {
@@ -61,7 +61,7 @@
class SvFileInformationManager
{
private:
- SVT_DLLPRIVATE static String GetDescription_Impl( const INetURLObject& rObject, sal_Bool
bDetectFolder );
+ SVT_DLLPRIVATE static OUString GetDescription_Impl( const INetURLObject& rObject, sal_Bool
bDetectFolder );
public:
SVT_DLLPUBLIC static Image GetImage( const INetURLObject& rURL, sal_Bool bBig = sal_False );
@@ -69,9 +69,9 @@
SVT_DLLPUBLIC static Image GetImageNoDefault( const INetURLObject& rURL, sal_Bool bBig =
sal_False );
SVT_DLLPUBLIC static Image GetFolderImage( const svtools::VolumeInfo& rInfo, sal_Bool bBig =
sal_False );
- SVT_DLLPUBLIC static String GetDescription( const INetURLObject& rObject );
- SVT_DLLPUBLIC static String GetFileDescription( const INetURLObject& rObject );
- SVT_DLLPUBLIC static String GetFolderDescription( const svtools::VolumeInfo& rInfo );
+ SVT_DLLPUBLIC static OUString GetDescription( const INetURLObject& rObject );
+ SVT_DLLPUBLIC static OUString GetFileDescription( const INetURLObject& rObject );
+ SVT_DLLPUBLIC static OUString GetFolderDescription( const svtools::VolumeInfo& rInfo );
};
#endif
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 38f301d..2fc65b5 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -164,7 +164,7 @@
SAL_DLLPRIVATE void ImplFillLayoutData() const;
SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu; }
SAL_DLLPRIVATE void ImplSetSalMenu( SalMenu *pMenu );
- SAL_DLLPRIVATE const XubString& ImplGetHelpText( sal_uInt16 nItemId ) const;
+ SAL_DLLPRIVATE const OUString& ImplGetHelpText( sal_uInt16 nItemId ) const;
// returns native check and option menu symbol height in rCheckHeight and rRadioHeight
// return value is maximum width and height of checkboxes and radiobuttons
@@ -194,7 +194,7 @@
virtual void Select();
virtual void RequestHelp( const HelpEvent& rHEvt );
- void InsertItem( sal_uInt16 nItemId, const XubString& rStr,
+ void InsertItem( sal_uInt16 nItemId, const OUString& rStr,
MenuItemBits nItemBits = 0,
const OString &rIdent = OString(),
sal_uInt16 nPos = MENU_APPEND );
@@ -203,7 +203,7 @@
const OString &rIdent = OString(),
sal_uInt16 nPos = MENU_APPEND );
void InsertItem( sal_uInt16 nItemId,
- const XubString& rString, const Image& rImage,
+ const OUString& rString, const Image& rImage,
MenuItemBits nItemBits = 0,
const OString &rIdent = OString(),
sal_uInt16 nPos = MENU_APPEND );
@@ -267,8 +267,8 @@
void RemoveDisabledEntries( sal_Bool bCheckPopups = sal_True, sal_Bool
bRemoveEmptyPopups = sal_False );
sal_Bool HasValidEntries( sal_Bool bCheckPopups = sal_True );
- void SetItemText( sal_uInt16 nItemId, const XubString& rStr );
- XubString GetItemText( sal_uInt16 nItemId ) const;
+ void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetItemText( sal_uInt16 nItemId ) const;
void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
Image GetItemImage( sal_uInt16 nItemId ) const;
@@ -277,17 +277,17 @@
void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror );
sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const;
- void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
- const XubString& GetItemCommand( sal_uInt16 nItemId ) const;
+ void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
+ const OUString& GetItemCommand( sal_uInt16 nItemId ) const;
- void SetHelpText( sal_uInt16 nItemId, const XubString& rString );
- const XubString& GetHelpText( sal_uInt16 nItemId ) const;
+ void SetHelpText( sal_uInt16 nItemId, const OUString& rString );
+ const OUString& GetHelpText( sal_uInt16 nItemId ) const;
- void SetTipHelpText( sal_uInt16 nItemId, const XubString& rString );
- const XubString& GetTipHelpText( sal_uInt16 nItemId ) const;
+ void SetTipHelpText( sal_uInt16 nItemId, const OUString& rString );
+ const OUString& GetTipHelpText( sal_uInt16 nItemId ) const;
- void SetHelpCommand( sal_uInt16 nItemId, const XubString& rString );
- const XubString& GetHelpCommand( sal_uInt16 nItemId ) const;
+ void SetHelpCommand( sal_uInt16 nItemId, const OUString& rString );
+ const OUString& GetHelpCommand( sal_uInt16 nItemId ) const;
void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
OString GetHelpId( sal_uInt16 nItemId ) const;
@@ -343,8 +343,8 @@
Window* GetWindow() const { return pWindow; }
- void SetAccessibleName( sal_uInt16 nItemId, const XubString& rStr );
- XubString GetAccessibleName( sal_uInt16 nItemId ) const;
+ void SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleName( sal_uInt16 nItemId ) const;
// returns whether the item a position nItemPos is highlighted or not.
bool IsHighlighted( sal_uInt16 nItemPos ) const;
@@ -420,7 +420,7 @@
// add an arbitrary button to the menubar (will appear next to closer)
// passed link will be call with a MenuBarButtonCallbackArg on press
// passed string will be set as tooltip
- sal_uInt16 AddMenuBarButton( const Image&, const Link&, const String&, sal_uInt16
nPos = 0 );
+ sal_uInt16 AddMenuBarButton( const Image&, const Link&, const OUString&, sal_uInt16
nPos = 0 );
// set the highlight link for additional button with ID nId
// highlight link will be called with a MenuBarButtonHighlightArg
// the bHighlight member of that struct shall contain the new state
diff --git a/include/vcl/mnemonic.hxx b/include/vcl/mnemonic.hxx
index 4ec22b5..1ad0245 100644
--- a/include/vcl/mnemonic.hxx
+++ b/include/vcl/mnemonic.hxx
@@ -64,17 +64,17 @@
protected:
SAL_DLLPRIVATE sal_uInt16 ImplGetMnemonicIndex( sal_Unicode c );
- SAL_DLLPRIVATE sal_Unicode ImplFindMnemonic( const XubString& rKey );
+ SAL_DLLPRIVATE sal_Unicode ImplFindMnemonic( const OUString& rKey );
public:
MnemonicGenerator();
- void RegisterMnemonic( const XubString& rKey );
- sal_Bool CreateMnemonic( XubString& rKey );
+ void RegisterMnemonic( const OUString& rKey );
+ sal_Bool CreateMnemonic( OUString& rKey );
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification >
GetCharClass();
// returns a string where all '~'-characters and CJK mnemonics of the form (~A) are completely
removed
- static String EraseAllMnemonicChars( const String& rStr );
+ static OUString EraseAllMnemonicChars( const OUString& rStr );
};
#endif // _SV_MNEMONIC_HXX
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b76598f..82f67c6 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -625,9 +625,9 @@
long GetCtrlTextWidth( const XubString& rStr, xub_StrLen nIndex = 0,
xub_StrLen nLen = STRING_LEN,
sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const;
- static XubString GetNonMnemonicString( const XubString& rStr, xub_StrLen& rMnemonicPos );
- static XubString GetNonMnemonicString( const XubString& rStr )
- { xub_StrLen nDummy; return GetNonMnemonicString( rStr, nDummy ); }
+ static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
+ static OUString GetNonMnemonicString( const OUString& rStr )
+ { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
sal_Bool GetTextBoundRect( Rectangle& rRect,
const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0,
xub_StrLen nLen = STRING_LEN,
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx
b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 2010932..0280a38 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -984,7 +984,7 @@
for (size_t i = 0; i < sizeof (pControlsLst) / sizeof (pControlsLst[0]); ++i)
{
pControls[i]->Show(sal_True);
- String sText = pControls[i]->GetText();
+ OUString sText = pControls[i]->GetText();
if ( aMnemonicGenerator.CreateMnemonic(sText) )
pControls[i]->SetText(sText);
sal_Int32 nTextWidth = GetTextWidth(sText);
diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx
index ac5f07b..d3272e2 100644
--- a/sfx2/source/menu/virtmenu.cxx
+++ b/sfx2/source/menu/virtmenu.cxx
@@ -724,7 +724,7 @@
i != rCtrlArr.end(); ++i)
{
sal_uInt16 nSlotId = i->GetId();
- if ( !pSVMenu->GetItemCommand(nSlotId).Len() )
+ if ( pSVMenu->GetItemCommand(nSlotId).isEmpty() )
{
i->ReBind();
}
@@ -995,7 +995,7 @@
return sal_True;
}
- if ( pMenu->GetItemCommand( nSlotId ).Len() )
+ if ( !pMenu->GetItemCommand( nSlotId ).isEmpty() )
pBindings->ExecuteCommand_Impl( pMenu->GetItemCommand( nSlotId ) );
else
pBindings->Execute( nSlotId );
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 805ce6f..e2d4c69 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -341,7 +341,7 @@
for( i = 0; i < nEntryCount; ++i )
{
SvxIconChoiceCtrlEntry* pEntry = GetEntry( i );
- String aTxt = pEntry->GetText();
+ OUString aTxt = pEntry->GetText();
if( _pGenerator->CreateMnemonic( aTxt ) )
pEntry->SetText( aTxt );
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index 286fd7a..4d17a0a 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -525,7 +525,7 @@
return Image();
}
-String SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObject, sal_Bool
bDetectFolder )
+OUString SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObject, sal_Bool
bDetectFolder )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "hb93813",
"SvFileInformationManager::GetDescription_Impl()" );
@@ -636,17 +636,17 @@
return GetImageFromList_Impl( nImage, bBig );
}
-String SvFileInformationManager::GetDescription( const INetURLObject& rObject )
+OUString SvFileInformationManager::GetDescription( const INetURLObject& rObject )
{
return SvFileInformationManager::GetDescription_Impl( rObject, sal_True );
}
-String SvFileInformationManager::GetFileDescription( const INetURLObject& rObject )
+OUString SvFileInformationManager::GetFileDescription( const INetURLObject& rObject )
{
return SvFileInformationManager::GetDescription_Impl( rObject, sal_False );
}
-String SvFileInformationManager::GetFolderDescription( const svtools::VolumeInfo& rInfo )
+OUString SvFileInformationManager::GetFolderDescription( const svtools::VolumeInfo& rInfo )
{
sal_uInt16 nResId = STR_DESCRIPTION_FOLDER;
if ( rInfo.m_bIsRemote )
diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx
index ad63ad9..901a076 100644
--- a/svtools/source/uno/contextmenuhelper.cxx
+++ b/svtools/source/uno/contextmenuhelper.cxx
@@ -588,7 +588,7 @@
else
pMenu->SetItemImage( nId, Image() );
- if ( pMenu->GetItemText( nId ).Len() == 0 )
+ if ( pMenu->GetItemText( nId ).getLength() == 0 )
{
OUString aLabel( getLabelFromCommandURL( aCmdURL ));
pMenu->SetItemText( nId, aLabel );
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index ab72e18..8a557ff 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -6221,9 +6221,9 @@
long nTextHeight = rTargetDevice.GetTextHeight();
TextAlign eAlign = rTargetDevice.GetTextAlign();
- xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+ sal_Int32 nMnemonicPos = -1;
- String aStr = rOrigStr;
+ OUString aStr = rOrigStr;
if ( nStyle & TEXT_DRAW_MNEMONIC )
aStr = GetNonMnemonicString( aStr, nMnemonicPos );
@@ -6255,7 +6255,7 @@
nFormatLines = nLines-1;
pLineInfo = aMultiLineInfo.GetLine( nFormatLines );
- aLastLine = convertLineEnd(aStr.Copy(pLineInfo->GetIndex()), LINEEND_LF);
+ aLastLine = convertLineEnd(aStr.copy(pLineInfo->GetIndex()), LINEEND_LF);
// Replace all LineFeeds with Spaces
xub_StrLen nLastLineLen = aLastLine.Len();
for ( i = 0; i < nLastLineLen; i++ )
@@ -6355,7 +6355,7 @@
aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, nStyle, _rLayout );
nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT);
nStyle |= TEXT_DRAW_LEFT;
- nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.Len() );
+ nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.getLength() );
}
}
else
@@ -6386,8 +6386,8 @@
long nMnemonicWidth = 0;
if ( nMnemonicPos != STRING_NOTFOUND )
{
- sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * aStr.Len() );
- /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() );
+ sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) *
aStr.getLength() );
+ /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0,
aStr.getLength() );
long lc_x1 = pCaretXArray[2*(nMnemonicPos)];
long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1];
nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 -
lc_x2)) );
@@ -6794,8 +6794,8 @@
if( (sal_uLong)nIndex+nLen >= rStr.Len() )
nLen = rStr.Len() - nIndex;
- XubString aStr = rStr;
- xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+ OUString aStr = rStr;
+ sal_Int32 nMnemonicPos = -1;
long nMnemonicX = 0;
long nMnemonicY = 0;
@@ -6909,15 +6909,19 @@
if ( nStyle & TEXT_DRAW_MNEMONIC )
{
- xub_StrLen nMnemonicPos;
- XubString aStr = GetNonMnemonicString( rStr, nMnemonicPos );
- if ( nMnemonicPos != STRING_NOTFOUND )
+ sal_Int32 nMnemonicPos;
+ OUString aStr = GetNonMnemonicString( rStr, nMnemonicPos );
+ if ( nMnemonicPos >= 0 )
{
- if ( nMnemonicPos < nIndex )
- nIndex--;
- else if ( (nLen < STRING_LEN) &&
- (nMnemonicPos >= nIndex) && (nMnemonicPos < (sal_uLong)(nIndex+nLen)) )
- nLen--;
+ if ( nMnemonicPos < (sal_Int32)nIndex )
+ {
+ nIndex -= 1;
+ }
+ else if ( (nLen >= 0) &&
+ (nMnemonicPos >= nIndex) && (nMnemonicPos < (nIndex+nLen)) )
+ {
+ nLen -= 1;
+ }
}
return GetTextWidth( aStr, nIndex, nLen );
}
@@ -6925,27 +6929,27 @@
return GetTextWidth( rStr, nIndex, nLen );
}
-String OutputDevice::GetNonMnemonicString( const String& rStr, xub_StrLen& rMnemonicPos )
+OUString OutputDevice::GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos )
{
- String aStr = rStr;
- xub_StrLen nLen = aStr.Len();
- xub_StrLen i = 0;
+ OUStringBuffer aStr(rStr);
+ sal_Int32 nLen = aStr.getLength();
+ sal_Int32 i = 0;
- rMnemonicPos = STRING_NOTFOUND;
+ rMnemonicPos = -1;
while ( i < nLen )
{
- if ( aStr.GetChar( i ) == '~' )
+ if ( aStr[ i ] == '~' )
{
- if ( aStr.GetChar( i+1 ) != '~' )
+ if ( aStr[ i+1 ] != '~' )
{
- if ( rMnemonicPos == STRING_NOTFOUND )
+ if ( rMnemonicPos == -1 )
rMnemonicPos = i;
- aStr.Erase( i, 1 );
+ aStr.remove( i, 1 );
nLen--;
}
else
{
- aStr.Erase( i, 1 );
+ aStr.remove( i, 1 );
nLen--;
i++;
}
@@ -6954,7 +6958,7 @@
i++;
}
- return aStr;
+ return aStr.makeStringAndClear();
}
int OutputDevice::GetDevFontCount() const
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index ed69f76..2c63c18 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8100,9 +8100,9 @@
Point aPos = rRect.TopLeft();
long nTextHeight = m_pReferenceDevice->GetTextHeight();
- xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+ sal_Int32 nMnemonicPos = -1;
- String aStr = rOrigStr;
+ OUString aStr = rOrigStr;
if ( nStyle & TEXT_DRAW_MNEMONIC )
aStr = m_pReferenceDevice->GetNonMnemonicString( aStr, nMnemonicPos );
@@ -8132,7 +8132,7 @@
nFormatLines = nLines-1;
pLineInfo = aMultiLineInfo.GetLine( nFormatLines );
- aLastLine = convertLineEnd(aStr.Copy(pLineInfo->GetIndex()), LINEEND_LF);
+ aLastLine = convertLineEnd(aStr.copy(pLineInfo->GetIndex()), LINEEND_LF);
// replace line feed by space
aLastLine = aLastLine.replace('\n', ' ');
aLastLine = m_pReferenceDevice->GetEllipsisString( aLastLine, nWidth, nStyle );
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index cd79e74..067d58c 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -221,7 +221,7 @@
pChild = pGetChild->ImplGetWindow();
if ( ImplIsMnemonicCtrl( pChild ) )
{
- XubString aText = pChild->GetText();
+ OUString aText = pChild->GetText();
if ( aMnemonicGenerator.CreateMnemonic( aText ) )
pChild->SetText( aText );
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 2d39189..508955e 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -113,14 +113,14 @@
MenuItemBits nBits; // MenuItem-Bits
Menu* pSubMenu; // Pointer to SubMenu
Menu* pAutoSubMenu; // Pointer to SubMenu from Resource
- XubString aText; // Menu-Text
- XubString aHelpText; // Help-String
- XubString aTipHelpText; // TipHelp-String (eg, expanded filenames)
- XubString aCommandStr; // CommandString
- XubString aHelpCommandStr; // Help command string (to reference external help)
+ OUString aText; // Menu-Text
+ OUString aHelpText; // Help-String
+ OUString aTipHelpText; // TipHelp-String (eg, expanded filenames)
+ OUString aCommandStr; // CommandString
+ OUString aHelpCommandStr; // Help command string (to reference external help)
OString sIdent;
OString aHelpId; // Help-Id
- sal_uLong nUserValue; // User value
+ sal_uLong nUserValue; // User value
Image aImage; // Image
KeyCode aAccelKey; // Accelerator-Key
sal_Bool bChecked; // Checked
@@ -130,15 +130,15 @@
sal_Bool bMirrorMode;
long nItemImageAngle;
Size aSz; // only temporarily valid
- XubString aAccessibleName; // accessible name
- XubString aAccessibleDescription; // accessible description
+ OUString aAccessibleName; // accessible name
+ OUString aAccessibleDescription; // accessible description
SalMenuItem* pSalMenuItem; // access to native menu
MenuItemData() :
pSalMenuItem ( NULL )
{}
- MenuItemData( const XubString& rStr, const Image& rImage ) :
+ MenuItemData( const OUString& rStr, const Image& rImage ) :
aText( rStr ),
aImage( rImage ),
pSalMenuItem ( NULL )
@@ -178,7 +178,7 @@
sal_uInt16 nId,
MenuItemType eType,
MenuItemBits nBits,
- const XubString& rStr,
+ const OUString& rStr,
const Image& rImage,
Menu* pMenu,
size_t nPos,
@@ -226,7 +226,7 @@
sal_uInt16 nId,
MenuItemType eType,
MenuItemBits nBits,
- const XubString& rStr,
+ const OUString& rStr,
const Image& rImage,
Menu* pMenu,
size_t nPos,
@@ -289,7 +289,7 @@
aSalMIData.eType = MENUITEM_SEPARATOR;
aSalMIData.nBits = 0;
aSalMIData.pMenu = NULL;
- aSalMIData.aText = XubString();
+ aSalMIData.aText = OUString();
aSalMIData.aImage = Image();
// Native-support: returns NULL if not supported
@@ -367,11 +367,11 @@
MenuItemData* pData = maItemList[ rPos ];
if ( pData->bEnabled )
{
- sal_uInt16 n = pData->aText.Search( '~' );
- if ( n != STRING_NOTFOUND )
+ sal_Int32 n = pData->aText.indexOf( '~' );
+ if ( n >= 0 )
{
KeyCode mnKeyCode;
- sal_Unicode mnUnicode = pData->aText.GetChar(n+1);
+ sal_Unicode mnUnicode = pData->aText[n+1];
Window* pDefWindow = ImplGetDefaultWindow();
if( ( pDefWindow
&& pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( mnUnicode,
@@ -427,15 +427,15 @@
MenuItemData* pData = maItemList[ --nPos ];
if ( pData->bEnabled )
{
- sal_uInt16 n = pData->aText.Search( '~' );
- if ( n != STRING_NOTFOUND )
+ sal_Int32 n = pData->aText.indexOf( '~' );
+ if ( n >= 0 )
{
KeyCode mnKeyCode;
// if MapUnicodeToKeyCode fails or is unsupported we try the pure ascii mapping of
the keycodes
// so we have working shortcuts when ascii mnemonics are used
Window* pDefWindow = ImplGetDefaultWindow();
if( ( pDefWindow
- && pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( pData->aText.GetChar(n+1),
+ && pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( pData->aText[n+1],
Application::GetSettings().GetUILanguageTag().getLanguageType(),
mnKeyCode )
&& aKeyCode.GetCode() == mnKeyCode.GetCode()
)
@@ -738,7 +738,7 @@
Size MinCloseButtonSize();
// add an arbitrary button to the menubar (will appear next to closer)
- sal_uInt16 AddMenuBarButton( const Image&, const Link&, const String&, sal_uInt16
nPos );
+ sal_uInt16 AddMenuBarButton( const Image&, const Link&, const OUString&,
sal_uInt16 nPos );
void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link& );
Rectangle GetMenuBarButtonRectPixel( sal_uInt16 nId );
void RemoveMenuBarButton( sal_uInt16 nId );
@@ -766,7 +766,7 @@
// convert data
if ( !pData->aImage )
pData->eType = MENUITEM_STRING;
- else if ( !pData->aText.Len() )
+ else if ( pData->aText.isEmpty() )
pData->eType = MENUITEM_IMAGE;
else
pData->eType = MENUITEM_STRINGIMAGE;
@@ -807,7 +807,7 @@
aPos = rHEvt.GetMousePosPixel();
Rectangle aRect( aPos, Size() );
- if( pMenu->GetHelpText( nId ).Len() )
+ if( !pMenu->GetHelpText( nId ).isEmpty() )
Help::ShowBalloon( pMenuWindow, aPos, pMenu->GetHelpText( nId ) );
else
{
@@ -838,12 +838,12 @@
{
// is an id available, then call help with the id, otherwise
// use help-index
- String aCommand = pMenu->GetItemCommand( nId );
+ OUString aCommand = pMenu->GetItemCommand( nId );
OString aHelpId( pMenu->GetHelpId( nId ) );
if( aHelpId.isEmpty() )
aHelpId = OOO_HELP_INDEX;
- if ( aCommand.Len() )
+ if ( !aCommand.isEmpty() )
pHelp->Start( aCommand, NULL );
else
pHelp->Start( OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), NULL );
@@ -1199,7 +1199,7 @@
maEventListeners.removeListener( rEventListener );
}
-void Menu::InsertItem(sal_uInt16 nItemId, const XubString& rStr, MenuItemBits nItemBits,
+void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nItemBits,
const OString &rIdent, sal_uInt16 nPos)
{
DBG_ASSERT( nItemId, "Menu::InsertItem(): ItemId == 0" );
@@ -1232,13 +1232,13 @@
void Menu::InsertItem(sal_uInt16 nItemId, const Image& rImage,
MenuItemBits nItemBits, const OString &rIdent, sal_uInt16 nPos)
{
- InsertItem(nItemId, ImplGetSVEmptyStr(), nItemBits, rIdent, nPos);
+ InsertItem(nItemId, OUString::getEmptyOUString(), nItemBits, rIdent, nPos);
SetItemImage( nItemId, rImage );
}
-void Menu::InsertItem(sal_uInt16 nItemId, const XubString& rStr,
- const Image& rImage, MenuItemBits nItemBits,
- const OString &rIdent, sal_uInt16 nPos)
+void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr,
+ const Image& rImage, MenuItemBits nItemBits,
+ const OString &rIdent, sal_uInt16 nPos)
{
InsertItem(nItemId, rStr, nItemBits, rIdent, nPos);
SetItemImage( nItemId, rImage );
@@ -1267,7 +1267,7 @@
if ( nObjMask & RSC_MENUITEM_STATUS )
nStatus = sal::static_int_cast<MenuItemBits>(ReadLongRes());
- String aText;
+ OUString aText;
if ( nObjMask & RSC_MENUITEM_TEXT )
aText = ReadStringRes();
@@ -1277,7 +1277,7 @@
if ( !bSep )
{
Bitmap aBmp( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) );
- if ( aText.Len() )
+ if ( !aText.isEmpty() )
InsertItem( nItemId, aText, aBmp, nStatus, OString(), nPos );
else
InsertItem( nItemId, aBmp, nStatus, OString(), nPos );
@@ -1289,7 +1289,7 @@
if ( bSep )
InsertSeparator(OString(), nPos);
- String aHelpText;
+ OUString aHelpText;
if ( nObjMask & RSC_MENUITEM_HELPTEXT )
{
aHelpText = ReadStringRes();
@@ -1325,7 +1325,7 @@
}
if ( nObjMask & RSC_MENUITEM_COMMAND )
{
- String aCommandStr = ReadStringRes();
+ OUString aCommandStr = ReadStringRes();
if ( !bSep )
SetItemCommand( nItemId, aCommandStr );
}
@@ -1672,11 +1672,11 @@
MenuItemData* pData = pItemList->GetData( nItemId );
if( pData )
{
- sal_uInt16 nPos = pData->aText.Search( '~' );
- if( nPos != STRING_NOTFOUND && nPos < pData->aText.Len()-1 )
+ sal_Int32 nPos = pData->aText.indexOf( '~' );
+ if( nPos >=0 && nPos < pData->aText.getLength()-1 )
{
sal_uInt16 nCode = 0;
- sal_Unicode cAccel = pData->aText.GetChar( nPos+1 );
+ sal_Unicode cAccel = pData->aText[nPos+1 ];
if( cAccel >= 'a' && cAccel <= 'z' )
nCode = KEY_A + (cAccel-'a');
else if( cAccel >= 'A' && cAccel <= 'Z' )
@@ -1834,7 +1834,7 @@
}
}
-void Menu::SetItemText( sal_uInt16 nItemId, const XubString& rStr )
+void Menu::SetItemText( sal_uInt16 nItemId, const OUString& rStr )
{
size_t nPos;
MenuItemData* pData = pItemList->GetData( nItemId, nPos );
@@ -1842,7 +1842,7 @@
if ( !pData )
return;
- if ( !rStr.Equals( pData->aText ) )
+ if ( !(rStr == pData->aText ) )
{
pData->aText = rStr;
ImplSetMenuItemData( pData );
@@ -1863,7 +1863,7 @@
}
}
-XubString Menu::GetItemText( sal_uInt16 nItemId ) const
+OUString Menu::GetItemText( sal_uInt16 nItemId ) const
{
size_t nPos;
MenuItemData* pData = pItemList->GetData( nItemId, nPos );
@@ -1871,7 +1871,7 @@
if ( pData )
return pData->aText;
else
- return ImplGetSVEmptyStr();
+ return OUString::getEmptyOUString();
}
void Menu::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
@@ -1975,7 +1975,7 @@
return sal_False;
}
-void Menu::SetItemCommand( sal_uInt16 nItemId, const String& rCommand )
+void Menu::SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand )
{
size_t nPos;
MenuItemData* pData = pItemList->GetData( nItemId, nPos );
@@ -1984,17 +1984,17 @@
pData->aCommandStr = rCommand;
}
-const XubString& Menu::GetItemCommand( sal_uInt16 nItemId ) const
+const OUString& Menu::GetItemCommand( sal_uInt16 nItemId ) const
{
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
return pData->aCommandStr;
else
- return ImplGetSVEmptyStr();
+ return OUString::getEmptyOUString();
}
-void Menu::SetHelpCommand( sal_uInt16 nItemId, const XubString& rStr )
+void Menu::SetHelpCommand( sal_uInt16 nItemId, const OUString& rStr )
{
MenuItemData* pData = pItemList->GetData( nItemId );
@@ -2002,17 +2002,17 @@
pData->aHelpCommandStr = rStr;
}
-const XubString& Menu::GetHelpCommand( sal_uInt16 nItemId ) const
+const OUString& Menu::GetHelpCommand( sal_uInt16 nItemId ) const
{
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
return pData->aHelpCommandStr;
else
- return ImplGetSVEmptyStr();
+ return OUString::getEmptyOUString();
}
-void Menu::SetHelpText( sal_uInt16 nItemId, const XubString& rStr )
+void Menu::SetHelpText( sal_uInt16 nItemId, const OUString& rStr )
{
MenuItemData* pData = pItemList->GetData( nItemId );
@@ -2020,22 +2020,22 @@
pData->aHelpText = rStr;
}
-const XubString& Menu::ImplGetHelpText( sal_uInt16 nItemId ) const
+const OUString& Menu::ImplGetHelpText( sal_uInt16 nItemId ) const
{
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
{
- if ( !pData->aHelpText.Len() &&
- (( !pData->aHelpId.isEmpty() ) || ( pData->aCommandStr.Len() )))
+ if ( pData->aHelpText.isEmpty() &&
+ (( !pData->aHelpId.isEmpty() ) || ( !pData->aCommandStr.isEmpty() )))
{
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
- if ( pData->aCommandStr.Len() )
+ if ( !pData->aCommandStr.isEmpty() )
pData->aHelpText = pHelp->GetHelpText( pData->aCommandStr, NULL );
- if( !pData->aHelpText.Len() && !pData->aHelpId.isEmpty() )
+ if( pData->aHelpText.isEmpty() && !pData->aHelpId.isEmpty() )
pData->aHelpText = pHelp->GetHelpText( OStringToOUString( pData->aHelpId,
RTL_TEXTENCODING_UTF8 ), NULL );
}
}
@@ -2043,15 +2043,15 @@
return pData->aHelpText;
}
else
- return ImplGetSVEmptyStr();
+ return OUString::getEmptyOUString();
}
-const XubString& Menu::GetHelpText( sal_uInt16 nItemId ) const
+const OUString& Menu::GetHelpText( sal_uInt16 nItemId ) const
{
return ImplGetHelpText( nItemId );
}
-void Menu::SetTipHelpText( sal_uInt16 nItemId, const XubString& rStr )
+void Menu::SetTipHelpText( sal_uInt16 nItemId, const OUString& rStr )
{
MenuItemData* pData = pItemList->GetData( nItemId );
@@ -2059,14 +2059,14 @@
pData->aTipHelpText = rStr;
}
-const XubString& Menu::GetTipHelpText( sal_uInt16 nItemId ) const
+const OUString& Menu::GetTipHelpText( sal_uInt16 nItemId ) const
{
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
return pData->aTipHelpText;
else
- return ImplGetSVEmptyStr();
+ return OUString::getEmptyOUString();
}
void Menu::SetHelpId( sal_uInt16 nItemId, const OString& rHelpId )
@@ -2473,7 +2473,7 @@
// Accel
if ( !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() )
{
- String aName = pData->aAccelKey.GetName();
+ OUString aName = pData->aAccelKey.GetName();
long nAccWidth = pWin->GetTextWidth( aName );
nAccWidth += nExtra;
nWidth += nAccWidth;
@@ -2594,20 +2594,20 @@
}
}
-static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_nMaxWidth )
+static OUString getShortenedString( const OUString& i_rLong, Window* i_pWin, long i_nMaxWidth )
{
- xub_StrLen nPos = STRING_NOTFOUND;
- String aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) );
+ sal_Int32 nPos = -1;
+ OUString aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) );
aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS );
// re-insert mnemonic
- if( nPos != STRING_NOTFOUND )
+ if( nPos >= 0 )
{
- if( nPos < aNonMnem.Len() && i_rLong.GetChar(nPos+1) == aNonMnem.GetChar(nPos) )
+ if( nPos < !aNonMnem.isEmpty() && i_rLong[nPos+1] == aNonMnem[nPos] )
{
- OUStringBuffer aBuf( i_rLong.Len() );
- aBuf.append( aNonMnem.GetBuffer(), nPos );
+ OUStringBuffer aBuf( i_rLong.getLength() );
+ aBuf.append( aNonMnem.getStr(), nPos );
aBuf.append( sal_Unicode('~') );
- aBuf.append( aNonMnem.GetBuffer()+nPos );
+ aBuf.append( aNonMnem.getStr() + nPos );
aNonMnem = aBuf.makeStringAndClear();
}
}
@@ -2838,15 +2838,15 @@
long nMaxItemTextWidth = aOutSz.Width() - aTmpPos.X() - nExtra - nOuterSpaceX;
if( !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() )
{
- XubString aAccText = pData->aAccelKey.GetName();
+ OUString aAccText = pData->aAccelKey.GetName();
nMaxItemTextWidth -= pWin->GetTextWidth( aAccText ) + 3*nExtra;
}
if( !bIsMenuBar && pData->pSubMenu )
{
nMaxItemTextWidth -= nFontHeight - nExtra;
}
- String aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth )
);
- pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector,
pDisplayText );
+ OUString aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth
) );
+ pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.getLength(), nStyle,
pVector, pDisplayText );
if( bSetTmpBackground )
pWin->SetBackground();
}
@@ -2854,14 +2854,14 @@
// Accel
if ( !bLayout && !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled()
)
{
- XubString aAccText = pData->aAccelKey.GetName();
+ OUString aAccText = pData->aAccelKey.GetName();
aTmpPos.X() = aOutSz.Width() - pWin->GetTextWidth( aAccText );
aTmpPos.X() -= 4*nExtra;
aTmpPos.X() -= nOuterSpaceX;
aTmpPos.Y() = aPos.Y();
aTmpPos.Y() += nTextOffsetY;
- pWin->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle );
+ pWin->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.getLength(), nTextStyle );
}
// SubMenu?
@@ -3190,26 +3190,26 @@
return aRet;
}
-void Menu::SetAccessibleName( sal_uInt16 nItemId, const XubString& rStr )
+void Menu::SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr )
{
size_t nPos;
MenuItemData* pData = pItemList->GetData( nItemId, nPos );
- if ( pData && !rStr.Equals( pData->aAccessibleName ) )
+ if ( pData && !(rStr == pData->aAccessibleName ) )
{
pData->aAccessibleName = rStr;
ImplCallEventListeners( VCLEVENT_MENU_ACCESSIBLENAMECHANGED, nPos );
}
}
-XubString Menu::GetAccessibleName( sal_uInt16 nItemId ) const
+OUString Menu::GetAccessibleName( sal_uInt16 nItemId ) const
{
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
return pData->aAccessibleName;
else
- return ImplGetSVEmptyStr();
+ return OUString::getEmptyOUString();
}
void Menu::ImplSetSalMenu( SalMenu *pSalMenu )
@@ -3465,7 +3465,7 @@
return sal_False;
}
-sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const String&
i_rToolTip, sal_uInt16 i_nPos )
+sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const OUString&
i_rToolTip, sal_uInt16 i_nPos )
{
return pWindow ? static_cast<MenuBarWindow*>(pWindow)->AddMenuBarButton( i_rImage, i_rLink,
i_rToolTip, i_nPos ) : 0;
}
@@ -6042,7 +6042,7 @@
return xAcc;
}
-sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const
String& i_rToolTip, sal_uInt16 i_nPos )
+sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i_rLink, const
OUString& i_rToolTip, sal_uInt16 i_nPos )
{
// find first free button id
sal_uInt16 nId = IID_DOCUMENTCLOSE;
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index 45ceac4..653d299 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -64,12 +64,12 @@
// -----------------------------------------------------------------------
-sal_Unicode MnemonicGenerator::ImplFindMnemonic( const XubString& rKey )
+sal_Unicode MnemonicGenerator::ImplFindMnemonic( const OUString& rKey )
{
- xub_StrLen nIndex = 0;
- while ( (nIndex = rKey.Search( MNEMONIC_CHAR, nIndex )) != STRING_NOTFOUND )
+ sal_Int32 nIndex = 0;
+ while ( (nIndex = rKey.indexOf( MNEMONIC_CHAR, nIndex )) >= 0 )
{
- sal_Unicode cMnemonic = rKey.GetChar( nIndex+1 );
+ sal_Unicode cMnemonic = rKey[nIndex+1 ];
if ( cMnemonic != MNEMONIC_CHAR )
return cMnemonic;
nIndex += 2;
@@ -80,7 +80,7 @@
// -----------------------------------------------------------------------
-void MnemonicGenerator::RegisterMnemonic( const XubString& rKey )
+void MnemonicGenerator::RegisterMnemonic( const OUString& rKey )
{
const ::com::sun::star::lang::Locale& rLocale =
Application::GetSettings().GetUILanguageTag().getLocale();
uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass();
@@ -89,7 +89,7 @@
if ( !xCharClass.is() )
return;
- XubString aKey = xCharClass->toUpper( rKey, 0, rKey.Len(), rLocale );
+ OUString aKey = xCharClass->toUpper( rKey, 0, rKey.getLength(), rLocale );
// If we find a Mnemonic, set the flag. In other case count the
// characters, because we need this to set most as possible
@@ -103,11 +103,11 @@
}
else
{
- xub_StrLen nIndex = 0;
- xub_StrLen nLen = aKey.Len();
+ sal_Int32 nIndex = 0;
+ sal_Int32 nLen = aKey.getLength();
while ( nIndex < nLen )
{
- sal_Unicode c = aKey.GetChar( nIndex );
+ sal_Unicode c = aKey[nIndex];
sal_uInt16 nMnemonicIndex = ImplGetMnemonicIndex( c );
if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
@@ -123,9 +123,9 @@
// -----------------------------------------------------------------------
-sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
+sal_Bool MnemonicGenerator::CreateMnemonic( OUString& rKey )
{
- if ( !rKey.Len() || ImplFindMnemonic( rKey ) )
+ if ( rKey.isEmpty() || ImplFindMnemonic( rKey ) )
return sal_False;
const ::com::sun::star::lang::Locale& rLocale =
Application::GetSettings().GetUILanguageTag().getLocale();
@@ -135,10 +135,10 @@
if ( !xCharClass.is() )
return sal_False;
- XubString aKey = xCharClass->toUpper( rKey, 0, rKey.Len(), rLocale );
+ OUString aKey = xCharClass->toUpper( rKey, 0, rKey.getLength(), rLocale );
sal_Bool bChanged = sal_False;
- xub_StrLen nLen = aKey.Len();
+ sal_Int32 nLen = aKey.getLength();
bool bCJK = MsLangId::isCJK(Application::GetSettings().GetUILanguageTag().getLanguageType());
@@ -151,12 +151,12 @@
{
sal_Bool bLatinOnly = sal_True;
sal_Bool bMnemonicIndexFound = sal_False;
- sal_Unicode c;
- xub_StrLen nIndex;
+ sal_Unicode c;
+ sal_Int32 nIndex;
for( nIndex=0; nIndex < nLen; nIndex++ )
{
- c = aKey.GetChar( nIndex );
+ c = aKey[ nIndex ];
if ( ((c >= 0x3000) && (c <= 0xD7FF)) || // cjk
((c >= 0xFF61) && (c <= 0xFFDC)) ) // halfwidth forms
{
@@ -172,15 +172,15 @@
int nCJK = 0;
- sal_uInt16 nMnemonicIndex;
+ sal_uInt16 nMnemonicIndex;
sal_Unicode c;
- xub_StrLen nIndex = 0;
+ sal_Int32 nIndex = 0;
if( !bCJK )
{
// 1) first try the first character of a word
do
{
- c = aKey.GetChar( nIndex );
+ c = aKey[ nIndex ];
if ( nCJK != 2 )
{
@@ -201,7 +201,9 @@
if ( maMnemonics[nMnemonicIndex] )
{
maMnemonics[nMnemonicIndex] = 0;
- rKey.Insert( MNEMONIC_CHAR, nIndex );
+ OUStringBuffer sKeyBuff(rKey);
+ sKeyBuff.insert( nIndex, MNEMONIC_CHAR );
+ rKey = sKeyBuff.makeStringAndClear();
bChanged = sal_True;
break;
}
@@ -211,7 +213,7 @@
do
{
nIndex++;
- c = aKey.GetChar( nIndex );
+ c = aKey[ nIndex ];
if ( c == ' ' )
break;
}
@@ -225,11 +227,11 @@
{
sal_uInt16 nBestCount = 0xFFFF;
sal_uInt16 nBestMnemonicIndex = 0;
- xub_StrLen nBestIndex = 0;
+ sal_Int32 nBestIndex = 0;
nIndex = 0;
do
{
- c = aKey.GetChar( nIndex );
+ c = aKey[ nIndex ];
nMnemonicIndex = ImplGetMnemonicIndex( c );
if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
{
@@ -253,7 +255,9 @@
if ( nBestCount != 0xFFFF )
{
maMnemonics[nBestMnemonicIndex] = 0;
- rKey.Insert( MNEMONIC_CHAR, nBestIndex );
+ OUStringBuffer sKeyBuff(rKey);
+ sKeyBuff.insert( nBestIndex, MNEMONIC_CHAR );
+ rKey = sKeyBuff.makeStringAndClear();
bChanged = sal_True;
}
}
@@ -262,7 +266,7 @@
nCJK = 1;
// 3) Add English Mnemonic for CJK Text
- if ( !bChanged && (nCJK == 1) && rKey.Len() )
+ if ( !bChanged && (nCJK == 1) && !rKey.isEmpty() )
{
// Append Ascii Mnemonic
for ( c = MNEMONIC_RANGE_2_START; c <= MNEMONIC_RANGE_2_END; c++ )
@@ -276,32 +280,36 @@
OUString aStr = OUStringBuffer().
append('(').append(MNEMONIC_CHAR).append(c).
append(')').makeStringAndClear();
- nIndex = rKey.Len();
+ nIndex = rKey.getLength();
if( nIndex >= 2 )
{
- static sal_Unicode cGreaterGreater[] = { 0xFF1E, 0xFF1E };
- if ( rKey.EqualsAscii( ">>", nIndex-2, 2 ) ||
- rKey.Equals( cGreaterGreater, nIndex-2, 2 ) )
+ if ( (rKey[nIndex-2] == '>' && rKey[nIndex-1] == '>') ||
+ (rKey[nIndex-2] == (sal_Unicode)0xFF1E && rKey[nIndex-1] ==
(sal_Unicode)0xFF1E))
+ {
nIndex -= 2;
+ }
}
if( nIndex >= 3 )
{
- static sal_Unicode cDotDotDot[] = { 0xFF0E, 0xFF0E, 0xFF0E };
- if ( rKey.EqualsAscii( "...", nIndex-3, 3 ) ||
- rKey.Equals( cDotDotDot, nIndex-3, 3 ) )
+ if ( (rKey[nIndex-3] == (sal_Unicode)'.' && rKey[nIndex-2] ==
(sal_Unicode)'.' && rKey[nIndex-1] == (sal_Unicode)'.') ||
+ (rKey[nIndex-3] == (sal_Unicode)0xFF0E && rKey[nIndex-2] ==
(sal_Unicode)0xFF0E && rKey[nIndex-1] == (sal_Unicode)0xFF0E))
+ {
nIndex -= 3;
+ }
}
if( nIndex >= 1)
{
- sal_Unicode cLastChar = rKey.GetChar( nIndex-1 );
+ sal_Unicode cLastChar = rKey[ nIndex-1 ];
if ( (cLastChar == ':') || (cLastChar == 0xFF1A) ||
(cLastChar == '.') || (cLastChar == 0xFF0E) ||
(cLastChar == '?') || (cLastChar == 0xFF1F) ||
(cLastChar == ' ') )
nIndex--;
}
- rKey.Insert( aStr, nIndex );
- bChanged = sal_True;
+ OUStringBuffer sKeyBuff(rKey);
+ sKeyBuff.insert( nIndex, aStr );
+ rKey = sKeyBuff.makeStringAndClear();
+ bChanged = sal_True;
break;
}
}
@@ -358,25 +366,25 @@
// -----------------------------------------------------------------------
-String MnemonicGenerator::EraseAllMnemonicChars( const String& rStr )
+OUString MnemonicGenerator::EraseAllMnemonicChars( const OUString& rStr )
{
- String aStr = rStr;
- xub_StrLen nLen = aStr.Len();
- xub_StrLen i = 0;
+ OUStringBuffer aStr(rStr);
+ sal_Int32 nLen = rStr.getLength();
+ sal_Int32 i = 0;
while ( i < nLen )
{
- if ( aStr.GetChar( i ) == '~' )
+ if ( aStr[ i ] == '~' )
{
// check for CJK-style mnemonic
if( i > 0 && (i+2) < nLen )
{
- sal_Unicode c = aStr.GetChar(i+1);
- if( aStr.GetChar( i-1 ) == '(' &&
- aStr.GetChar( i+2 ) == ')' &&
+ sal_Unicode c = aStr[i+1];
+ if( aStr[ i-1 ] == '(' &&
+ aStr[ i+2 ] == ')' &&
c >= MNEMONIC_RANGE_2_START && c <= MNEMONIC_RANGE_2_END )
{
- aStr.Erase( i-1, 4 );
+ aStr = aStr.remove( i-1 , 4);
nLen -= 4;
i--;
continue;
@@ -384,14 +392,14 @@
}
// remove standard mnemonics
- aStr.Erase( i, 1 );
+ aStr.remove( i, 1 );
nLen--;
}
else
i++;
}
- return aStr;
+ return aStr.makeStringAndClear();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 9e27767..709e8e8 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -356,7 +356,7 @@
// checkbox length including a temporary mnemonic, the correct auto mnemonic will be
// generated later in the dialog (see init_show)
- String aMnemonicString( maCheckBoxText );
+ OUString aMnemonicString( maCheckBoxText );
if( GetSettings().GetStyleSettings().GetAutoMnemonic() )
{
if( aMnemonicString == GetNonMnemonicString( maCheckBoxText ) )
--
To view, visit https://gerrit.libreoffice.org/4260
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib96e44732db8d9172bf1f804a20281343766ed33
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>
Context
- [PATCH] String=>OUString yet another random batch starting from svto... · Norbert Thiebaud (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.