diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-07-04 11:57:27 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-07-04 13:03:00 +0200 |
commit | b90733fceb9d831a2c796f8ce6b3fffc309f4153 (patch) | |
tree | 1c27fc9b2e0d80637f72a0ad8904c348481b710a /vcl | |
parent | 6c5063da1dc6ba4b6b4cd9a82d7c54b053cdfb38 (diff) |
vcl lok: pre-load graphic libraries
This is needed to be able to load e.g. TIFF files in Online, which does
not have code in the chroot since online.git commit
ad21717498cc214d5d5d5c0ff378238552137e2f (Avoid copying most code into
the chroot jail., 2018-03-10).
Conflicts:
vcl/source/filter/graphicfilter.cxx
Change-Id: Ib095191ee690d9da6269878a82b1c6995df50dfa
Reviewed-on: https://gerrit.libreoffice.org/75078
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index bef80fb94b24..7448826a8a33 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -66,6 +66,8 @@ #include <rtl/bootstrap.hxx> #include <rtl/instance.hxx> #include <vcl/metaact.hxx> +#include <tools/svlibrary.h> +#include <comphelper/string.hxx> #include <vector> #include <memory> @@ -1441,6 +1443,30 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra } } +void GraphicFilter::preload() +{ + sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFilterPath, ';'); + ImpFilterLibCache& rCache = Cache::get(); + static const std::initializer_list<OUStringLiteral> aFilterNames = { + "icd", "idx", "ime", "ipb", "ipd", "ips", "ipt", "ipx", "ira", "itg", "iti", + }; + + // Load library for each filter. + for (const auto& rFilterName : aFilterNames) + { + ImpFilterLibCacheEntry* pFilter = nullptr; + // Look at the library in each element inside the filter path. + for (sal_Int32 i = 0; i < nTokenCount; ++i) + { + pFilter = rCache.GetFilter(aFilterPath.getToken(i, ';'), SVLIBRARY("gie"), rFilterName); + if (pFilter) + { + break; + } + } + } +} + 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, |