2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* $RCSfile: vclxwindow.cxx,v $
|
|
|
|
* $Revision: 1.86 $
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 08:22:21 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 11:15:53 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_toolkit.hxx"
|
2001-11-27 09:32:38 +00:00
|
|
|
#include <com/sun/star/awt/WindowEvent.hpp>
|
|
|
|
#include <com/sun/star/awt/KeyEvent.hpp>
|
|
|
|
#include <com/sun/star/awt/KeyModifier.hpp>
|
|
|
|
#include <com/sun/star/awt/MouseEvent.hpp>
|
|
|
|
#include <com/sun/star/awt/MouseButton.hpp>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <com/sun/star/awt/XTopWindow.hpp>
|
|
|
|
#include <com/sun/star/awt/Style.hpp>
|
2003-04-24 14:10:01 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
2004-07-06 11:02:21 +00:00
|
|
|
#include <com/sun/star/awt/DockingEvent.hpp>
|
|
|
|
#include <com/sun/star/awt/EndDockingEvent.hpp>
|
|
|
|
#include <com/sun/star/awt/EndPopupModeEvent.hpp>
|
2006-10-18 12:14:50 +00:00
|
|
|
#include <com/sun/star/awt/XWindowListener2.hpp>
|
2005-01-21 15:46:46 +00:00
|
|
|
#include <com/sun/star/style/VerticalAlignment.hpp>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <toolkit/awt/vclxwindow.hxx>
|
|
|
|
#include <toolkit/awt/vclxpointer.hxx>
|
|
|
|
#include <toolkit/helper/macros.hxx>
|
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
#include <toolkit/helper/convert.hxx>
|
|
|
|
#include <toolkit/helper/macros.hxx>
|
|
|
|
#include <toolkit/helper/property.hxx>
|
2007-06-27 14:15:34 +00:00
|
|
|
#include <toolkit/helper/accessibilityclient.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
|
|
|
#include <rtl/memory.h>
|
|
|
|
#include <rtl/uuid.h>
|
2006-12-13 10:41:41 +00:00
|
|
|
#include <rtl/ustrbuf.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <tools/color.hxx>
|
2004-07-06 11:02:21 +00:00
|
|
|
#include <vcl/dockwin.hxx>
|
2006-12-04 07:25:53 +00:00
|
|
|
#include <vcl/pdfextoutdevdata.hxx>
|
2007-06-20 09:25:32 +00:00
|
|
|
#include <vcl/tabpage.hxx>
|
2005-02-17 09:21:18 +00:00
|
|
|
#include <comphelper/asyncnotification.hxx>
|
2005-07-08 09:27:53 +00:00
|
|
|
#include <toolkit/helper/solarrelease.hxx>
|
2005-02-17 09:21:18 +00:00
|
|
|
|
2008-01-14 11:57:14 +00:00
|
|
|
#include <toolkit/helper/unopropertyarrayhelper.hxx>
|
|
|
|
|
2006-05-05 09:26:48 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY;
|
|
|
|
using ::com::sun::star::lang::EventObject;
|
|
|
|
using ::com::sun::star::awt::XWindowListener2;
|
2005-01-21 15:46:46 +00:00
|
|
|
using ::com::sun::star::style::VerticalAlignment;
|
|
|
|
using ::com::sun::star::style::VerticalAlignment_TOP;
|
|
|
|
using ::com::sun::star::style::VerticalAlignment_MIDDLE;
|
|
|
|
using ::com::sun::star::style::VerticalAlignment_BOTTOM;
|
|
|
|
using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE;
|
|
|
|
|
2006-05-05 09:26:48 +00:00
|
|
|
|
2005-07-08 09:27:53 +00:00
|
|
|
//#define SYNCHRON_NOTIFICATION
|
|
|
|
// define this for notifying mouse events synchronously when they happen
|
|
|
|
// disadvantage: potential of deadlocks, since this means that the
|
|
|
|
// SolarMutex is locked when the listener is called
|
|
|
|
// See http://www.openoffice.org/issues/show_bug.cgi?id=40583 for an example
|
|
|
|
// deadlock
|
|
|
|
//#define THREADED_NOTIFICATION
|
|
|
|
// define this for notifying mouse events asynchronously, in a dedicated thread
|
|
|
|
// This is what I'd like to use. However, there's some Windows API code
|
|
|
|
// which doesn't like being called in the non-main thread, and we didn't
|
|
|
|
// find out which one :(
|
|
|
|
// See http://www.openoffice.org/issues/show_bug.cgi?id=47502 for an example
|
|
|
|
// of a bug triggered by asynchronous notification in a foreign thread
|
|
|
|
|
|
|
|
// If none of the above is defined, then mouse events are notified asynchronously
|
|
|
|
// in the main thread, using PostUserEvent.
|
|
|
|
// disadvantage: The event we're posting is delayed until the next event
|
|
|
|
// reschedule. Normally, this is virtually immediately, but there's no guarantee
|
|
|
|
// ....
|
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
//====================================================================
|
|
|
|
//= VCLXWindowImpl
|
|
|
|
//====================================================================
|
2006-10-18 12:14:50 +00:00
|
|
|
namespace
|
2006-03-14 09:53:33 +00:00
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
enum MouseEventType
|
|
|
|
{
|
|
|
|
EVENT_MOUSE_PRESSED = 0,
|
|
|
|
EVENT_MOUSE_RELEASED = 1,
|
|
|
|
EVENT_MOUSE_ENTERED = 2,
|
|
|
|
EVENT_MOUSE_EXITED = 3,
|
|
|
|
|
|
|
|
META_FIRST_MOUSE_EVENT = 0,
|
|
|
|
META_LAST_MOUSE_EVENT = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
enum PlainEventType
|
|
|
|
{
|
|
|
|
EVENT_WINDOW_ENABLED = 4,
|
|
|
|
EVENT_WINDOW_DISABLED = 5,
|
|
|
|
|
|
|
|
META_FIRST_PLAIN_EVENT = 4,
|
|
|
|
META_LAST_PLAIN_EVENT = 5
|
|
|
|
};
|
2006-03-14 09:53:33 +00:00
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
|
|
|
static void checkEventDefinitions()
|
2006-03-14 09:53:33 +00:00
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
OSL_ENSURE( (int)META_LAST_MOUSE_EVENT < (int)META_FIRST_PLAIN_EVENT, "checkEventDefinitions: invalid event definitions!" );
|
2006-03-14 09:53:33 +00:00
|
|
|
}
|
2006-10-18 12:14:50 +00:00
|
|
|
#define DBG_CHECK_EVENTS() checkEventDefinitions()
|
|
|
|
#else
|
|
|
|
#define DBG_CHECK_EVENTS()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct AnyWindowEvent : public ::comphelper::AnyEvent
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
awt::MouseEvent m_aMouseEvent;
|
|
|
|
lang::EventObject m_aPlainEvent;
|
|
|
|
|
|
|
|
sal_Int32 m_nEventType;
|
|
|
|
|
|
|
|
public:
|
|
|
|
AnyWindowEvent( const awt::MouseEvent& _rEvent, MouseEventType _nType )
|
|
|
|
:comphelper::AnyEvent()
|
|
|
|
,m_aMouseEvent( _rEvent )
|
|
|
|
,m_nEventType( static_cast< sal_Int32 >( _nType ) )
|
|
|
|
{
|
|
|
|
DBG_CHECK_EVENTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
AnyWindowEvent( const lang::EventObject& _rEvent, PlainEventType _nType )
|
|
|
|
:comphelper::AnyEvent()
|
|
|
|
,m_aPlainEvent( _rEvent )
|
|
|
|
,m_nEventType( static_cast< sal_Int32 >( _nType ) )
|
|
|
|
{
|
|
|
|
DBG_CHECK_EVENTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isMouseEvent() const
|
|
|
|
{
|
|
|
|
return ( META_FIRST_MOUSE_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_MOUSE_EVENT );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isPlainEvent() const
|
|
|
|
{
|
|
|
|
return ( META_FIRST_PLAIN_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_PLAIN_EVENT );
|
|
|
|
}
|
|
|
|
|
|
|
|
const awt::MouseEvent& getMouseEvent() const
|
|
|
|
{
|
|
|
|
OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEvent: no mouse event!" );
|
|
|
|
return m_aMouseEvent;
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseEventType getMouseEventType() const
|
|
|
|
{
|
|
|
|
OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEventType: no mouse event!" );
|
|
|
|
return static_cast< MouseEventType >( m_nEventType );
|
|
|
|
}
|
|
|
|
|
|
|
|
const lang::EventObject& getPlainEvent() const
|
|
|
|
{
|
|
|
|
OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEvent: no plain event!" );
|
|
|
|
return m_aPlainEvent;
|
|
|
|
}
|
|
|
|
|
|
|
|
PlainEventType getPlainEventType() const
|
|
|
|
{
|
|
|
|
OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEventType: no mouse event!" );
|
|
|
|
return static_cast< PlainEventType >( m_nEventType );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2006-03-14 09:53:33 +00:00
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor
|
|
|
|
{
|
|
|
|
private:
|
2006-03-14 09:53:33 +00:00
|
|
|
typedef ::std::vector< ::rtl::Reference< ::comphelper::AnyEvent > >
|
2005-07-08 09:27:53 +00:00
|
|
|
EventArray;
|
2005-02-17 09:21:18 +00:00
|
|
|
|
|
|
|
private:
|
2006-03-14 09:53:33 +00:00
|
|
|
oslInterlockedCount m_refCount;
|
2005-02-17 09:21:18 +00:00
|
|
|
VCLXWindow& mrAntiImpl;
|
|
|
|
::vos::IMutex& mrMutex;
|
2007-06-27 14:15:34 +00:00
|
|
|
::toolkit::AccessibilityClient maAccFactory;
|
2006-03-14 09:53:33 +00:00
|
|
|
bool mbDisposed;
|
2006-10-18 12:14:50 +00:00
|
|
|
::osl::Mutex maListenerContainerMutex;
|
|
|
|
::cppu::OInterfaceContainerHelper maWindow2Listeners;
|
2006-03-14 09:53:33 +00:00
|
|
|
|
2005-07-08 09:27:53 +00:00
|
|
|
#ifdef THREADED_NOTIFICATION
|
2006-03-14 09:53:33 +00:00
|
|
|
::rtl::Reference< ::comphelper::AsyncEventNotifier >
|
|
|
|
mpAsyncNotifier;
|
2005-07-08 09:27:53 +00:00
|
|
|
#else
|
|
|
|
#if !defined( SYNCHRON_NOTIFICATION )
|
|
|
|
EventArray maEvents;
|
|
|
|
sal_Int32 mnEventId;
|
|
|
|
#endif
|
|
|
|
#endif
|
2005-02-17 09:21:18 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** ctor
|
|
|
|
@param _pAntiImpl
|
|
|
|
the <type>VCLXWindow</type> instance which the object belongs to. Must
|
|
|
|
live longer then the object just being constructed.
|
|
|
|
*/
|
|
|
|
VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex );
|
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
/** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners
|
2005-02-17 09:21:18 +00:00
|
|
|
*/
|
2006-10-18 12:14:50 +00:00
|
|
|
void notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType );
|
|
|
|
|
|
|
|
/** asynchronously notifies an event described by an EventObject to the respective listeners
|
|
|
|
*/
|
|
|
|
void notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType );
|
2005-02-17 09:21:18 +00:00
|
|
|
|
|
|
|
/** notifies the object that its VCLXWindow is being disposed
|
|
|
|
*/
|
|
|
|
void disposing();
|
|
|
|
|
2007-06-27 14:15:34 +00:00
|
|
|
inline ::toolkit::AccessibilityClient& getAccessibleFactory()
|
|
|
|
{
|
|
|
|
return maAccFactory;
|
|
|
|
}
|
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
/** returns the container of registered XWindowListener2 listeners
|
|
|
|
*/
|
|
|
|
inline ::cppu::OInterfaceContainerHelper&
|
|
|
|
getWindow2Listeners() { return maWindow2Listeners; }
|
|
|
|
|
2006-03-14 09:53:33 +00:00
|
|
|
virtual void SAL_CALL acquire();
|
|
|
|
virtual void SAL_CALL release();
|
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
protected:
|
2006-06-19 22:02:22 +00:00
|
|
|
virtual ~VCLXWindowImpl();
|
2006-03-14 09:53:33 +00:00
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
// IEventProcessor
|
2006-03-14 09:53:33 +00:00
|
|
|
virtual void processEvent( const ::comphelper::AnyEvent& _rEvent );
|
2005-07-08 09:27:53 +00:00
|
|
|
|
|
|
|
#if !defined( SYNCHRON_NOTIFICATION ) && !defined( THREADED_NOTIFICATION )
|
|
|
|
private:
|
|
|
|
DECL_LINK( OnProcessEvent, void* );
|
|
|
|
#endif
|
2006-03-14 09:53:33 +00:00
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
private:
|
|
|
|
/** notifies an arbitrary event
|
|
|
|
@param _rEvent
|
|
|
|
the event to notify
|
|
|
|
@param _rGuard
|
|
|
|
a guard currentl guarding our mutex, which is released for the actual notification
|
|
|
|
*/
|
|
|
|
void impl_notifyAnyEvent(
|
|
|
|
const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent,
|
|
|
|
::vos::OClearableGuard& _rGuard
|
|
|
|
);
|
|
|
|
|
2006-03-14 09:53:33 +00:00
|
|
|
private:
|
|
|
|
/** determines whether the instance is already disposed
|
|
|
|
@precond
|
|
|
|
m_aMutex must be acquired
|
|
|
|
*/
|
|
|
|
inline bool impl_isDisposed()
|
|
|
|
{
|
|
|
|
return mbDisposed;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
VCLXWindowImpl(); // never implemented
|
|
|
|
VCLXWindowImpl( const VCLXWindowImpl& ); // never implemented
|
|
|
|
VCLXWindowImpl& operator=( const VCLXWindowImpl& ); // never implemented
|
2005-02-17 09:21:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex )
|
2006-06-19 22:02:22 +00:00
|
|
|
:m_refCount( 0 )
|
|
|
|
,mrAntiImpl( _rAntiImpl )
|
2005-02-17 09:21:18 +00:00
|
|
|
,mrMutex( _rMutex )
|
2006-03-14 09:53:33 +00:00
|
|
|
,mbDisposed( false )
|
2006-10-18 12:14:50 +00:00
|
|
|
,maListenerContainerMutex( )
|
|
|
|
,maWindow2Listeners( maListenerContainerMutex )
|
2005-07-08 09:27:53 +00:00
|
|
|
#ifdef THREADED_NOTIFICATION
|
2005-02-17 09:21:18 +00:00
|
|
|
,mpAsyncNotifier( NULL )
|
2005-07-08 09:27:53 +00:00
|
|
|
#else
|
|
|
|
#ifndef SYNCHRON_NOTIFICATION
|
|
|
|
,mnEventId( 0 )
|
|
|
|
#endif
|
|
|
|
#endif
|
2005-02-17 09:21:18 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-03-14 09:53:33 +00:00
|
|
|
VCLXWindowImpl::~VCLXWindowImpl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void VCLXWindowImpl::disposing()
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( mrMutex );
|
2005-07-08 09:27:53 +00:00
|
|
|
#ifdef THREADED_NOTIFICATION
|
2006-03-14 09:53:33 +00:00
|
|
|
if ( mpAsyncNotifier.is() )
|
2005-02-17 09:21:18 +00:00
|
|
|
{
|
2006-03-14 09:53:33 +00:00
|
|
|
mpAsyncNotifier->removeEventsForProcessor( this );
|
2006-08-04 12:50:57 +00:00
|
|
|
mpAsyncNotifier->dispose();
|
2005-02-17 09:21:18 +00:00
|
|
|
mpAsyncNotifier = NULL;
|
|
|
|
}
|
2005-07-08 09:27:53 +00:00
|
|
|
#else
|
|
|
|
#ifndef SYNCHRON_NOTIFICATION
|
|
|
|
if ( mnEventId )
|
|
|
|
Application::RemoveUserEvent( mnEventId );
|
|
|
|
mnEventId = 0;
|
|
|
|
#endif
|
|
|
|
#endif
|
2006-03-14 09:53:33 +00:00
|
|
|
mbDisposed= true;
|
2005-02-17 09:21:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2006-10-18 12:14:50 +00:00
|
|
|
void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent, ::vos::OClearableGuard& _rGuard )
|
2005-02-17 09:21:18 +00:00
|
|
|
{
|
2005-07-08 09:27:53 +00:00
|
|
|
#ifdef THREADED_NOTIFICATION
|
2006-10-18 12:14:50 +00:00
|
|
|
(void)_rGuard;
|
|
|
|
if ( !mpAsyncNotifier.is() )
|
|
|
|
{
|
|
|
|
mpAsyncNotifier = new ::comphelper::AsyncEventNotifier;
|
|
|
|
mpAsyncNotifier->create();
|
2005-02-17 09:21:18 +00:00
|
|
|
}
|
2006-10-18 12:14:50 +00:00
|
|
|
mpAsyncNotifier->addEvent( _rEvent, this );
|
|
|
|
|
|
|
|
#else // #ifdef THREADED_NOTIFICATION
|
|
|
|
|
|
|
|
#ifdef SYNCHRON_NOTIFICATION
|
|
|
|
_rGuard.clear();
|
|
|
|
processEvent( *_rEvent );
|
|
|
|
#else // #ifdef SYNCHRON_NOTIFICATION
|
|
|
|
(void)_rGuard;
|
|
|
|
maEvents.push_back( _rEvent );
|
|
|
|
if ( !mnEventId )
|
|
|
|
mnEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessEvent ) );
|
|
|
|
#endif // #ifdef SYNCHRON_NOTIFICATION
|
|
|
|
|
|
|
|
#endif // // #ifdef THREADED_NOTIFICATION
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType )
|
|
|
|
{
|
|
|
|
::vos::OClearableGuard aGuard( mrMutex );
|
|
|
|
if ( mrAntiImpl.GetMouseListeners().getLength() )
|
|
|
|
impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ), aGuard );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType )
|
|
|
|
{
|
|
|
|
::vos::OClearableGuard aGuard( mrMutex );
|
|
|
|
if ( maWindow2Listeners.getLength() )
|
|
|
|
impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ), aGuard );
|
2005-02-17 09:21:18 +00:00
|
|
|
}
|
|
|
|
|
2005-07-08 09:27:53 +00:00
|
|
|
#if !defined( SYNCHRON_NOTIFICATION ) && !defined( THREADED_NOTIFICATION )
|
|
|
|
//--------------------------------------------------------------------
|
2006-06-19 22:02:22 +00:00
|
|
|
IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG )
|
2005-07-08 09:27:53 +00:00
|
|
|
{
|
|
|
|
// work on a copy of the events array
|
|
|
|
EventArray aEventsCopy;
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( mrMutex );
|
|
|
|
aEventsCopy = maEvents;
|
|
|
|
maEvents.clear();
|
|
|
|
|
|
|
|
if ( !mnEventId )
|
|
|
|
// we were disposed while waiting for the mutex to lock
|
|
|
|
return 1L;
|
|
|
|
|
|
|
|
mnEventId = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
::toolkit::ReleaseSolarMutex aReleaseSolar;
|
|
|
|
for ( EventArray::const_iterator loop = aEventsCopy.begin();
|
|
|
|
loop != aEventsCopy.end();
|
|
|
|
++loop
|
|
|
|
)
|
|
|
|
{
|
|
|
|
processEvent( *(*loop) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0L;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
//--------------------------------------------------------------------
|
2006-03-14 09:53:33 +00:00
|
|
|
void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent )
|
2005-02-17 09:21:18 +00:00
|
|
|
{
|
2006-03-14 09:53:33 +00:00
|
|
|
::vos::OGuard aGuard( mrMutex );
|
|
|
|
if ( impl_isDisposed() )
|
|
|
|
// while we were waiting for our mutex, another thread disposed us
|
|
|
|
return;
|
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
const AnyWindowEvent& rEventDescriptor( static_cast< const AnyWindowEvent& >( _rEvent ) );
|
|
|
|
if ( rEventDescriptor.isMouseEvent() )
|
2005-02-17 09:21:18 +00:00
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
const awt::MouseEvent& rEvent( rEventDescriptor.getMouseEvent() );
|
|
|
|
switch ( rEventDescriptor.getMouseEventType() )
|
|
|
|
{
|
|
|
|
case EVENT_MOUSE_PRESSED:
|
|
|
|
mrAntiImpl.GetMouseListeners().mousePressed( rEvent );
|
|
|
|
break;
|
|
|
|
case EVENT_MOUSE_RELEASED:
|
|
|
|
mrAntiImpl.GetMouseListeners().mouseReleased( rEvent );
|
|
|
|
break;
|
|
|
|
case EVENT_MOUSE_ENTERED:
|
|
|
|
mrAntiImpl.GetMouseListeners().mouseEntered( rEvent );
|
|
|
|
break;
|
|
|
|
case EVENT_MOUSE_EXITED:
|
|
|
|
mrAntiImpl.GetMouseListeners().mouseExited( rEvent );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( rEventDescriptor.isPlainEvent() )
|
|
|
|
{
|
|
|
|
const lang::EventObject& rEvent( rEventDescriptor.getPlainEvent() );
|
|
|
|
switch ( rEventDescriptor.getPlainEventType() )
|
|
|
|
{
|
|
|
|
case EVENT_WINDOW_ENABLED:
|
|
|
|
maWindow2Listeners.notifyEach( &XWindowListener2::windowEnabled, rEvent );
|
|
|
|
break;
|
|
|
|
case EVENT_WINDOW_DISABLED:
|
|
|
|
maWindow2Listeners.notifyEach( &XWindowListener2::windowDisabled, rEvent );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" );
|
|
|
|
break;
|
|
|
|
}
|
2005-02-17 09:21:18 +00:00
|
|
|
}
|
2006-10-18 12:14:50 +00:00
|
|
|
else
|
|
|
|
DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (3)?" );
|
2005-02-17 09:21:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2006-03-14 09:53:33 +00:00
|
|
|
void SAL_CALL VCLXWindowImpl::acquire()
|
2005-02-17 09:21:18 +00:00
|
|
|
{
|
2006-03-14 09:53:33 +00:00
|
|
|
osl_incrementInterlockedCount( &m_refCount );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL VCLXWindowImpl::release()
|
|
|
|
{
|
|
|
|
if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
|
|
|
|
delete this;
|
2005-02-17 09:21:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//====================================================================
|
|
|
|
|
2001-11-27 09:32:38 +00:00
|
|
|
// Mit Out-Parameter besser als Rueckgabewert, wegen Ref-Objekt...
|
|
|
|
|
|
|
|
void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pWindow )
|
|
|
|
{
|
|
|
|
Point aPos = pWindow->GetPosPixel();
|
|
|
|
Size aSz = pWindow->GetSizePixel();
|
|
|
|
|
|
|
|
rEvent.X = aPos.X();
|
|
|
|
rEvent.Y = aPos.Y();
|
|
|
|
|
|
|
|
rEvent.Width = aSz.Width();
|
|
|
|
rEvent.Height = aSz.Height();
|
|
|
|
|
|
|
|
pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset );
|
|
|
|
}
|
|
|
|
|
|
|
|
void ImplInitKeyEvent( ::com::sun::star::awt::KeyEvent& rEvent, const KeyEvent& rEvt )
|
|
|
|
{
|
|
|
|
rEvent.Modifiers = 0;
|
|
|
|
if ( rEvt.GetKeyCode().IsShift() )
|
|
|
|
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
|
|
|
|
if ( rEvt.GetKeyCode().IsMod1() )
|
|
|
|
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
|
|
|
|
if ( rEvt.GetKeyCode().IsMod2() )
|
|
|
|
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
|
|
|
|
|
|
|
|
rEvent.KeyCode = rEvt.GetKeyCode().GetCode();
|
2004-02-04 10:11:08 +00:00
|
|
|
rEvent.KeyChar = rEvt.GetCharCode();
|
2006-10-12 09:31:52 +00:00
|
|
|
rEvent.KeyFunc = sal::static_int_cast< sal_Int16 >(
|
|
|
|
rEvt.GetKeyCode().GetFunction());
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
void ImplInitMouseEvent( awt::MouseEvent& rEvent, const MouseEvent& rEvt )
|
2001-11-27 09:32:38 +00:00
|
|
|
{
|
|
|
|
rEvent.Modifiers = 0;
|
|
|
|
if ( rEvt.IsShift() )
|
|
|
|
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
|
|
|
|
if ( rEvt.IsMod1() )
|
|
|
|
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
|
|
|
|
if ( rEvt.IsMod2() )
|
|
|
|
rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
|
|
|
|
|
|
|
|
rEvent.Buttons = 0;
|
|
|
|
if ( rEvt.IsLeft() )
|
|
|
|
rEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT;
|
|
|
|
if ( rEvt.IsRight() )
|
|
|
|
rEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT;
|
|
|
|
if ( rEvt.IsMiddle() )
|
|
|
|
rEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE;
|
|
|
|
|
|
|
|
rEvent.X = rEvt.GetPosPixel().X();
|
|
|
|
rEvent.Y = rEvt.GetPosPixel().Y();
|
|
|
|
rEvent.ClickCount = rEvt.GetClicks();
|
|
|
|
rEvent.PopupTrigger = sal_False;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// ----------------------------------------------------
|
|
|
|
// class VCLXWindow
|
|
|
|
// ----------------------------------------------------
|
2002-11-07 16:19:24 +00:00
|
|
|
|
|
|
|
DBG_NAME(VCLXWindow);
|
|
|
|
|
2008-01-14 11:57:14 +00:00
|
|
|
VCLXWindow::VCLXWindow( bool bWithDefaultProps )
|
2000-09-18 16:07:07 +00:00
|
|
|
: maEventListeners( *this ),
|
|
|
|
maFocusListeners( *this ),
|
|
|
|
maWindowListeners( *this ),
|
|
|
|
maKeyListeners( *this ),
|
|
|
|
maMouseListeners( *this ),
|
|
|
|
maMouseMotionListeners( *this ),
|
|
|
|
maPaintListeners( *this ),
|
|
|
|
maContainerListeners( *this ),
|
2003-06-06 09:55:01 +00:00
|
|
|
maTopWindowListeners( *this ),
|
2005-02-17 09:21:18 +00:00
|
|
|
mnListenerLockLevel( 0 ),
|
|
|
|
mpImpl( NULL ),
|
2008-01-14 11:57:14 +00:00
|
|
|
mpPropHelper( NULL ),
|
|
|
|
mbDisposing( false ),
|
|
|
|
mbDesignMode( false ),
|
|
|
|
mbSynthesizingVCLEvent( false ),
|
|
|
|
mbWithDefaultProps( !!bWithDefaultProps ),
|
2005-02-17 09:21:18 +00:00
|
|
|
mbDrawingOntoParent( false )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-11-07 16:19:24 +00:00
|
|
|
DBG_CTOR( VCLXWindow, 0 );
|
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
mpImpl = new VCLXWindowImpl( *this, GetMutex() );
|
2006-03-14 09:53:33 +00:00
|
|
|
mpImpl->acquire();
|
2005-02-17 09:21:18 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mbDisposing = sal_False;
|
|
|
|
mbDesignMode = sal_False;
|
2003-03-27 16:05:12 +00:00
|
|
|
mbSynthesizingVCLEvent = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VCLXWindow::~VCLXWindow()
|
|
|
|
{
|
2002-11-07 16:19:24 +00:00
|
|
|
DBG_DTOR( VCLXWindow, 0 );
|
|
|
|
|
2008-01-14 11:57:14 +00:00
|
|
|
delete mpPropHelper;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( GetWindow() )
|
2001-11-29 15:59:43 +00:00
|
|
|
{
|
|
|
|
GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
|
2001-11-29 18:34:16 +00:00
|
|
|
GetWindow()->SetWindowPeer( NULL, NULL );
|
|
|
|
GetWindow()->SetAccessible( NULL );
|
2001-11-29 15:59:43 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2007-06-27 14:15:34 +00:00
|
|
|
::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory()
|
|
|
|
{
|
|
|
|
return mpImpl->getAccessibleFactory().getFactory();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void VCLXWindow::SetWindow( Window* pWindow )
|
|
|
|
{
|
2001-11-27 09:32:38 +00:00
|
|
|
if ( GetWindow() )
|
2002-06-12 09:50:50 +00:00
|
|
|
{
|
2001-11-29 15:59:43 +00:00
|
|
|
GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
|
2002-06-12 09:50:50 +00:00
|
|
|
// GetWindow()->DbgAssertNoEventListeners();
|
|
|
|
}
|
2001-11-27 09:32:38 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SetOutputDevice( pWindow );
|
2001-11-27 09:32:38 +00:00
|
|
|
|
2001-11-29 15:59:43 +00:00
|
|
|
if ( GetWindow() )
|
2004-05-07 15:16:58 +00:00
|
|
|
GetWindow()->AddEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
|
2003-06-06 09:55:01 +00:00
|
|
|
void VCLXWindow::suspendVclEventListening( )
|
|
|
|
{
|
|
|
|
++mnListenerLockLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::resumeVclEventListening( )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" );
|
|
|
|
--mnListenerLockLevel;
|
|
|
|
}
|
|
|
|
|
2001-11-29 15:59:43 +00:00
|
|
|
IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent )
|
2001-11-27 09:32:38 +00:00
|
|
|
{
|
2003-06-06 09:55:01 +00:00
|
|
|
if ( mnListenerLockLevel )
|
|
|
|
return 0L;
|
|
|
|
|
2001-11-27 09:32:38 +00:00
|
|
|
DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
|
|
|
|
if ( pEvent && pEvent->ISA( VclWindowEvent ) )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow() && GetWindow(), "Window???" );
|
|
|
|
ProcessWindowEvent( *(VclWindowEvent*)pEvent );
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
|
|
|
|
{
|
2004-07-06 11:02:21 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this );
|
|
|
|
|
2001-11-27 09:32:38 +00:00
|
|
|
switch ( rVclWindowEvent.GetId() )
|
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
case VCLEVENT_WINDOW_ENABLED:
|
|
|
|
case VCLEVENT_WINDOW_DISABLED:
|
|
|
|
{
|
|
|
|
bool bEnabled = ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() );
|
|
|
|
EventObject aEvent( *this );
|
|
|
|
mpImpl->notifyPlainEvent( aEvent,
|
|
|
|
bEnabled ? EVENT_WINDOW_ENABLED : EVENT_WINDOW_DISABLED );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2001-11-27 09:32:38 +00:00
|
|
|
case VCLEVENT_WINDOW_PAINT:
|
|
|
|
{
|
|
|
|
if ( GetPaintListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::PaintEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
aEvent.UpdateRect = AWTRectangle( *(Rectangle*)rVclWindowEvent.GetData() );
|
|
|
|
aEvent.Count = 0;
|
|
|
|
GetPaintListeners().windowPaint( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_MOVE:
|
|
|
|
{
|
|
|
|
if ( GetWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::WindowEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
|
|
|
|
GetWindowListeners().windowMoved( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_RESIZE:
|
|
|
|
{
|
|
|
|
if ( GetWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::WindowEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
|
|
|
|
GetWindowListeners().windowResized( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_SHOW:
|
|
|
|
{
|
|
|
|
if ( GetWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::WindowEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
|
|
|
|
GetWindowListeners().windowShown( aEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
// For TopWindows this means opened...
|
|
|
|
if ( GetTopWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
GetTopWindowListeners().windowOpened( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_HIDE:
|
|
|
|
{
|
|
|
|
if ( GetWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::WindowEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
|
|
|
|
GetWindowListeners().windowHidden( aEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
// For TopWindows this means closed...
|
|
|
|
if ( GetTopWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
GetTopWindowListeners().windowClosed( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_ACTIVATE:
|
|
|
|
{
|
|
|
|
if ( GetTopWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
GetTopWindowListeners().windowActivated( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_DEACTIVATE:
|
|
|
|
{
|
|
|
|
if ( GetTopWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
GetTopWindowListeners().windowDeactivated( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_CLOSE:
|
|
|
|
{
|
2004-07-06 11:02:21 +00:00
|
|
|
if ( mxDockableWindowListener.is() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
mxDockableWindowListener->closed( aEvent );
|
|
|
|
}
|
2001-11-27 09:32:38 +00:00
|
|
|
if ( GetTopWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
GetTopWindowListeners().windowClosing( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-03-27 16:05:12 +00:00
|
|
|
case VCLEVENT_CONTROL_GETFOCUS:
|
2001-11-27 09:32:38 +00:00
|
|
|
case VCLEVENT_WINDOW_GETFOCUS:
|
|
|
|
{
|
2003-03-27 16:05:12 +00:00
|
|
|
if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
|
|
|
|
&& rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS
|
|
|
|
)
|
|
|
|
|| ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
|
|
|
|
&& rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS
|
|
|
|
)
|
|
|
|
)
|
2001-11-27 09:32:38 +00:00
|
|
|
{
|
2003-03-27 16:05:12 +00:00
|
|
|
if ( GetFocusListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::FocusEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
|
|
|
|
aEvent.Temporary = sal_False;
|
|
|
|
GetFocusListeners().focusGained( aEvent );
|
|
|
|
}
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-03-27 16:05:12 +00:00
|
|
|
case VCLEVENT_CONTROL_LOSEFOCUS:
|
2001-11-27 09:32:38 +00:00
|
|
|
case VCLEVENT_WINDOW_LOSEFOCUS:
|
|
|
|
{
|
2003-03-27 16:05:12 +00:00
|
|
|
if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
|
|
|
|
&& rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS
|
|
|
|
)
|
|
|
|
|| ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
|
|
|
|
&& rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS
|
|
|
|
)
|
|
|
|
)
|
2001-11-27 09:32:38 +00:00
|
|
|
{
|
2003-03-27 16:05:12 +00:00
|
|
|
if ( GetFocusListeners().getLength() )
|
2001-11-27 09:32:38 +00:00
|
|
|
{
|
2003-03-27 16:05:12 +00:00
|
|
|
::com::sun::star::awt::FocusEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
|
|
|
|
aEvent.Temporary = sal_False;
|
|
|
|
|
|
|
|
Window* pNext = Application::GetFocusWindow();
|
|
|
|
if ( pNext )
|
|
|
|
{
|
|
|
|
// Bei zusammengesetzten Controls interessiert sich keiner fuer das Innenleben:
|
|
|
|
Window* pNextC = pNext;
|
|
|
|
while ( pNextC && !pNextC->IsCompoundControl() )
|
|
|
|
pNextC = pNextC->GetParent();
|
|
|
|
if ( pNextC )
|
|
|
|
pNext = pNextC;
|
|
|
|
|
|
|
|
pNext->GetComponentInterface( sal_True );
|
|
|
|
aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer();
|
|
|
|
}
|
|
|
|
GetFocusListeners().focusLost( aEvent );
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_MINIMIZE:
|
|
|
|
{
|
|
|
|
if ( GetTopWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
GetTopWindowListeners().windowMinimized( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_NORMALIZE:
|
|
|
|
{
|
|
|
|
if ( GetTopWindowListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
GetTopWindowListeners().windowNormalized( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_KEYINPUT:
|
|
|
|
{
|
|
|
|
if ( GetKeyListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::KeyEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() );
|
|
|
|
GetKeyListeners().keyPressed( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_KEYUP:
|
|
|
|
{
|
|
|
|
if ( GetKeyListeners().getLength() )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::KeyEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() );
|
|
|
|
GetKeyListeners().keyReleased( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_COMMAND:
|
|
|
|
{
|
|
|
|
CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData();
|
2002-08-16 08:12:34 +00:00
|
|
|
if ( GetMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) )
|
2001-11-27 09:32:38 +00:00
|
|
|
{
|
|
|
|
// COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
|
2002-08-16 08:12:34 +00:00
|
|
|
Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel();
|
|
|
|
if ( !pCmdEvt->IsMouseEvent() )
|
|
|
|
{ // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
|
|
|
|
// handles a context menu command as special case of a mouse event, which is simply wrong.
|
|
|
|
// Without extending the API, we would not have another chance to notify listeners of a
|
|
|
|
// keyboard-triggered context menu request
|
|
|
|
// 102205 - 16.08.2002 - fs@openoffice.org
|
|
|
|
aWhere = Point( -1, -1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
|
2006-10-18 12:14:50 +00:00
|
|
|
awt::MouseEvent aEvent;
|
2001-11-27 09:32:38 +00:00
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitMouseEvent( aEvent, aMEvt );
|
|
|
|
aEvent.PopupTrigger = sal_True;
|
2005-02-17 09:21:18 +00:00
|
|
|
mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_MOUSEMOVE:
|
|
|
|
{
|
|
|
|
MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData();
|
|
|
|
if ( GetMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
|
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
awt::MouseEvent aEvent;
|
2001-11-27 09:32:38 +00:00
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitMouseEvent( aEvent, *pMouseEvt );
|
|
|
|
|
2005-02-17 09:21:18 +00:00
|
|
|
mpImpl->notifyMouseEvent(
|
|
|
|
aEvent,
|
|
|
|
pMouseEvt->IsEnterWindow() ? EVENT_MOUSE_ENTERED : EVENT_MOUSE_EXITED
|
|
|
|
);
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( GetMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
|
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
awt::MouseEvent aEvent;
|
2001-11-27 09:32:38 +00:00
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitMouseEvent( aEvent, *pMouseEvt );
|
|
|
|
aEvent.ClickCount = 0; // #92138#
|
|
|
|
|
|
|
|
if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE )
|
|
|
|
GetMouseMotionListeners().mouseMoved( aEvent );
|
|
|
|
else
|
|
|
|
GetMouseMotionListeners().mouseDragged( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
|
|
|
|
{
|
|
|
|
if ( GetMouseListeners().getLength() )
|
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
awt::MouseEvent aEvent;
|
2001-11-27 09:32:38 +00:00
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitMouseEvent( aEvent, *(MouseEvent*)rVclWindowEvent.GetData() );
|
2005-02-17 09:21:18 +00:00
|
|
|
mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_MOUSEBUTTONUP:
|
|
|
|
{
|
|
|
|
if ( GetMouseListeners().getLength() )
|
|
|
|
{
|
2006-10-18 12:14:50 +00:00
|
|
|
awt::MouseEvent aEvent;
|
2001-11-27 09:32:38 +00:00
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
ImplInitMouseEvent( aEvent, *(MouseEvent*)rVclWindowEvent.GetData() );
|
2005-02-17 09:21:18 +00:00
|
|
|
mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_RELEASED );
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-07-06 11:02:21 +00:00
|
|
|
case VCLEVENT_WINDOW_STARTDOCKING:
|
|
|
|
{
|
|
|
|
if ( mxDockableWindowListener.is() )
|
|
|
|
{
|
|
|
|
DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
|
|
|
|
|
|
|
|
if( pData )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::DockingEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
|
|
|
|
aEvent.MousePos.X = pData->maMousePos.X();
|
|
|
|
aEvent.MousePos.Y = pData->maMousePos.Y();
|
|
|
|
aEvent.bLiveMode = pData->mbLivemode;
|
|
|
|
aEvent.bInteractive = pData->mbInteractive;
|
|
|
|
|
|
|
|
mxDockableWindowListener->startDocking( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_DOCKING:
|
|
|
|
{
|
|
|
|
if ( mxDockableWindowListener.is() )
|
|
|
|
{
|
|
|
|
DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
|
|
|
|
|
|
|
|
if( pData )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::DockingEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
|
|
|
|
aEvent.MousePos.X = pData->maMousePos.X();
|
|
|
|
aEvent.MousePos.Y = pData->maMousePos.Y();
|
|
|
|
aEvent.bLiveMode = pData->mbLivemode;
|
|
|
|
aEvent.bInteractive = pData->mbInteractive;
|
|
|
|
::com::sun::star::awt::DockingData aDockingData =
|
|
|
|
mxDockableWindowListener->docking( aEvent );
|
|
|
|
pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle );
|
|
|
|
pData->mbFloating = aDockingData.bFloating;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_ENDDOCKING:
|
|
|
|
{
|
|
|
|
if ( mxDockableWindowListener.is() )
|
|
|
|
{
|
|
|
|
EndDockingData *pData = (EndDockingData*)rVclWindowEvent.GetData();
|
|
|
|
|
|
|
|
if( pData )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::EndDockingEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect );
|
|
|
|
aEvent.bFloating = pData->mbFloating;
|
|
|
|
aEvent.bCancelled = pData->mbCancelled;
|
|
|
|
mxDockableWindowListener->endDocking( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING:
|
|
|
|
{
|
|
|
|
if ( mxDockableWindowListener.is() )
|
|
|
|
{
|
|
|
|
BOOL *p_bFloating = (BOOL*)rVclWindowEvent.GetData();
|
|
|
|
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
*p_bFloating = mxDockableWindowListener->prepareToggleFloatingMode( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_TOGGLEFLOATING:
|
|
|
|
{
|
|
|
|
if ( mxDockableWindowListener.is() )
|
|
|
|
{
|
|
|
|
::com::sun::star::lang::EventObject aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
mxDockableWindowListener->toggleFloatingMode( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VCLEVENT_WINDOW_ENDPOPUPMODE:
|
|
|
|
{
|
|
|
|
if ( mxDockableWindowListener.is() )
|
|
|
|
{
|
|
|
|
EndPopupModeData *pData = (EndPopupModeData*)rVclWindowEvent.GetData();
|
|
|
|
|
|
|
|
if( pData )
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::EndPopupModeEvent aEvent;
|
|
|
|
aEvent.Source = (::cppu::OWeakObject*)this;
|
|
|
|
aEvent.FloatingPosition.X = pData->maFloatingPos.X();
|
|
|
|
aEvent.FloatingPosition.Y = pData->maFloatingPos.Y();
|
|
|
|
aEvent.bTearoff = pData->mbTearoff;
|
|
|
|
mxDockableWindowListener->endPopupMode( aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-05-05 09:26:48 +00:00
|
|
|
uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext()
|
2002-02-22 07:38:26 +00:00
|
|
|
{
|
2007-06-27 14:15:34 +00:00
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
return getAccessibleFactory().createAccessibleContext( this );
|
2002-02-22 07:38:26 +00:00
|
|
|
}
|
|
|
|
|
2002-02-08 07:59:48 +00:00
|
|
|
/*
|
|
|
|
void VCLXWindow::FillAccessibleStateSet( AccessibleStateSetHelper& rStateSet )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const
|
|
|
|
{
|
|
|
|
Size aSz = rOutSz;
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
sal_Int32 nLeft, nTop, nRight, nBottom;
|
|
|
|
pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
|
|
|
|
aSz.Width() += nLeft+nRight;
|
|
|
|
aSz.Height() += nTop+nBottom;
|
|
|
|
}
|
|
|
|
return aSz;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::uno::XInterface
|
|
|
|
::com::sun::star::uno::Any VCLXWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
|
|
|
|
SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, (::com::sun::star::awt::XWindow*)this ),
|
|
|
|
SAL_STATIC_CAST( ::com::sun::star::awt::XWindow*, this ),
|
|
|
|
SAL_STATIC_CAST( ::com::sun::star::awt::XWindowPeer*, this ),
|
|
|
|
SAL_STATIC_CAST( ::com::sun::star::awt::XVclWindowPeer*, this ),
|
|
|
|
SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ),
|
2001-11-27 09:32:38 +00:00
|
|
|
SAL_STATIC_CAST( ::com::sun::star::awt::XView*, this ),
|
2003-04-24 14:10:01 +00:00
|
|
|
SAL_STATIC_CAST( ::com::sun::star::accessibility::XAccessible*, this ),
|
2004-07-06 11:02:21 +00:00
|
|
|
SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ),
|
2008-01-14 11:57:14 +00:00
|
|
|
SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySetInfo*, this ),
|
2004-09-09 14:12:47 +00:00
|
|
|
SAL_STATIC_CAST( ::com::sun::star::awt::XWindow2*, this ),
|
2004-07-06 11:02:21 +00:00
|
|
|
SAL_STATIC_CAST( ::com::sun::star::awt::XDockableWindow*, this ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
return (aRet.hasValue() ? aRet : VCLXDevice::queryInterface( rType ));
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XUnoTunnel
|
2001-02-27 12:57:43 +00:00
|
|
|
IMPL_XUNOTUNNEL2( VCLXWindow, VCLXDevice )
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// ::com::sun::star::lang::XTypeProvider
|
|
|
|
IMPL_XTYPEPROVIDER_START( VCLXWindow )
|
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ),
|
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ),
|
2004-09-09 14:12:47 +00:00
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>* ) NULL ),
|
2000-09-18 16:07:07 +00:00
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>* ) NULL ),
|
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer>* ) NULL ),
|
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
|
2003-04-24 14:10:01 +00:00
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>* ) NULL ),
|
2002-06-12 12:15:27 +00:00
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>* ) NULL ),
|
2008-01-14 11:57:14 +00:00
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>* ) NULL ),
|
2002-02-14 16:28:24 +00:00
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ),
|
2004-07-06 11:02:21 +00:00
|
|
|
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow>* ) NULL ),
|
2000-09-18 16:07:07 +00:00
|
|
|
VCLXDevice::getTypes()
|
|
|
|
IMPL_XTYPEPROVIDER_END
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::Component
|
|
|
|
void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
mxViewGraphics = NULL;
|
|
|
|
|
2002-08-27 11:10:35 +00:00
|
|
|
if ( !mbDisposing )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
mbDisposing = sal_True;
|
|
|
|
|
|
|
|
::com::sun::star::lang::EventObject aObj;
|
2002-08-27 11:10:35 +00:00
|
|
|
aObj.Source = static_cast< ::cppu::OWeakObject* >( this );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
maEventListeners.disposeAndClear( aObj );
|
|
|
|
maFocusListeners.disposeAndClear( aObj );
|
|
|
|
maWindowListeners.disposeAndClear( aObj );
|
|
|
|
maKeyListeners.disposeAndClear( aObj );
|
|
|
|
maMouseListeners.disposeAndClear( aObj );
|
|
|
|
maMouseMotionListeners.disposeAndClear( aObj );
|
|
|
|
maPaintListeners.disposeAndClear( aObj );
|
|
|
|
maContainerListeners.disposeAndClear( aObj );
|
|
|
|
maTopWindowListeners.disposeAndClear( aObj );
|
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
if ( mpImpl )
|
|
|
|
{
|
|
|
|
mpImpl->disposing();
|
|
|
|
mpImpl->release();
|
|
|
|
mpImpl = NULL;
|
|
|
|
}
|
|
|
|
|
2002-08-27 11:10:35 +00:00
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
OutputDevice* pOutDev = GetOutputDevice();
|
|
|
|
SetWindow( NULL ); // Damit ggf. Handler abgemeldet werden (virtuell).
|
|
|
|
SetOutputDevice( pOutDev );
|
|
|
|
DestroyOutputDevice();
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-05-22 07:50:32 +00:00
|
|
|
// #i14103# dispose the accessible context after the window has been destroyed,
|
|
|
|
// otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
|
|
|
|
// for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object
|
|
|
|
try
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY );
|
|
|
|
if ( xComponent.is() )
|
|
|
|
xComponent->dispose();
|
|
|
|
}
|
|
|
|
catch ( const ::com::sun::star::uno::Exception& )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "VCLXWindow::dispose: could not dispose the accessible context!" );
|
|
|
|
}
|
|
|
|
mxAccessibleContext.clear();
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
mbDisposing = sal_False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetEventListeners().addInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetEventListeners().removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::awt::XWindow
|
|
|
|
void VCLXWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
2004-07-06 11:02:21 +00:00
|
|
|
{
|
|
|
|
if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
|
|
|
|
Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X, Y, Width, Height, Flags );
|
|
|
|
else
|
|
|
|
GetWindow()->SetPosSizePixel( X, Y, Width, Height, Flags );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::awt::Rectangle VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
::com::sun::star::awt::Rectangle aBounds;
|
|
|
|
if ( GetWindow() )
|
2004-07-06 11:02:21 +00:00
|
|
|
{
|
|
|
|
if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
|
|
|
|
aBounds = AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
|
|
|
|
else
|
|
|
|
aBounds = AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
return aBounds;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
2000-12-14 11:20:00 +00:00
|
|
|
/*
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bVisible )
|
|
|
|
{
|
|
|
|
// #57167# TopWindows mit unsichtbaren Parent anzeigen...
|
|
|
|
::com::sun::star::uno::Any aTest = queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >*) 0 ) );
|
|
|
|
if ( aTest.hasValue() )
|
|
|
|
{
|
|
|
|
Window* pParent = pWindow->GetWindow( WINDOW_PARENTOVERLAP );
|
|
|
|
if ( pParent && !pParent->IsReallyVisible() )
|
|
|
|
pWindow->SetParent( pWindow->GetWindow( WINDOW_FRAME ) );
|
|
|
|
}
|
|
|
|
}
|
2000-12-14 11:20:00 +00:00
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
pWindow->Show( bVisible );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
2003-09-04 06:43:35 +00:00
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
pWindow->Enable( bEnable, FALSE ); // #95824# without children!
|
|
|
|
pWindow->EnableInput( bEnable );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
GetWindow()->GrabFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetWindowListeners().addInterface( rxListener );
|
2002-11-20 08:41:10 +00:00
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
|
|
|
|
if ( xListener2.is() )
|
|
|
|
mpImpl->getWindow2Listeners().addInterface( xListener2 );
|
|
|
|
|
2002-11-20 08:41:10 +00:00
|
|
|
// #100119# Get all resize events, even if height or width 0, or invisible
|
|
|
|
if ( GetWindow() )
|
|
|
|
GetWindow()->EnableAllResize( TRUE );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
2006-10-18 12:14:50 +00:00
|
|
|
Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
|
|
|
|
if ( xListener2.is() )
|
|
|
|
mpImpl->getWindow2Listeners().removeInterface( xListener2 );
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
GetWindowListeners().removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetFocusListeners().addInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetFocusListeners().removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetKeyListeners().addInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetKeyListeners().removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetMouseListeners().addInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetMouseListeners().removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetMouseMotionListeners().addInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetMouseMotionListeners().removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetPaintListeners().addInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
GetPaintListeners().removeInterface( rxListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::awt::XWindowPeer
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2001-01-05 15:49:41 +00:00
|
|
|
// no guard. nothing to guard here.
|
|
|
|
// 82463 - 12/21/00 - fs
|
|
|
|
return Application::GetVCLToolkit();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& rxPointer ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer );
|
|
|
|
if ( pPointer )
|
|
|
|
{
|
|
|
|
mxPointer = rxPointer;
|
|
|
|
if ( GetWindow() )
|
|
|
|
GetWindow()->SetPointer( pPointer->GetPointer() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setBackground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Color aColor( (sal_uInt32)nColor );
|
|
|
|
GetWindow()->SetBackground( aColor );
|
|
|
|
GetWindow()->SetControlBackground( aColor );
|
|
|
|
|
|
|
|
WindowType eWinType = GetWindow()->GetType();
|
|
|
|
if ( ( eWinType == WINDOW_WINDOW ) ||
|
|
|
|
( eWinType == WINDOW_WORKWINDOW ) ||
|
|
|
|
( eWinType == WINDOW_FLOATINGWINDOW ) )
|
|
|
|
{
|
|
|
|
GetWindow()->Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-19 22:02:22 +00:00
|
|
|
void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
2006-06-19 22:02:22 +00:00
|
|
|
GetWindow()->Invalidate( (sal_uInt16) nInvalidateFlags );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-06-19 22:02:22 +00:00
|
|
|
void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle& rRect, sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
2006-06-19 22:02:22 +00:00
|
|
|
GetWindow()->Invalidate( VCLRectangle(rRect), (sal_uInt16) nInvalidateFlags );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::awt::XVclWindowPeer
|
|
|
|
sal_Bool VCLXWindow::isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxPeer ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
sal_Bool bIsChild = sal_False;
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
Window* pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
|
|
|
|
bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow );
|
|
|
|
}
|
|
|
|
|
|
|
|
return bIsChild;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
mbDesignMode = bOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
return mbDesignMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
GetWindow()->EnableClipSiblings( bClip );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setForeground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
Color aColor( (sal_uInt32)nColor );
|
|
|
|
GetWindow()->SetControlForeground( aColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor& rFont ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont, GetWindow()->GetControlFont() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
|
|
|
|
|
|
|
|
switch ( nType )
|
|
|
|
{
|
|
|
|
case ::com::sun::star::awt::Style::FRAME:
|
|
|
|
{
|
|
|
|
Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
|
|
|
|
ForegroundColor = rStyleSettings.GetWindowTextColor().GetColor();
|
|
|
|
BackgroundColor = rStyleSettings.GetWindowColor().GetColor();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ::com::sun::star::awt::Style::DIALOG:
|
|
|
|
{
|
|
|
|
Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
|
|
|
|
ForegroundColor = rStyleSettings.GetDialogTextColor().GetColor();
|
|
|
|
BackgroundColor = rStyleSettings.GetDialogColor().GetColor();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: DBG_ERROR( "VCLWindow::getStyles() - unknown Type" );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-05 14:55:21 +00:00
|
|
|
namespace toolkit
|
|
|
|
{
|
|
|
|
static void setColorSettings( Window* _pWindow, const ::com::sun::star::uno::Any& _rValue,
|
|
|
|
void (StyleSettings::*pSetter)( const Color& ), const Color& (StyleSettings::*pGetter)( ) const )
|
|
|
|
{
|
|
|
|
sal_Int32 nColor = 0;
|
|
|
|
if ( !( _rValue >>= nColor ) )
|
|
|
|
nColor = (Application::GetSettings().GetStyleSettings().*pGetter)().GetColor();
|
|
|
|
|
|
|
|
AllSettings aSettings = _pWindow->GetSettings();
|
|
|
|
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
|
|
|
|
|
|
|
|
(aStyleSettings.*pSetter)( Color( nColor ) );
|
|
|
|
|
|
|
|
aSettings.SetStyleSettings( aStyleSettings );
|
|
|
|
_pWindow->SetSettings( aSettings, TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-14 11:57:14 +00:00
|
|
|
// Terminated by BASEPROPERTY_NOTFOUND (or 0)
|
|
|
|
void VCLXWindow::PushPropertyIds( std::list< sal_uInt16 > &rIds,
|
|
|
|
int nFirstId, ...)
|
|
|
|
{
|
|
|
|
va_list pVarArgs;
|
|
|
|
va_start( pVarArgs, nFirstId );
|
|
|
|
|
|
|
|
for ( int nId = nFirstId; nId != BASEPROPERTY_NOTFOUND;
|
|
|
|
nId = va_arg( pVarArgs, int ) )
|
2008-01-15 12:15:08 +00:00
|
|
|
rIds.push_back( (sal_uInt16) nId );
|
2008-01-14 11:57:14 +00:00
|
|
|
|
|
|
|
va_end( pVarArgs );
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDefaults )
|
|
|
|
{
|
|
|
|
// These are common across ~all VCLXWindow derived classes
|
|
|
|
if( bWithDefaults )
|
|
|
|
PushPropertyIds( rIds,
|
|
|
|
BASEPROPERTY_ALIGN,
|
|
|
|
BASEPROPERTY_BACKGROUNDCOLOR,
|
|
|
|
BASEPROPERTY_BORDER,
|
|
|
|
BASEPROPERTY_BORDERCOLOR,
|
|
|
|
BASEPROPERTY_DEFAULTCONTROL,
|
|
|
|
BASEPROPERTY_ENABLED,
|
|
|
|
BASEPROPERTY_FONTDESCRIPTOR,
|
|
|
|
BASEPROPERTY_HELPTEXT,
|
|
|
|
BASEPROPERTY_HELPURL,
|
|
|
|
BASEPROPERTY_TEXT,
|
|
|
|
BASEPROPERTY_PRINTABLE,
|
|
|
|
BASEPROPERTY_TABSTOP,
|
|
|
|
0);
|
|
|
|
|
|
|
|
// lovely hack from:
|
|
|
|
// void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
|
|
|
|
std::list< sal_uInt16 >::const_iterator iter;
|
|
|
|
for( iter = rIds.begin(); iter != rIds.end(); iter++) {
|
|
|
|
if( *iter == BASEPROPERTY_FONTDESCRIPTOR )
|
|
|
|
{
|
|
|
|
// some properties are not included in the FontDescriptor, but everytime
|
|
|
|
// when we have a FontDescriptor we want to have these properties too.
|
|
|
|
// => Easier to register the here, istead everywhere where I register the FontDescriptor...
|
|
|
|
|
|
|
|
rIds.push_back( BASEPROPERTY_TEXTCOLOR );
|
|
|
|
rIds.push_back( BASEPROPERTY_TEXTLINECOLOR );
|
|
|
|
rIds.push_back( BASEPROPERTY_FONTRELIEF );
|
|
|
|
rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
|
|
|
|
|
|
|
|
WindowType eWinType = pWindow->GetType();
|
|
|
|
sal_uInt16 nPropType = GetPropertyId( PropertyName );
|
|
|
|
switch ( nPropType )
|
|
|
|
{
|
2006-05-04 07:25:09 +00:00
|
|
|
case BASEPROPERTY_WHEELWITHOUTFOCUS:
|
|
|
|
{
|
|
|
|
sal_Bool bWheelOnHover( sal_True );
|
|
|
|
if ( Value >>= bWheelOnHover )
|
|
|
|
{
|
|
|
|
AllSettings aSettings = pWindow->GetSettings();
|
|
|
|
MouseSettings aMouseSettings = aSettings.GetMouseSettings();
|
|
|
|
|
|
|
|
aMouseSettings.SetNoWheelActionWithoutFocus( !bWheelOnHover );
|
|
|
|
aSettings.SetMouseSettings( aMouseSettings );
|
|
|
|
|
|
|
|
pWindow->SetSettings( aSettings, TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-10-13 07:20:37 +00:00
|
|
|
case BASEPROPERTY_NATIVE_WIDGET_LOOK:
|
|
|
|
{
|
|
|
|
sal_Bool bEnable( sal_True );
|
|
|
|
OSL_VERIFY( Value >>= bEnable );
|
|
|
|
pWindow->EnableNativeWidget( bEnable );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-06-20 09:19:09 +00:00
|
|
|
case BASEPROPERTY_PLUGINPARENT:
|
|
|
|
{
|
|
|
|
// set parent handle
|
2007-08-30 12:54:36 +00:00
|
|
|
SetSystemParent_Impl( Value );
|
2003-06-20 09:19:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_ENABLED:
|
|
|
|
{
|
2006-08-29 09:57:37 +00:00
|
|
|
sal_Bool b = sal_Bool();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( Value >>= b )
|
2003-09-04 06:43:35 +00:00
|
|
|
setEnable( b );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_TEXT:
|
|
|
|
case BASEPROPERTY_LABEL:
|
2001-01-24 15:13:20 +00:00
|
|
|
case BASEPROPERTY_TITLE:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-01-29 14:05:41 +00:00
|
|
|
::rtl::OUString aText;
|
|
|
|
if ( Value >>= aText )
|
2006-08-03 12:31:57 +00:00
|
|
|
{
|
2008-01-29 14:05:41 +00:00
|
|
|
switch (eWinType)
|
|
|
|
{
|
|
|
|
case WINDOW_OKBUTTON:
|
|
|
|
case WINDOW_CANCELBUTTON:
|
|
|
|
case WINDOW_HELPBUTTON:
|
|
|
|
// Standard Button: overwrite only if not empty.
|
|
|
|
if (aText.getLength())
|
|
|
|
pWindow->SetText( aText );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
pWindow->SetText( aText );
|
|
|
|
break;
|
|
|
|
}
|
2006-08-03 12:31:57 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-12-10 06:14:21 +00:00
|
|
|
case BASEPROPERTY_ACCESSIBLENAME:
|
|
|
|
{
|
|
|
|
::rtl::OUString aText;
|
|
|
|
if ( Value >>= aText )
|
|
|
|
pWindow->SetAccessibleName( aText );
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_HELPURL:
|
|
|
|
{
|
|
|
|
::rtl::OUString aURL;
|
|
|
|
if ( Value >>= aURL )
|
|
|
|
{
|
|
|
|
String aHelpURL( aURL );
|
|
|
|
String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
|
|
|
|
if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL )
|
|
|
|
{
|
|
|
|
String aID = aHelpURL.Copy( aPattern.Len() );
|
|
|
|
pWindow->SetHelpId( aID.ToInt32() );
|
|
|
|
}
|
2007-11-19 11:57:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pWindow->SetSmartHelpId( SmartId( aHelpURL ) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-11 08:45:18 +00:00
|
|
|
break;
|
2001-03-23 12:31:49 +00:00
|
|
|
case BASEPROPERTY_HELPTEXT:
|
|
|
|
{
|
|
|
|
::rtl::OUString aHelpText;
|
|
|
|
if ( Value >>= aHelpText )
|
|
|
|
{
|
|
|
|
pWindow->SetQuickHelpText( aHelpText );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
break;
|
|
|
|
case BASEPROPERTY_FONTDESCRIPTOR:
|
|
|
|
{
|
|
|
|
if ( bVoid )
|
|
|
|
pWindow->SetControlFont( Font() );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
::com::sun::star::awt::FontDescriptor aFont;
|
|
|
|
if ( Value >>= aFont )
|
|
|
|
pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2001-06-01 10:22:52 +00:00
|
|
|
case BASEPROPERTY_FONTRELIEF:
|
|
|
|
{
|
2006-08-29 09:57:37 +00:00
|
|
|
sal_Int16 n = sal_Int16();
|
2001-06-01 10:22:52 +00:00
|
|
|
if ( Value >>= n )
|
|
|
|
{
|
|
|
|
Font aFont = pWindow->GetControlFont();
|
|
|
|
aFont.SetRelief( (FontRelief)n );
|
|
|
|
pWindow->SetControlFont( aFont );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_FONTEMPHASISMARK:
|
|
|
|
{
|
2006-08-29 09:57:37 +00:00
|
|
|
sal_Int16 n = sal_Int16();
|
2001-06-01 10:22:52 +00:00
|
|
|
if ( Value >>= n )
|
|
|
|
{
|
|
|
|
Font aFont = pWindow->GetControlFont();
|
|
|
|
aFont.SetEmphasisMark( n );
|
|
|
|
pWindow->SetControlFont( aFont );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_BACKGROUNDCOLOR:
|
|
|
|
if ( bVoid )
|
|
|
|
{
|
2007-11-26 15:26:33 +00:00
|
|
|
switch ( eWinType )
|
|
|
|
{
|
|
|
|
// set dialog color for default
|
|
|
|
case WINDOW_DIALOG:
|
|
|
|
case WINDOW_MESSBOX:
|
|
|
|
case WINDOW_INFOBOX:
|
|
|
|
case WINDOW_WARNINGBOX:
|
|
|
|
case WINDOW_ERRORBOX:
|
|
|
|
case WINDOW_QUERYBOX:
|
|
|
|
case WINDOW_TABPAGE:
|
|
|
|
{
|
|
|
|
Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor();
|
|
|
|
pWindow->SetBackground( aColor );
|
|
|
|
pWindow->SetControlBackground( aColor );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-01-14 16:09:42 +00:00
|
|
|
case WINDOW_FIXEDTEXT:
|
|
|
|
case WINDOW_CHECKBOX:
|
|
|
|
case WINDOW_RADIOBUTTON:
|
|
|
|
case WINDOW_GROUPBOX:
|
|
|
|
case WINDOW_FIXEDLINE:
|
2007-11-26 15:26:33 +00:00
|
|
|
{
|
2008-01-14 16:09:42 +00:00
|
|
|
// support transparency only for special controls
|
2007-11-26 15:26:33 +00:00
|
|
|
pWindow->SetBackground();
|
|
|
|
pWindow->SetControlBackground();
|
2008-01-29 14:05:41 +00:00
|
|
|
pWindow->SetPaintTransparent( TRUE );
|
2007-11-26 15:26:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-01-14 16:09:42 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
// default code which enables transparency for
|
|
|
|
// compound controls. It's not real transparency
|
|
|
|
// as most of these controls repaint their client
|
|
|
|
// area completely new.
|
|
|
|
if ( pWindow->IsCompoundControl() )
|
|
|
|
pWindow->SetBackground();
|
|
|
|
pWindow->SetControlBackground();
|
|
|
|
break;
|
|
|
|
}
|
2007-11-26 15:26:33 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-21 16:02:45 +00:00
|
|
|
sal_Int32 nColor = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( Value >>= nColor )
|
|
|
|
{
|
|
|
|
Color aColor( nColor );
|
|
|
|
pWindow->SetControlBackground( aColor );
|
2007-08-02 13:18:21 +00:00
|
|
|
pWindow->SetBackground( aColor );
|
2008-01-29 14:05:41 +00:00
|
|
|
switch ( eWinType )
|
|
|
|
{
|
|
|
|
// reset paint transparent mode
|
|
|
|
case WINDOW_FIXEDTEXT:
|
|
|
|
case WINDOW_CHECKBOX:
|
|
|
|
case WINDOW_RADIOBUTTON:
|
|
|
|
case WINDOW_GROUPBOX:
|
|
|
|
case WINDOW_FIXEDLINE:
|
|
|
|
pWindow->SetPaintTransparent( FALSE );
|
|
|
|
default: ;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
pWindow->Invalidate(); // Falls das Control nicht drauf reagiert
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_TEXTCOLOR:
|
|
|
|
if ( bVoid )
|
|
|
|
{
|
|
|
|
pWindow->SetControlForeground();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-21 16:02:45 +00:00
|
|
|
sal_Int32 nColor = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( Value >>= nColor )
|
|
|
|
{
|
|
|
|
Color aColor( nColor );
|
|
|
|
pWindow->SetTextColor( aColor );
|
|
|
|
pWindow->SetControlForeground( aColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2001-06-01 10:22:52 +00:00
|
|
|
case BASEPROPERTY_TEXTLINECOLOR:
|
|
|
|
if ( bVoid )
|
|
|
|
{
|
|
|
|
pWindow->SetTextLineColor();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-21 16:02:45 +00:00
|
|
|
sal_Int32 nColor = 0;
|
2001-06-01 10:22:52 +00:00
|
|
|
if ( Value >>= nColor )
|
|
|
|
{
|
|
|
|
Color aColor( nColor );
|
|
|
|
pWindow->SetTextLineColor( aColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_FILLCOLOR:
|
|
|
|
if ( bVoid )
|
|
|
|
pWindow->SetFillColor();
|
|
|
|
else
|
|
|
|
{
|
2006-11-21 16:02:45 +00:00
|
|
|
sal_Int32 nColor = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( Value >>= nColor )
|
|
|
|
{
|
|
|
|
Color aColor( nColor );
|
|
|
|
pWindow->SetFillColor( aColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_LINECOLOR:
|
|
|
|
if ( bVoid )
|
|
|
|
pWindow->SetLineColor();
|
|
|
|
else
|
|
|
|
{
|
2006-11-21 16:02:45 +00:00
|
|
|
sal_Int32 nColor = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( Value >>= nColor )
|
|
|
|
{
|
|
|
|
Color aColor( nColor );
|
|
|
|
pWindow->SetLineColor( aColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_BORDER:
|
|
|
|
{
|
|
|
|
WinBits nStyle = pWindow->GetStyle();
|
2006-07-19 14:55:10 +00:00
|
|
|
sal_uInt16 nBorder = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
Value >>= nBorder;
|
|
|
|
if ( !nBorder )
|
|
|
|
{
|
|
|
|
pWindow->SetStyle( nStyle & ~WB_BORDER );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pWindow->SetStyle( nStyle | WB_BORDER );
|
|
|
|
pWindow->SetBorderStyle( nBorder );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_TABSTOP:
|
|
|
|
{
|
|
|
|
WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP;
|
|
|
|
if ( !bVoid )
|
|
|
|
{
|
2006-07-19 14:55:10 +00:00
|
|
|
sal_Bool bTab = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
Value >>= bTab;
|
|
|
|
if ( bTab )
|
|
|
|
nStyle |= WB_TABSTOP;
|
|
|
|
else
|
|
|
|
nStyle |= WB_NOTABSTOP;
|
|
|
|
}
|
|
|
|
pWindow->SetStyle( nStyle );
|
|
|
|
}
|
|
|
|
break;
|
2005-01-21 15:46:46 +00:00
|
|
|
case BASEPROPERTY_VERTICALALIGN:
|
|
|
|
{
|
|
|
|
VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE;
|
|
|
|
WinBits nStyle = pWindow->GetStyle();
|
|
|
|
nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM);
|
|
|
|
if ( !bVoid )
|
|
|
|
Value >>= eAlign;
|
|
|
|
switch ( eAlign )
|
|
|
|
{
|
|
|
|
case VerticalAlignment_TOP:
|
|
|
|
nStyle |= WB_TOP;
|
|
|
|
break;
|
|
|
|
case VerticalAlignment_MIDDLE:
|
|
|
|
nStyle |= WB_VCENTER;
|
|
|
|
break;
|
|
|
|
case VerticalAlignment_BOTTOM:
|
|
|
|
nStyle |= WB_BOTTOM;
|
|
|
|
break;
|
2006-06-19 22:02:22 +00:00
|
|
|
default: ; // for warning free code, MAKE_FIXED_SIZE
|
2005-01-21 15:46:46 +00:00
|
|
|
}
|
|
|
|
pWindow->SetStyle( nStyle );
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_ALIGN:
|
|
|
|
{
|
2004-07-05 14:55:21 +00:00
|
|
|
sal_Int16 nAlign = PROPERTY_ALIGN_LEFT;
|
2000-09-18 16:07:07 +00:00
|
|
|
switch ( eWinType )
|
|
|
|
{
|
2004-07-05 14:55:21 +00:00
|
|
|
case WINDOW_COMBOBOX:
|
|
|
|
case WINDOW_BUTTON:
|
|
|
|
case WINDOW_PUSHBUTTON:
|
|
|
|
case WINDOW_OKBUTTON:
|
|
|
|
case WINDOW_CANCELBUTTON:
|
|
|
|
case WINDOW_HELPBUTTON:
|
|
|
|
nAlign = PROPERTY_ALIGN_CENTER;
|
|
|
|
// no break here!
|
2000-09-18 16:07:07 +00:00
|
|
|
case WINDOW_FIXEDTEXT:
|
|
|
|
case WINDOW_EDIT:
|
2007-07-06 13:26:58 +00:00
|
|
|
case WINDOW_MULTILINEEDIT:
|
2004-07-05 14:55:21 +00:00
|
|
|
case WINDOW_CHECKBOX:
|
|
|
|
case WINDOW_RADIOBUTTON:
|
|
|
|
case WINDOW_LISTBOX:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
WinBits nStyle = pWindow->GetStyle();
|
|
|
|
nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
|
|
|
|
if ( !bVoid )
|
|
|
|
Value >>= nAlign;
|
|
|
|
if ( nAlign == PROPERTY_ALIGN_LEFT )
|
|
|
|
nStyle |= WB_LEFT;
|
|
|
|
else if ( nAlign == PROPERTY_ALIGN_CENTER )
|
|
|
|
nStyle |= WB_CENTER;
|
|
|
|
else
|
|
|
|
nStyle |= WB_RIGHT;
|
|
|
|
pWindow->SetStyle( nStyle );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_MULTILINE:
|
|
|
|
{
|
2004-07-05 14:55:21 +00:00
|
|
|
if ( ( eWinType == WINDOW_FIXEDTEXT )
|
|
|
|
|| ( eWinType == WINDOW_CHECKBOX )
|
|
|
|
|| ( eWinType == WINDOW_RADIOBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_BUTTON )
|
|
|
|
|| ( eWinType == WINDOW_PUSHBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_OKBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_CANCELBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_HELPBUTTON )
|
|
|
|
)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
WinBits nStyle = pWindow->GetStyle();
|
2006-07-19 14:55:10 +00:00
|
|
|
sal_Bool bMulti = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
Value >>= bMulti;
|
|
|
|
if ( bMulti )
|
|
|
|
nStyle |= WB_WORDBREAK;
|
|
|
|
else
|
|
|
|
nStyle &= ~WB_WORDBREAK;
|
|
|
|
pWindow->SetStyle( nStyle );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2001-05-04 08:04:05 +00:00
|
|
|
case BASEPROPERTY_ORIENTATION:
|
|
|
|
{
|
|
|
|
switch ( eWinType )
|
|
|
|
{
|
|
|
|
case WINDOW_FIXEDLINE:
|
|
|
|
{
|
2006-11-21 16:02:45 +00:00
|
|
|
sal_Int32 nOrientation = 0;
|
2001-05-04 08:04:05 +00:00
|
|
|
if ( Value >>= nOrientation )
|
|
|
|
{
|
|
|
|
WinBits nStyle = pWindow->GetStyle();
|
|
|
|
nStyle &= ~(WB_HORZ|WB_VERT);
|
|
|
|
if ( nOrientation == 0 )
|
|
|
|
nStyle |= WB_HORZ;
|
|
|
|
else
|
|
|
|
nStyle |= WB_VERT;
|
|
|
|
|
|
|
|
pWindow->SetStyle( nStyle );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-11-04 13:10:09 +00:00
|
|
|
case BASEPROPERTY_AUTOMNEMONICS:
|
|
|
|
{
|
2006-07-19 14:55:10 +00:00
|
|
|
sal_Bool bAutoMnemonics = false;
|
2002-11-04 13:10:09 +00:00
|
|
|
Value >>= bAutoMnemonics;
|
|
|
|
AllSettings aSettings = pWindow->GetSettings();
|
|
|
|
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
|
|
|
|
if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics )
|
|
|
|
{
|
|
|
|
aStyleSettings.SetAutoMnemonic( bAutoMnemonics );
|
|
|
|
aSettings.SetStyleSettings( aStyleSettings );
|
|
|
|
pWindow->SetSettings( aSettings );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-11-21 11:07:05 +00:00
|
|
|
case BASEPROPERTY_MOUSETRANSPARENT:
|
|
|
|
{
|
2006-07-19 14:55:10 +00:00
|
|
|
sal_Bool bMouseTransparent = false;
|
2002-11-21 11:07:05 +00:00
|
|
|
Value >>= bMouseTransparent;
|
|
|
|
pWindow->SetMouseTransparent( bMouseTransparent );
|
|
|
|
}
|
|
|
|
break;
|
2007-07-06 13:26:58 +00:00
|
|
|
case BASEPROPERTY_PAINTTRANSPARENT:
|
|
|
|
{
|
|
|
|
sal_Bool bPaintTransparent = false;
|
|
|
|
Value >>= bPaintTransparent;
|
|
|
|
pWindow->SetPaintTransparent( bPaintTransparent );
|
2007-11-26 15:26:33 +00:00
|
|
|
// pWindow->SetBackground();
|
2007-07-06 13:26:58 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-12-11 10:57:03 +00:00
|
|
|
|
|
|
|
case BASEPROPERTY_REPEAT:
|
|
|
|
{
|
|
|
|
sal_Bool bRepeat( FALSE );
|
|
|
|
Value >>= bRepeat;
|
|
|
|
|
|
|
|
WinBits nStyle = pWindow->GetStyle();
|
|
|
|
if ( bRepeat )
|
|
|
|
nStyle |= WB_REPEAT;
|
|
|
|
else
|
|
|
|
nStyle &= ~WB_REPEAT;
|
|
|
|
pWindow->SetStyle( nStyle );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BASEPROPERTY_REPEAT_DELAY:
|
|
|
|
{
|
2006-11-21 16:02:45 +00:00
|
|
|
sal_Int32 nRepeatDelay = 0;
|
2003-12-11 10:57:03 +00:00
|
|
|
if ( Value >>= nRepeatDelay )
|
|
|
|
{
|
|
|
|
AllSettings aSettings = pWindow->GetSettings();
|
|
|
|
MouseSettings aMouseSettings = aSettings.GetMouseSettings();
|
|
|
|
|
|
|
|
aMouseSettings.SetButtonRepeat( nRepeatDelay );
|
|
|
|
aSettings.SetMouseSettings( aMouseSettings );
|
|
|
|
|
|
|
|
pWindow->SetSettings( aSettings, TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BASEPROPERTY_SYMBOL_COLOR:
|
2004-07-05 14:55:21 +00:00
|
|
|
::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor );
|
|
|
|
break;
|
2003-12-11 10:57:03 +00:00
|
|
|
|
2004-07-05 14:55:21 +00:00
|
|
|
case BASEPROPERTY_BORDERCOLOR:
|
|
|
|
::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor);
|
|
|
|
break;
|
2008-01-14 11:57:14 +00:00
|
|
|
case BASEPROPERTY_DEFAULTCONTROL:
|
|
|
|
{
|
|
|
|
rtl::OUString aName;
|
|
|
|
Value >>= aName;
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::uno::Any VCLXWindow::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
::com::sun::star::uno::Any aProp;
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
WindowType eWinType = GetWindow()->GetType();
|
|
|
|
sal_uInt16 nPropType = GetPropertyId( PropertyName );
|
|
|
|
switch ( nPropType )
|
|
|
|
{
|
2006-05-04 07:25:09 +00:00
|
|
|
case BASEPROPERTY_WHEELWITHOUTFOCUS:
|
|
|
|
{
|
|
|
|
sal_Bool bWheelOnHover = !GetWindow()->GetSettings().GetMouseSettings().GetNoWheelActionWithoutFocus();
|
|
|
|
aProp <<= bWheelOnHover;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2004-10-13 07:20:37 +00:00
|
|
|
case BASEPROPERTY_NATIVE_WIDGET_LOOK:
|
|
|
|
aProp <<= (sal_Bool) GetWindow()->IsNativeWidgetEnabled();
|
2006-05-04 07:25:09 +00:00
|
|
|
break;
|
2004-10-13 07:20:37 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_ENABLED:
|
|
|
|
aProp <<= (sal_Bool) GetWindow()->IsEnabled();
|
2006-05-04 07:25:09 +00:00
|
|
|
break;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_TEXT:
|
|
|
|
case BASEPROPERTY_LABEL:
|
2001-01-24 15:13:20 +00:00
|
|
|
case BASEPROPERTY_TITLE:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
::rtl::OUString aText = GetWindow()->GetText();
|
|
|
|
aProp <<= aText;
|
|
|
|
}
|
|
|
|
break;
|
2002-12-10 06:14:21 +00:00
|
|
|
case BASEPROPERTY_ACCESSIBLENAME:
|
|
|
|
{
|
|
|
|
::rtl::OUString aText = GetWindow()->GetAccessibleName();
|
|
|
|
aProp <<= aText;
|
|
|
|
}
|
|
|
|
break;
|
2001-03-23 12:31:49 +00:00
|
|
|
case BASEPROPERTY_HELPTEXT:
|
|
|
|
{
|
|
|
|
::rtl::OUString aText = GetWindow()->GetQuickHelpText();
|
|
|
|
aProp <<= aText;
|
|
|
|
}
|
|
|
|
break;
|
2006-12-13 10:41:41 +00:00
|
|
|
case BASEPROPERTY_HELPURL:
|
|
|
|
{
|
2007-11-19 11:57:38 +00:00
|
|
|
SmartId aSmartId = GetWindow()->GetSmartHelpId();
|
|
|
|
if( aSmartId.HasString() )
|
|
|
|
{
|
|
|
|
String aStrHelpId = aSmartId.GetStr();
|
|
|
|
aProp <<= ::rtl::OUString( aStrHelpId );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
::rtl::OUStringBuffer aURL;
|
|
|
|
aURL.appendAscii( "HID:" );
|
|
|
|
aURL.append( (sal_Int32) GetWindow()->GetHelpId() );
|
|
|
|
aProp <<= aURL.makeStringAndClear();
|
|
|
|
}
|
2006-12-13 10:41:41 +00:00
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_FONTDESCRIPTOR:
|
|
|
|
{
|
|
|
|
Font aFont = GetWindow()->GetControlFont();
|
|
|
|
::com::sun::star::awt::FontDescriptor aFD = VCLUnoHelper::CreateFontDescriptor( aFont );
|
|
|
|
aProp <<= aFD;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_BACKGROUNDCOLOR:
|
|
|
|
aProp <<= (sal_Int32) GetWindow()->GetControlBackground().GetColor();
|
|
|
|
break;
|
2002-05-27 09:37:02 +00:00
|
|
|
case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR:
|
|
|
|
aProp <<= (sal_Int32) GetWindow()->GetDisplayBackground().GetColor().GetColor();
|
|
|
|
break;
|
2001-06-01 10:22:52 +00:00
|
|
|
case BASEPROPERTY_FONTRELIEF:
|
|
|
|
aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetRelief();
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_FONTEMPHASISMARK:
|
|
|
|
aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetEmphasisMark();
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_TEXTCOLOR:
|
|
|
|
aProp <<= (sal_Int32) GetWindow()->GetControlForeground().GetColor();
|
|
|
|
break;
|
2001-06-01 10:22:52 +00:00
|
|
|
case BASEPROPERTY_TEXTLINECOLOR:
|
|
|
|
aProp <<= (sal_Int32) GetWindow()->GetTextLineColor().GetColor();
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_FILLCOLOR:
|
|
|
|
aProp <<= (sal_Int32) GetWindow()->GetFillColor().GetColor();
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_LINECOLOR:
|
|
|
|
aProp <<= (sal_Int32) GetWindow()->GetLineColor().GetColor();
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_BORDER:
|
|
|
|
{
|
2004-07-05 14:55:21 +00:00
|
|
|
sal_Int16 nBorder = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( GetWindow()->GetStyle() & WB_BORDER )
|
|
|
|
nBorder = GetWindow()->GetBorderStyle();
|
|
|
|
aProp <<= nBorder;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_TABSTOP:
|
|
|
|
aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_TABSTOP ) ? sal_True : sal_False;
|
|
|
|
break;
|
2005-01-21 15:46:46 +00:00
|
|
|
case BASEPROPERTY_VERTICALALIGN:
|
|
|
|
{
|
|
|
|
WinBits nStyle = GetWindow()->GetStyle();
|
|
|
|
if ( nStyle & WB_TOP )
|
|
|
|
aProp <<= VerticalAlignment_TOP;
|
|
|
|
else if ( nStyle & WB_VCENTER )
|
|
|
|
aProp <<= VerticalAlignment_MIDDLE;
|
|
|
|
else if ( nStyle & WB_BOTTOM )
|
|
|
|
aProp <<= VerticalAlignment_BOTTOM;
|
|
|
|
}
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
case BASEPROPERTY_ALIGN:
|
|
|
|
{
|
|
|
|
switch ( eWinType )
|
|
|
|
{
|
|
|
|
case WINDOW_FIXEDTEXT:
|
|
|
|
case WINDOW_EDIT:
|
2007-07-06 13:26:58 +00:00
|
|
|
case WINDOW_MULTILINEEDIT:
|
2004-07-05 14:55:21 +00:00
|
|
|
case WINDOW_CHECKBOX:
|
|
|
|
case WINDOW_RADIOBUTTON:
|
|
|
|
case WINDOW_LISTBOX:
|
|
|
|
case WINDOW_COMBOBOX:
|
|
|
|
case WINDOW_BUTTON:
|
|
|
|
case WINDOW_PUSHBUTTON:
|
|
|
|
case WINDOW_OKBUTTON:
|
|
|
|
case WINDOW_CANCELBUTTON:
|
|
|
|
case WINDOW_HELPBUTTON:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
WinBits nStyle = GetWindow()->GetStyle();
|
|
|
|
if ( nStyle & WB_LEFT )
|
|
|
|
aProp <<= (sal_Int16) PROPERTY_ALIGN_LEFT;
|
|
|
|
else if ( nStyle & WB_CENTER )
|
|
|
|
aProp <<= (sal_Int16) PROPERTY_ALIGN_CENTER;
|
|
|
|
else if ( nStyle & WB_RIGHT )
|
|
|
|
aProp <<= (sal_Int16) PROPERTY_ALIGN_RIGHT;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case BASEPROPERTY_MULTILINE:
|
|
|
|
{
|
2004-07-05 14:55:21 +00:00
|
|
|
if ( ( eWinType == WINDOW_FIXEDTEXT )
|
|
|
|
|| ( eWinType == WINDOW_CHECKBOX )
|
|
|
|
|| ( eWinType == WINDOW_RADIOBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_BUTTON )
|
|
|
|
|| ( eWinType == WINDOW_PUSHBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_OKBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_CANCELBUTTON )
|
|
|
|
|| ( eWinType == WINDOW_HELPBUTTON )
|
|
|
|
)
|
2000-09-18 16:07:07 +00:00
|
|
|
aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_WORDBREAK ) ? sal_True : sal_False;
|
|
|
|
}
|
|
|
|
break;
|
2002-11-04 13:10:09 +00:00
|
|
|
case BASEPROPERTY_AUTOMNEMONICS:
|
|
|
|
{
|
|
|
|
sal_Bool bAutoMnemonics = GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
|
|
|
|
aProp <<= bAutoMnemonics;
|
|
|
|
}
|
|
|
|
break;
|
2002-11-21 11:07:05 +00:00
|
|
|
case BASEPROPERTY_MOUSETRANSPARENT:
|
|
|
|
{
|
|
|
|
sal_Bool bMouseTransparent = GetWindow()->IsMouseTransparent();
|
|
|
|
aProp <<= bMouseTransparent;
|
2007-07-06 13:26:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BASEPROPERTY_PAINTTRANSPARENT:
|
|
|
|
{
|
|
|
|
sal_Bool bPaintTransparent = GetWindow()->IsPaintTransparent();
|
|
|
|
aProp <<= bPaintTransparent;
|
2002-11-21 11:07:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-12-11 10:57:03 +00:00
|
|
|
case BASEPROPERTY_REPEAT:
|
|
|
|
aProp <<= (sal_Bool)( 0 != ( GetWindow()->GetStyle() & WB_REPEAT ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BASEPROPERTY_REPEAT_DELAY:
|
|
|
|
{
|
|
|
|
sal_Int32 nButtonRepeat = GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
|
|
|
|
aProp <<= (sal_Int32)nButtonRepeat;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BASEPROPERTY_SYMBOL_COLOR:
|
2004-07-05 14:55:21 +00:00
|
|
|
aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BASEPROPERTY_BORDERCOLOR:
|
|
|
|
aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor();
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return aProp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::awt::XLayoutConstrains
|
|
|
|
::com::sun::star::awt::Size VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
// Diese Methode sollte nur fuer Componenten gerufen werden, die zwar
|
|
|
|
// ueber das ::com::sun::star::awt::Toolkit erzeugt werden koennen, aber fuer die es
|
|
|
|
// kein Interface gibt.
|
|
|
|
|
|
|
|
Size aSz;
|
|
|
|
if ( GetWindow() )
|
|
|
|
{
|
|
|
|
WindowType nWinType = GetWindow()->GetType();
|
|
|
|
switch ( nWinType )
|
|
|
|
{
|
|
|
|
case WINDOW_MESSBOX:
|
|
|
|
case WINDOW_INFOBOX:
|
|
|
|
case WINDOW_WARNINGBOX:
|
|
|
|
case WINDOW_ERRORBOX:
|
|
|
|
case WINDOW_QUERYBOX:
|
|
|
|
aSz = Size( 250, 100 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WINDOW_CONTROL:
|
|
|
|
aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
|
|
|
|
aSz.Height() = GetWindow()->GetTextHeight()+2*6;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WINDOW_PATTERNBOX:
|
|
|
|
case WINDOW_NUMERICBOX:
|
|
|
|
case WINDOW_METRICBOX:
|
|
|
|
case WINDOW_CURRENCYBOX:
|
|
|
|
case WINDOW_DATEBOX:
|
|
|
|
case WINDOW_TIMEBOX:
|
|
|
|
case WINDOW_LONGCURRENCYBOX:
|
|
|
|
aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
|
|
|
|
aSz.Height() = GetWindow()->GetTextHeight()+2*2;
|
|
|
|
break;
|
|
|
|
case WINDOW_SCROLLBARBOX:
|
|
|
|
case WINDOW_SCROLLBAR:
|
|
|
|
{
|
|
|
|
long n = GetWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
|
|
|
|
aSz = Size( n, n );
|
|
|
|
}
|
|
|
|
break;
|
2008-01-14 11:57:14 +00:00
|
|
|
default:
|
|
|
|
aSz = GetWindow()->GetOptimalSize( WINDOWSIZE_MINIMUM );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::awt::Size VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return getMinimumSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::awt::Size VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
::com::sun::star::awt::Size aNewSize( rNewSize );
|
|
|
|
::com::sun::star::awt::Size aMinSize = getMinimumSize();
|
|
|
|
|
|
|
|
if ( aNewSize.Width < aMinSize.Width )
|
|
|
|
aNewSize.Width = aMinSize.Width;
|
|
|
|
if ( aNewSize.Height < aMinSize.Height )
|
|
|
|
aNewSize.Height = aMinSize.Height;
|
|
|
|
|
|
|
|
return aNewSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::com::sun::star::awt::XView
|
|
|
|
sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rxDevice ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( VCLUnoHelper::GetOutputDevice( rxDevice ) )
|
|
|
|
mxViewGraphics = rxDevice;
|
|
|
|
else
|
|
|
|
mxViewGraphics = NULL;
|
|
|
|
|
|
|
|
return mxViewGraphics.is();
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
return mxViewGraphics;
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Size aSz;
|
|
|
|
if ( GetWindow() )
|
|
|
|
aSz = GetWindow()->GetSizePixel();
|
|
|
|
return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
|
|
|
|
}
|
|
|
|
|
2007-01-15 12:41:53 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class FlagGuard
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
sal_Bool& m_rFlag;
|
|
|
|
|
|
|
|
public:
|
|
|
|
FlagGuard( sal_Bool& _rFlag )
|
|
|
|
:m_rFlag( _rFlag )
|
|
|
|
{
|
|
|
|
m_rFlag = sal_True;
|
|
|
|
}
|
|
|
|
~FlagGuard()
|
|
|
|
{
|
|
|
|
m_rFlag = sal_False;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
2001-02-16 10:15:57 +00:00
|
|
|
Window* pWindow = GetWindow();
|
2007-05-10 08:39:58 +00:00
|
|
|
if ( !pWindow )
|
|
|
|
return;
|
2001-02-16 10:15:57 +00:00
|
|
|
|
2007-06-20 09:25:32 +00:00
|
|
|
if ( pWindow )
|
|
|
|
{
|
|
|
|
TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow );
|
|
|
|
if ( pTabPage )
|
|
|
|
{
|
|
|
|
Point aPos( nX, nY );
|
|
|
|
Size aSize = pWindow->GetSizePixel();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-06-20 09:25:32 +00:00
|
|
|
OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics );
|
|
|
|
aPos = pDev->PixelToLogic( aPos );
|
|
|
|
aSize = pDev->PixelToLogic( aSize );
|
2005-02-17 09:21:18 +00:00
|
|
|
|
2007-06-20 09:25:32 +00:00
|
|
|
pTabPage->Draw( pDev, aPos, aSize, 0 );
|
|
|
|
return;
|
|
|
|
}
|
2005-02-17 09:21:18 +00:00
|
|
|
|
2007-06-20 09:25:32 +00:00
|
|
|
OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics );
|
|
|
|
Point aPos( nX, nY );
|
2001-03-23 12:31:49 +00:00
|
|
|
|
2007-06-20 09:25:32 +00:00
|
|
|
if ( !pDev )
|
|
|
|
pDev = pWindow->GetParent();
|
|
|
|
|
|
|
|
if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) )
|
|
|
|
{
|
|
|
|
// #i40647# don't draw here if this is a recursive call
|
|
|
|
// sometimes this is called recursively, because the Update call on the parent
|
|
|
|
// (strangely) triggers another paint. Prevent a stack overflow here
|
|
|
|
// Yes, this is only fixing symptoms for the moment ....
|
|
|
|
// #i40647# / 2005-01-18 / frank.schoenheit@sun.com
|
|
|
|
if ( !mbDrawingOntoParent )
|
|
|
|
{
|
|
|
|
FlagGuard aDrawingflagGuard( mbDrawingOntoParent );
|
|
|
|
|
|
|
|
BOOL bWasVisible = pWindow->IsVisible();
|
|
|
|
Point aOldPos( pWindow->GetPosPixel() );
|
|
|
|
|
|
|
|
if ( bWasVisible && aOldPos == aPos )
|
|
|
|
{
|
|
|
|
pWindow->Update();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pWindow->SetPosPixel( aPos );
|
|
|
|
|
|
|
|
// Erstmal ein Update auf den Parent, damit nicht beim Update
|
|
|
|
// auf dieses Fenster noch ein Paint vom Parent abgearbeitet wird,
|
|
|
|
// wo dann ggf. dieses Fenster sofort wieder gehidet wird.
|
|
|
|
if( pWindow->GetParent() )
|
|
|
|
pWindow->GetParent()->Update();
|
|
|
|
|
|
|
|
pWindow->Show();
|
|
|
|
pWindow->Update();
|
|
|
|
pWindow->SetParentUpdateMode( sal_False );
|
|
|
|
pWindow->Hide();
|
|
|
|
pWindow->SetParentUpdateMode( sal_True );
|
|
|
|
|
|
|
|
pWindow->SetPosPixel( aOldPos );
|
|
|
|
if ( bWasVisible )
|
|
|
|
pWindow->Show( TRUE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( pDev )
|
|
|
|
{
|
|
|
|
Size aSz = pWindow->GetSizePixel();
|
|
|
|
aSz = pDev->PixelToLogic( aSz );
|
|
|
|
Point aP = pDev->PixelToLogic( aPos );
|
|
|
|
|
|
|
|
vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
|
|
|
|
bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER )
|
|
|
|
|| ( pDev->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW )
|
|
|
|
|| ( pPDFExport && ! pPDFExport->GetIsExportFormFields() );
|
|
|
|
if ( bDrawSimple )
|
|
|
|
{
|
|
|
|
pWindow->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-08-28 08:50:40 +00:00
|
|
|
BOOL bOldNW =pWindow->IsNativeWidgetEnabled();
|
|
|
|
if( bOldNW )
|
|
|
|
pWindow->EnableNativeWidget(FALSE);
|
2007-06-20 09:25:32 +00:00
|
|
|
pWindow->PaintToDevice( pDev, aP, aSz );
|
2007-08-28 08:50:40 +00:00
|
|
|
if( bOldNW )
|
|
|
|
pWindow->EnableNativeWidget(TRUE);
|
2007-06-20 09:25:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-06-19 22:02:22 +00:00
|
|
|
void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if ( GetWindow() )
|
|
|
|
GetWindow()->SetZoom( Fraction( fZoomX ) );
|
|
|
|
}
|
|
|
|
|
2002-04-25 10:24:33 +00:00
|
|
|
// ::com::sun::star::lang::XEventListener
|
|
|
|
void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
// check if it comes from our AccessibleContext
|
2002-11-07 16:19:24 +00:00
|
|
|
uno::Reference< uno::XInterface > aAC( mxAccessibleContext, uno::UNO_QUERY );
|
2002-04-25 10:24:33 +00:00
|
|
|
uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY );
|
|
|
|
|
|
|
|
if ( aAC.get() == xSource.get() )
|
|
|
|
{ // yep, it does
|
|
|
|
mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-24 14:10:01 +00:00
|
|
|
// ::com::sun::star::accessibility::XAccessible
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXWindow::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException)
|
2001-11-27 09:32:38 +00:00
|
|
|
{
|
2002-04-25 10:24:33 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
2002-11-07 16:19:24 +00:00
|
|
|
if ( !mxAccessibleContext.is() && GetWindow() )
|
2002-01-29 11:54:56 +00:00
|
|
|
{
|
2002-11-07 16:19:24 +00:00
|
|
|
mxAccessibleContext = CreateAccessibleContext();
|
2002-04-25 10:24:33 +00:00
|
|
|
|
|
|
|
// add as event listener to this component
|
|
|
|
// in case somebody disposes it, we do not want to have a (though weak) reference to a dead
|
|
|
|
// object
|
2002-11-07 16:19:24 +00:00
|
|
|
uno::Reference< lang::XComponent > xComp( mxAccessibleContext, uno::UNO_QUERY );
|
2002-04-25 10:24:33 +00:00
|
|
|
if ( xComp.is() )
|
|
|
|
xComp->addEventListener( this );
|
2002-01-29 11:54:56 +00:00
|
|
|
}
|
|
|
|
|
2002-11-07 16:19:24 +00:00
|
|
|
return mxAccessibleContext;
|
2001-11-27 09:32:38 +00:00
|
|
|
}
|
2004-07-06 11:02:21 +00:00
|
|
|
|
|
|
|
// ::com::sun::star::awt::XDockable
|
|
|
|
void SAL_CALL VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if( !mxDockableWindowListener.is() )
|
|
|
|
mxDockableWindowListener = xListener;
|
|
|
|
//else
|
|
|
|
// throw too_many_listeners_exception
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
if( mxDockableWindowListener == xListener )
|
|
|
|
mxDockableWindowListener.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if ( pWindow )
|
|
|
|
pWindow->EnableDocking( bEnable );
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXWindow::isFloating( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if( pWindow )
|
|
|
|
return Window::GetDockingManager()->IsFloating( pWindow );
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if( pWindow )
|
|
|
|
Window::GetDockingManager()->SetFloatingMode( pWindow, bFloating );
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXWindow::isLocked( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if( pWindow )
|
|
|
|
return Window::GetDockingManager()->IsLocked( pWindow );
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
|
|
|
|
Window::GetDockingManager()->Lock( pWindow );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL VCLXWindow::unlock( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
Window* pWindow = GetWindow();
|
|
|
|
if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
|
|
|
|
Window::GetDockingManager()->Unlock( pWindow );
|
|
|
|
}
|
2006-06-19 22:02:22 +00:00
|
|
|
void SAL_CALL VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle& ) throw (::com::sun::star::uno::RuntimeException)
|
2004-07-06 11:02:21 +00:00
|
|
|
{
|
2004-09-09 14:12:47 +00:00
|
|
|
// TODO: remove interface in the next incompatible build
|
2004-07-06 11:02:21 +00:00
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2004-09-09 14:12:47 +00:00
|
|
|
// TODO: remove interface in the next incompatible build
|
2004-07-06 11:02:21 +00:00
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
2004-09-09 14:12:47 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-07-06 11:02:21 +00:00
|
|
|
|
2004-09-09 14:12:47 +00:00
|
|
|
|
|
|
|
// ::com::sun::star::awt::XWindow2
|
|
|
|
|
|
|
|
void SAL_CALL VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
2005-01-31 07:58:15 +00:00
|
|
|
Window *pWindow;
|
|
|
|
if( (pWindow = GetWindow()) != NULL )
|
|
|
|
{
|
|
|
|
DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
|
|
|
|
if( pDockingWindow )
|
|
|
|
pDockingWindow->SetOutputSizePixel( VCLSize( aSize ) );
|
|
|
|
else
|
|
|
|
pWindow->SetOutputSizePixel( VCLSize( aSize ) );
|
|
|
|
}
|
2004-09-09 14:12:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::awt::Size SAL_CALL VCLXWindow::getOutputSize( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
2005-01-31 07:58:15 +00:00
|
|
|
Window *pWindow;
|
|
|
|
if( (pWindow = GetWindow()) != NULL )
|
|
|
|
{
|
|
|
|
DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
|
|
|
|
if( pDockingWindow )
|
|
|
|
return AWTSize( pDockingWindow->GetOutputSizePixel() );
|
|
|
|
else
|
|
|
|
return AWTSize( pWindow->GetOutputSizePixel() );
|
|
|
|
}
|
2004-09-09 14:12:47 +00:00
|
|
|
else
|
|
|
|
return ::com::sun::star::awt::Size();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
if( GetWindow() )
|
|
|
|
return GetWindow()->IsVisible();
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
if( GetWindow() )
|
|
|
|
return GetWindow()->IsActive();
|
2004-07-06 11:02:21 +00:00
|
|
|
else
|
|
|
|
return FALSE;
|
2004-09-09 14:12:47 +00:00
|
|
|
|
2004-07-06 11:02:21 +00:00
|
|
|
}
|
2004-09-09 14:12:47 +00:00
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
if( GetWindow() )
|
|
|
|
return GetWindow()->IsEnabled();
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
if( GetWindow() )
|
|
|
|
return GetWindow()->HasFocus();
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-01-14 11:57:14 +00:00
|
|
|
// ::com::sun::star::beans::XPropertySetInfo
|
|
|
|
|
|
|
|
UnoPropertyArrayHelper *
|
|
|
|
VCLXWindow::GetPropHelper()
|
|
|
|
{
|
|
|
|
::vos::OGuard aGuard( GetMutex() );
|
|
|
|
if (mpPropHelper == NULL)
|
|
|
|
{
|
|
|
|
std::list< sal_uInt16 > aIDs;
|
|
|
|
GetPropertyIds( aIDs );
|
|
|
|
mpPropHelper = new UnoPropertyArrayHelper( aIDs );
|
|
|
|
}
|
|
|
|
return mpPropHelper;
|
|
|
|
}
|
|
|
|
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
|
|
|
|
VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return GetPropHelper()->getProperties();
|
|
|
|
}
|
|
|
|
::com::sun::star::beans::Property SAL_CALL
|
|
|
|
VCLXWindow::getPropertyByName( const ::rtl::OUString& rName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return GetPropHelper()->getPropertyByName( rName );
|
|
|
|
}
|
|
|
|
|
|
|
|
::sal_Bool SAL_CALL
|
|
|
|
VCLXWindow::hasPropertyByName( const ::rtl::OUString& rName ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return GetPropHelper()->hasPropertyByName( rName );
|
|
|
|
}
|