[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - framework/source

2023-04-05 Thread Caolán McNamara (via logerrit)
 framework/source/accelerators/acceleratorconfiguration.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit fe09be20ad4eb17cdbd09cff29de78b55a4135c7
Author: Caolán McNamara 
AuthorDate: Wed Mar 22 16:59:23 2023 +
Commit: Xisco Fauli 
CommitDate: Wed Apr 5 22:32:42 2023 +0200

fix crash seen when experimenting with tdf#129547

Change-Id: I0b26a7f683f91d3307856f86c5a437fde1155451
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149331
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 936f2e6924e405433770b98f32a615508fd0670d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149434
Reviewed-by: Xisco Fauli 
(cherry picked from commit 98465ee3f987c43bdb0a615ca81ffbbac6bf479f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149515

diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx 
b/framework/source/accelerators/acceleratorconfiguration.cxx
index 3507314a9a6e..ad08f375a177 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -64,7 +64,10 @@ namespace framework
 static OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent)
 {
 const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of an 
identifier...
-OUStringBuffer 
sKeyBuffer((KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode)).subView(nBeginIndex));
+OUString 
sKey(KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode));
+if (sKey.getLength() < nBeginIndex) // dead key
+return OUString();
+OUStringBuffer sKeyBuffer(sKey.subView(nBeginIndex));
 
 if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == 
css::awt::KeyModifier::SHIFT )
 sKeyBuffer.append("_SHIFT");


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - framework/source

2022-12-06 Thread Noel Grandin (via logerrit)
 framework/source/uiconfiguration/uiconfigurationmanager.cxx |   33 
 1 file changed, 12 insertions(+), 21 deletions(-)

New commits:
commit 3883454e64d8723d27d357f5fa3c213df59773ca
Author: Noel Grandin 
AuthorDate: Mon Dec 5 14:43:30 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 6 11:45:53 2022 +

tdf#152134 Customize: assign user macro to menu hangs

regression from
commit d4257daba1155ebccbfebea99bad0e4152ca9b08
Author: Noel Grandin 
Date:   Fri Dec 24 20:58:28 2021 +0200
use comphelper::WeakComponentImplHelper in MenuBarManager

We should not hold the mutex while firing events, since the mutex is now
non-recursive.

Change-Id: I6ee45df0bf27df3ca1fd31857285ceb820161d61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143671
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 80ef2a46f4ac2ac6f3b14561a195262156fe4b85)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143591

diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 42f6269bf3ce..24dbe1639ac5 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -1348,29 +1348,20 @@ sal_Bool SAL_CALL UIConfigurationManager::isReadOnly()
 void UIConfigurationManager::implts_notifyContainerListener( const 
ConfigurationEvent& aEvent, NotifyOp eOp )
 {
 std::unique_lock aGuard(m_mutex);
-comphelper::OInterfaceIteratorHelper4 pIterator( aGuard, 
m_aConfigListeners );
-while ( pIterator.hasMoreElements() )
-{
-try
-{
-switch ( eOp )
-{
-case NotifyOp_Replace:
-pIterator.next()->elementReplaced( aEvent );
-break;
-case NotifyOp_Insert:
-pIterator.next()->elementInserted( aEvent );
-break;
-case NotifyOp_Remove:
-pIterator.next()->elementRemoved( aEvent );
-break;
-}
-}
-catch( const css::uno::RuntimeException& )
+m_aConfigListeners.forEach(aGuard, [, ](const 
css::uno::Reference& l) {
+switch ( eOp )
 {
-pIterator.remove(aGuard);
+case NotifyOp_Replace:
+l->elementReplaced( aEvent );
+break;
+case NotifyOp_Insert:
+l->elementInserted( aEvent );
+break;
+case NotifyOp_Remove:
+l->elementRemoved( aEvent );
+break;
 }
-}
+});
 }
 
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - framework/source

2022-08-10 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/toolbarmanager.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ad0354c5c5964eefa9241653581c1860d1042644
Author: Maxim Monastirsky 
AuthorDate: Tue Aug 9 21:26:55 2022 +0300
Commit: Noel Grandin 
CommitDate: Wed Aug 10 13:17:17 2022 +0200

Missing colon in toolbar help ids

Regression of 5200a73627d13e2997f81b53f61e143e77e328ee
("use more string_view in various").

Change-Id: I402eb6c03dcfa661c79c5469cfca3c86ac528f60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138066
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 
(cherry picked from commit f4c922f91e717728376dca943008a6dd56387c71)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138023
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/framework/source/uielement/toolbarmanager.cxx 
b/framework/source/uielement/toolbarmanager.cxx
index 4d56884ffbb2..3cce6eef4509 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -633,7 +633,7 @@ void ToolBarManager::Init()
 sal_Int32 idx = m_aResourceName.lastIndexOf('/');
 idx++; // will become 0 if '/' not found: use full string
 std::u16string_view aToolbarName = m_aResourceName.subView( idx );
-OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, 
RTL_TEXTENCODING_UTF8 );
+OString aHelpIdAsString = ".HelpId:" + OUStringToOString( aToolbarName, 
RTL_TEXTENCODING_UTF8 );
 m_pImpl->SetHelpId( aHelpIdAsString );
 
 m_aAsyncUpdateControllersTimer.SetTimeout( 50 );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - framework/source

2022-08-08 Thread Noel Grandin (via logerrit)
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   34 
+++---
 1 file changed, 13 insertions(+), 21 deletions(-)

New commits:
commit fff5829dc00a1d823aa9bd23430737f82158e484
Author: Noel Grandin 
AuthorDate: Tue Aug 2 20:15:07 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 8 16:17:59 2022 +0200

tdf#149966 Crash on Windows and freeze on Linux when customizing Menu

use the notifyEach helper, which unlocks the mutex while we are
calling listeners, which means we can tolerate a re-entrant call to
removeConfigurationListener.

regression from
commit dab35c152af3345786b8335e83cd067b67d08b81
Author: Noel Grandin 
Date:   Sat Dec 18 20:24:15 2021 +0200
osl::Mutex->std::mutex in ModuleUIConfigurationManager

Change-Id: I7a2fbffb1c734b8bd0e952614592ce12c1611328
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137705
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 84c4ccfec1cbbd573609623a026a8cd2ad20400f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137963
Reviewed-by: Xisco Fauli 

diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 93058358d04a..ded9d777080c 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -1625,29 +1625,21 @@ sal_Bool SAL_CALL 
ModuleUIConfigurationManager::isReadOnly()
 void ModuleUIConfigurationManager::implts_notifyContainerListener( const 
ui::ConfigurationEvent& aEvent, NotifyOp eOp )
 {
 std::unique_lock aGuard(m_mutex);
-comphelper::OInterfaceIteratorHelper4 pIterator( aGuard, 
m_aConfigListeners );
-while ( pIterator.hasMoreElements() )
+using ListenerMethodType = void (SAL_CALL 
css::ui::XUIConfigurationListener::*)(const ui::ConfigurationEvent&);
+ListenerMethodType aListenerMethod {};
+switch ( eOp )
 {
-try
-{
-switch ( eOp )
-{
-case NotifyOp_Replace:
-pIterator.next()->elementReplaced( aEvent );
-break;
-case NotifyOp_Insert:
-pIterator.next()->elementInserted( aEvent );
-break;
-case NotifyOp_Remove:
-pIterator.next()->elementRemoved( aEvent );
-break;
-}
-}
-catch( const css::uno::RuntimeException& )
-{
-pIterator.remove(aGuard);
-}
+case NotifyOp_Replace:
+aListenerMethod = 
::ui::XUIConfigurationListener::elementReplaced;
+break;
+case NotifyOp_Insert:
+aListenerMethod = 
::ui::XUIConfigurationListener::elementInserted;
+break;
+case NotifyOp_Remove:
+aListenerMethod = 
::ui::XUIConfigurationListener::elementRemoved;
+break;
 }
+m_aConfigListeners.notifyEach(aGuard, aListenerMethod, aEvent);
 }
 
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - framework/source

2022-08-04 Thread Caolán McNamara (via logerrit)
 framework/source/uielement/subtoolbarcontroller.cxx |   28 +++-
 1 file changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 400caafbc169860f6511b8b270843089206966c4
Author: Caolán McNamara 
AuthorDate: Thu Aug 4 11:45:47 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 4 16:29:33 2022 +0200

tdf#150249 close of popover not detected

the popover listened to here isn't the one that ends up getting actually
used, its contents are transferred to another one, so the
OnPopoverClosed wasn't called, its sufficient to just use the
SubToolbarControl dtor to detect what is wanted here

Change-Id: I3f4a038acfc183b863457919bf89d600517ddc01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137731
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/framework/source/uielement/subtoolbarcontroller.cxx 
b/framework/source/uielement/subtoolbarcontroller.cxx
index c5aed8f7bf59..de345f545497 100644
--- a/framework/source/uielement/subtoolbarcontroller.cxx
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -46,7 +46,6 @@ namespace {
 
 class SubToolBarController : public ToolBarBase
 {
-DECL_LINK(OnPopoverClose, weld::Popover&, void);
 OUString m_aSubTbName;
 OUString m_aLastCommand;
 css::uno::Reference< css::ui::XUIElement > m_xUIElement;
@@ -56,6 +55,8 @@ public:
const css::uno::Sequence< css::uno::Any >& 
rxArgs );
 virtual ~SubToolBarController() override;
 
+void PopoverDestroyed();
+
 // XInitialization
 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any 
>& rxArgs ) override;
 
