xref: /AOO41X/main/vcl/source/window/status.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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/list.hxx>
32*cdf0e10cSrcweir #include <tools/debug.hxx>
33*cdf0e10cSrcweir #include <tools/rc.h>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <vcl/event.hxx>
36*cdf0e10cSrcweir #include <vcl/decoview.hxx>
37*cdf0e10cSrcweir #include <vcl/svapp.hxx>
38*cdf0e10cSrcweir #include <vcl/help.hxx>
39*cdf0e10cSrcweir #include <vcl/status.hxx>
40*cdf0e10cSrcweir #include <vcl/virdev.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <svdata.hxx>
43*cdf0e10cSrcweir #include <window.h>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir // =======================================================================
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #define STATUSBAR_OFFSET_X		STATUSBAR_OFFSET
48*cdf0e10cSrcweir #define STATUSBAR_OFFSET_Y		2
49*cdf0e10cSrcweir #define STATUSBAR_OFFSET_TEXTY	3
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir #define STATUSBAR_PRGS_OFFSET	3
52*cdf0e10cSrcweir #define STATUSBAR_PRGS_COUNT	100
53*cdf0e10cSrcweir #define STATUSBAR_PRGS_MIN		5
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir // -----------------------------------------------------------------------
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir class StatusBar::ImplData
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir public:
60*cdf0e10cSrcweir     ImplData();
61*cdf0e10cSrcweir     ~ImplData();
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir     VirtualDevice*		mpVirDev;
64*cdf0e10cSrcweir     long                mnItemBorderWidth;
65*cdf0e10cSrcweir     bool                mbTopBorder:1;
66*cdf0e10cSrcweir     bool                mbDrawItemFrames:1;
67*cdf0e10cSrcweir };
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir StatusBar::ImplData::ImplData()
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir     mpVirDev = NULL;
72*cdf0e10cSrcweir     mbTopBorder = false;
73*cdf0e10cSrcweir     mbDrawItemFrames = false;
74*cdf0e10cSrcweir     mnItemBorderWidth = 0;
75*cdf0e10cSrcweir }
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir StatusBar::ImplData::~ImplData()
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir }
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir struct ImplStatusItem
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir 	sal_uInt16				mnId;
84*cdf0e10cSrcweir 	StatusBarItemBits	mnBits;
85*cdf0e10cSrcweir 	long				mnWidth;
86*cdf0e10cSrcweir 	long				mnOffset;
87*cdf0e10cSrcweir 	long				mnExtraWidth;
88*cdf0e10cSrcweir 	long				mnX;
89*cdf0e10cSrcweir 	XubString			maText;
90*cdf0e10cSrcweir 	XubString			maHelpText;
91*cdf0e10cSrcweir 	XubString			maQuickHelpText;
92*cdf0e10cSrcweir 	rtl::OString		maHelpId;
93*cdf0e10cSrcweir 	void*				mpUserData;
94*cdf0e10cSrcweir 	sal_Bool				mbVisible;
95*cdf0e10cSrcweir 	XubString			maAccessibleName;
96*cdf0e10cSrcweir     XubString           maCommand;
97*cdf0e10cSrcweir };
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir DECLARE_LIST( ImplStatusItemList, ImplStatusItem* )
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir // =======================================================================
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir inline long ImplCalcProgessWidth( sal_uInt16 nMax, long nSize )
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir 	return ((nMax*(nSize+(nSize/2)))-(nSize/2)+(STATUSBAR_PRGS_OFFSET*2));
106*cdf0e10cSrcweir }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir // -----------------------------------------------------------------------
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir static Point ImplGetItemTextPos( const Size& rRectSize, const Size& rTextSize,
111*cdf0e10cSrcweir 								 sal_uInt16 nStyle )
112*cdf0e10cSrcweir {
113*cdf0e10cSrcweir 	long nX;
114*cdf0e10cSrcweir 	long nY;
115*cdf0e10cSrcweir     long delta = (rTextSize.Height()/4) + 1;
116*cdf0e10cSrcweir     if( delta + rTextSize.Width() > rRectSize.Width() )
117*cdf0e10cSrcweir         delta = 0;
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	if ( nStyle & SIB_LEFT )
120*cdf0e10cSrcweir 		nX = delta;
121*cdf0e10cSrcweir 	else if ( nStyle & SIB_RIGHT )
122*cdf0e10cSrcweir 		nX = rRectSize.Width()-rTextSize.Width()-delta;
123*cdf0e10cSrcweir 	else // SIB_CENTER
124*cdf0e10cSrcweir 		nX = (rRectSize.Width()-rTextSize.Width())/2;
125*cdf0e10cSrcweir 	nY = (rRectSize.Height()-rTextSize.Height())/2 + 1;
126*cdf0e10cSrcweir 	return Point( nX, nY );
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir // -----------------------------------------------------------------------
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir sal_Bool StatusBar::ImplIsItemUpdate()
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir 	if ( !mbProgressMode && mbVisibleItems && IsReallyVisible() && IsUpdateMode() )
134*cdf0e10cSrcweir 		return sal_True;
135*cdf0e10cSrcweir 	else
136*cdf0e10cSrcweir 		return sal_False;
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir // -----------------------------------------------------------------------
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir void StatusBar::ImplInit( Window* pParent, WinBits nStyle )
142*cdf0e10cSrcweir {
143*cdf0e10cSrcweir     mpImplData = new ImplData;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	// Default ist RightAlign
146*cdf0e10cSrcweir 	if ( !(nStyle & (WB_LEFT | WB_RIGHT)) )
147*cdf0e10cSrcweir 		nStyle |= WB_RIGHT;
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	Window::ImplInit( pParent, nStyle & ~WB_BORDER, NULL );
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	// WinBits merken
152*cdf0e10cSrcweir 	mpItemList		= new ImplStatusItemList;
153*cdf0e10cSrcweir 	mpImplData->mpVirDev		= new VirtualDevice( *this );
154*cdf0e10cSrcweir 	mnCurItemId 	= 0;
155*cdf0e10cSrcweir 	mbFormat		= sal_True;
156*cdf0e10cSrcweir 	mbVisibleItems	= sal_True;
157*cdf0e10cSrcweir 	mbProgressMode	= sal_False;
158*cdf0e10cSrcweir 	mbInUserDraw	= sal_False;
159*cdf0e10cSrcweir 	mbBottomBorder	= sal_False;
160*cdf0e10cSrcweir     mnItemsWidth    = STATUSBAR_OFFSET_X;
161*cdf0e10cSrcweir 	mnDX			= 0;
162*cdf0e10cSrcweir 	mnDY			= 0;
163*cdf0e10cSrcweir 	mnCalcHeight	= 0;
164*cdf0e10cSrcweir 	mnItemY 		= STATUSBAR_OFFSET_Y;
165*cdf0e10cSrcweir 	mnTextY 		= STATUSBAR_OFFSET_TEXTY;
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	ImplInitSettings( sal_True, sal_True, sal_True );
168*cdf0e10cSrcweir 	SetLineColor();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir     SetOutputSizePixel( CalcWindowSizePixel() );
171*cdf0e10cSrcweir }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir // -----------------------------------------------------------------------
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir StatusBar::StatusBar( Window* pParent, WinBits nStyle ) :
176*cdf0e10cSrcweir 	Window( WINDOW_STATUSBAR )
177*cdf0e10cSrcweir {
178*cdf0e10cSrcweir 	ImplInit( pParent, nStyle );
179*cdf0e10cSrcweir }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir // -----------------------------------------------------------------------
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir StatusBar::StatusBar( Window* pParent, const ResId& rResId ) :
184*cdf0e10cSrcweir 	Window( WINDOW_STATUSBAR )
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir 	rResId.SetRT( RSC_STATUSBAR );
187*cdf0e10cSrcweir 	WinBits nStyle = ImplInitRes( rResId );
188*cdf0e10cSrcweir 	ImplInit( pParent, nStyle );
189*cdf0e10cSrcweir 	ImplLoadRes( rResId );
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir 	if ( !(nStyle & WB_HIDE) )
192*cdf0e10cSrcweir 		Show();
193*cdf0e10cSrcweir }
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir // -----------------------------------------------------------------------
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir StatusBar::~StatusBar()
198*cdf0e10cSrcweir {
199*cdf0e10cSrcweir 	// Alle Items loeschen
200*cdf0e10cSrcweir 	ImplStatusItem* pItem = mpItemList->First();
201*cdf0e10cSrcweir 	while ( pItem )
202*cdf0e10cSrcweir 	{
203*cdf0e10cSrcweir 		delete pItem;
204*cdf0e10cSrcweir 		pItem = mpItemList->Next();
205*cdf0e10cSrcweir 	}
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	delete mpItemList;
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 	// VirtualDevice loeschen
210*cdf0e10cSrcweir 	delete mpImplData->mpVirDev;
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     delete mpImplData;
213*cdf0e10cSrcweir }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir // -----------------------------------------------------------------------
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir void StatusBar::ImplInitSettings( sal_Bool bFont,
218*cdf0e10cSrcweir 								  sal_Bool bForeground, sal_Bool bBackground )
219*cdf0e10cSrcweir {
220*cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 	if ( bFont )
223*cdf0e10cSrcweir 	{
224*cdf0e10cSrcweir 		Font aFont = rStyleSettings.GetToolFont();
225*cdf0e10cSrcweir 		if ( IsControlFont() )
226*cdf0e10cSrcweir 			aFont.Merge( GetControlFont() );
227*cdf0e10cSrcweir 		SetZoomedPointFont( aFont );
228*cdf0e10cSrcweir 	}
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 	if ( bForeground || bFont )
231*cdf0e10cSrcweir 	{
232*cdf0e10cSrcweir 		Color aColor;
233*cdf0e10cSrcweir 		if ( IsControlForeground() )
234*cdf0e10cSrcweir 			aColor = GetControlForeground();
235*cdf0e10cSrcweir 		else if ( GetStyle() & WB_3DLOOK )
236*cdf0e10cSrcweir 			aColor = rStyleSettings.GetButtonTextColor();
237*cdf0e10cSrcweir 		else
238*cdf0e10cSrcweir 			aColor = rStyleSettings.GetWindowTextColor();
239*cdf0e10cSrcweir 		SetTextColor( aColor );
240*cdf0e10cSrcweir 		SetTextFillColor();
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 		mpImplData->mpVirDev->SetFont( GetFont() );
243*cdf0e10cSrcweir 		mpImplData->mpVirDev->SetTextColor( GetTextColor() );
244*cdf0e10cSrcweir 		mpImplData->mpVirDev->SetTextAlign( GetTextAlign() );
245*cdf0e10cSrcweir 		mpImplData->mpVirDev->SetTextFillColor();
246*cdf0e10cSrcweir 	}
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir 	if ( bBackground )
249*cdf0e10cSrcweir 	{
250*cdf0e10cSrcweir 		Color aColor;
251*cdf0e10cSrcweir 		if ( IsControlBackground() )
252*cdf0e10cSrcweir 			aColor = GetControlBackground();
253*cdf0e10cSrcweir 		else if ( GetStyle() & WB_3DLOOK )
254*cdf0e10cSrcweir 			aColor = rStyleSettings.GetFaceColor();
255*cdf0e10cSrcweir 		else
256*cdf0e10cSrcweir 			aColor = rStyleSettings.GetWindowColor();
257*cdf0e10cSrcweir         SetBackground( aColor );
258*cdf0e10cSrcweir         mpImplData->mpVirDev->SetBackground( GetBackground() );
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir         // NWF background
261*cdf0e10cSrcweir         if( ! IsControlBackground() &&
262*cdf0e10cSrcweir               IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_WINDOW ) )
263*cdf0e10cSrcweir         {
264*cdf0e10cSrcweir             ImplGetWindowImpl()->mnNativeBackground = PART_BACKGROUND_WINDOW;
265*cdf0e10cSrcweir             EnableChildTransparentMode( sal_True );
266*cdf0e10cSrcweir         }
267*cdf0e10cSrcweir 	}
268*cdf0e10cSrcweir }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir // -----------------------------------------------------------------------
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir void StatusBar::ImplFormat()
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir 	ImplStatusItem* pItem;
275*cdf0e10cSrcweir 	long			nExtraWidth;
276*cdf0e10cSrcweir 	long			nExtraWidth2;
277*cdf0e10cSrcweir 	long			nX;
278*cdf0e10cSrcweir 	sal_uInt16			nAutoSizeItems = 0;
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 	// Breiten zusammenrechnen
281*cdf0e10cSrcweir 	mnItemsWidth = STATUSBAR_OFFSET_X;
282*cdf0e10cSrcweir 	long nOffset = 0;
283*cdf0e10cSrcweir 	pItem = mpItemList->First();
284*cdf0e10cSrcweir 	while ( pItem )
285*cdf0e10cSrcweir 	{
286*cdf0e10cSrcweir 		if ( pItem->mbVisible )
287*cdf0e10cSrcweir 		{
288*cdf0e10cSrcweir 			if ( pItem->mnBits & SIB_AUTOSIZE )
289*cdf0e10cSrcweir 				nAutoSizeItems++;
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 			mnItemsWidth += pItem->mnWidth + nOffset;
292*cdf0e10cSrcweir 			nOffset = pItem->mnOffset;
293*cdf0e10cSrcweir 		}
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 		pItem = mpItemList->Next();
296*cdf0e10cSrcweir 	}
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 	if ( GetStyle() & WB_RIGHT )
299*cdf0e10cSrcweir 	{
300*cdf0e10cSrcweir 		// Bei rechtsbuendiger Ausrichtung wird kein AutoSize ausgewertet,
301*cdf0e10cSrcweir 		// da wir links den Text anzeigen, der mit SetText gesetzt wird
302*cdf0e10cSrcweir 		nX				= mnDX - mnItemsWidth;
303*cdf0e10cSrcweir 		nExtraWidth 	= 0;
304*cdf0e10cSrcweir 		nExtraWidth2	= 0;
305*cdf0e10cSrcweir 	}
306*cdf0e10cSrcweir 	else
307*cdf0e10cSrcweir 	{
308*cdf0e10cSrcweir 		mnItemsWidth += STATUSBAR_OFFSET_X;
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 		// Bei linksbuendiger Ausrichtung muessen wir gegebenenfalls noch
311*cdf0e10cSrcweir 		// AutoSize auswerten
312*cdf0e10cSrcweir 		if ( nAutoSizeItems && (mnDX > (mnItemsWidth - STATUSBAR_OFFSET)) )
313*cdf0e10cSrcweir 		{
314*cdf0e10cSrcweir 			nExtraWidth  = (mnDX - mnItemsWidth - 1) / nAutoSizeItems;
315*cdf0e10cSrcweir 			nExtraWidth2 = (mnDX - mnItemsWidth - 1) % nAutoSizeItems;
316*cdf0e10cSrcweir 		}
317*cdf0e10cSrcweir 		else
318*cdf0e10cSrcweir 		{
319*cdf0e10cSrcweir 			nExtraWidth  = 0;
320*cdf0e10cSrcweir 			nExtraWidth2 = 0;
321*cdf0e10cSrcweir 		}
322*cdf0e10cSrcweir 		nX = STATUSBAR_OFFSET_X;
323*cdf0e10cSrcweir 		if( ImplHasMirroredGraphics() && IsRTLEnabled() )
324*cdf0e10cSrcweir 		    nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset;
325*cdf0e10cSrcweir 	}
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 	pItem = mpItemList->First();
328*cdf0e10cSrcweir 	while ( pItem )
329*cdf0e10cSrcweir 	{
330*cdf0e10cSrcweir 		if ( pItem->mbVisible )
331*cdf0e10cSrcweir 		{
332*cdf0e10cSrcweir 			if ( pItem->mnBits & SIB_AUTOSIZE )
333*cdf0e10cSrcweir 			{
334*cdf0e10cSrcweir 				pItem->mnExtraWidth = nExtraWidth;
335*cdf0e10cSrcweir 				if ( nExtraWidth2 )
336*cdf0e10cSrcweir 				{
337*cdf0e10cSrcweir 					pItem->mnExtraWidth++;
338*cdf0e10cSrcweir 					nExtraWidth2--;
339*cdf0e10cSrcweir 				}
340*cdf0e10cSrcweir 			}
341*cdf0e10cSrcweir 			else
342*cdf0e10cSrcweir 				pItem->mnExtraWidth = 0;
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 			pItem->mnX = nX;
345*cdf0e10cSrcweir 			nX += pItem->mnWidth + pItem->mnExtraWidth + pItem->mnOffset;
346*cdf0e10cSrcweir 		}
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 		pItem = mpItemList->Next();
349*cdf0e10cSrcweir 	}
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 	mbFormat = sal_False;
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir // -----------------------------------------------------------------------
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir Rectangle StatusBar::ImplGetItemRectPos( sal_uInt16 nPos ) const
357*cdf0e10cSrcweir {
358*cdf0e10cSrcweir     Rectangle		aRect;
359*cdf0e10cSrcweir     ImplStatusItem* pItem;
360*cdf0e10cSrcweir     pItem = mpItemList->GetObject( nPos );
361*cdf0e10cSrcweir     if ( pItem )
362*cdf0e10cSrcweir     {
363*cdf0e10cSrcweir         if ( pItem->mbVisible )
364*cdf0e10cSrcweir         {
365*cdf0e10cSrcweir             aRect.Left()   = pItem->mnX;
366*cdf0e10cSrcweir             aRect.Right()  = aRect.Left() + pItem->mnWidth + pItem->mnExtraWidth;
367*cdf0e10cSrcweir             aRect.Top()    = mnItemY;
368*cdf0e10cSrcweir             aRect.Bottom() = mnCalcHeight - STATUSBAR_OFFSET_Y;
369*cdf0e10cSrcweir             if( IsTopBorder() )
370*cdf0e10cSrcweir                 aRect.Bottom()+=2;
371*cdf0e10cSrcweir         }
372*cdf0e10cSrcweir     }
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir     return aRect;
375*cdf0e10cSrcweir }
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir // -----------------------------------------------------------------------
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir sal_uInt16 StatusBar::ImplGetFirstVisiblePos() const
380*cdf0e10cSrcweir {
381*cdf0e10cSrcweir     ImplStatusItem* pItem;
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir     for( sal_uInt16 nPos = 0; nPos < mpItemList->Count(); nPos++ )
384*cdf0e10cSrcweir     {
385*cdf0e10cSrcweir         pItem = mpItemList->GetObject( nPos );
386*cdf0e10cSrcweir         if ( pItem )
387*cdf0e10cSrcweir         {
388*cdf0e10cSrcweir             if ( pItem->mbVisible )
389*cdf0e10cSrcweir                 return nPos;
390*cdf0e10cSrcweir         }
391*cdf0e10cSrcweir     }
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir     return ~0;
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir // -----------------------------------------------------------------------
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir void StatusBar::ImplDrawText( sal_Bool bOffScreen, long nOldTextWidth )
399*cdf0e10cSrcweir {
400*cdf0e10cSrcweir 	// Das ueberschreiben der Item-Box verhindern
401*cdf0e10cSrcweir 	Rectangle aTextRect;
402*cdf0e10cSrcweir 	aTextRect.Left() = STATUSBAR_OFFSET_X+1;
403*cdf0e10cSrcweir 	aTextRect.Top()  = mnTextY;
404*cdf0e10cSrcweir 	if ( mbVisibleItems && (GetStyle() & WB_RIGHT) )
405*cdf0e10cSrcweir 		aTextRect.Right() = mnDX - mnItemsWidth - 1;
406*cdf0e10cSrcweir 	else
407*cdf0e10cSrcweir 		aTextRect.Right() = mnDX - 1;
408*cdf0e10cSrcweir 	if ( aTextRect.Right() > aTextRect.Left() )
409*cdf0e10cSrcweir 	{
410*cdf0e10cSrcweir 		// Position ermitteln
411*cdf0e10cSrcweir 		XubString aStr = GetText();
412*cdf0e10cSrcweir 		sal_uInt16 nPos = aStr.Search( _LF );
413*cdf0e10cSrcweir 		if ( nPos != STRING_NOTFOUND )
414*cdf0e10cSrcweir 			aStr.Erase( nPos );
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 		aTextRect.Bottom() = aTextRect.Top()+GetTextHeight()+1;
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir 		if ( bOffScreen )
419*cdf0e10cSrcweir 		{
420*cdf0e10cSrcweir 			long nMaxWidth = Max( nOldTextWidth, GetTextWidth( aStr ) );
421*cdf0e10cSrcweir 			Size aVirDevSize( nMaxWidth, aTextRect.GetHeight() );
422*cdf0e10cSrcweir 			mpImplData->mpVirDev->SetOutputSizePixel( aVirDevSize );
423*cdf0e10cSrcweir 			Rectangle aTempRect = aTextRect;
424*cdf0e10cSrcweir 			aTempRect.SetPos( Point( 0, 0 ) );
425*cdf0e10cSrcweir 			mpImplData->mpVirDev->DrawText( aTempRect, aStr, TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_CLIP | TEXT_DRAW_ENDELLIPSIS );
426*cdf0e10cSrcweir 			DrawOutDev( aTextRect.TopLeft(), aVirDevSize, Point(), aVirDevSize, *mpImplData->mpVirDev );
427*cdf0e10cSrcweir 		}
428*cdf0e10cSrcweir 		else
429*cdf0e10cSrcweir 			DrawText( aTextRect, aStr, TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_CLIP | TEXT_DRAW_ENDELLIPSIS );
430*cdf0e10cSrcweir 	}
431*cdf0e10cSrcweir }
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir // -----------------------------------------------------------------------
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir void StatusBar::ImplDrawItem( sal_Bool bOffScreen, sal_uInt16 nPos, sal_Bool bDrawText, sal_Bool bDrawFrame )
436*cdf0e10cSrcweir {
437*cdf0e10cSrcweir 	Rectangle aRect = ImplGetItemRectPos( nPos );
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir 	if ( aRect.IsEmpty() )
440*cdf0e10cSrcweir 		return;
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir 	// Ausgabebereich berechnen
443*cdf0e10cSrcweir 	ImplStatusItem* 	pItem = mpItemList->GetObject( nPos );
444*cdf0e10cSrcweir     long nW = mpImplData->mnItemBorderWidth + 1;
445*cdf0e10cSrcweir 	Rectangle			aTextRect( aRect.Left()+nW, aRect.Top()+nW,
446*cdf0e10cSrcweir 								   aRect.Right()-nW, aRect.Bottom()-nW );
447*cdf0e10cSrcweir 	Size				aTextRectSize( aTextRect.GetSize() );
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 	if ( bOffScreen )
450*cdf0e10cSrcweir 		mpImplData->mpVirDev->SetOutputSizePixel( aTextRectSize );
451*cdf0e10cSrcweir 	else
452*cdf0e10cSrcweir 	{
453*cdf0e10cSrcweir 		Region aRegion( aTextRect );
454*cdf0e10cSrcweir 		SetClipRegion( aRegion );
455*cdf0e10cSrcweir 	}
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 	// Text ausgeben
458*cdf0e10cSrcweir 	if ( bDrawText )
459*cdf0e10cSrcweir 	{
460*cdf0e10cSrcweir 		Size	aTextSize( GetTextWidth( pItem->maText ), GetTextHeight() );
461*cdf0e10cSrcweir 		Point	aTextPos = ImplGetItemTextPos( aTextRectSize, aTextSize, pItem->mnBits );
462*cdf0e10cSrcweir 		if ( bOffScreen )
463*cdf0e10cSrcweir 			mpImplData->mpVirDev->DrawText( aTextPos, pItem->maText );
464*cdf0e10cSrcweir 		else
465*cdf0e10cSrcweir 		{
466*cdf0e10cSrcweir 			aTextPos.X() += aTextRect.Left();
467*cdf0e10cSrcweir 			aTextPos.Y() += aTextRect.Top();
468*cdf0e10cSrcweir 			DrawText( aTextPos, pItem->maText );
469*cdf0e10cSrcweir 		}
470*cdf0e10cSrcweir 	}
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir 	// Gegebenenfalls auch DrawItem aufrufen
473*cdf0e10cSrcweir 	if ( pItem->mnBits & SIB_USERDRAW )
474*cdf0e10cSrcweir 	{
475*cdf0e10cSrcweir 		if ( bOffScreen )
476*cdf0e10cSrcweir 		{
477*cdf0e10cSrcweir 			mbInUserDraw = sal_True;
478*cdf0e10cSrcweir             mpImplData->mpVirDev->EnableRTL( IsRTLEnabled() );
479*cdf0e10cSrcweir 			UserDrawEvent aODEvt( mpImplData->mpVirDev, Rectangle( Point(), aTextRectSize ), pItem->mnId );
480*cdf0e10cSrcweir 			UserDraw( aODEvt );
481*cdf0e10cSrcweir             mpImplData->mpVirDev->EnableRTL( sal_False );
482*cdf0e10cSrcweir 			mbInUserDraw = sal_False;
483*cdf0e10cSrcweir 		}
484*cdf0e10cSrcweir 		else
485*cdf0e10cSrcweir 		{
486*cdf0e10cSrcweir 			UserDrawEvent aODEvt( this, aTextRect, pItem->mnId );
487*cdf0e10cSrcweir 			UserDraw( aODEvt );
488*cdf0e10cSrcweir 		}
489*cdf0e10cSrcweir 	}
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir 	if ( bOffScreen )
492*cdf0e10cSrcweir 		DrawOutDev( aTextRect.TopLeft(), aTextRectSize, Point(), aTextRectSize, *mpImplData->mpVirDev );
493*cdf0e10cSrcweir 	else
494*cdf0e10cSrcweir 		SetClipRegion();
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 	// Frame ausgeben
497*cdf0e10cSrcweir 	if ( bDrawFrame )
498*cdf0e10cSrcweir     {
499*cdf0e10cSrcweir         if( mpImplData->mbDrawItemFrames )
500*cdf0e10cSrcweir         {
501*cdf0e10cSrcweir             if( !(pItem->mnBits & SIB_FLAT) )
502*cdf0e10cSrcweir             {
503*cdf0e10cSrcweir                 sal_uInt16 nStyle;
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir                 if ( pItem->mnBits & SIB_IN )
506*cdf0e10cSrcweir                     nStyle = FRAME_DRAW_IN;
507*cdf0e10cSrcweir                 else
508*cdf0e10cSrcweir                     nStyle = FRAME_DRAW_OUT;
509*cdf0e10cSrcweir 
510*cdf0e10cSrcweir                 DecorationView aDecoView( this );
511*cdf0e10cSrcweir                 aDecoView.DrawFrame( aRect, nStyle );
512*cdf0e10cSrcweir             }
513*cdf0e10cSrcweir         }
514*cdf0e10cSrcweir         else if( nPos != ImplGetFirstVisiblePos() )
515*cdf0e10cSrcweir         {
516*cdf0e10cSrcweir             // draw separator
517*cdf0e10cSrcweir             Point aFrom( aRect.TopLeft() );
518*cdf0e10cSrcweir             aFrom.X()--;
519*cdf0e10cSrcweir             aFrom.Y()++;
520*cdf0e10cSrcweir             Point aTo( aRect.BottomLeft() );
521*cdf0e10cSrcweir             aTo.X()--;
522*cdf0e10cSrcweir             aTo.Y()--;
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir             DecorationView aDecoView( this );
525*cdf0e10cSrcweir             aDecoView.DrawSeparator( aFrom, aTo );
526*cdf0e10cSrcweir         }
527*cdf0e10cSrcweir     }
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir 	if ( !ImplIsRecordLayout() )
530*cdf0e10cSrcweir 		ImplCallEventListeners( VCLEVENT_STATUSBAR_DRAWITEM, (void*) sal_IntPtr(pItem->mnId) );
531*cdf0e10cSrcweir }
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir // -----------------------------------------------------------------------
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir void DrawProgress( Window* pWindow, const Point& rPos,
536*cdf0e10cSrcweir 				   long nOffset, long nPrgsWidth, long nPrgsHeight,
537*cdf0e10cSrcweir 				   sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount,
538*cdf0e10cSrcweir                    const Rectangle& rFramePosSize
539*cdf0e10cSrcweir                    )
540*cdf0e10cSrcweir {
541*cdf0e10cSrcweir     if( pWindow->IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
542*cdf0e10cSrcweir     {
543*cdf0e10cSrcweir         bool bNeedErase = ImplGetSVData()->maNWFData.mbProgressNeedsErase;
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir         long nFullWidth = (nPrgsWidth + nOffset) * (10000 / nPercentCount);
546*cdf0e10cSrcweir         long nPerc = (nPercent2 > 10000) ? 10000 : nPercent2;
547*cdf0e10cSrcweir         ImplControlValue aValue( nFullWidth * (long)nPerc / 10000 );
548*cdf0e10cSrcweir         Rectangle aDrawRect( rPos, Size( nFullWidth, nPrgsHeight ) );
549*cdf0e10cSrcweir         Rectangle aControlRegion( aDrawRect );
550*cdf0e10cSrcweir         if( bNeedErase )
551*cdf0e10cSrcweir         {
552*cdf0e10cSrcweir             Window* pEraseWindow = pWindow;
553*cdf0e10cSrcweir             while( pEraseWindow->IsPaintTransparent()                         &&
554*cdf0e10cSrcweir                    ! pEraseWindow->ImplGetWindowImpl()->mbFrame )
555*cdf0e10cSrcweir             {
556*cdf0e10cSrcweir                 pEraseWindow = pEraseWindow->ImplGetWindowImpl()->mpParent;
557*cdf0e10cSrcweir             }
558*cdf0e10cSrcweir             if( pEraseWindow == pWindow )
559*cdf0e10cSrcweir                 // restore background of pWindow
560*cdf0e10cSrcweir                 pEraseWindow->Erase( rFramePosSize );
561*cdf0e10cSrcweir             else
562*cdf0e10cSrcweir             {
563*cdf0e10cSrcweir                 // restore transparent background
564*cdf0e10cSrcweir                 Point aTL( pWindow->OutputToAbsoluteScreenPixel( rFramePosSize.TopLeft() ) );
565*cdf0e10cSrcweir                 aTL = pEraseWindow->AbsoluteScreenToOutputPixel( aTL );
566*cdf0e10cSrcweir                 Rectangle aRect( aTL, rFramePosSize.GetSize() );
567*cdf0e10cSrcweir                 pEraseWindow->Invalidate( aRect, INVALIDATE_NOCHILDREN     |
568*cdf0e10cSrcweir                                                  INVALIDATE_NOCLIPCHILDREN |
569*cdf0e10cSrcweir                                                  INVALIDATE_TRANSPARENT );
570*cdf0e10cSrcweir                 pEraseWindow->Update();
571*cdf0e10cSrcweir             }
572*cdf0e10cSrcweir             pWindow->Push( PUSH_CLIPREGION );
573*cdf0e10cSrcweir             pWindow->IntersectClipRegion( rFramePosSize );
574*cdf0e10cSrcweir         }
575*cdf0e10cSrcweir         sal_Bool bNativeOK = pWindow->DrawNativeControl( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
576*cdf0e10cSrcweir                                                      CTRL_STATE_ENABLED, aValue, rtl::OUString() );
577*cdf0e10cSrcweir         if( bNeedErase )
578*cdf0e10cSrcweir             pWindow->Pop();
579*cdf0e10cSrcweir         if( bNativeOK )
580*cdf0e10cSrcweir         {
581*cdf0e10cSrcweir             pWindow->Flush();
582*cdf0e10cSrcweir             return;
583*cdf0e10cSrcweir         }
584*cdf0e10cSrcweir     }
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir 	// Werte vorberechnen
587*cdf0e10cSrcweir 	sal_uInt16 nPerc1 = nPercent1 / nPercentCount;
588*cdf0e10cSrcweir 	sal_uInt16 nPerc2 = nPercent2 / nPercentCount;
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir 	if ( nPerc1 > nPerc2 )
591*cdf0e10cSrcweir 	{
592*cdf0e10cSrcweir 		// Support progress that can also decrease
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir 		// Rechteck berechnen
595*cdf0e10cSrcweir 		long		nDX = nPrgsWidth + nOffset;
596*cdf0e10cSrcweir 		long		nLeft = rPos.X()+((nPerc1-1)*nDX);
597*cdf0e10cSrcweir 		Rectangle	aRect( nLeft, rPos.Y(), nLeft+nPrgsWidth, rPos.Y()+nPrgsHeight );
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir 		do
600*cdf0e10cSrcweir 		{
601*cdf0e10cSrcweir 			pWindow->Erase( aRect );
602*cdf0e10cSrcweir 			aRect.Left()  -= nDX;
603*cdf0e10cSrcweir 			aRect.Right() -= nDX;
604*cdf0e10cSrcweir 			nPerc1--;
605*cdf0e10cSrcweir 		}
606*cdf0e10cSrcweir 		while ( nPerc1 > nPerc2 );
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir 		pWindow->Flush();
609*cdf0e10cSrcweir 	}
610*cdf0e10cSrcweir 	else if ( nPerc1 < nPerc2 )
611*cdf0e10cSrcweir 	{
612*cdf0e10cSrcweir 		// Percent-Rechtecke malen
613*cdf0e10cSrcweir 		// Wenn Percent2 ueber 100%, Werte anpassen
614*cdf0e10cSrcweir 		if ( nPercent2 > 10000 )
615*cdf0e10cSrcweir 		{
616*cdf0e10cSrcweir 			nPerc2 = 10000 / nPercentCount;
617*cdf0e10cSrcweir 			if ( nPerc1 >= nPerc2 )
618*cdf0e10cSrcweir 				nPerc1 = nPerc2-1;
619*cdf0e10cSrcweir 		}
620*cdf0e10cSrcweir 
621*cdf0e10cSrcweir 		// Rechteck berechnen
622*cdf0e10cSrcweir 		long		nDX = nPrgsWidth + nOffset;
623*cdf0e10cSrcweir 		long		nLeft = rPos.X()+(nPerc1*nDX);
624*cdf0e10cSrcweir 		Rectangle	aRect( nLeft, rPos.Y(), nLeft+nPrgsWidth, rPos.Y()+nPrgsHeight );
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir 		do
627*cdf0e10cSrcweir 		{
628*cdf0e10cSrcweir 			pWindow->DrawRect( aRect );
629*cdf0e10cSrcweir 			aRect.Left()  += nDX;
630*cdf0e10cSrcweir 			aRect.Right() += nDX;
631*cdf0e10cSrcweir 			nPerc1++;
632*cdf0e10cSrcweir 		}
633*cdf0e10cSrcweir 		while ( nPerc1 < nPerc2 );
634*cdf0e10cSrcweir 
635*cdf0e10cSrcweir 		// Bei mehr als 100%, lassen wir das Rechteck blinken
636*cdf0e10cSrcweir 		if ( nPercent2 > 10000 )
637*cdf0e10cSrcweir 		{
638*cdf0e10cSrcweir 			// an/aus-Status festlegen
639*cdf0e10cSrcweir 			if ( ((nPercent2 / nPercentCount) & 0x01) == (nPercentCount & 0x01) )
640*cdf0e10cSrcweir 			{
641*cdf0e10cSrcweir 				aRect.Left()  -= nDX;
642*cdf0e10cSrcweir 				aRect.Right() -= nDX;
643*cdf0e10cSrcweir 				pWindow->Erase( aRect );
644*cdf0e10cSrcweir 			}
645*cdf0e10cSrcweir 		}
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir 		pWindow->Flush();
648*cdf0e10cSrcweir 	}
649*cdf0e10cSrcweir }
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir // -----------------------------------------------------------------------
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir void StatusBar::ImplDrawProgress( sal_Bool bPaint,
654*cdf0e10cSrcweir 								  sal_uInt16 nPercent1, sal_uInt16 nPercent2 )
655*cdf0e10cSrcweir {
656*cdf0e10cSrcweir     bool bNative = IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL );
657*cdf0e10cSrcweir 	// bPaint: draw text also, else only update progress
658*cdf0e10cSrcweir 	if ( bPaint )
659*cdf0e10cSrcweir 	{
660*cdf0e10cSrcweir 		DrawText( maPrgsTxtPos, maPrgsTxt );
661*cdf0e10cSrcweir         if( ! bNative )
662*cdf0e10cSrcweir         {
663*cdf0e10cSrcweir             DecorationView aDecoView( this );
664*cdf0e10cSrcweir             aDecoView.DrawFrame( maPrgsFrameRect, FRAME_DRAW_IN );
665*cdf0e10cSrcweir         }
666*cdf0e10cSrcweir 	}
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir 	Point aPos( maPrgsFrameRect.Left()+STATUSBAR_PRGS_OFFSET,
669*cdf0e10cSrcweir 				maPrgsFrameRect.Top()+STATUSBAR_PRGS_OFFSET );
670*cdf0e10cSrcweir     long nPrgsHeight = mnPrgsSize;
671*cdf0e10cSrcweir     if( bNative )
672*cdf0e10cSrcweir     {
673*cdf0e10cSrcweir         aPos = maPrgsFrameRect.TopLeft();
674*cdf0e10cSrcweir         nPrgsHeight = maPrgsFrameRect.GetHeight();
675*cdf0e10cSrcweir     }
676*cdf0e10cSrcweir 	DrawProgress( this, aPos, mnPrgsSize/2, mnPrgsSize, nPrgsHeight,
677*cdf0e10cSrcweir 				  nPercent1*100, nPercent2*100, mnPercentCount, maPrgsFrameRect );
678*cdf0e10cSrcweir }
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir // -----------------------------------------------------------------------
681*cdf0e10cSrcweir 
682*cdf0e10cSrcweir void StatusBar::ImplCalcProgressRect()
683*cdf0e10cSrcweir {
684*cdf0e10cSrcweir 	// calculate text size
685*cdf0e10cSrcweir 	Size aPrgsTxtSize( GetTextWidth( maPrgsTxt ), GetTextHeight() );
686*cdf0e10cSrcweir 	maPrgsTxtPos.X()	= STATUSBAR_OFFSET_X+1;
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir 	// calculate progress frame
689*cdf0e10cSrcweir 	maPrgsFrameRect.Left()		= maPrgsTxtPos.X()+aPrgsTxtSize.Width()+STATUSBAR_OFFSET;
690*cdf0e10cSrcweir 	maPrgsFrameRect.Top()		= mnItemY;
691*cdf0e10cSrcweir 	maPrgsFrameRect.Bottom()	= mnCalcHeight - STATUSBAR_OFFSET_Y;
692*cdf0e10cSrcweir     if( IsTopBorder() )
693*cdf0e10cSrcweir         maPrgsFrameRect.Bottom()+=2;
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir 	// calculate size of progress rects
696*cdf0e10cSrcweir 	mnPrgsSize = maPrgsFrameRect.Bottom()-maPrgsFrameRect.Top()-(STATUSBAR_PRGS_OFFSET*2);
697*cdf0e10cSrcweir 	sal_uInt16 nMaxPercent = STATUSBAR_PRGS_COUNT;
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir 	long nMaxWidth = mnDX-STATUSBAR_OFFSET-1;
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir 	// make smaller if there are too many rects
702*cdf0e10cSrcweir 	while ( maPrgsFrameRect.Left()+ImplCalcProgessWidth( nMaxPercent, mnPrgsSize ) > nMaxWidth )
703*cdf0e10cSrcweir 	{
704*cdf0e10cSrcweir 		nMaxPercent--;
705*cdf0e10cSrcweir 		if ( nMaxPercent <= STATUSBAR_PRGS_MIN )
706*cdf0e10cSrcweir 			break;
707*cdf0e10cSrcweir 	}
708*cdf0e10cSrcweir 	maPrgsFrameRect.Right() = maPrgsFrameRect.Left() + ImplCalcProgessWidth( nMaxPercent, mnPrgsSize );
709*cdf0e10cSrcweir 
710*cdf0e10cSrcweir 	// save the divisor for later
711*cdf0e10cSrcweir 	mnPercentCount = 10000 / nMaxPercent;
712*cdf0e10cSrcweir     sal_Bool bNativeOK = sal_False;
713*cdf0e10cSrcweir     if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
714*cdf0e10cSrcweir     {
715*cdf0e10cSrcweir         ImplControlValue aValue;
716*cdf0e10cSrcweir         Rectangle aControlRegion( Rectangle( (const Point&)Point(), maPrgsFrameRect.GetSize() ) );
717*cdf0e10cSrcweir         Rectangle aNativeControlRegion, aNativeContentRegion;
718*cdf0e10cSrcweir         if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
719*cdf0e10cSrcweir                                                  CTRL_STATE_ENABLED, aValue, rtl::OUString(),
720*cdf0e10cSrcweir                                                  aNativeControlRegion, aNativeContentRegion ) ) != sal_False )
721*cdf0e10cSrcweir         {
722*cdf0e10cSrcweir             long nProgressHeight = aNativeControlRegion.GetHeight();
723*cdf0e10cSrcweir             if( nProgressHeight > maPrgsFrameRect.GetHeight() )
724*cdf0e10cSrcweir             {
725*cdf0e10cSrcweir                 long nDelta = nProgressHeight - maPrgsFrameRect.GetHeight();
726*cdf0e10cSrcweir                 maPrgsFrameRect.Top() -= (nDelta - nDelta/2);
727*cdf0e10cSrcweir                 maPrgsFrameRect.Bottom() += nDelta/2;
728*cdf0e10cSrcweir             }
729*cdf0e10cSrcweir             maPrgsTxtPos.Y() = maPrgsFrameRect.Top() + (nProgressHeight - GetTextHeight())/2;
730*cdf0e10cSrcweir         }
731*cdf0e10cSrcweir     }
732*cdf0e10cSrcweir     if( ! bNativeOK )
733*cdf0e10cSrcweir         maPrgsTxtPos.Y()	= mnTextY;
734*cdf0e10cSrcweir }
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir // -----------------------------------------------------------------------
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir void StatusBar::MouseButtonDown( const MouseEvent& rMEvt )
739*cdf0e10cSrcweir {
740*cdf0e10cSrcweir 	// Nur bei linker Maustaste ToolBox ausloesen
741*cdf0e10cSrcweir 	if ( rMEvt.IsLeft() )
742*cdf0e10cSrcweir 	{
743*cdf0e10cSrcweir 		if ( mbVisibleItems )
744*cdf0e10cSrcweir 		{
745*cdf0e10cSrcweir 			Point  aMousePos = rMEvt.GetPosPixel();
746*cdf0e10cSrcweir 			sal_uInt16 i = 0;
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 			// Item suchen, das geklickt wurde
749*cdf0e10cSrcweir 			ImplStatusItem* pItem = mpItemList->First();
750*cdf0e10cSrcweir 			while ( pItem )
751*cdf0e10cSrcweir 			{
752*cdf0e10cSrcweir 				// Ist es dieses Item
753*cdf0e10cSrcweir 				if ( ImplGetItemRectPos( i ).IsInside( aMousePos ) )
754*cdf0e10cSrcweir 				{
755*cdf0e10cSrcweir 					mnCurItemId = pItem->mnId;
756*cdf0e10cSrcweir 					if ( rMEvt.GetClicks() == 2 )
757*cdf0e10cSrcweir 						DoubleClick();
758*cdf0e10cSrcweir 					else
759*cdf0e10cSrcweir 						Click();
760*cdf0e10cSrcweir 					mnCurItemId = 0;
761*cdf0e10cSrcweir 
762*cdf0e10cSrcweir 					// Item wurde gefunden
763*cdf0e10cSrcweir 					return;
764*cdf0e10cSrcweir 				}
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir 				i++;
767*cdf0e10cSrcweir 				pItem = mpItemList->Next();
768*cdf0e10cSrcweir 			}
769*cdf0e10cSrcweir 		}
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir 		// Kein Item, dann nur Click oder DoubleClick
772*cdf0e10cSrcweir 		if ( rMEvt.GetClicks() == 2 )
773*cdf0e10cSrcweir 			DoubleClick();
774*cdf0e10cSrcweir 		else
775*cdf0e10cSrcweir 			Click();
776*cdf0e10cSrcweir 	}
777*cdf0e10cSrcweir }
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir // -----------------------------------------------------------------------
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir void StatusBar::Paint( const Rectangle& )
782*cdf0e10cSrcweir {
783*cdf0e10cSrcweir 	if ( mbFormat )
784*cdf0e10cSrcweir 		ImplFormat();
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir 	sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count();
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir 	if ( mbProgressMode )
789*cdf0e10cSrcweir 		ImplDrawProgress( sal_True, 0, mnPercent );
790*cdf0e10cSrcweir 	else
791*cdf0e10cSrcweir 	{
792*cdf0e10cSrcweir 		// Text zeichen
793*cdf0e10cSrcweir 		if ( !mbVisibleItems || (GetStyle() & WB_RIGHT) )
794*cdf0e10cSrcweir 			ImplDrawText( sal_False, 0 );
795*cdf0e10cSrcweir 
796*cdf0e10cSrcweir 		// Items zeichnen
797*cdf0e10cSrcweir 		if ( mbVisibleItems )
798*cdf0e10cSrcweir 		{
799*cdf0e10cSrcweir 			// Items zeichnen
800*cdf0e10cSrcweir 			for ( sal_uInt16 i = 0; i < nItemCount; i++ )
801*cdf0e10cSrcweir 				ImplDrawItem( sal_False, i, sal_True, sal_True );
802*cdf0e10cSrcweir 		}
803*cdf0e10cSrcweir 	}
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir     // draw borders
806*cdf0e10cSrcweir     if( IsTopBorder() )
807*cdf0e10cSrcweir     {
808*cdf0e10cSrcweir 	    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
809*cdf0e10cSrcweir 	    SetLineColor( rStyleSettings.GetShadowColor() );
810*cdf0e10cSrcweir 	    DrawLine( Point( 0, 0 ), Point( mnDX-1, 0 ) );
811*cdf0e10cSrcweir 	    SetLineColor( rStyleSettings.GetLightColor() );
812*cdf0e10cSrcweir 	    DrawLine( Point( 0, 1 ), Point( mnDX-1, 1 ) );
813*cdf0e10cSrcweir     }
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir 	if ( IsBottomBorder() )
816*cdf0e10cSrcweir 	{
817*cdf0e10cSrcweir 		const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
818*cdf0e10cSrcweir 		SetLineColor( rStyleSettings.GetShadowColor() );
819*cdf0e10cSrcweir 		DrawLine( Point( 0, mnDY-2 ), Point( mnDX-1, mnDY-2 ) );
820*cdf0e10cSrcweir 		SetLineColor( rStyleSettings.GetLightColor() );
821*cdf0e10cSrcweir 		DrawLine( Point( 0, mnDY-1 ), Point( mnDX-1, mnDY-1 ) );
822*cdf0e10cSrcweir 	}
823*cdf0e10cSrcweir }
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir // -----------------------------------------------------------------------
826*cdf0e10cSrcweir 
827*cdf0e10cSrcweir void StatusBar::Move()
828*cdf0e10cSrcweir {
829*cdf0e10cSrcweir 	Window::Move();
830*cdf0e10cSrcweir }
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir // -----------------------------------------------------------------------
833*cdf0e10cSrcweir 
834*cdf0e10cSrcweir void StatusBar::Resize()
835*cdf0e10cSrcweir {
836*cdf0e10cSrcweir 	// Breite und Hoehe abfragen und merken
837*cdf0e10cSrcweir 	Size aSize = GetOutputSizePixel();
838*cdf0e10cSrcweir 	mnDX = aSize.Width() - ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset;
839*cdf0e10cSrcweir 	mnDY = aSize.Height();
840*cdf0e10cSrcweir 	mnCalcHeight = mnDY;
841*cdf0e10cSrcweir     // subtract border
842*cdf0e10cSrcweir     if( IsTopBorder() )
843*cdf0e10cSrcweir         mnCalcHeight -= 2;
844*cdf0e10cSrcweir 	if ( IsBottomBorder() )
845*cdf0e10cSrcweir 		mnCalcHeight -= 2;
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir     mnItemY = STATUSBAR_OFFSET_Y;
848*cdf0e10cSrcweir     if( IsTopBorder() )
849*cdf0e10cSrcweir         mnItemY += 2;
850*cdf0e10cSrcweir     mnTextY = (mnCalcHeight-GetTextHeight())/2;
851*cdf0e10cSrcweir     if( IsTopBorder() )
852*cdf0e10cSrcweir         mnTextY += 2;
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir 	// Formatierung neu ausloesen
855*cdf0e10cSrcweir 	mbFormat = sal_True;
856*cdf0e10cSrcweir 
857*cdf0e10cSrcweir 	if ( mbProgressMode )
858*cdf0e10cSrcweir 		ImplCalcProgressRect();
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir 	Invalidate();
861*cdf0e10cSrcweir }
862*cdf0e10cSrcweir 
863*cdf0e10cSrcweir // -----------------------------------------------------------------------
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir void StatusBar::RequestHelp( const HelpEvent& rHEvt )
866*cdf0e10cSrcweir {
867*cdf0e10cSrcweir 	// no keyboard help in status bar
868*cdf0e10cSrcweir 	if( rHEvt.KeyboardActivated() )
869*cdf0e10cSrcweir 		return;
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir 	sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir 	if ( nItemId )
874*cdf0e10cSrcweir 	{
875*cdf0e10cSrcweir 		Rectangle aItemRect = GetItemRect( nItemId );
876*cdf0e10cSrcweir 		Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
877*cdf0e10cSrcweir 		aItemRect.Left()   = aPt.X();
878*cdf0e10cSrcweir 		aItemRect.Top()    = aPt.Y();
879*cdf0e10cSrcweir 		aPt = OutputToScreenPixel( aItemRect.BottomRight() );
880*cdf0e10cSrcweir 		aItemRect.Right()  = aPt.X();
881*cdf0e10cSrcweir 		aItemRect.Bottom() = aPt.Y();
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir 		if ( rHEvt.GetMode() & HELPMODE_BALLOON )
884*cdf0e10cSrcweir 		{
885*cdf0e10cSrcweir 			XubString aStr = GetHelpText( nItemId );
886*cdf0e10cSrcweir 			Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
887*cdf0e10cSrcweir 			return;
888*cdf0e10cSrcweir 		}
889*cdf0e10cSrcweir 		else if ( rHEvt.GetMode() & HELPMODE_QUICK )
890*cdf0e10cSrcweir 		{
891*cdf0e10cSrcweir 			XubString	aStr = GetQuickHelpText( nItemId );
892*cdf0e10cSrcweir             // Show quickhelp if available
893*cdf0e10cSrcweir             if( aStr.Len() )
894*cdf0e10cSrcweir             {
895*cdf0e10cSrcweir 			    Help::ShowQuickHelp( this, aItemRect, aStr );
896*cdf0e10cSrcweir                 return;
897*cdf0e10cSrcweir             }
898*cdf0e10cSrcweir 			aStr = GetItemText( nItemId );
899*cdf0e10cSrcweir 			// show a quick help if item text doesn't fit
900*cdf0e10cSrcweir 			if ( GetTextWidth( aStr ) > aItemRect.GetWidth() )
901*cdf0e10cSrcweir 			{
902*cdf0e10cSrcweir 				Help::ShowQuickHelp( this, aItemRect, aStr );
903*cdf0e10cSrcweir 				return;
904*cdf0e10cSrcweir 			}
905*cdf0e10cSrcweir 		}
906*cdf0e10cSrcweir 		else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
907*cdf0e10cSrcweir 		{
908*cdf0e10cSrcweir             String aCommand = GetItemCommand( nItemId );
909*cdf0e10cSrcweir             rtl::OString aHelpId( GetHelpId( nItemId ) );
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir             if ( aCommand.Len() || aHelpId.getLength() )
912*cdf0e10cSrcweir             {
913*cdf0e10cSrcweir                 // Wenn eine Hilfe existiert, dann ausloesen
914*cdf0e10cSrcweir                 Help* pHelp = Application::GetHelp();
915*cdf0e10cSrcweir                 if ( pHelp )
916*cdf0e10cSrcweir                 {
917*cdf0e10cSrcweir                     if ( aCommand.Len() )
918*cdf0e10cSrcweir                         pHelp->Start( aCommand, this );
919*cdf0e10cSrcweir                     else if ( aHelpId.getLength() )
920*cdf0e10cSrcweir                         pHelp->Start( rtl::OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), this );
921*cdf0e10cSrcweir                 }
922*cdf0e10cSrcweir                 return;
923*cdf0e10cSrcweir             }
924*cdf0e10cSrcweir 		}
925*cdf0e10cSrcweir 	}
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir 	Window::RequestHelp( rHEvt );
928*cdf0e10cSrcweir }
929*cdf0e10cSrcweir 
930*cdf0e10cSrcweir // -----------------------------------------------------------------------
931*cdf0e10cSrcweir 
932*cdf0e10cSrcweir void StatusBar::StateChanged( StateChangedType nType )
933*cdf0e10cSrcweir {
934*cdf0e10cSrcweir 	Window::StateChanged( nType );
935*cdf0e10cSrcweir 
936*cdf0e10cSrcweir 	if ( nType == STATE_CHANGE_INITSHOW )
937*cdf0e10cSrcweir 		ImplFormat();
938*cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_UPDATEMODE )
939*cdf0e10cSrcweir 		Invalidate();
940*cdf0e10cSrcweir 	else if ( (nType == STATE_CHANGE_ZOOM) ||
941*cdf0e10cSrcweir 			  (nType == STATE_CHANGE_CONTROLFONT) )
942*cdf0e10cSrcweir 	{
943*cdf0e10cSrcweir 		mbFormat = sal_True;
944*cdf0e10cSrcweir 		ImplInitSettings( sal_True, sal_False, sal_False );
945*cdf0e10cSrcweir 		Invalidate();
946*cdf0e10cSrcweir 	}
947*cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
948*cdf0e10cSrcweir 	{
949*cdf0e10cSrcweir 		ImplInitSettings( sal_False, sal_True, sal_False );
950*cdf0e10cSrcweir 		Invalidate();
951*cdf0e10cSrcweir 	}
952*cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
953*cdf0e10cSrcweir 	{
954*cdf0e10cSrcweir 		ImplInitSettings( sal_False, sal_False, sal_True );
955*cdf0e10cSrcweir 		Invalidate();
956*cdf0e10cSrcweir 	}
957*cdf0e10cSrcweir }
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir // -----------------------------------------------------------------------
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir void StatusBar::DataChanged( const DataChangedEvent& rDCEvt )
962*cdf0e10cSrcweir {
963*cdf0e10cSrcweir 	Window::DataChanged( rDCEvt );
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
966*cdf0e10cSrcweir 		 (rDCEvt.GetType() == DATACHANGED_FONTS) ||
967*cdf0e10cSrcweir 		 (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
968*cdf0e10cSrcweir 		 ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
969*cdf0e10cSrcweir 		  (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
970*cdf0e10cSrcweir 	{
971*cdf0e10cSrcweir 		mbFormat = sal_True;
972*cdf0e10cSrcweir 		ImplInitSettings( sal_True, sal_True, sal_True );
973*cdf0e10cSrcweir         ImplStatusItem* pItem = mpItemList->First();
974*cdf0e10cSrcweir         long nFudge = GetTextHeight() / 4;
975*cdf0e10cSrcweir         while ( pItem )
976*cdf0e10cSrcweir         {
977*cdf0e10cSrcweir             long nWidth = GetTextWidth( pItem->maText ) + nFudge;
978*cdf0e10cSrcweir             if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET )
979*cdf0e10cSrcweir                 pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
980*cdf0e10cSrcweir             pItem = mpItemList->Next();
981*cdf0e10cSrcweir         }
982*cdf0e10cSrcweir         Size aSize = GetSizePixel();
983*cdf0e10cSrcweir         // do not disturb current width, since
984*cdf0e10cSrcweir         // CalcWindowSizePixel calculates a minimum width
985*cdf0e10cSrcweir         aSize.Height() = CalcWindowSizePixel().Height();
986*cdf0e10cSrcweir         SetSizePixel( aSize );
987*cdf0e10cSrcweir 		Invalidate();
988*cdf0e10cSrcweir 	}
989*cdf0e10cSrcweir }
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir // -----------------------------------------------------------------------
992*cdf0e10cSrcweir 
993*cdf0e10cSrcweir void StatusBar::Click()
994*cdf0e10cSrcweir {
995*cdf0e10cSrcweir     ImplCallEventListeners( VCLEVENT_STATUSBAR_CLICK );
996*cdf0e10cSrcweir 	maClickHdl.Call( this );
997*cdf0e10cSrcweir }
998*cdf0e10cSrcweir 
999*cdf0e10cSrcweir // -----------------------------------------------------------------------
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir void StatusBar::DoubleClick()
1002*cdf0e10cSrcweir {
1003*cdf0e10cSrcweir     ImplCallEventListeners( VCLEVENT_STATUSBAR_DOUBLECLICK );
1004*cdf0e10cSrcweir 	maDoubleClickHdl.Call( this );
1005*cdf0e10cSrcweir }
1006*cdf0e10cSrcweir 
1007*cdf0e10cSrcweir // -----------------------------------------------------------------------
1008*cdf0e10cSrcweir 
1009*cdf0e10cSrcweir void StatusBar::UserDraw( const UserDrawEvent& )
1010*cdf0e10cSrcweir {
1011*cdf0e10cSrcweir }
1012*cdf0e10cSrcweir 
1013*cdf0e10cSrcweir // -----------------------------------------------------------------------
1014*cdf0e10cSrcweir 
1015*cdf0e10cSrcweir void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
1016*cdf0e10cSrcweir 							StatusBarItemBits nBits,
1017*cdf0e10cSrcweir 							long nOffset, sal_uInt16 nPos )
1018*cdf0e10cSrcweir {
1019*cdf0e10cSrcweir 	DBG_ASSERT( nItemId, "StatusBar::InsertItem(): ItemId == 0" );
1020*cdf0e10cSrcweir 	DBG_ASSERT( GetItemPos( nItemId ) == STATUSBAR_ITEM_NOTFOUND,
1021*cdf0e10cSrcweir 				"StatusBar::InsertItem(): ItemId already exists" );
1022*cdf0e10cSrcweir 
1023*cdf0e10cSrcweir 	// IN und CENTER sind Default
1024*cdf0e10cSrcweir 	if ( !(nBits & (SIB_IN | SIB_OUT | SIB_FLAT)) )
1025*cdf0e10cSrcweir 		nBits |= SIB_IN;
1026*cdf0e10cSrcweir 	if ( !(nBits & (SIB_LEFT | SIB_RIGHT | SIB_CENTER)) )
1027*cdf0e10cSrcweir 		nBits |= SIB_CENTER;
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir 	// Item anlegen
1030*cdf0e10cSrcweir     long nFudge = GetTextHeight()/4;
1031*cdf0e10cSrcweir 	ImplStatusItem* pItem	= new ImplStatusItem;
1032*cdf0e10cSrcweir 	pItem->mnId 			= nItemId;
1033*cdf0e10cSrcweir 	pItem->mnBits			= nBits;
1034*cdf0e10cSrcweir 	pItem->mnWidth			= (long)nWidth+nFudge+STATUSBAR_OFFSET;
1035*cdf0e10cSrcweir 	pItem->mnOffset 		= nOffset;
1036*cdf0e10cSrcweir 	pItem->mpUserData		= 0;
1037*cdf0e10cSrcweir 	pItem->mbVisible		= sal_True;
1038*cdf0e10cSrcweir 
1039*cdf0e10cSrcweir 	// Item in die Liste einfuegen
1040*cdf0e10cSrcweir 	mpItemList->Insert( pItem, nPos );
1041*cdf0e10cSrcweir 
1042*cdf0e10cSrcweir 	mbFormat = sal_True;
1043*cdf0e10cSrcweir 	if ( ImplIsItemUpdate() )
1044*cdf0e10cSrcweir 		Invalidate();
1045*cdf0e10cSrcweir 
1046*cdf0e10cSrcweir 	ImplCallEventListeners( VCLEVENT_STATUSBAR_ITEMADDED, (void*) sal_IntPtr(nItemId) );
1047*cdf0e10cSrcweir }
1048*cdf0e10cSrcweir 
1049*cdf0e10cSrcweir // -----------------------------------------------------------------------
1050*cdf0e10cSrcweir 
1051*cdf0e10cSrcweir void StatusBar::RemoveItem( sal_uInt16 nItemId )
1052*cdf0e10cSrcweir {
1053*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1054*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1055*cdf0e10cSrcweir 	{
1056*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->Remove( nPos );
1057*cdf0e10cSrcweir 		delete pItem;
1058*cdf0e10cSrcweir 
1059*cdf0e10cSrcweir 		mbFormat = sal_True;
1060*cdf0e10cSrcweir 		if ( ImplIsItemUpdate() )
1061*cdf0e10cSrcweir 			Invalidate();
1062*cdf0e10cSrcweir 
1063*cdf0e10cSrcweir 		ImplCallEventListeners( VCLEVENT_STATUSBAR_ITEMREMOVED, (void*) sal_IntPtr(nItemId) );
1064*cdf0e10cSrcweir 	}
1065*cdf0e10cSrcweir }
1066*cdf0e10cSrcweir 
1067*cdf0e10cSrcweir // -----------------------------------------------------------------------
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir void StatusBar::ShowItem( sal_uInt16 nItemId )
1070*cdf0e10cSrcweir {
1071*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1072*cdf0e10cSrcweir 
1073*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1074*cdf0e10cSrcweir 	{
1075*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1076*cdf0e10cSrcweir 		if ( !pItem->mbVisible )
1077*cdf0e10cSrcweir 		{
1078*cdf0e10cSrcweir 			pItem->mbVisible = sal_True;
1079*cdf0e10cSrcweir 
1080*cdf0e10cSrcweir 			mbFormat = sal_True;
1081*cdf0e10cSrcweir 			if ( ImplIsItemUpdate() )
1082*cdf0e10cSrcweir 				Invalidate();
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir 			ImplCallEventListeners( VCLEVENT_STATUSBAR_SHOWITEM, (void*) sal_IntPtr(nItemId) );
1085*cdf0e10cSrcweir 		}
1086*cdf0e10cSrcweir 	}
1087*cdf0e10cSrcweir }
1088*cdf0e10cSrcweir 
1089*cdf0e10cSrcweir // -----------------------------------------------------------------------
1090*cdf0e10cSrcweir 
1091*cdf0e10cSrcweir void StatusBar::HideItem( sal_uInt16 nItemId )
1092*cdf0e10cSrcweir {
1093*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1096*cdf0e10cSrcweir 	{
1097*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1098*cdf0e10cSrcweir 		if ( pItem->mbVisible )
1099*cdf0e10cSrcweir 		{
1100*cdf0e10cSrcweir 			pItem->mbVisible = sal_False;
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir 			mbFormat = sal_True;
1103*cdf0e10cSrcweir 			if ( ImplIsItemUpdate() )
1104*cdf0e10cSrcweir 				Invalidate();
1105*cdf0e10cSrcweir 
1106*cdf0e10cSrcweir 			ImplCallEventListeners( VCLEVENT_STATUSBAR_HIDEITEM, (void*) sal_IntPtr(nItemId) );
1107*cdf0e10cSrcweir 		}
1108*cdf0e10cSrcweir 	}
1109*cdf0e10cSrcweir }
1110*cdf0e10cSrcweir 
1111*cdf0e10cSrcweir // -----------------------------------------------------------------------
1112*cdf0e10cSrcweir 
1113*cdf0e10cSrcweir sal_Bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const
1114*cdf0e10cSrcweir {
1115*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1118*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->mbVisible;
1119*cdf0e10cSrcweir 	else
1120*cdf0e10cSrcweir 		return sal_False;
1121*cdf0e10cSrcweir }
1122*cdf0e10cSrcweir 
1123*cdf0e10cSrcweir // -----------------------------------------------------------------------
1124*cdf0e10cSrcweir 
1125*cdf0e10cSrcweir void StatusBar::ShowItems()
1126*cdf0e10cSrcweir {
1127*cdf0e10cSrcweir 	if ( !mbVisibleItems )
1128*cdf0e10cSrcweir 	{
1129*cdf0e10cSrcweir 		mbVisibleItems = sal_True;
1130*cdf0e10cSrcweir 		if ( !mbProgressMode )
1131*cdf0e10cSrcweir 			Invalidate();
1132*cdf0e10cSrcweir 
1133*cdf0e10cSrcweir 		ImplCallEventListeners( VCLEVENT_STATUSBAR_SHOWALLITEMS );
1134*cdf0e10cSrcweir 	}
1135*cdf0e10cSrcweir }
1136*cdf0e10cSrcweir 
1137*cdf0e10cSrcweir // -----------------------------------------------------------------------
1138*cdf0e10cSrcweir 
1139*cdf0e10cSrcweir void StatusBar::HideItems()
1140*cdf0e10cSrcweir {
1141*cdf0e10cSrcweir 	if ( mbVisibleItems )
1142*cdf0e10cSrcweir 	{
1143*cdf0e10cSrcweir 		mbVisibleItems = sal_False;
1144*cdf0e10cSrcweir 		if ( !mbProgressMode )
1145*cdf0e10cSrcweir 			Invalidate();
1146*cdf0e10cSrcweir 
1147*cdf0e10cSrcweir 		ImplCallEventListeners( VCLEVENT_STATUSBAR_HIDEALLITEMS );
1148*cdf0e10cSrcweir 	}
1149*cdf0e10cSrcweir }
1150*cdf0e10cSrcweir 
1151*cdf0e10cSrcweir // -----------------------------------------------------------------------
1152*cdf0e10cSrcweir 
1153*cdf0e10cSrcweir void StatusBar::CopyItems( const StatusBar& rStatusBar )
1154*cdf0e10cSrcweir {
1155*cdf0e10cSrcweir 	// Alle Items entfernen
1156*cdf0e10cSrcweir 	ImplStatusItem* pItem = mpItemList->First();
1157*cdf0e10cSrcweir 	while ( pItem )
1158*cdf0e10cSrcweir 	{
1159*cdf0e10cSrcweir 		delete pItem;
1160*cdf0e10cSrcweir 		pItem = mpItemList->Next();
1161*cdf0e10cSrcweir 	}
1162*cdf0e10cSrcweir 
1163*cdf0e10cSrcweir 	// Items aus der Liste loeschen
1164*cdf0e10cSrcweir 	mpItemList->Clear();
1165*cdf0e10cSrcweir 
1166*cdf0e10cSrcweir 	// Items kopieren
1167*cdf0e10cSrcweir 	sal_uLong i = 0;
1168*cdf0e10cSrcweir 	pItem = rStatusBar.mpItemList->GetObject( i );
1169*cdf0e10cSrcweir 	while ( pItem )
1170*cdf0e10cSrcweir 	{
1171*cdf0e10cSrcweir 		mpItemList->Insert( new ImplStatusItem( *pItem ), LIST_APPEND );
1172*cdf0e10cSrcweir 		i++;
1173*cdf0e10cSrcweir 		pItem = rStatusBar.mpItemList->GetObject( i );
1174*cdf0e10cSrcweir 	}
1175*cdf0e10cSrcweir 
1176*cdf0e10cSrcweir 	mbFormat = sal_True;
1177*cdf0e10cSrcweir 	if ( ImplIsItemUpdate() )
1178*cdf0e10cSrcweir 		Invalidate();
1179*cdf0e10cSrcweir }
1180*cdf0e10cSrcweir 
1181*cdf0e10cSrcweir // -----------------------------------------------------------------------
1182*cdf0e10cSrcweir 
1183*cdf0e10cSrcweir void StatusBar::Clear()
1184*cdf0e10cSrcweir {
1185*cdf0e10cSrcweir 	// Alle Item loeschen
1186*cdf0e10cSrcweir 	ImplStatusItem* pItem = mpItemList->First();
1187*cdf0e10cSrcweir 	while ( pItem )
1188*cdf0e10cSrcweir 	{
1189*cdf0e10cSrcweir 		delete pItem;
1190*cdf0e10cSrcweir 		pItem = mpItemList->Next();
1191*cdf0e10cSrcweir 	}
1192*cdf0e10cSrcweir 
1193*cdf0e10cSrcweir 	// Items aus der Liste loeschen
1194*cdf0e10cSrcweir 	mpItemList->Clear();
1195*cdf0e10cSrcweir 
1196*cdf0e10cSrcweir 	mbFormat = sal_True;
1197*cdf0e10cSrcweir 	if ( ImplIsItemUpdate() )
1198*cdf0e10cSrcweir 		Invalidate();
1199*cdf0e10cSrcweir 
1200*cdf0e10cSrcweir 	ImplCallEventListeners( VCLEVENT_STATUSBAR_ALLITEMSREMOVED );
1201*cdf0e10cSrcweir }
1202*cdf0e10cSrcweir 
1203*cdf0e10cSrcweir // -----------------------------------------------------------------------
1204*cdf0e10cSrcweir 
1205*cdf0e10cSrcweir sal_uInt16 StatusBar::GetItemCount() const
1206*cdf0e10cSrcweir {
1207*cdf0e10cSrcweir 	return (sal_uInt16)mpItemList->Count();
1208*cdf0e10cSrcweir }
1209*cdf0e10cSrcweir 
1210*cdf0e10cSrcweir // -----------------------------------------------------------------------
1211*cdf0e10cSrcweir 
1212*cdf0e10cSrcweir sal_uInt16 StatusBar::GetItemId( sal_uInt16 nPos ) const
1213*cdf0e10cSrcweir {
1214*cdf0e10cSrcweir 	ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1215*cdf0e10cSrcweir 	if ( pItem )
1216*cdf0e10cSrcweir 		return pItem->mnId;
1217*cdf0e10cSrcweir 	else
1218*cdf0e10cSrcweir 		return 0;
1219*cdf0e10cSrcweir }
1220*cdf0e10cSrcweir 
1221*cdf0e10cSrcweir // -----------------------------------------------------------------------
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir sal_uInt16 StatusBar::GetItemPos( sal_uInt16 nItemId ) const
1224*cdf0e10cSrcweir {
1225*cdf0e10cSrcweir 	ImplStatusItem* pItem = mpItemList->First();
1226*cdf0e10cSrcweir 	while ( pItem )
1227*cdf0e10cSrcweir 	{
1228*cdf0e10cSrcweir 		if ( pItem->mnId == nItemId )
1229*cdf0e10cSrcweir 			return (sal_uInt16)mpItemList->GetCurPos();
1230*cdf0e10cSrcweir 
1231*cdf0e10cSrcweir 		pItem = mpItemList->Next();
1232*cdf0e10cSrcweir 	}
1233*cdf0e10cSrcweir 
1234*cdf0e10cSrcweir 	return STATUSBAR_ITEM_NOTFOUND;
1235*cdf0e10cSrcweir }
1236*cdf0e10cSrcweir 
1237*cdf0e10cSrcweir // -----------------------------------------------------------------------
1238*cdf0e10cSrcweir 
1239*cdf0e10cSrcweir sal_uInt16 StatusBar::GetItemId( const Point& rPos ) const
1240*cdf0e10cSrcweir {
1241*cdf0e10cSrcweir 	if ( AreItemsVisible() && !mbFormat )
1242*cdf0e10cSrcweir 	{
1243*cdf0e10cSrcweir 		sal_uInt16 nItemCount = GetItemCount();
1244*cdf0e10cSrcweir 		sal_uInt16 nPos;
1245*cdf0e10cSrcweir 		for ( nPos = 0; nPos < nItemCount; nPos++ )
1246*cdf0e10cSrcweir 		{
1247*cdf0e10cSrcweir 			// Rechteck holen
1248*cdf0e10cSrcweir 			Rectangle aRect = ImplGetItemRectPos( nPos );
1249*cdf0e10cSrcweir 			if ( aRect.IsInside( rPos ) )
1250*cdf0e10cSrcweir 				return mpItemList->GetObject( nPos )->mnId;
1251*cdf0e10cSrcweir 		}
1252*cdf0e10cSrcweir 	}
1253*cdf0e10cSrcweir 
1254*cdf0e10cSrcweir 	return 0;
1255*cdf0e10cSrcweir }
1256*cdf0e10cSrcweir 
1257*cdf0e10cSrcweir // -----------------------------------------------------------------------
1258*cdf0e10cSrcweir 
1259*cdf0e10cSrcweir Rectangle StatusBar::GetItemRect( sal_uInt16 nItemId ) const
1260*cdf0e10cSrcweir {
1261*cdf0e10cSrcweir 	Rectangle aRect;
1262*cdf0e10cSrcweir 
1263*cdf0e10cSrcweir 	if ( AreItemsVisible() && !mbFormat )
1264*cdf0e10cSrcweir 	{
1265*cdf0e10cSrcweir 		sal_uInt16 nPos = GetItemPos( nItemId );
1266*cdf0e10cSrcweir 		if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1267*cdf0e10cSrcweir 		{
1268*cdf0e10cSrcweir 			// Rechteck holen und Rahmen abziehen
1269*cdf0e10cSrcweir 			aRect = ImplGetItemRectPos( nPos );
1270*cdf0e10cSrcweir             long nW = mpImplData->mnItemBorderWidth+1;
1271*cdf0e10cSrcweir             aRect.Top() += nW-1;
1272*cdf0e10cSrcweir             aRect.Bottom() -= nW-1;
1273*cdf0e10cSrcweir 			aRect.Left() += nW;
1274*cdf0e10cSrcweir 			aRect.Right() -= nW;
1275*cdf0e10cSrcweir 			return aRect;
1276*cdf0e10cSrcweir 		}
1277*cdf0e10cSrcweir 	}
1278*cdf0e10cSrcweir 
1279*cdf0e10cSrcweir 	return aRect;
1280*cdf0e10cSrcweir }
1281*cdf0e10cSrcweir 
1282*cdf0e10cSrcweir // -----------------------------------------------------------------------
1283*cdf0e10cSrcweir 
1284*cdf0e10cSrcweir Point StatusBar::GetItemTextPos( sal_uInt16 nItemId ) const
1285*cdf0e10cSrcweir {
1286*cdf0e10cSrcweir 	if ( !mbFormat )
1287*cdf0e10cSrcweir 	{
1288*cdf0e10cSrcweir 		sal_uInt16 nPos = GetItemPos( nItemId );
1289*cdf0e10cSrcweir 		if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1290*cdf0e10cSrcweir 		{
1291*cdf0e10cSrcweir 			// Rechteck holen
1292*cdf0e10cSrcweir 			ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1293*cdf0e10cSrcweir 			Rectangle aRect = ImplGetItemRectPos( nPos );
1294*cdf0e10cSrcweir             long nW = mpImplData->mnItemBorderWidth + 1;
1295*cdf0e10cSrcweir             Rectangle			aTextRect( aRect.Left()+nW, aRect.Top()+nW,
1296*cdf0e10cSrcweir                                            aRect.Right()-nW, aRect.Bottom()-nW );
1297*cdf0e10cSrcweir 			Point aPos = ImplGetItemTextPos( aTextRect.GetSize(),
1298*cdf0e10cSrcweir 											 Size( GetTextWidth( pItem->maText ), GetTextHeight() ),
1299*cdf0e10cSrcweir 											 pItem->mnBits );
1300*cdf0e10cSrcweir 			if ( !mbInUserDraw )
1301*cdf0e10cSrcweir 			{
1302*cdf0e10cSrcweir 				aPos.X() += aTextRect.Left();
1303*cdf0e10cSrcweir 				aPos.Y() += aTextRect.Top();
1304*cdf0e10cSrcweir 			}
1305*cdf0e10cSrcweir 			return aPos;
1306*cdf0e10cSrcweir 		}
1307*cdf0e10cSrcweir 	}
1308*cdf0e10cSrcweir 
1309*cdf0e10cSrcweir 	return Point();
1310*cdf0e10cSrcweir }
1311*cdf0e10cSrcweir 
1312*cdf0e10cSrcweir // -----------------------------------------------------------------------
1313*cdf0e10cSrcweir 
1314*cdf0e10cSrcweir sal_uLong StatusBar::GetItemWidth( sal_uInt16 nItemId ) const
1315*cdf0e10cSrcweir {
1316*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1317*cdf0e10cSrcweir 
1318*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1319*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->mnWidth;
1320*cdf0e10cSrcweir 	else
1321*cdf0e10cSrcweir 		return 0;
1322*cdf0e10cSrcweir }
1323*cdf0e10cSrcweir 
1324*cdf0e10cSrcweir // -----------------------------------------------------------------------
1325*cdf0e10cSrcweir 
1326*cdf0e10cSrcweir StatusBarItemBits StatusBar::GetItemBits( sal_uInt16 nItemId ) const
1327*cdf0e10cSrcweir {
1328*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1329*cdf0e10cSrcweir 
1330*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1331*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->mnBits;
1332*cdf0e10cSrcweir 	else
1333*cdf0e10cSrcweir 		return 0;
1334*cdf0e10cSrcweir }
1335*cdf0e10cSrcweir 
1336*cdf0e10cSrcweir // -----------------------------------------------------------------------
1337*cdf0e10cSrcweir 
1338*cdf0e10cSrcweir long StatusBar::GetItemOffset( sal_uInt16 nItemId ) const
1339*cdf0e10cSrcweir {
1340*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1341*cdf0e10cSrcweir 
1342*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1343*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->mnOffset;
1344*cdf0e10cSrcweir 	else
1345*cdf0e10cSrcweir 		return 0;
1346*cdf0e10cSrcweir }
1347*cdf0e10cSrcweir 
1348*cdf0e10cSrcweir // -----------------------------------------------------------------------
1349*cdf0e10cSrcweir 
1350*cdf0e10cSrcweir void StatusBar::SetItemText( sal_uInt16 nItemId, const XubString& rText )
1351*cdf0e10cSrcweir {
1352*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1353*cdf0e10cSrcweir 
1354*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1355*cdf0e10cSrcweir 	{
1356*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1357*cdf0e10cSrcweir 
1358*cdf0e10cSrcweir 		if ( pItem->maText != rText )
1359*cdf0e10cSrcweir 		{
1360*cdf0e10cSrcweir 			pItem->maText = rText;
1361*cdf0e10cSrcweir 
1362*cdf0e10cSrcweir             // adjust item width - see also DataChanged()
1363*cdf0e10cSrcweir             long nFudge = GetTextHeight()/4;
1364*cdf0e10cSrcweir             long nWidth = GetTextWidth( pItem->maText ) + nFudge;
1365*cdf0e10cSrcweir             if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
1366*cdf0e10cSrcweir                 ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth  ))
1367*cdf0e10cSrcweir             {
1368*cdf0e10cSrcweir                 pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
1369*cdf0e10cSrcweir                 ImplFormat();
1370*cdf0e10cSrcweir                 Invalidate();
1371*cdf0e10cSrcweir             }
1372*cdf0e10cSrcweir 
1373*cdf0e10cSrcweir 			// Item neu Zeichen, wenn StatusBar sichtbar und
1374*cdf0e10cSrcweir 			// UpdateMode gesetzt ist
1375*cdf0e10cSrcweir 			if ( pItem->mbVisible && !mbFormat && ImplIsItemUpdate() )
1376*cdf0e10cSrcweir 			{
1377*cdf0e10cSrcweir 				Update();
1378*cdf0e10cSrcweir 				ImplDrawItem( sal_True, nPos, sal_True, sal_False );
1379*cdf0e10cSrcweir 				Flush();
1380*cdf0e10cSrcweir 			}
1381*cdf0e10cSrcweir 		}
1382*cdf0e10cSrcweir 	}
1383*cdf0e10cSrcweir }
1384*cdf0e10cSrcweir 
1385*cdf0e10cSrcweir // -----------------------------------------------------------------------
1386*cdf0e10cSrcweir 
1387*cdf0e10cSrcweir const XubString& StatusBar::GetItemText( sal_uInt16 nItemId ) const
1388*cdf0e10cSrcweir {
1389*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1390*cdf0e10cSrcweir 
1391*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1392*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->maText;
1393*cdf0e10cSrcweir 	else
1394*cdf0e10cSrcweir 		return ImplGetSVEmptyStr();
1395*cdf0e10cSrcweir }
1396*cdf0e10cSrcweir 
1397*cdf0e10cSrcweir // -----------------------------------------------------------------------
1398*cdf0e10cSrcweir 
1399*cdf0e10cSrcweir void StatusBar::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand )
1400*cdf0e10cSrcweir {
1401*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1402*cdf0e10cSrcweir 
1403*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1404*cdf0e10cSrcweir 	{
1405*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1406*cdf0e10cSrcweir 
1407*cdf0e10cSrcweir 		if ( pItem->maCommand != rCommand )
1408*cdf0e10cSrcweir 			pItem->maCommand = rCommand;
1409*cdf0e10cSrcweir 	}
1410*cdf0e10cSrcweir }
1411*cdf0e10cSrcweir 
1412*cdf0e10cSrcweir // -----------------------------------------------------------------------
1413*cdf0e10cSrcweir 
1414*cdf0e10cSrcweir const XubString& StatusBar::GetItemCommand( sal_uInt16 nItemId )
1415*cdf0e10cSrcweir {
1416*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1417*cdf0e10cSrcweir 
1418*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1419*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->maCommand;
1420*cdf0e10cSrcweir 	else
1421*cdf0e10cSrcweir 		return ImplGetSVEmptyStr();
1422*cdf0e10cSrcweir }
1423*cdf0e10cSrcweir 
1424*cdf0e10cSrcweir // -----------------------------------------------------------------------
1425*cdf0e10cSrcweir 
1426*cdf0e10cSrcweir void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
1427*cdf0e10cSrcweir {
1428*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1429*cdf0e10cSrcweir 
1430*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1431*cdf0e10cSrcweir 	{
1432*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1433*cdf0e10cSrcweir 		pItem->mpUserData = pNewData;
1434*cdf0e10cSrcweir 
1435*cdf0e10cSrcweir 		// Wenn es ein User-Item ist, DrawItem-Aufrufen
1436*cdf0e10cSrcweir 		if ( (pItem->mnBits & SIB_USERDRAW) && pItem->mbVisible &&
1437*cdf0e10cSrcweir 			 !mbFormat && ImplIsItemUpdate() )
1438*cdf0e10cSrcweir 		{
1439*cdf0e10cSrcweir 			Update();
1440*cdf0e10cSrcweir 			ImplDrawItem( sal_True, nPos, sal_False, sal_False );
1441*cdf0e10cSrcweir 			Flush();
1442*cdf0e10cSrcweir 		}
1443*cdf0e10cSrcweir 	}
1444*cdf0e10cSrcweir }
1445*cdf0e10cSrcweir 
1446*cdf0e10cSrcweir // -----------------------------------------------------------------------
1447*cdf0e10cSrcweir 
1448*cdf0e10cSrcweir void* StatusBar::GetItemData( sal_uInt16 nItemId ) const
1449*cdf0e10cSrcweir {
1450*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1451*cdf0e10cSrcweir 
1452*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1453*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->mpUserData;
1454*cdf0e10cSrcweir 	else
1455*cdf0e10cSrcweir 		return NULL;
1456*cdf0e10cSrcweir }
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir // -----------------------------------------------------------------------
1459*cdf0e10cSrcweir 
1460*cdf0e10cSrcweir void StatusBar::SetHelpText( sal_uInt16 nItemId, const XubString& rText )
1461*cdf0e10cSrcweir {
1462*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1465*cdf0e10cSrcweir 		mpItemList->GetObject( nPos )->maHelpText = rText;
1466*cdf0e10cSrcweir }
1467*cdf0e10cSrcweir 
1468*cdf0e10cSrcweir // -----------------------------------------------------------------------
1469*cdf0e10cSrcweir 
1470*cdf0e10cSrcweir const XubString& StatusBar::GetHelpText( sal_uInt16 nItemId ) const
1471*cdf0e10cSrcweir {
1472*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1473*cdf0e10cSrcweir 
1474*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1475*cdf0e10cSrcweir 	{
1476*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1477*cdf0e10cSrcweir 		if ( !pItem->maHelpText.Len() && ( pItem->maHelpId.getLength() || pItem->maCommand.Len() ))
1478*cdf0e10cSrcweir 		{
1479*cdf0e10cSrcweir 			Help* pHelp = Application::GetHelp();
1480*cdf0e10cSrcweir 			if ( pHelp )
1481*cdf0e10cSrcweir             {
1482*cdf0e10cSrcweir 				if ( pItem->maCommand.Len() )
1483*cdf0e10cSrcweir                     pItem->maHelpText = pHelp->GetHelpText( pItem->maCommand, this );
1484*cdf0e10cSrcweir                 if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() )
1485*cdf0e10cSrcweir                     pItem->maHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this );
1486*cdf0e10cSrcweir             }
1487*cdf0e10cSrcweir 		}
1488*cdf0e10cSrcweir 
1489*cdf0e10cSrcweir 		return pItem->maHelpText;
1490*cdf0e10cSrcweir 	}
1491*cdf0e10cSrcweir 	else
1492*cdf0e10cSrcweir 		return ImplGetSVEmptyStr();
1493*cdf0e10cSrcweir }
1494*cdf0e10cSrcweir 
1495*cdf0e10cSrcweir // -----------------------------------------------------------------------
1496*cdf0e10cSrcweir 
1497*cdf0e10cSrcweir void StatusBar::SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText )
1498*cdf0e10cSrcweir {
1499*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1500*cdf0e10cSrcweir 
1501*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1502*cdf0e10cSrcweir 		mpItemList->GetObject( nPos )->maQuickHelpText = rText;
1503*cdf0e10cSrcweir }
1504*cdf0e10cSrcweir 
1505*cdf0e10cSrcweir // -----------------------------------------------------------------------
1506*cdf0e10cSrcweir 
1507*cdf0e10cSrcweir const XubString& StatusBar::GetQuickHelpText( sal_uInt16 nItemId ) const
1508*cdf0e10cSrcweir {
1509*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1510*cdf0e10cSrcweir 
1511*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1512*cdf0e10cSrcweir 	{
1513*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1514*cdf0e10cSrcweir 		return pItem->maQuickHelpText;
1515*cdf0e10cSrcweir 	}
1516*cdf0e10cSrcweir 	else
1517*cdf0e10cSrcweir 		return ImplGetSVEmptyStr();
1518*cdf0e10cSrcweir }
1519*cdf0e10cSrcweir 
1520*cdf0e10cSrcweir // -----------------------------------------------------------------------
1521*cdf0e10cSrcweir 
1522*cdf0e10cSrcweir void StatusBar::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId )
1523*cdf0e10cSrcweir {
1524*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1525*cdf0e10cSrcweir 
1526*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1527*cdf0e10cSrcweir 		mpItemList->GetObject( nPos )->maHelpId = rHelpId;
1528*cdf0e10cSrcweir }
1529*cdf0e10cSrcweir 
1530*cdf0e10cSrcweir // -----------------------------------------------------------------------
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir rtl::OString StatusBar::GetHelpId( sal_uInt16 nItemId ) const
1533*cdf0e10cSrcweir {
1534*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1535*cdf0e10cSrcweir 
1536*cdf0e10cSrcweir 	rtl::OString aRet;
1537*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1538*cdf0e10cSrcweir     {
1539*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1540*cdf0e10cSrcweir         if ( pItem->maHelpId.getLength() )
1541*cdf0e10cSrcweir             aRet = pItem->maHelpId;
1542*cdf0e10cSrcweir         else
1543*cdf0e10cSrcweir             aRet = ::rtl::OUStringToOString( pItem->maCommand, RTL_TEXTENCODING_UTF8 );
1544*cdf0e10cSrcweir     }
1545*cdf0e10cSrcweir 
1546*cdf0e10cSrcweir 	return aRet;
1547*cdf0e10cSrcweir }
1548*cdf0e10cSrcweir 
1549*cdf0e10cSrcweir // -----------------------------------------------------------------------
1550*cdf0e10cSrcweir 
1551*cdf0e10cSrcweir void StatusBar::ImplCalcBorder( )
1552*cdf0e10cSrcweir {
1553*cdf0e10cSrcweir 	mnCalcHeight = mnDY;
1554*cdf0e10cSrcweir     // subtract border
1555*cdf0e10cSrcweir     if( IsTopBorder() )
1556*cdf0e10cSrcweir     {
1557*cdf0e10cSrcweir         mnCalcHeight -= 2;
1558*cdf0e10cSrcweir         mnTextY += 2;
1559*cdf0e10cSrcweir         mnItemY += 2;
1560*cdf0e10cSrcweir     }
1561*cdf0e10cSrcweir 	if ( IsBottomBorder() )
1562*cdf0e10cSrcweir 		mnCalcHeight -= 2;
1563*cdf0e10cSrcweir 	mbFormat = sal_True;
1564*cdf0e10cSrcweir 	Invalidate();
1565*cdf0e10cSrcweir }
1566*cdf0e10cSrcweir 
1567*cdf0e10cSrcweir void StatusBar::SetBottomBorder( sal_Bool bBottomBorder )
1568*cdf0e10cSrcweir {
1569*cdf0e10cSrcweir 	if ( mbBottomBorder != bBottomBorder )
1570*cdf0e10cSrcweir 	{
1571*cdf0e10cSrcweir 		mbBottomBorder = bBottomBorder;
1572*cdf0e10cSrcweir         ImplCalcBorder();
1573*cdf0e10cSrcweir 	}
1574*cdf0e10cSrcweir }
1575*cdf0e10cSrcweir 
1576*cdf0e10cSrcweir void StatusBar::SetTopBorder( sal_Bool bTopBorder )
1577*cdf0e10cSrcweir {
1578*cdf0e10cSrcweir     if ( mpImplData->mbTopBorder != static_cast<bool>(bTopBorder) )
1579*cdf0e10cSrcweir     {
1580*cdf0e10cSrcweir 	    mpImplData->mbTopBorder = static_cast<bool>(bTopBorder);
1581*cdf0e10cSrcweir         ImplCalcBorder();
1582*cdf0e10cSrcweir     }
1583*cdf0e10cSrcweir }
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir sal_Bool StatusBar::IsTopBorder() const
1586*cdf0e10cSrcweir {
1587*cdf0e10cSrcweir     return mpImplData->mbTopBorder;
1588*cdf0e10cSrcweir }
1589*cdf0e10cSrcweir 
1590*cdf0e10cSrcweir // -----------------------------------------------------------------------
1591*cdf0e10cSrcweir 
1592*cdf0e10cSrcweir void StatusBar::StartProgressMode( const XubString& rText )
1593*cdf0e10cSrcweir {
1594*cdf0e10cSrcweir 	DBG_ASSERT( !mbProgressMode, "StatusBar::StartProgressMode(): progress mode is active" );
1595*cdf0e10cSrcweir 
1596*cdf0e10cSrcweir 	mbProgressMode	= sal_True;
1597*cdf0e10cSrcweir 	mnPercent		= 0;
1598*cdf0e10cSrcweir 	maPrgsTxt		= rText;
1599*cdf0e10cSrcweir 
1600*cdf0e10cSrcweir 	// Groessen berechnen
1601*cdf0e10cSrcweir 	ImplCalcProgressRect();
1602*cdf0e10cSrcweir 
1603*cdf0e10cSrcweir 	// Paint ausloesen (dort wird der Text und der Frame gemalt)
1604*cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1605*cdf0e10cSrcweir 	Color aPrgsColor = rStyleSettings.GetHighlightColor();
1606*cdf0e10cSrcweir 	if ( aPrgsColor == rStyleSettings.GetFaceColor() )
1607*cdf0e10cSrcweir 		aPrgsColor = rStyleSettings.GetDarkShadowColor();
1608*cdf0e10cSrcweir 	SetLineColor();
1609*cdf0e10cSrcweir 	SetFillColor( aPrgsColor );
1610*cdf0e10cSrcweir 	if ( IsReallyVisible() )
1611*cdf0e10cSrcweir 	{
1612*cdf0e10cSrcweir 		Invalidate();
1613*cdf0e10cSrcweir 		Update();
1614*cdf0e10cSrcweir 		Flush();
1615*cdf0e10cSrcweir 	}
1616*cdf0e10cSrcweir }
1617*cdf0e10cSrcweir 
1618*cdf0e10cSrcweir // -----------------------------------------------------------------------
1619*cdf0e10cSrcweir 
1620*cdf0e10cSrcweir void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
1621*cdf0e10cSrcweir {
1622*cdf0e10cSrcweir 	DBG_ASSERT( mbProgressMode, "StatusBar::SetProgressValue(): no progrss mode" );
1623*cdf0e10cSrcweir 	DBG_ASSERTWARNING( nNewPercent <= 100, "StatusBar::SetProgressValue(): nPercent > 100" );
1624*cdf0e10cSrcweir 
1625*cdf0e10cSrcweir 	if ( mbProgressMode
1626*cdf0e10cSrcweir 	&&   IsReallyVisible()
1627*cdf0e10cSrcweir 	&&   (!mnPercent || (mnPercent != nNewPercent)) )
1628*cdf0e10cSrcweir 	{
1629*cdf0e10cSrcweir 		Update();
1630*cdf0e10cSrcweir 		SetLineColor();
1631*cdf0e10cSrcweir 		ImplDrawProgress( sal_False, mnPercent, nNewPercent );
1632*cdf0e10cSrcweir 		Flush();
1633*cdf0e10cSrcweir 	}
1634*cdf0e10cSrcweir 	mnPercent = nNewPercent;
1635*cdf0e10cSrcweir }
1636*cdf0e10cSrcweir 
1637*cdf0e10cSrcweir // -----------------------------------------------------------------------
1638*cdf0e10cSrcweir 
1639*cdf0e10cSrcweir void StatusBar::EndProgressMode()
1640*cdf0e10cSrcweir {
1641*cdf0e10cSrcweir 	DBG_ASSERT( mbProgressMode, "StatusBar::EndProgressMode(): no progress mode" );
1642*cdf0e10cSrcweir 
1643*cdf0e10cSrcweir 	mbProgressMode = sal_False;
1644*cdf0e10cSrcweir 	maPrgsTxt.Erase();
1645*cdf0e10cSrcweir 
1646*cdf0e10cSrcweir 	// Paint neu ausloesen um StatusBar wieder herzustellen
1647*cdf0e10cSrcweir 	SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
1648*cdf0e10cSrcweir 	if ( IsReallyVisible() )
1649*cdf0e10cSrcweir 	{
1650*cdf0e10cSrcweir 		Invalidate();
1651*cdf0e10cSrcweir 		Update();
1652*cdf0e10cSrcweir 		Flush();
1653*cdf0e10cSrcweir 	}
1654*cdf0e10cSrcweir }
1655*cdf0e10cSrcweir 
1656*cdf0e10cSrcweir // -----------------------------------------------------------------------
1657*cdf0e10cSrcweir 
1658*cdf0e10cSrcweir void StatusBar::ResetProgressMode()
1659*cdf0e10cSrcweir {
1660*cdf0e10cSrcweir 	if ( mbProgressMode )
1661*cdf0e10cSrcweir 	{
1662*cdf0e10cSrcweir 		mnPercent = 0;
1663*cdf0e10cSrcweir 		maPrgsTxt.Erase();
1664*cdf0e10cSrcweir 		if ( IsReallyVisible() )
1665*cdf0e10cSrcweir 		{
1666*cdf0e10cSrcweir 			Invalidate();
1667*cdf0e10cSrcweir 			Update();
1668*cdf0e10cSrcweir 			Flush();
1669*cdf0e10cSrcweir 		}
1670*cdf0e10cSrcweir 	}
1671*cdf0e10cSrcweir }
1672*cdf0e10cSrcweir 
1673*cdf0e10cSrcweir // -----------------------------------------------------------------------
1674*cdf0e10cSrcweir 
1675*cdf0e10cSrcweir void StatusBar::SetText( const XubString& rText )
1676*cdf0e10cSrcweir {
1677*cdf0e10cSrcweir 	if ( (!mbVisibleItems || (GetStyle() & WB_RIGHT)) && !mbProgressMode &&
1678*cdf0e10cSrcweir 		 IsReallyVisible() && IsUpdateMode() )
1679*cdf0e10cSrcweir 	{
1680*cdf0e10cSrcweir 		if ( mbFormat  )
1681*cdf0e10cSrcweir 		{
1682*cdf0e10cSrcweir 			Invalidate();
1683*cdf0e10cSrcweir 			Window::SetText( rText );
1684*cdf0e10cSrcweir 		}
1685*cdf0e10cSrcweir 		else
1686*cdf0e10cSrcweir 		{
1687*cdf0e10cSrcweir 			Update();
1688*cdf0e10cSrcweir 			long nOldTextWidth = GetTextWidth( GetText() );
1689*cdf0e10cSrcweir 			Window::SetText( rText );
1690*cdf0e10cSrcweir 			ImplDrawText( sal_True, nOldTextWidth );
1691*cdf0e10cSrcweir 			Flush();
1692*cdf0e10cSrcweir 		}
1693*cdf0e10cSrcweir 	}
1694*cdf0e10cSrcweir 	else if ( mbProgressMode )
1695*cdf0e10cSrcweir 	{
1696*cdf0e10cSrcweir 		maPrgsTxt = rText;
1697*cdf0e10cSrcweir 		if ( IsReallyVisible() )
1698*cdf0e10cSrcweir 		{
1699*cdf0e10cSrcweir 			Invalidate();
1700*cdf0e10cSrcweir 			Update();
1701*cdf0e10cSrcweir 			Flush();
1702*cdf0e10cSrcweir 		}
1703*cdf0e10cSrcweir 	}
1704*cdf0e10cSrcweir 	else
1705*cdf0e10cSrcweir 		Window::SetText( rText );
1706*cdf0e10cSrcweir }
1707*cdf0e10cSrcweir 
1708*cdf0e10cSrcweir // -----------------------------------------------------------------------
1709*cdf0e10cSrcweir 
1710*cdf0e10cSrcweir Size StatusBar::CalcWindowSizePixel() const
1711*cdf0e10cSrcweir {
1712*cdf0e10cSrcweir 	sal_uLong	i = 0;
1713*cdf0e10cSrcweir 	sal_uLong	nCount = mpItemList->Count();
1714*cdf0e10cSrcweir 	long	nOffset = 0;
1715*cdf0e10cSrcweir 	long	nCalcWidth = (STATUSBAR_OFFSET_X*2);
1716*cdf0e10cSrcweir 	long	nCalcHeight;
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir 	while ( i < nCount )
1719*cdf0e10cSrcweir 	{
1720*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( i );
1721*cdf0e10cSrcweir 		nCalcWidth += pItem->mnWidth + nOffset;
1722*cdf0e10cSrcweir 		nOffset = pItem->mnOffset;
1723*cdf0e10cSrcweir 		i++;
1724*cdf0e10cSrcweir 	}
1725*cdf0e10cSrcweir 
1726*cdf0e10cSrcweir     long nMinHeight = GetTextHeight();
1727*cdf0e10cSrcweir     const long nBarTextOffset = STATUSBAR_OFFSET_TEXTY*2;
1728*cdf0e10cSrcweir     long nProgressHeight = nMinHeight + nBarTextOffset;
1729*cdf0e10cSrcweir     // FIXME: IsNativeControlSupported and GetNativeControlRegion should be const ?
1730*cdf0e10cSrcweir     StatusBar* pThis = const_cast<StatusBar*>( this );
1731*cdf0e10cSrcweir     if( pThis->IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
1732*cdf0e10cSrcweir     {
1733*cdf0e10cSrcweir         ImplControlValue aValue;
1734*cdf0e10cSrcweir         Rectangle aControlRegion( (const Point&)Point(), Size( nCalcWidth, nMinHeight ) );
1735*cdf0e10cSrcweir         Rectangle aNativeControlRegion, aNativeContentRegion;
1736*cdf0e10cSrcweir         if( pThis->GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
1737*cdf0e10cSrcweir                                            CTRL_STATE_ENABLED, aValue, rtl::OUString(),
1738*cdf0e10cSrcweir                                            aNativeControlRegion, aNativeContentRegion ) )
1739*cdf0e10cSrcweir         {
1740*cdf0e10cSrcweir             nProgressHeight = aNativeControlRegion.GetHeight();
1741*cdf0e10cSrcweir         }
1742*cdf0e10cSrcweir     }
1743*cdf0e10cSrcweir 
1744*cdf0e10cSrcweir     if( mpImplData->mbDrawItemFrames &&
1745*cdf0e10cSrcweir         pThis->IsNativeControlSupported( CTRL_FRAME, PART_BORDER ) )
1746*cdf0e10cSrcweir     {
1747*cdf0e10cSrcweir         ImplControlValue aControlValue( FRAME_DRAW_NODRAW );
1748*cdf0e10cSrcweir         Rectangle aBound, aContent;
1749*cdf0e10cSrcweir         Rectangle aNatRgn( Point( 0, 0 ), Size( 150, 50 ) );
1750*cdf0e10cSrcweir         if(	pThis->GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
1751*cdf0e10cSrcweir             aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) )
1752*cdf0e10cSrcweir         {
1753*cdf0e10cSrcweir             mpImplData->mnItemBorderWidth =
1754*cdf0e10cSrcweir                 ( aBound.GetHeight() - aContent.GetHeight() ) / 2;
1755*cdf0e10cSrcweir         }
1756*cdf0e10cSrcweir     }
1757*cdf0e10cSrcweir 
1758*cdf0e10cSrcweir 	nCalcHeight = nMinHeight+nBarTextOffset + 2*mpImplData->mnItemBorderWidth;
1759*cdf0e10cSrcweir     if( nCalcHeight < nProgressHeight+2 )
1760*cdf0e10cSrcweir         nCalcHeight = nProgressHeight+2;
1761*cdf0e10cSrcweir 
1762*cdf0e10cSrcweir     // add border
1763*cdf0e10cSrcweir     if( IsTopBorder() )
1764*cdf0e10cSrcweir         nCalcHeight += 2;
1765*cdf0e10cSrcweir 	if ( IsBottomBorder() )
1766*cdf0e10cSrcweir 		nCalcHeight += 2;
1767*cdf0e10cSrcweir 
1768*cdf0e10cSrcweir 	return Size( nCalcWidth, nCalcHeight );
1769*cdf0e10cSrcweir }
1770*cdf0e10cSrcweir 
1771*cdf0e10cSrcweir 
1772*cdf0e10cSrcweir // -----------------------------------------------------------------------
1773*cdf0e10cSrcweir 
1774*cdf0e10cSrcweir void StatusBar::SetAccessibleName( sal_uInt16 nItemId, const XubString& rName )
1775*cdf0e10cSrcweir {
1776*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1777*cdf0e10cSrcweir 
1778*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1779*cdf0e10cSrcweir 	{
1780*cdf0e10cSrcweir 		ImplStatusItem* pItem = mpItemList->GetObject( nPos );
1781*cdf0e10cSrcweir 
1782*cdf0e10cSrcweir 		if ( pItem->maAccessibleName != rName )
1783*cdf0e10cSrcweir 		{
1784*cdf0e10cSrcweir 			pItem->maAccessibleName = rName;
1785*cdf0e10cSrcweir 			ImplCallEventListeners( VCLEVENT_STATUSBAR_NAMECHANGED, (void*) sal_IntPtr(pItem->mnId) );
1786*cdf0e10cSrcweir 		}
1787*cdf0e10cSrcweir 	}
1788*cdf0e10cSrcweir }
1789*cdf0e10cSrcweir 
1790*cdf0e10cSrcweir // -----------------------------------------------------------------------
1791*cdf0e10cSrcweir 
1792*cdf0e10cSrcweir const XubString& StatusBar::GetAccessibleName( sal_uInt16 nItemId ) const
1793*cdf0e10cSrcweir {
1794*cdf0e10cSrcweir 	sal_uInt16 nPos = GetItemPos( nItemId );
1795*cdf0e10cSrcweir 
1796*cdf0e10cSrcweir 	if ( nPos != STATUSBAR_ITEM_NOTFOUND )
1797*cdf0e10cSrcweir 		return mpItemList->GetObject( nPos )->maAccessibleName;
1798*cdf0e10cSrcweir 	else
1799*cdf0e10cSrcweir 		return ImplGetSVEmptyStr();
1800*cdf0e10cSrcweir }
1801*cdf0e10cSrcweir 
1802*cdf0e10cSrcweir // -----------------------------------------------------------------------
1803