diff -ru sd.orig/source/ui/func/fupage.cxx sd/source/ui/func/fupage.cxx --- sd.orig/source/ui/func/fupage.cxx 2010-02-12 14:18:44.000000000 +0000 +++ sd/source/ui/func/fupage.cxx 2010-02-12 15:39:15.000000000 +0000 @@ -87,6 +87,7 @@ #include "undoback.hxx" #include "sdabstdlg.hxx" #include "sdresid.hxx" +#include "sdundogr.hxx" #include "helpids.h" namespace sd { @@ -391,10 +392,43 @@ 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); + if (SdrObject *pObj = pPage->GetBackgroundObj()) + { + SdBackgroundObjUndoAction *pBackgroundObjUndoAction = + new SdBackgroundObjUndoAction(*mpDoc, *pPage, pObj); + pUndoGroup->AddAction(pBackgroundObjUndoAction); + pPage->SetBackgroundObj(NULL); + pPage->ActionChanged(); + } + } + + pUndoMgr->AddUndoAction(pUndoGroup); + pUndoMgr->LeaveListAction(); } const SfxPoolItem *pItem;