xref: /aoo41x/main/svtools/source/inc/svimpbox.hxx (revision 01aa44aa)
1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*01aa44aaSAndrew Rist  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*01aa44aaSAndrew Rist  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19*01aa44aaSAndrew Rist  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVIMPLBOX_HXX
25cdf0e10cSrcweir #define _SVIMPLBOX_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _SELENG_HXX
28cdf0e10cSrcweir #include <vcl/seleng.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _SCRBAR_HXX
31cdf0e10cSrcweir #include <vcl/scrbar.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <vcl/vclevent.hxx>
34cdf0e10cSrcweir // #102891# ----------------
35cdf0e10cSrcweir #include <unotools/intlwrapper.hxx>
36cdf0e10cSrcweir // #97680# -----------------
37cdf0e10cSrcweir #include <vector>
38cdf0e10cSrcweir #include "svtaccessiblefactory.hxx"
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class SvTreeListBox;
41cdf0e10cSrcweir class Point;
42cdf0e10cSrcweir class DropEvent;
43cdf0e10cSrcweir class SvLBoxTreeList;
44cdf0e10cSrcweir class SvImpLBox;
45cdf0e10cSrcweir class SvLBoxEntry;
46cdf0e10cSrcweir class SvLBoxItem;
47cdf0e10cSrcweir class SvLBoxTab;
48cdf0e10cSrcweir class TabBar;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class ImpLBSelEng : public FunctionSet
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 	SvImpLBox* 			pImp;
53cdf0e10cSrcweir 	SelectionEngine*	pSelEng;
54cdf0e10cSrcweir 	SvTreeListBox*		pView;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir 	ImpLBSelEng( SvImpLBox* pImp, SelectionEngine* pSelEng,
58cdf0e10cSrcweir 				 SvTreeListBox* pView );
59cdf0e10cSrcweir 	virtual ~ImpLBSelEng();
60cdf0e10cSrcweir 	void 		BeginDrag();
61cdf0e10cSrcweir 	void 		CreateAnchor();
62cdf0e10cSrcweir 	void		DestroyAnchor();
63cdf0e10cSrcweir 	sal_Bool 		SetCursorAtPoint( const Point& rPoint,
64cdf0e10cSrcweir 					sal_Bool bDontSelectAtCursor=sal_False );
65cdf0e10cSrcweir 	sal_Bool 		IsSelectionAtPoint( const Point& rPoint );
66cdf0e10cSrcweir 	void 		DeselectAtPoint( const Point& rPoint );
67cdf0e10cSrcweir 	void 		DeselectAll();
68cdf0e10cSrcweir };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir // Flags fuer nFlag
71cdf0e10cSrcweir #define F_VER_SBARSIZE_WITH_HBAR		0x0001
72cdf0e10cSrcweir #define F_HOR_SBARSIZE_WITH_VBAR		0x0002
73cdf0e10cSrcweir #define F_IGNORE_NEXT_MOUSEMOVE			0x0004	// OS/2 only
74cdf0e10cSrcweir #define F_IN_SCROLLING					0x0008
75cdf0e10cSrcweir #define F_DESEL_ALL						0x0010
76cdf0e10cSrcweir #define F_START_EDITTIMER				0x0020 	// MAC only
77cdf0e10cSrcweir #define F_IGNORE_SELECT					0x0040
78cdf0e10cSrcweir #define F_IN_RESIZE						0x0080
79cdf0e10cSrcweir #define F_REMOVED_ENTRY_INVISIBLE		0x0100
80cdf0e10cSrcweir #define F_REMOVED_RECALC_MOST_RIGHT		0x0200
81cdf0e10cSrcweir #define F_IGNORE_CHANGED_TABS			0x0400
82cdf0e10cSrcweir #define F_PAINTED						0x0800
83cdf0e10cSrcweir #define F_IN_PAINT						0x1000
84cdf0e10cSrcweir #define F_ENDSCROLL_SET_VIS_SIZE	   	0x2000
85cdf0e10cSrcweir #define F_FILLING 						0x4000
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 
88cdf0e10cSrcweir class SvImpLBox
89cdf0e10cSrcweir {
90cdf0e10cSrcweir friend class ImpLBSelEng;
91cdf0e10cSrcweir friend class SvTreeListBox;
92cdf0e10cSrcweir private:
93cdf0e10cSrcweir 	SvTreeListBox* 		pView;
94cdf0e10cSrcweir 	SvLBoxTreeList*		pTree;
95cdf0e10cSrcweir 	SvLBoxEntry*		pCursor;
96cdf0e10cSrcweir 	SvLBoxEntry*		pStartEntry;
97cdf0e10cSrcweir 	SvLBoxEntry*  		pAnchor;
98cdf0e10cSrcweir 	SvLBoxEntry*		pMostRightEntry;
99cdf0e10cSrcweir 	SvLBoxButton* 		pActiveButton;
100cdf0e10cSrcweir 	SvLBoxEntry* 		pActiveEntry;
101cdf0e10cSrcweir 	SvLBoxTab* 			pActiveTab;
102cdf0e10cSrcweir 	TabBar*				pTabBar;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	ScrollBar   		aVerSBar;
105cdf0e10cSrcweir 	ScrollBar   		aHorSBar;
106cdf0e10cSrcweir 	ScrollBarBox 		aScrBarBox;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     ::svt::AccessibleFactoryAccess
109cdf0e10cSrcweir                         m_aFactoryAccess;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	static Image*		s_pDefCollapsed;
112cdf0e10cSrcweir 	static Image*		s_pDefExpanded;
113cdf0e10cSrcweir 	static Image*		s_pDefCollapsedHC;
114cdf0e10cSrcweir 	static Image*		s_pDefExpandedHC;
115cdf0e10cSrcweir 	static oslInterlockedCount	s_nImageRefCount; /// When 0 all static images will be destroyed
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// Node Bitmaps
118cdf0e10cSrcweir 	enum ImageType
119cdf0e10cSrcweir 	{
120cdf0e10cSrcweir 		itNodeExpanded = 0,		// node is expanded ( usually a bitmap showing a minus )
121cdf0e10cSrcweir 		itNodeCollapsed,		// node is collapsed ( usually a bitmap showing a plus )
122cdf0e10cSrcweir 		itNodeDontKnow,			// don't know the node state
123cdf0e10cSrcweir 		itEntryDefExpanded,		// default for expanded entries
124cdf0e10cSrcweir 		itEntryDefCollapsed,	// default for collapsed entries
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 		IT_IMAGE_COUNT
127cdf0e10cSrcweir 	};
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	// all our images
130cdf0e10cSrcweir 	Image				m_aNodeAndEntryImages[ IT_IMAGE_COUNT ];
131cdf0e10cSrcweir 	// plus the high contrast versions
132cdf0e10cSrcweir 	Image				m_aNodeAndEntryImages_HC[ IT_IMAGE_COUNT ];
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	// wg. kompat. hier
135cdf0e10cSrcweir 	Size    			aOutputSize;
136cdf0e10cSrcweir 	SelectionEngine 	aSelEng;
137cdf0e10cSrcweir 	ImpLBSelEng			aFctSet;
138cdf0e10cSrcweir 	Timer				aAsyncBeginDragTimer;
139cdf0e10cSrcweir 	Point				aAsyncBeginDragPos;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	long				nYoffsNodeBmp;
142cdf0e10cSrcweir 	long				nNodeBmpTabDistance; // typisch kleiner 0
143cdf0e10cSrcweir 	long				nNodeBmpWidth;
144cdf0e10cSrcweir 	long				nNextVerVisSize;
145cdf0e10cSrcweir 	long 				nMostRight;
146cdf0e10cSrcweir 	sal_uLong     			nVisibleCount;  // Anzahl Zeilen im Control
147cdf0e10cSrcweir 	sal_uLong				nCurUserEvent; //-1 == kein Userevent amn Laufen
148cdf0e10cSrcweir 	short				nHorSBarHeight, nVerSBarWidth;
149cdf0e10cSrcweir 	sal_uInt16				nFlags;
150cdf0e10cSrcweir 	sal_uInt16				nCurTabPos;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	WinBits				m_nStyle;
153cdf0e10cSrcweir     ExtendedWinBits     nExtendedWinBits;
154cdf0e10cSrcweir 	sal_Bool				bSimpleTravel : 1; // ist sal_True bei SINGLE_SELECTION
155cdf0e10cSrcweir 	sal_Bool				bUpdateMode : 1;
156cdf0e10cSrcweir 	sal_Bool				bInVScrollHdl : 1;
157cdf0e10cSrcweir 	sal_Bool				bAsyncBeginDrag : 1;
158cdf0e10cSrcweir 	sal_Bool				bSubLstOpRet : 1;	// open/close sublist with return/enter, defaulted with sal_False
159cdf0e10cSrcweir 	sal_Bool				bSubLstOpLR : 1;	// open/close sublist with cursor left/right, defaulted with sal_False
160cdf0e10cSrcweir 	sal_Bool				bContextMenuHandling : 1;
161cdf0e10cSrcweir 	sal_Bool				bIsCellFocusEnabled : 1;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     sal_Bool            bAreChildrenTransient;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	Point				aEditClickPos;
166cdf0e10cSrcweir 	Timer				aEditTimer;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	// #102891# -------------------
169cdf0e10cSrcweir 	IntlWrapper *		pIntlWrapper;
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	// #97680# --------------------
172cdf0e10cSrcweir 	std::vector< short > aContextBmpWidthVector;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 	DECL_LINK( EditTimerCall, Timer * );
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	DECL_LINK( BeginDragHdl, void* );
177cdf0e10cSrcweir 	DECL_LINK( MyUserEvent,void*);
178cdf0e10cSrcweir 	void				StopUserEvent();
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	void 				InvalidateEntriesFrom( long nY ) const;
181cdf0e10cSrcweir 	void 				InvalidateEntry( long nY ) const;
182cdf0e10cSrcweir 	void 				ShowVerSBar();
183cdf0e10cSrcweir 	// setzt Thumb auf FirstEntryToDraw
184cdf0e10cSrcweir 	void 				SyncVerThumb();
185cdf0e10cSrcweir 	sal_Bool 				IsLineVisible( long nY ) const;
186cdf0e10cSrcweir 	long 				GetEntryLine( SvLBoxEntry* pEntry ) const;
187cdf0e10cSrcweir 	void				FillView();
188cdf0e10cSrcweir 	void 				CursorDown();
189cdf0e10cSrcweir 	void 				CursorUp();
190cdf0e10cSrcweir 	void				KeyLeftRight( long nDiff );
191cdf0e10cSrcweir 	void 				PageDown( sal_uInt16 nDelta );
192cdf0e10cSrcweir 	void 				PageUp( sal_uInt16 nDelta );
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 	void				SetCursor( SvLBoxEntry* pEntry, sal_Bool bForceNoSelect = sal_False );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 	void 				DrawNet();
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 	// ScrollBar-Handler
199cdf0e10cSrcweir 	DECL_LINK( ScrollUpDownHdl, ScrollBar * );
200cdf0e10cSrcweir 	DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
201cdf0e10cSrcweir 	DECL_LINK( EndScrollHdl, ScrollBar * );
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 	void				SetNodeBmpYOffset( const Image& );
204cdf0e10cSrcweir 	void				SetNodeBmpTabDistance();
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	// Selection-Engine
207cdf0e10cSrcweir 	SvLBoxEntry*  		MakePointVisible( const Point& rPoint,
208cdf0e10cSrcweir 							sal_Bool bNotifyScroll=sal_True );
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	void        		SetAnchorSelection( SvLBoxEntry* pOld,
211cdf0e10cSrcweir 							SvLBoxEntry* pNewCursor );
212cdf0e10cSrcweir 	void        		BeginDrag();
213cdf0e10cSrcweir 	sal_Bool				ButtonDownCheckCtrl( const MouseEvent& rMEvt,
214cdf0e10cSrcweir 							SvLBoxEntry* pEntry, long nY	);
215cdf0e10cSrcweir 	sal_Bool				MouseMoveCheckCtrl( const MouseEvent& rMEvt,
216cdf0e10cSrcweir 							SvLBoxEntry* pEntry );
217cdf0e10cSrcweir 	sal_Bool				ButtonUpCheckCtrl( const MouseEvent& rMEvt );
218cdf0e10cSrcweir 	sal_Bool 				ButtonDownCheckExpand( const MouseEvent&,
219cdf0e10cSrcweir 							SvLBoxEntry*,long nY );
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	void				PositionScrollBars( Size& rOSize, sal_uInt16 nMask );
222cdf0e10cSrcweir 	sal_uInt16				AdjustScrollBars( Size& rSize );
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	void				BeginScroll();
225cdf0e10cSrcweir 	void				EndScroll();
InScroll() const226cdf0e10cSrcweir 	sal_Bool				InScroll() const { return (sal_Bool)(nFlags & F_IN_SCROLLING)!=0;}
227cdf0e10cSrcweir 	Rectangle			GetVisibleArea() const;
228cdf0e10cSrcweir 	sal_Bool				EntryReallyHit(SvLBoxEntry* pEntry,const Point& rPos,long nLine);
229cdf0e10cSrcweir 	void				InitScrollBarBox();
230cdf0e10cSrcweir 	SvLBoxTab*			NextTab( SvLBoxTab* );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	sal_Bool				SetMostRight( SvLBoxEntry* pEntry );
233cdf0e10cSrcweir 	void				FindMostRight( SvLBoxEntry* EntryToIgnore );
234cdf0e10cSrcweir 	void 				FindMostRight( SvLBoxEntry* pParent, SvLBoxEntry* EntryToIgnore );
235cdf0e10cSrcweir 	void 				FindMostRight_Impl( SvLBoxEntry* pParent,SvLBoxEntry* EntryToIgnore  );
236cdf0e10cSrcweir 	void				NotifyTabsChanged();
237cdf0e10cSrcweir 
IsExpandable() const238cdf0e10cSrcweir 	inline sal_Bool			IsExpandable() const		// if element at cursor can be expanded in general
239cdf0e10cSrcweir 							{ return pCursor->HasChilds() || pCursor->HasChildsOnDemand(); }
IsNowExpandable() const240cdf0e10cSrcweir 	inline sal_Bool			IsNowExpandable() const		// if element at cursor can be expanded at this moment
241cdf0e10cSrcweir 							{ return IsExpandable() && !pView->IsExpanded( pCursor ); }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 	static	void		implInitDefaultNodeImages();
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	// #102891# -------------------
246cdf0e10cSrcweir 	void 				UpdateIntlWrapper();
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 	// #97680# --------------------
249cdf0e10cSrcweir 	short				UpdateContextBmpWidthVector( SvLBoxEntry* pEntry, short nWidth );
250cdf0e10cSrcweir 	void				UpdateContextBmpWidthMax( SvLBoxEntry* pEntry );
251cdf0e10cSrcweir 	void				UpdateContextBmpWidthVectorFromMovedEntry( SvLBoxEntry* pEntry );
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	void				CalcCellFocusRect( SvLBoxEntry* pEntry, Rectangle& rRect );
254cdf0e10cSrcweir 
AreChildrenTransient() const255cdf0e10cSrcweir     inline sal_Bool     AreChildrenTransient() const { return bAreChildrenTransient; }
SetChildrenNotTransient()256cdf0e10cSrcweir     inline void         SetChildrenNotTransient() { bAreChildrenTransient = sal_False; }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir public:
259cdf0e10cSrcweir 	SvImpLBox( SvTreeListBox* pView, SvLBoxTreeList*, WinBits nWinStyle );
260cdf0e10cSrcweir 	~SvImpLBox();
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	void 				Clear();
263cdf0e10cSrcweir     void                SetStyle( WinBits i_nWinStyle );
264cdf0e10cSrcweir 	void 				SetExtendedWindowBits( ExtendedWinBits _nBits );
GetExtendedWindowBits() const265cdf0e10cSrcweir     ExtendedWinBits     GetExtendedWindowBits() const { return nExtendedWinBits; }
SetModel(SvLBoxTreeList * pModel)266cdf0e10cSrcweir 	void 				SetModel( SvLBoxTreeList* pModel ) { pTree = pModel;}
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	void 				EntryInserted( SvLBoxEntry*);
269cdf0e10cSrcweir 	void 				RemovingEntry( SvLBoxEntry* pEntry );
270cdf0e10cSrcweir 	void 				EntryRemoved();
271cdf0e10cSrcweir 	void 				MovingEntry( SvLBoxEntry* pEntry );
272cdf0e10cSrcweir 	void 				EntryMoved( SvLBoxEntry* pEntry );
273cdf0e10cSrcweir 	void 				TreeInserted( SvLBoxEntry* pEntry );
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 	void 				IndentChanged( short nIndentPixel );
276cdf0e10cSrcweir 	void 				EntryExpanded( SvLBoxEntry* pEntry );
277cdf0e10cSrcweir 	void 				EntryCollapsed( SvLBoxEntry* pEntry );
278cdf0e10cSrcweir 	void 				CollapsingEntry( SvLBoxEntry* pEntry );
279cdf0e10cSrcweir 	void 				EntrySelected( SvLBoxEntry*, sal_Bool bSelect );
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 	void	 			Paint( const Rectangle& rRect );
282cdf0e10cSrcweir 	void 				RepaintSelectionItems();
283cdf0e10cSrcweir 	void 				MouseButtonDown( const MouseEvent& );
284cdf0e10cSrcweir 	void 				MouseButtonUp( const MouseEvent& );
285cdf0e10cSrcweir 	void 				MouseMove( const MouseEvent&);
286cdf0e10cSrcweir 	sal_Bool 				KeyInput( const KeyEvent& );
287cdf0e10cSrcweir 	void 				Resize();
288cdf0e10cSrcweir 	void 				GetFocus();
289cdf0e10cSrcweir 	void 				LoseFocus();
290cdf0e10cSrcweir 	void 				UpdateAll(
291cdf0e10cSrcweir 							sal_Bool bInvalidateCompleteView= sal_True,
292cdf0e10cSrcweir 							sal_Bool bUpdateVerSBar = sal_True );
293cdf0e10cSrcweir 	void 				SetEntryHeight( short nHeight );
294cdf0e10cSrcweir 	void 				PaintEntry( SvLBoxEntry* pEntry );
295cdf0e10cSrcweir 	void 				InvalidateEntry( SvLBoxEntry* );
296cdf0e10cSrcweir 	void 				RecalcFocusRect();
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 	inline void 		SelectEntry( SvLBoxEntry* pEntry, sal_Bool bSelect );
299cdf0e10cSrcweir 	void 				SetDragDropMode( DragDropMode eDDMode );
300cdf0e10cSrcweir 	void 				SetSelectionMode( SelectionMode eSelMode  );
SetAddMode(sal_Bool)301cdf0e10cSrcweir 	void				SetAddMode( sal_Bool ) { aSelEng.AddAlways(sal_False); }
IsAddMode() const302cdf0e10cSrcweir 	sal_Bool				IsAddMode() const { return aSelEng.IsAlwaysAdding(); }
303cdf0e10cSrcweir 
GetCurrentEntry() const304cdf0e10cSrcweir 	SvLBoxEntry* 		GetCurrentEntry() const { return pCursor; }
305cdf0e10cSrcweir 	sal_Bool				IsEntryInView( SvLBoxEntry* ) const;
306cdf0e10cSrcweir 	SvLBoxEntry* 		GetEntry( const Point& rPos ) const;
307cdf0e10cSrcweir 	// gibt letzten Eintrag zurueck, falls Pos unter letztem Eintrag
308cdf0e10cSrcweir 	SvLBoxEntry* 		GetClickedEntry( const Point& ) const;
GetCurEntry() const309cdf0e10cSrcweir 	SvLBoxEntry* 		GetCurEntry() const { return pCursor; }
310cdf0e10cSrcweir 	void				SetCurEntry( SvLBoxEntry* );
311cdf0e10cSrcweir 	Point 				GetEntryPosition( SvLBoxEntry* ) const;
312cdf0e10cSrcweir 	void 				MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop=sal_False );
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	void 				PaintDDCursor( SvLBoxEntry* );
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	// Images
317cdf0e10cSrcweir 	inline Image&		implGetImageLocation( const ImageType _eType, BmpColorMode _eMode );
318cdf0e10cSrcweir 	inline Image&		implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const;
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	inline void 		SetExpandedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
321cdf0e10cSrcweir 	inline void 		SetCollapsedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL  );
322cdf0e10cSrcweir 	inline void 		SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	inline const Image& GetExpandedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
325cdf0e10cSrcweir 	inline const Image& GetCollapsedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
326cdf0e10cSrcweir 	inline const Image&	GetDontKnowNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	inline void			SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
329cdf0e10cSrcweir 	inline void			SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
330cdf0e10cSrcweir 	inline const Image&	GetDefaultEntryExpBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL );
331cdf0e10cSrcweir 	inline const Image&	GetDefaultEntryColBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL );
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 	static const Image&	GetDefaultExpandedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL );
334cdf0e10cSrcweir 	static const Image&	GetDefaultCollapsedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL );
335cdf0e10cSrcweir 
GetOutputSize() const336cdf0e10cSrcweir 	const Size& 		GetOutputSize() const { return aOutputSize;}
337cdf0e10cSrcweir 	void 				KeyUp( sal_Bool bPageUp, sal_Bool bNotifyScroll = sal_True );
338cdf0e10cSrcweir 	void 				KeyDown( sal_Bool bPageDown, sal_Bool bNotifyScroll = sal_True );
339cdf0e10cSrcweir 	void                Command( const CommandEvent& rCEvt );
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 	void				Invalidate();
DestroyAnchor()342cdf0e10cSrcweir 	void				DestroyAnchor() { pAnchor=0; aSelEng.Reset(); }
343cdf0e10cSrcweir 	void        		SelAllDestrAnch( sal_Bool bSelect,
344cdf0e10cSrcweir 							sal_Bool bDestroyAnchor = sal_True,
345cdf0e10cSrcweir 							sal_Bool bSingleSelToo = sal_False );
346cdf0e10cSrcweir 	void				ShowCursor( sal_Bool bShow );
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 	sal_Bool    			RequestHelp( const HelpEvent& rHEvt );
349cdf0e10cSrcweir 	void				EndSelection();
350cdf0e10cSrcweir 	sal_Bool				IsNodeButton( const Point& rPosPixel, SvLBoxEntry* pEntry ) const;
351cdf0e10cSrcweir 	void				RepaintScrollBars();
EnableAsyncDrag(sal_Bool b)352cdf0e10cSrcweir 	void				EnableAsyncDrag( sal_Bool b) { bAsyncBeginDrag = b; }
353cdf0e10cSrcweir 	void				SetUpdateMode( sal_Bool );
354cdf0e10cSrcweir 	void 				SetUpdateModeFast( sal_Bool );
GetUpdateMode() const355cdf0e10cSrcweir 	sal_Bool				GetUpdateMode() const { return bUpdateMode; }
356cdf0e10cSrcweir 	Rectangle			GetClipRegionRect() const;
HasHorScrollBar() const357cdf0e10cSrcweir 	sal_Bool				HasHorScrollBar() const { return aHorSBar.IsVisible(); }
358cdf0e10cSrcweir 	void				ShowFocusRect( const SvLBoxEntry* pEntry );
359cdf0e10cSrcweir 	void				SetTabBar( TabBar* pTabBar );
360cdf0e10cSrcweir 	void				CancelPendingEdit();
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 	void				CallEventListeners( sal_uLong nEvent, void* pData = NULL );
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 	/** Enables, that one cell of a tablistbox entry can be focused */
IsCellFocusEnabled() const365cdf0e10cSrcweir 	inline sal_Bool			IsCellFocusEnabled() const { return bIsCellFocusEnabled; }
EnableCellFocus()366cdf0e10cSrcweir 	inline void			EnableCellFocus() { bIsCellFocusEnabled = sal_True; }
367cdf0e10cSrcweir 	bool				SetCurrentTabPos( sal_uInt16 _nNewPos );
GetCurrentTabPos() const368cdf0e10cSrcweir 	inline sal_uInt16		GetCurrentTabPos() const { return nCurTabPos; }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 	bool				IsSelectable( const SvLBoxEntry* pEntry );
371cdf0e10cSrcweir };
372cdf0e10cSrcweir 
implGetImageLocation(const ImageType _eType,BmpColorMode _eMode)373cdf0e10cSrcweir inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType, BmpColorMode _eMode )
374cdf0e10cSrcweir {
375cdf0e10cSrcweir 	DBG_ASSERT( ( BMP_COLOR_HIGHCONTRAST == _eMode ) || ( BMP_COLOR_NORMAL == _eMode ),
376cdf0e10cSrcweir 		"SvImpLBox::implGetImageLocation: invalid mode!" );
377cdf0e10cSrcweir 	DBG_ASSERT( ( _eType >= 0 ) && ( _eType < IT_IMAGE_COUNT ),
378cdf0e10cSrcweir 		"SvImpLBox::implGetImageLocation: invalid image index (will crash)!" );
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 	Image* _pSet = ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? m_aNodeAndEntryImages_HC : m_aNodeAndEntryImages;
381cdf0e10cSrcweir 	return *( _pSet + (sal_Int32)_eType );
382cdf0e10cSrcweir }
383cdf0e10cSrcweir 
implGetImageLocationWithFallback(const ImageType _eType,BmpColorMode _eMode) const384cdf0e10cSrcweir inline Image& SvImpLBox::implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const
385cdf0e10cSrcweir {
386cdf0e10cSrcweir 	Image& rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, _eMode );
387cdf0e10cSrcweir 	if ( !rImage )
388cdf0e10cSrcweir 		// fallback to normal images in case the one for the special mode has not been set
389cdf0e10cSrcweir 		rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, BMP_COLOR_NORMAL );
390cdf0e10cSrcweir 	return rImage;
391cdf0e10cSrcweir }
392cdf0e10cSrcweir 
SetDontKnowNodeBmp(const Image & rImg,BmpColorMode _eMode)393cdf0e10cSrcweir inline void SvImpLBox::SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode )
394cdf0e10cSrcweir {
395cdf0e10cSrcweir 	implGetImageLocation( itNodeDontKnow, _eMode ) = rImg;
396cdf0e10cSrcweir }
397cdf0e10cSrcweir 
SetExpandedNodeBmp(const Image & rImg,BmpColorMode _eMode)398cdf0e10cSrcweir inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg, BmpColorMode _eMode )
399cdf0e10cSrcweir {
400cdf0e10cSrcweir 	implGetImageLocation( itNodeExpanded, _eMode ) = rImg;
401cdf0e10cSrcweir 	SetNodeBmpYOffset( rImg );
402cdf0e10cSrcweir }
403cdf0e10cSrcweir 
SetCollapsedNodeBmp(const Image & rImg,BmpColorMode _eMode)404cdf0e10cSrcweir inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg, BmpColorMode _eMode )
405cdf0e10cSrcweir {
406cdf0e10cSrcweir 	implGetImageLocation( itNodeCollapsed, _eMode ) = rImg;
407cdf0e10cSrcweir 	SetNodeBmpYOffset( rImg );
408cdf0e10cSrcweir }
409cdf0e10cSrcweir 
GetDontKnowNodeBmp(BmpColorMode _eMode) const410cdf0e10cSrcweir inline const Image&	SvImpLBox::GetDontKnowNodeBmp( BmpColorMode _eMode ) const
411cdf0e10cSrcweir {
412cdf0e10cSrcweir 	return implGetImageLocationWithFallback( itNodeDontKnow, _eMode );
413cdf0e10cSrcweir }
414cdf0e10cSrcweir 
GetExpandedNodeBmp(BmpColorMode _eMode) const415cdf0e10cSrcweir inline const Image& SvImpLBox::GetExpandedNodeBmp( BmpColorMode _eMode ) const
416cdf0e10cSrcweir {
417cdf0e10cSrcweir 	return implGetImageLocationWithFallback( itNodeExpanded, _eMode );
418cdf0e10cSrcweir }
419cdf0e10cSrcweir 
GetCollapsedNodeBmp(BmpColorMode _eMode) const420cdf0e10cSrcweir inline const Image& SvImpLBox::GetCollapsedNodeBmp( BmpColorMode _eMode ) const
421cdf0e10cSrcweir {
422cdf0e10cSrcweir 	return implGetImageLocationWithFallback( itNodeCollapsed, _eMode );
423cdf0e10cSrcweir }
424cdf0e10cSrcweir 
SetDefaultEntryExpBmp(const Image & _rImg,BmpColorMode _eMode)425cdf0e10cSrcweir inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode )
426cdf0e10cSrcweir {
427cdf0e10cSrcweir 	implGetImageLocation( itEntryDefExpanded, _eMode ) = _rImg;
428cdf0e10cSrcweir }
429cdf0e10cSrcweir 
SetDefaultEntryColBmp(const Image & _rImg,BmpColorMode _eMode)430cdf0e10cSrcweir inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode )
431cdf0e10cSrcweir {
432cdf0e10cSrcweir 	implGetImageLocation( itEntryDefCollapsed, _eMode ) = _rImg;
433cdf0e10cSrcweir }
434cdf0e10cSrcweir 
GetDefaultEntryExpBmp(BmpColorMode _eMode)435cdf0e10cSrcweir inline const Image&	SvImpLBox::GetDefaultEntryExpBmp( BmpColorMode _eMode )
436cdf0e10cSrcweir {
437cdf0e10cSrcweir 	return implGetImageLocationWithFallback( itEntryDefExpanded, _eMode );
438cdf0e10cSrcweir }
439cdf0e10cSrcweir 
GetDefaultEntryColBmp(BmpColorMode _eMode)440cdf0e10cSrcweir inline const Image&	SvImpLBox::GetDefaultEntryColBmp( BmpColorMode _eMode )
441cdf0e10cSrcweir {
442cdf0e10cSrcweir 	return implGetImageLocationWithFallback( itEntryDefCollapsed, _eMode );
443cdf0e10cSrcweir }
444cdf0e10cSrcweir 
GetEntryPosition(SvLBoxEntry * pEntry) const445cdf0e10cSrcweir inline Point SvImpLBox::GetEntryPosition( SvLBoxEntry* pEntry ) const
446cdf0e10cSrcweir {
447cdf0e10cSrcweir 	return Point( 0, GetEntryLine( pEntry ) );
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
PaintEntry(SvLBoxEntry * pEntry)450cdf0e10cSrcweir inline void SvImpLBox::PaintEntry( SvLBoxEntry* pEntry )
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	long nY = GetEntryLine( pEntry );
453cdf0e10cSrcweir 	pView->PaintEntry( pEntry, nY );
454cdf0e10cSrcweir }
455cdf0e10cSrcweir 
IsLineVisible(long nY) const456cdf0e10cSrcweir inline sal_Bool SvImpLBox::IsLineVisible( long nY ) const
457cdf0e10cSrcweir {
458cdf0e10cSrcweir 	sal_Bool bRet = sal_True;
459cdf0e10cSrcweir 	if ( nY < 0 || nY >= aOutputSize.Height() )
460cdf0e10cSrcweir 		bRet = sal_False;
461cdf0e10cSrcweir 	return bRet;
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
TreeInserted(SvLBoxEntry * pInsTree)464cdf0e10cSrcweir inline void SvImpLBox::TreeInserted( SvLBoxEntry* pInsTree )
465cdf0e10cSrcweir {
466cdf0e10cSrcweir 	EntryInserted( pInsTree );
467cdf0e10cSrcweir }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir #endif // #ifndef _SVIMPLBOX_HXX
470cdf0e10cSrcweir 
471