diff options
Diffstat (limited to 'filter/source/msfilter/msdffimp.cxx')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 86 |
1 files changed, 54 insertions, 32 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index ac281e0bfdd1..e958c813068c 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -3955,7 +3955,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons } if( !pRet ) { - pRet = new SdrGrafObj; + pRet = new SdrGrafObj(*pSdrModel); if( bGrfRead ) static_cast<SdrGrafObj*>(pRet)->SetGraphic( aGraf ); @@ -3997,7 +3997,6 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons pRet->SetName( aFileName ); } } - pRet->SetModel( pSdrModel ); // required for GraphicLink pRet->SetLogicRect( rObjData.aBoundRect ); if ( dynamic_cast<const SdrGrafObj* >(pRet) != nullptr ) @@ -4307,7 +4306,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if ( aObjData.nSpFlags & ShapeFlag::Group ) { - pRet = new SdrObjGroup; + pRet = new SdrObjGroup(*pSdrModel); /* After CWS aw033 has been integrated, an empty group object cannot store its resulting bounding rectangle anymore. We have to return this rectangle via rClientRect now, but only, if @@ -4337,8 +4336,10 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r basegfx::B2DPolygon aPoly; aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Left(), aObjData.aBoundRect.Top())); aPoly.append(basegfx::B2DPoint(aObjData.aBoundRect.Right(), aObjData.aBoundRect.Bottom())); - pRet = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly)); - pRet->SetModel( pSdrModel ); + pRet = new SdrPathObj( + *pSdrModel, + OBJ_LINE, + basegfx::B2DPolyPolygon(aPoly)); ApplyAttributes( rSt, aSet, aObjData ); pRet->SetMergedItemSet(aSet); } @@ -4349,8 +4350,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ApplyAttributes( rSt, aSet, aObjData ); - pRet = new SdrObjCustomShape(); - pRet->SetModel( pSdrModel ); + pRet = new SdrObjCustomShape(*pSdrModel); sal_uInt32 ngtextFStrikethrough = GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ); bool bIsFontwork = ( ngtextFStrikethrough & 0x4000 ) != 0; @@ -4471,9 +4471,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r { SdrOutliner& rOutliner = static_cast<SdrObjCustomShape*>(pRet)->ImpGetDrawOutliner(); bool bOldUpdateMode = rOutliner.GetUpdateMode(); - SdrModel* pModel = pRet->GetModel(); - if ( pModel ) - rOutliner.SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pModel->GetStyleSheetPool()) ); + rOutliner.SetStyleSheetPool(static_cast< SfxStyleSheetPool* >(pRet->getSdrModelFromSdrObject().GetStyleSheetPool())); rOutliner.SetUpdateMode( false ); rOutliner.SetText( *pParaObj ); ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK); @@ -4735,7 +4733,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r basegfx::B2DPolyPolygon aPoly( static_cast<SdrObjCustomShape*>(pRet)->GetLineGeometry( true ) ); SdrObject::Free( pRet ); - pRet = new SdrEdgeObj(); + pRet = new SdrEdgeObj(*pSdrModel); ApplyAttributes( rSt, aSet, aObjData ); pRet->SetLogicRect( aObjData.aBoundRect ); pRet->SetMergedItemSet(aSet); @@ -5235,7 +5233,10 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, } } - pTextObj = new SdrRectObj(OBJ_TEXT, rTextRect); + pTextObj = new SdrRectObj( + *pSdrModel, + OBJ_TEXT, + rTextRect); pTextImpRec = new SvxMSDffImportRec(*pImpRec); bDeleteTextImpRec = true; @@ -5364,7 +5365,6 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, } pTextObj->SetMergedItemSet(aSet); - pTextObj->SetModel(pSdrModel); if (bVerticalText) pTextObj->SetVerticalWriting(true); @@ -5397,7 +5397,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, { if( pTextObj != pObj ) { - SdrObject* pGroup = new SdrObjGroup; + SdrObject* pGroup = new SdrObjGroup(*pSdrModel); pGroup->GetSubList()->NbcInsertObject( pObj ); pGroup->GetSubList()->NbcInsertObject( pTextObj ); if (pOrgObj == pObj) @@ -5413,9 +5413,11 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, // simple rectangular objects are ignored by ImportObj() :-( // this is OK for Draw but not for Calc and Writer // cause here these objects have a default border - pObj = new SdrRectObj(rTextRect); + pObj = new SdrRectObj( + *pSdrModel, + rTextRect); + pOrgObj = pObj; - pObj->SetModel( pSdrModel ); SfxItemSet aSet( pSdrModel->GetItemPool() ); ApplyAttributes( rSt, aSet, rObjData ); @@ -6615,9 +6617,19 @@ SdrObject* SvxMSDffManager::ImportOLE( sal_uInt32 nOLEId, ErrCode nError = ERRCODE_NONE; uno::Reference < embed::XStorage > xDstStg; if( GetOLEStorageName( nOLEId, sStorageName, xSrcStg, xDstStg )) - pRet = CreateSdrOLEFromStorage( sStorageName, xSrcStg, xDstStg, - rGrf, rBoundRect, rVisArea, pStData, nError, - nSvxMSDffOLEConvFlags, embed::Aspects::MSOLE_CONTENT, maBaseURL); + pRet = CreateSdrOLEFromStorage( + *GetModel(), + sStorageName, + xSrcStg, + xDstStg, + rGrf, + rBoundRect, + rVisArea, + pStData, + nError, + nSvxMSDffOLEConvFlags, + embed::Aspects::MSOLE_CONTENT, + maBaseURL); return pRet; } @@ -7106,17 +7118,18 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo // TODO/MBA: code review and testing! SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage( - const OUString& rStorageName, - tools::SvRef<SotStorage> const & rSrcStorage, - const uno::Reference < embed::XStorage >& xDestStorage, - const Graphic& rGrf, - const tools::Rectangle& rBoundRect, - const tools::Rectangle& rVisArea, - SvStream* pDataStrm, - ErrCode& rError, - sal_uInt32 nConvertFlags, - sal_Int64 nRecommendedAspect, - OUString const& rBaseURL) + SdrModel& rSdrModel, + const OUString& rStorageName, + tools::SvRef<SotStorage> const & rSrcStorage, + const uno::Reference < embed::XStorage >& xDestStorage, + const Graphic& rGrf, + const tools::Rectangle& rBoundRect, + const tools::Rectangle& rVisArea, + SvStream* pDataStrm, + ErrCode& rError, + sal_uInt32 nConvertFlags, + sal_Int64 nRecommendedAspect, + OUString const& rBaseURL) { sal_Int64 nAspect = nRecommendedAspect; SdrOle2Obj* pRet = nullptr; @@ -7184,7 +7197,12 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage( aObj.SetGraphic( rGrf, OUString() ); // TODO/MBA: check setting of PersistName - pRet = new SdrOle2Obj( aObj, OUString(), rBoundRect); + pRet = new SdrOle2Obj( + rSdrModel, + aObj, + OUString(), + rBoundRect); + // we have the Object, don't create another bValidStorage = false; } @@ -7280,7 +7298,11 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage( // TODO/LATER: need MediaType aObj.SetGraphic( rGrf, OUString() ); - pRet = new SdrOle2Obj( aObj, aDstStgName, rBoundRect); + pRet = new SdrOle2Obj( + rSdrModel, + aObj, + aDstStgName, + rBoundRect); } } } |