Bug 146573 - Writer table formulas involving cells with footnotes are not recalculated consistently
Summary: Writer table formulas involving cells with footnotes are not recalculated con...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha1+
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0 target:7.3.4
Keywords:
Depends on:
Blocks: Writer-Tables-Formulas
  Show dependency treegraph
 
Reported: 2022-01-04 21:42 UTC by William Friedman
Modified: 2022-05-27 10:39 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Friedman 2022-01-04 21:42:52 UTC
Description:
In a table with cells containing ordinary numbers, formulas involving that cell recalculate immediately upon exiting the cell. If there is a footnote in a table cell, however, formulas involving that cell don't recalculate unless the user leaves the table and returns to it OR adds an additional row to the table. If the footnote is deleted, however, the formula involving the cell is recalculated immediately! This behavior is inconsistent and confusing.

Steps to Reproduce:
1. Create a table with 1 row and 2 columns.
2. Put a number in the first cell.
3. In the second cell, enter the formula =<A1>.
4. Return to the first cell and change the number. The second cell does not change.
5. Press tab or click on the second cell. The second cell is recalculated to match the first cell.
6. Return to the first cell. Insert a footnote. Change the number in the cell.
7. Press tab or click on the second cell. The second cell is *not* recalculated to match the first cell.
8. Click outside the table. Notice that the second cell is *still* not recalculated.
9. Click inside the table. Notice that the second is *finally* recalculated.
10. Change the number in the first cell again. Add a row, either by tabbing past the second cell or Table | Add Row or right-clicking and hitting Add Row. Notice that the second is recalculated.
11. Return to the first cell. Change the number again. Delete the footnote. Notice that the second cell is recalculated *immediately*.

Actual Results:
Changing the number in a cell with a footnote does not change an associated formula in predictable, consistent ways.

Expected Results:
Changing the cell with the footnote should cause a formula involving that cell to be recalculated consistently, as if the cell did not have a footnote in it.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.4.1 (x64) / LibreOffice Community
Build ID: 27d75539669ac387bb498e35313b970b7fe9c4f9
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 1 Buovjaga 2022-01-05 11:49:28 UTC
The behaviour was previously much more broken (formula value changed to 0 upon inserting footnote and refused to update no matter what). The situation was improved by commit https://git.libreoffice.org/core/commit/915d3eebc1dc4f18d7a1992db801ee8313ee46c0
tdf#39828 sw: fix table formula calculation at track changes

László: as your commit improved this, I thought you might be interested in taking a look.

I found the commit with linux-64-7.3 bibisect repository.
Comment 2 László Németh 2022-01-05 13:45:04 UTC
@all: Thanks for your report, I'll check it.
Comment 3 Commit Notification 2022-05-02 20:57:44 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/978e22f8cfb3db573bed3fd4b14a515cf090f7e5

tdf#146573 sw: recalculate cells with footnotes

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 László Németh 2022-05-03 07:09:01 UTC
@William Friedman: thanks for the bug report!

@Buovjaga: thanks for bibisecting and forwarding the problem!

Commit description:

tdf#146573 sw: recalculate cells with footnotes

Commit 915d3eebc1dc4f18d7a1992db801ee8313ee46c0
"tdf#39828 sw: fix table formula calculation at track changes"
allowed to use footnotes in value cells unintentionally.
The only problem was that modifying cells with footnotes didn't
trigger formula recalculation in text tables, according to the
incomplete SwTableBox::IsValidNumTextNd(). Instead of
asking formula recalculation pressing F9, now IsValidNumTextNd
was extended to skip footnotes, similar to the already
skipped comments.

Also clean-up to testTdf39828 (remove copy-paste code), and
clean-up to commit 915d3eebc1dc4f18d7a1992db801ee8313ee46c0
"tdf#39828 sw: fix table formula calculation at track changes"
to avoid of unnecessary calls of GetRedlineText(), which
is an expensive call, especially when there are a lot of redlines
with overlapping (see commit d467cd0dd9e9cf3b018859a592e2638527bc7add
"tdf#135683 speedup DocumentRedlineManager::GetRedlinePos").
Comment 5 Commit Notification 2022-05-03 14:30:13 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/b47b35e0ab6efceeaa2dbe8b598c21afa5944d67

tdf#146573 sw: recalculate cells with footnotes

It will be available in 7.3.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 NISZ LibreOffice Team 2022-05-27 10:39:45 UTC
Verified in:

Version: 7.4.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: b6266207b55a7633dc82b02142215757512adfb7
CPU threads: 8; OS: Windows 10.0 Build 19042; UI render: Skia/Vulkan; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL