From 1e9f63fd0d6e8c4e5c92c1379a3792bc09ade97a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 28 Oct 2020 15:11:36 +0000 Subject: tdf#137643 alternative solution to activate embedded fonts in one batch Change-Id: Ib5ffb2b8a31f237d5d2e465bf3f777590e0bfade Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104957 Tested-by: Jenkins Reviewed-by: Michael Stahl --- xmloff/source/core/xmlimp.cxx | 10 ++++++++++ xmloff/source/style/XMLFontStylesContext.cxx | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 1e77eca85928..0c9e9d06cfd4 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -444,6 +445,15 @@ SvXMLImport::~SvXMLImport() throw () cleanup(); } +bool SvXMLImport::addEmbeddedFont(const css::uno::Reference< css::io::XInputStream >& stream, + const OUString& fontName, const char* extra, + std::vector key, bool eot) +{ + if (!mxEmbeddedFontHelper) + mxEmbeddedFontHelper.reset(new EmbeddedFontsHelper); + return mxEmbeddedFontHelper->addEmbeddedFont(stream, fontName, extra, key, eot); +} + namespace { class theSvXMLImportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvXMLImportUnoTunnelId> {}; diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx index ad706d987c96..eb3ed7b45666 100644 --- a/xmloff/source/style/XMLFontStylesContext.cxx +++ b/xmloff/source/style/XMLFontStylesContext.cxx @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -326,7 +325,7 @@ void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const OUString& url, bo uno::Reference< io::XInputStream > inputStream; inputStream.set( storage->openStreamElement( url.copy( url.indexOf( '/' ) + 1 ), ::embed::ElementModes::READ ), UNO_QUERY_THROW ); - if( EmbeddedFontsHelper::addEmbeddedFont( inputStream, fontName, "?", std::vector< unsigned char >(), eot )) + if (GetImport().addEmbeddedFont(inputStream, fontName, "?", std::vector< unsigned char >(), eot)) GetImport().NotifyEmbeddedFontRead(); inputStream->closeInput(); } @@ -338,7 +337,7 @@ void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const ::css::uno::Seque { const uno::Reference< io::XInputStream > xInput( new comphelper::SequenceInputStream( rData ) ); const OUString fontName = font.familyName(); - if( EmbeddedFontsHelper::addEmbeddedFont( xInput, fontName, "?", std::vector< unsigned char >(), eot ) ) + if (GetImport().addEmbeddedFont(xInput, fontName, "?", std::vector< unsigned char >(), eot)) GetImport().NotifyEmbeddedFontRead(); xInput->closeInput(); } -- cgit