summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de (CIB)>2018-03-01 15:54:32 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-07 00:28:30 +0200
commitdfefe448c41921f2f1e54d3f69b8b9e89031d055 (patch)
tree1aace31054b5740e2faffcbc5de66a791be27f7d /basctl
parenteba4d5b2b76cefde90cb3d6638c736f435023a45 (diff)
SOSAW080: Added first bunch of basic changes to helpers
SOSAW080: Make SdrModel& prerequisite to SdrObjects Added need for SdrModel& in constructors of SdrModel, SdrPage, SdrView and SdrObjList. Builds, not finished. SOSAW080: removed and replaced old SdrModel Removed and replaced GetModel()/SetModel() in all using classes (SdrObject, SdrPage, SdrView), added accessors to new referenced SdrModel, adapted all accessing places. Refactored/Extended ::Clone and ::operator== for these classes to allow cloning objects to a target SdrModel. Adapted places where this is done AFAP. Added quite some comments (tagged with 'TTTT') where possible further work is needed. Builds completely, thus checking in. This does not mean that this change is done yet. SOSAW080: Adapted SdrPage/SdrModel relationship Also needed to work on copy-construction of SdrPage and hierarchy, quite some stuff removed, no copy-constructor anymore, no MigrateItemPool stuff. Builds well, test stuck, will need some cleanup/finetunung SOSAW080: Smaller corrections/includes adapted SOSAW080: Smaller corrections/includes adapted SOSAW080: Debugging/Stabilizing/MakeUnitTestWork SOSAW080: Stabilized for UnitTests, cleanups SOSAW080: Adapted GetObjGraphic to just take a const SdrObject& SOSAW080: Removed ChangeModel from classes Classes SvxTextEditSource and SvxDrawPage (including TextEditSource stuff) do not need change of SdrModel anymore. SOSAW080: Adapted some comments to make more readable SOSAW080: Corrected constructor SOSAW080: getSdrModelFromUnoModel added override marks SOSAW080: Added missing includes SOSAW080: Corrected SdrPage constructor SOSAW080: Corrected some SdrObject::Clone scenarios Especially when cloning to another SdrModel and taking the sdr::properties into account. SOSAW080: Added include for Mac-Build SOSAW080: Added Scale to DefaultProperties If a SdrModel change happens in DefaultProperties copy constructor (used from Clone()), potentially a Scale for the SfxItems has to be done. SOSAW080: Added missing include for MacBuild SOSAW080: Corrected CppunitTest_sc_anchor_test An adaption of a SdrPathObj instantiation was missing, added that. Seems as if that test is no tpart of the usual 'make' scenario, but used/executed in gerrit builds SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Free SdrObjects when SdrModel goes down In an UNO API test problem is that SvxShapes reference SdrShapes, but these are not added to a SdrPage and not 'owned' by the SvxShape. Thus these do not get deleted at all (same in master, memory leak). I extended SvxShape::Notify the case for ModelCleared to also Free the SdrObject when not owner and it's not added to a SdrPage (in that case it gets deleted with deleting the SdrModel) SOSAW080: Solve UNO API calls that move SvxShapes to other Model Due to UNO API tests I got a call to insert an xShape to a xDrawPage which was constructed in another Model, this has now to be done by Cloning the SdrObject to the new SdrModel, getting rid of the old one and getting all the UNO implementation stuff right (referemces SdrObject <-> xShape). 1cb7d573d323e98a89761fe662c10c4a654fdec0 24617494a0ef79f6e33dfcb02782a833a81c6434 763f39094b6a48b529a6952d01468f8776c97679 242b9e228a9a042c3a5bdd38b1ea6600144276d5 242b9e228a9a042c3a5bdd38b1ea6600144276d5 33a6f3f306b70c223171aef796dd5ee041ad14df 6878b33f8b05738a44c0910e40a60a0f0d1d58ed 0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2 8c4626274a5cc531dad27f27c0c45d4c528fb2fb 446685a49a6d67aedd01cfbbd5e87b07f97a4d7b c1b5ed3c99bc7219a0061e4ece24ea42afd2889a 22de9a1c8af7c25be5c108671ddc548ba323ed47 4caf6b6fbbe6e8130741d793dffb560fd01d4ed5 488b9601735ec1822433f82f633990063951fe08 c366d60299f239e3df856ddffedb19e743e4be0c c5137ba8c597c7b5f90318df50e87b93a39a28dc f9e646242cf89f6fde1315046952252a2c429779 f830fbc5fadd89d04be5edd2a5abf9b0d4bf0410 1694b54903df784385abaa8452e1201e12344238 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 7b5c241faec7488924e5935ae8b19f785846b5e4 bf097ee7467895823fbd158a2a9543da3b5a5078 Change-Id: Iaf53535de0502a481466be74a1768bbb39f0e78c Reviewed-on: https://gerrit.libreoffice.org/52526 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/dlged/dlged.cxx12
-rw-r--r--basctl/source/dlged/dlgedfac.cxx60
-rw-r--r--basctl/source/dlged/dlgedobj.cxx38
-rw-r--r--basctl/source/dlged/dlgedpage.cxx32
-rw-r--r--basctl/source/dlged/dlgedview.cxx8
-rw-r--r--basctl/source/inc/dlgedobj.hxx14
-rw-r--r--basctl/source/inc/dlgedpage.hxx7
-rw-r--r--basctl/source/inc/dlgedview.hxx6
8 files changed, 90 insertions, 87 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index ec3a2e0c3045..186e83521b05 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -347,7 +347,7 @@ void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xU
m_xUnoControlDialogModel = xUnoControlDialogModel;
// create dialog form
- pDlgEdForm = new DlgEdForm(*this);
+ pDlgEdForm = new DlgEdForm(*pDlgEdModel, *this);
uno::Reference< awt::XControlModel > xDlgMod( m_xUnoControlDialogModel , uno::UNO_QUERY );
pDlgEdForm->SetUnoControlModel(xDlgMod);
static_cast<DlgEdPage*>(pDlgEdModel->GetPage(0))->SetDlgEdForm( pDlgEdForm );
@@ -391,7 +391,7 @@ void DlgEditor::SetDialog( const uno::Reference< container::XNameContainer >& xU
Any aCtrl = xNameAcc->getByName( indexToName.second );
Reference< css::awt::XControlModel > xCtrlModel;
aCtrl >>= xCtrlModel;
- DlgEdObj* pCtrlObj = new DlgEdObj();
+ DlgEdObj* pCtrlObj = new DlgEdObj(*pDlgEdModel);
pCtrlObj->SetUnoControlModel( xCtrlModel );
pCtrlObj->SetDlgEdForm( pDlgEdForm );
pDlgEdForm->AddChild( pCtrlObj );
@@ -609,7 +609,11 @@ void DlgEditor::SetInsertObj( sal_uInt16 eObj )
void DlgEditor::CreateDefaultObject()
{
// create object by factory
- SdrObject* pObj = SdrObjFactory::MakeNewObject( pDlgEdView->GetCurrentObjInventor(), pDlgEdView->GetCurrentObjIdentifier(), pDlgEdPage );
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ *pDlgEdModel,
+ pDlgEdView->GetCurrentObjInventor(),
+ pDlgEdView->GetCurrentObjIdentifier(),
+ pDlgEdPage);
if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj))
{
@@ -920,7 +924,7 @@ void DlgEditor::Paste()
Reference< util::XCloneable > xClone( xCM, uno::UNO_QUERY );
Reference< awt::XControlModel > xCtrlModel( xClone->createClone(), uno::UNO_QUERY );
- DlgEdObj* pCtrlObj = new DlgEdObj();
+ DlgEdObj* pCtrlObj = new DlgEdObj(*pDlgEdModel);
pCtrlObj->SetDlgEdForm(pDlgEdForm); // set parent form
pDlgEdForm->AddChild(pCtrlObj); // add child to parent form
pCtrlObj->SetUnoControlModel( xCtrlModel ); // set control model
diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx
index a3e7b62ae14e..be8e592fbd1f 100644
--- a/basctl/source/dlged/dlgedfac.cxx
+++ b/basctl/source/dlged/dlgedfac.cxx
@@ -69,27 +69,27 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
switch( aParams.nObjIdentifier )
{
case OBJ_DLG_PUSHBUTTON:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlButtonModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlButtonModel", xDialogSFact );
break;
case OBJ_DLG_RADIOBUTTON:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlRadioButtonModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlRadioButtonModel", xDialogSFact );
break;
case OBJ_DLG_FORMRADIO:
- pNewObj = new DlgEdObj( "com.sun.star.form.component.RadioButton", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.form.component.RadioButton", xDialogSFact );
static_cast< DlgEdObj* >( pNewObj )->MakeDataAware( mxModel );
break;
case OBJ_DLG_CHECKBOX:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlCheckBoxModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlCheckBoxModel", xDialogSFact );
break;
case OBJ_DLG_FORMCHECK:
- pNewObj = new DlgEdObj( "com.sun.star.form.component.CheckBox", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.form.component.CheckBox", xDialogSFact );
static_cast< DlgEdObj* >( pNewObj )->MakeDataAware( mxModel );
break;
case OBJ_DLG_LISTBOX:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlListBoxModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlListBoxModel", xDialogSFact );
break;
case OBJ_DLG_FORMLIST:
- pNewObj = new DlgEdObj( "com.sun.star.form.component.ListBox", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.form.component.ListBox", xDialogSFact );
static_cast< DlgEdObj* >( pNewObj )->MakeDataAware( mxModel );
break;
case OBJ_DLG_FORMCOMBO:
@@ -97,10 +97,10 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
{
DlgEdObj* pNew = nullptr;
if ( aParams.nObjIdentifier == OBJ_DLG_COMBOBOX )
- pNew = new DlgEdObj( "com.sun.star.awt.UnoControlComboBoxModel", xDialogSFact );
+ pNew = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlComboBoxModel", xDialogSFact );
else
{
- pNew = new DlgEdObj( "com.sun.star.form.component.ComboBox", xDialogSFact );
+ pNew = new DlgEdObj(aParams.rSdrModel, "com.sun.star.form.component.ComboBox", xDialogSFact );
pNew->MakeDataAware( mxModel );
}
pNewObj = pNew;
@@ -118,25 +118,25 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
}
break;
case OBJ_DLG_GROUPBOX:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlGroupBoxModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlGroupBoxModel", xDialogSFact );
break;
case OBJ_DLG_EDIT:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlEditModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlEditModel", xDialogSFact );
break;
case OBJ_DLG_FIXEDTEXT:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlFixedTextModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlFixedTextModel", xDialogSFact );
break;
case OBJ_DLG_IMAGECONTROL:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlImageControlModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlImageControlModel", xDialogSFact );
break;
case OBJ_DLG_PROGRESSBAR:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlProgressBarModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlProgressBarModel", xDialogSFact );
break;
case OBJ_DLG_HSCROLLBAR:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlScrollBarModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlScrollBarModel", xDialogSFact );
break;
case OBJ_DLG_FORMHSCROLL:
- pNewObj = new DlgEdObj( "com.sun.star.form.component.ScrollBar", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.form.component.ScrollBar", xDialogSFact );
static_cast< DlgEdObj* >( pNewObj )->MakeDataAware( mxModel );
break;
case OBJ_DLG_FORMVSCROLL:
@@ -144,10 +144,10 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
{
DlgEdObj* pNew = nullptr;
if ( aParams.nObjIdentifier == OBJ_DLG_VSCROLLBAR )
- pNew = new DlgEdObj( "com.sun.star.awt.UnoControlScrollBarModel", xDialogSFact );
+ pNew = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlScrollBarModel", xDialogSFact );
else
{
- pNew = new DlgEdObj( "com.sun.star.form.component.ScrollBar", xDialogSFact );
+ pNew = new DlgEdObj(aParams.rSdrModel, "com.sun.star.form.component.ScrollBar", xDialogSFact );
pNew->MakeDataAware( mxModel );
}
pNewObj = pNew;
@@ -165,11 +165,11 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
}
} break;
case OBJ_DLG_HFIXEDLINE:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlFixedLineModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlFixedLineModel", xDialogSFact );
break;
case OBJ_DLG_VFIXEDLINE:
{
- DlgEdObj* pNew = new DlgEdObj( "com.sun.star.awt.UnoControlFixedLineModel", xDialogSFact );
+ DlgEdObj* pNew = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlFixedLineModel", xDialogSFact );
pNewObj = pNew;
// set vertical orientation
try
@@ -185,35 +185,35 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
}
} break;
case OBJ_DLG_DATEFIELD:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlDateFieldModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlDateFieldModel", xDialogSFact );
break;
case OBJ_DLG_TIMEFIELD:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlTimeFieldModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlTimeFieldModel", xDialogSFact );
break;
case OBJ_DLG_NUMERICFIELD:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlNumericFieldModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlNumericFieldModel", xDialogSFact );
break;
case OBJ_DLG_CURRENCYFIELD:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlCurrencyFieldModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlCurrencyFieldModel", xDialogSFact );
break;
case OBJ_DLG_FORMATTEDFIELD:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlFormattedFieldModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlFormattedFieldModel", xDialogSFact );
break;
case OBJ_DLG_PATTERNFIELD:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlPatternFieldModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlPatternFieldModel", xDialogSFact );
break;
case OBJ_DLG_FILECONTROL:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlFileControlModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlFileControlModel", xDialogSFact );
break;
case OBJ_DLG_SPINBUTTON:
- pNewObj = new DlgEdObj( "com.sun.star.awt.UnoControlSpinButtonModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.UnoControlSpinButtonModel", xDialogSFact );
break;
case OBJ_DLG_FORMSPIN:
- pNewObj = new DlgEdObj( "com.sun.star.form.component.SpinButton", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.form.component.SpinButton", xDialogSFact );
static_cast< DlgEdObj* >( pNewObj )->MakeDataAware( mxModel );
break;
case OBJ_DLG_TREECONTROL:
- pNewObj = new DlgEdObj( "com.sun.star.awt.tree.TreeControlModel", xDialogSFact );
+ pNewObj = new DlgEdObj(aParams.rSdrModel, "com.sun.star.awt.tree.TreeControlModel", xDialogSFact );
break;
}
}
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 41158fed7273..44d7b7a10d55 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -63,18 +63,20 @@ DlgEditor& DlgEdObj::GetDialogEditor ()
return pDlgEdForm->GetDlgEditor();
}
-DlgEdObj::DlgEdObj()
- :SdrUnoObj(OUString())
- ,bIsListening(false)
- ,pDlgEdForm( nullptr )
+DlgEdObj::DlgEdObj(SdrModel& rSdrModel)
+: SdrUnoObj(rSdrModel, OUString())
+ ,bIsListening(false)
+ ,pDlgEdForm( nullptr )
{
}
-DlgEdObj::DlgEdObj(const OUString& rModelName,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac)
- :SdrUnoObj(rModelName, rxSFac)
- ,bIsListening(false)
- ,pDlgEdForm( nullptr )
+DlgEdObj::DlgEdObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac)
+: SdrUnoObj(rSdrModel, rModelName, rxSFac)
+ ,bIsListening(false)
+ ,pDlgEdForm( nullptr )
{
}
@@ -500,7 +502,7 @@ void DlgEdObj::UpdateStep()
sal_Int32 nCurStep = GetDlgEdForm()->GetStep();
sal_Int32 nStep = GetStep();
- SdrLayerAdmin& rLayerAdmin = GetModel()->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin(getSdrModelFromSdrObject().GetLayerAdmin());
SdrLayerID nHiddenLayerId = rLayerAdmin.GetLayerID( "HiddenLayer" );
SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName() );
@@ -604,7 +606,7 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt )
}
// reorder objects in drawing page
- GetModel()->GetPage(0)->SetObjectOrdNum( nOldTabIndex + 1, nNewTabIndex + 1 );
+ getSdrModelFromSdrObject().GetPage(0)->SetObjectOrdNum( nOldTabIndex + 1, nNewTabIndex + 1 );
pForm->UpdateTabOrderAndGroups();
}
@@ -884,9 +886,9 @@ void DlgEdObj::clonedFrom(const DlgEdObj* _pSource)
StartListening();
}
-DlgEdObj* DlgEdObj::Clone() const
+DlgEdObj* DlgEdObj::Clone(SdrModel* pTargetModel) const
{
- DlgEdObj* pDlgEdObj = CloneHelper< DlgEdObj >();
+ DlgEdObj* pDlgEdObj = CloneHelper< DlgEdObj >(pTargetModel);
DBG_ASSERT( pDlgEdObj != nullptr, "DlgEdObj::Clone: invalid clone!" );
if ( pDlgEdObj )
pDlgEdObj->clonedFrom( this );
@@ -898,7 +900,9 @@ SdrObject* DlgEdObj::getFullDragClone() const
{
// no need to really add the clone for dragging, it's a temporary
// object
- SdrObject* pObj = new SdrUnoObj(OUString());
+ SdrObject* pObj = new SdrUnoObj(
+ getSdrModelFromSdrObject(),
+ OUString());
*pObj = *static_cast<const SdrUnoObj*>(this);
return pObj;
@@ -1193,8 +1197,10 @@ void DlgEdObj::SetLayer(SdrLayerID nLayer)
}
}
-
-DlgEdForm::DlgEdForm (DlgEditor& rDlgEditor_) :
+DlgEdForm::DlgEdForm(
+ SdrModel& rSdrModel,
+ DlgEditor& rDlgEditor_)
+: DlgEdObj(rSdrModel),
rDlgEditor(rDlgEditor_)
{
}
diff --git a/basctl/source/dlged/dlgedpage.cxx b/basctl/source/dlged/dlgedpage.cxx
index 211aa863a12f..da9ba12ef1b0 100644
--- a/basctl/source/dlged/dlgedpage.cxx
+++ b/basctl/source/dlged/dlgedpage.cxx
@@ -27,14 +27,8 @@ namespace basctl
DlgEdPage::DlgEdPage(DlgEdModel& rModel, bool bMasterPage)
- : SdrPage(rModel, bMasterPage)
- , pDlgEdForm(nullptr)
-{
-}
-
-DlgEdPage::DlgEdPage(const DlgEdPage& rSrcPage)
- : SdrPage(rSrcPage)
- , pDlgEdForm(nullptr)
+: SdrPage(rModel, bMasterPage)
+ ,pDlgEdForm(nullptr)
{
}
@@ -43,23 +37,15 @@ DlgEdPage::~DlgEdPage()
Clear();
}
-
-SdrPage* DlgEdPage::Clone() const
-{
- return Clone(nullptr);
-}
-
SdrPage* DlgEdPage::Clone(SdrModel* const pNewModel) const
{
- DlgEdPage* const pNewPage = new DlgEdPage( *this );
- DlgEdModel* pDlgEdModel = nullptr;
- if ( pNewModel )
- {
- pDlgEdModel = dynamic_cast<DlgEdModel*>( pNewModel );
- assert(pDlgEdModel);
- }
- pNewPage->lateInit( *this, pDlgEdModel );
- return pNewPage;
+ DlgEdModel& rDlgEdModel(static_cast< DlgEdModel& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel));
+ DlgEdPage* pClonedDlgEdPage(
+ new DlgEdPage(
+ rDlgEdModel,
+ IsMasterPage()));
+ pClonedDlgEdPage->SdrPage::lateInit(*this);
+ return pClonedDlgEdPage;
}
diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx
index aa7f1e4bfbff..12d2d57bb99a 100644
--- a/basctl/source/dlged/dlgedview.cxx
+++ b/basctl/source/dlged/dlgedview.cxx
@@ -31,9 +31,11 @@
namespace basctl
{
-
-DlgEdView::DlgEdView (SdrModel& rModel, OutputDevice& rOut, DlgEditor& rEditor) :
- SdrView(&rModel, &rOut),
+DlgEdView::DlgEdView(
+ SdrModel& rSdrModel,
+ OutputDevice& rOut,
+ DlgEditor& rEditor)
+: SdrView(rSdrModel, &rOut),
rDlgEditor(rEditor)
{
SetBufferedOutputAllowed(true);
diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx
index 58f60447c9eb..4660c29d2682 100644
--- a/basctl/source/inc/dlgedobj.hxx
+++ b/basctl/source/inc/dlgedobj.hxx
@@ -57,9 +57,11 @@ private:
DlgEditor& GetDialogEditor ();
protected:
- DlgEdObj();
- DlgEdObj(const OUString& rModelName,
- const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac);
+ DlgEdObj(SdrModel& rSdrModel);
+ DlgEdObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac);
virtual void NbcMove( const Size& rSize ) override;
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
@@ -94,7 +96,7 @@ public:
virtual SdrInventor GetObjInventor() const override;
virtual sal_uInt16 GetObjIdentifier() const override;
- virtual DlgEdObj* Clone() const override; // not working yet
+ virtual DlgEdObj* Clone(SdrModel* pTargetModel = nullptr) const override; // not working yet
void clonedFrom(const DlgEdObj* _pSource); // not working yet
// FullDrag support
@@ -152,7 +154,9 @@ private:
mutable ::boost::optional< css::awt::DeviceInfo > mpDeviceInfo;
private:
- explicit DlgEdForm (DlgEditor&);
+ explicit DlgEdForm(
+ SdrModel& rSdrModel,
+ DlgEditor&);
protected:
virtual void NbcMove( const Size& rSize ) override;
diff --git a/basctl/source/inc/dlgedpage.hxx b/basctl/source/inc/dlgedpage.hxx
index 814826e02f77..164f725f85ee 100644
--- a/basctl/source/inc/dlgedpage.hxx
+++ b/basctl/source/inc/dlgedpage.hxx
@@ -35,6 +35,7 @@ class DlgEdForm;
class DlgEdPage final : public SdrPage
{
DlgEdPage& operator=(const DlgEdPage&) = delete;
+ DlgEdPage(const DlgEdPage&) = delete;
DlgEdForm* pDlgEdForm;
@@ -43,16 +44,12 @@ public:
explicit DlgEdPage( DlgEdModel& rModel, bool bMasterPage = false );
virtual ~DlgEdPage() override;
- virtual SdrPage* Clone() const override;
- virtual SdrPage* Clone( SdrModel* pNewModel ) const override;
+ virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override;
void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
virtual SdrObject* SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum) override;
-
-private:
- DlgEdPage(const DlgEdPage& rSrcPage);
};
} // namespace basctl
diff --git a/basctl/source/inc/dlgedview.hxx b/basctl/source/inc/dlgedview.hxx
index 511abfc841e3..c194c1216d11 100644
--- a/basctl/source/inc/dlgedview.hxx
+++ b/basctl/source/inc/dlgedview.hxx
@@ -39,7 +39,11 @@ private:
public:
- DlgEdView (SdrModel& rModel, OutputDevice& rOut, DlgEditor& rEditor);
+ DlgEdView(
+ SdrModel& rSdrModel,
+ OutputDevice& rOut,
+ DlgEditor& rEditor);
+
virtual ~DlgEdView() override;
virtual void MarkListHasChanged() override;