summaryrefslogtreecommitdiff
path: root/svx/source/form/fmpage.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/form/fmpage.cxx')
-rw-r--r--svx/source/form/fmpage.cxx82
1 files changed, 17 insertions, 65 deletions
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;
}