summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf129575-directAfter.docxbin0 -> 18625 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf129575-directBefore.docxbin0 -> 19246 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf129575-docDefault.docxbin0 -> 38088 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf129575-styleAfter.docxbin0 -> 18620 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport6.cxx6
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx65
6 files changed, 68 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129575-directAfter.docx b/sw/qa/extras/ooxmlexport/data/tdf129575-directAfter.docx
new file mode 100644
index 000000000000..c9856b02857b
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf129575-directAfter.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129575-directBefore.docx b/sw/qa/extras/ooxmlexport/data/tdf129575-directBefore.docx
new file mode 100644
index 000000000000..5e75ef1be5d2
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf129575-directBefore.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129575-docDefault.docx b/sw/qa/extras/ooxmlexport/data/tdf129575-docDefault.docx
new file mode 100644
index 000000000000..d7cdf2ec4308
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf129575-docDefault.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129575-styleAfter.docx b/sw/qa/extras/ooxmlexport/data/tdf129575-styleAfter.docx
new file mode 100644
index 000000000000..97439011ff55
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf129575-styleAfter.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index cd1665489db5..4eae1b2a33df 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -465,9 +465,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119054, "tdf119054.docx")
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
- // Don't overwrite before and after spacing of Heading2 by table style
- assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "before");
- assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after");
+ // Overwrite applied table style with before and after spacing of Heading2
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "before", "0");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after", "360");
// Use table style based single line spacing instead of the docDefaults' 254
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "line", "240");
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index e396ac0bea0b..9d6642a153ec 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/LineSpacingMode.hpp>
+//#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
@@ -159,6 +160,70 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106690Cell, "tdf106690-cell.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraphOfText(2, xCell->getText()), "ParaBottomMargin"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf129575_directBefore, "tdf129575-directBefore.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ // direct paragraph formatting
+ // This was 212 twips from the table style, but always direct paragraph formatting wins, in the case of the default 0 margin, too
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaTopMargin"));
+ // default margin
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf129575_directAfter, "tdf129575-directAfter.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ // from table style
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaTopMargin"));
+ // direct paragraph formatting
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf129575_styleAfter, "tdf129575-styleAfter.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ // direct paragraph formatting
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaTopMargin"));
+ // from table style
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf129575_docDefault, "tdf129575-docDefault.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ // docDefault defines both bottom margin and line spacing, but
+ // applied bottom margin values are based on non-docDefault paragraph styles, line spacing is based on table style
+
+ // docDefault: <w:spacing w:after="160" w:line="320" w:lineRule="auto"/>
+ // table style: <w:spacing w:after="0" w:line="240" w:lineRule="auto"/> (single line space, overwriting bigger docDefault)
+
+ // Paragraph style Normal: <w:spacing w:after="160"/> (same as docDefault),
+ // table style based single line spacing
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(282), getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), "ParaBottomMargin"));
+ style::LineSpacing aLineSpacing = getProperty<style::LineSpacing>(getParagraphOfText(1, xCell->getText()), "ParaLineSpacing");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aLineSpacing.Height);
+ // Heading 2: <w:spacing w:after="360"/> (different from docDefault),
+ // table style based single line spacing
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(635), getProperty<sal_Int32>(getParagraphOfText(2, xCell->getText()), "ParaBottomMargin"));
+ aLineSpacing = getProperty<style::LineSpacing>(getParagraphOfText(1, xCell->getText()), "ParaLineSpacing");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aLineSpacing.Height);
+
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf106970, "tdf106970.docx")
{
// The second paragraph (first numbered one) had 0 bottom margin: