diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de (CIB)> | 2018-03-16 16:11:45 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-04-06 17:52:02 +0200 |
commit | a274dddaf671792eae07c322726dfe49a29876cf (patch) | |
tree | 75c5ba01bbdbca8a8042f48b57ae9821873c36b6 | |
parent | f59e9743ab16bd9ef07a9cd9abe5452eae7710dd (diff) |
SOSAW080: Adapted GetObjGraphic to just take a const SdrObject&
Change-Id: I0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 7 | ||||
-rw-r--r-- | filter/source/svg/svgexport.cxx | 5 | ||||
-rw-r--r-- | include/svx/svdxcgv.hxx | 12 | ||||
-rw-r--r-- | sc/source/filter/html/htmlexp2.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/dlg/animobjs.cxx | 19 | ||||
-rw-r--r-- | svx/source/svdraw/svdovirt.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdxcgv.cxx | 106 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 4 |
8 files changed, 67 insertions, 93 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index c5c5f3af7b3a..3b3fc0562bf5 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -3774,11 +3774,8 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const uno::Refer SdrObject* pShape = GetSdrObjectFromXShape( rXShape ); if ( pShape ) { - Graphic aGraphic( - SdrExchangeView::GetObjGraphic( // TTTT GetObjGraphic may use a SdrObject& - &pShape->getSdrModelFromSdrObject(), - pShape)); - GraphicObject aGraphicObject(aGraphic); + const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape)); + const GraphicObject aGraphicObject(aGraphic); if (!aGraphicObject.GetUniqueID().isEmpty()) { diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index dcaae2acaa46..e13b162876c7 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -1931,10 +1931,7 @@ bool SVGFilter::implCreateObjectsFromShape( const Reference< css::drawing::XDraw if( pObj ) { - Graphic aGraphic( - SdrExchangeView::GetObjGraphic( - &pObj->getSdrModelFromSdrObject(), - pObj)); + const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pObj)); if( aGraphic.GetType() != GraphicType::NONE ) { diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx index 4625d83d0817..52dc63b1a282 100644 --- a/include/svx/svdxcgv.hxx +++ b/include/svx/svdxcgv.hxx @@ -74,20 +74,16 @@ public: Graphic GetAllMarkedGraphic() const; - /** Generate a Graphic for the given draw object in the given model + /** Generate a Graphic for the given draw object - @param pModel - Must not be NULL. Denotes the draw model the object is a part - of. - - @param pObj + @param rSdrObject The object (can also be a group object) to retrieve a Graphic - for. Must not be NULL. + for. @return a graphical representation of the given object, as it appears on screen (e.g. with rotation, if any, applied). */ - static Graphic GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj ); + static Graphic GetObjGraphic(const SdrObject& rSdrObject); // The new Draw objects are marked for all paste methods. // If bAddMark is true, the new Draw objects are added to an existing diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx index a6b73fd76631..d6887744f517 100644 --- a/sc/source/filter/html/htmlexp2.cxx +++ b/sc/source/filter/html/htmlexp2.cxx @@ -165,8 +165,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) break; default: { - Graphic aGraph( SdrExchangeView::GetObjGraphic( - pDoc->GetDrawLayer(), pObject ) ); + Graphic aGraph(SdrExchangeView::GetObjGraphic(*pObject)); OUString aLinkName; WriteImage( aLinkName, aGraph, aOpt ); pE->bWritten = true; diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index deddf8b68a53..5ca6bab37ebd 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -777,13 +777,8 @@ void AnimationWindow::AddObj (::sd::View& rView ) for( size_t nObject = 0; nObject < pObjList->GetObjCount(); ++nObject ) { - SdrObject* pSnapShot = pObjList->GetObj( nObject ); - - BitmapEx *const pBitmapEx = new BitmapEx( - SdrExchangeView::GetObjGraphic( - &pSnapShot->getSdrModelFromSdrObject(), - pSnapShot).GetBitmapEx() ); - + SdrObject* pSnapShot(pObjList->GetObj(nObject)); + BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pSnapShot).GetBitmapEx()); ::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() ); size_t nIndex = m_nCurrentFrame + 1; m_FrameList.insert( @@ -831,15 +826,9 @@ void AnimationWindow::AddObj (::sd::View& rView ) for( size_t nObject= 0; nObject < nMarkCount; ++nObject ) { // Clone - SdrObject* pObject = rMarkList.GetMark( nObject )->GetMarkedSdrObj(); - - BitmapEx *const pBitmapEx = new BitmapEx( - SdrExchangeView::GetObjGraphic( - &pObject->getSdrModelFromSdrObject(), - pObject).GetBitmapEx() ); - + SdrObject* pObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj()); + BitmapEx *const pBitmapEx = new BitmapEx(SdrExchangeView::GetObjGraphic(*pObject).GetBitmapEx()); ::tools::Time* pTime = new ::tools::Time( m_pTimeField->GetTime() ); - size_t nIndex = m_nCurrentFrame + 1; m_FrameList.insert( m_FrameList.begin() + nIndex, diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 596c6139e1c9..4306ecd577fa 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -277,9 +277,7 @@ SdrObject* SdrVirtObj::getFullDragClone() const SdrObject& rReferencedObject = const_cast<SdrVirtObj*>(this)->ReferencedObj(); return new SdrGrafObj( getSdrModelFromSdrObject(), - SdrDragView::GetObjGraphic( - &getSdrModelFromSdrObject(), - &rReferencedObject), + SdrDragView::GetObjGraphic(rReferencedObject), GetLogicRect()); } diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 8603cc472ca2..58fc73351181 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -585,7 +585,7 @@ Graphic SdrExchangeView::GetAllMarkedGraphic() const if( AreObjectsMarked() ) { if( ( 1 == GetMarkedObjectCount() ) && GetSdrMarkByIndex( 0 ) ) - aRet = SdrExchangeView::GetObjGraphic( mpModel, GetMarkedObjectByIndex( 0 ) ); + aRet = SdrExchangeView::GetObjGraphic(*GetMarkedObjectByIndex(0)); else aRet = GetMarkedObjMetaFile(); } @@ -594,68 +594,68 @@ Graphic SdrExchangeView::GetAllMarkedGraphic() const } -Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj ) +Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject) { Graphic aRet; - if( pModel && pObj ) - { - // try to get a graphic from the object first - const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj); - const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj); + // try to get a graphic from the object first + const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&rSdrObject)); + const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&rSdrObject)); - if(pSdrGrafObj) + if(pSdrGrafObj) + { + if(pSdrGrafObj->isEmbeddedVectorGraphicData()) { - if(pSdrGrafObj->isEmbeddedVectorGraphicData()) - { - // get Metafile for Svg content - aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); - } - else - { - // Make behaviour coherent with metafile - // recording below (which of course also takes - // view-transformed objects) - aRet = pSdrGrafObj->GetTransformedGraphic(); - } + // get Metafile for Svg content + aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); } - else if(pSdrOle2Obj) + else { - if ( pSdrOle2Obj->GetGraphic() ) - aRet = *pSdrOle2Obj->GetGraphic(); + // Make behaviour coherent with metafile + // recording below (which of course also takes + // view-transformed objects) + aRet = pSdrGrafObj->GetTransformedGraphic(); } - - // if graphic could not be retrieved => go the hard way and create a MetaFile - if( ( GraphicType::NONE == aRet.GetType() ) || ( GraphicType::Default == aRet.GetType() ) ) + } + else if(pSdrOle2Obj) + { + if(pSdrOle2Obj->GetGraphic()) { - ScopedVclPtrInstance< VirtualDevice > pOut; - GDIMetaFile aMtf; - const tools::Rectangle aBoundRect( pObj->GetCurrentBoundRect() ); - const MapMode aMap( pModel->GetScaleUnit(), - Point(), - pModel->GetScaleFraction(), - pModel->GetScaleFraction() ); - - pOut->EnableOutput( false ); - pOut->SetMapMode( aMap ); - aMtf.Record( pOut ); - pObj->SingleObjectPainter( *pOut.get() ); - aMtf.Stop(); - aMtf.WindStart(); - - // #i99268# replace the original offset from using XOutDev's SetOffset - // NOT (as tried with #i92760#) with another MapMode which gets recorded - // by the Metafile itself (what always leads to problems), but by - // moving the result directly - aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top()); - - aMtf.SetPrefMapMode( aMap ); - aMtf.SetPrefSize( aBoundRect.GetSize() ); + aRet = *pSdrOle2Obj->GetGraphic(); + } + } - if( aMtf.GetActionSize() ) - aRet = aMtf; + // if graphic could not be retrieved => go the hard way and create a MetaFile + if((GraphicType::NONE == aRet.GetType()) || (GraphicType::Default == aRet.GetType())) + { + ScopedVclPtrInstance< VirtualDevice > pOut; + GDIMetaFile aMtf; + const tools::Rectangle aBoundRect(rSdrObject.GetCurrentBoundRect()); + const MapMode aMap(rSdrObject.getSdrModelFromSdrObject().GetScaleUnit(), + Point(), + rSdrObject.getSdrModelFromSdrObject().GetScaleFraction(), + rSdrObject.getSdrModelFromSdrObject().GetScaleFraction()); + + pOut->EnableOutput(false); + pOut->SetMapMode(aMap); + aMtf.Record(pOut); + rSdrObject.SingleObjectPainter(*pOut.get()); + aMtf.Stop(); + aMtf.WindStart(); + + // #i99268# replace the original offset from using XOutDev's SetOffset + // NOT (as tried with #i92760#) with another MapMode which gets recorded + // by the Metafile itself (what always leads to problems), but by + // moving the result directly + aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top()); + aMtf.SetPrefMapMode(aMap); + aMtf.SetPrefSize(aBoundRect.GetSize()); + + if(aMtf.GetActionSize()) + { + aRet = aMtf; } - } + } return aRet; } @@ -736,7 +736,7 @@ SdrModel* SdrExchangeView::GetMarkedObjModel() const // virtual connection to referenced page gets lost in new model pNewObj = new SdrGrafObj( *pNeuMod, - GetObjGraphic(mpModel, pObj), + GetObjGraphic(*pObj), pObj->GetLogicRect()); pNewObj->SetPage( pNeuPag ); } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 4d15b6b02742..c27173b1fc0d 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2967,9 +2967,7 @@ void SwEscherEx::WriteOCXControl( const SwFrameFormat& rFormat, sal_uInt32 nShap // #i71538# use complete SdrViews // SdrExchangeView aExchange(pModel, pDevice); SdrView aExchange(*pModel, pDevice); - - Graphic aGraphic(SdrExchangeView::GetObjGraphic(pModel, pSdrObj)); - + const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pSdrObj)); EscherPropertyContainer aPropOpt; WriteOLEPicture(aPropOpt, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::OLEShape, aGraphic, |