sw: revert change in expanding hints in SwXText::insertTextContent()

Desktop / LibreOffice - Michael Stahl [cib.de] - 20 November 2019 10:59 UTC

The SwXText implementation for inserting text works like this:

- XTextPortionAppend methods appendTextPortion()/insertTextPortion() get the text properties passed as a parameter, and they should apply only those properties to the inserted text, not expand any existing formatting hints at the insert position.

- XSimpleText method insertString() does expand existing formatting at the insert position, just like editing in the UI does

For inserting XTextContent:

- XTextContentAppend methods appendTextContent()/insertTextContentWithProperties() with properties parameter, similar to XTextPortionAppend

- XTextContent::insertTextContent(), without properties

So arguably, by analogy to inserting text, the methods that take properties should not expand hints, and the insertTextContent() should follow the insertString and expand hints.

Commit 18cbb8fe699131a234355e1d00fa917fede6ac46 is an important bugfix for writerfilter import, but the problem is, it added the DontExpandFormat() call to insertTextContent(), whereas the regression it was fixing (from commit 232ad2f2588beff50cb5c1f3b689c581ba317583) was that the call was removed from insertTextContentWithProperties().

So restore the state before 232ad2f2588beff50cb5c1f3b689c581ba317583.

Turns out that SwUiWriterTest2::testTdf126206 was checking how a bookmark-start is formatted instead of how the text is formatted.

Change-Id: If524409f88a1a36aa062b6e132996d3f9c1bb571 Reviewed-on: https://gerrit.libreoffice.org/83223

635bd7fbcb1d sw: revert change in expanding hints in SwXText::insertTextContent()
sw/qa/extras/uiwriter/uiwriter2.cxx | 6 ++-
sw/qa/extras/unowriter/unowriter.cxx | 91 ++++++++++++++++++++++++++++++++++++
sw/source/core/unocore/unotext.cxx | 14 ++++--
3 files changed, 106 insertions(+), 5 deletions(-)

Upstream: cgit.freedesktop.org


  • Share