include/vcl/graphicfilter.hxx             |   10 ++++------
 vcl/source/filter/graphicfilter.cxx       |   25 +++++++++----------------
 vcl/source/graphic/GraphicLoader.cxx      |    3 +--
 vcl/source/graphic/UnoGraphicProvider.cxx |    5 +----
 xmlsecurity/workben/pdfverify.cxx         |    3 +--
 5 files changed, 16 insertions(+), 30 deletions(-)

New commits:
commit 1c25d22bfa072eb78da8930a3877f37a70ff707b
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Wed May 18 21:52:52 2022 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Thu May 19 10:55:06 2022 +0200

    Simplify an "ImportGraphic" method by removing useless pExtHeader 
(WmfExternal)
    
    Change-Id: I2916610e08c3157e0438ec90592fb5b8f921cc24
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134574
    Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl>
    Tested-by: Jenkins

diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index f1568680660c..0e0351dc4d50 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -314,8 +314,7 @@ public:
     ErrCode             ImportGraphic( Graphic& rGraphic, std::u16string_view 
rPath,
                                    SvStream& rStream,
                                    sal_uInt16 nFormat = 
GRFILTER_FORMAT_DONTKNOW,
-                                   sal_uInt16 * pDeterminedFormat = nullptr, 
GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE,
-                                   WmfExternal const *pExtHeader = nullptr );
+                                   sal_uInt16 * pDeterminedFormat = nullptr, 
GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE );
 
     /// Imports multiple graphics.
     ///
@@ -353,10 +352,9 @@ public:
     static ErrCode readXBM(SvStream & rStream, Graphic & rGraphic);
     static ErrCode readXPM(SvStream & rStream, Graphic & rGraphic);
 
-    static ErrCode readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType,
-                        WmfExternal const* pExtHeader, VectorGraphicDataType 
eType);
-    static ErrCode readWMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType, WmfExternal const* pExtHeader);
-    static ErrCode readEMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType, WmfExternal const* pExtHeader);
+    static ErrCode readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, VectorGraphicDataType eType);
+    static ErrCode readWMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType);
+    static ErrCode readEMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType);
 
     static ErrCode readPDF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType);
     static ErrCode readTIFF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType);
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index da436ed634f2..d208c7d81e72 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1149,8 +1149,7 @@ ErrCode GraphicFilter::readXPM(SvStream & rStream, 
Graphic & rGraphic)
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
-ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType,
-                                   WmfExternal const *pExtHeader, 
VectorGraphicDataType eType)
+ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, VectorGraphicDataType eType)
 {
     // use new UNO API service, do not directly import but create a
     // Graphic that contains the original data and decomposes to
@@ -1181,11 +1180,6 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, 
Graphic & rGraphic, GfxLi
 
         auto aVectorGraphicDataPtr = 
std::make_shared<VectorGraphicData>(aDataContainer, aDataType);
 
-        if (pExtHeader)
-        {
-            aVectorGraphicDataPtr->setWmfExternalHeader(*pExtHeader);
-        }
-
         rGraphic = Graphic(aVectorGraphicDataPtr);
         rLinkType = GfxLinkType::NativeWmf;
         aReturnCode = ERRCODE_NONE;
@@ -1194,14 +1188,14 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, 
Graphic & rGraphic, GfxLi
     return aReturnCode;
 }
 
-ErrCode GraphicFilter::readWMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, WmfExternal const* pExtHeader)
+ErrCode GraphicFilter::readWMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType)
 {
-    return readWMF_EMF(rStream, rGraphic, rLinkType, pExtHeader, 
VectorGraphicDataType::Wmf);
+    return readWMF_EMF(rStream, rGraphic, 
rLinkType,VectorGraphicDataType::Wmf);
 }
 
-ErrCode GraphicFilter::readEMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, WmfExternal const* pExtHeader)
+ErrCode GraphicFilter::readEMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType)
 {
-    return readWMF_EMF(rStream, rGraphic, rLinkType, pExtHeader, 
VectorGraphicDataType::Emf);
+    return readWMF_EMF(rStream, rGraphic, rLinkType, 
VectorGraphicDataType::Emf);
 }
 
 ErrCode GraphicFilter::readPDF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType)
