diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-08-23 11:58:29 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-08-23 16:35:33 +0200 |
commit | 31cb5b5538b9fd91dafb067ce961f2540555ad2b (patch) | |
tree | a6edfa9eba484c746761091c16407a9a7a58041b /sw/qa/python | |
parent | c5d255b1f0bea5fec520c27b5141bce4b41cb3d6 (diff) |
sw: fix missing cache invalidation when switching between images
It is possible to disable toolbar buttons from UNO API client code by
registering a dispatch provider interceptor and then returning an empty
reference when the UNO command associated with that toolbar button is queried
for a dispatch. Such querying of a dispatch happens when changing context (e.g.
text -> image selection), but not when switching between two images.
A benefit of the current approach is that once a button is disabled this way,
it remains disabled without re-querying the dispatch provider, which helps
performance. A downside is that in case the dispatch provider intercepts the
command based on the current selection (e.g. currently selected image), then
switching to an other image won't re-query the dispatch provider, for at least
two reasons:
- SfxBindings::Register_Impl() is only called when the dispatcher is an
internal one (e.g. not implemented in Java), so there is no listener that would
re-query the state on selection change
- even if we re-query the dispatch provider, the actual toolbar button won't be
updated if the initial dispatch was an empty reference, since updating works by
registering a status listener on the returned dispatch object in
svt::ToolboxController::bindListener()
Fix the problem by explicitly calling contextChanged() on the current frame
when switching between images (but not changing context), similar to how
SvtCommandOptions_Impl::Notify() invalidates registered dispatch objects when
the configuration (on what commands are disabled) changes.
This only helps with images and OLE objects, other object types are kept
unchanged for now.
Change-Id: I7f33dd2804067acf5cb0ca836f6a2a69fa950a8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138724
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa/python')
0 files changed, 0 insertions, 0 deletions