diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-04-06 22:32:24 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-04-06 22:32:24 +0200 |
commit | eba4d5b2b76cefde90cb3d6638c736f435023a45 (patch) | |
tree | 43befa620475c11f3dde00e5ea141e1efd95a334 /sd/source/ui | |
parent | 6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91 (diff) |
Revert "SOSAW080: Added first bunch of basic changes to helpers"
This reverts commit 6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91.
Diffstat (limited to 'sd/source/ui')
31 files changed, 295 insertions, 371 deletions
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index c54d991ba42a..373f25149d87 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(rView.getSdrModelFromSdrView()); + mpPathObj = mpEffect->createSdrPathObjFromPath(); 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 37a862294b29..e9d185c58758 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->getSdrModelFromSdrObject() ); + pDoc = dynamic_cast< SdDrawDocument* >( pTextObj->GetModel() ); if( pDoc ) pDocShell = pDoc->GetDocSh(); diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index 5ca6bab37ebd..a9b324d1fd24 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -777,8 +777,12 @@ 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).GetBitmapEx()); + SdrObject* pSnapShot = pObjList->GetObj( nObject ); + + BitmapEx *const pBitmapEx = new BitmapEx( + SdrExchangeView::GetObjGraphic( + pSnapShot->GetModel(), pSnapShot).GetBitmapEx() ); + ::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() ); size_t nIndex = m_nCurrentFrame + 1; m_FrameList.insert( @@ -826,9 +830,14 @@ 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).GetBitmapEx()); + SdrObject* pObject = rMarkList.GetMark( nObject )->GetMarkedSdrObj(); + + BitmapEx *const pBitmapEx = new BitmapEx( + SdrExchangeView::GetObjGraphic( + pObject->GetModel(), pObject).GetBitmapEx() ); + ::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() ); + size_t nIndex = m_nCurrentFrame + 1; m_FrameList.insert( m_FrameList.begin() + nIndex, @@ -843,7 +852,7 @@ void AnimationWindow::AddObj (::sd::View& rView ) } else { - SdrObjGroup* pCloneGroup = new SdrObjGroup(rView.getSdrModelFromSdrView()); + SdrObjGroup* pCloneGroup = new SdrObjGroup; SdrObjList* pObjList = pCloneGroup->GetSubList(); for (size_t nObject= 0; nObject < nMarkCount; ++nObject) @@ -991,9 +1000,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView ) aAnimation.SetLoopCount( nLoopCount ); } - SdrGrafObj* pGrafObj = new SdrGrafObj( - rView.getSdrModelFromSdrView(), - Graphic(aAnimation)); + SdrGrafObj* pGrafObj = new SdrGrafObj( Graphic( aAnimation ) ); const Point aOrg( aWindowCenter.X() - ( aMaxSizeLog.Width() >> 1 ), aWindowCenter.Y() - ( aMaxSizeLog.Height() >> 1 ) ); pGrafObj->SetLogicRect( ::tools::Rectangle( aOrg, aMaxSizeLog ) ); @@ -1066,7 +1073,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView ) if(pTargetSdPage) { // create animation group - SdrObjGroup* pGroup = new SdrObjGroup(rView.getSdrModelFromSdrView()); + SdrObjGroup* pGroup = new SdrObjGroup; 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 f74db13144eb..5fe097765688 100644 --- a/sd/source/ui/func/fucon3d.cxx +++ b/sd/source/ui/func/fucon3d.cxx @@ -89,7 +89,6 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() case SID_3D_CUBE: { p3DObj = new E3dCubeObj( - mpView->getSdrModelFromSdrView(), mpView->Get3DDefaultAttributes(), ::basegfx::B3DPoint(-2500, -2500, -2500), ::basegfx::B3DVector(5000, 5000, 5000)); @@ -99,7 +98,6 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() case SID_3D_SPHERE: { p3DObj = new E3dSphereObj( - mpView->getSdrModelFromSdrView(), mpView->Get3DDefaultAttributes(), ::basegfx::B3DPoint(0, 0, 0), ::basegfx::B3DVector(5000, 5000, 5000)); @@ -116,10 +114,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() { aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon); } - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aB2DPolygon)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon)); /* this is an open object, therefore it has to be handled double- sided by default */ @@ -146,10 +141,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() { aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon); } - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aB2DPolygon)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon)); break; } @@ -160,10 +152,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() { aB2DPolygon = ::basegfx::utils::adaptiveSubdivideByAngle(aB2DPolygon); } - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aB2DPolygon)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon)); break; } @@ -189,10 +178,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5)); aInnerPoly.setClosed(true); - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aInnerPoly)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly)); break; } @@ -216,10 +202,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5)); aInnerPoly.setClosed(true); - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aInnerPoly)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly)); break; } @@ -243,10 +226,7 @@ E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape() aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5)); aInnerPoly.setClosed(true); - p3DObj = new E3dLatheObj( - mpView->getSdrModelFromSdrView(), - mpView->Get3DDefaultAttributes(), - ::basegfx::B2DPolyPolygon(aInnerPoly)); + p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly)); p3DObj->SetMergedItem(makeSvx3DHorizontalSegmentsItem(4)); break; } @@ -393,7 +373,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(*mpDoc); + E3dScene* pScene = new E3dScene; // copied code from E3dView::InitScene double fCamZ(aVolume.getMaxZ() + ((fW + fH) / 4.0)); @@ -407,9 +387,13 @@ 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 6967a1495017..7d6aca665a37 100644 --- a/sd/source/ui/func/fuconarc.cxx +++ b/sd/source/ui/func/fuconarc.cxx @@ -91,12 +91,10 @@ void FuConstructArc::DoExecute( SfxRequest& rReq ) Activate(); // sets aObjKind SdrCircObj* pNewCircle = - new SdrCircObj( - mpView->getSdrModelFromSdrView(), - static_cast<SdrObjKind>(mpView->GetCurrentObjIdentifier()), - aNewRectangle, - static_cast<long>(pPhiStart->GetValue () * 10.0), - static_cast<long>(pPhiEnd->GetValue () * 10.0)); + new SdrCircObj(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); @@ -204,9 +202,8 @@ SdrObject* FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, const ::too { SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx index cad7080afd6b..e7cc868d495b 100644 --- a/sd/source/ui/func/fuconbez.cxx +++ b/sd/source/ui/func/fuconbez.cxx @@ -309,9 +309,8 @@ SdrObject* FuConstructBezierPolygon::CreateDefaultObject(const sal_uInt16 nID, c // case SID_DRAW_BEZIER_NOFILL: // BASIC SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx index 97a60a302c11..6396eeb46e82 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->getSdrModelFromSdrObject().GetItemPool(), + pObj->GetModel()->GetItemPool(), svl::Items< // Ranges from SdrAttrObj: SDRATTR_START, SDRATTR_SHADOW_LAST, @@ -236,9 +236,8 @@ const OUString& FuConstructCustomShape::GetShapeType() const SdrObject* FuConstructCustomShape::CreateDefaultObject(const sal_uInt16, const ::tools::Rectangle& rRectangle) { SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if( pObj ) { diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index d78fd866755d..1377429ed056 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -109,10 +109,7 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq ) pCenterY->GetValue () - pAxisY->GetValue () / 2, pCenterX->GetValue () + pAxisX->GetValue () / 2, pCenterY->GetValue () + pAxisY->GetValue () / 2); - SdrCircObj *pNewCircle = new SdrCircObj( - mpView->getSdrModelFromSdrView(), - OBJ_CIRC, - aNewRectangle); + SdrCircObj *pNewCircle = new SdrCircObj (OBJ_CIRC, aNewRectangle); SdrPageView *pPV = mpView->GetSdrPageView(); mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR); @@ -130,9 +127,7 @@ void FuConstructRectangle::DoExecute( SfxRequest& rReq ) pMouseStartY->GetValue (), pMouseEndX->GetValue (), pMouseEndY->GetValue ()); - SdrRectObj *pNewRect = new SdrRectObj( - mpView->getSdrModelFromSdrView(), - aNewRectangle); + SdrRectObj *pNewRect = new SdrRectObj (aNewRectangle); SdrPageView *pPV = mpView->GetSdrPageView(); mpView->InsertObjectAtView(pNewRect, *pPV, SdrInsertFlags::SETDEFLAYER | SdrInsertFlags::SETDEFATTR); @@ -482,9 +477,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->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Para))); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( pPage->GetModel()-> + GetStyleSheetPool()-> + Find(aName, SfxStyleFamily::Para)); DBG_ASSERT(pSheet, "StyleSheet missing"); if (pSheet) @@ -501,10 +496,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, const SdrModel& rModel) +::basegfx::B2DPolyPolygon getPolygon(const char* pResId, SdrModel const * pDoc) { ::basegfx::B2DPolyPolygon aRetval; - XLineEndListRef pLineEndList(rModel.GetLineEndList()); + XLineEndListRef pLineEndList = pDoc->GetLineEndList(); if( pLineEndList.is() ) { @@ -541,10 +536,9 @@ 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, rModel ) ); + ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, mpDoc ) ); if( !aArrow.count() ) { ::basegfx::B2DPolygon aNewArrow; @@ -556,7 +550,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj } // Circles - ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) ); + ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, mpDoc ) ); if( !aCircle.count() ) { ::basegfx::B2DPolygon aNewCircle; @@ -566,7 +560,7 @@ void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj } // Square - ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) ); + ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, mpDoc ) ); if( !aSquare.count() ) { ::basegfx::B2DPolygon aNewSquare; @@ -770,9 +764,8 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const // case SID_CONNECTOR_LINES_CIRCLES: SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx index 9e15f47a070a..8f376fb3d72a 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->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page))); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pPage->GetModel()-> + 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->getSdrModelFromSdrPage().GetStyleSheetPool()->Find(aName, SfxStyleFamily::Para))); + SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pPage->GetModel()-> + 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 8ff99fdb7e00..935cb0c50157 100644 --- a/sd/source/ui/func/fuconuno.cxx +++ b/sd/source/ui/func/fuconuno.cxx @@ -138,9 +138,8 @@ SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const :: // case SID_FM_CREATE_CONTROL: SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier()); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index ad22e00dc71b..0cdd22da3807 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -386,11 +386,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) aRect = ::tools::Rectangle(aPos, aSize); } - SdrOle2Obj* pOleObj = new SdrOle2Obj( - mpView->getSdrModelFromSdrView(), - svt::EmbeddedObjectRef( xObj, nAspect ), - aObjName, - aRect); + SdrOle2Obj* pOleObj = new SdrOle2Obj( 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 @@ -617,11 +613,8 @@ 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( - mpView->getSdrModelFromSdrView(), - aObjRef, - aName, - aRect); + + SdrOle2Obj* pObj = new SdrOle2Obj( 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 5ad65b627063..fae84526e97f 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -506,9 +506,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) } else { - SdrRectObj* pTO = new SdrRectObj( - mpView->getSdrModelFromSdrView(), - OBJ_TEXT); + SdrRectObj* pTO = new SdrRectObj(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 03aa0b0ad656..b78c018747ed 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(mpView->getSdrModelFromSdrView()); + SdrObjGroup* pObjGroup = new SdrObjGroup; SdrObjList* pObjList = pObjGroup->GetSubList(); const size_t nCount = rPolyPolyList3D.size(); const double fStep = 1. / ( nCount + 1 ); @@ -397,10 +397,7 @@ void FuMorph::ImpInsertPolygons( for ( size_t i = 0; i < nCount; i++, fFactor += fStep ) { const ::basegfx::B2DPolyPolygon& rPolyPoly3D = *rPolyPolyList3D[ i ]; - SdrPathObj* pNewObj = new SdrPathObj( - mpView->getSdrModelFromSdrView(), - OBJ_POLY, - rPolyPoly3D); + SdrPathObj* pNewObj = new SdrPathObj(OBJ_POLY, rPolyPoly3D); // line color if ( bLineColor ) diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index b6d81901f870..300e17c09cc5 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->getSdrModelFromSdrObject().GetDrawOutliner(GetTextObj())); + SdrOutliner& rOutl = mxTextObj->GetModel()->GetDrawOutliner(GetTextObj()); bool bVertical((pOPO && pOPO->IsVertical()) || nSlotId == SID_ATTR_CHAR_VERTICAL || nSlotId == SID_TEXT_FITTOSIZE_VERTICAL); @@ -1304,11 +1304,10 @@ void FuText::DoubleClick(const MouseEvent& ) */ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) { + SdrObject* pObj = SdrObjFactory::MakeNewObject( - mpView->getSdrModelFromSdrView(), - mpView->GetCurrentObjInventor(), - mpView->GetCurrentObjIdentifier(), - nullptr); + mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), + nullptr, mpDoc); if(pObj) { diff --git a/sd/source/ui/func/unoaprms.cxx b/sd/source/ui/func/unoaprms.cxx index ab46b90ac8ee..021dc5ba7a02 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(dynamic_cast< SdDrawDocument* >(&pObject->getSdrModelFromSdrObject())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pObject->GetModel()); if( pDoc ) { SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo( pObject ); diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 381b22be955f..67770cc27313 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -128,10 +128,6 @@ 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 b9336124f9e1..dc76d90a4777 100644 --- a/sd/source/ui/sidebar/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -53,11 +53,14 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( break; // Check the presence of the source document. - SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage())); + SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>( + pMasterPage->GetModel()); + if (pSourceDocument == nullptr) + break; // When the given master page already belongs to the target document // then there is nothing more to do. - if (&rSourceDocument == &rTargetDocument) + if (pSourceDocument == &rTargetDocument) { pNewMasterPage = pMasterPage; break; @@ -67,7 +70,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 = rSourceDocument.GetMasterPageCount(); + sal_uInt16 nSourceMasterPageCount = pSourceDocument->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 @@ -78,11 +81,11 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( break; // Get the slide master page. if (pMasterPage != static_cast<SdPage*>( - rSourceDocument.GetMasterPage(nIndex))) + pSourceDocument->GetMasterPage(nIndex))) break; // Get the notes master page. SdPage* pNotesMasterPage = static_cast<SdPage*>( - rSourceDocument.GetMasterPage(nIndex+1)); + pSourceDocument->GetMasterPage(nIndex+1)); if (pNotesMasterPage == nullptr) break; @@ -158,7 +161,7 @@ SdPage* DocumentHelper::GetSlideForMasterPage (SdPage const * pMasterPage) SdDrawDocument* pDocument = nullptr; if (pMasterPage != nullptr) - pDocument = dynamic_cast< SdDrawDocument* >(&pMasterPage->getSdrModelFromSdrPage()); + pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel()); // Iterate over all pages and check if it references the given master // page. @@ -212,8 +215,10 @@ SdPage* DocumentHelper::AddMasterPage ( pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone()); // Copy the necessary styles. - SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage())); - ProvideStyles(rSourceDocument, rTargetDocument, pClonedMasterPage); + SdDrawDocument* pSourceDocument + = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument != nullptr) + ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage); // Copy the precious flag. pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious()); @@ -305,7 +310,7 @@ void DocumentHelper::AssignMasterPageToPageList ( ::std::vector<SdPage*> aCleanedList; for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage) { - OSL_ASSERT(*iPage!=nullptr && &(*iPage)->getSdrModelFromSdrPage() == &rTargetDocument); + OSL_ASSERT(*iPage!=nullptr && (*iPage)->GetModel() == &rTargetDocument); if (*iPage != nullptr && (*iPage)->GetLayoutName() != sFullLayoutName) { aCleanedList.push_back(*iPage); @@ -353,24 +358,28 @@ SdPage* DocumentHelper::AddMasterPage ( pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious()); // Copy the necessary styles. - 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); + 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); + } } return pClonedMasterPage; @@ -397,24 +406,25 @@ void DocumentHelper::AssignMasterPageToPage ( // Leave early when the parameters are invalid. if (pPage == nullptr || pMasterPage == nullptr) return; - - SdDrawDocument& rDocument(dynamic_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); + SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel()); + if (pDocument == nullptr) + return; 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. - rDocument.GetDocSh()->GetUndoManager()->AddUndoAction( + pDocument->GetDocSh()->GetUndoManager()->AddUndoAction( new SdBackgroundObjUndoAction( - rDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()), + *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()), true); pPage->getSdrPageProperties().PutItem(XFillStyleItem(drawing::FillStyle_NONE)); - rDocument.SetMasterPage ( + pDocument->SetMasterPage ( (pPage->GetPageNum()-1)/2, rsBaseLayoutName, - &rDocument, + pDocument, false, false); } @@ -422,10 +432,10 @@ void DocumentHelper::AssignMasterPageToPage ( { // Find first slide that uses the master page. SdPage* pSlide = nullptr; - sal_uInt16 nPageCount = rDocument.GetSdPageCount(PageKind::Standard); + sal_uInt16 nPageCount = pDocument->GetSdPageCount(PageKind::Standard); for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==nullptr; nPage++) { - SdrPage* pCandidate = rDocument.GetSdPage(nPage,PageKind::Standard); + SdrPage* pCandidate = pDocument->GetSdPage(nPage,PageKind::Standard); if (pCandidate != nullptr && pCandidate->TRG_HasMasterPage() && &(pCandidate->TRG_GetMasterPage()) == pPage) @@ -438,10 +448,10 @@ void DocumentHelper::AssignMasterPageToPage ( { // 2. Assign the given master pages to the first slide that was // found above that uses the master page. - rDocument.SetMasterPage ( + pDocument->SetMasterPage ( (pSlide->GetPageNum()-1)/2, rsBaseLayoutName, - &rDocument, + pDocument, false, false); } @@ -449,7 +459,7 @@ void DocumentHelper::AssignMasterPageToPage ( { // 3. Replace the master page A by a copy of the given master // page B. - rDocument.RemoveUnnecessaryMasterPages ( + pDocument->RemoveUnnecessaryMasterPages ( pPage); } } @@ -469,9 +479,11 @@ SdPage* DocumentHelper::ProvideMasterPage ( OSL_ASSERT(pMasterPage != nullptr); return nullptr; } - SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage())); + SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel()); + if (pSourceDocument == nullptr) + return nullptr; SdPage* pNotesMasterPage = static_cast<SdPage*>( - rSourceDocument.GetMasterPage(pMasterPage->GetPageNum()+1)); + pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1)); if (pNotesMasterPage == nullptr) { // The model is not in a valid state. Maybe a new master page @@ -509,7 +521,7 @@ SdPage* DocumentHelper::ProvideMasterPage ( } // Clone the master page. - if (&pMasterPage->getSdrModelFromSdrPage() != &rTargetDocument) + if (pMasterPage->GetModel() != &rTargetDocument) { pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex); if( rTargetDocument.IsUndoEnabled() ) @@ -520,7 +532,7 @@ SdPage* DocumentHelper::ProvideMasterPage ( pMasterPageInDocument = pMasterPage; // Clone the notes master. - if (&pNotesMasterPage->getSdrModelFromSdrPage() != &rTargetDocument) + if (pNotesMasterPage->GetModel() != &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 e85d27a810fb..dd3e6a4f0dd3 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -183,11 +183,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq) aRect = ::tools::Rectangle(aPos, aSize); } - sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( - *GetDoc(), // TTTT should be reference - aRect, - nColumns, - nRows); + sdr::table::SdrTableObj* pObj = new sdr::table::SdrTableObj( GetDoc(), aRect, nColumns, nRows ); pObj->NbcSetStyleSheet( GetDoc()->GetDefaultStyleSheet(), true ); apply_table_style( pObj, GetDoc(), sTableStyle ); SdrPageView* pPV = mpView->GetSdrPageView(); @@ -275,11 +271,7 @@ 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 23717ea3d16b..158b1603f00e 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -202,9 +202,15 @@ bool PreviewRenderer::Initialize ( if (pPage == nullptr) return false; + SdrModel* pModel = pPage->GetModel(); + if (pModel == nullptr) + return false; + SetupOutputSize(*pPage, rPixelSize); - SdDrawDocument& rDocument(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - DrawDocShell* pDocShell = rDocument.GetDocSh(); + + SdDrawDocument* pDocument + = static_cast<SdDrawDocument*>(pPage->GetModel()); + DrawDocShell* pDocShell = pDocument->GetDocSh(); // Create view ProvideView (pDocShell); @@ -254,9 +260,9 @@ bool PreviewRenderer::Initialize ( } pPageView->SetApplicationDocumentColor(aApplicationDocumentColor); - SdrOutliner& rOutliner(rDocument.GetDrawOutliner()); + SdrOutliner& rOutliner(pDocument->GetDrawOutliner()); rOutliner.SetBackgroundColor(aApplicationDocumentColor); - rOutliner.SetDefaultLanguage(rDocument.GetLanguage(EE_CHAR_LANGUAGE)); + rOutliner.SetDefaultLanguage(pDocument->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 b6ee7d5d1122..afe7ede9bde5 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2714,11 +2714,6 @@ 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 7a34f2a80277..619d84254a7d 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -406,20 +406,23 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap SdrObject* pObj = SvxFmDrawPage::CreateSdrObject_( xShape ); if( pObj && ( (pObj->GetObjInventor() != SdrInventor::Default) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) ) { - 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) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if( pDoc ) { - pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true); - } - else - { - pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true); + // #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); + } } } return pObj; @@ -515,8 +518,9 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap pPresObj = SvxFmDrawPage::CreateSdrObject_( xShape ); if( pPresObj ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - pPresObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if( pDoc ) + pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), true ); GetPage()->InsertPresObj( pPresObj, eObjKind ); } } @@ -681,21 +685,21 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName if( eOri != GetPage()->GetOrientation() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetOrientation( eOri ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetOrientation( eOri ); } } @@ -777,10 +781,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND)), bVisible); pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers); @@ -797,10 +801,10 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aVisibleLayers.Set(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ)), bVisible); pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers); @@ -1096,36 +1100,39 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) case WID_PAGE_PREVIEW : case WID_PAGE_PREVIEWMETAFILE : { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh(); - if ( pDocShell ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if ( pDoc ) { - 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 ) + ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh(); + if ( pDocShell ) { - 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; + 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; + } } } } @@ -1133,26 +1140,29 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) case WID_PAGE_PREVIEWBITMAP : { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); - ::sd::DrawDocShell* pDocShell = rDoc.GetDocSh(); - if ( pDocShell ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); + if ( pDoc ) { - 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 ) - { - rDoc.SetSelected( rDoc.GetSdPage( nPgNum, PageKind::Standard ), nPgNum == nPageNumber ); - nPgNum++; - } - std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile(); - BitmapEx aBitmap; - if (xMetaFile && xMetaFile->CreateThumbnail(aBitmap)) + ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh(); + if ( pDocShell ) { - SvMemoryStream aMemStream; - WriteDIB(aBitmap.GetBitmap(), aMemStream, false, false); - uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aMemStream.GetData()), aMemStream.Tell() ); - aAny <<= aSeq; + 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; + } } } } @@ -1196,10 +1206,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND))); } @@ -1215,10 +1225,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) SdrPage* pPage = GetPage(); if( pPage ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(pPage->getSdrModelFromSdrPage())); - if( rDoc.GetMasterPageCount() ) + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(pPage->GetModel()); + if( pDoc->GetMasterPageCount() ) { - SdrLayerAdmin& rLayerAdmin = rDoc.GetLayerAdmin(); + SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayerIDSet aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); aAny <<= aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ))); } @@ -1674,21 +1684,21 @@ void SdGenericDrawPage::SetLeftBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetLeftBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetLeftBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetLeftBorder( nValue ); } } @@ -1698,21 +1708,21 @@ void SdGenericDrawPage::SetRightBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetRightBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetRightBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetRightBorder( nValue ); } } @@ -1722,21 +1732,21 @@ void SdGenericDrawPage::SetUpperBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetUpperBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetUpperBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetUpperBorder( nValue ); } } @@ -1746,21 +1756,21 @@ void SdGenericDrawPage::SetLowerBorder( sal_Int32 nValue ) { if( nValue != GetPage()->GetLowerBorder() ) { - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetLowerBorder( nValue ); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetLowerBorder( nValue ); } } @@ -1801,25 +1811,25 @@ void SdGenericDrawPage::SetWidth( sal_Int32 nWidth ) { aSize.setWidth( nWidth ); - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetSize(aSize); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetSize(aSize); } - refreshpage( &rDoc, ePageKind ); + refreshpage( pDoc, ePageKind ); } } @@ -1830,25 +1840,25 @@ void SdGenericDrawPage::SetHeight( sal_Int32 nHeight ) { aSize.setHeight( nHeight ); - SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage())); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(GetPage()->GetModel()); const PageKind ePageKind = GetPage()->GetPageKind(); - sal_uInt16 i, nPageCnt = rDoc.GetMasterSdPageCount(ePageKind); + sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetMasterSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind); pPage->SetSize(aSize); } - nPageCnt = rDoc.GetSdPageCount(ePageKind); + nPageCnt = pDoc->GetSdPageCount(ePageKind); for (i = 0; i < nPageCnt; i++) { - SdPage* pPage = rDoc.GetSdPage(i, ePageKind); + SdPage* pPage = pDoc->GetSdPage(i, ePageKind); pPage->SetSize(aSize); } - refreshpage( &rDoc, ePageKind ); + refreshpage( pDoc, ePageKind ); } } @@ -2379,7 +2389,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->getSdrModelFromSdrPage().GetMasterPage(nNum)); + pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum)); pNotesPage->SetLayoutName( pSdPage->GetLayoutName() ); GetModel()->SetModified(); @@ -2476,7 +2486,7 @@ void SdDrawPage::setBackground( const Any& rValue ) if( pBack ) { - pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet ); + pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet ); } else { @@ -2500,7 +2510,7 @@ void SdDrawPage::setBackground( const Any& rValue ) pProp++; } - pBackground->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet ); + pBackground->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet ); } if( aSet.Count() == 0 ) @@ -2862,7 +2872,7 @@ void SdMasterPage::setBackground( const Any& rValue ) if( pBack ) { - pBack->fillItemSet( static_cast<SdDrawDocument*>(&GetPage()->getSdrModelFromSdrPage()), aSet ); + pBack->fillItemSet( static_cast<SdDrawDocument*>(GetPage()->GetModel()), aSet ); } else { @@ -2885,11 +2895,11 @@ void SdMasterPage::setBackground( const Any& rValue ) pProp++; } - pBackground->fillItemSet( static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()), aSet ); + pBackground->fillItemSet( static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()), aSet ); } // if we find the background style, copy the set to the background - SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()); SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool(); if(pSSPool) { @@ -2933,7 +2943,7 @@ void SdMasterPage::getBackground( Any& rValue ) } else { - SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()); + SdDrawDocument* pDoc = static_cast<SdDrawDocument*>(SvxFmDrawPage::mpPage->GetModel()); SfxStyleSheetBasePool* pSSPool = pDoc->GetStyleSheetPool(); if(pSSPool) { @@ -3082,9 +3092,9 @@ Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage ) { Reference< uno::XInterface > xPage; - if( pPage ) + if( pPage && pPage->GetModel() ) { - SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->getSdrModelFromSdrPage().getUnoModel() ); + SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() ); if( pModel ) { if( pPage->IsMasterPage() ) diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 432146681d78..c89213c5880d 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1526,10 +1526,7 @@ private: std::vector< ::tools::Rectangle >::iterator iter( aAreas.begin() ); while( iter != aAreas.end() ) { - pHandout->NbcInsertObject( - new SdrPageObj( - rModel, - (*iter++))); + pHandout->NbcInsertObject( new SdrPageObj((*iter++)) ); if( bDrawLines && (iter != aAreas.end()) ) { @@ -1549,10 +1546,7 @@ private: aPathPoly.append( aPoly ); } - SdrPathObj* pPathObj = new SdrPathObj( - rModel, - OBJ_PATHLINE, - aPathPoly); + SdrPathObj* pPathObj = new SdrPathObj(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 95a4807e43c3..56a07fdb6486 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -78,15 +78,12 @@ 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 bbfd4e0d3d23..f61052b4cb68 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -520,9 +520,7 @@ public: if (!pMasterPage) continue; - SdrRectObj* pObject = new SdrRectObj( - *m_rDrawViewShell.GetDoc(), // TTTT should be reference - OBJ_TEXT); + SdrRectObj* pObject = new SdrRectObj(OBJ_TEXT); pObject->SetMergedItem(makeSdrTextAutoGrowWidthItem(true)); pObject->SetOutlinerParaObject(pOutliner->CreateParaObject()); pMasterPage->InsertObject(pObject); @@ -1087,9 +1085,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } // create new object - SdrGrafObj* pGraphicObj = new SdrGrafObj( - *GetDoc(), - aGraphic); + SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic); // get some necessary info and ensure it const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList()); @@ -2343,9 +2339,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) pOutl->QuickInsertField( *pFieldItem, ESelection() ); OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject(); - SdrRectObj* pRectObj = new SdrRectObj( - *GetDoc(), - OBJ_TEXT); + SdrRectObj* pRectObj = new SdrRectObj( 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 e396b8ec6ea8..1181d6c7d820 100644 --- a/sd/source/ui/view/drviews8.cxx +++ b/sd/source/ui/view/drviews8.cxx @@ -120,10 +120,7 @@ void DrawViewShell::ScannerEvent() if( bInsertNewObject ) { - auto pGrafObj = new SdrGrafObj( - GetView()->getSdrModelFromSdrView(), - Graphic(aScanBmp), - aRect); + auto pGrafObj = new SdrGrafObj( 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 afc151b29a96..4c2e6b1c3203 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -169,10 +169,7 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq) if( bInsertNewObject ) { - pGrafObj = new SdrGrafObj( - GetView()->getSdrModelFromSdrView(), - aGraphic, - aRect); + pGrafObj = new SdrGrafObj(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 8b69d3616037..0b082d9e18a9 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1458,9 +1458,7 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText, pOutl->QuickInsertField( aURLItem, ESelection() ); OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject(); - SdrRectObj* pRectObj = new SdrRectObj( - GetView()->getSdrModelFromSdrView(), - OBJ_TEXT); + SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT); pOutl->UpdateFields(); pOutl->SetUpdateMode( true ); @@ -1536,12 +1534,8 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText, if (bNewObj) try { - SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( - SdrObjFactory::MakeNewObject( - GetView()->getSdrModelFromSdrView(), - SdrInventor::FmForm, - OBJ_FM_BUTTON, - mpDrawView->GetSdrPageView()->GetPage())); + SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(SdrInventor::FmForm, OBJ_FM_BUTTON, + mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) ); 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 b08896abf358..3795f9e09b4f 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), // TTTT SdDrawDocument* -> should be reference + : SdrView(pDrawDoc, nullptr), mnRefCount(0), mnPresViewShellId(SID_VIEWSHELL0), mbIsNavigatorShowingAllShapes(false) diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 7bff93080e61..d0344d2ab4e5 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -104,11 +104,10 @@ 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), @@ -659,7 +658,7 @@ bool View::SdrBeginTextEdit( EventMultiplexerEventId::BeginTextEdit, static_cast<void*>(pObj) ); if( pOutl==nullptr && pObj ) - pOutl = SdrMakeOutliner(OutlinerMode::TextObject, pObj->getSdrModelFromSdrObject()); + pOutl = SdrMakeOutliner(OutlinerMode::TextObject, *pObj->GetModel()); // make draw&impress specific initialisations if( pOutl ) diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index cf6f72870045..c0f5f5e19413 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -797,11 +797,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, aNewSet.Put( pObj->GetMergedItemSet() ); if( bUndo ) - AddUndo( - new E3dAttributesUndoAction( - *static_cast< E3dObject* >(pPickObj), - aNewSet, - aOldSet)); + AddUndo( new E3dAttributesUndoAction( mrDoc, static_cast<E3dObject*>(pPickObj), aNewSet, aOldSet ) ); pPickObj->SetMergedItemSetAndBroadcast( aNewSet ); } @@ -999,11 +995,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) ); ::tools::Rectangle aRect( maDropPos, aSize ); - SdrOle2Obj* pObj = new SdrOle2Obj( - getSdrModelFromSdrView(), - aObjRef, - aName, - aRect); + SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect ); SdrPageView* pPV = GetSdrPageView(); SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER; @@ -1173,11 +1165,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropPos.AdjustY( -(std::min( aSize.Height(), aMaxSize.Height() ) >> 1) ); ::tools::Rectangle aRect( maDropPos, aSize ); - SdrOle2Obj* pObj = new SdrOle2Obj( - getSdrModelFromSdrView(), - aObjRef, - aName, - aRect); + SdrOle2Obj* pObj = new SdrOle2Obj( 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 fb17fcc2df24..f98a8ab1b216 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -116,10 +116,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, } else { - pNewGrafObj = new SdrGrafObj( - getSdrModelFromSdrView(), - rGraphic, - pPickObj->GetLogicRect()); + pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() ); pNewGrafObj->SetEmptyPresObj(true); } @@ -192,10 +189,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, MapMode( MapUnit::Map100thMM ) ); } - pNewGrafObj = new SdrGrafObj( - getSdrModelFromSdrView(), - rGraphic, - ::tools::Rectangle(rPos, aSize)); + pNewGrafObj = new SdrGrafObj( rGraphic, ::tools::Rectangle( rPos, aSize ) ); SdrPage* pPage = pPV->GetPage(); Size aPageSize( pPage->GetSize() ); aPageSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) ); @@ -335,9 +329,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM pUserCall = pPickObj->GetUserCall(); // ReplaceObjectAtView can free pPickObj } - pNewMediaObj = new SdrMediaObj( - getSdrModelFromSdrView(), - aRect); + pNewMediaObj = new SdrMediaObj( aRect ); bool bIsPres = false; if( pPickObj ) @@ -537,11 +529,7 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void) aRect = ::tools::Rectangle( maDropPos, aSize ); - SdrOle2Obj* pOleObj = new SdrOle2Obj( - getSdrModelFromSdrView(), - svt::EmbeddedObjectRef(xObj, nAspect), - aName, - aRect); + SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect ); SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER; if (mpViewSh != nullptr) |