include/xmloff/txtimppr.hxx | 5 +- include/xmloff/txtprmap.hxx | 1 include/xmloff/xmlimppr.hxx | 5 +- sc/source/filter/xml/xmlstyli.cxx | 12 +--- sc/source/filter/xml/xmlstyli.hxx | 8 +-- xmloff/inc/XMLChartPropertySetMapper.hxx | 5 +- xmloff/qa/unit/data/tdf167358_label_form_control_borders.odt |binary xmloff/qa/unit/style.cxx | 27 +++++++++-- xmloff/source/chart/PropertyMaps.cxx | 4 - xmloff/source/draw/sdpropls.cxx | 2 xmloff/source/style/PageMasterImportPropMapper.cxx | 6 -- xmloff/source/style/PageMasterImportPropMapper.hxx | 5 +- xmloff/source/style/xmlimppr.cxx | 10 ++-- xmloff/source/text/txtimppr.cxx | 21 +------- 14 files changed, 56 insertions(+), 55 deletions(-)
New commits: commit 23be40db1965b4ea40abef7b8a3f29680d0aa3c6 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Thu Jul 10 09:28:07 2025 -0400 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Sat Jul 12 10:45:30 2025 +0200 tdf#167358 Revert "tdf#156707 xmloff import: always provide ControlBorder ... property #2" This reverts my 25.2 commits d4dad2e181fd2dc30c3916fd59c05745023a51c8 and 5a617f77ee803eb65051e93f659ef66433879052. Obviously this entire thing is just too broken for a simple guy like me to fix. It seems like each kind of control has its own definition of what should happen if the border is not specified. So much for ODF standardization of default style values... This makes it virtually impossible to force a setting at import time, and since styles (without specified fo:borders) could theoretically be shared between the different control types, it might also make it impossible to force an export as well? make CppunitTest_xmloff_style Change-Id: I0182878a16213ad2c7f06524fe85388aae86551f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187654 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins (cherry picked from commit 0ad0fc985cc4b1c8f05df1e64752ae045127c051) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187700 diff --git a/include/xmloff/txtimppr.hxx b/include/xmloff/txtimppr.hxx index 7078ec499f57..ca01450d825f 100644 --- a/include/xmloff/txtimppr.hxx +++ b/include/xmloff/txtimppr.hxx @@ -60,8 +60,9 @@ public: virtual ~XMLTextImportPropertyMapper() override; /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */ - virtual void finished(std::vector<XMLPropertyState>& rProperties, sal_Int32 nStartIndex, - sal_Int32 nEndIndex, const sal_uInt32 nPropType) const override; + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override; }; #endif // INCLUDED_XMLOFF_TXTIMPPR_HXX diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx index ab2cdb173424..9efbb085688c 100644 --- a/include/xmloff/txtprmap.hxx +++ b/include/xmloff/txtprmap.hxx @@ -204,7 +204,6 @@ #define CTF_FILLCOLOR (XML_TEXT_CTF_START + 174) #define CTF_PAGENUMBEROFFSET (XML_TEXT_CTF_START + 175) #define CTF_COMPLEX_COLOR (XML_TEXT_CTF_START + 176) -#define CTF_CONTROL_BORDER (XML_TEXT_CTF_START + 177) enum class TextPropMap { TEXT = 0, diff --git a/include/xmloff/xmlimppr.hxx b/include/xmloff/xmlimppr.hxx index 246d6de6aae6..92f195586601 100644 --- a/include/xmloff/xmlimppr.hxx +++ b/include/xmloff/xmlimppr.hxx @@ -112,8 +112,9 @@ public: const SvXMLNamespaceMap& rNamespaceMap ) const; /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */ - virtual void finished(std::vector<XMLPropertyState>& rProperties, sal_Int32 nStartIndex, - sal_Int32 nEndIndex, const sal_uInt32 nPropType) const; + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const; void CheckSpecialContext( const ::std::vector< XMLPropertyState >& rProperties, diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index b224c02d9b2f..61e069401a19 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -76,16 +76,14 @@ ScXMLCellImportPropertyMapper::~ScXMLCellImportPropertyMapper() { } -void ScXMLCellImportPropertyMapper::finished(std::vector<XMLPropertyState>& rProperties, - sal_Int32 nStartIndex, sal_Int32 nEndIndex, - const sal_uInt32 nPropType) const +void ScXMLCellImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const { static const sal_Int16 aPaddingCTF[4] = { CTF_SC_LEFTPADDING, CTF_SC_RIGHTPADDING, CTF_SC_TOPPADDING, CTF_SC_BOTTOMPADDING }; static const sal_Int16 aBorderCTF[4] = { CTF_SC_LEFTBORDER, CTF_SC_RIGHTBORDER, CTF_SC_TOPBORDER, CTF_SC_BOTTOMBORDER }; - SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex, nPropType); + SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex); XMLPropertyState* pAllPaddingProperty(nullptr); XMLPropertyState* pPadding[4] = { nullptr, nullptr, nullptr, nullptr }; XMLPropertyState* pNewPadding[4] = { nullptr, nullptr, nullptr, nullptr }; @@ -219,11 +217,9 @@ ScXMLRowImportPropertyMapper::~ScXMLRowImportPropertyMapper() { } -void ScXMLRowImportPropertyMapper::finished(std::vector<XMLPropertyState>& rProperties, - sal_Int32 nStartIndex, sal_Int32 nEndIndex, - const sal_uInt32 nPropType) const +void ScXMLRowImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const { - SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex, nPropType); + SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex); XMLPropertyState* pHeight(nullptr); XMLPropertyState* pOptimalHeight(nullptr); XMLPropertyState* pPageBreak(nullptr); diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx index 1d47ee618d0b..00749c4496b5 100644 --- a/sc/source/filter/xml/xmlstyli.hxx +++ b/sc/source/filter/xml/xmlstyli.hxx @@ -44,8 +44,8 @@ public: virtual ~ScXMLCellImportPropertyMapper() override; /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */ - virtual void finished(std::vector<XMLPropertyState>& rProperties, sal_Int32 nStartIndex, - sal_Int32 nEndIndex, const sal_uInt32 nPropType) const override; + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override; }; class ScXMLRowImportPropertyMapper : public SvXMLImportPropertyMapper @@ -60,8 +60,8 @@ public: virtual ~ScXMLRowImportPropertyMapper() override; /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */ - virtual void finished(std::vector<XMLPropertyState>& rProperties, sal_Int32 nStartIndex, - sal_Int32 nEndIndex, const sal_uInt32 nPropType) const override; + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override; }; class XMLTableStylesContext; diff --git a/xmloff/inc/XMLChartPropertySetMapper.hxx b/xmloff/inc/XMLChartPropertySetMapper.hxx index 5aeb4ee6706b..835dd3cc9a6c 100644 --- a/xmloff/inc/XMLChartPropertySetMapper.hxx +++ b/xmloff/inc/XMLChartPropertySetMapper.hxx @@ -94,8 +94,9 @@ public: const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap ) const override; - virtual void finished(std::vector<XMLPropertyState>& rProperties, sal_Int32 nStartIndex, - sal_Int32 nEndIndex, const sal_uInt32 nPropType) const override; + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/qa/unit/data/tdf167358_label_form_control_borders.odt b/xmloff/qa/unit/data/tdf167358_label_form_control_borders.odt new file mode 100644 index 000000000000..90fb24459d52 Binary files /dev/null and b/xmloff/qa/unit/data/tdf167358_label_form_control_borders.odt differ diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx index f1dcc07b4295..b16e09a42eca 100644 --- a/xmloff/qa/unit/style.cxx +++ b/xmloff/qa/unit/style.cxx @@ -300,8 +300,6 @@ 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); @@ -315,7 +313,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testTdf156707) xShape = getShape(1); xShapeProperties.set(xShape, uno::UNO_QUERY_THROW); xShapeProperties->getPropertyValue(u"ControlBorder"_ustr) >>= nBorderStyle; - CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), nBorderStyle); + // since tdf#152974, this shape SHOULD ACTUALLY have a 3d border (1), NOT a flat one(2). + CPPUNIT_ASSERT_EQUAL_MESSAGE("DID YOU FIX ME?", sal_uInt16(2), nBorderStyle); xShape = getShape(2); xShapeProperties.set(xShape, uno::UNO_QUERY_THROW); @@ -323,6 +322,28 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testTdf156707) CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), nBorderStyle); } +CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testTdf167358) +{ + // The file contains label form fields. Labels default to having no border. + loadFromFile(u"tdf167358_label_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 = SAL_MAX_UINT16; // 0 = none, 1 = 3d [default], 2 = flat + xShapeProperties->getPropertyValue(u"ControlBorder"_ustr) >>= nBorderStyle; + // In this case, no fo:border style element exists, so the default must be none. + CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), nBorderStyle); + + xShape = getShape(1); + xShapeProperties.set(xShape, uno::UNO_QUERY_THROW); + xShapeProperties->getPropertyValue(u"ControlBorder"_ustr) >>= nBorderStyle; + // In this case, the fo:border style element doesn't specify 3d/flat/none, + // so the default must be still be none. + 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, diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 8ec82c5b0479..141a67f35fc7 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -1050,9 +1050,7 @@ bool XMLChartImportPropertyMapper::handleSpecialItem( return bRet; } -void XMLChartImportPropertyMapper::finished(std::vector<XMLPropertyState>& /*rProperties*/, - sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/, - const sal_uInt32 /*nPropMap*/) const +void XMLChartImportPropertyMapper::finished( ::std::vector< XMLPropertyState >& /*rProperties*/, sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const { } diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 6706cf1400f2..2a987ad78e6c 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -289,7 +289,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] = // control attributes (border exists one more time for the text additions of shapes) GMAP( PROP_ControlSymbolColor, XML_NAMESPACE_DRAW, XML_SYMBOL_COLOR, XML_TYPE_COLOR, 0 ), GMAP( PROP_ControlBackground, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 ), - GMAP( PROP_ControlBorder, XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_CONTROL_BORDER ), + GMAP( PROP_ControlBorder, XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ), GMAP( PROP_ControlBorderColor, XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER_COLOR|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ), GMAP( PROP_ControlDataStyle, XML_NAMESPACE_STYLE,XML_DATA_STYLE_NAME, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_EXPORT|MID_FLAG_SPECIAL_ITEM, CTF_SD_CONTROL_SHAPE_DATA_STYLE ), GMAP( PROP_ControlTextEmphasis, XML_NAMESPACE_STYLE,XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 ), diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx index f0d1db882075..2b3a5cb209e1 100644 --- a/xmloff/source/style/PageMasterImportPropMapper.cxx +++ b/xmloff/source/style/PageMasterImportPropMapper.cxx @@ -85,11 +85,9 @@ bool PageMasterImportPropertyMapper::handleSpecialItem( } -void PageMasterImportPropertyMapper::finished(std::vector<XMLPropertyState>& rProperties, - sal_Int32 nStartIndex, sal_Int32 nEndIndex, - const sal_uInt32 nPropType) const +void PageMasterImportPropertyMapper::finished(std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const { - SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex, nPropType); + SvXMLImportPropertyMapper::finished(rProperties, nStartIndex, nEndIndex); XMLPropertyState* pAllPaddingProperty = nullptr; XMLPropertyState* pPadding[4] = { nullptr, nullptr, nullptr, nullptr }; XMLPropertyState* pNewPadding[4] = { nullptr, nullptr, nullptr, nullptr }; diff --git a/xmloff/source/style/PageMasterImportPropMapper.hxx b/xmloff/source/style/PageMasterImportPropMapper.hxx index 90c22f32d7a6..1493ffd6b96e 100644 --- a/xmloff/source/style/PageMasterImportPropMapper.hxx +++ b/xmloff/source/style/PageMasterImportPropMapper.hxx @@ -45,8 +45,9 @@ public: const SvXMLNamespaceMap& rNamespaceMap ) const override; /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */ - virtual void finished(std::vector<XMLPropertyState>& rProperties, sal_Int32 nStartIndex, - sal_Int32 nEndIndex, const sal_uInt32 nPropType) const override; + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index 7869bc49d42c..ef4b2bb24513 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -155,7 +155,7 @@ void SvXMLImportPropertyMapper::importXML( rAttribute.Name, rAttribute.NamespaceURL, rAttribute.Value); } - finished(rProperties, nStartIdx, nEndIdx, nPropType); + finished( rProperties, nStartIdx, nEndIdx ); } void SvXMLImportPropertyMapper::importXMLAttribute( @@ -747,13 +747,13 @@ bool SvXMLImportPropertyMapper::FillTolerantMultiPropertySet_( return bSuccessful; } -void SvXMLImportPropertyMapper::finished(std::vector<XMLPropertyState>& rProperties, - sal_Int32 nStartIndex, sal_Int32 nEndIndex, - const sal_uInt32 nPropType) const +void SvXMLImportPropertyMapper::finished( + std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const { // nothing to do here if( mxNextMapper ) - mxNextMapper->finished(rProperties, nStartIndex, nEndIndex, nPropType); + mxNextMapper->finished( rProperties, nStartIndex, nEndIndex ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index 0513be2445f3..7fde78724227 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -33,8 +33,6 @@ #include <xmloff/txtimppr.hxx> #include <xmloff/maptype.hxx> -#include <xmlsdtypes.hxx> - #define XML_LINE_LEFT 0 #define XML_LINE_RIGHT 1 #define XML_LINE_TOP 2 @@ -349,15 +347,14 @@ void lcl_SeparateBorder( } -void XMLTextImportPropertyMapper::finished(std::vector<XMLPropertyState>& rProperties, - sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/, - const sal_uInt32 nPropType) const +void XMLTextImportPropertyMapper::finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const { bool bHasAnyHeight = false; bool bHasAnyMinHeight = false; bool bHasAnyWidth = false; bool bHasAnyMinWidth = false; - bool bHasControlBorder = false; XMLPropertyState* pFontFamilyName = nullptr; XMLPropertyState* pFontStyleName = nullptr; @@ -423,8 +420,6 @@ void XMLTextImportPropertyMapper::finished(std::vector<XMLPropertyState>& rPrope switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ) ) { - case CTF_CONTROL_BORDER: bHasControlBorder = true; break; - case CTF_FONTFAMILYNAME: pFontFamilyName = property; break; case CTF_FONTSTYLENAME: pFontStyleName = property; break; case CTF_FONTFAMILY: pFontFamily = property; break; @@ -786,16 +781,6 @@ void XMLTextImportPropertyMapper::finished(std::vector<XMLPropertyState>& rPrope } } - // The internal LO default (app) is flat (at least for the ORichTextModel), - // which deviates from the import default (file) of 3d - so always provide as a property - if (!bHasControlBorder && nPropType == XML_TYPE_PROP_GRAPHIC) - { - const sal_Int32 nIndex = getPropertySetMapper()->FindEntryIndex(CTF_CONTROL_BORDER); - XMLPropertyState aControlBorderState(nIndex); - aControlBorderState.maValue <<= static_cast<sal_uInt16>(1); // 3d - rProperties.push_back(aControlBorderState); - } - if( bHasAnyHeight ) { if( m_nSizeTypeIndex == -2 )