filter/source/msfilter/escherex.cxx | 29 ++++++++++++++++------------- include/filter/msfilter/escherex.hxx | 2 +- sd/source/filter/eppt/epptso.cxx | 2 +- sw/source/filter/ww8/wrtw8esh.cxx | 12 +++++------- 4 files changed, 23 insertions(+), 22 deletions(-)
New commits: commit 7de3ea6a00a45f4860229571bf1df4866cffcdf5 Author: Tomaž Vajngerl <[email protected]> Date: Tue Feb 13 18:31:16 2018 +0900 Pass GraphicObject instead of UniqueId for GetBlibID Change-Id: I49d0c84a5beb4f8bf33c3ebac6ddc8ae302c6a4c Reviewed-on: https://gerrit.libreoffice.org/49645 Tested-by: Jenkins <[email protected]> Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index a4888620a0bb..8807d84173c2 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1278,7 +1278,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<drawi pVisArea.reset(new awt::Rectangle); aAny >>= (*pVisArea); } - sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, pVisArea.get() ); + sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, rGraphicObj, pVisArea.get() ); if ( nBlibId ) { AddOpt( ESCHER_Prop_pib, nBlibId, true ); @@ -1311,7 +1311,10 @@ bool EscherPropertyContainer::ImplCreateEmbeddedBmp( const OString& rUniqueId ) { EscherGraphicProvider aProvider; SvMemoryStream aMemStrm; - if ( aProvider.GetBlibID( aMemStrm, rUniqueId ) ) + // TODO: Get rid of UniqueID + + GraphicObject aGraphicObject(rUniqueId); + if ( aProvider.GetBlibID( aMemStrm, aGraphicObject ) ) { // grab BLIP from stream and insert directly as complex property // ownership of stream memory goes to complex property @@ -1347,7 +1350,6 @@ void EscherPropertyContainer::CreateEmbeddedBitmapProperties( } } - namespace { GraphicObject* lclDrawHatch( const drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground, const tools::Rectangle& rRect ) @@ -1678,7 +1680,8 @@ bool EscherPropertyContainer::CreateGraphicProperties( // write out embedded graphic if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect ) { - const sal_uInt32 nBlibId(pGraphicProvider->GetBlibID(*pPicOutStrm, aUniqueId, nullptr, pGraphicAttr.get())); + GraphicObject aGraphicObject(aUniqueId); + const sal_uInt32 nBlibId(pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject, nullptr, pGraphicAttr.get())); if(nBlibId) { @@ -1700,7 +1703,9 @@ bool EscherPropertyContainer::CreateGraphicProperties( EscherGraphicProvider aProvider; SvMemoryStream aMemStrm; - if ( aProvider.GetBlibID( aMemStrm, aUniqueId, nullptr, pGraphicAttr.get(), bOOxmlExport ) ) + GraphicObject aGraphicObject(aUniqueId); + + if ( aProvider.GetBlibID( aMemStrm, aGraphicObject, nullptr, pGraphicAttr.get(), bOOxmlExport ) ) { // grab BLIP from stream and insert directly as complex property // ownership of stream memory goes to complex property @@ -3789,13 +3794,12 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const uno::Refer SdrModel* pMod = pShape->GetModel(); Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape)); - std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(aGraphic)); - OString aUniqueId = xGraphicObject->GetUniqueID(); - if ( aUniqueId.getLength() ) + GraphicObject aGraphicObject(aGraphic); + if (!aGraphicObject.GetUniqueID().isEmpty()) { if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect ) { - sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId ); + sal_uInt32 nBlibId = pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject); if ( nBlibId ) { AddOpt( ESCHER_Prop_pib, nBlibId, true ); @@ -4149,14 +4153,13 @@ bool EscherGraphicProvider::GetPrefSize( const sal_uInt32 nBlibId, Size& rPrefSi return bInRange; } -sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OString& rId, +sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObject const & rGraphicObject, const awt::Rectangle* pVisArea, const GraphicAttr* pGraphicAttr, const bool bOOxmlExport ) { sal_uInt32 nBlibId = 0; - std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(rId)); - std::unique_ptr<EscherBlibEntry> p_EscherBlibEntry( new EscherBlibEntry( rPicOutStrm.Tell(), *xGraphicObject, rId, pGraphicAttr ) ); + std::unique_ptr<EscherBlibEntry> p_EscherBlibEntry( new EscherBlibEntry( rPicOutStrm.Tell(), rGraphicObject, rGraphicObject.GetUniqueID(), pGraphicAttr ) ); if ( !p_EscherBlibEntry->IsEmpty() ) { for ( size_t i = 0; i < mvBlibEntrys.size(); i++ ) @@ -4170,7 +4173,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin bool bUseNativeGraphic( false ); - Graphic aGraphic(xGraphicObject->GetTransformedGraphic(pGraphicAttr)); + Graphic aGraphic(rGraphicObject.GetTransformedGraphic(pGraphicAttr)); GfxLink aGraphicLink; SvMemoryStream aStream; diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx index 80e2888211a6..04574a2939fe 100644 --- a/include/filter/msfilter/escherex.hxx +++ b/include/filter/msfilter/escherex.hxx @@ -590,7 +590,7 @@ public: void WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, sal_uInt32 nResize); sal_uInt32 GetBlibID( SvStream& rPicOutStream, - const OString& rGraphicId, + GraphicObject const & pGraphicObject, const css::awt::Rectangle* pVisArea = nullptr, const GraphicAttr* pGrafikAttr = nullptr, const bool ooxmlExport = false diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 7ea85d922520..24eba89c4b38 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -140,7 +140,7 @@ sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicS xGraphicObject.reset(new GraphicObject(aMappedGraphic)); } } - sal_uInt32 nId = pGraphicProv->GetBlibID(aBuExPictureStream, xGraphicObject->GetUniqueID()); + sal_uInt32 nId = pGraphicProv->GetBlibID(aBuExPictureStream, *xGraphicObject.get()); if ( nId && ( nId < 0x10000 ) ) nRetValue = static_cast<sal_uInt16>(nId) - 1; diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index d50b66776a42..4b5d3e00916a 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1544,7 +1544,7 @@ void SwBasicEscherEx::WriteGrfBullet(const Graphic& rGrf) { aSize = OutputDevice::LogicToLogic( aSize,rGrf.GetPrefMapMode(), aMap100mm ); } - sal_uInt32 nBlibId = mxGlobal->GetBlibID( *(mxGlobal->QueryPictureStream()), aUniqueId ); + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *(mxGlobal->QueryPictureStream()), aGraphicObject ); if (nBlibId) aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true); } @@ -1631,8 +1631,7 @@ sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrameFormat& rFormat, sal_uI aGraphic.GetPrefMapMode(), aMap100mm ); } - sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), - aUniqueId ); + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), aGraphicObject); if (nBlibId) aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true); } @@ -1855,8 +1854,7 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush, rGraphic.GetPrefMapMode(), aMap100mm); } - sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), - aUniqueId); + sal_uInt32 nBlibId = mxGlobal->GetBlibID(*QueryPictureStream(), *pGraphicObject); if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_fillBlip,nBlibId,true); } @@ -2923,8 +2921,8 @@ void SwBasicEscherEx::WriteOLEPicture(EscherPropertyContainer &rPropOpt, OString aId = aGraphicObject.GetUniqueID(); if (!aId.isEmpty()) { - sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), - aId, pVisArea); // SJ: the fourth parameter (VisArea) should be set.. + // SJ: the fourth parameter (VisArea) should be set.. + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *QueryPictureStream(), aGraphicObject, pVisArea); if (nBlibId) rPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, true); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
