summaryrefslogtreecommitdiff
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
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>
-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
-rw-r--r--basegfx/Library_basegfx.mk1
-rw-r--r--basegfx/source/matrix/b2dhommatrix.cxx15
-rw-r--r--basegfx/source/matrix/b3dhommatrix.cxx15
-rwxr-xr-xbasegfx/source/matrix/b3dhommatrixtools.cxx73
-rw-r--r--basegfx/source/numeric/ftools.cxx53
-rw-r--r--basegfx/source/range/b2drange.cxx20
-rw-r--r--basegfx/source/range/b3drange.cxx19
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx12
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx2
-rw-r--r--chart2/source/controller/inc/DrawViewWrapper.hxx5
-rw-r--r--chart2/source/controller/main/ChartController.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx11
-rw-r--r--chart2/source/controller/main/ChartTransferable.cxx11
-rw-r--r--chart2/source/controller/main/ChartTransferable.hxx11
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx13
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx8
-rw-r--r--cui/source/dialogs/sdrcelldlg.cxx12
-rw-r--r--cui/source/factory/dlgfact.cxx4
-rw-r--r--cui/source/factory/dlgfact.hxx2
-rw-r--r--cui/source/inc/sdrcelldlg.hxx2
-rw-r--r--cui/source/tabpages/measure.cxx9
-rw-r--r--cui/source/tabpages/tpline.cxx4
-rw-r--r--cui/source/tabpages/transfrm.cxx12
-rw-r--r--filter/source/msfilter/escherex.cxx5
-rw-r--r--filter/source/msfilter/msdffimp.cxx86
-rw-r--r--filter/source/msfilter/svdfppt.cxx39
-rw-r--r--filter/source/svg/svgexport.cxx14
-rw-r--r--include/basegfx/matrix/b2dhommatrix.hxx2
-rw-r--r--include/basegfx/matrix/b3dhommatrix.hxx3
-rwxr-xr-xinclude/basegfx/matrix/b3dhommatrixtools.hxx46
-rw-r--r--include/basegfx/numeric/ftools.hxx19
-rw-r--r--include/basegfx/range/b1drange.hxx5
-rw-r--r--include/basegfx/range/b2drange.hxx25
-rw-r--r--include/basegfx/range/b2irange.hxx7
-rw-r--r--include/basegfx/range/b3drange.hxx25
-rw-r--r--include/basegfx/range/basicrange.hxx22
-rw-r--r--include/filter/msfilter/msdffimp.hxx24
-rw-r--r--include/svx/connctrl.hxx4
-rw-r--r--include/svx/cube3d.hxx14
-rw-r--r--include/svx/deflt3d.hxx8
-rw-r--r--include/svx/e3dsceneupdater.hxx4
-rw-r--r--include/svx/e3dundo.hxx64
-rw-r--r--include/svx/extedit.hxx12
-rw-r--r--include/svx/extrud3d.hxx16
-rw-r--r--include/svx/fmpage.hxx11
-rw-r--r--include/svx/fmview.hxx4
-rw-r--r--include/svx/graphctl.hxx11
-rw-r--r--include/svx/lathe3d.hxx14
-rw-r--r--include/svx/obj3d.hxx17
-rw-r--r--include/svx/polygn3d.hxx12
-rw-r--r--include/svx/scene3d.hxx4
-rw-r--r--include/svx/sdr/properties/defaultproperties.hxx3
-rw-r--r--include/svx/sdr/properties/properties.hxx33
-rw-r--r--include/svx/sdr/table/tablecontroller.hxx26
-rw-r--r--include/svx/sphere3d.hxx16
-rw-r--r--include/svx/svdcrtv.hxx7
-rw-r--r--include/svx/svddrgv.hxx7
-rw-r--r--include/svx/svdedtv.hxx7
-rw-r--r--include/svx/svdedxv.hxx7
-rw-r--r--include/svx/svdglev.hxx7
-rw-r--r--include/svx/svdmrkv.hxx5
-rw-r--r--include/svx/svdoashp.hxx13
-rw-r--r--include/svx/svdoattr.hxx10
-rw-r--r--include/svx/svdobj.hxx109
-rw-r--r--include/svx/svdocapt.hxx22
-rw-r--r--include/svx/svdocirc.hxx23
-rw-r--r--include/svx/svdoedge.hxx5
-rw-r--r--include/svx/svdograf.hxx19
-rw-r--r--include/svx/svdogrp.hxx18
-rw-r--r--include/svx/svdomeas.hxx12
-rw-r--r--include/svx/svdomedia.hxx10
-rw-r--r--include/svx/svdoole2.hxx16
-rw-r--r--include/svx/svdopage.hxx12
-rw-r--r--include/svx/svdopath.hxx12
-rw-r--r--include/svx/svdorect.hxx18
-rw-r--r--include/svx/svdotable.hxx18
-rw-r--r--include/svx/svdotext.hxx22
-rw-r--r--include/svx/svdouno.hxx14
-rw-r--r--include/svx/svdovirt.hxx10
-rw-r--r--include/svx/svdpage.hxx59
-rw-r--r--include/svx/svdpntv.hxx32
-rw-r--r--include/svx/svdpoev.hxx7
-rw-r--r--include/svx/svdsnpv.hxx7
-rw-r--r--include/svx/svdtext.hxx5
-rw-r--r--include/svx/svdview.hxx7
-rw-r--r--include/svx/svdxcgv.hxx18
-rw-r--r--include/svx/svxdlg.hxx2
-rw-r--r--include/svx/unomod.hxx4
-rw-r--r--include/svx/unomodel.hxx15
-rw-r--r--include/svx/unopage.hxx5
-rw-r--r--include/svx/unoshape.hxx15
-rw-r--r--include/svx/unoshtxt.hxx2
-rw-r--r--include/svx/view3d.hxx5
-rw-r--r--reportdesign/inc/ReportDefinition.hxx7
-rw-r--r--reportdesign/inc/RptObject.hxx55
-rw-r--r--reportdesign/inc/RptPage.hxx9
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx32
-rw-r--r--reportdesign/source/core/sdr/ReportDrawPage.cxx15
-rw-r--r--reportdesign/source/core/sdr/ReportUndoFactory.cxx4
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx221
-rw-r--r--reportdesign/source/core/sdr/RptPage.cxx45
-rw-r--r--reportdesign/source/ui/inc/SectionView.hxx6
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx12
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx11
-rw-r--r--reportdesign/source/ui/report/SectionView.cxx8
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx6
-rw-r--r--reportdesign/source/ui/report/dlgedfac.cxx15
-rw-r--r--reportdesign/source/ui/report/dlgedfunc.cxx30
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/inc/drawpage.hxx9
-rw-r--r--sc/qa/extras/anchor.cxx2
-rw-r--r--sc/qa/unit/ucalc.cxx14
-rw-r--r--sc/qa/unit/ucalc_sort.cxx2
-rw-r--r--sc/source/core/data/documen9.cxx6
-rw-r--r--sc/source/core/data/drawpage.cxx30
-rw-r--r--sc/source/core/data/drwlayer.cxx22
-rw-r--r--sc/source/core/data/postit.cxx11
-rw-r--r--sc/source/core/tool/detfunc.cxx23
-rw-r--r--sc/source/filter/excel/xichart.cxx2
-rw-r--r--sc/source/filter/excel/xiescher.cxx72
-rw-r--r--sc/source/filter/html/htmlexp2.cxx3
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx6
-rw-r--r--sc/source/ui/app/drwtrans.cxx10
-rw-r--r--sc/source/ui/drawfunc/fuconarc.cxx5
-rw-r--r--sc/source/ui/drawfunc/fuconcustomshape.cxx9
-rw-r--r--sc/source/ui/drawfunc/fuconpol.cxx5
-rw-r--r--sc/source/ui/drawfunc/fuconrec.cxx21
-rw-r--r--sc/source/ui/drawfunc/fuconuno.cxx5
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx12
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx18
-rw-r--r--sc/source/ui/drawfunc/futext.cxx5
-rw-r--r--sc/source/ui/inc/drawview.hxx7
-rw-r--r--sc/source/ui/navipi/content.cxx2
-rw-r--r--sc/source/ui/unoobj/TablePivotCharts.cxx7
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx16
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx129
-rw-r--r--sc/source/ui/view/drawvie3.cxx6
-rw-r--r--sc/source/ui/view/gridwin4.cxx5
-rw-r--r--sc/source/ui/view/preview.cxx4
-rw-r--r--sc/source/ui/view/printfun.cxx5
-rw-r--r--sc/source/ui/view/tabvwshg.cxx7
-rw-r--r--sc/source/ui/view/viewfun7.cxx21
-rw-r--r--sd/inc/CustomAnimationEffect.hxx6
-rw-r--r--sd/inc/sdpage.hxx9
-rw-r--r--sd/source/core/CustomAnimationEffect.cxx4
-rw-r--r--sd/source/core/annotations/Annotation.cxx4
-rw-r--r--sd/source/core/drawdoc.cxx15
-rw-r--r--sd/source/core/drawdoc3.cxx2
-rw-r--r--sd/source/core/pglink.cxx2
-rw-r--r--sd/source/core/sdpage.cxx142
-rw-r--r--sd/source/core/sdpage2.cxx174
-rw-r--r--sd/source/core/undo/undoobjects.cxx10
-rw-r--r--sd/source/filter/grf/sdgrffilter.cxx84
-rw-r--r--sd/source/filter/ppt/pptin.cxx5
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx2
-rw-r--r--sd/source/ui/app/sdmod2.cxx2
-rw-r--r--sd/source/ui/dlg/animobjs.cxx25
-rw-r--r--sd/source/ui/func/fucon3d.cxx38
-rw-r--r--sd/source/ui/func/fuconarc.cxx15
-rw-r--r--sd/source/ui/func/fuconbez.cxx5
-rw-r--r--sd/source/ui/func/fuconcs.cxx7
-rw-r--r--sd/source/ui/func/fuconrec.cxx31
-rw-r--r--sd/source/ui/func/fuconstr.cxx12
-rw-r--r--sd/source/ui/func/fuconuno.cxx5
-rw-r--r--sd/source/ui/func/fuinsert.cxx13
-rw-r--r--sd/source/ui/func/fuinsfil.cxx4
-rw-r--r--sd/source/ui/func/fumorph.cxx7
-rw-r--r--sd/source/ui/func/futext.cxx9
-rw-r--r--sd/source/ui/func/unoaprms.cxx2
-rw-r--r--sd/source/ui/inc/unomodel.hxx4
-rw-r--r--sd/source/ui/sidebar/DocumentHelper.cxx96
-rw-r--r--sd/source/ui/table/tablefunction.cxx12
-rw-r--r--sd/source/ui/tools/PreviewRenderer.cxx14
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx5
-rw-r--r--sd/source/ui/unoidl/unopage.cxx248
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx10
-rw-r--r--sd/source/ui/view/drawview.cxx15
-rw-r--r--sd/source/ui/view/drviews2.cxx12
-rw-r--r--sd/source/ui/view/drviews8.cxx5
-rw-r--r--sd/source/ui/view/drviews9.cxx5
-rw-r--r--sd/source/ui/view/drviewse.cxx12
-rw-r--r--sd/source/ui/view/frmview.cxx2
-rw-r--r--sd/source/ui/view/sdview.cxx11
-rw-r--r--sd/source/ui/view/sdview3.cxx18
-rw-r--r--sd/source/ui/view/sdview4.cxx20
-rw-r--r--svx/inc/dragmt3d.hxx9
-rw-r--r--svx/inc/sdr/properties/attributeproperties.hxx16
-rw-r--r--svx/inc/sdr/properties/e3dsceneproperties.hxx3
-rw-r--r--svx/inc/sdr/properties/groupproperties.hxx3
-rw-r--r--svx/source/accessibility/AccessibleEmptyEditSource.cxx9
-rw-r--r--svx/source/accessibility/AccessibleGraphicShape.cxx2
-rw-r--r--svx/source/core/extedit.cxx9
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx16
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx54
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx16
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.cxx6
-rw-r--r--svx/source/dialog/connctrl.cxx32
-rw-r--r--svx/source/dialog/contwnd.cxx5
-rw-r--r--svx/source/dialog/dlgctl3d.cxx10
-rw-r--r--svx/source/dialog/dlgctrl.cxx35
-rw-r--r--svx/source/dialog/graphctl.cxx2
-rw-r--r--svx/source/dialog/imapwnd.cxx32
-rw-r--r--svx/source/dialog/measctrl.cxx6
-rw-r--r--svx/source/engine3d/cube3d.cxx37
-rw-r--r--svx/source/engine3d/dragmt3d.cxx47
-rw-r--r--svx/source/engine3d/e3dsceneupdater.cxx35
-rw-r--r--svx/source/engine3d/e3dundo.cxx43
-rw-r--r--svx/source/engine3d/extrud3d.cxx37
-rw-r--r--svx/source/engine3d/lathe3d.cxx37
-rw-r--r--svx/source/engine3d/obj3d.cxx46
-rw-r--r--svx/source/engine3d/objfac3d.cxx19
-rw-r--r--svx/source/engine3d/polygn3d.cxx29
-rw-r--r--svx/source/engine3d/scene3d.cxx38
-rw-r--r--svx/source/engine3d/sphere3d.cxx46
-rw-r--r--svx/source/engine3d/view3d.cxx25
-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
-rw-r--r--svx/source/gallery2/galobj.cxx2
-rw-r--r--svx/source/gallery2/galtheme.cxx4
-rw-r--r--svx/source/inc/cell.hxx2
-rw-r--r--svx/source/inc/fmobj.hxx13
-rw-r--r--svx/source/inc/tablemodel.hxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx5
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrrectobj.cxx3
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx14
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx426
-rw-r--r--svx/source/sdr/properties/defaultproperties.cxx28
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx25
-rw-r--r--svx/source/sdr/properties/groupproperties.cxx25
-rw-r--r--svx/source/sdr/properties/properties.cxx12
-rw-r--r--svx/source/sdr/properties/textproperties.cxx12
-rw-r--r--svx/source/svdraw/svdcrtv.cxx21
-rw-r--r--svx/source/svdraw/svddrgv.cxx6
-rw-r--r--svx/source/svdraw/svdedtv.cxx7
-rw-r--r--svx/source/svdraw/svdedtv2.cxx28
-rw-r--r--svx/source/svdraw/svdedxv.cxx23
-rw-r--r--svx/source/svdraw/svdetc.cxx6
-rw-r--r--svx/source/svdraw/svdfmtf.cxx126
-rw-r--r--svx/source/svdraw/svdglev.cxx8
-rw-r--r--svx/source/svdraw/svdhdl.cxx12
-rw-r--r--svx/source/svdraw/svdmodel.cxx45
-rw-r--r--svx/source/svdraw/svdmrkv.cxx8
-rw-r--r--svx/source/svdraw/svdoashp.cxx37
-rw-r--r--svx/source/svdraw/svdoattr.cxx22
-rw-r--r--svx/source/svdraw/svdobj.cxx504
-rw-r--r--svx/source/svdraw/svdocapt.cxx45
-rw-r--r--svx/source/svdraw/svdocirc.cxx43
-rw-r--r--svx/source/svdraw/svdoedge.cxx17
-rw-r--r--svx/source/svdraw/svdograf.cxx296
-rw-r--r--svx/source/svdraw/svdogrp.cxx195
-rw-r--r--svx/source/svdraw/svdomeas.cxx190
-rw-r--r--svx/source/svdraw/svdomedia.cxx48
-rw-r--r--svx/source/svdraw/svdoole2.cxx348
-rw-r--r--svx/source/svdraw/svdopage.cxx20
-rw-r--r--svx/source/svdraw/svdopath.cxx43
-rw-r--r--svx/source/svdraw/svdorect.cxx58
-rw-r--r--svx/source/svdraw/svdotext.cxx123
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx5
-rw-r--r--svx/source/svdraw/svdotxat.cxx8
-rw-r--r--svx/source/svdraw/svdotxed.cxx10
-rw-r--r--svx/source/svdraw/svdotxln.cxx9
-rw-r--r--svx/source/svdraw/svdotxtr.cxx45
-rw-r--r--svx/source/svdraw/svdouno.cxx53
-rw-r--r--svx/source/svdraw/svdovirt.cxx59
-rw-r--r--svx/source/svdraw/svdpage.cxx313
-rw-r--r--svx/source/svdraw/svdpagv.cxx26
-rw-r--r--svx/source/svdraw/svdpntv.cxx11
-rw-r--r--svx/source/svdraw/svdpoev.cxx6
-rw-r--r--svx/source/svdraw/svdsnpv.cxx49
-rw-r--r--svx/source/svdraw/svdtext.cxx90
-rw-r--r--svx/source/svdraw/svdundo.cxx30
-rw-r--r--svx/source/svdraw/svdview.cxx8
-rw-r--r--svx/source/svdraw/svdviter.cxx4
-rw-r--r--svx/source/svdraw/svdxcgv.cxx150
-rw-r--r--svx/source/table/cell.cxx120
-rw-r--r--svx/source/table/cellcursor.cxx23
-rw-r--r--svx/source/table/svdotable.cxx125
-rw-r--r--svx/source/table/tablecolumn.cxx8
-rw-r--r--svx/source/table/tablecontroller.cxx981
-rw-r--r--svx/source/table/tablemodel.cxx74
-rw-r--r--svx/source/table/tablerow.cxx18
-rw-r--r--svx/source/table/tablertfimporter.cxx4
-rw-r--r--svx/source/table/tableundo.cxx54
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx8
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx53
-rw-r--r--svx/source/unodraw/tableshape.cxx34
-rw-r--r--svx/source/unodraw/unomod.cxx22
-rw-r--r--svx/source/unodraw/unopage.cxx128
-rw-r--r--svx/source/unodraw/unoshap2.cxx180
-rw-r--r--svx/source/unodraw/unoshap3.cxx182
-rw-r--r--svx/source/unodraw/unoshap4.cxx80
-rw-r--r--svx/source/unodraw/unoshape.cxx553
-rw-r--r--svx/source/unodraw/unoshtxt.cxx72
-rw-r--r--svx/source/unogallery/unogaltheme.cxx5
-rw-r--r--sw/inc/dcontact.hxx10
-rw-r--r--sw/inc/dpage.hxx8
-rw-r--r--sw/inc/frmfmt.hxx2
-rw-r--r--sw/inc/unotxdoc.hxx3
-rw-r--r--sw/source/core/doc/doclay.cxx4
-rw-r--r--sw/source/core/draw/dcontact.cxx47
-rw-r--r--sw/source/core/draw/dflyobj.cxx14
-rw-r--r--sw/source/core/draw/dobjfac.cxx2
-rw-r--r--sw/source/core/draw/dpage.cxx52
-rw-r--r--sw/source/core/draw/dview.cxx7
-rw-r--r--sw/source/core/frmedt/fecopy.cxx5
-rw-r--r--sw/source/core/frmedt/feshview.cxx21
-rw-r--r--sw/source/core/inc/dflyobj.hxx7
-rw-r--r--sw/source/core/inc/dview.hxx5
-rw-r--r--sw/source/core/layout/atrfrm.cxx6
-rw-r--r--sw/source/core/layout/paintfrm.cxx2
-rw-r--r--sw/source/core/view/viewimp.cxx5
-rw-r--r--sw/source/filter/html/htmldrawreader.cxx8
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx15
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx52
-rw-r--r--sw/source/filter/ww8/ww8par.cxx28
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx16
-rw-r--r--sw/source/filter/xml/swxml.cxx6
-rw-r--r--sw/source/uibase/ribbar/concustomshape.cxx2
-rw-r--r--sw/source/uibase/ribbar/conrect.cxx2
-rw-r--r--sw/source/uibase/shells/grfshex.cxx5
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx6
-rw-r--r--xmloff/source/draw/xexptran.cxx39
341 files changed, 6096 insertions, 5489 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;
diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk
index 087e4a081419..de744b5a15ce 100644
--- a/basegfx/Library_basegfx.mk
+++ b/basegfx/Library_basegfx.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\
basegfx/source/matrix/b2dhommatrix \
basegfx/source/matrix/b2dhommatrixtools \
basegfx/source/matrix/b3dhommatrix \
+ basegfx/source/matrix/b3dhommatrixtools \
basegfx/source/numeric/ftools \
basegfx/source/pixel/bpixel \
basegfx/source/point/b2dpoint \
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx
index 9f7d5bff0156..466e9037d149 100644
--- a/basegfx/source/matrix/b2dhommatrix.cxx
+++ b/basegfx/source/matrix/b2dhommatrix.cxx
@@ -115,6 +115,11 @@ namespace basegfx
bool B2DHomMatrix::invert()
{
+ if(isIdentity())
+ {
+ return true;
+ }
+
Impl2DHomMatrix aWork(*mpImpl);
std::unique_ptr<sal_uInt16[]> pIndex( new sal_uInt16[Impl2DHomMatrix_Base::getEdgeLength()] );
sal_Int16 nParity;
@@ -213,6 +218,11 @@ namespace basegfx
}
}
+ void B2DHomMatrix::translate(const B2DTuple& rTuple)
+ {
+ translate(rTuple.getX(), rTuple.getY());
+ }
+
void B2DHomMatrix::scale(double fX, double fY)
{
const double fOne(1.0);
@@ -228,6 +238,11 @@ namespace basegfx
}
}
+ void B2DHomMatrix::scale(const B2DTuple& rTuple)
+ {
+ scale(rTuple.getX(), rTuple.getY());
+ }
+
void B2DHomMatrix::shearX(double fSx)
{
// #i76239# do not test against 1.0, but against 0.0. We are talking about a value not on the diagonal (!)
diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx
index 6cfd054992ec..b55dd079b514 100644
--- a/basegfx/source/matrix/b3dhommatrix.cxx
+++ b/basegfx/source/matrix/b3dhommatrix.cxx
@@ -203,6 +203,11 @@ namespace basegfx
}
}
+ void B3DHomMatrix::rotate(const B3DTuple& rRotation)
+ {
+ rotate(rRotation.getX(), rRotation.getY(), rRotation.getZ());
+ }
+
void B3DHomMatrix::translate(double fX, double fY, double fZ)
{
if(!fTools::equalZero(fX) || !fTools::equalZero(fY) || !fTools::equalZero(fZ))
@@ -217,6 +222,11 @@ namespace basegfx
}
}
+ void B3DHomMatrix::translate(const B3DTuple& rRotation)
+ {
+ translate(rRotation.getX(), rRotation.getY(), rRotation.getZ());
+ }
+
void B3DHomMatrix::scale(double fX, double fY, double fZ)
{
const double fOne(1.0);
@@ -233,6 +243,11 @@ namespace basegfx
}
}
+ void B3DHomMatrix::scale(const B3DTuple& rRotation)
+ {
+ scale(rRotation.getX(), rRotation.getY(), rRotation.getZ());
+ }
+
void B3DHomMatrix::shearXY(double fSx, double fSy)
{
// #i76239# do not test against 1.0, but against 0.0. We are talking about a value not on the diagonal (!)
diff --git a/basegfx/source/matrix/b3dhommatrixtools.cxx b/basegfx/source/matrix/b3dhommatrixtools.cxx
new file mode 100755
index 000000000000..02dfe63d6741
--- /dev/null
+++ b/basegfx/source/matrix/b3dhommatrixtools.cxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <basegfx/matrix/b3dhommatrixtools.hxx>
+
+namespace basegfx
+{
+namespace utils
+{
+B3DHomMatrix UnoHomogenMatrixToB3DHomMatrix(const com::sun::star::drawing::HomogenMatrix& rMatrixIn)
+{
+ B3DHomMatrix aRetval;
+
+ aRetval.set(0, 0, rMatrixIn.Line1.Column1);
+ aRetval.set(0, 1, rMatrixIn.Line1.Column2);
+ aRetval.set(0, 2, rMatrixIn.Line1.Column3);
+ aRetval.set(0, 3, rMatrixIn.Line1.Column4);
+ aRetval.set(1, 0, rMatrixIn.Line2.Column1);
+ aRetval.set(1, 1, rMatrixIn.Line2.Column2);
+ aRetval.set(1, 2, rMatrixIn.Line2.Column3);
+ aRetval.set(1, 3, rMatrixIn.Line2.Column4);
+ aRetval.set(2, 0, rMatrixIn.Line3.Column1);
+ aRetval.set(2, 1, rMatrixIn.Line3.Column2);
+ aRetval.set(2, 2, rMatrixIn.Line3.Column3);
+ aRetval.set(2, 3, rMatrixIn.Line3.Column4);
+ aRetval.set(3, 0, rMatrixIn.Line4.Column1);
+ aRetval.set(3, 1, rMatrixIn.Line4.Column2);
+ aRetval.set(3, 2, rMatrixIn.Line4.Column3);
+ aRetval.set(3, 3, rMatrixIn.Line4.Column4);
+
+ return aRetval;
+}
+
+void B3DHomMatrixToUnoHomogenMatrix(const B3DHomMatrix& rMatrixIn,
+ com::sun::star::drawing::HomogenMatrix& rMatrixOut)
+{
+ rMatrixOut.Line1.Column1 = rMatrixIn.get(0, 0);
+ rMatrixOut.Line1.Column2 = rMatrixIn.get(0, 1);
+ rMatrixOut.Line1.Column3 = rMatrixIn.get(0, 2);
+ rMatrixOut.Line1.Column4 = rMatrixIn.get(0, 3);
+ rMatrixOut.Line2.Column1 = rMatrixIn.get(1, 0);
+ rMatrixOut.Line2.Column2 = rMatrixIn.get(1, 1);
+ rMatrixOut.Line2.Column3 = rMatrixIn.get(1, 2);
+ rMatrixOut.Line2.Column4 = rMatrixIn.get(1, 3);
+ rMatrixOut.Line3.Column1 = rMatrixIn.get(2, 0);
+ rMatrixOut.Line3.Column2 = rMatrixIn.get(2, 1);
+ rMatrixOut.Line3.Column3 = rMatrixIn.get(2, 2);
+ rMatrixOut.Line3.Column4 = rMatrixIn.get(2, 3);
+ rMatrixOut.Line4.Column1 = rMatrixIn.get(3, 0);
+ rMatrixOut.Line4.Column2 = rMatrixIn.get(3, 1);
+ rMatrixOut.Line4.Column3 = rMatrixIn.get(3, 2);
+ rMatrixOut.Line4.Column4 = rMatrixIn.get(3, 3);
+}
+} // end of namespace tools
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/numeric/ftools.cxx b/basegfx/source/numeric/ftools.cxx
index 994bd29e30eb..d1eca66ca2fc 100644
--- a/basegfx/source/numeric/ftools.cxx
+++ b/basegfx/source/numeric/ftools.cxx
@@ -45,6 +45,59 @@ namespace basegfx
}
}
+ double snapToZeroRange(double v, double fWidth)
+ {
+ if(fTools::equalZero(fWidth))
+ {
+ // with no range all snaps to range bound
+ return 0.0;
+ }
+ else
+ {
+ if(v < 0.0 || v > fWidth)
+ {
+ double fRetval(fmod(v, fWidth));
+
+ if(fRetval < 0.0)
+ {
+ fRetval += fWidth;
+ }
+
+ return fRetval;
+ }
+ else
+ {
+ return v;
+ }
+ }
+ }
+
+ double snapToRange(double v, double fLow, double fHigh)
+ {
+ if(fTools::equal(fLow, fHigh))
+ {
+ // with no range all snaps to range bound
+ return 0.0;
+ }
+ else
+ {
+ if(fLow > fHigh)
+ {
+ // correct range order. Evtl. assert this (?)
+ std::swap(fLow, fHigh);
+ }
+
+ if(v < fLow || v > fHigh)
+ {
+ return snapToZeroRange(v - fLow, fHigh - fLow) + fLow;
+ }
+ else
+ {
+ return v;
+ }
+ }
+ }
+
double normalizeToRange(double v, const double fRange)
{
if(fTools::lessOrEqual(fRange, 0.0))
diff --git a/basegfx/source/range/b2drange.cxx b/basegfx/source/range/b2drange.cxx
index 2f4a3e08e69e..331c5431bcf3 100644
--- a/basegfx/source/range/b2drange.cxx
+++ b/basegfx/source/range/b2drange.cxx
@@ -51,6 +51,19 @@ namespace basegfx
}
}
+ B2DRange& B2DRange::operator*=( const ::basegfx::B2DHomMatrix& rMat )
+ {
+ transform(rMat);
+ return *this;
+ }
+
+ const B2DRange& B2DRange::getUnitB2DRange()
+ {
+ static const B2DRange aUnitB2DRange(0.0, 0.0, 1.0, 1.0);
+
+ return aUnitB2DRange;
+ }
+
B2IRange fround(const B2DRange& rRange)
{
return rRange.isEmpty() ?
@@ -58,6 +71,13 @@ namespace basegfx
B2IRange(fround(rRange.getMinimum()),
fround(rRange.getMaximum()));
}
+
+ B2DRange operator*( const ::basegfx::B2DHomMatrix& rMat, const B2DRange& rB2DRange )
+ {
+ B2DRange aRes( rB2DRange );
+ return aRes *= rMat;
+ }
+
} // end of namespace basegfx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/source/range/b3drange.cxx b/basegfx/source/range/b3drange.cxx
index f779f1855d79..879dbb0f9974 100644
--- a/basegfx/source/range/b3drange.cxx
+++ b/basegfx/source/range/b3drange.cxx
@@ -40,6 +40,25 @@ namespace basegfx
}
}
+ B3DRange& B3DRange::operator*=( const ::basegfx::B3DHomMatrix& rMat )
+ {
+ transform(rMat);
+ return *this;
+ }
+
+ const B3DRange& B3DRange::getUnitB3DRange()
+ {
+ static const B3DRange aUnitB3DRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
+
+ return aUnitB3DRange;
+ }
+
+ B3DRange operator*( const ::basegfx::B3DHomMatrix& rMat, const B3DRange& rB3DRange )
+ {
+ B3DRange aRes( rB3DRange );
+ return aRes *= rMat;
+ }
+
} // end of namespace basegfx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 5efd976dcef5..b86980f47782 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -96,11 +96,13 @@ OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & x
}
-DrawViewWrapper::DrawViewWrapper( SdrModel* pSdrModel, OutputDevice* pOut)
- : E3dView(pSdrModel, pOut)
- , m_pMarkHandleProvider(nullptr)
- , m_apOutliner(SdrMakeOutliner(OutlinerMode::TextObject, *pSdrModel))
- , m_bRestoreMapMode( false )
+DrawViewWrapper::DrawViewWrapper(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut)
+: E3dView(rSdrModel, pOut)
+ ,m_pMarkHandleProvider(nullptr)
+ ,m_apOutliner(SdrMakeOutliner(OutlinerMode::TextObject, rSdrModel))
+ ,m_bRestoreMapMode( false )
{
SetBufferedOutputAllowed(true);
SetBufferedOverlayAllowed(true);
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index 954426f925a5..500488aaa39c 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -161,7 +161,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co
SdrPage* pPage = new SdrPage( *pModel, false );
pPage->SetSize(Size(1000,1000));
pModel->InsertPage( pPage, 0 );
- std::unique_ptr<SdrView> pView( new SdrView( pModel.get(), pVDev ) );
+ std::unique_ptr<SdrView> pView( new SdrView( *pModel.get(), pVDev ) );
pView->hideMarkHandles();
SdrPageView* pPageView = pView->ShowSdrPage(pPage);
diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx
index 91ffdf7eeb1b..2adf512fe015 100644
--- a/chart2/source/controller/inc/DrawViewWrapper.hxx
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -46,7 +46,10 @@ protected:
class DrawViewWrapper : public E3dView
{
public:
- DrawViewWrapper(SdrModel* pModel, OutputDevice* pOut);
+ DrawViewWrapper(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~DrawViewWrapper() override;
//triggers the use of an updated first page
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 139f17279b40..02c444d8f041 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -727,7 +727,7 @@ void ChartController::impl_createDrawViewController()
{
if( m_pDrawModelWrapper )
{
- m_pDrawViewWrapper = new DrawViewWrapper(&m_pDrawModelWrapper->getSdrModel(),GetChartWindow());
+ m_pDrawViewWrapper = new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow());
m_pDrawViewWrapper->attachParentReferenceDevice( getModel() );
}
}
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index d06524480847..00abbf63ad5e 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -395,11 +395,12 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )
SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
while ( aIter.IsMore() )
{
- SdrObject* pObj = aIter.Next();
- SdrObject* pNewObj = ( pObj ? pObj->Clone() : nullptr );
+ SdrObject* pObj(aIter.Next());
+ // Clone to new SdrModel
+ SdrObject* pNewObj(pObj ? pObj->Clone(&pDrawModelWrapper->getSdrModel()) : nullptr);
+
if ( pNewObj )
{
- pNewObj->SetModel( &pDrawModelWrapper->getSdrModel() );
pNewObj->SetPage( pDestPage );
// set position
@@ -516,7 +517,9 @@ void ChartController::executeDispatch_Copy()
if ( pSelectedObj )
{
xTransferable.set( new ChartTransferable(
- &m_pDrawModelWrapper->getSdrModel(), pSelectedObj, aSelOID.isAdditionalShape() ) );
+ m_pDrawModelWrapper->getSdrModel(),
+ pSelectedObj,
+ aSelOID.isAdditionalShape() ) );
}
}
}
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 2eeb46a764f2..4888c4802b9f 100644
--- a/chart2/source/controller/main/ChartTransferable.cxx
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -46,12 +46,15 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-ChartTransferable::ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing )
- :m_pMarkedObjModel( nullptr )
+ChartTransferable::ChartTransferable(
+ SdrModel& rSdrModel,
+ SdrObject* pSelectedObj,
+ bool bDrawing)
+: m_pMarkedObjModel( nullptr )
,m_bDrawing( bDrawing )
{
- std::unique_ptr<SdrExchangeView> pExchgView(o3tl::make_unique<SdrView>( pDrawModel ));
- SdrPageView* pPv = pExchgView->ShowSdrPage( pDrawModel->GetPage( 0 ));
+ std::unique_ptr<SdrExchangeView> pExchgView(o3tl::make_unique<SdrView>( rSdrModel ));
+ SdrPageView* pPv = pExchgView->ShowSdrPage( rSdrModel.GetPage( 0 ));
if( pSelectedObj )
pExchgView->MarkObj( pSelectedObj, pPv );
else
diff --git a/chart2/source/controller/main/ChartTransferable.hxx b/chart2/source/controller/main/ChartTransferable.hxx
index 35e4f5d514c1..6fc8b4c26f8c 100644
--- a/chart2/source/controller/main/ChartTransferable.hxx
+++ b/chart2/source/controller/main/ChartTransferable.hxx
@@ -36,16 +36,19 @@ namespace chart
class ChartTransferable : public TransferableHelper
{
public:
- explicit ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelectedObj, bool bDrawing );
+ explicit ChartTransferable(
+ SdrModel& rSdrModel,
+ SdrObject* pSelectedObj,
+ bool bDrawing );
virtual ~ChartTransferable() override;
protected:
// implementation of TransferableHelper methods
- virtual void AddSupportedFormats() override;
+ virtual void AddSupportedFormats() override;
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
- virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
- const css::datatransfer::DataFlavor& rFlavor ) override;
+ virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
+ const css::datatransfer::DataFlavor& rFlavor ) override;
private:
css::uno::Reference< css::graphic::XGraphic > m_xMetaFileGraphic;
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 7e318646ebf5..6c59620ce6c1 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -74,7 +74,7 @@ bool DrawCommandDispatch::isFeatureSupported( const OUString& rCommandURL )
return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType );
}
-::basegfx::B2DPolyPolygon getPolygon(const char* pResId, SdrModel const & rModel)
+::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aReturn;
XLineEndListRef pLineEndList = rModel.GetLineEndList();
@@ -123,7 +123,7 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
SfxItemSet aDest(
- pObj->GetModel()->GetItemPool(),
+ pObj->getSdrModelFromSdrObject().GetItemPool(),
svl::Items<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
@@ -425,8 +425,13 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
if ( pPage )
{
SolarMutexGuard aGuard;
- pObj = SdrObjFactory::MakeNewObject( pDrawViewWrapper->GetCurrentObjInventor(),
- pDrawViewWrapper->GetCurrentObjIdentifier(), pPage );
+
+ pObj = SdrObjFactory::MakeNewObject(
+ pDrawModelWrapper->getSdrModel(),
+ pDrawViewWrapper->GetCurrentObjInventor(),
+ pDrawViewWrapper->GetCurrentObjIdentifier(),
+ pPage);
+
if ( pObj )
{
Size aObjectSize( 4000, 2500 );
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index 4c5bac5abfc0..897bbe390ea4 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -436,7 +436,7 @@ void VDiagram::adjustAspectRatio3d( const awt::Size& rAvailableSize )
// To get the 3D aspect ratio's effect on the 2D scene size, the scene's 2D size needs to be adapted to
// 3D content changes here. The tooling class remembers the current 3D transformation stack
// and in its destructor, calculates a new 2D SnapRect for the scene and it's modified 3D geometry.
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
m_xAspectRatio3D->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
, uno::Any(BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aResult )) );
@@ -599,7 +599,8 @@ void VDiagram::createShapes_3d()
aEffectiveTranformation.shearXY(m_fYAnglePi,-m_fXAnglePi);
//#i98497# 3D charts are rendered with wrong size
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
+
xDestProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX,
uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aEffectiveTranformation ) ) );
}
@@ -656,7 +657,8 @@ void VDiagram::createShapes_3d()
::basegfx::B3DHomMatrix aM;
aM.translate(GRID_TO_WALL_DISTANCE/fXScale, GRID_TO_WALL_DISTANCE/fYScale, GRID_TO_WALL_DISTANCE/fZScale);
aM.scale( fXScale, fYScale, fZScale );
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
+ E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene(m_xOuterGroupShape));
+
xShapeProp->setPropertyValue( UNO_NAME_3D_TRANSFORM_MATRIX
, uno::Any(BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aM)) );
}
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 <border.hxx>
#include <svx/dialogs.hrc>
-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<SfxAbstractLinksDialog> AbstractDialogFactory_Impl::CreateLinksDialog( vc
return VclPtr<AbstractLinksDialog_Impl>::Create( pLinkDlg );
}
-VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* /*pObj*/ )
+VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, const SdrModel& rModel, const SdrObject* /*pObj*/ )
{
- return VclPtr<CuiAbstractTabDialog_Impl>::Create( VclPtr<SvxFormatCellsDialog>::Create( nullptr, pAttr, pModel ) );
+ return VclPtr<CuiAbstractTabDialog_Impl>::Create( VclPtr<SvxFormatCellsDialog>::Create( nullptr, pAttr, rModel ) );
}
VclPtr<SvxAbstractSplitTableDialog> 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<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj ) override;
+ virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, const SdrModel& rModel, const SdrObject* pObj ) override;
virtual VclPtr<SvxAbstractSplitTableDialog> 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<SdrView> pView(new SdrView( pModel.get(), pVDev ));
+ std::unique_ptr<SdrView> 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<SdrView> pView(new SdrView( pModel.get(), pVDev ));
+ std::unique_ptr<SdrView> 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();
}
}
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 0eb9efe66e86..3b3fc0562bf5 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3774,10 +3774,9 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const uno::Refer
SdrObject* pShape = GetSdrObjectFromXShape( rXShape );
if ( pShape )
{
- SdrModel* pMod = pShape->GetModel();
- Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape));
+ const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape));
+ const GraphicObject aGraphicObject(aGraphic);
- GraphicObject aGraphicObject(aGraphic);
if (!aGraphicObject.GetUniqueID().isEmpty())
{
if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index ac281e0bfdd1..e958c813068c 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3955,7 +3955,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
}
if( !pRet )
{
- pRet = new SdrGrafObj;
+ pRet = new SdrGrafObj(*pSdrModel);
if( bGrfRead )
static_cast<SdrGrafObj*>(pRet)->SetGraphic( aGraf );
@@ -3997,7 +3997,6 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
pRet->SetName( aFileName );
}
}
- pRet->SetModel( pSdrModel ); // required for GraphicLink
pRet->SetLogicRect( rObjData.aBoundRect );
if ( dynamic_cast<const SdrGrafObj* >(pRet) != nullptr )
@@ -4307,7 +4306,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
if ( aObjData.nSpFlags & ShapeFlag::Group )
{
- pRet = new SdrObjGroup;
+ pRet = new SdrObjGroup(*pSdrModel);
/* After CWS aw033 has been integrated, an empty group object
cannot store its resulting bounding rectangle anymore. We have
to return this rectangle via rClientRect now, but only, if
@@ -4337,8 +4336,10 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
basegfx::B2DPolygon aPoly;
aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top()));
aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom()));
- pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly));
- pRet->SetModel( pSdrModel );
+ pRet = new SdrPathObj(
+ *pSdrModel,
+ OBJ_LINE,
+ basegfx::B2DPolyPolygon(aPoly));
ApplyAttributes( rSt, aSet, aObjData );
pRet->SetMergedItemSet(aSet);
}
@@ -4349,8 +4350,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
ApplyAttributes( rSt, aSet, aObjData );
- pRet = new SdrObjCustomShape();
- pRet->SetModel( pSdrModel );
+ pRet = new SdrObjCustomShape(*pSdrModel);
sal_uInt32 ngtextFStrikethrough = GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 );
bool bIsFontwork = ( ngtextFStrikethrough & 0x4000 ) != 0;
@@ -4471,9 +4471,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
{
SdrOutliner& rOutliner = static_cast<SdrObjCustomShape*>(pRet)->ImpGetDrawOutliner();
bool bOldUpdateMode = rOutliner.GetUpdateMode();
- SdrModel* pModel = pRet->GetModel();
- if ( pModel )
- rOutliner.SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pModel->GetStyleSheetPool()) );
+ rOutliner.SetStyleSheetPool(static_cast< SfxStyleSheetPool* >(pRet->getSdrModelFromSdrObject().GetStyleSheetPool()));
rOutliner.SetUpdateMode( false );
rOutliner.SetText( *pParaObj );
ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK);
@@ -4735,7 +4733,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
basegfx::B2DPolyPolygon aPoly( static_cast<SdrObjCustomShape*>(pRet)->GetLineGeometry( true ) );
SdrObject::Free( pRet );
- pRet = new SdrEdgeObj();
+ pRet = new SdrEdgeObj(*pSdrModel);
ApplyAttributes( rSt, aSet, aObjData );
pRet->SetLogicRect( aObjData.aBoundRect );
pRet->SetMergedItemSet(aSet);
@@ -5235,7 +5233,10 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
}
}
- pTextObj = new SdrRectObj(OBJ_TEXT, rTextRect);
+ pTextObj = new SdrRectObj(
+ *pSdrModel,
+ OBJ_TEXT,
+ rTextRect);
pTextImpRec = new SvxMSDffImportRec(*pImpRec);
bDeleteTextImpRec = true;
@@ -5364,7 +5365,6 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
}
pTextObj->SetMergedItemSet(aSet);
- pTextObj->SetModel(pSdrModel);
if (bVerticalText)
pTextObj->SetVerticalWriting(true);
@@ -5397,7 +5397,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
{
if( pTextObj != pObj )
{
- SdrObject* pGroup = new SdrObjGroup;
+ SdrObject* pGroup = new SdrObjGroup(*pSdrModel);
pGroup->GetSubList()->NbcInsertObject( pObj );
pGroup->GetSubList()->NbcInsertObject( pTextObj );
if (pOrgObj == pObj)
@@ -5413,9 +5413,11 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
// simple rectangular objects are ignored by ImportObj() :-(
// this is OK for Draw but not for Calc and Writer
// cause here these objects have a default border
- pObj = new SdrRectObj(rTextRect);
+ pObj = new SdrRectObj(
+ *pSdrModel,
+ rTextRect);
+
pOrgObj = pObj;
- pObj->SetModel( pSdrModel );
SfxItemSet aSet( pSdrModel->GetItemPool() );
ApplyAttributes( rSt, aSet, rObjData );
@@ -6615,9 +6617,19 @@ SdrObject* SvxMSDffManager::ImportOLE( sal_uInt32 nOLEId,
ErrCode nError = ERRCODE_NONE;
uno::Reference < embed::XStorage > xDstStg;
if( GetOLEStorageName( nOLEId, sStorageName, xSrcStg, xDstStg ))
- pRet = CreateSdrOLEFromStorage( sStorageName, xSrcStg, xDstStg,
- rGrf, rBoundRect, rVisArea, pStData, nError,
- nSvxMSDffOLEConvFlags, embed::Aspects::MSOLE_CONTENT, maBaseURL);
+ pRet = CreateSdrOLEFromStorage(
+ *GetModel(),
+ sStorageName,
+ xSrcStg,
+ xDstStg,
+ rGrf,
+ rBoundRect,
+ rVisArea,
+ pStData,
+ nError,
+ nSvxMSDffOLEConvFlags,
+ embed::Aspects::MSOLE_CONTENT,
+ maBaseURL);
return pRet;
}
@@ -7106,17 +7118,18 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo
// TODO/MBA: code review and testing!
SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
- const OUString& rStorageName,
- tools::SvRef<SotStorage> const & rSrcStorage,
- const uno::Reference < embed::XStorage >& xDestStorage,
- const Graphic& rGrf,
- const tools::Rectangle& rBoundRect,
- const tools::Rectangle& rVisArea,
- SvStream* pDataStrm,
- ErrCode& rError,
- sal_uInt32 nConvertFlags,
- sal_Int64 nRecommendedAspect,
- OUString const& rBaseURL)
+ SdrModel& rSdrModel,
+ const OUString& rStorageName,
+ tools::SvRef<SotStorage> const & rSrcStorage,
+ const uno::Reference < embed::XStorage >& xDestStorage,
+ const Graphic& rGrf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ SvStream* pDataStrm,
+ ErrCode& rError,
+ sal_uInt32 nConvertFlags,
+ sal_Int64 nRecommendedAspect,
+ OUString const& rBaseURL)
{
sal_Int64 nAspect = nRecommendedAspect;
SdrOle2Obj* pRet = nullptr;
@@ -7184,7 +7197,12 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
aObj.SetGraphic( rGrf, OUString() );
// TODO/MBA: check setting of PersistName
- pRet = new SdrOle2Obj( aObj, OUString(), rBoundRect);
+ pRet = new SdrOle2Obj(
+ rSdrModel,
+ aObj,
+ OUString(),
+ rBoundRect);
+
// we have the Object, don't create another
bValidStorage = false;
}
@@ -7280,7 +7298,11 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage(
// TODO/LATER: need MediaType
aObj.SetGraphic( rGrf, OUString() );
- pRet = new SdrOle2Obj( aObj, aDstStgName, rBoundRect);
+ pRet = new SdrOle2Obj(
+ rSdrModel,
+ aObj,
+ aDstStgName,
+ rBoundRect);
}
}
}
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 22d21cb1a74e..5758ca606a1b 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -807,7 +807,10 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
// replacing the object which we will return with a SdrPageObj
SdrObject::Free( pRet );
- pRet = new SdrPageObj( rObjData.aBoundRect, pSdrModel->GetPage( nPageNum - 1 ) );
+ pRet = new SdrPageObj(
+ *pSdrModel,
+ rObjData.aBoundRect,
+ pSdrModel->GetPage(nPageNum - 1));
}
else
{
@@ -1069,8 +1072,9 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
SdrObject::Free( pRet );
pRet = nullptr;
}
- pTObj = new SdrRectObj( eTextKind != OBJ_RECT ? eTextKind : OBJ_TEXT );
- pTObj->SetModel( pSdrModel );
+ pTObj = new SdrRectObj(
+ *pSdrModel,
+ eTextKind != OBJ_RECT ? eTextKind : OBJ_TEXT);
SfxItemSet aSet( pSdrModel->GetItemPool() );
if ( !pRet )
ApplyAttributes( rSt, aSet, rObjData );
@@ -1197,7 +1201,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
}
if ( pRet )
{
- SdrObject* pGroup = new SdrObjGroup;
+ SdrObject* pGroup = new SdrObjGroup(*pSdrModel);
pGroup->GetSubList()->NbcInsertObject( pRet );
pGroup->GetSubList()->NbcInsertObject( pTObj );
pRet = pGroup;
@@ -1880,7 +1884,11 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
// TODO/LATER: need MediaType for Graphic
aObj.SetGraphic( rGraf, OUString() );
- pRet = new SdrOle2Obj( aObj, aNm, rBoundRect );
+ pRet = new SdrOle2Obj(
+ *pSdrModel,
+ aObj,
+ aNm,
+ rBoundRect);
}
}
if ( !pRet && ( rOe.nType == PPT_PST_ExControl ) )
@@ -1943,7 +1951,11 @@ SdrObject* SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId,
// TODO/LATER: need MediaType for Graphic
aObj.SetGraphic( aGraphic, OUString() );
- pRet = new SdrOle2Obj( aObj, aNm, rBoundRect );
+ pRet = new SdrOle2Obj(
+ *pSdrModel,
+ aObj,
+ aNm,
+ rBoundRect);
}
}
}
@@ -3062,12 +3074,17 @@ SdrObject* SdrPowerPointImport::ImportPageBackgroundObject( const SdrPage& rPage
pSet->Put( XFillStyleItem( drawing::FillStyle_NONE ) );
}
pSet->Put( XLineStyleItem( drawing::LineStyle_NONE ) );
- tools::Rectangle aRect( rPage.GetLeftBorder(), rPage.GetUpperBorder(), rPage.GetWidth()-rPage.GetRightBorder(), rPage.GetHeight()-rPage.GetLowerBorder() );
- pRet = new SdrRectObj( aRect );
- pRet->SetModel( pSdrModel );
+ tools::Rectangle aRect(
+ rPage.GetLeftBorder(),
+ rPage.GetUpperBorder(),
+ rPage.GetWidth() - rPage.GetRightBorder(),
+ rPage.GetHeight() - rPage.GetLowerBorder());
- pRet->SetMergedItemSet(*pSet);
+ pRet = new SdrRectObj(
+ *pSdrModel,
+ aRect);
+ pRet->SetMergedItemSet(*pSet);
pRet->SetMarkProtect( true );
pRet->SetMoveProtect( true );
pRet->SetResizeProtect( true );
@@ -7572,7 +7589,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, const sal_uInt32
if (aRows.empty())
return pRet;
- sdr::table::SdrTableObj* pTable = new sdr::table::SdrTableObj( pSdrModel );
+ sdr::table::SdrTableObj* pTable = new sdr::table::SdrTableObj(*pSdrModel);
pTable->uno_lock();
Reference< XTable > xTable( pTable->getTable() );
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index e923eb92c021..056c1c7fa5c9 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -560,9 +560,9 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
if( pSvxDrawPage )
{
mpDefaultSdrPage = pSvxDrawPage->GetSdrPage();
- mpSdrModel = mpDefaultSdrPage->GetModel();
+ mpSdrModel = &mpDefaultSdrPage->getSdrModelFromSdrPage();
- if( mpSdrModel )
+ if( mpSdrModel ) // TTTT should be reference
{
SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner();
@@ -921,8 +921,8 @@ void SVGFilter::implGenerateMetaData()
if( pSvxDrawPage )
{
SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage();
- SdrModel* pSdrModel = pSdrPage->GetModel();
- nPageNumberingType = pSdrModel->GetPageNumType();
+ SdrModel& rSdrModel(pSdrPage->getSdrModelFromSdrPage());
+ nPageNumberingType = rSdrModel.GetPageNumType();
// That is used by CalcFieldHdl method.
mVisiblePagePropSet.nPageNumberingType = nPageNumberingType;
@@ -1384,8 +1384,8 @@ void SVGFilter::implGetPagePropSet( const Reference< css::drawing::XDrawPage > &
if( pSvxDrawPage )
{
SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage();
- SdrModel* pSdrModel = pSdrPage->GetModel();
- mVisiblePagePropSet.nPageNumberingType = pSdrModel->GetPageNumType();
+ SdrModel& rSdrModel(pSdrPage->getSdrModelFromSdrPage());
+ mVisiblePagePropSet.nPageNumberingType = rSdrModel.GetPageNumType();
}
}
}
@@ -1931,7 +1931,7 @@ bool SVGFilter::implCreateObjectsFromShape( const Reference< css::drawing::XDraw
if( pObj )
{
- Graphic aGraphic( SdrExchangeView::GetObjGraphic( pObj->GetModel(), pObj ) );
+ const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pObj));
if( aGraphic.GetType() != GraphicType::NONE )
{
diff --git a/include/basegfx/matrix/b2dhommatrix.hxx b/include/basegfx/matrix/b2dhommatrix.hxx
index a7ab0c3f5917..9f2c8a338412 100644
--- a/include/basegfx/matrix/b2dhommatrix.hxx
+++ b/include/basegfx/matrix/b2dhommatrix.hxx
@@ -74,8 +74,10 @@ namespace basegfx
void rotate(double fRadiant);
void translate(double fX, double fY);
+ void translate(const B2DTuple& rTuple);
void scale(double fX, double fY);
+ void scale(const B2DTuple& rTuple);
// Shearing-Matrices
void shearX(double fSx);
diff --git a/include/basegfx/matrix/b3dhommatrix.hxx b/include/basegfx/matrix/b3dhommatrix.hxx
index 09d700547363..6d5d5c486b9b 100644
--- a/include/basegfx/matrix/b3dhommatrix.hxx
+++ b/include/basegfx/matrix/b3dhommatrix.hxx
@@ -64,12 +64,15 @@ namespace basegfx
/// Rotation
void rotate(double fAngleX,double fAngleY,double fAngleZ);
+ void rotate(const B3DTuple& rRotation);
/// Translation
void translate(double fX, double fY, double fZ);
+ void translate(const B3DTuple& rTranslation);
/// Scaling
void scale(double fX, double fY, double fZ);
+ void scale(const B3DTuple& rScale);
// Shearing-Matrices
void shearXY(double fSx, double fSy);
diff --git a/include/basegfx/matrix/b3dhommatrixtools.hxx b/include/basegfx/matrix/b3dhommatrixtools.hxx
new file mode 100755
index 000000000000..16debfad981b
--- /dev/null
+++ b/include/basegfx/matrix/b3dhommatrixtools.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFX_MATRIX_B3DHOMMATRIXTOOLS_HXX
+#define INCLUDED_BASEGFX_MATRIX_B3DHOMMATRIXTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+
+namespace basegfx
+{
+namespace utils
+{
+/* tooling methods for converting API matrices (drawing::HomogenMatrix) to
+ B3DHomMatrix. drawing::HomogenMatrix4 is not used by OOo
+ */
+BASEGFX_DLLPUBLIC B3DHomMatrix
+UnoHomogenMatrixToB3DHomMatrix(const com::sun::star::drawing::HomogenMatrix& rMatrixIn);
+
+BASEGFX_DLLPUBLIC void
+B3DHomMatrixToUnoHomogenMatrix(const B3DHomMatrix& rMatrixIn,
+ com::sun::star::drawing::HomogenMatrix& rMatrixOut);
+
+} // end of namespace tools
+} // end of namespace basegfx
+
+#endif // INCLUDED_BASEGFX_MATRIX_B3DHOMMATRIXTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
index 52909c9cd75b..1ade3bb3a3d6 100644
--- a/include/basegfx/numeric/ftools.hxx
+++ b/include/basegfx/numeric/ftools.hxx
@@ -153,6 +153,25 @@ namespace basegfx
*/
BASEGFX_DLLPUBLIC double snapToNearestMultiple(double v, const double fStep);
+ /** Snap v to the range [0.0 .. fWidth] using modulo
+ */
+ double snapToZeroRange(double v, double fWidth);
+
+ /** Snap v to the range [fLow .. fHigh] using modulo
+ */
+ double snapToRange(double v, double fLow, double fHigh);
+
+ /** return fValue with the sign of fSignCarrier, thus evtl. changed
+ */
+ inline double copySign(double fValue, double fSignCarrier)
+ {
+#ifdef WNT
+ return _copysign(fValue, fSignCarrier);
+#else
+ return copysign(fValue, fSignCarrier);
+#endif
+ }
+
/** RotateFlyFrame3: Normalize to range defined by [0.0 ... fRange[, independent
if v is positive or negative.
diff --git a/include/basegfx/range/b1drange.hxx b/include/basegfx/range/b1drange.hxx
index c1e35b13605c..7b0d22869559 100644
--- a/include/basegfx/range/b1drange.hxx
+++ b/include/basegfx/range/b1drange.hxx
@@ -141,6 +141,11 @@ namespace basegfx
maRange.intersect(rRange.maRange);
}
+ /// clamp value on range
+ double clamp(double fValue) const
+ {
+ return maRange.clamp(fValue);
+ }
};
} // end of namespace basegfx
diff --git a/include/basegfx/range/b2drange.hxx b/include/basegfx/range/b2drange.hxx
index 0de9dba0e783..00eab63d1472 100644
--- a/include/basegfx/range/b2drange.hxx
+++ b/include/basegfx/range/b2drange.hxx
@@ -274,8 +274,29 @@ namespace basegfx
maRangeY.grow(fValue);
}
+ /// clamp value on range
+ B2DTuple clamp(const B2DTuple& rTuple) const
+ {
+ return B2DTuple(
+ maRangeX.clamp(rTuple.getX()),
+ maRangeY.clamp(rTuple.getY()));
+ }
+
+ /** Transform Range by given transformation matrix. */
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix& rMatrix);
+ /** Transform Range by given transformation matrix.
+
+ This operation transforms the Range by transforming all four possible
+ extrema points (corners) of the given range and building a new one.
+ This means that the range will grow evtl. when a shear and/or rotation
+ is part of the transformation.
+ */
+ B2DRange& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+
+ /** Get a range filled with (0.0, 0.0, 1.0, 1.0) */
+ static const B2DRange& getUnitB2DRange();
+
private:
typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange;
@@ -283,6 +304,10 @@ namespace basegfx
MyBasicRange maRangeY;
};
+ /** Transform B2DRange by given transformation matrix (see operator*=())
+ */
+ B2DRange operator*( const B2DHomMatrix& rMat, const B2DRange& rB2DRange );
+
/** Round double to nearest integer for 2D range
@return the nearest integer for this range
diff --git a/include/basegfx/range/b2irange.hxx b/include/basegfx/range/b2irange.hxx
index 3d7d0edba6c9..a8a95d69ceed 100644
--- a/include/basegfx/range/b2irange.hxx
+++ b/include/basegfx/range/b2irange.hxx
@@ -208,6 +208,13 @@ namespace basegfx
maRangeY.intersect(rRange.maRangeY);
}
+ B2ITuple clamp(const B2ITuple& rTuple) const
+ {
+ return B2ITuple(
+ maRangeX.clamp(rTuple.getX()),
+ maRangeY.clamp(rTuple.getY()));
+ }
+
private:
typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange;
diff --git a/include/basegfx/range/b3drange.hxx b/include/basegfx/range/b3drange.hxx
index 881dce612297..e1c44393813a 100644
--- a/include/basegfx/range/b3drange.hxx
+++ b/include/basegfx/range/b3drange.hxx
@@ -195,9 +195,34 @@ namespace basegfx
maRangeZ.grow(fValue);
}
+ /// clamp value on range
+ B3DTuple clamp(const B3DTuple& rTuple) const
+ {
+ return B3DTuple(
+ maRangeX.clamp(rTuple.getX()),
+ maRangeY.clamp(rTuple.getY()),
+ maRangeZ.clamp(rTuple.getZ()));
+ }
+
BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix& rMatrix);
+
+ /** Transform Range by given transformation matrix.
+
+ This operation transforms the Range by transforming all eight possible
+ extrema points (corners) of the given range and building a new one.
+ This means that the range will grow evtl. when a shear and/or rotation
+ is part of the transformation.
+ */
+ B3DRange& operator*=( const ::basegfx::B3DHomMatrix& rMat );
+
+ /** Get a range filled with (0.0, 0.0, 0.0, 1.0, 1.0, 1.0) */
+ static const B3DRange& getUnitB3DRange();
};
+ /** Transform B3DRange by given transformation matrix (see operator*=())
+ */
+ B3DRange operator*( const B3DHomMatrix& rMat, const B3DRange& rB2DRange );
+
} // end of namespace basegfx
diff --git a/include/basegfx/range/basicrange.hxx b/include/basegfx/range/basicrange.hxx
index bea40dd3ded2..17f31ea42f19 100644
--- a/include/basegfx/range/basicrange.hxx
+++ b/include/basegfx/range/basicrange.hxx
@@ -248,6 +248,28 @@ namespace basegfx
}
}
+ T clamp(T nValue) const
+ {
+ if(isEmpty())
+ {
+ return nValue;
+ }
+ else
+ {
+ if(nValue < mnMinimum)
+ {
+ return mnMinimum;
+ }
+
+ if(nValue > mnMaximum)
+ {
+ return mnMaximum;
+ }
+
+ return nValue;
+ }
+ }
+
typename Traits::DifferenceType getRange() const
{
if(isEmpty())
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index ba8e6897492d..fedce1b33112 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -697,17 +697,19 @@ public:
void RemoveFromShapeOrder( SdrObject const * pObject ) const;
- static SdrOle2Obj* CreateSdrOLEFromStorage( const OUString& rStorageName,
- tools::SvRef<SotStorage> const & rSrcStorage,
- const css::uno::Reference < css::embed::XStorage >& xDestStg,
- const Graphic& rGraf,
- const tools::Rectangle& rBoundRect,
- const tools::Rectangle& rVisArea,
- SvStream* pDataStrrm,
- ErrCode& rError,
- sal_uInt32 nConvertFlags,
- sal_Int64 nAspect,
- OUString const& rBaseURL);
+ static SdrOle2Obj* CreateSdrOLEFromStorage(
+ SdrModel& rSdrModel,
+ const OUString& rStorageName,
+ tools::SvRef<SotStorage> const & rSrcStorage,
+ const css::uno::Reference < css::embed::XStorage >& xDestStg,
+ const Graphic& rGraf,
+ const tools::Rectangle& rBoundRect,
+ const tools::Rectangle& rVisArea,
+ SvStream* pDataStrrm,
+ ErrCode& rError,
+ sal_uInt32 nConvertFlags,
+ sal_Int64 nAspect,
+ OUString const& rBaseURL);
/** Create connections between shapes.
This method should be called after a page is imported.
diff --git a/include/svx/connctrl.hxx b/include/svx/connctrl.hxx
index 360ff38522da..106140dfa374 100644
--- a/include/svx/connctrl.hxx
+++ b/include/svx/connctrl.hxx
@@ -32,7 +32,7 @@ namespace vcl { class Window; }
class SfxItemSet;
class SdrEdgeObj;
class SdrView;
-class SdrObjList;
+class SdrPage;
/*************************************************************************
|*
@@ -45,7 +45,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXConnectionPreview : public Control
private:
SdrEdgeObj* pEdgeObj;
- SdrObjList* pObjList;
+ SdrPage* pSdrPage;
const SdrView* pView;
SVX_DLLPRIVATE void SetStyles();
diff --git a/include/svx/cube3d.hxx b/include/svx/cube3d.hxx
index 4a74777e0cff..95acaab386cd 100644
--- a/include/svx/cube3d.hxx
+++ b/include/svx/cube3d.hxx
@@ -54,17 +54,23 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC E3dCubeObj final : public E3dCompoundObject
// BOOLeans
bool bPosIsCenter : 1;
- void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+ void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
public:
- E3dCubeObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& aPos, const basegfx::B3DVector& r3DSize);
- E3dCubeObj();
+ E3dCubeObj(SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPoint& aPos,
+ const basegfx::B3DVector& r3DSize);
+ E3dCubeObj(SdrModel& rSdrModel);
virtual sal_uInt16 GetObjIdentifier() const override;
virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
- virtual E3dCubeObj* Clone() const override;
+ virtual E3dCubeObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ E3dCubeObj& operator=(const E3dCubeObj& rObj);
// Set local parameters with geometry recreation
void SetCubePos(const basegfx::B3DPoint& rNew);
diff --git a/include/svx/deflt3d.hxx b/include/svx/deflt3d.hxx
index e69a62a1625e..e08e9945fa96 100644
--- a/include/svx/deflt3d.hxx
+++ b/include/svx/deflt3d.hxx
@@ -65,13 +65,13 @@ public:
void Reset();
// Cube object
- const basegfx::B3DPoint& GetDefaultCubePos() { return aDefaultCubePos; }
- const basegfx::B3DVector& GetDefaultCubeSize() { return aDefaultCubeSize; }
+ const basegfx::B3DPoint& GetDefaultCubePos() const { return aDefaultCubePos; }
+ const basegfx::B3DVector& GetDefaultCubeSize() const { return aDefaultCubeSize; }
bool GetDefaultCubePosIsCenter() const { return bDefaultCubePosIsCenter; }
// Sphere object
- const basegfx::B3DPoint& GetDefaultSphereCenter() { return aDefaultSphereCenter; }
- const basegfx::B3DVector& GetDefaultSphereSize() { return aDefaultSphereSize; }
+ const basegfx::B3DPoint& GetDefaultSphereCenter() const { return aDefaultSphereCenter; }
+ const basegfx::B3DVector& GetDefaultSphereSize() const { return aDefaultSphereSize; }
// Lathe object
bool GetDefaultLatheSmoothed() const { return bDefaultLatheSmoothed; }
diff --git a/include/svx/e3dsceneupdater.hxx b/include/svx/e3dsceneupdater.hxx
index ad01d667b4f5..e6800e845e01 100644
--- a/include/svx/e3dsceneupdater.hxx
+++ b/include/svx/e3dsceneupdater.hxx
@@ -50,7 +50,7 @@ class SVX_DLLPUBLIC E3DModifySceneSnapRectUpdater
// of the to-be-changed 3D object when the scene has a 3d transformation
// stack at construction time. In all other cases it's set to zero and
// no action needs to be taken
- E3dScene* mpScene;
+ E3dScene* mpScene;
// the 3d transformation stack at the time of construction, valid when
// mpScene is not zero
@@ -58,7 +58,7 @@ class SVX_DLLPUBLIC E3DModifySceneSnapRectUpdater
public:
// the constructor evaluates and sets the members at construction time
- E3DModifySceneSnapRectUpdater(const SdrObject* pObject);
+ E3DModifySceneSnapRectUpdater(const SdrObject* mpObject);
// the destructor will take action if mpScene is not zero and modify the
// 2D geomeztry of the target scene
diff --git a/include/svx/e3dundo.hxx b/include/svx/e3dundo.hxx
index 8be61b7b9e0e..17335ea1e8e0 100644
--- a/include/svx/e3dundo.hxx
+++ b/include/svx/e3dundo.hxx
@@ -31,17 +31,15 @@
\************************************************************************/
class SAL_WARN_UNUSED E3dUndoAction : public SdrUndoAction
{
-
protected:
- E3dObject *pMy3DObj;
+ E3dObject& mrMy3DObj;
public:
- E3dUndoAction (SdrModel *pModel,
- E3dObject *p3DObj) :
- SdrUndoAction (*pModel),
- pMy3DObj (p3DObj)
- {
- }
+ E3dUndoAction(E3dObject &r3DObj)
+ : SdrUndoAction(r3DObj.getSdrModelFromSdrObject()),
+ mrMy3DObj(r3DObj)
+ {
+ }
virtual ~E3dUndoAction () override;
@@ -55,25 +53,25 @@ class SAL_WARN_UNUSED E3dUndoAction : public SdrUndoAction
\************************************************************************/
class SAL_WARN_UNUSED E3dRotateUndoAction : public E3dUndoAction
{
- basegfx::B3DHomMatrix aMyOldRotation;
- basegfx::B3DHomMatrix aMyNewRotation;
-
- public:
- E3dRotateUndoAction (SdrModel *pModel,
- E3dObject *p3DObj,
- const basegfx::B3DHomMatrix &aOldRotation,
- const basegfx::B3DHomMatrix &aNewRotation) :
- E3dUndoAction (pModel, p3DObj),
- aMyOldRotation (aOldRotation),
- aMyNewRotation (aNewRotation)
- {
- }
-
- virtual ~E3dRotateUndoAction () override;
-
- virtual void Undo() override;
- virtual void Redo() override;
-
+private:
+ basegfx::B3DHomMatrix maMyOldRotation;
+ basegfx::B3DHomMatrix maMyNewRotation;
+
+public:
+ E3dRotateUndoAction(
+ E3dObject& r3DObj,
+ const basegfx::B3DHomMatrix &aOldRotation,
+ const basegfx::B3DHomMatrix &aNewRotation)
+ : E3dUndoAction(r3DObj),
+ maMyOldRotation(aOldRotation),
+ maMyNewRotation(aNewRotation)
+ {
+ }
+
+ virtual ~E3dRotateUndoAction () override;
+
+ virtual void Undo() override;
+ virtual void Redo() override;
};
/************************************************************************\
@@ -83,16 +81,16 @@ class SAL_WARN_UNUSED E3dRotateUndoAction : public E3dUndoAction
\************************************************************************/
class SAL_WARN_UNUSED SVX_DLLPUBLIC E3dAttributesUndoAction : public SdrUndoAction
{
+private:
using SdrUndoAction::Repeat;
- SdrObject* pObject;
-
- const SfxItemSet aNewSet;
- const SfxItemSet aOldSet;
+ SdrObject& mrObject;
+ const SfxItemSet maNewSet;
+ const SfxItemSet maOldSet;
public:
- E3dAttributesUndoAction( SdrModel &rModel,
- E3dObject* pInObject,
+ E3dAttributesUndoAction(
+ E3dObject& rInObject,
const SfxItemSet& rNewSet,
const SfxItemSet& rOldSet);
diff --git a/include/svx/extedit.hxx b/include/svx/extedit.hxx
index 5ee2864a94a2..82afea29c83f 100644
--- a/include/svx/extedit.hxx
+++ b/include/svx/extedit.hxx
@@ -43,18 +43,20 @@ class FmFormView;
class SdrObject;
class SAL_WARN_UNUSED SVX_DLLPUBLIC SdrExternalToolEdit
- : public ExternalToolEdit
- , public SfxListener
+: public ExternalToolEdit
+ ,public SfxListener
{
private:
- FmFormView * m_pView;
- SdrObject * m_pObj;
+ FmFormView* m_pView;
+ SdrObject* m_pObj;
SAL_DLLPRIVATE virtual void Update(Graphic&) override;
SAL_DLLPRIVATE virtual void Notify(SfxBroadcaster&, const SfxHint&) override;
public:
- SdrExternalToolEdit(FmFormView * pView, SdrObject * pObj);
+ SdrExternalToolEdit(
+ FmFormView* pView,
+ SdrObject* pObj);
};
#endif
diff --git a/include/svx/extrud3d.hxx b/include/svx/extrud3d.hxx
index 1b78d4547740..5c121343af4d 100644
--- a/include/svx/extrud3d.hxx
+++ b/include/svx/extrud3d.hxx
@@ -40,12 +40,15 @@ private:
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
- void SetDefaultAttributes(E3dDefaultAttributes const & rDefault);
+ void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
public:
-
- E3dExtrudeObj(E3dDefaultAttributes const & rDefault, const basegfx::B2DPolyPolygon& rPP, double fDepth);
- E3dExtrudeObj();
+ E3dExtrudeObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B2DPolyPolygon& rPP,
+ double fDepth);
+ E3dExtrudeObj(SdrModel& rSdrModel);
// PercentDiagonal: 0..100, before 0.0..0.5
sal_uInt16 GetPercentDiagonal() const
@@ -81,7 +84,10 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
- virtual E3dExtrudeObj* Clone() const override;
+ virtual E3dExtrudeObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ E3dExtrudeObj& operator=(const E3dExtrudeObj& rObj);
// TakeObjName...() is for the display in the UI (for example "3 frames selected")
virtual OUString TakeObjNameSingul() const override;
diff --git a/include/svx/fmpage.hxx b/include/svx/fmpage.hxx
index 808d814452b1..2605a6067517 100644
--- a/include/svx/fmpage.hxx
+++ b/include/svx/fmpage.hxx
@@ -42,6 +42,7 @@ class HelpEvent;
class SVX_DLLPUBLIC FmFormPage : public SdrPage
{
FmFormPage& operator=(const FmFormPage&) = delete;
+ FmFormPage(const FmFormPage&) = delete;
friend class FmFormObj;
std::unique_ptr<FmFormPageImpl> m_pImpl;
@@ -52,10 +53,7 @@ public:
explicit FmFormPage(FmFormModel& rModel, bool bMasterPage=false);
virtual ~FmFormPage() override;
- virtual void SetModel(SdrModel* pNewModel) override;
-
- virtual SdrPage* Clone() const override;
- virtual SdrPage* Clone(SdrModel* pNewModel) const override;
+ virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override;
virtual void InsertObject(SdrObject* pObj, size_t nPos = SAL_MAX_SIZE) override;
@@ -75,9 +73,8 @@ public:
const HelpEvent& rEvt );
protected:
- FmFormPage(const FmFormPage& rPage);
-
- void lateInit(const FmFormPage& rPage, FmFormModel* pNewModel = nullptr);
+ // lateInit -> copyValuesToClonedInstance (?)
+ void lateInit(const FmFormPage& rPage);
};
#endif // INCLUDED_SVX_FMPAGE_HXX
diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx
index a4245150337a..d0a7eb79836f 100644
--- a/include/svx/fmview.hxx
+++ b/include/svx/fmview.hxx
@@ -61,8 +61,10 @@ class SVX_DLLPUBLIC FmFormView : public E3dView
void Init();
public:
+ FmFormView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
- FmFormView(FmFormModel* pModel, OutputDevice* pOut);
virtual ~FmFormView() override;
/** create a control pair (label/bound control) for the database field description given.
diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx
index 85ecc62e904f..f32454a56ae4 100644
--- a/include/svx/graphctl.hxx
+++ b/include/svx/graphctl.hxx
@@ -141,10 +141,13 @@ protected:
}
public:
- GraphCtrlView(SdrModel* pModel, GraphCtrl* pWindow)
- : SdrView(pModel, pWindow)
- , rGraphCtrl(*pWindow)
- {}
+ GraphCtrlView(
+ SdrModel& rSdrModel,
+ GraphCtrl* pWindow)
+ : SdrView(rSdrModel, pWindow)
+ ,rGraphCtrl(*pWindow)
+ {
+ }
};
#endif // INCLUDED_SVX_GRAPHCTL_HXX
diff --git a/include/svx/lathe3d.hxx b/include/svx/lathe3d.hxx
index 3c5a0e23b015..89df10369045 100644
--- a/include/svx/lathe3d.hxx
+++ b/include/svx/lathe3d.hxx
@@ -39,11 +39,14 @@ class SVX_DLLPUBLIC E3dLatheObj final : public E3dCompoundObject
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
- void SetDefaultAttributes(E3dDefaultAttributes const & rDefault);
+ void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
public:
- E3dLatheObj(E3dDefaultAttributes const & rDefault, const basegfx::B2DPolyPolygon& rPoly2D);
- E3dLatheObj();
+ E3dLatheObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B2DPolyPolygon& rPoly2D);
+ E3dLatheObj(SdrModel& rSdrModel);
// HorizontalSegments:
sal_uInt32 GetHorizontalSegments() const
@@ -87,7 +90,10 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
- virtual E3dLatheObj* Clone() const override;
+ virtual E3dLatheObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ E3dLatheObj& operator=(const E3dLatheObj& rObj);
virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
index 87117cc5d203..7ad18848d4cd 100644
--- a/include/svx/obj3d.hxx
+++ b/include/svx/obj3d.hxx
@@ -81,6 +81,8 @@ public:
E3dObjList();
SVX_DLLPUBLIC virtual ~E3dObjList() override;
+ virtual E3dObjList* CloneSdrObjList(SdrModel* pNewModel = nullptr) const override;
+
virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override;
virtual void InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override;
virtual SdrObject* NbcRemoveObject(size_t nObjNum) override;
@@ -88,8 +90,7 @@ public:
private:
E3dObjList &operator=(const E3dObjList& rSrcList) = delete;
-
- SVX_DLLPUBLIC E3dObjList(const E3dObjList& rSrcList);
+ E3dObjList(const E3dObjList& rSrcList) = delete;
};
/*************************************************************************
@@ -131,7 +132,7 @@ protected:
// E3dObject is only a helper class (for E3DScene and E3DCompoundObject)
// and no instances should be created from anyone, so i move the constructors
// to protected area
- E3dObject();
+ E3dObject(SdrModel& rSdrModel);
public:
virtual void RecalcSnapRect() override;
@@ -148,7 +149,6 @@ public:
virtual void SetObjList(SdrObjList* pNewObjList) override;
virtual void SetPage(SdrPage* pNewPage) override;
- virtual void SetModel(SdrModel* pNewModel) override;
virtual void NbcMove(const Size& rSize) override;
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
virtual SdrObjList* GetSubList() const override;
@@ -183,7 +183,7 @@ public:
// TakeObjName...() is for the display in the UI, for example "3 frames selected".
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
- virtual E3dObject* Clone() const override;
+ virtual E3dObject* Clone(SdrModel* pTargetModel = nullptr) const override;
E3dObject& operator=( const E3dObject& rObj );
virtual SdrObjGeoData *NewGeoData() const override;
@@ -232,7 +232,7 @@ protected:
public:
- E3dCompoundObject();
+ E3dCompoundObject(SdrModel& rSdrModel);
virtual ~E3dCompoundObject() override;
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
@@ -242,7 +242,10 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
virtual void RecalcSnapRect() override;
- virtual E3dCompoundObject* Clone() const override;
+ virtual E3dCompoundObject* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ E3dCompoundObject& operator=(const E3dCompoundObject& rObj);
bool IsAOrdNumRemapCandidate(E3dScene*& prScene) const;
};
diff --git a/include/svx/polygn3d.hxx b/include/svx/polygn3d.hxx
index 98778dd493e3..9f5acca38ce2 100644
--- a/include/svx/polygn3d.hxx
+++ b/include/svx/polygn3d.hxx
@@ -43,10 +43,11 @@ public:
void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D);
void SetPolyTexture2D(const basegfx::B2DPolyPolygon& rNewPolyPoly2D);
+ E3dPolygonObj(
+ SdrModel& rSdrModel,
+ const basegfx::B3DPolyPolygon& rPolyPoly3D);
+ E3dPolygonObj(SdrModel& rSdrModel);
- E3dPolygonObj(const basegfx::B3DPolyPolygon& rPolyPoly3D);
-
- E3dPolygonObj();
virtual ~E3dPolygonObj() override;
const basegfx::B3DPolyPolygon& GetPolyPolygon3D() const { return aPolyPoly3D; }
@@ -56,7 +57,10 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
- virtual E3dPolygonObj* Clone() const override;
+ virtual E3dPolygonObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ E3dPolygonObj& operator=(const E3dPolygonObj& rObj);
// LineOnly?
bool GetLineOnly() const { return bLineOnly; }
diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
index b6562093a6f1..eef2c0422ba9 100644
--- a/include/svx/scene3d.hxx
+++ b/include/svx/scene3d.hxx
@@ -90,7 +90,7 @@ protected:
void ImpCleanup3DDepthMapper();
public:
- E3dScene();
+ E3dScene(SdrModel& rSdrModel);
virtual ~E3dScene() override;
virtual void SetBoundRectDirty() override;
@@ -130,7 +130,7 @@ public:
const Camera3D& GetCamera() const { return aCamera; }
void removeAllNonSelectedObjects();
- virtual E3dScene* Clone() const override;
+ virtual E3dScene* Clone(SdrModel* pTargetModel = nullptr) const override;
E3dScene& operator=(const E3dScene&);
virtual SdrObjGeoData *NewGeoData() const override;
diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx
index fec5963d4e7d..b3395386f833 100644
--- a/include/svx/sdr/properties/defaultproperties.hxx
+++ b/include/svx/sdr/properties/defaultproperties.hxx
@@ -54,6 +54,9 @@ namespace sdr
// react on ItemSet changes
virtual void ItemSetChanged(const SfxItemSet& rSet) override;
+ // check if SfxItemSet exists
+ bool HasSfxItemSet() const { return bool(mpItemSet); }
+
public:
// basic constructor
explicit DefaultProperties(SdrObject& rObj);
diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx
index 71dad7f567fb..3bfca7630efe 100644
--- a/include/svx/sdr/properties/properties.hxx
+++ b/include/svx/sdr/properties/properties.hxx
@@ -44,6 +44,32 @@ namespace sdr
}
}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// BaseProperties
+// DefaultProperties ->SfxItemSet
+// AttributeProperties ->SfxStyleSheet
+// E3dProperties
+// E3dCompoundProperties
+// E3dExtrudeProperties
+// E3dLatheProperties
+// E3dSphereProperties
+// E3dSceneProperties
+// TextProperties ->maVersion
+// ConnectorProperties
+// CustomShapeProperties
+// MeasureProperties
+// RectangleProperties
+// CaptionProperties
+// CircleProperties
+// GraphicProperties
+// OleProperties
+// CellProperties
+// TableProperties
+// GroupProperties
+// EmptyProperties
+// PageProperties
+
namespace sdr
{
namespace properties
@@ -141,13 +167,6 @@ namespace sdr
// Get the installed StyleSheet.
virtual SfxStyleSheet* GetStyleSheet() const = 0;
- // Move local items to a new ItemPool.
- // Override this to do it for hierarchical objects like e.g. groups.
- virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel);
-
- // Set new model.
- virtual void SetModel(SdrModel* pOldModel, SdrModel* pNewModel);
-
// force all attributes which come from styles to hard attributes
// to be able to live without the style.
virtual void ForceStyleToHardAttributes();
diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx
index 6a999a78b344..fe03d7353a2b 100644
--- a/include/svx/sdr/table/tablecontroller.hxx
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -29,7 +29,7 @@
#include <svx/svdotable.hxx>
#include <svx/svdview.hxx>
-class SdrObjEditView;
+class SdrView;
class SdrObject;
class SfxItemSet;
class SvxBoxInfoItem;
@@ -39,10 +39,12 @@ namespace sdr { namespace table {
class TableModel;
-class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController
+class SVX_DLLPUBLIC SvxTableController : public sdr::SelectionController
{
public:
- SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrTableObj* pObj );
+ SVX_DLLPRIVATE SvxTableController(
+ SdrView& rView,
+ const SdrTableObj& rObj);
SVX_DLLPRIVATE virtual ~SvxTableController() override;
// from sdr::SelectionController
@@ -76,7 +78,10 @@ public:
SVX_DLLPRIVATE void DistributeRows();
SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
- SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrTableObj* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
+ SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create(
+ SdrView& rView,
+ const SdrTableObj& rObj,
+ const rtl::Reference< sdr::SelectionController >& xRefController);
SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
@@ -93,7 +98,7 @@ public:
SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage ) override;
SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ) override;
- SVX_DLLPRIVATE virtual bool hasSelectedCells() const override { return mbCellSelectionMode || mpView->IsTextEdit(); }
+ SVX_DLLPRIVATE virtual bool hasSelectedCells() const override { return mbCellSelectionMode || mrView.IsTextEdit(); }
/// @see sdr::SelectionController::setCursorLogicPosition().
SVX_DLLPRIVATE virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint) override;
@@ -174,17 +179,16 @@ private:
CellPos maMouseDownPos;
bool mbLeftButtonDown;
sdr::overlay::OverlayObjectList* mpSelectionOverlay;
-
- SdrView* mpView;
+ SdrView& mrView;
tools::WeakReference<SdrTableObj> mxTableObj;
- SdrModel* mpModel;
-
css::uno::Reference< css::util::XModifyListener > mxModifyListener;
-
ImplSVEvent * mnUpdateEvent;
};
-rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrTableObj* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
+rtl::Reference< sdr::SelectionController > CreateTableController(
+ SdrView& rView,
+ const SdrTableObj& rObj,
+ const rtl::Reference< sdr::SelectionController >& xRefController );
} }
diff --git a/include/svx/sphere3d.hxx b/include/svx/sphere3d.hxx
index 9c4bc5d21468..e5534e528fa9 100644
--- a/include/svx/sphere3d.hxx
+++ b/include/svx/sphere3d.hxx
@@ -35,16 +35,19 @@ private:
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
- void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+ void SetDefaultAttributes(const E3dDefaultAttributes& rDefault);
public:
- E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize);
+ E3dSphereObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPoint& rCenter,
+ const basegfx::B3DVector& r3DSize);
// FG: This constructor is only called from MakeObject from the 3d-Objectfactory
// when a document with a sphere is loaded. This constructor does not call
// CreateSphere, or create any spheres.
- enum Dummy { DUMMY };
- E3dSphereObj(Dummy dummy);
+ E3dSphereObj(SdrModel& rSdrModel);
// horizontal segments:
sal_uInt32 GetHorizontalSegments() const
@@ -57,7 +60,10 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
- virtual E3dSphereObj* Clone() const override;
+ virtual E3dSphereObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ E3dSphereObj& operator=(const E3dSphereObj& rObj);
const basegfx::B3DPoint& Center() const { return aCenter; }
const basegfx::B3DVector& Size() const { return aSize; }
diff --git a/include/svx/svdcrtv.hxx b/include/svx/svdcrtv.hxx
index 3b71a5088510..47858b29cf4e 100644
--- a/include/svx/svdcrtv.hxx
+++ b/include/svx/svdcrtv.hxx
@@ -31,7 +31,7 @@ class SdrObjConnection;
class ImplConnectMarkerOverlay;
class ImpSdrCreateViewExtraData;
-class SVX_DLLPUBLIC SdrCreateView: public SdrDragView
+class SVX_DLLPUBLIC SdrCreateView : public SdrDragView
{
friend class SdrPageView;
@@ -69,7 +69,10 @@ protected:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrCreateView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrCreateView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrCreateView() override;
public:
diff --git a/include/svx/svddrgv.hxx b/include/svx/svddrgv.hxx
index 19b56414e9b0..180d8cc09269 100644
--- a/include/svx/svddrgv.hxx
+++ b/include/svx/svddrgv.hxx
@@ -25,7 +25,7 @@
class SdrUndoGeoObj;
-class SVX_DLLPUBLIC SdrDragView: public SdrExchangeView
+class SVX_DLLPUBLIC SdrDragView : public SdrExchangeView
{
friend class SdrPageView;
friend class SdrDragMethod;
@@ -69,7 +69,10 @@ protected:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrDragView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrDragView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrDragView() override;
public:
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index 0c1e2f6a9dc1..51dbb4872e51 100644
--- a/include/svx/svdedtv.hxx
+++ b/include/svx/svdedtv.hxx
@@ -68,7 +68,7 @@ namespace o3tl
template<> struct typed_flags<SdrInsertFlags> : is_typed_flags<SdrInsertFlags, 0x1f> {};
}
-class SVX_DLLPUBLIC SdrEditView: public SdrMarkView
+class SVX_DLLPUBLIC SdrEditView : public SdrMarkView
{
friend class SdrPageView;
friend class SdrDragDistort;
@@ -163,7 +163,10 @@ protected:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrEditView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrEditView() override;
public:
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 324a611d96eb..70472aab20b2 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -58,7 +58,7 @@ enum class SdrEndTextEditKind
// - macromod
-class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView, public EditViewCallbacks
+class SVX_DLLPUBLIC SdrObjEditView : public SdrGlueEditView, public EditViewCallbacks
{
friend class SdrPageView;
friend class ImpSdrEditPara;
@@ -150,7 +150,10 @@ protected:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrObjEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrObjEditView() override;
public:
diff --git a/include/svx/svdglev.hxx b/include/svx/svdglev.hxx
index 10645f0a5aaa..be365e368c7e 100644
--- a/include/svx/svdglev.hxx
+++ b/include/svx/svdglev.hxx
@@ -29,7 +29,7 @@ class SdrGluePoint;
// Edit GluePoints at the objects (GluePoints for connector)
-class SVX_DLLPUBLIC SdrGlueEditView: public SdrPolyEditView
+class SVX_DLLPUBLIC SdrGlueEditView : public SdrPolyEditView
{
// copy marked GluePoints and mark instead of the old ones
void ImpCopyMarkedGluePoints();
@@ -40,7 +40,10 @@ class SVX_DLLPUBLIC SdrGlueEditView: public SdrPolyEditView
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrGlueEditView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrGlueEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrGlueEditView() override;
public:
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 981b1e29e5d1..36e80416087b 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -166,7 +166,10 @@ protected:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrMarkView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrMarkView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrMarkView() override;
public:
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index 85f5e9dc68ca..3ce7833ca8c8 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -98,15 +98,8 @@ public:
css::uno::Reference< css::drawing::XCustomShapeEngine > const & GetCustomShapeEngine() const;
-// SVX_DLLPRIVATE css::uno::Sequence< css::uno::Reference< css::drawing::XCustomShapeHandle > >
-// SdrObjCustomShape::GetInteraction( const SdrObjCustomShape* pCustomShape ) const;
-// #i47293#
-// SVX_DLLPRIVATE std::vector< css::uno::Reference< css::drawing::XCustomShapeHandle > > GetFixedInteractionHandle() const;
-
SVX_DLLPRIVATE std::vector< SdrCustomShapeInteraction > GetInteractionHandles() const;
-
SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag );
-
SVX_DLLPRIVATE void DragResizeCustomShape( const tools::Rectangle& rNewRect );
SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point& rDestination,
const sal_uInt16 nCustomShapeHdlNum, bool bMoveCalloutRectangle );
@@ -147,7 +140,7 @@ public:
double GetObjectRotation() const { return fObjectRotation;}
double GetExtraTextRotation( const bool bPreRotation = false ) const;
- SdrObjCustomShape();
+ SdrObjCustomShape(SdrModel& rSdrModel);
virtual ~SdrObjCustomShape() override;
/* is merging default attributes from type-shape into the SdrCustomShapeGeometryItem. If pType
@@ -172,8 +165,6 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
- virtual void SetModel(SdrModel* pNewModel) override;
-
virtual void Move(const Size& rSiz) override;
virtual void Shear(const Point& rRef, long nAngle, double tn, bool bVShear) override;
virtual void SetSnapRect(const tools::Rectangle& rRect) override;
@@ -216,7 +207,7 @@ public:
virtual void TakeTextAnchorRect( tools::Rectangle& rAnchorRect ) const override;
virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override;
- virtual SdrObjCustomShape* Clone() const override;
+ virtual SdrObjCustomShape* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrObjCustomShape& operator=(const SdrObjCustomShape& rObj);
virtual OUString TakeObjNameSingul() const override;
diff --git a/include/svx/svdoattr.hxx b/include/svx/svdoattr.hxx
index 10c163b3b9b0..a39a91957841 100644
--- a/include/svx/svdoattr.hxx
+++ b/include/svx/svdoattr.hxx
@@ -28,20 +28,14 @@
#include <svx/svdattr.hxx>
#include <svx/svxdllapi.h>
-
// Initial Declarations
-
-
class SfxPoolItem;
class SfxSetItem;
class SdrOutliner;
class SfxItemSet;
class SfxItemPool;
-
// SdrAttrObj
-
-
class SVX_DLLPUBLIC SdrAttrObj : public SdrObject
{
private:
@@ -59,7 +53,7 @@ protected:
/// Detects when a stylesheet is changed
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
- SdrAttrObj();
+ SdrAttrObj(SdrModel& rSdrModel);
virtual ~SdrAttrObj() override;
public:
@@ -71,8 +65,6 @@ public:
bool HasLine() const;
virtual const tools::Rectangle& GetSnapRect() const override;
-
- virtual void SetModel(SdrModel* pNewModel) override;
};
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 3f01cbb82ff6..7d033605933a 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -74,10 +74,11 @@ class SdrLayerIDSet;
class OutputDevice;
class Fraction;
-namespace basegfx {
-class B2DPoint;
-class B2DPolyPolygon;
-class B2DHomMatrix;
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
}
namespace sdr
@@ -103,6 +104,8 @@ namespace svx
class PropertyChangeNotifier;
}
+class SvxShape;
+
enum SdrObjKind {
OBJ_NONE = 0, /// abstract object (SdrObject)
OBJ_GRUP = 1, /// object group
@@ -265,9 +268,45 @@ public:
SdrObjTransformInfoRec();
};
-/// Abstract DrawObject
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrObject
+// SdrAttrObj
+// E3dObject
+// E3dCompoundObject
+// E3dCubeObj
+// E3dExtrudeObj
+// E3dLatheObj
+// E3dPolygonObj
+// E3dSphereObj
+// E3dScene
+// SdrTextObj
+// SdrObjCustomShape
+// OCustomShape
+// SdrEdgeObj
+// SdrMeasureObj
+// SdrPathObj
+// SdrRectObj
+// SdrCaptionObj
+// SdrCircObj
+// SdrGrafObj
+// SdrMediaObj
+// SdrOle2Obj
+// OOle2Obj
+// SdrUnoObj
+// DlgEdObj
+// DlgEdForm
+// OUnoObject
+// FmFormObj
+// SdrTableObj
+// SdrObjGroup
+// SdrPageObj
+// SdrVirtObj
+// SwDrawVirtObj
+// SwVirtFlyDrawObj
+// SwFlyDrawObj
-class SvxShape;
+/// Abstract DrawObject
class SVX_DLLPUBLIC SdrObject: public SfxListener, public virtual tools::WeakBase
{
private:
@@ -296,8 +335,16 @@ private:
public:
const SdrObject* getFillGeometryDefiningShape() const { return mpFillGeometryDefiningShape; }
+private:
+ // the SdrModel this objects was created with, unchanged during SdrObject lifetime
+ SdrModel& mrSdrModelFromSdrObject;
+
public:
- SdrObject();
+ // A SdrObject always needs a SdrModel for lifetime (Pool, ...)
+ SdrObject(SdrModel& rSdrModel);
+
+ // SdrModel access on SdrObject level
+ SdrModel& getSdrModelFromSdrObject() const { return mrSdrModelFromSdrObject; }
void AddObjectUser(sdr::ObjectUser& rNewUser);
void RemoveObjectUser(sdr::ObjectUser& rOldUser);
@@ -341,9 +388,6 @@ public:
virtual void SetPage(SdrPage* pNewPage);
SdrPage* GetPage() const { return pPage;}
-
- virtual void SetModel(SdrModel* pNewModel);
- SdrModel* GetModel() const { return pModel;}
SfxItemPool & GetObjectItemPool() const;
void AddListener(SfxListener& rListener);
@@ -438,7 +482,7 @@ public:
// Returns a copy of the object. Every inherited class must reimplement this (in class Foo
// it should be sufficient to do "virtual Foo* Clone() const { return CloneHelper< Foo >(); }".
// Note that this function uses operator= internally.
- virtual SdrObject* Clone() const;
+ virtual SdrObject* Clone(SdrModel* pTargetModel = nullptr) const;
// implemented mainly for the purposes of Clone()
SdrObject& operator=(const SdrObject& rObj);
@@ -724,7 +768,9 @@ public:
// when there is no filled new polygon created from line-to-polygon conversion,
// specially used for XLINE_DASH and 3D conversion
SdrObject* ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
- static SdrObject* ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDash);
+private:
+ SdrObject* ImpConvertToContourObj(bool bForceLineDash);
+public:
// if true, reference onto an object
bool IsVirtualObj() const { return bVirtObj;}
@@ -762,9 +808,6 @@ public:
// removes the record from the list and performs delete (FreeMem+Dtor).
void DeleteUserData(sal_uInt16 nNum);
- // switch ItemPool for this object
- void MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel);
-
// access to the UNO representation of the shape
virtual css::uno::Reference< css::uno::XInterface > getUnoShape();
@@ -867,7 +910,6 @@ protected:
tools::Rectangle aOutRect; // surrounding rectangle for Paint (incl. LineWdt, ...)
Point aAnchor; // anchor position (Writer)
SdrPage* pPage;
- SdrModel* pModel;
SdrObjUserCall* pUserCall;
std::unique_ptr<SdrObjPlusData>
pPlusData; // Broadcaster, UserData, connectors, ... (this is the Bitsack)
@@ -909,7 +951,6 @@ protected:
void ImpForcePlusData();
- OUString GetAngleStr(long nAngle) const;
OUString GetMetrStr(long nVal) const;
/// A derived class must override these 3 methods if it has own geometric
@@ -945,7 +986,7 @@ protected:
virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& _rxUnoShape );
// helper function for reimplementing Clone().
- template< typename T > T* CloneHelper() const;
+ template< typename T > T* CloneHelper(SdrModel* pTargetModel) const;
private:
struct Impl;
@@ -1006,6 +1047,7 @@ struct SdrObjCreatorParams
{
SdrInventor nInventor;
sal_uInt16 nObjIdentifier;
+ SdrModel& rSdrModel;
};
/**
@@ -1019,23 +1061,40 @@ struct SdrObjCreatorParams
class SVX_DLLPUBLIC SdrObjFactory
{
public:
- static SdrObject* MakeNewObject(SdrInventor nInventor, sal_uInt16 nObjIdentifier, SdrPage* pPage, SdrModel* pModel=nullptr);
- static SdrObject* MakeNewObject(SdrInventor nInventor, sal_uInt16 nObjIdentifier, const tools::Rectangle& rSnapRect, SdrPage* pPage);
+ static SdrObject* MakeNewObject(
+ SdrModel& rSdrModel,
+ SdrInventor nInventor,
+ sal_uInt16 nObjIdentifier,
+ SdrPage* pPage = nullptr,
+ const tools::Rectangle* pSnapRect = nullptr);
+
static void InsertMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink);
static void RemoveMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink);
private:
- static SVX_DLLPRIVATE SdrObject* CreateObjectFromFactory( SdrInventor nInventor, sal_uInt16 nIdentifier );
+ static SVX_DLLPRIVATE SdrObject* CreateObjectFromFactory(
+ SdrModel& rSdrModel,
+ SdrInventor nInventor,
+ sal_uInt16 nIdentifier);
SdrObjFactory() = delete;
};
-template< typename T > T* SdrObject::CloneHelper() const
+template< typename T > T* SdrObject::CloneHelper(SdrModel* pTargetModel) const
{
OSL_ASSERT( typeid( T ) == typeid( *this ));
- T* pObj = dynamic_cast< T* >( SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),nullptr));
- if (pObj!=nullptr)
- *pObj=*static_cast< const T* >( this );
+ T* pObj = dynamic_cast< T* >(
+ SdrObjFactory::MakeNewObject(
+ nullptr == pTargetModel ? getSdrModelFromSdrObject() : *pTargetModel,
+ GetObjInventor(),
+ GetObjIdentifier()));
+
+ if(nullptr != pObj)
+ {
+ // use ::operator=()
+ *pObj = *static_cast< const T* >( this );
+ }
+
return pObj;
}
diff --git a/include/svx/svdocapt.hxx b/include/svx/svdocapt.hxx
index 3dd68293708a..baa0e0390bd6 100644
--- a/include/svx/svdocapt.hxx
+++ b/include/svx/svdocapt.hxx
@@ -25,28 +25,20 @@
// Forward Declarations
-
-
class ImpCaptParams;
namespace sdr { namespace properties {
class CaptionProperties;
}}
-
// Helper Class SdrCaptObjGeoData
-
-
class SdrCaptObjGeoData : public SdrTextObjGeoData
{
public:
tools::Polygon aTailPoly;
};
-
// SdrCaptionObj
-
-
class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj
{
private:
@@ -73,13 +65,20 @@ private:
SVX_DLLPRIVATE void ImpRecalcTail();
public:
- SdrCaptionObj();
- SdrCaptionObj(const tools::Rectangle& rRect, const Point& rTail);
+ SdrCaptionObj(SdrModel& rSdrModel);
+ SdrCaptionObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect,
+ const Point& rTail);
+
virtual ~SdrCaptionObj() override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual sal_uInt16 GetObjIdentifier() const override;
- virtual SdrCaptionObj* Clone() const override;
+ virtual SdrCaptionObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ SdrCaptionObj& operator=(const SdrCaptionObj& rObj);
// for calc: special shadow only for text box
void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = true; }
@@ -92,7 +91,6 @@ public:
virtual OUString TakeObjNamePlural() const override;
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
- virtual void SetModel(SdrModel* pNewModel) override;
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
virtual sal_uInt32 GetHdlCount() const override;
diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx
index d3bc9c2116f5..fc3045585aa6 100644
--- a/include/svx/svdocirc.hxx
+++ b/include/svx/svdocirc.hxx
@@ -66,14 +66,25 @@ private:
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
public:
- SdrCircObj(SdrObjKind eNewKind); // Circ, CArc, Sect or CCut
- SdrCircObj(SdrObjKind eNewKind, const tools::Rectangle& rRect);
+ SdrCircObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewKind); // Circ, CArc, Sect or CCut
+ SdrCircObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewKind,
+ const tools::Rectangle& rRect);
// 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
// The circle is build up from StartAngle to EndWink anti-clockwise.
// If nNewStartAngle==nNewEndWink, then arc has an angle of 0 degrees.
// If nNewStartAngle+36000==nNewEndWink, then the arc has angle of 360 degrees.
- SdrCircObj(SdrObjKind eNewKind, const tools::Rectangle& rRect, long nNewStartAngle, long nNewEndWink);
+ SdrCircObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewKind,
+ const tools::Rectangle& rRect,
+ long nNewStartAngle,
+ long nNewEndWink);
+
virtual ~SdrCircObj() override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
@@ -83,7 +94,11 @@ public:
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
- virtual SdrCircObj* Clone() const override;
+ virtual SdrCircObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ SdrCircObj& operator=(const SdrCircObj& rObj);
+
virtual void RecalcSnapRect() override;
virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index 5b11da0feaef..ae28ad7103be 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -187,8 +187,7 @@ protected:
void ImpSetEdgeInfoToAttr(); // copying values from the aEdgeInfo to the pool
public:
-
- SdrEdgeObj();
+ SdrEdgeObj(SdrModel& rSdrModel);
virtual ~SdrEdgeObj() override;
SdrObjConnection& GetConnection(bool bTail1) { return *(bTail1 ? &aCon1 : &aCon2); }
@@ -214,7 +213,7 @@ public:
virtual void RecalcSnapRect() override;
virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
- virtual SdrEdgeObj* Clone() const override;
+ virtual SdrEdgeObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrEdgeObj& operator=(const SdrEdgeObj& rObj);
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 65b934847489..d11a289060f8 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -129,10 +129,16 @@ private:
public:
- SdrGrafObj();
- SdrGrafObj(const Graphic& rGrf);
- SdrGrafObj(const Graphic& rGrf, const tools::Rectangle& rRect);
- virtual ~SdrGrafObj() override;
+ SdrGrafObj(SdrModel& rSdrModel);
+ SdrGrafObj(
+ SdrModel& rSdrModel,
+ const Graphic& rGrf);
+ SdrGrafObj(
+ SdrModel& rSdrModel,
+ const Graphic& rGrf,
+ const tools::Rectangle& rRect);
+
+ virtual ~SdrGrafObj() override;
void SetGraphicObject( const GraphicObject& rGrfObj );
const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
@@ -143,9 +149,7 @@ public:
const Graphic& GetGraphic() const;
Graphic GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
-
GraphicType GetGraphicType() const;
-
GraphicAttr GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
// Keep ATM for SD.
@@ -182,7 +186,7 @@ public:
// #i25616#
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
- virtual SdrGrafObj* Clone() const override;
+ virtual SdrGrafObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrGrafObj& operator=(const SdrGrafObj& rObj);
virtual sal_uInt32 GetHdlCount() const override;
@@ -197,7 +201,6 @@ public:
bool HasGDIMetaFile() const;
virtual void SetPage(SdrPage* pNewPage) override;
- virtual void SetModel(SdrModel* pNewModel) override;
bool isEmbeddedVectorGraphicData() const;
GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx
index f15a9b92fb47..7f0fb234f972 100644
--- a/include/svx/svdogrp.hxx
+++ b/include/svx/svdogrp.hxx
@@ -23,30 +23,23 @@
#include <memory>
#include <svx/svdobj.hxx>
#include <svx/svxdllapi.h>
-
+#include <svx/svdpage.hxx>
// Forward declarations
-
-
-class SdrObjList;
-class SdrObjListIter;
class SfxItemSet;
-
// SdrObjGroup
-
-
class SVX_DLLPUBLIC SdrObjGroup final : public SdrObject
{
private:
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
- std::unique_ptr<SdrObjList> pSub; // sub list (children)
- Point aRefPoint; // Reference point inside the object group
+ SdrObjList maSdrObjList; // sub list (children)
+ Point aRefPoint; // Reference point inside the object group
public:
- SdrObjGroup();
+ SdrObjGroup(SdrModel& rSdrModel);
virtual ~SdrObjGroup() override;
virtual void SetBoundRectDirty() override;
@@ -56,13 +49,12 @@ public:
virtual void NbcSetLayer(SdrLayerID nLayer) override;
virtual void SetObjList(SdrObjList* pNewObjList) override;
virtual void SetPage(SdrPage* pNewPage) override;
- virtual void SetModel(SdrModel* pNewModel) override;
virtual SdrObjList* GetSubList() const override;
virtual const tools::Rectangle& GetCurrentBoundRect() const override;
virtual const tools::Rectangle& GetSnapRect() const override;
- virtual SdrObjGroup* Clone() const override;
+ virtual SdrObjGroup* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrObjGroup& operator=(const SdrObjGroup& rObj);
virtual OUString TakeObjNameSingul() const override;
diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx
index be2ce849890b..00a4a9567546 100644
--- a/include/svx/svdomeas.hxx
+++ b/include/svx/svdomeas.hxx
@@ -85,14 +85,20 @@ protected:
virtual void RestGeoData(const SdrObjGeoData& rGeo) override;
public:
- SdrMeasureObj();
- SdrMeasureObj(const Point& rPt1, const Point& rPt2);
+ SdrMeasureObj(SdrModel& rSdrModel);
+ SdrMeasureObj(
+ SdrModel& rSdrModel,
+ const Point& rPt1,
+ const Point& rPt2);
virtual ~SdrMeasureObj() override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual sal_uInt16 GetObjIdentifier() const override;
virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
- virtual SdrMeasureObj* Clone() const override;
+ virtual SdrMeasureObj* Clone(SdrModel* pTargetModel = nullptr) const override;
+
+ // implemented mainly for the purposes of Clone()
+ SdrMeasureObj& operator=(const SdrMeasureObj& rObj);
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx
index 43356da4e302..a45410f76bdf 100644
--- a/include/svx/svdomedia.hxx
+++ b/include/svx/svdomedia.hxx
@@ -37,10 +37,12 @@ class SVX_DLLPUBLIC SdrMediaObj final : public SdrRectObj
public:
- SdrMediaObj();
- SdrMediaObj( const tools::Rectangle& rRect );
+ SdrMediaObj(SdrModel& rSdrModel);
+ SdrMediaObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect);
- virtual ~SdrMediaObj() override;
+ virtual ~SdrMediaObj() override;
virtual bool HasTextEdit() const override;
@@ -50,7 +52,7 @@ public:
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
- virtual SdrMediaObj* Clone() const override;
+ virtual SdrMediaObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrMediaObj& operator=(const SdrMediaObj& rObj);
virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index edeccfa5984a..b170f6ac6d03 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -60,6 +60,8 @@ private:
SVX_DLLPRIVATE SdrObject* createSdrGrafObjReplacement(bool bAddText) const;
SVX_DLLPRIVATE void ImpSetVisAreaSize();
+ SVX_DLLPRIVATE void Init();
+
protected:
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
@@ -67,8 +69,15 @@ protected:
public:
OUString GetStyleString();
- SdrOle2Obj( bool bFrame_ = false );
- SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const OUString& rNewObjName, const tools::Rectangle& rNewRect );
+ SdrOle2Obj(
+ SdrModel& rSdrModel,
+ bool bFrame_ = false);
+ SdrOle2Obj(
+ SdrModel& rSdrModel,
+ const svt::EmbeddedObjectRef& rNewObjRef,
+ const OUString& rNewObjName,
+ const tools::Rectangle& rNewRect);
+
virtual ~SdrOle2Obj() override;
const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const;
@@ -112,7 +121,6 @@ public:
void AbandonObject();
virtual void SetPage(SdrPage* pNewPage) override;
- virtual void SetModel(SdrModel* pModel) override;
/** Change the IsClosedObj attribute
@@ -129,7 +137,7 @@ public:
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
- virtual SdrOle2Obj* Clone() const override;
+ virtual SdrOle2Obj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrOle2Obj& assignFrom(const SdrOle2Obj& rObj);
SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
diff --git a/include/svx/svdopage.hxx b/include/svx/svdopage.hxx
index 8893e812d783..1f349a9a38ad 100644
--- a/include/svx/svdopage.hxx
+++ b/include/svx/svdopage.hxx
@@ -41,8 +41,14 @@ protected:
virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
public:
- SdrPageObj(SdrPage* pNewPage = nullptr);
- SdrPageObj(const tools::Rectangle& rRect, SdrPage* pNewPage = nullptr);
+ SdrPageObj(
+ SdrModel& rSdrModel,
+ SdrPage* pNewPage = nullptr);
+ SdrPageObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect,
+ SdrPage* pNewPage = nullptr);
+
virtual ~SdrPageObj() override;
SdrPage* GetReferencedPage() const { return mpShownPage;}
@@ -53,7 +59,7 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
- virtual SdrPageObj* Clone() const override;
+ virtual SdrPageObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrPageObj& operator=(const SdrPageObj& rObj);
virtual OUString TakeObjNameSingul() const override;
diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx
index e32ccf5116df..6c21fd06571a 100644
--- a/include/svx/svdopath.hxx
+++ b/include/svx/svdopath.hxx
@@ -62,14 +62,20 @@ private:
ImpPathForDragAndCreate& impGetDAC() const;
public:
- SdrPathObj(SdrObjKind eNewKind);
- SdrPathObj(SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly);
+ SdrPathObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewKind);
+ SdrPathObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewKind,
+ const basegfx::B2DPolyPolygon& rPathPoly);
+
virtual ~SdrPathObj() override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual sal_uInt16 GetObjIdentifier() const override;
virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
- virtual SdrPathObj* Clone() const override;
+ virtual SdrPathObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrPathObj& operator=(const SdrPathObj& rObj);
virtual OUString TakeObjNameSingul() const override;
diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx
index 729d3f221a05..f9c1c34fd145 100644
--- a/include/svx/svdorect.hxx
+++ b/include/svx/svdorect.hxx
@@ -66,14 +66,22 @@ public:
*
* Constructor of a rectangular drawing object
*/
- SdrRectObj();
- SdrRectObj(const tools::Rectangle& rRect);
+ SdrRectObj(SdrModel& rSdrModel);
+ SdrRectObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rRect);
SdrRectObj& operator=(const SdrRectObj& rCopy);
// Constructor of a text frame
- SdrRectObj(SdrObjKind eNewTextKind);
- SdrRectObj(SdrObjKind eNewTextKind, const tools::Rectangle& rRect);
+ SdrRectObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind);
+ SdrRectObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind,
+ const tools::Rectangle& rRect);
+
virtual ~SdrRectObj() override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
@@ -83,7 +91,7 @@ public:
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
- virtual SdrRectObj* Clone() const override;
+ virtual SdrRectObj* Clone(SdrModel* pTargetModel = nullptr) const override;
virtual void RecalcSnapRect() override;
virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index c33551cccac7..7c5e30ec4e8d 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -98,13 +98,20 @@ class SVX_DLLPUBLIC SdrTableObj : public ::SdrTextObj
friend class SdrTableObjImpl;
public:
- SdrTableObj(SdrModel* _pModel);
- SdrTableObj(SdrModel* _pModel, const ::tools::Rectangle& rNewRect, sal_Int32 nColumns, sal_Int32 nRows);
- virtual ~SdrTableObj() override;
+ SdrTableObj(SdrModel& rSdrModel);
+ SdrTableObj(
+ SdrModel& rSdrModel,
+ const ::tools::Rectangle& rNewRect,
+ sal_Int32 nColumns,
+ sal_Int32 nRows);
+ virtual ~SdrTableObj() override;
// Table stuff
- SdrTableObj* CloneRange( const CellPos& rStartPos, const CellPos& rEndPos );
+ SdrTableObj* CloneRange(
+ const CellPos& rStartPos,
+ const CellPos& rEndPos,
+ SdrModel& rTargetModel);
void DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn );
void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow );
@@ -184,7 +191,6 @@ public:
virtual bool IsFontwork() const override;
- virtual void SetModel(SdrModel* pNewModel) override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual sal_uInt16 GetObjIdentifier() const override;
virtual void SetChanged() override;
@@ -193,7 +199,7 @@ public:
virtual bool AdjustTextFrameWidthAndHeight() override;
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
- virtual SdrTableObj* Clone() const override;
+ virtual SdrTableObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrTableObj& operator=(const SdrTableObj& rObj);
virtual void RecalcSnapRect() override;
virtual const tools::Rectangle& GetSnapRect() const override;
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 277f51ebba2c..13ff8940d0c1 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -136,16 +136,13 @@ class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider
{
private:
// Cell needs access to ImpGetDrawOutliner();
-
friend class sdr::table::Cell;
friend class sdr::table::SdrTableRtfExporter;
friend class sdr::table::SdrTableRTFParser;
-
friend class TextChain;
friend class TextChainFlow;
friend class EditingTextChainFlow;
-
// CustomShapeproperties need to access the "bTextFrame" member:
friend class sdr::properties::CustomShapeProperties;
@@ -272,7 +269,6 @@ private:
SVX_DLLPRIVATE void ImpRegisterLink();
SVX_DLLPRIVATE void ImpDeregisterLink();
SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const;
-// void ImpCheckItemSetChanges(const SfxItemSet& rAttr);
/** Appends the style family to a provided style name */
static void AppendFamilyToStyleName(OUString& styleName, SfxStyleFamily family);
@@ -306,12 +302,19 @@ protected:
virtual void AdaptTextMinSize();
// constructors for labeled graphical objects
- SdrTextObj();
- SdrTextObj(const tools::Rectangle& rNewRect);
+ SdrTextObj(SdrModel& rSdrModel);
+ SdrTextObj(
+ SdrModel& rSdrModel,
+ const tools::Rectangle& rNewRect);
// constructors for text frames
- SdrTextObj(SdrObjKind eNewTextKind);
- SdrTextObj(SdrObjKind eNewTextKind, const tools::Rectangle& rNewRect);
+ SdrTextObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind);
+ SdrTextObj(
+ SdrModel& rSdrModel,
+ SdrObjKind eNewTextKind,
+ const tools::Rectangle& rNewRect);
virtual ~SdrTextObj() override;
@@ -434,7 +437,6 @@ public:
SdrTextAniDirection GetTextAniDirection() const;
virtual void SetPage(SdrPage* pNewPage) override;
- virtual void SetModel(SdrModel* pNewModel) override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual sal_uInt16 GetObjIdentifier() const override;
@@ -442,7 +444,7 @@ public:
virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const;
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
- virtual SdrTextObj* Clone() const override;
+ virtual SdrTextObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrTextObj& operator=(const SdrTextObj& rObj);
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
virtual basegfx::B2DPolyPolygon TakeContour() const override;
diff --git a/include/svx/svdouno.hxx b/include/svx/svdouno.hxx
index 48098ae65b37..d9dfb5d6acd2 100644
--- a/include/svx/svdouno.hxx
+++ b/include/svx/svdouno.hxx
@@ -61,15 +61,19 @@ private:
public:
- explicit SdrUnoObj(const OUString& rModelName);
- SdrUnoObj(const OUString& rModelName,
+ explicit SdrUnoObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName);
+ SdrUnoObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName,
const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac);
virtual ~SdrUnoObj() override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual sal_uInt16 GetObjIdentifier() const override;
- virtual SdrUnoObj* Clone() const override;
+ virtual SdrUnoObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrUnoObj& operator= (const SdrUnoObj& rObj);
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
virtual void NbcSetLayer(SdrLayerID nLayer) override;
@@ -77,10 +81,6 @@ public:
// SpecialDrag support
virtual bool hasSpecialDrag() const override;
- // FullDrag support
- virtual bool supportsFullDrag() const override;
- virtual SdrObject* getFullDragClone() const override;
-
virtual OUString TakeObjNameSingul() const override;
virtual OUString TakeObjNamePlural() const override;
diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx
index c6d626e1305f..9e4e6d9ed179 100644
--- a/include/svx/svdovirt.hxx
+++ b/include/svx/svdovirt.hxx
@@ -37,7 +37,7 @@ protected:
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
SdrObject& rRefObj; // Referenced drawing object
- tools::Rectangle aSnapRect;
+ tools::Rectangle aSnapRect;
protected:
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
@@ -47,12 +47,14 @@ protected:
virtual void RestGeoData(const SdrObjGeoData& rGeo) override;
public:
- SdrVirtObj(SdrObject& rNewObj);
+ SdrVirtObj(
+ SdrModel& rSdrModel,
+ SdrObject& rNewObj);
virtual ~SdrVirtObj() override;
+
SdrObject& ReferencedObj();
const SdrObject& GetReferencedObj() const;
virtual void NbcSetAnchorPos(const Point& rAnchorPos) override;
- virtual void SetModel(SdrModel* pNewModel) override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual SdrInventor GetObjInventor() const override;
@@ -62,7 +64,7 @@ public:
virtual const tools::Rectangle& GetCurrentBoundRect() const override;
virtual const tools::Rectangle& GetLastBoundRect() const override;
virtual void RecalcBoundRect() override;
- virtual SdrVirtObj* Clone() const override;
+ virtual SdrVirtObj* Clone(SdrModel* pTargetModel = nullptr) const override;
SdrVirtObj& operator=(const SdrVirtObj& rObj);
virtual OUString TakeObjNameSingul() const override;
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 1a7fdb59a7fa..1ea8f1f57358 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -53,21 +53,26 @@ class Color;
class SfxStyleSheet;
class SvxUnoDrawPagesAccess;
-// class SdrObjList
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrObjList
+// E3dObjList
+// SdrPage -> see continuation there
+// class SdrObjList
class SVX_DLLPUBLIC SdrObjList
{
+private:
SdrObjList(const SdrObjList& rSrcList) = delete;
SdrObjList &operator=(const SdrObjList& rSrcList) = delete;
private:
- ::std::vector<SdrObject*> maList;
+ ::std::vector<SdrObject*> maList;
protected:
friend class SdrObjListIter;
friend class SdrEditView;
SdrObjList* pUpList; /// parent list
- SdrModel* pModel; /// model to which the list belongs (Layer,ItemPool,Storage)
SdrPage* pPage; /// Page containing the list, may be "this".
SdrObject* pOwnerObj; /// OwnerObject, if it's list of a Group object.
tools::Rectangle aOutRect;
@@ -75,20 +80,20 @@ friend class SdrEditView;
SdrObjListKind eListKind;
bool bObjOrdNumsDirty;
bool bRectsDirty;
+
protected:
void RecalcRects();
-
- SdrObjList();
- void lateInit(const SdrObjList& rSrcList);
+ void lateInitSdrObjList(const SdrObjList& rSrcList, SdrModel* pNewModel = nullptr);
private:
/// simple ActionChildInserted forwarder to have it on a central place
static void impChildInserted(SdrObject const & rChild);
public:
- SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage);
+ SdrObjList(SdrPage* pNewPage = nullptr);
virtual ~SdrObjList();
+ virtual SdrObjList* CloneSdrObjList(SdrModel* pNewModel = nullptr) const;
- void CopyObjects(const SdrObjList& rSrcList);
+ void CopyObjects(const SdrObjList& rSrcList, SdrModel* pNewModel = nullptr);
/// clean up everything (without Undo)
void Clear();
SdrObjListKind GetListKind() const { return eListKind; }
@@ -99,8 +104,7 @@ public:
void SetOwnerObj(SdrObject* pNewOwner) { pOwnerObj=pNewOwner; }
SdrPage* GetPage() const;
void SetPage(SdrPage* pNewPage);
- SdrModel* GetModel() const;
- virtual void SetModel(SdrModel* pNewModel);
+
/// recalculate order numbers / ZIndex
void RecalcObjOrdNums();
bool IsObjOrdNumsDirty() const { return bObjOrdNumsDirty; }
@@ -348,6 +352,17 @@ public:
Also it's possible to request and directly set the order number (ZOrder)
of SdrObjects.
*/
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrPage
+// DlgEdPage
+// FmFormPage
+// ScDrawPage
+// SdPage
+// SwDPage
+// OReportPage
+
class SVX_DLLPUBLIC SdrPage : public SdrObjList, public virtual tools::WeakBase
{
// #i9076#
@@ -358,7 +373,8 @@ class SVX_DLLPUBLIC SdrPage : public SdrObjList, public virtual tools::WeakBase
// and thus has to set mxUnoPage (it also relies on mxUnoPage not being WeakRef)
friend class reportdesign::OSection;
- SdrPage& operator=(const SdrPage& rSrcPage) = delete;
+ SdrPage& operator=(const SdrPage&) = delete;
+ SdrPage(const SdrPage&) = delete;
// start PageUser section
private:
@@ -371,6 +387,9 @@ public:
void AddPageUser(sdr::PageUser& rNewUser);
void RemovePageUser(sdr::PageUser& rOldUser);
+ // SdrModel access on SdrPage level
+ SdrModel& getSdrModelFromSdrPage() const { return mrSdrModelFromSdrPage; }
+
protected:
sdr::contact::ViewContact* CreateObjectSpecificViewContact();
public:
@@ -381,6 +400,10 @@ public:
void ActionChanged();
private:
+ // the SdrModel this page was created with, unchanged during SdrPage lifetime
+ SdrModel& mrSdrModelFromSdrPage;
+
+private:
sal_Int32 mnWidth; // Seitengroesse
sal_Int32 mnHeight; // Seitengroesse
sal_Int32 mnBorderLeft; // Seitenrand links
@@ -420,14 +443,13 @@ protected:
// to call lateInit() after copy-construction of a new object. Any initialization in derived
// classes that needs access to the page objects must be deferred to lateInit. And it must
// call lateInit() of its parent class.
- SdrPage(const SdrPage& rSrcPage);
- void lateInit(const SdrPage& rSrcPage, SdrModel* pNewModel = nullptr);
+ void lateInit(const SdrPage& rSrcPage);
public:
- explicit SdrPage(SdrModel& rNewModel, bool bMasterPage=false);
+ explicit SdrPage(SdrModel& rModel, bool bMasterPage=false);
virtual ~SdrPage() override;
- virtual SdrPage* Clone() const;
- virtual SdrPage* Clone(SdrModel* pNewModel) const;
+
+ virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const;
bool IsMasterPage() const { return mbMaster; }
void SetInserted(bool bNew = true);
bool IsInserted() const { return mbInserted; }
@@ -458,8 +480,6 @@ public:
sal_Int32 GetRightBorder() const;
sal_Int32 GetLowerBorder() const;
- virtual void SetModel(SdrModel* pNewModel) override;
-
// New MasterPage interface
bool TRG_HasMasterPage() const { return (nullptr != mpMasterPageDescriptor); }
void TRG_SetMasterPage(SdrPage& rNew);
@@ -505,9 +525,6 @@ public:
const sdr::contact::ViewObjectContact& rOriginal,
const sdr::contact::DisplayInfo& rDisplayInfo,
bool bEdit );
-
-private:
- void impl_setModelForLayerAdmin(SdrModel* pNewModel);
};
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx
index eb48416af426..2405ad9ca4b5 100644
--- a/include/svx/svdpntv.hxx
+++ b/include/svx/svdpntv.hxx
@@ -100,12 +100,39 @@ BitmapEx SVX_DLLPUBLIC convertMetafileToBitmapEx(
const basegfx::B2DRange& rTargetRange,
const sal_uInt32 nMaximumQuadraticPixels);
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrPaintView
+// SdrSnapView
+// SdrMarkView
+// SdrEditView
+// SdrPolyEditView
+// SdrGlueEditView
+// SdrObjEditView
+// SdrExchangeView
+// SdrDragView
+// SdrCreateView
+// SdrView
+// DlgEdView
+// GraphCtrlView
+// E3dView
+// DrawViewWrapper
+// FmFormView
+// ScDrawView
+// sd::View (may have more?)
+// sd::DrawView
+// SwDrawView
+// OSectionView
class SVX_DLLPUBLIC SdrPaintView : public SfxListener, public SfxRepeatTarget, public SfxBroadcaster, public ::utl::ConfigurationListener
{
+private:
friend class SdrPageView;
friend class SdrGrafObj;
+ // the SdrModel this view was created with, unchanged during lifetime
+ SdrModel& mrSdrModelFromSdrView;
+
SdrPageView* mpPageView;
protected:
SdrModel* mpModel;
@@ -238,10 +265,13 @@ protected:
virtual void ModelHasChanged();
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrPaintView(SdrModel* pModel1, OutputDevice* pOut);
+ // A SdrView always needs a SdrModel for lifetime (Pool, ...)
+ SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut);
virtual ~SdrPaintView() override;
public:
+ // SdrModel access on SdrView level
+ SdrModel& getSdrModelFromSdrView() const { return mrSdrModelFromSdrView; }
virtual void ClearPageView();
SdrModel* GetModel() const { return mpModel; }
diff --git a/include/svx/svdpoev.hxx b/include/svx/svdpoev.hxx
index c7a33bac1683..187eadd4ca12 100644
--- a/include/svx/svdpoev.hxx
+++ b/include/svx/svdpoev.hxx
@@ -25,7 +25,7 @@
#include <svx/ipolypolygoneditorcontroller.hxx>
-class SVX_DLLPUBLIC SdrPolyEditView: public SdrEditView, public IPolyPolygonEditorController
+class SVX_DLLPUBLIC SdrPolyEditView : public SdrEditView, public IPolyPolygonEditorController
{
friend class SdrEditView;
@@ -45,7 +45,10 @@ private:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrPolyEditView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrPolyEditView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrPolyEditView() override;
public:
diff --git a/include/svx/svdsnpv.hxx b/include/svx/svdsnpv.hxx
index a90bdf34d392..0a40c9ac59ac 100644
--- a/include/svx/svdsnpv.hxx
+++ b/include/svx/svdsnpv.hxx
@@ -90,7 +90,7 @@ enum class SdrCrookMode {
// #114409#-1 Migrate PageOrigin
class ImplPageOriginOverlay;
-class SVX_DLLPUBLIC SdrSnapView: public SdrPaintView
+class SVX_DLLPUBLIC SdrSnapView : public SdrPaintView
{
protected:
// #114409#-1 Migrate PageOrigin
@@ -127,7 +127,10 @@ protected:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrSnapView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrSnapView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~SdrSnapView() override;
public:
diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx
index 020d8a483b4b..11b91f028fb8 100644
--- a/include/svx/svdtext.hxx
+++ b/include/svx/svdtext.hxx
@@ -47,7 +47,6 @@ public:
explicit SdrText( SdrTextObj& rObject );
virtual ~SdrText() override;
- virtual void SetModel(SdrModel* pNewModel);
void ForceOutlinerParaObject( OutlinerMode nOutlMode );
virtual void SetOutlinerParaObject( OutlinerParaObject* pTextObject );
@@ -60,7 +59,8 @@ public:
// return a text-specific ItemSet
virtual const SfxItemSet& GetItemSet() const;
- SdrModel* GetModel() const { return mpModel; }
+ // This class does not need an own SdrModel reference - always
+ // has the SdrTextObj working with so can use SdrModel::getSdrModelFromSdrObject()
SdrTextObj& GetObject() const { return mrObject; }
/** returns the current OutlinerParaObject and removes it from this instance */
@@ -76,7 +76,6 @@ protected:
private:
std::unique_ptr<OutlinerParaObject> mpOutlinerParaObject;
SdrTextObj& mrObject;
- SdrModel* mpModel;
bool mbPortionInfoChecked;
};
diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx
index e9d0f51aa476..2bab7eaed548 100644
--- a/include/svx/svdview.hxx
+++ b/include/svx/svdview.hxx
@@ -144,7 +144,7 @@ public:
};
-class SVX_DLLPUBLIC SdrView: public SdrCreateView, public virtual tools::WeakBase
+class SVX_DLLPUBLIC SdrView : public SdrCreateView, public virtual tools::WeakBase
{
friend class SdrPageView;
@@ -156,7 +156,10 @@ protected:
SvtAccessibilityOptions maAccessibilityOptions;
public:
- explicit SdrView(SdrModel* pModel1, OutputDevice* pOut = nullptr);
+ explicit SdrView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut = nullptr);
+
virtual ~SdrView() override;
// The default value for all dispatchers is activated. If the app for example
diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx
index 8c4deca123b9..52dc63b1a282 100644
--- a/include/svx/svdxcgv.hxx
+++ b/include/svx/svdxcgv.hxx
@@ -25,7 +25,7 @@
#include <vcl/gdimtf.hxx>
#include <svx/svxdllapi.h>
-class SVX_DLLPUBLIC SdrExchangeView: public SdrObjEditView
+class SVX_DLLPUBLIC SdrExchangeView : public SdrObjEditView
{
friend class SdrPageView;
@@ -40,7 +40,9 @@ protected:
protected:
// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
- SdrExchangeView(SdrModel* pModel1, OutputDevice* pOut);
+ SdrExchangeView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
public:
// Output all marked objects on the specified OutputDevice
@@ -72,20 +74,16 @@ public:
Graphic GetAllMarkedGraphic() const;
- /** Generate a Graphic for the given draw object in the given model
+ /** Generate a Graphic for the given draw object
- @param pModel
- Must not be NULL. Denotes the draw model the object is a part
- of.
-
- @param pObj
+ @param rSdrObject
The object (can also be a group object) to retrieve a Graphic
- for. Must not be NULL.
+ for.
@return a graphical representation of the given object, as it
appears on screen (e.g. with rotation, if any, applied).
*/
- static Graphic GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj );
+ static Graphic GetObjGraphic(const SdrObject& rSdrObject);
// The new Draw objects are marked for all paste methods.
// If bAddMark is true, the new Draw objects are added to an existing
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 77f4437f8ae9..ae84bb361a92 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -464,7 +464,7 @@ public:
const sal_uInt16 _nInitiallySelectedEvent
) = 0;
- virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj )=0;
+ virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, const SdrModel& rModel, const SdrObject* pObj )=0;
virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) = 0;
diff --git a/include/svx/unomod.hxx b/include/svx/unomod.hxx
index 630c51ce52e4..04571c9071b2 100644
--- a/include/svx/unomod.hxx
+++ b/include/svx/unomod.hxx
@@ -32,6 +32,10 @@ SVX_DLLPUBLIC css::uno::Reference< css::container::XIndexReplace > SvxCreateNumR
class SVX_DLLPUBLIC SvxUnoDrawMSFactory : public css::lang::XMultiServiceFactory
{
+protected:
+ /** abstract SdrModel provider */
+ virtual SdrModel* getSdrModelFromUnoModel() const = 0; //TTTT make reference return
+
public:
SvxUnoDrawMSFactory() throw() {};
diff --git a/include/svx/unomodel.hxx b/include/svx/unomodel.hxx
index ab9ab9ed2cec..e637e4486d2a 100644
--- a/include/svx/unomodel.hxx
+++ b/include/svx/unomodel.hxx
@@ -31,11 +31,12 @@
class SdrModel;
-class SVX_DLLPUBLIC SvxUnoDrawingModel : public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other
- public SvxFmMSFactory,
- public css::drawing::XDrawPagesSupplier,
- public css::lang::XServiceInfo,
- public css::ucb::XAnyCompareFactory
+class SVX_DLLPUBLIC SvxUnoDrawingModel
+: public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other
+ public SvxFmMSFactory,
+ public css::drawing::XDrawPagesSupplier,
+ public css::lang::XServiceInfo,
+ public css::ucb::XAnyCompareFactory
{
friend class SvxUnoDrawPagesAccess;
@@ -53,6 +54,10 @@ private:
css::uno::Sequence< css::uno::Type > maTypeSequence;
+protected:
+ // SvxUnoDrawMSFactory
+ virtual SdrModel* getSdrModelFromUnoModel() const override;
+
public:
SvxUnoDrawingModel( SdrModel* pDoc ) throw();
virtual ~SvxUnoDrawingModel() throw() override;
diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx
index 6f84e72b8e66..eefc11c61b2b 100644
--- a/include/svx/unopage.hxx
+++ b/include/svx/unopage.hxx
@@ -68,8 +68,8 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper6< css::drawin
protected:
cppu::OBroadcastHelper mrBHelper;
- SdrPage* mpPage;
- SdrModel* mpModel;
+ SdrPage* mpPage; // TTTT should be reference
+ SdrModel* mpModel; // TTTT probably not needed -> use from SdrPage
SdrView* mpView;
void SelectObjectsInView( const css::uno::Reference< css::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw ();
@@ -83,7 +83,6 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper6< css::drawin
// Internals
SdrPage* GetSdrPage() const { return mpPage; }
- void ChangeModel( SdrModel* pNewModel );
// Creation of a SdrObject and insertion into the SdrPage
SdrObject *CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) throw();
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 4bb90d88ee0e..422f6b13b446 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -137,8 +137,10 @@ protected:
const SvxItemPropertySet* mpPropSet;
const SfxItemPropertyMapEntry* maPropMapEntries;
- ::tools::WeakReference< SdrObject > mpObj;
- SdrModel* mpModel;
+private:
+ ::tools::WeakReference< SdrObject > mpSdrObjectWeakReference;
+
+protected:
// translations for writer, which works in TWIPS
void ForceMetricToItemPoolMetric(Pair& rPoint) const throw();
void ForceMetricToItemPoolMetric(Point& rPoint) const throw() { ForceMetricToItemPoolMetric(rPoint.toPair()); }
@@ -206,10 +208,13 @@ public:
void TakeSdrObjectOwnership();
bool HasSdrObjectOwnership() const;
- void ChangeModel( SdrModel* pNewModel );
+ // used exclusively by SdrObject
+ void InvalidateSdrObject();
+
+ // Encapsulated access to SdrObject
+ SdrObject* GetSdrObject() const { return mpSdrObjectWeakReference.get(); }
+ bool HasSdrObject() const { return mpSdrObjectWeakReference.is(); }
- void InvalidateSdrObject() { mpObj.reset( nullptr ); };
- SdrObject* GetSdrObject() const {return mpObj.get();}
void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; }
/// @throws css::uno::RuntimeException
css::uno::Any GetBitmap( bool bMetaFile = false ) const;
diff --git a/include/svx/unoshtxt.hxx b/include/svx/unoshtxt.hxx
index f38cf8a62d0f..f16358d2432d 100644
--- a/include/svx/unoshtxt.hxx
+++ b/include/svx/unoshtxt.hxx
@@ -77,8 +77,6 @@ public:
virtual Point LogicToPixel( const Point&, const MapMode& ) const override;
virtual Point PixelToLogic( const Point&, const MapMode& ) const override;
- void ChangeModel( SdrModel* pNewModel );
-
void UpdateOutliner();
private:
diff --git a/include/svx/view3d.hxx b/include/svx/view3d.hxx
index 48ff9b6f12b2..be4381c21351 100644
--- a/include/svx/view3d.hxx
+++ b/include/svx/view3d.hxx
@@ -63,7 +63,10 @@ protected:
void BreakSingle3DObj(E3dObject* pObj);
public:
- E3dView(SdrModel* pModel, OutputDevice* pOut);
+ E3dView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut);
+
virtual ~E3dView() override;
// Output all marked Objects on the given OutputDevice.
diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx
index 6c0883c92a4a..79c58c998600 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -186,7 +186,14 @@ namespace reportdesign
css::uno::Reference< css::uno::XComponentContext > getContext();
+ protected:
+ /** abstract SdrModel provider */
+ virtual SdrModel* getSdrModelFromUnoModel() const override;
+
+ public:
+ //TTTT Needed? Or same as above?
static std::shared_ptr<rptui::OReportModel> getSdrModel(const css::uno::Reference< css::report::XReportDefinition >& _xReportDefinition);
+
private:
DECLARE_XINTERFACE( )
DECLARE_XTYPEPROVIDER( )
diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx
index 201782857e68..17f433629c56 100644
--- a/reportdesign/inc/RptObject.hxx
+++ b/reportdesign/inc/RptObject.hxx
@@ -112,7 +112,9 @@ public:
*/
void releaseUnoShape() { m_xKeepShapeAlive.clear(); }
- static SdrObject* createObject(const css::uno::Reference< css::report::XReportComponent>& _xComponent);
+ static SdrObject* createObject(
+ SdrModel& rTargetModel,
+ const css::uno::Reference< css::report::XReportComponent>& _xComponent);
static sal_uInt16 getObjectType(const css::uno::Reference< css::report::XReportComponent>& _xComponent);
};
@@ -123,9 +125,11 @@ class REPORTDESIGN_DLLPUBLIC OCustomShape final : public SdrObjCustomShape , pub
friend class OReportPage;
friend class DlgEdFactory;
public:
- static OCustomShape* Create( const css::uno::Reference< css::report::XReportComponent>& _xComponent )
+ static OCustomShape* Create(
+ SdrModel& rSdrModel,
+ const css::uno::Reference< css::report::XReportComponent>& _xComponent)
{
- return new OCustomShape( _xComponent );
+ return new OCustomShape(rSdrModel, _xComponent );
}
virtual ~OCustomShape() override;
@@ -139,8 +143,12 @@ public:
private:
virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& rxUnoShape ) override;
- OCustomShape(const css::uno::Reference< css::report::XReportComponent>& _xComponent);
- OCustomShape(const OUString& _sComponentName);
+ OCustomShape(
+ SdrModel& rSdrModel,
+ const css::uno::Reference< css::report::XReportComponent>& _xComponent);
+ OCustomShape(
+ SdrModel& rSdrModel,
+ const OUString& _sComponentName);
virtual void NbcMove( const Size& rSize ) override;
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
@@ -158,9 +166,12 @@ class REPORTDESIGN_DLLPUBLIC OOle2Obj final : public SdrOle2Obj , public OObject
friend class OReportPage;
friend class DlgEdFactory;
public:
- static OOle2Obj* Create( const css::uno::Reference< css::report::XReportComponent>& _xComponent,sal_uInt16 _nType )
+ static OOle2Obj* Create(
+ SdrModel& rSdrModel,
+ const css::uno::Reference< css::report::XReportComponent>& _xComponent,
+ sal_uInt16 _nType)
{
- return new OOle2Obj( _xComponent,_nType );
+ return new OOle2Obj(rSdrModel, _xComponent, _nType);
}
virtual ~OOle2Obj() override;
@@ -171,7 +182,7 @@ public:
virtual sal_uInt16 GetObjIdentifier() const override;
virtual SdrInventor GetObjInventor() const override;
// Clone() should make a complete copy of the object.
- virtual OOle2Obj* Clone() const override;
+ virtual OOle2Obj* Clone(SdrModel* pTargetModel = nullptr) const override;
virtual void initializeOle() override;
OOle2Obj& operator=(const OOle2Obj& rObj);
@@ -179,9 +190,14 @@ public:
void initializeChart( const css::uno::Reference< css::frame::XModel>& _xModel);
private:
- OOle2Obj(const css::uno::Reference< css::report::XReportComponent>& _xComponent,sal_uInt16 _nType);
- OOle2Obj(const OUString& _sComponentName,sal_uInt16 _nType);
-
+ OOle2Obj(
+ SdrModel& rSdrModel,
+ const css::uno::Reference< css::report::XReportComponent>& _xComponent,
+ sal_uInt16 _nType);
+ OOle2Obj(
+ SdrModel& rSdrModel,
+ const OUString& _sComponentName,
+ sal_uInt16 _nType);
virtual void NbcMove( const Size& rSize ) override;
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
@@ -208,12 +224,15 @@ class REPORTDESIGN_DLLPUBLIC OUnoObject: public SdrUnoObj , public OObjectBase
sal_uInt16 m_nObjectType;
protected:
- OUnoObject(const OUString& _sComponentName
- ,const OUString& rModelName
- ,sal_uInt16 _nObjectType);
- OUnoObject( const css::uno::Reference< css::report::XReportComponent>& _xComponent
- ,const OUString& rModelName
- ,sal_uInt16 _nObjectType);
+ OUnoObject(SdrModel& rSdrModel,
+ const OUString& _sComponentName,
+ const OUString& rModelName,
+ sal_uInt16 _nObjectType);
+ OUnoObject(
+ SdrModel& rSdrModel,
+ const css::uno::Reference< css::report::XReportComponent>& _xComponent,
+ const OUString& rModelName,
+ sal_uInt16 _nObjectType);
virtual ~OUnoObject() override;
@@ -240,7 +259,7 @@ public:
virtual css::uno::Reference< css::uno::XInterface > getUnoShape() override;
virtual sal_uInt16 GetObjIdentifier() const override;
virtual SdrInventor GetObjInventor() const override;
- virtual OUnoObject* Clone() const override;
+ virtual OUnoObject* Clone(SdrModel* pTargetModel = nullptr) const override;
OUnoObject& operator=(const OUnoObject& rObj);
diff --git a/reportdesign/inc/RptPage.hxx b/reportdesign/inc/RptPage.hxx
index c168cd5f942f..2c45c93a8331 100644
--- a/reportdesign/inc/RptPage.hxx
+++ b/reportdesign/inc/RptPage.hxx
@@ -35,20 +35,21 @@ class OReportModel;
class REPORTDESIGN_DLLPUBLIC OReportPage : public SdrPage
{
OReportPage& operator=(const OReportPage&) = delete;
+ OReportPage(const OReportPage&) = delete;
OReportModel& rModel;
css::uno::Reference< css::report::XSection > m_xSection;
bool m_bSpecialInsertMode;
std::vector<SdrObject*> m_aTemporaryObjectList;
- OReportPage(const OReportPage&);
-
// method to remove temporary objects, created by 'special mode'
// (BegDragObj)
void removeTempObject(SdrObject const *_pToRemoveObj);
virtual ~OReportPage() override;
+ OReportModel& getOReportModelFromOReportPage() const { return rModel; }
+
protected:
virtual css::uno::Reference< css::uno::XInterface > createUnoPage() override;
public:
@@ -56,9 +57,7 @@ public:
OReportPage( OReportModel& rModel
,const css::uno::Reference< css::report::XSection >& _xSection );
-
- virtual SdrPage* Clone() const override;
- virtual SdrPage* Clone( SdrModel* pNewModel ) const override;
+ virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override;
virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override;
virtual SdrObject* RemoveObject(size_t nObjNum) override;
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 641b88d95e12..11064f21d36e 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -532,10 +532,12 @@ struct OReportDefinitionImpl
};
OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext)
-: ReportDefinitionBase(m_aMutex)
-,ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
-,m_aProps(new OReportComponentProperties(_xContext))
-,m_pImpl(new OReportDefinitionImpl(m_aMutex))
+: ::cppu::BaseMutex(),
+ ReportDefinitionBase(m_aMutex),
+ ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()),
+ ::comphelper::IEmbeddedHelper(),
+ m_aProps(new OReportComponentProperties(_xContext)),
+ m_pImpl(new OReportDefinitionImpl(m_aMutex))
{
m_aProps->m_sName = RptResId(RID_STR_REPORT);
osl_atomic_increment(&m_refCount);
@@ -548,13 +550,16 @@ OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > co
osl_atomic_decrement( &m_refCount );
}
-OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext
- ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
- ,uno::Reference< drawing::XShape >& _xShape)
-: ReportDefinitionBase(m_aMutex)
-,ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
-,m_aProps(new OReportComponentProperties(_xContext))
-,m_pImpl(new OReportDefinitionImpl(m_aMutex))
+OReportDefinition::OReportDefinition(
+ uno::Reference< uno::XComponentContext > const & _xContext,
+ const uno::Reference< lang::XMultiServiceFactory>& _xFactory,
+ uno::Reference< drawing::XShape >& _xShape)
+: ::cppu::BaseMutex(),
+ ReportDefinitionBase(m_aMutex),
+ ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()),
+ ::comphelper::IEmbeddedHelper(),
+ m_aProps(new OReportComponentProperties(_xContext)),
+ m_pImpl(new OReportDefinitionImpl(m_aMutex))
{
m_aProps->m_sName = RptResId(RID_STR_REPORT);
m_aProps->m_xFactory = _xFactory;
@@ -2015,6 +2020,11 @@ std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::R
return pReportModel;
}
+SdrModel* OReportDefinition::getSdrModelFromUnoModel() const
+{
+ return m_pImpl->m_pReportModel.get();
+}
+
uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs)
{
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx
index e67f7a91626d..cf73d9c04c4b 100644
--- a/reportdesign/source/core/sdr/ReportDrawPage.cxx
+++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx
@@ -29,9 +29,9 @@
#include <svx/svdmodel.hxx>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/embed/Aspects.hpp>
-
#include <tools/diagnose_ex.h>
#include <svx/unoshape.hxx>
+#include <svx/svdpage.hxx>
namespace reportdesign
{
@@ -49,7 +49,12 @@ SdrObject* OReportDrawPage::CreateSdrObject_(const uno::Reference< drawing::XSha
{
uno::Reference< report::XReportComponent> xReportComponent(xDescr,uno::UNO_QUERY);
if ( xReportComponent.is() )
- return OObjectBase::createObject(xReportComponent);
+ {
+ return OObjectBase::createObject(
+ GetSdrPage()->getSdrModelFromSdrPage(),
+ xReportComponent);
+ }
+
return SvxDrawPage::CreateSdrObject_( xDescr );
}
@@ -101,7 +106,7 @@ uno::Reference< drawing::XShape > OReportDrawPage::CreateShape( SdrObject *pObj
sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
uno::Reference < embed::XEmbeddedObject > xObj;
OUString sName;
- xObj = pObj->GetModel()->GetPersist()->getEmbeddedObjectContainer().CreateEmbeddedObject(
+ xObj = pObj->getSdrModelFromSdrObject().GetPersist()->getEmbeddedObjectContainer().CreateEmbeddedObject(
::comphelper::MimeConfigurationHelper::GetSequenceClassIDRepresentation(
"80243D39-6741-46C5-926E-069164FF87BB"), sName );
OSL_ENSURE(xObj.is(),"Embedded Object could not be created!");
@@ -131,8 +136,8 @@ uno::Reference< drawing::XShape > OReportDrawPage::CreateShape( SdrObject *pObj
try
{
- OReportModel* pRptModel = static_cast<OReportModel*>(pObj->GetModel());
- xRet.set( pRptModel->createShape(sServiceName,xShape,bChangeOrientation ? 0 : 1), uno::UNO_QUERY_THROW );
+ OReportModel& rRptModel(static_cast< OReportModel& >(pObj->getSdrModelFromSdrObject()));
+ xRet.set( rRptModel.createShape(sServiceName,xShape,bChangeOrientation ? 0 : 1), uno::UNO_QUERY_THROW );
}
catch( const uno::Exception& )
{
diff --git a/reportdesign/source/core/sdr/ReportUndoFactory.cxx b/reportdesign/source/core/sdr/ReportUndoFactory.cxx
index e40411c3b2ec..ee64aed0e003 100644
--- a/reportdesign/source/core/sdr/ReportUndoFactory.cxx
+++ b/reportdesign/source/core/sdr/ReportUndoFactory.cxx
@@ -35,9 +35,9 @@ SdrUndoAction* lcl_createUndo(SdrObject& rObject, Action _eAction, const char* p
uno::Reference< report::XGroup> xGroup = xSection->getGroup();
SdrUndoAction* pUndo = nullptr;
if ( xGroup.is() )
- pUndo = new OUndoGroupSectionAction(*rObject.GetModel(),_eAction,OGroupHelper::getMemberFunction(xSection),xGroup,xReportComponent,pCommentId);
+ pUndo = new OUndoGroupSectionAction(rObject.getSdrModelFromSdrObject(),_eAction,OGroupHelper::getMemberFunction(xSection),xGroup,xReportComponent,pCommentId);
else
- pUndo = new OUndoReportSectionAction(*rObject.GetModel(),_eAction,OReportHelper::getMemberFunction(xSection),xSection->getReportDefinition(),xReportComponent,pCommentId);
+ pUndo = new OUndoReportSectionAction(rObject.getSdrModelFromSdrObject(),_eAction,OReportHelper::getMemberFunction(xSection),xSection->getReportDefinition(),xReportComponent,pCommentId);
return pUndo;
}
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index a0af522a616c..737c87e3b1fe 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -107,7 +107,9 @@ sal_uInt16 OObjectBase::getObjectType(const uno::Reference< report::XReportCompo
return 0;
}
-SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportComponent>& _xComponent)
+SdrObject* OObjectBase::createObject(
+ SdrModel& rTargetModel,
+ const uno::Reference< report::XReportComponent>& _xComponent)
{
SdrObject* pNewObj = nullptr;
sal_uInt16 nType = OObjectBase::getObjectType(_xComponent);
@@ -115,9 +117,11 @@ SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportCompon
{
case OBJ_DLG_FIXEDTEXT:
{
- OUnoObject* pUnoObj = new OUnoObject( _xComponent
- ,OUString("com.sun.star.form.component.FixedText")
- ,OBJ_DLG_FIXEDTEXT);
+ OUnoObject* pUnoObj = new OUnoObject(
+ rTargetModel,
+ _xComponent,
+ OUString("com.sun.star.form.component.FixedText"),
+ OBJ_DLG_FIXEDTEXT);
pNewObj = pUnoObj;
uno::Reference<beans::XPropertySet> xControlModel(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
@@ -126,23 +130,31 @@ SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportCompon
}
break;
case OBJ_DLG_IMAGECONTROL:
- pNewObj = new OUnoObject(_xComponent
- ,OUString("com.sun.star.form.component.DatabaseImageControl")
- ,OBJ_DLG_IMAGECONTROL);
+ pNewObj = new OUnoObject(
+ rTargetModel,
+ _xComponent,
+ OUString("com.sun.star.form.component.DatabaseImageControl"),
+ OBJ_DLG_IMAGECONTROL);
break;
case OBJ_DLG_FORMATTEDFIELD:
- pNewObj = new OUnoObject( _xComponent
- ,OUString("com.sun.star.form.component.FormattedField")
- ,OBJ_DLG_FORMATTEDFIELD);
+ pNewObj = new OUnoObject(
+ rTargetModel,
+ _xComponent,
+ OUString("com.sun.star.form.component.FormattedField"),
+ OBJ_DLG_FORMATTEDFIELD);
break;
case OBJ_DLG_HFIXEDLINE:
case OBJ_DLG_VFIXEDLINE:
- pNewObj = new OUnoObject( _xComponent
- ,OUString("com.sun.star.awt.UnoControlFixedLineModel")
- ,nType);
+ pNewObj = new OUnoObject(
+ rTargetModel,
+ _xComponent,
+ OUString("com.sun.star.awt.UnoControlFixedLineModel"),
+ nType);
break;
case OBJ_CUSTOMSHAPE:
- pNewObj = OCustomShape::Create( _xComponent );
+ pNewObj = OCustomShape::Create(
+ rTargetModel,
+ _xComponent);
try
{
bool bOpaque = false;
@@ -156,7 +168,10 @@ SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportCompon
break;
case OBJ_DLG_SUBREPORT:
case OBJ_OLE2:
- pNewObj = OOle2Obj::Create( _xComponent,nType );
+ pNewObj = OOle2Obj::Create(
+ rTargetModel,
+ _xComponent,
+ nType);
break;
default:
OSL_FAIL("Unknown object id");
@@ -455,19 +470,21 @@ uno::Reference< uno::XInterface > OObjectBase::getUnoShapeOf( SdrObject& _rSdrOb
return xShape;
}
-
-OCustomShape::OCustomShape(const uno::Reference< report::XReportComponent>& _xComponent
- )
- :SdrObjCustomShape()
- ,OObjectBase(_xComponent)
+OCustomShape::OCustomShape(
+ SdrModel& rSdrModel,
+ const uno::Reference< report::XReportComponent>& _xComponent)
+: SdrObjCustomShape(rSdrModel)
+ ,OObjectBase(_xComponent)
{
impl_setUnoShape( uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY) );
m_bIsListening = true;
}
-OCustomShape::OCustomShape(const OUString& _sComponentName)
- :SdrObjCustomShape()
- ,OObjectBase(_sComponentName)
+OCustomShape::OCustomShape(
+ SdrModel& rSdrModel,
+ const OUString& _sComponentName)
+: SdrObjCustomShape(rSdrModel)
+ ,OObjectBase(_sComponentName)
{
m_bIsListening = true;
}
@@ -500,8 +517,8 @@ void OCustomShape::NbcMove( const Size& rSize )
if ( m_xReportComponent.is() )
{
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.Width());
m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.Height());
}
@@ -533,13 +550,12 @@ bool OCustomShape::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
bool bResult = SdrObjCustomShape::EndCreate(rStat, eCmd);
if ( bResult )
{
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- if ( pRptModel )
- {
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
- if ( !m_xReportComponent.is() )
- m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
- }
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
+
+ if ( !m_xReportComponent.is() )
+ m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
+
SetPropsFromRect(GetSnapRect());
}
@@ -558,8 +574,8 @@ uno::Reference< uno::XInterface > OCustomShape::getUnoShape()
uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this );
if ( !m_xReportComponent.is() )
{
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
m_xReportComponent.set(xShape,uno::UNO_QUERY);
}
return xShape;
@@ -572,24 +588,27 @@ void OCustomShape::impl_setUnoShape( const uno::Reference< uno::XInterface >& rx
m_xReportComponent.clear();
}
-
-OUnoObject::OUnoObject(const OUString& _sComponentName
- ,const OUString& rModelName
- ,sal_uInt16 _nObjectType)
- :SdrUnoObj(rModelName)
- ,OObjectBase(_sComponentName)
- ,m_nObjectType(_nObjectType)
+OUnoObject::OUnoObject(
+ SdrModel& rSdrModel,
+ const OUString& _sComponentName,
+ const OUString& rModelName,
+ sal_uInt16 _nObjectType)
+: SdrUnoObj(rSdrModel, rModelName)
+ ,OObjectBase(_sComponentName)
+ ,m_nObjectType(_nObjectType)
{
if ( !rModelName.isEmpty() )
impl_initializeModel_nothrow();
}
-OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xComponent
- ,const OUString& rModelName
- ,sal_uInt16 _nObjectType)
- :SdrUnoObj(rModelName)
- ,OObjectBase(_xComponent)
- ,m_nObjectType(_nObjectType)
+OUnoObject::OUnoObject(
+ SdrModel& rSdrModel,
+ const uno::Reference< report::XReportComponent>& _xComponent,
+ const OUString& rModelName,
+ sal_uInt16 _nObjectType)
+: SdrUnoObj(rSdrModel, rModelName)
+ ,OObjectBase(_xComponent)
+ ,m_nObjectType(_nObjectType)
{
impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) );
@@ -626,12 +645,8 @@ void OUnoObject::impl_setReportComponent_nothrow()
if ( m_xReportComponent.is() )
return;
- OReportModel* pReportModel = static_cast<OReportModel*>(GetModel());
- OSL_ENSURE( pReportModel, "OUnoObject::impl_setReportComponent_nothrow: no report model!" );
- if ( !pReportModel )
- return;
-
- OXUndoEnvironment::OUndoEnvLock aLock( pReportModel->GetUndoEnv() );
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock( rRptModel.GetUndoEnv() );
m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
impl_initializeModel_nothrow();
@@ -665,13 +680,14 @@ void OUnoObject::NbcMove( const Size& rSize )
if ( m_xReportComponent.is() )
{
bool bUndoMode = false;
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- if (pRptModel->GetUndoEnv().IsUndoMode())
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+
+ if (rRptModel.GetUndoEnv().IsUndoMode())
{
// if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode
bUndoMode = true;
}
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
// LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point?
int nNewX = m_xReportComponent->getPositionX() + rSize.Width();
@@ -687,7 +703,7 @@ void OUnoObject::NbcMove( const Size& rSize )
}
if (bPositionFixed)
{
- GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
+ getSdrModelFromSdrObject().AddUndo(getSdrModelFromSdrObject().GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
}
// set geometry properties
SetPropsFromRect(GetLogicRect());
@@ -867,6 +883,11 @@ void OUnoObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& rxUn
releaseUnoShape();
}
+OUnoObject* OUnoObject::Clone(SdrModel* pTargetModel) const
+{
+ return CloneHelper< OUnoObject >(pTargetModel);
+}
+
OUnoObject& OUnoObject::operator=(const OUnoObject& rObj)
{
if( this == &rObj )
@@ -881,29 +902,28 @@ OUnoObject& OUnoObject::operator=(const OUnoObject& rObj)
return *this;
}
-OUnoObject* OUnoObject::Clone() const
-{
- return CloneHelper< OUnoObject >();
-}
-
// OOle2Obj
-
-OOle2Obj::OOle2Obj(const uno::Reference< report::XReportComponent>& _xComponent,sal_uInt16 _nType)
- :SdrOle2Obj()
- ,OObjectBase(_xComponent)
- ,m_nType(_nType)
- ,m_bOnlyOnce(true)
+OOle2Obj::OOle2Obj(
+ SdrModel& rSdrModel,
+ const uno::Reference< report::XReportComponent>& _xComponent,
+ sal_uInt16 _nType)
+: SdrOle2Obj(rSdrModel)
+ ,OObjectBase(_xComponent)
+ ,m_nType(_nType)
+ ,m_bOnlyOnce(true)
{
-
impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) );
m_bIsListening = true;
}
-OOle2Obj::OOle2Obj(const OUString& _sComponentName,sal_uInt16 _nType)
- :SdrOle2Obj()
- ,OObjectBase(_sComponentName)
- ,m_nType(_nType)
- ,m_bOnlyOnce(true)
+OOle2Obj::OOle2Obj(
+ SdrModel& rSdrModel,
+ const OUString& _sComponentName,
+ sal_uInt16 _nType)
+: SdrOle2Obj(rSdrModel)
+ ,OObjectBase(_sComponentName)
+ ,m_nType(_nType)
+ ,m_bOnlyOnce(true)
{
m_bIsListening = true;
}
@@ -940,13 +960,14 @@ void OOle2Obj::NbcMove( const Size& rSize )
if ( m_xReportComponent.is() )
{
bool bUndoMode = false;
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- if (pRptModel->GetUndoEnv().IsUndoMode())
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+
+ if (rRptModel.GetUndoEnv().IsUndoMode())
{
// if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode
bUndoMode = true;
}
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
// LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point?
int nNewX = m_xReportComponent->getPositionX() + rSize.Width();
@@ -967,7 +988,7 @@ void OOle2Obj::NbcMove( const Size& rSize )
}
if (bPositionFixed)
{
- GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
+ getSdrModelFromSdrObject().AddUndo(getSdrModelFromSdrObject().GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
}
// set geometry properties
SetPropsFromRect(GetLogicRect());
@@ -1013,13 +1034,12 @@ bool OOle2Obj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
bool bResult = SdrOle2Obj::EndCreate(rStat, eCmd);
if ( bResult )
{
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- if ( pRptModel )
- {
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
- if ( !m_xReportComponent.is() )
- m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
- }
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
+
+ if ( !m_xReportComponent.is() )
+ m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
+
// set geometry properties
SetPropsFromRect(GetLogicRect());
}
@@ -1038,8 +1058,8 @@ uno::Reference< uno::XInterface > OOle2Obj::getUnoShape()
uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this );
if ( !m_xReportComponent.is() )
{
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
m_xReportComponent.set(xShape,uno::UNO_QUERY);
}
return xShape;
@@ -1068,33 +1088,32 @@ uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider(const
return xSource;
}
+// Clone() should make a complete copy of the object.
+OOle2Obj* OOle2Obj::Clone(SdrModel* pTargetModel) const
+{
+ return CloneHelper< OOle2Obj >(pTargetModel);
+}
+
OOle2Obj& OOle2Obj::operator=(const OOle2Obj& rObj)
{
if( this == &rObj )
return *this;
SdrOle2Obj::operator=(rObj);
- OReportModel* pRptModel = static_cast<OReportModel*>(rObj.GetModel());
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
svt::EmbeddedObjectRef::TryRunningState( GetObjRef() );
- impl_createDataProvider_nothrow(pRptModel->getReportDefinition().get());
+ impl_createDataProvider_nothrow(rRptModel.getReportDefinition().get());
uno::Reference< chart2::data::XDatabaseDataProvider > xSource( lcl_getDataProvider(rObj.GetObjRef()) );
uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(GetObjRef()) );
if ( xSource.is() && xDest.is() )
comphelper::copyProperties(xSource.get(),xDest.get());
- initializeChart(pRptModel->getReportDefinition().get());
+ initializeChart(rRptModel.getReportDefinition().get());
return *this;
}
-
-// Clone() should make a complete copy of the object.
-OOle2Obj* OOle2Obj::Clone() const
-{
- return CloneHelper< OOle2Obj >();
-}
-
void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel)
{
try
@@ -1123,8 +1142,8 @@ void OOle2Obj::initializeOle()
{
m_bOnlyOnce = false;
uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
if( xCompSupp.is() )
@@ -1155,8 +1174,8 @@ void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel)
if ( !lcl_getDataProvider(xObj).is() )
impl_createDataProvider_nothrow(_xModel);
- OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
- pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
::comphelper::NamedValueCollection aArgs;
aArgs.put( "CellRangeRepresentation", uno::makeAny( OUString( "all" ) ) );
diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx
index 0d3465e93b30..b4e09805f04c 100644
--- a/reportdesign/source/core/sdr/RptPage.cxx
+++ b/reportdesign/source/core/sdr/RptPage.cxx
@@ -28,48 +28,29 @@ namespace rptui
{
using namespace ::com::sun::star;
-
-OReportPage::OReportPage( OReportModel& _rModel
- ,const uno::Reference< report::XSection >& _xSection )
- :SdrPage( _rModel, false/*bMasterPage*/ )
+OReportPage::OReportPage(
+ OReportModel& _rModel,
+ const uno::Reference< report::XSection >& _xSection)
+: SdrPage(_rModel, false/*bMasterPage*/)
,rModel(_rModel)
,m_xSection(_xSection)
- ,m_bSpecialInsertMode(false)
-{
-}
-
-
-OReportPage::OReportPage( const OReportPage& rPage )
- :SdrPage( rPage )
- ,rModel(rPage.rModel)
- ,m_xSection(rPage.m_xSection)
- ,m_bSpecialInsertMode(rPage.m_bSpecialInsertMode)
- ,m_aTemporaryObjectList(rPage.m_aTemporaryObjectList)
+ ,m_bSpecialInsertMode(false)
{
}
-
OReportPage::~OReportPage()
{
}
-
-SdrPage* OReportPage::Clone() const
-{
- return Clone(nullptr);
-}
-
-SdrPage* OReportPage::Clone( SdrModel* const pNewModel ) const
+SdrPage* OReportPage::Clone(SdrModel* pNewModel) const
{
- OReportPage *const pNewPage = new OReportPage( *this );
- OReportModel* pReportModel = nullptr;
- if ( pNewModel )
- {
- pReportModel = dynamic_cast<OReportModel*>( pNewModel );
- assert( pReportModel );
- }
- pNewPage->lateInit( *this, pReportModel );
- return pNewPage;
+ OReportModel& rOReportModel(static_cast< OReportModel& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel));
+ OReportPage* pClonedOReportPage(
+ new OReportPage(
+ rOReportModel,
+ m_xSection));
+ pClonedOReportPage->SdrPage::lateInit(*this);
+ return pClonedOReportPage;
}
diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx
index c5c48661c059..df3cbc7b060a 100644
--- a/reportdesign/source/ui/inc/SectionView.hxx
+++ b/reportdesign/source/ui/inc/SectionView.hxx
@@ -42,7 +42,11 @@ private:
void operator =(const OSectionView&) = delete;
public:
- OSectionView( SdrModel* pModel, OReportSection* _pSectionWindow, OReportWindow* pEditor );
+ OSectionView(
+ SdrModel& rSdrModel,
+ OReportSection* _pSectionWindow,
+ OReportWindow* pEditor);
+
virtual ~OSectionView() override;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 10e813dae9b9..84a8569b430b 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3107,7 +3107,11 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
uno::Reference< report::XReportComponent> xShapeProp;
if ( _nObjectId == OBJ_CUSTOMSHAPE )
{
- pNewControl = SdrObjFactory::MakeNewObject( SdrInventor::ReportDesign, _nObjectId, pSectionWindow->getReportSection().getPage(),m_aReportModel.get() );
+ pNewControl = SdrObjFactory::MakeNewObject(
+ *m_aReportModel,
+ SdrInventor::ReportDesign,
+ _nObjectId,
+ pSectionWindow->getReportSection().getPage());
xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY);
OUString sCustomShapeType = getDesignView()->GetInsertObjString();
if ( sCustomShapeType.isEmpty() )
@@ -3117,7 +3121,11 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
}
else if ( _nObjectId == OBJ_OLE2 || OBJ_DLG_SUBREPORT == _nObjectId )
{
- pNewControl = SdrObjFactory::MakeNewObject( SdrInventor::ReportDesign, _nObjectId, pSectionWindow->getReportSection().getPage(),m_aReportModel.get() );
+ pNewControl = SdrObjFactory::MakeNewObject(
+ *m_aReportModel,
+ SdrInventor::ReportDesign,
+ _nObjectId,
+ pSectionWindow->getReportSection().getPage());
pNewControl->SetLogicRect(tools::Rectangle(3000,500,8000,5500)); // switch height and width
xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY_THROW);
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 9cca7d85a9b8..27e467105424 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -183,7 +183,10 @@ void OReportSection::fill()
m_pModel = m_pParent->getViewsWindow()->getView()->getReportView()->getController().getSdrModel();
m_pPage = m_pModel->getPage(m_xSection);
- m_pView = new OSectionView( m_pModel.get(), this, m_pParent->getViewsWindow()->getView() );
+ m_pView = new OSectionView(
+ *m_pModel,
+ this,
+ m_pParent->getViewsWindow()->getView());
// #i93597# tell SdrPage that only left and right page border is defined
// instead of the full rectangle definition
@@ -262,10 +265,10 @@ void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyC
SdrObject* pObject = pShape ? pShape->GetSdrObject() : nullptr;
if ( pObject )
{
- SdrObject* pNewObj = pObject->Clone();
+ // Clone to target SdrModel
+ SdrObject* pNewObj(pObject->Clone(m_pModel.get()));
pNewObj->SetPage( m_pPage );
- pNewObj->SetModel( m_pModel.get() );
m_pPage->InsertObject(pNewObj, SAL_MAX_SIZE);
tools::Rectangle aRet(VCLPoint((*pCopiesIter)->getPosition()),VCLSize((*pCopiesIter)->getSize()));
@@ -606,7 +609,7 @@ void OReportSection::createDefault(const OUString& _sType,SdrObject* _pObj)
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
SfxItemSet aDest(
- _pObj->GetModel()->GetItemPool(),
+ _pObj->getSdrModelFromSdrObject().GetItemPool(),
svl::Items<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx
index 06b594f63d6e..ea01291b81f6 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -34,9 +34,11 @@ namespace rptui
{
using namespace ::com::sun::star;
-
-OSectionView::OSectionView( SdrModel* pModel, OReportSection* _pSectionWindow, OReportWindow* pEditor )
- :SdrView( pModel, _pSectionWindow )
+OSectionView::OSectionView(
+ SdrModel& rSdrModel,
+ OReportSection* _pSectionWindow,
+ OReportWindow* pEditor)
+: SdrView(rSdrModel, _pSectionWindow)
,m_pReportWindow( pEditor )
,m_pSectionWindow(_pSectionWindow)
{
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 341dc465a397..72f74f2eff50 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -1015,9 +1015,11 @@ void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const tools::Recta
if ( &rView != &_rSection )
{
- SdrObject *pNewObj = new SdrUnoObj("com.sun.star.form.component.FixedText");
- pNewObj->SetLogicRect(_aRect);
+ SdrObject *pNewObj = new SdrUnoObj(
+ rView.getSdrModelFromSdrView(),
+ "com.sun.star.form.component.FixedText");
+ pNewObj->SetLogicRect(_aRect);
pNewObj->Move(Size(0, aNewPos.Y()));
bool bChanged = rView.GetModel()->IsChanged();
rReportSection.getPage()->InsertObject(pNewObj);
diff --git a/reportdesign/source/ui/report/dlgedfac.cxx b/reportdesign/source/ui/report/dlgedfac.cxx
index 1a59852f1029..4a416838ebda 100644
--- a/reportdesign/source/ui/report/dlgedfac.cxx
+++ b/reportdesign/source/ui/report/dlgedfac.cxx
@@ -47,29 +47,30 @@ IMPL_STATIC_LINK(
DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* )
{
SdrObject* pNewObj = nullptr;
+
if ( aParams.nInventor == SdrInventor::ReportDesign )
{
switch( aParams.nObjIdentifier )
{
case OBJ_DLG_FIXEDTEXT:
- pNewObj = new OUnoObject( SERVICE_FIXEDTEXT
+ pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_FIXEDTEXT
,OUString("com.sun.star.form.component.FixedText")
,OBJ_DLG_FIXEDTEXT);
break;
case OBJ_DLG_IMAGECONTROL:
- pNewObj = new OUnoObject( SERVICE_IMAGECONTROL
+ pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_IMAGECONTROL
,OUString("com.sun.star.form.component.DatabaseImageControl")
,OBJ_DLG_IMAGECONTROL);
break;
case OBJ_DLG_FORMATTEDFIELD:
- pNewObj = new OUnoObject( SERVICE_FORMATTEDFIELD
+ pNewObj = new OUnoObject(aParams.rSdrModel, SERVICE_FORMATTEDFIELD
,OUString("com.sun.star.form.component.FormattedField")
,OBJ_DLG_FORMATTEDFIELD);
break;
case OBJ_DLG_VFIXEDLINE:
case OBJ_DLG_HFIXEDLINE:
{
- OUnoObject* pObj = new OUnoObject( SERVICE_FIXEDLINE
+ OUnoObject* pObj = new OUnoObject(aParams.rSdrModel, SERVICE_FIXEDLINE
,OUString("com.sun.star.awt.UnoControlFixedLineModel")
,aParams.nObjIdentifier);
pNewObj = pObj;
@@ -81,13 +82,13 @@ IMPL_STATIC_LINK(
}
break;
case OBJ_CUSTOMSHAPE:
- pNewObj = new OCustomShape(SERVICE_SHAPE);
+ pNewObj = new OCustomShape(aParams.rSdrModel, SERVICE_SHAPE);
break;
case OBJ_DLG_SUBREPORT:
- pNewObj = new OOle2Obj(SERVICE_REPORTDEFINITION,OBJ_DLG_SUBREPORT);
+ pNewObj = new OOle2Obj(aParams.rSdrModel, SERVICE_REPORTDEFINITION, OBJ_DLG_SUBREPORT);
break;
case OBJ_OLE2:
- pNewObj = new OOle2Obj(OUString("com.sun.star.chart2.ChartDocument"),OBJ_OLE2);
+ pNewObj = new OOle2Obj(aParams.rSdrModel, OUString("com.sun.star.chart2.ChartDocument"),OBJ_OLE2);
break;
default:
OSL_FAIL("Unknown object id");
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index c66e3d00184d..0c465d1bb106 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -450,18 +450,15 @@ void DlgEdFunc::colorizeOverlappedObject(SdrObject* _pOverlappedObj)
uno::Reference<report::XReportComponent> xComponent = pObj->getReportComponent();
if (xComponent.is() && xComponent != m_xOverlappingObj)
{
- OReportModel* pRptModel = static_cast<OReportModel*>(_pOverlappedObj->GetModel());
- if ( pRptModel )
- {
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ OReportModel& rRptModel(static_cast< OReportModel& >(_pOverlappedObj->getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
- // uncolorize an old object, if there is one
- unColorizeOverlappedObj();
+ // uncolorize an old object, if there is one
+ unColorizeOverlappedObj();
- m_nOldColor = lcl_setColorOfObject(xComponent, m_nOverlappedControlColor);
- m_xOverlappingObj = xComponent;
- m_pOverlappingObj = _pOverlappedObj;
- }
+ m_nOldColor = lcl_setColorOfObject(xComponent, m_nOverlappedControlColor);
+ m_xOverlappingObj = xComponent;
+ m_pOverlappingObj = _pOverlappedObj;
}
}
}
@@ -471,15 +468,12 @@ void DlgEdFunc::unColorizeOverlappedObj()
// uncolorize an old object, if there is one
if (m_xOverlappingObj.is())
{
- OReportModel* pRptModel = static_cast<OReportModel*>(m_pOverlappingObj->GetModel());
- if ( pRptModel )
- {
- OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ OReportModel& rRptModel(static_cast< OReportModel& >(m_pOverlappingObj->getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv());
- lcl_setColorOfObject(m_xOverlappingObj, m_nOldColor);
- m_xOverlappingObj = nullptr;
- m_pOverlappingObj = nullptr;
- }
+ lcl_setColorOfObject(m_xOverlappingObj, m_nOldColor);
+ m_xOverlappingObj = nullptr;
+ m_pOverlappingObj = nullptr;
}
}
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index f86c9048fe03..8c7382cd1050 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -124,6 +124,9 @@ private:
protected:
const SfxItemPropertySet& GetPropertySet() const { return aPropSet; }
+ /** abstract SdrModel provider */
+ virtual SdrModel* getSdrModelFromUnoModel() const override;
+
public:
ScModelObj(ScDocShell* pDocSh);
virtual ~ScModelObj() override;
diff --git a/sc/inc/drawpage.hxx b/sc/inc/drawpage.hxx
index 8f9348220172..cbbaff987a6c 100644
--- a/sc/inc/drawpage.hxx
+++ b/sc/inc/drawpage.hxx
@@ -24,21 +24,18 @@
class ScDrawLayer;
-class ScDrawPage: public FmFormPage
+class ScDrawPage : public FmFormPage
{
ScDrawPage& operator=(const ScDrawPage&) = delete;
+ ScDrawPage(const ScDrawPage&) = delete;
public:
explicit ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage);
virtual ~ScDrawPage() override;
- virtual ScDrawPage* Clone() const override;
- virtual ScDrawPage* Clone(SdrModel* pNewModel) const override;
+ virtual ScDrawPage* Clone(SdrModel* pNewModel = nullptr) const override;
virtual css::uno::Reference< css::uno::XInterface > createUnoPage() override;
-
-private:
- ScDrawPage(const ScDrawPage& rSrcPage);
};
#endif
diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx
index e1130b792b39..baa609a154a6 100644
--- a/sc/qa/extras/anchor.cxx
+++ b/sc/qa/extras/anchor.cxx
@@ -170,7 +170,7 @@ void ScAnchorTest::testTdf76183()
// Add a circle somewhere below first row.
const tools::Rectangle aOrigRect = tools::Rectangle(1000, 1000, 1200, 1200);
- SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect);
+ SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
pPage->InsertObject(pObj);
// Anchor to cell
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rDoc, 0, false);
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index eff48bfd5581..907c8f6a04ae 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2708,7 +2708,7 @@ void Test::testGraphicsInGroup()
{
//Add a square
tools::Rectangle aOrigRect(2,2,100,100);
- SdrRectObj *pObj = new SdrRectObj(aOrigRect);
+ SdrRectObj *pObj = new SdrRectObj(*pDrawLayer, aOrigRect);
pPage->InsertObject(pObj);
const tools::Rectangle &rNewRect = pObj->GetLogicRect();
CPPUNIT_ASSERT_EQUAL_MESSAGE("must have equal position and size",
@@ -2749,7 +2749,7 @@ void Test::testGraphicsInGroup()
{
// Add a circle.
tools::Rectangle aOrigRect = tools::Rectangle(10,10,210,210); // 200 x 200
- SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect);
+ SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
pPage->InsertObject(pObj);
const tools::Rectangle& rNewRect = pObj->GetLogicRect();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Position and size of the circle shouldn't change when inserted into the page.",
@@ -2781,7 +2781,7 @@ void Test::testGraphicsInGroup()
tools::Rectangle aOrigRect(10,200,110,300); // 100 x 100
aTempPoly.append(basegfx::B2DPoint(aStartPos.X(), aStartPos.Y()));
aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y()));
- SdrPathObj* pObj = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pObj = new SdrPathObj(*pDrawLayer, OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
pObj->NbcSetLogicRect(aOrigRect);
pPage->InsertObject(pObj);
const tools::Rectangle& rNewRect = pObj->GetLogicRect();
@@ -2822,7 +2822,7 @@ void Test::testGraphicsOnSheetMove()
// Insert an object.
tools::Rectangle aObjRect(2,2,100,100);
- SdrObject* pObj = new SdrRectObj(aObjRect);
+ SdrObject* pObj = new SdrRectObj(*pDrawLayer, aObjRect);
pPage->InsertObject(pObj);
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0, false);
@@ -5342,7 +5342,7 @@ void Test::testNoteLifeCycle()
SdrCaptionObj* pCaption = pNote->GetOrCreateCaption(aPos);
CPPUNIT_ASSERT_MESSAGE("Failed to create a caption object.", pCaption);
CPPUNIT_ASSERT_EQUAL_MESSAGE("This caption should belong to the drawing layer of the document.",
- m_pDoc->GetDrawLayer(), static_cast<ScDrawLayer*>(pCaption->GetModel()));
+ m_pDoc->GetDrawLayer(), static_cast<ScDrawLayer*>(&pCaption->getSdrModelFromSdrObject()));
// Copy B2 with note to a clipboard.
@@ -5648,7 +5648,7 @@ void Test::testAnchoredRotatedShape()
tools::Rectangle aRect( 4000, 5000, 10000, 7000 );
tools::Rectangle aRotRect( 6000, 3000, 8000, 9000 );
- SdrRectObj *pObj = new SdrRectObj(aRect);
+ SdrRectObj *pObj = new SdrRectObj(*pDrawLayer, aRect);
pPage->InsertObject(pObj);
Point aRef1(pObj->GetSnapRect().Center());
int nAngle = 9000; //90 deg.
@@ -6421,7 +6421,7 @@ void Test::testUndoDataAnchor()
// Insert an object.
tools::Rectangle aObjRect(2,1000,100,1100);
- SdrObject* pObj = new SdrRectObj(aObjRect);
+ SdrObject* pObj = new SdrRectObj(*pDrawLayer, aObjRect);
pPage->InsertObject(pObj);
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0, false);
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index 048b53b33969..38c3e1aebcdb 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -1911,7 +1911,7 @@ void Test::testSortImages()
// Insert graphic in cell B2.
const tools::Rectangle aOrigRect = tools::Rectangle(1000, 1000, 1200, 1200);
- SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect);
+ SdrCircObj* pObj = new SdrCircObj(*pDrawLayer, OBJ_CIRC, aOrigRect);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT(pPage);
pPage->InsertObject(pObj);
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 70b99bdf03e5..8b9b4de19e63 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -84,11 +84,9 @@ void ScDocument::TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDes
SdrObject* pOldObject = aIter.Next();
while (pOldObject)
{
- SdrObject* pNewObject = pOldObject->Clone();
- // SdrObject* pNewObject = pOldObject->Clone( pNewPage, mpDrawLayer );
- pNewObject->SetModel(mpDrawLayer);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(mpDrawLayer);
pNewObject->SetPage(pNewPage);
-
pNewObject->NbcMove(Size(0,0));
pNewPage->InsertObject( pNewObject );
diff --git a/sc/source/core/data/drawpage.cxx b/sc/source/core/data/drawpage.cxx
index 5d445983b69e..5ccd3cdd5598 100644
--- a/sc/source/core/data/drawpage.cxx
+++ b/sc/source/core/data/drawpage.cxx
@@ -24,37 +24,25 @@
#include <document.hxx>
#include <pageuno.hxx>
-ScDrawPage::ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage) :
- FmFormPage(rNewModel, bMasterPage)
+ScDrawPage::ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage)
+: FmFormPage(rNewModel, bMasterPage)
{
SetSize( Size( RECT_MAX, RECT_MAX ) );
}
-ScDrawPage::ScDrawPage(const ScDrawPage& rSrcPage)
- : FmFormPage(rSrcPage)
-{
-}
-
ScDrawPage::~ScDrawPage()
{
}
-ScDrawPage* ScDrawPage::Clone() const
-{
- return Clone(nullptr);
-}
-
ScDrawPage* ScDrawPage::Clone(SdrModel* const pNewModel) const
{
- ScDrawPage* const pNewPage = new ScDrawPage(*this);
- FmFormModel* pScDrawModel = nullptr;
- if (pNewModel)
- {
- pScDrawModel = dynamic_cast<FmFormModel*>(pNewModel);
- assert(pScDrawModel);
- }
- pNewPage->lateInit(*this, pScDrawModel);
- return pNewPage;
+ ScDrawLayer& rScDrawLayer(static_cast< ScDrawLayer& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel));
+ ScDrawPage* pClonedScDrawPage(
+ new ScDrawPage(
+ rScDrawLayer,
+ IsMasterPage()));
+ pClonedScDrawPage->FmFormPage::lateInit(*this);
+ return pClonedScDrawPage;
}
css::uno::Reference< css::uno::XInterface > ScDrawPage::createUnoPage()
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index e694fed7c25a..0665e0942188 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -155,10 +155,10 @@ ScUndoAnchorData::~ScUndoAnchorData()
void ScUndoAnchorData::Undo()
{
// Trigger Object Change
- if (pObj->IsInserted() && pObj->GetPage() && pObj->GetModel())
+ if (pObj->IsInserted() && pObj->GetPage())
{
SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
- pObj->GetModel()->Broadcast(aHint);
+ pObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
if (mbWasCellAnchored)
@@ -175,10 +175,10 @@ void ScUndoAnchorData::Redo()
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *mpDoc, mnTab, mbWasResizeWithCell);
// Trigger Object Change
- if (pObj->IsInserted() && pObj->GetPage() && pObj->GetModel())
+ if (pObj->IsInserted() && pObj->GetPage())
{
SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
- pObj->GetModel()->Broadcast(aHint);
+ pObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
}
@@ -463,10 +463,10 @@ void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )
pOldData->maStart.SetTab(nOldTab);
pOldData->maEnd.SetTab(nOldTab);
}
- SdrObject* pNewObject = pOldObject->Clone();
- pNewObject->SetModel(this);
- pNewObject->SetPage(pNewPage);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(this);
+ pNewObject->SetPage(pNewPage);
pNewObject->NbcMove(Size(0,0));
pNewPage->InsertObject( pNewObject );
ScDrawObjData* pNewData = GetObjData(pNewObject);
@@ -1492,8 +1492,8 @@ void ScDrawLayer::CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const tools::Rec
OSL_ENSURE( pDestPage, "no page" );
if (pDestPage)
{
- SdrObject* pNewObject = pOldObject->Clone();
- pNewObject->SetModel(pDestModel);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(pDestModel);
pNewObject->SetPage(pDestPage);
uno::Reference< chart2::XChartDocument > xOldChart( ScChartHelper::GetChartFromSdrObject( pOldObject ) );
@@ -1667,8 +1667,8 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
if (bObjectInArea && (pOldObject->GetLayer() != SC_LAYER_INTERN)
&& !IsNoteCaption(pOldObject))
{
- SdrObject* pNewObject = pOldObject->Clone();
- pNewObject->SetModel(this);
+ // Clone to target SdrModel
+ SdrObject* pNewObject = pOldObject->Clone(this);
pNewObject->SetPage(pDestPage);
if ( bMirrorObj )
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index d70e87f528c1..676a0dafb35a 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -375,7 +375,11 @@ void ScCaptionCreator::CreateCaption( bool bShown, bool bTailFront )
// create the caption drawing object
tools::Rectangle aTextRect( Point( 0 , 0 ), Size( SC_NOTECAPTION_WIDTH, SC_NOTECAPTION_HEIGHT ) );
Point aTailPos = CalcTailPos( bTailFront );
- mxCaption.reset( new SdrCaptionObj( aTextRect, aTailPos ));
+ mxCaption.reset(
+ new SdrCaptionObj(
+ *mrDoc.GetDrawLayer(), // TTTT should ret a ref?
+ aTextRect,
+ aTailPos));
// basic caption settings
ScCaptionUtil::SetBasicCaptionSettings( *mxCaption, bShown );
}
@@ -754,7 +758,7 @@ void ScCaptionPtr::removeFromDrawPageAndFree( bool bIgnoreUndo )
bool bRecording = false;
if (!bIgnoreUndo)
{
- ScDrawLayer* pDrawLayer = dynamic_cast<ScDrawLayer*>(mpCaption->GetModel());
+ ScDrawLayer* pDrawLayer(dynamic_cast< ScDrawLayer* >(&mpCaption->getSdrModelFromSdrObject()));
SAL_WARN_IF( !pDrawLayer, "sc.core", "ScCaptionPtr::removeFromDrawPageAndFree - object without drawing layer");
// create drawing undo action (before removing the object to have valid draw page in undo action)
bRecording = (pDrawLayer && pDrawLayer->IsRecording());
@@ -1137,8 +1141,9 @@ void ScPostIt::RemoveCaption()
/* Remove caption object only, if this note is its owner (e.g. notes in
undo documents refer to captions in original document, do not remove
them from drawing layer here). */
+ // TTTT maybe no longer needed - can that still happen?
ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer();
- if (pDrawLayer == maNoteData.mxCaption->GetModel())
+ if (pDrawLayer == &maNoteData.mxCaption->getSdrModelFromSdrObject())
maNoteData.mxCaption.removeFromDrawPageAndFree();
SAL_INFO("sc.core","ScPostIt::RemoveCaption - refs: " << maNoteData.mxCaption.getRefs() <<
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index f8f5ac045c68..77f19b2e39c5 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -453,7 +453,9 @@ bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
// insert the rectangle before the arrow - this is relied on in FindFrameForObject
tools::Rectangle aRect = GetDrawRect( nRefStartCol, nRefStartRow, nRefEndCol, nRefEndRow );
- SdrRectObj* pBox = new SdrRectObj( aRect );
+ SdrRectObj* pBox = new SdrRectObj(
+ *pModel,
+ aRect);
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -494,7 +496,10 @@ bool ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
basegfx::B2DPolygon aTempPoly;
aTempPoly.append(basegfx::B2DPoint(aStartPos.X(), aStartPos.Y()));
aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y()));
- SdrPathObj* pArrow = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pArrow = new SdrPathObj(
+ *pModel,
+ OBJ_LINE,
+ basegfx::B2DPolyPolygon(aTempPoly));
pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
@@ -526,7 +531,9 @@ bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
if (bArea)
{
tools::Rectangle aRect = GetDrawRect( nStartCol, nStartRow, nEndCol, nEndRow );
- SdrRectObj* pBox = new SdrRectObj( aRect );
+ SdrRectObj* pBox = new SdrRectObj(
+ *pModel,
+ aRect);
pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
@@ -559,7 +566,10 @@ bool ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
basegfx::B2DPolygon aTempPoly;
aTempPoly.append(basegfx::B2DPoint(aStartPos.X(), aStartPos.Y()));
aTempPoly.append(basegfx::B2DPoint(aEndPos.X(), aEndPos.Y()));
- SdrPathObj* pArrow = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aTempPoly));
+ SdrPathObj* pArrow = new SdrPathObj(
+ *pModel,
+ OBJ_LINE,
+ basegfx::B2DPolyPolygon(aTempPoly));
pArrow->NbcSetLogicRect(tools::Rectangle(aStartPos,aEndPos)); //TODO: needed ???
pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
@@ -625,7 +635,10 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData
aRect.AdjustTop( -70 );
aRect.AdjustBottom(70 );
- SdrCircObj* pCircle = new SdrCircObj( OBJ_CIRC, aRect );
+ SdrCircObj* pCircle = new SdrCircObj(
+ *pModel,
+ OBJ_CIRC,
+ aRect);
SfxItemSet& rAttrSet = rData.GetCircleSet();
pCircle->SetMergedItemSetAndBroadcast(rAttrSet);
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index cad44b77ea43..055663df4782 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -4221,7 +4221,7 @@ void XclImpChartDrawing::ConvertObjects( XclImpDffConverter& rDffConv,
Reference< XDrawPageSupplier > xDrawPageSupp( rxModel, UNO_QUERY_THROW );
Reference< XDrawPage > xDrawPage( xDrawPageSupp->getDrawPage(), UNO_SET_THROW );
pSdrPage = ::GetSdrPageFromXDrawPage( xDrawPage );
- pSdrModel = pSdrPage ? pSdrPage->GetModel() : nullptr;
+ pSdrModel = pSdrPage ? &pSdrPage->getSdrModelFromSdrPage() : nullptr;
}
catch( Exception& )
{
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 94b2d0130d0b..989c9b693d0f 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -425,8 +425,7 @@ SdrObjectPtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffConv, c
else
{
xSdrObj = DoCreateSdrObj( rDffConv, rAnchorRect );
- if( xSdrObj )
- xSdrObj->SetModel( rDffConv.GetModel() );
+
//added for exporting OCX control
/* mnObjType value set should be as below table:
0x0000 Group 0x0001 Line
@@ -1012,7 +1011,9 @@ std::size_t XclImpGroupObj::DoGetProgressSize() const
SdrObjectPtr XclImpGroupObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& /*rAnchorRect*/ ) const
{
- std::unique_ptr<SdrObjGroup, SdrObjectFree> xSdrObj( new SdrObjGroup );
+ std::unique_ptr<SdrObjGroup, SdrObjectFree> xSdrObj(
+ new SdrObjGroup(
+ *GetDoc().GetDrawLayer()));
// child objects in BIFF2-BIFF5 have absolute size, not needed to pass own anchor rectangle
SdrObjList& rObjList = *xSdrObj->GetSubList(); // SdrObjGroup always returns existing sublist
for( ::std::vector< XclImpDrawObjRef >::const_iterator aIt = maChildren.begin(), aEnd = maChildren.end(); aIt != aEnd; ++aIt )
@@ -1080,7 +1081,11 @@ SdrObjectPtr XclImpLineObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
aB2DPolygon.append( ::basegfx::B2DPoint( rAnchorRect.Right(), rAnchorRect.Top() ) );
break;
}
- SdrObjectPtr xSdrObj( new SdrPathObj( OBJ_LINE, ::basegfx::B2DPolyPolygon( aB2DPolygon ) ) );
+ SdrObjectPtr xSdrObj(
+ new SdrPathObj(
+ *GetDoc().GetDrawLayer(),
+ OBJ_LINE,
+ ::basegfx::B2DPolyPolygon(aB2DPolygon)));
ConvertLineStyle( *xSdrObj, maLineData );
// line ends
@@ -1195,7 +1200,10 @@ void XclImpRectObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uI
SdrObjectPtr XclImpRectObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- SdrObjectPtr xSdrObj( new SdrRectObj( rAnchorRect ) );
+ SdrObjectPtr xSdrObj(
+ new SdrRectObj(
+ *GetDoc().GetDrawLayer(),
+ rAnchorRect));
ConvertRectStyle( *xSdrObj );
rDffConv.Progress();
return xSdrObj;
@@ -1208,7 +1216,11 @@ XclImpOvalObj::XclImpOvalObj( const XclImpRoot& rRoot ) :
SdrObjectPtr XclImpOvalObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- SdrObjectPtr xSdrObj( new SdrCircObj( OBJ_CIRC, rAnchorRect ) );
+ SdrObjectPtr xSdrObj(
+ new SdrCircObj(
+ *GetDoc().GetDrawLayer(),
+ OBJ_CIRC,
+ rAnchorRect));
ConvertRectStyle( *xSdrObj );
rDffConv.Progress();
return xSdrObj;
@@ -1280,7 +1292,13 @@ SdrObjectPtr XclImpArcObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const t
break;
}
SdrObjKind eObjKind = maFillData.IsFilled() ? OBJ_SECT : OBJ_CARC;
- SdrObjectPtr xSdrObj( new SdrCircObj( eObjKind, aNewRect, nStartAngle, nEndAngle ) );
+ SdrObjectPtr xSdrObj(
+ new SdrCircObj(
+ *GetDoc().GetDrawLayer(),
+ eObjKind,
+ aNewRect,
+ nStartAngle,
+ nEndAngle));
ConvertFillStyle( *xSdrObj, maFillData );
ConvertLineStyle( *xSdrObj, maLineData );
rDffConv.Progress();
@@ -1358,7 +1376,11 @@ SdrObjectPtr XclImpPolygonObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, con
aB2DPolygon.append( lclGetPolyPoint( rAnchorRect, maCoords.front() ) );
// create the SdrObject
SdrObjKind eObjKind = maFillData.IsFilled() ? OBJ_PATHPOLY : OBJ_PATHPLIN;
- xSdrObj.reset( new SdrPathObj( eObjKind, ::basegfx::B2DPolyPolygon( aB2DPolygon ) ) );
+ xSdrObj.reset(
+ new SdrPathObj(
+ *GetDoc().GetDrawLayer(),
+ eObjKind,
+ ::basegfx::B2DPolyPolygon(aB2DPolygon)));
ConvertRectStyle( *xSdrObj );
}
rDffConv.Progress();
@@ -1420,7 +1442,9 @@ void XclImpTextObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uI
SdrObjectPtr XclImpTextObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const
{
- std::unique_ptr<SdrObjCustomShape, SdrObjectFree> xSdrObj( new SdrObjCustomShape );
+ std::unique_ptr<SdrObjCustomShape, SdrObjectFree> xSdrObj(
+ new SdrObjCustomShape(
+ *GetDoc().GetDrawLayer()));
xSdrObj->NbcSetSnapRect( rAnchorRect );
OUString aRectType = "rectangle";
xSdrObj->MergeDefaultAttributes( &aRectType );
@@ -1710,7 +1734,12 @@ SdrObjectPtr XclImpChartObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
// ChartHelper::AdaptDefaultsForChart( xEmbObj );
// create the container OLE object
- xSdrObj.reset( new SdrOle2Obj( svt::EmbeddedObjectRef( xEmbObj, nAspect ), aEmbObjName, rAnchorRect ) );
+ xSdrObj.reset(
+ new SdrOle2Obj(
+ *GetDoc().GetDrawLayer(),
+ svt::EmbeddedObjectRef(xEmbObj, nAspect),
+ aEmbObjName,
+ rAnchorRect));
}
return xSdrObj;
@@ -2953,7 +2982,11 @@ SdrObjectPtr XclImpPictureObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, con
// no OLE - create a plain picture from IMGDATA record data
if( !xSdrObj && (maGraphic.GetType() != GraphicType::NONE) )
{
- xSdrObj.reset( new SdrGrafObj( maGraphic, rAnchorRect ) );
+ xSdrObj.reset(
+ new SdrGrafObj(
+ *GetDoc().GetDrawLayer(),
+ maGraphic,
+ rAnchorRect));
ConvertRectStyle( *xSdrObj );
}
@@ -3434,9 +3467,20 @@ SdrObjectPtr XclImpDffConverter::CreateSdrObject( const XclImpPictureObj& rPicOb
ErrCode nError = ERRCODE_NONE;
namespace cssea = ::com::sun::star::embed::Aspects;
sal_Int64 nAspects = rPicObj.IsSymbol() ? cssea::MSOLE_ICON : cssea::MSOLE_CONTENT;
- xSdrObj.reset( CreateSdrOLEFromStorage(
- aStrgName, xSrcStrg, pDocShell->GetStorage(), aGraphic,
- rAnchorRect, aVisArea, nullptr, nError, mnOleImpFlags, nAspects, GetRoot().GetMedium().GetBaseURL()) );
+ xSdrObj.reset(
+ CreateSdrOLEFromStorage(
+ GetConvData().mrSdrModel,
+ aStrgName,
+ xSrcStrg,
+ pDocShell->GetStorage(),
+ aGraphic,
+ rAnchorRect,
+ aVisArea,
+ nullptr,
+ nError,
+ mnOleImpFlags,
+ nAspects,
+ GetRoot().GetMedium().GetBaseURL()));
}
}
}
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index a6b73fd76631..d6887744f517 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -165,8 +165,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
break;
default:
{
- Graphic aGraph( SdrExchangeView::GetObjGraphic(
- pDoc->GetDrawLayer(), pObject ) );
+ Graphic aGraph(SdrExchangeView::GetObjGraphic(*pObject));
OUString aLinkName;
WriteImage( aLinkName, aGraph, aOpt );
pE->bWritten = true;
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index d6915302aba4..e553df1130ff 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -602,7 +602,11 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
if ( pI->pGraphic )
{
tools::Rectangle aRect ( aInsertPos, aLogicSize );
- SdrGrafObj* pObj = new SdrGrafObj( *pI->pGraphic, aRect );
+ SdrGrafObj* pObj = new SdrGrafObj(
+ *pModel,
+ *pI->pGraphic,
+ aRect);
+
// calling SetGraphicLink here doesn't work
pObj->SetName( pI->aURL );
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 1e4c9c868bfc..12cfa00f3bca 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -188,7 +188,7 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain
// #i71538# use complete SdrViews
// SdrExchangeView aView(pModel);
- SdrView aView(pModel);
+ SdrView aView(*pModel);
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
aView.MarkAllObj(pPv);
aSrcSize = aView.GetAllMarkedRect().GetSize();
@@ -395,7 +395,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c
{
// #i71538# use complete SdrViews
// SdrExchangeView aView( pModel );
- SdrView aView( pModel );
+ SdrView aView(*pModel);
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
OSL_ENSURE( pPv, "pPv not there..." );
aView.MarkAllObj( pPv );
@@ -632,7 +632,7 @@ static void lcl_InitMarks( SdrMarkView& rDest, const SdrMarkView& rSource, SCTAB
void ScDrawTransferObj::SetDragSource( const ScDrawView* pView )
{
DELETEZ( pDragSourceView );
- pDragSourceView = new SdrView( pView->GetModel() );
+ pDragSourceView = new SdrView(pView->getSdrModelFromSdrView()); // TTTT pView should be reference
lcl_InitMarks( *pDragSourceView, *pView, pView->GetTab() );
//! add as listener with document, delete pDragSourceView if document gone
@@ -641,7 +641,7 @@ void ScDrawTransferObj::SetDragSource( const ScDrawView* pView )
void ScDrawTransferObj::SetDragSourceObj( SdrObject* pObj, SCTAB nTab )
{
DELETEZ( pDragSourceView );
- pDragSourceView = new SdrView( pObj->GetModel() );
+ pDragSourceView = new SdrView(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference
pDragSourceView->ShowSdrPage(pDragSourceView->GetModel()->GetPage(nTab));
SdrPageView* pPV = pDragSourceView->GetSdrPageView();
pDragSourceView->MarkObj(pObj, pPV);
@@ -719,7 +719,7 @@ void ScDrawTransferObj::InitDocShell()
SdrModel* pDestModel = rDestDoc.GetDrawLayer();
// #i71538# use complete SdrViews
// SdrExchangeView aDestView( pDestModel );
- SdrView aDestView( pDestModel );
+ SdrView aDestView(*pDestModel);
aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0));
aDestView.Paste(
*pModel,
diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx
index 7ada2107c5b3..d167649a5086 100644
--- a/sc/source/ui/drawfunc/fuconarc.cxx
+++ b/sc/source/ui/drawfunc/fuconarc.cxx
@@ -123,8 +123,9 @@ SdrObject* FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const tools::Re
// case SID_DRAW_CIRCLECUT:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx
index f5a03392f736..e028a4d1dcd3 100644
--- a/sc/source/ui/drawfunc/fuconcustomshape.cxx
+++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx
@@ -132,8 +132,10 @@ void FuConstCustomShape::Deactivate()
SdrObject* FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, const tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
+
if( pObj )
{
tools::Rectangle aRectangle( rRectangle );
@@ -142,6 +144,7 @@ SdrObject* FuConstCustomShape::CreateDefaultObject(const sal_uInt16 /* nID */, c
ImpForceQuadratic( aRectangle );
pObj->SetLogicRect( aRectangle );
}
+
return pObj;
}
@@ -168,7 +171,7 @@ void FuConstCustomShape::SetAttributes( SdrObject* pObj )
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
SfxItemSet aDest(
- pObj->GetModel()->GetItemPool(),
+ pObj->getSdrModelFromSdrObject().GetItemPool(),
svl::Items<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx
index 330ebf09a41d..cc9ec052cea2 100644
--- a/sc/source/ui/drawfunc/fuconpol.cxx
+++ b/sc/source/ui/drawfunc/fuconpol.cxx
@@ -185,8 +185,9 @@ SdrObject* FuConstPolygon::CreateDefaultObject(const sal_uInt16 nID, const tools
// case SID_DRAW_FREELINE_NOFILL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index d3ae4c990850..6aba5faad5fc 100644
--- a/sc/source/ui/drawfunc/fuconrec.cxx
+++ b/sc/source/ui/drawfunc/fuconrec.cxx
@@ -58,10 +58,10 @@ FuConstRectangle::~FuConstRectangle()
namespace {
-::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel* pDoc)
+::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aRetval;
- XLineEndListRef pLineEndList = pDoc->GetLineEndList();
+ XLineEndListRef pLineEndList(rModel.GetLineEndList());
if( pLineEndList.is() )
{
@@ -116,7 +116,7 @@ bool FuConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
if (pObj)
{
- SfxItemSet aAttr(pObj->GetModel()->GetItemPool());
+ SfxItemSet aAttr(pObj->getSdrModelFromSdrObject().GetItemPool());
SetLineEnds(aAttr, pObj, aSfxRequest.GetSlot());
pObj->SetMergedItemSet(aAttr);
}
@@ -216,7 +216,7 @@ void FuConstRectangle::Activate()
void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal_uInt16 nSlotId)
{
- SdrModel *pDoc = pObj->GetModel();
+ SdrModel& rModel(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference
if ( nSlotId == SID_LINE_ARROW_START ||
nSlotId == SID_LINE_ARROW_END ||
@@ -230,7 +230,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
// set attributes of line start and ends
// arrowhead
- ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDoc ) );
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) );
if( !aArrow.count() )
{
::basegfx::B2DPolygon aNewArrow;
@@ -242,7 +242,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
}
// Circles
- ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, pDoc ) );
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) );
if( !aCircle.count() )
{
::basegfx::B2DPolygon aNewCircle;
@@ -252,7 +252,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
}
// Square
- ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, pDoc ) );
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) );
if( !aSquare.count() )
{
::basegfx::B2DPolygon aNewSquare;
@@ -264,7 +264,7 @@ void FuConstRectangle::SetLineEnds(SfxItemSet& rAttr, const SdrObject* pObj, sal
aSquare.append(aNewSquare);
}
- SfxItemSet aSet( pDoc->GetItemPool() );
+ SfxItemSet aSet( rModel.GetItemPool() );
long nWidth = 200; // (1/100th mm)
// determine line width and calculate with it the line end width
@@ -356,8 +356,9 @@ void FuConstRectangle::Deactivate()
SdrObject* FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx
index 619ad1c4f79d..a3a141a8732e 100644
--- a/sc/source/ui/drawfunc/fuconuno.cxx
+++ b/sc/source/ui/drawfunc/fuconuno.cxx
@@ -111,8 +111,9 @@ SdrObject* FuConstUnoControl::CreateDefaultObject(const sal_uInt16 /* nID */, co
// case SID_FM_CREATE_CONTROL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 5574a6f5b6cc..d1efc9f2cd33 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -177,10 +177,13 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
tools::Rectangle aRect ( aInsertPos, aLogicSize );
- SdrGrafObj* pObj = new SdrGrafObj( rGraphic1, aRect );
+ SdrGrafObj* pObj = new SdrGrafObj(
+ pView->getSdrModelFromSdrView(), // TTTT pView should be reference
+ rGraphic1,
+ aRect);
// calling SetGraphicLink here doesn't work
-
+ // Yes, due to the SdrObject had no SdrModel
// Path is no longer used as name for the graphics object
ScDrawLayer* pLayer = static_cast<ScDrawLayer*>(pView->GetModel());
@@ -244,9 +247,10 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
#endif
}
- SdrMediaObj* pObj = new SdrMediaObj( tools::Rectangle( aInsertPos, aSize ) );
+ SdrMediaObj* pObj = new SdrMediaObj(
+ *rData.GetDocument()->GetDrawLayer(),
+ tools::Rectangle(aInsertPos, aSize));
- pObj->SetModel(rData.GetDocument()->GetDrawLayer()); // set before setURL
pObj->setURL( realURL, ""/*TODO?*/ );
pView->InsertObjectAtView( pObj, *pPV, bApi ? SdrInsertFlags::DONTMARK : SdrInsertFlags::NONE );
}
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index b56a1c1d7f0a..bcee011d6637 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -350,7 +350,11 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView*
if ( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) )
aPnt.AdjustX( -(aSize.Width()) ); // move position to left edge
tools::Rectangle aRect (aPnt, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pDoc, // TTTT should be reference
+ aObjRef,
+ aName,
+ aRect);
SdrPageView* pPV = pView->GetSdrPageView();
pView->InsertObjectAtView(pObj, *pPV);
@@ -588,7 +592,11 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawV
Point aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange );
tools::Rectangle aRect (aStart, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pDoc, // TTTT should be reference
+ svt::EmbeddedObjectRef(xObj, nAspect),
+ aName,
+ aRect);
SdrPageView* pPV = pView->GetSdrPageView();
// #i121334# This call will change the chart's default background fill from white to transparent.
@@ -747,7 +755,11 @@ FuInsertChartFromFile::FuInsertChartFromFile( ScTabViewShell* pViewSh, vcl::Wind
ScRange aPositionRange = pViewSh->GetViewData().GetCurPos();
Point aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange );
tools::Rectangle aRect (aStart, aSize);
- SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pDoc, // TTTT should be reference
+ svt::EmbeddedObjectRef(xObj, nAspect),
+ aName,
+ aRect);
SdrPageView* pPV = pView->GetSdrPageView();
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 38583597b9d2..7914c87a7313 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -643,8 +643,9 @@ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectan
// case SID_DRAW_NOTEEDIT:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
- nullptr, pDrDoc);
+ *pDrDoc,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 9574cdb63900..ad353cdd7a29 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -56,8 +56,11 @@ class ScDrawView final : public FmFormView
virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const override;
public:
- ScDrawView( OutputDevice* pOut, ScViewData* pData );
- virtual ~ScDrawView() override;
+ ScDrawView(
+ OutputDevice* pOut,
+ ScViewData* pData);
+
+ virtual ~ScDrawView() override;
virtual void MarkListHasChanged() override;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 52c3fb9b4e93..a414160700c7 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1248,7 +1248,7 @@ static void lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo
SdrObject* pObject = pModel->GetNamedObject( rName, nDrawId, nTab );
if (pObject)
{
- SdrView aEditView( pModel );
+ SdrView aEditView(*pModel);
aEditView.ShowSdrPage(aEditView.GetModel()->GetPage(nTab));
SdrPageView* pPV = aEditView.GetSdrPageView();
aEditView.MarkObj(pObject, pPV);
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx
index a8c19f342abc..7f150e228572 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -154,8 +154,11 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName,
xReceiver->setArguments(aArgs);
}
- SdrOle2Obj* pObject = new SdrOle2Obj(svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
- aName, aInsRect);
+ SdrOle2Obj* pObject = new SdrOle2Obj(
+ *pModel,
+ svt::EmbeddedObjectRef(xObject, embed::Aspects::MSOLE_CONTENT),
+ aName,
+ aInsRect);
if (xObject.is())
xObject->setVisualAreaSize(nAspect, aAwtSize);
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index c146e3aba2e3..1c98dc40c502 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -246,7 +246,11 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
rDoc.GetChartListenerCollection()->insert( pChartListener );
pChartListener->StartListeningTo();
- SdrOle2Obj* pObj = new SdrOle2Obj( ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), aName, aInsRect );
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ *pModel,
+ ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT),
+ aName,
+ aInsRect);
// set VisArea
if( xObj.is())
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index d16bc895a5d1..ee46cd116c43 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -373,6 +373,18 @@ void ScModelObj::CreateAndSet(ScDocShell* pDocSh)
pDocSh->SetBaseModel( new ScModelObj(pDocSh) );
}
+SdrModel* ScModelObj::getSdrModelFromUnoModel() const
+{
+ ScDocument& rDoc(pDocShell->GetDocument());
+
+ if(!rDoc.GetDrawLayer())
+ {
+ rDoc.InitDrawLayer();
+ }
+
+ return rDoc.GetDrawLayer();
+}
+
ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
SfxBaseModel( pDocSh ),
aPropSet( lcl_GetDocOptPropertyMap() ),
@@ -1947,7 +1959,9 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
if( pModel )
{
- aDrawViewKeeper.mpDrawView = new FmFormView( pModel, pDev );
+ aDrawViewKeeper.mpDrawView = new FmFormView(
+ *pModel,
+ pDev);
aDrawViewKeeper.mpDrawView->ShowSdrPage(aDrawViewKeeper.mpDrawView->GetModel()->GetPage(nTab));
aDrawViewKeeper.mpDrawView->SetPrintPreview();
}
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index a938851e26fb..8c590d64a90e 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -333,11 +333,13 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc(rModel.GetDocument());
+
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -346,7 +348,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
table::CellRangeAddress aAddress = xRangeAdd->getRangeAddress();
if (nTab == aAddress.Sheet)
@@ -463,14 +465,15 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -561,14 +564,15 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
@@ -657,15 +661,16 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
@@ -705,15 +710,16 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
@@ -764,15 +770,16 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
SdrObject *pObj = GetSdrObject();
if (pObj)
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel && pPage )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+
+ if ( pPage )
{
- ScDocument* pDoc = pModel->GetDocument();
+ ScDocument* pDoc = rModel.GetDocument();
if ( pDoc )
{
SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
{
uno::Reference<drawing::XShape> xShape( mxShapeAgg, uno::UNO_QUERY );
if (xShape.is())
@@ -997,28 +1004,26 @@ uno::Reference<text::XTextRange> SAL_CALL ScShapeObj::getAnchor()
SdrObject* pObj = GetSdrObject();
if( pObj )
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+ ScDocument* pDoc = rModel.GetDocument();
+
+ if ( pPage && pDoc )
{
- ScDocument* pDoc = pModel->GetDocument();
- if ( pDoc )
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
{
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
- {
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
- SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
- {
- Point aPos(pObj->GetCurrentBoundRect().TopLeft());
- ScRange aRange(pDoc->GetRange( nTab, tools::Rectangle( aPos, aPos ) ));
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ {
+ Point aPos(pObj->GetCurrentBoundRect().TopLeft());
+ ScRange aRange(pDoc->GetRange( nTab, tools::Rectangle( aPos, aPos ) ));
- // anchor is always the cell
+ // anchor is always the cell
- xRet.set(new ScCellObj( pDocSh, aRange.aStart ));
- }
+ xRet.set(new ScCellObj( pDocSh, aRange.aStart ));
}
}
}
@@ -1242,25 +1247,23 @@ uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent()
SdrObject* pObj = GetSdrObject();
if( pObj )
{
- ScDrawLayer* pModel = static_cast<ScDrawLayer*>(pObj->GetModel());
- SdrPage* pPage = pObj->GetPage();
- if ( pModel )
+ ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
+ SdrPage* pPage(pObj->GetPage());
+ ScDocument* pDoc = rModel.GetDocument();
+
+ if ( pPage && pDoc )
{
- ScDocument* pDoc = pModel->GetDocument();
- if ( pDoc )
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
{
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
- if ( pObjSh && dynamic_cast<const ScDocShell*>( pObjSh) != nullptr )
- {
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pObjSh);
- SCTAB nTab = 0;
- if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
- {
- const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab );
- if( pCaptData )
- return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) );
- }
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, rModel, nTab ) )
+ {
+ const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab );
+ if( pCaptData )
+ return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) );
}
}
}
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index 4be43b1354d1..bbe58cda31c9 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -34,8 +34,10 @@
#include <tabvwsh.hxx>
#include <docsh.hxx>
-ScDrawView::ScDrawView( OutputDevice* pOut, ScViewData* pData ) :
- FmFormView( pData->GetDocument()->GetDrawLayer(), pOut ),
+ScDrawView::ScDrawView(
+ OutputDevice* pOut,
+ ScViewData* pData )
+: FmFormView(*pData->GetDocument()->GetDrawLayer(), pOut),
pViewData( pData ),
pDev( pOut ),
pDoc( pData->GetDocument() ),
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index de4ff2c7e003..0561a41c3d9f 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1197,7 +1197,10 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
ScDrawLayer* pModel = pDoc->GetDrawLayer();
if (pModel)
{
- mpLOKDrawView.reset(new FmFormView(pModel, &rDevice));
+ mpLOKDrawView.reset(
+ new FmFormView(
+ *pModel,
+ &rDevice));
mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel()->GetPage(nTab));
aOutputData.SetDrawView(mpLOKDrawView.get());
aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index ae4a3fc029cf..11596ac08e5d 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -165,7 +165,9 @@ void ScPreview::UpdateDrawView() // nTab must be right
if ( !pDrawView ) // New Drawing?
{
- pDrawView = new FmFormView( pModel, this );
+ pDrawView = new FmFormView(
+ *pModel,
+ this);
// The DrawView takes over the Design-Mode from the Model
// (Settings "In opening Draftmode"), therefore to restore here
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index cdafc4580165..58316cf16907 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -564,7 +564,10 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
if( pModel )
{
- pDrawView.reset(new FmFormView( pModel, pDev ));
+ pDrawView.reset(
+ new FmFormView(
+ *pModel,
+ pDev));
pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
pDrawView->SetPrintPreview();
aOutputData.SetDrawView( pDrawView.get() );
diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx
index ba44266d31b0..d081c875c4cb 100644
--- a/sc/source/ui/view/tabvwshg.cxx
+++ b/sc/source/ui/view/tabvwshg.cxx
@@ -60,8 +60,11 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
ScDrawView* pDrView = pView->GetScDrawView();
SdrModel* pModel = pDrView->GetModel();
- SdrObject* pObj = SdrObjFactory::MakeNewObject(SdrInventor::FmForm, OBJ_FM_BUTTON,
- pDrView->GetSdrPageView()->GetPage(), pModel);
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ *pModel,
+ SdrInventor::FmForm,
+ OBJ_FM_BUTTON,
+ pDrView->GetSdrPageView()->GetPage());
SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
OSL_ENSURE( pUnoCtrl, "no SdrUnoObj");
if( !pUnoCtrl )
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index e1f521ce992f..cfbd4bed996f 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -153,11 +153,12 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
const SdrMark* pM=aMark.GetMark(nm);
const SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrObject* pNewObj=pObj->Clone();
+ // Directly Clone to taget SdrModel
+ SdrObject* pNewObj(pObj->Clone(pDrawModel));
if (pNewObj!=nullptr)
{
- pNewObj->SetModel(pDrawModel);
+ // pNewObj->SetModel(pDrawModel);
pNewObj->SetPage(pDestPage);
// copy graphics within the same model - always needs new name
@@ -193,8 +194,9 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
else
{
bPasteIsMove = false; // no internal move happened
-
- SdrView aView(pModel); // #i71529# never create a base class of SdrView directly!
+ // TTTT hide all non-direct SdrView constr to disable construct
+ // in-between classes in one of the next steps (!)
+ SdrView aView(*pModel); // #i71529# never create a base class of SdrView directly!
SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
aView.MarkAllObj(pPv);
Size aSize = aView.GetAllMarkedRect().GetSize();
@@ -353,7 +355,11 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X
tools::Rectangle aRect( aInsPos, aSize );
ScDrawView* pDrView = GetScDrawView();
- SdrOle2Obj* pSdrObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrOle2Obj* pSdrObj = new SdrOle2Obj(
+ pDrView->getSdrModelFromSdrView(),
+ aObjRef,
+ aName,
+ aRect);
SdrPageView* pPV = pDrView->GetSdrPageView();
pDrView->InsertObjectSafe( pSdrObj, *pPV ); // don't mark if OLE
@@ -432,7 +438,10 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
GetViewData().GetViewShell()->SetDrawShell( true );
tools::Rectangle aRect(aPos, aSize);
- SdrGrafObj* pGrafObj = new SdrGrafObj(rGraphic, aRect);
+ SdrGrafObj* pGrafObj = new SdrGrafObj(
+ pScDrawView->getSdrModelFromSdrView(),
+ rGraphic,
+ aRect);
// path was the name of the graphic in history
diff --git a/sd/inc/CustomAnimationEffect.hxx b/sd/inc/CustomAnimationEffect.hxx
index 6322d365b293..53e08b70c4af 100644
--- a/sd/inc/CustomAnimationEffect.hxx
+++ b/sd/inc/CustomAnimationEffect.hxx
@@ -25,17 +25,15 @@
#include <com/sun/star/animations/XAudio.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/util/XChangesListener.hpp>
-
#include <vcl/timer.hxx>
-
#include "sddllapi.h"
-
#include <list>
#include <vector>
#include <map>
#include <memory>
class SdrPathObj;
+class SdrModel;
namespace sd {
@@ -167,7 +165,7 @@ public:
SAL_DLLPRIVATE static sal_Int32 get_node_type( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
SAL_DLLPRIVATE static sal_Int32 getNumberOfSubitems( const css::uno::Any& aTarget, sal_Int16 nIterateType );
- SAL_DLLPRIVATE SdrPathObj* createSdrPathObjFromPath();
+ SAL_DLLPRIVATE SdrPathObj* createSdrPathObjFromPath(SdrModel& rTargetModel);
SAL_DLLPRIVATE void updateSdrPathObjFromPath( SdrPathObj& rPathObj );
SAL_DLLPRIVATE void updatePathFromSdrPathObj( const SdrPathObj& rPathObj );
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 42af131102c0..5dedec0d3bb4 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -93,6 +93,7 @@ namespace sd {
class SD_DLLPUBLIC SdPage final : public FmFormPage, public SdrObjUserCall
{
SdPage& operator=(const SdPage&) = delete;
+ SdPage(const SdPage&) = delete;
friend class SdGenericDrawPage;
friend class SdDrawPage;
@@ -147,15 +148,14 @@ friend class sd::UndoAttrObject;
sal_Int32 mnTransitionFadeColor;
double mfTransitionDuration;
- SdPage(const SdPage& rSrcPage);
void lateInit(const SdPage& rSrcPage);
public:
SdPage(SdDrawDocument& rNewDoc, bool bMasterPage);
virtual ~SdPage() override;
- virtual SdrPage* Clone() const override;
- virtual SdrPage* Clone(SdrModel* pNewModel) const override;
+
+ virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override;
virtual void SetSize(const Size& aSize) override;
virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr) override;
@@ -163,7 +163,6 @@ public:
virtual void SetRightBorder(sal_Int32 nBorder) override;
virtual void SetUpperBorder(sal_Int32 nBorder) override;
virtual void SetLowerBorder(sal_Int32 nBorder) override;
- virtual void SetModel(SdrModel* pNewModel) override;
virtual bool IsReadOnly() const override;
sd::ShapeList& GetPresentationShapeList() { return maPresentationShapeList; }
@@ -388,6 +387,8 @@ private:
sal_uInt16 mnPageId;
/** clone the animations from this and set them to rTargetPage
+ * TTTT: Order is strange, should be the other way around by
+ * convention/convenience and makes usage a little dangerous...
*/
void cloneAnimations( SdPage& rTargetPage ) const;
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 2d1025db6b61..1473358706fc 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1528,9 +1528,9 @@ bool CustomAnimationEffect::getStopAudio() const
return mnCommand == EffectCommands::STOPAUDIO;
}
-SdrPathObj* CustomAnimationEffect::createSdrPathObjFromPath()
+SdrPathObj* CustomAnimationEffect::createSdrPathObjFromPath(SdrModel& rTargetModel)
{
- SdrPathObj * pPathObj = new SdrPathObj( OBJ_PATHLINE );
+ SdrPathObj * pPathObj = new SdrPathObj(rTargetModel, OBJ_PATHLINE);
updateSdrPathObjFromPath( *pPathObj );
return pPathObj;
}
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index ce442b4f7402..38c6db785f46 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -69,7 +69,7 @@ public:
static sal_uInt32 m_nLastId;
SdPage* GetPage() const { return mpPage; }
- SdrModel* GetModel() { return (mpPage != nullptr) ? mpPage->GetModel() : nullptr; }
+ SdrModel* GetModel() { return (mpPage != nullptr) ? &mpPage->getSdrModelFromSdrPage() : nullptr; }
sal_uInt32 GetId() const { return m_nId; }
// XInterface:
@@ -366,7 +366,7 @@ Reference< XText > SAL_CALL Annotation::getTextRange()
osl::MutexGuard g(m_aMutex);
if( !m_TextRange.is() && (mpPage != nullptr) )
{
- m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( mpPage->GetModel() ) );
+ m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( &mpPage->getSdrModelFromSdrPage() ) );
}
return Reference< XText >( m_TextRange.get() );
}
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index d6335e3671d3..500a88caa103 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -657,22 +657,7 @@ void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode)
}
mbNewOrLoadCompleted = true;
-
- // Update all linked pages
- sal_uInt16 nMaxSdPages = GetSdPageCount(PageKind::Standard);
-
- for (sal_uInt16 nSdPage=0; nSdPage < nMaxSdPages; nSdPage++)
- {
- SdPage* pPage = GetSdPage(nSdPage, PageKind::Standard);
-
- if (pPage && !pPage->GetFileName().isEmpty() && pPage->GetBookmarkName().getLength())
- {
- pPage->SetModel(this);
- }
- }
-
UpdateAllLinks();
-
SetChanged( false );
}
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 9bc68bc98710..00a605697fa8 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -608,7 +608,6 @@ bool SdDrawDocument::InsertBookmarkAsPage(
// Assemble all link names
pPage->SetFileName(aBookmarkName);
pPage->SetBookmarkName(aName);
- pPage->SetModel(this);
}
nActualInsertPos += 2;
@@ -705,7 +704,6 @@ bool SdDrawDocument::InsertBookmarkAsPage(
SdPage* pPage = static_cast<SdPage*>( GetPage(nActualInsertPos) );
pPage->SetFileName(aBookmarkName);
pPage->SetBookmarkName(aPgName);
- pPage->SetModel(this);
}
if (bReplace)
diff --git a/sd/source/core/pglink.cxx b/sd/source/core/pglink.cxx
index 93180e1b906b..6762dcdd9bfa 100644
--- a/sd/source/core/pglink.cxx
+++ b/sd/source/core/pglink.cxx
@@ -57,7 +57,7 @@ SdPageLink::~SdPageLink()
::sfx2::SvBaseLink::UpdateResult SdPageLink::DataChanged(
const OUString&, const css::uno::Any& )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>( pPage->GetModel() );
+ SdDrawDocument* pDoc = static_cast<SdDrawDocument*>( &pPage->getSdrModelFromSdrPage() );
sfx2::LinkManager* pLinkManager = pDoc!=nullptr ? pDoc->GetLinkManager() : nullptr;
if (pLinkManager)
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index ad906e23c556..eed4fa28256c 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -129,6 +129,9 @@ SdPage::SdPage(SdDrawDocument& rNewDoc, bool bMasterPage)
// presentation template of the outline objects. Therefore, it already
// contains the designator for the outline (STR_LAYOUT_OUTLINE).
maLayoutName = SdResId(STR_LAYOUT_DEFAULT_NAME)+ SD_LT_SEPARATOR STR_LAYOUT_OUTLINE;
+
+ // Stuff that former SetModel did also:
+ ConnectLink();
}
namespace
@@ -267,7 +270,7 @@ void SdPage::EnsureMasterPageDefaultBackground()
*/
SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::tools::Rectangle& rRect )
{
- ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr;
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager());
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
SdrObject* pSdrObj = nullptr;
@@ -279,7 +282,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
{
case PRESOBJ_TITLE:
{
- pSdrObj = new SdrRectObj(OBJ_TITLETEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TITLETEXT);
if (mbMaster)
{
@@ -290,7 +293,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_OUTLINE:
{
- pSdrObj = new SdrRectObj(OBJ_OUTLINETEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_OUTLINETEXT);
if (mbMaster)
{
@@ -301,7 +304,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_NOTES:
{
- pSdrObj = new SdrRectObj(OBJ_TEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT);
if (mbMaster)
{
@@ -312,7 +315,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_TEXT:
{
- pSdrObj = new SdrRectObj(OBJ_TEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT);
}
break;
@@ -330,7 +333,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
Size aSize = aOutDev.PixelToLogic(aSizePix);
Point aPnt (0, 0);
::tools::Rectangle aRect (aPnt, aSize);
- pSdrObj = new SdrGrafObj(aGraphic, aRect);
+ pSdrObj = new SdrGrafObj(getSdrModelFromSdrPage(), aGraphic, aRect);
aOutDev.Pop();
}
break;
@@ -338,7 +341,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_MEDIA:
case PRESOBJ_OBJECT:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
BitmapEx aBmpEx(BMP_PRESOBJ_OBJECT);
Graphic aGraphic( aBmpEx );
static_cast<SdrOle2Obj*>(pSdrObj)->SetGraphic(aGraphic);
@@ -347,7 +350,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_CHART:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarChart" );
BitmapEx aBmpEx(BMP_PRESOBJ_CHART);
Graphic aGraphic( aBmpEx );
@@ -357,7 +360,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_ORGCHART:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarOrg" );
BitmapEx aBmpEx(BMP_PRESOBJ_ORGCHART);
Graphic aGraphic( aBmpEx );
@@ -368,7 +371,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_TABLE:
case PRESOBJ_CALC:
{
- pSdrObj = new SdrOle2Obj();
+ pSdrObj = new SdrOle2Obj(getSdrModelFromSdrPage());
static_cast<SdrOle2Obj*>(pSdrObj)->SetProgName( "StarCalc" );
BitmapEx aBmpEx(BMP_PRESOBJ_TABLE);
Graphic aGraphic( aBmpEx );
@@ -381,7 +384,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
// Save the first standard page at SdrPageObj
// #i105146# We want no content to be displayed for PageKind::Handout,
// so just never set a page as content
- pSdrObj = new SdrPageObj(nullptr);
+ pSdrObj = new SdrPageObj(getSdrModelFromSdrPage(), nullptr);
}
break;
@@ -396,13 +399,13 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
nDestPageNum -= 1;
}
- if (pModel && nDestPageNum < pModel->GetPageCount())
+ if (nDestPageNum < getSdrModelFromSdrPage().GetPageCount())
{
- pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum));
+ pSdrObj = new SdrPageObj(getSdrModelFromSdrPage(), getSdrModelFromSdrPage().GetPage(nDestPageNum));
}
else
{
- pSdrObj = new SdrPageObj();
+ pSdrObj = new SdrPageObj(getSdrModelFromSdrPage());
}
pSdrObj->SetResizeProtect(true);
@@ -414,7 +417,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
case PRESOBJ_DATETIME:
case PRESOBJ_SLIDENUMBER:
{
- pSdrObj = new SdrRectObj(OBJ_TEXT);
+ pSdrObj = new SdrRectObj(getSdrModelFromSdrPage(), OBJ_TEXT);
bEmptyPresObj = false;
bForceText = true;
}
@@ -437,7 +440,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
if(bVertical)
static_cast<SdrTextObj*>(pSdrObj)->SetVerticalWriting(true);
- SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool());
if( bVertical )
aTempAttr.Put( makeSdrTextMinFrameWidthItem( rRect.GetSize().Width() ) );
else
@@ -479,7 +482,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
OUString aString = GetPresObjText(eObjKind);
if( (!aString.isEmpty() || bForceText) && dynamic_cast< const SdrTextObj *>( pSdrObj ) != nullptr )
{
- SdrOutliner* pOutliner = static_cast<SdDrawDocument*>( GetModel() )->GetInternalOutliner();
+ SdrOutliner* pOutliner = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetInternalOutliner();
OutlinerMode nOutlMode = pOutliner->GetMode();
pOutliner->Init( OutlinerMode::TextObject );
@@ -494,7 +497,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
if( (eObjKind == PRESOBJ_HEADER) || (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_DATETIME) )
{
- SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool());
aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT ) );
aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CTL ) );
aTempAttr.Put( SvxFontHeightItem( 493, 100, EE_CHAR_FONTHEIGHT_CJK ) );
@@ -522,7 +525,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
if (mbMaster)
{
- SdrLayerAdmin& rLayerAdmin = pModel->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin(getSdrModelFromSdrPage().GetLayerAdmin());
// background objects of the master page
pSdrObj->SetLayer( rLayerAdmin.
@@ -543,7 +546,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
{
OUString aName( maLayoutName + " " + OUString::number( nLevel ) );
- SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pModel->GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page));
+ SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page));
DBG_ASSERT(pSheet, "StyleSheet for outline object not found");
if (pSheet)
pSdrObj->StartListening(*pSheet);
@@ -556,7 +559,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
eObjKind == PRESOBJ_CALC ||
eObjKind == PRESOBJ_GRAPHIC )
{
- SfxItemSet aSet( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aSet( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() );
aSet.Put( makeSdrTextContourFrameItem( true ) );
aSet.Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) );
@@ -565,7 +568,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
if( bUndo )
{
- pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
+ pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoNewObject(*pSdrObj));
}
if( bUndo )
@@ -604,7 +607,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForMasterPageBackground() const
aName += STR_LAYOUT_BACKGROUND;
- SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
SfxStyleSheetBase* pResult = pStShPool->Find(aName, SfxStyleFamily::Page);
return static_cast<SfxStyleSheet*>(pResult);
}
@@ -651,7 +654,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const
break;
}
- SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
SfxStyleSheetBase* pResult = pStShPool->Find(aName, SfxStyleFamily::Page);
return static_cast<SfxStyleSheet*>(pResult);
}
@@ -696,7 +699,7 @@ SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const
aStyleName += OUString::number( sal_Int32( nHelpId - HID_PSEUDOSHEET_OUTLINE ));
}
- SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
SfxStyleSheetBase* pResult = pStShPool->Find(aStyleName, SfxStyleFamily::Page);
return dynamic_cast<SdStyleSheet*>(pResult);
}
@@ -718,7 +721,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools
case SdrUserCallType::MoveOnly:
case SdrUserCallType::Resize:
{
- if (!pModel || pModel->isLocked())
+ if ( getSdrModelFromSdrPage().isLocked())
break;
SdrObject* pObj = const_cast<SdrObject*>(&rObj);
@@ -729,7 +732,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools
{
if( pObj->GetUserCall() )
{
- ::svl::IUndoManager* pUndoManager = static_cast<SdDrawDocument*>(pModel)->GetUndoManager();
+ ::svl::IUndoManager* pUndoManager = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager();
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
if( bUndo )
@@ -743,11 +746,11 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools
{
// Object of the master page changed, therefore adjust
// object on all pages
- sal_uInt16 nPageCount = static_cast<SdDrawDocument*>(pModel)->GetSdPageCount(mePageKind);
+ sal_uInt16 nPageCount = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPageCount(mePageKind);
for (sal_uInt16 i = 0; i < nPageCount; i++)
{
- SdPage* pLoopPage = static_cast<SdDrawDocument*>(pModel)->GetSdPage(i, mePageKind);
+ SdPage* pLoopPage = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPage(i, mePageKind);
if (pLoopPage && this == &(pLoopPage->TRG_GetMasterPage()))
{
@@ -777,7 +780,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const ::tools
void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
{
- ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr;
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager());
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
SdPage* pMasterPage = this;
@@ -800,7 +803,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
pMasterPage->EnsureMasterPageDefaultBackground();
}
- if (GetModel() && static_cast<SdDrawDocument*>(GetModel())->GetDocumentType() == DocumentType::Impress)
+ if (static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDocumentType() == DocumentType::Impress)
{
if( mePageKind == PageKind::Handout && bInit )
{
@@ -814,7 +817,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
if( bUndo )
{
- pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+ pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
}
else
{
@@ -823,7 +826,7 @@ void SdPage::CreateTitleAndLayout(bool bInit, bool bCreate )
}
std::vector< ::tools::Rectangle > aAreas;
- CalculateHandoutAreas( *static_cast< SdDrawDocument* >(GetModel() ), pMasterPage->GetAutoLayout(), false, aAreas );
+ CalculateHandoutAreas( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()), pMasterPage->GetAutoLayout(), false, aAreas );
const bool bSkip = pMasterPage->GetAutoLayout() == AUTOLAYOUT_HANDOUT3;
std::vector< ::tools::Rectangle >::iterator iter( aAreas.begin() );
@@ -897,7 +900,7 @@ void getPresObjProp( const SdPage& rPage, const char* sObjKind, const char* sPag
{
bool bNoObjectFound = true; //used to break from outer loop
- const std::vector< Reference<XNode> >& objectInfo = static_cast<const SdDrawDocument*>(rPage.GetModel())->GetObjectVector();
+ const std::vector< Reference<XNode> >& objectInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetObjectVector();
for( std::vector< Reference<XNode> >::const_iterator aIter=objectInfo.begin(); aIter != objectInfo.end(); ++aIter )
{
if(bNoObjectFound)
@@ -1047,8 +1050,7 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
if( pObject )
{
- SdDrawDocument *pDoc = static_cast<SdDrawDocument*>(pModel);
-
+ SdDrawDocument* pDoc(static_cast< SdDrawDocument* >(&getSdrModelFromSdrPage()));
const bool bUndo = pDoc->IsUndoEnabled();
if( bUndo )
pDoc->AddUndo(pDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject));
@@ -1113,9 +1115,9 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind)
nDestPageNum -= 1;
}
- if(nDestPageNum < pModel->GetPageCount())
+ if(nDestPageNum < getSdrModelFromSdrPage().GetPageCount())
{
- pRefPage = pModel->GetPage(nDestPageNum);
+ pRefPage = getSdrModelFromSdrPage().GetPage(nDestPageNum);
}
if ( pRefPage )
@@ -1362,7 +1364,7 @@ static void CalcAutoLayoutRectangles( SdPage const & rPage,::tools::Rectangle* r
const Point aLayoutPos( aLayoutRect.TopLeft() );
double propvalue[] = {0,0,0,0};
- const std::vector< Reference<XNode> >& layoutInfo = static_cast<const SdDrawDocument*>(rPage.GetModel())->GetLayoutVector();
+ const std::vector< Reference<XNode> >& layoutInfo = static_cast< const SdDrawDocument& >(rPage.getSdrModelFromSdrPage()).GetLayoutVector();
for( std::vector< Reference<XNode> >::const_iterator aIter=layoutInfo.begin(); aIter != layoutInfo.end(); ++aIter )
{
Reference<XNode> layoutNode = *aIter;
@@ -1521,10 +1523,10 @@ void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescripto
{
if( pOle2->IsEmpty() )
bFound = true;
- else if( rPage.GetModel() )
+ else
{
- SdrModel* pSdrModel = rPage.GetModel();
- ::comphelper::IEmbeddedHelper *pPersist = pSdrModel->GetPersist();
+ ::comphelper::IEmbeddedHelper* pPersist(rPage.getSdrModelFromSdrPage().GetPersist());
+
if( pPersist )
{
uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
@@ -1598,7 +1600,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool bInit, bool bCreate )
const bool bSwitchLayout = eLayout != GetAutoLayout();
- ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : nullptr;
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager());
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
meAutoLayout = eLayout;
@@ -1647,7 +1649,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool bInit, bool bCreate )
if( pObj->IsEmptyPresObj() )
{
if( bUndo )
- pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+ pUndoManager->AddUndoAction(getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
RemoveObject( pObj->GetOrdNum() );
@@ -1670,7 +1672,7 @@ void SdPage::NbcInsertObject(SdrObject* pObj, size_t nPos)
{
FmFormPage::NbcInsertObject(pObj, nPos);
- static_cast<SdDrawDocument*>(pModel)->InsertObject(pObj);
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).InsertObject(pObj);
SdrLayerID nId = pObj->GetLayer();
if( mbMaster )
@@ -1733,8 +1735,7 @@ void SdPage::onRemoveObject( SdrObject* pObject )
{
RemovePresObj(pObject);
- if( pModel )
- static_cast<SdDrawDocument*>(pModel)->RemoveObject(pObject);
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).RemoveObject(pObject);
removeAnimations( pObject );
}
@@ -1956,7 +1957,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN
for (sal_Int32 i=1; i<=9; i++)
{
OUString sLayoutName( aName + OUString::number( i ) );
- SfxStyleSheet* pOutlineSheet = static_cast<SfxStyleSheet*>(static_cast<SdDrawDocument*>(pModel)->GetStyleSheetPool()->Find(sLayoutName, SfxStyleFamily::Page));
+ SfxStyleSheet* pOutlineSheet = static_cast<SfxStyleSheet*>(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetStyleSheetPool()->Find(sLayoutName, SfxStyleFamily::Page));
if (pOutlineSheet)
{
@@ -2077,12 +2078,11 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN
SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, PresObjKind& eObjKind, bool bVertical, const ::tools::Rectangle& rRect)
{
- SdDrawDocument* pModel = static_cast< SdDrawDocument* >( rPage.GetModel() );
- DBG_ASSERT( pModel, "sd::convertPresentationObjectImpl(), no model on page!" );
- if( !pModel || !pSourceObj )
+ SdDrawDocument& rModel(static_cast< SdDrawDocument& >(rPage.getSdrModelFromSdrPage()));
+ if( !pSourceObj )
return pSourceObj;
- ::svl::IUndoManager* pUndoManager = pModel->GetUndoManager();
+ ::svl::IUndoManager* pUndoManager = rModel.GetUndoManager();
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && rPage.IsInserted();
SdrObject* pNewObj = pSourceObj;
@@ -2096,7 +2096,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
if(pOutlParaObj)
{
// assign text
- SdOutliner* pOutl = pModel->GetInternalOutliner();
+ SdOutliner* pOutl = rModel.GetInternalOutliner();
pOutl->Clear();
pOutl->SetText( *pOutlParaObj );
pOutlParaObj = pOutl->CreateParaObject();
@@ -2108,7 +2108,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
{
// assign new template
OUString aName( rPage.GetLayoutName() + " " + OUString::number( nLevel ) );
- SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pModel->GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) );
+ SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( rModel.GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) );
if (pSheet)
{
@@ -2125,7 +2125,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
}
// Remove LRSpace item
- SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
+ SfxItemSet aSet(rModel.GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
aSet.Put(pNewObj->GetMergedItemSet());
@@ -2134,7 +2134,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
pNewObj->SetMergedItemSet(aSet);
if( bUndo )
- pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) );
+ pUndoManager->AddUndoAction( rModel.GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj) );
// Remove outline shape from page
rPage.RemoveObject( pSourceObj->GetOrdNum() );
@@ -2154,7 +2154,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
if(pOutlParaObj)
{
// assign text
- SdOutliner* pOutl = pModel->GetInternalOutliner();
+ SdOutliner* pOutl = rModel.GetInternalOutliner();
pOutl->Clear();
pOutl->SetText( *pOutlParaObj );
pOutlParaObj = pOutl->CreateParaObject();
@@ -2163,7 +2163,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
pNewObj->SetEmptyPresObj(false);
// reset left indent
- SfxItemSet aSet(pModel->GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
+ SfxItemSet aSet(rModel.GetPool(), svl::Items<EE_PARA_LRSPACE, EE_PARA_LRSPACE>{} );
aSet.Put(pNewObj->GetMergedItemSet());
@@ -2180,7 +2180,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
// Remove subtitle shape from page
if( bUndo )
- pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj));
+ pUndoManager->AddUndoAction(rModel.GetSdrUndoFactory().CreateUndoDeleteObject(*pSourceObj));
rPage.RemoveObject( pSourceObj->GetOrdNum() );
@@ -2220,7 +2220,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P
*/
SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, const ::tools::Rectangle& rRect, bool bInit)
{
- ::svl::IUndoManager* pUndoManager = static_cast<SdDrawDocument*>(pModel)->GetUndoManager();
+ ::svl::IUndoManager* pUndoManager(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetUndoManager());
const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
if (!pObj && bInit)
@@ -2235,8 +2235,8 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind,
if( bUndo )
{
- pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
- pUndoManager->AddUndoAction( pModel->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, true, true ) );
+ pUndoManager->AddUndoAction( getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
+ pUndoManager->AddUndoAction( getSdrModelFromSdrPage().GetSdrUndoFactory().CreateUndoAttrObject( *pObj, true, true ) );
pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) );
}
@@ -2262,7 +2262,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind,
if ( pTextObject->IsAutoGrowHeight() )
{
// switch off AutoGrowHeight, set new MinHeight
- SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() );
SdrMetricItem aMinHeight( makeSdrTextMinFrameHeightItem(rRect.GetSize().Height()) );
aTempAttr.Put( aMinHeight );
aTempAttr.Put( makeSdrTextAutoGrowHeightItem(false) );
@@ -2270,7 +2270,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind,
pTextObject->SetLogicRect(rRect);
// switch on AutoGrowHeight
- SfxItemSet aAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() );
aAttr.Put( makeSdrTextAutoGrowHeightItem(true) );
pTextObject->SetMergedItemSet(aAttr);
@@ -2279,7 +2279,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind,
if ( pTextObject->IsAutoGrowWidth() )
{
// switch off AutoGrowWidth , set new MinWidth
- SfxItemSet aTempAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aTempAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() );
SdrMetricItem aMinWidth( makeSdrTextMinFrameWidthItem(rRect.GetSize().Width()) );
aTempAttr.Put( aMinWidth );
aTempAttr.Put( makeSdrTextAutoGrowWidthItem(false) );
@@ -2287,7 +2287,7 @@ SdrObject* SdPage::InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind,
pTextObject->SetLogicRect(rRect);
// switch on AutoGrowWidth
- SfxItemSet aAttr( static_cast<SdDrawDocument*>(pModel)->GetPool() );
+ SfxItemSet aAttr( static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetPool() );
aAttr.Put( makeSdrTextAutoGrowWidthItem(true) );
pTextObject->SetMergedItemSet(aAttr);
}
@@ -2389,11 +2389,11 @@ void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eO
if (!pOutliner)
{
- SfxItemPool* pPool = static_cast<SdDrawDocument*>(GetModel())->GetDrawOutliner().GetEmptyItemSet().GetPool();
+ SfxItemPool* pPool(static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDrawOutliner().GetEmptyItemSet().GetPool());
pOutl = new ::Outliner( pPool, OutlinerMode::OutlineObject );
pOutl->SetRefDevice( SD_MOD()->GetVirtualRefDevice() );
pOutl->SetEditTextObjectPool(pPool);
- pOutl->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(GetModel()->GetStyleSheetPool()));
+ pOutl->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(getSdrModelFromSdrPage().GetStyleSheetPool()));
pOutl->EnableUndo(false);
pOutl->SetUpdateMode( false );
}
@@ -2549,7 +2549,7 @@ const OUString& SdPage::GetName() const
aCreatedPageName = SdResId(STR_PAGE);
aCreatedPageName += " ";
- if( GetModel()->GetPageNumType() == css::style::NumberingType::NUMBER_NONE )
+ if( getSdrModelFromSdrPage().GetPageNumType() == css::style::NumberingType::NUMBER_NONE )
{
// if the document has number none as a formatting
// for page numbers we still default to arabic numbering
@@ -2558,7 +2558,7 @@ const OUString& SdPage::GetName() const
}
else
{
- aCreatedPageName += static_cast<SdDrawDocument*>(GetModel())->CreatePageNumValue(nNum);
+ aCreatedPageName += static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).CreatePageNumValue(nNum);
}
}
else
@@ -2721,7 +2721,7 @@ void SdPage::SetName (const OUString& rName)
{
OUString aOldName( GetName() );
FmFormPage::SetName (rName);
- static_cast<SdDrawDocument*>(pModel)->UpdatePageRelativeURLs(aOldName, rName);
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).UpdatePageRelativeURLs(aOldName, rName);
ActionChanged();
}
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 61fd29db97f7..3b6e42fd7b95 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -95,13 +95,13 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName,
SdPage* pMaster;
SdPage* pFoundMaster = nullptr;
sal_uInt16 nMaster = 0;
- sal_uInt16 nMasterCount = pModel->GetMasterPageCount();
+ sal_uInt16 nMasterCount = getSdrModelFromSdrPage().GetMasterPageCount();
if( !bReverseOrder )
{
for ( nMaster = 0; nMaster < nMasterCount; nMaster++ )
{
- pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster));
+ pMaster = static_cast<SdPage*>(getSdrModelFromSdrPage().GetMasterPage(nMaster));
if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
{
pFoundMaster = pMaster;
@@ -113,7 +113,7 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName,
{
for ( nMaster = nMasterCount; nMaster > 0; nMaster-- )
{
- pMaster = static_cast<SdPage*>(pModel->GetMasterPage(nMaster - 1));
+ pMaster = static_cast<SdPage*>(getSdrModelFromSdrPage().GetMasterPage(nMaster - 1));
if (pMaster->GetPageKind() == mePageKind && pMaster->GetLayoutName() == maLayoutName)
{
pFoundMaster = pMaster;
@@ -126,7 +126,7 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName,
// this should never happen, but we play failsafe here
if( pFoundMaster == nullptr )
- pFoundMaster = static_cast< SdDrawDocument *>(pModel)->GetSdPage( 0, mePageKind );
+ pFoundMaster = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetSdPage( 0, mePageKind );
if( pFoundMaster )
TRG_SetMasterPage(*pFoundMaster);
@@ -157,7 +157,7 @@ void SdPage::SetPresentationLayout(const OUString& rLayoutName,
OUString aFullName;
OUString aOldFullName;
SfxStyleSheetBase* pSheet = nullptr;
- SfxStyleSheetBasePool* pStShPool = pModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStShPool = getSdrModelFromSdrPage().GetStyleSheetPool();
for (sal_Int16 i = -1; i < 9; i++)
{
@@ -261,7 +261,7 @@ void SdPage::EndListenOutlineText()
if (pOutlineTextObj)
{
- SdStyleSheetPool* pSPool = static_cast<SdStyleSheetPool*>(pModel->GetStyleSheetPool());
+ SdStyleSheetPool* pSPool = static_cast<SdStyleSheetPool*>(getSdrModelFromSdrPage().GetStyleSheetPool());
DBG_ASSERT(pSPool, "StyleSheetPool missing");
OUString aTrueLayoutName(maLayoutName);
sal_Int32 nIndex = aTrueLayoutName.indexOf( SD_LT_SEPARATOR );
@@ -282,22 +282,6 @@ void SdPage::EndListenOutlineText()
/*************************************************************************
|*
-|* Set new model
-|*
-\************************************************************************/
-
-void SdPage::SetModel(SdrModel* pNewModel)
-{
- DisconnectLink();
-
- // assign model
- FmFormPage::SetModel(pNewModel);
-
- ConnectLink();
-}
-
-/*************************************************************************
-|*
|* Is this page read-only?
|*
\************************************************************************/
@@ -315,17 +299,17 @@ bool SdPage::IsReadOnly() const
void SdPage::ConnectLink()
{
- sfx2::LinkManager* pLinkManager = pModel!=nullptr ? pModel->GetLinkManager() : nullptr;
+ sfx2::LinkManager* pLinkManager(getSdrModelFromSdrPage().GetLinkManager());
if (pLinkManager && !mpPageLink && !maFileName.isEmpty() && !maBookmarkName.isEmpty() &&
mePageKind==PageKind::Standard && !IsMasterPage() &&
- static_cast<SdDrawDocument*>(pModel)->IsNewOrLoadCompleted())
+ static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).IsNewOrLoadCompleted())
{
/**********************************************************************
* Connect
* Only standard pages are allowed to be linked
**********************************************************************/
- ::sd::DrawDocShell* pDocSh = static_cast<SdDrawDocument*>(pModel)->GetDocSh();
+ ::sd::DrawDocShell* pDocSh = static_cast< SdDrawDocument& >(getSdrModelFromSdrPage()).GetDocSh();
if (!pDocSh || pDocSh->GetMedium()->GetOrigURL() != maFileName)
{
@@ -347,7 +331,7 @@ void SdPage::ConnectLink()
void SdPage::DisconnectLink()
{
- sfx2::LinkManager* pLinkManager = pModel!=nullptr ? pModel->GetLinkManager() : nullptr;
+ sfx2::LinkManager* pLinkManager(getSdrModelFromSdrPage().GetLinkManager());
if (pLinkManager && mpPageLink)
{
@@ -360,57 +344,41 @@ void SdPage::DisconnectLink()
}
}
-/*************************************************************************
-|*
-|* Copy-Ctor
-|*
-\************************************************************************/
-
-SdPage::SdPage(const SdPage& rSrcPage)
-: FmFormPage(rSrcPage)
-, SdrObjUserCall()
-, mpItems(nullptr)
-, mnPageId(mnLastPageId++)
+void SdPage::lateInit(const SdPage& rSrcPage)
{
- mePageKind = rSrcPage.mePageKind;
- meAutoLayout = rSrcPage.meAutoLayout;
+ // call parent
+ FmFormPage::lateInit(rSrcPage);
- mbSelected = false;
- mnTransitionType = rSrcPage.mnTransitionType;
+ // copy local variables (former stuff from copy constructor)
+ mePageKind = rSrcPage.mePageKind;
+ meAutoLayout = rSrcPage.meAutoLayout;
+ mbSelected = false;
+ mnTransitionType = rSrcPage.mnTransitionType;
mnTransitionSubtype = rSrcPage.mnTransitionSubtype;
mbTransitionDirection = rSrcPage.mbTransitionDirection;
mnTransitionFadeColor = rSrcPage.mnTransitionFadeColor;
mfTransitionDuration = rSrcPage.mfTransitionDuration;
- mePresChange = rSrcPage.mePresChange;
- mfTime = rSrcPage.mfTime;
- mbSoundOn = rSrcPage.mbSoundOn;
- mbExcluded = rSrcPage.mbExcluded;
-
- maLayoutName = rSrcPage.maLayoutName;
- maSoundFile = rSrcPage.maSoundFile;
- mbLoopSound = rSrcPage.mbLoopSound;
- mbStopSound = rSrcPage.mbStopSound;
+ mePresChange = rSrcPage.mePresChange;
+ mfTime = rSrcPage.mfTime;
+ mbSoundOn = rSrcPage.mbSoundOn;
+ mbExcluded = rSrcPage.mbExcluded;
+ maLayoutName = rSrcPage.maLayoutName;
+ maSoundFile = rSrcPage.maSoundFile;
+ mbLoopSound = rSrcPage.mbLoopSound;
+ mbStopSound = rSrcPage.mbStopSound;
maCreatedPageName.clear();
- maFileName = rSrcPage.maFileName;
- maBookmarkName = rSrcPage.maBookmarkName;
- mbScaleObjects = rSrcPage.mbScaleObjects;
+ maFileName = rSrcPage.maFileName;
+ maBookmarkName = rSrcPage.maBookmarkName;
+ mbScaleObjects = rSrcPage.mbScaleObjects;
mbBackgroundFullSize = rSrcPage.mbBackgroundFullSize;
- meCharSet = rSrcPage.meCharSet;
- mnPaperBin = rSrcPage.mnPaperBin;
-
- mpPageLink = nullptr; // is set when inserting via ConnectLink()
-
- mbIsPrecious = false;
-}
-
-void SdPage::lateInit(const SdPage& rSrcPage)
-{
- FmFormPage::lateInit(rSrcPage);
+ meCharSet = rSrcPage.meCharSet;
+ mnPaperBin = rSrcPage.mnPaperBin;
+ mpPageLink = nullptr; // is set when inserting via ConnectLink()
+ mbIsPrecious = false;
// use shape list directly to preserve constness of rSrcPage
const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList();
- for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin();
- aIter != rShapeList.end(); ++aIter )
+ for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin(); aIter != rShapeList.end(); ++aIter )
{
SdrObject* pObj = *aIter;
InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
@@ -418,31 +386,13 @@ void SdPage::lateInit(const SdPage& rSrcPage)
// header footer
setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() );
-}
-
-/*************************************************************************
-|*
-|* Clone
-|*
-\************************************************************************/
-SdrPage* SdPage::Clone() const
-{
- return Clone(nullptr);
-}
-
-SdrPage* SdPage::Clone(SdrModel* pNewModel) const
-{
- DBG_ASSERT( pNewModel == nullptr, "sd::SdPage::Clone(), new page ignored, please check code! CL" );
-
- SdPage* pNewPage = new SdPage(*this);
- pNewPage->lateInit( *this );
-
- cloneAnimations( *pNewPage );
+ // animations
+ rSrcPage.cloneAnimations(*this);
// fix user calls for duplicated slide
- SdrObjListIter aSourceIter( *this, SdrIterMode::DeepWithGroups );
- SdrObjListIter aTargetIter( *pNewPage, SdrIterMode::DeepWithGroups );
+ SdrObjListIter aSourceIter( rSrcPage, SdrIterMode::DeepWithGroups );
+ SdrObjListIter aTargetIter( *this, SdrIterMode::DeepWithGroups );
while( aSourceIter.IsMore() && aTargetIter.IsMore() )
{
@@ -450,10 +400,25 @@ SdrPage* SdPage::Clone(SdrModel* pNewModel) const
SdrObject* pTarget = aTargetIter.Next();
if( pSource->GetUserCall() )
- pTarget->SetUserCall( pNewPage );
+ pTarget->SetUserCall(this);
}
+}
- return pNewPage;
+/*************************************************************************
+|*
+|* Clone
+|*
+\************************************************************************/
+
+SdrPage* SdPage::Clone(SdrModel* pNewModel) const
+{
+ SdDrawDocument& rSdDrawDocument(static_cast< SdDrawDocument& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel));
+ SdPage* pClonedSdPage(
+ new SdPage(
+ rSdDrawDocument,
+ IsMasterPage()));
+ pClonedSdPage->lateInit(*this);
+ return pClonedSdPage;
}
/*************************************************************************
@@ -476,7 +441,7 @@ SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
SfxItemSet* SdPage::getOrCreateItems()
{
if( mpItems == nullptr )
- mpItems = o3tl::make_unique<SfxItemSet>( pModel->GetItemPool(), svl::Items<SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES>{} );
+ mpItems = o3tl::make_unique<SfxItemSet>( getSdrModelFromSdrPage().GetItemPool(), svl::Items<SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES>{} );
return mpItems.get();
}
@@ -604,40 +569,37 @@ void SdPage::addAnnotation( const Reference< XAnnotation >& xAnnotation, int nIn
maAnnotations.insert( maAnnotations.begin() + nIndex, xAnnotation );
}
- if( pModel && pModel->IsUndoEnabled() )
+ if( getSdrModelFromSdrPage().IsUndoEnabled() )
{
SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, true );
if( pAction )
- pModel->AddUndo( pAction );
+ getSdrModelFromSdrPage().AddUndo( pAction );
}
SetChanged();
-
- if( pModel )
- {
- pModel->SetChanged();
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationInserted", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
- }
+ getSdrModelFromSdrPage().SetChanged();
+ // TTTT NotifyDocumentEvent should be reference
+ NotifyDocumentEvent(
+ static_cast< SdDrawDocument* >(&getSdrModelFromSdrPage()),
+ "OnAnnotationInserted",
+ Reference<XInterface>(xAnnotation, UNO_QUERY));
}
void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
{
- if( pModel && pModel->IsUndoEnabled() )
+ if( getSdrModelFromSdrPage().IsUndoEnabled() )
{
SdrUndoAction* pAction = CreateUndoInsertOrRemoveAnnotation( xAnnotation, false );
if( pAction )
- pModel->AddUndo( pAction );
+ getSdrModelFromSdrPage().AddUndo( pAction );
}
AnnotationVector::iterator iter = std::find( maAnnotations.begin(), maAnnotations.end(), xAnnotation );
if( iter != maAnnotations.end() )
maAnnotations.erase( iter );
- if( pModel )
- {
- pModel->SetChanged();
- NotifyDocumentEvent( static_cast< SdDrawDocument* >( pModel ), "OnAnnotationRemoved", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
- }
+ getSdrModelFromSdrPage().SetChanged();
+ NotifyDocumentEvent( static_cast< SdDrawDocument* >( &getSdrModelFromSdrPage() ), "OnAnnotationRemoved", Reference<XInterface>( xAnnotation, UNO_QUERY ) );
}
void SdPage::dumpAsXml(xmlTextWriterPtr pWriter) const
diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx
index 6b3a4e80876e..d8db1329af56 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -58,7 +58,10 @@ UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject )
css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY );
if( pPage->getMainSequence()->hasEffect( xShape ) )
{
- mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) );
+ mpUndoAnimation.reset(
+ new UndoAnimation( // TTTT may use ref? Or just *SdrPage?
+ static_cast< SdDrawDocument* >(&pPage->getSdrModelFromSdrPage()),
+ pPage));
}
}
}
@@ -180,7 +183,10 @@ UndoObjectSetText::UndoObjectSetText( SdrObject& rObject, sal_Int32 nText )
css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY );
if( pPage->getMainSequence()->hasEffect( xShape ) )
{
- mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) );
+ mpUndoAnimation.reset(
+ new UndoAnimation(
+ static_cast< SdDrawDocument* >(&pPage->getSdrModelFromSdrPage()),
+ pPage));
}
}
}
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index 522f2bab8fc4..985d625b04d2 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -163,62 +163,66 @@ bool SdGRFFilter::Import()
const sal_uInt16 nFilter = rGraphicFilter.GetImportFormatNumberForTypeName( mrMedium.GetFilter()->GetTypeName() );
bool bRet = false;
- SvStream* pIStm = mrMedium.GetInStream();
- ErrCode nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : ErrCode(1);
+ SvStream* pIStm = mrMedium.GetInStream();
+ ErrCode nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : ErrCode(1);
- if( nReturn )
- HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError );
- else
- {
- if( mrDocument.GetPageCount() == 0 )
- mrDocument.CreateFirstPages();
+ if( nReturn )
+ HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError );
+ else
+ {
+ if( mrDocument.GetPageCount() == 0 )
+ mrDocument.CreateFirstPages();
- SdPage* pPage = mrDocument.GetSdPage( 0, PageKind::Standard );
- Point aPos;
- Size aPagSize( pPage->GetSize() );
- Size aGrfSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
- aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)));
+ SdPage* pPage = mrDocument.GetSdPage( 0, PageKind::Standard );
+ Point aPos;
+ Size aPagSize( pPage->GetSize() );
+ Size aGrfSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(),
+ aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)));
- aPagSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) );
- aPagSize.AdjustHeight( -(pPage->GetUpperBorder() + pPage->GetLowerBorder()) );
+ aPagSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) );
+ aPagSize.AdjustHeight( -(pPage->GetUpperBorder() + pPage->GetLowerBorder()) );
- // scale to fit page
- if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() > aPagSize.Width() ) ) &&
- aGrfSize.Height() && aPagSize.Height() )
- {
- double fGrfWH = static_cast<double>(aGrfSize.Width()) / aGrfSize.Height();
- double fWinWH = static_cast<double>(aPagSize.Width()) / aPagSize.Height();
+ // scale to fit page
+ if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() > aPagSize.Width() ) ) &&
+ aGrfSize.Height() && aPagSize.Height() )
+ {
+ double fGrfWH = static_cast<double>(aGrfSize.Width()) / aGrfSize.Height();
+ double fWinWH = static_cast<double>(aPagSize.Width()) / aPagSize.Height();
- // adjust graphic to page size (scales)
- if( fGrfWH < fWinWH )
- {
- aGrfSize.setWidth( static_cast<long>( aPagSize.Height() * fGrfWH ) );
- aGrfSize.setHeight( aPagSize.Height() );
- }
- else if( fGrfWH > 0.F )
- {
- aGrfSize.setWidth( aPagSize.Width() );
- aGrfSize.setHeight( static_cast<long>( aPagSize.Width() / fGrfWH ) );
- }
+ // adjust graphic to page size (scales)
+ if( fGrfWH < fWinWH )
+ {
+ aGrfSize.setWidth( static_cast<long>( aPagSize.Height() * fGrfWH ) );
+ aGrfSize.setHeight( aPagSize.Height() );
}
+ else if( fGrfWH > 0.F )
+ {
+ aGrfSize.setWidth( aPagSize.Width() );
+ aGrfSize.setHeight( static_cast<long>( aPagSize.Width() / fGrfWH ) );
+ }
+ }
- // set output rectangle for graphic
- aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLeftBorder() );
- aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUpperBorder() );
+ // set output rectangle for graphic
+ aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLeftBorder() );
+ aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUpperBorder() );
+
+ pPage->InsertObject(
+ new SdrGrafObj(
+ pPage->getSdrModelFromSdrPage(),
+ aGraphic,
+ ::tools::Rectangle(aPos, aGrfSize)));
+ bRet = true;
+ }
- pPage->InsertObject( new SdrGrafObj( aGraphic, ::tools::Rectangle( aPos, aGrfSize ) ) );
- bRet = true;
- }
return bRet;
}
bool SdGRFFilter::Export()
{
// SJ: todo: error handling, the GraphicExportFilter does not support proper errorhandling
-
bool bRet = false;
- uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
uno::Reference< drawing::XGraphicExportFilter > xExporter = drawing::GraphicExportFilter::create( xContext );
SdPage* pPage = nullptr;
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index d93fa3dd8280..056b2924a6ba 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2688,8 +2688,9 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
aMediaURL = ReadSound( nRef );
if ( !aMediaURL.isEmpty() )
{
- SdrMediaObj* pMediaObj = new SdrMediaObj( pObj->GetSnapRect() );
- pMediaObj->SetModel( pObj->GetModel() );
+ SdrMediaObj* pMediaObj = new SdrMediaObj(
+ pObj->getSdrModelFromSdrObject(),
+ pObj->GetSnapRect());
pMediaObj->SetMergedItemSet( pObj->GetMergedItemSet() );
//--remove object from maAnimations list and add the new object instead
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 373f25149d87..c54d991ba42a 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -316,7 +316,7 @@ MotionPathTag::MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, con
, msLastPath( pEffect->getPath() )
, mbInUpdatePath( false )
{
- mpPathObj = mpEffect->createSdrPathObjFromPath();
+ mpPathObj = mpEffect->createSdrPathObjFromPath(rView.getSdrModelFromSdrView());
mxPolyPoly = mpPathObj->GetPathPoly();
if (mxOrigin.is())
maOriginPos = mxOrigin->getPosition();
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index e9d185c58758..37a862294b29 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -160,7 +160,7 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
const SdrTextObj* pTextObj = pSdrOutliner->GetTextObj();
if( pTextObj )
- pDoc = dynamic_cast< SdDrawDocument* >( pTextObj->GetModel() );
+ pDoc = dynamic_cast< SdDrawDocument* >( &pTextObj->getSdrModelFromSdrObject() );
if( pDoc )
pDocShell = pDoc->GetDocSh();
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index a9b324d1fd24..5ca6bab37ebd 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -777,12 +777,8 @@ void AnimationWindow::AddObj (::sd::View& rView )
for( size_t nObject = 0; nObject < pObjList->GetObjCount(); ++nObject )
{
- SdrObject* pSnapShot = pObjList->GetObj( nObject );
-
- BitmapEx *const pBitmapEx = new BitmapEx(
- SdrExchangeView::GetObjGraphic(
- pSnapShot->GetModel(), pSnapShot).GetBitmapEx() );
-
+ SdrObject* pSnapShot(pObjList->GetObj(nObject));
+ BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pSnapShot).GetBitmapEx());
::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() );
size_t nIndex = m_nCurrentFrame + 1;
m_FrameList.insert(
@@ -830,14 +826,9 @@ void AnimationWindow::AddObj (::sd::View& rView )
for( size_t nObject= 0; nObject < nMarkCount; ++nObject )
{
// Clone
- SdrObject* pObject = rMarkList.GetMark( nObject )->GetMarkedSdrObj();
-
- BitmapEx *const pBitmapEx = new BitmapEx(
- SdrExchangeView::GetObjGraphic(
- pObject->GetModel(), pObject).GetBitmapEx() );
-
+ SdrObject* pObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj());
+ BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pObject).GetBitmapEx());
::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() );
-
size_t nIndex = m_nCurrentFrame + 1;
m_FrameList.insert(
m_FrameList.begin() + nIndex,
@@ -852,7 +843,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
}
else
{
- SdrObjGroup* pCloneGroup = new SdrObjGroup;
+ SdrObjGroup* pCloneGroup = new SdrObjGroup(rView.getSdrModelFromSdrView());
SdrObjList* pObjList = pCloneGroup->GetSubList();
for (size_t nObject= 0; nObject < nMarkCount; ++nObject)
@@ -1000,7 +991,9 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView )
aAnimation.SetLoopCount( nLoopCount );
}
- SdrGrafObj* pGrafObj = new SdrGrafObj( Graphic( aAnimation ) );
+ SdrGrafObj* pGrafObj = new SdrGrafObj(
+ rView.getSdrModelFromSdrView(),
+ Graphic(aAnimation));
const Point aOrg( aWindowCenter.X() - ( aMaxSizeLog.Width() >> 1 ), aWindowCenter.Y() - ( aMaxSizeLog.Height() >> 1 ) );
pGrafObj->SetLogicRect( ::tools::Rectangle( aOrg, aMaxSizeLog ) );
@@ -1073,7 +1066,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView )
if(pTargetSdPage)
{
// create animation group
- SdrObjGroup* pGroup = new SdrObjGroup;
+ SdrObjGroup* pGroup = new SdrObjGroup(rView.getSdrModelFromSdrView());
SdrObjList* pObjList = pGroup->GetSubList();
for (size_t i = 0; i < nCount; ++i)
diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx
index 5fe097765688..f74db13144eb 100644
--- a/sd/source/ui/func/fucon3d.cxx
+++ b/sd/source/ui/func/fucon3d.cxx
@@ -89,6 +89,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
case SID_3D_CUBE:
{
p3DObj = new E3dCubeObj(
+ mpView->getSdrModelFromSdrView(),
mpView->Get3DDefaultAttributes(),
::basegfx::B3DPoint(-2500, -2500, -2500),
::basegfx::B3DVector(5000, 5000, 5000));
@@ -98,6 +99,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
case SID_3D_SPHERE:
{
p3DObj = new E3dSphereObj(
+ mpView->getSdrModelFromSdrView(),
mpView->Get3DDefaultAttributes(),
::basegfx::B3DPoint(0, 0, 0),
::basegfx::B3DVector(5000, 5000, 5000));
@@ -114,7 +116,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
{
aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon);
}
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aB2DPolygon));
/* this is an open object, therefore it has to be handled double-
sided by default */
@@ -141,7 +146,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
{
aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon);
}
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aB2DPolygon));
break;
}
@@ -152,7 +160,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
{
aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon);
}
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aB2DPolygon));
break;
}
@@ -178,7 +189,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5));
aInnerPoly.setClosed(true);
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aInnerPoly));
break;
}
@@ -202,7 +216,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
aInnerPoly.setClosed(true);
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aInnerPoly));
break;
}
@@ -226,7 +243,10 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
aInnerPoly.setClosed(true);
- p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj = new E3dLatheObj(
+ mpView->getSdrModelFromSdrView(),
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B2DPolyPolygon(aInnerPoly));
p3DObj->SetMergedItem(makeSvx3DHorizontalSegmentsItem(4));
break;
}
@@ -373,7 +393,7 @@ SdrObject* FuConstruct3dObject::CreateDefaultObject(const sal_uInt16 nID, const
double fW(aVolume.getWidth());
double fH(aVolume.getHeight());
::tools::Rectangle a3DRect(0, 0, static_cast<long>(fW), static_cast<long>(fH));
- E3dScene* pScene = new E3dScene;
+ E3dScene* pScene = new E3dScene(*mpDoc);
// copied code from E3dView::InitScene
double fCamZ(aVolume.getMaxZ() + ((fW + fH) / 4.0));
@@ -387,13 +407,9 @@ SdrObject* FuConstruct3dObject::CreateDefaultObject(const sal_uInt16 nID, const
aCam.SetFocalLength(mpView->GetDefaultCamFocal());
aCam.SetDefaults(::basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt);
pScene->SetCamera(aCam);
-
pScene->Insert3DObj(p3DObj);
pScene->NbcSetSnapRect(a3DRect);
- pScene->SetModel(mpDoc);
-
ImpPrepareBasic3DShape(p3DObj, pScene);
-
SfxItemSet aAttr(mpDoc->GetPool());
SetStyleSheet(aAttr, p3DObj);
aAttr.Put(XLineStyleItem (drawing::LineStyle_NONE));
diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx
index 7d6aca665a37..6967a1495017 100644
--- a/sd/source/ui/func/fuconarc.cxx
+++ b/sd/source/ui/func/fuconarc.cxx
@@ -91,10 +91,12 @@ void FuConstructArc::DoExecute( SfxRequest& rReq )
Activate(); // sets aObjKind
SdrCircObj* pNewCircle =
- new SdrCircObj(static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()),
- aNewRectangle,
- static_cast<long>(pPhiStart->GetValue () * 10.0),
- static_cast<long>(pPhiEnd->GetValue () * 10.0));
+ new SdrCircObj(
+ mpView->getSdrModelFromSdrView(),
+ static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()),
+ aNewRectangle,
+ static_cast<long>(pPhiStart->GetValue () * 10.0),
+ static_cast<long>(pPhiEnd->GetValue () * 10.0));
SdrPageView *pPV = mpView->GetSdrPageView();
mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER);
@@ -202,8 +204,9 @@ SdrObject* FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, const ::too
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index e7cc868d495b..cad7080afd6b 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -309,8 +309,9 @@ SdrObject* FuConstructBezierPolygon::CreateDefaultObject(const sal_uInt16 nID, c
// case SID_DRAW_BEZIER_NOFILL: // BASIC
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx
index 6396eeb46e82..97a60a302c11 100644
--- a/sd/source/ui/func/fuconcs.cxx
+++ b/sd/source/ui/func/fuconcs.cxx
@@ -188,7 +188,7 @@ void FuConstructCustomShape::SetAttributes( SdrObject* pObj )
{
const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
SfxItemSet aDest(
- pObj->GetModel()->GetItemPool(),
+ pObj->getSdrModelFromSdrObject().GetItemPool(),
svl::Items<
// Ranges from SdrAttrObj:
SDRATTR_START, SDRATTR_SHADOW_LAST,
@@ -236,8 +236,9 @@ const OUString& FuConstructCustomShape::GetShapeType() const
SdrObject* FuConstructCustomShape::CreateDefaultObject(const sal_uInt16, const ::tools::Rectangle& rRectangle)
{
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if( pObj )
{
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
index 1377429ed056..d78fd866755d 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -109,7 +109,10 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq )
pCenterY->GetValue () - pAxisY->GetValue () / 2,
pCenterX->GetValue () + pAxisX->GetValue () / 2,
pCenterY->GetValue () + pAxisY->GetValue () / 2);
- SdrCircObj *pNewCircle = new SdrCircObj (OBJ_CIRC, aNewRectangle);
+ SdrCircObj *pNewCircle = new SdrCircObj(
+ mpView->getSdrModelFromSdrView(),
+ OBJ_CIRC,
+ aNewRectangle);
SdrPageView *pPV = mpView->GetSdrPageView();
mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR);
@@ -127,7 +130,9 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq )
pMouseStartY->GetValue (),
pMouseEndX->GetValue (),
pMouseEndY->GetValue ());
- SdrRectObj *pNewRect = new SdrRectObj (aNewRectangle);
+ SdrRectObj *pNewRect = new SdrRectObj(
+ mpView->getSdrModelFromSdrView(),
+ aNewRectangle);
SdrPageView *pPV = mpView->GetSdrPageView();
mpView->InsertObjectAtView(pNewRect, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR);
@@ -477,9 +482,9 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj)
// dimension line
SdPage* pPage = static_cast<SdPage*>( mpView->GetSdrPageView()->GetPage() );
OUString aName(SdResId(STR_POOLSHEET_MEASURE));
- SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pPage->GetModel()->
- GetStyleSheetPool()->
- Find(aName, SfxStyleFamily::Para));
+ SfxStyleSheet* pSheet(
+ static_cast< SfxStyleSheet* >(
+ pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Para)));
DBG_ASSERT(pSheet, "StyleSheet missing");
if (pSheet)
@@ -496,10 +501,10 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj)
/**
* set line starts and ends for the object to be created
*/
-::basegfx::B2DPolyPolygon getPolygon(const char* pResId, SdrModel const * pDoc)
+::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aRetval;
- XLineEndListRef pLineEndList = pDoc->GetLineEndList();
+ XLineEndListRef pLineEndList(rModel.GetLineEndList());
if( pLineEndList.is() )
{
@@ -536,9 +541,10 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj
nSlotId == SID_LINE_SQUARE_ARROW )
{
// set attributes of line start and ends
+ SdrModel& rModel(pObj->getSdrModelFromSdrObject()); // TTTT pObj should be reference
// arrowhead
- ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, mpDoc ) );
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) );
if( !aArrow.count() )
{
::basegfx::B2DPolygon aNewArrow;
@@ -550,7 +556,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj
}
// Circles
- ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, mpDoc ) );
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) );
if( !aCircle.count() )
{
::basegfx::B2DPolygon aNewCircle;
@@ -560,7 +566,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj
}
// Square
- ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, mpDoc ) );
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) );
if( !aSquare.count() )
{
::basegfx::B2DPolygon aNewSquare;
@@ -764,8 +770,9 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const
// case SID_CONNECTOR_LINES_CIRCLES:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
index 8f376fb3d72a..9e15f47a070a 100644
--- a/sd/source/ui/func/fuconstr.cxx
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -318,9 +318,9 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
OUString aName( pPage->GetLayoutName() );
sal_Int32 n = aName.indexOf(SD_LT_SEPARATOR) + strlen(SD_LT_SEPARATOR);
aName = aName.copy(0, n) + STR_LAYOUT_BACKGROUNDOBJECTS;
- SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pPage->GetModel()->
- GetStyleSheetPool()->
- Find(aName, SfxStyleFamily::Page));
+ SfxStyleSheet* pSheet(
+ static_cast< SfxStyleSheet* >(
+ pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page)));
DBG_ASSERT(pSheet, "StyleSheet missing");
if (pSheet)
{
@@ -348,9 +348,9 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
if ( bForceNoFillStyle )
{
OUString aName(SdResId(STR_POOLSHEET_OBJWITHOUTFILL));
- SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pPage->GetModel()->
- GetStyleSheetPool()->
- Find(aName, SfxStyleFamily::Para));
+ SfxStyleSheet* pSheet(
+ static_cast< SfxStyleSheet* >(
+ pPage->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Para)));
DBG_ASSERT(pSheet, "Stylesheet missing");
if (pSheet)
{
diff --git a/sd/source/ui/func/fuconuno.cxx b/sd/source/ui/func/fuconuno.cxx
index 935cb0c50157..8ff99fdb7e00 100644
--- a/sd/source/ui/func/fuconuno.cxx
+++ b/sd/source/ui/func/fuconuno.cxx
@@ -138,8 +138,9 @@ SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const ::
// case SID_FM_CREATE_CONTROL:
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier());
if(pObj)
{
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 0cdd22da3807..ad22e00dc71b 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -386,7 +386,11 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
aRect = ::tools::Rectangle(aPos, aSize);
}
- SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aObjName, aRect );
+ SdrOle2Obj* pOleObj = new SdrOle2Obj(
+ mpView->getSdrModelFromSdrView(),
+ svt::EmbeddedObjectRef( xObj, nAspect ),
+ aObjName,
+ aRect);
SdrPageView* pPV = mpView->GetSdrPageView();
// if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj
@@ -613,8 +617,11 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
(aPageSize.Height() - aSize.Height()) / 2);
::tools::Rectangle aRect (aPnt, aSize);
-
- SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ mpView->getSdrModelFromSdrView(),
+ aObjRef,
+ aName,
+ aRect);
if( mpView->InsertObjectAtView(pObj, *pPV, SdrInsertFlags::SETDEFLAYER) )
{
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index fae84526e97f..5ad65b627063 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -506,7 +506,9 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
}
else
{
- SdrRectObj* pTO = new SdrRectObj(OBJ_TEXT);
+ SdrRectObj* pTO = new SdrRectObj(
+ mpView->getSdrModelFromSdrView(),
+ OBJ_TEXT);
pTO->SetOutlinerParaObject(pOPO);
const bool bUndo = mpView->IsUndoEnabled();
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index b78c018747ed..03aa0b0ad656 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -384,7 +384,7 @@ void FuMorph::ImpInsertPolygons(
if ( pPageView )
{
SfxItemSet aSet( aSet1 );
- SdrObjGroup* pObjGroup = new SdrObjGroup;
+ SdrObjGroup* pObjGroup = new SdrObjGroup(mpView->getSdrModelFromSdrView());
SdrObjList* pObjList = pObjGroup->GetSubList();
const size_t nCount = rPolyPolyList3D.size();
const double fStep = 1. / ( nCount + 1 );
@@ -397,7 +397,10 @@ void FuMorph::ImpInsertPolygons(
for ( size_t i = 0; i < nCount; i++, fFactor += fStep )
{
const ::basegfx::B2DPolyPolygon& rPolyPoly3D = *rPolyPolyList3D[ i ];
- SdrPathObj* pNewObj = new SdrPathObj(OBJ_POLY, rPolyPoly3D);
+ SdrPathObj* pNewObj = new SdrPathObj(
+ mpView->getSdrModelFromSdrView(),
+ OBJ_POLY,
+ rPolyPoly3D);
// line color
if ( bLineColor )
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 300e17c09cc5..b6d81901f870 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -691,7 +691,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
// outliner object up to now; also it needs to be set back to not
// vertical when there was a vertical one used last time.
OutlinerParaObject* pOPO = GetTextObj()->GetOutlinerParaObject();
- SdrOutliner& rOutl = mxTextObj->GetModel()->GetDrawOutliner(GetTextObj());
+ SdrOutliner& rOutl(mxTextObj->getSdrModelFromSdrObject().GetDrawOutliner(GetTextObj()));
bool bVertical((pOPO && pOPO->IsVertical())
|| nSlotId == SID_ATTR_CHAR_VERTICAL
|| nSlotId == SID_TEXT_FITTOSIZE_VERTICAL);
@@ -1304,10 +1304,11 @@ void FuText::DoubleClick(const MouseEvent& )
*/
SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle)
{
-
SdrObject* pObj = SdrObjFactory::MakeNewObject(
- mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
- nullptr, mpDoc);
+ mpView->getSdrModelFromSdrView(),
+ mpView->GetCurrentObjInventor(),
+ mpView->GetCurrentObjIdentifier(),
+ nullptr);
if(pObj)
{
diff --git a/sd/source/ui/func/unoaprms.cxx b/sd/source/ui/func/unoaprms.cxx
index 021dc5ba7a02..ab46b90ac8ee 100644
--- a/sd/source/ui/func/unoaprms.cxx
+++ b/sd/source/ui/func/unoaprms.cxx
@@ -27,7 +27,7 @@ void SdAnimationPrmsUndoAction::Undo()
// no new info created: restore data
if (!bInfoCreated)
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pObject->GetModel());
+ SdDrawDocument* pDoc(dynamic_cast< SdDrawDocument* >(&pObject->getSdrModelFromSdrObject()));
if( pDoc )
{
SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo( pObject );
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 67770cc27313..381b22be955f 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -128,6 +128,10 @@ private:
sd::DrawViewShell* GetViewShell();
+protected:
+ /** abstract SdrModel provider */
+ virtual SdrModel* getSdrModelFromUnoModel() const override;
+
public:
SdXImpressDocument(::sd::DrawDocShell* pShell, bool bClipBoard);
SdXImpressDocument(SdDrawDocument* pDoc, bool bClipBoard);
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx
index dc76d90a4777..b9336124f9e1 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -53,14 +53,11 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
break;
// Check the presence of the source document.
- SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(
- pMasterPage->GetModel());
- if (pSourceDocument == nullptr)
- break;
+ SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
// When the given master page already belongs to the target document
// then there is nothing more to do.
- if (pSourceDocument == &rTargetDocument)
+ if (&rSourceDocument == &rTargetDocument)
{
pNewMasterPage = pMasterPage;
break;
@@ -70,7 +67,7 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
// present. This is not the case when we are called during the
// creation of the slide master page because then the notes master
// page is not there.
- sal_uInt16 nSourceMasterPageCount = pSourceDocument->GetMasterPageCount();
+ sal_uInt16 nSourceMasterPageCount = rSourceDocument.GetMasterPageCount();
if (nSourceMasterPageCount%2 == 0)
// There should be 1 handout page + n slide masters + n notes
// masters = 2*n+1. An even value indicates that a new slide
@@ -81,11 +78,11 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
break;
// Get the slide master page.
if (pMasterPage != static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(nIndex)))
+ rSourceDocument.GetMasterPage(nIndex)))
break;
// Get the notes master page.
SdPage* pNotesMasterPage = static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(nIndex+1));
+ rSourceDocument.GetMasterPage(nIndex+1));
if (pNotesMasterPage == nullptr)
break;
@@ -161,7 +158,7 @@ SdPage* DocumentHelper::GetSlideForMasterPage (SdPage const * pMasterPage)
SdDrawDocument* pDocument = nullptr;
if (pMasterPage != nullptr)
- pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel());
+ pDocument = dynamic_cast< SdDrawDocument* >(&pMasterPage->getSdrModelFromSdrPage());
// Iterate over all pages and check if it references the given master
// page.
@@ -215,10 +212,8 @@ SdPage* DocumentHelper::AddMasterPage (
pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
// Copy the necessary styles.
- SdDrawDocument* pSourceDocument
- = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument != nullptr)
- ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
+ SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
+ ProvideStyles(rSourceDocument, rTargetDocument, pClonedMasterPage);
// Copy the precious flag.
pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
@@ -310,7 +305,7 @@ void DocumentHelper::AssignMasterPageToPageList (
::std::vector<SdPage*> aCleanedList;
for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage)
{
- OSL_ASSERT(*iPage!=nullptr && (*iPage)->GetModel() == &rTargetDocument);
+ OSL_ASSERT(*iPage!=nullptr && &(*iPage)->getSdrModelFromSdrPage() == &rTargetDocument);
if (*iPage != nullptr && (*iPage)->GetLayoutName() != sFullLayoutName)
{
aCleanedList.push_back(*iPage);
@@ -358,28 +353,24 @@ SdPage* DocumentHelper::AddMasterPage (
pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
// Copy the necessary styles.
- SdDrawDocument* pSourceDocument
- = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument != nullptr)
- {
- ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
-
- // Now that the styles are available we can insert the cloned
- // master page.
- rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex);
-
- // Adapt the size of the new master page to that of the pages in
- // the document.
- Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize());
- ::tools::Rectangle aBorders (
- pClonedMasterPage->GetLeftBorder(),
- pClonedMasterPage->GetUpperBorder(),
- pClonedMasterPage->GetRightBorder(),
- pClonedMasterPage->GetLowerBorder());
- pClonedMasterPage->ScaleObjects(aNewSize, aBorders, true);
- pClonedMasterPage->SetSize(aNewSize);
- pClonedMasterPage->CreateTitleAndLayout(true);
- }
+ SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
+ ProvideStyles(rSourceDocument, rTargetDocument, pClonedMasterPage);
+
+ // Now that the styles are available we can insert the cloned
+ // master page.
+ rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex);
+
+ // Adapt the size of the new master page to that of the pages in
+ // the document.
+ Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize());
+ ::tools::Rectangle aBorders (
+ pClonedMasterPage->GetLeftBorder(),
+ pClonedMasterPage->GetUpperBorder(),
+ pClonedMasterPage->GetRightBorder(),
+ pClonedMasterPage->GetLowerBorder());
+ pClonedMasterPage->ScaleObjects(aNewSize, aBorders, true);
+ pClonedMasterPage->SetSize(aNewSize);
+ pClonedMasterPage->CreateTitleAndLayout(true);
}
return pClonedMasterPage;
@@ -406,25 +397,24 @@ void DocumentHelper::AssignMasterPageToPage (
// Leave early when the parameters are invalid.
if (pPage == nullptr || pMasterPage == nullptr)
return;
- SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel());
- if (pDocument == nullptr)
- return;
+
+ SdDrawDocument& rDocument(dynamic_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
if ( ! pPage->IsMasterPage())
{
// 1. Remove the background object (so that, if it exists, does
// not override the new master page) and assign the master page to
// the regular slide.
- pDocument->GetDocSh()->GetUndoManager()->AddUndoAction(
+ rDocument.GetDocSh()->GetUndoManager()->AddUndoAction(
new SdBackgroundObjUndoAction(
- *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
+ rDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
true);
pPage->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE));
- pDocument->SetMasterPage (
+ rDocument.SetMasterPage (
(pPage->GetPageNum()-1)/2,
rsBaseLayoutName,
- pDocument,
+ &rDocument,
false,
false);
}
@@ -432,10 +422,10 @@ void DocumentHelper::AssignMasterPageToPage (
{
// Find first slide that uses the master page.
SdPage* pSlide = nullptr;
- sal_uInt16 nPageCount = pDocument->GetSdPageCount(PageKind::Standard);
+ sal_uInt16 nPageCount = rDocument.GetSdPageCount(PageKind::Standard);
for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==nullptr; nPage++)
{
- SdrPage* pCandidate = pDocument->GetSdPage(nPage,PageKind::Standard);
+ SdrPage* pCandidate = rDocument.GetSdPage(nPage,PageKind::Standard);
if (pCandidate != nullptr
&& pCandidate->TRG_HasMasterPage()
&& &(pCandidate->TRG_GetMasterPage()) == pPage)
@@ -448,10 +438,10 @@ void DocumentHelper::AssignMasterPageToPage (
{
// 2. Assign the given master pages to the first slide that was
// found above that uses the master page.
- pDocument->SetMasterPage (
+ rDocument.SetMasterPage (
(pSlide->GetPageNum()-1)/2,
rsBaseLayoutName,
- pDocument,
+ &rDocument,
false,
false);
}
@@ -459,7 +449,7 @@ void DocumentHelper::AssignMasterPageToPage (
{
// 3. Replace the master page A by a copy of the given master
// page B.
- pDocument->RemoveUnnecessaryMasterPages (
+ rDocument.RemoveUnnecessaryMasterPages (
pPage);
}
}
@@ -479,11 +469,9 @@ SdPage* DocumentHelper::ProvideMasterPage (
OSL_ASSERT(pMasterPage != nullptr);
return nullptr;
}
- SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument == nullptr)
- return nullptr;
+ SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
SdPage* pNotesMasterPage = static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1));
+ rSourceDocument.GetMasterPage(pMasterPage->GetPageNum()+1));
if (pNotesMasterPage == nullptr)
{
// The model is not in a valid state. Maybe a new master page
@@ -521,7 +509,7 @@ SdPage* DocumentHelper::ProvideMasterPage (
}
// Clone the master page.
- if (pMasterPage->GetModel() != &rTargetDocument)
+ if (&pMasterPage->getSdrModelFromSdrPage() != &rTargetDocument)
{
pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
if( rTargetDocument.IsUndoEnabled() )
@@ -532,7 +520,7 @@ SdPage* DocumentHelper::ProvideMasterPage (
pMasterPageInDocument = pMasterPage;
// Clone the notes master.
- if (pNotesMasterPage->GetModel() != &rTargetDocument)
+ if (&pNotesMasterPage->getSdrModelFromSdrPage() != &rTargetDocument)
{
SdPage* pClonedNotesMasterPage
= AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1);
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index dd3e6a4f0dd3..e85d27a810fb 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -183,7 +183,11 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
aRect = ::tools::Rectangle(aPos, aSize);
}
- sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( GetDoc(), aRect, nColumns, nRows );
+ sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj(
+ *GetDoc(), // TTTT should be reference
+ aRect,
+ nColumns,
+ nRows);
pObj->NbcSetStyleSheet( GetDoc()->GetDefaultStyleSheet(), true );
apply_table_style( pObj, GetDoc(), sTableStyle );
SdrPageView* pPV = mpView->GetSdrPageView();
@@ -271,7 +275,11 @@ void CreateTableFromRTF( SvStream& rStream, SdDrawDocument* pModel )
{
Size aSize( 200, 200 );
::tools::Rectangle aRect (Point(), aSize);
- sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( pModel, aRect, 1, 1 );
+ sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj(
+ *pModel,
+ aRect,
+ 1,
+ 1);
pObj->NbcSetStyleSheet( pModel->GetDefaultStyleSheet(), true );
apply_table_style( pObj, pModel, OUString() );
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx
index 158b1603f00e..23717ea3d16b 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -202,15 +202,9 @@ bool PreviewRenderer::Initialize (
if (pPage == nullptr)
return false;
- SdrModel* pModel = pPage->GetModel();
- if (pModel == nullptr)
- return false;
-
SetupOutputSize(*pPage, rPixelSize);
-
- SdDrawDocument* pDocument
- = static_cast<SdDrawDocument*>(pPage->GetModel());
- DrawDocShell* pDocShell = pDocument->GetDocSh();
+ SdDrawDocument& rDocument(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ DrawDocShell* pDocShell = rDocument.GetDocSh();
// Create view
ProvideView (pDocShell);
@@ -260,9 +254,9 @@ bool PreviewRenderer::Initialize (
}
pPageView->SetApplicationDocumentColor(aApplicationDocumentColor);
- SdrOutliner& rOutliner(pDocument->GetDrawOutliner());
+ SdrOutliner& rOutliner(rDocument.GetDrawOutliner());
rOutliner.SetBackgroundColor(aApplicationDocumentColor);
- rOutliner.SetDefaultLanguage(pDocument->GetLanguage(EE_CHAR_LANGUAGE));
+ rOutliner.SetDefaultLanguage(rDocument.GetLanguage(EE_CHAR_LANGUAGE));
mpPreviewDevice->SetBackground(Wallpaper(aApplicationDocumentColor));
mpPreviewDevice->Erase();
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index afe7ede9bde5..b6ee7d5d1122 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2714,6 +2714,11 @@ void SdXImpressDocument::initializeDocument()
}
}
+SdrModel* SdXImpressDocument::getSdrModelFromUnoModel() const
+{
+ return GetDoc();
+}
+
void SAL_CALL SdXImpressDocument::dispose()
{
if( !mbDisposed )
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 619d84254a7d..7a34f2a80277 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -406,23 +406,20 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap
SdrObject* pObj = SvxFmDrawPage::CreateSdrObject_( xShape );
if( pObj && ( (pObj->GetObjInventor() != SdrInventor::Default) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if( pDoc )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
+ // #i119287# similar to the code in the SdrObject methods the graphic and ole
+ // SdrObjects need another default style than the rest, see task. Adding here, too.
+ // TTTT: Same as for #i119287#: Can be removed in branch aw080 again
+ const bool bIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(pObj) != nullptr);
+ const bool bIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr);
+
+ if(bIsSdrGrafObj || bIsSdrOle2Obj)
{
- // #i119287# similar to the code in the SdrObject methods the graphic and ole
- // SdrObjects need another default style than the rest, see task. Adding here, too.
- // TTTT: Same as for #i119287#: Can be removed in branch aw080 again
- const bool bIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(pObj) != nullptr);
- const bool bIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr);
-
- if(bIsSdrGrafObj || bIsSdrOle2Obj)
- {
- pObj->NbcSetStyleSheet(pDoc->GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true);
- }
- else
- {
- pObj->NbcSetStyleSheet(pDoc->GetDefaultStyleSheet(), true);
- }
+ pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true);
+ }
+ else
+ {
+ pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true);
}
}
return pObj;
@@ -518,9 +515,8 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap
pPresObj = SvxFmDrawPage::CreateSdrObject_( xShape );
if( pPresObj )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if( pDoc )
- pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), true );
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
+ pPresObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true);
GetPage()->InsertPresObj( pPresObj, eObjKind );
}
}
@@ -685,21 +681,21 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
if( eOri != GetPage()->GetOrientation() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetOrientation( eOri );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetOrientation( eOri );
}
}
@@ -781,10 +777,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND)), bVisible);
pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
@@ -801,10 +797,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ)), bVisible);
pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
@@ -1100,39 +1096,36 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
case WID_PAGE_PREVIEW :
case WID_PAGE_PREVIEWMETAFILE :
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if ( pDoc )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
+ ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh();
+ if ( pDocShell )
{
- ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
- if ( pDocShell )
+ sal_uInt16 nPgNum = 0;
+ sal_uInt16 nPageCount = rDoc.GetSdPageCount( PageKind::Standard );
+ sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 );
+ while( nPgNum < nPageCount )
{
- sal_uInt16 nPgNum = 0;
- sal_uInt16 nPageCount = pDoc->GetSdPageCount( PageKind::Standard );
- sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 );
- while( nPgNum < nPageCount )
- {
- pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber );
- nPgNum++;
- }
- std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
- if (xMetaFile)
- {
- Size aSize( GetPage()->GetSize() );
- xMetaFile->AddAction( static_cast<MetaAction*>(new MetaFillColorAction( COL_WHITE, true )), 0 );
- xMetaFile->AddAction( static_cast<MetaAction*>(new MetaRectAction( ::tools::Rectangle( Point(), aSize ) )), 1 );
- xMetaFile->SetPrefMapMode(MapMode(MapUnit::Map100thMM));
- xMetaFile->SetPrefSize( aSize );
-
- SvMemoryStream aDestStrm( 65535, 65535 );
- if (nEntry == WID_PAGE_PREVIEW)
- // Preview: WMF format.
- ConvertGDIMetaFileToWMF(*xMetaFile, aDestStrm, nullptr, false);
- else
- // PreviewMetafile: SVM format.
- xMetaFile->Write(aDestStrm);
- Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aDestStrm.GetData()), aDestStrm.Tell() );
- aAny <<= aSeq;
- }
+ rDoc.SetSelected( rDoc.GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber );
+ nPgNum++;
+ }
+ std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
+ if (xMetaFile)
+ {
+ Size aSize( GetPage()->GetSize() );
+ xMetaFile->AddAction( static_cast<MetaAction*>(new MetaFillColorAction( COL_WHITE, true )), 0 );
+ xMetaFile->AddAction( static_cast<MetaAction*>(new MetaRectAction( ::tools::Rectangle( Point(), aSize ) )), 1 );
+ xMetaFile->SetPrefMapMode(MapMode(MapUnit::Map100thMM));
+ xMetaFile->SetPrefSize( aSize );
+
+ SvMemoryStream aDestStrm( 65535, 65535 );
+ if (nEntry == WID_PAGE_PREVIEW)
+ // Preview: WMF format.
+ ConvertGDIMetaFileToWMF(*xMetaFile, aDestStrm, nullptr, false);
+ else
+ // PreviewMetafile: SVM format.
+ xMetaFile->Write(aDestStrm);
+ Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aDestStrm.GetData()), aDestStrm.Tell() );
+ aAny <<= aSeq;
}
}
}
@@ -1140,29 +1133,26 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
case WID_PAGE_PREVIEWBITMAP :
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
- if ( pDoc )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
+ ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh();
+ if ( pDocShell )
{
- ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
- if ( pDocShell )
+ sal_uInt16 nPgNum = 0;
+ sal_uInt16 nPageCount = rDoc.GetSdPageCount( PageKind::Standard );
+ sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 );
+ while( nPgNum < nPageCount )
{
- sal_uInt16 nPgNum = 0;
- sal_uInt16 nPageCount = pDoc->GetSdPageCount( PageKind::Standard );
- sal_uInt16 nPageNumber = static_cast<sal_uInt16>( ( GetPage()->GetPageNum() - 1 ) >> 1 );
- while( nPgNum < nPageCount )
- {
- pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber );
- nPgNum++;
- }
- std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
- BitmapEx aBitmap;
- if (xMetaFile && xMetaFile->CreateThumbnail(aBitmap))
- {
- SvMemoryStream aMemStream;
- WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false);
- uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aMemStream.GetData()), aMemStream.Tell() );
- aAny <<= aSeq;
- }
+ rDoc.SetSelected( rDoc.GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber );
+ nPgNum++;
+ }
+ std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
+ BitmapEx aBitmap;
+ if (xMetaFile && xMetaFile->CreateThumbnail(aBitmap))
+ {
+ SvMemoryStream aMemStream;
+ WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false);
+ uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aMemStream.GetData()), aMemStream.Tell() );
+ aAny <<= aSeq;
}
}
}
@@ -1206,10 +1196,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND)));
}
@@ -1225,10 +1215,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
SdrPage* pPage = GetPage();
if( pPage )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel());
- if( pDoc->GetMasterPageCount() )
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage()));
+ if( rDoc.GetMasterPageCount() )
{
- SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+ SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin();
SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ)));
}
@@ -1684,21 +1674,21 @@ void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetLeftBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetLeftBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetLeftBorder( nValue );
}
}
@@ -1708,21 +1698,21 @@ void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetRightBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetRightBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetRightBorder( nValue );
}
}
@@ -1732,21 +1722,21 @@ void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetUpperBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetUpperBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetUpperBorder( nValue );
}
}
@@ -1756,21 +1746,21 @@ void SdGenericDrawPage::SetLowerBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetLowerBorder() )
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetLowerBorder( nValue );
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetLowerBorder( nValue );
}
}
@@ -1811,25 +1801,25 @@ void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
{
aSize.setWidth( nWidth );
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- refreshpage( pDoc, ePageKind );
+ refreshpage( &rDoc, ePageKind );
}
}
@@ -1840,25 +1830,25 @@ void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
{
aSize.setHeight( nHeight );
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel());
+ SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
const PageKind ePageKind = GetPage()->GetPageKind();
- sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
+ sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- nPageCnt = pDoc->GetSdPageCount(ePageKind);
+ nPageCnt = rDoc.GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
- SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
+ SdPage* pPage = rDoc.GetSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
- refreshpage( pDoc, ePageKind );
+ refreshpage( &rDoc, ePageKind );
}
}
@@ -2389,7 +2379,7 @@ void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >&
pNotesPage->TRG_ClearMasterPage();
sal_uInt16 nNum = SvxFmDrawPage::mpPage->TRG_GetMasterPage().GetPageNum() + 1;
- pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum));
+ pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->getSdrModelFromSdrPage().GetMasterPage(nNum));
pNotesPage->SetLayoutName( pSdPage->GetLayoutName() );
GetModel()->SetModified();
@@ -2486,7 +2476,7 @@ void SdDrawPage::setBackground( const Any& rValue )
if( pBack )
{
- pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
+ pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
}
else
{
@@ -2510,7 +2500,7 @@ void SdDrawPage::setBackground( const Any& rValue )
pProp++;
}
- pBackground->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
+ pBackground->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
}
if( aSet.Count() == 0 )
@@ -2872,7 +2862,7 @@ void SdMasterPage::setBackground( const Any& rValue )
if( pBack )
{
- pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet );
+ pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet );
}
else
{
@@ -2895,11 +2885,11 @@ void SdMasterPage::setBackground( const Any& rValue )
pProp++;
}
- pBackground->fillItemSet( static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()), aSet );
+ pBackground->fillItemSet( static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()), aSet );
}
// if we find the background style, copy the set to the background
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel());
+ SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage());
SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
if(pSSPool)
{
@@ -2943,7 +2933,7 @@ void SdMasterPage::getBackground( Any& rValue )
}
else
{
- SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel());
+ SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage());
SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool();
if(pSSPool)
{
@@ -3092,9 +3082,9 @@ Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
{
Reference< uno::XInterface > xPage;
- if( pPage && pPage->GetModel() )
+ if( pPage )
{
- SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() );
+ SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->getSdrModelFromSdrPage().getUnoModel() );
if( pModel )
{
if( pPage->IsMasterPage() )
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index c89213c5880d..432146681d78 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1526,7 +1526,10 @@ private:
std::vector< ::tools::Rectangle >::iterator iter( aAreas.begin() );
while( iter != aAreas.end() )
{
- pHandout->NbcInsertObject( new SdrPageObj((*iter++)) );
+ pHandout->NbcInsertObject(
+ new SdrPageObj(
+ rModel,
+ (*iter++)));
if( bDrawLines && (iter != aAreas.end()) )
{
@@ -1546,7 +1549,10 @@ private:
aPathPoly.append( aPoly );
}
- SdrPathObj* pPathObj = new SdrPathObj(OBJ_PATHLINE, aPathPoly );
+ SdrPathObj* pPathObj = new SdrPathObj(
+ rModel,
+ OBJ_PATHLINE,
+ aPathPoly);
pPathObj->SetMergedItem(XLineStyleItem(drawing::LineStyle_SOLID));
pPathObj->SetMergedItem(XLineColorItem(OUString(), COL_BLACK));
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 56a07fdb6486..95a4807e43c3 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -78,12 +78,15 @@ namespace sd {
* that there is no page a page is created.
*/
-DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* pShell)
-: ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell)
-, mpDocShell(pDocSh)
-, mpDrawViewShell(pShell)
-, mpVDev(nullptr)
-, mnPOCHSmph(0)
+DrawView::DrawView(
+ DrawDocShell* pDocSh,
+ OutputDevice* pOutDev,
+ DrawViewShell* pShell)
+: ::sd::View(*pDocSh->GetDoc(), pOutDev, pShell)
+ ,mpDocShell(pDocSh)
+ ,mpDrawViewShell(pShell)
+ ,mpVDev(nullptr)
+ ,mnPOCHSmph(0)
{
SetCurrentObj(OBJ_RECT);
}
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index f61052b4cb68..bbfd4e0d3d23 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -520,7 +520,9 @@ public:
if (!pMasterPage)
continue;
- SdrRectObj* pObject = new SdrRectObj(OBJ_TEXT);
+ SdrRectObj* pObject = new SdrRectObj(
+ *m_rDrawViewShell.GetDoc(), // TTTT should be reference
+ OBJ_TEXT);
pObject->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
pObject->SetOutlinerParaObject(pOutliner->CreateParaObject());
pMasterPage->InsertObject(pObject);
@@ -1085,7 +1087,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
}
// create new object
- SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
+ SdrGrafObj* pGraphicObj = new SdrGrafObj(
+ *GetDoc(),
+ aGraphic);
// get some necessary info and ensure it
const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
@@ -2339,7 +2343,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
pOutl->QuickInsertField( *pFieldItem, ESelection() );
OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
- SdrRectObj* pRectObj = new SdrRectObj( OBJ_TEXT );
+ SdrRectObj* pRectObj = new SdrRectObj(
+ *GetDoc(),
+ OBJ_TEXT);
pRectObj->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
pOutl->UpdateFields();
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index 1181d6c7d820..e396b8ec6ea8 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -120,7 +120,10 @@ void DrawViewShell::ScannerEvent()
if( bInsertNewObject )
{
- auto pGrafObj = new SdrGrafObj( Graphic( aScanBmp ), aRect );
+ auto pGrafObj = new SdrGrafObj(
+ GetView()->getSdrModelFromSdrView(),
+ Graphic(aScanBmp),
+ aRect);
SdrPageView* pPV = GetView()->GetSdrPageView();
GetView()->InsertObjectAtView( pGrafObj, *pPV, SdrInsertFlags::SETDEFLAYER );
}
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index 4c2e6b1c3203..afc151b29a96 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -169,7 +169,10 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq)
if( bInsertNewObject )
{
- pGrafObj = new SdrGrafObj(aGraphic, aRect);
+ pGrafObj = new SdrGrafObj(
+ GetView()->getSdrModelFromSdrView(),
+ aGraphic,
+ aRect);
SdrPageView* pPV = mpDrawView->GetSdrPageView();
mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SdrInsertFlags::SETDEFLAYER);
}
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 0b082d9e18a9..8b69d3616037 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1458,7 +1458,9 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
pOutl->QuickInsertField( aURLItem, ESelection() );
OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
- SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT);
+ SdrRectObj* pRectObj = new SdrRectObj(
+ GetView()->getSdrModelFromSdrView(),
+ OBJ_TEXT);
pOutl->UpdateFields();
pOutl->SetUpdateMode( true );
@@ -1534,8 +1536,12 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText,
if (bNewObj) try
{
- SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(SdrInventor::FmForm, OBJ_FM_BUTTON,
- mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) );
+ SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >(
+ SdrObjFactory::MakeNewObject(
+ GetView()->getSdrModelFromSdrView(),
+ SdrInventor::FmForm,
+ OBJ_FM_BUTTON,
+ mpDrawView->GetSdrPageView()->GetPage()));
Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index 3795f9e09b4f..b08896abf358 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -51,7 +51,7 @@ using namespace ::std;
namespace sd {
FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK */)
- : SdrView(pDrawDoc, nullptr),
+: SdrView(*pDrawDoc, nullptr), // TTTT SdDrawDocument* -> should be reference
mnRefCount(0),
mnPresViewShellId(SID_VIEWSHELL0),
mbIsNavigatorShowingAllShapes(false)
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index d0344d2ab4e5..7bff93080e61 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -104,10 +104,11 @@ using namespace com::sun::star::uno;
using namespace sdr::table;
namespace sd {
-
-View::View(SdDrawDocument& rDrawDoc, OutputDevice* pOutDev,
- ViewShell* pViewShell)
- : FmFormView(&rDrawDoc, pOutDev),
+View::View(
+ SdDrawDocument& rDrawDoc,
+ OutputDevice* pOutDev,
+ ViewShell* pViewShell)
+: FmFormView(rDrawDoc, pOutDev),
mrDoc(rDrawDoc),
mpDocSh(rDrawDoc.GetDocSh()),
mpViewSh(pViewShell),
@@ -658,7 +659,7 @@ bool View::SdrBeginTextEdit(
EventMultiplexerEventId::BeginTextEdit, static_cast<void*>(pObj) );
if( pOutl==nullptr && pObj )
- pOutl = SdrMakeOutliner(OutlinerMode::TextObject, *pObj->GetModel());
+ pOutl = SdrMakeOutliner(OutlinerMode::TextObject, pObj->getSdrModelFromSdrObject());
// make draw&impress specific initialisations
if( pOutl )
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index c0f5f5e19413..cf6f72870045 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -797,7 +797,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
aNewSet.Put( pObj->GetMergedItemSet() );
if( bUndo )
- AddUndo( new E3dAttributesUndoAction( mrDoc, static_cast<E3dObject*>(pPickObj), aNewSet, aOldSet ) );
+ AddUndo(
+ new E3dAttributesUndoAction(
+ *static_cast< E3dObject* >(pPickObj),
+ aNewSet,
+ aOldSet));
pPickObj->SetMergedItemSetAndBroadcast( aNewSet );
}
@@ -995,7 +999,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) );
::tools::Rectangle aRect( maDropPos, aSize );
- SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ getSdrModelFromSdrView(),
+ aObjRef,
+ aName,
+ aRect);
SdrPageView* pPV = GetSdrPageView();
SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
@@ -1165,7 +1173,11 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) );
::tools::Rectangle aRect( maDropPos, aSize );
- SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect );
+ SdrOle2Obj* pObj = new SdrOle2Obj(
+ getSdrModelFromSdrView(),
+ aObjRef,
+ aName,
+ aRect);
SdrPageView* pPV = GetSdrPageView();
SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index f98a8ab1b216..fb17fcc2df24 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -116,7 +116,10 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
}
else
{
- pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
+ pNewGrafObj = new SdrGrafObj(
+ getSdrModelFromSdrView(),
+ rGraphic,
+ pPickObj->GetLogicRect());
pNewGrafObj->SetEmptyPresObj(true);
}
@@ -189,7 +192,10 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
MapMode( MapUnit::Map100thMM ) );
}
- pNewGrafObj = new SdrGrafObj( rGraphic, ::tools::Rectangle( rPos, aSize ) );
+ pNewGrafObj = new SdrGrafObj(
+ getSdrModelFromSdrView(),
+ rGraphic,
+ ::tools::Rectangle(rPos, aSize));
SdrPage* pPage = pPV->GetPage();
Size aPageSize( pPage->GetSize() );
aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) );
@@ -329,7 +335,9 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM
pUserCall = pPickObj->GetUserCall(); // ReplaceObjectAtView can free pPickObj
}
- pNewMediaObj = new SdrMediaObj( aRect );
+ pNewMediaObj = new SdrMediaObj(
+ getSdrModelFromSdrView(),
+ aRect);
bool bIsPres = false;
if( pPickObj )
@@ -529,7 +537,11 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void)
aRect = ::tools::Rectangle( maDropPos, aSize );
- SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect );
+ SdrOle2Obj* pOleObj = new SdrOle2Obj(
+ getSdrModelFromSdrView(),
+ svt::EmbeddedObjectRef(xObj, nAspect),
+ aName,
+ aRect);
SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
if (mpViewSh != nullptr)
diff --git a/svx/inc/dragmt3d.hxx b/svx/inc/dragmt3d.hxx
index d8eba435c667..2ac1274fbb96 100644
--- a/svx/inc/dragmt3d.hxx
+++ b/svx/inc/dragmt3d.hxx
@@ -30,7 +30,7 @@
class E3dDragMethodUnit
{
public:
- E3dObject* mp3DObj;
+ E3dObject& mr3DObj;
basegfx::B3DPolyPolygon maWireframePoly;
basegfx::B3DHomMatrix maDisplayTransform;
basegfx::B3DHomMatrix maInvDisplayTransform;
@@ -39,8 +39,8 @@ public:
sal_Int32 mnStartAngle;
sal_Int32 mnLastAngle;
- E3dDragMethodUnit()
- : mp3DObj(nullptr),
+ E3dDragMethodUnit(E3dObject& r3DObj)
+ : mr3DObj(r3DObj),
maWireframePoly(),
maDisplayTransform(),
maInvDisplayTransform(),
@@ -48,7 +48,8 @@ public:
maTransform(),
mnStartAngle(0),
mnLastAngle(0)
- {}
+ {
+ }
};
// Derivative of SdrDragMethod for 3D objects
diff --git a/svx/inc/sdr/properties/attributeproperties.hxx b/svx/inc/sdr/properties/attributeproperties.hxx
index 603442634df2..d12374f31ee1 100644
--- a/svx/inc/sdr/properties/attributeproperties.hxx
+++ b/svx/inc/sdr/properties/attributeproperties.hxx
@@ -31,6 +31,12 @@ namespace sdr
{
class AttributeProperties : public DefaultProperties, public SfxListener, public svl::StyleSheetUser
{
+ // get the correct (#119287#) default SfyStyleSheet from SdrObject's SdrModel
+ SfxStyleSheet* ImpGetDefaultStyleSheet() const;
+
+ // core to set parent at SfxItemSet and to execute the hard attribute computations
+ void ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr);
+
// add style sheet, do all the necessary handling
void ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
@@ -60,6 +66,10 @@ namespace sdr
// Clone() operator, normally just calls the local copy constructor
virtual BaseProperties& Clone(SdrObject& rObj) const override;
+ // Get the local ItemSet. This directly returns the local ItemSet of the object. No
+ // merging of ItemSets is done for e.g. Group objects.
+ virtual const SfxItemSet& GetObjectItemSet() const override;
+
// destructor
virtual ~AttributeProperties() override;
@@ -69,12 +79,6 @@ namespace sdr
// get the installed StyleSheet
virtual SfxStyleSheet* GetStyleSheet() const override;
- // Move properties to a new ItemPool.
- virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) override;
-
- // Set new model.
- virtual void SetModel(SdrModel* pOldModel, SdrModel* pNewModel) override;
-
// force all attributes which come from styles to hard attributes
// to be able to live without the style.
virtual void ForceStyleToHardAttributes() override;
diff --git a/svx/inc/sdr/properties/e3dsceneproperties.hxx b/svx/inc/sdr/properties/e3dsceneproperties.hxx
index 3705fd684258..00d377766e01 100644
--- a/svx/inc/sdr/properties/e3dsceneproperties.hxx
+++ b/svx/inc/sdr/properties/e3dsceneproperties.hxx
@@ -68,9 +68,6 @@ namespace sdr
// get the installed StyleSheet
virtual SfxStyleSheet* GetStyleSheet() const override;
- // Move properties to a new ItemPool. Default implementation does nothing.
- virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) override;
-
// Special for scene:
void SetSceneItemsFromCamera();
};
diff --git a/svx/inc/sdr/properties/groupproperties.hxx b/svx/inc/sdr/properties/groupproperties.hxx
index af197dc91360..9b6b28a73dc3 100644
--- a/svx/inc/sdr/properties/groupproperties.hxx
+++ b/svx/inc/sdr/properties/groupproperties.hxx
@@ -103,9 +103,6 @@ namespace sdr
// DefaultProperties::GetObjectItemSet() if a new ItemSet is created
virtual void ForceDefaultAttributes() override;
- // Move properties to a new ItemPool.
- virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel) override;
-
// force all attributes which come from styles to hard attributes
// to be able to live without the style.
virtual void ForceStyleToHardAttributes() override;
diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
index 6cbd41f35ce0..19a09ec8f502 100644
--- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx
+++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
@@ -218,8 +218,7 @@ namespace accessibility
mrViewWindow(rViewWindow),
mbEditSourceEmpty( true )
{
- if( mrObj.GetModel() )
- StartListening( *mrObj.GetModel() );
+ StartListening( mrObj.getSdrModelFromSdrObject() );
}
AccessibleEmptyEditSource::~AccessibleEmptyEditSource()
@@ -232,8 +231,7 @@ namespace accessibility
}
else
{
- if( mrObj.GetModel() )
- EndListening( *mrObj.GetModel() );
+ EndListening( mrObj.getSdrModelFromSdrObject() );
}
}
@@ -256,8 +254,7 @@ namespace accessibility
void AccessibleEmptyEditSource::Switch2ProxyEditSource()
{
// deregister EmptyEditSource model listener
- if( mrObj.GetModel() )
- EndListening( *mrObj.GetModel() );
+ EndListening( mrObj.getSdrModelFromSdrObject() );
::std::unique_ptr< SvxEditSource > pProxySource( new AccessibleProxyEditSource_Impl(mrObj, mrView, mrViewWindow) );
mpEditSource.swap(pProxySource);
diff --git a/svx/source/accessibility/AccessibleGraphicShape.cxx b/svx/source/accessibility/AccessibleGraphicShape.cxx
index 31c4690f5b97..fba25f4ad007 100644
--- a/svx/source/accessibility/AccessibleGraphicShape.cxx
+++ b/svx/source/accessibility/AccessibleGraphicShape.cxx
@@ -169,7 +169,7 @@ OUString AccessibleGraphicShape::CreateAccessibleDescription()
// Return this object's role.
sal_Int16 SAL_CALL AccessibleGraphicShape::getAccessibleRole()
{
- if( m_pShape->GetModel()->GetImageMapForObject(m_pShape) != nullptr )
+ if( m_pShape->getSdrModelFromSdrObject().GetImageMapForObject(m_pShape) != nullptr )
return AccessibleRole::IMAGE_MAP;
else
return AccessibleShape::getAccessibleRole();
diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index a00216d40b16..dab305257299 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -154,12 +154,13 @@ void ExternalToolEdit::Edit(GraphicObject const*const pGraphicObject)
}
SdrExternalToolEdit::SdrExternalToolEdit(
- FmFormView *const pView, SdrObject *const pObj)
- : m_pView(pView)
- , m_pObj(pObj)
+ FmFormView* pView,
+ SdrObject* pObj)
+: m_pView(pView)
+ ,m_pObj(pObj)
{
assert(m_pObj && m_pView);
- StartListening(*m_pObj->GetModel());
+ StartListening(m_pObj->getSdrModelFromSdrObject());
}
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 2386b5887d8f..f2a00feaad80 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1980,7 +1980,10 @@ void EnhancedCustomShape2d::CreateSubPath(
{
basegfx::B2DPolyPolygon aClosedPolyPolygon(aNewB2DPolyPolygon);
aClosedPolyPolygon.setClosed(true);
- SdrPathObj* pFill = new SdrPathObj(OBJ_POLY, aClosedPolyPolygon);
+ SdrPathObj* pFill = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
+ OBJ_POLY,
+ aClosedPolyPolygon);
SfxItemSet aTempSet(*this);
aTempSet.Put(makeSdrShadowItem(false));
aTempSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
@@ -1995,6 +1998,7 @@ void EnhancedCustomShape2d::CreateSubPath(
// to correct the polygon (here: open it) using the type, the last edge may get lost.
// Thus, use a type that fits the polygon
SdrPathObj* pStroke = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
aNewB2DPolyPolygon);
SfxItemSet aTempSet(*this);
@@ -2014,6 +2018,7 @@ void EnhancedCustomShape2d::CreateSubPath(
{
// see comment above about OBJ_PLIN
pObj = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
aNewB2DPolyPolygon);
aTempSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
@@ -2021,7 +2026,10 @@ void EnhancedCustomShape2d::CreateSubPath(
else
{
aNewB2DPolyPolygon.setClosed(true);
- pObj = new SdrPathObj(OBJ_POLY, aNewB2DPolyPolygon);
+ pObj = new SdrPathObj(
+ mrSdrObjCustomShape.getSdrModelFromSdrObject(),
+ OBJ_POLY,
+ aNewB2DPolyPolygon);
}
if(bNoStroke)
@@ -2372,7 +2380,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly )
// copy remaining objects to pRet
if(vObjectList.size() > 1)
{
- pRet = new SdrObjGroup;
+ pRet = new SdrObjGroup(mrSdrObjCustomShape.getSdrModelFromSdrObject());
for ( std::pair< SdrPathObj*, double >& rCandidate : vObjectList )
{
@@ -2404,7 +2412,7 @@ SdrObject* EnhancedCustomShape2d::CreateObject( bool bLineGeometryNeededOnly )
if ( eSpType == mso_sptRectangle )
{
- pRet = new SdrRectObj( aLogicRect );
+ pRet = new SdrRectObj(mrSdrObjCustomShape.getSdrModelFromSdrObject(), aLogicRect);
pRet->SetMergedItemSet( *this );
}
if ( !pRet )
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 60177fc9fbe8..a0e2a6badba0 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -255,27 +255,24 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
const SdrObject* pShape2d,
const SdrObjCustomShape& rSdrObjCustomShape)
{
- SdrObject* pRet = nullptr;
- SdrModel* pModel = rSdrObjCustomShape.GetModel();
- const SdrCustomShapeGeometryItem& rGeometryItem = rSdrObjCustomShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ SdrObject* pRet(nullptr);
+ const SdrCustomShapeGeometryItem& rGeometryItem(rSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY));
+ double fMap(1.0), *pMap = nullptr;
+ Fraction aFraction( rSdrObjCustomShape.getSdrModelFromSdrObject().GetScaleFraction() );
- double fMap, *pMap = nullptr;
- if ( pModel )
+ if ( aFraction.GetNumerator() != 1 || aFraction.GetDenominator() != 1 )
{
- fMap = 1.0;
- Fraction aFraction( pModel->GetScaleFraction() );
- if ( aFraction.GetNumerator() != 1 || aFraction.GetDenominator() != 1 )
- {
- fMap *= double(aFraction);
- pMap = &fMap;
- }
- if ( pModel->GetScaleUnit() != MapUnit::Map100thMM )
- {
- DBG_ASSERT( pModel->GetScaleUnit() == MapUnit::MapTwip, "EnhancedCustomShape3d::Current MapMode is Unsupported" );
- fMap *= 1440.0 / 2540.0;
- pMap = &fMap;
- }
+ fMap *= double(aFraction);
+ pMap = &fMap;
+ }
+
+ if ( rSdrObjCustomShape.getSdrModelFromSdrObject().GetScaleUnit() != MapUnit::Map100thMM )
+ {
+ DBG_ASSERT( rSdrObjCustomShape.getSdrModelFromSdrObject().GetScaleUnit() == MapUnit::MapTwip, "EnhancedCustomShape3d::Current MapMode is Unsupported" );
+ fMap *= 1440.0 / 2540.0;
+ pMap = &fMap;
}
+
if ( GetBool( rGeometryItem, "Extrusion", false ) )
{
bool bIsMirroredX(rSdrObjCustomShape.IsMirroredX());
@@ -326,7 +323,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
a3DDefaultAttr.SetDefaultLatheCharacterMode( true );
a3DDefaultAttr.SetDefaultExtrudeCharacterMode( true );
- E3dScene* pScene = new E3dScene;
+ E3dScene* pScene = new E3dScene(rSdrObjCustomShape.getSdrModelFromSdrObject());
bool bSceneHasObjects ( false );
bool bUseTwoFillStyles( false );
@@ -480,10 +477,15 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
aBoundRect2d.Union( aBoundRect );
// #i122777# depth 0 is okay for planes when using double-sided
- E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 0 : fDepth );
+ E3dCompoundObject* p3DObj = new E3dExtrudeObj(
+ rSdrObjCustomShape.getSdrModelFromSdrObject(),
+ a3DDefaultAttr,
+ aPolyPoly,
+ bUseTwoFillStyles ? 0 : fDepth );
p3DObj->NbcSetLayer( pShape2d->GetLayer() );
p3DObj->SetMergedItemSet( aLocalSet );
+
if ( bIsPlaceholderObject )
aPlaceholderObjectList.push_back( p3DObj );
else if ( bUseTwoFillStyles )
@@ -530,7 +532,11 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
}
}
pScene->Insert3DObj( p3DObj );
- p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, fDepth );
+ p3DObj = new E3dExtrudeObj(
+ rSdrObjCustomShape.getSdrModelFromSdrObject(),
+ a3DDefaultAttr,
+ aPolyPoly,
+ fDepth);
p3DObj->NbcSetLayer( pShape2d->GetLayer() );
p3DObj->SetMergedItemSet( aLocalSet );
if ( bUseExtrusionColor )
@@ -541,7 +547,11 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
pScene->Insert3DObj( p3DObj );
// #i122777# depth 0 is okay for planes when using double-sided
- p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, 0 );
+ p3DObj = new E3dExtrudeObj(
+ rSdrObjCustomShape.getSdrModelFromSdrObject(),
+ a3DDefaultAttr,
+ aPolyPoly,
+ 0);
p3DObj->NbcSetLayer( pShape2d->GetLayer() );
p3DObj->SetMergedItemSet( aLocalSet );
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 133c008ebc4e..753d43c3a0c7 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -167,7 +167,7 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText(
if ( dynamic_cast<const SdrObjGroup*>( pRenderedShape) == nullptr )
{
SdrObject* pTmp = pRenderedShape;
- pRenderedShape = new SdrObjGroup();
+ pRenderedShape = new SdrObjGroup(rSdrObjCustomShape.getSdrModelFromSdrObject());
static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
}
static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pShadowGeometry->Clone(), 0 );
@@ -181,10 +181,9 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText(
{
// #i37011# also create a text object and add at rPos + 1
SdrObject* pTextObj = SdrObjFactory::MakeNewObject(
+ rSdrObjCustomShape.getSdrModelFromSdrObject(),
rSdrObjCustomShape.GetObjInventor(),
- OBJ_TEXT,
- nullptr,
- rSdrObjCustomShape.GetModel());
+ OBJ_TEXT);
// Copy text content
OutlinerParaObject* pParaObj(rSdrObjCustomShape.GetOutlinerParaObject());
@@ -233,7 +232,7 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText(
if ( dynamic_cast<const SdrObjGroup*>( pRenderedShape) == nullptr )
{
SdrObject* pTmp = pRenderedShape;
- pRenderedShape = new SdrObjGroup();
+ pRenderedShape = new SdrObjGroup(rSdrObjCustomShape.getSdrModelFromSdrObject());
static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
}
static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTextObj );
@@ -248,12 +247,11 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText(
if ( dynamic_cast<const SdrObjGroup*>( pRenderedShape) == nullptr )
{
SdrObject* pTmp = pRenderedShape;
- pRenderedShape = new SdrObjGroup();
+ pRenderedShape = new SdrObjGroup(rSdrObjCustomShape.getSdrModelFromSdrObject());
static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
}
pRenderedShape->SetPage(rSdrObjCustomShape.GetPage());
- pRenderedShape->SetModel(rSdrObjCustomShape.GetModel());
}
}
@@ -391,9 +389,7 @@ awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
SdrObjCustomShape& rSdrObjCustomShape(static_cast< SdrObjCustomShape& >(*GetSdrObjectFromXShape(mxShape)));
uno::Reference< document::XActionLockable > xLockable( mxShape, uno::UNO_QUERY );
- if(rSdrObjCustomShape.GetModel()
- && xLockable.is()
- && !xLockable->isActionLocked())
+ if(xLockable.is() && !xLockable->isActionLocked())
{
EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
tools::Rectangle aRect( aCustomShape2d.GetTextRect() );
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 71dc441f1727..9bfed5d53ab4 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -853,13 +853,17 @@ SdrObject* CreateSdrObjectFromParagraphOutlines(
++aTextAreaIter;
}
- pRet = new SdrPathObj( OBJ_POLY, aPolyPoly );
+ pRet = new SdrPathObj(
+ rSdrObjCustomShape.getSdrModelFromSdrObject(),
+ OBJ_POLY,
+ aPolyPoly);
SfxItemSet aSet(rSdrObjCustomShape.GetMergedItemSet());
aSet.ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created
aSet.Put(makeSdrShadowItem(false)); // #i37011# NO shadow for FontWork geometry
pRet->SetMergedItemSet( aSet ); // * otherwise we would crash, because the outliner tries to create a Paraobject, but there is no model
}
+
return pRet;
}
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
index b9a8ea76b1bd..9440ce6796a6 100644
--- a/svx/source/dialog/connctrl.cxx
+++ b/svx/source/dialog/connctrl.cxx
@@ -39,7 +39,7 @@
SvxXConnectionPreview::SvxXConnectionPreview( vcl::Window* pParent, WinBits nStyle)
: Control(pParent, nStyle)
, pEdgeObj(nullptr)
- , pObjList(nullptr)
+ , pSdrPage(nullptr)
, pView(nullptr)
{
SetMapMode(MapMode(MapUnit::Map100thMM));
@@ -55,7 +55,7 @@ SvxXConnectionPreview::~SvxXConnectionPreview()
void SvxXConnectionPreview::dispose()
{
- delete pObjList;
+ delete pSdrPage;
Control::dispose();
}
@@ -76,13 +76,13 @@ Size SvxXConnectionPreview::GetOptimalSize() const
void SvxXConnectionPreview::AdaptSize()
{
// Adapt size
- if( !pObjList )
+ if( !pSdrPage )
return;
SetMapMode(MapMode(MapUnit::Map100thMM));
OutputDevice* pOD = pView->GetFirstOutputDevice(); // GetWin( 0 );
- tools::Rectangle aRect = pObjList->GetAllObjBoundRect();
+ tools::Rectangle aRect = pSdrPage->GetAllObjBoundRect();
MapMode aMapMode = GetMapMode();
aMapMode.SetMapUnit( pOD->GetMapMode().GetMapUnit() );
@@ -171,37 +171,43 @@ void SvxXConnectionPreview::Construct()
// potential memory leak here (!). Create SdrObjList only when there is
// not yet one.
- if(!pObjList)
+ if(!pSdrPage)
{
- pObjList = new SdrObjList( pView->GetModel(), nullptr );
+ pSdrPage = new SdrPage(
+ pView->getSdrModelFromSdrView(),
+ false);
}
if( pTmpObj1 )
{
SdrObject* pObj1 = pTmpObj1->Clone();
- pObjList->InsertObject( pObj1 );
+ pSdrPage->InsertObject( pObj1 );
pEdgeObj->ConnectToNode( true, pObj1 );
}
+
if( pTmpObj2 )
{
SdrObject* pObj2 = pTmpObj2->Clone();
- pObjList->InsertObject( pObj2 );
+ pSdrPage->InsertObject( pObj2 );
pEdgeObj->ConnectToNode( false, pObj2 );
}
- pObjList->InsertObject( pEdgeObj );
+
+ pSdrPage->InsertObject( pEdgeObj );
}
}
}
if( !pEdgeObj )
- pEdgeObj = new SdrEdgeObj();
+ {
+ pEdgeObj = new SdrEdgeObj(pView->getSdrModelFromSdrView());
+ }
AdaptSize();
}
void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
- if (pObjList)
+ if (pSdrPage)
{
// This will not work anymore. To not start at Adam and Eve, i will
// ATM not try to change all this stuff to really using an own model
@@ -212,9 +218,9 @@ void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tool
// New stuff: Use a ObjectContactOfObjListPainter.
sdr::contact::SdrObjectVector aObjectVector;
- for (size_t a = 0; a < pObjList->GetObjCount(); ++a)
+ for (size_t a = 0; a < pSdrPage->GetObjCount(); ++a)
{
- SdrObject* pObject = pObjList->GetObj(a);
+ SdrObject* pObject = pSdrPage->GetObj(a);
DBG_ASSERT(pObject,
"SvxXConnectionPreview::Paint: Corrupt ObjectList (!)");
aObjectVector.push_back(pObject);
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx
index e404154ed46d..c041a7240032 100644
--- a/svx/source/dialog/contwnd.cxx
+++ b/svx/source/dialog/contwnd.cxx
@@ -61,7 +61,10 @@ void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
{
basegfx::B2DPolyPolygon aPolyPolygon;
aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon());
- SdrPathObj* pPathObj = new SdrPathObj( OBJ_PATHFILL, aPolyPolygon );
+ SdrPathObj* pPathObj = new SdrPathObj(
+ *pModel,
+ OBJ_PATHFILL,
+ aPolyPolygon);
SfxItemSet aSet(pModel->GetItemPool());
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
index 0eee4586f225..22bb53ba2d18 100644
--- a/svx/source/dialog/dlgctl3d.cxx
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -92,12 +92,12 @@ void Svx3DPreviewControl::Construct()
mpModel->InsertPage( mpFmPage, 0 );
// 3D View
- mp3DView = new E3dView( mpModel, this );
+ mp3DView = new E3dView(*mpModel, this );
mp3DView->SetBufferedOutputAllowed(true);
mp3DView->SetBufferedOverlayAllowed(true);
// 3D Scene
- mpScene = new E3dScene;
+ mpScene = new E3dScene(*mpModel);
// initially create object
SetObjectType(SvxPreviewObjectType::SPHERE);
@@ -204,6 +204,7 @@ void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType)
case SvxPreviewObjectType::SPHERE:
{
mp3DObj = new E3dSphereObj(
+ *mpModel,
mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( 0, 0, 0 ),
basegfx::B3DVector( 5000, 5000, 5000 ));
@@ -213,6 +214,7 @@ void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType)
case SvxPreviewObjectType::CUBE:
{
mp3DObj = new E3dCubeObj(
+ *mpModel,
mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( -2500, -2500, -2500 ),
basegfx::B3DVector( 5000, 5000, 5000 ));
@@ -286,6 +288,7 @@ void Svx3DLightControl::Construct2()
// create invisible expansion object
const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
mpExpansionObject = new E3dCubeObj(
+ *mpModel,
mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
@@ -309,6 +312,7 @@ void Svx3DLightControl::Construct2()
// create object for it
mpLampBottomObject = new E3dPolygonObj(
+ *mpModel,
basegfx::B3DPolyPolygon(a3DCircle));
mpScene->Insert3DObj( mpLampBottomObject );
@@ -322,6 +326,7 @@ void Svx3DLightControl::Construct2()
// create object for it
mpLampShaftObject = new E3dPolygonObj(
+ *mpModel,
basegfx::B3DPolyPolygon(a3DHalfCircle));
mpScene->Insert3DObj( mpLampShaftObject );
@@ -383,6 +388,7 @@ void Svx3DLightControl::ConstructLightObjects()
const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
E3dObject* pNewLight = new E3dSphereObj(
+ *mpModel,
mp3DView->Get3DDefaultAttributes(),
basegfx::B3DPoint( 0, 0, 0 ),
basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index d89b71b3e2a1..7e2ffb67c0e3 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1468,14 +1468,9 @@ SvxXLinePreview::SvxXLinePreview(vcl::Window* pParent)
{
InitSettings( true, true );
- mpLineObjA = new SdrPathObj(OBJ_LINE);
- mpLineObjA->SetModel(&getModel());
-
- mpLineObjB = new SdrPathObj(OBJ_PLIN);
- mpLineObjB->SetModel(&getModel());
-
- mpLineObjC = new SdrPathObj(OBJ_PLIN);
- mpLineObjC->SetModel(&getModel());
+ mpLineObjA = new SdrPathObj(getModel(), OBJ_LINE);
+ mpLineObjB = new SdrPathObj(getModel(), OBJ_PLIN);
+ mpLineObjC = new SdrPathObj(getModel(), OBJ_PLIN);
}
VCL_BUILDER_FACTORY(SvxXLinePreview)
@@ -1563,15 +1558,16 @@ void SvxXLinePreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
}
SvxXRectPreview::SvxXRectPreview(vcl::Window* pParent)
- : SvxPreviewBase(pParent)
- , mpRectangleObject(nullptr)
+: SvxPreviewBase(pParent)
+ ,mpRectangleObject(nullptr)
{
InitSettings(true, true);
// create RectangleObject
const tools::Rectangle aObjectSize(Point(), GetOutputSize());
- mpRectangleObject = new SdrRectObj(aObjectSize);
- mpRectangleObject->SetModel(&getModel());
+ mpRectangleObject = new SdrRectObj(
+ getModel(),
+ aObjectSize);
}
void SvxXRectPreview::Resize()
@@ -1580,8 +1576,9 @@ void SvxXRectPreview::Resize()
SdrObject *pOrigObject = mpRectangleObject;
if (pOrigObject)
{
- mpRectangleObject = new SdrRectObj(aObjectSize);
- mpRectangleObject->SetModel(&getModel());
+ mpRectangleObject = new SdrRectObj(
+ getModel(),
+ aObjectSize);
SetAttributes(pOrigObject->GetMergedItemSet());
SdrObject::Free(pOrigObject);
}
@@ -1637,13 +1634,15 @@ SvxXShadowPreview::SvxXShadowPreview( vcl::Window* pParent )
// create RectangleObject
const tools::Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize );
- mpRectangleObject = new SdrRectObj(aObjectSize);
- mpRectangleObject->SetModel(&getModel());
+ mpRectangleObject = new SdrRectObj(
+ getModel(),
+ aObjectSize);
// create ShadowObject
const tools::Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize );
- mpRectangleShadow = new SdrRectObj(aShadowSize);
- mpRectangleShadow->SetModel(&getModel());
+ mpRectangleShadow = new SdrRectObj(
+ getModel(),
+ aShadowSize);
}
VCL_BUILDER_FACTORY(SvxXShadowPreview)
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 481c55ccd418..07ff51e01fd9 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -142,7 +142,7 @@ void GraphCtrl::InitSdrModel()
pModel->SetChanged( false );
// Creating a View
- pView = new GraphCtrlView( pModel, this );
+ pView = new GraphCtrlView(*pModel, this);
pView->SetWorkArea( tools::Rectangle( Point(), aGraphSize ) );
pView->EnableExtendedMouseEventDispatcher( true );
pView->ShowSdrPage(pView->GetModel()->GetPage(0));
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index da1a22a37ed9..557bbb005a95 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -195,7 +195,10 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
// clipped on CanvasPane
aDrawRect.Intersection( aClipRect );
- pSdrObj = static_cast<SdrObject*>(new SdrRectObj( aDrawRect ));
+ pSdrObj = static_cast<SdrObject*>(
+ new SdrRectObj(
+ *pModel,
+ aDrawRect));
pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapRectangleObject( *pIMapRectObj )));
}
break;
@@ -211,7 +214,13 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
// limited to CanvasPane
aCircle.Intersection( aClipRect );
- pSdrObj = static_cast<SdrObject*>(new SdrCircObj( OBJ_CIRC, aCircle, 0, 36000 ));
+ pSdrObj = static_cast<SdrObject*>(
+ new SdrCircObj(
+ *pModel,
+ OBJ_CIRC,
+ aCircle,
+ 0,
+ 36000));
pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapCircleObject( *pIMapCircleObj )));
}
break;
@@ -228,7 +237,13 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
// clipped on CanvasPane
aDrawRect.Intersection( aClipRect );
- pSdrObj = static_cast<SdrObject*>(new SdrCircObj( OBJ_CIRC, aDrawRect, 0, 36000 ));
+ pSdrObj = static_cast<SdrObject*>(
+ new SdrCircObj(
+ *pModel,
+ OBJ_CIRC,
+ aDrawRect,
+ 0,
+ 36000));
}
else
{
@@ -240,7 +255,11 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
basegfx::B2DPolygon aPolygon;
aPolygon.append(aDrawPoly.getB2DPolygon());
- pSdrObj = static_cast<SdrObject*>(new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aPolygon)));
+ pSdrObj = static_cast<SdrObject*>(
+ new SdrPathObj(
+ *pModel,
+ OBJ_POLY,
+ basegfx::B2DPolyPolygon(aPolygon)));
}
pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapPolygonObject( *pIMapPolyObj )));
@@ -745,7 +764,10 @@ void IMapWindow::CreateDefaultObject()
aPagePos.AdjustY((aPageSize.Height() / 2) - (nDefaultObjectSizeHeight / 2) );
tools::Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
- SdrObject* pObj = SdrObjFactory::MakeNewObject( pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), nullptr, pModel);
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ *pModel,
+ pView->GetCurrentObjInventor(),
+ pView->GetCurrentObjIdentifier());
pObj->SetLogicRect(aNewObjectRectangle);
switch( pObj->GetObjIdentifier() )
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
index ddca770b766d..03e630041189 100644
--- a/svx/source/dialog/measctrl.cxx
+++ b/svx/source/dialog/measctrl.cxx
@@ -42,9 +42,11 @@ SvxXMeasurePreview::SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle)
Point aPt1 = Point(aSize.Width() / 5, static_cast<long>(aSize.Height() / 2));
Point aPt2 = Point(aSize.Width() * 4 / 5, static_cast<long>(aSize.Height() / 2));
- pMeasureObj = new SdrMeasureObj(aPt1, aPt2);
pModel = new SdrModel();
- pMeasureObj->SetModel(pModel);
+ pMeasureObj = new SdrMeasureObj(
+ *pModel,
+ aPt1,
+ aPt2);
bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
SetDrawMode(bHighContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx
index 6583969bb771..509688fe2f77 100644
--- a/svx/source/engine3d/cube3d.cxx
+++ b/svx/source/engine3d/cube3d.cxx
@@ -35,25 +35,31 @@ sdr::contact::ViewContact* E3dCubeObj::CreateObjectSpecificViewContact()
}
-E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& aPos, const basegfx::B3DVector& r3DSize)
-: E3dCompoundObject()
+E3dCubeObj::E3dCubeObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPoint& aPos,
+ const basegfx::B3DVector& r3DSize)
+: E3dCompoundObject(rSdrModel)
{
// Set Defaults
SetDefaultAttributes(rDefault);
- aCubePos = aPos; // position centre or left, bottom, back (dependent on bPosIsCenter)
+ // position centre or left, bottom, back (dependent on bPosIsCenter)
+ aCubePos = aPos;
aCubeSize = r3DSize;
}
-E3dCubeObj::E3dCubeObj()
-: E3dCompoundObject()
+E3dCubeObj::E3dCubeObj(SdrModel& rSdrModel)
+: E3dCompoundObject(rSdrModel)
{
// Set Defaults
- E3dDefaultAttributes aDefault;
+ const E3dDefaultAttributes aDefault;
+
SetDefaultAttributes(aDefault);
}
-void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+void E3dCubeObj::SetDefaultAttributes(const E3dDefaultAttributes& rDefault)
{
aCubePos = rDefault.GetDefaultCubePos();
aCubeSize = rDefault.GetDefaultCubeSize();
@@ -72,9 +78,22 @@ SdrObject *E3dCubeObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/) c
return nullptr;
}
-E3dCubeObj* E3dCubeObj::Clone() const
+E3dCubeObj* E3dCubeObj::Clone(SdrModel* pTargetModel) const
+{
+ return CloneHelper< E3dCubeObj >(pTargetModel);
+}
+
+E3dCubeObj& E3dCubeObj::operator=(const E3dCubeObj& rObj)
{
- return CloneHelper< E3dCubeObj >();
+ if( this == &rObj )
+ return *this;
+ E3dCompoundObject::operator=(rObj);
+
+ aCubePos = rObj.aCubePos;
+ aCubeSize = rObj.aCubeSize;
+ bPosIsCenter = rObj.bPosIsCenter;
+
+ return *this;
}
// Set local parameters with geometry re-creating
diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx
index e55931b568f5..5e070abb6c43 100644
--- a/svx/source/engine3d/dragmt3d.cxx
+++ b/svx/source/engine3d/dragmt3d.cxx
@@ -73,8 +73,7 @@ E3dDragMethod::E3dDragMethod (
if(pE3dObj)
{
// fill new interaction unit
- E3dDragMethodUnit aNewUnit;
- aNewUnit.mp3DObj = pE3dObj;
+ E3dDragMethodUnit aNewUnit(*pE3dObj);
// get transformations
aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform();
@@ -157,13 +156,15 @@ bool E3dDragMethod::EndSdrDrag(bool /*bCopy*/)
for(nOb=0;nOb<nCnt;nOb++)
{
E3dDragMethodUnit& rCandidate = maGrp[nOb];
- E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
- rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
if( bUndo )
{
- getSdrDragView().AddUndo(new E3dRotateUndoAction(rCandidate.mp3DObj->GetModel(),
- rCandidate.mp3DObj, rCandidate.maInitTransform,
- rCandidate.maTransform));
+ getSdrDragView().AddUndo(
+ new E3dRotateUndoAction(
+ rCandidate.mr3DObj,
+ rCandidate.maInitTransform,
+ rCandidate.maTransform));
}
}
if( bUndo )
@@ -185,8 +186,8 @@ void E3dDragMethod::CancelSdrDrag()
{
// Restore transformation
E3dDragMethodUnit& rCandidate = maGrp[nOb];
- E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
- rCandidate.mp3DObj->SetTransform(rCandidate.maInitTransform);
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maInitTransform);
}
}
}
@@ -224,7 +225,7 @@ void E3dDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay
if(nPlyCnt)
{
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact());
const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform);
@@ -261,7 +262,7 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
if(nCnt)
{
- const E3dScene *pScene = maGrp[0].mp3DObj->GetScene();
+ const E3dScene *pScene = maGrp[0].mr3DObj.GetScene();
if(pScene)
{
@@ -271,7 +272,7 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
E3dDragMethodUnit& rCandidate = maGrp[nOb];
- basegfx::B3DPoint aObjCenter = rCandidate.mp3DObj->GetBoundVolume().getCenter();
+ basegfx::B3DPoint aObjCenter = rCandidate.mr3DObj.GetBoundVolume().getCenter();
const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
aObjCenter = aTransform * aObjCenter;
@@ -387,7 +388,7 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt)
}
// Transformation in eye coordinates, there rotate then and back
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact());
const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
aInverseOrientation.invert();
@@ -405,8 +406,8 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt)
if(mbMoveFull)
{
- E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
- rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
}
else
{
@@ -504,7 +505,7 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt)
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
E3dDragMethodUnit& rCandidate = maGrp[nOb];
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact());
const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
// move coor from 2d world to 3d Eye
@@ -554,8 +555,8 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt)
if(mbMoveFull)
{
- E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
- rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
}
else
{
@@ -575,10 +576,10 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt)
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
E3dDragMethodUnit& rCandidate = maGrp[nOb];
- const basegfx::B3DPoint aObjectCenter(rCandidate.mp3DObj->GetBoundVolume().getCenter());
+ const basegfx::B3DPoint aObjectCenter(rCandidate.mr3DObj.GetBoundVolume().getCenter());
// transform from 2D world view to 3D eye
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact());
const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
basegfx::B2DPoint aGlobalScaleStart2D(static_cast<double>(aStartPos.X()), static_cast<double>(aStartPos.Y()));
@@ -673,14 +674,14 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt)
if(mbMoveFull)
{
- E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
- rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj);
+ rCandidate.mr3DObj.SetTransform(rCandidate.maTransform);
}
else
{
Hide();
rCandidate.maWireframePoly.clear();
- rCandidate.maWireframePoly = rCandidate.mp3DObj->CreateWireframe();
+ rCandidate.maWireframePoly = rCandidate.mr3DObj.CreateWireframe();
rCandidate.maWireframePoly.transform(rCandidate.maTransform);
Show();
}
diff --git a/svx/source/engine3d/e3dsceneupdater.cxx b/svx/source/engine3d/e3dsceneupdater.cxx
index bc696daebafb..28c472727e17 100644
--- a/svx/source/engine3d/e3dsceneupdater.cxx
+++ b/svx/source/engine3d/e3dsceneupdater.cxx
@@ -29,30 +29,27 @@ E3DModifySceneSnapRectUpdater::E3DModifySceneSnapRectUpdater(const SdrObject* pO
mpViewInformation3D(nullptr)
{
// Secure old 3D transformation stack before modification
- if(pObject)
+ if(const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject))
{
- const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject);
+ mpScene = pE3dObject->GetScene();
- if(pE3dObject)
+ if(mpScene && mpScene->GetScene() == mpScene)
{
- mpScene = pE3dObject->GetScene();
+ // if there is a scene and it's the outmost scene, get current 3D range
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
+ const basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
- if(mpScene && mpScene->GetScene() == mpScene)
+ if(aAllContentRange.isEmpty())
{
- // if there is a scene and it's the outmost scene, get current 3D range
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
- const basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
-
- if(aAllContentRange.isEmpty())
- {
- // no content, nothing to do
- mpScene = nullptr;
- }
- else
- {
- // secure current 3D transformation stack
- mpViewInformation3D.reset( new drawinglayer::geometry::ViewInformation3D(rVCScene.getViewInformation3D(aAllContentRange)) );
- }
+ // no content, nothing to do
+ mpScene = nullptr;
+ }
+ else
+ {
+ // secure current 3D transformation stack
+ mpViewInformation3D.reset(
+ new drawinglayer::geometry::ViewInformation3D(
+ rVCScene.getViewInformation3D(aAllContentRange)));
}
}
}
diff --git a/svx/source/engine3d/e3dundo.cxx b/svx/source/engine3d/e3dundo.cxx
index e194dd661ef1..47268fcda660 100644
--- a/svx/source/engine3d/e3dundo.cxx
+++ b/svx/source/engine3d/e3dundo.cxx
@@ -38,36 +38,32 @@ bool E3dUndoAction::CanRepeat(SfxRepeatTarget&) const
// Undo destructor for 3D-Rotation
-
-E3dRotateUndoAction::~E3dRotateUndoAction ()
+E3dRotateUndoAction::~E3dRotateUndoAction()
{
}
// Undo for 3D-Rotation on the Rotation matrix
-
-void E3dRotateUndoAction::Undo ()
+void E3dRotateUndoAction::Undo()
{
- E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
- pMy3DObj->SetTransform(aMyOldRotation);
+ E3DModifySceneSnapRectUpdater aUpdater(&mrMy3DObj);
+ mrMy3DObj.SetTransform(maMyOldRotation);
}
// Redo for 3D-Rotation on the Rotation matrix
-
-void E3dRotateUndoAction::Redo ()
+void E3dRotateUndoAction::Redo()
{
- E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
- pMy3DObj->SetTransform(aMyNewRotation);
+ E3DModifySceneSnapRectUpdater aUpdater(&mrMy3DObj);
+ mrMy3DObj.SetTransform(maMyNewRotation);
}
-
-E3dAttributesUndoAction::E3dAttributesUndoAction( SdrModel &rModel,
- E3dObject* pInObject,
- const SfxItemSet& rNewSet,
- const SfxItemSet& rOldSet)
- : SdrUndoAction( rModel )
- , pObject ( pInObject )
- , aNewSet ( rNewSet )
- , aOldSet ( rOldSet )
+E3dAttributesUndoAction::E3dAttributesUndoAction(
+ E3dObject& rInObject,
+ const SfxItemSet& rNewSet,
+ const SfxItemSet& rOldSet)
+: SdrUndoAction(rInObject.getSdrModelFromSdrObject())
+ ,mrObject(rInObject)
+ ,maNewSet(rNewSet)
+ ,maOldSet(rOldSet)
{
}
@@ -80,18 +76,17 @@ E3dAttributesUndoAction::~E3dAttributesUndoAction()
void E3dAttributesUndoAction::Undo()
{
- E3DModifySceneSnapRectUpdater aUpdater(pObject);
- pObject->SetMergedItemSetAndBroadcast(aOldSet);
+ E3DModifySceneSnapRectUpdater aUpdater(&mrObject);
+ mrObject.SetMergedItemSetAndBroadcast(maOldSet);
}
void E3dAttributesUndoAction::Redo()
{
- E3DModifySceneSnapRectUpdater aUpdater(pObject);
- pObject->SetMergedItemSetAndBroadcast(aNewSet);
+ E3DModifySceneSnapRectUpdater aUpdater(&mrObject);
+ mrObject.SetMergedItemSetAndBroadcast(maNewSet);
}
// Multiple Undo is not possible
-
bool E3dAttributesUndoAction::CanRepeat(SfxRepeatTarget& /*rView*/) const
{
return false;
diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx
index 3b3bb93956c3..0a929970e50e 100644
--- a/svx/source/engine3d/extrud3d.cxx
+++ b/svx/source/engine3d/extrud3d.cxx
@@ -39,24 +39,24 @@
// DrawContact section
-
sdr::contact::ViewContact* E3dExtrudeObj::CreateObjectSpecificViewContact()
{
return new sdr::contact::ViewContactOfE3dExtrude(*this);
}
-
sdr::properties::BaseProperties* E3dExtrudeObj::CreateObjectSpecificProperties()
{
return new sdr::properties::E3dExtrudeProperties(*this);
}
-
// Constructor creates a two cover surface tools::PolyPolygon and (point-count 1) side
// surfaces rectangles from the passed PolyPolygon
-
-E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes const & rDefault, const basegfx::B2DPolyPolygon& rPP, double fDepth)
-: E3dCompoundObject(),
+E3dExtrudeObj::E3dExtrudeObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B2DPolyPolygon& rPP,
+ double fDepth)
+: E3dCompoundObject(rSdrModel),
maExtrudePolygon(rPP)
{
// since the old class PolyPolygon3D did mirror the given PolyPolygons in Y, do the same here
@@ -71,15 +71,16 @@ E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes const & rDefault, const basegf
GetProperties().SetObjectItemDirect(makeSvx3DDepthItem(static_cast<sal_uInt32>(fDepth + 0.5)));
}
-E3dExtrudeObj::E3dExtrudeObj()
-: E3dCompoundObject()
+E3dExtrudeObj::E3dExtrudeObj(SdrModel& rSdrModel)
+: E3dCompoundObject(rSdrModel)
{
// Set Defaults
- E3dDefaultAttributes aDefault;
+ const E3dDefaultAttributes aDefault;
+
SetDefaultAttributes(aDefault);
}
-void E3dExtrudeObj::SetDefaultAttributes(E3dDefaultAttributes const & rDefault)
+void E3dExtrudeObj::SetDefaultAttributes(const E3dDefaultAttributes& rDefault)
{
GetProperties().SetObjectItemDirect(Svx3DSmoothNormalsItem(rDefault.GetDefaultExtrudeSmoothed()));
GetProperties().SetObjectItemDirect(Svx3DSmoothLidsItem(rDefault.GetDefaultExtrudeSmoothFrontBack()));
@@ -97,11 +98,21 @@ sal_uInt16 E3dExtrudeObj::GetObjIdentifier() const
return E3D_EXTRUDEOBJ_ID;
}
-E3dExtrudeObj* E3dExtrudeObj::Clone() const
+E3dExtrudeObj* E3dExtrudeObj::Clone(SdrModel* pTargetModel) const
{
- return CloneHelper< E3dExtrudeObj >();
+ return CloneHelper< E3dExtrudeObj >(pTargetModel);
}
+E3dExtrudeObj& E3dExtrudeObj::operator=(const E3dExtrudeObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
+ E3dCompoundObject::operator=(rObj);
+
+ maExtrudePolygon = rObj.maExtrudePolygon;
+
+ return *this;
+}
// Set local parameters with geometry re-creating
@@ -194,7 +205,7 @@ SdrAttrObj* E3dExtrudeObj::GetBreakObj()
{
// create PathObj
basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(aBackSide);
- SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aPoly);
+ SdrPathObj* pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PLIN, aPoly);
SfxItemSet aSet(GetObjectItemSet());
aSet.Put(XLineStyleItem(css::drawing::LineStyle_SOLID));
diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx
index 99268c6d5ff8..74097eb29f63 100644
--- a/svx/source/engine3d/lathe3d.cxx
+++ b/svx/source/engine3d/lathe3d.cxx
@@ -37,23 +37,22 @@
// DrawContact section
-
sdr::contact::ViewContact* E3dLatheObj::CreateObjectSpecificViewContact()
{
return new sdr::contact::ViewContactOfE3dLathe(*this);
}
-
sdr::properties::BaseProperties* E3dLatheObj::CreateObjectSpecificProperties()
{
return new sdr::properties::E3dLatheProperties(*this);
}
-
// Constructor from 3D polygon, scale is the conversion factor for the coordinates
-
-E3dLatheObj::E3dLatheObj(E3dDefaultAttributes const & rDefault, const basegfx::B2DPolyPolygon& rPoly2D)
-: E3dCompoundObject(),
+E3dLatheObj::E3dLatheObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B2DPolyPolygon& rPoly2D)
+: E3dCompoundObject(rSdrModel),
maPolyPoly2D(rPoly2D)
{
// since the old class PolyPolygon3D did mirror the given PolyPolygons in Y, do the same here
@@ -82,15 +81,16 @@ E3dLatheObj::E3dLatheObj(E3dDefaultAttributes const & rDefault, const basegfx::B
}
}
-E3dLatheObj::E3dLatheObj()
-: E3dCompoundObject()
+E3dLatheObj::E3dLatheObj(SdrModel& rSdrModel)
+: E3dCompoundObject(rSdrModel)
{
// Set Defaults
- E3dDefaultAttributes aDefault;
+ const E3dDefaultAttributes aDefault;
+
SetDefaultAttributes(aDefault);
}
-void E3dLatheObj::SetDefaultAttributes(E3dDefaultAttributes const & rDefault)
+void E3dLatheObj::SetDefaultAttributes(const E3dDefaultAttributes& rDefault)
{
GetProperties().SetObjectItemDirect(Svx3DSmoothNormalsItem(rDefault.GetDefaultLatheSmoothed()));
GetProperties().SetObjectItemDirect(Svx3DSmoothLidsItem(rDefault.GetDefaultLatheSmoothFrontBack()));
@@ -104,9 +104,20 @@ sal_uInt16 E3dLatheObj::GetObjIdentifier() const
return E3D_LATHEOBJ_ID;
}
-E3dLatheObj* E3dLatheObj::Clone() const
+E3dLatheObj* E3dLatheObj::Clone(SdrModel* pTargetModel) const
{
- return CloneHelper< E3dLatheObj >();
+ return CloneHelper< E3dLatheObj >(pTargetModel);
+}
+
+E3dLatheObj& E3dLatheObj::operator=(const E3dLatheObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
+ E3dCompoundObject::operator=(rObj);
+
+ maPolyPoly2D = rObj.maPolyPoly2D;
+
+ return *this;
}
// Convert the object to group object consisting of n polygons
@@ -176,7 +187,7 @@ SdrAttrObj* E3dLatheObj::GetBreakObj()
// create PathObj
basegfx::B3DPolyPolygon aLathePoly3D(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(maPolyPoly2D));
basegfx::B2DPolyPolygon aTransPoly(TransformToScreenCoor(aLathePoly3D));
- SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aTransPoly);
+ SdrPathObj* pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PLIN, aTransPoly);
// Set Attribute
SfxItemSet aSet(GetObjectItemSet());
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 73a0675efdb4..959ecf1f0c49 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -81,16 +81,16 @@ using namespace com::sun::star;
// List for 3D-Objects
-
-
E3dObjList::E3dObjList()
-: SdrObjList(nullptr, nullptr)
+: SdrObjList(nullptr)
{
}
-E3dObjList::E3dObjList(const E3dObjList&)
-: SdrObjList()
+E3dObjList* E3dObjList::CloneSdrObjList(SdrModel* pNewModel) const
{
+ E3dObjList* pObjList = new E3dObjList();
+ pObjList->lateInitSdrObjList(*this, pNewModel);
+ return pObjList;
}
E3dObjList::~E3dObjList()
@@ -169,8 +169,9 @@ sdr::properties::BaseProperties* E3dObject::CreateObjectSpecificProperties()
}
-E3dObject::E3dObject()
-: maSubList(),
+E3dObject::E3dObject(SdrModel& rSdrModel)
+: SdrAttrObj(rSdrModel),
+ maSubList(),
maLocalBoundVol(),
maTransformation(),
maFullTransform(),
@@ -303,14 +304,7 @@ void E3dObject::SetPage(SdrPage* pNewPage)
maSubList.SetPage(pNewPage);
}
-void E3dObject::SetModel(SdrModel* pNewModel)
-{
- SdrAttrObj::SetModel(pNewModel);
- maSubList.SetModel(pNewModel);
-}
-
// resize object, used from old 2d interfaces, e.g. in Move/Scale dialog (F4)
-
void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
{
// Movement in X, Y in the eye coordinate system
@@ -656,9 +650,9 @@ OUString E3dObject::TakeObjNamePlural() const
return ImpGetResStr(STR_ObjNamePluralObj3d);
}
-E3dObject* E3dObject::Clone() const
+E3dObject* E3dObject::Clone(SdrModel* pTargetModel) const
{
- return CloneHelper< E3dObject >();
+ return CloneHelper< E3dObject >(pTargetModel);
}
E3dObject& E3dObject::operator=(const E3dObject& rObj)
@@ -736,9 +730,8 @@ sdr::properties::BaseProperties* E3dCompoundObject::CreateObjectSpecificProperti
return new sdr::properties::E3dCompoundProperties(*this);
}
-
-E3dCompoundObject::E3dCompoundObject()
-: E3dObject(),
+E3dCompoundObject::E3dCompoundObject(SdrModel& rSdrModel)
+: E3dObject(rSdrModel),
aMaterialAmbientColor()
{
// Set defaults
@@ -881,9 +874,20 @@ void E3dCompoundObject::RecalcSnapRect()
}
}
-E3dCompoundObject* E3dCompoundObject::Clone() const
+E3dCompoundObject* E3dCompoundObject::Clone(SdrModel* pTargetModel) const
{
- return CloneHelper< E3dCompoundObject >();
+ return CloneHelper< E3dCompoundObject >(pTargetModel);
+}
+
+E3dCompoundObject& E3dCompoundObject::operator=(const E3dCompoundObject& rObj)
+{
+ if( this == &rObj )
+ return *this;
+ E3dObject::operator=(rObj);
+
+ aMaterialAmbientColor = rObj.aMaterialAmbientColor;
+
+ return *this;
}
// convert given basegfx::B3DPolyPolygon to screen coor
diff --git a/svx/source/engine3d/objfac3d.cxx b/svx/source/engine3d/objfac3d.cxx
index b704cf2b848d..58e1479e413b 100644
--- a/svx/source/engine3d/objfac3d.cxx
+++ b/svx/source/engine3d/objfac3d.cxx
@@ -52,24 +52,19 @@ IMPL_STATIC_LINK( E3dObjFactory, MakeObject, SdrObjCreatorParams, aParams, SdrOb
switch ( aParams.nObjIdentifier )
{
case E3D_SCENE_ID:
- return new E3dScene();
+ return new E3dScene(aParams.rSdrModel);
case E3D_POLYGONOBJ_ID :
- return new E3dPolygonObj();
+ return new E3dPolygonObj(aParams.rSdrModel);
case E3D_CUBEOBJ_ID :
- return new E3dCubeObj();
+ return new E3dCubeObj(aParams.rSdrModel);
case E3D_SPHEREOBJ_ID:
- // Gets the dummy constructor, as this is only called when
- // loading documents. The actual number of segments is however
- // determined only after loading the members. This will result
- // in that the first sphere will be immediately destroyed,
- // although it was never used.
- return new E3dSphereObj(E3dSphereObj::DUMMY);
+ return new E3dSphereObj(aParams.rSdrModel);
case E3D_EXTRUDEOBJ_ID:
- return new E3dExtrudeObj();
+ return new E3dExtrudeObj(aParams.rSdrModel);
case E3D_LATHEOBJ_ID:
- return new E3dLatheObj();
+ return new E3dLatheObj(aParams.rSdrModel);
case E3D_COMPOUNDOBJ_ID:
- return new E3dCompoundObject();
+ return new E3dCompoundObject(aParams.rSdrModel);
}
}
return nullptr;
diff --git a/svx/source/engine3d/polygn3d.cxx b/svx/source/engine3d/polygn3d.cxx
index 190c0ca89ee5..bcb9ba81b9eb 100644
--- a/svx/source/engine3d/polygn3d.cxx
+++ b/svx/source/engine3d/polygn3d.cxx
@@ -25,17 +25,16 @@
#include <basegfx/polygon/b3dpolygon.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
-
// DrawContact section
-
sdr::contact::ViewContact* E3dPolygonObj::CreateObjectSpecificViewContact()
{
return new sdr::contact::ViewContactOfE3dPolygon(*this);
}
E3dPolygonObj::E3dPolygonObj(
+ SdrModel& rSdrModel,
const basegfx::B3DPolyPolygon& rPolyPoly3D)
-: E3dCompoundObject(),
+: E3dCompoundObject(rSdrModel),
bLineOnly(true)
{
// Set geometry
@@ -48,9 +47,9 @@ E3dPolygonObj::E3dPolygonObj(
CreateDefaultTexture();
}
-E3dPolygonObj::E3dPolygonObj()
-: E3dCompoundObject(),
- bLineOnly(false) // added missing initialisation
+E3dPolygonObj::E3dPolygonObj(SdrModel& rSdrModel)
+: E3dCompoundObject(rSdrModel),
+ bLineOnly(false)
{
// Create no geometry
}
@@ -219,9 +218,23 @@ SdrObject *E3dPolygonObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/
return nullptr;
}
-E3dPolygonObj* E3dPolygonObj::Clone() const
+E3dPolygonObj* E3dPolygonObj::Clone(SdrModel* pTargetModel) const
{
- return CloneHelper< E3dPolygonObj >();
+ return CloneHelper< E3dPolygonObj >(pTargetModel);
+}
+
+E3dPolygonObj& E3dPolygonObj::operator=(const E3dPolygonObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
+ E3dCompoundObject::operator=(rObj);
+
+ aPolyPoly3D = rObj.aPolyPoly3D;
+ aPolyNormals3D = rObj.aPolyNormals3D;
+ aPolyTexture2D = rObj.aPolyTexture2D;
+ bLineOnly = rObj.bLineOnly;
+
+ return *this;
}
void E3dPolygonObj::SetLineOnly(bool bNew)
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 444331de3472..38961d3ccfa8 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -170,8 +170,8 @@ sdr::contact::ViewContact* E3dScene::CreateObjectSpecificViewContact()
}
-E3dScene::E3dScene()
-: E3dObject(),
+E3dScene::E3dScene(SdrModel& rSdrModel)
+: E3dObject(rSdrModel),
aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
mp3DDepthRemapper(nullptr),
bDrawOnlySelected(false),
@@ -411,24 +411,9 @@ void E3dScene::removeAllNonSelectedObjects()
}
}
-E3dScene* E3dScene::Clone() const
+E3dScene* E3dScene::Clone(SdrModel* pTargetModel) const
{
- return CloneHelper< E3dScene >();
-}
-
-void E3dScene::SuspendReportingDirtyRects()
-{
- GetScene()->mbSkipSettingDirty = true;
-}
-
-void E3dScene::ResumeReportingDirtyRects()
-{
- GetScene()->mbSkipSettingDirty = false;
-}
-
-void E3dScene::SetAllSceneRectsDirty()
-{
- GetScene()->SetRectsDirty();
+ return CloneHelper< E3dScene >(pTargetModel);
}
E3dScene& E3dScene::operator=(const E3dScene& rObj)
@@ -463,6 +448,21 @@ E3dScene& E3dScene::operator=(const E3dScene& rObj)
return *this;
}
+void E3dScene::SuspendReportingDirtyRects()
+{
+ GetScene()->mbSkipSettingDirty = true;
+}
+
+void E3dScene::ResumeReportingDirtyRects()
+{
+ GetScene()->mbSkipSettingDirty = false;
+}
+
+void E3dScene::SetAllSceneRectsDirty()
+{
+ GetScene()->SetRectsDirty();
+}
+
// Rebuild Light- and label- object lists rebuild (after loading, allocation)
void E3dScene::RebuildLists()
diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx
index ecac05170094..75670c2e28d7 100644
--- a/svx/source/engine3d/sphere3d.cxx
+++ b/svx/source/engine3d/sphere3d.cxx
@@ -33,25 +33,24 @@
#include <sdr/contact/viewcontactofe3dsphere.hxx>
#include <basegfx/polygon/b3dpolygon.hxx>
-
// DrawContact section
-
sdr::contact::ViewContact* E3dSphereObj::CreateObjectSpecificViewContact()
{
return new sdr::contact::ViewContactOfE3dSphere(*this);
}
-
sdr::properties::BaseProperties* E3dSphereObj::CreateObjectSpecificProperties()
{
return new sdr::properties::E3dSphereProperties(*this);
}
-
// Build Sphere from polygon facets in latitude and longitude
-
-E3dSphereObj::E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize)
-: E3dCompoundObject()
+E3dSphereObj::E3dSphereObj(
+ SdrModel& rSdrModel,
+ const E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPoint& rCenter,
+ const basegfx::B3DVector& r3DSize)
+: E3dCompoundObject(rSdrModel)
{
// Set defaults
SetDefaultAttributes(rDefault);
@@ -60,23 +59,16 @@ E3dSphereObj::E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoi
aSize = r3DSize;
}
-// Create Sphere without creating the Polygons within
-
-// This call is from the 3D Object Factory (objfac3d.cxx) and only when loading
-// of documents. Here you do not need CreateSphere call, since the real number
-// of segments is not even known yet. This was until 10.02.1997 a (small)
-// memory leak.
-
-E3dSphereObj::E3dSphereObj(Dummy /*dummy*/)
-// the parameters it needs to be able to distinguish which
-// constructors of the two is meant. The above is the default.
+E3dSphereObj::E3dSphereObj(SdrModel& rSdrModel)
+: E3dCompoundObject(rSdrModel)
{
// Set defaults
- E3dDefaultAttributes aDefault;
+ const E3dDefaultAttributes aDefault;
+
SetDefaultAttributes(aDefault);
}
-void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+void E3dSphereObj::SetDefaultAttributes(const E3dDefaultAttributes& rDefault)
{
// Set defaults
aCenter = rDefault.GetDefaultSphereCenter();
@@ -95,9 +87,21 @@ SdrObject *E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, bool /*bAddText*/)
return nullptr;
}
-E3dSphereObj* E3dSphereObj::Clone() const
+E3dSphereObj* E3dSphereObj::Clone(SdrModel* pTargetModel) const
+{
+ return CloneHelper< E3dSphereObj >(pTargetModel);
+}
+
+E3dSphereObj& E3dSphereObj::operator=(const E3dSphereObj& rObj)
{
- return CloneHelper< E3dSphereObj >();
+ if( this == &rObj )
+ return *this;
+ E3dCompoundObject::operator=(rObj);
+
+ aCenter = rObj.aCenter;
+ aSize = rObj.aSize;
+
+ return *this;
}
// Set local parameters with geometry re-creating
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 33d051f23309..31d6c36bb44c 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -224,10 +224,12 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr
}
}
-E3dView::E3dView(SdrModel* pModel, OutputDevice* pOut) :
- SdrView(pModel, pOut)
+E3dView::E3dView(
+ SdrModel& rSdrModel,
+ OutputDevice* pOut)
+: SdrView(rSdrModel, pOut)
{
- InitView ();
+ InitView();
}
// DrawMarkedObj override, since possibly only a single 3D object is to be
@@ -579,7 +581,6 @@ bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dSce
pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans);
// fill and insert new object
- pNewCompoundObj->SetModel(pDstScene->GetModel());
pNewCompoundObj->SetPage(pDstScene->GetPage());
pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer());
pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), true);
@@ -700,10 +701,15 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, boo
if(pPath)
{
E3dDefaultAttributes aDefault = Get3DDefaultAttributes();
+
if(bExtrude)
+ {
aDefault.SetDefaultExtrudeCharacterMode(true);
+ }
else
+ {
aDefault.SetDefaultLatheCharacterMode(true);
+ }
// Get Itemset of the original object
SfxItemSet aSet(pObj->GetMergedItemSet());
@@ -736,13 +742,13 @@ void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, boo
E3dObject* p3DObj = nullptr;
if(bExtrude)
{
- p3DObj = new E3dExtrudeObj(aDefault, pPath->GetPathPoly(), fDepth);
+ p3DObj = new E3dExtrudeObj(pObj->getSdrModelFromSdrObject(), aDefault, pPath->GetPathPoly(), fDepth);
}
else
{
basegfx::B2DPolyPolygon aPolyPoly2D(pPath->GetPathPoly());
aPolyPoly2D.transform(rLatheMat);
- p3DObj = new E3dLatheObj(aDefault, aPolyPoly2D);
+ p3DObj = new E3dLatheObj(pObj->getSdrModelFromSdrObject(), aDefault, aPolyPoly2D);
}
// Set attribute
@@ -836,8 +842,10 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1
else
BegUndo(SvxResId(RID_SVX_3D_UNDO_LATHE));
+ SdrModel& rSdrModel(GetSdrMarkByIndex(0)->GetMarkedSdrObj()->getSdrModelFromSdrObject());
+
// Create a new scene for the created 3D object
- E3dScene* pScene = new E3dScene;
+ E3dScene* pScene = new E3dScene(rSdrModel);
// Determine rectangle and possibly correct it
tools::Rectangle aRect = GetAllMarkedRect();
@@ -1262,7 +1270,6 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut,
}
// Set current 3D drawing object, create the scene for this
-
E3dScene* E3dView::SetCurrent3DObj(E3dObject* p3DObj)
{
DBG_ASSERT(p3DObj != nullptr, "Who puts in a NULL-pointer here");
@@ -1275,7 +1282,7 @@ E3dScene* E3dView::SetCurrent3DObj(E3dObject* p3DObj)
tools::Rectangle aRect(0,0, static_cast<long>(fW), static_cast<long>(fH));
- E3dScene* pScene = new E3dScene;
+ E3dScene* pScene = new E3dScene(p3DObj->getSdrModelFromSdrObject());
InitScene(pScene, fW, fH, aVolume.getMaxZ() + ((fW + fH) / 4.0));
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;
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index d9e6a205cbfe..a91fabd1c527 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -458,7 +458,7 @@ bool SgaObjectSvDraw::CreateThumb( const FmFormModel& rModel )
if(aObjRect.GetWidth() && aObjRect.GetHeight())
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
- FmFormView aView(const_cast< FmFormModel* >(&rModel), pVDev);
+ FmFormView aView(const_cast< FmFormModel& >(rModel), pVDev);
aView.ShowSdrPage(const_cast< FmFormPage* >(pPage));
aView.MarkAllObj();
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index de21ba0307bb..9c8b27bef7d5 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -801,7 +801,7 @@ bool GalleryTheme::GetGraphic(sal_uInt32 nPos, Graphic& rGraphic)
{
ScopedVclPtrInstance< VirtualDevice > pVDev;
pVDev->SetMapMode( MapMode( MapUnit::Map100thMM ) );
- FmFormView aView( aModel.GetModel(), pVDev );
+ FmFormView aView(*aModel.GetModel(), pVDev);
aView.hideMarkHandles();
aView.ShowSdrPage(aView.GetModel()->GetPage(0));
@@ -1244,7 +1244,7 @@ bool GalleryTheme::InsertTransferable(const uno::Reference< datatransfer::XTrans
if( aModel.GetModel() )
{
SdrPage* pPage = aModel.GetModel()->GetPage(0);
- SdrGrafObj* pGrafObj = new SdrGrafObj( *pGraphic );
+ SdrGrafObj* pGrafObj = new SdrGrafObj(*aModel.GetModel(), *pGraphic );
pGrafObj->AppendUserData( new SgaIMapInfo( aImageMap ) );
pPage->InsertObject( pGrafObj );
diff --git a/svx/source/inc/cell.hxx b/svx/source/inc/cell.hxx
index 5b7f71b04c89..86c7579e1726 100644
--- a/svx/source/inc/cell.hxx
+++ b/svx/source/inc/cell.hxx
@@ -91,8 +91,6 @@ public:
SVX_DLLPRIVATE SdrTextVertAdjust GetTextVerticalAdjust() const;
SdrTextHorzAdjust GetTextHorizontalAdjust() const;
- SVX_DLLPRIVATE virtual void SetModel(SdrModel* pNewModel) override;
-
SVX_DLLPRIVATE void merge( sal_Int32 nColumnSpan, sal_Int32 nRowSpan );
SVX_DLLPRIVATE void mergeContent( const CellRef& xSourceCell );
SVX_DLLPRIVATE void replaceContentAndFormating( const CellRef& xSourceCell );
diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx
index 6b9adf61c548..da9f7c6fbfd7 100644
--- a/svx/source/inc/fmobj.hxx
+++ b/svx/source/inc/fmobj.hxx
@@ -27,7 +27,7 @@
// FmFormObj
-class SVX_DLLPUBLIC FmFormObj: public SdrUnoObj
+class SVX_DLLPUBLIC FmFormObj : public SdrUnoObj
{
FmFormObj( const FmFormObj& ) = delete;
@@ -47,9 +47,10 @@ class SVX_DLLPUBLIC FmFormObj: public SdrUnoObj
// only to be used for comparison with the current ref device!
public:
- FmFormObj(const OUString& rModelName);
- FmFormObj();
-
+ FmFormObj(
+ SdrModel& rSdrModel,
+ const OUString& rModelName);
+ FmFormObj(SdrModel& rSdrModel);
SAL_DLLPRIVATE const css::uno::Reference< css::container::XIndexContainer>&
GetOriginalParent() const { return m_xParent; }
@@ -72,12 +73,10 @@ public:
SAL_DLLPRIVATE virtual sal_uInt16 GetObjIdentifier() const override;
SAL_DLLPRIVATE virtual void NbcReformatText() override;
- SAL_DLLPRIVATE virtual FmFormObj* Clone() const override;
+ SAL_DLLPRIVATE virtual FmFormObj* Clone(SdrModel* pTargetModel = nullptr) const override;
// #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const;
SAL_DLLPRIVATE FmFormObj& operator= (const FmFormObj& rObj);
- SAL_DLLPRIVATE virtual void SetModel(SdrModel* pNewModel) override;
-
SAL_DLLPRIVATE void clonedFrom(const FmFormObj* _pSource);
SAL_DLLPRIVATE static css::uno::Reference< css::uno::XInterface> ensureModelEnv(
diff --git a/svx/source/inc/tablemodel.hxx b/svx/source/inc/tablemodel.hxx
index e59626da0200..791a4310f190 100644
--- a/svx/source/inc/tablemodel.hxx
+++ b/svx/source/inc/tablemodel.hxx
@@ -176,7 +176,7 @@ private:
rtl::Reference< TableColumns > mxTableColumns;
rtl::Reference< TableRows > mxTableRows;
- SdrTableObj* mpTableObj;
+ SdrTableObj* mpTableObj; // TTTT should be reference
bool mbModified;
bool mbNotifyPending;
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index b7c3086fe735..3c0622bad264 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -241,7 +241,7 @@ namespace sdr
aDraftText += " ...";
}
- if (!aDraftText.isEmpty() && GetGrafObject().GetModel())
+ if (!aDraftText.isEmpty())
{
// #i103255# Goal is to produce TextPrimitives which hold the given text as
// BlockText in the available space. It would be very tricky to do
@@ -253,8 +253,7 @@ namespace sdr
// needed and can be deleted.
// create temp RectObj as TextObj and set needed attributes
- SdrRectObj aRectObj(OBJ_TEXT);
- aRectObj.SetModel(GetGrafObject().GetModel());
+ SdrRectObj aRectObj(GetGrafObject().getSdrModelFromSdrObject(), OBJ_TEXT);
aRectObj.NbcSetText(aDraftText);
aRectObj.SetMergedItem(SvxColorItem(COL_LIGHTRED, EE_CHAR_COLOR));
diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
index c0ab639395de..f02ba917280c 100644
--- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
@@ -72,8 +72,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrRectObj::createV
drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
// #i105856# use knowledge about pickthrough from the model
- const bool bPickThroughTransparentTextFrames(
- GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames());
+ const bool bPickThroughTransparentTextFrames(GetRectObj().getSdrModelFromSdrObject().IsPickThroughTransparentTextFrames());
// create primitive. Always create primitives to allow the decomposition of
// SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index 95ed93a42b4c..f6e425fb1cfa 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -242,7 +242,7 @@ namespace sdr
{
// prepare primitive generation with evtl. loading the graphic when it's swapped out
SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
- bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
+ bool bDoAsynchronGraphicLoading(rGrafObj.getSdrModelFromSdrObject().IsSwapGraphics());
if( bDoAsynchronGraphicLoading && rGrafObj.IsSwappedOut() )
{
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 60e130c8b949..452971758bbc 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -527,7 +527,7 @@ namespace drawinglayer
bool bChainable = rTextObj.IsChainable();
- if(rText.GetOutlinerParaObject() && rText.GetModel())
+ if(rText.GetOutlinerParaObject())
{
// added TextEdit text suppression
bool bInEditMode(false);
@@ -564,7 +564,7 @@ namespace drawinglayer
const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind());
// #i107346#
- const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj);
+ const SdrOutliner& rDrawTextOutliner(rText.GetObject().getSdrModelFromSdrObject().GetDrawOutliner(&rTextObj));
const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EEControlBits::ONLINESPELLING);
return attribute::SdrTextAttribute(
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 0cdd5d0216d2..e3d7aba47366 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -64,16 +64,16 @@ namespace
sal_Int16 nRetval(0);
SdrPage* pPage = GetSdrPageFromXDrawPage(rxDrawPage);
- if(pPage && pPage->GetModel())
+ if(pPage)
{
if( (pPage->GetPageNum() == 0) && !pPage->IsMasterPage() )
{
// handout page!
- return pPage->GetModel()->getHandoutPageCount();
+ return pPage->getSdrModelFromSdrPage().getHandoutPageCount();
}
else
{
- const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount());
+ const sal_uInt16 nPageCount(pPage->getSdrModelFromSdrPage().GetPageCount());
nRetval = (static_cast<sal_Int16>(nPageCount) - 1) / 2;
}
}
@@ -188,9 +188,9 @@ namespace drawinglayer
}
// #i101443# check change of TextBackgroundolor
- if(!bDoDelete && getSdrText() && getSdrText()->GetModel())
+ if(!bDoDelete && getSdrText())
{
- SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner();
+ SdrOutliner& rDrawOutliner = getSdrText()->GetObject().getSdrModelFromSdrObject().GetDrawOutliner();
aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
bNewTextBackgroundColorIsSet = true;
@@ -223,9 +223,9 @@ namespace drawinglayer
nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage);
}
- if(!bNewTextBackgroundColorIsSet && getSdrText() && getSdrText()->GetModel())
+ if(!bNewTextBackgroundColorIsSet && getSdrText())
{
- SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner();
+ SdrOutliner& rDrawOutliner = getSdrText()->GetObject().getSdrModelFromSdrObject().GetDrawOutliner();
aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
}
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index b4038eab847a..d14b7ffd6b2f 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -44,33 +44,40 @@
#include <svx/svdmodel.hxx>
#include <svx/svdtrans.hxx>
#include <svx/svdpage.hxx>
-
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
namespace sdr
{
namespace properties
{
- void AttributeProperties::ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
+ SfxStyleSheet* AttributeProperties::ImpGetDefaultStyleSheet() const
{
- // test if old StyleSheet is cleared, else it would be lost
- // after this method -> memory leak (!)
- DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)");
+ // use correct default stylesheet #119287#
+ const SdrGrafObj* pIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&GetSdrObject()));
+ const SdrOle2Obj* pIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&GetSdrObject()));
+ SfxStyleSheet* pRetval(nullptr);
- if(pNewStyleSheet)
+ if(pIsSdrGrafObj || pIsSdrOle2Obj)
{
- mpStyleSheet = pNewStyleSheet;
-
- // local ItemSet is needed here, force it
- GetObjectItemSet();
+ pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();
+ }
+ else
+ {
+ pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet();
+ }
- // register as listener
- StartListening(pNewStyleSheet->GetPool());
- StartListening(*pNewStyleSheet);
+ return pRetval;
+ }
+ void AttributeProperties::ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr)
+ {
+ if(HasSfxItemSet() && mpStyleSheet)
+ {
// Delete hard attributes where items are set in the style sheet
if(!bDontRemoveHardAttr)
{
- const SfxItemSet& rStyle = pNewStyleSheet->GetItemSet();
+ const SfxItemSet& rStyle = mpStyleSheet->GetItemSet();
SfxWhichIter aIter(rStyle);
sal_uInt16 nWhich = aIter.FirstWhich();
@@ -86,7 +93,37 @@ namespace sdr
}
// set new stylesheet as parent
- mpItemSet->SetParent(&pNewStyleSheet->GetItemSet());
+ mpItemSet->SetParent(&mpStyleSheet->GetItemSet());
+ }
+ else
+ {
+ OSL_ENSURE(false, "ImpSetParentAtSfxItemSet called without SfxItemSet/SfxStyleSheet (!)");
+ }
+ }
+
+ void AttributeProperties::ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
+ {
+ // test if old StyleSheet is cleared, else it would be lost
+ // after this method -> memory leak (!)
+ DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)");
+
+ if(pNewStyleSheet)
+ {
+ // local remember
+ mpStyleSheet = pNewStyleSheet;
+
+ if(HasSfxItemSet())
+ {
+ // register as listener
+ StartListening(pNewStyleSheet->GetPool());
+ StartListening(*pNewStyleSheet);
+
+ // only apply the following when we have an SfxItemSet already, else
+ if(GetStyleSheet())
+ {
+ ImpSetParentAtSfxItemSet(bDontRemoveHardAttr);
+ }
+ }
}
}
@@ -99,7 +136,7 @@ namespace sdr
EndListening(mpStyleSheet->GetPool());
// reset parent of ItemSet
- if(mpItemSet)
+ if(HasSfxItemSet())
{
mpItemSet->SetParent(nullptr);
}
@@ -127,15 +164,59 @@ namespace sdr
: DefaultProperties(rObj),
mpStyleSheet(nullptr)
{
+ // Do nothing else, esp. do *not* try to get and set
+ // a default SfxStyle sheet. Nothing is allowed to be done
+ // that may lead to calls to virtual functions like
+ // CreateObjectSpecificItemSet - these would go *wrong*.
+ // Thus the rest is lazy-init from here.
}
AttributeProperties::AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj)
: DefaultProperties(rProps, rObj),
mpStyleSheet(nullptr)
{
- if(rProps.GetStyleSheet())
+ SfxStyleSheet* pTargetStyleSheet(rProps.GetStyleSheet());
+
+ if(pTargetStyleSheet && &rObj.getSdrModelFromSdrObject() != &GetSdrObject().getSdrModelFromSdrObject())
{
- ImpAddStyleSheet(rProps.GetStyleSheet(), true);
+ // TTTT It is a clone to another model, thus the TargetStyleSheet
+ // is probably also from another SdrModel, so do *not* simply use it.
+ //
+ // The DefaultProperties::Clone already has cloned the ::SET items
+ // to a new SfxItemSet in the new SfxItemPool. There are quite some
+ // possibilities to continue:
+ // - Do not use StyleSheet (will do this for now)
+ // - Search for same StyleSheet in Target-SdrModel and use if found
+ // (use e.g. Name)
+ // - Clone used StyleSheet(s) to Target-SdrModel and use
+ // - Set all Attributes from the StyleSheet as hard attributes at the
+ // SfxItemSet
+ // The original AW080 uses 'ImpModelChange' (see there) which Clones
+ // and uses the used StyleSheets if there is a Target-SfxItemPool
+ // and sets to hard attributes if not. This may be used later if needed,
+ // but for now only a single UnitTest uses this Clone-scenario and works
+ // well with not using the TargetStyleSheet. The logic Cloning
+ // StyleSheets *should* - if needed - be on a higher level where it is
+ // potentially better known what would be the correct thing to do.
+ pTargetStyleSheet = nullptr;
+ }
+
+ if(pTargetStyleSheet)
+ {
+ if(HasSfxItemSet())
+ {
+ // The SfxItemSet has been cloned and exists,
+ // we can directly set the SfxStyleSheet at it
+ ImpAddStyleSheet(pTargetStyleSheet, true);
+ }
+ else
+ {
+ // No SfxItemSet exists yet (there is none in
+ // the source, so none was cloned). Remember the
+ // SfxStyleSheet to set it when the SfxItemSet
+ // got constructed on-demand
+ mpStyleSheet = pTargetStyleSheet;
+ }
}
}
@@ -149,6 +230,42 @@ namespace sdr
return *(new AttributeProperties(*this, rObj));
}
+ const SfxItemSet& AttributeProperties::GetObjectItemSet() const
+ {
+ // remember if we had a SfxItemSet already
+ const bool bHadSfxItemSet(HasSfxItemSet());
+
+ // call parent - this will then guarantee
+ // SfxItemSet existance
+ DefaultProperties::GetObjectItemSet();
+
+ if(!bHadSfxItemSet)
+ {
+ if(GetStyleSheet())
+ {
+ // Late-Init of setting parent to SfxStyleSheet after
+ // it's creation. See copy-constructor and how it remembers
+ // the SfxStyleSheet there.
+ // It is necessary to reset mpStyleSheet to nullptr to
+ // not trigger alarm insde ImpAddStyleSheet (!)
+ SfxStyleSheet* pNew(mpStyleSheet);
+ const_cast< AttributeProperties* >(this)->mpStyleSheet = nullptr;
+ const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
+ pNew,
+ true);
+ }
+ else
+ {
+ // Set missing defaults and do not RemoveHardAttributes
+ const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
+ ImpGetDefaultStyleSheet(),
+ true);
+ }
+ }
+
+ return *mpItemSet;
+ }
+
void AttributeProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
{
// own modifications
@@ -164,64 +281,72 @@ namespace sdr
if(pNewItem)
{
const SfxPoolItem* pResultItem = nullptr;
- SdrModel* pModel = GetSdrObject().GetModel();
+ SdrModel& rModel(GetSdrObject().getSdrModelFromSdrObject());
switch( nWhich )
{
case XATTR_FILLBITMAP:
{
- pResultItem = static_cast<const XFillBitmapItem*>(pNewItem)->checkForUniqueItem( pModel );
+ // TTTT checkForUniqueItem should use SdrModel&
+ pResultItem = static_cast<const XFillBitmapItem*>(pNewItem)->checkForUniqueItem( &rModel );
break;
}
case XATTR_LINEDASH:
{
- pResultItem = static_cast<const XLineDashItem*>(pNewItem)->checkForUniqueItem( pModel );
+ pResultItem = static_cast<const XLineDashItem*>(pNewItem)->checkForUniqueItem( &rModel );
break;
}
case XATTR_LINESTART:
{
- pResultItem = static_cast<const XLineStartItem*>(pNewItem)->checkForUniqueItem( pModel );
+ pResultItem = static_cast<const XLineStartItem*>(pNewItem)->checkForUniqueItem( &rModel );
break;
}
case XATTR_LINEEND:
{
- pResultItem = static_cast<const XLineEndItem*>(pNewItem)->checkForUniqueItem( pModel );
+ pResultItem = static_cast<const XLineEndItem*>(pNewItem)->checkForUniqueItem( &rModel );
break;
}
case XATTR_FILLGRADIENT:
{
- pResultItem = static_cast<const XFillGradientItem*>(pNewItem)->checkForUniqueItem( pModel );
+ pResultItem = static_cast<const XFillGradientItem*>(pNewItem)->checkForUniqueItem( &rModel );
break;
}
case XATTR_FILLFLOATTRANSPARENCE:
{
// #85953# allow all kinds of XFillFloatTransparenceItem to be set
- pResultItem = static_cast<const XFillFloatTransparenceItem*>(pNewItem)->checkForUniqueItem( pModel );
+ pResultItem = static_cast<const XFillFloatTransparenceItem*>(pNewItem)->checkForUniqueItem( &rModel );
break;
}
case XATTR_FILLHATCH:
{
- pResultItem = static_cast<const XFillHatchItem*>(pNewItem)->checkForUniqueItem( pModel );
+ pResultItem = static_cast<const XFillHatchItem*>(pNewItem)->checkForUniqueItem( &rModel );
break;
}
}
// set item
- GetObjectItemSet();
+ if(!HasSfxItemSet())
+ {
+ GetObjectItemSet();
+ }
+
if(pResultItem)
{
// force ItemSet
mpItemSet->Put(*pResultItem);
+
// delete item if it was a generated one
delete pResultItem;
}
else
+ {
mpItemSet->Put(*pNewItem);
+ }
}
else
{
// clear item if ItemSet exists
- if(mpItemSet)
+ if(HasSfxItemSet())
{
mpItemSet->ClearItem(nWhich);
}
@@ -230,6 +355,12 @@ namespace sdr
void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
{
+ // guarantee SfxItemSet existance here
+ if(!HasSfxItemSet())
+ {
+ GetObjectItemSet();
+ }
+
ImpRemoveStyleSheet();
ImpAddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
@@ -243,237 +374,18 @@ namespace sdr