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 | |
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>
22 files changed, 495 insertions, 65 deletions
diff --git a/include/xmloff/XMLFontAutoStylePool.hxx b/include/xmloff/XMLFontAutoStylePool.hxx index 530d05b2762a..3380fc96d532 100644 --- a/include/xmloff/XMLFontAutoStylePool.hxx +++ b/include/xmloff/XMLFontAutoStylePool.hxx @@ -45,6 +45,10 @@ private: OUString embedFontFile(OUString const & rFileUrl, OUString const & rFamilyName); protected: + bool m_bEmbedUsedOnly; + bool m_bEmbedLatinScript; + bool m_bEmbedAsianScript; + bool m_bEmbedComplexScript; SvXMLExport& GetExport() { return rExport; } @@ -68,6 +72,17 @@ public: rtl_TextEncoding eEnc )const; void exportXML(); + + void setEmbedOnlyUsedFonts(bool bEmbedUsedOnly) + { + m_bEmbedUsedOnly = bEmbedUsedOnly; + } + void setEmbedFontScripts(bool bEmbedLatinScript, bool bEmbedAsianScript, bool bEmbedComplexScript) + { + m_bEmbedLatinScript = bEmbedLatinScript; + m_bEmbedAsianScript = bEmbedAsianScript; + m_bEmbedComplexScript = bEmbedComplexScript; + } }; #endif // INCLUDED_XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX diff --git a/offapi/com/sun/star/document/Settings.idl b/offapi/com/sun/star/document/Settings.idl index 9d4fa929a4c4..d9c8164fe306 100644 --- a/offapi/com/sun/star/document/Settings.idl +++ b/offapi/com/sun/star/document/Settings.idl @@ -260,6 +260,29 @@ published service Settings */ [optional, property] boolean EmbedSystemFonts; + /** Whether to embed only the fonts that are used in the document. + + @since LibreOffice 6.2 + */ + [optional, property] boolean EmbedOnlyUsedFonts; + + /** Whether to embed Latin script fonts. + + @since LibreOffice 6.2 + */ + [optional, property] short EmbedLatinScriptFonts; + + /** Whether to embed Asian script fonts. + + @since LibreOffice 6.2 + */ + [optional, property] short EmbedAsianScriptFonts; + + /** Whether to embed Complex script fonts. + + @since LibreOffice 6.2 + */ + [optional, property] short EmbedComplexScriptFonts; }; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 07e16a8388de..f2ee35bc693a 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -523,7 +523,12 @@ private: std::set<ScFormulaCell*> maSubTotalCells; - bool mbUseEmbedFonts; + + bool mbEmbedFonts : 1; + bool mbEmbedUsedFontsOnly : 1; + bool mbEmbedFontScriptLatin : 1; + bool mbEmbedFontScriptAsian : 1; + bool mbEmbedFontScriptComplex : 1; std::unique_ptr<sc::IconSetBitmapMap> m_pIconSetBitmapMap; @@ -535,8 +540,19 @@ private: public: bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBorder); void GetCellChangeTrackNote(const ScAddress &cell, OUString &strTrackText, bool &pbLeftEdge); - bool IsUsingEmbededFonts() { return mbUseEmbedFonts; } - void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; } + + bool IsEmbedFonts() { return mbEmbedFonts; } + bool IsEmbedUsedFontsOnly() { return mbEmbedUsedFontsOnly; } + bool IsEmbedFontScriptLatin() { return mbEmbedFontScriptLatin; } + bool IsEmbedFontScriptAsian() { return mbEmbedFontScriptAsian; } + bool IsEmbedFontScriptComplex() { return mbEmbedFontScriptComplex; } + + void SetEmbedFonts(bool bUse) { mbEmbedFonts = bUse; } + void SetEmbedUsedFontsOnly(bool bUse) { mbEmbedUsedFontsOnly = bUse; } + void SetEmbedFontScriptLatin(bool bUse) { mbEmbedFontScriptLatin = bUse; } + void SetEmbedFontScriptAsian(bool bUse) { mbEmbedFontScriptAsian = bUse; } + void SetEmbedFontScriptComplex(bool bUse) { mbEmbedFontScriptComplex = bUse; } + SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells SC_DLLPUBLIC sal_uLong GetFormulaGroupCount() const; // all cells sal_uLong GetCodeCount() const; // RPN-Code in formulas diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 07d2864ed4fd..d90c4a510a3a 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -691,7 +691,11 @@ // Named ranges #define SC_UNO_MODIFY_BROADCAST "ModifyAndBroadcast" -#define SC_UNO_EMBED_FONTS "EmbedFonts" +#define SC_UNO_EMBED_FONTS "EmbedFonts" +#define SC_UNO_EMBED_ONLY_USED_FONTS "EmbedOnlyUsedFonts" +#define SC_UNO_EMBED_FONT_SCRIPT_LATIN "EmbedLatinScriptFonts" +#define SC_UNO_EMBED_FONT_SCRIPT_ASIAN "EmbedAsianScriptFonts" +#define SC_UNO_EMBED_FONT_SCRIPT_COMPLEX "EmbedComplexScriptFonts" #define SC_UNO_ODS_LOCK_SOLAR_MUTEX "ODSLockSolarMutex" #define SC_UNO_ODS_IMPORT_STYLES "ODSImportStyles" diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 6db74263c27b..826f846279f2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -6521,7 +6521,11 @@ void Test::testEmptyCalcDocDefaults() CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasNotes() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsCutMode() ); - CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsUsingEmbededFonts() ); + CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsEmbedFonts() ); + CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsEmbedUsedFontsOnly() ); + CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsEmbedFontScriptLatin() ); + CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsEmbedFontScriptAsian() ); + CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsEmbedFontScriptComplex() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsEmbedded() ); CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsDocEditable() ); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 81ce2170d02d..b39d0866be24 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -221,7 +221,11 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : mbStreamValidLocked( false ), mbUserInteractionEnabled(true), mnNamedRangesLockCount(0), - mbUseEmbedFonts(false), + mbEmbedFonts(false), + mbEmbedUsedFontsOnly(false), + mbEmbedFontScriptLatin(true), + mbEmbedFontScriptAsian(true), + mbEmbedFontScriptComplex(true), mbTrackFormulasPending(false), mbFinalTrackFormulas(false), mnMutationGuardFlags(0) diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx index b8446e40606c..b4c7e7a8808c 100644 --- a/sc/source/filter/xml/xmlfonte.cxx +++ b/sc/source/filter/xml/xmlfonte.cxx @@ -39,7 +39,7 @@ private: void AddFontItems(const sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const bool bExportDefaults); public: - ScXMLFontAutoStylePool_Impl( ScXMLExport& rExport, bool bBlockFontEmbedding ); + ScXMLFontAutoStylePool_Impl( ScXMLExport& rExport, bool bEmbedFonts); virtual ~ScXMLFontAutoStylePool_Impl() override; }; @@ -70,8 +70,8 @@ void ScXMLFontAutoStylePool_Impl::AddFontItems(const sal_uInt16* pWhichIds, sal_ } } -ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP, bool bBlockFontEmbedding) - : XMLFontAutoStylePool(rExportP, bBlockFontEmbedding) +ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP, bool bEmbedFonts) + : XMLFontAutoStylePool(rExportP, bEmbedFonts) , mpEditEnginePool(nullptr) { sal_uInt16 const aWhichIds[] { ATTR_FONT, ATTR_CJK_FONT, @@ -88,6 +88,11 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP, std::shared_ptr<SfxStyleSheetIterator> pItr = rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Page, SfxStyleSearchBits::All); + m_bEmbedUsedOnly = rExportP.GetDocument()->IsEmbedUsedFontsOnly(); + m_bEmbedLatinScript = rExportP.GetDocument()->IsEmbedFontScriptLatin(); + m_bEmbedAsianScript = rExportP.GetDocument()->IsEmbedFontScriptAsian(); + m_bEmbedComplexScript = rExportP.GetDocument()->IsEmbedFontScriptComplex(); + if(pItr) { SfxStyleSheetBase* pStyle(pItr->First()); @@ -157,7 +162,7 @@ XMLFontAutoStylePool* ScXMLExport::CreateFontAutoStylePool() // the embedding only in one of them. if(!( getExportFlags() & SvXMLExportFlags::CONTENT )) blockFontEmbedding = true; - if( !GetDocument()->IsUsingEmbededFonts()) + if (!GetDocument()->IsEmbedFonts()) blockFontEmbedding = true; return new ScXMLFontAutoStylePool_Impl( *this, !blockFontEmbedding ); } diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 36f3c3f8baa9..20ba58d3c216 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2012,8 +2012,8 @@ const ScXMLEditAttributeMap& ScXMLImport::GetEditAttributeMap() const void ScXMLImport::NotifyEmbeddedFontRead() { - if ( pDoc ) - pDoc->SetIsUsingEmbededFonts( true ); + if (pDoc) + pDoc->SetEmbedFonts(true); } ScMyImpDetectiveOpArray* ScXMLImport::GetDetectiveOpArray() diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 9e3ae551e22c..a7d6599aef6c 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -84,7 +84,11 @@ static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap() {OUString(SC_UNO_LOADREADONLY), 0, cppu::UnoType<bool>::get(), 0, 0}, {OUString(SC_UNO_SHAREDOC), 0, cppu::UnoType<bool>::get(), 0, 0}, {OUString(SC_UNO_MODIFYPASSWORDINFO), 0, cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get(), 0, 0}, - {OUString(SC_UNO_EMBED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0}, + {OUString(SC_UNO_EMBED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0}, + {OUString(SC_UNO_EMBED_ONLY_USED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0}, + {OUString(SC_UNO_EMBED_FONT_SCRIPT_LATIN), 0, cppu::UnoType<bool>::get(), 0, 0}, + {OUString(SC_UNO_EMBED_FONT_SCRIPT_ASIAN), 0, cppu::UnoType<bool>::get(), 0, 0}, + {OUString(SC_UNO_EMBED_FONT_SCRIPT_COMPLEX), 0, cppu::UnoType<bool>::get(), 0, 0}, {OUString(SC_UNO_SYNTAXSTRINGREF), 0, cppu::UnoType<sal_Int16>::get(), 0, 0}, { OUString(), 0, css::uno::Type(), 0, 0 } }; @@ -337,13 +341,30 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( throw beans::PropertyVetoException( "The hash is not allowed to be changed now!" ); } - else if ( aPropertyName == SC_UNO_EMBED_FONTS ) + else if (aPropertyName == SC_UNO_EMBED_FONTS) { - bool bVal = false; - if ( aValue >>=bVal ) - { - rDoc.SetIsUsingEmbededFonts(bVal); - } + bool bVal = aValue.has<bool>() && aValue.get<bool>(); + rDoc.SetEmbedFonts(bVal); + } + else if (aPropertyName == SC_UNO_EMBED_ONLY_USED_FONTS) + { + bool bVal = aValue.has<bool>() && aValue.get<bool>(); + rDoc.SetEmbedUsedFontsOnly(bVal); + } + else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_LATIN) + { + bool bVal = aValue.has<bool>() && aValue.get<bool>(); + rDoc.SetEmbedFontScriptLatin(bVal); + } + else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_ASIAN) + { + bool bVal = aValue.has<bool>() && aValue.get<bool>(); + rDoc.SetEmbedFontScriptAsian(bVal); + } + else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_COMPLEX) + { + bool bVal = aValue.has<bool>() && aValue.get<bool>(); + rDoc.SetEmbedFontScriptComplex(bVal); } else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF ) { @@ -524,10 +545,16 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr } else if ( aPropertyName == SC_UNO_MODIFYPASSWORDINFO ) aRet <<= pDocShell->GetModifyPasswordInfo(); - else if ( aPropertyName == SC_UNO_EMBED_FONTS ) - { - aRet <<= rDoc.IsUsingEmbededFonts(); - } + else if (aPropertyName == SC_UNO_EMBED_FONTS) + aRet <<= rDoc.IsEmbedFonts(); + else if (aPropertyName == SC_UNO_EMBED_ONLY_USED_FONTS) + aRet <<= rDoc.IsEmbedUsedFontsOnly(); + else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_LATIN) + aRet <<= rDoc.IsEmbedFontScriptLatin(); + else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_ASIAN) + aRet <<= rDoc.IsEmbedFontScriptAsian(); + else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_COMPLEX) + aRet <<= rDoc.IsEmbedFontScriptComplex(); else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF ) { ScCalcConfig aCalcConfig = rDoc.GetCalcConfig(); diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index e576aa749eaa..23d7fbadff42 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -196,7 +196,12 @@ private: std::vector<css::uno::Reference< css::xml::dom::XNode> > maPresObjectInfo; - bool mbUseEmbedFonts; + bool mbEmbedFonts : 1; + bool mbEmbedUsedFontsOnly : 1; + bool mbEmbedFontScriptLatin : 1; + bool mbEmbedFontScriptAsian : 1; + bool mbEmbedFontScriptComplex : 1; + protected: SAL_DLLPRIVATE virtual css::uno::Reference< css::uno::XInterface > createUnoModel() override; @@ -618,8 +623,17 @@ public: SAL_DLLPRIVATE sal_uInt16 GetAnnotationAuthorIndex( const OUString& rAuthor ); - SAL_DLLPRIVATE bool IsUsingEmbededFonts() { return mbUseEmbedFonts; } - SAL_DLLPRIVATE void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; } + SAL_DLLPRIVATE bool IsEmbedFonts() { return mbEmbedFonts; } + SAL_DLLPRIVATE bool IsEmbedUsedFontsOnly() { return mbEmbedUsedFontsOnly; } + SAL_DLLPRIVATE bool IsEmbedFontScriptLatin() { return mbEmbedFontScriptLatin; } + SAL_DLLPRIVATE bool IsEmbedFontScriptAsian() { return mbEmbedFontScriptAsian; } + SAL_DLLPRIVATE bool IsEmbedFontScriptComplex() { return mbEmbedFontScriptComplex; } + + SAL_DLLPRIVATE void SetEmbedFonts(bool bUse) { mbEmbedFonts = bUse; } + SAL_DLLPRIVATE void SetEmbedUsedFontsOnly(bool bUse) { mbEmbedUsedFontsOnly = bUse; } + SAL_DLLPRIVATE void SetEmbedFontScriptLatin(bool bUse) { mbEmbedFontScriptLatin = bUse; } + SAL_DLLPRIVATE void SetEmbedFontScriptAsian(bool bUse) { mbEmbedFontScriptAsian = bUse; } + SAL_DLLPRIVATE void SetEmbedFontScriptComplex(bool bUse) { mbEmbedFontScriptComplex = bUse; } void dumpAsXml(struct _xmlTextWriter* pWriter) const override; diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index c91d842a1374..dcd73dde1994 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -156,7 +156,11 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) , mbAllocDocSh(false) , meDocType(eType) , mpCharClass(nullptr) -, mbUseEmbedFonts(false) +, mbEmbedFonts(false) +, mbEmbedUsedFontsOnly(false) +, mbEmbedFontScriptLatin(true) +, mbEmbedFontScriptAsian(true) +, mbEmbedFontScriptComplex(true) { mpDrawPageListWatcher.reset(new ImpDrawPageListWatcher(*this)); mpMasterPageListWatcher.reset(new ImpMasterPageListWatcher(*this)); diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index c2ef28948604..31c8afae0a8d 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -141,7 +141,9 @@ enum SdDocumentSettingsPropertyHandles HANDLE_UPDATEFROMTEMPLATE, HANDLE_PRINTER_INDEPENDENT_LAYOUT // #i33095# ,HANDLE_LOAD_READONLY, HANDLE_MODIFY_PASSWD, HANDLE_SAVE_VERSION - ,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL, HANDLE_EMBED_FONTS + ,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL, + HANDLE_EMBED_FONTS, HANDLE_EMBED_USED_FONTS, + HANDLE_EMBED_LATIN_SCRIPT_FONTS, HANDLE_EMBED_ASIAN_SCRIPT_FONTS, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, }; #define MID_PRINTER 1 @@ -205,7 +207,11 @@ enum SdDocumentSettingsPropertyHandles { OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0, 0 }, { OUString("ModifyPasswordInfo"), HANDLE_MODIFY_PASSWD, cppu::UnoType<uno::Sequence < beans::PropertyValue >>::get(), 0, 0 }, { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION, cppu::UnoType<bool>::get(), 0, 0 }, - { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, + { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, + { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, + { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, + { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, + { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, { OUString(), 0, css::uno::Type(), 0, 0 } }; @@ -960,11 +966,59 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries, case HANDLE_EMBED_FONTS: { - bool bNewValue = false; - if ( *pValues >>= bNewValue ) + if (pValues->has<bool>()) + { + bool bNewValue = pValues->get<bool>(); + bChanged = (pDoc->IsEmbedFonts() != bNewValue); + pDoc->SetEmbedFonts(bNewValue); + bOk = true; + } + } + break; + + case HANDLE_EMBED_USED_FONTS: + { + if (pValues->has<bool>()) + { + bool bNewValue = pValues->get<bool>(); + bChanged = (pDoc->IsEmbedUsedFontsOnly() != bNewValue); + pDoc->SetEmbedUsedFontsOnly(bNewValue); + bOk = true; + } + } + break; + + case HANDLE_EMBED_LATIN_SCRIPT_FONTS: + { + if (pValues->has<bool>()) + { + bool bNewValue = pValues->get<bool>(); + bChanged = (pDoc->IsEmbedFontScriptLatin() != bNewValue); + pDoc->SetEmbedFontScriptLatin(bNewValue); + bOk = true; + } + } + break; + + case HANDLE_EMBED_ASIAN_SCRIPT_FONTS: + { + if (pValues->has<bool>()) { - bChanged = ( pDoc->IsUsingEmbededFonts() != bNewValue ); - pDoc->SetIsUsingEmbededFonts( bNewValue ); + bool bNewValue = pValues->get<bool>(); + bChanged = (pDoc->IsEmbedFontScriptAsian() != bNewValue); + pDoc->SetEmbedFontScriptAsian(bNewValue); + bOk = true; + } + } + break; + + case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS: + { + if (pValues->has<bool>()) + { + bool bNewValue = pValues->get<bool>(); + bChanged = (pDoc->IsEmbedFontScriptComplex() != bNewValue); + pDoc->SetEmbedFontScriptComplex(bNewValue); bOk = true; } } @@ -1220,7 +1274,31 @@ DocumentSettings::_getPropertyValues( case HANDLE_EMBED_FONTS: { - *pValue <<= pDoc->IsUsingEmbededFonts(); + *pValue <<= pDoc->IsEmbedFonts(); + } + break; + + case HANDLE_EMBED_USED_FONTS: + { + *pValue <<= pDoc->IsEmbedUsedFontsOnly(); + } + break; + + case HANDLE_EMBED_LATIN_SCRIPT_FONTS: + { + *pValue <<= pDoc->IsEmbedFontScriptLatin(); + } + break; + + case HANDLE_EMBED_ASIAN_SCRIPT_FONTS: + { + *pValue <<= pDoc->IsEmbedFontScriptAsian(); + } + break; + + case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS: + { + *pValue <<= pDoc->IsEmbedFontScriptComplex(); } break; diff --git a/sfx2/source/dialog/documentfontsdialog.cxx b/sfx2/source/dialog/documentfontsdialog.cxx index 7e5e7f51c6e9..3896f624fa49 100644 --- a/sfx2/source/dialog/documentfontsdialog.cxx +++ b/sfx2/source/dialog/documentfontsdialog.cxx @@ -31,6 +31,10 @@ VclPtr<SfxTabPage> SfxDocumentFontsPage::Create(TabPageParent pParent, const Sfx SfxDocumentFontsPage::SfxDocumentFontsPage(TabPageParent parent, const SfxItemSet& set) : SfxTabPage(parent, "sfx/ui/documentfontspage.ui", "DocumentFontsPage", &set) , embedFontsCheckbox(m_xBuilder->weld_check_button("embedFonts")) + , embedUsedFontsCheckbox(m_xBuilder->weld_check_button("embedUsedFonts")) + , embedLatinScriptFontsCheckbox(m_xBuilder->weld_check_button("embedLatinScriptFonts")) + , embedAsianScriptFontsCheckbox(m_xBuilder->weld_check_button("embedAsianScriptFonts")) + , embedComplexScriptFontsCheckbox(m_xBuilder->weld_check_button("embedComplexScriptFonts")) { } @@ -40,26 +44,48 @@ SfxDocumentFontsPage::~SfxDocumentFontsPage() void SfxDocumentFontsPage::Reset( const SfxItemSet* ) { - bool bVal = false; + bool bEmbedFonts = false; + bool bEmbedUsedFonts = false; + + bool bEmbedLatinScriptFonts = false; + bool bEmbedAsianScriptFonts = false; + bool bEmbedComplexScriptFonts = false; + SfxObjectShell* pDocSh = SfxObjectShell::Current(); - if ( pDocSh ) + if (pDocSh) { try { uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY_THROW ); - xProps->getPropertyValue("EmbedFonts") >>= bVal; + + xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts; + xProps->getPropertyValue("EmbedOnlyUsedFonts") >>= bEmbedUsedFonts; + xProps->getPropertyValue("EmbedLatinScriptFonts") >>= bEmbedLatinScriptFonts; + xProps->getPropertyValue("EmbedAsianScriptFonts") >>= bEmbedAsianScriptFonts; + xProps->getPropertyValue("EmbedComplexScriptFonts") >>= bEmbedComplexScriptFonts; } catch( uno::Exception& ) { } } - embedFontsCheckbox->set_active(bVal); + embedFontsCheckbox->set_active(bEmbedFonts); + embedUsedFontsCheckbox->set_active(bEmbedUsedFonts); + + embedLatinScriptFontsCheckbox->set_active(bEmbedLatinScriptFonts); + embedAsianScriptFontsCheckbox->set_active(bEmbedAsianScriptFonts); + embedComplexScriptFontsCheckbox->set_active(bEmbedComplexScriptFonts); } bool SfxDocumentFontsPage::FillItemSet( SfxItemSet* ) { - bool bVal = embedFontsCheckbox->get_active(); + bool bEmbedFonts = embedFontsCheckbox->get_active(); + bool bEmbedUsedFonts = embedUsedFontsCheckbox->get_active(); + + bool bEmbedLatinScriptFonts = embedLatinScriptFontsCheckbox->get_active(); + bool bEmbedAsianScriptFonts = embedAsianScriptFontsCheckbox->get_active(); + bool bEmbedComplexScriptFonts = embedComplexScriptFontsCheckbox->get_active(); + SfxObjectShell* pDocSh = SfxObjectShell::Current(); if ( pDocSh ) { @@ -67,7 +93,11 @@ bool SfxDocumentFontsPage::FillItemSet( SfxItemSet* ) { uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("EmbedFonts", uno::makeAny( bVal ) ); + xProps->setPropertyValue("EmbedFonts", uno::makeAny(bEmbedFonts)); + xProps->setPropertyValue("EmbedOnlyUsedFonts", uno::makeAny(bEmbedUsedFonts)); + xProps->setPropertyValue("EmbedLatinScriptFonts", uno::makeAny(bEmbedLatinScriptFonts)); + xProps->setPropertyValue("EmbedAsianScriptFonts", uno::makeAny(bEmbedAsianScriptFonts)); + xProps->setPropertyValue("EmbedComplexScriptFonts", uno::makeAny(bEmbedComplexScriptFonts)); } catch( uno::Exception& ) { diff --git a/sfx2/source/inc/documentfontsdialog.hxx b/sfx2/source/inc/documentfontsdialog.hxx index 1bb9830483dc..32ca1b5160fe 100644 --- a/sfx2/source/inc/documentfontsdialog.hxx +++ b/sfx2/source/inc/documentfontsdialog.hxx @@ -35,6 +35,10 @@ protected: virtual void Reset( const SfxItemSet* set ) override; private: std::unique_ptr<weld::CheckButton> embedFontsCheckbox; + std::unique_ptr<weld::CheckButton> embedUsedFontsCheckbox; + std::unique_ptr<weld::CheckButton> embedLatinScriptFontsCheckbox; + std::unique_ptr<weld::CheckButton> embedAsianScriptFontsCheckbox; + std::unique_ptr<weld::CheckButton> embedComplexScriptFontsCheckbox; }; #endif diff --git a/sfx2/uiconfig/ui/documentfontspage.ui b/sfx2/uiconfig/ui/documentfontspage.ui index cec8f7848e82..a32fb1d4ed7f 100644 --- a/sfx2/uiconfig/ui/documentfontspage.ui +++ b/sfx2/uiconfig/ui/documentfontspage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sfx"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="DocumentFontsPage"> @@ -21,14 +21,115 @@ <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="GtkCheckButton" id="embedFonts"> - <property name="label" translatable="yes" context="documentfontspage|embedFonts">_Embed fonts in the document</property> + <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="embedFonts"> + <property name="label" translatable="yes" context="documentfontspage|embedFonts">_Embed fonts in the document</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="embedUsedFonts"> + <property name="label" translatable="yes" context="documentfontspage|embedUsedFonts">Only embed fonts that are used in documents</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkFrame"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkCheckButton" id="embedLatinScriptFonts"> + <property name="label" translatable="yes" context="documentfontspage|embedLatinScriptFonts">Latin fonts</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="embedAsianScriptFonts"> + <property name="label" translatable="yes" context="documentfontspage|embedAsianScriptFonts">Asian fonts</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="embedComplexScriptFonts"> + <property name="label" translatable="yes" context="documentfontspage|embedComplexScriptFonts">Complex fonts</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="documentfontspage|fontScriptFrameLabel">Select font scripts to embed</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> </object> </child> </object> diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index a66f2367c22f..46f8c1568526 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -96,6 +96,10 @@ enum class DocumentSettingId STYLES_NODEFAULT, FLOATTABLE_NOMARGINS, EMBED_FONTS, + EMBED_USED_FONTS, + EMBED_LATIN_SCRIPT_FONTS, + EMBED_ASIAN_SCRIPT_FONTS, + EMBED_COMPLEX_SCRIPT_FONTS, EMBED_SYSTEM_FONTS, APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, }; diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index c900a985dee2..5e088e0fd0be 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -61,6 +61,10 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbStylesNoDefault(false), mbFloattableNomargins(false), mEmbedFonts(false), + mEmbedUsedFonts(false), + mEmbedLatinScriptFonts(true), + mEmbedAsianScriptFonts(true), + mEmbedComplexScriptFonts(true), mEmbedSystemFonts(false), mbOldNumbering(false), mbIgnoreFirstLineIndentInNumbering(false), @@ -204,6 +208,10 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::STYLES_NODEFAULT: return mbStylesNoDefault; case DocumentSettingId::FLOATTABLE_NOMARGINS: return mbFloattableNomargins; case DocumentSettingId::EMBED_FONTS: return mEmbedFonts; + case DocumentSettingId::EMBED_USED_FONTS: return mEmbedUsedFonts; + case DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS: return mEmbedLatinScriptFonts; + case DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS: return mEmbedAsianScriptFonts; + case DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS: return mEmbedComplexScriptFonts; case DocumentSettingId::EMBED_SYSTEM_FONTS: return mEmbedSystemFonts; case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: return mApplyParagraphMarkFormatToNumbering; case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: return mbDisableOffPagePositioning; @@ -416,6 +424,18 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::EMBED_FONTS: mEmbedFonts = value; break; + case DocumentSettingId::EMBED_USED_FONTS: + mEmbedUsedFonts = value; + break; + case DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS: + mEmbedLatinScriptFonts = value; + break; + case DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS: + mEmbedAsianScriptFonts = value; + break; + case DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS: + mEmbedComplexScriptFonts = value; + break; case DocumentSettingId::EMBED_SYSTEM_FONTS: mEmbedSystemFonts = value; break; diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 1cf9a9d9fea9..c8c5b0037978 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -122,7 +122,11 @@ class DocumentSettingManager : bool mbMathBaselineAlignment : 1; // TL 2010-10-29 #i972# bool mbStylesNoDefault : 1; bool mbFloattableNomargins : 1; //< If paragraph margins next to a floating table should be ignored. - bool mEmbedFonts : 1; //< Whether to embed fonts used by the document when saving. + bool mEmbedFonts : 1; //< Whether to embed fonts when saving. + bool mEmbedUsedFonts : 1; //< Whether to embed fonts that are used by the document when saving. + bool mEmbedLatinScriptFonts : 1; //< Whether to embed latin script fonts when saving. + bool mEmbedAsianScriptFonts : 1; //< Whether to embed asian script fonts when saving. + bool mEmbedComplexScriptFonts : 1; //< Whether to embed complex script fonts when saving. bool mEmbedSystemFonts : 1; //< Whether to embed also system fonts. // non-ui-compatibility flags: diff --git a/sw/source/filter/xml/xmlfonte.cxx b/sw/source/filter/xml/xmlfonte.cxx index 7738d51ba50e..8c11072327f2 100644 --- a/sw/source/filter/xml/xmlfonte.cxx +++ b/sw/source/filter/xml/xmlfonte.cxx @@ -32,13 +32,12 @@ using namespace ::com::sun::star::text; class SwXMLFontAutoStylePool_Impl: public XMLFontAutoStylePool { - public: - SwXMLFontAutoStylePool_Impl( SwXMLExport& rExport, bool blockFontEmbedding ); +public: + SwXMLFontAutoStylePool_Impl(SwXMLExport& rExport, bool bFontEmbedding); }; -SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl( - SwXMLExport& _rExport, bool blockFontEmbedding ) : - XMLFontAutoStylePool( _rExport, blockFontEmbedding ) +SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl(SwXMLExport& _rExport, bool bFontEmbedding) + : XMLFontAutoStylePool(_rExport, bFontEmbedding) { sal_uInt16 const aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT }; @@ -65,6 +64,13 @@ SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl( } } } + auto const & pDocument = _rExport.getDoc(); + + m_bEmbedUsedOnly = pDocument->getIDocumentSettingAccess().get(DocumentSettingId::EMBED_USED_FONTS); + m_bEmbedLatinScript = pDocument->getIDocumentSettingAccess().get(DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS); + m_bEmbedAsianScript = pDocument->getIDocumentSettingAccess().get(DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS); + m_bEmbedComplexScript = pDocument->getIDocumentSettingAccess().get(DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS); + } XMLFontAutoStylePool* SwXMLExport::CreateFontAutoStylePool() @@ -87,4 +93,3 @@ void SwXMLImport::NotifyEmbeddedFontRead() } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index a7690c7b1b88..8e5ae19a13f1 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -128,6 +128,10 @@ enum SwDocumentSettingsPropertyHandles HANDLE_CLIPPED_PICTURES, HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, HANDLE_EMBED_FONTS, + HANDLE_EMBED_USED_FONTS, + HANDLE_EMBED_LATIN_SCRIPT_FONTS, + HANDLE_EMBED_ASIAN_SCRIPT_FONTS, + HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, HANDLE_EMBED_SYSTEM_FONTS, HANDLE_TAB_OVER_MARGIN, HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, @@ -208,6 +212,10 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0}, { OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0}, { OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0}, + { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0}, + { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0}, + { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0}, + { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0}, { OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0}, { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0}, { OUString("TreatSingleColumnBreakAsPageBreak"), HANDLE_TREAT_SINGLE_COLUMN_BREAK_AS_PAGE_BREAK, cppu::UnoType<bool>::get(), 0}, @@ -826,6 +834,30 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_FONTS, bTmp); } break; + case HANDLE_EMBED_USED_FONTS: + { + bool bTmp = *o3tl::doAccess<bool>(rValue); + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_USED_FONTS, bTmp); + } + break; + case HANDLE_EMBED_LATIN_SCRIPT_FONTS: + { + bool bTmp = *o3tl::doAccess<bool>(rValue); + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS, bTmp); + } + break; + case HANDLE_EMBED_ASIAN_SCRIPT_FONTS: + { + bool bTmp = *o3tl::doAccess<bool>(rValue); + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS, bTmp); + } + break; + case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS: + { + bool bTmp = *o3tl::doAccess<bool>(rValue); + mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS, bTmp); + } + break; case HANDLE_EMBED_SYSTEM_FONTS: { bool bTmp = *o3tl::doAccess<bool>(rValue); @@ -1287,6 +1319,26 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS ); } break; + case HANDLE_EMBED_USED_FONTS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_USED_FONTS ); + } + break; + case HANDLE_EMBED_LATIN_SCRIPT_FONTS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS ); + } + break; + case HANDLE_EMBED_ASIAN_SCRIPT_FONTS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS ); + } + break; + case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS ); + } + break; case HANDLE_EMBED_SYSTEM_FONTS: { rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_SYSTEM_FONTS ); 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) { } |