cui/source/customize/acccfg.cxx                         |    9 +++++++++
 framework/inc/properties.h                              |    2 ++
 framework/source/layoutmanager/layoutmanager.cxx        |    9 ++++++++-
 framework/source/layoutmanager/toolbarlayoutmanager.cxx |   14 ++++++++++++++
 framework/source/layoutmanager/toolbarlayoutmanager.hxx |    2 ++
 5 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 7a851c5b2da723ca618061c12a14f11479748dfd
Author:     Juergen Funk <juergen.funk...@cib.de>
AuthorDate: Wed Feb 8 12:15:44 2023 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Thu Feb 9 15:26:48 2023 +0000

    tdf#95936: Tooltip not updated in Toolbars after change Shortcut
    
    The update of all toobars after change the shortcut was missing,
    this patch update the toolbars now
    
    Change-Id: Ibc896dc48c9143307b028a3c271476482111c2c5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146678
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 1a37964fb8c8..70ec1764fc5e 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -63,6 +63,8 @@
 #include <comphelper/sequenceashashmap.hxx>
 #include <config_features.h>
 
+#include <com/sun/star/frame/LayoutManager.hpp>
+
 // namespaces
 
 using namespace css;
@@ -1480,6 +1482,13 @@ bool SfxAcceleratorConfigPage::FillItemSet(SfxItemSet*)
     try
     {
         m_xAct->store();
+        css::uno::Reference<css::beans::XPropertySet> xFrameProps(m_xFrame,
+                                                                  
css::uno::UNO_QUERY_THROW);
+        css::uno::Reference<css::frame::XLayoutManager> xLayoutManager;
+        xFrameProps->getPropertyValue("LayoutManager") >>= xLayoutManager;
+        css::uno::Reference<css::beans::XPropertySet> 
xLayoutProps(xLayoutManager,
+                                                                   
css::uno::UNO_QUERY_THROW);
+        xLayoutProps->setPropertyValue("RefreshContextToolbarToolTip", 
css::uno::Any(true));
     }
     catch (const uno::RuntimeException&)
     {
diff --git a/framework/inc/properties.h b/framework/inc/properties.h
index fead8e3e1fad..b11a5b2e9d71 100644
--- a/framework/inc/properties.h
+++ b/framework/inc/properties.h
@@ -49,6 +49,7 @@ inline constexpr OUStringLiteral 
LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY
 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI = 
u"HideCurrentUI";
 inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT = 
u"LockCount";
 inline constexpr OUStringLiteral 
LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE = u"PreserveContentSize";
+inline constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_REFRESHTOOLTIP = 
u"RefreshContextToolbarToolTip";
 
 #define LAYOUTMANAGER_PROPNAME_MENUBARCLOSER            
LAYOUTMANAGER_PROPNAME_ASCII_MENUBARCLOSER
 
@@ -58,6 +59,7 @@ inline constexpr OUStringLiteral 
LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_S
 #define LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI          3
 #define LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT              4
 #define LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE  5
+#define LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP         6
 
 /** properties for "UICommandDescription" class */
 inline constexpr OUStringLiteral 
UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST = 
u"private:resource/image/commandimagelist";
diff --git a/framework/source/layoutmanager/layoutmanager.cxx 
b/framework/source/layoutmanager/layoutmanager.cxx
index ec6ed5572d94..652521fdf6aa 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -130,6 +130,7 @@ LayoutManager::LayoutManager( const Reference< 
XComponentContext >& xContext ) :
     registerProperty( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, 
LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, beans::PropertyAttribute::TRANSIENT, 
&m_bMenuBarCloseButton, cppu::UnoType<decltype(m_bMenuBarCloseButton)>::get() );
     registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY, 
LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, 
beans::PropertyAttribute::TRANSIENT, cppu::UnoType<bool>::get(), 
css::uno::Any(false) );
     registerProperty( LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE, 
LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE, 
beans::PropertyAttribute::TRANSIENT, &m_bPreserveContentSize, 
cppu::UnoType<decltype(m_bPreserveContentSize)>::get() );
+    registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_ASCII_REFRESHTOOLTIP, 
LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP, beans::PropertyAttribute::TRANSIENT, 
cppu::UnoType<bool>::get(), css::uno::Any(false) );
 }
 
 LayoutManager::~LayoutManager()
@@ -3001,7 +3002,7 @@ void SAL_CALL LayoutManager::elementReplaced( const 
ui::ConfigurationEvent& Even
 void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32       
nHandle,
                                                                const uno::Any& 
aValue  )
 {
-    if ( nHandle != LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY )
+    if ( (nHandle != LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY) && (nHandle 
!= LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP) )
         LayoutManager_PBase::setFastPropertyValue_NoBroadcast( nHandle, aValue 
);
 
     switch( nHandle )
@@ -3029,6 +3030,12 @@ void SAL_CALL 
LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32       n
         case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI:
             implts_setCurrentUIVisibility( !m_bHideCurrentUI );
             break;
+
+        case LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP:
+            if (m_xToolbarManager.is())
+                m_xToolbarManager->updateToolbarsTips();
+            break;
+
         default: break;
     }
 }
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx 
b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index cf444b5ab31d..7b1f78f64c1e 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -3904,6 +3904,20 @@ void SAL_CALL ToolbarLayoutManager::elementReplaced( 
const ui::ConfigurationEven
         pParentLayouter->requestLayout();
 }
 
+void ToolbarLayoutManager::updateToolbarsTips()
+{
+    SolarMutexGuard g;
+
+    for (auto& elem : m_aUIElements)
+    {
+        uno::Reference< ui::XUIElementSettings > 
xElementSettings(elem.m_xUIElement, uno::UNO_QUERY);
+        if (!xElementSettings.is())
+            continue;
+        xElementSettings->updateSettings();
+    }
+}
+
+
 uno::Reference< ui::XUIElement > ToolbarLayoutManager::getToolbar( 
std::u16string_view aName )
 {
     return implts_findToolbar( aName ).m_xUIElement;
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx 
b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index 3e7b631c653d..2a490f618a0b 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -115,6 +115,8 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper< 
css::awt::XDockableW
         css::uno::Reference< css::ui::XUIElement > getToolbar( 
std::u16string_view aName );
         css::uno::Sequence< css::uno::Reference< css::ui::XUIElement > > 
getToolbars();
 
+        void updateToolbarsTips();
+
         // child window notifications
         void childWindowEvent( VclSimpleEvent const * pEvent );
 

Reply via email to