summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-03-19 00:11:33 +0300
committerAron Budea <aron.budea@collabora.com>2018-04-03 15:45:14 +0200
commit3a53fe4456f72dd57640b5bb33c5f08da96069f7 (patch)
treef5b700bf8c2dd1d79b7dec8991b846571c6a1a9b
parentfb05893bf019abc1fd0cfea64e32de10f2707b4f (diff)
tdf#116472: import "auto" border color as black
Since commit fe6da2feb57c3d5e355a36f6b8ac09b48412ff39, "auto" color is supported in OOXML import. Since ODF doesn't support "auto" color as border color, just convert "auto" border color to black on import, like is done in GetLineIndex in ww8par6.cxx. Incidentally, this also fixes a problem in RTF import, where we used to import black borders ("\red0\green0\blue0;" entries in color table) as 0x000001 ("\red0\green0\blue1;") - see fixed tests in rtfimport.cxx. Change-Id: I4f5e720d215b51c8a43dc7c58f338741bd608efc Reviewed-on: https://gerrit.libreoffice.org/51519 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/51585 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/52272 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx16
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx16
-rw-r--r--writerfilter/source/dmapper/ConversionHelper.cxx9
3 files changed, 23 insertions, 18 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index fb5fcfba122d..779d210259da 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -654,43 +654,43 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color = '000000']", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color = '000000']", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:color = '000000']", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:color = '000000']", 1);
//Table Cell Borders
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:color = '000000']", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom[@w:color = '000000']", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideH[@w:color = '000000']", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:sz = 4]", 1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:color = 'auto']", 1);
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:insideV[@w:color = '000000']", 1);
}
DECLARE_OOXMLEXPORT_TEST(testFdo77129, "fdo77129.docx")
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index f6ad57b75bab..18730e123084 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1664,7 +1664,8 @@ DECLARE_RTFIMPORT_TEST(testNestedTable, "rhbz1065629.rtf")
xTable.set(xTables->getByIndex(2), uno::UNO_QUERY);
xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY);
CPPUNIT_ASSERT(xCell.is());
- table::BorderLine2 fullPtSolid(1, 0, 35, 0, table::BorderLineStyle::SOLID, 35);
+ table::BorderLine2 fullPtSolid(sal_Int32(COL_BLACK), 0, 35, 0, table::BorderLineStyle::SOLID,
+ 35);
CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
getProperty<table::BorderLine2>(xCell, "LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid,
@@ -1676,7 +1677,8 @@ DECLARE_RTFIMPORT_TEST(testNestedTable, "rhbz1065629.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC0000), getProperty<sal_Int32>(xCell, "BackColor"));
xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY);
CPPUNIT_ASSERT(xCell.is());
- table::BorderLine2 halfPtSolid(/*0*/1, 0, 18, 0, table::BorderLineStyle::SOLID, 18);
+ table::BorderLine2 halfPtSolid(sal_Int32(COL_BLACK), 0, 18, 0, table::BorderLineStyle::SOLID,
+ 18);
CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid,
getProperty<table::BorderLine2>(xCell, "LeftBorder"));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff),
@@ -1764,7 +1766,7 @@ DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf")
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);
+ table::BorderLine2 solid(sal_Int32(COL_BLACK), 0, 26, 0, table::BorderLineStyle::SOLID, 26);
CPPUNIT_ASSERT_BORDER_EQUAL(solid,
getProperty<table::BorderLine2>(xCell, "LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(solid,
@@ -1777,7 +1779,7 @@ DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf")
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);
+ table::BorderLine2 dotted(sal_Int32(COL_BLACK), 0, 26, 0, table::BorderLineStyle::DOTTED, 26);
CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
getProperty<table::BorderLine2>(xCell, "LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(dotted,
@@ -1790,7 +1792,8 @@ DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf")
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);
+ table::BorderLine2 doubled(sal_Int32(COL_BLACK), 26, 26, 26, table::BorderLineStyle::DOUBLE,
+ 79);
CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
getProperty<table::BorderLine2>(xCell, "LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(doubled,
@@ -1803,7 +1806,8 @@ DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf")
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);
+ table::BorderLine2 thinThickMG(sal_Int32(COL_BLACK), 14, 26, 14,
+ table::BorderLineStyle::THINTHICK_MEDIUMGAP, 53);
CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
getProperty<table::BorderLine2>(xCell, "LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG,
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index 3e342ebd3395..f86b5391b092 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -246,16 +246,17 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineToken,
{
// The first item means automatic color (COL_AUTO), but we
// do not use it anyway (see the next statement) .-)
- 0, COL_BLACK, COL_LIGHTBLUE, COL_LIGHTCYAN, COL_LIGHTGREEN,
+ // See also GetLineIndex in sw/source/filter/ww8/ww8par6.cxx
+ sal_Int32(COL_AUTO), COL_BLACK, COL_LIGHTBLUE, COL_LIGHTCYAN, COL_LIGHTGREEN,
COL_LIGHTMAGENTA, COL_LIGHTRED, COL_YELLOW, COL_WHITE, COL_BLUE,
COL_CYAN, COL_GREEN, COL_MAGENTA, COL_RED, COL_BROWN, COL_GRAY,
COL_LIGHTGRAY
};
- //no auto color for borders
- if(!nLineColor)
- ++nLineColor;
if(!bIsOOXML && sal::static_int_cast<sal_uInt32>(nLineColor) < SAL_N_ELEMENTS(aBorderDefColor))
nLineColor = aBorderDefColor[nLineColor];
+ //no auto color for borders
+ if (nLineColor == sal_Int32(COL_AUTO))
+ nLineColor = sal_Int32(COL_BLACK);
sal_Int32 nLineType = lcl_convertBorderStyleFromToken(nLineToken);