office-gobmx/sw/CppunitTest_sw_uibase_uiview.mk
Miklos Vajna 31cb5b5538 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
2022-08-23 16:35:33 +02:00

75 lines
1.9 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sw_uibase_uiview))
$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_uibase_uiview))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_uibase_uiview, \
sw/qa/uibase/uiview/uiview \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_uibase_uiview, \
comphelper \
cppu \
cppuhelper \
sal \
sfx \
svxcore \
sw \
swqahelper \
test \
unotest \
utl \
vcl \
svt \
tl \
svl \
))
$(eval $(call gb_CppunitTest_use_externals,sw_uibase_uiview,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_uibase_uiview,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
-I$(SRCDIR)/sw/source/uibase/inc \
-I$(SRCDIR)/sw/qa/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sw_uibase_uiview,\
udkapi \
offapi \
oovbaapi \
))
$(eval $(call gb_CppunitTest_use_ure,sw_uibase_uiview))
$(eval $(call gb_CppunitTest_use_vcl,sw_uibase_uiview))
$(eval $(call gb_CppunitTest_use_rdb,sw_uibase_uiview,services))
$(eval $(call gb_CppunitTest_use_custom_headers,sw_uibase_uiview,\
officecfg/registry \
))
$(eval $(call gb_CppunitTest_use_instdir_configuration,sw_uibase_uiview))
$(eval $(call gb_CppunitTest_use_common_configuration,sw_uibase_uiview))
$(eval $(call gb_CppunitTest_use_uiconfigs,sw_uibase_uiview, \
modules/swriter \
))
$(eval $(call gb_CppunitTest_use_more_fonts,sw_uibase_uiview))
# vim: set noet sw=4 ts=4: