summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/items/borderline.cxx4
-rw-r--r--sw/qa/extras/rtfimport/data/fdo68779.rtf25
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx62
3 files changed, 90 insertions, 1 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index b919e58b5aab..d3eef130e64c 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -177,9 +177,11 @@ static const double OUTSET_line1 = 15.0;
static const double INSET_line2 = 15.0;
double
-ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth,
+ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const i_fWidth,
int const nWordLineStyle)
{
+ // fdo#68779: at least for RTF, 0.75pt is the default if width is missing
+ double const fWidth((i_fWidth == 0.0) ? 15.0 : i_fWidth);
switch (eStyle)
{
// Single lines
diff --git a/sw/qa/extras/rtfimport/data/fdo68779.rtf b/sw/qa/extras/rtfimport/data/fdo68779.rtf
new file mode 100644
index 000000000000..5dc7683fc858
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo68779.rtf
@@ -0,0 +1,25 @@
+{\rtf1\ansi\ansicpg1251
+\paperw11907\paperh16840\psz9\margl1418\margr1984\margt2438\margb1531
+{\colortbl\red0\green0\blue0;}\deflang1049
+
+\trowd
+\clbrdrt\brdrs\clbrdrl\brdrs\clbrdrb\brdrs\clbrdrr\brdrs\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\trowd
+\clbrdrt\brdrdot\clbrdrl\brdrdot\clbrdrb\brdrdot\clbrdrr\brdrdot\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\trowd
+\clbrdrt\brdrdb\clbrdrl\brdrdb\clbrdrb\brdrdb\clbrdrr\brdrdb\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\trowd
+\clbrdrt\brdrtnthmg\clbrdrl\brdrtnthmg\clbrdrb\brdrtnthmg\clbrdrr\brdrtnthmg\cellx8335
+\pard\plain \intbl foo\cell \pard \intbl \row
+\pard \par
+
+\pard \par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index f11f5ea4133f..0be7aff4a017 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1484,6 +1484,68 @@ DECLARE_RTFIMPORT_TEST(testFdo65090, "fdo65090.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
}
+DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf")
+{
+ // table borders without \brdrw were not imported
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->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);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 solid(
+ 1, 0, 26, 0, table::BorderLineStyle::SOLID, 26);
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(solid,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+
+ xTable.set(xTables->getByIndex(1), uno::UNO_QUERY);
+ xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 dotted(
+ 1, 0, 26, 0, table::BorderLineStyle::DOTTED, 26);
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+
+ xTable.set(xTables->getByIndex(2), uno::UNO_QUERY);
+ xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 doubled(
+ 1, 26, 26, 26, table::BorderLineStyle::DOUBLE, 79);
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+
+ xTable.set(xTables->getByIndex(3), uno::UNO_QUERY);
+ xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xCell.is());
+ table::BorderLine2 thinThickMG(
+ 1, 14, 26, 14, table::BorderLineStyle::THINTHICK_MEDIUMGAP, 53);
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "LeftBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "RightBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "TopBorder"));
+ CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
+ getProperty<table::BorderLine2>(xCell, "BottomBorder"));
+}
+
DECLARE_RTFIMPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf")
{
// Test that shpz has priority over dhght and not the other way around.