diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-07-06 12:45:31 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-07-10 16:14:59 +0200 |
commit | eb6ff07605a55675e7007ac0cb5604fb13a9ddf9 (patch) | |
tree | 6d5899b5aa7befa5d0c87e78ae8e5cd1e803f7bb /xmloff/source/draw/sdxmlexp.cxx | |
parent | 76b4820076eb24a4f3e5c8583c117cbf09fb8a8a (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/source/draw/sdxmlexp.cxx')
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 30 |
1 files changed, 21 insertions, 9 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() ) { |