diff options
-rw-r--r-- | oox/qa/unit/export.cxx | 39 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 5 |
2 files changed, 44 insertions, 0 deletions
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index aa9690efdb4a..4ad6dce4e288 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -70,6 +70,45 @@ CPPUNIT_TEST_FIXTURE(Test, testRotatedShapePosition) assertXPath(pXmlDoc, "//wpg:wgp/wps:wsp[1]/wps:spPr/a:xfrm/a:off"_ostr, "y"_ostr, "469440"); } +CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControlOdt) +{ + loadFromFile(u"tdf141786_RotatedShapeInGroup.odt"); + + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + dispatchCommand(mxComponent, ".uno:InsertCheckboxContentControl", {}); + + save("Office Open XML Text"); + // validate(maTempFile.GetFileName(), test::OOXML); // Enable when unrelated errors are fixed. +} + +CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControlDocx) +{ + { + loadFromFile(u"dml-groupshape-polygon.docx"); + + // Without TrackChanges, inserting the Checkbox works just fine + // when exporting to docx. + dispatchCommand(mxComponent, ".uno:InsertCheckboxContentControl", {}); + + save("Office Open XML Text"); + // validate(maTempFile.GetFileName(), test::OOXML); // Enable when unrelated errors are fixed. + } + + { + loadFromFile(u"dml-groupshape-polygon.docx"); + + // With TrackChanges, the Checkbox causes an assertion in the sax serializer, + // in void sax_fastparser::FastSaxSerializer::endFastElement(sal_Int32). + // Element == maMarkStack.top()->m_DebugStartedElements.back() + // sax/source/tools/fastserializer.cxx#402 + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + dispatchCommand(mxComponent, ".uno:InsertCheckboxContentControl", {}); + + save("Office Open XML Text"); + // validate(maTempFile.GetFileName(), test::OOXML); // Enable when unrelated errors are fixed. + } +} + CPPUNIT_TEST_FIXTURE(Test, testDmlGroupshapePolygon) { // Given a document with a group shape, containing a single polygon child shape: diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 4b2402fc93c8..0054eca4cb34 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -115,6 +115,7 @@ #include <frmtool.hxx> #include <viewopt.hxx> +#include <IDocumentRedlineAccess.hxx> #include <IDocumentUndoRedo.hxx> #include <UndoInsert.hxx> #include <UndoCore.hxx> @@ -1177,8 +1178,12 @@ void SwWrtShell::InsertContentControl(SwContentControlType eType) Left(SwCursorSkipMode::Chars, /*bSelect=*/true, aPlaceholder.getLength(), /*bBasicCall=*/false); } + + const RedlineFlags oldRedlineFlags = getIDocumentRedlineAccess().GetRedlineFlags(); + getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::Ignore); SwFormatContentControl aContentControl(pContentControl, RES_TXTATR_CONTENTCONTROL); SetAttrItem(aContentControl); + getIDocumentRedlineAccess().SetRedlineFlags(oldRedlineFlags); } // Insert footnote |