[Libreoffice-commits] core.git: filter/source include/filter sw/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu Mar 15 02:03:22 UTC 2018
filter/source/msfilter/msdffimp.cxx | 30 +++++++++++++-----------------
include/filter/msfilter/msdffimp.hxx | 3 ++-
sw/source/filter/ww8/ww8par.hxx | 2 +-
3 files changed, 16 insertions(+), 19 deletions(-)
New commits:
commit 531036fa296b6bfca5ec93c4d7ef1264dc6e7b65
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Thu Mar 15 09:45:52 2018 +0900
change EscherBlipCache to cache Graphic and not GObject uniqueID
In addition change from map to unordered_map.
Change-Id: Ief33d6ebd7e42606ab20fcf9fc91020b1ef9aab6
Reviewed-on: https://gerrit.libreoffice.org/51306
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 794aa8a4a59b..960fa7f1ed2d 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6294,10 +6294,9 @@ bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape,
}
-/* access to a BLIP at runtime (if the Blip-Number is already known)
- ---------------------------
-******************************************************************************/
-bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle* pVisArea )
+/** Access to a BLIP at runtime (if the Blip-Number is already known)
+ */
+bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rGraphic, tools::Rectangle* pVisArea )
{
if (!pStData)
return false;
@@ -6305,24 +6304,22 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle
bool bOk = false; // initialize result variable
// check if a graphic for this blipId is already imported
- if ( nIdx_)
+ if (nIdx_)
{
- std::map<sal_uInt32,OString>::iterator iter = aEscherBlipCache.find(nIdx_);
+ auto iter = aEscherBlipCache.find(nIdx_);
if (iter != aEscherBlipCache.end())
{
- /* if this entry is available, then it should be possible
- to get the Graphic via GraphicObject */
- GraphicObject aGraphicObject( iter->second );
- rData = aGraphicObject.GetGraphic();
- if ( rData.GetType() != GraphicType::NONE )
+ /* if this entry is available */
+ rGraphic = Graphic(iter->second);
+ if (rGraphic.GetType() != GraphicType::NONE)
bOk = true;
else
aEscherBlipCache.erase(iter);
}
}
- if ( !bOk )
+ if (!bOk)
{
sal_uInt16 nIdx = sal_uInt16( nIdx_ );
if (!nIdx || (m_pBLIPInfos->size() < nIdx))
@@ -6347,7 +6344,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle
if (!bOk || pStData->GetError())
pStData->ResetError();
else
- bOk = GetBLIPDirect( *pStData, rData, pVisArea );
+ bOk = GetBLIPDirect( *pStData, rGraphic, pVisArea );
if( pStData2 && !bOk )
{
// Error, but the is a second chance: There is a second
@@ -6361,7 +6358,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle
if (!bOk || pStData2->GetError())
pStData2->ResetError();
else
- bOk = GetBLIPDirect( *pStData2, rData, pVisArea );
+ bOk = GetBLIPDirect( *pStData2, rGraphic, pVisArea );
// restore of FilePos of the second data stream
pStData2->Seek( nOldPosData2 );
}
@@ -6370,11 +6367,10 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, tools::Rectangle
if( &rStCtrl != pStData )
pStData->Seek( nOldPosData );
- if ( bOk )
+ if (bOk)
{
// create new BlipCacheEntry for this graphic
- GraphicObject aGraphicObject( rData );
- aEscherBlipCache.insert(std::make_pair(nIdx_,aGraphicObject.GetUniqueID()));
+ aEscherBlipCache.insert(std::make_pair(nIdx_, rGraphic));
}
}
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index aafb47b3bc88..ba8e6897492d 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -26,6 +26,7 @@
#include <set>
#include <utility>
#include <vector>
+#include <unordered_map>
#include <boost/optional.hpp>
#include <com/sun/star/uno/Any.hxx>
@@ -529,7 +530,7 @@ protected:
public:
std::unique_ptr<DffPropertyReader> pSecPropSet;
- std::map<sal_uInt32,OString> aEscherBlipCache;
+ std::unordered_map<sal_uInt32, Graphic> aEscherBlipCache;
DffRecordManager maShapeRecords;
Color mnDefaultColor;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 601dcc17fa53..a81e1754be32 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -743,7 +743,7 @@ class SwMSDffManager : public SvxMSDffManager
private:
SwWW8ImplReader& rReader;
SvStream *pFallbackStream;
- std::map<sal_uInt32,OString> aOldEscherBlipCache;
+ std::unordered_map<sal_uInt32, Graphic> aOldEscherBlipCache;
virtual bool GetOLEStorageName( sal_uInt32 nOLEId, OUString& rStorageName,
tools::SvRef<SotStorage>& rSrcStorage, css::uno::Reference < css::embed::XStorage >& rDestStorage ) const override;
More information about the Libreoffice-commits
mailing list