diff options
Diffstat (limited to 'sd/source/ui/func/fupage.cxx')
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 80 |
1 files changed, 35 insertions, 45 deletions
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 134646f2368e..de1dadc3ae43 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -276,20 +276,28 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) } else { - // Only this page, check if there is a background-object on that page - SdrObject* pObj = mpPage->GetBackgroundObj(); - if( pObj ) + // Only this page, get attributes for background fill + const SfxItemSet& rBackgroundAttributes = mpPage->getSdrPageProperties().GetItemSet(); + + if(XFILL_NONE != ((const XFillStyleItem&)rBackgroundAttributes.Get(XATTR_FILLSTYLE)).GetValue()) { - aMergedAttr.Put(pObj->GetMergedItemSet()); + // page attributes are used, take them + aMergedAttr.Put(rBackgroundAttributes); } else { - // if the page hasn't got a background-object, than use - // the fillstyle-settings of the masterpage for the dialog - if( pStyleSheet && pStyleSheet->GetItemSet().GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DEFAULT ) - mergeItemSetsImpl( aMergedAttr, pStyleSheet->GetItemSet() ); + if(pStyleSheet + && XFILL_NONE != ((const XFillStyleItem&)pStyleSheet->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue()) + { + // if the page has no fill style, use the settings from the + // background stylesheet (if used) + mergeItemSetsImpl(aMergedAttr, pStyleSheet->GetItemSet()); + } else - aMergedAttr.Put( XFillStyleItem( XFILL_NONE ) ); + { + // no fill style from page, start with no fill style + aMergedAttr.Put(XFillStyleItem(XFILL_NONE)); + } } } } @@ -371,12 +379,14 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) if( mbPageBckgrdDeleted ) { - mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction( *mpDoc, *mpPage, mpPage->GetBackgroundObj() ); - mpPage->SetBackgroundObj( NULL ); - - // #110094#-15 - // tell the page that it's visualization has changed - mpPage->ActionChanged(); + mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction( + *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()); + + if(!mpPage->IsMasterPage()) + { + // on normal pages, switch off fill attribute usage + mpPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE)); + } } } @@ -403,15 +413,12 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) mpDoc->SetChanged(TRUE); - SdrObject* pObj = mpPage->IsMasterPage() ? - mpPage->GetPresObj( PRESOBJ_BACKGROUND ) : - ((SdPage&)(mpPage->TRG_GetMasterPage())).GetPresObj( PRESOBJ_BACKGROUND ); - if( pObj ) - { - // BackgroundObj: no hard attributes allowed - SfxItemSet aSet( mpDoc->GetPool() ); - pObj->SetMergedItemSet(aSet); - } + // BackgroundFill of Masterpage: no hard attributes allowed + SdrPage& rUsedMasterPage = mpPage->IsMasterPage() ? *mpPage : mpPage->TRG_GetMasterPage(); + OSL_ENSURE(rUsedMasterPage.IsMasterPage(), "No MasterPage (!)"); + rUsedMasterPage.getSdrPageProperties().ClearItem(); + OSL_ENSURE(0 != rUsedMasterPage.getSdrPageProperties().GetStyleSheet(), + "MasterPage without StyleSheet detected (!)"); } aNewAttr.Put(*(pTempSet.get())); @@ -536,28 +543,11 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs ) if( !mbMasterPage && !mbPageBckgrdDeleted ) { // Only this page - SdrObject* pObj = mpPage->GetBackgroundObj(); - delete mpBackgroundObjUndoAction; - mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction( *mpDoc, *mpPage, pObj ); - - if( !pObj ) - { - pObj = new SdrRectObj(); - mpPage->SetBackgroundObj( pObj ); - } - - Point aPos ( nLeft, nUpper ); - Size aSize( mpPage->GetSize() ); - aSize.Width() -= nLeft + nRight - 1; - aSize.Height() -= nUpper + nLower - 1; - Rectangle aRect( aPos, aSize ); - pObj->SetLogicRect( aRect ); - pObj->SetMergedItemSet(*pArgs); - - // #110094#-15 - // tell the page that it's visualization has changed - mpPage->ActionChanged(); + mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction( + *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()); + mpPage->getSdrPageProperties().ClearItem(); + mpPage->getSdrPageProperties().PutItemSet(*pArgs); } } |