xref: /AOO41X/main/vcl/inc/ilstbox.hxx (revision ad3a95a388ca181114ec1bc6cb467fb7f4c38a0c)
1161f4cd1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3161f4cd1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4161f4cd1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5161f4cd1SAndrew Rist  * distributed with this work for additional information
6161f4cd1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7161f4cd1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8161f4cd1SAndrew Rist  * "License"); you may not use this file except in compliance
9161f4cd1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11161f4cd1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13161f4cd1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14161f4cd1SAndrew Rist  * software distributed under the License is distributed on an
15161f4cd1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16161f4cd1SAndrew Rist  * KIND, either express or implied.  See the License for the
17161f4cd1SAndrew Rist  * specific language governing permissions and limitations
18161f4cd1SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20161f4cd1SAndrew Rist  *************************************************************/
21161f4cd1SAndrew Rist 
22161f4cd1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_ILSTBOX_HXX
25cdf0e10cSrcweir #define _SV_ILSTBOX_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/sv.h>
28cdf0e10cSrcweir #include <vcl/image.hxx>
29cdf0e10cSrcweir #include <vcl/ctrl.hxx>
30cdf0e10cSrcweir #include <vcl/button.hxx>
31cdf0e10cSrcweir #include <vcl/floatwin.hxx>
32cdf0e10cSrcweir #include <vcl/lstbox.h>
33cdf0e10cSrcweir #include <vcl/timer.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include "vcl/quickselectionengine.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class ScrollBar;
38cdf0e10cSrcweir class ScrollBarBox;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir // -----------------
41cdf0e10cSrcweir // - ListBox-Types -
42cdf0e10cSrcweir // -----------------
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #define HORZ_SCROLL 		4
45cdf0e10cSrcweir #define IMG_TXT_DISTANCE	6
46cdf0e10cSrcweir 
47cdf0e10cSrcweir enum LB_EVENT_TYPE
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 	LET_MBDOWN,
50cdf0e10cSrcweir 	LET_TRACKING,
51cdf0e10cSrcweir 	LET_TRACKING_END,
52cdf0e10cSrcweir 	LET_KEYMOVE,
53cdf0e10cSrcweir 	LET_KEYSPACE
54cdf0e10cSrcweir };
55cdf0e10cSrcweir 
56cdf0e10cSrcweir // -----------------
57cdf0e10cSrcweir // - ImplEntryType -
58cdf0e10cSrcweir // -----------------
59cdf0e10cSrcweir 
60cdf0e10cSrcweir struct ImplEntryType
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	XubString	maStr;
63cdf0e10cSrcweir 	Image		maImage;
64cdf0e10cSrcweir 	void*		mpUserData;
65cdf0e10cSrcweir 	sal_Bool		mbIsSelected;
66cdf0e10cSrcweir 	long		mnFlags;
67cdf0e10cSrcweir     long        mnHeight;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 				ImplEntryType( const XubString& rStr, const Image& rImage ) :
70cdf0e10cSrcweir 					maStr( rStr ),
71cdf0e10cSrcweir 					maImage( rImage ),
72cdf0e10cSrcweir 					mnFlags( 0 ),
73cdf0e10cSrcweir                     mnHeight( 0 )
74cdf0e10cSrcweir 				{
75cdf0e10cSrcweir 					mbIsSelected = sal_False;
76cdf0e10cSrcweir 					mpUserData = NULL;
77cdf0e10cSrcweir 				}
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 				ImplEntryType( const XubString& rStr ) :
80cdf0e10cSrcweir 					maStr( rStr ),
81cdf0e10cSrcweir 					mnFlags( 0 ),
82cdf0e10cSrcweir                     mnHeight( 0 )
83cdf0e10cSrcweir 				{
84cdf0e10cSrcweir 					mbIsSelected = sal_False;
85cdf0e10cSrcweir 					mpUserData = NULL;
86cdf0e10cSrcweir 				}
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 				ImplEntryType( const Image& rImage ) :
89cdf0e10cSrcweir 					maImage( rImage ),
90cdf0e10cSrcweir 					mnFlags( 0 ),
91cdf0e10cSrcweir                     mnHeight( 0 )
92cdf0e10cSrcweir 				{
93cdf0e10cSrcweir 					mbIsSelected = sal_False;
94cdf0e10cSrcweir 					mpUserData = NULL;
95cdf0e10cSrcweir 				}
96cdf0e10cSrcweir };
97cdf0e10cSrcweir 
98cdf0e10cSrcweir // -----------------
99cdf0e10cSrcweir // - ImplEntryList -
100cdf0e10cSrcweir // -----------------
101cdf0e10cSrcweir 
102cdf0e10cSrcweir class ImplEntryList : private List
103cdf0e10cSrcweir {
104cdf0e10cSrcweir private:
105cdf0e10cSrcweir     Window*         mpWindow;   // For getting the current locale when matching strings
106cdf0e10cSrcweir 	sal_uInt16			mnLastSelected;
107cdf0e10cSrcweir 	sal_uInt16			mnSelectionAnchor;
108cdf0e10cSrcweir 	sal_uInt16			mnImages;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	sal_uInt16			mnMRUCount;
111cdf0e10cSrcweir 	sal_uInt16			mnMaxMRUCount;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	Link			maSelectionChangedHdl;
114cdf0e10cSrcweir 	sal_Bool			mbCallSelectionChangedHdl;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	ImplEntryType*	GetEntry( sal_uInt16 nPos )	const { return (ImplEntryType*)List::GetObject( nPos ); }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir public:
119cdf0e10cSrcweir 					ImplEntryList( Window* pWindow );
120cdf0e10cSrcweir 					~ImplEntryList();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	sal_uInt16					InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort );
123cdf0e10cSrcweir 	void					RemoveEntry( sal_uInt16 nPos );
124cdf0e10cSrcweir 	const ImplEntryType* 	GetEntryPtr( sal_uInt16 nPos ) const { return (const ImplEntryType*) GetObject( nPos ); }
125cdf0e10cSrcweir 	ImplEntryType* 	        GetMutableEntryPtr( sal_uInt16 nPos ) const { return (ImplEntryType*) GetObject( nPos ); }
126cdf0e10cSrcweir 	void					Clear();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	sal_uInt16			FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart = 0, sal_Bool bForward = sal_True, sal_Bool bLazy = sal_True ) const;
129cdf0e10cSrcweir 	sal_uInt16			FindEntry( const XubString& rStr, sal_Bool bSearchMRUArea = sal_False ) const;
130cdf0e10cSrcweir 	sal_uInt16			FindEntry( const void* pData ) const;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     // helper: add up heights up to index nEndIndex.
133cdf0e10cSrcweir     // GetAddedHeight( 0 ) returns 0
134cdf0e10cSrcweir     // GetAddedHeight( LISTBOX_ENTRY_NOTFOUND ) returns 0
135cdf0e10cSrcweir     // GetAddedHeight( i, k ) with k > i is equivalent -GetAddedHeight( k, i )
136cdf0e10cSrcweir     long            GetAddedHeight( sal_uInt16 nEndIndex, sal_uInt16 nBeginIndex = 0, long nBeginHeight = 0 ) const;
137cdf0e10cSrcweir     long            GetEntryHeight( sal_uInt16 nPos ) const;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	sal_uInt16			GetEntryCount() const { return (sal_uInt16)List::Count(); }
140cdf0e10cSrcweir 	sal_Bool			HasImages() const { return mnImages ? sal_True : sal_False; }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	XubString		GetEntryText( sal_uInt16 nPos ) const;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	sal_Bool			HasEntryImage( sal_uInt16 nPos ) const;
145cdf0e10cSrcweir 	Image			GetEntryImage( sal_uInt16 nPos ) const;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 	void			SetEntryData( sal_uInt16 nPos, void* pNewData );
148cdf0e10cSrcweir 	void*			GetEntryData( sal_uInt16 nPos ) const;
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	void			SetEntryFlags( sal_uInt16 nPos, long nFlags );
151cdf0e10cSrcweir 	long			GetEntryFlags( sal_uInt16 nPos ) const;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	void			SelectEntry( sal_uInt16 nPos, sal_Bool bSelect );
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	sal_uInt16			GetSelectEntryCount() const;
156cdf0e10cSrcweir 	XubString		GetSelectEntry( sal_uInt16 nIndex ) const;
157cdf0e10cSrcweir 	sal_uInt16			GetSelectEntryPos( sal_uInt16 nIndex ) const;
158cdf0e10cSrcweir 	sal_Bool			IsEntrySelected( const XubString& rStr ) const;
159cdf0e10cSrcweir 	sal_Bool			IsEntryPosSelected( sal_uInt16 nIndex ) const;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	void			SetLastSelected( sal_uInt16 nPos )	{ mnLastSelected = nPos; }
162cdf0e10cSrcweir 	sal_uInt16			GetLastSelected() const { return mnLastSelected; }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	void			SetSelectionAnchor( sal_uInt16 nPos )	{ mnSelectionAnchor = nPos; }
165cdf0e10cSrcweir 	sal_uInt16			GetSelectionAnchor() const { return mnSelectionAnchor; }
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	void			SetSelectionChangedHdl( const Link& rLnk )	{ maSelectionChangedHdl = rLnk; }
169cdf0e10cSrcweir 	void			SetCallSelectionChangedHdl( sal_Bool bCall )	{ mbCallSelectionChangedHdl = bCall; }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	void			SetMRUCount( sal_uInt16 n )	{ mnMRUCount = n; }
172cdf0e10cSrcweir 	sal_uInt16			GetMRUCount() const		{ return mnMRUCount; }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 	void			SetMaxMRUCount( sal_uInt16 n )	{ mnMaxMRUCount = n; }
175cdf0e10cSrcweir 	sal_uInt16			GetMaxMRUCount() const		{ return mnMaxMRUCount; }
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	/**	An Entry is selectable if its mnFlags does not have the
178cdf0e10cSrcweir 		LISTBOX_ENTRY_FLAG_DISABLE_SELECTION flag set. */
179cdf0e10cSrcweir 	bool			IsEntrySelectable( sal_uInt16 nPos ) const;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	/** returns the first entry found from the given position nPos that is selectable
182cdf0e10cSrcweir 		or LISTBOX_ENTRY_NOTFOUND if non is found. If the entry at nPos is not selectable,
183cdf0e10cSrcweir 		it returns the first selectable entry after nPos if bForward is true and the
184cdf0e10cSrcweir 		first selectable entry after nPos is bForward is false.
185cdf0e10cSrcweir 		*/
186cdf0e10cSrcweir 	sal_uInt16			FindFirstSelectable( sal_uInt16 nPos, bool bForward = true );
187cdf0e10cSrcweir };
188cdf0e10cSrcweir 
189cdf0e10cSrcweir // ---------------------
190cdf0e10cSrcweir // - ImplListBoxWindow -
191cdf0e10cSrcweir // ---------------------
192cdf0e10cSrcweir 
193cdf0e10cSrcweir class ImplListBoxWindow : public Control, public ::vcl::ISearchableStringList
194cdf0e10cSrcweir {
195cdf0e10cSrcweir private:
196cdf0e10cSrcweir 	ImplEntryList*	mpEntryList;	 // EntryListe
197cdf0e10cSrcweir 	Rectangle		maFocusRect;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	Size			maUserItemSize;
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 	long			mnMaxTxtHeight;  // Maximale Hoehe eines Text-Items
202cdf0e10cSrcweir 	long			mnMaxTxtWidth;	 // Maximale Breite eines Text-Items
203cdf0e10cSrcweir 									 // Entry ohne Image
204cdf0e10cSrcweir 	long			mnMaxImgTxtWidth;// Maximale Breite eines Text-Items
205cdf0e10cSrcweir 									 // Entry UND Image
206cdf0e10cSrcweir 	long			mnMaxImgWidth;	 // Maximale Breite eines Image-Items
207cdf0e10cSrcweir 	long			mnMaxImgHeight;  // Maximale Hoehe eines Image-Items
208cdf0e10cSrcweir 	long			mnMaxWidth; 	 // Maximale Breite eines Eintrags
209cdf0e10cSrcweir 	long			mnMaxHeight;	 // Maximale Hoehe eines Eintrags
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 	sal_uInt16			mnCurrentPos;	 // Position (Focus)
212cdf0e10cSrcweir 	sal_uInt16			mnTrackingSaveSelection; // Selektion vor Tracking();
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 	sal_uInt16			mnSeparatorPos;	// Separator
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 	sal_uInt16			mnUserDrawEntry;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	sal_uInt16			mnTop;			 // Ausgabe ab Zeile
219cdf0e10cSrcweir 	long			mnLeft; 		 // Ausgabe ab Spalte
220cdf0e10cSrcweir 	long			mnBorder;		 // Abstand Rahmen - Text
221cdf0e10cSrcweir 	long			mnTextHeight;	 // Texthoehe
222cdf0e10cSrcweir 	ProminentEntry  meProminentType; // where is the "prominent" entry
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	sal_uInt16			mnSelectModifier;	// Modifiers
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     sal_Bool			mbHasFocusRect:         1,
227cdf0e10cSrcweir                     mbSort: 				1,	// ListBox sortiert
228cdf0e10cSrcweir 					mbTrack:				1,	// Tracking
229cdf0e10cSrcweir 					mbMulti:				1,	// MultiListBox
230cdf0e10cSrcweir 					mbStackMode:			1,	// StackSelection
231cdf0e10cSrcweir 					mbSimpleMode:			1,	// SimpleMode fuer MultiListBox
232cdf0e10cSrcweir 					mbImgsDiffSz:			1,	// Images haben verschiedene Groessen
233cdf0e10cSrcweir 					mbTravelSelect: 		1,	// TravelSelect
234cdf0e10cSrcweir 					mbTrackingSelect: 		1,	// Selektiert bei MouseMove
235cdf0e10cSrcweir 					mbSelectionChanged:		1,	// Select() nicht zu oft rufen...
236cdf0e10cSrcweir 					mbMouseMoveSelect:		1,  // Selektieren bei MouseMove
237cdf0e10cSrcweir 					mbGrabFocus:			1,  // Focus bei MBDown grabben
238cdf0e10cSrcweir 					mbUserDrawEnabled:		1,	// UserDraw possible
239cdf0e10cSrcweir 					mbInUserDraw:			1,	// In UserDraw
240cdf0e10cSrcweir 					mbReadOnly:				1,	// ReadOnly
241cdf0e10cSrcweir 					mbMirroring:			1,	// pb: #106948# explicit mirroring for calc
242cdf0e10cSrcweir                     mbRight:                1,  // right align Text output
243cdf0e10cSrcweir                     mbCenter:               1;  // center Text output
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	Link			maScrollHdl;
246cdf0e10cSrcweir 	Link			maSelectHdl;
247cdf0e10cSrcweir 	Link			maCancelHdl;
248cdf0e10cSrcweir 	Link			maDoubleClickHdl;
249cdf0e10cSrcweir 	Link			maUserDrawHdl;
250cdf0e10cSrcweir 	Link			maMRUChangedHdl;
251*ad3a95a3SSteve Yin //IAccessibility2 Implementation 2009-----
252*ad3a95a3SSteve Yin 	Link			maFocusHdl;
253*ad3a95a3SSteve Yin 	Link			maListItemSelectHdl;
254*ad3a95a3SSteve Yin //-----IAccessibility2 Implementation 2009
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     ::vcl::QuickSelectionEngine
257cdf0e10cSrcweir                     maQuickSelectionEngine;
258cdf0e10cSrcweir 
259cdf0e10cSrcweir protected:
260cdf0e10cSrcweir 	virtual void	KeyInput( const KeyEvent& rKEvt );
261cdf0e10cSrcweir 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
262cdf0e10cSrcweir 	virtual void	MouseMove( const MouseEvent& rMEvt );
263cdf0e10cSrcweir 	virtual void	Tracking( const TrackingEvent& rTEvt );
264cdf0e10cSrcweir 	virtual void	Paint( const Rectangle& rRect );
265cdf0e10cSrcweir 	virtual void	Resize();
266cdf0e10cSrcweir 	virtual void	GetFocus();
267cdf0e10cSrcweir 	virtual void	LoseFocus();
268cdf0e10cSrcweir 
269*ad3a95a3SSteve Yin 	//IAccessibility2 Implementation 2009-----
270*ad3a95a3SSteve Yin 	//sal_Bool			SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False );
271*ad3a95a3SSteve Yin 	sal_Bool			SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False, sal_Bool bSelectPosChange = sal_False );
272*ad3a95a3SSteve Yin 	//-----IAccessibility2 Implementation 2009
273cdf0e10cSrcweir 	void			ImplPaint( sal_uInt16 nPos, sal_Bool bErase = sal_False, bool bLayout = false );
274cdf0e10cSrcweir     void			ImplDoPaint( const Rectangle& rRect, bool bLayout = false );
275cdf0e10cSrcweir 	void			ImplCalcMetrics();
276cdf0e10cSrcweir 	void			ImplUpdateEntryMetrics( ImplEntryType& rEntry );
277cdf0e10cSrcweir 	void			ImplCallSelect();
278cdf0e10cSrcweir 
279cdf0e10cSrcweir     void            ImplShowFocusRect();
280cdf0e10cSrcweir     void            ImplHideFocusRect();
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	virtual void	StateChanged( StateChangedType nType );
284cdf0e10cSrcweir 	virtual void	DataChanged( const DataChangedEvent& rDCEvt );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir public:
287cdf0e10cSrcweir     virtual void  FillLayoutData() const;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 					ImplListBoxWindow( Window* pParent, WinBits nWinStyle );
290cdf0e10cSrcweir 					~ImplListBoxWindow();
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	ImplEntryList*	GetEntryList() const { return mpEntryList; }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	sal_uInt16			InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry );
295cdf0e10cSrcweir 	void			RemoveEntry( sal_uInt16 nPos );
296cdf0e10cSrcweir 	void			Clear();
297cdf0e10cSrcweir 	void			ResetCurrentPos()				{ mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; }
298cdf0e10cSrcweir 	sal_uInt16			GetCurrentPos()	const			{ return mnCurrentPos; }
299cdf0e10cSrcweir     sal_uInt16			GetDisplayLineCount() const;
300cdf0e10cSrcweir     void            SetEntryFlags( sal_uInt16 nPos, long nFlags );
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	void 			DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false );
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 	void			SelectEntry( sal_uInt16 nPos, sal_Bool bSelect );
305cdf0e10cSrcweir 	void			DeselectAll();
306cdf0e10cSrcweir     sal_uInt16			GetEntryPosForPoint( const Point& rPoint ) const;
307cdf0e10cSrcweir     sal_uInt16          GetLastVisibleEntry() const;
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 	sal_Bool			ProcessKeyInput( const KeyEvent& rKEvt );
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 	void			SetTopEntry( sal_uInt16 nTop );
312cdf0e10cSrcweir 	sal_uInt16			GetTopEntry() const 			{ return mnTop; }
313cdf0e10cSrcweir 	// ShowProminentEntry will set the entry correspoding to nEntryPos
314cdf0e10cSrcweir 	// either at top or in the middle depending on the chosen style
315cdf0e10cSrcweir 	void            ShowProminentEntry( sal_uInt16 nEntryPos );
316cdf0e10cSrcweir 	void            SetProminentEntryType( ProminentEntry eType ) { meProminentType = eType; }
317cdf0e10cSrcweir 	ProminentEntry  GetProminentEntryType() const { return meProminentType; }
318cdf0e10cSrcweir     using Window::IsVisible;
319cdf0e10cSrcweir 	sal_Bool			IsVisible( sal_uInt16 nEntry ) const;
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 	long			GetLeftIndent() const			{ return mnLeft; }
322cdf0e10cSrcweir 	void			SetLeftIndent( long n );
323cdf0e10cSrcweir 	void			ScrollHorz( long nDiff );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	void			AllowGrabFocus( sal_Bool b )		{ mbGrabFocus = b; }
326cdf0e10cSrcweir 	sal_Bool			IsGrabFocusAllowed() const		{ return mbGrabFocus; }
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	void			SetSeparatorPos( sal_uInt16 n )		{ mnSeparatorPos = n; }
329cdf0e10cSrcweir 	sal_uInt16			GetSeparatorPos() const			{ return mnSeparatorPos; }
330cdf0e10cSrcweir 
331cdf0e10cSrcweir 	void            SetTravelSelect( sal_Bool bTravelSelect ) { mbTravelSelect = bTravelSelect; }
332cdf0e10cSrcweir 	sal_Bool			IsTravelSelect() const			{ return mbTravelSelect; }
333cdf0e10cSrcweir 	sal_Bool			IsTrackingSelect() const			{ return mbTrackingSelect; }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 	void			SetUserItemSize( const Size& rSz );
336cdf0e10cSrcweir 	const Size&		GetUserItemSize() const				{ return maUserItemSize; }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 	void			EnableUserDraw( sal_Bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
339cdf0e10cSrcweir 	sal_Bool			IsUserDrawEnabled() const 	{ return mbUserDrawEnabled; }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 	void			EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; }
342cdf0e10cSrcweir 	sal_Bool			IsMultiSelectionEnabled() const 	{ return mbMulti; }
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 	void			SetMultiSelectionSimpleMode( sal_Bool bSimple )	{ mbSimpleMode = bSimple; }
345cdf0e10cSrcweir 	sal_Bool			IsMultiSelectionSimpleMode() const 			{ return mbSimpleMode; }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 	void			EnableMouseMoveSelect( sal_Bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; }
348cdf0e10cSrcweir 	sal_Bool			IsMouseMoveSelectEnabled() const 	{ return mbMouseMoveSelect; }
349cdf0e10cSrcweir 	sal_Bool			IsMouseMoveSelect() const 	{ return mbMouseMoveSelect||mbStackMode; }
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 	Size			CalcSize( sal_uInt16 nMaxLines ) const;
352cdf0e10cSrcweir     Rectangle       GetBoundingRectangle( sal_uInt16 nItem ) const;
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     long			GetEntryHeight() const				{ return mnMaxHeight; }
355cdf0e10cSrcweir 	long			GetMaxEntryWidth() const			{ return mnMaxWidth; }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 	void			SetScrollHdl( const Link& rLink )	{ maScrollHdl = rLink; }
358cdf0e10cSrcweir 	const Link& 	GetScrollHdl() const				{ return maScrollHdl; }
359cdf0e10cSrcweir 	void			SetSelectHdl( const Link& rLink )	{ maSelectHdl = rLink; }
360cdf0e10cSrcweir 	const Link& 	GetSelectHdl() const				{ return maSelectHdl; }
361cdf0e10cSrcweir 	void			SetCancelHdl( const Link& rLink )	{ maCancelHdl = rLink; }
362cdf0e10cSrcweir 	const Link& 	GetCancelHdl() const				{ return maCancelHdl; }
363cdf0e10cSrcweir 	void			SetDoubleClickHdl( const Link& rLink )	{ maDoubleClickHdl = rLink; }
364cdf0e10cSrcweir 	const Link& 	GetDoubleClickHdl() const				{ return maDoubleClickHdl; }
365cdf0e10cSrcweir 	void			SetUserDrawHdl( const Link& rLink )	{ maUserDrawHdl = rLink; }
366cdf0e10cSrcweir 	const Link& 	GetUserDrawHdl() const				{ return maUserDrawHdl; }
367cdf0e10cSrcweir 	void			SetMRUChangedHdl( const Link& rLink )	{ maMRUChangedHdl = rLink; }
368cdf0e10cSrcweir 	const Link& 	GetMRUChangedHdl() const				{ return maMRUChangedHdl; }
369*ad3a95a3SSteve Yin //IAccessibility2 Implementation 2009-----
370*ad3a95a3SSteve Yin 	void			SetFocusHdl( const Link& rLink )	{ maFocusHdl = rLink ; }
371*ad3a95a3SSteve Yin 	const Link& 	GetFocusHdl() const				{ return maFocusHdl; }
372cdf0e10cSrcweir 
373*ad3a95a3SSteve Yin 	void			SetListItemSelectHdl( const Link& rLink )	{ maListItemSelectHdl = rLink ; }
374*ad3a95a3SSteve Yin 	const Link& 	GetListItemSelectHdl() const				{ return maListItemSelectHdl; }
375*ad3a95a3SSteve Yin //-----IAccessibility2 Implementation 2009
376cdf0e10cSrcweir 	sal_Bool			IsSelectionChanged() const { return mbSelectionChanged; }
377cdf0e10cSrcweir 	sal_uInt16			GetSelectModifier() const { return mnSelectModifier; }
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 	void			EnableSort( sal_Bool b ) { mbSort = b; }
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	void			SetReadOnly( sal_Bool bReadOnly ) 	{ mbReadOnly = bReadOnly; }
382cdf0e10cSrcweir 	sal_Bool			IsReadOnly() const 				{ return mbReadOnly; }
383cdf0e10cSrcweir 
384cdf0e10cSrcweir     using Control::ImplInitSettings;
385cdf0e10cSrcweir 	void			ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
386cdf0e10cSrcweir     sal_uInt16          ImplGetTextStyle() const;
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 	// pb: #106948# explicit mirroring for calc
389cdf0e10cSrcweir 	inline void		EnableMirroring()		{ mbMirroring = sal_True; }
390cdf0e10cSrcweir 	inline sal_Bool		IsMirroring() const { return mbMirroring; }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir protected:
393cdf0e10cSrcweir     // ISearchableStringList
394cdf0e10cSrcweir     virtual ::vcl::StringEntryIdentifier    CurrentEntry( String& _out_entryText ) const;
395cdf0e10cSrcweir     virtual ::vcl::StringEntryIdentifier    NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const;
396cdf0e10cSrcweir     virtual void                            SelectEntry( ::vcl::StringEntryIdentifier _entry );
397cdf0e10cSrcweir };
398cdf0e10cSrcweir 
399cdf0e10cSrcweir // ---------------
400cdf0e10cSrcweir // - ImplListBox -
401cdf0e10cSrcweir // ---------------
402cdf0e10cSrcweir 
403cdf0e10cSrcweir class ImplListBox : public Control
404cdf0e10cSrcweir {
405cdf0e10cSrcweir private:
406cdf0e10cSrcweir 	ImplListBoxWindow	maLBWindow;
407cdf0e10cSrcweir 	ScrollBar*			mpHScrollBar;
408cdf0e10cSrcweir 	ScrollBar*			mpVScrollBar;
409cdf0e10cSrcweir 	ScrollBarBox*		mpScrollBarBox;
410cdf0e10cSrcweir 	sal_Bool				mbVScroll		: 1,	// VScroll an oder aus
411cdf0e10cSrcweir 						mbHScroll		: 1,	// HScroll an oder aus
412cdf0e10cSrcweir 						mbAutoHScroll	: 1;	// AutoHScroll an oder aus
413cdf0e10cSrcweir 	Link				maScrollHdl;	// Weil der vom ImplListBoxWindow selbst benoetigt wird.
414cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
415cdf0e10cSrcweir 
416cdf0e10cSrcweir protected:
417cdf0e10cSrcweir 	virtual void		GetFocus();
418cdf0e10cSrcweir 	virtual void		StateChanged( StateChangedType nType );
419cdf0e10cSrcweir 	virtual void		DataChanged( const DataChangedEvent& rDCEvt );
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 	long 				Notify( NotifyEvent& rNEvt );
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 	void				ImplResizeControls();
424cdf0e10cSrcweir 	void				ImplCheckScrollBars();
425cdf0e10cSrcweir 	void				ImplInitScrollBars();
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 	DECL_LINK(			ScrollBarHdl, ScrollBar* );
428cdf0e10cSrcweir 	DECL_LINK(			LBWindowScrolled, void* );
429cdf0e10cSrcweir 	DECL_LINK(			MRUChanged, void* );
430cdf0e10cSrcweir 
431cdf0e10cSrcweir public:
432cdf0e10cSrcweir 					ImplListBox( Window* pParent, WinBits nWinStyle );
433cdf0e10cSrcweir 					~ImplListBox();
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 	const ImplEntryList*	GetEntryList() const			{ return maLBWindow.GetEntryList(); }
436cdf0e10cSrcweir 	ImplListBoxWindow* 		GetMainWindow() 				{ return &maLBWindow; }
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 	virtual void	Resize();
439cdf0e10cSrcweir     virtual const Wallpaper& GetDisplayBackground() const;
440cdf0e10cSrcweir     virtual Window*     GetPreferredKeyInputWindow();
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 	sal_uInt16			InsertEntry( sal_uInt16 nPos, const XubString& rStr );
443cdf0e10cSrcweir 	sal_uInt16			InsertEntry( sal_uInt16 nPos, const Image& rImage );
444cdf0e10cSrcweir 	sal_uInt16			InsertEntry( sal_uInt16 nPos, const XubString& rStr, const Image& rImage );
445cdf0e10cSrcweir 	void			RemoveEntry( sal_uInt16 nPos );
446cdf0e10cSrcweir 	void			SetEntryData( sal_uInt16 nPos, void* pNewData )	{ maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); }
447cdf0e10cSrcweir 	void			Clear();
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 	void			SetEntryFlags( sal_uInt16 nPos, long nFlags );
450cdf0e10cSrcweir 	long			GetEntryFlags( sal_uInt16 nPos ) const;
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 	void			SelectEntry( sal_uInt16 nPos, sal_Bool bSelect );
453cdf0e10cSrcweir 	void			SetNoSelection();
454cdf0e10cSrcweir 	void			ResetCurrentPos()				{ maLBWindow.ResetCurrentPos(); }
455cdf0e10cSrcweir 	sal_uInt16			GetCurrentPos()	const			{ return maLBWindow.GetCurrentPos(); }
456cdf0e10cSrcweir 
457cdf0e10cSrcweir 	sal_Bool			ProcessKeyInput( const KeyEvent& rKEvt )	{ return maLBWindow.ProcessKeyInput( rKEvt ); }
458cdf0e10cSrcweir 	sal_Bool			HandleWheelAsCursorTravel( const CommandEvent& rCEvt );
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 	void			SetSeparatorPos( sal_uInt16 n )		{ maLBWindow.SetSeparatorPos( n ); }
461cdf0e10cSrcweir 	sal_uInt16			GetSeparatorPos() const			{ return maLBWindow.GetSeparatorPos(); }
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 	void			SetTopEntry( sal_uInt16 nTop )		{ maLBWindow.SetTopEntry( nTop ); }
464cdf0e10cSrcweir 	sal_uInt16			GetTopEntry() const 			{ return maLBWindow.GetTopEntry(); }
465cdf0e10cSrcweir 	void            ShowProminentEntry( sal_uInt16 nPos ) { maLBWindow.ShowProminentEntry( nPos ); }
466cdf0e10cSrcweir     using Window::IsVisible;
467cdf0e10cSrcweir 	sal_Bool			IsVisible( sal_uInt16 nEntry ) const { return maLBWindow.IsVisible( nEntry ); }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 	void            SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); }
470cdf0e10cSrcweir 	ProminentEntry  GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); }
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 	long			GetLeftIndent() const			{ return maLBWindow.GetLeftIndent(); }
473cdf0e10cSrcweir 	void			SetLeftIndent( sal_uInt16 n )		{ maLBWindow.SetLeftIndent( n ); }
474cdf0e10cSrcweir 	void			ScrollHorz( short nDiff )		{ maLBWindow.ScrollHorz( nDiff ); }
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 	void            SetTravelSelect( sal_Bool bTravelSelect ) { maLBWindow.SetTravelSelect( bTravelSelect ); }
477cdf0e10cSrcweir 	sal_Bool			IsTravelSelect() const			{ return maLBWindow.IsTravelSelect(); }
478cdf0e10cSrcweir 	sal_Bool			IsTrackingSelect() const			{ return maLBWindow.IsTrackingSelect(); }
479cdf0e10cSrcweir 
480cdf0e10cSrcweir 	void			EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackMode ) { maLBWindow.EnableMultiSelection( bMulti, bStackMode ); }
481cdf0e10cSrcweir 	sal_Bool			IsMultiSelectionEnabled() const 	{ return maLBWindow.IsMultiSelectionEnabled(); }
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 	void			SetMultiSelectionSimpleMode( sal_Bool bSimple ) { maLBWindow.SetMultiSelectionSimpleMode( bSimple ); }
484cdf0e10cSrcweir 	sal_Bool			IsMultiSelectionSimpleMode() const 	{ return maLBWindow.IsMultiSelectionSimpleMode(); }
485cdf0e10cSrcweir 
486cdf0e10cSrcweir 	void			SetReadOnly( sal_Bool b ) 			{ maLBWindow.SetReadOnly( b ); }
487cdf0e10cSrcweir 	sal_Bool			IsReadOnly() const 				{ return maLBWindow.IsReadOnly(); }
488cdf0e10cSrcweir 
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 	Size			CalcSize( sal_uInt16 nMaxLines ) const				{ return maLBWindow.CalcSize( nMaxLines ); }
491cdf0e10cSrcweir 	long			GetEntryHeight() const			{ return maLBWindow.GetEntryHeight(); }
492cdf0e10cSrcweir 	long			GetMaxEntryWidth() const		{ return maLBWindow.GetMaxEntryWidth(); }
493cdf0e10cSrcweir 
494cdf0e10cSrcweir 	void			SetScrollHdl( const Link& rLink )	{ maScrollHdl = rLink; }
495cdf0e10cSrcweir 	const Link& 	GetScrollHdl() const				{ return maScrollHdl; }
496cdf0e10cSrcweir 	void			SetSelectHdl( const Link& rLink )	{ maLBWindow.SetSelectHdl( rLink ); }
497cdf0e10cSrcweir 	const Link& 	GetSelectHdl() const				{ return maLBWindow.GetSelectHdl(); }
498cdf0e10cSrcweir 	void			SetCancelHdl( const Link& rLink )	{ maLBWindow.SetCancelHdl( rLink ); }
499cdf0e10cSrcweir 	const Link& 	GetCancelHdl() const				{ return maLBWindow.GetCancelHdl(); }
500cdf0e10cSrcweir 	void			SetDoubleClickHdl( const Link& rLink )	{ maLBWindow.SetDoubleClickHdl( rLink ); }
501cdf0e10cSrcweir 	const Link& 	GetDoubleClickHdl() const				{ return maLBWindow.GetDoubleClickHdl(); }
502cdf0e10cSrcweir 	void			SetUserDrawHdl( const Link& rLink )	{ maLBWindow.SetUserDrawHdl( rLink ); }
503cdf0e10cSrcweir 	const Link& 	GetUserDrawHdl() const				{ return maLBWindow.GetUserDrawHdl(); }
504cdf0e10cSrcweir 
505*ad3a95a3SSteve Yin //IAccessibility2 Implementation 2009-----
506*ad3a95a3SSteve Yin 	void			SetFocusHdl( const Link& rLink )	{ maLBWindow.SetFocusHdl( rLink ); }
507*ad3a95a3SSteve Yin 	const Link& 	GetFocusHdl() const				{ return maLBWindow.GetFocusHdl(); }
508*ad3a95a3SSteve Yin 	void			SetListItemSelectHdl( const Link& rLink )	{ maLBWindow.SetListItemSelectHdl( rLink ); }
509*ad3a95a3SSteve Yin 	const Link& 	GetListItemSelectHdl() const	{ return maLBWindow.GetListItemSelectHdl(); }
510*ad3a95a3SSteve Yin //-----IAccessibility2 Implementation 2009
511cdf0e10cSrcweir 	void			SetSelectionChangedHdl( const Link& rLnk )	{ maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); }
512cdf0e10cSrcweir 	void			SetCallSelectionChangedHdl( sal_Bool bCall )	{ maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
513cdf0e10cSrcweir 	sal_Bool			IsSelectionChanged() const 					{ return maLBWindow.IsSelectionChanged(); }
514cdf0e10cSrcweir 	sal_uInt16			GetSelectModifier() const 					{ return maLBWindow.GetSelectModifier(); }
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 	void			SetMRUEntries( const XubString& rEntries, xub_Unicode cSep );
517cdf0e10cSrcweir 	XubString		GetMRUEntries( xub_Unicode cSep ) const;
518cdf0e10cSrcweir 	void			SetMaxMRUCount( sal_uInt16 n )					{ maLBWindow.GetEntryList()->SetMaxMRUCount( n ); }
519cdf0e10cSrcweir 	sal_uInt16			GetMaxMRUCount() const						{ return maLBWindow.GetEntryList()->GetMaxMRUCount(); }
520cdf0e10cSrcweir     sal_uInt16			GetDisplayLineCount() const
521cdf0e10cSrcweir     { return maLBWindow.GetDisplayLineCount(); }
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 	// pb: #106948# explicit mirroring for calc
524cdf0e10cSrcweir 	inline void		EnableMirroring()	{ maLBWindow.EnableMirroring(); }
525cdf0e10cSrcweir     inline void     SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; }
526cdf0e10cSrcweir };
527cdf0e10cSrcweir 
528cdf0e10cSrcweir // -----------------------------
529cdf0e10cSrcweir // - ImplListBoxFloatingWindow -
530cdf0e10cSrcweir // -----------------------------
531cdf0e10cSrcweir 
532cdf0e10cSrcweir class ImplListBoxFloatingWindow : public FloatingWindow
533cdf0e10cSrcweir {
534cdf0e10cSrcweir private:
535cdf0e10cSrcweir 	ImplListBox*	mpImplLB;
536cdf0e10cSrcweir 	Size			maPrefSz;
537cdf0e10cSrcweir 	sal_uInt16			mnDDLineCount;
538cdf0e10cSrcweir     sal_uInt16          mnPopupModeStartSaveSelection;
539cdf0e10cSrcweir 	sal_Bool			mbAutoWidth;
540cdf0e10cSrcweir 
541cdf0e10cSrcweir protected:
542cdf0e10cSrcweir 	long			PreNotify( NotifyEvent& rNEvt );
543cdf0e10cSrcweir 
544cdf0e10cSrcweir public:
545cdf0e10cSrcweir 					ImplListBoxFloatingWindow( Window* pParent );
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	void			SetImplListBox( ImplListBox* pLB )	{ mpImplLB = pLB; }
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 	void			SetPrefSize( const Size& rSz )		{ maPrefSz = rSz; }
550cdf0e10cSrcweir 	const Size& 	GetPrefSize() const 				{ return maPrefSz; }
551cdf0e10cSrcweir 
552cdf0e10cSrcweir 	void			SetAutoWidth( sal_Bool b )				{ mbAutoWidth = b; }
553cdf0e10cSrcweir     sal_Bool            IsAutoWidth() const                 { return mbAutoWidth; }
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 	Size			CalcFloatSize();
556cdf0e10cSrcweir 	void			StartFloat( sal_Bool bStartTracking );
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 	virtual void	SetPosSizePixel( long nX, long nY,
559cdf0e10cSrcweir 									 long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL );
560cdf0e10cSrcweir 	void			SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
561cdf0e10cSrcweir 						{ FloatingWindow::SetPosSizePixel( rNewPos, rNewSize ); }
562cdf0e10cSrcweir 
563cdf0e10cSrcweir 	void			SetDropDownLineCount( sal_uInt16 n ) { mnDDLineCount = n; }
564cdf0e10cSrcweir 	sal_uInt16			GetDropDownLineCount() const { return mnDDLineCount; }
565cdf0e10cSrcweir 
566cdf0e10cSrcweir     sal_uInt16          GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection; }
567cdf0e10cSrcweir 
568cdf0e10cSrcweir     virtual void	Resize();
569cdf0e10cSrcweir };
570cdf0e10cSrcweir 
571cdf0e10cSrcweir // -----------
572cdf0e10cSrcweir // - ImplWin -
573cdf0e10cSrcweir // -----------
574cdf0e10cSrcweir 
575cdf0e10cSrcweir class ImplWin : public Control
576cdf0e10cSrcweir {
577cdf0e10cSrcweir private:
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 	sal_uInt16			mnItemPos;	// wegen UserDraw muss ich wissen, welches Item ich darstelle.
580cdf0e10cSrcweir 	XubString		maString;
581cdf0e10cSrcweir 	Image			maImage;
582cdf0e10cSrcweir 	Image			maImageHC;
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	Rectangle		maFocusRect;
585cdf0e10cSrcweir 	Size			maUserItemSize;
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 	Link			maMBDownHdl;
588cdf0e10cSrcweir 	Link			maUserDrawHdl;
589cdf0e10cSrcweir 
590cdf0e10cSrcweir 	sal_Bool			mbUserDrawEnabled	: 1,
591cdf0e10cSrcweir 					mbInUserDraw		: 1;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 
594cdf0e10cSrcweir     void ImplDraw( bool bLayout = false );
595cdf0e10cSrcweir protected:
596cdf0e10cSrcweir     virtual void  FillLayoutData() const;
597cdf0e10cSrcweir public:
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 					ImplWin( Window* pParent, WinBits nWinStyle = 0 );
600cdf0e10cSrcweir 					~ImplWin() {};
601cdf0e10cSrcweir 
602cdf0e10cSrcweir 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
603cdf0e10cSrcweir 	virtual void	Paint( const Rectangle& rRect );
604cdf0e10cSrcweir 	virtual void	Resize();
605cdf0e10cSrcweir 	virtual void	GetFocus();
606cdf0e10cSrcweir 	virtual void	LoseFocus();
607cdf0e10cSrcweir     virtual long    PreNotify( NotifyEvent& rNEvt );
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 	sal_uInt16			GetItemPos() const { return mnItemPos; }
610cdf0e10cSrcweir 	void			SetItemPos( sal_uInt16 n ) { mnItemPos = n; }
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 	const XubString& GetString() const { return maString; }
613cdf0e10cSrcweir 	void			SetString( const XubString& rStr ) { maString = rStr; }
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 	const Image&	GetImage() const { return maImage; }
616cdf0e10cSrcweir 	void			SetImage( const Image& rImg ) { maImage = rImg; }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir     sal_Bool            SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL );
619cdf0e10cSrcweir     const Image&    GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const;
620cdf0e10cSrcweir 
621cdf0e10cSrcweir 
622cdf0e10cSrcweir 	virtual void	MBDown();
623cdf0e10cSrcweir 	void			SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; }
624cdf0e10cSrcweir 	const Link& 	GetMBDownHdl() const { return maMBDownHdl; }
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 	void			SetUserDrawHdl( const Link& rLink )	{ maUserDrawHdl = rLink; }
627cdf0e10cSrcweir 	const Link& 	GetUserDrawHdl() const				{ return maUserDrawHdl; }
628cdf0e10cSrcweir 
629cdf0e10cSrcweir 	void			SetUserItemSize( const Size& rSz )	{ maUserItemSize = rSz; }
630cdf0e10cSrcweir 	const Size&		GetUserItemSize() const				{ return maUserItemSize; }
631cdf0e10cSrcweir 
632cdf0e10cSrcweir 	void			EnableUserDraw( sal_Bool bUserDraw ) 	{ mbUserDrawEnabled = bUserDraw; }
633cdf0e10cSrcweir 	sal_Bool			IsUserDrawEnabled() const 			{ return mbUserDrawEnabled; }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir 	void 			DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false );
636cdf0e10cSrcweir };
637cdf0e10cSrcweir 
638cdf0e10cSrcweir // -----------
639cdf0e10cSrcweir // - ImplBtn -
640cdf0e10cSrcweir // -----------
641cdf0e10cSrcweir 
642cdf0e10cSrcweir class ImplBtn : public PushButton
643cdf0e10cSrcweir {
644cdf0e10cSrcweir private:
645cdf0e10cSrcweir 	sal_Bool			mbDown;
646cdf0e10cSrcweir 
647cdf0e10cSrcweir 	Link			maMBDownHdl;
648cdf0e10cSrcweir 
649cdf0e10cSrcweir public:
650cdf0e10cSrcweir 					ImplBtn( Window* pParent, WinBits nWinStyle = 0 );
651cdf0e10cSrcweir 					~ImplBtn() {};
652cdf0e10cSrcweir 
653cdf0e10cSrcweir 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
654cdf0e10cSrcweir 
655cdf0e10cSrcweir 	virtual void	MBDown();
656cdf0e10cSrcweir 	void			SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; }
657cdf0e10cSrcweir 	const Link& 	GetMBDownHdl() const { return maMBDownHdl; }
658cdf0e10cSrcweir };
659cdf0e10cSrcweir 
660cdf0e10cSrcweir 
661cdf0e10cSrcweir void ImplInitFieldSettings( Window* pWin, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
662cdf0e10cSrcweir void ImplInitDropDownButton( PushButton* pButton );
663cdf0e10cSrcweir 
664cdf0e10cSrcweir #endif	// _SV_ILSTBOX_HXX
665