When I right-click a field in LO writer, e.g. a cross-reference, there should be a menu item on the context menu for "Update Field" (not all fields, just the right-clicked field).
I don't think Writer ever used to have that item, but just in case: It's missing with
Version: 126.96.36.199.alpha0+ / LibreOffice Community
Build ID: d9b33ed6644203141fdb0776c291425c2bc9f5ac
CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: en-IL (en_IL); UI: en-US
Why do you expect a field not to be up-to-date?
(In reply to Heiko Tietze from comment #2)
> Why do you expect a field not to be up-to-date?
Because a field isn't necessarily automatically up-to-date. Or - are you saying if that happens, then it's a bug?
(In reply to Eyal Rozenberg from comment #3)
> are you saying if that happens, then it's a bug?
I don't see a reason why fields cannot show the most recent content. Miklos, what do you think?
Not updating all fields automatically has a few benefits:
1) updating all these fields can take a bit of time for large documents, so doing it on every keypress would be seen as a problem by some users (Writer could be too slow to be usable)
2) we could also have code to track the dependencies of all fields (similar to e.g. what Calc does), not having that code makes the codebase simpler
3) there is not much pressure on us to do such auto-updates in all cases, e.g. Word doesn't update fields even on file load
So given that users learned to live with not auto-updating fields, this allows a bit simpler and faster code. That being said, we do auto-update a few fields, e.g. moving a page number field to a next page auto-updates it.
On the other hand, users learned that hand-editing a generated ToC is possible, and if we take that away, they can see that as a regression.
With these in mind, completely eliminating the explicit field update doesn't sound good.
Adding a possibly to explicitly update an individual field makes sense to me.
So let's make it an interesting easyhack, guess the prototype would be ImpEditEngine::UpdateFields().
*** Bug 152060 has been marked as a duplicate of this bug. ***
I have been working on this bug with the appraoch of adding the option to update fields in a selected range and currently wrote a possible implementation for a ImpEditEngine::UpdateSelectedField() function that does so. However, adding a new element to the context menu looks like much work. I believe it will need updating numerous files? If someone can help regarding how to actually add the element to the context menu & relevant files (even relevant docs) I would appreciate it.
(In reply to TokieSan from comment #8)
> I have been working on this bug with the appraoch of adding the option to
> update fields in a selected range and currently wrote a possible
> implementation for a ImpEditEngine::UpdateSelectedField() function that
> does so. However, adding a new element to the context menu looks like much
> work. I believe it will need updating numerous files? If someone can help
> regarding how to actually add the element to the context menu & relevant
> files (even relevant docs) I would appreciate it.
Did you try grepping through the commit history for changes that add stuff to a context menu?
(In reply to TokieSan from comment #8)
> However, adding a new element to the context menu looks like much work.
It isn't. AT least if you have a UNO command it's just adding this to the XML defintion. A UNO command is not rocket science but involves some files. Check this blog post https://dev.blog.documentfoundation.org/2022/02/23/adding-a-new-uno-command/
TokieSan committed a patch related to this issue.
It has been pushed to "master":
tdf#148979 Added option to update selected field
It will be available in 7.6.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:
Affected users are encouraged to test the fix and report feedback.