diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-03-14 17:12:35 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-03-14 18:02:03 +0100 |
commit | 8ba44dd1abbe31c1235f3b840bf27a61c3401236 (patch) | |
tree | 7e22a4f54ce38f9ea51b41e357cb95312b80f9aa /writerfilter | |
parent | 02f1aad7003703cf604c5c46da82cf0f46c7f709 (diff) |
n#751020 implement DOCX import of linked styles
This is just initial support: the default template and paragraph
properties are included.
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 5 |
4 files changed, 30 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 066416e495ea..2f0dd2bcf7f1 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -41,6 +41,8 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/LineNumberPosition.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/table/BorderLine2.hpp> @@ -3504,6 +3506,16 @@ void DomainMapper_Impl::ApplySettingsTable() m_xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Defaults"))), uno::UNO_QUERY_THROW ); sal_Int32 nDefTab = m_pSettingsTable->GetDefaultTabStop(); xTextDefaults->setPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TAB_STOP_DISTANCE ), uno::makeAny(nDefTab) ); + if (m_pSettingsTable->GetLinkStyles()) + { + PropertyNameSupplier& rSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); + // If linked styles are enabled, set paragraph defaults from Word's default template + xTextDefaults->setPropertyValue(rSupplier.GetName(PROP_PARA_BOTTOM_MARGIN), uno::makeAny(ConversionHelper::convertTwipToMM100(200))); + style::LineSpacing aSpacing; + aSpacing.Mode = style::LineSpacingMode::PROP; + aSpacing.Height = sal_Int16(115); + xTextDefaults->setPropertyValue(rSupplier.GetName(PROP_PARA_LINE_SPACING), uno::makeAny(aSpacing)); + } } catch(const uno::Exception& ) { diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 87b6f9ebb9d7..6e336171eb1b 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -75,6 +75,7 @@ struct SettingsTable_Impl ::rtl::OUString m_sCryptProviderTypeExtSource; ::rtl::OUString m_sHash; ::rtl::OUString m_sSalt; + bool m_bLinkStyles; SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : m_rDMapper( rDMapper ) @@ -91,6 +92,7 @@ struct SettingsTable_Impl , m_nCryptAlgorithmClass(NS_ooxml::LN_Value_wordprocessingml_ST_AlgClass_hash) , m_nCryptAlgorithmType(NS_ooxml::LN_Value_wordprocessingml_ST_AlgType_typeAny) , m_nCryptSpinCount(0) + , m_bLinkStyles(false) {} }; @@ -162,6 +164,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_defaultTabStop: // 92505; m_pImpl->m_nDefaultTabStop = nIntValue; break; + case NS_ooxml::LN_CT_Settings_linkStyles: // 92663; + m_pImpl->m_bLinkStyles = nIntValue; + break; case NS_ooxml::LN_CT_Settings_noPunctuationKerning: // 92526; m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false; break; @@ -217,6 +222,11 @@ int SettingsTable::GetDefaultTabStop() const return ConversionHelper::convertTwipToMM100( m_pImpl->m_nDefaultTabStop ); } +bool SettingsTable::GetLinkStyles() const +{ + return m_pImpl->m_bLinkStyles; +} + 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 2b50d5112ee1..79e095a12b3c 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -64,6 +64,9 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo //returns default TabStop in 1/100th mm int GetDefaultTabStop() const; + /// Automatically update styles from document template? + bool GetLinkStyles() const; + void ApplyProperties( uno::Reference< text::XTextDocument > xDoc ); private: diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 4dc8c49d2bdb..98f35a15dfb4 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -19064,6 +19064,11 @@ </element> </optional> <optional> + <element name="linkStyles"> + <ref name="CT_OnOff"/> + </element> + </optional> + <optional> <element name="removePersonalInformation"> <ref name="CT_OnOff"/> </element> |