diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2013-08-15 16:56:09 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2013-08-15 16:56:46 +0400 |
commit | 1edb495a45fde1d788b409fd1a9a839bd370c426 (patch) | |
tree | 3f113ad6c8232843816ea1bebe4daa5fd8a842f9 /sd | |
parent | 7cab33ab66e08f5757635b2989f83bbb7f9ebc67 (diff) |
convert GetName/Title/Description methods to OUString
Change-Id: Id16a2b29b1d6cf02b94cc6c423e2475a9cbeb8a3
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/docshell/docshel2.cxx | 60 | ||||
-rw-r--r-- | sd/source/ui/func/fulinend.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawDocShell.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsb.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsc.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/tabcontr.cxx | 2 |
9 files changed, 49 insertions, 51 deletions
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index 43e0b747c8b4..9306d8f33438 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -284,7 +284,7 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe * name. * @return sal_False if the user cancels the action. */ -sal_Bool DrawDocShell::CheckPageName (::Window* pWin, String& rName ) +sal_Bool DrawDocShell::CheckPageName (::Window* pWin, OUString& rName ) { const String aStrForDlg( rName ); bool bIsNameValid = IsNewPageNameValid( rName, true ); @@ -317,49 +317,47 @@ sal_Bool DrawDocShell::CheckPageName (::Window* pWin, String& rName ) return ( bIsNameValid ? sal_True : sal_False ); } -bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName /* = false */ ) +bool DrawDocShell::IsNewPageNameValid( OUString & rInOutPageName, bool bResetStringIfStandardName /* = false */ ) { bool bCanUseNewName = false; // check if name is something like 'Slide n' - String aStrPage( SdResId( STR_SD_PAGE ) ); - aStrPage += ' '; + OUString aStrPage(SD_RESSTR(STR_SD_PAGE) + " "); bool bIsStandardName = false; // prevent also _future_ slide names of the form "'STR_SD_PAGE' + ' ' + '[0-9]+|[a-z]|[A-Z]|[CDILMVX]+|[cdilmvx]+'" // (arabic, lower- and upper case single letter, lower- and upper case roman numbers) - if( 0 == rInOutPageName.Search( aStrPage ) ) + if (rInOutPageName.startsWith(aStrPage) && + rInOutPageName.getLength() > aStrPage.getLength()) { - if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= '0' && - rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= '9' ) + OUString sRemainder = rInOutPageName.getToken(1, ' '); + if (sRemainder[0] >= '0' && sRemainder[0] <= '9') { // check for arabic numbering - // gobble up all following numbers - String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') ); - while( sRemainder.Len() && - sRemainder.GetChar(0) >= '0' && - sRemainder.GetChar(0) <= '9' ) + sal_Int32 nIndex = 1; + // skip all following numbers + while (nIndex < sRemainder.getLength() && + sRemainder[nIndex] >= '0' && sRemainder[nIndex] <= '9') { - // trim by one - sRemainder.Erase(0, 1); + nIndex++; } // EOL? Reserved name! - if( !sRemainder.Len() ) + if (nIndex >= sRemainder.getLength()) { bIsStandardName = true; } } - else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 && - comphelper::string::islowerAscii(rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) ) ) + else if (sRemainder.getLength() == 1 && + comphelper::string::islowerAscii(sRemainder[0])) { // lower case, single character: reserved bIsStandardName = true; } - else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 && - comphelper::string::isupperAscii(rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) ) ) + else if (sRemainder.getLength() == 1 && + comphelper::string::isupperAscii(sRemainder[0])) { // upper case, single character: reserved bIsStandardName = true; @@ -367,21 +365,21 @@ bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStrin else { // check for upper/lower case roman numbering - String sReserved( OUString("cdilmvx") ); + OUString sReserved("cdilmvx"); - // gobble up all following characters contained in one reserved class - String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') ); - if( sReserved.Search( sRemainder.GetChar(0) ) == STRING_NOTFOUND ) - sReserved.ToUpperAscii(); + // skip all following characters contained in one reserved class + if (sReserved.indexOf(sRemainder[0]) == -1) + sReserved = sReserved.toAsciiUpperCase(); - while( sReserved.Search( sRemainder.GetChar(0) ) != STRING_NOTFOUND ) + sal_Int32 nIndex = 0; + while (nIndex < sRemainder.getLength() && + sReserved.indexOf(sRemainder[nIndex]) != -1) { - // trim by one - sRemainder.Erase(0, 1); + nIndex++; } // EOL? Reserved name! - if( !sRemainder.Len() ) + if (nIndex >= sRemainder.getLength()) { bIsStandardName = true; } @@ -395,7 +393,7 @@ bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStrin // this is for insertion of slides from other files with standard // name. They get a new standard name, if the string is set to an // empty one. - rInOutPageName = String(); + rInOutPageName = OUString(); bCanUseNewName = true; } else @@ -403,7 +401,7 @@ bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStrin } else { - if( rInOutPageName.Len() > 0 ) + if (!rInOutPageName.isEmpty()) { sal_Bool bOutDummy; sal_uInt16 nExistingPageNum = mpDoc->GetPageByName( rInOutPageName, bOutDummy ); @@ -421,7 +419,7 @@ IMPL_LINK( DrawDocShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog ) if( ! pDialog ) return 0; - String aNewName; + OUString aNewName; pDialog->GetName( aNewName ); return IsNewPageNameValid( aNewName ); diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx index 531ecda3225f..ae0520f47fa8 100644 --- a/sd/source/ui/func/fulinend.cxx +++ b/sd/source/ui/func/fulinend.cxx @@ -94,7 +94,7 @@ void FuLineEnd::DoExecute( SfxRequest& ) String aNewName( SdResId( STR_LINEEND ) ); String aDesc( SdResId( STR_DESC_LINEEND ) ); - String aName; + OUString aName; long nCount = pLineEndList->Count(); long j = 1; @@ -103,8 +103,8 @@ void FuLineEnd::DoExecute( SfxRequest& ) while( !bDifferent ) { aName = aNewName; - aName.Append( sal_Unicode(' ') ); - aName.Append( OUString::valueOf( j++ ) ); + aName += " "; + aName += OUString::number(j++); bDifferent = sal_True; for( long i = 0; i < nCount && bDifferent; i++ ) { diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index c36f038e1470..397fa88305b7 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -146,7 +146,7 @@ public: a default name of a not-yet-existing slide (e.g. 'Slide 17'), sal_True is returned, but rName is set to an empty string. */ - sal_Bool CheckPageName(::Window* pWin, String& rName ); + sal_Bool CheckPageName(::Window* pWin, OUString& rName ); void SetSlotFilter(sal_Bool bEnable = sal_False, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; } void ApplySlotFilter() const; @@ -177,7 +177,7 @@ public: is true, the return value is also true, if the slide name is a standard name (see above) */ - bool IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName = false ); + bool IsNewPageNameValid( OUString & rInOutPageName, bool bResetStringIfStandardName = false ); /** Return the reference device for the current document. When the diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 6b9c69048143..0e8babbae2e7 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -949,9 +949,9 @@ void SlotManager::RenameSlide (void) if( aNameDlg->Execute() == RET_OK ) { - String aNewName; + OUString aNewName; aNameDlg->GetName( aNewName ); - if( ! aNewName.Equals( aPageName ) ) + if (aNewName != aPageName) { #ifdef DBG_UTIL bool bResult = @@ -976,7 +976,7 @@ IMPL_LINK(SlotManager, RenameSlideHdl, AbstractSvxNameDialog*, pDialog) if( ! pDialog ) return 0; - String aNewName; + OUString aNewName; pDialog->GetName( aNewName ); model::SharedPageDescriptor pDescriptor ( @@ -985,7 +985,7 @@ IMPL_LINK(SlotManager, RenameSlideHdl, AbstractSvxNameDialog*, pDialog) if (pDescriptor.get() != NULL) pCurrentPage = pDescriptor->GetPage(); - return ( (pCurrentPage!=NULL && aNewName.Equals( pCurrentPage->GetName() )) + return ( (pCurrentPage!=NULL && aNewName == pCurrentPage->GetName()) || (mrSlideSorter.GetViewShell() && mrSlideSorter.GetViewShell()->GetDocSh()->IsNewPageNameValid( aNewName ) )); } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index f4f6eeb2136d..d1d96b32dbeb 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -445,9 +445,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if( aNameDlg->Execute() == RET_OK ) { - String aNewName; + OUString aNewName; aNameDlg->GetName( aNewName ); - if( ! aNewName.Equals( aPageName ) ) + if (aNewName != aPageName) { #ifdef DBG_UTIL bool bResult = @@ -2036,7 +2036,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) // #i68101# SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L); OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); - String aName(pSelected->GetName()); + OUString aName(pSelected->GetName()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); @@ -2070,8 +2070,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { SdrObject* pSelected = mpDrawView->GetMarkedObjectByIndex(0L); OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); - String aTitle(pSelected->GetTitle()); - String aDescription(pSelected->GetDescription()); + OUString aTitle(pSelected->GetTitle()); + OUString aDescription(pSelected->GetDescription()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx index e2e402f7544c..26dc337f6124 100644 --- a/sd/source/ui/view/drviewsb.cxx +++ b/sd/source/ui/view/drviewsb.cxx @@ -146,12 +146,12 @@ IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog ) if( ! pDialog ) return 0; - String aNewName; + OUString aNewName; pDialog->GetName( aNewName ); SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() ); - return pCurrentPage && ( aNewName.Equals( pCurrentPage->GetName() ) || GetDocSh()->IsNewPageNameValid( aNewName ) ); + return pCurrentPage && ( aNewName == pCurrentPage->GetName() || GetDocSh()->IsNewPageNameValid( aNewName ) ); } diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx index d39a2f220085..3649dea72fc9 100644 --- a/sd/source/ui/view/drviewsc.cxx +++ b/sd/source/ui/view/drviewsc.cxx @@ -361,12 +361,12 @@ void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog ) { - String aName; + OUString aName; if( pDialog ) pDialog->GetName( aName ); - return( ( !aName.Len() || ( GetDoc() && !GetDoc()->GetObj( aName ) ) ) ? 1 : 0 ); + return ( aName.isEmpty() || ( GetDoc() && !GetDoc()->GetObj( aName ) ) ) ? 1 : 0; } } // end of namespace sd diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index caa35322ae46..50213b614a4b 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -905,7 +905,7 @@ bool View::GetExchangeList (std::vector<OUString> &rExchangeList, std::vector<OUString>::const_iterator pIter; for ( pIter = rBookmarkList.begin(); bNameOK && pIter != rBookmarkList.end(); ++pIter ) { - String aNewName = *pIter; + OUString aNewName = *pIter; if( nType == 0 || nType == 2 ) bNameOK = mpDocSh->CheckPageName(mpViewSh->GetActiveWindow(), aNewName); diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index 379296e0a795..0dec8d62bf2a 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -323,7 +323,7 @@ long TabControl::AllowRenaming() { sal_Bool bOK = sal_True; - String aNewName( GetEditText() ); + OUString aNewName( GetEditText() ); OUString aCompareName( GetPageText( GetEditPageId() ) ); if( aCompareName != aNewName ) |