[Libreoffice-commits] core.git: 10 commits - cui/source framework/source include/vcl reportdesign/source sd/source sfx2/source svtools/source svx/source sw/source vcl/inc vcl/source
Noel Grandin
noel at peralex.com
Wed Jul 31 04:39:22 PDT 2013
cui/source/factory/init.cxx | 2
framework/source/uielement/menubarmanager.cxx | 6
include/vcl/edit.hxx | 2
include/vcl/menu.hxx | 28 ++--
include/vcl/mnemonic.hxx | 8 -
include/vcl/msgbox.hxx | 2
include/vcl/outdev.hxx | 4
include/vcl/pdfwriter.hxx | 30 ++--
include/vcl/status.hxx | 20 +--
include/vcl/tabctrl.hxx | 10 -
include/vcl/toolbox.hxx | 22 +--
include/vcl/txtattr.hxx | 12 -
reportdesign/source/ui/dlg/GroupsSorting.cxx | 7 -
sd/source/ui/app/tmplctrl.cxx | 2
sfx2/source/appl/appinit.cxx | 4
svtools/source/contnr/imivctl1.cxx | 7 -
svtools/source/uno/contextmenuhelper.cxx | 2
svx/source/stbctrls/insctrl.cxx | 2
sw/source/ui/utlui/bookctrl.cxx | 2
sw/source/ui/utlui/tmplctrl.cxx | 2
vcl/inc/toolbox.h | 14 +-
vcl/source/control/edit.cxx | 8 -
vcl/source/control/tabctrl.cxx | 82 ++++++-------
vcl/source/gdi/outdev3.cxx | 24 +--
vcl/source/gdi/pdfwriter.cxx | 14 +-
vcl/source/gdi/pdfwriter_impl.cxx | 132 ++++++++++-----------
vcl/source/gdi/pdfwriter_impl.hxx | 20 +--
vcl/source/window/dialog.cxx | 7 -
vcl/source/window/menu.cxx | 161 ++++++++++++--------------
vcl/source/window/mnemonic.cxx | 94 +++++++--------
vcl/source/window/msgbox.cxx | 8 -
vcl/source/window/status.cxx | 80 +++++-------
vcl/source/window/toolbox.cxx | 29 ++--
vcl/source/window/toolbox2.cxx | 36 +++--
34 files changed, 433 insertions(+), 450 deletions(-)
New commits:
commit 8855ed1da18e9697873d77d0b99b5eff2e9336a8
Author: Noel Grandin <noel at peralex.com>
Date: Wed Jul 31 12:16:14 2013 +0200
convert vcl/edit.hxx from XubString to OUString
Change-Id: Id0558cb6285ecd19ddc21caee3e26f44cbebf721
diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx
index 3859666..a903d19 100644
--- a/cui/source/factory/init.cxx
+++ b/cui/source/factory/init.cxx
@@ -25,7 +25,7 @@
// caution: needs C-Linkage since dynamically loaded via symbol name
extern "C"
{
-SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(Window* i_pParent, const Font& i_rFont, String& o_rResult)
+SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(Window* i_pParent, const Font& i_rFont, OUString& o_rResult)
{
bool bRet = false;
SvxCharacterMap* aDlg = new SvxCharacterMap( i_pParent );
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 6df1f7b..77a277f 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -46,7 +46,7 @@ struct Impl_IMEInfos;
#define EDIT_NOLIMIT STRING_LEN
#define EDIT_UPDATEDATA_TIMEOUT 350
-typedef XubString (*FncGetSpecialChars)( Window* pWin, const Font& rFont );
+typedef OUString (*FncGetSpecialChars)( Window* pWin, const Font& rFont );
// --------
// - Edit -
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 5a5fb9e..646993d 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -170,11 +170,11 @@ extern "C" { static void SAL_CALL thisModule() {} }
#else
-extern "C" bool GetSpecialCharsForEdit( Window* i_pParent, const Font& i_rFont, String& o_rOutString );
+extern "C" bool GetSpecialCharsForEdit( Window* i_pParent, const Font& i_rFont, OUString& o_rOutString );
#endif
-String GetSpecialCharsForEdit(Window* pParent, const Font& rFont)
+OUString GetSpecialCharsForEdit(Window* pParent, const Font& rFont)
{
static bool bDetermineFunction = false;
static PFunc_getSpecialCharsForEdit pfunc_getSpecialCharsForEdit = 0;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 545fb27..ffd256a 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1586,9 +1586,9 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
if ( pImplFncGetSpecialChars )
{
Selection aSaveSel = GetSelection(); // if someone changes the selection in Get/LoseFocus, e.g. URL bar
- XubString aChars = pImplFncGetSpecialChars( this, GetFont() );
+ OUString aChars = pImplFncGetSpecialChars( this, GetFont() );
SetSelection( aSaveSel );
- if ( aChars.Len() )
+ if ( !aChars.isEmpty() )
{
ImplInsertText( aChars );
ImplModified();
@@ -2176,9 +2176,9 @@ void Edit::Command( const CommandEvent& rCEvt )
break;
case SV_MENU_EDIT_INSERTSYMBOL:
{
- XubString aChars = pImplFncGetSpecialChars( this, GetFont() );
+ OUString aChars = pImplFncGetSpecialChars( this, GetFont() );
SetSelection( aSaveSel );
- if ( aChars.Len() )
+ if ( !aChars.isEmpty() )
{
ImplInsertText( aChars );
ImplModified();
commit 43b1ac3651732a1ceb193268ab72b4aaa90dee65
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jul 30 16:50:03 2013 +0200
convert vcl/menu.hxx from XubString to OUString
Change-Id: I9469363c09e4cc863ad4d8ddddf8d923fe444e25
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 7f7f69a..23baa74 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -845,7 +845,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
{
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 ) {
@@ -1252,7 +1252,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
}
if (( pMenu->IsMenuBar() || bAccessibilityEnabled ) &&
- ( pMenu->GetItemText( nItemId ).Len() == 0 ))
+ ( pMenu->GetItemText( nItemId ).isEmpty() ))
{
if ( !aItemCommand.isEmpty() )
pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aItemCommand ));
@@ -1272,7 +1272,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
{
// 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/vcl/menu.hxx b/include/vcl/menu.hxx
index f05ee5d..8328166 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -164,7 +164,7 @@ protected:
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 @@ public:
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 @@ public:
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 @@ public:
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;
@@ -280,14 +280,14 @@ public:
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 @@ public:
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 @@ public:
// 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/outdev.hxx b/include/vcl/outdev.hxx
index 2e5ad68..696a928 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -629,9 +629,9 @@ public:
long GetCtrlTextWidth( const OUString& rStr, xub_StrLen nIndex = 0,
xub_StrLen nLen = STRING_LEN,
sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const;
- static OUString GetNonMnemonicString( const OUString& rStr, xub_StrLen& rMnemonicPos );
+ static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
static OUString GetNonMnemonicString( const OUString& rStr )
- { xub_StrLen nDummy; return GetNonMnemonicString( rStr, nDummy ); }
+ { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
sal_Bool GetTextBoundRect( Rectangle& rRect,
const OUString& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx
index 5a39529..7e48cb3 100644
--- a/svtools/source/uno/contextmenuhelper.cxx
+++ b/svtools/source/uno/contextmenuhelper.cxx
@@ -588,7 +588,7 @@ ContextMenuHelper::completeMenuProperties(
else
pMenu->SetItemImage( nId, Image() );
- if ( pMenu->GetItemText( nId ).Len() == 0 )
+ if ( pMenu->GetItemText( nId ).isEmpty() )
{
OUString aLabel( getLabelFromCommandURL( aCmdURL ));
pMenu->SetItemText( nId, aLabel );
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index a0315ee..40e65b9 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -6142,7 +6142,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r
long nTextHeight = rTargetDevice.GetTextHeight();
TextAlign eAlign = rTargetDevice.GetTextAlign();
- xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+ sal_Int32 nMnemonicPos = STRING_NOTFOUND;
OUString aStr = rOrigStr;
if ( nStyle & TEXT_DRAW_MNEMONIC )
@@ -6718,7 +6718,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr,
nLen = rStr.getLength() - nIndex;
OUString aStr = rStr;
- xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+ sal_Int32 nMnemonicPos = STRING_NOTFOUND;
long nMnemonicX = 0;
long nMnemonicY = 0;
@@ -6832,14 +6832,14 @@ long OutputDevice::GetCtrlTextWidth( const OUString& rStr,
if ( nStyle & TEXT_DRAW_MNEMONIC )
{
- xub_StrLen nMnemonicPos;
+ sal_Int32 nMnemonicPos;
OUString aStr = GetNonMnemonicString( rStr, nMnemonicPos );
if ( nMnemonicPos != STRING_NOTFOUND )
{
if ( nMnemonicPos < nIndex )
nIndex--;
else if ( (nLen < STRING_LEN) &&
- (nMnemonicPos >= nIndex) && (nMnemonicPos < (sal_uLong)(nIndex+nLen)) )
+ (nMnemonicPos >= nIndex) && ((sal_uLong)nMnemonicPos < (sal_uLong)(nIndex+nLen)) )
nLen--;
}
return GetTextWidth( aStr, nIndex, nLen );
@@ -6848,27 +6848,27 @@ long OutputDevice::GetCtrlTextWidth( const OUString& rStr,
return GetTextWidth( rStr, nIndex, nLen );
}
-OUString OutputDevice::GetNonMnemonicString( const OUString& 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;
+ OUString aStr = rStr;
+ sal_Int32 nLen = aStr.getLength();
+ sal_Int32 i = 0;
rMnemonicPos = STRING_NOTFOUND;
while ( i < nLen )
{
- if ( aStr.GetChar( i ) == '~' )
+ if ( aStr[ i ] == '~' )
{
- if ( aStr.GetChar( i+1 ) != '~' )
+ if ( aStr[ i+1 ] != '~' )
{
if ( rMnemonicPos == STRING_NOTFOUND )
rMnemonicPos = i;
- aStr.Erase( i, 1 );
+ aStr = aStr.replaceAt( i, 1, "" );
nLen--;
}
else
{
- aStr.Erase( i, 1 );
+ aStr = aStr.replaceAt( i, 1, "" );
nLen--;
i++;
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a230e54..d431630 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7909,7 +7909,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr,
Point aPos = rRect.TopLeft();
long nTextHeight = m_pReferenceDevice->GetTextHeight();
- xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+ sal_Int32 nMnemonicPos = STRING_NOTFOUND;
OUString aStr = rOrigStr;
if ( nStyle & TEXT_DRAW_MNEMONIC )
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8d91515..e6edd9e 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -113,11 +113,11 @@ struct MenuItemData
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
@@ -130,15 +130,15 @@ struct MenuItemData
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() :
pSubMenu(NULL), pAutoSubMenu(NULL), nItemImageAngle(0), pSalMenuItem ( NULL )
{}
- MenuItemData( const XubString& rStr, const Image& rImage ) :
+ MenuItemData( const OUString& rStr, const Image& rImage ) :
pSubMenu(NULL),
pAutoSubMenu(NULL),
aText( rStr ),
@@ -181,7 +181,7 @@ public:
sal_uInt16 nId,
MenuItemType eType,
MenuItemBits nBits,
- const XubString& rStr,
+ const OUString& rStr,
const Image& rImage,
Menu* pMenu,
size_t nPos,
@@ -229,7 +229,7 @@ MenuItemData* MenuItemList::Insert(
sal_uInt16 nId,
MenuItemType eType,
MenuItemBits nBits,
- const XubString& rStr,
+ const OUString& rStr,
const Image& rImage,
Menu* pMenu,
size_t nPos,
@@ -292,7 +292,7 @@ void MenuItemList::InsertSeparator(const OString &rIdent, size_t nPos)
aSalMIData.eType = MENUITEM_SEPARATOR;
aSalMIData.nBits = 0;
aSalMIData.pMenu = NULL;
- aSalMIData.aText = XubString();
+ aSalMIData.aText = "";
aSalMIData.aImage = Image();
// Native-support: returns NULL if not supported
@@ -370,11 +370,11 @@ MenuItemData* MenuItemList::SearchItem(
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 != -1 )
{
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,
@@ -430,15 +430,15 @@ size_t MenuItemList::GetItemCount( KeyCode aKeyCode ) const
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 != -1 )
{
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()
)
@@ -741,7 +741,7 @@ public:
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 );
@@ -769,7 +769,7 @@ static void ImplSetMenuItemData( MenuItemData* pData )
// 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;
@@ -810,7 +810,7 @@ static bool ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, sal_uInt16 nH
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
{
@@ -841,12 +841,12 @@ static bool ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, sal_uInt16 nH
{
// 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 );
@@ -1202,7 +1202,7 @@ void Menu::RemoveEventListener( const Link& rEventListener )
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" );
@@ -1239,7 +1239,7 @@ void Menu::InsertItem(sal_uInt16 nItemId, const Image& rImage,
SetItemImage( nItemId, rImage );
}
-void Menu::InsertItem(sal_uInt16 nItemId, const XubString& rStr,
+void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr,
const Image& rImage, MenuItemBits nItemBits,
const OString &rIdent, sal_uInt16 nPos)
{
@@ -1270,7 +1270,7 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos )
if ( nObjMask & RSC_MENUITEM_STATUS )
nStatus = sal::static_int_cast<MenuItemBits>(ReadLongRes());
- String aText;
+ OUString aText;
if ( nObjMask & RSC_MENUITEM_TEXT )
aText = ReadStringRes();
@@ -1280,7 +1280,7 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos )
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 );
@@ -1292,7 +1292,7 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos )
if ( bSep )
InsertSeparator(OString(), nPos);
- String aHelpText;
+ OUString aHelpText;
if ( nObjMask & RSC_MENUITEM_HELPTEXT )
{
aHelpText = ReadStringRes();
@@ -1328,7 +1328,7 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos )
}
if ( nObjMask & RSC_MENUITEM_COMMAND )
{
- String aCommandStr = ReadStringRes();
+ OUString aCommandStr = ReadStringRes();
if ( !bSep )
SetItemCommand( nItemId, aCommandStr );
}
@@ -1675,11 +1675,11 @@ KeyEvent Menu::GetActivationKey( sal_uInt16 nItemId ) const
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 != -1 && 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' )
@@ -1837,7 +1837,7 @@ void Menu::ShowItem( sal_uInt16 nItemId, sal_Bool bVisible )
}
}
-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 );
@@ -1845,7 +1845,7 @@ void Menu::SetItemText( sal_uInt16 nItemId, const XubString& rStr )
if ( !pData )
return;
- if ( !rStr.Equals( pData->aText ) )
+ if ( rStr != pData->aText )
{
pData->aText = rStr;
ImplSetMenuItemData( pData );
@@ -1866,7 +1866,7 @@ void Menu::SetItemText( sal_uInt16 nItemId, const XubString& rStr )
}
}
-XubString Menu::GetItemText( sal_uInt16 nItemId ) const
+OUString Menu::GetItemText( sal_uInt16 nItemId ) const
{
size_t nPos;
MenuItemData* pData = pItemList->GetData( nItemId, nPos );
@@ -1997,7 +1997,7 @@ const OUString Menu::GetItemCommand( sal_uInt16 nItemId ) const
return OUString();
}
-void Menu::SetHelpCommand( sal_uInt16 nItemId, const XubString& rStr )
+void Menu::SetHelpCommand( sal_uInt16 nItemId, const OUString& rStr )
{
MenuItemData* pData = pItemList->GetData( nItemId );
@@ -2005,17 +2005,16 @@ void Menu::SetHelpCommand( sal_uInt16 nItemId, const XubString& rStr )
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();
+ assert ( pData );
+
+ return pData->aHelpCommandStr;
}
-void Menu::SetHelpText( sal_uInt16 nItemId, const XubString& rStr )
+void Menu::SetHelpText( sal_uInt16 nItemId, const OUString& rStr )
{
MenuItemData* pData = pItemList->GetData( nItemId );
@@ -2023,38 +2022,35 @@ void Menu::SetHelpText( sal_uInt16 nItemId, const XubString& rStr )
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 )
+ assert ( pData );
+
+ if ( pData->aHelpText.isEmpty() &&
+ (( !pData->aHelpId.isEmpty() ) || ( !pData->aCommandStr.isEmpty() )))
{
- if ( !pData->aHelpText.Len() &&
- (( !pData->aHelpId.isEmpty() ) || ( pData->aCommandStr.Len() )))
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
{
- Help* pHelp = Application::GetHelp();
- if ( pHelp )
- {
- if ( pData->aCommandStr.Len() )
- pData->aHelpText = pHelp->GetHelpText( pData->aCommandStr, NULL );
+ if ( !pData->aCommandStr.isEmpty() )
+ pData->aHelpText = pHelp->GetHelpText( pData->aCommandStr, NULL );
- if( !pData->aHelpText.Len() && !pData->aHelpId.isEmpty() )
- pData->aHelpText = pHelp->GetHelpText( OStringToOUString( pData->aHelpId, RTL_TEXTENCODING_UTF8 ), NULL );
- }
+ if( pData->aHelpText.isEmpty() && !pData->aHelpId.isEmpty() )
+ pData->aHelpText = pHelp->GetHelpText( OStringToOUString( pData->aHelpId, RTL_TEXTENCODING_UTF8 ), NULL );
}
-
- return pData->aHelpText;
}
- else
- return ImplGetSVEmptyStr();
+
+ return pData->aHelpText;
}
-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 );
@@ -2062,14 +2058,13 @@ void Menu::SetTipHelpText( sal_uInt16 nItemId, const XubString& rStr )
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();
+ assert ( pData );
+
+ return pData->aTipHelpText;
}
void Menu::SetHelpId( sal_uInt16 nItemId, const OString& rHelpId )
@@ -2476,7 +2471,7 @@ Size Menu::ImplCalcSize( Window* pWin )
// 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;
@@ -2597,20 +2592,20 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec
}
}
-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 = STRING_NOTFOUND;
+ 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 < aNonMnem.Len() && i_rLong.GetChar(nPos+1) == aNonMnem.GetChar(nPos) )
+ if( nPos < aNonMnem.getLength() && i_rLong[nPos+1] == aNonMnem[nPos] )
{
- OUStringBuffer aBuf( i_rLong.Len() );
- aBuf.append( aNonMnem.GetBuffer(), nPos );
+ OUStringBuffer aBuf( i_rLong.getLength() );
+ aBuf.append( aNonMnem.copy( 0, nPos) );
aBuf.append( sal_Unicode('~') );
- aBuf.append( aNonMnem.GetBuffer()+nPos );
+ aBuf.append( aNonMnem.copy(nPos) );
aNonMnem = aBuf.makeStringAndClear();
}
}
@@ -2841,15 +2836,15 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa
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();
}
@@ -2857,14 +2852,14 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa
// 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?
@@ -3193,19 +3188,19 @@ Rectangle Menu::GetBoundingRectangle( sal_uInt16 nPos ) const
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 );
@@ -3468,7 +3463,7 @@ sal_Bool MenuBar::HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nCommandEventI
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;
}
@@ -6045,7 +6040,7 @@ void MenuBarWindow::GetFocus()
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;
commit 93257759580e6df10cc9eddbf1800a17d61cfc48
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jul 30 15:38:52 2013 +0200
convert vcl/mnemonic.hxx from XubString to OUString
Change-Id: I2df7a6b29aa30ad5ad936b524061aeaef837ca9d
diff --git a/include/vcl/mnemonic.hxx b/include/vcl/mnemonic.hxx
index 4ec22b5..f644725 100644
--- a/include/vcl/mnemonic.hxx
+++ b/include/vcl/mnemonic.hxx
@@ -64,17 +64,17 @@ private:
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 );
+ OUString CreateMnemonic( const 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/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 4db90b4..4d4f9fd 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -985,9 +985,10 @@ OGroupsSortingDialog::OGroupsSortingDialog( Window* _pParent
{
pControls[i]->Show(sal_True);
String sText = pControls[i]->GetText();
- if ( aMnemonicGenerator.CreateMnemonic(sText) )
- pControls[i]->SetText(sText);
- sal_Int32 nTextWidth = GetTextWidth(sText);
+ OUString sNewText = aMnemonicGenerator.CreateMnemonic(sText);
+ if ( sText != sNewText )
+ pControls[i]->SetText(sNewText);
+ sal_Int32 nTextWidth = GetTextWidth(sNewText);
nMaxTextWidth = ::std::max<sal_Int32>(nTextWidth,nMaxTextWidth);
}
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 805ce6f..f1e5084 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -341,10 +341,11 @@ void SvxIconChoiceCtrl_Impl::CreateAutoMnemonics( MnemonicGenerator* _pGenerator
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 );
+ OUString aNewText = _pGenerator->CreateMnemonic( aTxt );
+ if( aNewText != aTxt )
+ pEntry->SetText( aNewText );
}
}
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 4f6d458..eeb70a3 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -221,9 +221,10 @@ void ImplWindowAutoMnemonic( Window* pWindow )
pChild = pGetChild->ImplGetWindow();
if ( ImplIsMnemonicCtrl( pChild ) )
{
- XubString aText = pChild->GetText();
- if ( aMnemonicGenerator.CreateMnemonic( aText ) )
- pChild->SetText( aText );
+ OUString aText = pChild->GetText();
+ OUString aNewText = aMnemonicGenerator.CreateMnemonic( aText );
+ if ( aText != aNewText )
+ pChild->SetText( aNewText );
}
pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index ae45891..8d91515 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1023,7 +1023,7 @@ void Menu::CreateAutoMnemonics()
{
MenuItemData* pData = pItemList->GetDataFromPos( n );
if ( ! (pData->nBits & MIB_NOSELECT ) )
- aMnemonicGenerator.CreateMnemonic( pData->aText );
+ pData->aText = aMnemonicGenerator.CreateMnemonic( pData->aText );
}
}
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index 676bd56..0b55245 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -64,12 +64,12 @@ sal_uInt16 MnemonicGenerator::ImplGetMnemonicIndex( sal_Unicode c )
// -----------------------------------------------------------------------
-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 )) != -1 )
{
- 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 @@ sal_Unicode MnemonicGenerator::ImplFindMnemonic( const XubString& rKey )
// -----------------------------------------------------------------------
-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 @@ void MnemonicGenerator::RegisterMnemonic( const XubString& rKey )
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 @@ void MnemonicGenerator::RegisterMnemonic( const XubString& rKey )
}
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,22 +123,22 @@ void MnemonicGenerator::RegisterMnemonic( const XubString& rKey )
// -----------------------------------------------------------------------
-sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
+OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
{
- if ( !rKey.Len() || ImplFindMnemonic( rKey ) )
- return sal_False;
+ if ( _rKey.isEmpty() || ImplFindMnemonic( _rKey ) )
+ return _rKey;
const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale();
uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass();
// Don't crash even when we don't have access to i18n service
if ( !xCharClass.is() )
- return sal_False;
+ return _rKey;
- 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());
@@ -152,11 +152,11 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
bool bLatinOnly = true;
bool bMnemonicIndexFound = false;
sal_Unicode c;
- xub_StrLen nIndex;
+ 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
{
@@ -167,20 +167,20 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
bMnemonicIndexFound = true;
}
if( bLatinOnly && !bMnemonicIndexFound )
- return sal_False;
+ return _rKey;
}
-
+ OUString rKey(_rKey);
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,7 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
if ( maMnemonics[nMnemonicIndex] )
{
maMnemonics[nMnemonicIndex] = 0;
- rKey.Insert( MNEMONIC_CHAR, nIndex );
+ rKey = rKey.replaceAt( nIndex, 0, OUString(MNEMONIC_CHAR) );
bChanged = sal_True;
break;
}
@@ -211,7 +211,7 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
do
{
nIndex++;
- c = aKey.GetChar( nIndex );
+ c = aKey[ nIndex ];
if ( c == ' ' )
break;
}
@@ -225,11 +225,11 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
{
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 +253,7 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
if ( nBestCount != 0xFFFF )
{
maMnemonics[nBestMnemonicIndex] = 0;
- rKey.Insert( MNEMONIC_CHAR, nBestIndex );
+ rKey = rKey.replaceAt( nBestIndex, 0, OUString(MNEMONIC_CHAR) );
bChanged = sal_True;
}
}
@@ -262,7 +262,7 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
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,31 +276,29 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
OUString aStr = OUStringBuffer().
append('(').append(MNEMONIC_CHAR).append(c).
append(')').makeStringAndClear();
- nIndex = rKey.Len();
+ nIndex = rKey.getLength();
if( nIndex >= 2 )
{
- static const 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] == 0xFF1E && rKey[nIndex-1] == 0xFF1E ) )
nIndex -= 2;
}
if( nIndex >= 3 )
{
- static const sal_Unicode cDotDotDot[] = { 0xFF0E, 0xFF0E, 0xFF0E };
- if ( rKey.EqualsAscii( "...", nIndex-3, 3 ) ||
- rKey.Equals( cDotDotDot, nIndex-3, 3 ) )
+ if ( ( rKey[nIndex-3] == '.' && rKey[nIndex-2] == '.' && rKey[nIndex-1] == '.' ) ||
+ ( rKey[nIndex-3] == 0xFF0E && rKey[nIndex-2] == 0xFF0E && rKey[nIndex-1] == 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 );
+ rKey = rKey.replaceAt( nIndex, 0, aStr );
bChanged = sal_True;
break;
}
@@ -344,7 +342,7 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey )
// while ( nIndex < nLen );
// }
- return bChanged;
+ return rKey;
}
// -----------------------------------------------------------------------
@@ -358,25 +356,25 @@ uno::Reference< i18n::XCharacterClassification > MnemonicGenerator::GetCharClass
// -----------------------------------------------------------------------
-String MnemonicGenerator::EraseAllMnemonicChars( const String& rStr )
+OUString MnemonicGenerator::EraseAllMnemonicChars( const OUString& rStr )
{
- String aStr = rStr;
- xub_StrLen nLen = aStr.Len();
- xub_StrLen i = 0;
+ OUString aStr = rStr;
+ sal_Int32 nLen = aStr.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.replaceAt( i-1, 4, "" );
nLen -= 4;
i--;
continue;
@@ -384,7 +382,7 @@ String MnemonicGenerator::EraseAllMnemonicChars( const String& rStr )
}
// remove standard mnemonics
- aStr.Erase( i, 1 );
+ aStr = aStr.replaceAt( i, 1, "" );
nLen--;
}
else
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index ab5131b..83ab1ae 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -351,14 +351,14 @@ void MessBox::ImplPosControls()
// 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 ) )
{
// no mnemonic found -> create one
MnemonicGenerator aMnemonicGenerator;
- aMnemonicGenerator.CreateMnemonic( aMnemonicString );
+ aMnemonicString = aMnemonicGenerator.CreateMnemonic( aMnemonicString );
}
}
commit c9bb2e3d2c39638eabd24656a9642fa56464700e
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jul 30 13:51:50 2013 +0200
convert vcl/msgbox.hxx from XubString to OUString
Change-Id: I68a591aa7891f5ea08ab3d6b3290e2fe80827126
diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 099bc55..5b53912 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -69,7 +69,7 @@ public:
void SetCheckBoxText( const OUString& rText ) { maCheckBoxText = rText;}
const OUString& GetCheckBoxText() const { return maCheckBoxText;}
void SetCheckBoxState( sal_Bool bCheck );
- sal_Bool GetCheckBoxState() const;
+ sal_Bool GetCheckBoxState() const;
virtual Size GetOptimalSize() const;
};
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index e65c668..ab5131b 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -155,7 +155,7 @@ MessBox::MessBox( Window* pParent, WinBits nStyle,
ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
ImplInitButtons();
- if (!rTitle.isEmpty())
+ if ( !rTitle.isEmpty() )
SetText( rTitle );
}
@@ -338,7 +338,7 @@ void MessBox::ImplPosControls()
if ( aPageSize.Width() < nTitleWidth )
aPageSize.Width() = nTitleWidth;
- if (!maCheckBoxText.isEmpty())
+ if ( !maCheckBoxText.isEmpty() )
{
Size aMinCheckboxSize ( aMEditSize );
if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH+80 )
commit 1211c5dcf10e79b1e4c472c54a4953996d965470
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jul 30 13:08:03 2013 +0200
convert vcl/pdfwriter.hxx from XubString to OUString
Change-Id: Ifc3d56ad9db6b73c26a16520482d5a94a5ba48a2
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index d3a3612..ec46e86 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -64,8 +64,8 @@ class PDFWriterImpl;
struct PDFNote
{
- String Title; // optional title for the popup containing the note
- String Contents; // contents of the note
+ OUString Title; // optional title for the popup containing the note
+ OUString Contents; // contents of the note
};
class VCL_DLLPUBLIC PDFOutputStream
@@ -549,12 +549,12 @@ The following structure describes the permissions used in PDF security
struct PDFDocInfo
{
- String Title; // document title
- String Author; // document author
- String Subject; // subject
- String Keywords; // keywords
- String Creator; // application that created the original document
- String Producer; // OpenOffice
+ OUString Title; // document title
+ OUString Author; // document author
+ OUString Subject; // subject
+ OUString Keywords; // keywords
+ OUString Creator; // application that created the original document
+ OUString Producer; // OpenOffice
};
enum ColorMode
@@ -763,22 +763,22 @@ The following structure describes the permissions used in PDF security
/* actual drawing functions */
- void DrawText( const Point& rPos, const String& rText );
+ void DrawText( const Point& rPos, const OUString& rText );
void DrawTextLine( const Point& rPos, long nWidth,
FontStrikeout eStrikeout,
FontUnderline eUnderline,
FontUnderline eOverline,
sal_Bool bUnderlineAbove = sal_False );
- void DrawTextArray( const Point& rStartPt, const XubString& rStr,
+ void DrawTextArray( const Point& rStartPt, const OUString& rStr,
const sal_Int32* pDXAry = NULL,
xub_StrLen nIndex = 0,
xub_StrLen nLen = STRING_LEN );
void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
- const XubString& rStr,
+ const OUString& rStr,
xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN );
void DrawText( const Rectangle& rRect,
- const XubString& rStr, sal_uInt16 nStyle = 0 );
+ const OUString& rStr, sal_uInt16 nStyle = 0 );
void DrawPixel( const Point& rPt, const Color& rColor );
void DrawPixel( const Point& rPt )
@@ -1224,7 +1224,7 @@ The following structure describes the permissions used in PDF security
@param rText
contains the complete logical text the structural element displays.
*/
- void SetActualText( const String& rText );
+ void SetActualText( const OUString& rText );
/** set the Alt attribute of a strutural element
@@ -1235,7 +1235,7 @@ The following structure describes the permissions used in PDF security
@param rText
contains the replacement text for the structural element
*/
- void SetAlternateText( const String& rText );
+ void SetAlternateText( const OUString& rText );
/** Sets the time in seconds a page will appear before the next
page is shown automatically
@@ -1296,7 +1296,7 @@ The following structure describes the permissions used in PDF security
@param bCompress
specifies whether the stream should be flate encoded by PDFWriter or not
*/
- void AddStream( const String& rMimeType, PDFOutputStream* pStream, bool bCompress );
+ void AddStream( const OUString& rMimeType, PDFOutputStream* pStream, bool bCompress );
};
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 21ed0cc..137319a 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -63,7 +63,7 @@ void PDFWriter::SetFont( const Font& rFont )
pImplementation->setFont( rFont );
}
-void PDFWriter::DrawText( const Point& rPos, const String& rText )
+void PDFWriter::DrawText( const Point& rPos, const OUString& rText )
{
pImplementation->drawText( rPos, rText );
}
@@ -81,7 +81,7 @@ void PDFWriter::DrawTextLine(
void PDFWriter::DrawTextArray(
const Point& rStartPt,
- const XubString& rStr,
+ const OUString& rStr,
const sal_Int32* pDXAry,
xub_StrLen nIndex,
xub_StrLen nLen )
@@ -92,7 +92,7 @@ void PDFWriter::DrawTextArray(
void PDFWriter::DrawStretchText(
const Point& rStartPt,
sal_uLong nWidth,
- const XubString& rStr,
+ const OUString& rStr,
xub_StrLen nIndex,
xub_StrLen nLen )
{
@@ -101,7 +101,7 @@ void PDFWriter::DrawStretchText(
void PDFWriter::DrawText(
const Rectangle& rRect,
- const XubString& rStr,
+ const OUString& rStr,
sal_uInt16 nStyle )
{
pImplementation->drawText( rRect, rStr, nStyle );
@@ -405,12 +405,12 @@ void PDFWriter::SetStructureBoundingBox( const Rectangle& rRect )
pImplementation->setStructureBoundingBox( rRect );
}
-void PDFWriter::SetActualText( const String& rText )
+void PDFWriter::SetActualText( const OUString& rText )
{
pImplementation->setActualText( rText );
}
-void PDFWriter::SetAlternateText( const String& rText )
+void PDFWriter::SetAlternateText( const OUString& rText )
{
pImplementation->setAlternateText( rText );
}
@@ -434,7 +434,7 @@ PDFOutputStream::~PDFOutputStream()
{
}
-void PDFWriter::AddStream( const String& rMimeType, PDFOutputStream* pStream, bool bCompress )
+void PDFWriter::AddStream( const OUString& rMimeType, PDFOutputStream* pStream, bool bCompress )
{
pImplementation->addStream( rMimeType, pStream, bCompress );
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 7410bee..a230e54 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -161,47 +161,47 @@ void doTestCode()
aWriter.DrawText( aRect, String( "Link annot 1" ) );
sal_Int32 nFirstLink = aWriter.CreateLink( aRect );
PDFNote aNote;
- aNote.Title = String( "A small test note" );
- aNote.Contents = String( "There is no business like show business like no business i know. Everything about it is appealing." );
+ aNote.Title = "A small test note";
+ aNote.Contents = "There is no business like show business like no business i know. Everything about it is appealing.";
aWriter.CreateNote( Rectangle( Point( aRect.Right(), aRect.Top() ), Size( 6000, 3000 ) ), aNote );
Rectangle aTargetRect( Point( 3000, 23000 ), Size( 12000, 6000 ) );
aWriter.SetFillColor( Color( COL_LIGHTGREEN ) );
aWriter.DrawRect( aTargetRect );
- aWriter.DrawText( aTargetRect, String( "Dest second link" ) );
+ aWriter.DrawText( aTargetRect, "Dest second link" );
sal_Int32 nSecondDest = aWriter.CreateDest( aTargetRect );
aWriter.BeginStructureElement( PDFWriter::Section );
aWriter.BeginStructureElement( PDFWriter::Heading );
- aWriter.DrawText( Point(4500, 9000), String( "A small structure test" ) );
+ aWriter.DrawText( Point(4500, 9000), "A small structure test" );
aWriter.EndStructureElement();
aWriter.BeginStructureElement( PDFWriter::Paragraph );
aWriter.SetStructureAttribute( PDFWriter::WritingMode, PDFWriter::LrTb );
aWriter.SetStructureAttribute( PDFWriter::TextDecorationType, PDFWriter::Underline );
aWriter.DrawText( Rectangle( Point( 4500, 10000 ), Size( 12000, 6000 ) ),
- String( "It was the best of PDF, it was the worst of PDF ... or so. This is a pretty nonsensical text to denote a paragraph. I suggest you stop reading it. Because if you read on you might get bored. So continue on your on risk. Hey, you're still here ? Why do you continue to read this as it is of no use at all ? OK, it's your time, but still... . Woah, i even get bored writing this, so let's end this here and now." ),
+ "It was the best of PDF, it was the worst of PDF ... or so. This is a pretty nonsensical text to denote a paragraph. I suggest you stop reading it. Because if you read on you might get bored. So continue on your on risk. Hey, you're still here ? Why do you continue to read this as it is of no use at all ? OK, it's your time, but still... . Woah, i even get bored writing this, so let's end this here and now.",
TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK
);
- aWriter.SetActualText( String( "It was the best of PDF, it was the worst of PDF ... or so. This is a pretty nonsensical text to denote a paragraph. I suggest you stop reading it. Because if you read on you might get bored. So continue on your on risk. Hey, you're still here ? Why do you continue to read this as it is of no use at all ? OK, it's your time, but still... . Woah, i even get bored writing this, so let's end this here and now." ) );
- aWriter.SetAlternateText( String( "This paragraph contains some lengthy nonsense to test structural element emission of PDFWriter." ) );
+ aWriter.SetActualText( "It was the best of PDF, it was the worst of PDF ... or so. This is a pretty nonsensical text to denote a paragraph. I suggest you stop reading it. Because if you read on you might get bored. So continue on your on risk. Hey, you're still here ? Why do you continue to read this as it is of no use at all ? OK, it's your time, but still... . Woah, i even get bored writing this, so let's end this here and now." );
+ aWriter.SetAlternateText( "This paragraph contains some lengthy nonsense to test structural element emission of PDFWriter." );
aWriter.EndStructureElement();
aWriter.BeginStructureElement( PDFWriter::Paragraph );
aWriter.SetStructureAttribute( PDFWriter::WritingMode, PDFWriter::LrTb );
aWriter.DrawText( Rectangle( Point( 4500, 19000 ), Size( 12000, 1000 ) ),
- String( "This paragraph is nothing special either but ends on the next page structurewise" ),
+ "This paragraph is nothing special either but ends on the next page structurewise",
TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK
);
aWriter.NewPage( 595, 842 );
// test AddStream interface
- aWriter.AddStream( String( "text/plain" ), new PDFTestOutputStream(), true );
+ aWriter.AddStream( "text/plain", new PDFTestOutputStream(), true );
// set transitional mode
aWriter.SetPageTransition( PDFWriter::WipeRightToLeft, 1500 );
aWriter.SetMapMode( MapMode( MAP_100TH_MM ) );
aWriter.SetTextColor( Color( COL_BLACK ) );
aWriter.SetFont( Font( String( "Times" ), Size( 0, 500 ) ) );
aWriter.DrawText( Rectangle( Point( 4500, 1500 ), Size( 12000, 3000 ) ),
- String( "Here's where all things come to an end ... well at least the paragaph from the last page." ),
+ "Here's where all things come to an end ... well at least the paragaph from the last page.",
TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK
);
aWriter.EndStructureElement();
@@ -211,13 +211,13 @@ void doTestCode()
aWriter.BeginStructureElement( PDFWriter::NonStructElement );
aWriter.DrawRect( aRect );
aWriter.BeginStructureElement( PDFWriter::Paragraph );
- aWriter.DrawText( aRect, String( "Link annot 2" ) );
+ aWriter.DrawText( aRect, "Link annot 2" );
sal_Int32 nSecondLink = aWriter.CreateLink( aRect );
aWriter.SetFillColor( Color( COL_LIGHTGREEN ) );
aWriter.BeginStructureElement( PDFWriter::ListItem );
aWriter.DrawRect( aTargetRect );
- aWriter.DrawText( aTargetRect, String( "Dest first link" ) );
+ aWriter.DrawText( aTargetRect, "Dest first link" );
sal_Int32 nFirstDest = aWriter.CreateDest( aTargetRect );
// enable structure
aWriter.EndStructureElement();
@@ -226,7 +226,7 @@ void doTestCode()
aWriter.EndStructureElement();
aWriter.BeginStructureElement( PDFWriter::Figure );
aWriter.BeginStructureElement( PDFWriter::Caption );
- aWriter.DrawText( Point( 4500, 9000 ), String( "Some drawing stuff inside the structure" ) );
+ aWriter.DrawText( Point( 4500, 9000 ), "Some drawing stuff inside the structure" );
aWriter.EndStructureElement();
// test clipping
@@ -258,7 +258,7 @@ void doTestCode()
aWriter.DrawEllipse( aTranspRect );
aWriter.SetTextColor( Color( COL_LIGHTBLUE ) );
aWriter.DrawText( aTranspRect,
- String( "Some transparent text" ),
+ "Some transparent text",
TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
aWriter.EndTransparencyGroup( aTranspRect, 50 );
@@ -282,7 +282,7 @@ void doTestCode()
aWriter.DrawEllipse( aTranspRect );
aWriter.SetTextColor( Color( COL_LIGHTBLUE ) );
aWriter.DrawText( aTranspRect,
- String( "Some transparent text" ),
+ "Some transparent text",
TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
aTranspRect = Rectangle( Point( 1500, 16500 ), Size( 4800, 3000 ) );
aWriter.SetFillColor( Color( COL_LIGHTRED ) );
@@ -330,7 +330,7 @@ void doTestCode()
aWriter.SetTextColor( Color( COL_BLACK ) );
aRect = Rectangle( Point( 4500, 6000 ), Size( 6000, 1500 ) );
aWriter.DrawRect( aRect );
- aWriter.DrawText( aRect, String( "www.heise.de" ) );
+ aWriter.DrawText( aRect, "www.heise.de" );
sal_Int32 nURILink = aWriter.CreateLink( aRect );
aWriter.SetLinkURL( nURILink, OUString( "http://www.heise.de" ) );
@@ -1873,17 +1873,17 @@ void PDFWriterImpl::computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIden
//build the document id
OString aInfoValuesOut;
OStringBuffer aID( 1024 );
- if( i_rDocInfo.Title.Len() )
+ if( !i_rDocInfo.Title.isEmpty() )
appendUnicodeTextString( i_rDocInfo.Title, aID );
- if( i_rDocInfo.Author.Len() )
+ if( !i_rDocInfo.Author.isEmpty() )
appendUnicodeTextString( i_rDocInfo.Author, aID );
- if( i_rDocInfo.Subject.Len() )
+ if( !i_rDocInfo.Subject.isEmpty() )
appendUnicodeTextString( i_rDocInfo.Subject, aID );
- if( i_rDocInfo.Keywords.Len() )
+ if( !i_rDocInfo.Keywords.isEmpty() )
appendUnicodeTextString( i_rDocInfo.Keywords, aID );
- if( i_rDocInfo.Creator.Len() )
+ if( !i_rDocInfo.Creator.isEmpty() )
appendUnicodeTextString( i_rDocInfo.Creator, aID );
- if( i_rDocInfo.Producer.Len() )
+ if( !i_rDocInfo.Producer.isEmpty() )
appendUnicodeTextString( i_rDocInfo.Producer, aID );
TimeValue aTVal, aGMT;
@@ -4607,7 +4607,7 @@ bool PDFWriterImpl::emitNoteAnnotations()
aLine.append( "\n" );
// optional title
- if( rNote.m_aContents.Title.Len() )
+ if( !rNote.m_aContents.Title.isEmpty() )
{
aLine.append( "/T" );
appendUnicodeTextStringEncrypt( rNote.m_aContents.Title, rNote.m_nObject, aLine );
@@ -5743,7 +5743,7 @@ bool PDFWriterImpl::emitCatalog()
}
// viewer preferences, if we had some, then emit
if( m_aContext.HideViewerToolbar ||
- ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) ||
+ ( m_aContext.Version > PDFWriter::PDF_1_3 && !m_aContext.DocumentInfo.Title.isEmpty() && m_aContext.DisplayPDFDocumentTitle ) ||
m_aContext.HideViewerMenubar ||
m_aContext.HideViewerWindowControls || m_aContext.FitWindow ||
m_aContext.CenterWindow || (m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing ) ||
@@ -5760,7 +5760,7 @@ bool PDFWriterImpl::emitCatalog()
aLine.append( "/FitWindow true\n" );
if( m_aContext.CenterWindow )
aLine.append( "/CenterWindow true\n" );
- if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle )
+ if( m_aContext.Version > PDFWriter::PDF_1_3 && !m_aContext.DocumentInfo.Title.isEmpty() && m_aContext.DisplayPDFDocumentTitle )
aLine.append( "/DisplayDocTitle true\n" );
if( m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing )
aLine.append( "/Direction/R2L\n" );
@@ -5896,7 +5896,7 @@ bool PDFWriterImpl::emitSignature()
aLine.append( aContentFiller.makeStringAndClear() );
aLine.append( ">\n/Type/Sig/SubFilter/adbe.pkcs7.detached");
- if( m_aContext.DocumentInfo.Author.Len() )
+ if( !m_aContext.DocumentInfo.Author.isEmpty() )
{
aLine.append( "/Name" );
appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Author, m_nSignatureObject, aLine );
@@ -6162,37 +6162,37 @@ sal_Int32 PDFWriterImpl::emitInfoDict( )
aLine.append( nObject );
aLine.append( " 0 obj\n"
"<<" );
- if( m_aContext.DocumentInfo.Title.Len() )
+ if( !m_aContext.DocumentInfo.Title.isEmpty() )
{
aLine.append( "/Title" );
appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Title, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aContext.DocumentInfo.Author.Len() )
+ if( !m_aContext.DocumentInfo.Author.isEmpty() )
{
aLine.append( "/Author" );
appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Author, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aContext.DocumentInfo.Subject.Len() )
+ if( !m_aContext.DocumentInfo.Subject.isEmpty() )
{
aLine.append( "/Subject" );
appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Subject, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aContext.DocumentInfo.Keywords.Len() )
+ if( !m_aContext.DocumentInfo.Keywords.isEmpty() )
{
aLine.append( "/Keywords" );
appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Keywords, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aContext.DocumentInfo.Creator.Len() )
+ if( !m_aContext.DocumentInfo.Creator.isEmpty() )
{
aLine.append( "/Creator" );
appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Creator, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aContext.DocumentInfo.Producer.Len() )
+ if( !m_aContext.DocumentInfo.Producer.isEmpty() )
{
aLine.append( "/Producer" );
appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Producer, nObject, aLine );
@@ -6451,13 +6451,13 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadataStream.append( " <pdfaid:conformance>A</pdfaid:conformance>\n" );
aMetadataStream.append( " </rdf:Description>\n" );
//... Dublin Core properties go here
- if( m_aContext.DocumentInfo.Title.Len() ||
- m_aContext.DocumentInfo.Author.Len() ||
- m_aContext.DocumentInfo.Subject.Len() )
+ if( !m_aContext.DocumentInfo.Title.isEmpty() ||
+ !m_aContext.DocumentInfo.Author.isEmpty() ||
+ !m_aContext.DocumentInfo.Subject.isEmpty() )
{
aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" );
aMetadataStream.append( " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n" );
- if( m_aContext.DocumentInfo.Title.Len() )
+ if( !m_aContext.DocumentInfo.Title.isEmpty() )
{
// this is according to PDF/A-1, technical corrigendum 1 (2007-04-01)
aMetadataStream.append( " <dc:title>\n" );
@@ -6470,7 +6470,7 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadataStream.append( " </rdf:Alt>\n" );
aMetadataStream.append( " </dc:title>\n" );
}
- if( m_aContext.DocumentInfo.Author.Len() )
+ if( !m_aContext.DocumentInfo.Author.isEmpty() )
{
aMetadataStream.append( " <dc:creator>\n" );
aMetadataStream.append( " <rdf:Seq>\n" );
@@ -6482,7 +6482,7 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadataStream.append( " </rdf:Seq>\n" );
aMetadataStream.append( " </dc:creator>\n" );
}
- if( m_aContext.DocumentInfo.Subject.Len() )
+ if( !m_aContext.DocumentInfo.Subject.isEmpty() )
{
// this is according to PDF/A-1, technical corrigendum 1 (2007-04-01)
aMetadataStream.append( " <dc:description>\n" );
@@ -6499,12 +6499,12 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
}
//... PDF properties go here
- if( m_aContext.DocumentInfo.Producer.Len() ||
- m_aContext.DocumentInfo.Keywords.Len() )
+ if( !m_aContext.DocumentInfo.Producer.isEmpty() ||
+ !m_aContext.DocumentInfo.Keywords.isEmpty() )
{
aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" );
aMetadataStream.append( " xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">\n" );
- if( m_aContext.DocumentInfo.Producer.Len() )
+ if( !m_aContext.DocumentInfo.Producer.isEmpty() )
{
aMetadataStream.append( " <pdf:Producer>" );
OUString aProducer;
@@ -6512,7 +6512,7 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadataStream.append( OUStringToOString( aProducer , RTL_TEXTENCODING_UTF8 ) );
aMetadataStream.append( "</pdf:Producer>\n" );
}
- if( m_aContext.DocumentInfo.Keywords.Len() )
+ if( !m_aContext.DocumentInfo.Keywords.isEmpty() )
{
aMetadataStream.append( " <pdf:Keywords>" );
OUString aKeywords;
@@ -6525,7 +6525,7 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" );
aMetadataStream.append( " xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n" );
- if( m_aContext.DocumentInfo.Creator.Len() )
+ if( !m_aContext.DocumentInfo.Creator.isEmpty() )
{
aMetadataStream.append( " <xmp:CreatorTool>" );
OUString aCreator;
@@ -7148,7 +7148,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
}
}
-void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bTextLines )
+void PDFWriterImpl::drawRelief( SalLayout& rLayout, const OUString& rText, bool bTextLines )
{
push( PUSH_ALL );
@@ -7195,7 +7195,7 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT
pop();
}
-void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bTextLines )
+void PDFWriterImpl::drawShadow( SalLayout& rLayout, const OUString& rText, bool bTextLines )
{
Font aSaveFont = m_aCurrentPDFState.m_aFont;
Color aSaveTextLineColor = m_aCurrentPDFState.m_aTextLineColor;
@@ -7408,7 +7408,7 @@ void PDFWriterImpl::drawHorizontalGlyphs(
}
}
-void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bTextLines )
+void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool bTextLines )
{
// relief takes precedence over shadow (see outdev3.cxx)
if( m_aCurrentPDFState.m_aFont.GetRelief() != RELIEF_NONE )
@@ -7436,7 +7436,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
bool bVertical = m_aCurrentPDFState.m_aFont.IsVertical();
int nGlyphs;
int nIndex = 0;
- int nMinCharPos = 0, nMaxCharPos = rText.Len()-1;
+ int nMinCharPos = 0, nMaxCharPos = rText.getLength()-1;
double fXScale = 1.0;
double fSkew = 0.0;
sal_Int32 nPixelFontHeight = m_pReferenceDevice->mpFontEntry->maFontSelData.mnHeight;
@@ -7574,7 +7574,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
else if( pCharPosAry[i] >= nMinCharPos && pCharPosAry[i] <= nMaxCharPos )
{
int nChars = 1;
- aUnicodes.push_back( rText.GetChar( sal::static_int_cast<xub_StrLen>(pCharPosAry[i]) ) );
+ aUnicodes.push_back( rText[ sal::static_int_cast<xub_StrLen>(pCharPosAry[i]) ] );
pUnicodesPerGlyph[i] = 1;
// try to handle ligatures and such
if( i < nGlyphs-1 )
@@ -7588,7 +7588,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
nChars = 1;
pUnicodesPerGlyph[i] = nChars;
for( int n = 1; n < nChars; n++ )
- aUnicodes.push_back( rText.GetChar( sal::static_int_cast<xub_StrLen>(pCharPosAry[i]+n) ) );
+ aUnicodes.push_back( rText[ sal::static_int_cast<xub_StrLen>(pCharPosAry[i]+n) ] );
}
// #i36691# hack that is needed because currently the pGlyphs[]
// argument is ignored for embeddable fonts and so the layout
@@ -7837,7 +7837,7 @@ void PDFWriterImpl::drawEmphasisMark( long nX, long nY,
}
}
-void PDFWriterImpl::drawText( const Point& rPos, const String& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines )
+void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines )
{
MARK( "drawText" );
@@ -7853,7 +7853,7 @@ void PDFWriterImpl::drawText( const Point& rPos, const String& rText, xub_StrLen
}
}
-void PDFWriterImpl::drawTextArray( const Point& rPos, const String& rText, const sal_Int32* pDXArray, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines )
+void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines )
{
MARK( "drawText with array" );
@@ -7869,7 +7869,7 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, const String& rText, const
}
}
-void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const String& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines )
+void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText, xub_StrLen nIndex, xub_StrLen nLen, bool bTextLines )
{
MARK( "drawStretchText" );
@@ -7885,7 +7885,7 @@ void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const
}
}
-void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sal_uInt16 nStyle, bool bTextLines )
+void PDFWriterImpl::drawText( const Rectangle& rRect, const OUString& rOrigStr, sal_uInt16 nStyle, bool bTextLines )
{
long nWidth = rRect.GetWidth();
long nHeight = rRect.GetHeight();
@@ -7911,7 +7911,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa
long nTextHeight = m_pReferenceDevice->GetTextHeight();
xub_StrLen nMnemonicPos = STRING_NOTFOUND;
- String aStr = rOrigStr;
+ OUString aStr = rOrigStr;
if ( nStyle & TEXT_DRAW_MNEMONIC )
aStr = m_pReferenceDevice->GetNonMnemonicString( aStr, nMnemonicPos );
@@ -7941,7 +7941,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa
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 );
@@ -8382,15 +8382,15 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik
//See qadevOOo/testdocs/StrikeThrough.odt for examples if you need
//to tweak this
- OUString aStrikeoutChar = eStrikeout == STRIKEOUT_SLASH ? OUString("/") : OUString("X");
- String aStrikeout = aStrikeoutChar;
+ OUString aStrikeoutChar = eStrikeout == STRIKEOUT_SLASH ? "/" : "X";
+ OUString aStrikeout = aStrikeoutChar;
while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth )
- aStrikeout.Append( aStrikeout );
+ aStrikeout += aStrikeout;
// do not get broader than nWidth modulo 1 character
while( m_pReferenceDevice->GetTextWidth( aStrikeout ) >= nWidth )
- aStrikeout.Erase( 0, 1 );
- aStrikeout.Append( aStrikeoutChar );
+ aStrikeout = aStrikeout.replaceAt( 0, 1, "" );
+ aStrikeout += aStrikeoutChar;
sal_Bool bShadow = m_aCurrentPDFState.m_aFont.IsShadow();
if ( bShadow )
{
@@ -8421,7 +8421,7 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik
}
intersectClipRegion( aRect );
- drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false );
+ drawText( rPos, aStrikeout, 0, aStrikeout.getLength(), false );
pop();
m_pReferenceDevice->SetLayoutMode( nOrigTLM );
@@ -11573,7 +11573,7 @@ void PDFWriterImpl::setStructureBoundingBox( const Rectangle& rRect )
}
}
-void PDFWriterImpl::setActualText( const String& rText )
+void PDFWriterImpl::setActualText( const OUString& rText )
{
if( m_aContext.Tagged && m_nCurrentStructElement > 0 && m_bEmitStructure )
{
@@ -11581,7 +11581,7 @@ void PDFWriterImpl::setActualText( const String& rText )
}
}
-void PDFWriterImpl::setAlternateText( const String& rText )
+void PDFWriterImpl::setAlternateText( const OUString& rText )
{
if( m_aContext.Tagged && m_nCurrentStructElement > 0 && m_bEmitStructure )
{
@@ -11921,13 +11921,13 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
return nNewWidget;
}
-void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream, bool bCompress )
+void PDFWriterImpl::addStream( const OUString& rMimeType, PDFOutputStream* pStream, bool bCompress )
{
if( pStream )
{
m_aAdditionalStreams.push_back( PDFAddStream() );
PDFAddStream& rStream = m_aAdditionalStreams.back();
- rStream.m_aMimeType = rMimeType.Len()
+ rStream.m_aMimeType = !rMimeType.isEmpty()
? OUString( rMimeType )
: OUString( "application/octet-stream" );
rStream.m_pStream = pStream;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 14ac0b2..b8ab213 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -836,9 +836,9 @@ i12626
/* TODO: remove rText as soon as SalLayout will change so that rText is not necessary anymore */
void drawVerticalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, const Matrix3& rRotScale, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight );
void drawHorizontalGlyphs( const std::vector<PDFGlyph>& rGlyphs, OStringBuffer& rLine, const Point& rAlignOffset, double fAngle, double fXScale, double fSkew, sal_Int32 nFontHeight, sal_Int32 nPixelFontHeight );
- void drawLayout( SalLayout& rLayout, const String& rText, bool bTextLines );
- void drawRelief( SalLayout& rLayout, const String& rText, bool bTextLines );
- void drawShadow( SalLayout& rLayout, const String& rText, bool bTextLines );
+ void drawLayout( SalLayout& rLayout, const OUString& rText, bool bTextLines );
+ void drawRelief( SalLayout& rLayout, const OUString& rText, bool bTextLines );
+ void drawShadow( SalLayout& rLayout, const OUString& rText, bool bTextLines );
/* writes differences between graphics stack and current real PDF
* state to the file
@@ -1195,12 +1195,12 @@ public:
}
/* actual drawing functions */
- void drawText( const Point& rPos, const String& rText, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
- void drawTextArray( const Point& rPos, const String& rText, const sal_Int32* pDXArray = NULL, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
- void drawStretchText( const Point& rPos, sal_uLong nWidth, const String& rText,
+ void drawText( const Point& rPos, const OUString& rText, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
+ void drawTextArray( const Point& rPos, const OUString& rText, const sal_Int32* pDXArray = NULL, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true );
+ void drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText,
xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
bool bTextLines = true );
- void drawText( const Rectangle& rRect, const String& rOrigStr, sal_uInt16 nStyle, bool bTextLines = true );
+ void drawText( const Rectangle& rRect, const OUString& rOrigStr, sal_uInt16 nStyle, bool bTextLines = true );
void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove );
void drawWaveTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
void drawStraightTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
@@ -1268,8 +1268,8 @@ public:
bool setStructureAttribute( enum PDFWriter::StructAttribute eAttr, enum PDFWriter::StructAttributeValue eVal );
bool setStructureAttributeNumerical( enum PDFWriter::StructAttribute eAttr, sal_Int32 nValue );
void setStructureBoundingBox( const Rectangle& rRect );
- void setActualText( const String& rText );
- void setAlternateText( const String& rText );
+ void setActualText( const OUString& rText );
+ void setAlternateText( const OUString& rText );
// transitional effects
void setAutoAdvanceTime( sal_uInt32 nSeconds, sal_Int32 nPageNr = -1 );
@@ -1279,7 +1279,7 @@ public:
sal_Int32 createControl( const PDFWriter::AnyWidget& rControl, sal_Int32 nPageNr = -1 );
// additional streams
- void addStream( const String& rMimeType, PDFOutputStream* pStream, bool bCompress );
+ void addStream( const OUString& rMimeType, PDFOutputStream* pStream, bool bCompress );
// helper: eventually begin marked content sequence and
// emit a comment in debug case
commit d8dd39b5fc8f3067e00abddbab90151f6ccac370
Author: Noel Grandin <noel at peralex.com>
Date: Tue Jul 30 11:30:02 2013 +0200
convert vcl/tabctrl.hxx from XubString->OUString
Change-Id: Iad4eb1ebd28e97cc99d7d52ea08c3e3fd04cf975
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 8b4111a..383c923 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -122,7 +122,7 @@ public:
void InsertPage( const ResId& rResId,
sal_uInt16 nPos = TAB_APPEND );
- void InsertPage( sal_uInt16 nPageId, const XubString& rText,
+ void InsertPage( sal_uInt16 nPageId, const OUString& rText,
sal_uInt16 nPos = TAB_APPEND );
void RemovePage( sal_uInt16 nPageId );
void Clear();
@@ -148,11 +148,11 @@ public:
void SetTabPage( sal_uInt16 nPageId, TabPage* pPage );
TabPage* GetTabPage( sal_uInt16 nPageId ) const;
- void SetPageText( sal_uInt16 nPageId, const XubString& rText );
- XubString GetPageText( sal_uInt16 nPageId ) const;
+ void SetPageText( sal_uInt16 nPageId, const OUString& rText );
+ OUString GetPageText( sal_uInt16 nPageId ) const;
- void SetHelpText( sal_uInt16 nPageId, const XubString& rText );
- const XubString& GetHelpText( sal_uInt16 nPageId ) const;
+ void SetHelpText( sal_uInt16 nPageId, const OUString& rText );
+ const OUString& GetHelpText( sal_uInt16 nPageId ) const;
void SetHelpId( sal_uInt16 nPageId, const OString& rId ) const;
OString GetHelpId( sal_uInt16 nPageId ) const;
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 53594a9..2cc1802 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -45,9 +45,9 @@ struct ImplTabItem
{
sal_uInt16 mnId;
TabPage* mpTabPage;
- String maText;
- String maFormatText;
- String maHelpText;
+ OUString maText;
+ OUString maFormatText;
+ OUString maHelpText;
OString maHelpId;
OString maTabName;
Rectangle maRect;
@@ -285,7 +285,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
if( !!pItem->maTabImage )
{
aImageSize = pItem->maTabImage.GetSizePixel();
- if( pItem->maFormatText.Len() )
+ if( !pItem->maFormatText.isEmpty() )
aImageSize.Width() += GetTextHeight()/4;
}
aSize.Width() += aImageSize.Width();
@@ -307,8 +307,8 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
// For languages with short names (e.g. Chinese), because the space is
// normally only one pixel per char
- if ( pItem->maFormatText.Len() < TAB_EXTRASPACE_X )
- aSize.Width() += TAB_EXTRASPACE_X-pItem->maFormatText.Len();
+ if ( !pItem->maFormatText.isEmpty() < TAB_EXTRASPACE_X )
+ aSize.Width() += TAB_EXTRASPACE_X-pItem->maFormatText.getLength();
// shorten Text if needed
if ( aSize.Width()+4 >= nMaxWidth )
@@ -317,20 +317,20 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
pItem->maFormatText += aAppendStr;
do
{
- pItem->maFormatText.Erase( pItem->maFormatText.Len()-aAppendStr.getLength()-1, 1 );
+ pItem->maFormatText = pItem->maFormatText.replaceAt( pItem->maFormatText.getLength()-aAppendStr.getLength()-1, 1, "" );
aSize.Width() = GetCtrlTextWidth( pItem->maFormatText );
aSize.Width() += aImageSize.Width();
aSize.Width() += TAB_TABOFFSET_X*2;
}
- while ( (aSize.Width()+4 >= nMaxWidth) && (pItem->maFormatText.Len() > aAppendStr.getLength()) );
+ while ( (aSize.Width()+4 >= nMaxWidth) && (pItem->maFormatText.getLength() > aAppendStr.getLength()) );
if ( aSize.Width()+4 >= nMaxWidth )
{
- pItem->maFormatText.Assign( '.' );
+ pItem->maFormatText = ".";
aSize.Width() = 1;
}
}
- if( pItem->maFormatText.Len() == 0 )
+ if( pItem->maFormatText.isEmpty() )
{
if( aSize.Height() < aImageSize.Height()+4 ) //leave space for focus rect
aSize.Height() = aImageSize.Height()+4;
@@ -699,11 +699,11 @@ void TabControl::ImplShowFocus()
if( !! rItem.maTabImage )
{
aImageSize = rItem.maTabImage.GetSizePixel();
- if( rItem.maFormatText.Len() )
+ if( !rItem.maFormatText.isEmpty() )
aImageSize.Width() += GetTextHeight()/4;
}
- if( rItem.maFormatText.Len() )
+ if( !rItem.maFormatText.isEmpty() )
{
// show focus around text
aRect.Left() = aRect.Left()+aImageSize.Width()+((aTabSize.Width()-nTextWidth-aImageSize.Width())/2)-nOff-1-1;
@@ -900,12 +900,12 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo
if( !! pItem->maTabImage )
{
aImageSize = pItem->maTabImage.GetSizePixel();
- if( pItem->maFormatText.Len() )
+ if( !pItem->maFormatText.isEmpty() )
aImageSize.Width() += GetTextHeight()/4;
}
long nXPos = aRect.Left()+((aTabSize.Width()-nTextWidth-aImageSize.Width())/2)-nOff-nOff3;
long nYPos = aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-nOff3;
- if( pItem->maFormatText.Len() )
+ if( !pItem->maFormatText.isEmpty() )
{
sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC;
if( ! pItem->mbEnabled )
@@ -1344,8 +1344,8 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
{
if ( rHEvt.GetMode() & HELPMODE_BALLOON )
{
- XubString aStr = GetHelpText( nItemId );
- if ( aStr.Len() )
+ OUString aStr = GetHelpText( nItemId );
+ if ( !aStr.isEmpty() )
{
Rectangle aItemRect = ImplGetTabRect( GetPagePos( nItemId ) );
Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
@@ -1375,7 +1375,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) )
{
ImplTabItem* pItem = ImplGetItem( nItemId );
- const XubString& rStr = pItem->maText;
+ const OUString& rStr = pItem->maText;
if ( rStr != pItem->maFormatText )
{
Rectangle aItemRect = ImplGetTabRect( GetPagePos( nItemId ) );
@@ -1385,7 +1385,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
aPt = OutputToScreenPixel( aItemRect.BottomRight() );
aItemRect.Right() = aPt.X();
aItemRect.Bottom() = aPt.Y();
- if ( rStr.Len() )
+ if ( !rStr.isEmpty() )
{
if ( rHEvt.GetMode() & HELPMODE_BALLOON )
Help::ShowBalloon( this, aItemRect.Center(), aItemRect, rStr );
@@ -1399,9 +1399,9 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
if ( rHEvt.GetMode() & HELPMODE_QUICK )
{
ImplTabItem* pItem = ImplGetItem( nItemId );
- const XubString& rHelpText = pItem->maHelpText;
+ const OUString& rHelpText = pItem->maHelpText;
// show tooltip if not text but image is set and helptext is available
- if ( rHelpText.Len() > 0 && pItem->maText.Len() == 0 && !!pItem->maTabImage )
+ if ( !rHelpText.isEmpty() && pItem->maText.isEmpty() && !!pItem->maTabImage )
{
Rectangle aItemRect = ImplGetTabRect( GetPagePos( nItemId ) );
Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
@@ -1645,7 +1645,7 @@ void TabControl::InsertPage( const ResId& rResId, sal_uInt16 nPos )
nItemId = sal::static_int_cast<sal_uInt16>(ReadLongRes());
// Text
- XubString aTmpStr;
+ OUString aTmpStr;
if( nObjMask & RSC_TABCONTROLITEM_TEXT )
aTmpStr = ReadStringRes();
InsertPage( nItemId, aTmpStr, nPos );
@@ -1660,7 +1660,7 @@ void TabControl::InsertPage( const ResId& rResId, sal_uInt16 nPos )
// -----------------------------------------------------------------------
-void TabControl::InsertPage( sal_uInt16 nPageId, const XubString& rText,
+void TabControl::InsertPage( sal_uInt16 nPageId, const OUString& rText,
sal_uInt16 nPos )
{
DBG_ASSERT( nPageId, "TabControl::InsertPage(): PageId == 0" );
@@ -1984,7 +1984,7 @@ TabPage* TabControl::GetTabPage( sal_uInt16 nPageId ) const
// -----------------------------------------------------------------------
-void TabControl::SetPageText( sal_uInt16 nPageId, const XubString& rText )
+void TabControl::SetPageText( sal_uInt16 nPageId, const OUString& rText )
{
ImplTabItem* pItem = ImplGetItem( nPageId );
@@ -2007,45 +2007,41 @@ void TabControl::SetPageText( sal_uInt16 nPageId, const XubString& rText )
// -----------------------------------------------------------------------
-XubString TabControl::GetPageText( sal_uInt16 nPageId ) const
+OUString TabControl::GetPageText( sal_uInt16 nPageId ) const
{
ImplTabItem* pItem = ImplGetItem( nPageId );
- if ( pItem )
- return pItem->maText;
- else
- return ImplGetSVEmptyStr();
+ assert( pItem );
+
+ return pItem->maText;
}
// -----------------------------------------------------------------------
-void TabControl::SetHelpText( sal_uInt16 nPageId, const XubString& rText )
+void TabControl::SetHelpText( sal_uInt16 nPageId, const OUString& rText )
{
ImplTabItem* pItem = ImplGetItem( nPageId );
- if ( pItem )
- pItem->maHelpText = rText;
+ assert( pItem );
+
+ pItem->maHelpText = rText;
}
// -----------------------------------------------------------------------
-const XubString& TabControl::GetHelpText( sal_uInt16 nPageId ) const
+const OUString& TabControl::GetHelpText( sal_uInt16 nPageId ) const
{
ImplTabItem* pItem = ImplGetItem( nPageId );
- if ( pItem )
- {
- if ( !pItem->maHelpText.Len() && !pItem->maHelpId.isEmpty() )
- {
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list