diff options
author | Noel Power <noel.power@suse.com> | 2012-09-07 12:17:31 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2012-09-11 16:04:11 +0100 |
commit | 67adc642765862c6609914a0131a18967538b81c (patch) | |
tree | 220c982d6d107a9912d225abb59bbbbf98f92f40 /toolkit | |
parent | b241005c51a6705425937218e6893b4be2165128 (diff) |
fixed the unable to close dialog when vert scrollbars set
Change-Id: If15a2b7312577a8285dc1ab1dea1ccb7c4824ed6
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/scrollabledialog.cxx | 14 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/controls/dialogcontrol.cxx | 19 |
3 files changed, 33 insertions, 6 deletions
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx index 74cabce2430d..1b35e8ea0f31 100644 --- a/toolkit/source/awt/scrollabledialog.cxx +++ b/toolkit/source/awt/scrollabledialog.cxx @@ -5,8 +5,14 @@ namespace toolkit { +// Using WB_AUTOHSCROLL, WB_AUTOVSCROLL here sucks big time, there is a +// problem in the toolkit class where there are some clashing IDs +// ( ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL has the same value +// as ::com::sun::star::awt::WindowAttribute::NODECORATION and they are used +// in the same bitmap :-( WB_VSCROLL & WB_HSCROLL apparently are only for +// child classes ( whole thing is a mess if you ask me ) template< class T> -ScrollableWrapper<T>::ScrollableWrapper( Window* pParent, WinBits nStyle ) : T( pParent, nStyle | ~( WB_HSCROLL | WB_VSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None ) +ScrollableWrapper<T>::ScrollableWrapper( Window* pParent, WinBits nStyle ) : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None ) { Link aLink( LINK( this, ScrollableWrapper, ScrollBarHdl ) ); maVScrollBar.SetScrollHdl( aLink ); @@ -15,11 +21,11 @@ ScrollableWrapper<T>::ScrollableWrapper( Window* pParent, WinBits nStyle ) : T( Size aOutSz = T::GetOutputSizePixel(); ScrollBarVisibility aVis = None; - if ( nStyle & ( WB_HSCROLL | WB_VSCROLL ) ) + if ( nStyle & ( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ) { - if ( nStyle & WB_HSCROLL ) + if ( nStyle & WB_AUTOHSCROLL ) aVis = Hori; - if ( nStyle & WB_VSCROLL ) + if ( nStyle & WB_AUTOVSCROLL ) { if ( aVis == Hori ) aVis = Both; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 64bffaa38756..225134d1d399 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -243,7 +243,7 @@ TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO ) nWinBits |= WB_DEF_NO; } - if ( nCompType == WINDOW_MULTILINEEDIT ) + if ( nCompType == WINDOW_MULTILINEEDIT || nCompType == WINDOW_DIALOG ) { if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL ) nWinBits |= WB_AUTOHSCROLL; @@ -725,7 +725,9 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, case WINDOW_GROUPBOX: { if ( bFrameControl ) - pNewWindow = new toolkit::ScrollableWrapper< GroupBox >( pParent, nWinBits ); + { + pNewWindow = new toolkit::ScrollableWrapper< GroupBox >( pParent, nWinBits | WB_VSCROLL ); + } else pNewWindow = new GroupBox( pParent, nWinBits ); if ( bFrameControl ) diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 99c9d469f64b..106c7aad8fbc 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -60,6 +60,7 @@ #include <vcl/tabctrl.hxx> #include <toolkit/awt/vclxwindows.hxx> #include "toolkit/controls/unocontrols.hxx" +#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -372,6 +373,24 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc ) { + // HACK due to the fact that we can't really use VSCROLL & HSCROLL + // for Dialog ( ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL + // has the same value as + // ::com::sun::star::awt::WindowAttribute::NODECORATION ) + // For convenience in the PropBrowse using HSCROLL and VSCROLL ensures + // the Correct text. We exchange them here and the control knows + // about this hack ( it sucks badly I know ) + if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL ) + { + rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL; + rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL; + } + if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL ) + { + rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL; + rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL; + } + sal_Bool bDecoration( sal_True ); ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration; if ( !bDecoration ) |