summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-01-25 01:37:00 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-01-25 07:25:16 +0000
commitd183daea1abbd7b564d083298874dd7c40d5a5b3 (patch)
tree0131aee6f41f5e7aaf3e963c631a7e89af834fc5 /xmloff
parent5c312c986eac570af1c8c3210bdcbde213aae6dc (diff)
tdf#153161: (Ab)use a call to XTextRange::getString to flush edits
Restore the call (without checking its returned value), removed in commit d194474aabd699806cb3631bc8641dd0548b8026 ("tdf#151100: xText->getString() may be empty for content needing export", 2022-09-22), side effects of which obviously allow some object's changes to get flushed and saved. Change-Id: I62f27cd056c32ad76f79a4862e2f4a0964eaadef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146106 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/shapeexport.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 39d9eabb5971..3e0786e6ea77 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -310,6 +310,18 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap
uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
if (xText.is())
{
+ try
+ {
+ // tdf#153161: it seems that the call to XTextRange::getString flushes the changes
+ // for some objects, that otherwise fail to get exported correctly. Maybe at some
+ // point it would make sense to find a better place for more targeted flush.
+ xText->getString();
+ }
+ catch (uno::RuntimeException const&)
+ {
+ // E.g., SwXTextFrame that contains only a table will throw; this is not an error
+ }
+
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("IsEmptyPresentationObject") )