[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 4 commits - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed May 17 09:06:10 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf107889.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 53 ++++++++++++---
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 45 ++----------
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 3
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 5 +
writerfilter/source/dmapper/PropertyMap.cxx | 24 +++++-
writerfilter/source/dmapper/PropertyMap.hxx | 2
8 files changed, 84 insertions(+), 50 deletions(-)
New commits:
commit aadbf483583acab13f043ac36af035be570a0b20
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue May 16 15:26:53 2017 +0200
tdf#107889 DOCX import: consider page breaks for multi-page floattables
This is the DOCX equivalent of commit
6aba29576df7a2a40e54040d4dd09d94d6594741 (tdf#107773 DOC import:
consider page breaks for multi-page floattables, 2017-05-11): a specific
case where it's clearly superior to import a multi-page floating table
as a multi-page one, rather than a floating one.
Reviewed-on: https://gerrit.libreoffice.org/37683
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 659c0227a50d298780d72902314e03df8824bc06)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
writerfilter/source/dmapper/PropertyMap.cxx
writerfilter/source/dmapper/PropertyMap.hxx
Change-Id: I71a92d2b10e52e505665831caacad2948d22b4e1
diff --git a/sw/qa/extras/ooxmlexport/data/tdf107889.docx b/sw/qa/extras/ooxmlexport/data/tdf107889.docx
new file mode 100644
index 000000000000..452c4aa13063
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107889.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 175aa081f113..32e418d09a3a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -287,6 +287,14 @@ DECLARE_OOXMLEXPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx")
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf107889, "tdf107889.docx")
+{
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ // This was 1, multi-page table was imported as a floating one.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 36f30a36c39c..5676a3c3ce80 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1142,6 +1142,9 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab
xTextAppendAndConvert->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties));
}
}
+
+ // We're right after a table conversion.
+ m_rDMapper_Impl.m_bConvertedTable = true;
}
m_aTableProperties.reset();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 47ae4e654438..4cb55513eacb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1225,6 +1225,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
xTextRange = xTextAppend->finishParagraph( comphelper::containerToSequence(aProperties) );
m_xPreviousParagraph.set(xTextRange, uno::UNO_QUERY);
+ // We're no longer right after a table conversion.
+ m_bConvertedTable = false;
if (xCursor.is())
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 6823e741619d..44a2be003c30 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -310,6 +310,8 @@ struct FloatingTableInfo
css::uno::Reference<css::text::XTextRange> m_xEnd;
css::uno::Sequence<css::beans::PropertyValue> m_aFrameProperties;
sal_Int32 m_nTableWidth;
+ /// Break type of the section that contains this table.
+ sal_Int32 m_nBreakType = -1;
FloatingTableInfo(css::uno::Reference<css::text::XTextRange> const& xStart,
css::uno::Reference<css::text::XTextRange> const& xEnd,
@@ -747,6 +749,9 @@ public:
DeletableTabStop m_aCurrentTabStop;
+ /// If we're right after the end of a table.
+ bool m_bConvertedTable = false;
+
bool IsOOXMLImport() const { return m_eDocumentType == SourceDocumentType::OOXML; }
bool IsRTFImport() const { return m_eDocumentType == SourceDocumentType::RTF; }
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 556c9be7aff2..c8cf96bb1f7f 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1057,12 +1057,17 @@ void SectionPropertyMap::HandleMarginsHeaderFooter(bool bFirstPage, DomainMapper
PrepareHeaderFooterProperties( bFirstPage );
}
-bool SectionPropertyMap::FloatingTableConversion(FloatingTableInfo& rInfo)
+bool SectionPropertyMap::FloatingTableConversion(DomainMapper_Impl& rDM_Impl, FloatingTableInfo& rInfo)
{
// Note that this is just a list of heuristics till sw core can have a
// table that is floating and can span over multiple pages at the same
// time.
+ // If there is an explicit section break right after a table, then there
+ // will be no wrapping anyway.
+ if (rDM_Impl.m_bConvertedTable && !rDM_Impl.GetIsLastSectionGroup() && rInfo.m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextPage)
+ return false;
+
sal_Int32 nPageWidth = GetPageWidth();
sal_Int32 nTextAreaWidth = nPageWidth - GetLeftMargin() - GetRightMargin();
// Count the layout width of the table.
@@ -1154,12 +1159,17 @@ throw ( css::beans::UnknownPropertyException,
void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
{
+ // The default section type is nextPage.
+ if ( m_nBreakType == -1 )
+ m_nBreakType = NS_ooxml::LN_Value_ST_SectionMark_nextPage;
+
// Text area width is known at the end of a section: decide if tables should be converted or not.
std::vector<FloatingTableInfo>& rPendingFloatingTables = rDM_Impl.m_aPendingFloatingTables;
uno::Reference<text::XTextAppendAndConvert> xBodyText( rDM_Impl.GetBodyText(), uno::UNO_QUERY );
for (FloatingTableInfo & rInfo : rPendingFloatingTables)
{
- if (FloatingTableConversion(rInfo))
+ rInfo.m_nBreakType = m_nBreakType;
+ if (FloatingTableConversion(rDM_Impl, rInfo))
xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties);
}
rPendingFloatingTables.clear();
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 9fe090273150..4aad5da6873b 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -264,7 +264,7 @@ class SectionPropertyMap : public PropertyMap
sal_Int32 nOffsetFrom,
sal_uInt32 nLineWidth);
/// Determines if conversion of a given floating table is wanted or not.
- bool FloatingTableConversion(FloatingTableInfo& rInfo);
+ bool FloatingTableConversion(DomainMapper_Impl& rDM_Impl, FloatingTableInfo& rInfo);
public:
explicit SectionPropertyMap(bool bIsFirstSection);
commit 8c9002a9509fb161ebebccc0f358a0dc5b6a8a12
Author: Justin Luth <justin_luth at sil.org>
Date: Thu Mar 16 16:19:04 2017 +0300
writerfilter: default break type identified as _nextPage
Change-Id: I9247c75819425a97d19c95c48fbaf7a4f8d92c62
Reviewed-on: https://gerrit.libreoffice.org/35379
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
(cherry picked from commit 541b377a94fb1247dbf4c39b5bcf55deb8e5ef60)
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 9272079687c0..556c9be7aff2 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1192,10 +1192,13 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
}
}
+ // The default section type is nextPage.
+ if( m_nBreakType == -1 )
+ m_nBreakType = NS_ooxml::LN_Value_ST_SectionMark_nextPage;
+
// depending on the break type no page styles should be created
- // If the section type is missing, but we have columns without new style info, then this should be
- // handled as a continuous section break.
- const bool bTreatAsContinuous = (m_nBreakType == -1 || m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextPage)
+ // Continuous sections usually create only a section, and not a new page style
+ const bool bTreatAsContinuous = m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextPage
&& m_nColumnCount > 0
&& !HasHeader(m_bTitlePage) && !HasFooter(m_bTitlePage)
&& (m_bIsFirstSection || m_sFollowPageStyleName.isEmpty() || (m_sFirstPageStyleName.isEmpty() && m_bTitlePage));
commit 1299dc274864038bd2961b685430e522456c0f1a
Author: Justin Luth <justin_luth at sil.org>
Date: Thu Mar 9 18:13:50 2017 +0300
tdf#103931 writerfilter breaktype: same for implicit and explicit
MSWord normally does NOT specify "nextPage" for the sectionBreak,
since that is the default type. That is imported as BreakType == -1.
However, Writer ALWAYS exports the section type name, which of
course is imported explicitly.
**There is an import hack that treats the very first -1 section as
continuous IF there are columns**. Since Writer explicitly defines
the section type, these documents import differently.
When Writer round-trips these types of files, they get totally
messed up in Writer, although they look fine in Word. So, treat
both implicit and explicit nextPage identically for
bTreatAsContinuous during import.
Another unit test demonstrated that headers/footers are lost when
treating as continuous, so preventing that situation now also.
This fix allows several import-only unit tests to round-trip.
Reviewed-on: https://gerrit.libreoffice.org/35013
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 4605bd46984125a99b0e993b71efa6edb411699f)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
Change-Id: I37fa861d82e8da564d28d8e9089fe0f2777650fb
diff --git a/sw/qa/extras/ooxmlimport/data/default-sect-break-cols.docx b/sw/qa/extras/ooxmlexport/data/default-sect-break-cols.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/default-sect-break-cols.docx
rename to sw/qa/extras/ooxmlexport/data/default-sect-break-cols.docx
diff --git a/sw/qa/extras/ooxmlimport/data/multi-column-separator-with-line.docx b/sw/qa/extras/ooxmlexport/data/multi-column-separator-with-line.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/multi-column-separator-with-line.docx
rename to sw/qa/extras/ooxmlexport/data/multi-column-separator-with-line.docx
diff --git a/sw/qa/extras/ooxmlimport/data/unbalanced-columns.docx b/sw/qa/extras/ooxmlexport/data/unbalanced-columns.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/unbalanced-columns.docx
rename to sw/qa/extras/ooxmlexport/data/unbalanced-columns.docx
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index a68bad47e78c..175aa081f113 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -13,6 +13,7 @@
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
#include <com/sun/star/text/XTextFrame.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
@@ -250,6 +251,42 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107033, "tdf107033.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(25), getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth"));
}
+DECLARE_OOXMLEXPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx")
+{
+ // First problem: the first two paragraphs did not have their own text section, so the whole document had two columns.
+ uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First."), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+ // Second problem: the page style had two columns, while it shouldn't have any.
+ uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+ xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+ // Check for the Column Separator value.It should be FALSE as the document does not contain separator line.
+ bool bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
+ CPPUNIT_ASSERT(!bValue) ;
+}
+
+DECLARE_OOXMLEXPORT_TEST(testMultiColumnSeparator, "multi-column-separator-with-line.docx")
+{
+ uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First data."), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+ // Check for the Column Separator value.It should be TRUE as the document contains separator line.
+ bool bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
+ CPPUNIT_ASSERT(bValue);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx")
+{
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+ // This was false, last section was balanced, but it's unbalanced in Word.
+ CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 395e38e36e96..70713a4abe49 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -671,23 +671,6 @@ DECLARE_OOXMLIMPORT_TEST(testGroupshapeSdt, "groupshape-sdt.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xShape->getText()), 1), "CharKerning"));
}
-DECLARE_OOXMLIMPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx")
-{
- // First problem: the first two paragraphs did not have their own text section, so the whole document had two columns.
- uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First."), "TextSection");
- CPPUNIT_ASSERT(xTextSection.is());
- uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
- CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
-
- // Second problem: the page style had two columns, while it shouldn't have any.
- uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
- xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns");
- CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
- // Check for the Column Separator value.It should be FALSE as the document does not contain separator line.
- bool bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
- CPPUNIT_ASSERT(!bValue) ;
-}
-
void lcl_countTextFrames(css::uno::Reference< lang::XComponent >& xComponent,
sal_Int32 nExpected )
{
@@ -764,17 +747,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf75573_lostTable, "tdf75573_lostTable.docx")
CPPUNIT_ASSERT_EQUAL_MESSAGE("# of pages", 3, getPages() );
}
-DECLARE_OOXMLIMPORT_TEST(testMultiColumnSeparator, "multi-column-separator-with-line.docx")
-{
- uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First data."), "TextSection");
- CPPUNIT_ASSERT(xTextSection.is());
- uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
- CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
- // Check for the Column Separator value.It should be TRUE as the document contains separator line.
- bool bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
- CPPUNIT_ASSERT(bValue);
-}
-
DECLARE_OOXMLIMPORT_TEST(lineWpsOnly, "line-wps-only.docx")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
@@ -939,14 +911,6 @@ DECLARE_OOXMLIMPORT_TEST(testFdo76803, "fdo76803.docx")
CPPUNIT_ASSERT_EQUAL(double(0), aPolygon.getB2DPoint(3).getY());
}
-DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.docx")
-{
- uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
- // This was false, last section was balanced, but it's unbalanced in Word.
- CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(2), "DontBalanceTextColumns"));
-}
-
DECLARE_OOXMLIMPORT_TEST(testUnbalancedColumnsCompat, "unbalanced-columns-compat.docx")
{
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index ec79cb1ba653..9272079687c0 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1195,8 +1195,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
// depending on the break type no page styles should be created
// If the section type is missing, but we have columns without new style info, then this should be
// handled as a continuous section break.
- const bool bTreatAsContinuous = m_nBreakType == -1
+ const bool bTreatAsContinuous = (m_nBreakType == -1 || m_nBreakType == NS_ooxml::LN_Value_ST_SectionMark_nextPage)
&& m_nColumnCount > 0
+ && !HasHeader(m_bTitlePage) && !HasFooter(m_bTitlePage)
&& (m_bIsFirstSection || m_sFollowPageStyleName.isEmpty() || (m_sFirstPageStyleName.isEmpty() && m_bTitlePage));
if(m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || bTreatAsContinuous)
{
commit a47b4e92e82b65a810e1ce92d6c3e47d2ec11c37
Author: Justin Luth <justin_luth at sil.org>
Date: Thu Mar 9 17:29:34 2017 +0300
ooxmlexport: move tdf103931 unit test to ooxmlimport
Visually, this unit test round-trips terribly.
During round-tripping, the 3 columns (related to textsections)
in the very first section get transferred into the pagedesc. Thus the
first section is "lost". For some unknown reason, another section
is added later on. So, cummulatively, the section count remained
the same, but whatever fixes these two situations will also affect
the section count.
However, it should work fine as an import only test. There ARE
three sections in MSWord after all.
Reviewed-on: https://gerrit.libreoffice.org/35012
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
(cherry picked from commit 3a9e87d14eb4bf9415dd96c77cbec75c03e9682c)
Change-Id: I1973977f5c5a45189896b10cacd757600e7684db
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 093aecd16901..a68bad47e78c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -235,14 +235,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106001_2, "tdf106001-2.odt")
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:w","val","600");
}
-DECLARE_OOXMLEXPORT_TEST(testTdf103931, "tdf103931.docx")
-{
- uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
- // This was 2, the last (empty) section of the document was lost on import.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xTextSections->getCount());
-}
-
DECLARE_OOXMLEXPORT_TEST(testTdf107104, "tdf107104.docx")
{
CPPUNIT_ASSERT(getShape(1)->getSize().Width > 0);
diff --git a/sw/qa/extras/ooxmlexport/data/tdf103931.docx b/sw/qa/extras/ooxmlimport/data/tdf103931.docx
similarity index 100%
rename from sw/qa/extras/ooxmlexport/data/tdf103931.docx
rename to sw/qa/extras/ooxmlimport/data/tdf103931.docx
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e926f2d078a3..395e38e36e96 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -131,6 +131,15 @@ DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", nullptr,
CPPUNIT_ASSERT(!mxComponent.is());
}
+DECLARE_OOXMLIMPORT_TEST(testTdf103931, "tdf103931.docx")
+{
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+ // This was 2, the last (empty) section of the document was lost on import.
+ // (import test only: Columns/Sections do not round-trip well)
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xTextSections->getCount());
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakB, "tdf103975_notPageBreakB.docx")
{
// turn on View Formatting Marks to see these documents.
More information about the Libreoffice-commits
mailing list