diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-05-31 14:59:09 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-05-31 18:51:06 +0200 |
commit | 259a1ebd879f1cfe7e9db9af97d3842fcd51f640 (patch) | |
tree | 92eaf094420ac25144bea99b2cfd4a1dc892a2b5 /uui | |
parent | 391cb44d415e2126f668ecf62387d5e98ffa6f5c (diff) |
Rework UUIInteractionHelper construction
...to remove the need to construct a fresh m_pImpl in
UUIInteractionHandler::initialize
Change-Id: Ia3f1b89903448f74242a5fec3dcf87c2b1f5e764
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135187
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'uui')
-rw-r--r-- | uui/source/iahndl.cxx | 10 | ||||
-rw-r--r-- | uui/source/iahndl.hxx | 11 | ||||
-rw-r--r-- | uui/source/interactionhandler.cxx | 17 |
3 files changed, 10 insertions, 28 deletions
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 251a642e509f..9f6a3d34b9d6 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -121,16 +121,6 @@ public: } /* namespace */ UUIInteractionHelper::UUIInteractionHelper( - uno::Reference< uno::XComponentContext > const & rxContext, - uno::Reference< awt::XWindow > const & rxWindowParam, - const OUString & rContextParam) - : m_xContext(rxContext), - m_xWindowParam(rxWindowParam), - m_aContextParam(rContextParam) -{ -} - -UUIInteractionHelper::UUIInteractionHelper( uno::Reference< uno::XComponentContext > const & rxContext) : m_xContext(rxContext) { diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index df2bdd054b47..a43122b7adb4 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -73,22 +73,20 @@ class UUIInteractionHelper private: css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::awt::XWindow > m_xWindowParam; - const OUString m_aContextParam; + OUString m_aContextParam; StringHashMap m_aTypedCustomHandlers; UUIInteractionHelper(UUIInteractionHelper const &) = delete; UUIInteractionHelper& operator =(UUIInteractionHelper const &) = delete; public: - UUIInteractionHelper( - css::uno::Reference< css::uno::XComponentContext > const & rxContext, - css::uno::Reference< css::awt::XWindow > const & rxWindow, - const OUString & rContextParam); explicit UUIInteractionHelper( css::uno::Reference< css::uno::XComponentContext > const & rxContext); const css::uno::Reference<css::awt::XWindow> & GetParentWindow() const { return m_xWindowParam; } void SetParentWindow(const css::uno::Reference<css::awt::XWindow>& rWindow) { m_xWindowParam = rWindow; } + void setContext(OUString const & context) { m_aContextParam = context; } + ~UUIInteractionHelper(); bool handleRequest( css::uno::Reference< css::task::XInteractionRequest > const & rRequest); @@ -103,9 +101,6 @@ public: const OUString& aMessage, std::vector< OUString > const & rArguments ); - const css::uno::Reference< css::uno::XComponentContext >& - getORB() const - { return m_xContext; } private: bool handleRequest_impl( diff --git a/uui/source/interactionhandler.cxx b/uui/source/interactionhandler.cxx index b9e3f4d788a1..ea6ebf6d36a4 100644 --- a/uui/source/interactionhandler.cxx +++ b/uui/source/interactionhandler.cxx @@ -34,7 +34,6 @@ #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> -#include <optional> using namespace com::sun::star; @@ -47,7 +46,7 @@ class UUIInteractionHandler: css::beans::XPropertySet> { private: - std::optional<UUIInteractionHelper> m_pImpl; + UUIInteractionHelper m_pImpl; public: explicit UUIInteractionHandler(css::uno::Reference< css::uno::XComponentContext > const & rxContext); @@ -114,7 +113,7 @@ public: { css::uno::Reference<css::awt::XWindow> xWindow; rValue >>= xWindow; - m_pImpl->SetParentWindow(xWindow); + m_pImpl.SetParentWindow(xWindow); return; } throw css::beans::UnknownPropertyException(rPropertyName); @@ -124,7 +123,7 @@ public: { if (rPropertyName == "ParentWindow") { - return uno::Any(m_pImpl->GetParentWindow()); + return uno::Any(m_pImpl.GetParentWindow()); } throw css::beans::UnknownPropertyException(rPropertyName); } @@ -161,9 +160,6 @@ void SAL_CALL UUIInteractionHandler::initialize( uno::Sequence< uno::Any > const & rArguments) { - uno::Reference<uno::XComponentContext> xContext = m_pImpl->getORB(); - m_pImpl.reset(); - // The old-style InteractionHandler service supported a sequence of // PropertyValue, while the new-style service now uses constructors to pass // in Parent and Context values; for backwards compatibility, keep support @@ -185,7 +181,8 @@ UUIInteractionHandler::initialize( } } - m_pImpl.emplace( xContext, xWindow, aContext ); + m_pImpl.SetParentWindow(xWindow); + m_pImpl.setContext(aContext); } void SAL_CALL @@ -194,7 +191,7 @@ UUIInteractionHandler::handle( { try { - m_pImpl->handleRequest(rRequest); + m_pImpl.handleRequest(rRequest); } catch (uno::RuntimeException const & ex) { @@ -209,7 +206,7 @@ sal_Bool SAL_CALL UUIInteractionHandler::handleInteractionRequest( { try { - return m_pImpl->handleRequest( Request ); + return m_pImpl.handleRequest( Request ); } catch (uno::RuntimeException const & ex) { |