[Libreoffice-commits] core.git: 3 commits - sd/source
Noel Grandin
noel at peralex.com
Thu Sep 19 04:55:40 PDT 2013
sd/source/core/drawdoc3.cxx | 28 ++++++++++++-----
sd/source/core/sdpage.cxx | 4 +-
sd/source/core/sdpage2.cxx | 4 +-
sd/source/core/stlfamily.cxx | 4 +-
sd/source/ui/func/fuinsfil.cxx | 8 +++-
sd/source/ui/sidebar/DocumentHelper.cxx | 8 +++-
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 4 +-
sd/source/ui/toolpanel/controls/DocumentHelper.cxx | 8 +++-
8 files changed, 51 insertions(+), 17 deletions(-)
New commits:
commit 8d8e10ab4c3ef890323dd9b21edab8e91b9068c2
Author: Noel Grandin <noel at peralex.com>
Date: Thu Sep 19 13:54:15 2013 +0200
restore behaviour after OUString changes
in commit ab0806e183fcdc8b2e4eca2d29b877a41f3ded8b,
"convert sd/.../fuinsfil.hxx from String to OUString"
my OUString conversion changed the behaviour of the
x.Erase(x.Search()) operations.
Change-Id: I0f7f342eb4caf277fe62c3c11d1aa2c74290e549
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index d789de7..42e180c 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -446,7 +446,9 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
aLayoutName = pPage->GetLayoutName();
- aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR));
+ sal_Int32 nIndex = aLayoutName.indexOf(SD_LT_SEPARATOR);
+ if( nIndex != -1 )
+ aLayoutName = aLayoutName.copy(0, nIndex);
pOutliner->SetPaperSize(pPage->GetSize());
@@ -583,7 +585,9 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
}
SdPage* pPage = mpDoc->GetSdPage(nPage, PK_STANDARD);
aLayoutName = pPage->GetLayoutName();
- aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR));
+ sal_Int32 nIndex = aLayoutName.indexOf(SD_LT_SEPARATOR);
+ if( nIndex != -1 )
+ aLayoutName = aLayoutName.copy(0, nIndex);
/* create our own outline since:
- it is possible that the document outliner is actually used in the
commit 7c34df7c6a65ce2ed616f6013f39121ce90e7c6b
Author: Noel Grandin <noel at peralex.com>
Date: Thu Sep 19 13:51:47 2013 +0200
restore behaviour after OUString changes
in commit 15d88e256dcf4d0bf567b5f320cefe55179e4bd8,
"convert more .cxx files in sd from String to OUString"
my OUString conversion changed the behaviour of the
x.Erase(x.Search()) operations.
Change-Id: I8150fdecde439fdc5eeae53d50ad0dd00c0c1879
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index cf64461..87b4acb 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -872,7 +872,9 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet)
{
pFirstPage = pPage;
aLayoutStr = pFirstPage->GetLayoutName();
- aLayoutStr = aLayoutStr.copy(0, aLayoutStr.indexOf( SD_LT_SEPARATOR ) );
+ sal_Int32 nIndex = aLayoutStr.indexOf( SD_LT_SEPARATOR );
+ if( nIndex != -1 )
+ aLayoutStr = aLayoutStr.copy(0, nIndex);
rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
}
if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
index 74848dd..ff8dcb2 100644
--- a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
+++ b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
@@ -264,7 +264,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 =
@@ -308,7 +310,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;
commit 3ea390cbd8fcb19dfefc0c8d8cf03510d3c6ea56
Author: Noel Grandin <noel at peralex.com>
Date: Thu Sep 19 13:23:24 2013 +0200
restore behaviour after OUString changes
in commit a2b86b5fb75925e7e8b24751f83e1ecc8584cf72, my OUString
conversion changed the behaviour of the x.Erase(x.Search())
operations.
Change-Id: Iad91980322b8cb46e8b2040f3fbd4e6cc1176424
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 336cdb3..3a20796 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 d310476..8e1e339 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 77d6e61..994727d 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 a17c324..fe265b7 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 5e3651e..6eb8a21 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;
More information about the Libreoffice-commits
mailing list