summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:44:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:44:47 +0000
commit91fe6b97952aa6f7cef58327fd085a17db38ad95 (patch)
tree7a4412295bfb80e15a4936fe67d4bd7b96458ce8 /oox
parentReleasing progress-linux version 4:24.2.1-4~progress7.99u1. (diff)
downloadlibreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.tar.xz
libreoffice-91fe6b97952aa6f7cef58327fd085a17db38ad95.zip
Merging upstream version 4:24.2.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/export.cxx58
-rw-r--r--oox/source/export/vmlexport.cxx7
2 files changed, 63 insertions, 2 deletions
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index aa9690efdb..bfee2e7ef8 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -9,6 +9,9 @@
#include <test/unoapixml_test.hxx>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+
using namespace ::com::sun::star;
namespace
@@ -70,6 +73,61 @@ 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");
+
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XText> xText = xTextDocument->getText();
+ uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ // 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", {});
+
+ xText->insertControlCharacter(xCursor, text::ControlCharacter::PARAGRAPH_BREAK, false);
+
+ dispatchCommand(mxComponent, ".uno:InsertCheckboxContentControl", {});
+
+ // Loading should not show the "corrupted" dialog, which would assert.
+ saveAndReload("Office Open XML Text");
+
+ // Now that we loaded it successfully, delete the controls,
+ // still with change-tracking enabled, and save.
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:Delete", {});
+
+ // Loading should not show the "corrupted" dialog, which would assert.
+ saveAndReload("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/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 1090b0857f..8438befa62 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -741,8 +741,11 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
Graphic aGraphic;
GraphicConverter::Import(aStream, aGraphic);
OUString aImageId = m_pTextExport->GetDrawingML().writeGraphicToStorage(aGraphic, false);
- pAttrList->add(FSNS(XML_r, XML_id), aImageId);
- imageData = true;
+ if (!aImageId.isEmpty())
+ {
+ pAttrList->add(FSNS(XML_r, XML_id), aImageId);
+ imageData = true;
+ }
}
if (rProps.GetOpt(ESCHER_Prop_fNoFillHitTest, nValue))