Kaydet (Commit) 4087130d authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Szymon Kłos

tdf#104199 sd: export non-borders as noFill

...followup to commit 76505bbd
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: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
Tested-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst 054a3586
......@@ -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 );
}
}
......
......@@ -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);
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment