1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3*cdf0e10cSrcweir * 4*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * This file is part of OpenOffice.org. 9*cdf0e10cSrcweir * 10*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 11*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 12*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 13*cdf0e10cSrcweir * 14*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 15*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 16*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 18*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 19*cdf0e10cSrcweir * 20*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 21*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 22*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 23*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 24*cdf0e10cSrcweir * 25*cdf0e10cSrcweir ************************************************************************/ 26*cdf0e10cSrcweir 27*cdf0e10cSrcweir #include "precompiled_svtools.hxx" 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir #include "toolpaneldrawer.hxx" 30*cdf0e10cSrcweir #include "toolpaneldrawerpeer.hxx" 31*cdf0e10cSrcweir #include "svtools/svtdata.hxx" 32*cdf0e10cSrcweir #include "svtools/svtools.hrc" 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <vcl/lineinfo.hxx> 37*cdf0e10cSrcweir #include <vcl/image.hxx> 38*cdf0e10cSrcweir #include <vcl/svapp.hxx> 39*cdf0e10cSrcweir #include <vcl/vclevent.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir //...................................................................................................................... 42*cdf0e10cSrcweir namespace svt 43*cdf0e10cSrcweir { 44*cdf0e10cSrcweir //...................................................................................................................... 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 47*cdf0e10cSrcweir using ::com::sun::star::awt::XWindowPeer; 48*cdf0e10cSrcweir namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir static const int s_nIndentationWidth = 16; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir //================================================================================================================== 53*cdf0e10cSrcweir //= DrawerVisualization 54*cdf0e10cSrcweir //================================================================================================================== 55*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 56*cdf0e10cSrcweir DrawerVisualization::DrawerVisualization( ToolPanelDrawer& i_rParent ) 57*cdf0e10cSrcweir :Window( &i_rParent ) 58*cdf0e10cSrcweir ,m_rDrawer( i_rParent ) 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir SetMouseTransparent( sal_True ); 61*cdf0e10cSrcweir Show(); 62*cdf0e10cSrcweir SetAccessibleRole( AccessibleRole::LABEL ); 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 66*cdf0e10cSrcweir DrawerVisualization::~DrawerVisualization() 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir } 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 71*cdf0e10cSrcweir void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox ) 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir Window::Paint( i_rBoundingBox ); 74*cdf0e10cSrcweir m_rDrawer.Paint(); 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir //================================================================================================================== 78*cdf0e10cSrcweir //= ToolPanelDrawer 79*cdf0e10cSrcweir //================================================================================================================== 80*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 81*cdf0e10cSrcweir ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle ) 82*cdf0e10cSrcweir :Window( &i_rParent, WB_TABSTOP ) 83*cdf0e10cSrcweir ,m_pPaintDevice( new VirtualDevice( *this ) ) 84*cdf0e10cSrcweir ,m_aVisualization( *this ) 85*cdf0e10cSrcweir ,m_bFocused( false ) 86*cdf0e10cSrcweir ,m_bExpanded( false ) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir EnableMapMode( sal_False ); 89*cdf0e10cSrcweir SetBackground( Wallpaper() ); 90*cdf0e10cSrcweir SetPointer( POINTER_REFHAND ); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir SetAccessibleRole( AccessibleRole::LIST_ITEM ); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir SetText( i_rTitle ); 95*cdf0e10cSrcweir SetAccessibleName( i_rTitle ); 96*cdf0e10cSrcweir SetAccessibleDescription( i_rTitle ); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir m_aVisualization.SetAccessibleName( i_rTitle ); 99*cdf0e10cSrcweir m_aVisualization.SetAccessibleDescription( i_rTitle ); 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 103*cdf0e10cSrcweir ToolPanelDrawer::~ToolPanelDrawer() 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 108*cdf0e10cSrcweir long ToolPanelDrawer::GetPreferredHeightPixel() const 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir Rectangle aTitleBarBox( impl_calcTitleBarBox( impl_calcTextBoundingBox() ) ); 111*cdf0e10cSrcweir return aTitleBarBox.GetHeight(); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 115*cdf0e10cSrcweir void ToolPanelDrawer::Paint() 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir m_pPaintDevice->SetMapMode( GetMapMode() ); 118*cdf0e10cSrcweir m_pPaintDevice->SetOutputSize( GetOutputSizePixel() ); 119*cdf0e10cSrcweir m_pPaintDevice->SetSettings( GetSettings() ); 120*cdf0e10cSrcweir m_pPaintDevice->SetDrawMode( GetDrawMode() ); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir const Rectangle aTextBox( impl_calcTextBoundingBox() ); 123*cdf0e10cSrcweir impl_paintBackground( impl_calcTitleBarBox( aTextBox ) ); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir Rectangle aFocusBox( impl_paintExpansionIndicator( aTextBox ) ); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir m_pPaintDevice->DrawText( aTextBox, GetText(), impl_getTextStyle() ); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir aFocusBox.Union( aTextBox ); 130*cdf0e10cSrcweir aFocusBox.Left() += 2; 131*cdf0e10cSrcweir impl_paintFocusIndicator( aFocusBox ); 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir m_aVisualization.DrawOutDev( 134*cdf0e10cSrcweir Point(), GetOutputSizePixel(), 135*cdf0e10cSrcweir Point(), GetOutputSizePixel(), 136*cdf0e10cSrcweir *m_pPaintDevice 137*cdf0e10cSrcweir ); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 141*cdf0e10cSrcweir Rectangle ToolPanelDrawer::impl_paintExpansionIndicator( const Rectangle& i_rTextBox ) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir Rectangle aExpansionIndicatorArea; 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir Image aImage( impl_getExpansionIndicator() ); 146*cdf0e10cSrcweir const int nHeight( aImage.GetSizePixel().Height() ); 147*cdf0e10cSrcweir if ( nHeight > 0 ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir Point aPosition( 150*cdf0e10cSrcweir 0, 151*cdf0e10cSrcweir i_rTextBox.Top() + ( GetTextHeight() - nHeight ) / 2 152*cdf0e10cSrcweir ); 153*cdf0e10cSrcweir m_pPaintDevice->DrawImage( aPosition, aImage ); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir aExpansionIndicatorArea = Rectangle( aPosition, aImage.GetSizePixel() ); 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir return aExpansionIndicatorArea; 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 162*cdf0e10cSrcweir Image ToolPanelDrawer::impl_getExpansionIndicator() const 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir const bool bHighContrastMode( GetSettings().GetStyleSettings().GetHighContrastMode() != 0 ); 165*cdf0e10cSrcweir sal_uInt16 nResourceId = 0; 166*cdf0e10cSrcweir if ( m_bExpanded ) 167*cdf0e10cSrcweir if ( bHighContrastMode ) 168*cdf0e10cSrcweir nResourceId = IMG_TRIANGLE_DOWN_HC; 169*cdf0e10cSrcweir else 170*cdf0e10cSrcweir nResourceId = IMG_TRIANGLE_DOWN; 171*cdf0e10cSrcweir else 172*cdf0e10cSrcweir if ( bHighContrastMode ) 173*cdf0e10cSrcweir nResourceId = IMG_TRIANGLE_RIGHT_HC; 174*cdf0e10cSrcweir else 175*cdf0e10cSrcweir nResourceId = IMG_TRIANGLE_RIGHT; 176*cdf0e10cSrcweir return Image( SvtResId( nResourceId ) ); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 180*cdf0e10cSrcweir sal_uInt16 ToolPanelDrawer::impl_getTextStyle() const 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir const sal_uInt16 nBasicStyle = TEXT_DRAW_LEFT 183*cdf0e10cSrcweir | TEXT_DRAW_TOP 184*cdf0e10cSrcweir | TEXT_DRAW_WORDBREAK; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir if ( IsEnabled() ) 187*cdf0e10cSrcweir return nBasicStyle; 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir return nBasicStyle | TEXT_DRAW_DISABLE; 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 193*cdf0e10cSrcweir void ToolPanelDrawer::impl_paintBackground( const Rectangle& i_rTitleBarBox ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir m_pPaintDevice->SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); 196*cdf0e10cSrcweir m_pPaintDevice->DrawRect( i_rTitleBarBox ); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir m_pPaintDevice->SetFillColor(); 199*cdf0e10cSrcweir m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetLightColor() ); 200*cdf0e10cSrcweir m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.TopRight() ); 201*cdf0e10cSrcweir m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.BottomLeft() ); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); 204*cdf0e10cSrcweir m_pPaintDevice->DrawLine( i_rTitleBarBox.BottomLeft(), i_rTitleBarBox.BottomRight() ); 205*cdf0e10cSrcweir m_pPaintDevice->DrawLine( i_rTitleBarBox.TopRight(), i_rTitleBarBox.BottomRight() ); 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 209*cdf0e10cSrcweir void ToolPanelDrawer::impl_paintFocusIndicator( const Rectangle& i_rTextBox ) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir if ( m_bFocused ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir const Rectangle aTextPixelBox( m_pPaintDevice->LogicToPixel( i_rTextBox ) ); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir m_pPaintDevice->EnableMapMode( sal_False ); 216*cdf0e10cSrcweir m_pPaintDevice->SetFillColor(); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir Rectangle aBox( i_rTextBox ); 219*cdf0e10cSrcweir aBox.Top() -= 1; 220*cdf0e10cSrcweir aBox.Bottom() += 1; 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir m_pPaintDevice->DrawRect( aTextPixelBox ); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir LineInfo aDottedStyle( LINE_DASH ); 225*cdf0e10cSrcweir aDottedStyle.SetDashCount( 0 ); 226*cdf0e10cSrcweir aDottedStyle.SetDotCount( 1 ); 227*cdf0e10cSrcweir aDottedStyle.SetDotLen( 1 ); 228*cdf0e10cSrcweir aDottedStyle.SetDistance( 1 ); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir m_pPaintDevice->SetLineColor( COL_BLACK ); 231*cdf0e10cSrcweir m_pPaintDevice->DrawPolyLine( Polygon( aTextPixelBox ), aDottedStyle ); 232*cdf0e10cSrcweir m_pPaintDevice->EnableMapMode( sal_False ); 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir else 235*cdf0e10cSrcweir HideFocus(); 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 239*cdf0e10cSrcweir void ToolPanelDrawer::GetFocus() 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir m_bFocused = true; 242*cdf0e10cSrcweir Invalidate(); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 246*cdf0e10cSrcweir void ToolPanelDrawer::LoseFocus() 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir m_bFocused = false; 249*cdf0e10cSrcweir Invalidate(); 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 253*cdf0e10cSrcweir void ToolPanelDrawer::Resize() 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir Window::Resize(); 256*cdf0e10cSrcweir m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() ); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 260*cdf0e10cSrcweir void ToolPanelDrawer::MouseButtonDown( const MouseEvent& i_rMouseEvent ) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir // consume this event, and do not forward to the base class - it would sent a NotifyEvent, which in turn, when 263*cdf0e10cSrcweir // we live in a DockingWindow, would start undocking 264*cdf0e10cSrcweir (void)i_rMouseEvent; 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 268*cdf0e10cSrcweir void ToolPanelDrawer::DataChanged( const DataChangedEvent& i_rEvent ) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir Window::DataChanged( i_rEvent ); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir switch ( i_rEvent.GetType() ) 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir case DATACHANGED_SETTINGS: 275*cdf0e10cSrcweir if ( ( i_rEvent.GetFlags() & SETTINGS_STYLE ) == 0 ) 276*cdf0e10cSrcweir break; 277*cdf0e10cSrcweir SetSettings( Application::GetSettings() ); 278*cdf0e10cSrcweir m_pPaintDevice.reset( new VirtualDevice( *this ) ); 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir // fall through. 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir case DATACHANGED_FONTS: 283*cdf0e10cSrcweir case DATACHANGED_FONTSUBSTITUTION: 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir // Font. 288*cdf0e10cSrcweir Font aFont = rStyleSettings.GetAppFont(); 289*cdf0e10cSrcweir if ( IsControlFont() ) 290*cdf0e10cSrcweir aFont.Merge( GetControlFont() ); 291*cdf0e10cSrcweir SetZoomedPointFont( aFont ); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir // Color. 294*cdf0e10cSrcweir Color aColor; 295*cdf0e10cSrcweir if ( IsControlForeground() ) 296*cdf0e10cSrcweir aColor = GetControlForeground(); 297*cdf0e10cSrcweir else 298*cdf0e10cSrcweir aColor = rStyleSettings.GetButtonTextColor(); 299*cdf0e10cSrcweir SetTextColor( aColor ); 300*cdf0e10cSrcweir SetTextFillColor(); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir Invalidate(); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir break; 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 309*cdf0e10cSrcweir Reference< XWindowPeer > ToolPanelDrawer::GetComponentInterface( sal_Bool i_bCreate ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir Reference< XWindowPeer > xWindowPeer( Window::GetComponentInterface( sal_False ) ); 312*cdf0e10cSrcweir if ( !xWindowPeer.is() && i_bCreate ) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir xWindowPeer.set( new ToolPanelDrawerPeer() ); 315*cdf0e10cSrcweir SetComponentInterface( xWindowPeer ); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir return xWindowPeer; 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 321*cdf0e10cSrcweir Rectangle ToolPanelDrawer::impl_calcTextBoundingBox() const 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir Font aFont( GetFont() ); 324*cdf0e10cSrcweir if ( m_bExpanded ) 325*cdf0e10cSrcweir aFont.SetWeight( m_bExpanded ? WEIGHT_BOLD : WEIGHT_NORMAL ); 326*cdf0e10cSrcweir m_pPaintDevice->SetFont( aFont ); 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir int nAvailableWidth = m_pPaintDevice->GetTextWidth( GetText() ); 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir Rectangle aTextBox( 331*cdf0e10cSrcweir Point(), 332*cdf0e10cSrcweir Size( 333*cdf0e10cSrcweir nAvailableWidth, 334*cdf0e10cSrcweir GetSettings().GetStyleSettings().GetTitleHeight() 335*cdf0e10cSrcweir ) 336*cdf0e10cSrcweir ); 337*cdf0e10cSrcweir aTextBox.Top() += ( aTextBox.GetHeight() - GetTextHeight() ) / 2; 338*cdf0e10cSrcweir aTextBox.Left() += s_nIndentationWidth; 339*cdf0e10cSrcweir aTextBox.Right() -= 1; 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir aTextBox = m_pPaintDevice->GetTextRect( aTextBox, GetText(), impl_getTextStyle() ); 342*cdf0e10cSrcweir return aTextBox; 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 346*cdf0e10cSrcweir Rectangle ToolPanelDrawer::impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir Rectangle aTitleBarBox( i_rTextBox ); 349*cdf0e10cSrcweir aTitleBarBox.Bottom() += aTitleBarBox.Top(); 350*cdf0e10cSrcweir aTitleBarBox.Top() = 0; 351*cdf0e10cSrcweir aTitleBarBox.Left() = 0; 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir const long nWidth = GetOutputSizePixel().Width(); 354*cdf0e10cSrcweir if ( aTitleBarBox.GetWidth() < nWidth ) 355*cdf0e10cSrcweir aTitleBarBox.Right() = nWidth - 1; 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir return aTitleBarBox; 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ 361*cdf0e10cSrcweir void ToolPanelDrawer::SetExpanded( const bool i_bExpanded ) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir if ( m_bExpanded != i_bExpanded ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir m_bExpanded = i_bExpanded; 366*cdf0e10cSrcweir CallEventListeners( m_bExpanded ? VCLEVENT_ITEM_EXPANDED : VCLEVENT_ITEM_COLLAPSED ); 367*cdf0e10cSrcweir Invalidate(); 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir //...................................................................................................................... 372*cdf0e10cSrcweir } // namespace svt 373*cdf0e10cSrcweir //...................................................................................................................... 374