diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-09-06 17:34:08 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-09-06 17:35:48 +0200 |
commit | 7a045f48bad2177538c43f76019c1caecdd5baf7 (patch) | |
tree | e2bf7d81f67a33eb772c7cffcf6be956977345f9 | |
parent | 9b14fa8f64d84866777e35acfe369503da188c7a (diff) |
read support for docx w:embedTrueTypeFonts/w:embedSystemFonts
No write support yet.
Change-Id: Ia10239acc77cf9ebc4f511e30c007da36abf43cb
-rw-r--r-- | offapi/com/sun/star/document/Settings.idl | 15 | ||||
-rw-r--r-- | sw/inc/IDocumentSettingAccess.hxx | 4 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/uno/SwXDocumentSettings.cxx | 28 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 20 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.hxx | 3 |
11 files changed, 89 insertions, 5 deletions
diff --git a/offapi/com/sun/star/document/Settings.idl b/offapi/com/sun/star/document/Settings.idl index be4d186ee391..a2eee7140851 100644 --- a/offapi/com/sun/star/document/Settings.idl +++ b/offapi/com/sun/star/document/Settings.idl @@ -249,6 +249,21 @@ published service Settings */ [optional, property] boolean AddExternalLeading; + // Writer, maybe later others + /** + Whether to embed fonts used by the document (see e.g. handling + of OOXML embedRegular etc.) + @since LibreOffice 3.7 + */ + [optional, property] boolean EmbedFonts; + // Writer, maybe later others + /** + Whether to embed also system fonts used by the document. + Does not have any effect if EmbedFonts is false. + @since LibreOffice 3.7 + */ + [optional, property] boolean EmbedSystemFonts; + }; diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 44eef470f140..b7d2c13d2db4 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -96,7 +96,9 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd KERN_ASIAN_PUNCTUATION, MATH_BASELINE_ALIGNMENT, STYLES_NODEFAULT, - FLOATTABLE_NOMARGINS + FLOATTABLE_NOMARGINS, + EMBED_FONTS, + EMBED_SYSTEM_FONTS }; public: diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 51c4f2873e7d..001ebf89f98a 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -568,6 +568,8 @@ private: 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 mEmbedSystemFonts : 1; ///< Whether to embed also system fonts. // non-ui-compatibility flags: bool mbOldNumbering : 1; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 46bccdee17eb..f7b5bfd1a2ef 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -212,6 +212,8 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment; case STYLES_NODEFAULT: return mbStylesNoDefault; case FLOATTABLE_NOMARGINS: return mbFloattableNomargins; + case EMBED_FONTS: return mEmbedFonts; + case EMBED_SYSTEM_FONTS: return mEmbedSystemFonts; default: OSL_FAIL("Invalid setting id"); } @@ -391,6 +393,12 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case FLOATTABLE_NOMARGINS: mbFloattableNomargins = value; break; + case EMBED_FONTS: + mEmbedFonts = value; + break; + case EMBED_SYSTEM_FONTS: + mEmbedSystemFonts = value; + break; default: OSL_FAIL("Invalid setting id"); } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 5e9cdf6e631d..b2d07dbae092 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -359,6 +359,8 @@ SwDoc::SwDoc() mbUnbreakableNumberings = false; mbFloattableNomargins = false; mbClippedPictures = false; + mEmbedFonts = false; + mEmbedSystemFonts = false; // // COMPATIBILITY FLAGS END diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index fda8a6c54f8b..728e54c2ad32 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -128,7 +128,9 @@ enum SwDocumentSettingsPropertyHandles HANDLE_UNBREAKABLE_NUMBERINGS, HANDLE_STYLES_NODEFAULT, HANDLE_FLOATTABLE_NOMARGINS, - HANDLE_CLIPPED_PICTURES + HANDLE_CLIPPED_PICTURES, + HANDLE_EMBED_FONTS, + HANDLE_EMBED_SYSTEM_FONTS }; MasterPropertySetInfo * lcl_createSettingsInfo() @@ -194,6 +196,8 @@ MasterPropertySetInfo * lcl_createSettingsInfo() { RTL_CONSTASCII_STRINGPARAM("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("ClippedPictures"), HANDLE_CLIPPED_PICTURES, CPPUTYPE_BOOLEAN, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("EmbedFonts"), HANDLE_EMBED_FONTS, CPPUTYPE_BOOLEAN, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, CPPUTYPE_BOOLEAN, 0, 0}, /* * As OS said, we don't have a view when we need to set this, so I have to * find another solution before adding them to this property set - MTG @@ -771,6 +775,17 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->set(IDocumentSettingAccess::CLIPPED_PICTURES, bTmp); } break; + case HANDLE_EMBED_FONTS: + { + sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); + mpDoc->set(IDocumentSettingAccess::EMBED_FONTS, bTmp); + } + case HANDLE_EMBED_SYSTEM_FONTS: + { + sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); + mpDoc->set(IDocumentSettingAccess::EMBED_SYSTEM_FONTS, bTmp); + } + break; default: throw UnknownPropertyException(); } @@ -1161,6 +1176,17 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue.setValue( &bTmp, ::getBooleanCppuType() ); } break; + case HANDLE_EMBED_FONTS: + { + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::EMBED_FONTS ); + rValue.setValue( &bTmp, ::getBooleanCppuType() ); + } + case HANDLE_EMBED_SYSTEM_FONTS: + { + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::EMBED_SYSTEM_FONTS ); + rValue.setValue( &bTmp, ::getBooleanCppuType() ); + } + break; default: throw UnknownPropertyException(); } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bc0871cf9507..40acc306f3f2 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3665,11 +3665,13 @@ void DomainMapper_Impl::ApplySettingsTable() xViewDataSupplier->setViewData(xIndexAccess); } + uno::Reference< beans::XPropertySet > xSettings(m_xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); if (m_pSettingsTable->GetUsePrinterMetrics()) - { - uno::Reference< beans::XPropertySet > xSettings(m_xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); xSettings->setPropertyValue("PrinterIndependentLayout", uno::makeAny(document::PrinterIndependentLayout::DISABLED)); - } + if( m_pSettingsTable->GetEmbedTrueTypeFonts()) + xSettings->setPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_EMBED_FONTS ), uno::makeAny(true) ); + if( m_pSettingsTable->GetEmbedSystemFonts()) + xSettings->setPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) ); } catch(const uno::Exception&) { diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 66aecf68262c..1b4e8abe4082 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -316,6 +316,8 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_IS_VISIBLE: sName = "IsVisible"; break; case PROP_PAGE_STYLE_LAYOUT: sName = "PageStyleLayout"; break; case PROP_Z_ORDER: sName = "ZOrder"; break; + case PROP_EMBED_FONTS: sName = "EmbedFonts"; break; + case PROP_EMBED_SYSTEM_FONTS: sName = "EmbedSystemFonts"; break; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 8a55b829d440..5f21ee1504e0 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -289,6 +289,8 @@ enum PropertyIds ,PROP_PARA_CONTEXT_MARGIN ,PROP_PAGE_STYLE_LAYOUT ,PROP_Z_ORDER + ,PROP_EMBED_FONTS + ,PROP_EMBED_SYSTEM_FONTS }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index c28b45bd482a..74161ed48ef7 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -69,6 +69,8 @@ struct SettingsTable_Impl sal_Int16 m_nZoomFactor; bool m_bEvenAndOddHeaders; bool m_bUsePrinterMetrics; + bool embedTrueTypeFonts; + bool embedSystemFonts; SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : m_rDMapper( rDMapper ) @@ -89,6 +91,8 @@ struct SettingsTable_Impl , m_nZoomFactor(0) , m_bEvenAndOddHeaders(false) , m_bUsePrinterMetrics(false) + , embedTrueTypeFonts(false) + , embedSystemFonts(false) {} }; @@ -199,6 +203,12 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Compat_usePrinterMetrics: m_pImpl->m_bUsePrinterMetrics = nIntValue; break; + case NS_ooxml::LN_CT_Settings_embedTrueTypeFonts: + m_pImpl->embedTrueTypeFonts = nIntValue != 0; + break; + case NS_ooxml::LN_CT_Settings_embedSystemFonts: + m_pImpl->embedSystemFonts = nIntValue != 0; + break; default: { #ifdef DEBUG_DMAPPER_SETTINGS_TABLE @@ -241,6 +251,16 @@ bool SettingsTable::GetEvenAndOddHeaders() const return m_pImpl->m_bEvenAndOddHeaders; } +bool SettingsTable::GetEmbedTrueTypeFonts() const +{ + return m_pImpl->embedTrueTypeFonts; +} + +bool SettingsTable::GetEmbedSystemFonts() const +{ + return m_pImpl->embedSystemFonts; +} + void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc ) { uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY ); diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx index 6c30f37cc4d1..d8a88c9a6656 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -65,6 +65,9 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo bool GetUsePrinterMetrics() const; + bool GetEmbedTrueTypeFonts() const; + bool GetEmbedSystemFonts() const; + void ApplyProperties( uno::Reference< text::XTextDocument > xDoc ); private: |