sw/qa/extras/ooxmlexport/data/tdf158597.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 258 ++++++++++++++++++++++ sw/source/core/unocore/unomap1.cxx | 1 sw/source/core/unocore/unoobj.cxx | 14 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 5 files changed, 269 insertions(+), 6 deletions(-)
New commits: commit d7754f81494ff8f360f67d3ad9e404dbab268df8 Author: Michael Stahl <[email protected]> AuthorDate: Wed Feb 14 19:13:34 2024 +0100 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Feb 16 14:37:07 2024 +0100 tdf#158597 writerfilter,sw: fix toggle properties in ListAutoFormat ... for DOCX import. These can be set both via paragraph style and via character style in the w:pPr/w:rPr, so use the applyToggleAttributes(). Adding a test for this requires adding the "CharStyleName" property to GetAutoCharStylePropertyMap(). Change-Id: I9701d5ac82ec3e7757650c08861791dc398a1a77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163386 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit ff9be3fd30ead41359734f9281b034a988d71196) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163453 Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/data/tdf158597.docx b/sw/qa/extras/ooxmlexport/data/tdf158597.docx new file mode 100644 index 000000000000..ad7924ce71b3 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf158597.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index a9d01670aab6..1a13b17cd649 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -9,12 +9,15 @@ #include <swmodeltestbase.hxx> +#include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/text/XDocumentIndex.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/style/LineSpacing.hpp> #include <com/sun/star/style/LineSpacingMode.hpp> +#include <comphelper/sequenceashashmap.hxx> + #include <pam.hxx> #include <unotxdoc.hxx> #include <docsh.hxx> @@ -30,6 +33,261 @@ public: } }; +DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx") +{ + // test with 2 properties: font size, italic (toggle) + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(1)); + CPPUNIT_ASSERT_EQUAL(OUString("No style"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xRun, "CharPosture")); + CPPUNIT_ASSERT(!xProps->getPropertyValue("ListAutoFormat").hasValue()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(2)); + CPPUNIT_ASSERT_EQUAL(OUString("Char style mark"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT(!listAutoFormat["CharHeight"].hasValue()); + CPPUNIT_ASSERT(!listAutoFormat["CharPosture"].hasValue()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(3)); + CPPUNIT_ASSERT_EQUAL(OUString("Char style mark and text"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT(!listAutoFormat["CharHeight"].hasValue()); + CPPUNIT_ASSERT(!listAutoFormat["CharPosture"].hasValue()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(4)); + CPPUNIT_ASSERT_EQUAL(OUString("Char style text"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + CPPUNIT_ASSERT(!xProps->getPropertyValue("ListAutoFormat").hasValue()); + } + + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(5)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + CPPUNIT_ASSERT(!xProps->getPropertyValue("ListAutoFormat").hasValue()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(6)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style + Char style mark"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT(!listAutoFormat["CharHeight"].hasValue()); + // bug was that here the toggle property was not overwritten + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(7)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style + Char style mark and text"), + xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT(!listAutoFormat["CharHeight"].hasValue()); + // bug was that here the toggle property was not overwritten + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(8)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style + Char style text"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xRun, "CharPosture")); + CPPUNIT_ASSERT(!xProps->getPropertyValue("ListAutoFormat").hasValue()); + } + + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(9)); + CPPUNIT_ASSERT_EQUAL(OUString("No style + direct mark"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT(!listAutoFormat["CharStyleName"].hasValue()); + CPPUNIT_ASSERT_EQUAL(16.f, listAutoFormat["CharHeight"].get<float>()); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(10)); + CPPUNIT_ASSERT_EQUAL(OUString("Char style + direct mark"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(16.f, listAutoFormat["CharHeight"].get<float>()); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(11)); + CPPUNIT_ASSERT_EQUAL(OUString("Char style + direct mark and text"), + xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(16.f, listAutoFormat["CharHeight"].get<float>()); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(12)); + CPPUNIT_ASSERT_EQUAL(OUString("Char style + direct text"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + CPPUNIT_ASSERT(!xProps->getPropertyValue("ListAutoFormat").hasValue()); + } + + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(13)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style + direct mark"), xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT(!listAutoFormat["CharStyleName"].hasValue()); + CPPUNIT_ASSERT_EQUAL(16.f, listAutoFormat["CharHeight"].get<float>()); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(14)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style + Char style + direct mark"), + xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(16.f, listAutoFormat["CharHeight"].get<float>()); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(15)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style + Char style + direct mark and text"), + xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + comphelper::SequenceAsHashMap listAutoFormat(xProps->getPropertyValue("ListAutoFormat")); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), listAutoFormat["CharStyleName"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(16.f, listAutoFormat["CharHeight"].get<float>()); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + listAutoFormat["CharPosture"].get<awt::FontSlant>()); + } + { + uno::Reference<text::XTextRange> xParagraph(getParagraph(16)); + CPPUNIT_ASSERT_EQUAL(OUString("Para style + Char style + direct text"), + xParagraph->getString()); + uno::Reference<beans::XPropertySet> xProps(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph E"), + getProperty<OUString>(xProps, "ParaStyleName")); + uno::Reference<text::XTextRange> xRun(getRun(xParagraph, 1)); + CPPUNIT_ASSERT_EQUAL(OUString("Emphasis"), getProperty<OUString>(xRun, "CharStyleName")); + CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, + getProperty<awt::FontSlant>(xRun, "CharPosture")); + CPPUNIT_ASSERT(!xProps->getPropertyValue("ListAutoFormat").hasValue()); + } +} + DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx") { // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx index 67112cd7a003..686db9dfc944 100644 --- a/sw/source/core/unocore/unomap1.cxx +++ b/sw/source/core/unocore/unomap1.cxx @@ -307,6 +307,7 @@ o3tl::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetAutoChar { UNO_NAME_CHAR_BORDER_TOP_COMPLEX_COLOR, RES_CHRATR_BOX, cppu::UnoType<css::util::XComplexColor>::get(), PropertyAttribute::MAYBEVOID, MID_BORDER_TOP_COLOR }, { UNO_NAME_CHAR_BORDER_BOTTOM_COMPLEX_COLOR, RES_CHRATR_BOX, cppu::UnoType<css::util::XComplexColor>::get(), PropertyAttribute::MAYBEVOID, MID_BORDER_BOTTOM_COLOR }, { UNO_NAME_CHAR_SHADOW_FORMAT, RES_CHRATR_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, + { UNO_NAME_CHAR_STYLE_NAME, RES_TXTATR_CHARFMT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0 }, }; return aAutoCharStyleMap; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 14cceaee3f38..ec5e3e27170a 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -538,11 +538,6 @@ SwUnoCursorHelper::SetCursorPropertyValue( rMap.getByName(prop.Name); if (!pEntry) { - if (prop.Name == "CharStyleName") - { - lcl_setCharStyle(rPam.GetDoc(), prop.Value, items); - continue; - } throw beans::UnknownPropertyException( "Unknown property: " + prop.Name); } @@ -551,7 +546,14 @@ SwUnoCursorHelper::SetCursorPropertyValue( throw beans::PropertyVetoException( "Property is read-only: " + prop.Name); } - rPropSet.setPropertyValue(*pEntry, prop.Value, items); + if (prop.Name == "CharStyleName") + { + lcl_setCharStyle(rPam.GetDoc(), prop.Value, items); + } + else + { + rPropSet.setPropertyValue(*pEntry, prop.Value, items); + } } IStyleAccess& rStyleAccess = rPam.GetDoc().GetIStyleAccess(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 5fbec2fb965d..4fa434431555 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2526,6 +2526,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con lcl_AddRange(pToBeSavedProperties, xTextAppend, rAppendContext); } } + applyToggleAttributes(pPropertyMap); // for paragraph marker formatting std::vector<beans::PropertyValue> aProperties; if (pPropertyMap) { @@ -2999,6 +3000,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con } +// TODO this does not yet take table styles into account void DomainMapper_Impl::applyToggleAttributes(const PropertyMapPtr& pPropertyMap) { std::optional<PropertyMap::Property> charStyleProperty = pPropertyMap->getProperty(PROP_CHAR_STYLE_NAME);
