From 6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 1 Mar 2018 15:54:32 +0100 Subject: 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). Change-Id: Iaf53535de0502a481466be74a1768bbb39f0e78c 1cb7d573d323e98a89761fe662c10c4a654fdec0 24617494a0ef79f6e33dfcb02782a833a81c6434 763f39094b6a48b529a6952d01468f8776c97679 242b9e228a9a042c3a5bdd38b1ea6600144276d5 242b9e228a9a042c3a5bdd38b1ea6600144276d5 33a6f3f306b70c223171aef796dd5ee041ad14df 6878b33f8b05738a44c0910e40a60a0f0d1d58ed 0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2 8c4626274a5cc531dad27f27c0c45d4c528fb2fb 446685a49a6d67aedd01cfbbd5e87b07f97a4d7b c1b5ed3c99bc7219a0061e4ece24ea42afd2889a 22de9a1c8af7c25be5c108671ddc548ba323ed47 4caf6b6fbbe6e8130741d793dffb560fd01d4ed5 488b9601735ec1822433f82f633990063951fe08 c366d60299f239e3df856ddffedb19e743e4be0c c5137ba8c597c7b5f90318df50e87b93a39a28dc f9e646242cf89f6fde1315046952252a2c429779 f830fbc5fadd89d04be5edd2a5abf9b0d4bf0410 1694b54903df784385abaa8452e1201e12344238 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 7b5c241faec7488924e5935ae8b19f785846b5e4 bf097ee7467895823fbd158a2a9543da3b5a5078 --- cui/source/dialogs/sdrcelldlg.cxx | 12 ++++++------ cui/source/factory/dlgfact.cxx | 4 ++-- cui/source/factory/dlgfact.hxx | 2 +- cui/source/inc/sdrcelldlg.hxx | 2 +- cui/source/tabpages/measure.cxx | 9 ++++++++- cui/source/tabpages/tpline.cxx | 4 ++-- cui/source/tabpages/transfrm.cxx | 12 ++++++------ 7 files changed, 26 insertions(+), 19 deletions(-) (limited to 'cui/source') diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx index 7789ddd64c13..a7de7c1f2ed2 100644 --- a/cui/source/dialogs/sdrcelldlg.cxx +++ b/cui/source/dialogs/sdrcelldlg.cxx @@ -26,14 +26,14 @@ #include #include -SvxFormatCellsDialog::SvxFormatCellsDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel const * pModel ) +SvxFormatCellsDialog::SvxFormatCellsDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel ) : SfxTabDialog(pParent, "FormatCellsDialog", "cui/ui/formatcellsdialog.ui", pAttr) , mrOutAttrs(*pAttr) - , mpColorTab(pModel->GetColorList()) - , mpGradientList(pModel->GetGradientList()) - , mpHatchingList(pModel->GetHatchList()) - , mpBitmapList(pModel->GetBitmapList()) - , mpPatternList(pModel->GetPatternList()) + , mpColorTab(rModel.GetColorList()) + , mpGradientList(rModel.GetGradientList()) + , mpHatchingList(rModel.GetHatchList()) + , mpBitmapList(rModel.GetBitmapList()) + , mpPatternList(rModel.GetPatternList()) , m_nAreaPageId(0) { AddTabPage("name", RID_SVXPAGE_CHAR_NAME); diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 8a8647b088af..51c7d5afd500 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1524,9 +1524,9 @@ VclPtr AbstractDialogFactory_Impl::CreateLinksDialog( vc return VclPtr::Create( pLinkDlg ); } -VclPtr AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* /*pObj*/ ) +VclPtr AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, const SdrModel& rModel, const SdrObject* /*pObj*/ ) { - return VclPtr::Create( VclPtr::Create( nullptr, pAttr, pModel ) ); + return VclPtr::Create( VclPtr::Create( nullptr, pAttr, rModel ) ); } VclPtr AbstractDialogFactory_Impl::CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index ae87ab25bb72..e9ea89b340e3 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -690,7 +690,7 @@ public: const sal_uInt16 _nInitiallySelectedEvent ) override; - virtual VclPtr CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj ) override; + virtual VclPtr CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, const SdrModel& rModel, const SdrObject* pObj ) override; virtual VclPtr CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) override; diff --git a/cui/source/inc/sdrcelldlg.hxx b/cui/source/inc/sdrcelldlg.hxx index 97a2abeec613..0a38f759a494 100644 --- a/cui/source/inc/sdrcelldlg.hxx +++ b/cui/source/inc/sdrcelldlg.hxx @@ -40,7 +40,7 @@ private: sal_uInt16 m_nBorderPageId; public: - SvxFormatCellsDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel const * pModel ); + SvxFormatCellsDialog( vcl::Window* pParent, const SfxItemSet* pAttr, const SdrModel& rModel ); virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx index adfb0ec6fa26..58ae066ae39b 100644 --- a/cui/source/tabpages/measure.cxx +++ b/cui/source/tabpages/measure.cxx @@ -598,7 +598,14 @@ void SvxMeasurePage::Construct() { DBG_ASSERT( pView, "No valid View transferred!" ); - m_pCtlPreview->pMeasureObj->SetModel( pView->GetModel() ); + // TTTT + // pMeasureObj is member of SvxXMeasurePreview and can only be accessed due to + // SvxMeasurePage being a friend. It has it's own SdrModel (also in SvxXMeasurePreview) + // and 'setting' the SdrModel is a hack. The comment above about 'notify unit and + // floatingpoint-values' is not clear, but has to be done another way - if needed. + // Checked on original aw080, is just commented out there, too. + + // m_pCtlPreview->pMeasureObj->SetModel( pView->GetModel() ); m_pCtlPreview->Invalidate(); } diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 85f2d856ecfc..145a30466576 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -349,7 +349,7 @@ void SvxLineTabPage::InitSymbols(MenuButton const * pButton) pModel->InsertPage( pPage, 0 ); { // 3D View - std::unique_ptr pView(new SdrView( pModel.get(), pVDev )); + std::unique_ptr pView(new SdrView( *pModel, pVDev )); pView->hideMarkHandles(); pView->ShowSdrPage(pPage); @@ -1119,7 +1119,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) pPage->SetSize(Size(1000,1000)); pModel->InsertPage( pPage, 0 ); { - std::unique_ptr pView(new SdrView( pModel.get(), pVDev )); + std::unique_ptr pView(new SdrView( *pModel, pVDev )); pView->hideMarkHandles(); pView->ShowSdrPage(pPage); SdrObject *pObj=nullptr; diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 226947059a7b..ee3f76be840f 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -566,15 +566,15 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs) SdrObjCustomShape& rSdrObjCustomShape( static_cast< SdrObjCustomShape& >( *pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj())); - SdrModel* pModel(rSdrObjCustomShape.GetModel()); + SdrModel& rModel(rSdrObjCustomShape.getSdrModelFromSdrObject()); SdrUndoAction* pUndo( - pModel->IsUndoEnabled() - ? pModel->GetSdrUndoFactory().CreateUndoAttrObject(rSdrObjCustomShape) + rModel.IsUndoEnabled() + ? rModel.GetSdrUndoFactory().CreateUndoAttrObject(rSdrObjCustomShape) : nullptr); if(pUndo) { - pModel->BegUndo(pUndo->GetComment()); + rModel.BegUndo(pUndo->GetComment()); } EnhancedCustomShape2d aShape(rSdrObjCustomShape); @@ -602,8 +602,8 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs) if (pUndo) { - pModel->AddUndo(pUndo); - pModel->EndUndo(); + rModel.AddUndo(pUndo); + rModel.EndUndo(); } } -- cgit v1.2.3