sw/qa/extras/uiwriter/uiwriter2.cxx | 13 +++++++++++ sw/source/core/doc/DocumentRedlineManager.cxx | 4 +++ sw/source/core/unocore/unocrsrhelper.cxx | 30 ++++++++++++++++++++++---- 3 files changed, 43 insertions(+), 4 deletions(-)
New commits: commit 6eccbbd22a46ea26bf90de94a97d55339a53cc0d Author: László Németh <nem...@numbertext.org> AuthorDate: Wed Jul 10 19:45:54 2019 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Jul 12 13:48:10 2019 +0200 tdf#126245 DOCX: reject tracked paragraph numbering changes during editing. Fix also import of change tracking data with unknown or read-only properties (use correct name-value pairs). Change-Id: I7c31393673ade5458d437268aab9200e8b2fdbdb Reviewed-on: https://gerrit.libreoffice.org/75354 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 5818597caae4..f5b98fc4cb84 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1695,6 +1695,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf120338) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(getParagraph(5), "ParaAdjust")); // right + CPPUNIT_ASSERT_EQUAL(OUString(""), + getProperty<OUString>(getParagraph(7), "NumberingStyleName")); + + CPPUNIT_ASSERT_EQUAL(OUString("WWNum2"), + getProperty<OUString>(getParagraph(8), "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), getProperty<OUString>(getParagraph(10), "ParaStyleName")); CPPUNIT_ASSERT_EQUAL(OUString("Heading 2"), @@ -1712,6 +1718,13 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf120338) CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(5), "ParaAdjust")); // left + // tdf#126245 revert numbering changes + CPPUNIT_ASSERT_EQUAL(OUString("WWNum2"), + getProperty<OUString>(getParagraph(7), "NumberingStyleName")); + + CPPUNIT_ASSERT_EQUAL(OUString(""), + getProperty<OUString>(getParagraph(8), "NumberingStyleName")); + // tdf#126243 revert paragraph styles CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty<OUString>(getParagraph(10), "ParaStyleName")); diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 63283b91ed5b..0c63b61e8226 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -688,6 +688,10 @@ namespace } rDoc.ResetAttrs(aPam, false, aResetAttrsArray); + + // remove numbering + if ( pTNd->GetNumRule() ) + rDoc.DelNumRules(aPam); } } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index db66adb2fd0a..6fbe3f75f3c7 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -91,6 +91,7 @@ #include <txtfld.hxx> #include <unoparagraph.hxx> #include <poolfmt.hxx> +#include <paratr.hxx> #include <sal/log.hxx> using namespace ::com::sun::star; @@ -1230,7 +1231,10 @@ void makeRedline( SwPaM const & rPaM, // Build set of attributes we want to fetch std::vector<sal_uInt16> aWhichPairs; std::vector<SfxItemPropertySimpleEntry const*> aEntries; + std::vector<uno::Any> aValues; aEntries.reserve(aRevertProperties.getLength()); + sal_uInt16 nStyleId = USHRT_MAX; + sal_uInt16 nNumId = USHRT_MAX; for (const auto& rRevertProperty : aRevertProperties) { const OUString &rPropertyName = rRevertProperty.Name; @@ -1245,13 +1249,22 @@ void makeRedline( SwPaM const & rPaM, { break; } + else if (rPropertyName == "NumberingRules") + { + aWhichPairs.push_back(RES_PARATR_NUMRULE); + aWhichPairs.push_back(RES_PARATR_NUMRULE); + nNumId = aEntries.size(); + } else { // FIXME: we should have some nice way of merging ranges surely ? aWhichPairs.push_back(pEntry->nWID); aWhichPairs.push_back(pEntry->nWID); + if (rPropertyName == "ParaStyleName") + nStyleId = aEntries.size(); } aEntries.push_back(pEntry); + aValues.push_back(rRevertProperty.Value); } if (!aWhichPairs.empty()) @@ -1264,11 +1277,20 @@ void makeRedline( SwPaM const & rPaM, for (size_t i = 0; i < aEntries.size(); ++i) { SfxItemPropertySimpleEntry const*const pEntry = aEntries[i]; - const uno::Any &rValue = aRevertProperties[i].Value; - rPropSet.setPropertyValue(*pEntry, rValue, aItemSet); - - if ( aRevertProperties[i].Name == "ParaStyleName" ) + const uno::Any &rValue = aValues[i]; + if (i == nNumId) + { + uno::Reference<container::XNamed> xNumberingRules; + rValue >>= xNumberingRules; + if (xNumberingRules.is()) + aItemSet.Put( SwNumRuleItem( xNumberingRules->getName() )); + } + else + { + rPropSet.setPropertyValue(*pEntry, rValue, aItemSet); + if (i == nStyleId) rValue >>= sParaStyleName; + } } if (eType == RedlineType::ParagraphFormat && sParaStyleName.isEmpty()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits