diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-06-16 17:16:22 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-07-15 11:01:30 +0200 |
commit | 783269e91e2166357a9fb095e64a1d48e6f0601a (patch) | |
tree | a91bb0d9ee76564ed44415b62a606da7f0d24a8a /vcl/source/filter/graphicfilter.cxx | |
parent | cfe47d035822ab4a46e1d34e26e383a45b9adddd (diff) |
emfplus: completed isolation/migration of Emf/Wmf
Decided to keep the migrated/isolated Emf/Wmf reader
which are now hidden behind a Uno Api. Had to re-implement
WMF_EXTERNALHEADER (now WmfExternal, own file/header)
to not break anything. It *seems* to just scale something
and could be done after import, but I could not be sure.
Also needed a callback hook to allow getting the Metafile
out of a MetafilePrimitive in a lower module (vcl relative
to drawinglayer) which is needed as long as primitives
are not completely on Uno Api. Deleted all Emf/Wmf reader
stuff from vcl.
Change-Id: Ic5540defa8ec770728280df4df3f12e1f48cfc3a
Diffstat (limited to 'vcl/source/filter/graphicfilter.cxx')
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index a436999af548..a0f9d21f9cca 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1306,8 +1306,14 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rP return nRetValue; } -ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rIStream, - sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, GraphicFilterImportFlags nImportFlags, WMF_EXTERNALHEADER *pExtHeader ) +ErrCode GraphicFilter::ImportGraphic( + Graphic& rGraphic, + const OUString& rPath, + SvStream& rIStream, + sal_uInt16 nFormat, + sal_uInt16* pDeterminedFormat, + GraphicFilterImportFlags nImportFlags, + WmfExternal *pExtHeader) { return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, nullptr, pExtHeader ); } @@ -1462,7 +1468,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rIStream, sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, GraphicFilterImportFlags nImportFlags, css::uno::Sequence< css::beans::PropertyValue >* pFilterData, - WMF_EXTERNALHEADER *pExtHeader ) + WmfExternal *pExtHeader ) { OUString aFilterName; OUString aExternalFilterName; @@ -1766,52 +1772,46 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, else if( aFilterName.equalsIgnoreAsciiCase( IMP_WMF ) || aFilterName.equalsIgnoreAsciiCase( IMP_EMF ) ) { - static bool bCheckEmfWmf = true; - if (bCheckEmfWmf) - { - if (rGraphic.IsDummyContext()) - rGraphic.SetDummyContext(false); + // use new UNO API service, do not directly import but create a + // Graphic that contains the original data and decomposes to + // primitives on demand + if (rGraphic.IsDummyContext()) + rGraphic.SetDummyContext(false); - const sal_uInt32 nStreamPosition(rIStream.Tell()); - const sal_uInt32 nStreamLength(rIStream.Seek(STREAM_SEEK_TO_END) - nStreamPosition); - VectorGraphicDataArray aNewData(nStreamLength); - bool bOkay(false); + const sal_uInt32 nStreamPosition(rIStream.Tell()); + const sal_uInt32 nStreamLength(rIStream.Seek(STREAM_SEEK_TO_END) - nStreamPosition); + VectorGraphicDataArray aNewData(nStreamLength); + bool bOkay(false); - rIStream.Seek(nStreamPosition); - rIStream.ReadBytes(aNewData.begin(), nStreamLength); + rIStream.Seek(nStreamPosition); + rIStream.ReadBytes(aNewData.begin(), nStreamLength); - if (!rIStream.GetError()) + if (!rIStream.GetError()) + { + const bool bIsWmf(aFilterName.equalsIgnoreAsciiCase(IMP_WMF)); + const VectorGraphicDataType aDataType(bIsWmf ? VectorGraphicDataType::Wmf : VectorGraphicDataType::Emf); + VectorGraphicDataPtr aVectorGraphicDataPtr( + new VectorGraphicData( + aNewData, + rPath, + aDataType)); + + if (pExtHeader) { - const bool bIsWmf(aFilterName.equalsIgnoreAsciiCase(IMP_WMF)); - const VectorGraphicDataType aDataType(bIsWmf ? VectorGraphicDataType::Wmf : VectorGraphicDataType::Emf); - VectorGraphicDataPtr aVectorGraphicDataPtr( - new VectorGraphicData( - aNewData, - rPath, - aDataType)); - rGraphic = Graphic(aVectorGraphicDataPtr); - bOkay = true; + aVectorGraphicDataPtr->setWmfExternalHeader(*pExtHeader); } - if (bOkay) - { - eLinkType = GfxLinkType::NativeWmf; - } - else - { - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } + rGraphic = Graphic(aVectorGraphicDataPtr); + bOkay = true; + } + + if (bOkay) + { + eLinkType = GfxLinkType::NativeWmf; } else { - GDIMetaFile aMtf; - if (!ConvertWMFToGDIMetaFile(rIStream, aMtf, nullptr, pExtHeader)) - nStatus = ERRCODE_GRFILTER_FORMATERROR; - else - { - rGraphic = aMtf; - eLinkType = GfxLinkType::NativeWmf; - } + nStatus = ERRCODE_GRFILTER_FILTERERROR; } } else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVSGF ) |