diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-09-17 12:49:32 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-09-17 12:55:17 +0200 |
commit | 4dff8b0d40a1d5dbb36bc549f1e528e0eccae39b (patch) | |
tree | 4ed3a46f9c73774ebea807f87c9374d3a9db1e05 | |
parent | f91e008c986b1d57c092103f1b68e75805499a59 (diff) |
n#778140 DOCX import of w:doNotUseHTMLParagraphAutoSpacing compat option
This reverts commit 61c94cbe2cbbbcaa1e44edecc4add60eb6d7937d (as it
touched values which are not in the spec) and sets the correct paragraph
top/bottom margin in case the compat option is enabled.
Change-Id: I152a76d8fcdef3acf5491783c2ccacd2d48e76b3
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.hxx | 2 |
3 files changed, 22 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index dc042765df59..557d05456694 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1154,15 +1154,19 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) uno::makeAny( aLocale ) ); } break; -#define AUTO_PARA_SPACING sal_Int32(100) +// This is the value when the compat option is not enabled. No idea where it comes from, the spec doesn't mention it. +#define AUTO_PARA_SPACING sal_Int32(49) case NS_ooxml::LN_CT_Spacing_beforeAutospacing: - //TODO: autospacing depends on some document property (called fDontUseHTMLAutoSpacing in old ww8 filter) 100 or 280 twip - //and should be set to 0 on start of page - m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, false, uno::makeAny( ConversionHelper::convertTwipToMM100(AUTO_PARA_SPACING) ) ); + if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) + m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) ); + else + m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, false, uno::makeAny( ConversionHelper::convertTwipToMM100(100) ) ); break; case NS_ooxml::LN_CT_Spacing_afterAutospacing: - //TODO: autospacing depends on some document property (called fDontUseHTMLAutoSpacing in old ww8 filter) 100 or 280 twip - m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, false, uno::makeAny( ConversionHelper::convertTwipToMM100(AUTO_PARA_SPACING) ) ); + if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) + m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) ); + else + m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, false, uno::makeAny( ConversionHelper::convertTwipToMM100(200) ) ); break; case NS_ooxml::LN_CT_SmartTagRun_uri: case NS_ooxml::LN_CT_SmartTagRun_element: diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 74161ed48ef7..18bef92d7b89 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -71,6 +71,7 @@ struct SettingsTable_Impl bool m_bUsePrinterMetrics; bool embedTrueTypeFonts; bool embedSystemFonts; + bool m_bDoNotUseHTMLParagraphAutoSpacing; SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : m_rDMapper( rDMapper ) @@ -93,6 +94,7 @@ struct SettingsTable_Impl , m_bUsePrinterMetrics(false) , embedTrueTypeFonts(false) , embedSystemFonts(false) + , m_bDoNotUseHTMLParagraphAutoSpacing(false) {} }; @@ -209,6 +211,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_embedSystemFonts: m_pImpl->embedSystemFonts = nIntValue != 0; break; + case NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing: + m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing = nIntValue; + break; default: { #ifdef DEBUG_DMAPPER_SETTINGS_TABLE @@ -261,6 +266,11 @@ bool SettingsTable::GetEmbedSystemFonts() const return m_pImpl->embedSystemFonts; } +bool SettingsTable::GetDoNotUseHTMLParagraphAutoSpacing() const +{ + return m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing; +} + 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 d8a88c9a6656..6a250a7157d0 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -68,6 +68,8 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo bool GetEmbedTrueTypeFonts() const; bool GetEmbedSystemFonts() const; + bool GetDoNotUseHTMLParagraphAutoSpacing() const; + void ApplyProperties( uno::Reference< text::XTextDocument > xDoc ); private: |