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 /sw/source | |
parent | 6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91 (diff) |
Revert "SOSAW080: Added first bunch of basic changes to helpers"
This reverts commit 6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91.
Diffstat (limited to 'sw/source')
24 files changed, 114 insertions, 209 deletions
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 4430547b343b..3b93cd9735da 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -125,9 +125,7 @@ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc, getIDocumentDrawModelAccess().GetDrawModel()->InsertPage( pPg ); } - // TTTT Clone directly to target SdrModel - SdrObject *pObj = rObj.Clone(getIDocumentDrawModelAccess().GetDrawModel()); - + SdrObject *pObj = rObj.Clone(); if( bMoveWithinDoc && SdrInventor::FmForm == pObj->GetObjInventor() ) { // We need to preserve the Name for Controls diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index c690b2514156..2cc3235b8846 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -460,11 +460,9 @@ void SwContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) } -SwFlyDrawContact::SwFlyDrawContact( - SwFlyFrameFormat *pToRegisterIn, - SdrModel& rTargetModel) -: SwContact(pToRegisterIn), - mpMasterObj(new SwFlyDrawObj(rTargetModel)) +SwFlyDrawContact::SwFlyDrawContact( SwFlyFrameFormat *pToRegisterIn ) + : SwContact( pToRegisterIn ) + , mpMasterObj(new SwFlyDrawObj) { // #i26791# - class <SwFlyDrawContact> contains the 'master' // drawing object of type <SwFlyDrawObj> on its own. @@ -512,11 +510,8 @@ SwVirtFlyDrawObj* SwFlyDrawContact::CreateNewRef(SwFlyFrame* pFly, SwFlyFrameFor IDocumentDrawModelAccess& rIDDMA = pFormat->getIDocumentDrawModelAccess(); SwFlyDrawContact* pContact = pFormat->GetOrCreateContact(); - SwVirtFlyDrawObj* pDrawObj( - new SwVirtFlyDrawObj( - pContact->GetMaster()->getSdrModelFromSdrObject(), - *pContact->GetMaster(), - pFly)); + SwVirtFlyDrawObj* pDrawObj(new SwVirtFlyDrawObj(*pContact->GetMaster(), pFly)); + pDrawObj->SetModel(pContact->GetMaster()->GetModel()); pDrawObj->SetUserCall(pContact); // The Reader creates the Masters and inserts them into the Page in @@ -812,12 +807,7 @@ SwFrame* SwDrawContact::GetAnchorFrame(SdrObject const *const pDrawObj) */ SwDrawVirtObj* SwDrawContact::AddVirtObj() { - maDrawVirtObjs.push_back( - std::unique_ptr<SwDrawVirtObj>( - new SwDrawVirtObj( - GetMaster()->getSdrModelFromSdrObject(), - *GetMaster(), - *this))); + maDrawVirtObjs.push_back(std::unique_ptr<SwDrawVirtObj>(new SwDrawVirtObj(*GetMaster(), *this))); maDrawVirtObjs.back()->AddToDrawingPage(); return maDrawVirtObjs.back().get(); } @@ -2148,29 +2138,27 @@ namespace sdr } // end of namespace sdr /// implementation of class <SwDrawVirtObj> + sdr::contact::ViewContact* SwDrawVirtObj::CreateObjectSpecificViewContact() { return new sdr::contact::VCOfDrawVirtObj(*this); } -SwDrawVirtObj::SwDrawVirtObj( - SdrModel& rSdrModel, - SdrObject& _rNewObj, - SwDrawContact& _rDrawContact) -: SdrVirtObj(rSdrModel, _rNewObj ), - maAnchoredDrawObj(), - mrDrawContact(_rDrawContact) +SwDrawVirtObj::SwDrawVirtObj( SdrObject& _rNewObj, + SwDrawContact& _rDrawContact ) + : SdrVirtObj( _rNewObj ), + // #i26791# - init new member <maAnchoredDrawObj> + maAnchoredDrawObj(), + mrDrawContact( _rDrawContact ) { // #i26791# maAnchoredDrawObj.SetDrawObj( *this ); - // #i35635# - set initial position out of sight NbcMove( Size( -16000, -16000 ) ); } SwDrawVirtObj::~SwDrawVirtObj() -{ -} +{} SwDrawVirtObj& SwDrawVirtObj::operator=( const SwDrawVirtObj& rObj ) { @@ -2180,12 +2168,9 @@ SwDrawVirtObj& SwDrawVirtObj::operator=( const SwDrawVirtObj& rObj ) return *this; } -SwDrawVirtObj* SwDrawVirtObj::Clone(SdrModel* pTargetModel) const +SwDrawVirtObj* SwDrawVirtObj::Clone() const { - SwDrawVirtObj* pObj = new SwDrawVirtObj( - nullptr == pTargetModel ? getSdrModelFromSdrObject() : *pTargetModel, - rRefObj, - mrDrawContact); + SwDrawVirtObj* pObj = new SwDrawVirtObj( rRefObj, mrDrawContact ); pObj->operator=( *this ); // Note: Member <maAnchoredDrawObj> hasn't to be considered. diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index cd74e92fa23c..93a58d2a4fb1 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -121,8 +121,7 @@ sdr::contact::ViewContact* SwFlyDrawObj::CreateObjectSpecificViewContact() return new sdr::contact::VCOfSwFlyDrawObj(*this); } -SwFlyDrawObj::SwFlyDrawObj(SdrModel& rSdrModel) -: SdrObject(rSdrModel) +SwFlyDrawObj::SwFlyDrawObj() { } @@ -131,6 +130,7 @@ SwFlyDrawObj::~SwFlyDrawObj() } // SwFlyDrawObj - Factory-Methods + SdrInventor SwFlyDrawObj::GetObjInventor() const { return SdrInventor::Swg; @@ -142,6 +142,7 @@ sal_uInt16 SwFlyDrawObj::GetObjIdentifier() const } // TODO: Need own primitive to get the FlyFrame paint working + namespace drawinglayer { namespace primitive2d @@ -420,12 +421,9 @@ sdr::contact::ViewContact* SwVirtFlyDrawObj::CreateObjectSpecificViewContact() return new sdr::contact::VCOfSwVirtFlyDrawObj(*this); } -SwVirtFlyDrawObj::SwVirtFlyDrawObj( - SdrModel& rSdrModel, - SdrObject& rNew, - SwFlyFrame* pFly) -: SdrVirtObj(rSdrModel, rNew), - m_pFlyFrame(pFly) +SwVirtFlyDrawObj::SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrame* pFly) : + SdrVirtObj( rNew ), + m_pFlyFrame( pFly ) { const SvxProtectItem &rP = m_pFlyFrame->GetFormat()->GetProtect(); bMovProt = rP.IsPosProtected(); diff --git a/sw/source/core/draw/dobjfac.cxx b/sw/source/core/draw/dobjfac.cxx index e11e375aa30b..e3587646202d 100644 --- a/sw/source/core/draw/dobjfac.cxx +++ b/sw/source/core/draw/dobjfac.cxx @@ -31,7 +31,7 @@ IMPL_STATIC_LINK( // No switch, there's only one at the moment OSL_ENSURE( aParams.nObjIdentifier == SwFlyDrawObjIdentifier, "Wrong inventor or identifier" ); - return new SwFlyDrawObj(aParams.rSdrModel); + return new SwFlyDrawObj; } return nullptr; } diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index d50a7f5780cf..716e41c433a6 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -49,38 +49,58 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::frame; -SwDPage::SwDPage(SwDrawModel& rNewModel, bool bMasterPage) -: FmFormPage(rNewModel, bMasterPage), +SwDPage::SwDPage(SwDrawModel& rNewModel, bool bMasterPage) : + FmFormPage(rNewModel, bMasterPage), pGridLst( nullptr ), pDoc(&rNewModel.GetDoc()) { } +SwDPage::SwDPage(const SwDPage& rSrcPage) : + FmFormPage( rSrcPage ), + pDoc( nullptr ) +{ + if ( rSrcPage.pGridLst ) + { + pGridLst.reset( new SdrPageGridFrameList ); + for ( sal_uInt16 i = 0; i != rSrcPage.pGridLst->GetCount(); ++i ) + pGridLst->Insert( ( *rSrcPage.pGridLst )[ i ] ); + } +} + SwDPage::~SwDPage() { } -void SwDPage::lateInit(const SwDPage& rSrcPage) +void SwDPage::lateInit(const SwDPage& rPage, SwDrawModel* const pNewModel) { - FmFormPage::lateInit( rSrcPage ); + FmFormPage::lateInit( rPage, pNewModel ); - if ( rSrcPage.pGridLst ) + SwDrawModel* pSwDrawModel = pNewModel; + if (!pSwDrawModel) { - pGridLst.reset( new SdrPageGridFrameList ); - for ( sal_uInt16 i = 0; i != rSrcPage.pGridLst->GetCount(); ++i ) - pGridLst->Insert( ( *rSrcPage.pGridLst )[ i ] ); + pSwDrawModel = &dynamic_cast<SwDrawModel&>(*GetModel()); + assert( pSwDrawModel ); } + pDoc = &pSwDrawModel->GetDoc(); +} + +SwDPage* SwDPage::Clone() const +{ + return Clone( nullptr ); } SwDPage* SwDPage::Clone(SdrModel* const pNewModel) const { - SwDrawModel& rSwDrawModel(static_cast< SwDrawModel& >(nullptr == pNewModel ? getSdrModelFromSdrPage() : *pNewModel)); - SwDPage* pClonedSwDPage( - new SwDPage( - rSwDrawModel, - IsMasterPage())); - pClonedSwDPage->lateInit(*this); - return pClonedSwDPage; + SwDPage* const pNewPage = new SwDPage( *this ); + SwDrawModel* pSwDrawModel = nullptr; + if ( pNewModel ) + { + pSwDrawModel = &dynamic_cast<SwDrawModel&>(*pNewModel); + assert( pSwDrawModel ); + } + pNewPage->lateInit( *this, pSwDrawModel ); + return pNewPage; } SdrObject* SwDPage::ReplaceObject( SdrObject* pNewObj, size_t nObjNum ) @@ -106,7 +126,7 @@ void InsertGridFrame( SdrPageGridFrameList *pLst, const SwFrame *pPg ) const SdrPageGridFrameList* SwDPage::GetGridFrameList( const SdrPageView* pPV, const tools::Rectangle *pRect ) const { - SwViewShell* pSh = static_cast< SwDrawModel& >(getSdrModelFromSdrPage()).GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); + SwViewShell* pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); if(pSh) { for(SwViewShell& rShell : pSh->GetRingContainer()) diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 255163443a96..ef557e8ecd9e 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -94,11 +94,8 @@ static const SwFrame *lcl_FindAnchor( const SdrObject *pObj, bool bAll ) return nullptr; } -SwDrawView::SwDrawView( - SwViewShellImp& rI, - FmFormModel& rFmFormModel, - OutputDevice* pOutDev) -: FmFormView(rFmFormModel, pOutDev), +SwDrawView::SwDrawView( SwViewShellImp &rI, SdrModel *pMd, OutputDevice *pOutDev) : + FmFormView( static_cast<FmFormModel*>(pMd), pOutDev ), m_rImp( rI ) { SetPageVisible( false ); diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 385f8dacc8d5..fd44d6ea09e7 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1287,10 +1287,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SdrModel* _pModel ) pOle2Obj->Disconnect(); // create new graphic shape with the ole graphic and shape size - SdrGrafObj* pGraphicObj = new SdrGrafObj( - *_pModel, // TTTT should be reference - aGraphic, - pOle2Obj->GetCurrentBoundRect()); + SdrGrafObj* pGraphicObj = new SdrGrafObj( aGraphic, pOle2Obj->GetCurrentBoundRect() ); // apply layer of ole2 shape at graphic shape pGraphicObj->SetLayer( pOle2Obj->GetLayer() ); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 250fec87a4dd..a47aa962f9bd 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -111,10 +111,10 @@ using namespace com::sun::star; namespace { -::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() ) { @@ -894,7 +894,7 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt16 nSlotId) { - SdrModel& rModel(pObj->getSdrModelFromSdrObject()); + SdrModel *pDoc = pObj->GetModel(); if ( !(nSlotId == SID_LINE_ARROW_START || nSlotId == SID_LINE_ARROW_END || @@ -908,7 +908,7 @@ void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt1 // set attributes of line start and ends // arrowhead - ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, rModel ) ); + ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDoc ) ); if( !aArrow.count() ) { ::basegfx::B2DPolygon aNewArrow; @@ -920,7 +920,7 @@ void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt1 } // Circles - ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, rModel ) ); + ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, pDoc ) ); if( !aCircle.count() ) { ::basegfx::B2DPolygon aNewCircle; @@ -930,7 +930,7 @@ void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt1 } // Square - ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, rModel ) ); + ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, pDoc ) ); if( !aSquare.count() ) { ::basegfx::B2DPolygon aNewSquare; @@ -942,7 +942,7 @@ void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt1 aSquare.append(aNewSquare); } - SfxItemSet aSet( rModel.GetItemPool() ); + SfxItemSet aSet( pDoc->GetItemPool() ); long nWidth = 100; // (1/100th mm) // determine line width and calculate with it the line end width @@ -2919,9 +2919,8 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const SdrView* pDrawView = GetDrawView(); SdrModel* pDrawModel = pDrawView->GetModel(); SdrObject* pObj = SdrObjFactory::MakeNewObject( - *pDrawModel, - SdrInventor::Default, - eSdrObjectKind); + SdrInventor::Default, eSdrObjectKind, + nullptr, pDrawModel); if(pObj) { @@ -3041,7 +3040,7 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const aTempPoly.append(basegfx::B2DPoint(aRect.BottomRight().getX(), nYMiddle)); aPoly.append(aTempPoly); - SfxItemSet aAttr(pObj->getSdrModelFromSdrObject().GetItemPool()); + SfxItemSet aAttr(pObj->GetModel()->GetItemPool()); SetLineEnds(aAttr, pObj, nSlotId); pObj->SetMergedItemSet(aAttr); } diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index 6e157b1ed3db..a0cf7fd28d3a 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -42,7 +42,7 @@ protected: public: - SwFlyDrawObj(SdrModel& rSdrModel); + SwFlyDrawObj(); virtual ~SwFlyDrawObj() override; // for instantiation of this class while loading (via factory) @@ -80,10 +80,7 @@ public: // RotGrfFlyFrame: Check if this is a SwGrfNode bool ContainsSwGrfNode() const; - SwVirtFlyDrawObj( - SdrModel& rSdrModel, - SdrObject& rNew, - SwFlyFrame* pFly); + SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrame* pFly); virtual ~SwVirtFlyDrawObj() override; // override method of base class SdrVirtObj diff --git a/sw/source/core/inc/dview.hxx b/sw/source/core/inc/dview.hxx index 66b51fd4ade8..aeb1e864fc4f 100644 --- a/sw/source/core/inc/dview.hxx +++ b/sw/source/core/inc/dview.hxx @@ -79,10 +79,7 @@ protected: virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const override; public: - SwDrawView( - SwViewShellImp &rI, - FmFormModel& rFmFormModel, - OutputDevice* pOutDev); + SwDrawView( SwViewShellImp &rI, SdrModel *pMd, OutputDevice* pOutDev ); // from base class virtual SdrObject* GetMaxToTopObj(SdrObject* pObj) const override; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index d7b84212e52a..91d8e155869e 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2886,11 +2886,7 @@ SwFlyFrameFormat::~SwFlyFrameFormat() SwFlyDrawContact* SwFlyFrameFormat::GetOrCreateContact() { if(!m_pContact) - { - SwDrawModel* pDrawModel(GetDoc()->getIDocumentDrawModelAccess().GetOrCreateDrawModel()); - m_pContact.reset(new SwFlyDrawContact(this, *pDrawModel)); - } - + m_pContact.reset(new SwFlyDrawContact(this)); return m_pContact.get(); } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 592a8a7a9cb2..ffc09406425a 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7384,7 +7384,7 @@ Graphic SwDrawFrameFormat::MakeGraphic( ImageMap* ) if ( pMod ) { SdrObject *pObj = FindSdrObject(); - std::unique_ptr<SdrView> pView( new SdrView( *pMod ) ); + std::unique_ptr<SdrView> pView( new SdrView( pMod ) ); SdrPageView *pPgView = pView->ShowSdrPage(pView->GetModel()->GetPage(0)); pView->MarkObj( pObj, pPgView ); aRet = pView->GetMarkedObjBitmapEx(); diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 2146529c8ccd..ee204d12fb9b 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -228,10 +228,7 @@ void SwViewShellImp::MakeDrawView() pOutDevForDrawView = GetShell()->GetOut(); } - m_pDrawView = new SwDrawView( - *this, - *rIDDMA.GetOrCreateDrawModel(), - pOutDevForDrawView); + m_pDrawView = new SwDrawView( *this, rIDDMA.GetDrawModel(), pOutDevForDrawView); } GetDrawView()->SetActiveLayer("Heaven"); diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx index 8b1589563026..7d746579f361 100644 --- a/sw/source/filter/html/htmldrawreader.cxx +++ b/sw/source/filter/html/htmldrawreader.cxx @@ -355,12 +355,8 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) // #i52858# - method name changed SwDrawModel* pModel = m_xDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); SdrPage* pPg = pModel->GetPage( 0 ); - m_pMarquee = SdrObjFactory::MakeNewObject( - *pModel, - SdrInventor::Default, - OBJ_TEXT, - pPg); - + m_pMarquee = SdrObjFactory::MakeNewObject( SdrInventor::Default, + OBJ_TEXT, pPg, pModel ); if( !m_pMarquee ) return; diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index c27173b1fc0d..7406f153a67f 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2966,8 +2966,10 @@ void SwEscherEx::WriteOCXControl( const SwFrameFormat& rFormat, sal_uInt32 nShap // #i71538# use complete SdrViews // SdrExchangeView aExchange(pModel, pDevice); - SdrView aExchange(*pModel, pDevice); - const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pSdrObj)); + SdrView aExchange(pModel, pDevice); + + Graphic aGraphic(SdrExchangeView::GetObjGraphic(pModel, pSdrObj)); + EscherPropertyContainer aPropOpt; WriteOLEPicture(aPropOpt, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::OLEShape, aGraphic, diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index ee2f92901b1e..4d9ceaa9c00f 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -67,8 +67,6 @@ #include <docsh.hxx> #include <cstdio> #include <o3tl/enumrange.hxx> -#include <IDocumentDrawModelAccess.hxx> -#include <drawdoc.hxx> using namespace ::com::sun::star; @@ -141,18 +139,7 @@ bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, if ( pOLENd ) nAspect = pOLENd->GetAspect(); SdrOle2Obj *pRet = SvxMSDffManager::CreateSdrOLEFromStorage( - *m_pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel(), - rStorageName, - xObjStg, - m_pDoc->GetDocStorage(), - aGraph, - aRect, - tools::Rectangle(), - nullptr, - nErr, - 0, - nAspect, - m_pWriter->GetBaseURL()); + rStorageName,xObjStg,m_pDoc->GetDocStorage(),aGraph,aRect,tools::Rectangle(),nullptr,nErr,0,nAspect, m_pWriter->GetBaseURL()); if (pRet) { diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 1b165cfdef64..ed673656a093 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -326,10 +326,7 @@ SdrObject* SwWW8ImplReader::ReadLine(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet ::basegfx::B2DPolygon aPolygon; aPolygon.append(::basegfx::B2DPoint(aP[0].X(), aP[0].Y())); aPolygon.append(::basegfx::B2DPoint(aP[1].X(), aP[1].Y())); - SdrObject* pObj = new SdrPathObj( - *m_pDrawModel, - OBJ_LINE, - ::basegfx::B2DPolyPolygon(aPolygon)); + SdrObject* pObj = new SdrPathObj(OBJ_LINE, ::basegfx::B2DPolyPolygon(aPolygon)); SetStdAttr( rSet, aLine.aLnt, aLine.aShd ); SetLineEndAttr( rSet, aLine.aEpp, aLine.aLnt ); @@ -350,9 +347,7 @@ SdrObject* SwWW8ImplReader::ReadRect(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); - SdrObject* pObj = new SdrRectObj( - *m_pDrawModel, - tools::Rectangle(aP0, aP1)); + SdrObject* pObj = new SdrRectObj( tools::Rectangle( aP0, aP1 ) ); SetStdAttr( rSet, aRect.aLnt, aRect.aShd ); SetFill( rSet, aRect.aFill ); @@ -373,10 +368,7 @@ SdrObject* SwWW8ImplReader::ReadElipse(WW8_DPHEAD const * pHd, SfxAllItemSet &rS aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); - SdrObject* pObj = new SdrCircObj( - *m_pDrawModel, - OBJ_CIRC, - tools::Rectangle(aP0, aP1)); + SdrObject* pObj = new SdrCircObj( OBJ_CIRC, tools::Rectangle( aP0, aP1 ) ); SetStdAttr( rSet, aElipse.aLnt, aElipse.aShd ); SetFill( rSet, aElipse.aFill ); @@ -408,12 +400,8 @@ SdrObject* SwWW8ImplReader::ReadArc(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet) aP1.AdjustX( -static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); } - SdrObject* pObj = new SdrCircObj( - *m_pDrawModel, - OBJ_SECT, - tools::Rectangle(aP0, aP1), - nW * 9000, - ( ( nW + 1 ) & 3 ) * 9000); + SdrObject* pObj = new SdrCircObj( OBJ_SECT, tools::Rectangle( aP0, aP1 ), + nW * 9000, ( ( nW + 1 ) & 3 ) * 9000 ); SetStdAttr( rSet, aArc.aLnt, aArc.aShd ); SetFill( rSet, aArc.aFill ); @@ -448,11 +436,7 @@ SdrObject* SwWW8ImplReader::ReadPolyLine(WW8_DPHEAD const * pHd, SfxAllItemSet & } xP.reset(); - SdrObject* pObj = new SdrPathObj( - *m_pDrawModel, - (SVBT16ToShort(aPoly.aBits1) & 0x1) ? OBJ_POLY : OBJ_PLIN, - ::basegfx::B2DPolyPolygon(aP.getB2DPolygon())); - + SdrObject* pObj = new SdrPathObj(( SVBT16ToShort( aPoly.aBits1 ) & 0x1 ) ? OBJ_POLY : OBJ_PLIN, ::basegfx::B2DPolyPolygon(aP.getB2DPolygon())); SetStdAttr( rSet, aPoly.aLnt, aPoly.aShd ); SetFill( rSet, aPoly.aFill ); @@ -1112,12 +1096,13 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj, if( !pNew ) { - pNew = new SdrGrafObj(*m_pDrawModel); + pNew = new SdrGrafObj; static_cast<SdrGrafObj*>(pNew)->SetGraphic(aGraph); } GrafikCtor(); + pNew->SetModel( m_pDrawModel ); pNew->SetLogicRect( pTextObj->GetCurrentBoundRect() ); pNew->SetLayer( pTextObj->GetLayer() ); @@ -1240,11 +1225,8 @@ SdrObject* SwWW8ImplReader::ReadTextBox(WW8_DPHEAD const * pHd, SfxAllItemSet &r aP1.AdjustX(static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) ); aP1.AdjustY(static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); - SdrRectObj* pObj = new SdrRectObj( - *m_pDrawModel, - OBJ_TEXT, - tools::Rectangle(aP0, aP1)); - + SdrRectObj* pObj = new SdrRectObj( OBJ_TEXT, tools::Rectangle( aP0, aP1 ) ); + pObj->SetModel( m_pDrawModel ); pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1)); Size aSize( static_cast<sal_Int16>(SVBT16ToShort( pHd->dxa )) , static_cast<sal_Int16>(SVBT16ToShort( pHd->dya )) ); @@ -1313,11 +1295,8 @@ SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD const * pHd, SfxAllItemSet + m_nDrawYOfs2 + static_cast<sal_Int16>(SVBT16ToShort( xP[1] )) ); xP.reset(); - SdrCaptionObj* pObj = new SdrCaptionObj( - *m_pDrawModel, - tools::Rectangle(aP0, aP1), - aP2); - + SdrCaptionObj* pObj = new SdrCaptionObj( tools::Rectangle( aP0, aP1 ), aP2 ); + pObj->SetModel( m_pDrawModel ); pObj->NbcSetSnapRect(tools::Rectangle(aP0, aP1)); Size aSize( static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.dxa )), static_cast<sal_Int16>(SVBT16ToShort( aCallB.dpheadTxbx.dya )) ); @@ -1349,7 +1328,7 @@ SdrObject *SwWW8ImplReader::ReadGroup(WW8_DPHEAD const * pHd, SfxAllItemSet &rSe m_nDrawXOfs = m_nDrawXOfs + static_cast<sal_Int16>(SVBT16ToShort( pHd->xa )); m_nDrawYOfs = m_nDrawYOfs + static_cast<sal_Int16>(SVBT16ToShort( pHd->ya )); - SdrObject* pObj = new SdrObjGroup(*m_pDrawModel); + SdrObject* pObj = new SdrObjGroup; short nLeft = static_cast<sal_Int16>(SVBT16ToShort( pHd->cb )) - sizeof( WW8_DPHEAD ); for (int i = 0; i < nGrouped && nLeft >= static_cast<short>(sizeof(WW8_DPHEAD)); ++i) @@ -2815,10 +2794,7 @@ SwFrameFormat* SwWW8ImplReader::MungeTextIntoDrawBox(SdrObject* pTrueObject, { // Group objects don't have text. Insert a text object into // the group for holding the text. - pSdrTextObj = new SdrRectObj( - *m_pDrawModel, - OBJ_TEXT, - pThisGroup->GetCurrentBoundRect()); + pSdrTextObj = new SdrRectObj( OBJ_TEXT, pThisGroup->GetCurrentBoundRect()); SfxItemSet aSet(m_pDrawModel->GetItemPool()); aSet.Put(XFillStyleItem(drawing::FillStyle_NONE)); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 0990ec498bb5..33ff69accc43 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -497,19 +497,9 @@ SdrObject* SwMSDffManager::ImportOLE( sal_uInt32 nOLEId, else { ErrCode nError = ERRCODE_NONE; - pRet = CreateSdrOLEFromStorage( - *pSdrModel, - sStorageName, - xSrcStg, - xDstStg, - rGrf, - rBoundRect, - rVisArea, - pStData, - nError, - nSvxMSDffOLEConvFlags, - css::embed::Aspects::MSOLE_CONTENT, - rReader.GetBaseURL()); + pRet = CreateSdrOLEFromStorage( sStorageName, xSrcStg, xDstStg, + rGrf, rBoundRect, rVisArea, pStData, nError, + nSvxMSDffOLEConvFlags, css::embed::Aspects::MSOLE_CONTENT, rReader.GetBaseURL()); } } return pRet; @@ -743,10 +733,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, if (bIsSimpleDrawingTextBox) { SdrObject::Free( pObj ); - pObj = new SdrRectObj( - *pSdrModel, - OBJ_TEXT, - rTextRect); + pObj = new SdrRectObj(OBJ_TEXT, rTextRect); } // The vertical paragraph justification are contained within the @@ -870,6 +857,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, if (pObj != nullptr) { pObj->SetMergedItemSet(aSet); + pObj->SetModel(pSdrModel); if (bVerticalText) { @@ -935,10 +923,8 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, // simple rectangular objects are ignored by ImportObj() :-( // this is OK for Draw but not for Calc and Writer // cause here these objects have a default border - pObj = new SdrRectObj( - *pSdrModel, - rTextRect); - + pObj = new SdrRectObj(rTextRect); + pObj->SetModel( pSdrModel ); SfxItemSet aSet( pSdrModel->GetItemPool() ); ApplyAttributes( rSt, aSet, rObjData ); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index d2a63a93234f..fd82c91222b7 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -436,21 +436,9 @@ SdrObject* SwWW8ImplReader::ImportOleBase( Graphic& rGraph, } ErrCode nError = ERRCODE_NONE; - GrafikCtor(); - pRet = SvxMSDffManager::CreateSdrOLEFromStorage( - *m_pDrawModel, - aSrcStgName, - xSrc0, - m_pDocShell->GetStorage(), - rGraph, - aRect, - aVisArea, - pTmpData, - nError, - SwMSDffManager::GetFilterFlags(), - nAspect, - GetBaseURL()); + aSrcStgName, xSrc0, m_pDocShell->GetStorage(), rGraph, aRect, aVisArea, pTmpData, nError, + SwMSDffManager::GetFilterFlags(), nAspect, GetBaseURL()); m_pDataStream->Seek( nOldPos ); } } diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index e0244ca88a32..d64f3c2ccd18 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -458,11 +458,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc) pOle2Obj->Disconnect(); // create new graphic shape with the ole graphic and shape size - SdrGrafObj* pGraphicObj = new SdrGrafObj( - pOle2Obj->getSdrModelFromSdrObject(), - aGraphic, - pOle2Obj->GetCurrentBoundRect()); - + SdrGrafObj* pGraphicObj = new SdrGrafObj( aGraphic, pOle2Obj->GetCurrentBoundRect() ); // apply layer of ole2 shape at graphic shape pGraphicObj->SetLayer( pOle2Obj->GetLayer() ); diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index adbbd07ebd2b..be8e19e092ab 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -128,7 +128,7 @@ void ConstCustomShape::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, diff --git a/sw/source/uibase/ribbar/conrect.cxx b/sw/source/uibase/ribbar/conrect.cxx index 395bca6961fe..36f1050ace37 100644 --- a/sw/source/uibase/ribbar/conrect.cxx +++ b/sw/source/uibase/ribbar/conrect.cxx @@ -65,7 +65,7 @@ bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt) SdrObject* pObj = m_pView->GetDrawView()->GetCreateObj(); if (pObj) { - SfxItemSet aAttr(pObj->getSdrModelFromSdrObject().GetItemPool()); + SfxItemSet aAttr(pObj->GetModel()->GetItemPool()); SwFEShell::SetLineEnds(aAttr, pObj, m_nSlotId); pObj->SetMergedItemSet(aAttr); } diff --git a/sw/source/uibase/shells/grfshex.cxx b/sw/source/uibase/shells/grfshex.cxx index e31d5a148b62..6536cf576d97 100644 --- a/sw/source/uibase/shells/grfshex.cxx +++ b/sw/source/uibase/shells/grfshex.cxx @@ -123,10 +123,9 @@ bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq ) if (!bRet) { return bRet; } } - SdrMediaObj* pObj = new SdrMediaObj( - *rSh.GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(), - tools::Rectangle(aPos, aSize)); + SdrMediaObj* pObj = new SdrMediaObj( tools::Rectangle( aPos, aSize ) ); + pObj->SetModel(rSh.GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()); // set before setURL pObj->setURL( realURL, "" ); rSh.EnterStdMode(); rSh.SwFEShell::InsertDrawObj( *pObj, aPos ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 3aa9a3cfa688..2fd36e885ddc 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -450,12 +450,6 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) { } -SdrModel* SwXTextDocument::getSdrModelFromUnoModel() const -{ - OSL_ENSURE(pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetOrCreateDrawModel(), "No SdrModel in SwDoc, should not happen"); - return pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); -} - SwXTextDocument::~SwXTextDocument() { InitNewDoc(); |