summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-07-06 12:45:31 +0200
committerTomaž Vajngerl <quikee@gmail.com>2018-07-10 16:14:59 +0200
commiteb6ff07605a55675e7007ac0cb5604fb13a9ddf9 (patch)
tree6d5899b5aa7befa5d0c87e78ae8e5cd1e803f7bb /xmloff
parent76b4820076eb24a4f3e5c8583c117cbf09fb8a8a (diff)
[API CHANGE] tdf#65353 Add more doc. settings more embedding fonts
- Add setting to embed used fonts only - Add setting for filtering of Latin, Asian, Complex script fonts Change-Id: I8d093ed05fdcef3715616c008f6eeaa8cfbcc850 Reviewed-on: https://gerrit.libreoffice.org/57167 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx30
-rw-r--r--xmloff/source/style/XMLFontAutoStylePool.cxx6
2 files changed, 26 insertions, 10 deletions
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 36c8ca93f117..859a8aea8c2e 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2694,26 +2694,38 @@ SERVICE( XMLImpressClipboardExport, "com.sun.star.comp.Impress.XMLClipboardExpor
XMLFontAutoStylePool* SdXMLExport::CreateFontAutoStylePool()
{
bool bEmbedFonts = false;
+ bool bEmbedUsedOnly = false;
+ bool bEmbedLatinScript = true;
+ bool bEmbedAsianScript = true;
+ bool bEmbedComplexScript = true;
+
if (getExportFlags() & SvXMLExportFlags::CONTENT)
{
Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
if( xFac.is() )
{
- try
- {
- Reference<beans::XPropertySet> const xProps( xFac->createInstance(
- "com.sun.star.document.Settings"), UNO_QUERY_THROW );
- xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts;
- }
- catch (...)
+ Reference<beans::XPropertySet> const xProps(xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY);
+ Reference<beans::XPropertySetInfo> const xInfo(xProps->getPropertySetInfo(), uno::UNO_QUERY);
+
+ if (xProps.is() && xInfo.is())
{
- // clipboard document doesn't have shell so throws from getPropertyValue
- // gallery elements may not support com.sun.star.document.Settings so throws from createInstance
+ if (xInfo->hasPropertyByName("EmbedFonts"))
+ xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts;
+ if (xInfo->hasPropertyByName("EmbedOnlyUsedFonts"))
+ xProps->getPropertyValue("EmbedOnlyUsedFonts") >>= bEmbedUsedOnly;
+ if (xInfo->hasPropertyByName("EmbedLatinScriptFonts"))
+ xProps->getPropertyValue("EmbedLatinScriptFonts") >>= bEmbedLatinScript;
+ if (xInfo->hasPropertyByName("EmbedAsianScriptFonts"))
+ xProps->getPropertyValue("EmbedAsianScriptFonts") >>= bEmbedAsianScript;
+ if (xInfo->hasPropertyByName("EmbedComplexScriptFonts"))
+ xProps->getPropertyValue("EmbedComplexScriptFonts") >>= bEmbedComplexScript;
}
}
}
XMLFontAutoStylePool *pPool = new XMLFontAutoStylePool( *this, bEmbedFonts );
+ pPool->setEmbedOnlyUsedFonts(bEmbedUsedOnly);
+ pPool->setEmbedFontScripts(bEmbedLatinScript, bEmbedAsianScript, bEmbedComplexScript);
Reference< beans::XPropertySet > xProps( GetModel(), UNO_QUERY );
if ( xProps.is() ) {
diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx
index 1fb06598f841..c410624ee9ce 100644
--- a/xmloff/source/style/XMLFontAutoStylePool.cxx
+++ b/xmloff/source/style/XMLFontAutoStylePool.cxx
@@ -141,7 +141,11 @@ public:
XMLFontAutoStylePool::XMLFontAutoStylePool(SvXMLExport& rExp, bool bTryToEmbedFonts) :
rExport( rExp ),
m_pFontAutoStylePool( new XMLFontAutoStylePool_Impl ),
- m_bTryToEmbedFonts( bTryToEmbedFonts )
+ m_bTryToEmbedFonts( bTryToEmbedFonts ),
+ m_bEmbedUsedOnly(false),
+ m_bEmbedLatinScript(true),
+ m_bEmbedAsianScript(true),
+ m_bEmbedComplexScript(true)
{
}