summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-06-19 11:35:21 +0300
committerSzymon Kłos <szymon.klos@collabora.com>2018-06-29 10:29:33 +0200
commit4087130d0531a31456310bfe5c41a028dacd5a4d (patch)
tree2df8dd4185d6cf2c589ff4d71e6e56c3ef07b0c0
parent054a3586bb4808728a5cd58ea8a867539c08e55c (diff)
tdf#104199 sd: export non-borders as noFill
...followup to commit 76505bbd862b17b9b02a2d6e68bac308890dec70 which made the border invisible by setting the color to COL_AUTO. But being invisible isn't good enough because on a round-trip we are now losing the "noFill" attribute and saving a defined border. However, COL_AUTO is turned into white during import, in both LO and in MSO, so round-tripping displayed a white border instead of an invisible one. Change-Id: If6cb513ca6e4336e49bc56a9509aede2e1937063 Reviewed-on: https://gerrit.libreoffice.org/55658 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--oox/source/export/shapes.cxx5
-rw-r--r--sd/qa/unit/export-tests.cxx56
-rw-r--r--sd/qa/unit/import-tests.cxx56
3 files changed, 60 insertions, 57 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7b51e62b0059..410ef022fb28 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1756,7 +1756,10 @@ void ShapeExport::WriteBorderLine(const sal_Int32 XML_line, const BorderLine2& r
if ( nBorderWidth > 0 )
{
mpFS->startElementNS( XML_a, XML_line, XML_w, I32S(nBorderWidth), FSEND );
- DrawingML::WriteSolidFill( ::Color(rBorderLine.Color) );
+ if ( rBorderLine.Color == sal_Int32( COL_AUTO ) )
+ mpFS->singleElementNS( XML_a, XML_noFill, FSEND );
+ else
+ DrawingML::WriteSolidFill( ::Color(rBorderLine.Color) );
mpFS->endElementNS( XML_a, XML_line );
}
}
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index d14becc09924..0394b0ab92de 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -84,6 +84,7 @@ public:
void testTdf97630();
void testSwappedOutImageExport();
void testOOoXMLAnimations();
+ void testBnc480256();
void testUnknownAttributes();
void testTdf80020();
void testLinkedGraphicRT();
@@ -107,6 +108,7 @@ public:
CPPUNIT_TEST(testTdf97630);
CPPUNIT_TEST(testSwappedOutImageExport);
CPPUNIT_TEST(testOOoXMLAnimations);
+ CPPUNIT_TEST(testBnc480256);
CPPUNIT_TEST(testUnknownAttributes);
CPPUNIT_TEST(testTdf80020);
CPPUNIT_TEST(testLinkedGraphicRT);
@@ -519,6 +521,60 @@ void SdExportTest::testOOoXMLAnimations()
assertXPath(pXmlDoc, "//anim:par", 223);
}
+void SdExportTest::testBnc480256()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc480256.pptx"), PPTX);
+ // In the document, there are two tables with table background properties.
+ // Make sure colors are set properly for individual cells.
+
+ // TODO: If you are working on improving table background support, expect
+ // this unit test to fail. In that case, feel free to change the numbers.
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+
+ sdr::table::SdrTableObj *pTableObj;
+ uno::Reference< table::XCellRange > xTable;
+ uno::Reference< beans::XPropertySet > xCell;
+ sal_Int32 nColor;
+ table::BorderLine2 aBorderLine;
+
+ pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT( pTableObj );
+ xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+
+ xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillColor") >>= nColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(10208238), nColor);
+ xCell->getPropertyValue("LeftBorder") >>= aBorderLine;
+ CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color);
+
+ xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillColor") >>= nColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(13032959), nColor);
+ xCell->getPropertyValue("TopBorder") >>= aBorderLine;
+ CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color);
+
+ pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(1));
+ CPPUNIT_ASSERT( pTableObj );
+ xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+
+ xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillColor") >>= nColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(7056614), nColor);
+ xCell->getPropertyValue("LeftBorder") >>= aBorderLine;
+ CPPUNIT_ASSERT_EQUAL(util::Color(12505062), aBorderLine.Color);
+
+ xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("FillColor") >>= nColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4626400), nColor);
+
+ xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW);
+ xCell->getPropertyValue("BottomBorder") >>= aBorderLine;
+ CPPUNIT_ASSERT_EQUAL(util::Color(COL_AUTO), aBorderLine.Color);
+
+ xDocShRef->DoClose();
+}
+
void SdExportTest::testUnknownAttributes()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/unknown-attribute.fodp"), FODP);
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 21b78715f5d7..3159a7ed9ce8 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -128,7 +128,6 @@ public:
void testN862510_4();
void testBnc870237();
void testBnc887225();
- void testBnc480256();
void testBnc591147();
void testCreationDate();
void testBnc584721_1();
@@ -212,7 +211,6 @@ public:
CPPUNIT_TEST(testN862510_4);
CPPUNIT_TEST(testBnc870237);
CPPUNIT_TEST(testBnc887225);
- CPPUNIT_TEST(testBnc480256);
CPPUNIT_TEST(testBnc591147);
CPPUNIT_TEST(testCreationDate);
CPPUNIT_TEST(testBnc584721_1);
@@ -891,60 +889,6 @@ void SdImportTest::testBnc887225()
xDocShRef->DoClose();
}
-void SdImportTest::testBnc480256()
-{
- sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc480256.pptx"), PPTX);
- // In the document, there are two tables with table background properties.
- // Make sure colors are set properly for individual cells.
-
- // TODO: If you are working on improving table background support, expect
- // this unit test to fail. In that case, feel free to change the numbers.
-
- const SdrPage *pPage = GetPage( 1, xDocShRef );
-
- sdr::table::SdrTableObj *pTableObj;
- uno::Reference< table::XCellRange > xTable;
- uno::Reference< beans::XPropertySet > xCell;
- sal_Int32 nColor;
- table::BorderLine2 aBorderLine;
-
- pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
- CPPUNIT_ASSERT( pTableObj );
- xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
-
- xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
- xCell->getPropertyValue("FillColor") >>= nColor;
- CPPUNIT_ASSERT_EQUAL(sal_Int32(10208238), nColor);
- xCell->getPropertyValue("LeftBorder") >>= aBorderLine;
- CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color);
-
- xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
- xCell->getPropertyValue("FillColor") >>= nColor;
- CPPUNIT_ASSERT_EQUAL(sal_Int32(13032959), nColor);
- xCell->getPropertyValue("TopBorder") >>= aBorderLine;
- CPPUNIT_ASSERT_EQUAL(util::Color(5609427), aBorderLine.Color);
-
- pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(1));
- CPPUNIT_ASSERT( pTableObj );
- xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
-
- xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
- xCell->getPropertyValue("FillColor") >>= nColor;
- CPPUNIT_ASSERT_EQUAL(sal_Int32(7056614), nColor);
- xCell->getPropertyValue("LeftBorder") >>= aBorderLine;
- CPPUNIT_ASSERT_EQUAL(util::Color(12505062), aBorderLine.Color);
-
- xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW);
- xCell->getPropertyValue("FillColor") >>= nColor;
- CPPUNIT_ASSERT_EQUAL(sal_Int32(4626400), nColor);
-
- xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW);
- xCell->getPropertyValue("BottomBorder") >>= aBorderLine;
- CPPUNIT_ASSERT_EQUAL(util::Color(COL_AUTO), aBorderLine.Color);
-
- xDocShRef->DoClose();
-}
-
void SdImportTest::testBnc584721_1()
{
// Title text shape on the master page contained wrong text.