diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-28 15:11:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-29 10:14:16 +0100 |
commit | 388735924392027eb6a8e722083e6496b92a40fa (patch) | |
tree | 112aaf7591c9fef82d3415fe8e16c0263a1a2383 /xmloff | |
parent | e58592414da353aaef9432277d7155fc0c0f0213 (diff) |
tdf#137643 alternative solution to activate embedded fonts in one batch
Change-Id: Ib5ffb2b8a31f237d5d2e465bf3f777590e0bfade
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104947
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/style/XMLFontStylesContext.cxx | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 5a6bddd4192a..dbb02f0fe29a 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -23,6 +23,7 @@ #include <sal/log.hxx> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <tools/urlobj.hxx> +#include <vcl/embeddedfontshelper.hxx> #include <vcl/graph.hxx> #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> #include <xmloff/namespacemap.hxx> @@ -451,6 +452,15 @@ SvXMLImport::~SvXMLImport() throw () cleanup(); } +bool SvXMLImport::addEmbeddedFont(const css::uno::Reference< css::io::XInputStream >& stream, + const OUString& fontName, const char* extra, + std::vector<unsigned char> 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 f8e3184740dd..8f4019985beb 100644 --- a/xmloff/source/style/XMLFontStylesContext.cxx +++ b/xmloff/source/style/XMLFontStylesContext.cxx @@ -28,7 +28,6 @@ #include <comphelper/seqstream.hxx> #include <sal/log.hxx> -#include <vcl/embeddedfontshelper.hxx> #include <xmloff/xmlnamespace.hxx> #include <xmloff/xmltoken.hxx> @@ -327,7 +326,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(); } @@ -339,7 +338,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(); } |