diff options
Diffstat (limited to 'vcl/source/control/fixed.cxx')
-rw-r--r-- | vcl/source/control/fixed.cxx | 155 |
1 files changed, 90 insertions, 65 deletions
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index eed47fb59741..1828ded64a14 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -28,13 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <vcl/decoview.hxx> -#include <vcl/event.hxx> -#include <vcl/fixed.hxx> -#include <vcl/controldata.hxx> -#include <vcl/window.h> +#include "vcl/decoview.hxx" +#include "vcl/event.hxx" +#include "vcl/fixed.hxx" +#include "vcl/controldata.hxx" +#include "vcl/window.h" -#include <tools/rc.h> +#include "tools/rc.h" // ======================================================================= @@ -95,7 +95,7 @@ void FixedText::ImplInit( Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -122,8 +122,8 @@ const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) co // ----------------------------------------------------------------------- -void FixedText::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void FixedText::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Control::ImplInitSettings( bFont, bForeground ); @@ -132,16 +132,16 @@ void FixedText::ImplInitSettings( BOOL bFont, Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -183,7 +183,7 @@ FixedText::FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessi ImplInit( pParent, nStyle ); ImplLoadRes( rResId ); if ( bDisableAccessibleLabelForRelation ) - ImplGetWindowImpl()->mbDisableAccessibleLabelForRelation = TRUE; + ImplGetWindowImpl()->mbDisableAccessibleLabelForRelation = sal_True; if ( !(nStyle & WB_HIDE) ) Show(); @@ -191,9 +191,9 @@ FixedText::FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessi // ----------------------------------------------------------------------- -USHORT FixedText::ImplGetTextStyle( WinBits nWinStyle ) +sal_uInt16 FixedText::ImplGetTextStyle( WinBits nWinStyle ) { - USHORT nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_ENDELLIPSIS; + sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_ENDELLIPSIS; if( ! (nWinStyle & WB_NOMULTILINE) ) nTextStyle |= TEXT_DRAW_MULTILINE; @@ -224,7 +224,7 @@ USHORT FixedText::ImplGetTextStyle( WinBits nWinStyle ) // ----------------------------------------------------------------------- -void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void FixedText::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize, bool bFillLayout ) const @@ -232,7 +232,7 @@ void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); - USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); + sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); Point aPos = rPos; if ( nWinStyle & WB_EXTRAOFFSET ) @@ -280,9 +280,9 @@ void FixedText::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -297,8 +297,8 @@ void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextColor( GetTextColor() ); pDev->SetTextFillColor(); - BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); - BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); + sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); + sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); if ( bBorder || bBackground ) { Rectangle aRect( aPos, aSize ); @@ -344,24 +344,24 @@ void FixedText::StateChanged( StateChangedType nType ) if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } } else if ( (nType == STATE_CHANGE_ZOOM) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -377,7 +377,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -386,7 +386,7 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) Size FixedText::CalcMinimumTextSize( Control const *pControl, long nMaxWidth ) { - USHORT nStyle = ImplGetTextStyle( pControl->GetStyle() ); + sal_uInt16 nStyle = ImplGetTextStyle( pControl->GetStyle() ); if ( !( pControl->GetStyle() & WB_NOLABEL ) ) nStyle |= TEXT_DRAW_MNEMONIC; @@ -435,7 +435,7 @@ void FixedLine::ImplInit( Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); Control::ImplInit( pParent, nStyle, NULL ); - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); } // ----------------------------------------------------------------------- @@ -462,8 +462,8 @@ const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) co // ----------------------------------------------------------------------- -void FixedLine::ImplInitSettings( BOOL bFont, - BOOL bForeground, BOOL bBackground ) +void FixedLine::ImplInitSettings( sal_Bool bFont, + sal_Bool bForeground, sal_Bool bBackground ) { Control::ImplInitSettings( bFont, bForeground ); @@ -472,16 +472,16 @@ void FixedLine::ImplInitSettings( BOOL bFont, Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -502,7 +502,7 @@ void FixedLine::ImplDraw( bool bLayout ) String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; DecorationView aDecoView( this ); - if ( !aText.Len() || (nWinStyle & WB_VERT) ) + if ( !aText.Len() ) { if( !pVector ) { @@ -518,11 +518,34 @@ void FixedLine::ImplDraw( bool bLayout ) } } } + else if( (nWinStyle & WB_VERT) ) + { + long nWidth = GetTextWidth( aText ); + Push( PUSH_FONT ); + Font aFont( GetFont() ); + aFont.SetOrientation( 900 ); + SetFont( aFont ); + Point aStartPt( aOutSize.Width()/2, aOutSize.Height()-1 ); + if( (nWinStyle & WB_VCENTER) ) + aStartPt.Y() -= (aOutSize.Height() - nWidth)/2; + Point aTextPt( aStartPt ); + aTextPt.X() -= GetTextHeight()/2; + DrawText( aTextPt, aText, 0, STRING_LEN, pVector, pDisplayText ); + Pop(); + if( aOutSize.Height() - aStartPt.Y() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aOutSize.Height()-1 ), + Point( aStartPt.X(), aStartPt.Y() + FIXEDLINE_TEXT_BORDER ) ); + if( aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER > 0 ) + aDecoView.DrawSeparator( Point( aStartPt.X(), aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER ), + Point( aStartPt.X(), 0 ) ); + } else { - USHORT nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; + sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; Rectangle aRect( 0, 0, aOutSize.Width(), aOutSize.Height() ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + if( (nWinStyle & WB_CENTER) ) + nStyle |= TEXT_DRAW_CENTER; if ( !IsEnabled() ) nStyle |= TEXT_DRAW_DISABLE; @@ -537,6 +560,8 @@ void FixedLine::ImplDraw( bool bLayout ) { long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2); aDecoView.DrawSeparator( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ), false ); + if( aRect.Left() > FIXEDLINE_TEXT_BORDER ) + aDecoView.DrawSeparator( Point( 0, nTop ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop ), false ); } } } @@ -582,7 +607,7 @@ void FixedLine::Paint( const Rectangle& ) // ----------------------------------------------------------------------- -void FixedLine::Draw( OutputDevice*, const Point&, const Size&, ULONG ) +void FixedLine::Draw( OutputDevice*, const Point&, const Size&, sal_uLong ) { } @@ -618,17 +643,17 @@ void FixedLine::StateChanged( StateChangedType nType ) (nType == STATE_CHANGE_STYLE) || (nType == STATE_CHANGE_CONTROLFONT) ) { - ImplInitSettings( TRUE, FALSE, FALSE ); + ImplInitSettings( sal_True, sal_False, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) { - ImplInitSettings( FALSE, TRUE, FALSE ); + ImplInitSettings( sal_False, sal_True, sal_False ); Invalidate(); } else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { - ImplInitSettings( FALSE, FALSE, TRUE ); + ImplInitSettings( sal_False, sal_False, sal_True ); Invalidate(); } } @@ -644,7 +669,7 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - ImplInitSettings( TRUE, TRUE, TRUE ); + ImplInitSettings( sal_True, sal_True, sal_True ); Invalidate(); } } @@ -686,16 +711,16 @@ void FixedBitmap::ImplInitSettings() Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -710,7 +735,7 @@ void FixedBitmap::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( RSC_FIXEDBITMAP_BITMAP & nObjMask ) { @@ -749,10 +774,10 @@ FixedBitmap::~FixedBitmap() // ----------------------------------------------------------------------- -void FixedBitmap::ImplDraw( OutputDevice* pDev, ULONG /* nDrawFlags */, +void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, const Point& rPos, const Size& rSize ) { - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; Bitmap* pBitmap = &maBitmap; Color aCol; @@ -797,7 +822,7 @@ void FixedBitmap::Paint( const Rectangle& ) // ----------------------------------------------------------------------- void FixedBitmap::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -876,10 +901,10 @@ void FixedBitmap::SetBitmap( const Bitmap& rBitmap ) // ----------------------------------------------------------------------- -BOOL FixedBitmap::SetModeBitmap( const Bitmap& rBitmap ) +sal_Bool FixedBitmap::SetModeBitmap( const Bitmap& rBitmap ) { SetBitmap( rBitmap ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- @@ -894,7 +919,7 @@ const Bitmap& FixedBitmap::GetModeBitmap( ) const void FixedImage::ImplInit( Window* pParent, WinBits nStyle ) { nStyle = ImplInitStyle( nStyle ); - mbInUserDraw = FALSE; + mbInUserDraw = sal_False; Control::ImplInit( pParent, nStyle, NULL ); ImplInitSettings(); } @@ -915,16 +940,16 @@ void FixedImage::ImplInitSettings() Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -939,7 +964,7 @@ void FixedImage::ImplLoadRes( const ResId& rResId ) { Control::ImplLoadRes( rResId ); - ULONG nObjMask = ReadLongRes(); + sal_uLong nObjMask = ReadLongRes(); if ( RSC_FIXEDIMAGE_IMAGE & nObjMask ) { @@ -978,10 +1003,10 @@ FixedImage::~FixedImage() // ----------------------------------------------------------------------- -void FixedImage::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, +void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, const Point& rPos, const Size& rSize ) { - USHORT nStyle = 0; + sal_uInt16 nStyle = 0; if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) { if ( !IsEnabled() ) @@ -1003,10 +1028,10 @@ void FixedImage::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, } } - mbInUserDraw = TRUE; + mbInUserDraw = sal_True; UserDrawEvent aUDEvt( pDev, Rectangle( rPos, rSize ), 0, nStyle ); UserDraw( aUDEvt ); - mbInUserDraw = FALSE; + mbInUserDraw = sal_False; } // ----------------------------------------------------------------------- @@ -1033,7 +1058,7 @@ void FixedImage::UserDraw( const UserDrawEvent& ) // ----------------------------------------------------------------------- void FixedImage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - ULONG nFlags ) + sal_uLong nFlags ) { Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -1115,10 +1140,10 @@ void FixedImage::SetImage( const Image& rImage ) // ----------------------------------------------------------------------- -BOOL FixedImage::SetModeImage( const Image& rImage ) +sal_Bool FixedImage::SetModeImage( const Image& rImage ) { SetImage( rImage ); - return TRUE; + return sal_True; } // ----------------------------------------------------------------------- |