summaryrefslogtreecommitdiff
path: root/svx/source/form
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 /svx/source/form
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 'svx/source/form')
-rw-r--r--svx/source/form/fmdmod.cxx9
-rw-r--r--svx/source/form/fmdpage.cxx7
-rw-r--r--svx/source/form/fmobj.cxx51
-rw-r--r--svx/source/form/fmobjfac.cxx8
-rw-r--r--svx/source/form/fmpage.cxx82
-rw-r--r--svx/source/form/fmpgeimp.cxx52
-rw-r--r--svx/source/form/fmshimp.cxx11
-rw-r--r--svx/source/form/fmview.cxx8
-rw-r--r--svx/source/form/fmvwimp.cxx27
9 files changed, 113 insertions, 142 deletions
diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx
index d487399fedf9..ac197b2ff419 100644
--- a/svx/source/form/fmdmod.cxx
+++ b/svx/source/form/fmdmod.cxx
@@ -31,6 +31,7 @@ using namespace ::svxform;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const OUString& rServiceSpecifier)
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
+
if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
{
css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
@@ -38,11 +39,17 @@ using namespace ::svxform;
}
else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" )
{
- SdrObject* pObj = new FmFormObj();
+ SdrModel* pTargetModel = getSdrModelFromUnoModel();
+ OSL_ENSURE(pTargetModel, "Got no SdrModel for SdrShape construction (!)");
+ SdrObject* pObj = new FmFormObj(*pTargetModel);
xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
}
+
if (!xRet.is())
+ {
xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier);
+ }
+
return xRet;
}
diff --git a/svx/source/form/fmdpage.cxx b/svx/source/form/fmdpage.cxx
index 1e81e8fe08e8..45ac667c50eb 100644
--- a/svx/source/form/fmdpage.cxx
+++ b/svx/source/form/fmdpage.cxx
@@ -73,10 +73,13 @@ SdrObject *SvxFmDrawPage::CreateSdrObject_( const css::uno::Reference< css::draw
if ( aShapeType == "com.sun.star.drawing.ShapeControl" // compatibility
|| aShapeType == "com.sun.star.drawing.ControlShape"
)
- return new FmFormObj();
+ {
+ return new FmFormObj(GetSdrPage()->getSdrModelFromSdrPage());
+ }
else
+ {
return SvxDrawPage::CreateSdrObject_( xDescr );
-
+ }
}
css::uno::Reference< css::drawing::XShape > SvxFmDrawPage::CreateShape( SdrObject *pObj ) const
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 5863ec9f38f6..44431b8018da 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -55,26 +55,27 @@ using namespace ::com::sun::star::container;
using namespace ::svxform;
-FmFormObj::FmFormObj(const OUString& rModelName)
- :SdrUnoObj ( rModelName )
- ,m_nPos ( -1 )
- ,m_pLastKnownRefDevice ( nullptr )
+FmFormObj::FmFormObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName)
+: SdrUnoObj(rSdrModel, rModelName)
+ ,m_nPos(-1)
+ ,m_pLastKnownRefDevice(nullptr)
{
-
// normally, this is done in SetUnoControlModel, but if the call happened in the base class ctor,
// then our incarnation of it was not called (since we were not constructed at this time).
impl_checkRefDevice_nothrow( true );
}
-
-FmFormObj::FmFormObj()
- :SdrUnoObj ( "" )
- ,m_nPos ( -1 )
- ,m_pLastKnownRefDevice ( nullptr )
+FmFormObj::FmFormObj(SdrModel& rSdrModel)
+: SdrUnoObj(rSdrModel, "")
+ ,m_nPos(-1)
+ ,m_pLastKnownRefDevice(nullptr)
{
+ // Stuff that old SetModel also did:
+ impl_checkRefDevice_nothrow();
}
-
FmFormObj::~FmFormObj()
{
@@ -105,7 +106,7 @@ void FmFormObj::ClearObjEnv()
void FmFormObj::impl_checkRefDevice_nothrow( bool _force )
{
- const FmFormModel* pFormModel = dynamic_cast<FmFormModel*>( GetModel() );
+ const FmFormModel* pFormModel = dynamic_cast<FmFormModel*>(&getSdrModelFromSdrObject());
if ( !pFormModel || !pFormModel->ControlsUseRefDevice() )
return;
@@ -357,9 +358,9 @@ void FmFormObj::clonedFrom(const FmFormObj* _pSource)
}
-FmFormObj* FmFormObj::Clone() const
+FmFormObj* FmFormObj::Clone(SdrModel* pTargetModel) const
{
- FmFormObj* pFormObject = CloneHelper< FmFormObj >();
+ FmFormObj* pFormObject = CloneHelper< FmFormObj >(pTargetModel);
DBG_ASSERT(pFormObject != nullptr, "FmFormObj::Clone : invalid clone !");
if (pFormObject)
pFormObject->clonedFrom(this);
@@ -368,13 +369,6 @@ FmFormObj* FmFormObj::Clone() const
}
-void FmFormObj::NbcReformatText()
-{
- impl_checkRefDevice_nothrow();
- SdrUnoObj::NbcReformatText();
-}
-
-
FmFormObj& FmFormObj::operator= (const FmFormObj& rObj)
{
if( this == &rObj )
@@ -401,6 +395,13 @@ FmFormObj& FmFormObj::operator= (const FmFormObj& rObj)
}
+void FmFormObj::NbcReformatText()
+{
+ impl_checkRefDevice_nothrow();
+ SdrUnoObj::NbcReformatText();
+}
+
+
namespace
{
OUString lcl_getFormComponentAccessPath(const Reference< XInterface >& _xElement, Reference< XInterface >& _rTopLevelElement)
@@ -584,14 +585,6 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface >
return Reference<XInterface>( xDestContainer, UNO_QUERY );
}
-
-void FmFormObj::SetModel( SdrModel* _pNewModel )
-{
- SdrUnoObj::SetModel( _pNewModel );
- impl_checkRefDevice_nothrow();
-}
-
-
FmFormObj* FmFormObj::GetFormObject( SdrObject* _pSdrObject )
{
FmFormObj* pFormObject = dynamic_cast< FmFormObj* >( _pSdrObject );
diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx
index bfc834e9cd1a..a640caac7c0c 100644
--- a/svx/source/form/fmobjfac.cxx
+++ b/svx/source/form/fmobjfac.cxx
@@ -106,10 +106,10 @@ namespace
}
}
-IMPL_STATIC_LINK(
- FmFormObjFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject*)
+IMPL_STATIC_LINK(FmFormObjFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject*)
{
SdrObject* pNewObj = nullptr;
+
if (aParams.nInventor == SdrInventor::FmForm)
{
OUString sServiceSpecifier;
@@ -213,9 +213,9 @@ IMPL_STATIC_LINK(
// create the actual object
if ( !sServiceSpecifier.isEmpty() )
- pNewObj = new FmFormObj(sServiceSpecifier);
+ pNewObj = new FmFormObj(aParams.rSdrModel, sServiceSpecifier);
else
- pNewObj = new FmFormObj();
+ pNewObj = new FmFormObj(aParams.rSdrModel);
// initialize some properties which we want to differ from the defaults
for ( PropertyValueArray::const_iterator aInitProp = aInitialProperties.begin();
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index 7f267cbbcf03..ca79aba3845f 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -49,22 +49,17 @@ using com::sun::star::uno::UNO_QUERY;
FmFormPage::FmFormPage(FmFormModel& rModel, bool bMasterPage)
- :SdrPage(rModel, bMasterPage)
- ,m_pImpl( new FmFormPageImpl( *this ) )
+: SdrPage(rModel, bMasterPage)
+ ,m_pImpl( new FmFormPageImpl( *this ) )
{
}
-
-FmFormPage::FmFormPage(const FmFormPage& rPage)
- :SdrPage(rPage)
- ,m_pImpl(new FmFormPageImpl( *this ) )
-{
-}
-
-void FmFormPage::lateInit(const FmFormPage& rPage, FmFormModel* const pNewModel)
+void FmFormPage::lateInit(const FmFormPage& rPage)
{
- SdrPage::lateInit( rPage, pNewModel );
+ // call parent
+ SdrPage::lateInit( rPage );
+ // copy local variables (former stuff from copy constructor)
m_pImpl->initFrom( rPage.GetImpl() );
m_sPageName = rPage.m_sPageName;
}
@@ -74,65 +69,22 @@ FmFormPage::~FmFormPage()
{
}
-
-void FmFormPage::SetModel(SdrModel* pNewModel)
-{
- /* #35055# */
- // we want to call the super's "SetModel" method even if the model is the
- // same, in case code somewhere in the system depends on it. But our code
- // doesn't, so get the old model to do a check.
- SdrModel *pOldModel = GetModel();
-
- SdrPage::SetModel( pNewModel );
-
- /* #35055# */
- if ( ( pOldModel != pNewModel ) && m_pImpl )
- {
- try
- {
- Reference< css::form::XForms > xForms( m_pImpl->getForms( false ) );
- if ( xForms.is() )
- {
- // we want to keep the current collection, just reset the model
- // with which it's associated.
- FmFormModel* pDrawModel = static_cast<FmFormModel*>( GetModel() );
- SfxObjectShell* pObjShell = pDrawModel->GetObjectShell();
- if ( pObjShell )
- xForms->setParent( pObjShell->GetModel() );
- }
- }
- catch( css::uno::Exception const& )
- {
- OSL_FAIL( "UNO Exception caught resetting model for m_pImpl (FmFormPageImpl) in FmFormPage::SetModel" );
- }
- }
-}
-
-
-SdrPage* FmFormPage::Clone() const
-{
- return Clone(nullptr);
-}
-
-SdrPage* FmFormPage::Clone(SdrModel* const pNewModel) const
+SdrPage* FmFormPage::Clone(SdrModel* pNewModel) const
{
- FmFormPage* const pNewPage = new FmFormPage(*this);
- FmFormModel* pFormModel = nullptr;
- if (pNewModel)
- {
- pFormModel = dynamic_cast<FmFormModel*>(pNewModel);
- assert(pFormModel);
- }
- pNewPage->lateInit(*this, pFormModel);
- return pNewPage;
+ FmFormModel& rFmFormModel(static_cast< FmFormModel& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel));
+ FmFormPage* pClonedFmFormPage(
+ new FmFormPage(
+ rFmFormModel,
+ IsMasterPage()));
+ pClonedFmFormPage->lateInit(*this);
+ return pClonedFmFormPage;
}
void FmFormPage::InsertObject(SdrObject* pObj, size_t nPos)
{
SdrPage::InsertObject( pObj, nPos );
- if (GetModel())
- static_cast<FmFormModel*>(GetModel())->GetUndoEnv().Inserted(pObj);
+ static_cast< FmFormModel& >(getSdrModelFromSdrPage()).GetUndoEnv().Inserted(pObj);
}
@@ -217,8 +169,8 @@ bool FmFormPage::RequestHelp( vcl::Window* pWindow, SdrView const * pView,
SdrObject* FmFormPage::RemoveObject(size_t nObjNum)
{
SdrObject* pObj = SdrPage::RemoveObject(nObjNum);
- if (pObj && GetModel())
- static_cast<FmFormModel*>(GetModel())->GetUndoEnv().Removed(pObj);
+ if (pObj)
+ static_cast< FmFormModel& >(getSdrModelFromSdrPage()).GetUndoEnv().Removed(pObj);
return pObj;
}
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index 3d974c0eb02e..417f84a1212c 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -315,16 +315,15 @@ const Reference< css::form::XForms >& FmFormPageImpl::getForms( bool _bForceCrea
m_aFormsCreationHdl.Call( *this );
}
- FmFormModel* pFormsModel = dynamic_cast<FmFormModel*>( m_rPage.GetModel() );
+ FmFormModel& rFmFormModel(dynamic_cast< FmFormModel& >(m_rPage.getSdrModelFromSdrPage()));
// give the newly created collection a place in the universe
- SfxObjectShell* pObjShell = pFormsModel ? pFormsModel->GetObjectShell() : nullptr;
+ SfxObjectShell* pObjShell(rFmFormModel.GetObjectShell());
if ( pObjShell )
m_xForms->setParent( pObjShell->GetModel() );
// tell the UNDO environment that we have a new forms collection
- if ( pFormsModel )
- pFormsModel->GetUndoEnv().AddForms( Reference<XNameContainer>(m_xForms,UNO_QUERY_THROW) );
+ rFmFormModel.GetUndoEnv().AddForms( Reference<XNameContainer>(m_xForms,UNO_QUERY_THROW) );
}
return m_xForms;
}
@@ -396,13 +395,13 @@ Reference< XForm > FmFormPageImpl::getDefaultForm()
// did not find an existing suitable form -> create a new one
if ( !xForm.is() )
{
- SdrModel* pModel = m_rPage.GetModel();
+ SdrModel& rModel(m_rPage.getSdrModelFromSdrPage());
- if( pModel->IsUndoEnabled() )
+ if( rModel.IsUndoEnabled() )
{
OUString aStr(SvxResId(RID_STR_FORM));
OUString aUndoStr(SvxResId(RID_STR_UNDO_CONTAINER_INSERT));
- pModel->BegUndo(aUndoStr.replaceFirst("'#'", aStr));
+ rModel.BegUndo(aUndoStr.replaceFirst("'#'", aStr));
}
try
@@ -417,13 +416,15 @@ Reference< XForm > FmFormPageImpl::getDefaultForm()
OUString sName = SvxResId(RID_STR_STDFORMNAME);
xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
- if( pModel->IsUndoEnabled() )
+ if( rModel.IsUndoEnabled() )
{
- pModel->AddUndo(new FmUndoContainerAction(*static_cast<FmFormModel*>(pModel),
- FmUndoContainerAction::Inserted,
- xForms,
- xForm,
- xForms->getCount()));
+ rModel.AddUndo(
+ new FmUndoContainerAction(
+ static_cast< FmFormModel& >(rModel),
+ FmUndoContainerAction::Inserted,
+ xForms,
+ xForm,
+ xForms->getCount()));
}
xForms->insertByName( sName, makeAny( xForm ) );
xCurrentForm = xForm;
@@ -434,8 +435,8 @@ Reference< XForm > FmFormPageImpl::getDefaultForm()
xForm.clear();
}
- if( pModel->IsUndoEnabled() )
- pModel->EndUndo();
+ if( rModel.IsUndoEnabled() )
+ rModel.EndUndo();
}
return xForm;
@@ -474,16 +475,15 @@ Reference< css::form::XForm > FmFormPageImpl::findPlaceInFormComponentHierarchy
// If no css::form found, then create a new one
if (!xForm.is())
{
- SdrModel* pModel = m_rPage.GetModel();
-
- const bool bUndo = pModel->IsUndoEnabled();
+ SdrModel& rModel(m_rPage.getSdrModelFromSdrPage());
+ const bool bUndo(rModel.IsUndoEnabled());
if( bUndo )
{
OUString aStr(SvxResId(RID_STR_FORM));
OUString aUndoStr(SvxResId(RID_STR_UNDO_CONTAINER_INSERT));
aUndoStr = aUndoStr.replaceFirst("#", aStr);
- pModel->BegUndo(aUndoStr);
+ rModel.BegUndo(aUndoStr);
}
xForm.set(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY);
@@ -515,17 +515,19 @@ Reference< css::form::XForm > FmFormPageImpl::findPlaceInFormComponentHierarchy
if( bUndo )
{
Reference< css::container::XIndexContainer > xContainer( getForms(), UNO_QUERY );
- pModel->AddUndo(new FmUndoContainerAction(*static_cast<FmFormModel*>(pModel),
- FmUndoContainerAction::Inserted,
- xContainer,
- xForm,
- xContainer->getCount()));
+ rModel.AddUndo(
+ new FmUndoContainerAction(
+ static_cast< FmFormModel& >(rModel),
+ FmUndoContainerAction::Inserted,
+ xContainer,
+ xForm,
+ xContainer->getCount()));
}
getForms()->insertByName( sName, makeAny( xForm ) );
if( bUndo )
- pModel->EndUndo();
+ rModel.EndUndo();
}
xCurrentForm = xForm;
}
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index a21e90431d7b..560b2fa5c70b 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -3845,10 +3845,8 @@ void FmXFormShell::loadForms_Lock(FmFormPage* _pPage, const LoadFormsFlags _nBeh
{
// lock the undo env so the forms can change non-transient properties while loading
// (without this my doc's modified flag would be set)
- FmFormModel* pModel = dynamic_cast<FmFormModel*>( _pPage->GetModel() );
- DBG_ASSERT( pModel, "FmXFormShell::loadForms: invalid model!" );
- if ( pModel )
- pModel->GetUndoEnv().Lock();
+ FmFormModel& rFmFormModel(dynamic_cast< FmFormModel& >(_pPage->getSdrModelFromSdrPage()));
+ rFmFormModel.GetUndoEnv().Lock();
// load all forms
Reference< XIndexAccess > xForms;
@@ -3894,9 +3892,8 @@ void FmXFormShell::loadForms_Lock(FmFormPage* _pPage, const LoadFormsFlags _nBeh
}
}
- if ( pModel )
- // unlock the environment
- pModel->GetUndoEnv().UnLock();
+ // unlock the environment
+ rFmFormModel.GetUndoEnv().UnLock();
}
}
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 2adad0dc524f..6acd8b890e2d 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -77,14 +77,14 @@ using namespace ::com::sun::star::util;
using namespace ::svxform;
using namespace ::svx;
-
-FmFormView::FmFormView( FmFormModel* pModel, OutputDevice* pOut )
- :E3dView(pModel,pOut)
+FmFormView::FmFormView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut)
+: E3dView(rSdrModel, pOut)
{
Init();
}
-
void FmFormView::Init()
{
pFormShell = nullptr;
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index cbf975fe0a2d..30dd8add1b1d 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1350,7 +1350,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const svx::ODataAccessDescriptor
if ( bCheckbox )
return pControl;
- SdrObjGroup* pGroup = new SdrObjGroup();
+ SdrObjGroup* pGroup = new SdrObjGroup(getView()->getSdrModelFromSdrView());
SdrObjList* pObjList = pGroup->GetSubList();
pObjList->InsertObject( pLabel );
pObjList->InsertObject( pControl );
@@ -1462,7 +1462,7 @@ SdrObject* FmXFormView::implCreateXFormsControl( const svx::OXFormsDescriptor &_
// group objects
- SdrObjGroup* pGroup = new SdrObjGroup();
+ SdrObjGroup* pGroup = new SdrObjGroup(getView()->getSdrModelFromSdrView());
SdrObjList* pObjList = pGroup->GetSubList();
pObjList->InsertObject(pLabel);
pObjList->InsertObject(pControl);
@@ -1476,7 +1476,11 @@ SdrObject* FmXFormView::implCreateXFormsControl( const svx::OXFormsDescriptor &_
const MapMode eSourceMode(MapUnit::Map100thMM);
const sal_uInt16 nObjID = OBJ_FM_BUTTON;
::Size controlSize(4000, 500);
- FmFormObj *pControl = static_cast<FmFormObj*>(SdrObjFactory::MakeNewObject( SdrInventor::FmForm, nObjID, nullptr ));
+ FmFormObj *pControl = static_cast<FmFormObj*>(
+ SdrObjFactory::MakeNewObject(
+ getView()->getSdrModelFromSdrView(),
+ SdrInventor::FmForm,
+ nObjID));
controlSize.setWidth( long(controlSize.Width() * eTargetMode.GetScaleX()) );
controlSize.setHeight( long(controlSize.Height() * eTargetMode.GetScaleY()) );
::Point controlPos( OutputDevice::LogicToLogic( ::Point( controlSize.Width(), 0 ), eSourceMode, eTargetMode ) );
@@ -1576,11 +1580,18 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
// the label
::std::unique_ptr< SdrUnoObj > pLabel;
Reference< XPropertySet > xLabelModel;
+
if ( bNeedLabel )
{
pLabel.reset( dynamic_cast< SdrUnoObj* >(
- SdrObjFactory::MakeNewObject( _nInventor, _nLabelObjectID, _pLabelPage, _pModel ) ) );
+ SdrObjFactory::MakeNewObject(
+ *_pModel,
+ _nInventor,
+ _nLabelObjectID,
+ _pLabelPage)));
+
OSL_ENSURE( pLabel.get(), "FmXFormView::createControlLabelPair: could not create the label!" );
+
if ( !pLabel.get() )
return false;
@@ -1606,8 +1617,14 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
// the control
::std::unique_ptr< SdrUnoObj > pControl( dynamic_cast< SdrUnoObj* >(
- SdrObjFactory::MakeNewObject( _nInventor, _nControlObjectID, _pControlPage, _pModel ) ) );
+ SdrObjFactory::MakeNewObject(
+ *_pModel,
+ _nInventor,
+ _nControlObjectID,
+ _pControlPage)));
+
OSL_ENSURE( pControl.get(), "FmXFormView::createControlLabelPair: could not create the control!" );
+
if ( !pControl.get() )
return false;