From 99cad9fd7f413adecffc527d334eff616799cc4b Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 6 Jul 2012 11:19:57 +0100 Subject: fdo#51336 - change vcl checkbox no-label behaviour Change-Id: I352c6041cc520dc76c302190dcf3a6945f5ac85f Signed-off-by: Petr Mladek --- svtools/source/brwbox/ebbcontrols.cxx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index 1d7b0253fa29..b0ab8018ac62 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -253,6 +253,28 @@ namespace svt //= CheckBoxControl //================================================================== //------------------------------------------------------------------ + + class CBCntrlTriState : public TriStateBox + { + CBCntrlTriState( const CBCntrlTriState & ); + CBCntrlTriState& operator= ( const CBCntrlTriState & ); + protected: + virtual void ImplHandleHoriAlign( const Point& rPos, const Size& rSize, + const Size& rImageSize, Rectangle& rStateRect ) + { + WinBits nWinStyle = GetStyle(); + if ( nWinStyle & WB_CENTER ) + rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2); + else if ( nWinStyle & WB_RIGHT ) + rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width(); + else + rStateRect.Left() = rPos.X(); + } + public: + CBCntrlTriState( Window* pParent, WinBits nStyle = 0 ) : TriStateBox( pParent, nStyle ) {} + CBCntrlTriState( Window* pParent, const ResId& rResId ) : TriStateBox( pParent, rResId ) {} + }; + CheckBoxControl::CheckBoxControl(Window* pParent, WinBits nWinStyle) :Control(pParent, nWinStyle) { @@ -267,7 +289,7 @@ namespace svt EnableChildTransparentMode(); - pBox = new TriStateBox(this,WB_CENTER|WB_VCENTER); + pBox = new CBCntrlTriState(this,WB_CENTER|WB_VCENTER); pBox->EnableChildTransparentMode(); pBox->SetPaintTransparent( sal_True ); pBox->SetClickHdl( LINK( this, CheckBoxControl, OnClick ) ); -- cgit