summaryrefslogtreecommitdiff
path: root/sd/source/core/stlsheet.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/core/stlsheet.cxx')
-rw-r--r--sd/source/core/stlsheet.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index c59762127b5b..b103ab00adec 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -967,16 +967,25 @@ void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName ) throw
if( !rParentName.isEmpty() )
{
+ OUString const name(GetName());
+ sal_Int32 const sep(name.indexOf(SD_LT_SEPARATOR));
+ OUString const master((sep == -1) ? OUString() : name.copy(0, sep));
boost::shared_ptr<SfxStyleSheetIterator> aSSSI = boost::make_shared<SfxStyleSheetIterator>(mxPool.get(), nFamily);
for (SfxStyleSheetBase *pStyle = aSSSI->First(); pStyle; pStyle = aSSSI->Next())
{
// we hope that we have only sd style sheets
SdStyleSheet* pSdStyleSheet = static_cast<SdStyleSheet*>(pStyle);
- if (pSdStyleSheet->msApiName == rParentName)
+ OUString const curName(pStyle->GetName());
+ sal_Int32 const curSep(curName.indexOf(SD_LT_SEPARATOR));
+ OUString const curMaster((curSep == -1)
+ ? OUString() : curName.copy(0, sep));
+ // check that the master matches, as msApiName exists once per
+ // master page
+ if (pSdStyleSheet->msApiName == rParentName && master == curMaster)
{
if( pStyle != this )
{
- SetParent( pStyle->GetName() );
+ SetParent(curName);
}
return;
}