Bug 152071

Summary: Figure numbering reference is broken
Product: LibreOffice Reporter: Mihai Vasiliu <mihai.vasiliu.93>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED NOTABUG    
Severity: normal CC: stephane.guillou
Priority: medium    
Version: 7.4.2.3 release   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: example document

Description Mihai Vasiliu 2022-11-16 13:44:16 UTC
Description:
Adding multiple figures and referencing in text gives wrong indicies.

Steps to Reproduce:
1. Create a new Writer document
2. Insert a picture (copy-paste) and add a caption to it, category Figure and type some text in the caption. It will be inserted as Figure 1.
3. Repeat above step and insert another figure, which will be numbered Figure 2.
4. Insert cross-reference in text to both figure 1 and 2. Both references are now to figure 1.
5. Same behaviour happens if the images are inserted on abov the other or one below the other.
6. After saving and reopening the document, adding more pictures may produce strange results as duplicate Figure numbers or incorrect referencies.

If I use F9 to update referencies, nothing changes.



Actual Results:
Duplicate figure numbers are seen as references and there is no way to correct them.

Expected Results:
Each reference should have a unique number.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.4.2.3 (x64) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 8; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: ro-RO (ro_RO); UI: en-US
Calc: CL
Comment 1 Stéphane Guillou (stragu) 2022-11-16 14:43:37 UTC
Created attachment 183628 [details]
example document

Could not reproduce in:

Version: 7.4.2.3 / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Example document shows the cross references. Links work and jump to the right location. Note that the reason they both show "1" is that the default number referenced is the page. To use the "figure nb" text, one needs to choose "Refer using: category and number".
Comment 2 Stéphane Guillou (stragu) 2022-11-16 14:45:47 UTC
Marking this a "not a bug", but please feel free to explain some more if I got it wrong!
Comment 3 Mihai Vasiliu 2022-11-16 15:12:46 UTC
You're right. It seems that I've been using page numbers without realizing, as I had one image per page and they matched until they didn't...

Maybe it would be better to change the default to "Refer using: category and number" to make it easier to see if something is wrong.

Otherwise, seems fine as it is.
Thanks a lot!
Comment 4 Stéphane Guillou (stragu) 2022-11-17 08:08:35 UTC
Thanks Mihai. I think bugs 96299 and 92688 should cover that issue.