sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 4 ++-- sw/source/core/doc/textboxhelper.cxx | 1 - sw/source/filter/ww8/docxattributeoutput.cxx | 4 +++- writerfilter/qa/cppunittests/dmapper/SdtHelper.cxx | 2 +- writerfilter/qa/cppunittests/dmapper/data/sdt-run-rich-text.docx |binary 5 files changed, 6 insertions(+), 5 deletions(-)
New commits: commit 69a2c20b65347341f85e1d24c9de84b3b7e53089 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Jan 31 11:57:38 2023 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Feb 3 23:30:52 2023 +0100 tdf#153289: remove problematic assertion It is unclear what it should guarantee; but at least when ungrouping, SwDoc::UnGroupSelection copy-constructs a shared pointer (increasing the refcount), then a copy-constructed argument passed to lcl_CollectTextBoxesForSubGroupObj increases it once again, and then the assertion expectedly fails. Change-Id: I0cb5f303c67b2dc67d5583a9eb03fe405af3573d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146377 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index f253502e56a6..98fc0512acfd 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -1795,7 +1795,6 @@ SwFrameFormat* SwTextBoxNode::GetTextBox(const SdrObject* pDrawObject) const if (size_t(pTextBoxes.use_count()) != pTextBoxes->GetTextBoxCount() + size_t(1)) { SAL_WARN("sw.core", "SwTextBoxNode::GetTextBox(): RefCount and TexBox count mismatch!"); - assert(false); } } commit 82a937df8142da69f652e47c183b5dff1f82bc35 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Wed Jan 25 16:29:55 2023 -0500 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Feb 3 23:30:33 2023 +0100 tdf#151548 sw content controls: preserve tabIndex val="-1" Either we have to read sal_uInt32 (which I can't figure out how to do) or else we have to write it out as sal_Int32. Microsoft isn't much help here because their documentation does not give any example of a non-tabsltop, and one errata document indicates that MS Word simply ignores tabIndex altogether for Sdt (and ffData). According to the documentation, tabIndex is a CT_UnsignedDecimalNumber which we do not have in our model.xml so it was defined as being a CT_DecimalNumber which works fine for reading something human sensible like -1. However, in our exporting we were exporting a sal_uInt32 which creates large, all positive numbers which were not being read on import. Nothing I tried worked to read these large numbers. Perhaps it is even illegal to do so in MS formats? Since it doesn't seem to matter to MS Word, and for a human it is easier to understand -1, and it is easier to solve in export than import, I'm taking the easy road. Change-Id: I6b296703c9a37149d9e11f29901e6db32bd041b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146149 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index a04a7813f9c6..bfc09d934343 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -426,7 +426,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDateContentControlExport) xContentControlProps->setPropertyValue("Alias", uno::Any(OUString("myalias"))); xContentControlProps->setPropertyValue("Tag", uno::Any(OUString("mytag"))); xContentControlProps->setPropertyValue("Id", uno::Any(static_cast<sal_Int32>(123))); - xContentControlProps->setPropertyValue("TabIndex", uno::Any(sal_uInt32(2))); + xContentControlProps->setPropertyValue("TabIndex", uno::Any(sal_uInt32(4294967295))); // -1 xContentControlProps->setPropertyValue("Lock", uno::Any(OUString("sdtLocked"))); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); @@ -453,7 +453,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDateContentControlExport) assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:alias", "val", "myalias"); assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:tag", "val", "mytag"); assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:id", "val", "123"); - assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:tabIndex", "val", "2"); + assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:tabIndex", "val", "-1"); assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:lock", "val", "sdtLocked"); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 03b73dbaee84..b361e5b171a0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2441,8 +2441,10 @@ void DocxAttributeOutput::WriteContentControlStart() if (m_pContentControl->GetTabIndex()) { + // write the unsigned value as as if it were signed since that is all we can import + const sal_Int32 nTabIndex = static_cast<sal_Int32>(m_pContentControl->GetTabIndex()); m_pSerializer->singleElementNS(XML_w, XML_tabIndex, FSNS(XML_w, XML_val), - OString::number(m_pContentControl->GetTabIndex())); + OString::number(nTabIndex)); } if (!m_pContentControl->GetLock().isEmpty()) diff --git a/writerfilter/qa/cppunittests/dmapper/SdtHelper.cxx b/writerfilter/qa/cppunittests/dmapper/SdtHelper.cxx index fc99cd2e3416..6300a488b409 100644 --- a/writerfilter/qa/cppunittests/dmapper/SdtHelper.cxx +++ b/writerfilter/qa/cppunittests/dmapper/SdtHelper.cxx @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunRichText) sal_uInt32 nTabIndex = 0; xContentControlProps->getPropertyValue("TabIndex") >>= nTabIndex; // This was 0 - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(5), nTabIndex); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(4294967295), nTabIndex); OUString aLock; xContentControlProps->getPropertyValue("Lock") >>= aLock; // This was empty. diff --git a/writerfilter/qa/cppunittests/dmapper/data/sdt-run-rich-text.docx b/writerfilter/qa/cppunittests/dmapper/data/sdt-run-rich-text.docx index d5644f33e9d9..0d1004ef8a6e 100644 Binary files a/writerfilter/qa/cppunittests/dmapper/data/sdt-run-rich-text.docx and b/writerfilter/qa/cppunittests/dmapper/data/sdt-run-rich-text.docx differ