diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-03 14:02:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-03 13:44:22 +0000 |
commit | df182c7e4235513916204a4dc4aec6ec6e4c746b (patch) | |
tree | d297e633c191d1dbd267d51bb8bf19a025e06049 | |
parent | 37a4d67d6885860c279476c2504e35c3190ffc6c (diff) |
flatten OGenericUnoController
rather than having a confusing mix of pimpl pattern and inline fields
Change-Id: I2953df1893f49efb43f387d0d6348c6b17de83f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148175
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | dbaccess/source/ui/browser/genericcontroller.cxx | 58 | ||||
-rw-r--r-- | include/dbaccess/genericcontroller.hxx | 7 |
2 files changed, 13 insertions, 52 deletions
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index a5c8afbb306b..654ad2ff1525 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/ui/XSidebarProvider.hpp> -#include <sfx2/userinputinterception.hxx> #include <datasourceconnector.hxx> #include <com/sun/star/frame/FrameSearchFlag.hpp> @@ -73,32 +72,11 @@ typedef std::unordered_map< sal_Int16, sal_Int16 > CommandHashMap; namespace dbaui { -namespace { - -// UserDefinedFeatures -class UserDefinedFeatures -{ -public: - explicit UserDefinedFeatures( const Reference< XController >& _rxController ); - - void execute( const URL& _rFeatureURL, const Sequence< PropertyValue>& _rArgs ); - -private: - css::uno::WeakReference< XController > m_aController; -}; - -} - -UserDefinedFeatures::UserDefinedFeatures( const Reference< XController >& _rxController ) - :m_aController( _rxController ) -{ -} - -void UserDefinedFeatures::execute( const URL& _rFeatureURL, const Sequence< PropertyValue>& _rArgs ) +void OGenericUnoController::executeUserDefinedFeatures( const URL& _rFeatureURL, const Sequence< PropertyValue>& _rArgs ) { try { - Reference< XController > xController( Reference< XController >(m_aController), UNO_SET_THROW ); + Reference< XController > xController( getXController(), UNO_SET_THROW ); Reference< XDispatchProvider > xDispatchProvider( xController->getFrame(), UNO_QUERY_THROW ); Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( _rFeatureURL, @@ -121,22 +99,10 @@ void UserDefinedFeatures::execute( const URL& _rFeatureURL, const Sequence< Prop } } -// OGenericUnoController_Data -struct OGenericUnoController_Data -{ - ::sfx2::UserInputInterception m_aUserInputInterception; - UserDefinedFeatures m_aUserDefinedFeatures; - - OGenericUnoController_Data( OGenericUnoController& _rController, ::osl::Mutex& _rMutex ) - :m_aUserInputInterception( _rController, _rMutex ) - ,m_aUserDefinedFeatures( _rController.getXController() ) - { - } -}; - // OGenericUnoController OGenericUnoController::OGenericUnoController(const Reference< XComponentContext >& _rM) :OGenericUnoController_Base( getMutex() ) + ,m_aUserInputInterception(*this, getMutex()) ,m_pView(nullptr) #ifdef DBG_UTIL ,m_bDescribingSupportedFeatures( false ) @@ -150,12 +116,6 @@ OGenericUnoController::OGenericUnoController(const Reference< XComponentContext ,m_bCurrentlyModified(false) ,m_bExternalTitle(false) { - osl_atomic_increment( &m_refCount ); - { - m_pData.reset( new OGenericUnoController_Data( *this, getMutex() ) ); - } - osl_atomic_decrement( &m_refCount ); - try { @@ -815,7 +775,7 @@ void OGenericUnoController::Execute( sal_uInt16 _nId, const Sequence< PropertyVa // user defined features can be handled by dispatch interceptors resp. protocol handlers only. // So, we need to do a queryDispatch, and dispatch the URL - m_pData->m_aUserDefinedFeatures.execute( getURLForId( _nId ), _rArgs ); + executeUserDefinedFeatures( getURLForId( _nId ), _rArgs ); } URL OGenericUnoController::getURLForId(sal_Int32 _nId) const @@ -1102,23 +1062,23 @@ void SAL_CALL OGenericUnoController::removeTitleChangeListener(const Reference< void SAL_CALL OGenericUnoController::addKeyHandler( const Reference< XKeyHandler >& _rxHandler ) { if ( _rxHandler.is() ) - m_pData->m_aUserInputInterception.addKeyHandler( _rxHandler ); + m_aUserInputInterception.addKeyHandler( _rxHandler ); } void SAL_CALL OGenericUnoController::removeKeyHandler( const Reference< XKeyHandler >& _rxHandler ) { - m_pData->m_aUserInputInterception.removeKeyHandler( _rxHandler ); + m_aUserInputInterception.removeKeyHandler( _rxHandler ); } void SAL_CALL OGenericUnoController::addMouseClickHandler( const Reference< XMouseClickHandler >& _rxHandler ) { if ( _rxHandler.is() ) - m_pData->m_aUserInputInterception.addMouseClickHandler( _rxHandler ); + m_aUserInputInterception.addMouseClickHandler( _rxHandler ); } void SAL_CALL OGenericUnoController::removeMouseClickHandler( const Reference< XMouseClickHandler >& _rxHandler ) { - m_pData->m_aUserInputInterception.removeMouseClickHandler( _rxHandler ); + m_aUserInputInterception.removeMouseClickHandler( _rxHandler ); } void OGenericUnoController::executeChecked(sal_uInt16 _nCommandId, const Sequence< PropertyValue >& aArgs) @@ -1144,7 +1104,7 @@ Reference< XController > OGenericUnoController::getXController() bool OGenericUnoController::interceptUserInput( const NotifyEvent& _rEvent ) { - return m_pData->m_aUserInputInterception.handleNotifyEvent( _rEvent ); + return m_aUserInputInterception.handleNotifyEvent( _rEvent ); } bool OGenericUnoController::isCommandChecked(sal_uInt16 _nCommandId) const diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx index 6ef9393c2f9a..efe193b28e7d 100644 --- a/include/dbaccess/genericcontroller.hxx +++ b/include/dbaccess/genericcontroller.hxx @@ -63,6 +63,7 @@ #include <sal/types.h> #include <tools/link.hxx> #include <vcl/vclptr.hxx> +#include <sfx2/userinputinterception.hxx> namespace com::sun::star { namespace awt { class XKeyHandler; } @@ -208,9 +209,7 @@ namespace dbaui SupportedFeatures m_aSupportedFeatures; ::comphelper::NamedValueCollection m_aInitParameters; - - ::std::unique_ptr< OGenericUnoController_Data > - m_pData; + ::sfx2::UserInputInterception m_aUserInputInterception; VclPtr<ODataView> m_pView; // our (VCL) "main window" #ifdef DBG_UTIL @@ -376,6 +375,8 @@ namespace dbaui void ImplBroadcastFeatureState(const OUString& _rFeature, const css::uno::Reference< css::frame::XStatusListener > & xListener, bool _bIgnoreCache); + void executeUserDefinedFeatures( const css::util::URL& _rFeatureURL, const css::uno::Sequence< css::beans::PropertyValue>& _rArgs ); + // link methods DECL_DLLPRIVATE_LINK(OnAsyncInvalidateAll, void*, void); DECL_DLLPRIVATE_LINK(OnAsyncCloseTask, void*, void); |