diff options
34 files changed, 1191 insertions, 1021 deletions
diff --git a/comphelper/inc/comphelper/property.hxx b/comphelper/inc/comphelper/property.hxx index d1315db48748..0c31f6b2cb93 100644 --- a/comphelper/inc/comphelper/property.hxx +++ b/comphelper/inc/comphelper/property.hxx @@ -231,7 +231,7 @@ inline sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno: sal_False, if the value could be converted and has not changed @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument) */ -COMPHELPER_DLLPUBLIC sal_Bool tryPropertyValue(staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, const staruno::Any& _rValueToSet, staruno::Any& _rCurrentValue, const staruno::Type& _rExpectedType); +COMPHELPER_DLLPUBLIC sal_Bool tryPropertyValue(staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, const staruno::Any& _rValueToSet, const staruno::Any& _rCurrentValue, const staruno::Type& _rExpectedType); //......................................................................... } diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx index a708a06ea86b..82e38d49c433 100644 --- a/comphelper/source/property/property.cxx +++ b/comphelper/source/property/property.cxx @@ -195,7 +195,7 @@ void ModifyPropertyAttributes(Sequence<Property>& seqProps, const ::rtl::OUStrin } //------------------------------------------------------------------ -sal_Bool tryPropertyValue(Any& _rConvertedValue, Any& _rOldValue, const Any& _rValueToSet, Any& _rCurrentValue, const Type& _rExpectedType) +sal_Bool tryPropertyValue(Any& _rConvertedValue, Any& _rOldValue, const Any& _rValueToSet, const Any& _rCurrentValue, const Type& _rExpectedType) { sal_Bool bModified(sal_False); if (_rCurrentValue.getValue() != _rValueToSet.getValue()) diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index d36a3b71141b..526af00e5b5f 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -291,11 +291,10 @@ void BrowseBox::InsertHandleColumn( ULONG nWidth ) // Headerbar anpassen if ( getDataWindow()->pHeaderBar ) { - getDataWindow()->pHeaderBar->SetPosPixel( - Point(nWidth, 0)); - - getDataWindow()->pHeaderBar->SetSizePixel( - Size( GetOutputSizePixel().Width() - nWidth, GetTitleHeight() ) ); + getDataWindow()->pHeaderBar->SetPosSizePixel( + Point(nWidth, 0), + Size( GetOutputSizePixel().Width() - nWidth, GetTitleHeight() ) + ); } /*if ( getDataWindow()->pHeaderBar ) @@ -837,11 +836,10 @@ void BrowseBox::RemoveColumn( USHORT nItemId ) // Headerbar anpassen if ( getDataWindow()->pHeaderBar ) { - getDataWindow()->pHeaderBar->SetPosPixel( - Point(0, 0)); - - getDataWindow()->pHeaderBar->SetSizePixel( - Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ); + getDataWindow()->pHeaderBar->SetPosSizePixel( + Point(0, 0), + Size( GetOutputSizePixel().Width(), GetTitleHeight() ) + ); } } diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 69eadb01f0a9..daf8d080dac2 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -164,7 +164,21 @@ bool BrowseBox::IsInCommandEvent() const void BrowseBox::StateChanged( StateChangedType nStateChange ) { - if ( STATE_CHANGE_INITSHOW == nStateChange ) + Control::StateChanged( nStateChange ); + + if ( STATE_CHANGE_MIRRORING == nStateChange ) + { + getDataWindow()->EnableRTL( IsRTLEnabled() ); + + HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar; + if ( pHeaderBar ) + pHeaderBar->EnableRTL( IsRTLEnabled() ); + aHScroll.EnableRTL( IsRTLEnabled() ); + if( pVScroll ) + pVScroll->EnableRTL( IsRTLEnabled() ); + Resize(); + } + else if ( STATE_CHANGE_INITSHOW == nStateChange ) { bBootstrapped = TRUE; // muss zuerst gesetzt werden! @@ -661,8 +675,7 @@ void BrowseBox::Resize() // Handle-Column beruecksichtigen BrowserColumn *pFirstCol = pCols->GetObject(0); long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); - pHeaderBar->SetPosPixel( Point( nOfsX, 0 ) ); - pHeaderBar->SetSizePixel( Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) ); + pHeaderBar->SetPosSizePixel( Point( nOfsX, 0 ), Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) ); } AutoSizeLastColumn(); // adjust last column width @@ -1306,7 +1319,9 @@ void BrowseBox::UpdateScrollbars() if ( bNeedsVScroll && !pVScroll->IsVisible() ) pVScroll->Show(); - pDataWin->SetSizePixel( aDataWinSize ); + pDataWin->SetPosSizePixel( + Point( 0, GetTitleHeight() ), + aDataWinSize ); // needs corner-window? // (do that AFTER positioning BOTH scrollbars) diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 3e16e10866f3..086e00674a8e 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -330,6 +330,7 @@ namespace svt } Image aImage; + bool bNeedMirror = IsRTLEnabled(); switch (eStatus) { case CURRENT: @@ -340,6 +341,7 @@ namespace svt break; case MODIFIED: aImage = m_aStatusImages.GetImage(IMG_EBB_MODIFIED); + bNeedMirror = false; // the pen is not mirrored break; case NEW: aImage = m_aStatusImages.GetImage(IMG_EBB_NEW); @@ -362,6 +364,12 @@ namespace svt case CLEAN: break; } + if ( bNeedMirror ) + { + BitmapEx aBitmap( aImage.GetBitmapEx() ); + aBitmap.Mirror( BMP_MIRROR_HORZ ); + aImage = Image( aBitmap ); + } return aImage; } @@ -788,14 +796,15 @@ namespace svt { BrowseBox::StateChanged( nType ); - if ( nType == STATE_CHANGE_ZOOM ) + bool bNeedCellReActivation = false; + if ( nType == STATE_CHANGE_MIRRORING ) + { + bNeedCellReActivation = true; + } + else if ( nType == STATE_CHANGE_ZOOM ) { ImplInitSettings( sal_True, sal_False, sal_False ); - if (IsEditing()) - { - DeactivateCell(); - ActivateCell(); - } + bNeedCellReActivation = true; } else if ( nType == STATE_CHANGE_CONTROLFONT ) { @@ -820,6 +829,14 @@ namespace svt SetStyle(nStyle); } + if ( bNeedCellReActivation ) + { + if ( IsEditing() ) + { + DeactivateCell(); + ActivateCell(); + } + } } //------------------------------------------------------------------------------ diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx index f41ac0601b7f..7b4f1922b99e 100644 --- a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx @@ -52,7 +52,7 @@ protected: virtual ::vos::IMutex& GetMutexImpl() = 0; virtual Window* GetWindowImpl() = 0; - virtual TopWindowListenerMultiplexer& GetTopWindowListenersImpl() = 0; + virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0; public: virtual ~VCLXTopWindow_Base(); @@ -81,7 +81,7 @@ private: protected: virtual vos::IMutex& GetMutexImpl(); virtual Window* GetWindowImpl(); - virtual TopWindowListenerMultiplexer& GetTopWindowListenersImpl(); + virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl(); public: VCLXTopWindow(bool bWHWND = false); diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx index da601f77a865..8aab5a769df1 100644 --- a/toolkit/inc/toolkit/awt/vclxwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx @@ -32,24 +32,23 @@ #define _TOOLKIT_AWT_VCLXWINDOW_HXX_ #include <toolkit/dllapi.h> -#include <com/sun/star/awt/XWindow.hpp> +#include <toolkit/awt/vclxdevice.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/awt/XLayoutConstrains.hpp> #include <com/sun/star/awt/XView.hpp> -#include <com/sun/star/awt/XPointer.hpp> -#include <com/sun/star/awt/XGraphics.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> + #include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase8.hxx> #include <osl/mutex.hxx> -#include <toolkit/awt/vclxdevice.hxx> -#include <toolkit/helper/listenermultiplexer.hxx> - #include <tools/gen.hxx> // Size #include <tools/link.hxx> @@ -74,44 +73,21 @@ namespace toolkit class UnoPropertyArrayHelper; class VCLXWindowImpl; -class TOOLKIT_DLLPUBLIC VCLXWindow : public ::com::sun::star::awt::XWindow2, - public ::com::sun::star::awt::XVclWindowPeer, - public ::com::sun::star::awt::XLayoutConstrains, - public ::com::sun::star::awt::XView, - public ::com::sun::star::awt::XDockableWindow, - public ::com::sun::star::accessibility::XAccessible, - public ::com::sun::star::lang::XEventListener, - public ::com::sun::star::beans::XPropertySetInfo, - public VCLXDevice +typedef ::cppu::ImplInheritanceHelper8 < VCLXDevice + , ::com::sun::star::awt::XWindow2 + , ::com::sun::star::awt::XVclWindowPeer + , ::com::sun::star::awt::XLayoutConstrains + , ::com::sun::star::awt::XView + , ::com::sun::star::awt::XDockableWindow + , ::com::sun::star::accessibility::XAccessible + , ::com::sun::star::lang::XEventListener + , ::com::sun::star::beans::XPropertySetInfo + > VCLXWindow_Base; + +class TOOLKIT_DLLPUBLIC VCLXWindow : public VCLXWindow_Base { private: - EventListenerMultiplexer maEventListeners; - FocusListenerMultiplexer maFocusListeners; - WindowListenerMultiplexer maWindowListeners; - KeyListenerMultiplexer maKeyListeners; - MouseListenerMultiplexer maMouseListeners; - MouseMotionListenerMultiplexer maMouseMotionListeners; - PaintListenerMultiplexer maPaintListeners; - VclContainerListenerMultiplexer maContainerListeners; - TopWindowListenerMultiplexer maTopWindowListeners; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> mxPointer; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> mxViewGraphics; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccessibleContext; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener> mxDockableWindowListener; - - ULONG mnListenerLockLevel; - ULONG nDummy2; VCLXWindowImpl* mpImpl; - UnoPropertyArrayHelper *mpPropHelper; - - - sal_Bool mbDisposing : 1; - sal_Bool mbDesignMode : 1; - sal_Bool mbSynthesizingVCLEvent : 1; - sal_Bool mbWithDefaultProps : 1; - sal_Bool mbDrawingOntoParent; UnoPropertyArrayHelper *GetPropHelper(); @@ -123,8 +99,9 @@ protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); - void SetSynthesizingVCLEvent( sal_Bool b ) { mbSynthesizingVCLEvent = b; } - BOOL IsSynthesizingVCLEvent() const { return mbSynthesizingVCLEvent; } + void SetSynthesizingVCLEvent( sal_Bool b ); + BOOL IsSynthesizingVCLEvent() const; + void SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle ); ::toolkit::IAccessibleFactory& getAccessibleFactory(); @@ -134,8 +111,10 @@ protected: // for use in controls/ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds, bool bWithDefaults = false ); - virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) - { return ImplGetPropertyIds( aIds, mbWithDefaultProps ); } + virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ); + + ::cppu::OInterfaceContainerHelper& GetContainerListeners(); + ::cppu::OInterfaceContainerHelper& GetTopWindowListeners(); public: VCLXWindow( bool bWithDefaultProps = false ); @@ -143,36 +122,17 @@ public: virtual void SetWindow( Window* pWindow ); Window* GetWindow() const { return (Window*)GetOutputDevice(); } - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> GetViewGraphics() const { return mxViewGraphics; } void suspendVclEventListening( ); void resumeVclEventListening( ); - EventListenerMultiplexer& GetEventListeners() { return maEventListeners; } - FocusListenerMultiplexer& GetFocusListeners() { return maFocusListeners; } - WindowListenerMultiplexer& GetWindowListeners() { return maWindowListeners; } - KeyListenerMultiplexer& GetKeyListeners() { return maKeyListeners; } - MouseListenerMultiplexer& GetMouseListeners() { return maMouseListeners; } - MouseMotionListenerMultiplexer& GetMouseMotionListeners() { return maMouseMotionListeners; } - PaintListenerMultiplexer& GetPaintListeners() { return maPaintListeners; } - VclContainerListenerMultiplexer& GetContainerListeners() { return maContainerListeners; } - TopWindowListenerMultiplexer& GetTopWindowListeners() { return maTopWindowListeners; } - - // ::com::sun::star::uno::XInterface - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } + void notifyWindowRemoved( Window& _rWindow ); // ::com::sun::star::lang::XUnoTunnel static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); static VCLXWindow* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index ef2f06ba12af..da2de08c9544 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -189,6 +189,8 @@ namespace rtl { #define BASEPROPERTY_UNIT 135 // ::awt::FieldUnit #define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString #define BASEPROPERTY_IMAGE_SCALE_MODE 137 +#define BASEPROPERTY_WRITING_MODE 138 +#define BASEPROPERTY_CONTEXT_WRITING_MODE 139 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000 diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx index 76a266d1e609..26cff37e8e2b 100644 --- a/toolkit/source/awt/vclxdialog.cxx +++ b/toolkit/source/awt/vclxdialog.cxx @@ -94,9 +94,9 @@ Window* VCLXDialog::GetWindowImpl() return VCLXWindow::GetWindow(); } -TopWindowListenerMultiplexer& VCLXDialog::GetTopWindowListenersImpl() +::cppu::OInterfaceContainerHelper& VCLXDialog::GetTopWindowListenersImpl() { - return VCLXWindow::GetTopWindowListeners(); + return GetTopWindowListeners(); } IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXDialog, VCLXWindow, Bin, VCLXDialog_Base ); diff --git a/toolkit/source/awt/vclxdialog.hxx b/toolkit/source/awt/vclxdialog.hxx index 5c5f85177ce3..b4245a7b6e65 100644 --- a/toolkit/source/awt/vclxdialog.hxx +++ b/toolkit/source/awt/vclxdialog.hxx @@ -59,7 +59,7 @@ private: protected: vos::IMutex& GetMutexImpl(); Window* GetWindowImpl(); - TopWindowListenerMultiplexer& GetTopWindowListenersImpl(); + ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl(); ~VCLXDialog(); diff --git a/toolkit/source/awt/vclxtabcontrol.cxx b/toolkit/source/awt/vclxtabcontrol.cxx index a0f064f6de8b..0097c6a0a73a 100644 --- a/toolkit/source/awt/vclxtabcontrol.cxx +++ b/toolkit/source/awt/vclxtabcontrol.cxx @@ -239,7 +239,7 @@ void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::su ::Point aPos( nX, nY ); ::Size aSize = pTabPage->GetSizePixel(); - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( GetViewGraphics() ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); aPos = pDev->PixelToLogic( aPos ); aSize = pDev->PixelToLogic( aSize ); diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index 2495e046b3aa..907ccb797fd2 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -187,9 +187,9 @@ Window* VCLXTopWindow::GetWindowImpl() return VCLXContainer::GetWindow(); } -TopWindowListenerMultiplexer& VCLXTopWindow::GetTopWindowListenersImpl() +::cppu::OInterfaceContainerHelper& VCLXTopWindow::GetTopWindowListenersImpl() { - return VCLXContainer::GetTopWindowListeners(); + return GetTopWindowListeners(); } // ::com::sun::star::uno::XInterface diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 89ac9799a64f..c767458f03ae 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/awt/EndPopupModeEvent.hpp> #include <com/sun/star/awt/XWindowListener2.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/awt/vclxpointer.hxx> #include <toolkit/awt/vclxwindows.hxx> @@ -73,55 +74,66 @@ 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; +using ::com::sun::star::awt::XDockableWindowListener; 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; +namespace WritingMode2 = ::com::sun::star::text::WritingMode2; -//#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 -// .... //==================================================================== -//= VCLXWindowImpl +//= misc helpers //==================================================================== namespace { + //................................................................ + //. FlagGuard + //................................................................ + class FlagGuard + { + private: + bool& m_rFlag; + + public: + FlagGuard( bool& _rFlag ) + :m_rFlag( _rFlag ) + { + m_rFlag = true; + } + ~FlagGuard() + { + m_rFlag = false; + } + }; + + //................................................................ + //. MouseEventType + //................................................................ enum MouseEventType { + META_FIRST_MOUSE_EVENT = 0, + 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 }; + //................................................................ + //. PlainEventType + //................................................................ enum PlainEventType { + META_FIRST_PLAIN_EVENT = 4, + EVENT_WINDOW_ENABLED = 4, EVENT_WINDOW_DISABLED = 5, - META_FIRST_PLAIN_EVENT = 4, META_LAST_PLAIN_EVENT = 5 }; @@ -135,6 +147,9 @@ namespace #define DBG_CHECK_EVENTS() #endif + //................................................................ + //. AnyWindowEvent + //................................................................ struct AnyWindowEvent : public ::comphelper::AnyEvent { private: @@ -196,6 +211,9 @@ namespace }; } +//==================================================================== +//= VCLXWindowImpl +//==================================================================== class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor { private: @@ -203,23 +221,49 @@ private: EventArray; private: - oslInterlockedCount m_refCount; VCLXWindow& mrAntiImpl; ::vos::IMutex& mrMutex; ::toolkit::AccessibilityClient maAccFactory; bool mbDisposed; + bool mbDrawingOntoParent; // no bit mask, is passed around by reference + ::osl::Mutex maListenerContainerMutex; ::cppu::OInterfaceContainerHelper maWindow2Listeners; + ::cppu::OInterfaceContainerHelper maDockableWindowListeners; + EventListenerMultiplexer maEventListeners; + FocusListenerMultiplexer maFocusListeners; + WindowListenerMultiplexer maWindowListeners; + KeyListenerMultiplexer maKeyListeners; + MouseListenerMultiplexer maMouseListeners; + MouseMotionListenerMultiplexer maMouseMotionListeners; + PaintListenerMultiplexer maPaintListeners; + VclContainerListenerMultiplexer maContainerListeners; + TopWindowListenerMultiplexer maTopWindowListeners; -#ifdef THREADED_NOTIFICATION - ::rtl::Reference< ::comphelper::AsyncEventNotifier > - mpAsyncNotifier; -#else -#if !defined( SYNCHRON_NOTIFICATION ) EventArray maEvents; ULONG mnEventId; -#endif -#endif + +public: + bool mbDisposing : 1; + bool mbDesignMode : 1; + bool mbSynthesizingVCLEvent : 1; + bool mbWithDefaultProps : 1; + + ULONG mnListenerLockLevel; + sal_Int16 mnWritingMode; + sal_Int16 mnContextWritingMode; + + UnoPropertyArrayHelper* mpPropHelper; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer > + mxPointer; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + mxAccessibleContext; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > + mxViewGraphics; + +public: + bool& getDrawingOntoParent_ref() { return mbDrawingOntoParent; } public: /** ctor @@ -227,7 +271,7 @@ public: 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 ); + VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, bool _bWithDefaultProps ); /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners */ @@ -248,33 +292,37 @@ public: /** returns the container of registered XWindowListener2 listeners */ - inline ::cppu::OInterfaceContainerHelper& - getWindow2Listeners() { return maWindow2Listeners; } + inline ::cppu::OInterfaceContainerHelper& getWindow2Listeners() { return maWindow2Listeners; } + inline ::cppu::OInterfaceContainerHelper& getDockableWindowListeners(){ return maDockableWindowListeners; } + inline EventListenerMultiplexer& getEventListeners() { return maEventListeners; } + inline FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; } + inline WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; } + inline KeyListenerMultiplexer& getKeyListeners() { return maKeyListeners; } + inline MouseListenerMultiplexer& getMouseListeners() { return maMouseListeners; } + inline MouseMotionListenerMultiplexer& getMouseMotionListeners() { return maMouseMotionListeners; } + inline PaintListenerMultiplexer& getPaintListeners() { return maPaintListeners; } + inline VclContainerListenerMultiplexer& getContainerListeners() { return maContainerListeners; } + inline TopWindowListenerMultiplexer& getTopWindowListeners() { return maTopWindowListeners; } - virtual void SAL_CALL acquire(); - virtual void SAL_CALL release(); + virtual ~VCLXWindowImpl(); protected: - virtual ~VCLXWindowImpl(); + virtual void SAL_CALL acquire(); + virtual void SAL_CALL release(); // IEventProcessor virtual void processEvent( const ::comphelper::AnyEvent& _rEvent ); -#if !defined( SYNCHRON_NOTIFICATION ) && !defined( THREADED_NOTIFICATION ) private: DECL_LINK( OnProcessEvent, void* ); -#endif 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 + const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent ); private: @@ -294,81 +342,78 @@ private: }; //-------------------------------------------------------------------- -VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex ) - :m_refCount( 0 ) - ,mrAntiImpl( _rAntiImpl ) +VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, bool _bWithDefaultProps ) + :mrAntiImpl( _rAntiImpl ) ,mrMutex( _rMutex ) ,mbDisposed( false ) + ,mbDrawingOntoParent( false ) ,maListenerContainerMutex( ) ,maWindow2Listeners( maListenerContainerMutex ) -#ifdef THREADED_NOTIFICATION - ,mpAsyncNotifier( NULL ) -#else -#ifndef SYNCHRON_NOTIFICATION + ,maDockableWindowListeners( maListenerContainerMutex ) + ,maEventListeners( _rAntiImpl ) + ,maFocusListeners( _rAntiImpl ) + ,maWindowListeners( _rAntiImpl ) + ,maKeyListeners( _rAntiImpl ) + ,maMouseListeners( _rAntiImpl ) + ,maMouseMotionListeners( _rAntiImpl ) + ,maPaintListeners( _rAntiImpl ) + ,maContainerListeners( _rAntiImpl ) + ,maTopWindowListeners( _rAntiImpl ) ,mnEventId( 0 ) -#endif -#endif + ,mbDisposing( false ) + ,mbDesignMode( false ) + ,mbSynthesizingVCLEvent( false ) + ,mbWithDefaultProps( _bWithDefaultProps ) + ,mnListenerLockLevel( 0 ) + ,mnWritingMode( WritingMode2::CONTEXT ) + ,mnContextWritingMode( WritingMode2::CONTEXT ) + ,mpPropHelper( NULL ) { } VCLXWindowImpl::~VCLXWindowImpl() { + delete mpPropHelper; } //-------------------------------------------------------------------- void VCLXWindowImpl::disposing() { ::vos::OGuard aGuard( mrMutex ); -#ifdef THREADED_NOTIFICATION - if ( mpAsyncNotifier.is() ) - { - mpAsyncNotifier->removeEventsForProcessor( this ); - mpAsyncNotifier->dispose(); - mpAsyncNotifier = NULL; - } -#else -#ifndef SYNCHRON_NOTIFICATION if ( mnEventId ) Application::RemoveUserEvent( mnEventId ); mnEventId = 0; -#endif -#endif mbDisposed= true; + + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source = mrAntiImpl; + + maEventListeners.disposeAndClear( aEvent ); + maFocusListeners.disposeAndClear( aEvent ); + maWindowListeners.disposeAndClear( aEvent ); + maKeyListeners.disposeAndClear( aEvent ); + maMouseListeners.disposeAndClear( aEvent ); + maMouseMotionListeners.disposeAndClear( aEvent ); + maPaintListeners.disposeAndClear( aEvent ); + maContainerListeners.disposeAndClear( aEvent ); + maTopWindowListeners.disposeAndClear( aEvent ); + } //-------------------------------------------------------------------- -void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent, ::vos::OClearableGuard& _rGuard ) +void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent ) { -#ifdef THREADED_NOTIFICATION - (void)_rGuard; - if ( !mpAsyncNotifier.is() ) - { - mpAsyncNotifier = new ::comphelper::AsyncEventNotifier; - mpAsyncNotifier->create(); - } - 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 ); + if ( maMouseListeners.getLength() ) + impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ) ); } //-------------------------------------------------------------------- @@ -376,10 +421,9 @@ void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, Pl { ::vos::OClearableGuard aGuard( mrMutex ); if ( maWindow2Listeners.getLength() ) - impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ), aGuard ); + impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ) ); } -#if !defined( SYNCHRON_NOTIFICATION ) && !defined( THREADED_NOTIFICATION ) //-------------------------------------------------------------------- IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG ) { @@ -410,7 +454,6 @@ IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG ) return 0L; } -#endif //-------------------------------------------------------------------- void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) @@ -427,16 +470,16 @@ void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) switch ( rEventDescriptor.getMouseEventType() ) { case EVENT_MOUSE_PRESSED: - mrAntiImpl.GetMouseListeners().mousePressed( rEvent ); + maMouseListeners.mousePressed( rEvent ); break; case EVENT_MOUSE_RELEASED: - mrAntiImpl.GetMouseListeners().mouseReleased( rEvent ); + maMouseListeners.mouseReleased( rEvent ); break; case EVENT_MOUSE_ENTERED: - mrAntiImpl.GetMouseListeners().mouseEntered( rEvent ); + maMouseListeners.mouseEntered( rEvent ); break; case EVENT_MOUSE_EXITED: - mrAntiImpl.GetMouseListeners().mouseExited( rEvent ); + maMouseListeners.mouseExited( rEvent ); break; default: DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" ); @@ -468,14 +511,13 @@ void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) //-------------------------------------------------------------------- void SAL_CALL VCLXWindowImpl::acquire() { - osl_incrementInterlockedCount( &m_refCount ); + mrAntiImpl.acquire(); } //-------------------------------------------------------------------- void SAL_CALL VCLXWindowImpl::release() { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - delete this; + mrAntiImpl.release(); } //==================================================================== @@ -543,40 +585,19 @@ void ImplInitMouseEvent( awt::MouseEvent& rEvent, const MouseEvent& rEvt ) DBG_NAME(VCLXWindow); -VCLXWindow::VCLXWindow( bool bWithDefaultProps ) - : maEventListeners( *this ), - maFocusListeners( *this ), - maWindowListeners( *this ), - maKeyListeners( *this ), - maMouseListeners( *this ), - maMouseMotionListeners( *this ), - maPaintListeners( *this ), - maContainerListeners( *this ), - maTopWindowListeners( *this ), - mnListenerLockLevel( 0 ), - mpImpl( NULL ), - mpPropHelper( NULL ), - mbDisposing( false ), - mbDesignMode( false ), - mbSynthesizingVCLEvent( false ), - mbWithDefaultProps( !!bWithDefaultProps ), - mbDrawingOntoParent( false ) +VCLXWindow::VCLXWindow( bool _bWithDefaultProps ) + :mpImpl( NULL ) { DBG_CTOR( VCLXWindow, 0 ); - mpImpl = new VCLXWindowImpl( *this, GetMutex() ); - mpImpl->acquire(); - - mbDisposing = sal_False; - mbDesignMode = sal_False; - mbSynthesizingVCLEvent = sal_False; + mpImpl = new VCLXWindowImpl( *this, GetMutex(), _bWithDefaultProps ); } VCLXWindow::~VCLXWindow() { DBG_DTOR( VCLXWindow, 0 ); - delete mpPropHelper; + delete mpImpl; if ( GetWindow() ) { @@ -607,18 +628,29 @@ void VCLXWindow::SetWindow( Window* pWindow ) void VCLXWindow::suspendVclEventListening( ) { - ++mnListenerLockLevel; + ++mpImpl->mnListenerLockLevel; } void VCLXWindow::resumeVclEventListening( ) { - DBG_ASSERT( mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" ); - --mnListenerLockLevel; + DBG_ASSERT( mpImpl->mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" ); + --mpImpl->mnListenerLockLevel; +} + +void VCLXWindow::notifyWindowRemoved( Window& _rWindow ) +{ + if ( mpImpl->getContainerListeners().getLength() ) + { + awt::VclContainerEvent aEvent; + aEvent.Source = *this; + aEvent.Child = static_cast< XWindow* >( _rWindow.GetWindowPeer() ); + mpImpl->getContainerListeners().windowRemoved( aEvent ); + } } IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent ) { - if ( mnListenerLockLevel ) + if ( mpImpl->mnListenerLockLevel ) return 0L; DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); @@ -648,109 +680,109 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) case VCLEVENT_WINDOW_PAINT: { - if ( GetPaintListeners().getLength() ) + if ( mpImpl->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 ); + mpImpl->getPaintListeners().windowPaint( aEvent ); } } break; case VCLEVENT_WINDOW_MOVE: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowMoved( aEvent ); + mpImpl->getWindowListeners().windowMoved( aEvent ); } } break; case VCLEVENT_WINDOW_RESIZE: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowResized( aEvent ); + mpImpl->getWindowListeners().windowResized( aEvent ); } } break; case VCLEVENT_WINDOW_SHOW: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowShown( aEvent ); + mpImpl->getWindowListeners().windowShown( aEvent ); } // For TopWindows this means opened... - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowOpened( aEvent ); + mpImpl->getTopWindowListeners().windowOpened( aEvent ); } } break; case VCLEVENT_WINDOW_HIDE: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowHidden( aEvent ); + mpImpl->getWindowListeners().windowHidden( aEvent ); } // For TopWindows this means closed... - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowClosed( aEvent ); + mpImpl->getTopWindowListeners().windowClosed( aEvent ); } } break; case VCLEVENT_WINDOW_ACTIVATE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowActivated( aEvent ); + mpImpl->getTopWindowListeners().windowActivated( aEvent ); } } break; case VCLEVENT_WINDOW_DEACTIVATE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowDeactivated( aEvent ); + mpImpl->getTopWindowListeners().windowDeactivated( aEvent ); } } break; case VCLEVENT_WINDOW_CLOSE: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - mxDockableWindowListener->closed( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed, aEvent ); } - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowClosing( aEvent ); + mpImpl->getTopWindowListeners().windowClosing( aEvent ); } } break; @@ -765,13 +797,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) ) ) { - if ( GetFocusListeners().getLength() ) + if ( mpImpl->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 ); + mpImpl->getFocusListeners().focusGained( aEvent ); } } } @@ -787,7 +819,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) ) ) { - if ( GetFocusListeners().getLength() ) + if ( mpImpl->getFocusListeners().getLength() ) { ::com::sun::star::awt::FocusEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -807,57 +839,57 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) pNext->GetComponentInterface( sal_True ); aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer(); } - GetFocusListeners().focusLost( aEvent ); + mpImpl->getFocusListeners().focusLost( aEvent ); } } } break; case VCLEVENT_WINDOW_MINIMIZE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowMinimized( aEvent ); + mpImpl->getTopWindowListeners().windowMinimized( aEvent ); } } break; case VCLEVENT_WINDOW_NORMALIZE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowNormalized( aEvent ); + mpImpl->getTopWindowListeners().windowNormalized( aEvent ); } } break; case VCLEVENT_WINDOW_KEYINPUT: { - if ( GetKeyListeners().getLength() ) + if ( mpImpl->getKeyListeners().getLength() ) { ::com::sun::star::awt::KeyEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() ); - GetKeyListeners().keyPressed( aEvent ); + mpImpl->getKeyListeners().keyPressed( aEvent ); } } break; case VCLEVENT_WINDOW_KEYUP: { - if ( GetKeyListeners().getLength() ) + if ( mpImpl->getKeyListeners().getLength() ) { ::com::sun::star::awt::KeyEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() ); - GetKeyListeners().keyReleased( aEvent ); + mpImpl->getKeyListeners().keyReleased( aEvent ); } } break; case VCLEVENT_WINDOW_COMMAND: { CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData(); - if ( GetMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) ) + if ( mpImpl->getMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) ) { // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden... Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel(); @@ -882,7 +914,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) case VCLEVENT_WINDOW_MOUSEMOVE: { MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData(); - if ( GetMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) ) + if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -894,7 +926,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) ); } - if ( GetMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() ) + if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -902,15 +934,15 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.ClickCount = 0; // #92138# if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE ) - GetMouseMotionListeners().mouseMoved( aEvent ); + mpImpl->getMouseMotionListeners().mouseMoved( aEvent ); else - GetMouseMotionListeners().mouseDragged( aEvent ); + mpImpl->getMouseMotionListeners().mouseDragged( aEvent ); } } break; case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: { - if ( GetMouseListeners().getLength() ) + if ( mpImpl->getMouseListeners().getLength() ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -921,7 +953,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; case VCLEVENT_WINDOW_MOUSEBUTTONUP: { - if ( GetMouseListeners().getLength() ) + if ( mpImpl->getMouseListeners().getLength() ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -932,7 +964,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; case VCLEVENT_WINDOW_STARTDOCKING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { DockingData *pData = (DockingData*)rVclWindowEvent.GetData(); @@ -946,14 +978,14 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.bLiveMode = pData->mbLivemode; aEvent.bInteractive = pData->mbInteractive; - mxDockableWindowListener->startDocking( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking, aEvent ); } } } break; case VCLEVENT_WINDOW_DOCKING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { DockingData *pData = (DockingData*)rVclWindowEvent.GetData(); @@ -966,8 +998,16 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.MousePos.Y = pData->maMousePos.Y(); aEvent.bLiveMode = pData->mbLivemode; aEvent.bInteractive = pData->mbInteractive; + + Reference< XDockableWindowListener > xFirstListener; + ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); + while ( aIter.hasMoreElements() && !xFirstListener.is() ) + { + xFirstListener.set( aIter.next(), UNO_QUERY ); + } + ::com::sun::star::awt::DockingData aDockingData = - mxDockableWindowListener->docking( aEvent ); + xFirstListener->docking( aEvent ); pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle ); pData->mbFloating = aDockingData.bFloating; } @@ -976,7 +1016,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; case VCLEVENT_WINDOW_ENDDOCKING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { EndDockingData *pData = (EndDockingData*)rVclWindowEvent.GetData(); @@ -987,36 +1027,44 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect ); aEvent.bFloating = pData->mbFloating; aEvent.bCancelled = pData->mbCancelled; - mxDockableWindowListener->endDocking( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent ); } } } break; case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { BOOL *p_bFloating = (BOOL*)rVclWindowEvent.GetData(); ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - *p_bFloating = mxDockableWindowListener->prepareToggleFloatingMode( aEvent ); + + Reference< XDockableWindowListener > xFirstListener; + ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); + while ( aIter.hasMoreElements() && !xFirstListener.is() ) + { + xFirstListener.set( aIter.next(), UNO_QUERY ); + } + + *p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent ); } } break; case VCLEVENT_WINDOW_TOGGLEFLOATING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - mxDockableWindowListener->toggleFloatingMode( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode, aEvent ); } - } + } break; case VCLEVENT_WINDOW_ENDPOPUPMODE: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { EndPopupModeData *pData = (EndPopupModeData*)rVclWindowEvent.GetData(); @@ -1027,7 +1075,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.FloatingPosition.X = pData->maFloatingPos.X(); aEvent.FloatingPosition.Y = pData->maFloatingPos.Y(); aEvent.bTearoff = pData->mbTearoff; - mxDockableWindowListener->endPopupMode( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode, aEvent ); } } } @@ -1042,11 +1090,15 @@ uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessible return getAccessibleFactory().createAccessibleContext( this ); } -/* -void VCLXWindow::FillAccessibleStateSet( AccessibleStateSetHelper& rStateSet ) +void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b ) { + mpImpl->mbSynthesizingVCLEvent = _b; +} + +BOOL VCLXWindow::IsSynthesizingVCLEvent() const +{ + return mpImpl->mbSynthesizingVCLEvent; } -*/ Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const { @@ -1064,74 +1116,21 @@ Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const } -// ::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 ), - SAL_STATIC_CAST( ::com::sun::star::awt::XView*, this ), - SAL_STATIC_CAST( ::com::sun::star::accessibility::XAccessible*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ), - SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySetInfo*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XWindow2*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XDockableWindow*, this ) ); - return (aRet.hasValue() ? aRet : VCLXDevice::queryInterface( rType )); -} - // ::com::sun::star::lang::XUnoTunnel IMPL_XUNOTUNNEL2( VCLXWindow, VCLXDevice ) -// ::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 ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>* ) NULL ), - 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 ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow>* ) NULL ), - 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; + mpImpl->mxViewGraphics = NULL; - if ( !mbDisposing ) + if ( !mpImpl->mbDisposing ) { - mbDisposing = sal_True; + mpImpl->mbDisposing = true; - ::com::sun::star::lang::EventObject aObj; - aObj.Source = static_cast< ::cppu::OWeakObject* >( this ); - - 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 ); - - if ( mpImpl ) - { - mpImpl->disposing(); - mpImpl->release(); - mpImpl = NULL; - } + mpImpl->disposing(); if ( GetWindow() ) { @@ -1146,7 +1145,7 @@ void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException) // 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 ); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY ); if ( xComponent.is() ) xComponent->dispose(); } @@ -1154,9 +1153,9 @@ void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException) { DBG_ERROR( "VCLXWindow::dispose: could not dispose the accessible context!" ); } - mxAccessibleContext.clear(); + mpImpl->mxAccessibleContext.clear(); - mbDisposing = sal_False; + mpImpl->mbDisposing = false; } } @@ -1164,14 +1163,14 @@ void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com { ::vos::OGuard aGuard( GetMutex() ); - GetEventListeners().addInterface( rxListener ); + mpImpl->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 ); + mpImpl->getEventListeners().removeInterface( rxListener ); } @@ -1253,7 +1252,7 @@ void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::co { ::vos::OGuard aGuard( GetMutex() ); - GetWindowListeners().addInterface( rxListener ); + mpImpl->getWindowListeners().addInterface( rxListener ); Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY ); if ( xListener2.is() ) @@ -1272,77 +1271,67 @@ void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< : if ( xListener2.is() ) mpImpl->getWindow2Listeners().removeInterface( xListener2 ); - GetWindowListeners().removeInterface( rxListener ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->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 ); + mpImpl->getPaintListeners().removeInterface( rxListener ); } // ::com::sun::star::awt::XWindowPeer @@ -1360,7 +1349,7 @@ void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun: VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer ); if ( pPointer ) { - mxPointer = rxPointer; + mpImpl->mxPointer = rxPointer; if ( GetWindow() ) GetWindow()->SetPointer( pPointer->GetPointer() ); } @@ -1423,14 +1412,13 @@ void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::Runt { ::vos::OGuard aGuard( GetMutex() ); - mbDesignMode = bOn; + mpImpl->mbDesignMode = bOn; } sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - return mbDesignMode; + return mpImpl->mbDesignMode; } void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException) @@ -1561,485 +1549,554 @@ void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDe } } +void VCLXWindow::GetPropertyIds( std::list< sal_uInt16 >& _out_rIds ) +{ + return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps ); +} + +::cppu::OInterfaceContainerHelper& VCLXWindow::GetContainerListeners() +{ + return mpImpl->getContainerListeners(); +} + +::cppu::OInterfaceContainerHelper& VCLXWindow::GetTopWindowListeners() +{ + return mpImpl->getTopWindowListeners(); +} + +namespace +{ + void lcl_updateWritingMode( Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode ) + { + BOOL bEnableRTL = FALSE; + switch ( _nWritingMode ) + { + case WritingMode2::LR_TB: bEnableRTL = FALSE; break; + case WritingMode2::RL_TB: bEnableRTL = TRUE; break; + case WritingMode2::CONTEXT: + { + // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use + // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our + // own window for its RTL mode + switch ( _nContextWritingMode ) + { + case WritingMode2::LR_TB: bEnableRTL = FALSE; break; + case WritingMode2::RL_TB: bEnableRTL = TRUE; break; + case WritingMode2::CONTEXT: + { + const Window* pParent = _rWindow.GetParent(); + OSL_ENSURE( pParent, "lcl_updateWritingMode: cannot determine context's writing mode!" ); + if ( pParent ) + bEnableRTL = pParent->IsRTLEnabled(); + } + break; + } + } + break; + default: + OSL_ENSURE( false, "lcl_updateWritingMode: unsupported WritingMode!" ); + } // switch ( nWritingMode ) + + _rWindow.EnableRTL( bEnableRTL ); + } +} + 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 ) + if ( !pWindow ) + return; + + sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + WindowType eWinType = pWindow->GetType(); + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) { - sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + case BASEPROPERTY_CONTEXT_WRITING_MODE: + { + OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode ); + if ( mpImpl->mnWritingMode == WritingMode2::CONTEXT ) + lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode ); + } + break; - WindowType eWinType = pWindow->GetType(); - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) + case BASEPROPERTY_WRITING_MODE: { - case BASEPROPERTY_WHEELWITHOUTFOCUS: + sal_Bool bProperType = ( Value >>= mpImpl->mnWritingMode ); + OSL_ENSURE( bProperType, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" ); + if ( bProperType ) + lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode ); + } + break; + + case BASEPROPERTY_WHEELWITHOUTFOCUS: + { + sal_Bool bWheelOnHover( sal_True ); + if ( Value >>= bWheelOnHover ) { - sal_Bool bWheelOnHover( sal_True ); - if ( Value >>= bWheelOnHover ) - { - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); + AllSettings aSettings = pWindow->GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - aMouseSettings.SetNoWheelActionWithoutFocus( !bWheelOnHover ); - aSettings.SetMouseSettings( aMouseSettings ); + aMouseSettings.SetNoWheelActionWithoutFocus( !bWheelOnHover ); + aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings, TRUE ); - } + pWindow->SetSettings( aSettings, TRUE ); } - break; + } + break; - case BASEPROPERTY_NATIVE_WIDGET_LOOK: - { - sal_Bool bEnable( sal_True ); - OSL_VERIFY( Value >>= bEnable ); - pWindow->EnableNativeWidget( bEnable ); - } - break; + case BASEPROPERTY_NATIVE_WIDGET_LOOK: + { + sal_Bool bEnable( sal_True ); + OSL_VERIFY( Value >>= bEnable ); + pWindow->EnableNativeWidget( bEnable ); + } + break; - case BASEPROPERTY_PLUGINPARENT: - { - // set parent handle - SetSystemParent_Impl( Value ); - } - break; + case BASEPROPERTY_PLUGINPARENT: + { + // set parent handle + SetSystemParent_Impl( Value ); + } + break; - case BASEPROPERTY_ENABLED: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - setEnable( b ); - } - break; - case BASEPROPERTY_TEXT: - case BASEPROPERTY_LABEL: - case BASEPROPERTY_TITLE: + case BASEPROPERTY_ENABLED: + { + sal_Bool b = sal_Bool(); + if ( Value >>= b ) + setEnable( b ); + } + break; + case BASEPROPERTY_TEXT: + case BASEPROPERTY_LABEL: + case BASEPROPERTY_TITLE: + { + ::rtl::OUString aText; + if ( Value >>= aText ) { - ::rtl::OUString aText; - if ( Value >>= aText ) + switch (eWinType) { - 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: + case WINDOW_OKBUTTON: + case WINDOW_CANCELBUTTON: + case WINDOW_HELPBUTTON: + // Standard Button: overwrite only if not empty. + if (aText.getLength()) pWindow->SetText( aText ); - break; - } + break; + + default: + pWindow->SetText( aText ); + break; } } - break; - case BASEPROPERTY_ACCESSIBLENAME: - { - ::rtl::OUString aText; - if ( Value >>= aText ) - pWindow->SetAccessibleName( aText ); - } - break; - case BASEPROPERTY_HELPURL: + } + break; + case BASEPROPERTY_ACCESSIBLENAME: + { + ::rtl::OUString aText; + if ( Value >>= aText ) + pWindow->SetAccessibleName( aText ); + } + break; + case BASEPROPERTY_HELPURL: + { + ::rtl::OUString aURL; + if ( Value >>= aURL ) { - ::rtl::OUString aURL; - if ( Value >>= aURL ) + String aHelpURL( aURL ); + String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); + if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL ) { - 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() ); - } - else - { - pWindow->SetSmartHelpId( SmartId( aHelpURL ) ); - } + String aID = aHelpURL.Copy( aPattern.Len() ); + pWindow->SetHelpId( aID.ToInt32() ); } - } - break; - case BASEPROPERTY_HELPTEXT: - { - ::rtl::OUString aHelpText; - if ( Value >>= aHelpText ) + else { - pWindow->SetQuickHelpText( aHelpText ); + pWindow->SetSmartHelpId( SmartId( aHelpURL ) ); } } - break; - case BASEPROPERTY_FONTDESCRIPTOR: + } + break; + case BASEPROPERTY_HELPTEXT: + { + ::rtl::OUString aHelpText; + if ( Value >>= aHelpText ) { - if ( bVoid ) - pWindow->SetControlFont( Font() ); - else - { - ::com::sun::star::awt::FontDescriptor aFont; - if ( Value >>= aFont ) - pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) ); - } + pWindow->SetQuickHelpText( aHelpText ); } - break; - case BASEPROPERTY_FONTRELIEF: + } + break; + case BASEPROPERTY_FONTDESCRIPTOR: + { + if ( bVoid ) + pWindow->SetControlFont( Font() ); + else { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - { - Font aFont = pWindow->GetControlFont(); - aFont.SetRelief( (FontRelief)n ); - pWindow->SetControlFont( aFont ); - } + ::com::sun::star::awt::FontDescriptor aFont; + if ( Value >>= aFont ) + pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) ); } - break; - case BASEPROPERTY_FONTEMPHASISMARK: + } + break; + case BASEPROPERTY_FONTRELIEF: + { + sal_Int16 n = sal_Int16(); + if ( Value >>= n ) { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - { - Font aFont = pWindow->GetControlFont(); - aFont.SetEmphasisMark( n ); - pWindow->SetControlFont( aFont ); - } + Font aFont = pWindow->GetControlFont(); + aFont.SetRelief( (FontRelief)n ); + pWindow->SetControlFont( aFont ); } - break; - case BASEPROPERTY_BACKGROUNDCOLOR: - if ( bVoid ) - { - 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; - } - - case WINDOW_FIXEDTEXT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_GROUPBOX: - case WINDOW_FIXEDLINE: - { - // support transparency only for special controls - pWindow->SetBackground(); - pWindow->SetControlBackground(); - pWindow->SetPaintTransparent( TRUE ); - break; - } - - 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; - } - } - } - else + } + break; + case BASEPROPERTY_FONTEMPHASISMARK: + { + sal_Int16 n = sal_Int16(); + if ( Value >>= n ) + { + Font aFont = pWindow->GetControlFont(); + aFont.SetEmphasisMark( n ); + pWindow->SetControlFont( aFont ); + } + } + break; + case BASEPROPERTY_BACKGROUNDCOLOR: + if ( bVoid ) + { + switch ( eWinType ) { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + // 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( nColor ); - pWindow->SetControlBackground( aColor ); + Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor(); pWindow->SetBackground( aColor ); - 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: ; - } - pWindow->Invalidate(); // Falls das Control nicht drauf reagiert - } - } - break; - case BASEPROPERTY_TEXTCOLOR: - if ( bVoid ) - { - pWindow->SetControlForeground(); - } - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) - { - Color aColor( nColor ); - pWindow->SetTextColor( aColor ); - pWindow->SetControlForeground( aColor ); + pWindow->SetControlBackground( aColor ); + break; } - } - break; - case BASEPROPERTY_TEXTLINECOLOR: - if ( bVoid ) - { - pWindow->SetTextLineColor(); - } - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + + case WINDOW_FIXEDTEXT: + case WINDOW_CHECKBOX: + case WINDOW_RADIOBUTTON: + case WINDOW_GROUPBOX: + case WINDOW_FIXEDLINE: { - Color aColor( nColor ); - pWindow->SetTextLineColor( aColor ); + // support transparency only for special controls + pWindow->SetBackground(); + pWindow->SetControlBackground(); + pWindow->SetPaintTransparent( TRUE ); + break; } - } - break; - case BASEPROPERTY_FILLCOLOR: - if ( bVoid ) - pWindow->SetFillColor(); - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + + default: { - Color aColor( nColor ); - pWindow->SetFillColor( aColor ); + // 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; } } - break; - case BASEPROPERTY_LINECOLOR: - if ( bVoid ) - pWindow->SetLineColor(); - else + } + else + { + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + Color aColor( nColor ); + pWindow->SetControlBackground( aColor ); + pWindow->SetBackground( aColor ); + switch ( eWinType ) { - Color aColor( nColor ); - pWindow->SetLineColor( aColor ); + // reset paint transparent mode + case WINDOW_FIXEDTEXT: + case WINDOW_CHECKBOX: + case WINDOW_RADIOBUTTON: + case WINDOW_GROUPBOX: + case WINDOW_FIXEDLINE: + pWindow->SetPaintTransparent( FALSE ); + default: ; } + pWindow->Invalidate(); // Falls das Control nicht drauf reagiert } - break; - case BASEPROPERTY_BORDER: + } + break; + case BASEPROPERTY_TEXTCOLOR: + if ( bVoid ) { - WinBits nStyle = pWindow->GetStyle(); - sal_uInt16 nBorder = 0; - Value >>= nBorder; - if ( !nBorder ) - { - pWindow->SetStyle( nStyle & ~WB_BORDER ); - } - else + pWindow->SetControlForeground(); + } + else + { + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - pWindow->SetStyle( nStyle | WB_BORDER ); - pWindow->SetBorderStyle( nBorder ); + Color aColor( nColor ); + pWindow->SetTextColor( aColor ); + pWindow->SetControlForeground( aColor ); } } - break; - case BASEPROPERTY_TABSTOP: + break; + case BASEPROPERTY_TEXTLINECOLOR: + if ( bVoid ) { - WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP; - if ( !bVoid ) + pWindow->SetTextLineColor(); + } + else + { + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - sal_Bool bTab = false; - Value >>= bTab; - if ( bTab ) - nStyle |= WB_TABSTOP; - else - nStyle |= WB_NOTABSTOP; + Color aColor( nColor ); + pWindow->SetTextLineColor( aColor ); } - pWindow->SetStyle( nStyle ); } - break; - case BASEPROPERTY_VERTICALALIGN: + break; + case BASEPROPERTY_FILLCOLOR: + if ( bVoid ) + pWindow->SetFillColor(); + else { - VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE; - WinBits nStyle = pWindow->GetStyle(); - nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM); - if ( !bVoid ) - Value >>= eAlign; - switch ( eAlign ) + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - case VerticalAlignment_TOP: - nStyle |= WB_TOP; - break; - case VerticalAlignment_MIDDLE: - nStyle |= WB_VCENTER; - break; - case VerticalAlignment_BOTTOM: - nStyle |= WB_BOTTOM; - break; - default: ; // for warning free code, MAKE_FIXED_SIZE + Color aColor( nColor ); + pWindow->SetFillColor( aColor ); } - pWindow->SetStyle( nStyle ); } - break; - case BASEPROPERTY_ALIGN: + break; + case BASEPROPERTY_LINECOLOR: + if ( bVoid ) + pWindow->SetLineColor(); + else { - sal_Int16 nAlign = PROPERTY_ALIGN_LEFT; - switch ( eWinType ) + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - 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! - case WINDOW_FIXEDTEXT: - case WINDOW_EDIT: - case WINDOW_MULTILINEEDIT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_LISTBOX: - { - 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; + Color aColor( nColor ); + pWindow->SetLineColor( aColor ); } } - break; - case BASEPROPERTY_MULTILINE: + break; + case BASEPROPERTY_BORDER: + { + WinBits nStyle = pWindow->GetStyle(); + sal_uInt16 nBorder = 0; + Value >>= nBorder; + if ( !nBorder ) { - 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 ) - ) + 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 ) + { + sal_Bool bTab = false; + Value >>= bTab; + if ( bTab ) + nStyle |= WB_TABSTOP; + else + nStyle |= WB_NOTABSTOP; + } + pWindow->SetStyle( nStyle ); + } + break; + 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; + default: ; // for warning free code, MAKE_FIXED_SIZE + } + pWindow->SetStyle( nStyle ); + } + break; + case BASEPROPERTY_ALIGN: + { + sal_Int16 nAlign = PROPERTY_ALIGN_LEFT; + switch ( eWinType ) + { + 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! + case WINDOW_FIXEDTEXT: + case WINDOW_EDIT: + case WINDOW_MULTILINEEDIT: + case WINDOW_CHECKBOX: + case WINDOW_RADIOBUTTON: + case WINDOW_LISTBOX: { WinBits nStyle = pWindow->GetStyle(); - sal_Bool bMulti = false; - Value >>= bMulti; - if ( bMulti ) - nStyle |= WB_WORDBREAK; + 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_WORDBREAK; + nStyle |= WB_RIGHT; pWindow->SetStyle( nStyle ); } + break; } - break; - case BASEPROPERTY_ORIENTATION: + } + break; + case BASEPROPERTY_MULTILINE: + { + 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 ) + ) { - switch ( eWinType ) - { - case WINDOW_FIXEDLINE: - { - sal_Int32 nOrientation = 0; - 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; - } + WinBits nStyle = pWindow->GetStyle(); + sal_Bool bMulti = false; + Value >>= bMulti; + if ( bMulti ) + nStyle |= WB_WORDBREAK; + else + nStyle &= ~WB_WORDBREAK; + pWindow->SetStyle( nStyle ); } - break; - case BASEPROPERTY_AUTOMNEMONICS: + } + break; + case BASEPROPERTY_ORIENTATION: + { + switch ( eWinType ) { - sal_Bool bAutoMnemonics = false; - Value >>= bAutoMnemonics; - AllSettings aSettings = pWindow->GetSettings(); - StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics ) + case WINDOW_FIXEDLINE: { - aStyleSettings.SetAutoMnemonic( bAutoMnemonics ); - aSettings.SetStyleSettings( aStyleSettings ); - pWindow->SetSettings( aSettings ); + sal_Int32 nOrientation = 0; + 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; - case BASEPROPERTY_MOUSETRANSPARENT: + } + break; + case BASEPROPERTY_AUTOMNEMONICS: + { + sal_Bool bAutoMnemonics = false; + Value >>= bAutoMnemonics; + AllSettings aSettings = pWindow->GetSettings(); + StyleSettings aStyleSettings = aSettings.GetStyleSettings(); + if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics ) { - sal_Bool bMouseTransparent = false; - Value >>= bMouseTransparent; - pWindow->SetMouseTransparent( bMouseTransparent ); + aStyleSettings.SetAutoMnemonic( bAutoMnemonics ); + aSettings.SetStyleSettings( aStyleSettings ); + pWindow->SetSettings( aSettings ); } - break; - case BASEPROPERTY_PAINTTRANSPARENT: - { - sal_Bool bPaintTransparent = false; - Value >>= bPaintTransparent; - pWindow->SetPaintTransparent( bPaintTransparent ); + } + break; + case BASEPROPERTY_MOUSETRANSPARENT: + { + sal_Bool bMouseTransparent = false; + Value >>= bMouseTransparent; + pWindow->SetMouseTransparent( bMouseTransparent ); + } + break; + case BASEPROPERTY_PAINTTRANSPARENT: + { + sal_Bool bPaintTransparent = false; + Value >>= bPaintTransparent; + pWindow->SetPaintTransparent( bPaintTransparent ); // pWindow->SetBackground(); - } - break; + } + break; - case BASEPROPERTY_REPEAT: - { - sal_Bool bRepeat( FALSE ); - Value >>= bRepeat; + 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; + WinBits nStyle = pWindow->GetStyle(); + if ( bRepeat ) + nStyle |= WB_REPEAT; + else + nStyle &= ~WB_REPEAT; + pWindow->SetStyle( nStyle ); + } + break; - case BASEPROPERTY_REPEAT_DELAY: + case BASEPROPERTY_REPEAT_DELAY: + { + sal_Int32 nRepeatDelay = 0; + if ( Value >>= nRepeatDelay ) { - sal_Int32 nRepeatDelay = 0; - if ( Value >>= nRepeatDelay ) - { - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); + AllSettings aSettings = pWindow->GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - aMouseSettings.SetButtonRepeat( nRepeatDelay ); - aSettings.SetMouseSettings( aMouseSettings ); + aMouseSettings.SetButtonRepeat( nRepeatDelay ); + aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings, TRUE ); - } + pWindow->SetSettings( aSettings, TRUE ); } - break; + } + break; - case BASEPROPERTY_SYMBOL_COLOR: - ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor ); - break; + case BASEPROPERTY_SYMBOL_COLOR: + ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor ); + break; - case BASEPROPERTY_BORDERCOLOR: - ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor); - break; - case BASEPROPERTY_DEFAULTCONTROL: - { - rtl::OUString aName; - Value >>= aName; - break; - } + case BASEPROPERTY_BORDERCOLOR: + ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor); + break; + case BASEPROPERTY_DEFAULTCONTROL: + { + rtl::OUString aName; + Value >>= aName; + break; } } } @@ -2055,6 +2112,14 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_CONTEXT_WRITING_MODE: + aProp <<= mpImpl->mnContextWritingMode; + break; + + case BASEPROPERTY_WRITING_MODE: + aProp <<= mpImpl->mnWritingMode; + break; + case BASEPROPERTY_WHEELWITHOUTFOCUS: { sal_Bool bWheelOnHover = !GetWindow()->GetSettings().GetMouseSettings().GetNoWheelActionWithoutFocus(); @@ -2312,18 +2377,18 @@ sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com: ::vos::OGuard aGuard( GetMutex() ); if ( VCLUnoHelper::GetOutputDevice( rxDevice ) ) - mxViewGraphics = rxDevice; + mpImpl->mxViewGraphics = rxDevice; else - mxViewGraphics = NULL; + mpImpl->mxViewGraphics = NULL; - return mxViewGraphics.is(); + return mpImpl->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; + return mpImpl->mxViewGraphics; } ::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException) @@ -2336,26 +2401,6 @@ sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com: return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() ); } -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; - } - }; -} - void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -2372,7 +2417,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: Point aPos( nX, nY ); Size aSize = pWindow->GetSizePixel(); - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics ); aPos = pDev->PixelToLogic( aPos ); aSize = pDev->PixelToLogic( aSize ); @@ -2380,7 +2425,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: return; } - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics ); Point aPos( nX, nY ); if ( !pDev ) @@ -2393,9 +2438,9 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: // (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 ) + if ( !mpImpl->getDrawingOntoParent_ref() ) { - FlagGuard aDrawingflagGuard( mbDrawingOntoParent ); + FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() ); BOOL bWasVisible = pWindow->IsVisible(); Point aOldPos( pWindow->GetPosPixel() ); @@ -2466,12 +2511,12 @@ void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& ::vos::OGuard aGuard( GetMutex() ); // check if it comes from our AccessibleContext - uno::Reference< uno::XInterface > aAC( mxAccessibleContext, uno::UNO_QUERY ); + uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY ); if ( aAC.get() == xSource.get() ) { // yep, it does - mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >(); + mpImpl->mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >(); } } @@ -2486,19 +2531,19 @@ void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& if( ! mpImpl ) return uno::Reference< accessibility::XAccessibleContext >(); - if ( !mxAccessibleContext.is() && GetWindow() ) + if ( !mpImpl->mxAccessibleContext.is() && GetWindow() ) { - mxAccessibleContext = CreateAccessibleContext(); + mpImpl->mxAccessibleContext = CreateAccessibleContext(); // 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 - uno::Reference< lang::XComponent > xComp( mxAccessibleContext, uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); if ( xComp.is() ) xComp->addEventListener( this ); } - return mxAccessibleContext; + return mpImpl->mxAccessibleContext; } // ::com::sun::star::awt::XDockable @@ -2506,10 +2551,8 @@ void SAL_CALL VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno { ::vos::OGuard aGuard( GetMutex() ); - if( !mxDockableWindowListener.is() ) - mxDockableWindowListener = xListener; - //else - // throw too_many_listeners_exception + if ( xListener.is() ) + mpImpl->getDockableWindowListeners().addInterface( xListener ); } @@ -2517,8 +2560,7 @@ void SAL_CALL VCLXWindow::removeDockableWindowListener( const ::com::sun::star:: { ::vos::OGuard aGuard( GetMutex() ); - if( mxDockableWindowListener == xListener ) - mxDockableWindowListener.clear(); + mpImpl->getDockableWindowListeners().removeInterface( xListener ); } void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException) @@ -2668,13 +2710,13 @@ UnoPropertyArrayHelper * VCLXWindow::GetPropHelper() { ::vos::OGuard aGuard( GetMutex() ); - if (mpPropHelper == NULL) + if ( mpImpl->mpPropHelper == NULL ) { std::list< sal_uInt16 > aIDs; GetPropertyIds( aIDs ); - mpPropHelper = new UnoPropertyArrayHelper( aIDs ); + mpImpl->mpPropHelper = new UnoPropertyArrayHelper( aIDs ); } - return mpPropHelper; + return mpImpl->mpPropHelper; } ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 23b59f37f56f..dadb1300675a 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -405,6 +405,8 @@ void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_MULTILINE, BASEPROPERTY_ALIGN, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -667,6 +669,8 @@ void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_SCALEIMAGE, BASEPROPERTY_IMAGE_SCALE_MODE, BASEPROPERTY_TABSTOP, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -801,6 +805,8 @@ void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_ALIGN, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1097,6 +1103,8 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_ALIGN, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1508,6 +1516,8 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TABSTOP, BASEPROPERTY_READONLY, BASEPROPERTY_ALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -2241,7 +2251,7 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s if ( pWindow ) { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( GetViewGraphics() ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) pDev = pWindow->GetParent(); @@ -2342,7 +2352,7 @@ throw(::com::sun::star::uno::RuntimeException) if ( pWindow ) { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( GetViewGraphics() ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) pDev = pWindow->GetParent(); @@ -2692,6 +2702,8 @@ void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TABSTOP, BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_URL, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -2717,6 +2729,8 @@ void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_PRINTABLE, BASEPROPERTY_TABSTOP, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -2861,6 +2875,8 @@ void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_SYMBOL_COLOR, BASEPROPERTY_TABSTOP, BASEPROPERTY_VISIBLESIZE, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -3342,6 +3358,8 @@ void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_PAINTTRANSPARENT, BASEPROPERTY_AUTOHSCROLL, BASEPROPERTY_AUTOVSCROLL, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -3711,6 +3729,8 @@ void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_ALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box // #i92690# / 2008-08-12 / frank.schoenheit@sun.com @@ -4195,6 +4215,7 @@ void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, c void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -4219,6 +4240,8 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -4533,6 +4556,7 @@ sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeExc void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -4555,6 +4579,8 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -4830,6 +4856,7 @@ void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::co void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -4853,6 +4880,8 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VALUE_DOUBLE, BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5167,6 +5196,7 @@ void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const : void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -5188,6 +5218,8 @@ void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_UNIT, BASEPROPERTY_CUSTOMUNITTEXT, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5412,6 +5444,7 @@ void VCLXMetricField::setProperty( const ::rtl::OUString& PropertyName, const :: void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -5437,6 +5470,8 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VALUE_DOUBLE, BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5762,6 +5797,7 @@ void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -5779,6 +5815,8 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TABSTOP, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx index 0b99064413d7..c80c3b14e63e 100644 --- a/toolkit/source/controls/formattedcontrol.cxx +++ b/toolkit/source/controls/formattedcontrol.cxx @@ -159,6 +159,8 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); Any aTreatAsNumber; aTreatAsNumber <<= (sal_Bool) sal_True; diff --git a/toolkit/source/controls/tkspinbutton.cxx b/toolkit/source/controls/tkspinbutton.cxx index c0493a28ab95..5c4e47e240dc 100644 --- a/toolkit/source/controls/tkspinbutton.cxx +++ b/toolkit/source/controls/tkspinbutton.cxx @@ -72,6 +72,8 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MAX ); ImplRegisterProperty( BASEPROPERTY_SPININCREMENT ); ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); } //-------------------------------------------------------------------- diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 99acd47121b1..0f54a204a010 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/io/XMarkableStream.hpp> #include <toolkit/controls/unocontrolmodel.hxx> #include <toolkit/helper/macros.hxx> @@ -259,8 +260,10 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) { switch ( nPropId ) { - case BASEPROPERTY_GRAPHIC: aDefault <<= ::com::sun::star::uno::makeAny( - ::com::sun::star::uno::Reference< graphic::XGraphic >() ); break; + case BASEPROPERTY_GRAPHIC: + aDefault <<= makeAny( Reference< graphic::XGraphic >() ); + break; + case BASEPROPERTY_VERTICALALIGN: case BASEPROPERTY_BORDERCOLOR: case BASEPROPERTY_SYMBOL_COLOR: @@ -354,6 +357,11 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) case BASEPROPERTY_TITLE: case BASEPROPERTY_TEXT: aDefault <<= ::rtl::OUString(); break; + case BASEPROPERTY_WRITING_MODE: + case BASEPROPERTY_CONTEXT_WRITING_MODE: + aDefault <<= text::WritingMode2::CONTEXT; + break; + case BASEPROPERTY_STRINGITEMLIST: { ::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq; diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 40536a66d124..53b28cb7f2ac 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -498,6 +498,8 @@ UnoControlFileControlModel::UnoControlFileControlModel() ImplRegisterProperty( BASEPROPERTY_READONLY ); ImplRegisterProperty( BASEPROPERTY_TABSTOP ); ImplRegisterProperty( BASEPROPERTY_TEXT ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); } @@ -1654,21 +1656,7 @@ void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::X // ---------------------------------------------------- UnoControlFixedTextModel::UnoControlFixedTextModel() { - ImplRegisterProperty( BASEPROPERTY_ALIGN ); - ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); - ImplRegisterProperty( BASEPROPERTY_BORDER ); - ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); - ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); - ImplRegisterProperty( BASEPROPERTY_ENABLED ); - ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); - ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); - ImplRegisterProperty( BASEPROPERTY_HELPURL ); - ImplRegisterProperty( BASEPROPERTY_LABEL ); - ImplRegisterProperty( BASEPROPERTY_MULTILINE ); - ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); - ImplRegisterProperty( BASEPROPERTY_TABSTOP ); - ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN ); - ImplRegisterProperty( BASEPROPERTY_NOLABEL ); + UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedText ); } ::rtl::OUString UnoControlFixedTextModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) @@ -1805,6 +1793,8 @@ UnoControlGroupBoxModel::UnoControlGroupBoxModel() ImplRegisterProperty( BASEPROPERTY_HELPURL ); ImplRegisterProperty( BASEPROPERTY_LABEL ); ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); } ::rtl::OUString UnoControlGroupBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 16181629c9d4..bace3ff94771 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -98,6 +98,8 @@ struct ImplPropertyInfo ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 ) #define DECL_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 ) +#define DECL_PROP_4( asciiname, id, type, attrib1, attrib2, attrib3, attrib4 ) \ + ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 | ::com::sun::star::beans::PropertyAttribute::attrib4 ) #define DECL_DEP_PROP_1( asciiname, id, type, attrib1 ) \ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1, sal_True ) @@ -152,7 +154,6 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "EnforceFormat", ENFORCE_FORMAT, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "FillColor", FILLCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "FocusOnClick", FOCUSONCLICK, bool, BOUND, MAYBEDEFAULT ), -// DECL_PROP_2 ( "FocusSelectionHide", FOCUSSELECTIONHIDE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "FontRelief", FONTRELIEF, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "FontEmphasisMark", FONTEMPHASISMARK, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "FontDescriptor", FONTDESCRIPTOR, FontDescriptor, BOUND, MAYBEDEFAULT ), @@ -200,7 +201,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ), //added for issue79712 + DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "PaintTransparent", PAINTTRANSPARENT, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "PluginParent", PLUGINPARENT, sal_Int64, BOUND, MAYBEDEFAULT ), @@ -213,7 +214,6 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "ReadOnly", READONLY, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Repeat", REPEAT, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "RepeatDelay", REPEAT_DELAY, sal_Int32, BOUND, MAYBEDEFAULT ), -// DECL_PROP_3 ( "ResourceResolver", RESOURCERESOLVER, Reference< ::com::sun::star::resource::XStringResourceResolver >, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "ScaleImage", SCALEIMAGE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ScaleMode", IMAGE_SCALE_MODE, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), @@ -270,7 +270,9 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "RowHeight", TREE_ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ) + DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ) }; pPropertyInfos = aImplPropertyInfos; nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 96964018ff6b..fe41ad9a52ef 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -289,13 +289,8 @@ void UnoWrapper::WindowDestroyed( Window* pWindow ) } Window* pParent = pWindow->GetParent(); - if ( pParent && pParent->GetWindowPeer() && pParent->GetWindowPeer()->GetContainerListeners().getLength() ) - { - ::com::sun::star::awt::VclContainerEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)pParent->GetWindowPeer(); - aEvent.Child = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); - pParent->GetWindowPeer()->GetContainerListeners().windowRemoved( aEvent ); - } + if ( pParent && pParent->GetWindowPeer() ) + pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow ); if ( pWindow && pWindow->GetWindowPeer() ) { diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 7c33e21204c6..578eb2b787a9 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -394,7 +394,6 @@ private: mbRefPoint:1, mbEnableRTL:1; -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE sal_Int32 ImplGetDPIX() const { return mnDPIX; } SAL_DLLPRIVATE sal_Int32 ImplGetDPIY() const { return mnDPIY; } @@ -550,7 +549,10 @@ public: SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont ); SAL_DLLPRIVATE static BOOL ImplIsUnderlineAbove( const Font& ); -//#endif + + + // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI + SAL_DLLPRIVATE bool ImplIsAntiparallel() const ; protected: OutputDevice(); diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index d51a794441b0..6f7c18ac2730 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -258,6 +258,7 @@ typedef USHORT StateChangedType; #define STATE_CHANGE_READONLY ((StateChangedType)16) #define STATE_CHANGE_FORMAT ((StateChangedType)17) #define STATE_CHANGE_EXTENDEDSTYLE ((StateChangedType)18) +#define STATE_CHANGE_MIRRORING ((StateChangedType)19) #define STATE_CHANGE_USER ((StateChangedType)10000) // GetFocusFlags @@ -557,7 +558,7 @@ public: SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow ); SAL_DLLPRIVATE void ImplInitSalControlHandle(); - SAL_DLLPRIVATE void ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev, const Region* pOuterClip = NULL ); + SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos ); SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList(); SAL_DLLPRIVATE void ImplIsInTaskPaneList( BOOL mbIsInTaskList ); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 3038f60267ee..42abe3fd248a 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -130,8 +130,6 @@ void ComboBox::ImplInitComboBoxData() mbSyntheticModify = FALSE; mbMatchCase = FALSE; mcMultiSep = ';'; - - EnableRTL( TRUE ); } // ----------------------------------------------------------------------- @@ -671,7 +669,7 @@ void ComboBox::Resize() else { nSBWidth = CalcZoom( nSBWidth ); - mpSubEdit->SetSizePixel( Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) ); + mpSubEdit->SetPosSizePixel( Point( 0, 0 ), Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) ); mpBtn->SetPosSizePixel( aOutSz.Width() - nSBWidth, nTop, nSBWidth, (nBottom-nTop) ); } } @@ -766,6 +764,17 @@ void ComboBox::StateChanged( StateChangedType nType ) SetStyle( ImplInitStyle( GetStyle() ) ); mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpBtn ) + { + mpBtn->EnableRTL( IsRTLEnabled() ); + ImplInitDropDownButton( mpBtn ); + } + mpSubEdit->StateChanged( STATE_CHANGE_MIRRORING ); + mpImplLB->EnableRTL( IsRTLEnabled() ); + Resize(); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 93e707fc562c..173f80ca0f50 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -340,7 +340,7 @@ void Edit::ImplInit( Window* pParent, WinBits nStyle ) mnAlign = EDIT_ALIGN_LEFT; // --- RTL --- hack: right align until keyinput and cursor travelling works - if( Application::GetSettings().GetLayoutRTL() ) + if( IsRTLEnabled() ) mnAlign = EDIT_ALIGN_RIGHT; if ( nStyle & WB_RIGHT ) @@ -1253,7 +1253,10 @@ void Edit::ImplAlign() else if ( mnAlign == EDIT_ALIGN_RIGHT ) { long nMinXOffset = nOutWidth - nTextWidth - 1 - ImplGetExtraOffset(); - if( Application::GetSettings().GetLayoutRTL() ) + bool bRTL = IsRTLEnabled(); + if( mbIsSubEdit && GetParent() ) + bRTL = GetParent()->IsRTLEnabled(); + if( bRTL ) { if( nTextWidth < nOutWidth ) mnXOffset = nMinXOffset; @@ -2258,17 +2261,33 @@ void Edit::StateChanged( StateChangedType nType ) ImplInvalidateOrRepaint( 0, 0xFFFF ); } } - else if ( nType == STATE_CHANGE_STYLE ) + else if ( nType == STATE_CHANGE_STYLE || nType == STATE_CHANGE_MIRRORING ) { - WinBits nStyle = ImplInitStyle( GetStyle() ); - SetStyle( nStyle ); + WinBits nStyle = GetStyle(); + if( nType == STATE_CHANGE_STYLE ) + { + nStyle = ImplInitStyle( GetStyle() ); + SetStyle( nStyle ); + } USHORT nOldAlign = mnAlign; mnAlign = EDIT_ALIGN_LEFT; // --- RTL --- hack: right align until keyinput and cursor travelling works - if( Application::GetSettings().GetLayoutRTL() ) - mnAlign = EDIT_ALIGN_RIGHT; + // edits are always RTL disabled + // however the parent edits contain the correct setting + if( mbIsSubEdit && GetParent()->IsRTLEnabled() ) + { + if( GetParent()->GetStyle() & WB_LEFT ) + mnAlign = EDIT_ALIGN_RIGHT; + if ( nType == STATE_CHANGE_MIRRORING ) + SetLayoutMode( TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + } + else if( mbIsSubEdit && !GetParent()->IsRTLEnabled() ) + { + if ( nType == STATE_CHANGE_MIRRORING ) + SetLayoutMode( TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + } if ( nStyle & WB_RIGHT ) mnAlign = EDIT_ALIGN_RIGHT; diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index df77e088a7a4..62ec901bfe25 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2558,6 +2558,13 @@ void ImplListBox::StateChanged( StateChangedType nType ) { maLBWindow.SetControlBackground( GetControlBackground() ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + maLBWindow.EnableRTL( IsRTLEnabled() ); + mpHScrollBar->EnableRTL( IsRTLEnabled() ); + mpVScrollBar->EnableRTL( IsRTLEnabled() ); + ImplResizeControls(); + } Control::StateChanged( nType ); } @@ -3200,7 +3207,7 @@ void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking ) // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI // where the document is unmirrored // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror - if( GetParent()->GetParent()->ImplHasMirroredGraphics() && !GetParent()->GetParent()->IsRTLEnabled() ) + if( GetParent()->GetParent()->ImplIsAntiparallel() ) GetParent()->GetParent()->ImplReMirror( aRect ); StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 2fcf24478ffe..0accd17489c9 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -876,6 +876,18 @@ void ListBox::StateChanged( StateChangedType nType ) SetStyle( ImplInitStyle( GetStyle() ) ); mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpBtn ) + { + mpBtn->EnableRTL( IsRTLEnabled() ); + ImplInitDropDownButton( mpBtn ); + } + mpImplLB->EnableRTL( IsRTLEnabled() ); + if( mpImplWin ) + mpImplWin->EnableRTL( IsRTLEnabled() ); + Resize(); + } Control::StateChanged( nType ); } diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index c0bbd62b82c1..3f8779dc2e90 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -313,7 +313,6 @@ void SpinField::ImplInitSpinFieldData() mbInitialDown = FALSE; mbNoSelect = FALSE; mbInDropDown = FALSE; - EnableRTL( TRUE ); } // -------------------------------------------------------------------- @@ -765,6 +764,7 @@ void SpinField::Resize() { Control::Resize(); Size aSize = GetOutputSizePixel(); + bool bSubEditPositioned = false; if ( GetStyle() & (WB_SPIN|WB_DROPDOWN) ) { @@ -789,6 +789,7 @@ void SpinField::Resize() // use the themes drop down size Rectangle aContentRect = aContent.GetBoundRect(); mpEdit->SetPosPixel( aContentRect.TopLeft() ); + bSubEditPositioned = true; aSize = aContentRect.GetSize(); } else @@ -803,6 +804,11 @@ void SpinField::Resize() } } + if( ! bSubEditPositioned ) + { + // this moves our sub edit if RTL gets switched + mpEdit->SetPosPixel( Point() ); + } mpEdit->SetSizePixel( aSize ); if ( GetStyle() & WB_SPIN ) @@ -868,6 +874,12 @@ void SpinField::StateChanged( StateChangedType nType ) ImplInitSettings( FALSE, FALSE, TRUE ); Invalidate(); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpEdit ) + mpEdit->StateChanged( STATE_CHANGE_MIRRORING ); + Resize(); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 0d93b538338b..9c94811e0122 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -43,6 +43,7 @@ #include <tools/debug.hxx> #include <vcl/svdata.hxx> #include <vcl/svapp.hxx> +#include <vcl/ctrl.hxx> #ifndef _POLY_HXX #include <tools/poly.hxx> #endif @@ -173,6 +174,22 @@ static void ImplDeleteObjStack( ImplObjStack* pObjStack ) // ----------------------------------------------------------------------- +bool OutputDevice::ImplIsAntiparallel() const +{ + bool bRet = false; + if( ImplGetGraphics() ) + { + if( ( (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && ! IsRTLEnabled() ) || + ( ! (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && IsRTLEnabled() ) ) + { + bRet = true; + } + } + return bRet; +} + +// ----------------------------------------------------------------------- + bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGraphics ) { @@ -564,11 +581,18 @@ void OutputDevice::EnableRTL( BOOL bEnable ) // under rare circumstances in the UI, eg the valueset control // because each virdev has its own SalGraphics we can safely switch the SalGraphics here // ...hopefully - if( Application::GetSettings().GetLayoutRTL() ) // allow mirroring only in BiDi Office - if( ImplGetGraphics() ) - mpGraphics->SetLayout( mbEnableRTL ? SAL_LAYOUT_BIDI_RTL : 0 ); + if( ImplGetGraphics() ) + mpGraphics->SetLayout( mbEnableRTL ? SAL_LAYOUT_BIDI_RTL : 0 ); } + // convenience: for controls also switch layout mode + if( dynamic_cast<Control*>(this) != 0 ) + SetLayoutMode( bEnable ? TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT : TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT); + + Window* pWin = dynamic_cast<Window*>(this); + if( pWin ) + pWin->StateChanged( STATE_CHANGE_MIRRORING ); + if( mpAlphaVDev ) mpAlphaVDev->EnableRTL( bEnable ); } @@ -1019,7 +1043,7 @@ void OutputDevice::ImplInitClipRegion() aRegion = *(pWindow->ImplGetWinChildClipRegion()); // --- RTL -- only this region is in frame coordinates, so re-mirror it // the mpWindowImpl->mpPaintRegion above is already correct (see ImplCallPaint()) ! - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror ( aRegion ); } if ( mbClipRegion ) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 5bb7b0d9afcf..4a682c4cecc9 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -118,9 +118,6 @@ using namespace ::vcl; // ======================================================================= -//#ifdef USE_NEW_RTL_IMPLEMENTATION - - static void ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY, int nOrientation ) { @@ -4105,7 +4102,7 @@ void OutputDevice::ImplDrawTextLine( long nBaseX, BOOL bNormalLines = TRUE; // TODO: fix rotated text - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) // --- RTL --- mirror at basex nX = nBaseX - nWidth - (nX - nBaseX - 1); @@ -4576,7 +4573,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, long nWidth ) { long nBaseX = nX; - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( /*ImplHasMirroredGraphics() &&*/ IsRTLEnabled() ) { // --- RTL --- // add some strange offset @@ -4752,7 +4749,7 @@ void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY, // TODO: pass nWidth as width of this mark long nWidth = 0; - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) // --- RTL --- mirror at basex nX = nBaseX - nWidth - (nX - nBaseX - 1); @@ -4970,16 +4967,20 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, BOOL bTextLines ) if( !IsRTLEnabled() ) { OutputDevice *pOutDevRef = (OutputDevice *)this; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) this)->mpDummy4; -#endif - // mirror this window back long devX = w-pOutDevRef->mnOutWidth-pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX rSalLayout.DrawBase().X() = devX + ( pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) ) ; } } + else if( IsRTLEnabled() ) + { + //long w = meOutDevType == OUTDEV_VIRDEV ? mnOutWidth : mpGraphics->GetGraphicsWidth(); + //long x = rSalLayout.DrawBase().X(); + OutputDevice *pOutDevRef = (OutputDevice *)this; + // mirror this window back + long devX = pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX + rSalLayout.DrawBase().X() = pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) + devX; + } rSalLayout.DrawText( *mpGraphics ); } @@ -6067,7 +6068,7 @@ bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXA } // handle window mirroring - if( ((OutputDevice*)this)->ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) { for( i = 0; i < 2 * nLen; ++i ) pCaretXArray[i] = nWidth - pCaretXArray[i] - 1; @@ -6213,7 +6214,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( String& rStr, // SSA: hack for western office, ie text get right aligned // for debugging purposes of mirrored UI //static const char* pEnv = getenv( "SAL_RTL_MIRRORTEXT" ); - bool bRTLWindow = (((OutputDevice*)this)->ImplHasMirroredGraphics() && IsRTLEnabled()); + bool bRTLWindow = IsRTLEnabled(); bRightAlign ^= bRTLWindow; if( bRightAlign ) nLayoutFlags |= SAL_LAYOUT_RIGHT_ALIGN; diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 0c266079c277..339cc875256f 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -59,8 +59,6 @@ #include <vcl/sallayout.hxx> #include "basegfx/polygon/b2dpolygon.hxx" -//#define USE_NEW_RTL_IMPLEMENTATION - // ---------------------------------------------------------------------------- // The only common SalFrame method // ---------------------------------------------------------------------------- @@ -114,22 +112,28 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev, bool bBack ) con if( w ) { - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) - x = x - devX + pOutDevRef->GetOutOffXPixel(); + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - devX + pOutDevRef->GetOutOffXPixel(); + else + x = devX + (x - pOutDevRef->GetOutOffXPixel()); + } else - x = devX + (x - pOutDevRef->GetOutOffXPixel()); + { + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; + else + x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - 1; + } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) x = w-1-x; } } @@ -144,22 +148,28 @@ void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bo if( w ) { - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) - x = x - devX + pOutDevRef->GetOutOffXPixel(); + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - devX + pOutDevRef->GetOutOffXPixel(); + else + x = devX + (x - pOutDevRef->GetOutOffXPixel()); + } else - x = devX + (x - pOutDevRef->GetOutOffXPixel()); + { + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + nWidth; + else + x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - nWidth; + } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) x = w-nWidth-x; } @@ -177,38 +187,60 @@ BOOL SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * { sal_uInt32 i, j; - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) { - for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) { - //long x = w-1-pPtAry[i].mnX; - //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); - pPtAry2[j].mnX = pOutDevRef->GetOutOffXPixel() + (pPtAry[i].mnX - devX); - pPtAry2[j].mnY = pPtAry[i].mnY; + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pOutDevRef->GetOutOffXPixel() + (pPtAry[i].mnX - devX); + pPtAry2[j].mnY = pPtAry[i].mnY; + } + } + else + { + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); + pPtAry2[j].mnY = pPtAry[i].mnY; + } } } else { - for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + { + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pPtAry[i].mnX - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; + pPtAry2[j].mnY = pPtAry[i].mnY; + } + } + else { - //long x = w-1-pPtAry[i].mnX; - //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); - pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); - pPtAry2[j].mnY = pPtAry[i].mnY; + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pOutDevRef->GetOutputWidthPixel() - (pPtAry[i].mnX - devX) + pOutDevRef->GetOutOffXPixel() - 1; + pPtAry2[j].mnY = pPtAry[i].mnY; + } } } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) { for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) { @@ -331,7 +363,7 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return unionClipRegion( nX, nY, nWidth, nHeight ); } @@ -349,19 +381,19 @@ BOOL SalGraphics::UnionClipRegion( const ::basegfx::B2DPolyPolygon& rPoly, const void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY ); } void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY, nSalColor ); } void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nX1, pOutDev ); mirror( nX2, pOutDev ); @@ -370,7 +402,7 @@ void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const Out } void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); drawRect( nX, nY, nWidth, nHeight ); } @@ -384,7 +416,7 @@ bool SalGraphics::drawPolyLine( void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -397,7 +429,7 @@ void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const Out void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -410,7 +442,7 @@ void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const Outp void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[nPoly]; @@ -527,7 +559,7 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, long nSrcWidth, long nSrcHeight, USHORT nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nDestX, nSrcWidth, pOutDev ); mirror( nSrcX, nSrcWidth, pOutDev ); @@ -537,13 +569,13 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, void SalGraphics::CopyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics, const OutputDevice *pOutDev, const OutputDevice *pSrcOutDev ) { - if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) || - (pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) ) + if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) || + (pSrcGraphics && ( (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) ) ) { SalTwoRect pPosAry2 = *pPosAry; - if( pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) mirror( pPosAry2.mnSrcX, pPosAry2.mnSrcWidth, pSrcOutDev ); - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); copyBits( &pPosAry2, pSrcGraphics ); } @@ -553,7 +585,7 @@ void SalGraphics::CopyBits( const SalTwoRect* pPosAry, void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -566,7 +598,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nTransparentColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -579,7 +611,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -592,7 +624,7 @@ void SalGraphics::DrawMask( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nMaskColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -603,25 +635,25 @@ void SalGraphics::DrawMask( const SalTwoRect* pPosAry, } SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return getBitmap( nX, nY, nWidth, nHeight ); } SalColor SalGraphics::GetPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); return getPixel( nX, nY ); } void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); invert( nX, nY, nWidth, nHeight, nFlags ); } void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -634,7 +666,7 @@ void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nF BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize ); } @@ -642,7 +674,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Point pt( aPos ); Region rgn( rControlRegion ); @@ -690,7 +722,7 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -707,7 +739,7 @@ BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, c ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -724,7 +756,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -753,7 +785,7 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, const SalBitmap& rAlphaBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = rPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -766,7 +798,7 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, bool SalGraphics::DrawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency ); diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx index 168c20fc5188..3b317ab18cae 100644 --- a/vcl/source/window/dndevdis.cxx +++ b/vcl/source/window/dndevdis.cxx @@ -89,7 +89,7 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -145,7 +145,7 @@ void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtd while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -208,7 +208,7 @@ void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde ) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -266,7 +266,7 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -323,7 +323,7 @@ void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const DragGestureEvent& while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( origin ); aSolarGuard.clear(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index a493fd427baa..cb8e5655c0c6 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -709,7 +709,7 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mbDisableAccessibleLabelForRelation = FALSE; // TRUE: do not set LabelFor relation on accessible objects mpWindowImpl->mbDisableAccessibleLabeledByRelation = FALSE; // TRUE: do not set LabeledBy relation on accessible objects - mbEnableRTL = TRUE; // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active + mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active } // ----------------------------------------------------------------------- @@ -774,6 +774,9 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste mpWindowImpl->mpOverlapData->mnTopLevel = 1; } + if( pParent && ! mpWindowImpl->mbFrame ) + mbEnableRTL = pParent->mbEnableRTL; + // test for frame creation if ( mpWindowImpl->mbFrame ) { @@ -1388,7 +1391,7 @@ Window* Window::ImplFindWindow( const Point& rFramePos ) USHORT Window::ImplHitTest( const Point& rFramePos ) { Point aFramePos( rFramePos ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at this window ImplReMirror( aFramePos ); @@ -2401,7 +2404,7 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ) Rectangle aPaintRect = aPaintRegion.GetBoundRect(); // - RTL - re-mirror paint rect and region at this window - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { ImplReMirror( aPaintRect ); ImplReMirror( aPaintRegion ); @@ -2675,7 +2678,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) if ( pRegion ) { // --- RTL --- remirror region before intersecting it - if ( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if ( ImplIsAntiparallel() ) { Region aRgn( *pRegion ); ImplReMirror( aRgn ); @@ -2896,7 +2899,7 @@ void Window::ImplScroll( const Rectangle& rRect, bScrollChilds = FALSE; // --- RTL --- check if this window requires special action - BOOL bReMirror = ( ImplHasMirroredGraphics() && !IsRTLEnabled() ); + BOOL bReMirror = ( ImplIsAntiparallel() ); Rectangle aRectMirror( rRect ); if( bReMirror ) @@ -3268,12 +3271,21 @@ void Window::ImplPosSizeWindow( long nX, long nY, // #106948# always mirror our pos if our parent is not mirroring, even // if we are also not mirroring // --- RTL --- check if parent is in different coordinates - if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplHasMirroredGraphics() && !mpWindowImpl->mpParent->IsRTLEnabled() ) + if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + { + // --- RTL --- (re-mirror at parent window) + nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; + } + } + else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + { + // mirrored window in LTR UI { // --- RTL --- (re-mirror at parent window) nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; } } + // check maPos as well, as it could have been changed for client windows (ImplCallMove()) if ( mpWindowImpl->mnAbsScreenX != aPtDev.X() || nX != mpWindowImpl->mnX || nOrgX != mpWindowImpl->maPos.X() ) { @@ -6132,7 +6144,7 @@ Region Window::GetWindowClipRegionPixel( USHORT nFlags ) const Region* pWinChildClipRegion = ((Window*)this)->ImplGetWinChildClipRegion(); aWinClipRegion = *pWinChildClipRegion; // --- RTL --- remirror clip region before passing it to somebody - if( ((Window*)this)->ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror( aWinClipRegion ); } @@ -6180,7 +6192,7 @@ void Window::ExpandPaintClipRegion( const Region& rRegion ) Region aWinChildRegion = *ImplGetWinChildClipRegion(); // --- RTL -- only this region is in frame coordinates, so re-mirror it - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror( aWinChildRegion ); aDevPixRegion.Intersect( aWinChildRegion ); if( ! aDevPixRegion.IsEmpty() ) @@ -7202,7 +7214,7 @@ void Window::SetPosSizePixel( long nX, long nY, Window* pParent = pWindow->GetParent(); nX += pParent->mnOutOffX; } - if( GetParent() && GetParent()->ImplHasMirroredGraphics() && !GetParent()->IsRTLEnabled() ) + if( GetParent() && GetParent()->ImplIsAntiparallel() ) { // --- RTL --- (re-mirror at parent window) Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) ); @@ -7324,7 +7336,7 @@ long Window::ImplGetUnmirroredOutOffX() long offx = mnOutOffX; if( ImplHasMirroredGraphics() ) { - if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplHasMirroredGraphics() && !mpWindowImpl->mpParent->IsRTLEnabled() ) + if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) { if ( !ImplIsOverlapWindow() ) offx -= mpWindowImpl->mpParent->mnOutOffX; @@ -7857,6 +7869,10 @@ void Window::SetPointerPosPixel( const Point& rPos ) // mirroring is required here, SetPointerPos bypasses SalGraphics mpGraphics->mirror( aPos.X(), this ); } + else if( ImplIsAntiparallel() ) + { + ImplReMirror( aPos ); + } mpWindowImpl->mpFrame->SetPointerPos( aPos.X(), aPos.Y() ); } @@ -7867,7 +7883,7 @@ Point Window::GetPointerPosPixel() DBG_CHKTHIS( Window, ImplDbgCheckWindow ); Point aPos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aPos ); @@ -7882,13 +7898,11 @@ Point Window::GetLastPointerPosPixel() DBG_CHKTHIS( Window, ImplDbgCheckWindow ); Point aPos( mpWindowImpl->mpFrameData->mnBeforeLastMouseX, mpWindowImpl->mpFrameData->mnBeforeLastMouseY ); -#ifndef REMOTE_APPSERVER - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aPos ); } -#endif return ImplFrameToOutput( aPos ); } @@ -7920,7 +7934,7 @@ Window::PointerState Window::GetPointerState() SalFrame::SalPointerState aSalPointerState; aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aSalPointerState.maPos ); @@ -9688,7 +9702,7 @@ Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpr return xSpriteCanvas; } -void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev, const Region* pOuterClip ) +void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos ) { BOOL bRVisible = mpWindowImpl->mbReallyVisible; mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible; @@ -9697,8 +9711,8 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev long nOldDPIX = ImplGetDPIX(); long nOldDPIY = ImplGetDPIY(); - mnDPIX = pTargetOutDev->ImplGetDPIX(); - mnDPIY = pTargetOutDev->ImplGetDPIY(); + mnDPIX = i_pTargetOutDev->ImplGetDPIX(); + mnDPIY = i_pTargetOutDev->ImplGetDPIY(); BOOL bOutput = IsOutputEnabled(); EnableOutput(); @@ -9710,8 +9724,8 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev SetClipRegion(); GDIMetaFile* pOldMtf = GetConnectMetaFile(); - pMtf->WindEnd(); - SetConnectMetaFile( pMtf ); + GDIMetaFile aMtf; + SetConnectMetaFile( &aMtf ); // put a push action to metafile Push(); @@ -9750,8 +9764,6 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev SetDigitLanguage( GetDigitLanguage() ); Rectangle aPaintRect( Point( 0, 0 ), GetOutputSizePixel() ); aClipRegion.Intersect( aPaintRect ); - if( pOuterClip ) - aClipRegion.Intersect( *pOuterClip ); SetClipRegion( aClipRegion ); // do the actual paint @@ -9768,37 +9780,30 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev EnableOutput( bOutput ); mpWindowImpl->mbReallyVisible = bRVisible; + // paint metafile to VDev + VirtualDevice* pMaskedDevice = new VirtualDevice( *i_pTargetOutDev, 0, 0 ); + pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() ); + pMaskedDevice->EnableRTL( IsRTLEnabled() ); + aMtf.WindStart(); + aMtf.Play( pMaskedDevice ); + BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), pMaskedDevice->GetOutputSizePixel() ) ); + i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx ); + // get rid of virtual device now so they don't pile up during recursive calls + delete pMaskedDevice, pMaskedDevice = NULL; + + for( Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext ) { if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) { - Region aClip( aPaintRect ); - if( pOuterClip ) - aClip.Intersect( *pOuterClip ); - sal_Int32 nDeltaX = GetOutOffXPixel() - pChild->GetOutOffXPixel(); - sal_Int32 nDeltaY = GetOutOffYPixel() - pChild->GetOutOffYPixel(); - pMtf->Move( nDeltaX, nDeltaY ); - aClip.Move( nDeltaX, nDeltaY ); - pChild->ImplPaintToMetaFile( pMtf, pTargetOutDev, &aClip ); - pMtf->Move( -nDeltaX, -nDeltaY ); - } - } - - for( Window* pOverlap = mpWindowImpl->mpFirstOverlap; pOverlap; pOverlap = pOverlap->mpWindowImpl->mpNext ) - { - if( pOverlap->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pOverlap->IsVisible() ) - { - Region aClip; - sal_Int32 nDeltaX = GetOutOffXPixel() - pOverlap->GetOutOffXPixel(); - sal_Int32 nDeltaY = GetOutOffYPixel() - pOverlap->GetOutOffYPixel(); - pMtf->Move( nDeltaX, nDeltaY ); - if( pOuterClip ) - { - aClip = *pOuterClip; - aClip.Move( nDeltaX, nDeltaY ); - } - pOverlap->ImplPaintToMetaFile( pMtf, pTargetOutDev, pOuterClip ? &aClip : NULL ); - pMtf->Move( -nDeltaX, -nDeltaY ); + long nDeltaX = pChild->mnOutOffX - mnOutOffX; + if( ImplHasMirroredGraphics() ) + nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth; + long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); + Point aPos( i_rPos ); + Point aDelta( nDeltaX, nDeltaY ); + aPos += aDelta; + pChild->ImplPaintToDevice( i_pTargetOutDev, aPos ); } } @@ -9815,7 +9820,11 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /*rSize*/ ) { // FIXME: scaling: currently this is for pixel copying only - GDIMetaFile aMF; + + DBG_ASSERT( ! pDev->ImplHasMirroredGraphics(), "PaintToDevice to mirroring graphics" ); + DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" ); + + Point aPos = pDev->LogicToPixel( rPos ); Window* pRealParent = NULL; @@ -9835,23 +9844,14 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& / mpWindowImpl->mbVisible = TRUE; if( mpWindowImpl->mpBorderWindow ) - mpWindowImpl->mpBorderWindow->ImplPaintToMetaFile( &aMF, pDev ); + mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos ); else - ImplPaintToMetaFile( &aMF, pDev ); + ImplPaintToDevice( pDev, rPos ); mpWindowImpl->mbVisible = bVisible; if( pRealParent ) SetParent( pRealParent ); - - pDev->Push(); - pDev->SetMapMode(); - - aMF.Move( aPos.X(), aPos.Y() ); - aMF.WindStart(); - aMF.Play( pDev ); - - pDev->Pop(); } XubString Window::GetSurroundingText() const diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 42389fc12e40..0595a7a9ab8a 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -68,8 +68,6 @@ DBG_NAMEEX( Window ) #define IMPL_MAXSAVEBACKSIZE (640*480) #define IMPL_MAXALLSAVEBACKSIZE (800*600*2) -//#define USE_NEW_RTL_IMPLEMENTATION - // ======================================================================= struct ImplFocusDelData : public ImplDelData @@ -690,15 +688,10 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer ) // Tracking-Event erzeugen Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else ImplReMirror( aMousePos ); -#endif } MouseEvent aMEvt( ImplFrameToOutput( aMousePos ), mpWindowImpl->mpFrameData->mnClickCount, 0, @@ -768,15 +761,10 @@ void Window::EndTracking( USHORT nFlags ) if ( !(nFlags & ENDTRACK_DONTCALLHDL) ) { Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else ImplReMirror( aMousePos ); -#endif } MouseEvent aMEvt( ImplFrameToOutput( aMousePos ), diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 56fcdee394d3..a8be05bf4909 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -80,9 +80,6 @@ extern void MyOutputDebugString( char *s); #endif -//#define USE_NEW_RTL_IMPLEMENTATION - - // ======================================================================= #define IMPL_MIN_NEEDSYSWIN 49 @@ -458,15 +455,10 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, // Ein paar Test ausfuehren und Message abfangen oder Status umsetzen if ( pChild ) { - if( pChild->ImplHasMirroredGraphics() && !pChild->IsRTLEnabled() ) + if( pChild->ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) pChild->mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else pChild->ImplReMirror( aMousePos ); -#endif } // no mouse messages to system object windows ? // !!!KA: Is it OK to comment this out? !!! |