diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de (CIB)> | 2018-03-01 15:54:32 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-04-07 00:28:30 +0200 |
commit | dfefe448c41921f2f1e54d3f69b8b9e89031d055 (patch) | |
tree | 1aace31054b5740e2faffcbc5de66a791be27f7d /sd/source/ui | |
parent | eba4d5b2b76cefde90cb3d6638c736f435023a45 (diff) |
SOSAW080: Added first bunch of basic changes to helpers
SOSAW080: Make SdrModel& prerequisite to SdrObjects
Added need for SdrModel& in constructors of SdrModel,
SdrPage, SdrView and SdrObjList. Builds, not finished.
SOSAW080: removed and replaced old SdrModel
Removed and replaced GetModel()/SetModel() in all using
classes (SdrObject, SdrPage, SdrView), added accessors
to new referenced SdrModel, adapted all accessing places.
Refactored/Extended ::Clone and ::operator== for these
classes to allow cloning objects to a target SdrModel.
Adapted places where this is done AFAP. Added quite some
comments (tagged with 'TTTT') where possible further work
is needed. Builds completely, thus checking in. This does
not mean that this change is done yet.
SOSAW080: Adapted SdrPage/SdrModel relationship
Also needed to work on copy-construction of SdrPage and hierarchy,
quite some stuff removed, no copy-constructor anymore, no
MigrateItemPool stuff. Builds well, test stuck, will need
some cleanup/finetunung
SOSAW080: Smaller corrections/includes adapted
SOSAW080: Smaller corrections/includes adapted
SOSAW080: Debugging/Stabilizing/MakeUnitTestWork
SOSAW080: Stabilized for UnitTests, cleanups
SOSAW080: Adapted GetObjGraphic to just take a const SdrObject&
SOSAW080: Removed ChangeModel from classes
Classes SvxTextEditSource and SvxDrawPage (including
TextEditSource stuff) do not need change of SdrModel
anymore.
SOSAW080: Adapted some comments to make more readable
SOSAW080: Corrected constructor
SOSAW080: getSdrModelFromUnoModel added override marks
SOSAW080: Added missing includes
SOSAW080: Corrected SdrPage constructor
SOSAW080: Corrected some SdrObject::Clone scenarios
Especially when cloning to another SdrModel and taking
the sdr::properties into account.
SOSAW080: Added include for Mac-Build
SOSAW080: Added Scale to DefaultProperties
If a SdrModel change happens in DefaultProperties copy
constructor (used from Clone()), potentially a Scale
for the SfxItems has to be done.
SOSAW080: Added missing include for MacBuild
SOSAW080: Corrected CppunitTest_sc_anchor_test
An adaption of a SdrPathObj instantiation was missing,
added that. Seems as if that test is no tpart of the
usual 'make' scenario, but used/executed in gerrit builds
SOSAW080: Reworked SvxShape to use SdrObject's SdrModel
SOSAW080: Reworked SvxShape to use SdrObject's SdrModel
SOSAW080: Free SdrObjects when SdrModel goes down
In an UNO API test problem is that SvxShapes reference
SdrShapes, but these are not added to a SdrPage and not
'owned' by the SvxShape. Thus these do not get deleted
at all (same in master, memory leak). I extended
SvxShape::Notify the case for ModelCleared to also
Free the SdrObject when not owner and it's not added to
a SdrPage (in that case it gets deleted with deleting
the SdrModel)
SOSAW080: Solve UNO API calls that move SvxShapes to other Model
Due to UNO API tests I got a call to insert an xShape to a
xDrawPage which was constructed in another Model, this has now to
be done by Cloning the SdrObject to the new SdrModel, getting
rid of the old one and getting all the UNO implementation
stuff right (referemces SdrObject <-> xShape).
1cb7d573d323e98a89761fe662c10c4a654fdec0
24617494a0ef79f6e33dfcb02782a833a81c6434
763f39094b6a48b529a6952d01468f8776c97679
242b9e228a9a042c3a5bdd38b1ea6600144276d5
242b9e228a9a042c3a5bdd38b1ea6600144276d5
33a6f3f306b70c223171aef796dd5ee041ad14df
6878b33f8b05738a44c0910e40a60a0f0d1d58ed
0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2
8c4626274a5cc531dad27f27c0c45d4c528fb2fb
446685a49a6d67aedd01cfbbd5e87b07f97a4d7b
c1b5ed3c99bc7219a0061e4ece24ea42afd2889a
22de9a1c8af7c25be5c108671ddc548ba323ed47
4caf6b6fbbe6e8130741d793dffb560fd01d4ed5
488b9601735ec1822433f82f633990063951fe08
c366d60299f239e3df856ddffedb19e743e4be0c
c5137ba8c597c7b5f90318df50e87b93a39a28dc
f9e646242cf89f6fde1315046952252a2c429779
f830fbc5fadd89d04be5edd2a5abf9b0d4bf0410
1694b54903df784385abaa8452e1201e12344238
17bcb44d2e29920c0c74430c2d9c703b36cfa0ad
17bcb44d2e29920c0c74430c2d9c703b36cfa0ad
7b5c241faec7488924e5935ae8b19f785846b5e4
bf097ee7467895823fbd158a2a9543da3b5a5078
Change-Id: Iaf53535de0502a481466be74a1768bbb39f0e78c
Reviewed-on: https://gerrit.libreoffice.org/52526
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'sd/source/ui')
31 files changed, 371 insertions, 295 deletions
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) |