editeng/source/items/borderline.cxx | 4 +- sw/qa/extras/rtfimport/data/fdo68779.rtf | 25 ++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 62 +++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-)
New commits: commit baac2e214ff41b18e33ad5d4e054d765ddb2b3d6 Author: Michael Stahl <mst...@redhat.com> Date: Fri Mar 14 19:03:09 2014 +0100 fdo#68779: RTF import: set borders without explicit width Word reportedly uses 0.75pt as a default if \brdrw is missing. Change-Id: I263c56f756c65ff6bb30870aa70806564d5826a6 (cherry picked from commit 84f4de3b65cd0f861e80c69b773004f28f9f8d9f) Reviewed-on: https://gerrit.libreoffice.org/8594 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit 93f8e87dc7f488bbbfd8a748e47ce53936824391) Reviewed-on: https://gerrit.libreoffice.org/8598 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index b393420..38c61e0 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 0000000..5dc7683 --- /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 73bf749..0a16ab4 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1482,6 +1482,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.
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits