xmloff/source/draw/shapeexport.cxx | 4 ++-- xmloff/source/forms/layerexport.cxx | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-)
New commits: commit aef44ca736e5d6921b5350e5e61767f74d17b4a8 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Fri Feb 7 12:53:22 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Feb 11 22:28:53 2025 +0100 tdf#120397 - odf export fix missing texts in text box control (Ab)use a call to XTextRange::getText to flush edits and restore the selection of the textcontent in the textfields. TODO: unit/UItest Change-Id: If8e1c85f3565ae1b80fd0645c0905aae16404379 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181245 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit 4328d1cca66ed9d1e34a8d788d16a2205fe77c1c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181280 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 960e6af4fbe15e4cf857f74382adc0b994a12ff8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181326 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Tested-by: Michael Weghorn <m.wegh...@posteo.de> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 65709b7bfba3..b77cd9927cb8 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -311,10 +311,10 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap { try { - // tdf#153161: it seems that the call to XTextRange::getString flushes the changes + // tdf#153161: it seems that the call to xText->getText 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(); + xText = xText->getText(); } catch (uno::RuntimeException const&) { diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index 13785cd60156..9e38e9659a24 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -524,6 +524,20 @@ namespace xmloff Reference< XText > xControlText( _rxObject, UNO_QUERY ); if ( xControlText.is() ) { + try + { + // tdf#120397: similar to the fix of tdf#153161 where + // XTextRange::getText() --> ::GetSelection() flushes the changes + // for some Shape objects we also need to set the end cursor pos + // to the end of the form text objects, otherwise fail to get + // exported correctly. Maybe at some point it would make sense + // to find a better place for more targeted flush. + xControlText = xControlText->getText(); + } + catch (css::uno::RuntimeException const&) + { + // just in case if we would hit something here + } m_rContext.GetTextParagraphExport()->collectTextAutoStyles( xControlText ); }