From 7a045f48bad2177538c43f76019c1caecdd5baf7 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 6 Sep 2012 17:34:08 +0200 Subject: read support for docx w:embedTrueTypeFonts/w:embedSystemFonts No write support yet. Change-Id: Ia10239acc77cf9ebc4f511e30c007da36abf43cb --- sw/inc/IDocumentSettingAccess.hxx | 4 +++- sw/inc/doc.hxx | 2 ++ sw/source/core/doc/doc.cxx | 8 ++++++++ sw/source/core/doc/docnew.cxx | 2 ++ sw/source/ui/uno/SwXDocumentSettings.cxx | 28 +++++++++++++++++++++++++++- 5 files changed, 42 insertions(+), 2 deletions(-) (limited to 'sw') 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(); } -- cgit