summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/drawview.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/view/drawview.cxx')
-rw-r--r--sd/source/ui/view/drawview.cxx206
1 files changed, 128 insertions, 78 deletions
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index eb5613c1742b..b67fb350ca3a 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -132,12 +132,38 @@ void DrawView::ModelHasChanged()
*/
bool DrawView::SetAttributes(const SfxItemSet& rSet,
- bool bReplaceAll)
+ bool bReplaceAll, bool bSlide, bool bMaster)
{
bool bOk = false;
+ if (mpDrawViewShell && bMaster)
+ {
+ SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
+ SdPage& rPage = *mpDrawViewShell->getCurrentPage();
+ SdrPage& rMasterPage = rPage.TRG_GetMasterPage();
+ size_t nObjCount = rMasterPage.GetObjCount();
+ for (size_t nObj = 0; nObj < nObjCount; ++nObj)
+ {
+ SdrObject* pObject = rMasterPage.GetObj(nObj);
+ SetMasterAttributes(pObject, rPage, rSet, pStShPool, bOk, bMaster, bSlide);
+ }
+ return bOk;
+ }
+ if (mpDrawViewShell && bSlide)
+ {
+ SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
+ SdPage& rPage = *mpDrawViewShell->getCurrentPage();
+ size_t nObjCount = rPage.GetObjCount();
+ for (size_t nObj = 0; nObj < nObjCount; ++nObj)
+ {
+ SdrObject* pObject = rPage.GetObj(nObj);
+ SetMasterAttributes(pObject, rPage, rSet, pStShPool, bOk, bMaster, bSlide);
+ }
+ return bOk;
+ }
+
// is there a masterpage edit?
- if ( mpDrawViewShell && mpDrawViewShell->GetEditMode() == EditMode::MasterPage )
+ if ( mpDrawViewShell && (mpDrawViewShell->GetEditMode() == EditMode::MasterPage) )
{
SfxStyleSheetBasePool* pStShPool = mrDoc.GetStyleSheetPool();
SdPage& rPage = *mpDrawViewShell->getCurrentPage();
@@ -274,100 +300,124 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
for (size_t nMark = 0; nMark < nMarkCount; ++nMark)
{
SdrObject* pObject = rList.GetMark(nMark)->GetMarkedSdrObj();
- SdrInventor nInv = pObject->GetObjInventor();
+ SetMasterAttributes(pObject, rPage, rSet, pStShPool, bOk, bMaster, bSlide);
+ }
- if (nInv == SdrInventor::Default)
- {
- sal_uInt16 eObjKind = pObject->GetObjIdentifier();
- PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
+ if(!bOk)
+ bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
+ }
+ }
+ else // not at masterpage
+ {
+ bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
+ }
- if (ePresObjKind == PRESOBJ_TITLE ||
- ePresObjKind == PRESOBJ_NOTES)
- {
- // Presentation object (except outline)
- SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
- DBG_ASSERT(pSheet, "StyleSheet not found");
+ return bOk;
+}
- SfxItemSet aTempSet( pSheet->GetItemSet() );
- aTempSet.Put( rSet );
- aTempSet.ClearInvalidItems();
+void DrawView::SetMasterAttributes( SdrObject* pObject, SdPage& rPage, SfxItemSet rSet, SfxStyleSheetBasePool* pStShPool, bool& bOk, bool /*bMaster*/, bool bSlide )
+{
+ SdrInventor nInv = pObject->GetObjInventor();
- // Undo-Action
- mpDocSh->GetUndoManager()->AddUndoAction(
- std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
+ if (nInv == SdrInventor::Default)
+ {
+ sal_uInt16 eObjKind = pObject->GetObjIdentifier();
+ PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
+ if (bSlide && eObjKind == OBJ_TEXT)
+ {
+ // Presentation object (except outline)
+ SfxStyleSheet* pSheet = rPage.GetTextStyleSheetForObject(pObject);
+ DBG_ASSERT(pSheet, "StyleSheet not found");
- pSheet->GetItemSet().Put(aTempSet,false);
- pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
- bOk = true;
- }
- else if (eObjKind == OBJ_OUTLINETEXT)
- {
- // Presentation object outline
- for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
- {
- OUString aName = rPage.GetLayoutName() + " " +
- OUString::number(nLevel);
- SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pStShPool->
- Find(aName, SfxStyleFamily::Page));
- DBG_ASSERT(pSheet, "StyleSheet not found");
+ SfxItemSet aTempSet( pSheet->GetItemSet() );
+ aTempSet.Put( rSet );
+ aTempSet.ClearInvalidItems();
- SfxItemSet aTempSet( pSheet->GetItemSet() );
+ // Undo-Action
+ mpDocSh->GetUndoManager()->AddUndoAction(
+ std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
- if( nLevel > 1 )
- {
- // for all levels over 1, clear all items that will be
- // hard set to level 1
- SfxWhichIter aWhichIter(rSet);
- sal_uInt16 nWhich(aWhichIter.FirstWhich());
- while( nWhich )
- {
- if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
- aTempSet.ClearItem( nWhich );
- nWhich = aWhichIter.NextWhich();
- }
+ pSheet->GetItemSet().Put(aTempSet,false);
+ pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
+ bOk = true;
+ }
- }
- else
- {
- // put the items hard into level one
- aTempSet.Put( rSet );
- }
+ if (!bSlide &&
+ (ePresObjKind == PRESOBJ_TITLE ||
+ ePresObjKind == PRESOBJ_NOTES))
+ {
+ // Presentation object (except outline)
+ SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
+ DBG_ASSERT(pSheet, "StyleSheet not found");
- aTempSet.ClearInvalidItems();
+ SfxItemSet aTempSet( pSheet->GetItemSet() );
+ aTempSet.Put( rSet );
+ aTempSet.ClearInvalidItems();
- // Undo-Action
- mpDocSh->GetUndoManager()->AddUndoAction(
- std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
+ // Undo-Action
+ mpDocSh->GetUndoManager()->AddUndoAction(
+ std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
- pSheet->GetItemSet().Set(aTempSet,false);
- pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
- }
+ pSheet->GetItemSet().Put(aTempSet,false);
+ pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
+ bOk = true;
+ }
+ else if (eObjKind == OBJ_OUTLINETEXT)
+ {
+ // Presentation object outline
+ for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
+ {
+ OUString aName = rPage.GetLayoutName() + " " +
+ OUString::number(nLevel);
+ SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pStShPool->
+ Find(aName, SfxStyleFamily::Page));
+ DBG_ASSERT(pSheet, "StyleSheet not found");
- // remove all hard set items from shape that are now set in style
- SfxWhichIter aWhichIter(rSet);
- sal_uInt16 nWhich(aWhichIter.FirstWhich());
- while( nWhich )
- {
- if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
- pObject->ClearMergedItem( nWhich );
- nWhich = aWhichIter.NextWhich();
- }
+ SfxItemSet aTempSet( pSheet->GetItemSet() );
- bOk = true;
+ if( nLevel > 1 )
+ {
+ // for all levels over 1, clear all items that will be
+ // hard set to level 1
+ SfxWhichIter aWhichIter(rSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ while( nWhich )
+ {
+ if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
+ aTempSet.ClearItem( nWhich );
+ nWhich = aWhichIter.NextWhich();
}
+
}
+ else
+ {
+ // put the items hard into level one
+ aTempSet.Put( rSet );
+ }
+
+ aTempSet.ClearInvalidItems();
+
+ // Undo-Action
+ mpDocSh->GetUndoManager()->AddUndoAction(
+ std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
+
+ pSheet->GetItemSet().Set(aTempSet,false);
+ pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
}
- if(!bOk)
- bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
- }
- }
- else // not at masterpage
- {
- bOk = ::sd::View::SetAttributes(rSet, bReplaceAll);
- }
+ // remove all hard set items from shape that are now set in style
+ SfxWhichIter aWhichIter(rSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ while( nWhich )
+ {
+ if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
+ pObject->ClearMergedItem( nWhich );
+ nWhich = aWhichIter.NextWhich();
+ }
- return bOk;
+ bOk = true;
+ }
+ }
}
/**