Created attachment 132363 [details] Document demonstrating the bug, macro embedded See the attached document: "Here is a x in superscript. This superscript is implemented by writing x, selecting it and applying the superscript button from the toolbar. According to Format > Character > Position: x is raised by 33% (Automatic). The embedded macro ReplaceFormatting should replace superscript by normal text by searching: SrchAttributes(0).Name = "CharEscapement" SrchAttributes(0).Value = 33 But it does nothing! Is this an ancient bug??? See https://bz.apache.org/ooo/show_bug.cgi?id=31212"
Note: Searching for value 0 (normal text) works perfectly! All normal text is identified, superscript is exculded.
Note: If superscript is defined explicitely by Position Raise by: 33% (not automatic) Relative font size: 58% (which seems to be the default for superscript) it is NOT FOUND. But if defined by Raise by: 33% (not automatic) Relative font size: 100% it is FOUND!!!
Reproduced. Arch Linux 64-bit, KDE Plasma 5 Version: 5.4.0.0.alpha0+ Build ID: d69e6321fbb2c9f5b4d30890074a230ee6b39d2d CPU threads: 8; OS: Linux 4.10; UI render: default; VCL: kde4; Locale: fi-FI (fi_FI.UTF-8); Calc: group Built on April 17th 2016
** 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
Still repro with file Arch Linux 64-bit Version: 6.4.0.0.alpha0+ Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503 CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US Calc: threaded Built on 6 August 2019
I investigate the issue and I need an advice how LO should behave in this case: If you search for: SrchAttributes(0).Name = "CharEscapement" SrchAttributes(0).Value = 33 LO searches for CharEscapement 33% and for the default value on CharEscapementHeight, which is 100% and therefore it does not find the superscript attribute which is CharEscapement 33% and CharEscapementHeight 58%. However, if you search for: Dim SrchAttributes(1) as new com.sun.star.beans.PropertyValue SrchAttributes(0).Name = "CharEscapement" SrchAttributes(0).Value = 33 SrchAttributes(1).Name = "CharEscapementHeight" SrchAttributes(1).Value = 58 Everything works fine. The whole script looks like: REM ***** BASIC ***** Sub Main End Sub Sub ReplaceFormatting() Dim oDocument As Object Dim oReplace As Object Dim SrchAttributes(1) as new com.sun.star.beans.PropertyValue Dim ReplAttributes(0) as new com.sun.star.beans.PropertyValue oDocument = ThisComponent oReplace = oDocument.createReplaceDescriptor oReplace.SearchString = ".*" oReplace.ReplaceString = "<sup>&</sup>" oReplace.SearchRegularExpression=True oReplace.searchStyles=True oReplace.searchAll=True REM This is the attribute to find SrchAttributes(0).Name = "CharEscapement" SrchAttributes(0).Value = 33 SrchAttributes(1).Name = "CharEscapementHeight" SrchAttributes(1).Value = 58 REM This is the attribute to replace it with ReplAttributes(0).Name = "CharEscapement" ReplAttributes(0).Value = 0 oReplace.SetSearchAttributes(SrchAttributes()) oReplace.SetReplaceAttributes(ReplAttributes()) oDocument.replaceAll(oReplace) End Sub
Andreas asked for opinions in the QA chat, I will include the messages, so we can refer to them: If you search for superscripts the LO searches for CharEscapement AND CharEscapementHeight But if you only define one attribute, in this case CharEscapement, then the other property is set to its default value So there are two options for a fix: either you specify always both properties or you search for just the one set
the problem is that there is one item SvxEscapementItem for both CharEscapement and CharEscapementHeight and the search looks for an equal item so it's not obvious how to fix this because the SvxEscapementItem always compares 2 properties...
There could be some check, that if the Item is not explicitly set, it receives a NULL or an empty value.
There are a lot of user-visible properties in LO that don't map to a single SfxPoolItem object. E.g., both CharEscapement and CharEscapementHeight are two fields of SvxEscapementItem. So when you set one, you always get (some default) value for another in the itemset that will be used in matching - see SwSearchProperties_Impl::FillItemSet. Then these items will be compared directly for equality to corresponding items of text. For those properties that happen to map to a single item, the equality is the correct check; those text runs that happen to have searched items with all other fields default, will also get found (accidentally); bit for those which have non-default values for fields that are not in search, the lookup will fail. I suppose that you either might try to introduce special "doesn't matter" values for such item fields, and set it when preparing search items, then modify operator == to ignore left object's field if right object's corresponding field has "doesn't matter" value; or introduce e.g. a child class of SvxEscapementItem with an own equality operator taking into account which fields were actually set.
Dear Butch, 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://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug