[Libreoffice-commits] core.git: framework/inc framework/source framework/util include/framework sfx2/source

2021-03-23 Thread Noel Grandin (via logerrit)
 framework/inc/helper/mischelper.hxx |2 +
 framework/source/fwe/classes/sfxhelperfunctions.cxx |3 +
 framework/source/fwi/helper/mischelper.cxx  |4 +-
 framework/source/services/ContextChangeEventMultiplexer.cxx |   24 +++-
 framework/util/fwk.component|3 +
 include/framework/ContextChangeEventMultiplexerTunnel.hxx   |2 +
 sfx2/source/sidebar/SidebarController.cxx   |4 +-
 7 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit a9493229bb453a8f437c45d838777e2ba8217b76
Author: Noel Grandin 
AuthorDate: Sun Mar 21 13:41:39 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 23 09:33:43 2021 +0100

use single-use attribute for ContextChangeEventMultiplexer

instead of rtl::Instance, which means it will get
cleaned up when UNO shuts down

Change-Id: I13b36f1fe570f789036ef54ecfb7d0a85ce1450c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112842
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/framework/inc/helper/mischelper.hxx 
b/framework/inc/helper/mischelper.hxx
index 4dcb94003449..d05ae360a082 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -246,10 +246,12 @@ class WeakDocumentEventListener final : public 
::cppu::WeakImplHelper
 GetFirstListenerWith_Impl(
+css::uno::Reference const & xComponentContext,
 css::uno::Reference const& xEventFocus,
 std::function const&)> const& 
rPredicate);
 
 extern auto (*g_pGetMultiplexerListener)(
+css::uno::Reference const & xComponentContext,
 css::uno::Reference const&,
 std::function const&)> const&)
 -> css::uno::Reference;
diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx 
b/framework/source/fwe/classes/sfxhelperfunctions.cxx
index e456a7a42460..9adc5931a7e3 100644
--- a/framework/source/fwe/classes/sfxhelperfunctions.cxx
+++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx
@@ -146,10 +146,11 @@ bool IsDockingWindowVisible( const css::uno::Reference< 
css::frame::XFrame >& rF
 
 using namespace ::com::sun::star;
 uno::Reference GetFirstListenerWith(
+css::uno::Reference const & xComponentContext,
 uno::Reference const& xEventFocus,
 std::function 
const&)> const& rPredicate)
 {
-return GetFirstListenerWith_Impl(xEventFocus, rPredicate);
+return GetFirstListenerWith_Impl(xComponentContext, xEventFocus, 
rPredicate);
 }
 
 }
diff --git a/framework/source/fwi/helper/mischelper.cxx 
b/framework/source/fwi/helper/mischelper.cxx
index b53cd0f2672d..e9c664d474df 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -133,17 +133,19 @@ void FillLangItems( std::set< OUString > &rLangItems,
 }
 
 auto (*g_pGetMultiplexerListener)(
+css::uno::Reference const & xComponentContext,
 uno::Reference const&,
 std::function 
const&)> const&)
 -> uno::Reference = nullptr;
 
 uno::Reference
 GetFirstListenerWith_Impl(
+css::uno::Reference const & xComponentContext,
 uno::Reference const& xEventFocus,
 std::function 
const&)> const& rPredicate)
 {
 assert(g_pGetMultiplexerListener != nullptr); // should not be called too 
early, nor too late
-return g_pGetMultiplexerListener(xEventFocus, rPredicate);
+return g_pGetMultiplexerListener(xComponentContext, xEventFocus, 
rPredicate);
 }
 
 
diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx 
b/framework/source/services/ContextChangeEventMultiplexer.cxx
index fe24c2b6d770..3e647985cb40 100644
--- a/framework/source/services/ContextChangeEventMultiplexer.cxx
+++ b/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -23,11 +23,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -324,34 +326,21 @@ void SAL_CALL ContextChangeEventMultiplexer::disposing ( 
const css::lang::EventO
 maListeners.erase(iDescriptor);
 }
 
-struct Instance {
-explicit Instance():
-instance(static_cast(
-new ContextChangeEventMultiplexer()))
-{
-}
-
-css::uno::Reference instance;
-};
-
-struct Singleton:
-public rtl::Static
-{};
-
 }
 
 namespace framework {
 
 // right now we assume there's one matching listener
 static uno::Reference 
GetFirstListenerWith_ImplImpl(
+css::uno::Reference const & xComponentContext,
 uno::Reference const& xEventFocus,
 std::function 
const&)> const& rPredicate)
 {
 assert(xEventFocus.is()); // in current usage it's a bug if the 
XController is null here
 uno::Reference xRet;
 
-ContextChangeEventMultiplexer *const pMultiplexer(
-dynamic_cast(Singleton::get().instance.get()));
+rtl::Reference pMultiplexer =
+dynamic_cast(ui::ContextChangeEventMultiplexer::get(xComponentContext).get());
 assert(pMultiplexer);
 
 ContextCh

[Libreoffice-commits] core.git: framework/inc framework/source framework/util include/framework

2020-07-07 Thread Noel Grandin (via logerrit)
 framework/inc/dispatch/oxt_handler.hxx   |   15 +-
 framework/inc/dispatch/popupmenudispatcher.hxx   |   10 -
 framework/inc/dispatch/servicehandler.hxx|   14 +-
 framework/inc/dispatch/systemexec.hxx|   10 -
 framework/inc/jobs/helponstartup.hxx |   10 -
 framework/inc/jobs/shelljob.hxx  |   10 -
 framework/inc/services.h |   12 --
 framework/inc/services/uriabbreviation.hxx   |9 -
 framework/inc/uielement/newmenucontroller.hxx|   10 -
 framework/inc/uielement/toolbarmodemenucontroller.hxx|   10 -
 framework/inc/uielement/toolbarsmenucontroller.hxx   |   10 -
 framework/source/dispatch/dispatchdisabler.cxx   |   28 -
 framework/source/dispatch/oxt_handler.cxx|   39 ---
 framework/source/dispatch/popupmenudispatcher.cxx|   58 +-
 framework/source/dispatch/servicehandler.cxx |   46 
 framework/source/dispatch/systemexec.cxx |   35 +++---
 framework/source/inc/dispatch/dispatchdisabler.hxx   |9 -
 framework/source/jobs/helponstartup.cxx  |   81 ---
 framework/source/jobs/shelljob.cxx   |   38 ---
 framework/source/register/registertemp.cxx   |   14 --
 framework/source/services/dispatchhelper.cxx |   24 +++-
 framework/source/services/uriabbreviation.cxx|   31 +++--
 framework/source/uielement/newmenucontroller.cxx |   27 +++--
 framework/source/uielement/toolbarmodemenucontroller.cxx |   29 -
 framework/source/uielement/toolbarsmenucontroller.cxx|   28 -
 framework/util/fwk.component |   36 --
 include/framework/dispatchhelper.hxx |   12 --
 27 files changed, 354 insertions(+), 301 deletions(-)

New commits:
commit 71227e2306987cb8aa5fbda2943e73237674e9ba
Author: Noel Grandin 
AuthorDate: Tue Jul 7 20:02:18 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 7 22:13:02 2020 +0200

framework: create instances with uno constructors

See tdf#74608 for motivation

Change-Id: I8679b50395d11cb2d807d52526d803df9b0606b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98294
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/framework/inc/dispatch/oxt_handler.hxx 
b/framework/inc/dispatch/oxt_handler.hxx
index 69bc07074c3e..bc9c24070cde 100644
--- a/framework/inc/dispatch/oxt_handler.hxx
+++ b/framework/inc/dispatch/oxt_handler.hxx
@@ -52,16 +52,13 @@ class Oxt_Handler final  :  public  ::cppu::WeakImplHelper<
 
 public:
 
- Oxt_Handler( const css::uno::Reference< 
css::lang::XMultiServiceFactory >& xFactory );
+ Oxt_Handler( const css::uno::Reference< 
css::uno::XComponentContext >&  );
 virtual ~Oxt_Handler(  
  ) override;
 
-//  XInterface, XTypeProvider, XServiceInfo
-
-DECLARE_XSERVICEINFO_NOFACTORY
-/* Helper for registry */
-/// @throws css::uno::Exception
-static css::uno::Reference< css::uno::XInterface > 
SAL_CALL impl_createInstance( const css::uno::Reference< 
css::lang::XMultiServiceFactory >& xServiceManager );
-static css::uno::Reference< css::lang::XSingleServiceFactory > 
impl_createFactory ( const css::uno::Reference< 
css::lang::XMultiServiceFactory >& xServiceManager );
+/* interface XServiceInfo */
+virtual OUString SAL_CALL getImplementationName() override;
+virtual sal_Bool SAL_CALL supportsService( const OUString& 
sServiceName ) override;
+virtual css::uno::Sequence< OUString > SAL_CALL 
getSupportedServiceNames() override;
 
 //  XNotifyingDispatch
 
@@ -85,7 +82,7 @@ class Oxt_Handler final  :  public  ::cppu::WeakImplHelper<
 private:
 osl::Mutex m_mutex;
 
-css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; 
  /// global uno service factory to create new services
+css::uno::Reference< css::uno::XComponentContext > m_xContext;   
/// global uno service factory to create new services
 
 };
 
diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx 
b/framework/inc/dispatch/popupmenudispatcher.hxx
index 869ee956e4a4..845e5c92592d 100644
--- a/framework/inc/dispatch/popupmenudispatcher.hxx
+++ b/framework/inc/dispatch/popupmenudispatcher.hxx
@@ -68,12 +68,10 @@ class PopupMenuDispatcher final : public  
::cppu::WeakImplHelper<
 //  constructor / destructor
 PopupMenuDispatcher( const css::uno::Reference< 
css::uno::XComponentContext >& xContext );
 
-// XInterface, XTypeProvider, XServiceInfo
-DECLARE_XSERVICEINFO_NOFACTORY
-/* Helper for registry */
-/// @throws css::uno::Excepti