diff options
author | Noel Grandin <noel@peralex.com> | 2013-09-19 13:23:24 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-09-19 13:54:38 +0200 |
commit | 3ea390cbd8fcb19dfefc0c8d8cf03510d3c6ea56 (patch) | |
tree | 9c905d876d98b0b530416e6ff4918475c7149719 /sd | |
parent | 'de-1901' is a valid fallback, 'en-oed' is not (diff) | |
download | core-3ea390cbd8fcb19dfefc0c8d8cf03510d3c6ea56.tar.gz core-3ea390cbd8fcb19dfefc0c8d8cf03510d3c6ea56.zip |
restore behaviour after OUString changes
in commit a2b86b5fb75925e7e8b24751f83e1ecc8584cf72, my OUString
conversion changed the behaviour of the x.Erase(x.Search())
operations.
Change-Id: Iad91980322b8cb46e8b2040f3fbd4e6cc1176424
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 28 | ||||
-rw-r--r-- | sd/source/core/sdpage.cxx | 4 | ||||
-rw-r--r-- | sd/source/core/sdpage2.cxx | 4 | ||||
-rw-r--r-- | sd/source/core/stlfamily.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/sidebar/DocumentHelper.cxx | 8 |
5 files changed, 36 insertions, 12 deletions
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 336cdb31226e..3a207962851e 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -83,7 +83,9 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc // =================================================== OUString aFullNameLayout( pBMMPage->GetLayoutName() ); - aFullNameLayout = aFullNameLayout.copy(0, aFullNameLayout.indexOf( SD_LT_SEPARATOR )); + sal_Int32 nIndex = aFullNameLayout.indexOf( SD_LT_SEPARATOR ); + if( nIndex != -1 ) + aFullNameLayout = aFullNameLayout.copy(0, nIndex); OUString aLayout(aFullNameLayout); @@ -98,7 +100,9 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc // Do the layouts already exist within the document? SdPage* pTestPage = (SdPage*) rDoc.GetMasterPage(nMPage); OUString aFullTest(pTestPage->GetLayoutName()); - aFullTest = aFullTest.copy(0, aFullTest.indexOf( SD_LT_SEPARATOR )); + sal_Int32 nIndex2 = aFullTest.indexOf( SD_LT_SEPARATOR ); + if( nIndex2 != -1 ) + aFullTest = aFullTest.copy(0, nIndex2); OUString aTest(aFullTest); @@ -816,7 +820,9 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage( } OUString aLayout(pRefPage->GetLayoutName()); - aLayout = aLayout.copy(0, aLayout.indexOf( SD_LT_SEPARATOR )); + sal_Int32 nIndex = aLayout.indexOf( SD_LT_SEPARATOR ); + if( nIndex != -1 ) + aLayout = aLayout.copy(0, nIndex); // update layout and referred master page pRefPage->SetPresentationLayout(aLayout); @@ -1297,7 +1303,9 @@ bool isMasterPageLayoutNameUnique(const SdDrawDocument& rDoc, const OUString& rC { const SdrPage* pCandidate = rDoc.GetMasterPage(a); OUString aPageLayoutName(pCandidate->GetLayoutName()); - aPageLayoutName = aPageLayoutName.copy(0, aPageLayoutName.indexOf(SD_LT_SEPARATOR)); + sal_Int32 nIndex = aPageLayoutName.indexOf(SD_LT_SEPARATOR); + if( nIndex != -1 ) + aPageLayoutName = aPageLayoutName.copy(0, nIndex); if(aPageLayoutName == rCandidate) { @@ -1362,7 +1370,9 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, SdPage* pPage = NULL; OUString aOldPageLayoutName(pSelectedPage->GetLayoutName()); OUString aOldLayoutName(aOldPageLayoutName); - aOldLayoutName = aOldLayoutName.copy(0, aOldLayoutName.indexOf( SD_LT_SEPARATOR )); + sal_Int32 nIndex = aOldLayoutName.indexOf( SD_LT_SEPARATOR ); + if( nIndex != -1 ) + aOldLayoutName = aOldLayoutName.copy(0, nIndex); if (pSourceDoc) { @@ -1443,7 +1453,9 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, // layout name needs to be unique aTargetNewLayoutName = pMaster->GetLayoutName(); - aTargetNewLayoutName = aTargetNewLayoutName.copy(0, aTargetNewLayoutName.indexOf(SD_LT_SEPARATOR)); + sal_Int32 nIndex2 = aTargetNewLayoutName.indexOf(SD_LT_SEPARATOR); + if( nIndex2 != -1 ) + aTargetNewLayoutName = aTargetNewLayoutName.copy(0, nIndex2); if(!isMasterPageLayoutNameUnique(*this, aTargetNewLayoutName)) { @@ -1595,7 +1607,9 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, // master page OUString aPageLayoutName(pMaster->GetLayoutName()); OUString aLayoutName = aPageLayoutName; - aLayoutName = aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR )); + sal_Int32 nIndex2 = aLayoutName.indexOf( SD_LT_SEPARATOR ); + if( nIndex2 != -1 ) + aLayoutName = aLayoutName.copy( 0, nIndex2); // #i121863# Do *not* remove from original document any longer, it is potentially used there // and would lead to crashes. Rely on the automatic process of removing unused masterpages diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index d310476a8d75..8e1e3395662a 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -638,7 +638,9 @@ SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const { OUString aStyleName( pPage->GetLayoutName() ); const OUString aSep( SD_LT_SEPARATOR ); - aStyleName = aStyleName.copy(0, aStyleName.indexOf(aSep) + aSep.getLength()); + sal_Int32 nIndex = aStyleName.indexOf(aSep); + if( nIndex != -1 ) + aStyleName = aStyleName.copy(0, nIndex + aSep.getLength()); sal_uInt16 nNameId; switch( nHelpId ) diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 77d6e61b0e87..994727dc63ec 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -266,7 +266,9 @@ void SdPage::EndListenOutlineText() SdStyleSheetPool* pSPool = (SdStyleSheetPool*)pModel->GetStyleSheetPool(); DBG_ASSERT(pSPool, "StyleSheetPool missing"); OUString aTrueLayoutName(maLayoutName); - aTrueLayoutName = aTrueLayoutName.copy(0, aTrueLayoutName.indexOf( SD_LT_SEPARATOR )); + sal_Int32 nIndex = aTrueLayoutName.indexOf( SD_LT_SEPARATOR ); + if( nIndex != -1 ) + aTrueLayoutName = aTrueLayoutName.copy(0, nIndex); SfxStyleSheet *pSheet = NULL; std::vector<SfxStyleSheetBase*> aOutlineStyles; diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx index a17c3241bef4..fe265b7562a4 100644 --- a/sd/source/core/stlfamily.cxx +++ b/sd/source/core/stlfamily.cxx @@ -210,7 +210,9 @@ OUString SAL_CALL SdStyleFamily::getName() throw (RuntimeException) OUString aLayoutName( pPage->GetLayoutName() ); const OUString aSep( SD_LT_SEPARATOR ); - aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(aSep)); + sal_Int32 nIndex = aLayoutName.indexOf(aSep); + if( nIndex != -1 ) + aLayoutName = aLayoutName.copy(0, nIndex); return OUString( aLayoutName ); } diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx index 5e3651e4c514..6eb8a21f044f 100644 --- a/sd/source/ui/sidebar/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -263,7 +263,9 @@ void DocumentHelper::ProvideStyles ( { // Get the layout name of the given page. OUString sLayoutName (pPage->GetLayoutName()); - sLayoutName = sLayoutName.copy(0, sLayoutName.indexOf(SD_LT_SEPARATOR)); + sal_Int32 nIndex = sLayoutName.indexOf(SD_LT_SEPARATOR); + if( nIndex != -1 ) + sLayoutName = sLayoutName.copy(0, nIndex); // Copy the style sheet from source to target document. SdStyleSheetPool* pSourceStyleSheetPool = @@ -307,7 +309,9 @@ void DocumentHelper::AssignMasterPageToPageList ( // layout name of the given master page. OUString sFullLayoutName(pMasterPage->GetLayoutName()); OUString sBaseLayoutName (sFullLayoutName); - sBaseLayoutName = sBaseLayoutName.copy(0, sBaseLayoutName.indexOf(SD_LT_SEPARATOR)); + sal_Int32 nIndex = sBaseLayoutName.indexOf(SD_LT_SEPARATOR); + if( nIndex != -1 ) + sBaseLayoutName = sBaseLayoutName.copy(0, nIndex); if (rpPageList->empty()) return; |