Created attachment 140932 [details] Simple document with a form that contains a rich text control The function insertTextPortion() of the XTextPortionAppend Interface doesn't work. I attached a simple document that contains a form with a rich text control. The following macro should first insert the unformatted text "Text", then append the formatted text "Append" (in Arial red) using apendTextPortion() and at last insert at the beginning the text "Insert" (in Arial red) using insertTextPortion(). While appendTextPortion() works as expected (text is appended with the right format), insertTextPortion() does not work: simply, nothing happens when it is called. Here is the test macro: Sub Test() Dim oForm As Object, oCtrl as Object ' Get form and rich text control oForm = thisComponent.DrawPage.Forms.getByName("Form1") oCtrl = oForm.getByName("Text1") ' Append unformatted text => works oCtrl.Text = "Text" ' Text properties Dim aStyleProps(1) As New com.sun.star.beans.PropertyValue aStyleProps(0).Name = "CharColor" aStyleProps(0).Value = rgb( 255, 0, 0 ) aStyleProps(1).Name = "CharFontName" aStyleProps(1).Value = "Arial" ' Append formatted text => works oCtrl.appendTextPortion("Append", aStyleProps) ' Insert formatted text at the start => does not work Dim oTextCursor as Object oTextCursor = oCtrl.createTextCursor() oTextCursor.GotoStart(FALSE) oCtrl.insertTextPortion("Insert", aStyleProps, oTextCursor) End Sub
Created attachment 141058 [details] Simple document with a form that contains a rich text control plus macro
Repro. Arch Linux 64-bit Version: 6.1.0.0.alpha0+ Build ID: 6acda2a36c9025e0d3fe94d6ca8788ab60c3203e CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: kde4; Locale: fi-FI (fi_FI.UTF-8); Calc: group Built on April 2nd 2018
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=889dc7bf#4026
oops, I mis-posted to the wrong bug report.
https://opengrok.libreoffice.org/xref/core/editeng/source/uno/unotext.cxx?r=24c17dab#2075
https://opengrok.libreoffice.org/xref/core/forms/source/richtext/richtextunowrapper.hxx?r=61dd9caf#40 https://opengrok.libreoffice.org/xref/core/include/editeng/unotext.hxx?r=3667031e#482 https://opengrok.libreoffice.org/xref/core/include/editeng/unotext.hxx?r=3667031e#408
Dear Roland Baudin, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
The bug is still there in LibreOffice 7.5.3.2. I checked the source code and found that in file editeng/source/uno/unotext.cxx, the method: uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion( const OUString& /*rText*/, const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/, const uno::Reference< text::XTextRange>& /*rTextRange*/ ) { uno::Reference< text::XTextRange > xRet; return xRet; } doesn't do anything, it is a dummy method. On the contrary, the method: uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion( const OUString& rText, const uno::Sequence< beans::PropertyValue >& rCharAndParaProps ) is fully implemented.
Fixed by commit da8dead8e9282010893cbd12519e107baf03cd1a.