@@ -209,22 +210,24 @@ namespace {
 class SubToolbarControl final : public WeldToolbarPopup
 {
 public:
-explicit SubToolbarControl(css::uno::Reference< css::frame::XFrame > 
xFrame,
-   weld::Widget* pParent);
+explicit SubToolbarControl(SubToolBarController& rController, 
weld::Widget* pParent);
+virtual ~SubToolbarControl() override;
 
 virtual void GrabFocus() override;
 
 weld::Container* GetContainer() { return m_xTargetContainer.get(); }
 
 private:
+SubToolBarController& m_rController;
 std::unique_ptr m_xTargetContainer;
 };
 }
 
-SubToolbarControl::SubToolbarControl(css::uno::Reference< css::frame::XFrame > 
xFrame,
+SubToolbarControl::SubToolbarControl(SubToolBarController& rController,
  weld::Widget* pParent)
-: WeldToolbarPopup(xFrame, pParent, "svt/ui/subtoolbar.ui", "subtoolbar")
-, m_xTargetContainer(m_xBuilder->weld_container("container"))
+: WeldToolbarPopup(rController.getFrameInterface(), pParent, 
"svt/ui/subtoolbar.ui", "subtoolbar")
+, m_rController(rController)
+, m_xTargetContainer(m_xBuilder->weld_container("container"))
 {
 }
 
@@ -233,11 +236,16 @@ void SubToolbarControl::GrabFocus()
 // TODO
 }
 
+SubToolbarControl::~SubToolbarControl()
+{
+m_rController.PopoverDestroyed();
+}
+
 std::unique_ptr SubToolBarController::weldPopupWindow()
 {
 SolarMutexGuard aGuard;
 
-auto pPopup = std::make_unique(getFrameInterface(), 
m_pToolbar);
+auto pPopup = std::make_unique(*this, m_pToolbar);
 
 css::uno::Reference< css::frame::XFrame > xFrame ( getFrameInterface() );
 
@@ -268,10 +276,6 @@ std::unique_ptr 
SubToolBarController::weldPopupWindow()
 catch ( css::lang::IllegalArgumentException& )
 {}
 
-weld::Popover* pPopover = 
dynamic_cast(pPopup->getTopLevel());
-if (pPopover)
-pPopover->connect_closed(LINK(this, SubToolBarController, 
OnPopoverClose));
-
 return pPopup;
 }
 
@@ -501,7 +505,7 @@ void SubToolBarController::initialize( const 
css::uno::Sequence< css::uno::Any >
 updateImage();
 }
 
-IMPL_LINK_NOARG(SubToolBarController, OnPopoverClose, weld::Popover&, void)
+void SubToolBarController::PopoverDestroyed()
 {
 disposeUIElement();
 m_xUIElement = nullptr;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - framework/source

2022-06-15 Thread Samuel Mehrbrodt (via logerrit)
 framework/source/dispatch/closedispatcher.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 2154945c4b1ed6dfe365f50e318c47b9fafbf4ee
Author: Samuel Mehrbrodt 
AuthorDate: Wed Jun 15 14:25:36 2022 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 16 07:49:53 2022 +0200

Show start center when closing last document

also when there are active UNO connections.

(Behavior was different when there were active UNO connections)

Change-Id: Ief37b0f362b7e2a47eccbec985ee3017c475046c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135905
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 539374caa5deac788f394a54a75b6e167ab04864)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135939

diff --git a/framework/source/dispatch/closedispatcher.cxx 
b/framework/source/dispatch/closedispatcher.cxx
index 19fe9ffaa69d..a6ff39d459c3 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -353,12 +353,17 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, 
LinkParamNone*, void)
 // application or establish the backing mode now.
 // And that depends from the dispatched URL ...
 {
-if (bHasActiveConnections)
-bCloseFrame = true;
-else if (eOperation == E_CLOSE_FRAME)
-bTerminateApp = true;
+if (eOperation == E_CLOSE_FRAME)
+{
+if (bHasActiveConnections)
+bCloseFrame = true;
+else
+bTerminateApp = true;
+}
 else if( 
SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::STARTMODULE) )
 bEstablishBackingMode = true;
+else if (bHasActiveConnections)
+bCloseFrame = true;
 else
 bTerminateApp = true;
 }