summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-28 15:11:36 +0000
committerMichael Stahl <michael.stahl@cib.de>2020-10-30 13:40:52 +0100
commit1e9f63fd0d6e8c4e5c92c1379a3792bc09ade97a (patch)
tree4c8c97bdfbea4c8e10782f0458b786532629f093 /xmloff
parent3b92dc64024a6bd4c750dfdc460e9bacf0408b00 (diff)
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 <michael.stahl@cib.de>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmlimp.cxx10
-rw-r--r--xmloff/source/style/XMLFontStylesContext.cxx5
2 files changed, 12 insertions, 3 deletions
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 <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/nmspmap.hxx>
@@ -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<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 ad706d987c96..eb3ed7b45666 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/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
@@ -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();
}