[Libreoffice-commits] core.git: 2 commits - sd/source
Michael Stahl
mstahl at redhat.com
Sat May 10 14:20:20 PDT 2014
sd/source/core/stlpool.cxx | 56 ++++++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 26 deletions(-)
New commits:
commit 2241dd8d83fa8a89502ad7985427c5c79d94ce21
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat May 10 23:04:45 2014 +0200
SdStyleSheetPool: de-dent that
Change-Id: Ifce20de3068e12c42bfcd115ad852371f97b971c
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 26490e0..84e970a 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -688,32 +688,30 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily
bAddToList = true;
}
}
+ // we do not already have a sheet with the same name and contents. Create a new one.
+ if (!pExistingSheet)
{
- // we do not already have a sheet with the same name and contents. Create a new one.
- if (!pExistingSheet)
- {
- assert(!Find(aName, eFamily));
- rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
+ assert(!Find(aName, eFamily));
+ rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
- xNewSheet->SetMask( xSheet->GetMask() );
+ xNewSheet->SetMask( xSheet->GetMask() );
- // Also set parent relation for copied style sheets
- OUString aParent( xSheet->GetParent() );
- if( !aParent.isEmpty() )
- aNewStyles.push_back( std::pair< rtl::Reference< SfxStyleSheetBase >, OUString >( xNewSheet, aParent ) );
+ // Also set parent relation for copied style sheets
+ OUString aParent( xSheet->GetParent() );
+ if( !aParent.isEmpty() )
+ aNewStyles.push_back( std::pair< rtl::Reference< SfxStyleSheetBase >, OUString >( xNewSheet, aParent ) );
- xNewSheet->SetHelpId( aHelpFile, xSheet->GetHelpId( aHelpFile ) );
- xNewSheet->GetItemSet().Put( xSheet->GetItemSet() );
+ xNewSheet->SetHelpId( aHelpFile, xSheet->GetHelpId( aHelpFile ) );
+ xNewSheet->GetItemSet().Put( xSheet->GetItemSet() );
- rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( xNewSheet.get() ) ) );
- aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
- }
- else if (bAddToList)
- {
- // Add to list - used for renaming
- rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pExistingSheet ) ) );
- aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
- }
+ rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( xNewSheet.get() ) ) );
+ aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
+ }
+ else if (bAddToList)
+ {
+ // Add to list - used for renaming
+ rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pExistingSheet ) ) );
+ aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
}
}
commit 3440766f0ad43454287a874b5fd34b6f2af6bdf1
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat May 10 23:00:54 2014 +0200
SdStyleSheetPool: fix numerous regressions when copying in Draw...
... from commit 0c17ccc493d0c7a80f37600dae76a09a119bef78.
Change-Id: Ib0848da26091899961c5ed95879f9306b13653dd
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 45133f1..26490e0 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -654,7 +654,8 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily
for (std::vector<unsigned>::const_iterator it = aSheetsWithFamily.begin();
it != aSheetsWithFamily.end(); ++it )
{
- rtl::Reference< SfxStyleSheetBase > xSheet = GetStyleSheetByPositionInIndex( *it );
+ rtl::Reference<SfxStyleSheetBase> const xSheet =
+ rSourcePool.GetStyleSheetByPositionInIndex( *it );
if( !xSheet.is() )
continue;
rtl::OUString aName( xSheet->GetName() );
@@ -662,12 +663,15 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily
// now check whether we already have a sheet with the same name
std::vector<unsigned> aSheetsWithName = GetIndexedStyleSheets().FindPositionsByName(aName);
bool bAddToList = false;
- if (!aSheetsWithName.empty() && !rRenameSuffix.isEmpty())
+ SfxStyleSheetBase * pExistingSheet = 0;
+ if (!aSheetsWithName.empty())
{
// if we have a rename suffix, try to find a new name
- SfxStyleSheetBase* pExistingSheet = GetStyleSheetByPositionInIndex(aSheetsWithName.front()).get();
+ pExistingSheet =
+ GetStyleSheetByPositionInIndex(aSheetsWithName.front()).get();
sal_Int32 nHash = xSheet->GetItemSet().getHash();
- if( pExistingSheet->GetItemSet().getHash() != nHash )
+ if (!rRenameSuffix.isEmpty() &&
+ pExistingSheet->GetItemSet().getHash() != nHash)
{
// we have found a sheet with the same name, but different contents. Try to find a new name.
// If we already have a sheet with the new name, and it is equal to the one in the source pool,
@@ -683,10 +687,12 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily
aName = aTmpName;
bAddToList = true;
}
-
+ }
+ {
// we do not already have a sheet with the same name and contents. Create a new one.
- if ( !pExistingSheet )
+ if (!pExistingSheet)
{
+ assert(!Find(aName, eFamily));
rtl::Reference< SfxStyleSheetBase > xNewSheet( &Make( aName, eFamily ) );
xNewSheet->SetMask( xSheet->GetMask() );
@@ -702,7 +708,7 @@ void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily
rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( xNewSheet.get() ) ) );
aRenamedList.push_back( std::pair< OUString, OUString >( xSheet->GetName(), aName ) );
}
- else if( bAddToList )
+ else if (bAddToList)
{
// Add to list - used for renaming
rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( pExistingSheet ) ) );
@@ -939,7 +945,7 @@ struct StyleSheetIsUserDefinedPredicate : svl::StyleSheetPredicate
bool Check(const SfxStyleSheetBase& sheet) SAL_OVERRIDE
{
- return sheet.IsUserDefined();
+ return !sheet.IsUserDefined();
}
};
}
More information about the Libreoffice-commits
mailing list