diff options
author | Christian Lippka <christian.lippka@sun.com> | 2010-03-09 15:30:04 +0100 |
---|---|---|
committer | Christian Lippka <christian.lippka@sun.com> | 2010-03-09 15:30:04 +0100 |
commit | 007870b2956c7e8bc734f68b9663063847bee65c (patch) | |
tree | 032429dfc1a4c37ea66049cb1a83931cd68b7bb7 /sd | |
parent | 2caeda091a394dd134783dbd1656910f730ad040 (diff) |
#i109210# set backgrounds to all master if user choose so
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 420f6d762065..df3ae9272652 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -87,6 +87,7 @@ #include "undoback.hxx" #include "sdabstdlg.hxx" #include "sdresid.hxx" +#include "sdundogr.hxx" #include "helpids.h" namespace sd { @@ -401,10 +402,51 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent ) if( mbMasterPage ) { +/* StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyleSheet, &(*pTempSet.get())); mpDocSh->GetUndoManager()->AddUndoAction(pAction); pStyleSheet->GetItemSet().Put( *(pTempSet.get()) ); pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); +*/ + String aComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT)); + SfxUndoManager* pUndoMgr = mpDocSh->GetUndoManager(); + pUndoMgr->EnterListAction(aComment, aComment); + SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc); + pUndoGroup->SetComment(aComment); + + //Set background on all master pages + USHORT nMasterPageCount = mpDoc->GetMasterSdPageCount(ePageKind); + for (USHORT i = 0; i < nMasterPageCount; ++i) + { + SdPage *pMasterPage = mpDoc->GetMasterSdPage(i, ePageKind); + SdStyleSheet *pStyle = + pMasterPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND); + StyleSheetUndoAction* pAction = + new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyle, &(*pTempSet.get())); + pUndoGroup->AddAction(pAction); + pStyle->GetItemSet().Put( *(pTempSet.get()) ); + pStyle->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); + } + + //Remove background from all pages to reset to the master bg + USHORT nPageCount(mpDoc->GetSdPageCount(ePageKind)); + for(USHORT i=0; i<nPageCount; ++i) + { + SdPage *pPage = mpDoc->GetSdPage(i, ePageKind); + + const SfxItemSet& rFillAttributes = pPage->getSdrPageProperties().GetItemSet(); + if(XFILL_NONE != ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue()) + { + SdBackgroundObjUndoAction *pBackgroundObjUndoAction = new SdBackgroundObjUndoAction(*mpDoc, *pPage, rFillAttributes); + pUndoGroup->AddAction(pBackgroundObjUndoAction); + pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE)); + pPage->ActionChanged(); + } + } + + pUndoMgr->AddUndoAction(pUndoGroup); + pUndoMgr->LeaveListAction(); + } const SfxPoolItem *pItem; |