summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-12-02 13:40:39 +0100
committerMathias Bauer <mba@openoffice.org>2009-12-02 13:40:39 +0100
commit50ecff830f5211792dd8e8e14c1ecd1564600ecb (patch)
tree445b801d7e42ec7b520a6d8db50cc218cdc394bd /toolkit
parent100882583706d346d20d36f39b534789f62df2a4 (diff)
parent0b46bdb4967eac005e006bd7cece131ca88a7ddd (diff)
merge with db33a
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/toolkit/awt/vclxtopwindow.hxx37
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx5
-rw-r--r--toolkit/source/awt/vclxdialog.cxx1
-rw-r--r--toolkit/source/awt/vclxtopwindow.cxx166
-rw-r--r--toolkit/source/awt/vclxwindows.cxx3
-rw-r--r--toolkit/source/controls/unocontrol.cxx8
6 files changed, 152 insertions, 68 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
index 7b4f1922b99e..4716120a347b 100644
--- a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
+++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
@@ -32,31 +32,45 @@
#define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
-#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XTopWindow2.hpp>
#include <com/sun/star/awt/XMenuBar.hpp>
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <toolkit/awt/vclxcontainer.hxx>
-typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTopWindow,
- ::com::sun::star::awt::XSystemDependentWindowPeer
- > VCLXTopWindow_XBase;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XTopWindow2
+ > VCLXTopWindow_XBase;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSystemDependentWindowPeer
+ > VCLXTopWindow_SBase;
-class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base: public VCLXTopWindow_XBase
+class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base :public VCLXTopWindow_XBase
+ ,public VCLXTopWindow_SBase
{
+private:
+ const bool m_bWHWND;
+
protected:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar;
+ bool isSystemDependentWindowPeer() const { return m_bWHWND; }
+
virtual ::vos::IMutex& GetMutexImpl() = 0;
virtual Window* GetWindowImpl() = 0;
virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0;
+ VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer );
+
public:
virtual ~VCLXTopWindow_Base();
+ // XInterface equivalents
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ // XTypeProvider equivalents
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::awt::XSystemDependentWindowPeer
::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException);
@@ -66,6 +80,14 @@ public:
void SAL_CALL toFront() throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL toBack() throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTopWindow2
+ virtual ::sal_Bool SAL_CALL getIsMaximized() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIsMaximized( ::sal_Bool _ismaximized ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getIsMinimized() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIsMinimized( ::sal_Bool _isminimized ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDisplay() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
};
// ----------------------------------------------------
@@ -75,9 +97,6 @@ public:
class VCLXTopWindow: public VCLXTopWindow_Base,
public VCLXContainer
{
-private:
- bool m_bWHWND;
-
protected:
virtual vos::IMutex& GetMutexImpl();
virtual Window* GetWindowImpl();
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index 3e61a9e9aa87..b6958c720f29 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -32,6 +32,7 @@
#define _TOOLKIT_AWT_VCLXWINDOWS_HXX_
#include <toolkit/dllapi.h>
+
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -88,8 +89,8 @@
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase2.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/awt/vclxtopwindow.hxx>
+#include "toolkit/awt/vclxwindow.hxx"
+#include "toolkit/awt/vclxtopwindow.hxx"
#include <cppuhelper/implbase1.hxx>
#include <vcl/pointr.hxx>
diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx
index 0712f8ca074c..32f2931e7438 100644
--- a/toolkit/source/awt/vclxdialog.cxx
+++ b/toolkit/source/awt/vclxdialog.cxx
@@ -66,6 +66,7 @@ DBG_NAME( VCLXDialog )
VCLXDialog::VCLXDialog()
: VCLXWindow()
+ , VCLXTopWindow_Base( true )
, VCLXDialog_Base()
, Bin()
, bRealized( false )
diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx
index 26e457d74583..6e532c7bef3e 100644
--- a/toolkit/source/awt/vclxtopwindow.cxx
+++ b/toolkit/source/awt/vclxtopwindow.cxx
@@ -46,6 +46,7 @@
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
#include <toolkit/awt/vclxtopwindow.hxx>
#include <toolkit/awt/vclxmenu.hxx>
@@ -54,13 +55,44 @@
#include <vcl/wrkwin.hxx>
#include <vcl/syswin.hxx>
#include <vcl/menu.hxx>
+#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+
+VCLXTopWindow_Base::VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer )
+ :m_bWHWND( _bSupportSystemWindowPeer )
+{
+}
+
VCLXTopWindow_Base::~VCLXTopWindow_Base()
{
}
+Any VCLXTopWindow_Base::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) );
+
+ // do not expose XSystemDependentWindowPeer if we do not have a system window handle
+ if ( !aRet.hasValue() && m_bWHWND )
+ aRet = VCLXTopWindow_SBase::queryInterface( rType );
+
+ return aRet;
+}
+
+Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException)
+{
+ Sequence< Type > aTypes( VCLXTopWindow_XBase::getTypes() );
+ if ( m_bWHWND )
+ aTypes = ::comphelper::concatSequences( aTypes, VCLXTopWindow_SBase::getTypes() );
+ return aTypes;
+}
+
::com::sun::star::uno::Any VCLXTopWindow_Base::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutexImpl() );
@@ -157,6 +189,81 @@ void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::c
mxMenuBar = rxMenu;
}
+//--------------------------------------------------------------------
+::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return sal_False;
+
+ return pWindow->IsMaximized();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setIsMaximized( ::sal_Bool _ismaximized ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ pWindow->Maximize( _ismaximized );
+}
+
+//--------------------------------------------------------------------
+::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return sal_False;
+
+ return pWindow->IsMinimized();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setIsMinimized( ::sal_Bool _isMinimized ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ _isMinimized ? pWindow->Minimize() : pWindow->Restore();
+}
+
+//--------------------------------------------------------------------
+::sal_Int32 SAL_CALL VCLXTopWindow_Base::getDisplay() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return 0;
+
+ return pWindow->GetScreenNumber();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setDisplay( ::sal_Int32 _display ) throw (RuntimeException, IndexOutOfBoundsException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ if ( ( _display < 0 ) || ( _display >= (sal_Int32)Application::GetScreenCount() ) )
+ throw IndexOutOfBoundsException();
+
+ SystemWindow* pWindow = dynamic_cast< SystemWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ pWindow->SetScreenNumber( _display );
+}
+
// ----------------------------------------------------
// class VCLXTopWindow
// ----------------------------------------------------
@@ -167,7 +274,7 @@ void VCLXTopWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
}
VCLXTopWindow::VCLXTopWindow(bool bWHWND)
- : m_bWHWND(bWHWND)
+ : VCLXTopWindow_Base( bWHWND )
{
}
@@ -193,24 +300,19 @@ Window* VCLXTopWindow::GetWindowImpl()
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any VCLXTopWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
- ::com::sun::star::uno::Any aRet;
- if(! m_bWHWND) {
- aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ) );
- }
- else {
- aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer*, this ) );
- }
- return (aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType ));
+ ::com::sun::star::uno::Any aRet( VCLXTopWindow_Base::queryInterface( rType ) );
+
+ if ( !aRet.hasValue() )
+ aRet = VCLXContainer::queryInterface( rType );
+
+ return aRet;
}
::com::sun::star::uno::Sequence< sal_Int8 > VCLXTopWindow::getImplementationId() throw(::com::sun::star::uno::RuntimeException)
{
static ::cppu::OImplementationId* pId = NULL;
static ::cppu::OImplementationId* pIdWithHandle = NULL;
- if ( m_bWHWND )
+ if ( isSystemDependentWindowPeer() )
{
if( !pIdWithHandle )
{
@@ -242,41 +344,5 @@ Window* VCLXTopWindow::GetWindowImpl()
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXTopWindow::getTypes() throw(::com::sun::star::uno::RuntimeException)
{
- static ::cppu::OTypeCollection* pCollection = NULL;
- static ::cppu::OTypeCollection* pCollectionWithHandle = NULL;
-
- if ( m_bWHWND )
- {
- if( !pCollectionWithHandle )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pCollectionWithHandle )
- {
- static ::cppu::OTypeCollection collectionWithHandle(
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ),
- VCLXContainer::getTypes() );
- pCollectionWithHandle = &collectionWithHandle;
- }
- }
-
- return (*pCollectionWithHandle).getTypes();
- }
- else
- {
- if( !pCollection )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static ::cppu::OTypeCollection collection(
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ),
- VCLXContainer::getTypes() );
- pCollection = &collection;
- }
- }
- return (*pCollection).getTypes();
- }
+ return ::comphelper::concatSequences( VCLXTopWindow_Base::getTypes(), VCLXContainer::getTypes() );
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index ff5dd437ef52..7757d170256a 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -421,9 +421,6 @@ VCLXButton::VCLXButton()
VCLXButton::~VCLXButton()
{
-#ifndef __SUNPRO_CC
- OSL_TRACE ("%s", __FUNCTION__);
-#endif
}
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext()
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 0775b6ee74f3..21876feb072b 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1050,10 +1050,10 @@ void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException)
if ( xDrawPeerView.is() )
{
- Reference< XVclWindowPeer > xWindowPeer;
- xWindowPeer.set( xDrawPeer, UNO_QUERY );
- if ( xWindowPeer.is() )
- xWindowPeer->setDesignMode( mbDesignMode );
+ Reference< XVclWindowPeer > xWindowPeer;
+ xWindowPeer.set( xDrawPeer, UNO_QUERY );
+ if ( xWindowPeer.is() )
+ xWindowPeer->setDesignMode( mbDesignMode );
xDrawPeerView->draw( x, y );
}