Created attachment 151563 [details] The example announced in the report (E.g.) Having a sheet with a shape anchored to a cell we can get the cell using the sheet's method getCellByPosition. We can get the same cell object via the shape's .Anchor property. Now we can apply the function EqualUnoObjects() to the two representations of the same object. Expected result: True Actual result: False Thorough inspection of both representations in the IDE doesn't show any differences. Same (respective) result for EqualUnoObjects(ThisComponent.Sheets.GetByIndex(0), _ ThisComponent.Sheets.GetByName("Sheet1")) If the function not was implemented for the comparison of ANY kind of objects, but only for UnoStruct e.g. this should be explicitly stated somewhere (since I assume that a respective change of the name not is acceptable). The result in cases of undue application concerning the type of objects should be an error then instead of the nwrong (at least gravely misleading) False. Testing was done with OOo V3.2 and with LibO V 6.2.3.2 The behaviour obviously is common heritage of LibO and AOO. See attached demo.
Code pointer: https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbunoobj.cxx?r=fbc038cc#3118
On pc Debian x86-64 with master sources updated today, I could reproduce this. Since in this part: 3171 if( x1 == x2 ) 3172 { 3173 refVar->PutBool( true ); 3174 } x1 isn't considered as == to x2, refVar stays at false. Now I don't know how to fix this or if we should fix this. Indeed, I suppose it may have impacts on existing macros.
I should subjoin that even the expression EqualUnoObjects(ThisComponent.Sheets.GetByIndex(0), ThisComponent.Sheets.GetByIndex(0)) will return False.
Created attachment 151602 [details] EqualUnoObjects - working example with controls adding a working example, searching a control on drawpage
You may also have a glance at a related post in a forum where sometimes actual discussion occurs: https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=98435
We actually do create a new object each time a range object is requested (see e.g. ScTableSheetsObj::GetObjectByIndex_Impl[1], which implements functionality of XIndexAccess::getByIndex). So at least in case of range objects (which have their range read-only, thus for all uses should be considered "same" when refer to same range), we need some special casing to check if they are objects of the same type (e.g., one could be "sheet", and the other "all cells, but not sheet", and these are different objects), and then refer to the same range. https://git.libreoffice.org/core/+/1c3eb7e329cd2eaeb83068907ba0c9a5b3ef7852/sc/source/ui/unoobj/docuno.cxx#3577
Dear Wolfgang Jäger, 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
Checked with V 7.5.3.2 under Win10 Behaviour unchanged.
(In reply to Mike Kaganski from comment #6) > We actually do create a new object each time a range object is requested > (see e.g. ScTableSheetsObj::GetObjectByIndex_Impl[1], which implements > functionality of XIndexAccess::getByIndex). So at least in case of range > objects (which have their range read-only, thus for all uses should be > considered "same" when refer to same range), ... ... we need some special casing to > check if they are objects of the same type (e.g., one could be "sheet", and > the other "all cells, but not sheet", ... ... and these are different objects), and > then refer to the same range. > > https://git.libreoffice.org/core/+/1c3eb7e329cd2eaeb83068907ba0c9a5b3ef7852/ > sc/source/ui/unoobj/docuno.cxx#3577 Thanks. I can't start to study and analyze the complex C++ code (I never understood sufficiently nor ever liked). As a frequent user of the API I would, however, expect that things are consistent to a degree allowing for a sufficient understanding either by a kind of self-explanation and educated reasoning or by well structured documentation. That there are objects of different types in a sense as underlying the above example without giving the user reliable information about it is just confusion, imo. I'm told that only service names are assured to be stable. OK. But if so there must be a service helping to distinguish "different object types" in every case. Otherwise implementation names must get assured stability, and must be applied in a way offering the mentioned functionality. Also a kind of bundling or "merging" services in a way that results in facts like EqualUNOobjects(cellObject, cellObject.Text)=True (same "object type"?) is evil if not at least there are reliable means to make the needed distinctions in a different way. An API will always partly be useless or create errors if its usage requires full understanding of the core code. If "object types" are actually defined by their BUNDLING of services, these types must have stable names, and their bundling (including the surprising "identities") must be documented.