1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_vcl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "tools/rc.h" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "vcl/decoview.hxx" 34*cdf0e10cSrcweir #include "vcl/event.hxx" 35*cdf0e10cSrcweir #include "vcl/fixed.hxx" 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include "controldata.hxx" 38*cdf0e10cSrcweir #include "window.h" 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir // ======================================================================= 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #define FIXEDLINE_TEXT_BORDER 4 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #define FIXEDTEXT_VIEW_STYLE (WB_3DLOOK | \ 45*cdf0e10cSrcweir WB_LEFT | WB_CENTER | WB_RIGHT | \ 46*cdf0e10cSrcweir WB_TOP | WB_VCENTER | WB_BOTTOM | \ 47*cdf0e10cSrcweir WB_WORDBREAK | WB_NOLABEL | \ 48*cdf0e10cSrcweir WB_INFO | WB_PATHELLIPSIS) 49*cdf0e10cSrcweir #define FIXEDLINE_VIEW_STYLE (WB_3DLOOK | WB_NOLABEL) 50*cdf0e10cSrcweir #define FIXEDBITMAP_VIEW_STYLE (WB_3DLOOK | \ 51*cdf0e10cSrcweir WB_LEFT | WB_CENTER | WB_RIGHT | \ 52*cdf0e10cSrcweir WB_TOP | WB_VCENTER | WB_BOTTOM | \ 53*cdf0e10cSrcweir WB_SCALE) 54*cdf0e10cSrcweir #define FIXEDIMAGE_VIEW_STYLE (WB_3DLOOK | \ 55*cdf0e10cSrcweir WB_LEFT | WB_CENTER | WB_RIGHT | \ 56*cdf0e10cSrcweir WB_TOP | WB_VCENTER | WB_BOTTOM | \ 57*cdf0e10cSrcweir WB_SCALE) 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir // ======================================================================= 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir static Point ImplCalcPos( WinBits nStyle, const Point& rPos, 62*cdf0e10cSrcweir const Size& rObjSize, const Size& rWinSize ) 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir long nX; 65*cdf0e10cSrcweir long nY; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir if ( nStyle & WB_LEFT ) 68*cdf0e10cSrcweir nX = 0; 69*cdf0e10cSrcweir else if ( nStyle & WB_RIGHT ) 70*cdf0e10cSrcweir nX = rWinSize.Width()-rObjSize.Width(); 71*cdf0e10cSrcweir else 72*cdf0e10cSrcweir nX = (rWinSize.Width()-rObjSize.Width())/2; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir if ( nStyle & WB_TOP ) 75*cdf0e10cSrcweir nY = 0; 76*cdf0e10cSrcweir else if ( nStyle & WB_BOTTOM ) 77*cdf0e10cSrcweir nY = rWinSize.Height()-rObjSize.Height(); 78*cdf0e10cSrcweir else 79*cdf0e10cSrcweir nY = (rWinSize.Height()-rObjSize.Height())/2; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir if ( nStyle & WB_TOPLEFTVISIBLE ) 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir if ( nX < 0 ) 84*cdf0e10cSrcweir nX = 0; 85*cdf0e10cSrcweir if ( nY < 0 ) 86*cdf0e10cSrcweir nY = 0; 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir Point aPos( nX+rPos.X(), nY+rPos.Y() ); 90*cdf0e10cSrcweir return aPos; 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir // ======================================================================= 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir void FixedText::ImplInit( Window* pParent, WinBits nStyle ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir nStyle = ImplInitStyle( nStyle ); 98*cdf0e10cSrcweir Control::ImplInit( pParent, nStyle, NULL ); 99*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_True, sal_True ); 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir // ----------------------------------------------------------------------- 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir WinBits FixedText::ImplInitStyle( WinBits nStyle ) 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir if ( !(nStyle & WB_NOGROUP) ) 107*cdf0e10cSrcweir nStyle |= WB_GROUP; 108*cdf0e10cSrcweir return nStyle; 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // ----------------------------------------------------------------- 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir const Font& FixedText::GetCanonicalFont( const StyleSettings& _rStyle ) const 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoFont() : _rStyle.GetLabelFont(); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir // ----------------------------------------------------------------- 119*cdf0e10cSrcweir const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) const 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir // ----------------------------------------------------------------------- 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir void FixedText::ImplInitSettings( sal_Bool bFont, 127*cdf0e10cSrcweir sal_Bool bForeground, sal_Bool bBackground ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir Control::ImplInitSettings( bFont, bForeground ); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir if ( bBackground ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir Window* pParent = GetParent(); 134*cdf0e10cSrcweir if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir EnableChildTransparentMode( sal_True ); 137*cdf0e10cSrcweir SetParentClipMode( PARENTCLIPMODE_NOCLIP ); 138*cdf0e10cSrcweir SetPaintTransparent( sal_True ); 139*cdf0e10cSrcweir SetBackground(); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir else 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir EnableChildTransparentMode( sal_False ); 144*cdf0e10cSrcweir SetParentClipMode( 0 ); 145*cdf0e10cSrcweir SetPaintTransparent( sal_False ); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir if ( IsControlBackground() ) 148*cdf0e10cSrcweir SetBackground( GetControlBackground() ); 149*cdf0e10cSrcweir else 150*cdf0e10cSrcweir SetBackground( pParent->GetBackground() ); 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir // ----------------------------------------------------------------------- 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir FixedText::FixedText( Window* pParent, WinBits nStyle ) : 158*cdf0e10cSrcweir Control( WINDOW_FIXEDTEXT ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir // ----------------------------------------------------------------------- 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir FixedText::FixedText( Window* pParent, const ResId& rResId ) : 166*cdf0e10cSrcweir Control( WINDOW_FIXEDTEXT ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir rResId.SetRT( RSC_TEXT ); 169*cdf0e10cSrcweir WinBits nStyle = ImplInitRes( rResId ); 170*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 171*cdf0e10cSrcweir ImplLoadRes( rResId ); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir if ( !(nStyle & WB_HIDE) ) 174*cdf0e10cSrcweir Show(); 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir // ----------------------------------------------------------------------- 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir FixedText::FixedText( Window* pParent, const ResId& rResId, bool bDisableAccessibleLabelForRelation ) : 180*cdf0e10cSrcweir Control( WINDOW_FIXEDTEXT ) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir rResId.SetRT( RSC_TEXT ); 183*cdf0e10cSrcweir WinBits nStyle = ImplInitRes( rResId ); 184*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 185*cdf0e10cSrcweir ImplLoadRes( rResId ); 186*cdf0e10cSrcweir if ( bDisableAccessibleLabelForRelation ) 187*cdf0e10cSrcweir ImplGetWindowImpl()->mbDisableAccessibleLabelForRelation = sal_True; 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir if ( !(nStyle & WB_HIDE) ) 190*cdf0e10cSrcweir Show(); 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir // ----------------------------------------------------------------------- 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir sal_uInt16 FixedText::ImplGetTextStyle( WinBits nWinStyle ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_ENDELLIPSIS; 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir if( ! (nWinStyle & WB_NOMULTILINE) ) 200*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_MULTILINE; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir if ( nWinStyle & WB_RIGHT ) 203*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_RIGHT; 204*cdf0e10cSrcweir else if ( nWinStyle & WB_CENTER ) 205*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_CENTER; 206*cdf0e10cSrcweir else 207*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_LEFT; 208*cdf0e10cSrcweir if ( nWinStyle & WB_BOTTOM ) 209*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_BOTTOM; 210*cdf0e10cSrcweir else if ( nWinStyle & WB_VCENTER ) 211*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_VCENTER; 212*cdf0e10cSrcweir else 213*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_TOP; 214*cdf0e10cSrcweir if ( nWinStyle & WB_WORDBREAK ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_WORDBREAK; 217*cdf0e10cSrcweir if ( (nWinStyle & WB_HYPHENATION ) == WB_HYPHENATION ) 218*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_WORDBREAK_HYPHENATION; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir if ( nWinStyle & WB_NOLABEL ) 221*cdf0e10cSrcweir nTextStyle &= ~TEXT_DRAW_MNEMONIC; 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir return nTextStyle; 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir // ----------------------------------------------------------------------- 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir void FixedText::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, 229*cdf0e10cSrcweir const Point& rPos, const Size& rSize, 230*cdf0e10cSrcweir bool bFillLayout 231*cdf0e10cSrcweir ) const 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 234*cdf0e10cSrcweir WinBits nWinStyle = GetStyle(); 235*cdf0e10cSrcweir XubString aText( GetText() ); 236*cdf0e10cSrcweir sal_uInt16 nTextStyle = FixedText::ImplGetTextStyle( nWinStyle ); 237*cdf0e10cSrcweir Point aPos = rPos; 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir if ( nWinStyle & WB_EXTRAOFFSET ) 240*cdf0e10cSrcweir aPos.X() += 2; 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir if ( nWinStyle & WB_PATHELLIPSIS ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir nTextStyle &= ~(TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK); 245*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_PATHELLIPSIS; 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir if ( nTextStyle & TEXT_DRAW_MNEMONIC ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir aText = GetNonMnemonicString( aText ); 252*cdf0e10cSrcweir nTextStyle &= ~TEXT_DRAW_MNEMONIC; 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if ( !IsEnabled() ) 258*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_DISABLE; 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir if ( (nDrawFlags & WINDOW_DRAW_MONO) || 261*cdf0e10cSrcweir (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) 262*cdf0e10cSrcweir nTextStyle |= TEXT_DRAW_MONO; 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir if( bFillLayout ) 265*cdf0e10cSrcweir mpControlData->mpLayoutData->m_aDisplayText = String(); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir Rectangle aRect( Rectangle( aPos, rSize ) ); 268*cdf0e10cSrcweir DrawControlText( *pDev, aRect, aText, nTextStyle, 269*cdf0e10cSrcweir bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, 270*cdf0e10cSrcweir bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL 271*cdf0e10cSrcweir ); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir // ----------------------------------------------------------------------- 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir void FixedText::Paint( const Rectangle& ) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir ImplDraw( this, 0, Point(), GetOutputSizePixel() ); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // ----------------------------------------------------------------------- 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, 284*cdf0e10cSrcweir sal_uLong nFlags ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_True, sal_True ); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir Point aPos = pDev->LogicToPixel( rPos ); 289*cdf0e10cSrcweir Size aSize = pDev->LogicToPixel( rSize ); 290*cdf0e10cSrcweir Font aFont = GetDrawPixelFont( pDev ); 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir pDev->Push(); 293*cdf0e10cSrcweir pDev->SetMapMode(); 294*cdf0e10cSrcweir pDev->SetFont( aFont ); 295*cdf0e10cSrcweir if ( nFlags & WINDOW_DRAW_MONO ) 296*cdf0e10cSrcweir pDev->SetTextColor( Color( COL_BLACK ) ); 297*cdf0e10cSrcweir else 298*cdf0e10cSrcweir pDev->SetTextColor( GetTextColor() ); 299*cdf0e10cSrcweir pDev->SetTextFillColor(); 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); 302*cdf0e10cSrcweir sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); 303*cdf0e10cSrcweir if ( bBorder || bBackground ) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir Rectangle aRect( aPos, aSize ); 306*cdf0e10cSrcweir if ( bBorder ) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir ImplDrawFrame( pDev, aRect ); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir if ( bBackground ) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir pDev->SetFillColor( GetControlBackground() ); 313*cdf0e10cSrcweir pDev->DrawRect( aRect ); 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir ImplDraw( pDev, nFlags, aPos, aSize ); 318*cdf0e10cSrcweir pDev->Pop(); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir // ----------------------------------------------------------------------- 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir void FixedText::Resize() 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir Control::Resize(); 326*cdf0e10cSrcweir Invalidate(); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir // ----------------------------------------------------------------------- 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir void FixedText::StateChanged( StateChangedType nType ) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir Control::StateChanged( nType ); 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir if ( (nType == STATE_CHANGE_ENABLE) || 336*cdf0e10cSrcweir (nType == STATE_CHANGE_TEXT) || 337*cdf0e10cSrcweir (nType == STATE_CHANGE_UPDATEMODE) ) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir if ( IsReallyVisible() && IsUpdateMode() ) 340*cdf0e10cSrcweir Invalidate(); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_STYLE ) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir SetStyle( ImplInitStyle( GetStyle() ) ); 345*cdf0e10cSrcweir if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) != 346*cdf0e10cSrcweir (GetStyle() & FIXEDTEXT_VIEW_STYLE) ) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_False, sal_False ); 349*cdf0e10cSrcweir Invalidate(); 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir else if ( (nType == STATE_CHANGE_ZOOM) || 353*cdf0e10cSrcweir (nType == STATE_CHANGE_CONTROLFONT) ) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_False, sal_False ); 356*cdf0e10cSrcweir Invalidate(); 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir ImplInitSettings( sal_False, sal_True, sal_False ); 361*cdf0e10cSrcweir Invalidate(); 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir ImplInitSettings( sal_False, sal_False, sal_True ); 366*cdf0e10cSrcweir Invalidate(); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir // ----------------------------------------------------------------------- 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir void FixedText::DataChanged( const DataChangedEvent& rDCEvt ) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir Control::DataChanged( rDCEvt ); 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || 377*cdf0e10cSrcweir (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || 378*cdf0e10cSrcweir ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && 379*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_True, sal_True ); 382*cdf0e10cSrcweir Invalidate(); 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir // ----------------------------------------------------------------------- 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir Size FixedText::CalcMinimumTextSize( Control const *pControl, long nMaxWidth ) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir sal_uInt16 nStyle = ImplGetTextStyle( pControl->GetStyle() ); 391*cdf0e10cSrcweir if ( !( pControl->GetStyle() & WB_NOLABEL ) ) 392*cdf0e10cSrcweir nStyle |= TEXT_DRAW_MNEMONIC; 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir Size aSize = pControl->GetTextRect( Rectangle( Point(), Size( (nMaxWidth ? nMaxWidth : 0x7fffffff), 0x7fffffff ) ), 395*cdf0e10cSrcweir pControl->GetText(), nStyle ).GetSize(); 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir if ( pControl->GetStyle() & WB_EXTRAOFFSET ) 398*cdf0e10cSrcweir aSize.Width() += 2; 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir // GetTextRect verkraftet keinen leeren String: 401*cdf0e10cSrcweir if ( aSize.Width() < 0 ) 402*cdf0e10cSrcweir aSize.Width() = 0; 403*cdf0e10cSrcweir if ( aSize.Height() <= 0 ) 404*cdf0e10cSrcweir aSize.Height() = pControl->GetTextHeight(); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir return aSize; 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir Size FixedText::CalcMinimumSize( long nMaxWidth ) const 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir return CalcWindowSize( CalcMinimumTextSize ( this, nMaxWidth ) ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir // ----------------------------------------------------------------------- 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir Size FixedText::GetOptimalSize(WindowSizeType eType) const 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir switch (eType) { 418*cdf0e10cSrcweir case WINDOWSIZE_MINIMUM: 419*cdf0e10cSrcweir return CalcMinimumSize(); 420*cdf0e10cSrcweir default: 421*cdf0e10cSrcweir return Control::GetOptimalSize( eType ); 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir // ----------------------------------------------------------------------- 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir void FixedText::FillLayoutData() const 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir mpControlData->mpLayoutData = new vcl::ControlLayoutData(); 430*cdf0e10cSrcweir ImplDraw( const_cast<FixedText*>(this), 0, Point(), GetOutputSizePixel(), true ); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir // ======================================================================= 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir void FixedLine::ImplInit( Window* pParent, WinBits nStyle ) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir nStyle = ImplInitStyle( nStyle ); 438*cdf0e10cSrcweir Control::ImplInit( pParent, nStyle, NULL ); 439*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_True, sal_True ); 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir // ----------------------------------------------------------------------- 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir WinBits FixedLine::ImplInitStyle( WinBits nStyle ) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir if ( !(nStyle & WB_NOGROUP) ) 447*cdf0e10cSrcweir nStyle |= WB_GROUP; 448*cdf0e10cSrcweir return nStyle; 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir // ----------------------------------------------------------------- 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir const Font& FixedLine::GetCanonicalFont( const StyleSettings& _rStyle ) const 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir return _rStyle.GetGroupFont(); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir // ----------------------------------------------------------------- 459*cdf0e10cSrcweir const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) const 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir return _rStyle.GetGroupTextColor(); 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir // ----------------------------------------------------------------------- 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir void FixedLine::ImplInitSettings( sal_Bool bFont, 467*cdf0e10cSrcweir sal_Bool bForeground, sal_Bool bBackground ) 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir Control::ImplInitSettings( bFont, bForeground ); 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir if ( bBackground ) 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir Window* pParent = GetParent(); 474*cdf0e10cSrcweir if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir EnableChildTransparentMode( sal_True ); 477*cdf0e10cSrcweir SetParentClipMode( PARENTCLIPMODE_NOCLIP ); 478*cdf0e10cSrcweir SetPaintTransparent( sal_True ); 479*cdf0e10cSrcweir SetBackground(); 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir else 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir EnableChildTransparentMode( sal_False ); 484*cdf0e10cSrcweir SetParentClipMode( 0 ); 485*cdf0e10cSrcweir SetPaintTransparent( sal_False ); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir if ( IsControlBackground() ) 488*cdf0e10cSrcweir SetBackground( GetControlBackground() ); 489*cdf0e10cSrcweir else 490*cdf0e10cSrcweir SetBackground( pParent->GetBackground() ); 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir // ----------------------------------------------------------------------- 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir void FixedLine::ImplDraw( bool bLayout ) 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir Size aOutSize = GetOutputSizePixel(); 500*cdf0e10cSrcweir String aText = GetText(); 501*cdf0e10cSrcweir WinBits nWinStyle = GetStyle(); 502*cdf0e10cSrcweir MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; 503*cdf0e10cSrcweir String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir DecorationView aDecoView( this ); 506*cdf0e10cSrcweir if ( !aText.Len() ) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir if( !pVector ) 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir long nX = 0; 511*cdf0e10cSrcweir long nY = 0; 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir if ( nWinStyle & WB_VERT ) 514*cdf0e10cSrcweir { 515*cdf0e10cSrcweir nX = (aOutSize.Width()-1)/2; 516*cdf0e10cSrcweir aDecoView.DrawSeparator( Point( nX, 0 ), Point( nX, aOutSize.Height()-1 ) ); 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir else 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir nY = (aOutSize.Height()-1)/2; 521*cdf0e10cSrcweir aDecoView.DrawSeparator( Point( 0, nY ), Point( aOutSize.Width()-1, nY ), false ); 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir else if( (nWinStyle & WB_VERT) ) 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir long nWidth = GetTextWidth( aText ); 528*cdf0e10cSrcweir Push( PUSH_FONT ); 529*cdf0e10cSrcweir Font aFont( GetFont() ); 530*cdf0e10cSrcweir aFont.SetOrientation( 900 ); 531*cdf0e10cSrcweir SetFont( aFont ); 532*cdf0e10cSrcweir Point aStartPt( aOutSize.Width()/2, aOutSize.Height()-1 ); 533*cdf0e10cSrcweir if( (nWinStyle & WB_VCENTER) ) 534*cdf0e10cSrcweir aStartPt.Y() -= (aOutSize.Height() - nWidth)/2; 535*cdf0e10cSrcweir Point aTextPt( aStartPt ); 536*cdf0e10cSrcweir aTextPt.X() -= GetTextHeight()/2; 537*cdf0e10cSrcweir DrawText( aTextPt, aText, 0, STRING_LEN, pVector, pDisplayText ); 538*cdf0e10cSrcweir Pop(); 539*cdf0e10cSrcweir if( aOutSize.Height() - aStartPt.Y() > FIXEDLINE_TEXT_BORDER ) 540*cdf0e10cSrcweir aDecoView.DrawSeparator( Point( aStartPt.X(), aOutSize.Height()-1 ), 541*cdf0e10cSrcweir Point( aStartPt.X(), aStartPt.Y() + FIXEDLINE_TEXT_BORDER ) ); 542*cdf0e10cSrcweir if( aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER > 0 ) 543*cdf0e10cSrcweir aDecoView.DrawSeparator( Point( aStartPt.X(), aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER ), 544*cdf0e10cSrcweir Point( aStartPt.X(), 0 ) ); 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir else 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; 549*cdf0e10cSrcweir Rectangle aRect( 0, 0, aOutSize.Width(), aOutSize.Height() ); 550*cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 551*cdf0e10cSrcweir if( (nWinStyle & WB_CENTER) ) 552*cdf0e10cSrcweir nStyle |= TEXT_DRAW_CENTER; 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir if ( !IsEnabled() ) 555*cdf0e10cSrcweir nStyle |= TEXT_DRAW_DISABLE; 556*cdf0e10cSrcweir if ( GetStyle() & WB_NOLABEL ) 557*cdf0e10cSrcweir nStyle &= ~TEXT_DRAW_MNEMONIC; 558*cdf0e10cSrcweir if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) 559*cdf0e10cSrcweir nStyle |= TEXT_DRAW_MONO; 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir DrawControlText( *this, aRect, aText, nStyle, pVector, pDisplayText ); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir if( !pVector ) 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2); 566*cdf0e10cSrcweir aDecoView.DrawSeparator( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ), false ); 567*cdf0e10cSrcweir if( aRect.Left() > FIXEDLINE_TEXT_BORDER ) 568*cdf0e10cSrcweir aDecoView.DrawSeparator( Point( 0, nTop ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop ), false ); 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir // ----------------------------------------------------------------------- 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir FixedLine::FixedLine( Window* pParent, WinBits nStyle ) : 576*cdf0e10cSrcweir Control( WINDOW_FIXEDLINE ) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 579*cdf0e10cSrcweir SetSizePixel( Size( 2, 2 ) ); 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir // ----------------------------------------------------------------------- 583*cdf0e10cSrcweir 584*cdf0e10cSrcweir FixedLine::FixedLine( Window* pParent, const ResId& rResId ) : 585*cdf0e10cSrcweir Control( WINDOW_FIXEDLINE ) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir rResId.SetRT( RSC_FIXEDLINE ); 588*cdf0e10cSrcweir WinBits nStyle = ImplInitRes( rResId ); 589*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 590*cdf0e10cSrcweir ImplLoadRes( rResId ); 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir if ( !(nStyle & WB_HIDE) ) 593*cdf0e10cSrcweir Show(); 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir // ----------------------------------------------------------------------- 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir void FixedLine::FillLayoutData() const 599*cdf0e10cSrcweir { 600*cdf0e10cSrcweir mpControlData->mpLayoutData = new vcl::ControlLayoutData(); 601*cdf0e10cSrcweir const_cast<FixedLine*>(this)->ImplDraw( true ); 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir // ----------------------------------------------------------------------- 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir void FixedLine::Paint( const Rectangle& ) 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir ImplDraw(); 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir // ----------------------------------------------------------------------- 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir void FixedLine::Draw( OutputDevice*, const Point&, const Size&, sal_uLong ) 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir // ----------------------------------------------------------------------- 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir void FixedLine::Resize() 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir Control::Resize(); 623*cdf0e10cSrcweir Invalidate(); 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir // ----------------------------------------------------------------------- 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir void FixedLine::StateChanged( StateChangedType nType ) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir Control::StateChanged( nType ); 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir if ( (nType == STATE_CHANGE_ENABLE) || 633*cdf0e10cSrcweir (nType == STATE_CHANGE_TEXT) || 634*cdf0e10cSrcweir (nType == STATE_CHANGE_UPDATEMODE) ) 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir if ( IsReallyVisible() && IsUpdateMode() ) 637*cdf0e10cSrcweir Invalidate(); 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_STYLE ) 640*cdf0e10cSrcweir { 641*cdf0e10cSrcweir SetStyle( ImplInitStyle( GetStyle() ) ); 642*cdf0e10cSrcweir if ( (GetPrevStyle() & FIXEDLINE_VIEW_STYLE) != 643*cdf0e10cSrcweir (GetStyle() & FIXEDLINE_VIEW_STYLE) ) 644*cdf0e10cSrcweir Invalidate(); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir else if ( (nType == STATE_CHANGE_ZOOM) || 647*cdf0e10cSrcweir (nType == STATE_CHANGE_STYLE) || 648*cdf0e10cSrcweir (nType == STATE_CHANGE_CONTROLFONT) ) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_False, sal_False ); 651*cdf0e10cSrcweir Invalidate(); 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir ImplInitSettings( sal_False, sal_True, sal_False ); 656*cdf0e10cSrcweir Invalidate(); 657*cdf0e10cSrcweir } 658*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir ImplInitSettings( sal_False, sal_False, sal_True ); 661*cdf0e10cSrcweir Invalidate(); 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir } 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir // ----------------------------------------------------------------------- 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir Control::DataChanged( rDCEvt ); 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || 672*cdf0e10cSrcweir (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || 673*cdf0e10cSrcweir ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && 674*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir ImplInitSettings( sal_True, sal_True, sal_True ); 677*cdf0e10cSrcweir Invalidate(); 678*cdf0e10cSrcweir } 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir // ----------------------------------------------------------------------- 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir Size FixedLine::GetOptimalSize(WindowSizeType eType) const 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir switch (eType) { 686*cdf0e10cSrcweir case WINDOWSIZE_MINIMUM: 687*cdf0e10cSrcweir return CalcWindowSize( FixedText::CalcMinimumTextSize ( this ) ); 688*cdf0e10cSrcweir default: 689*cdf0e10cSrcweir return Control::GetOptimalSize( eType ); 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir // ======================================================================= 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir void FixedBitmap::ImplInit( Window* pParent, WinBits nStyle ) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir nStyle = ImplInitStyle( nStyle ); 698*cdf0e10cSrcweir Control::ImplInit( pParent, nStyle, NULL ); 699*cdf0e10cSrcweir ImplInitSettings(); 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir // ----------------------------------------------------------------------- 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir WinBits FixedBitmap::ImplInitStyle( WinBits nStyle ) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir if ( !(nStyle & WB_NOGROUP) ) 707*cdf0e10cSrcweir nStyle |= WB_GROUP; 708*cdf0e10cSrcweir return nStyle; 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir // ----------------------------------------------------------------------- 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir void FixedBitmap::ImplInitSettings() 714*cdf0e10cSrcweir { 715*cdf0e10cSrcweir Window* pParent = GetParent(); 716*cdf0e10cSrcweir if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir EnableChildTransparentMode( sal_True ); 719*cdf0e10cSrcweir SetParentClipMode( PARENTCLIPMODE_NOCLIP ); 720*cdf0e10cSrcweir SetPaintTransparent( sal_True ); 721*cdf0e10cSrcweir SetBackground(); 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir else 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir EnableChildTransparentMode( sal_False ); 726*cdf0e10cSrcweir SetParentClipMode( 0 ); 727*cdf0e10cSrcweir SetPaintTransparent( sal_False ); 728*cdf0e10cSrcweir 729*cdf0e10cSrcweir if ( IsControlBackground() ) 730*cdf0e10cSrcweir SetBackground( GetControlBackground() ); 731*cdf0e10cSrcweir else 732*cdf0e10cSrcweir SetBackground( pParent->GetBackground() ); 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir // ----------------------------------------------------------------------- 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir void FixedBitmap::ImplLoadRes( const ResId& rResId ) 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir Control::ImplLoadRes( rResId ); 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir sal_uLong nObjMask = ReadLongRes(); 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir if ( RSC_FIXEDBITMAP_BITMAP & nObjMask ) 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir maBitmap = Bitmap( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); 747*cdf0e10cSrcweir IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir } 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir // ----------------------------------------------------------------------- 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir FixedBitmap::FixedBitmap( Window* pParent, WinBits nStyle ) : 754*cdf0e10cSrcweir Control( WINDOW_FIXEDBITMAP ) 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 757*cdf0e10cSrcweir } 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir // ----------------------------------------------------------------------- 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir FixedBitmap::FixedBitmap( Window* pParent, const ResId& rResId ) : 762*cdf0e10cSrcweir Control( WINDOW_FIXEDBITMAP ) 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir rResId.SetRT( RSC_FIXEDBITMAP ); 765*cdf0e10cSrcweir WinBits nStyle = ImplInitRes( rResId ); 766*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 767*cdf0e10cSrcweir ImplLoadRes( rResId ); 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir if ( !(nStyle & WB_HIDE) ) 770*cdf0e10cSrcweir Show(); 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir // ----------------------------------------------------------------------- 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir FixedBitmap::~FixedBitmap() 776*cdf0e10cSrcweir { 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir // ----------------------------------------------------------------------- 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */, 782*cdf0e10cSrcweir const Point& rPos, const Size& rSize ) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir sal_uInt16 nStyle = 0; 785*cdf0e10cSrcweir Bitmap* pBitmap = &maBitmap; 786*cdf0e10cSrcweir Color aCol; 787*cdf0e10cSrcweir if( !!maBitmapHC ) 788*cdf0e10cSrcweir { 789*cdf0e10cSrcweir if( GetSettings().GetStyleSettings().GetHighContrastMode() ) 790*cdf0e10cSrcweir pBitmap = &maBitmapHC; 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir if( nStyle & IMAGE_DRAW_COLORTRANSFORM ) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir // only images support IMAGE_DRAW_COLORTRANSFORM 796*cdf0e10cSrcweir Image aImage( maBitmap ); 797*cdf0e10cSrcweir if ( !(!aImage) ) 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir if ( GetStyle() & WB_SCALE ) 800*cdf0e10cSrcweir pDev->DrawImage( rPos, rSize, aImage, nStyle ); 801*cdf0e10cSrcweir else 802*cdf0e10cSrcweir { 803*cdf0e10cSrcweir Point aPos = ImplCalcPos( GetStyle(), rPos, aImage.GetSizePixel(), rSize ); 804*cdf0e10cSrcweir pDev->DrawImage( aPos, aImage, nStyle ); 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir } 808*cdf0e10cSrcweir else 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir // Haben wir ueberhaupt eine Bitmap 811*cdf0e10cSrcweir if ( !(!(*pBitmap)) ) 812*cdf0e10cSrcweir { 813*cdf0e10cSrcweir if ( GetStyle() & WB_SCALE ) 814*cdf0e10cSrcweir pDev->DrawBitmap( rPos, rSize, *pBitmap ); 815*cdf0e10cSrcweir else 816*cdf0e10cSrcweir { 817*cdf0e10cSrcweir Point aPos = ImplCalcPos( GetStyle(), rPos, pBitmap->GetSizePixel(), rSize ); 818*cdf0e10cSrcweir pDev->DrawBitmap( aPos, *pBitmap ); 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir } 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir 824*cdf0e10cSrcweir // ----------------------------------------------------------------------- 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir void FixedBitmap::Paint( const Rectangle& ) 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir ImplDraw( this, 0, Point(), GetOutputSizePixel() ); 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir // ----------------------------------------------------------------------- 832*cdf0e10cSrcweir 833*cdf0e10cSrcweir void FixedBitmap::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, 834*cdf0e10cSrcweir sal_uLong nFlags ) 835*cdf0e10cSrcweir { 836*cdf0e10cSrcweir Point aPos = pDev->LogicToPixel( rPos ); 837*cdf0e10cSrcweir Size aSize = pDev->LogicToPixel( rSize ); 838*cdf0e10cSrcweir Rectangle aRect( aPos, aSize ); 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir pDev->Push(); 841*cdf0e10cSrcweir pDev->SetMapMode(); 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir // Border 844*cdf0e10cSrcweir if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) ) 845*cdf0e10cSrcweir { 846*cdf0e10cSrcweir DecorationView aDecoView( pDev ); 847*cdf0e10cSrcweir aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN ); 848*cdf0e10cSrcweir } 849*cdf0e10cSrcweir pDev->IntersectClipRegion( aRect ); 850*cdf0e10cSrcweir ImplDraw( pDev, nFlags, aRect.TopLeft(), aRect.GetSize() ); 851*cdf0e10cSrcweir 852*cdf0e10cSrcweir pDev->Pop(); 853*cdf0e10cSrcweir } 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir // ----------------------------------------------------------------------- 856*cdf0e10cSrcweir 857*cdf0e10cSrcweir void FixedBitmap::Resize() 858*cdf0e10cSrcweir { 859*cdf0e10cSrcweir Control::Resize(); 860*cdf0e10cSrcweir Invalidate(); 861*cdf0e10cSrcweir } 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir // ----------------------------------------------------------------------- 864*cdf0e10cSrcweir 865*cdf0e10cSrcweir void FixedBitmap::StateChanged( StateChangedType nType ) 866*cdf0e10cSrcweir { 867*cdf0e10cSrcweir Control::StateChanged( nType ); 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir if ( (nType == STATE_CHANGE_DATA) || 870*cdf0e10cSrcweir (nType == STATE_CHANGE_UPDATEMODE) ) 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir if ( IsReallyVisible() && IsUpdateMode() ) 873*cdf0e10cSrcweir Invalidate(); 874*cdf0e10cSrcweir } 875*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_STYLE ) 876*cdf0e10cSrcweir { 877*cdf0e10cSrcweir SetStyle( ImplInitStyle( GetStyle() ) ); 878*cdf0e10cSrcweir if ( (GetPrevStyle() & FIXEDBITMAP_VIEW_STYLE) != 879*cdf0e10cSrcweir (GetStyle() & FIXEDBITMAP_VIEW_STYLE) ) 880*cdf0e10cSrcweir Invalidate(); 881*cdf0e10cSrcweir } 882*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir ImplInitSettings(); 885*cdf0e10cSrcweir Invalidate(); 886*cdf0e10cSrcweir } 887*cdf0e10cSrcweir } 888*cdf0e10cSrcweir 889*cdf0e10cSrcweir // ----------------------------------------------------------------------- 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt ) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir Control::DataChanged( rDCEvt ); 894*cdf0e10cSrcweir 895*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 896*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir ImplInitSettings(); 899*cdf0e10cSrcweir Invalidate(); 900*cdf0e10cSrcweir } 901*cdf0e10cSrcweir } 902*cdf0e10cSrcweir 903*cdf0e10cSrcweir // ----------------------------------------------------------------------- 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir void FixedBitmap::SetBitmap( const Bitmap& rBitmap ) 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir maBitmap = rBitmap; 908*cdf0e10cSrcweir StateChanged( STATE_CHANGE_DATA ); 909*cdf0e10cSrcweir } 910*cdf0e10cSrcweir 911*cdf0e10cSrcweir // ----------------------------------------------------------------------- 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir sal_Bool FixedBitmap::SetModeBitmap( const Bitmap& rBitmap, BmpColorMode eMode ) 914*cdf0e10cSrcweir { 915*cdf0e10cSrcweir if( eMode == BMP_COLOR_NORMAL ) 916*cdf0e10cSrcweir SetBitmap( rBitmap ); 917*cdf0e10cSrcweir else if( eMode == BMP_COLOR_HIGHCONTRAST ) 918*cdf0e10cSrcweir { 919*cdf0e10cSrcweir maBitmapHC = rBitmap; 920*cdf0e10cSrcweir StateChanged( STATE_CHANGE_DATA ); 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir else 923*cdf0e10cSrcweir return sal_False; 924*cdf0e10cSrcweir return sal_True; 925*cdf0e10cSrcweir } 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir // ----------------------------------------------------------------------- 928*cdf0e10cSrcweir 929*cdf0e10cSrcweir const Bitmap& FixedBitmap::GetModeBitmap( BmpColorMode eMode) const 930*cdf0e10cSrcweir { 931*cdf0e10cSrcweir if( eMode == BMP_COLOR_HIGHCONTRAST ) 932*cdf0e10cSrcweir return maBitmapHC; 933*cdf0e10cSrcweir else 934*cdf0e10cSrcweir return maBitmap; 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir 937*cdf0e10cSrcweir // ======================================================================= 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir void FixedImage::ImplInit( Window* pParent, WinBits nStyle ) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir nStyle = ImplInitStyle( nStyle ); 942*cdf0e10cSrcweir mbInUserDraw = sal_False; 943*cdf0e10cSrcweir Control::ImplInit( pParent, nStyle, NULL ); 944*cdf0e10cSrcweir ImplInitSettings(); 945*cdf0e10cSrcweir } 946*cdf0e10cSrcweir 947*cdf0e10cSrcweir // ----------------------------------------------------------------------- 948*cdf0e10cSrcweir 949*cdf0e10cSrcweir WinBits FixedImage::ImplInitStyle( WinBits nStyle ) 950*cdf0e10cSrcweir { 951*cdf0e10cSrcweir if ( !(nStyle & WB_NOGROUP) ) 952*cdf0e10cSrcweir nStyle |= WB_GROUP; 953*cdf0e10cSrcweir return nStyle; 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir // ----------------------------------------------------------------------- 957*cdf0e10cSrcweir 958*cdf0e10cSrcweir void FixedImage::ImplInitSettings() 959*cdf0e10cSrcweir { 960*cdf0e10cSrcweir Window* pParent = GetParent(); 961*cdf0e10cSrcweir if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) 962*cdf0e10cSrcweir { 963*cdf0e10cSrcweir EnableChildTransparentMode( sal_True ); 964*cdf0e10cSrcweir SetParentClipMode( PARENTCLIPMODE_NOCLIP ); 965*cdf0e10cSrcweir SetPaintTransparent( sal_True ); 966*cdf0e10cSrcweir SetBackground(); 967*cdf0e10cSrcweir } 968*cdf0e10cSrcweir else 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir EnableChildTransparentMode( sal_False ); 971*cdf0e10cSrcweir SetParentClipMode( 0 ); 972*cdf0e10cSrcweir SetPaintTransparent( sal_False ); 973*cdf0e10cSrcweir 974*cdf0e10cSrcweir if ( IsControlBackground() ) 975*cdf0e10cSrcweir SetBackground( GetControlBackground() ); 976*cdf0e10cSrcweir else 977*cdf0e10cSrcweir SetBackground( pParent->GetBackground() ); 978*cdf0e10cSrcweir } 979*cdf0e10cSrcweir } 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir // ----------------------------------------------------------------------- 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir void FixedImage::ImplLoadRes( const ResId& rResId ) 984*cdf0e10cSrcweir { 985*cdf0e10cSrcweir Control::ImplLoadRes( rResId ); 986*cdf0e10cSrcweir 987*cdf0e10cSrcweir sal_uLong nObjMask = ReadLongRes(); 988*cdf0e10cSrcweir 989*cdf0e10cSrcweir if ( RSC_FIXEDIMAGE_IMAGE & nObjMask ) 990*cdf0e10cSrcweir { 991*cdf0e10cSrcweir maImage = Image( ResId( (RSHEADER_TYPE*)GetClassRes(), *rResId.GetResMgr() ) ); 992*cdf0e10cSrcweir IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir } 995*cdf0e10cSrcweir 996*cdf0e10cSrcweir // ----------------------------------------------------------------------- 997*cdf0e10cSrcweir 998*cdf0e10cSrcweir FixedImage::FixedImage( Window* pParent, WinBits nStyle ) : 999*cdf0e10cSrcweir Control( WINDOW_FIXEDIMAGE ) 1000*cdf0e10cSrcweir { 1001*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 1002*cdf0e10cSrcweir } 1003*cdf0e10cSrcweir 1004*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1005*cdf0e10cSrcweir 1006*cdf0e10cSrcweir FixedImage::FixedImage( Window* pParent, const ResId& rResId ) : 1007*cdf0e10cSrcweir Control( WINDOW_FIXEDIMAGE ) 1008*cdf0e10cSrcweir { 1009*cdf0e10cSrcweir rResId.SetRT( RSC_FIXEDIMAGE ); 1010*cdf0e10cSrcweir WinBits nStyle = ImplInitRes( rResId ); 1011*cdf0e10cSrcweir ImplInit( pParent, nStyle ); 1012*cdf0e10cSrcweir ImplLoadRes( rResId ); 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir if ( !(nStyle & WB_HIDE) ) 1015*cdf0e10cSrcweir Show(); 1016*cdf0e10cSrcweir } 1017*cdf0e10cSrcweir 1018*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1019*cdf0e10cSrcweir 1020*cdf0e10cSrcweir FixedImage::~FixedImage() 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir } 1023*cdf0e10cSrcweir 1024*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags, 1027*cdf0e10cSrcweir const Point& rPos, const Size& rSize ) 1028*cdf0e10cSrcweir { 1029*cdf0e10cSrcweir sal_uInt16 nStyle = 0; 1030*cdf0e10cSrcweir if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) ) 1031*cdf0e10cSrcweir { 1032*cdf0e10cSrcweir if ( !IsEnabled() ) 1033*cdf0e10cSrcweir nStyle |= IMAGE_DRAW_DISABLE; 1034*cdf0e10cSrcweir } 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir Image *pImage = &maImage; 1037*cdf0e10cSrcweir Color aCol; 1038*cdf0e10cSrcweir if( !!maImageHC ) 1039*cdf0e10cSrcweir { 1040*cdf0e10cSrcweir if( GetSettings().GetStyleSettings().GetHighContrastMode() ) 1041*cdf0e10cSrcweir pImage = &maImageHC; 1042*cdf0e10cSrcweir } 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir // Haben wir ueberhaupt ein Image 1045*cdf0e10cSrcweir if ( !(!(*pImage)) ) 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir if ( GetStyle() & WB_SCALE ) 1048*cdf0e10cSrcweir pDev->DrawImage( rPos, rSize, *pImage, nStyle ); 1049*cdf0e10cSrcweir else 1050*cdf0e10cSrcweir { 1051*cdf0e10cSrcweir Point aPos = ImplCalcPos( GetStyle(), rPos, pImage->GetSizePixel(), rSize ); 1052*cdf0e10cSrcweir pDev->DrawImage( aPos, *pImage, nStyle ); 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir } 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir mbInUserDraw = sal_True; 1057*cdf0e10cSrcweir UserDrawEvent aUDEvt( pDev, Rectangle( rPos, rSize ), 0, nStyle ); 1058*cdf0e10cSrcweir UserDraw( aUDEvt ); 1059*cdf0e10cSrcweir mbInUserDraw = sal_False; 1060*cdf0e10cSrcweir } 1061*cdf0e10cSrcweir 1062*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1063*cdf0e10cSrcweir 1064*cdf0e10cSrcweir void FixedImage::Paint( const Rectangle& ) 1065*cdf0e10cSrcweir { 1066*cdf0e10cSrcweir ImplDraw( this, 0, Point(), GetOutputSizePixel() ); 1067*cdf0e10cSrcweir } 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1070*cdf0e10cSrcweir 1071*cdf0e10cSrcweir Size FixedImage::GetOptimalSize( WindowSizeType ) const 1072*cdf0e10cSrcweir { 1073*cdf0e10cSrcweir const Image* pImage = GetSettings().GetStyleSettings().GetHighContrastMode() ? &maImageHC : &maImage; 1074*cdf0e10cSrcweir return pImage->GetSizePixel(); 1075*cdf0e10cSrcweir } 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1078*cdf0e10cSrcweir 1079*cdf0e10cSrcweir void FixedImage::UserDraw( const UserDrawEvent& ) 1080*cdf0e10cSrcweir { 1081*cdf0e10cSrcweir } 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir void FixedImage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, 1086*cdf0e10cSrcweir sal_uLong nFlags ) 1087*cdf0e10cSrcweir { 1088*cdf0e10cSrcweir Point aPos = pDev->LogicToPixel( rPos ); 1089*cdf0e10cSrcweir Size aSize = pDev->LogicToPixel( rSize ); 1090*cdf0e10cSrcweir Rectangle aRect( aPos, aSize ); 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir pDev->Push(); 1093*cdf0e10cSrcweir pDev->SetMapMode(); 1094*cdf0e10cSrcweir 1095*cdf0e10cSrcweir // Border 1096*cdf0e10cSrcweir if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) ) 1097*cdf0e10cSrcweir { 1098*cdf0e10cSrcweir ImplDrawFrame( pDev, aRect ); 1099*cdf0e10cSrcweir } 1100*cdf0e10cSrcweir pDev->IntersectClipRegion( aRect ); 1101*cdf0e10cSrcweir ImplDraw( pDev, nFlags, aRect.TopLeft(), aRect.GetSize() ); 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir pDev->Pop(); 1104*cdf0e10cSrcweir } 1105*cdf0e10cSrcweir 1106*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir void FixedImage::Resize() 1109*cdf0e10cSrcweir { 1110*cdf0e10cSrcweir Control::Resize(); 1111*cdf0e10cSrcweir Invalidate(); 1112*cdf0e10cSrcweir } 1113*cdf0e10cSrcweir 1114*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1115*cdf0e10cSrcweir 1116*cdf0e10cSrcweir void FixedImage::StateChanged( StateChangedType nType ) 1117*cdf0e10cSrcweir { 1118*cdf0e10cSrcweir Control::StateChanged( nType ); 1119*cdf0e10cSrcweir 1120*cdf0e10cSrcweir if ( (nType == STATE_CHANGE_ENABLE) || 1121*cdf0e10cSrcweir (nType == STATE_CHANGE_DATA) || 1122*cdf0e10cSrcweir (nType == STATE_CHANGE_UPDATEMODE) ) 1123*cdf0e10cSrcweir { 1124*cdf0e10cSrcweir if ( IsReallyVisible() && IsUpdateMode() ) 1125*cdf0e10cSrcweir Invalidate(); 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_STYLE ) 1128*cdf0e10cSrcweir { 1129*cdf0e10cSrcweir SetStyle( ImplInitStyle( GetStyle() ) ); 1130*cdf0e10cSrcweir if ( (GetPrevStyle() & FIXEDIMAGE_VIEW_STYLE) != 1131*cdf0e10cSrcweir (GetStyle() & FIXEDIMAGE_VIEW_STYLE) ) 1132*cdf0e10cSrcweir Invalidate(); 1133*cdf0e10cSrcweir } 1134*cdf0e10cSrcweir else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) 1135*cdf0e10cSrcweir { 1136*cdf0e10cSrcweir ImplInitSettings(); 1137*cdf0e10cSrcweir Invalidate(); 1138*cdf0e10cSrcweir } 1139*cdf0e10cSrcweir } 1140*cdf0e10cSrcweir 1141*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1142*cdf0e10cSrcweir 1143*cdf0e10cSrcweir void FixedImage::DataChanged( const DataChangedEvent& rDCEvt ) 1144*cdf0e10cSrcweir { 1145*cdf0e10cSrcweir Control::DataChanged( rDCEvt ); 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 1148*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 1149*cdf0e10cSrcweir { 1150*cdf0e10cSrcweir ImplInitSettings(); 1151*cdf0e10cSrcweir Invalidate(); 1152*cdf0e10cSrcweir } 1153*cdf0e10cSrcweir } 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir void FixedImage::SetImage( const Image& rImage ) 1158*cdf0e10cSrcweir { 1159*cdf0e10cSrcweir if ( rImage != maImage ) 1160*cdf0e10cSrcweir { 1161*cdf0e10cSrcweir maImage = rImage; 1162*cdf0e10cSrcweir StateChanged( STATE_CHANGE_DATA ); 1163*cdf0e10cSrcweir } 1164*cdf0e10cSrcweir } 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1167*cdf0e10cSrcweir 1168*cdf0e10cSrcweir sal_Bool FixedImage::SetModeImage( const Image& rImage, BmpColorMode eMode ) 1169*cdf0e10cSrcweir { 1170*cdf0e10cSrcweir if( eMode == BMP_COLOR_NORMAL ) 1171*cdf0e10cSrcweir SetImage( rImage ); 1172*cdf0e10cSrcweir else if( eMode == BMP_COLOR_HIGHCONTRAST ) 1173*cdf0e10cSrcweir { 1174*cdf0e10cSrcweir if( maImageHC != rImage ) 1175*cdf0e10cSrcweir { 1176*cdf0e10cSrcweir maImageHC = rImage; 1177*cdf0e10cSrcweir StateChanged( STATE_CHANGE_DATA ); 1178*cdf0e10cSrcweir } 1179*cdf0e10cSrcweir } 1180*cdf0e10cSrcweir else 1181*cdf0e10cSrcweir return sal_False; 1182*cdf0e10cSrcweir return sal_True; 1183*cdf0e10cSrcweir } 1184*cdf0e10cSrcweir 1185*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1186*cdf0e10cSrcweir 1187*cdf0e10cSrcweir const Image& FixedImage::GetModeImage( BmpColorMode eMode ) const 1188*cdf0e10cSrcweir { 1189*cdf0e10cSrcweir if( eMode == BMP_COLOR_HIGHCONTRAST ) 1190*cdf0e10cSrcweir return maImageHC; 1191*cdf0e10cSrcweir else 1192*cdf0e10cSrcweir return maImage; 1193*cdf0e10cSrcweir } 1194*cdf0e10cSrcweir 1195*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1196*cdf0e10cSrcweir 1197*cdf0e10cSrcweir Point FixedImage::CalcImagePos( const Point& rPos, 1198*cdf0e10cSrcweir const Size& rObjSize, const Size& rWinSize ) 1199*cdf0e10cSrcweir { 1200*cdf0e10cSrcweir return ImplCalcPos( GetStyle(), rPos, rObjSize, rWinSize ); 1201*cdf0e10cSrcweir } 1202