diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-11-29 10:03:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-11-30 07:05:02 +0100 |
commit | 2d594080628d66649e5f01455adb50e3d49cb195 (patch) | |
tree | 3024a80f4847d4a61c0da5a712ce2c76ffd2d120 | |
parent | 402e05114df0aeeb53b85106e1f18140de52bfb8 (diff) |
merge classes VCLXTopWindow_Base and VCLXTopWindow
Change-Id: I4c0718d2947449fa076b0afd3046587c73784558
Reviewed-on: https://gerrit.libreoffice.org/84035
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/toolkit/awt/vclxtopwindow.hxx | 58 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtopwindow.cxx | 87 |
2 files changed, 44 insertions, 101 deletions
diff --git a/include/toolkit/awt/vclxtopwindow.hxx b/include/toolkit/awt/vclxtopwindow.hxx index 188f128f793e..9db6e7d51d24 100644 --- a/include/toolkit/awt/vclxtopwindow.hxx +++ b/include/toolkit/awt/vclxtopwindow.hxx @@ -24,33 +24,32 @@ #include <com/sun/star/awt/XTopWindow2.hpp> #include <cppuhelper/weak.hxx> -#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <toolkit/awt/vclxcontainer.hxx> namespace com { namespace sun { namespace star { namespace awt { class XMenuBar; } } } } -typedef ::cppu::ImplHelper1 < css::awt::XTopWindow2 +typedef ::cppu::ImplHelper2 < css::awt::XTopWindow2, css::awt::XSystemDependentWindowPeer > VCLXTopWindow_XBase; -typedef ::cppu::ImplHelper1 < css::awt::XSystemDependentWindowPeer - > VCLXTopWindow_SBase; -class VCLXTopWindow_Base :public VCLXTopWindow_XBase - ,public VCLXTopWindow_SBase -{ -protected: - virtual vcl::Window* GetWindowImpl() = 0; - virtual ::comphelper::OInterfaceContainerHelper2& GetTopWindowListenersImpl() = 0; - - VCLXTopWindow_Base(); +// class VCLXTopWindow +class VCLXTopWindow: public VCLXTopWindow_XBase, + public VCLXContainer +{ public: - virtual ~VCLXTopWindow_Base(); + VCLXTopWindow(); + virtual ~VCLXTopWindow() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() throw() override { OWeakObject::acquire(); } + void SAL_CALL release() throw() override { OWeakObject::release(); } - // XInterface equivalents - css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - // XTypeProvider equivalents - css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; // css::awt::XSystemDependentWindowPeer css::uno::Any SAL_CALL getWindowHandle( const css::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) override; @@ -69,31 +68,6 @@ public: virtual void SAL_CALL setIsMinimized( sal_Bool _isminimized ) override; virtual ::sal_Int32 SAL_CALL getDisplay() override; virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) override; -}; - - -// class VCLXTopWindow - - -class VCLXTopWindow: public VCLXTopWindow_Base, - public VCLXContainer -{ -protected: - virtual vcl::Window* GetWindowImpl() override; - virtual ::comphelper::OInterfaceContainerHelper2& GetTopWindowListenersImpl() override; - -public: - VCLXTopWindow(); - virtual ~VCLXTopWindow() override; - - // css::uno::XInterface - css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - void SAL_CALL acquire() throw() override { OWeakObject::acquire(); } - void SAL_CALL release() throw() override { OWeakObject::release(); } - - // css::lang::XTypeProvider - css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; - css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index f612851a8236..544cc60622ae 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -46,38 +46,14 @@ using ::com::sun::star::uno::Type; using ::com::sun::star::uno::Any; using ::com::sun::star::lang::IndexOutOfBoundsException; -VCLXTopWindow_Base::VCLXTopWindow_Base() -{ -} - -VCLXTopWindow_Base::~VCLXTopWindow_Base() -{ -} - -Any VCLXTopWindow_Base::queryInterface( const Type & rType ) -{ - css::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) ); - - if (!aRet.hasValue()) - aRet = VCLXTopWindow_SBase::queryInterface( rType ); - - return aRet; -} -Sequence< Type > VCLXTopWindow_Base::getTypes() -{ - Sequence< Type > aTypes( VCLXTopWindow_XBase::getTypes() ); - aTypes = ::comphelper::concatSequences( aTypes, VCLXTopWindow_SBase::getTypes() ); - return aTypes; -} - -css::uno::Any VCLXTopWindow_Base::getWindowHandle( const css::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) +css::uno::Any VCLXTopWindow::getWindowHandle( const css::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) { SolarMutexGuard aGuard; // TODO, check the process id css::uno::Any aRet; - vcl::Window* pWindow = GetWindowImpl(); + vcl::Window* pWindow = VCLXContainer::GetWindow().get(); if ( pWindow ) { const SystemEnvData* pSysData = static_cast<SystemWindow *>(pWindow)->GetSystemData(); @@ -113,38 +89,38 @@ css::uno::Any VCLXTopWindow_Base::getWindowHandle( const css::uno::Sequence< sal return aRet; } -void VCLXTopWindow_Base::addTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& rxListener ) +void VCLXTopWindow::addTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& rxListener ) { SolarMutexGuard aGuard; - GetTopWindowListenersImpl().addInterface( rxListener ); + GetTopWindowListeners().addInterface( rxListener ); } -void VCLXTopWindow_Base::removeTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& rxListener ) +void VCLXTopWindow::removeTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& rxListener ) { SolarMutexGuard aGuard; - GetTopWindowListenersImpl().removeInterface( rxListener ); + GetTopWindowListeners().removeInterface( rxListener ); } -void VCLXTopWindow_Base::toFront( ) +void VCLXTopWindow::toFront( ) { SolarMutexGuard aGuard; - vcl::Window* pWindow = GetWindowImpl(); + vcl::Window* pWindow = VCLXContainer::GetWindow().get(); if ( pWindow ) static_cast<WorkWindow*>(pWindow)->ToTop( ToTopFlags::RestoreWhenMin ); } -void VCLXTopWindow_Base::toBack( ) +void VCLXTopWindow::toBack( ) { } -void VCLXTopWindow_Base::setMenuBar( const css::uno::Reference< css::awt::XMenuBar >& rxMenu ) +void VCLXTopWindow::setMenuBar( const css::uno::Reference< css::awt::XMenuBar >& rxMenu ) { SolarMutexGuard aGuard; - vcl::Window* pWindow = GetWindowImpl(); + vcl::Window* pWindow = VCLXContainer::GetWindow().get(); if ( pWindow ) { SystemWindow* pSystemWindow = static_cast<SystemWindow*>( pWindow ); @@ -159,11 +135,11 @@ void VCLXTopWindow_Base::setMenuBar( const css::uno::Reference< css::awt::XMenuB } -sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() +sal_Bool SAL_CALL VCLXTopWindow::getIsMaximized() { SolarMutexGuard aGuard; - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); + const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( VCLXContainer::GetWindow().get() ); if ( !pWindow ) return false; @@ -171,11 +147,11 @@ sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() } -void SAL_CALL VCLXTopWindow_Base::setIsMaximized( sal_Bool _ismaximized ) +void SAL_CALL VCLXTopWindow::setIsMaximized( sal_Bool _ismaximized ) { SolarMutexGuard aGuard; - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); + WorkWindow* pWindow = dynamic_cast< WorkWindow* >( VCLXContainer::GetWindow().get() ); if ( !pWindow ) return; @@ -183,11 +159,11 @@ void SAL_CALL VCLXTopWindow_Base::setIsMaximized( sal_Bool _ismaximized ) } -sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() +sal_Bool SAL_CALL VCLXTopWindow::getIsMinimized() { SolarMutexGuard aGuard; - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); + const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( VCLXContainer::GetWindow().get() ); if ( !pWindow ) return false; @@ -195,11 +171,11 @@ sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() } -void SAL_CALL VCLXTopWindow_Base::setIsMinimized( sal_Bool _isMinimized ) +void SAL_CALL VCLXTopWindow::setIsMinimized( sal_Bool _isMinimized ) { SolarMutexGuard aGuard; - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); + WorkWindow* pWindow = dynamic_cast< WorkWindow* >( VCLXContainer::GetWindow().get() ); if ( !pWindow ) return; @@ -207,11 +183,11 @@ void SAL_CALL VCLXTopWindow_Base::setIsMinimized( sal_Bool _isMinimized ) } -::sal_Int32 SAL_CALL VCLXTopWindow_Base::getDisplay() +::sal_Int32 SAL_CALL VCLXTopWindow::getDisplay() { SolarMutexGuard aGuard; - const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( GetWindowImpl() ); + const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( VCLXContainer::GetWindow().get() ); if ( !pWindow ) return 0; @@ -219,14 +195,14 @@ void SAL_CALL VCLXTopWindow_Base::setIsMinimized( sal_Bool _isMinimized ) } -void SAL_CALL VCLXTopWindow_Base::setDisplay( ::sal_Int32 _display ) +void SAL_CALL VCLXTopWindow::setDisplay( ::sal_Int32 _display ) { SolarMutexGuard aGuard; if ( ( _display < 0 ) || ( _display >= static_cast<sal_Int32>(Application::GetScreenCount()) ) ) throw IndexOutOfBoundsException(); - SystemWindow* pWindow = dynamic_cast< SystemWindow* >( GetWindowImpl() ); + SystemWindow* pWindow = dynamic_cast< SystemWindow* >( VCLXContainer::GetWindow().get() ); if ( !pWindow ) return; @@ -250,21 +226,13 @@ VCLXTopWindow::~VCLXTopWindow() { } -vcl::Window* VCLXTopWindow::GetWindowImpl() -{ - return VCLXContainer::GetWindow(); -} - -::comphelper::OInterfaceContainerHelper2& VCLXTopWindow::GetTopWindowListenersImpl() -{ - return GetTopWindowListeners(); -} - // css::uno::XInterface css::uno::Any VCLXTopWindow::queryInterface( const css::uno::Type & rType ) { - css::uno::Any aRet( VCLXTopWindow_Base::queryInterface( rType ) ); + css::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) ); + if (!aRet.hasValue()) + aRet = VCLXTopWindow_XBase::queryInterface( rType ); if ( !aRet.hasValue() ) aRet = VCLXContainer::queryInterface( rType ); @@ -278,7 +246,8 @@ css::uno::Sequence< sal_Int8 > VCLXTopWindow::getImplementationId() css::uno::Sequence< css::uno::Type > VCLXTopWindow::getTypes() { - return ::comphelper::concatSequences( VCLXTopWindow_Base::getTypes(), VCLXContainer::getTypes() ); + return ::comphelper::concatSequences( VCLXTopWindow_XBase::getTypes(), VCLXContainer::getTypes() ); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |