LO question about ImportGraphic and pExtHeader for EMF/WMF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Armin, Bartosz

Taking a look at ImportGraphic methods, I noticed one could be removed (see https://gerrit.libreoffice.org/c/core/+/134503).

Then I noticed this method in vcl/source/filter/graphicfilter.cxx:

78  ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, std::u16string_view rPath, SvStream& rIStream, 1379                                       sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, GraphicFilterImportFlags nImportFlags, 1380                                       const css::uno::Sequence< css::beans::PropertyValue >* /*pFilterData*/,
1381                                       WmfExternal const *pExtHeader )

(see https://opengrok.libreoffice.org/xref/core/vcl/source/filter/graphicfilter.cxx?r=52dfeeb6#1378)

Default value for "pExtHeader" is nullptr in include/vcl/graphicfilter.hxx

    314     ErrCode             ImportGraphic( Graphic& rGraphic, std::u16string_view rPath,
    315                                    SvStream& rStream,
    316                                    sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW,     317                                    sal_uInt16 * pDeterminedFormat = nullptr, GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE,     318                                    WmfExternal const *pExtHeader = nullptr );

(see https://opengrok.libreoffice.org/xref/core/include/vcl/graphicfilter.hxx?r=d3849255#314)


"pExtHeader" has been added in 783269e91e2166357a9fb095e64a1d48e6f0601a "emfplus: completed isolation/migration of Emf/Wmf" (in June 2017)

and is only used for "readEMF" and "readWMF" methods which both call GraphicFilter::readWMF_EMF (see https://opengrok.libreoffice.org/xref/core/vcl/source/filter/graphicfilter.cxx?r=52dfeeb6#1164).

This last one uses pExtHeader here:

1196          if (pExtHeader)
1197          {
1198 aVectorGraphicDataPtr->setWmfExternalHeader(*pExtHeader);
1199          }


But when git grepping ImportGraphic in all LO code, "pExtHeader" was never defined and passed to "ImportGraphic" except in xmlsecurity/workben/pdfverify.cxx

     44     WmfExternal* pExtHeader = nullptr;
     45     if (rFilter.ImportGraphic(aGraphic, u"", aInStream, GRFILTER_FORMAT_DONTKNOW, nullptr,
     46 GraphicFilterImportFlags::NONE, pExtHeader)
     47         != ERRCODE_NONE)
     48         return;

(see https://opengrok.libreoffice.org/xref/core/xmlsecurity/workben/pdfverify.cxx?r=d3849255&mo=1042&fi=37#37)

so "setWmfExternalHeader" is never called and all "pExtHeader" parameter in each of the quoted methods seems useless.


Did I miss something? If no, can we remove this "pExtHeader" parameter and clean the related code or is it some basis to implement in the future a feature in EMF/WMF ?

Regards,

Julien




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux