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