Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / vcl / inc / ilstbox.hxx
blob8a851afbff7e65d63b3134122ba4560e7c6c7634
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SV_ILSTBOX_HXX
21 #define _SV_ILSTBOX_HXX
23 #include <boost/ptr_container/ptr_vector.hpp>
25 #include <tools/solar.h>
26 #include <vcl/image.hxx>
27 #include <vcl/ctrl.hxx>
28 #include <vcl/button.hxx>
29 #include <vcl/floatwin.hxx>
30 #include <vcl/lstbox.h>
31 #include <vcl/timer.hxx>
33 #include "vcl/quickselectionengine.hxx"
35 class ScrollBar;
36 class ScrollBarBox;
38 // -----------------
39 // - ListBox-Types -
40 // -----------------
42 #define HORZ_SCROLL 4
43 #define IMG_TXT_DISTANCE 6
45 enum LB_EVENT_TYPE
47 LET_MBDOWN,
48 LET_TRACKING,
49 LET_TRACKING_END,
50 LET_KEYMOVE,
51 LET_KEYSPACE
54 // -----------------
55 // - ImplEntryType -
56 // -----------------
58 struct ImplEntryType
60 XubString maStr;
61 Image maImage;
62 void* mpUserData;
63 sal_Bool mbIsSelected;
64 long mnFlags;
65 long mnHeight;
67 ImplEntryType( const XubString& rStr, const Image& rImage ) :
68 maStr( rStr ),
69 maImage( rImage ),
70 mnFlags( 0 ),
71 mnHeight( 0 )
73 mbIsSelected = sal_False;
74 mpUserData = NULL;
77 ImplEntryType( const XubString& rStr ) :
78 maStr( rStr ),
79 mnFlags( 0 ),
80 mnHeight( 0 )
82 mbIsSelected = sal_False;
83 mpUserData = NULL;
86 ImplEntryType( const Image& rImage ) :
87 maImage( rImage ),
88 mnFlags( 0 ),
89 mnHeight( 0 )
91 mbIsSelected = sal_False;
92 mpUserData = NULL;
96 // -----------------
97 // - ImplEntryList -
98 // -----------------
100 class ImplEntryList
102 private:
103 Window* mpWindow; // For getting the current locale when matching strings
104 sal_uInt16 mnLastSelected;
105 sal_uInt16 mnSelectionAnchor;
106 sal_uInt16 mnImages;
108 sal_uInt16 mnMRUCount;
109 sal_uInt16 mnMaxMRUCount;
111 Link maSelectionChangedHdl;
112 sal_Bool mbCallSelectionChangedHdl;
113 boost::ptr_vector<ImplEntryType> maEntries;
115 ImplEntryType* GetEntry( sal_uInt16 nPos ) const
117 if (nPos >= maEntries.size())
118 return NULL;
119 return const_cast<ImplEntryType*>(&maEntries[nPos]);
122 public:
123 ImplEntryList( Window* pWindow );
124 ~ImplEntryList();
126 sal_uInt16 InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort );
127 void RemoveEntry( sal_uInt16 nPos );
128 const ImplEntryType* GetEntryPtr( sal_uInt16 nPos ) const { return (const ImplEntryType*) GetEntry( nPos ); }
129 ImplEntryType* GetMutableEntryPtr( sal_uInt16 nPos ) const { return GetEntry( nPos ); }
130 void Clear();
132 sal_uInt16 FindMatchingEntry( const XubString& rStr, sal_uInt16 nStart = 0, sal_Bool bForward = sal_True, sal_Bool bLazy = sal_True ) const;
133 sal_uInt16 FindEntry( const XubString& rStr, sal_Bool bSearchMRUArea = sal_False ) const;
134 sal_uInt16 FindEntry( const void* pData ) const;
136 // helper: add up heights up to index nEndIndex.
137 // GetAddedHeight( 0 ) returns 0
138 // GetAddedHeight( LISTBOX_ENTRY_NOTFOUND ) returns 0
139 // GetAddedHeight( i, k ) with k > i is equivalent -GetAddedHeight( k, i )
140 long GetAddedHeight( sal_uInt16 nEndIndex, sal_uInt16 nBeginIndex = 0, long nBeginHeight = 0 ) const;
141 long GetEntryHeight( sal_uInt16 nPos ) const;
143 sal_uInt16 GetEntryCount() const { return (sal_uInt16)maEntries.size(); }
144 sal_Bool HasImages() const { return mnImages ? sal_True : sal_False; }
146 XubString GetEntryText( sal_uInt16 nPos ) const;
148 sal_Bool HasEntryImage( sal_uInt16 nPos ) const;
149 Image GetEntryImage( sal_uInt16 nPos ) const;
151 void SetEntryData( sal_uInt16 nPos, void* pNewData );
152 void* GetEntryData( sal_uInt16 nPos ) const;
154 void SetEntryFlags( sal_uInt16 nPos, long nFlags );
155 long GetEntryFlags( sal_uInt16 nPos ) const;
157 void SelectEntry( sal_uInt16 nPos, sal_Bool bSelect );
159 sal_uInt16 GetSelectEntryCount() const;
160 XubString GetSelectEntry( sal_uInt16 nIndex ) const;
161 sal_uInt16 GetSelectEntryPos( sal_uInt16 nIndex ) const;
162 sal_Bool IsEntryPosSelected( sal_uInt16 nIndex ) const;
164 void SetLastSelected( sal_uInt16 nPos ) { mnLastSelected = nPos; }
165 sal_uInt16 GetLastSelected() const { return mnLastSelected; }
167 void SetSelectionAnchor( sal_uInt16 nPos ) { mnSelectionAnchor = nPos; }
168 sal_uInt16 GetSelectionAnchor() const { return mnSelectionAnchor; }
171 void SetSelectionChangedHdl( const Link& rLnk ) { maSelectionChangedHdl = rLnk; }
172 void SetCallSelectionChangedHdl( sal_Bool bCall ) { mbCallSelectionChangedHdl = bCall; }
174 void SetMRUCount( sal_uInt16 n ) { mnMRUCount = n; }
175 sal_uInt16 GetMRUCount() const { return mnMRUCount; }
177 void SetMaxMRUCount( sal_uInt16 n ) { mnMaxMRUCount = n; }
178 sal_uInt16 GetMaxMRUCount() const { return mnMaxMRUCount; }
180 /** An Entry is selectable if its mnFlags does not have the
181 LISTBOX_ENTRY_FLAG_DISABLE_SELECTION flag set. */
182 bool IsEntrySelectable( sal_uInt16 nPos ) const;
184 /** returns the first entry found from the given position nPos that is selectable
185 or LISTBOX_ENTRY_NOTFOUND if non is found. If the entry at nPos is not selectable,
186 it returns the first selectable entry after nPos if bForward is true and the
187 first selectable entry after nPos is bForward is false.
189 sal_uInt16 FindFirstSelectable( sal_uInt16 nPos, bool bForward = true );
191 void take_properties(ImplEntryList &rOther);
194 // ---------------------
195 // - ImplListBoxWindow -
196 // ---------------------
198 class ImplListBoxWindow : public Control, public ::vcl::ISearchableStringList
200 private:
201 ImplEntryList* mpEntryList; // EntryList
202 Rectangle maFocusRect;
204 Size maUserItemSize;
206 long mnMaxTxtHeight; // Maximum height of a text item
207 long mnMaxTxtWidth; // Maximum width of a text item
208 // Entry without Image
209 long mnMaxImgTxtWidth;// Maximum width of a text item
210 // Entry AND Image
211 long mnMaxImgWidth; // Maximum width of an image item
212 long mnMaxImgHeight; // Maximum height of an image item
213 long mnMaxWidth; // Maximum width of an entry
214 long mnMaxHeight; // Maximum heigth of an entry
216 sal_uInt16 mnCurrentPos; // Position (Focus)
217 sal_uInt16 mnTrackingSaveSelection; // Selection before Tracking();
219 sal_uInt16 mnSeparatorPos; // Separator
221 sal_uInt16 mnUserDrawEntry;
223 sal_uInt16 mnTop; // output from line on
224 long mnLeft; // output from column on
225 long mnBorder; // distance border - text
226 long mnTextHeight; // text height
227 ProminentEntry meProminentType; // where is the "prominent" entry
229 sal_uInt16 mnSelectModifier; // Modifiers
231 sal_Bool mbHasFocusRect: 1,
232 mbSort: 1, // ListBox sorted
233 mbTrack: 1, // Tracking
234 mbMulti: 1, // MultiListBox
235 mbStackMode: 1, // StackSelection
236 mbSimpleMode: 1, // SimpleMode for MultiListBox
237 mbImgsDiffSz: 1, // Images have different sizes
238 mbTravelSelect: 1, // TravelSelect
239 mbTrackingSelect: 1, // Selected at a MouseMove
240 mbSelectionChanged: 1, // Do not call Select() too often ...
241 mbMouseMoveSelect: 1, // Select at MouseMove
242 mbGrabFocus: 1, // Grab focus at MBDown
243 mbUserDrawEnabled: 1, // UserDraw possible
244 mbInUserDraw: 1, // In UserDraw
245 mbReadOnly: 1, // ReadOnly
246 mbMirroring: 1, // pb: #106948# explicit mirroring for calc
247 mbRight: 1, // right align Text output
248 mbCenter: 1; // center Text output
250 Link maScrollHdl;
251 Link maSelectHdl;
252 Link maCancelHdl;
253 Link maDoubleClickHdl;
254 Link maUserDrawHdl;
255 Link maMRUChangedHdl;
257 ::vcl::QuickSelectionEngine
258 maQuickSelectionEngine;
260 protected:
261 virtual void KeyInput( const KeyEvent& rKEvt );
262 virtual void MouseButtonDown( const MouseEvent& rMEvt );
263 virtual void MouseMove( const MouseEvent& rMEvt );
264 virtual void Tracking( const TrackingEvent& rTEvt );
265 virtual void Paint( const Rectangle& rRect );
266 virtual void Resize();
267 virtual void GetFocus();
268 virtual void LoseFocus();
270 sal_Bool SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False );
271 void ImplPaint( sal_uInt16 nPos, sal_Bool bErase = sal_False, bool bLayout = false );
272 void ImplDoPaint( const Rectangle& rRect, bool bLayout = false );
273 void ImplCalcMetrics();
274 void ImplUpdateEntryMetrics( ImplEntryType& rEntry );
275 void ImplCallSelect();
277 void ImplShowFocusRect();
278 void ImplHideFocusRect();
281 virtual void StateChanged( StateChangedType nType );
282 virtual void DataChanged( const DataChangedEvent& rDCEvt );
284 public:
285 virtual void FillLayoutData() const;
287 ImplListBoxWindow( Window* pParent, WinBits nWinStyle );
288 ~ImplListBoxWindow();
290 ImplEntryList* GetEntryList() const { return mpEntryList; }
292 sal_uInt16 InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry );
293 void RemoveEntry( sal_uInt16 nPos );
294 void Clear();
295 void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; }
296 sal_uInt16 GetCurrentPos() const { return mnCurrentPos; }
297 sal_uInt16 GetDisplayLineCount() const;
298 void SetEntryFlags( sal_uInt16 nPos, long nFlags );
300 void DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false );
302 void SelectEntry( sal_uInt16 nPos, sal_Bool bSelect );
303 void DeselectAll();
304 sal_uInt16 GetEntryPosForPoint( const Point& rPoint ) const;
305 sal_uInt16 GetLastVisibleEntry() const;
307 sal_Bool ProcessKeyInput( const KeyEvent& rKEvt );
309 void SetTopEntry( sal_uInt16 nTop );
310 sal_uInt16 GetTopEntry() const { return mnTop; }
311 // ShowProminentEntry will set the entry correspoding to nEntryPos
312 // either at top or in the middle depending on the chosen style
313 void ShowProminentEntry( sal_uInt16 nEntryPos );
314 void SetProminentEntryType( ProminentEntry eType ) { meProminentType = eType; }
315 ProminentEntry GetProminentEntryType() const { return meProminentType; }
316 using Window::IsVisible;
317 sal_Bool IsVisible( sal_uInt16 nEntry ) const;
319 long GetLeftIndent() const { return mnLeft; }
320 void SetLeftIndent( long n );
321 void ScrollHorz( long nDiff );
323 void AllowGrabFocus( sal_Bool b ) { mbGrabFocus = b; }
324 sal_Bool IsGrabFocusAllowed() const { return mbGrabFocus; }
326 void SetSeparatorPos( sal_uInt16 n ) { mnSeparatorPos = n; }
327 sal_uInt16 GetSeparatorPos() const { return mnSeparatorPos; }
329 void SetTravelSelect( sal_Bool bTravelSelect ) { mbTravelSelect = bTravelSelect; }
330 sal_Bool IsTravelSelect() const { return mbTravelSelect; }
331 sal_Bool IsTrackingSelect() const { return mbTrackingSelect; }
333 void SetUserItemSize( const Size& rSz );
334 const Size& GetUserItemSize() const { return maUserItemSize; }
336 void EnableUserDraw( sal_Bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
337 sal_Bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
339 void EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackMode ) { mbMulti = bMulti; mbStackMode = bStackMode; }
340 sal_Bool IsMultiSelectionEnabled() const { return mbMulti; }
342 void SetMultiSelectionSimpleMode( sal_Bool bSimple ) { mbSimpleMode = bSimple; }
343 sal_Bool IsMultiSelectionSimpleMode() const { return mbSimpleMode; }
345 void EnableMouseMoveSelect( sal_Bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; }
346 sal_Bool IsMouseMoveSelectEnabled() const { return mbMouseMoveSelect; }
347 sal_Bool IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; }
349 Size CalcSize( sal_uInt16 nMaxLines ) const;
350 Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const;
352 long GetEntryHeight() const { return mnMaxHeight; }
353 long GetMaxEntryWidth() const { return mnMaxWidth; }
355 void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; }
356 const Link& GetScrollHdl() const { return maScrollHdl; }
357 void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
358 const Link& GetSelectHdl() const { return maSelectHdl; }
359 void SetCancelHdl( const Link& rLink ) { maCancelHdl = rLink; }
360 const Link& GetCancelHdl() const { return maCancelHdl; }
361 void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
362 const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
363 void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; }
364 const Link& GetUserDrawHdl() const { return maUserDrawHdl; }
365 void SetMRUChangedHdl( const Link& rLink ) { maMRUChangedHdl = rLink; }
366 const Link& GetMRUChangedHdl() const { return maMRUChangedHdl; }
368 sal_Bool IsSelectionChanged() const { return mbSelectionChanged; }
369 sal_uInt16 GetSelectModifier() const { return mnSelectModifier; }
371 void EnableSort( sal_Bool b ) { mbSort = b; }
373 void SetReadOnly( sal_Bool bReadOnly ) { mbReadOnly = bReadOnly; }
374 sal_Bool IsReadOnly() const { return mbReadOnly; }
376 using Control::ImplInitSettings;
377 void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
378 sal_uInt16 ImplGetTextStyle() const;
380 // pb: #106948# explicit mirroring for calc
381 inline void EnableMirroring() { mbMirroring = sal_True; }
382 inline sal_Bool IsMirroring() const { return mbMirroring; }
385 * Takes ownership of the rOther properties
387 virtual void take_properties(Window &rOther);
389 protected:
390 // ISearchableStringList
391 virtual ::vcl::StringEntryIdentifier CurrentEntry( String& _out_entryText ) const;
392 virtual ::vcl::StringEntryIdentifier NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const;
393 virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry );
396 // ---------------
397 // - ImplListBox -
398 // ---------------
400 class ImplListBox : public Control
402 private:
403 ImplListBoxWindow maLBWindow;
404 ScrollBar* mpHScrollBar;
405 ScrollBar* mpVScrollBar;
406 ScrollBarBox* mpScrollBarBox;
407 sal_Bool mbVScroll : 1, // VScroll an oder aus
408 mbHScroll : 1, // HScroll an oder aus
409 mbAutoHScroll : 1; // AutoHScroll an oder aus
410 Link maScrollHdl; // Weil der vom ImplListBoxWindow selbst benoetigt wird.
411 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
413 protected:
414 virtual void GetFocus();
415 virtual void StateChanged( StateChangedType nType );
416 virtual void DataChanged( const DataChangedEvent& rDCEvt );
418 long Notify( NotifyEvent& rNEvt );
420 void ImplResizeControls();
421 void ImplCheckScrollBars();
422 void ImplInitScrollBars();
424 DECL_LINK( ScrollBarHdl, ScrollBar* );
425 DECL_LINK( LBWindowScrolled, void* );
426 DECL_LINK( MRUChanged, void* );
428 public:
429 ImplListBox( Window* pParent, WinBits nWinStyle );
430 ~ImplListBox();
432 const ImplEntryList* GetEntryList() const { return maLBWindow.GetEntryList(); }
433 ImplListBoxWindow* GetMainWindow() { return &maLBWindow; }
435 virtual void Resize();
436 virtual const Wallpaper& GetDisplayBackground() const;
437 virtual Window* GetPreferredKeyInputWindow();
439 sal_uInt16 InsertEntry( sal_uInt16 nPos, const XubString& rStr );
440 sal_uInt16 InsertEntry( sal_uInt16 nPos, const Image& rImage );
441 sal_uInt16 InsertEntry( sal_uInt16 nPos, const XubString& rStr, const Image& rImage );
442 void RemoveEntry( sal_uInt16 nPos );
443 void SetEntryData( sal_uInt16 nPos, void* pNewData ) { maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); }
444 void Clear();
446 void SetEntryFlags( sal_uInt16 nPos, long nFlags );
448 void SelectEntry( sal_uInt16 nPos, sal_Bool bSelect );
449 void SetNoSelection();
450 void ResetCurrentPos() { maLBWindow.ResetCurrentPos(); }
451 sal_uInt16 GetCurrentPos() const { return maLBWindow.GetCurrentPos(); }
453 sal_Bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow.ProcessKeyInput( rKEvt ); }
454 sal_Bool HandleWheelAsCursorTravel( const CommandEvent& rCEvt );
456 void SetSeparatorPos( sal_uInt16 n ) { maLBWindow.SetSeparatorPos( n ); }
457 sal_uInt16 GetSeparatorPos() const { return maLBWindow.GetSeparatorPos(); }
459 void SetTopEntry( sal_uInt16 nTop ) { maLBWindow.SetTopEntry( nTop ); }
460 sal_uInt16 GetTopEntry() const { return maLBWindow.GetTopEntry(); }
461 void ShowProminentEntry( sal_uInt16 nPos ) { maLBWindow.ShowProminentEntry( nPos ); }
462 using Window::IsVisible;
463 sal_Bool IsVisible( sal_uInt16 nEntry ) const { return maLBWindow.IsVisible( nEntry ); }
465 void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); }
466 ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); }
468 long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); }
469 void SetLeftIndent( sal_uInt16 n ) { maLBWindow.SetLeftIndent( n ); }
470 void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); }
472 void SetTravelSelect( sal_Bool bTravelSelect ) { maLBWindow.SetTravelSelect( bTravelSelect ); }
473 sal_Bool IsTravelSelect() const { return maLBWindow.IsTravelSelect(); }
474 sal_Bool IsTrackingSelect() const { return maLBWindow.IsTrackingSelect(); }
476 void EnableMultiSelection( sal_Bool bMulti, sal_Bool bStackMode ) { maLBWindow.EnableMultiSelection( bMulti, bStackMode ); }
477 sal_Bool IsMultiSelectionEnabled() const { return maLBWindow.IsMultiSelectionEnabled(); }
479 void SetMultiSelectionSimpleMode( sal_Bool bSimple ) { maLBWindow.SetMultiSelectionSimpleMode( bSimple ); }
480 sal_Bool IsMultiSelectionSimpleMode() const { return maLBWindow.IsMultiSelectionSimpleMode(); }
482 void SetReadOnly( sal_Bool b ) { maLBWindow.SetReadOnly( b ); }
483 sal_Bool IsReadOnly() const { return maLBWindow.IsReadOnly(); }
486 Size CalcSize( sal_uInt16 nMaxLines ) const { return maLBWindow.CalcSize( nMaxLines ); }
487 long GetEntryHeight() const { return maLBWindow.GetEntryHeight(); }
488 long GetMaxEntryWidth() const { return maLBWindow.GetMaxEntryWidth(); }
490 void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; }
491 const Link& GetScrollHdl() const { return maScrollHdl; }
492 void SetSelectHdl( const Link& rLink ) { maLBWindow.SetSelectHdl( rLink ); }
493 const Link& GetSelectHdl() const { return maLBWindow.GetSelectHdl(); }
494 void SetCancelHdl( const Link& rLink ) { maLBWindow.SetCancelHdl( rLink ); }
495 const Link& GetCancelHdl() const { return maLBWindow.GetCancelHdl(); }
496 void SetDoubleClickHdl( const Link& rLink ) { maLBWindow.SetDoubleClickHdl( rLink ); }
497 const Link& GetDoubleClickHdl() const { return maLBWindow.GetDoubleClickHdl(); }
498 void SetUserDrawHdl( const Link& rLink ) { maLBWindow.SetUserDrawHdl( rLink ); }
499 const Link& GetUserDrawHdl() const { return maLBWindow.GetUserDrawHdl(); }
501 void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); }
502 void SetCallSelectionChangedHdl( sal_Bool bCall ) { maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
503 sal_Bool IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); }
504 sal_uInt16 GetSelectModifier() const { return maLBWindow.GetSelectModifier(); }
506 void SetMRUEntries( const rtl::OUString& rEntries, sal_Unicode cSep );
507 rtl::OUString GetMRUEntries( sal_Unicode cSep ) const;
508 void SetMaxMRUCount( sal_uInt16 n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); }
509 sal_uInt16 GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); }
510 sal_uInt16 GetDisplayLineCount() const
511 { return maLBWindow.GetDisplayLineCount(); }
513 // pb: #106948# explicit mirroring for calc
514 inline void EnableMirroring() { maLBWindow.EnableMirroring(); }
515 inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; }
517 virtual void take_properties(Window &rOther);
520 // -----------------------------
521 // - ImplListBoxFloatingWindow -
522 // -----------------------------
524 class ImplListBoxFloatingWindow : public FloatingWindow
526 private:
527 ImplListBox* mpImplLB;
528 Size maPrefSz;
529 sal_uInt16 mnDDLineCount;
530 sal_uInt16 mnPopupModeStartSaveSelection;
531 sal_Bool mbAutoWidth;
533 protected:
534 long PreNotify( NotifyEvent& rNEvt );
536 public:
537 ImplListBoxFloatingWindow( Window* pParent );
539 void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; }
541 void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; }
542 const Size& GetPrefSize() const { return maPrefSz; }
544 void SetAutoWidth( sal_Bool b ) { mbAutoWidth = b; }
545 sal_Bool IsAutoWidth() const { return mbAutoWidth; }
547 Size CalcFloatSize();
548 void StartFloat( sal_Bool bStartTracking );
550 virtual void setPosSizePixel( long nX, long nY,
551 long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL );
552 void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
553 { FloatingWindow::SetPosSizePixel( rNewPos, rNewSize ); }
555 void SetDropDownLineCount( sal_uInt16 n ) { mnDDLineCount = n; }
556 sal_uInt16 GetDropDownLineCount() const { return mnDDLineCount; }
558 sal_uInt16 GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection; }
560 virtual void Resize();
563 // -----------
564 // - ImplWin -
565 // -----------
567 class ImplWin : public Control
569 private:
571 sal_uInt16 mnItemPos; // because of UserDraw I have to know which item I draw
572 XubString maString;
573 Image maImage;
575 Rectangle maFocusRect;
576 Size maUserItemSize;
578 Link maMBDownHdl;
579 Link maUserDrawHdl;
581 sal_Bool mbUserDrawEnabled : 1,
582 mbInUserDraw : 1;
585 void ImplDraw( bool bLayout = false );
586 protected:
587 virtual void FillLayoutData() const;
588 public:
590 ImplWin( Window* pParent, WinBits nWinStyle = 0 );
591 ~ImplWin() {};
593 virtual void MouseButtonDown( const MouseEvent& rMEvt );
594 virtual void Paint( const Rectangle& rRect );
595 virtual void Resize();
596 virtual void GetFocus();
597 virtual void LoseFocus();
598 virtual long PreNotify( NotifyEvent& rNEvt );
600 sal_uInt16 GetItemPos() const { return mnItemPos; }
601 void SetItemPos( sal_uInt16 n ) { mnItemPos = n; }
603 const XubString& GetString() const { return maString; }
604 void SetString( const XubString& rStr ) { maString = rStr; }
606 const Image& GetImage() const { return maImage; }
607 void SetImage( const Image& rImg ) { maImage = rImg; }
609 virtual void MBDown();
610 void SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; }
611 const Link& GetMBDownHdl() const { return maMBDownHdl; }
613 void SetUserDrawHdl( const Link& rLink ) { maUserDrawHdl = rLink; }
614 const Link& GetUserDrawHdl() const { return maUserDrawHdl; }
616 void SetUserItemSize( const Size& rSz ) { maUserItemSize = rSz; }
617 const Size& GetUserItemSize() const { return maUserItemSize; }
619 void EnableUserDraw( sal_Bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
620 sal_Bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
622 void DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDrawTextAtImagePos = sal_False, bool bLayout = false );
623 virtual void take_properties(Window &rOther);
626 // -----------
627 // - ImplBtn -
628 // -----------
630 class ImplBtn : public PushButton
632 private:
633 sal_Bool mbDown;
635 Link maMBDownHdl;
637 public:
638 ImplBtn( Window* pParent, WinBits nWinStyle = 0 );
639 ~ImplBtn() {};
641 virtual void MouseButtonDown( const MouseEvent& rMEvt );
643 virtual void MBDown();
644 void SetMBDownHdl( const Link& rLink ) { maMBDownHdl = rLink; }
645 const Link& GetMBDownHdl() const { return maMBDownHdl; }
649 void ImplInitFieldSettings( Window* pWin, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
650 void ImplInitDropDownButton( PushButton* pButton );
652 #endif // _SV_ILSTBOX_HXX
654 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */