In a text with different paragraph styles it's expected that on selection the S&F tree changes accordingly. For example you click on a heading and the "Heading 1" node is highlighted, click on some text and "Text Body" is highlighted.
This functionality is broken with the introduction of the Styles Inspector, bug 134554.
Caused by grabbing the change link exclusively by SI in WriterInspectorTextPanel::WriterInspectorTextPanel (calling SwWrtShell::SetChgLnk). We must either make it chained (e.g. store previously set link in a member variable, and call it before/after we execute code in our link), or modify SI to not set the link, but to use the existing link (investigate how sidebar/toolbar get notifications and don't step on each other's toes).
(In reply to Mike Kaganski from comment #1)
> ..., or modify SI to not set the link, but to use the
> existing link (investigate how sidebar/toolbar get notifications and don't
> step on each other's toes).
See SwXTextView::addSelectionChangeListener. This would be the preferred way to solve this.
*** Bug 135182 has been marked as a duplicate of this bug. ***
Shivam Kumar Singh committed a patch related to this issue.
It has been pushed to "master":
tdf#135178 tdf#135179 tdf#134820 Issue in SetChgLnk in Inspector
It will be available in 7.1.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.
Thank you Shivam for fixing this!
In the meanwhile, I have checked how style is updated in Stylist; looks like it listens to SfxHintId::UpdateDone. Which at some point we also need to do; that would allow the update be asynchronous, thus avoiding performance issues, and reverting the fix to avoid using change link at all.
Possibly we would simply need to inherit the inspector implementation from SfxCommonTemplateDialog_Impl, which handles the notification?
... or modify IMPL_LINK_NOARG(SwView, AttrChangedNotify, LinkParamNone*, void) to send an asynchronous notification
(In reply to Mike Kaganski from comment #5)
> Possibly we would simply need to inherit the inspector implementation from
> SfxCommonTemplateDialog_Impl, which handles the notification?
Inspector implementation from SfxCommonTemplateDialog_Impl ? Could you please explain a bit on this Mike.
(In reply to Shivam Kumar Singh from comment #7)
SfxCommonTemplateDialog_Impl::Notify gets notified on SfxHintId::UpdateDone, and I thought we could expand that to call some virtual function ... but it seems that it doesn't react for some cases we need, so likely comment 6 is more relevant - please ignore "inherit from SfxCommonTemplateDialog_Impl" in comment 5.
The thing is, currently we call the update code for each invocation of change link, which happens synchronously. The intended end result would be to refresh asynchronously: the pre-existing change link would fire an idle timer, and it would only execute once after LO finished executing more prioritized tasks, so that SI doesn't incur performance penalty. But that's for later.