[Libreoffice-commits] .: writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Sep 17 03:53:43 PDT 2012
writerfilter/source/dmapper/DomainMapper.cxx | 16 ++++++++++------
writerfilter/source/dmapper/SettingsTable.cxx | 10 ++++++++++
writerfilter/source/dmapper/SettingsTable.hxx | 2 ++
3 files changed, 22 insertions(+), 6 deletions(-)
New commits:
commit 4dff8b0d40a1d5dbb36bc549f1e528e0eccae39b
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Sep 17 12:49:32 2012 +0200
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
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index dc04276..557d054 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 74161ed..18bef92 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 d8a88c9..6a250a7 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:
More information about the Libreoffice-commits
mailing list