tdf#147766 Export empty lines as line with noFill

We have a case that 0 width line but has auto color. If that case
exported there is no line over there, LO handles normally but MSO draws
back borders as default. To prevent this we have to export them as line
with noFill.

testTableBorderLineStyle change reverts a workaround for
3faf005a36

testBnc480256 Cell(1,0) still invisible. We are just checking
this with another way.

Change-Id: If5f6d2dbdba5c295d58307fcfe3b37629ede8a8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131532
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
This commit is contained in:
Gülşah Köse
2022-03-17 08:05:06 +01:00
parent 345149ef7b
commit f8ac4be066
4 changed files with 10 additions and 11 deletions
+1 -9
View File
@@ -73,20 +73,12 @@ static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 );
aBorderLine.LineDistance = 0;
}
else if ( rLineProperties.moLineWidth.get(0)!=0 )
{
aBorderLine.Color = sal_Int32( COL_AUTO );
aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 );
aBorderLine.LineDistance = 0;
}
else
{
aBorderLine.Color = sal_Int32( COL_AUTO );
aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
aBorderLine.LineWidth = 12700;
aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 );
aBorderLine.LineDistance = 0;
}
+6
View File
@@ -1995,6 +1995,12 @@ void ShapeExport::WriteBorderLine(const sal_Int32 XML_line, const BorderLine2& r
DrawingML::WriteSolidFill( ::Color(ColorTransparency, rBorderLine.Color) );
mpFS->endElementNS( XML_a, XML_line );
}
else if( nBorderWidth == 0)
{
mpFS->startElementNS(XML_a, XML_line);
mpFS->singleElementNS(XML_a, XML_noFill);
mpFS->endElementNS( XML_a, XML_line );
}
}
void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPropSet)
+2 -1
View File
@@ -602,9 +602,10 @@ void SdExportTest::testBnc480256()
xCell->getPropertyValue("FillColor") >>= nColor;
CPPUNIT_ASSERT_EQUAL(Color(0x4697e0), nColor);
// This border should be invisible.
xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW);
xCell->getPropertyValue("BottomBorder") >>= aBorderLine;
CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, aBorderLine.Color));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), sal_Int32(aBorderLine.LineWidth));
xDocShRef->DoClose();
}
+1 -1
View File
@@ -1456,7 +1456,7 @@ void SdImportTest::testTableBorderLineStyle()
xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW);
xCell->getPropertyValue("TopBorder") >>= aBorderLine;
if (aBorderLine.Color != -1) {
if (aBorderLine.LineWidth > 0) {
CPPUNIT_ASSERT_EQUAL(nObjBorderLineStyles[i], aBorderLine.LineStyle);
}
}