summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-06-19 11:35:21 +0300
committerJustin Luth <justin_luth@sil.org>2018-07-02 06:28:12 +0200
commit48c736a50525b7e72e57d511f61c4328fef10207 (patch)
treed1ecd01defadfdff0b9fe2a8870afe74f537e777
parentbda21b487f4899fb42ff24515b27e2344ccf9a50 (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> (cherry picked from commit 4087130d0531a31456310bfe5c41a028dacd5a4d) Reviewed-on: https://gerrit.libreoffice.org/56747
-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 6e4442502b5d..95cc968f76ff 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1758,7 +1758,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 165d212fd956..b75e4aad24cf 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -82,6 +82,7 @@ public:
void testTdf97630();
void testSwappedOutImageExport();
void testOOoXMLAnimations();
+ void testBnc480256();
void testUnknownAttributes();
void testTdf80020();
void testLinkedGraphicRT();
@@ -105,6 +106,7 @@ public:
CPPUNIT_TEST(testTdf97630);
CPPUNIT_TEST(testSwappedOutImageExport);
CPPUNIT_TEST(testOOoXMLAnimations);
+ CPPUNIT_TEST(testBnc480256);
CPPUNIT_TEST(testUnknownAttributes);
CPPUNIT_TEST(testTdf80020);
CPPUNIT_TEST(testLinkedGraphicRT);
@@ -517,6 +519,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 242bddfd2c3a..b9d7b21db3aa 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -127,7 +127,6 @@ public:
void testN862510_4();
void testBnc870237();
void testBnc887225();
- void testBnc480256();
void testBnc591147();
void testCreationDate();
void testBnc584721_1();
@@ -211,7 +210,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);
@@ -890,60 +888,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.