summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-11-06 14:59:49 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-11-06 16:07:08 +0000
commit8ec5b1a267b229aec50c40c6d2acec1ad48da4b1 (patch)
tree32dc572e9b8a1b53f798c184ac7de6f526f8f8e8 /sd/source
parenta6f3f05e9623254a18b2403316dacb6136400733 (diff)
refactor MasterLayoutDialog::remove to SdPage::DestroyDefaultPresObj
Change-Id: If4edb16b2e94396249f3e2ba99381fcd8341d790
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/core/sdpage.cxx19
-rw-r--r--sd/source/ui/dlg/masterlayoutdlg.cxx18
2 files changed, 22 insertions, 15 deletions
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 75e41fb8b085..355400b1eb90 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1019,6 +1019,25 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
}
}
+void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
+{
+ SdrObject* pObject = GetPresObj( eObjKind );
+
+ if( pObject )
+ {
+ SdDrawDocument *pDoc = static_cast<SdDrawDocument*>(pModel);
+
+ const bool bUndo = pDoc->IsUndoEnabled();
+ if( bUndo )
+ pDoc->AddUndo(pDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject));
+ SdrObjList* pOL = pObject->GetObjList();
+ pOL->RemoveObject(pObject->GetOrdNumDirect());
+
+ if( !bUndo )
+ SdrObject::Free(pObject);
+ }
+}
+
/*************************************************************************
|*
|* return title area
diff --git a/sd/source/ui/dlg/masterlayoutdlg.cxx b/sd/source/ui/dlg/masterlayoutdlg.cxx
index d9e525f39a2f..840037256ef2 100644
--- a/sd/source/ui/dlg/masterlayoutdlg.cxx
+++ b/sd/source/ui/dlg/masterlayoutdlg.cxx
@@ -121,26 +121,14 @@ void MasterLayoutDialog::applyChanges()
mpDoc->EndUndo();
}
-void MasterLayoutDialog::create( PresObjKind eKind )
+void MasterLayoutDialog::create(PresObjKind eKind)
{
- mpCurrentPage->CreateDefaultPresObj( eKind, true );
+ mpCurrentPage->CreateDefaultPresObj(eKind, true);
}
void MasterLayoutDialog::remove( PresObjKind eKind )
{
- SdrObject* pObject = mpCurrentPage->GetPresObj( eKind );
-
- if( pObject )
- {
- const bool bUndo = mpDoc->IsUndoEnabled();
- if( bUndo )
- mpDoc->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject));
- SdrObjList* pOL =pObject->GetObjList();
- pOL->RemoveObject(pObject->GetOrdNumDirect());
-
- if( !bUndo )
- SdrObject::Free(pObject);
- }
+ mpCurrentPage->DestroyDefaultPresObj(eKind);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */