diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-17 10:00:32 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-17 10:24:32 +0100 |
commit | 8b6ff51bb89db0d7050bb4d00c0ec797b4754f25 (patch) | |
tree | 4c251b0ce9f174e035e9dead7490eecd96bd0791 | |
parent | fdo#74357 DOCX import: fix nested tables anchored inside tables (diff) | |
download | core-8b6ff51bb89db0d7050bb4d00c0ec797b4754f25.tar.gz core-8b6ff51bb89db0d7050bb4d00c0ec797b4754f25.zip |
fdo#74357 DOCX import: avoid layout problem with automatic spacing
Commit 279ff2e03371542d014bf281e73282ba8080cf6b (bnc#816593 DOCX import:
fix auto para spacing without compat option, 2013-08-28) corrected the
value of "auto" paragraph spacing, but unfortunately this triggers a
layout problem:
warn:legacy.osl:12692:1:sw/source/core/layout/tabfrm.cxx:2513: debug assertion: <SwTabFrm::MakeAll()> - format of table lowers suppressed by fix i44910
resulting in "the rest of the table is not rendered by the layout".
Given that we backported the original fix to stable branches as well,
just stay on the safe side and revert back to the original behavior in
case the document requests the web layout.
Change-Id: I72683530b5218beff084bec8218cc99946b44802
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 11 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 2 |
5 files changed, 29 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 41089c974e32..7d9e4f523135 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -752,6 +752,10 @@ DECLARE_OOXMLIMPORT_TEST(testFdo74357, "fdo74357.docx") uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); // This was 0. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); + + // Bottom margin of the first paragraph was too large, causing a layout problem. + // This was 494. + CPPUNIT_ASSERT_EQUAL(sal_Int32(86), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); } DECLARE_OOXMLIMPORT_TEST(testFdo55187, "fdo55187.docx") diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index c4036756f714..b3932c35edff 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -549,7 +549,12 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) sal_Int32 default_spacing = 100; if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) { - default_spacing = 280; + // 49 is just the old value that should be removed, once the + // root cause in SwTabFrm::MakeAll() is fixed. + if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_wordprocessingml_ST_View_web) + default_spacing = 49; + else + default_spacing = 280; } m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag @@ -564,7 +569,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) if (!m_pImpl->GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing()) { - default_spacing = 280; + if (m_pImpl->GetSettingsTable()->GetView() == NS_ooxml::LN_Value_wordprocessingml_ST_View_web) + default_spacing = 49; + else + default_spacing = 280; } m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index d6ef7211444c..f2c9023faee6 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -66,6 +66,7 @@ struct SettingsTable_Impl OUString m_sSalt; bool m_bLinkStyles; sal_Int16 m_nZoomFactor; + Id m_nView; bool m_bEvenAndOddHeaders; bool m_bUsePrinterMetrics; bool embedTrueTypeFonts; @@ -92,6 +93,7 @@ struct SettingsTable_Impl , m_nCryptSpinCount(0) , m_bLinkStyles(false) , m_nZoomFactor(0) + , m_nView(0) , m_bEvenAndOddHeaders(false) , m_bUsePrinterMetrics(false) , embedTrueTypeFonts(false) @@ -139,6 +141,9 @@ void SettingsTable::lcl_attribute(Id nName, Value & val) m_pImpl->m_pThemeFontLangProps[2].Name = "bidi"; m_pImpl->m_pThemeFontLangProps[2].Value <<= sStringValue; break; + case NS_ooxml::LN_CT_View_val: + m_pImpl->m_nView = nIntValue; + break; default: { #ifdef DEBUG_DMAPPER_SETTINGS_TABLE @@ -168,6 +173,7 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_compat: // 92547; case NS_ooxml::LN_CT_Settings_themeFontLang: // 92552; case NS_ooxml::LN_CT_Settings_shapeDefaults: // 92560; + case NS_ooxml::LN_CT_Settings_view: //PropertySetValues - need to be resolved { @@ -270,6 +276,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const return m_pImpl->m_nZoomFactor; } +Id SettingsTable::GetView() const +{ + return m_pImpl->m_nView; +} + bool SettingsTable::GetUsePrinterMetrics() const { return m_pImpl->m_bUsePrinterMetrics; diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx index 2014eafab0e7..37320b691c09 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -61,6 +61,9 @@ class SettingsTable : public LoggedProperties, public LoggedTable /// What's the zoom factor set in percents? sal_Int16 GetZoomFactor() const; + /// What's the requested view? E.g. "web". + Id GetView() const; + bool GetEvenAndOddHeaders() const; bool GetUsePrinterMetrics() const; diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 43e58b057c0c..ab0476ad7f48 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -14278,7 +14278,7 @@ </define> <define name="CT_View"> <attribute name="val"> - <text/> + <ref name="ST_View"/> <xs:documentation>Document View Setting Value</xs:documentation> </attribute> </define> |