tdf#165636 - FILESAVE PPTX: fix extra table border lines shown

Export correctly the transparency value of table borders.

Change-Id: I22ee5e29d1846295645ce5934149cf864a178bb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182741
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
This commit is contained in:
Balazs Varga
2025-03-10 15:14:22 +01:00
parent fb0b4878d3
commit d532407e12
4 changed files with 26 additions and 19 deletions

View File

@@ -2517,7 +2517,13 @@ void ShapeExport::WriteBorderLine(const sal_Int32 xml_line_element, const Border
if ( rBorderLine.Color == sal_Int32( COL_AUTO ) )
mpFS->singleElementNS(XML_a, XML_noFill);
else
DrawingML::WriteSolidFill( ::Color(ColorTransparency, rBorderLine.Color) );
{
::Color nColor(ColorTransparency, rBorderLine.Color);
if (nColor.IsTransparent())
DrawingML::WriteSolidFill( nColor, nColor.GetAlpha() );
else
DrawingML::WriteSolidFill( nColor );
}
OUString sBorderStyle;
sal_Int16 nStyle = rBorderLine.LineStyle;

Binary file not shown.

View File

@@ -2101,6 +2101,25 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testSvgImageSupport)
}
}
CPPUNIT_TEST_FIXTURE(SdExportTest, testTableBordersTransparancy)
{
createSdImpressDoc("pptx/tdf164936.pptx");
saveAndReload(u"Impress Office Open XML"_ustr);
const SdrPage* pPage = GetPage(1);
sdr::table::SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
CPPUNIT_ASSERT(pTableObj);
uno::Reference<table::XCellRange> xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xCellPropSet;
table::BorderLine2 aBorderLine;
xCellPropSet.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
xCellPropSet->getPropertyValue(u"LeftBorder"_ustr) >>= aBorderLine;
CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xff2670c9),
Color(ColorTransparency, aBorderLine.Color));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -305,24 +305,6 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testTableStyle)
CPPUNIT_ASSERT_EQUAL(Color(0x5b9bd5), nFillColor);
}
CPPUNIT_TEST_FIXTURE(SdImportTest, testTableBorderTransparent)
{
createSdImpressDoc("pptx/tdf164936.pptx");
const SdrPage* pPage = GetPage(1);
sdr::table::SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
CPPUNIT_ASSERT(pTableObj);
uno::Reference<table::XCellRange> xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xCellPropSet;
table::BorderLine2 aBorderLine;
xCellPropSet.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
xCellPropSet->getPropertyValue(u"LeftBorder"_ustr) >>= aBorderLine;
CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xff2670c9),
Color(ColorTransparency, aBorderLine.Color));
}
CPPUNIT_TEST_FIXTURE(SdImportTest, testFreeformShapeGluePoints)
{
createSdImpressDoc("pptx/tdf156829.pptx");