summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2019-04-13 09:31:56 +0300
committerJustin Luth <justin_luth@sil.org>2019-04-13 16:16:13 +0200
commitd7e6c898f5ec8fbd142f9d3e1c46dfcf90edfc27 (patch)
tree43b2f6fac578c463bd4cedcb82299b909a367173
parenta1a8fda4205581046b021120cae4b7b7e46ef14a (diff)
tdf#124637 writerfilter: partially revert import section margins
...from LO6.3 commit 8d4a7b17e60aa889d1a78da47630aae2d1c1513c Footnotes and Endnotes are also considered sections, and those sections are messing up tracking which page style is in effect. Simply reverting since any fix will still be based on page style assumptions and require losts of testing. The original commit didn't fix any reported bug anyway. Change-Id: I3597d511d9755f48e7ac2ae9cfb2f8ff63c74d17 Reviewed-on: https://gerrit.libreoffice.org/70702 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf124637_sectionMargin.docxbin0 -> 21535 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx13
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx18
3 files changed, 14 insertions, 17 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124637_sectionMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf124637_sectionMargin.docx
new file mode 100644
index 000000000000..19aa819aca3d
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf124637_sectionMargin.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 6ca09581d1b5..fc747e30b3dc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -68,7 +68,18 @@ DECLARE_OOXMLEXPORT_TEST(testendingSectionProps, "endingSectionProps.docx")
CPPUNIT_ASSERT_EQUAL_MESSAGE("# of paragraphs", 2, getParagraphs());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Section is RightToLeft", text::WritingMode2::RL_TB, getProperty<sal_Int16>(xSect, "WritingMode"));
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Section Left Margin", sal_Int32(2540), getProperty<sal_Int32>(xSect, "SectionLeftMargin"));
+ //regression: tdf124637
+ //CPPUNIT_ASSERT_EQUAL_MESSAGE("Section Left Margin", sal_Int32(2540), getProperty<sal_Int32>(xSect, "SectionLeftMargin"));
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf124637_sectionMargin, "tdf124637_sectionMargin.docx")
+{
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+ // sections 0 and 1 must be related to footnotes...
+ uno::Reference<beans::XPropertySet> xSect(xSections->getByIndex(2), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Section Left Margin", sal_Int32(0), getProperty<sal_Int32>(xSect, "SectionLeftMargin"));
}
DECLARE_OOXMLEXPORT_TEST(tdf123912_protectedForm, "tdf123912_protectedForm.odt")
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index de14f1066a43..cf5f3b4d3381 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -682,27 +682,12 @@ void SectionPropertyMap::DontBalanceTextColumns()
}
}
-void SectionPropertyMap::ApplySectionProperties( const uno::Reference< beans::XPropertySet >& xSection, DomainMapper_Impl& rDM_Impl )
+void SectionPropertyMap::ApplySectionProperties( const uno::Reference< beans::XPropertySet >& xSection, DomainMapper_Impl& /*rDM_Impl*/ )
{
try
{
if ( xSection.is() )
{
- // Margins only valid if page style is already determined.
- // Take some care not to create an automatic page style (with GetPageStyle) if it isn't already created.
- if ( !m_aFollowPageStyle.is() && !m_sFollowPageStyleName.isEmpty() )
- GetPageStyle( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), false );
- if ( m_aFollowPageStyle.is() )
- {
- sal_Int32 nPageMargin = 0;
- m_aFollowPageStyle->getPropertyValue( getPropertyName( PROP_LEFT_MARGIN ) ) >>= nPageMargin;
- xSection->setPropertyValue( "SectionLeftMargin", uno::makeAny(m_nLeftMargin - nPageMargin) );
-
- nPageMargin = 0;
- m_aFollowPageStyle->getPropertyValue( getPropertyName( PROP_RIGHT_MARGIN ) ) >>= nPageMargin;
- xSection->setPropertyValue( "SectionRightMargin", uno::makeAny(m_nRightMargin - nPageMargin) );
- }
-
boost::optional< PropertyMap::Property > pProp = getProperty( PROP_WRITING_MODE );
if ( pProp )
xSection->setPropertyValue( "WritingMode", pProp->second );
@@ -1236,6 +1221,7 @@ void SectionPropertyMap::InheritOrFinalizePageStyles( DomainMapper_Impl& rDM_Imp
// otherwise apply this section's settings to the new style.
// Ensure that FollowPage is inherited first - otherwise GetPageStyle may auto-create a follow when checking FirstPage.
SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
+ //tdf124637 TODO: identify and skip special sections (like footnotes/endnotes)
if ( pLastContext && m_sFollowPageStyleName.isEmpty() )
m_sFollowPageStyleName = pLastContext->GetPageStyleName();
else