tdf#156707 xmloff import: always provide ControlBorder property

The problem was that 3d textbox form controls
were imported as flat.

The default value for ControlBorder is 3d.

Since caolan's 7.5.4 63b8e8bda2,
all textboxes are initially created with a flat border instead of 3d.
Since 3d is the fo:border default (and never specified),
the newly created control had no override to force it to 3d.

So this patch forces passing a ControlBorder property.

On export, since the 3d property is the default value,
ControlBorder is no even provided as something to be exported,
and therefore only "solid" and "none"
are ever exported as fo:border qualifiers.

make CppunitTest_xmloff_style CPPUNIT_TEST_NAME=testTdf156707

Change-Id: Ib4541d5e3599dc42af6055062fd709e105bf5d14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174754
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Justin Luth
2024-10-10 18:52:22 +02:00
committed by Justin Luth
parent 683c005c2c
commit 5a617f77ee
3 changed files with 31 additions and 1 deletions
+25
View File
@@ -297,6 +297,31 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin)
}
}
CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testTdf156707)
{
// The file contains a shape with linear gradient fill from red #ff0000 to yellow #ffff00,
// named 'red2yellow'
loadFromFile(u"tdf156707_text_form_control_borders.odt");
saveAndReload(u"writer8"_ustr);
uno::Reference<drawing::XShape> xShape = getShape(0);
uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY_THROW);
sal_uInt16 nBorderStyle = 0; // 0 = none, 1 = 3d [default], 2 = flat
xShapeProperties->getPropertyValue(u"ControlBorder"_ustr) >>= nBorderStyle;
CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), nBorderStyle);
xShape = getShape(1);
xShapeProperties.set(xShape, uno::UNO_QUERY_THROW);
xShapeProperties->getPropertyValue(u"ControlBorder"_ustr) >>= nBorderStyle;
CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), nBorderStyle);
xShape = getShape(2);
xShapeProperties.set(xShape, uno::UNO_QUERY_THROW);
xShapeProperties->getPropertyValue(u"ControlBorder"_ustr) >>= nBorderStyle;
CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), nBorderStyle);
}
CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew)
{
// The file contains a shape with linear gradient fill from red #ff0000 to yellow #ffff00,
+6 -1
View File
@@ -212,8 +212,13 @@ namespace xmloff
if ( SvXMLUnitConverter::convertEnum( nStyle, sToken, aBorderTypeMap ) )
{
_rValue <<= nStyle;
return true;
}
else
{
// The internal LO default is flat, which deviates from the import default of 3d
_rValue <<= sal_uInt16(1);
}
return true;
}
// try interpreting it as color value