diff options
Diffstat (limited to 'toolkit/source/awt/vclxwindow.cxx')
-rw-r--r-- | toolkit/source/awt/vclxwindow.cxx | 122 |
1 files changed, 40 insertions, 82 deletions
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 243f682f1097..2169203e5916 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -66,8 +66,9 @@ #include <vcl/tabpage.hxx> #include <vcl/button.hxx> #include <comphelper/asyncnotification.hxx> +#include <comphelper/flagguard.hxx> #include "stylesettings.hxx" - +#include <tools/urlobj.hxx> #include <toolkit/helper/unopropertyarrayhelper.hxx> #include <boost/bind.hpp> @@ -93,32 +94,6 @@ namespace WritingMode2 = ::com::sun::star::text::WritingMode2; namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; //==================================================================== -//= misc helpers -//==================================================================== -namespace -{ - //................................................................ - //. FlagGuard - //................................................................ - class FlagGuard - { - private: - bool& m_rFlag; - - public: - FlagGuard( bool& _rFlag ) - :m_rFlag( _rFlag ) - { - m_rFlag = true; - } - ~FlagGuard() - { - m_rFlag = false; - } - }; -} - -//==================================================================== //= VCLXWindowImpl //==================================================================== class SAL_DLLPRIVATE VCLXWindowImpl @@ -148,7 +123,7 @@ private: TopWindowListenerMultiplexer maTopWindowListeners; CallbackArray maCallbackEvents; - ULONG mnCallbackEventId; + sal_uLong mnCallbackEventId; public: bool mbDisposing : 1; @@ -156,7 +131,7 @@ public: bool mbSynthesizingVCLEvent : 1; bool mbWithDefaultProps : 1; - ULONG mnListenerLockLevel; + sal_uLong mnListenerLockLevel; sal_Int16 mnWritingMode; sal_Int16 mnContextWritingMode; @@ -889,7 +864,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { if ( mpImpl->getDockableWindowListeners().getLength() ) { - BOOL *p_bFloating = (BOOL*)rVclWindowEvent.GetData(); + sal_Bool *p_bFloating = (sal_Bool*)rVclWindowEvent.GetData(); ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -948,7 +923,7 @@ void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b ) mpImpl->mbSynthesizingVCLEvent = _b; } -BOOL VCLXWindow::IsSynthesizingVCLEvent() const +sal_Bool VCLXWindow::IsSynthesizingVCLEvent() const { return mpImpl->mbSynthesizingVCLEvent; } @@ -1089,7 +1064,7 @@ void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::Runt Window* pWindow = GetWindow(); if ( pWindow ) { - pWindow->Enable( bEnable, FALSE ); // #95824# without children! + pWindow->Enable( bEnable, sal_False ); // #95824# without children! pWindow->EnableInput( bEnable ); } } @@ -1114,7 +1089,7 @@ void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::co // #100119# Get all resize events, even if height or width 0, or invisible if ( GetWindow() ) - GetWindow()->EnableAllResize( TRUE ); + GetWindow()->EnableAllResize( sal_True ); } void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) @@ -1347,7 +1322,7 @@ namespace toolkit (aStyleSettings.*pSetter)( Color( nColor ) ); aSettings.SetStyleSettings( aStyleSettings ); - _pWindow->SetSettings( aSettings, TRUE ); + _pWindow->SetSettings( aSettings, sal_True ); } } @@ -1423,11 +1398,11 @@ namespace { void lcl_updateWritingMode( Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode ) { - BOOL bEnableRTL = FALSE; + sal_Bool bEnableRTL = sal_False; switch ( _nWritingMode ) { - case WritingMode2::LR_TB: bEnableRTL = FALSE; break; - case WritingMode2::RL_TB: bEnableRTL = TRUE; break; + case WritingMode2::LR_TB: bEnableRTL = sal_False; break; + case WritingMode2::RL_TB: bEnableRTL = sal_True; break; case WritingMode2::CONTEXT: { // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use @@ -1435,8 +1410,8 @@ namespace // own window for its RTL mode switch ( _nContextWritingMode ) { - case WritingMode2::LR_TB: bEnableRTL = FALSE; break; - case WritingMode2::RL_TB: bEnableRTL = TRUE; break; + case WritingMode2::LR_TB: bEnableRTL = sal_False; break; + case WritingMode2::RL_TB: bEnableRTL = sal_True; break; case WritingMode2::CONTEXT: { const Window* pParent = _rWindow.GetParent(); @@ -1507,7 +1482,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: AllSettings aSettings = pWindow->GetSettings(); MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - USHORT nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY ); + sal_uInt16 nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY ); switch ( nWheelBehavior ) { case MouseWheelBehavior::SCROLL_DISABLED: nVclBehavior = MOUSE_WHEEL_DISABLE; break; @@ -1519,7 +1494,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: aMouseSettings.SetWheelBehavior( nVclBehavior ); aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings, TRUE ); + pWindow->SetSettings( aSettings, sal_True ); } break; @@ -1594,17 +1569,11 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: ::rtl::OUString aURL; if ( Value >>= aURL ) { - String aHelpURL( aURL ); - String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); - if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL ) - { - String aID = aHelpURL.Copy( aPattern.Len() ); - pWindow->SetHelpId( aID.ToInt32() ); - } + INetURLObject aHelpURL( aURL ); + if ( aHelpURL.GetProtocol() == INET_PROT_HID ) + pWindow->SetHelpId( rtl::OUStringToOString( aHelpURL.GetURLPath(), RTL_TEXTENCODING_UTF8 ) ); else - { - pWindow->SetSmartHelpId( SmartId( aHelpURL ) ); - } + pWindow->SetHelpId( rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ) ); } } break; @@ -1680,7 +1649,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: // support transparency only for special controls pWindow->SetBackground(); pWindow->SetControlBackground(); - pWindow->SetPaintTransparent( TRUE ); + pWindow->SetPaintTransparent( sal_True ); break; } @@ -1713,7 +1682,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: case WINDOW_RADIOBUTTON: case WINDOW_GROUPBOX: case WINDOW_FIXEDLINE: - pWindow->SetPaintTransparent( FALSE ); + pWindow->SetPaintTransparent( sal_False ); default: ; } pWindow->Invalidate(); // Falls das Control nicht drauf reagiert @@ -1945,7 +1914,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: case BASEPROPERTY_REPEAT: { - sal_Bool bRepeat( FALSE ); + sal_Bool bRepeat( sal_False ); Value >>= bRepeat; WinBits nStyle = pWindow->GetStyle(); @@ -1968,7 +1937,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: aMouseSettings.SetButtonRepeat( nRepeatDelay ); aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings, TRUE ); + pWindow->SetSettings( aSettings, sal_True ); } } break; @@ -2023,7 +1992,7 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR: { - USHORT nVclBehavior = GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior(); + sal_uInt16 nVclBehavior = GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior(); sal_Int16 nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; switch ( nVclBehavior ) { @@ -2075,19 +2044,8 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: break; case BASEPROPERTY_HELPURL: { - SmartId aSmartId = GetWindow()->GetSmartHelpId(); - if( aSmartId.HasString() ) - { - String aStrHelpId = aSmartId.GetStr(); - aProp <<= ::rtl::OUString( aStrHelpId ); - } - else - { - ::rtl::OUStringBuffer aURL; - aURL.appendAscii( "HID:" ); - aURL.append( (sal_Int32) GetWindow()->GetHelpId() ); - aProp <<= aURL.makeStringAndClear(); - } + rtl::OUString aHelpId( rtl::OStringToOUString( GetWindow()->GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); + aProp <<= ::rtl::OUString( aHelpId ); } break; case BASEPROPERTY_FONTDESCRIPTOR: @@ -2358,9 +2316,9 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: // #i40647# / 2005-01-18 / frank.schoenheit@sun.com if ( !mpImpl->getDrawingOntoParent_ref() ) { - FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() ); + ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() ); - BOOL bWasVisible = pWindow->IsVisible(); + sal_Bool bWasVisible = pWindow->IsVisible(); Point aOldPos( pWindow->GetPosPixel() ); if ( bWasVisible && aOldPos == aPos ) @@ -2385,7 +2343,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: pWindow->SetPosPixel( aOldPos ); if ( bWasVisible ) - pWindow->Show( TRUE ); + pWindow->Show( sal_True ); } } else if ( pDev ) @@ -2404,12 +2362,12 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: } else { - BOOL bOldNW =pWindow->IsNativeWidgetEnabled(); + sal_Bool bOldNW =pWindow->IsNativeWidgetEnabled(); if( bOldNW ) - pWindow->EnableNativeWidget(FALSE); + pWindow->EnableNativeWidget(sal_False); pWindow->PaintToDevice( pDev, aP, aSz ); if( bOldNW ) - pWindow->EnableNativeWidget(TRUE); + pWindow->EnableNativeWidget(sal_True); } } } @@ -2505,7 +2463,7 @@ sal_Bool SAL_CALL VCLXWindow::isFloating( ) throw (::com::sun::star::uno::Runti if( pWindow ) return Window::GetDockingManager()->IsFloating( pWindow ); else - return FALSE; + return sal_False; } void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException) @@ -2525,7 +2483,7 @@ sal_Bool SAL_CALL VCLXWindow::isLocked( ) throw (::com::sun::star::uno::Runtime if( pWindow ) return Window::GetDockingManager()->IsLocked( pWindow ); else - return FALSE; + return sal_False; } void SAL_CALL VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException) @@ -2556,7 +2514,7 @@ sal_Bool SAL_CALL VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::Ru { // TODO: remove interface in the next incompatible build SolarMutexGuard aGuard; - return FALSE; + return sal_False; } @@ -2598,7 +2556,7 @@ sal_Bool SAL_CALL VCLXWindow::isVisible( ) throw (::com::sun::star::uno::Runtim if( GetWindow() ) return GetWindow()->IsVisible(); else - return FALSE; + return sal_False; } sal_Bool SAL_CALL VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException) @@ -2607,7 +2565,7 @@ sal_Bool SAL_CALL VCLXWindow::isActive( ) throw (::com::sun::star::uno::Runtime if( GetWindow() ) return GetWindow()->IsActive(); else - return FALSE; + return sal_False; } @@ -2617,7 +2575,7 @@ sal_Bool SAL_CALL VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::Runtim if( GetWindow() ) return GetWindow()->IsEnabled(); else - return FALSE; + return sal_False; } sal_Bool SAL_CALL VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException) @@ -2626,7 +2584,7 @@ sal_Bool SAL_CALL VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::Runtime if( GetWindow() ) return GetWindow()->HasFocus(); else - return FALSE; + return sal_False; } // ::com::sun::star::beans::XPropertySetInfo |