Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_INC_ILSTBOX_HXX
21 : #define INCLUDED_VCL_INC_ILSTBOX_HXX
22 :
23 : #include <boost/ptr_container/ptr_vector.hpp>
24 : #include <boost/signals2/signal.hpp>
25 : #include <vcl/image.hxx>
26 : #include <vcl/ctrl.hxx>
27 : #include <vcl/button.hxx>
28 : #include <vcl/floatwin.hxx>
29 : #include <vcl/lstbox.h>
30 : #include <vcl/timer.hxx>
31 :
32 : #include "vcl/quickselectionengine.hxx"
33 :
34 : class ScrollBar;
35 : class ScrollBarBox;
36 :
37 : #define HORZ_SCROLL 4
38 : #define IMG_TXT_DISTANCE 6
39 :
40 : enum LB_EVENT_TYPE
41 : {
42 : LET_MBDOWN,
43 : LET_TRACKING,
44 : LET_TRACKING_END,
45 : LET_KEYMOVE,
46 : LET_KEYSPACE
47 : };
48 :
49 260038 : struct ImplEntryType
50 : {
51 : OUString maStr;
52 : Image maImage;
53 : void* mpUserData;
54 : bool mbIsSelected;
55 : long mnFlags;
56 : long mnHeight;
57 :
58 1379 : ImplEntryType( const OUString& rStr, const Image& rImage ) :
59 : maStr( rStr ),
60 : maImage( rImage ),
61 : mnFlags( 0 ),
62 1379 : mnHeight( 0 )
63 : {
64 1379 : mbIsSelected = false;
65 1379 : mpUserData = NULL;
66 1379 : }
67 :
68 258659 : ImplEntryType( const OUString& rStr ) :
69 : maStr( rStr ),
70 : mnFlags( 0 ),
71 258659 : mnHeight( 0 )
72 : {
73 258659 : mbIsSelected = false;
74 258659 : mpUserData = NULL;
75 258659 : }
76 :
77 : ImplEntryType( const Image& rImage ) :
78 : maImage( rImage ),
79 : mnFlags( 0 ),
80 : mnHeight( 0 )
81 : {
82 : mbIsSelected = false;
83 : mpUserData = NULL;
84 : }
85 : };
86 :
87 : class ImplEntryList
88 : {
89 : private:
90 : vcl::Window* mpWindow; ///< For getting the current locale when matching strings
91 : sal_Int32 mnLastSelected;
92 : sal_Int32 mnSelectionAnchor;
93 : sal_Int32 mnImages;
94 :
95 : sal_Int32 mnMRUCount;
96 : sal_Int32 mnMaxMRUCount;
97 :
98 : Link maSelectionChangedHdl;
99 : bool mbCallSelectionChangedHdl;
100 : boost::ptr_vector<ImplEntryType> maEntries;
101 :
102 1891419 : ImplEntryType* GetEntry( sal_Int32 nPos ) const
103 : {
104 1891419 : if (nPos < 0 || static_cast<size_t>(nPos) >= maEntries.size())
105 414 : return NULL;
106 1891005 : return const_cast<ImplEntryType*>(&maEntries[nPos]);
107 : }
108 :
109 : public:
110 : ImplEntryList( vcl::Window* pWindow );
111 : ~ImplEntryList();
112 :
113 : sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort );
114 : void RemoveEntry( sal_Int32 nPos );
115 753084 : const ImplEntryType* GetEntryPtr( sal_Int32 nPos ) const { return (const ImplEntryType*) GetEntry( nPos ); }
116 86226 : ImplEntryType* GetMutableEntryPtr( sal_Int32 nPos ) const { return GetEntry( nPos ); }
117 : void Clear();
118 :
119 : sal_Int32 FindMatchingEntry( const OUString& rStr, sal_Int32 nStart = 0, bool bForward = true, bool bLazy = true ) const;
120 : sal_Int32 FindEntry( const OUString& rStr, bool bSearchMRUArea = false ) const;
121 : sal_Int32 FindEntry( const void* pData ) const;
122 :
123 : /// helper: add up heights up to index nEndIndex.
124 : /// GetAddedHeight( 0 ) @return 0
125 : /// GetAddedHeight( LISTBOX_ENTRY_NOTFOUND ) @return 0
126 : /// GetAddedHeight( i, k ) with k > i is equivalent -GetAddedHeight( k, i )
127 : long GetAddedHeight( sal_Int32 nEndIndex, sal_Int32 nBeginIndex = 0, long nBeginHeight = 0 ) const;
128 : long GetEntryHeight( sal_Int32 nPos ) const;
129 :
130 804577 : sal_Int32 GetEntryCount() const { return (sal_Int32 )maEntries.size(); }
131 4579 : bool HasImages() const { return mnImages ? true : false; }
132 :
133 : OUString GetEntryText( sal_Int32 nPos ) const;
134 :
135 : bool HasEntryImage( sal_Int32 nPos ) const;
136 : Image GetEntryImage( sal_Int32 nPos ) const;
137 :
138 : void SetEntryData( sal_Int32 nPos, void* pNewData );
139 : void* GetEntryData( sal_Int32 nPos ) const;
140 :
141 : void SetEntryFlags( sal_Int32 nPos, long nFlags );
142 : long GetEntryFlags( sal_Int32 nPos ) const;
143 :
144 : void SelectEntry( sal_Int32 nPos, bool bSelect );
145 :
146 : sal_Int32 GetSelectEntryCount() const;
147 : OUString GetSelectEntry( sal_Int32 nIndex ) const;
148 : sal_Int32 GetSelectEntryPos( sal_Int32 nIndex ) const;
149 : bool IsEntryPosSelected( sal_Int32 nIndex ) const;
150 :
151 0 : void SetLastSelected( sal_Int32 nPos ) { mnLastSelected = nPos; }
152 0 : sal_Int32 GetLastSelected() const { return mnLastSelected; }
153 :
154 0 : void SetSelectionAnchor( sal_Int32 nPos ) { mnSelectionAnchor = nPos; }
155 0 : sal_Int32 GetSelectionAnchor() const { return mnSelectionAnchor; }
156 :
157 6286 : void SetSelectionChangedHdl( const Link& rLnk ) { maSelectionChangedHdl = rLnk; }
158 56724 : void SetCallSelectionChangedHdl( bool bCall ) { mbCallSelectionChangedHdl = bCall; }
159 :
160 0 : void SetMRUCount( sal_Int32 n ) { mnMRUCount = n; }
161 570952 : sal_Int32 GetMRUCount() const { return mnMRUCount; }
162 :
163 1954 : void SetMaxMRUCount( sal_Int32 n ) { mnMaxMRUCount = n; }
164 1956 : sal_Int32 GetMaxMRUCount() const { return mnMaxMRUCount; }
165 :
166 : /** An Entry is selectable if its mnFlags does not have the
167 : LISTBOX_ENTRY_FLAG_DISABLE_SELECTION flag set. */
168 : bool IsEntrySelectable( sal_Int32 nPos ) const;
169 :
170 : /** @return the first entry found from the given position nPos that is selectable
171 : or LISTBOX_ENTRY_NOTFOUND if non is found. If the entry at nPos is not selectable,
172 : it returns the first selectable entry after nPos if bForward is true and the
173 : first selectable entry after nPos is bForward is false.
174 : */
175 : sal_Int32 FindFirstSelectable( sal_Int32 nPos, bool bForward = true );
176 : };
177 :
178 : class ImplListBoxWindow : public Control, public ::vcl::ISearchableStringList
179 : {
180 : private:
181 : ImplEntryList* mpEntryList; ///< EntryList
182 : Rectangle maFocusRect;
183 :
184 : Size maUserItemSize;
185 :
186 : long mnMaxTxtHeight; ///< Maximum height of a text item
187 : long mnMaxTxtWidth; ///< Maximum width of a text item
188 : ///< Entry without Image
189 : long mnMaxImgTxtWidth;///< Maximum width of a text item
190 : ///< Entry AND Image
191 : long mnMaxImgWidth; ///< Maximum width of an image item
192 : long mnMaxImgHeight; ///< Maximum height of an image item
193 : long mnMaxWidth; ///< Maximum width of an entry
194 : long mnMaxHeight; ///< Maximum height of an entry
195 :
196 : sal_Int32 mnCurrentPos; ///< Position (Focus)
197 : sal_Int32 mnTrackingSaveSelection; ///< Selection before Tracking();
198 :
199 : sal_Int32 mnSeparatorPos; ///< Separator
200 :
201 : sal_Int32 mnUserDrawEntry;
202 :
203 : sal_Int32 mnTop; ///< output from line on
204 : long mnLeft; ///< output from column on
205 : long mnBorder; ///< distance border - text
206 : long mnTextHeight; ///< text height
207 : ProminentEntry meProminentType; ///< where is the "prominent" entry
208 :
209 : sal_uInt16 mnSelectModifier; ///< Modifiers
210 :
211 : /// bitfield
212 : bool mbHasFocusRect : 1;
213 : bool mbSort : 1; ///< ListBox sorted
214 : bool mbTrack : 1; ///< Tracking
215 : bool mbMulti : 1; ///< MultiListBox
216 : bool mbStackMode : 1; ///< StackSelection
217 : bool mbSimpleMode : 1; ///< SimpleMode for MultiListBox
218 : bool mbImgsDiffSz : 1; ///< Images have different sizes
219 : bool mbTravelSelect : 1; ///< TravelSelect
220 : bool mbTrackingSelect : 1; ///< Selected at a MouseMove
221 : bool mbSelectionChanged : 1; ///< Do not call Select() too often ...
222 : bool mbMouseMoveSelect : 1; ///< Select at MouseMove
223 : bool mbGrabFocus : 1; ///< Grab focus at MBDown
224 : bool mbUserDrawEnabled : 1; ///< UserDraw possible
225 : bool mbInUserDraw : 1; ///< In UserDraw
226 : bool mbReadOnly : 1; ///< ReadOnly
227 : bool mbMirroring : 1; ///< pb: #106948# explicit mirroring for calc
228 : bool mbRight : 1; ///< right align Text output
229 : bool mbCenter : 1; ///< center Text output
230 : bool mbEdgeBlending : 1;
231 :
232 : Link maScrollHdl;
233 : Link maSelectHdl;
234 : Link maCancelHdl;
235 : Link maDoubleClickHdl;
236 : Link maMRUChangedHdl;
237 : Link maFocusHdl;
238 : Link maListItemSelectHdl;
239 :
240 : ::vcl::QuickSelectionEngine maQuickSelectionEngine;
241 :
242 : protected:
243 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
244 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
245 : virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
246 : virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
247 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
248 : virtual void Resize() SAL_OVERRIDE;
249 : virtual void GetFocus() SAL_OVERRIDE;
250 : virtual void LoseFocus() SAL_OVERRIDE;
251 :
252 : bool SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift = false, bool bCtrl = false, bool bSelectPosChange = false );
253 : void ImplPaint( sal_Int32 nPos, bool bErase = false, bool bLayout = false );
254 : void ImplDoPaint( const Rectangle& rRect, bool bLayout = false );
255 : void ImplCalcMetrics();
256 : void ImplUpdateEntryMetrics( ImplEntryType& rEntry );
257 : void ImplCallSelect();
258 :
259 : void ImplShowFocusRect();
260 : void ImplHideFocusRect();
261 :
262 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
263 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
264 :
265 : public:
266 : virtual void FillLayoutData() const SAL_OVERRIDE;
267 :
268 : ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle );
269 : virtual ~ImplListBoxWindow();
270 :
271 1085022 : ImplEntryList* GetEntryList() const { return mpEntryList; }
272 :
273 : sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry );
274 : void RemoveEntry( sal_Int32 nPos );
275 : void Clear();
276 16458 : void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; }
277 36537 : sal_Int32 GetCurrentPos() const { return mnCurrentPos; }
278 : sal_uInt16 GetDisplayLineCount() const;
279 : void SetEntryFlags( sal_Int32 nPos, long nFlags );
280 :
281 : void DrawEntry( sal_Int32 nPos, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos = false, bool bLayout = false );
282 :
283 : void SelectEntry( sal_Int32 nPos, bool bSelect );
284 : void DeselectAll();
285 : sal_Int32 GetEntryPosForPoint( const Point& rPoint ) const;
286 : sal_Int32 GetLastVisibleEntry() const;
287 :
288 : bool ProcessKeyInput( const KeyEvent& rKEvt );
289 :
290 : void SetTopEntry( sal_Int32 nTop );
291 35488 : sal_Int32 GetTopEntry() const { return mnTop; }
292 : /** ShowProminentEntry will set the entry correspoding to nEntryPos
293 : either at top or in the middle depending on the chosen style*/
294 : void ShowProminentEntry( sal_Int32 nEntryPos );
295 1948 : void SetProminentEntryType( ProminentEntry eType ) { meProminentType = eType; }
296 : ProminentEntry GetProminentEntryType() const { return meProminentType; }
297 : using Window::IsVisible;
298 : bool IsVisible( sal_Int32 nEntry ) const;
299 :
300 7207 : long GetLeftIndent() const { return mnLeft; }
301 : void SetLeftIndent( long n );
302 : void ScrollHorz( long nDiff );
303 :
304 78 : void AllowGrabFocus( bool b ) { mbGrabFocus = b; }
305 8 : bool IsGrabFocusAllowed() const { return mbGrabFocus; }
306 :
307 10116 : void SetSeparatorPos( sal_Int32 n ) { mnSeparatorPos = n; }
308 0 : sal_Int32 GetSeparatorPos() const { return mnSeparatorPos; }
309 :
310 0 : void SetTravelSelect( bool bTravelSelect ) { mbTravelSelect = bTravelSelect; }
311 0 : bool IsTravelSelect() const { return mbTravelSelect; }
312 356 : bool IsTrackingSelect() const { return mbTrackingSelect; }
313 :
314 : void SetUserItemSize( const Size& rSz );
315 : const Size& GetUserItemSize() const { return maUserItemSize; }
316 :
317 3296 : void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
318 353065 : bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
319 :
320 64 : void EnableMultiSelection( bool bMulti, bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; }
321 28396 : bool IsMultiSelectionEnabled() const { return mbMulti; }
322 :
323 174 : void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; }
324 : bool IsMultiSelectionSimpleMode() const { return mbSimpleMode; }
325 :
326 8 : void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; }
327 : bool IsMouseMoveSelectEnabled() const { return mbMouseMoveSelect; }
328 0 : bool IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; }
329 :
330 : Size CalcSize(sal_Int32 nMaxLines) const;
331 : Rectangle GetBoundingRectangle( sal_Int32 nItem ) const;
332 :
333 45152 : long GetEntryHeight() const { return mnMaxHeight; }
334 25370 : long GetMaxEntryWidth() const { return mnMaxWidth; }
335 :
336 6314 : void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; }
337 : const Link& GetScrollHdl() const { return maScrollHdl; }
338 6314 : void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
339 : const Link& GetSelectHdl() const { return maSelectHdl; }
340 6314 : void SetCancelHdl( const Link& rLink ) { maCancelHdl = rLink; }
341 : const Link& GetCancelHdl() const { return maCancelHdl; }
342 6314 : void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
343 : const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
344 6314 : void SetMRUChangedHdl( const Link& rLink ) { maMRUChangedHdl = rLink; }
345 : const Link& GetMRUChangedHdl() const { return maMRUChangedHdl; }
346 608 : void SetFocusHdl( const Link& rLink ) { maFocusHdl = rLink ; }
347 : const Link& GetFocusHdl() const { return maFocusHdl; }
348 :
349 : boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
350 :
351 6314 : void SetListItemSelectHdl( const Link& rLink ) { maListItemSelectHdl = rLink ; }
352 : const Link& GetListItemSelectHdl() const { return maListItemSelectHdl; }
353 0 : bool IsSelectionChanged() const { return mbSelectionChanged; }
354 0 : sal_uInt16 GetSelectModifier() const { return mnSelectModifier; }
355 :
356 18050 : void EnableSort( bool b ) { mbSort = b; }
357 :
358 60 : void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; }
359 80 : bool IsReadOnly() const { return mbReadOnly; }
360 :
361 : using Control::ImplInitSettings;
362 : void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
363 : sal_uInt16 ImplGetTextStyle() const;
364 :
365 : /// pb: #106948# explicit mirroring for calc
366 0 : inline void EnableMirroring() { mbMirroring = true; }
367 27331 : inline bool IsMirroring() const { return mbMirroring; }
368 :
369 57 : bool GetEdgeBlending() const { return mbEdgeBlending; }
370 6440 : void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
371 : void EnableQuickSelection( const bool& b );
372 :
373 : protected:
374 : // ISearchableStringList
375 : virtual ::vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const SAL_OVERRIDE;
376 : virtual ::vcl::StringEntryIdentifier NextEntry( ::vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const SAL_OVERRIDE;
377 : virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry ) SAL_OVERRIDE;
378 : };
379 :
380 : class ImplListBox : public Control
381 : {
382 : private:
383 : ImplListBoxWindow maLBWindow;
384 : ScrollBar* mpHScrollBar;
385 : ScrollBar* mpVScrollBar;
386 : ScrollBarBox* mpScrollBarBox;
387 :
388 : /// bitfield
389 : bool mbVScroll : 1; // VScroll an oder aus
390 : bool mbHScroll : 1; // HScroll an oder aus
391 : bool mbAutoHScroll : 1; // AutoHScroll an oder aus
392 : bool mbEdgeBlending : 1;
393 :
394 : Link maScrollHdl; // because it is needed by ImplListBoxWindow itself
395 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
396 :
397 : protected:
398 : virtual void GetFocus() SAL_OVERRIDE;
399 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
400 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
401 :
402 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
403 :
404 : void ImplResizeControls();
405 : void ImplCheckScrollBars();
406 : void ImplInitScrollBars();
407 :
408 : DECL_LINK( ScrollBarHdl, ScrollBar* );
409 : DECL_LINK( LBWindowScrolled, void* );
410 : DECL_LINK( MRUChanged, void* );
411 :
412 : public:
413 : ImplListBox( vcl::Window* pParent, WinBits nWinStyle );
414 : virtual ~ImplListBox();
415 :
416 944414 : const ImplEntryList* GetEntryList() const { return maLBWindow.GetEntryList(); }
417 40511 : ImplListBoxWindow& GetMainWindow() { return maLBWindow; }
418 :
419 : virtual void Resize() SAL_OVERRIDE;
420 : virtual const Wallpaper& GetDisplayBackground() const SAL_OVERRIDE;
421 : virtual vcl::Window* GetPreferredKeyInputWindow() SAL_OVERRIDE;
422 :
423 : sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr );
424 : sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage );
425 : void RemoveEntry( sal_Int32 nPos );
426 58440 : void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); }
427 : void Clear();
428 :
429 : void SetEntryFlags( sal_Int32 nPos, long nFlags );
430 :
431 : void SelectEntry( sal_Int32 nPos, bool bSelect );
432 : void SetNoSelection();
433 16458 : void ResetCurrentPos() { maLBWindow.ResetCurrentPos(); }
434 36537 : sal_Int32 GetCurrentPos() const { return maLBWindow.GetCurrentPos(); }
435 :
436 0 : bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow.ProcessKeyInput( rKEvt ); }
437 : bool HandleWheelAsCursorTravel( const CommandEvent& rCEvt );
438 :
439 10116 : void SetSeparatorPos( sal_Int32 n ) { maLBWindow.SetSeparatorPos( n ); }
440 0 : sal_Int32 GetSeparatorPos() const { return maLBWindow.GetSeparatorPos(); }
441 :
442 36161 : void SetTopEntry( sal_Int32 nTop ) { maLBWindow.SetTopEntry( nTop ); }
443 35488 : sal_Int32 GetTopEntry() const { return maLBWindow.GetTopEntry(); }
444 16251 : void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow.ShowProminentEntry( nPos ); }
445 : using Window::IsVisible;
446 11904 : bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow.IsVisible( nEntry ); }
447 :
448 1948 : void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); }
449 : ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); }
450 :
451 7207 : long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); }
452 50753 : void SetLeftIndent( sal_uInt16 n ) { maLBWindow.SetLeftIndent( n ); }
453 : void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); }
454 :
455 0 : void SetTravelSelect( bool bTravelSelect ) { maLBWindow.SetTravelSelect( bTravelSelect ); }
456 0 : bool IsTravelSelect() const { return maLBWindow.IsTravelSelect(); }
457 356 : bool IsTrackingSelect() const { return maLBWindow.IsTrackingSelect(); }
458 :
459 64 : void EnableMultiSelection( bool bMulti, bool bStackMode ) { maLBWindow.EnableMultiSelection( bMulti, bStackMode ); }
460 28396 : bool IsMultiSelectionEnabled() const { return maLBWindow.IsMultiSelectionEnabled(); }
461 :
462 174 : void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow.SetMultiSelectionSimpleMode( bSimple ); }
463 : bool IsMultiSelectionSimpleMode() const { return maLBWindow.IsMultiSelectionSimpleMode(); }
464 :
465 60 : void SetReadOnly( bool b ) { maLBWindow.SetReadOnly( b ); }
466 80 : bool IsReadOnly() const { return maLBWindow.IsReadOnly(); }
467 :
468 11017 : Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow.CalcSize( nMaxLines ); }
469 45152 : long GetEntryHeight() const { return maLBWindow.GetEntryHeight(); }
470 25370 : long GetMaxEntryWidth() const { return maLBWindow.GetMaxEntryWidth(); }
471 :
472 608 : void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; }
473 : const Link& GetScrollHdl() const { return maScrollHdl; }
474 6314 : void SetSelectHdl( const Link& rLink ) { maLBWindow.SetSelectHdl( rLink ); }
475 : const Link& GetSelectHdl() const { return maLBWindow.GetSelectHdl(); }
476 6314 : void SetCancelHdl( const Link& rLink ) { maLBWindow.SetCancelHdl( rLink ); }
477 : const Link& GetCancelHdl() const { return maLBWindow.GetCancelHdl(); }
478 6314 : void SetDoubleClickHdl( const Link& rLink ) { maLBWindow.SetDoubleClickHdl( rLink ); }
479 : const Link& GetDoubleClickHdl() const { return maLBWindow.GetDoubleClickHdl(); }
480 :
481 : boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
482 :
483 608 : void SetFocusHdl( const Link& rLink ) { maLBWindow.SetFocusHdl( rLink ); }
484 : const Link& GetFocusHdl() const { return maLBWindow.GetFocusHdl(); }
485 6314 : void SetListItemSelectHdl( const Link& rLink ) { maLBWindow.SetListItemSelectHdl( rLink ); }
486 : const Link& GetListItemSelectHdl() const { return maLBWindow.GetListItemSelectHdl(); }
487 6286 : void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); }
488 56724 : void SetCallSelectionChangedHdl( bool bCall ) { maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
489 0 : bool IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); }
490 0 : sal_uInt16 GetSelectModifier() const { return maLBWindow.GetSelectModifier(); }
491 :
492 : void SetMRUEntries( const OUString& rEntries, sal_Unicode cSep );
493 : OUString GetMRUEntries( sal_Unicode cSep ) const;
494 1954 : void SetMaxMRUCount( sal_Int32 n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); }
495 1956 : sal_Int32 GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); }
496 423 : sal_uInt16 GetDisplayLineCount() const
497 423 : { return maLBWindow.GetDisplayLineCount(); }
498 :
499 6440 : bool GetEdgeBlending() const { return mbEdgeBlending; }
500 : void SetEdgeBlending(bool bNew);
501 :
502 : /// pb: #106948# explicit mirroring for calc
503 0 : inline void EnableMirroring() { maLBWindow.EnableMirroring(); }
504 608 : inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; }
505 : };
506 :
507 12516 : class ImplListBoxFloatingWindow : public FloatingWindow
508 : {
509 : private:
510 : ImplListBox* mpImplLB;
511 : Size maPrefSz;
512 : sal_uInt16 mnDDLineCount;
513 : sal_Int32 mnPopupModeStartSaveSelection;
514 : bool mbAutoWidth;
515 :
516 : protected:
517 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
518 :
519 : public:
520 : ImplListBoxFloatingWindow( vcl::Window* pParent );
521 :
522 6258 : void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; }
523 :
524 19359 : void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; }
525 19359 : const Size& GetPrefSize() const { return maPrefSz; }
526 :
527 6258 : void SetAutoWidth( bool b ) { mbAutoWidth = b; }
528 : bool IsAutoWidth() const { return mbAutoWidth; }
529 :
530 : Size CalcFloatSize();
531 : void StartFloat( bool bStartTracking );
532 :
533 : virtual void setPosSizePixel( long nX, long nY,
534 : long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL ) SAL_OVERRIDE;
535 0 : void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) SAL_OVERRIDE
536 0 : { FloatingWindow::SetPosSizePixel( rNewPos, rNewSize ); }
537 :
538 11022 : void SetDropDownLineCount( sal_uInt16 n ) { mnDDLineCount = n; }
539 0 : sal_uInt16 GetDropDownLineCount() const { return mnDDLineCount; }
540 :
541 0 : sal_Int32 GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection; }
542 :
543 : virtual void Resize() SAL_OVERRIDE;
544 : };
545 :
546 : class ImplWin : public Control
547 : {
548 : private:
549 :
550 : sal_Int32 mnItemPos; ///< because of UserDraw I have to know which item I draw
551 : OUString maString;
552 : Image maImage;
553 :
554 : Rectangle maFocusRect;
555 : Size maUserItemSize;
556 :
557 : /// bitfield
558 : bool mbUserDrawEnabled : 1;
559 : bool mbInUserDraw : 1;
560 : bool mbEdgeBlending : 1;
561 :
562 : void ImplDraw( bool bLayout = false );
563 : protected:
564 : virtual void FillLayoutData() const SAL_OVERRIDE;
565 : public:
566 :
567 : ImplWin( vcl::Window* pParent, WinBits nWinStyle = 0 );
568 1160 : virtual ~ImplWin() {};
569 :
570 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
571 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
572 : virtual void Resize() SAL_OVERRIDE;
573 : virtual void GetFocus() SAL_OVERRIDE;
574 : virtual void LoseFocus() SAL_OVERRIDE;
575 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
576 :
577 0 : sal_Int32 GetItemPos() const { return mnItemPos; }
578 2244 : void SetItemPos( sal_Int32 n ) { mnItemPos = n; }
579 :
580 : const OUString& GetString() const { return maString; }
581 2244 : void SetString( const OUString& rStr ) { maString = rStr; }
582 :
583 : const Image& GetImage() const { return maImage; }
584 1951 : void SetImage( const Image& rImg ) { maImage = rImg; }
585 :
586 : virtual void MBDown();
587 :
588 : boost::signals2::signal< void ( ImplWin* ) > buttonDownSignal;
589 : boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
590 :
591 126 : void SetUserItemSize( const Size& rSz ) { maUserItemSize = rSz; }
592 : const Size& GetUserItemSize() const { return maUserItemSize; }
593 :
594 126 : void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
595 1170 : bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
596 :
597 : void DrawEntry( bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos = false, bool bLayout = false );
598 :
599 58 : bool GetEdgeBlending() const { return mbEdgeBlending; }
600 706 : void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
601 : };
602 :
603 : class ImplBtn : public PushButton
604 : {
605 : private:
606 : bool mbDown;
607 :
608 : public:
609 : ImplBtn( vcl::Window* pParent, WinBits nWinStyle = 0 );
610 12516 : virtual ~ImplBtn() {};
611 :
612 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
613 : virtual void MBDown();
614 :
615 : boost::signals2::signal< void ( ImplBtn* ) > buttonDownSignal;
616 : };
617 :
618 : void ImplInitFieldSettings( vcl::Window* pWin, bool bFont, bool bForeground, bool bBackground );
619 : void ImplInitDropDownButton( PushButton* pButton );
620 :
621 : #endif // INCLUDED_VCL_INC_ILSTBOX_HXX
622 :
623 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|