Created attachment 151563 [details]
The example announced in the report
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
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 18.104.22.168
The behaviour obviously is common heritage of LibO and AOO.
See attached demo.
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Since in this part:
3171 if( x1 == x2 )
3173 refVar->PutBool( true );
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
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, 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.