@@ -1363,9 +1357,8 @@ ErrCode GraphicFilter::readWEBP(SvStream & rStream, 
Graphic & rGraphic, GfxLinkT
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
-ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, std::u16string_view 
rPath, SvStream& rIStream,
-                                     sal_uInt16 nFormat, sal_uInt16* 
pDeterminedFormat, GraphicFilterImportFlags nImportFlags,
-                                     WmfExternal const *pExtHeader )
+ErrCode GraphicFilter::ImportGraphic(Graphic& rGraphic, std::u16string_view 
rPath, SvStream& rIStream,
+                                     sal_uInt16 nFormat, sal_uInt16* 
pDeterminedFormat, GraphicFilterImportFlags nImportFlags)
 {
     OUString aFilterName;
     sal_uInt64 nStreamBegin;
@@ -1458,11 +1451,11 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& 
rGraphic, std::u16string_view rPa
         }
         else if (aFilterName.equalsIgnoreAsciiCase(IMP_WMF))
         {
-            nStatus = readWMF(rIStream, rGraphic, eLinkType, pExtHeader);
+            nStatus = readWMF(rIStream, rGraphic, eLinkType);
         }
         else if (aFilterName.equalsIgnoreAsciiCase(IMP_EMF))
         {
-            nStatus = readEMF(rIStream, rGraphic, eLinkType, pExtHeader);
+            nStatus = readEMF(rIStream, rGraphic, eLinkType);
         }
         else if (aFilterName.equalsIgnoreAsciiCase(IMP_PDF))
         {
diff --git a/vcl/source/graphic/GraphicLoader.cxx 
b/vcl/source/graphic/GraphicLoader.cxx
index 5c8ccc87d26c..63d35efb688a 100644
--- a/vcl/source/graphic/GraphicLoader.cxx
+++ b/vcl/source/graphic/GraphicLoader.cxx
@@ -32,8 +32,7 @@ Graphic loadFromURL(OUString const& rURL, weld::Window* 
pParentWin)
 
         ErrCode nError
             = rFilter.ImportGraphic(aGraphic, rURL, *pInputStream, 
GRFILTER_FORMAT_DONTKNOW,
-                                    nullptr, GraphicFilterImportFlags::NONE,
-                                    /*pExtHeader*/ static_cast<WmfExternal 
const*>(nullptr));
+                                    nullptr, GraphicFilterImportFlags::NONE);
         if (nError != ERRCODE_NONE || aGraphic.GetType() == GraphicType::NONE)
             return Graphic();
     }
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index 540433d63460..cab6659ce010 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -401,10 +401,8 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL 
GraphicProvider::queryGraphic( co
             aExtHeader.xExt = nExtWidth;
             aExtHeader.yExt = nExtHeight;
             aExtHeader.mapMode = nExtMapMode;
-            WmfExternal *pExtHeader = nullptr;
             if ( nExtMapMode > 0 )
             {
-                pExtHeader = &aExtHeader;
                 bLazyRead = false;
             }
 
@@ -416,8 +414,7 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL 
GraphicProvider::queryGraphic( co
                     aVCLGraphic = aGraphic;
             }
             if (aVCLGraphic.IsNone())
-                error = rFilter.ImportGraphic(aVCLGraphic, aPath, *pIStm, 
GRFILTER_FORMAT_DONTKNOW,
-                                              nullptr, 
GraphicFilterImportFlags::NONE, pExtHeader);
+                error = rFilter.ImportGraphic(aVCLGraphic, aPath, *pIStm, 
GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE);
 
             if( (error == ERRCODE_NONE ) &&
                 ( aVCLGraphic.GetType() != GraphicType::NONE ) )
diff --git a/xmlsecurity/workben/pdfverify.cxx 
b/xmlsecurity/workben/pdfverify.cxx
index 6a68da04a1a1..f04db1fa62cf 100644
--- a/xmlsecurity/workben/pdfverify.cxx
+++ b/xmlsecurity/workben/pdfverify.cxx
@@ -41,9 +41,8 @@ void generatePreview(std::string_view rPdfPath, 
std::string_view rPngPath)
     OUString aInURL;
     osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(rPdfPath), 
aInURL);
     SvFileStream aInStream(aInURL, StreamMode::READ);
-    WmfExternal* pExtHeader = nullptr;
     if (rFilter.ImportGraphic(aGraphic, u"", aInStream, 
GRFILTER_FORMAT_DONTKNOW, nullptr,
-                              GraphicFilterImportFlags::NONE, pExtHeader)
+                              GraphicFilterImportFlags::NONE)
         != ERRCODE_NONE)
         return;
 

Reply via email to