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