1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
43 #define IMG_TXT_DISTANCE 6
63 sal_Bool mbIsSelected
;
67 ImplEntryType( const OUString
& rStr
, const Image
& rImage
) :
73 mbIsSelected
= sal_False
;
77 ImplEntryType( const OUString
& rStr
) :
82 mbIsSelected
= sal_False
;
86 ImplEntryType( const Image
& rImage
) :
91 mbIsSelected
= sal_False
;
103 Window
* mpWindow
; // For getting the current locale when matching strings
104 sal_uInt16 mnLastSelected
;
105 sal_uInt16 mnSelectionAnchor
;
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())
119 return const_cast<ImplEntryType
*>(&maEntries
[nPos
]);
123 ImplEntryList( Window
* pWindow
);
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
); }
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 OUString
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 OUString
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 );
192 // ---------------------
193 // - ImplListBoxWindow -
194 // ---------------------
196 class ImplListBoxWindow
: public Control
, public ::vcl::ISearchableStringList
199 ImplEntryList
* mpEntryList
; // EntryList
200 Rectangle maFocusRect
;
204 long mnMaxTxtHeight
; // Maximum height of a text item
205 long mnMaxTxtWidth
; // Maximum width of a text item
206 // Entry without Image
207 long mnMaxImgTxtWidth
;// Maximum width of a text item
209 long mnMaxImgWidth
; // Maximum width of an image item
210 long mnMaxImgHeight
; // Maximum height of an image item
211 long mnMaxWidth
; // Maximum width of an entry
212 long mnMaxHeight
; // Maximum height of an entry
214 sal_uInt16 mnCurrentPos
; // Position (Focus)
215 sal_uInt16 mnTrackingSaveSelection
; // Selection before Tracking();
217 sal_uInt16 mnSeparatorPos
; // Separator
219 sal_uInt16 mnUserDrawEntry
;
221 sal_uInt16 mnTop
; // output from line on
222 long mnLeft
; // output from column on
223 long mnBorder
; // distance border - text
224 long mnTextHeight
; // text height
225 ProminentEntry meProminentType
; // where is the "prominent" entry
227 sal_uInt16 mnSelectModifier
; // Modifiers
230 bool mbHasFocusRect
: 1;
231 bool mbSort
: 1; // ListBox sorted
232 bool mbTrack
: 1; // Tracking
233 bool mbMulti
: 1; // MultiListBox
234 bool mbStackMode
: 1; // StackSelection
235 bool mbSimpleMode
: 1; // SimpleMode for MultiListBox
236 bool mbImgsDiffSz
: 1; // Images have different sizes
237 bool mbTravelSelect
: 1; // TravelSelect
238 bool mbTrackingSelect
: 1; // Selected at a MouseMove
239 bool mbSelectionChanged
: 1; // Do not call Select() too often ...
240 bool mbMouseMoveSelect
: 1; // Select at MouseMove
241 bool mbGrabFocus
: 1; // Grab focus at MBDown
242 bool mbUserDrawEnabled
: 1; // UserDraw possible
243 bool mbInUserDraw
: 1; // In UserDraw
244 bool mbReadOnly
: 1; // ReadOnly
245 bool mbMirroring
: 1; // pb: #106948# explicit mirroring for calc
246 bool mbRight
: 1; // right align Text output
247 bool mbCenter
: 1; // center Text output
248 bool mbEdgeBlending
: 1;
253 Link maDoubleClickHdl
;
255 Link maMRUChangedHdl
;
257 ::vcl::QuickSelectionEngine maQuickSelectionEngine
;
260 virtual void KeyInput( const KeyEvent
& rKEvt
);
261 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
262 virtual void MouseMove( const MouseEvent
& rMEvt
);
263 virtual void Tracking( const TrackingEvent
& rTEvt
);
264 virtual void Paint( const Rectangle
& rRect
);
265 virtual void Resize();
266 virtual void GetFocus();
267 virtual void LoseFocus();
269 sal_Bool
SelectEntries( sal_uInt16 nSelect
, LB_EVENT_TYPE eLET
, sal_Bool bShift
= sal_False
, sal_Bool bCtrl
= sal_False
);
270 void ImplPaint( sal_uInt16 nPos
, sal_Bool bErase
= sal_False
, bool bLayout
= false );
271 void ImplDoPaint( const Rectangle
& rRect
, bool bLayout
= false );
272 void ImplCalcMetrics();
273 void ImplUpdateEntryMetrics( ImplEntryType
& rEntry
);
274 void ImplCallSelect();
276 void ImplShowFocusRect();
277 void ImplHideFocusRect();
280 virtual void StateChanged( StateChangedType nType
);
281 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
284 virtual void FillLayoutData() const;
286 ImplListBoxWindow( Window
* pParent
, WinBits nWinStyle
);
287 ~ImplListBoxWindow();
289 ImplEntryList
* GetEntryList() const { return mpEntryList
; }
291 sal_uInt16
InsertEntry( sal_uInt16 nPos
, ImplEntryType
* pNewEntry
);
292 void RemoveEntry( sal_uInt16 nPos
);
294 void ResetCurrentPos() { mnCurrentPos
= LISTBOX_ENTRY_NOTFOUND
; }
295 sal_uInt16
GetCurrentPos() const { return mnCurrentPos
; }
296 sal_uInt16
GetDisplayLineCount() const;
297 void SetEntryFlags( sal_uInt16 nPos
, long nFlags
);
299 void DrawEntry( sal_uInt16 nPos
, sal_Bool bDrawImage
, sal_Bool bDrawText
, sal_Bool bDrawTextAtImagePos
= sal_False
, bool bLayout
= false );
301 void SelectEntry( sal_uInt16 nPos
, sal_Bool bSelect
);
303 sal_uInt16
GetEntryPosForPoint( const Point
& rPoint
) const;
304 sal_uInt16
GetLastVisibleEntry() const;
306 sal_Bool
ProcessKeyInput( const KeyEvent
& rKEvt
);
308 void SetTopEntry( sal_uInt16 nTop
);
309 sal_uInt16
GetTopEntry() const { return mnTop
; }
310 // ShowProminentEntry will set the entry correspoding to nEntryPos
311 // either at top or in the middle depending on the chosen style
312 void ShowProminentEntry( sal_uInt16 nEntryPos
);
313 void SetProminentEntryType( ProminentEntry eType
) { meProminentType
= eType
; }
314 ProminentEntry
GetProminentEntryType() const { return meProminentType
; }
315 using Window::IsVisible
;
316 sal_Bool
IsVisible( sal_uInt16 nEntry
) const;
318 long GetLeftIndent() const { return mnLeft
; }
319 void SetLeftIndent( long n
);
320 void ScrollHorz( long nDiff
);
322 void AllowGrabFocus( bool b
) { mbGrabFocus
= b
; }
323 bool IsGrabFocusAllowed() const { return mbGrabFocus
; }
325 void SetSeparatorPos( sal_uInt16 n
) { mnSeparatorPos
= n
; }
326 sal_uInt16
GetSeparatorPos() const { return mnSeparatorPos
; }
328 void SetTravelSelect( bool bTravelSelect
) { mbTravelSelect
= bTravelSelect
; }
329 bool IsTravelSelect() const { return mbTravelSelect
; }
330 bool IsTrackingSelect() const { return mbTrackingSelect
; }
332 void SetUserItemSize( const Size
& rSz
);
333 const Size
& GetUserItemSize() const { return maUserItemSize
; }
335 void EnableUserDraw( bool bUserDraw
) { mbUserDrawEnabled
= bUserDraw
; }
336 bool IsUserDrawEnabled() const { return mbUserDrawEnabled
; }
338 void EnableMultiSelection( bool bMulti
, bool bStackMode
) { mbMulti
= bMulti
; mbStackMode
= bStackMode
; }
339 bool IsMultiSelectionEnabled() const { return mbMulti
; }
341 void SetMultiSelectionSimpleMode( bool bSimple
) { mbSimpleMode
= bSimple
; }
342 bool IsMultiSelectionSimpleMode() const { return mbSimpleMode
; }
344 void EnableMouseMoveSelect( bool bMouseMoveSelect
) { mbMouseMoveSelect
= bMouseMoveSelect
; }
345 bool IsMouseMoveSelectEnabled() const { return mbMouseMoveSelect
; }
346 bool IsMouseMoveSelect() const { return mbMouseMoveSelect
||mbStackMode
; }
348 Size
CalcSize( sal_uInt16 nMaxLines
) const;
349 Rectangle
GetBoundingRectangle( sal_uInt16 nItem
) const;
351 long GetEntryHeight() const { return mnMaxHeight
; }
352 long GetMaxEntryWidth() const { return mnMaxWidth
; }
354 void SetScrollHdl( const Link
& rLink
) { maScrollHdl
= rLink
; }
355 const Link
& GetScrollHdl() const { return maScrollHdl
; }
356 void SetSelectHdl( const Link
& rLink
) { maSelectHdl
= rLink
; }
357 const Link
& GetSelectHdl() const { return maSelectHdl
; }
358 void SetCancelHdl( const Link
& rLink
) { maCancelHdl
= rLink
; }
359 const Link
& GetCancelHdl() const { return maCancelHdl
; }
360 void SetDoubleClickHdl( const Link
& rLink
) { maDoubleClickHdl
= rLink
; }
361 const Link
& GetDoubleClickHdl() const { return maDoubleClickHdl
; }
362 void SetUserDrawHdl( const Link
& rLink
) { maUserDrawHdl
= rLink
; }
363 const Link
& GetUserDrawHdl() const { return maUserDrawHdl
; }
364 void SetMRUChangedHdl( const Link
& rLink
) { maMRUChangedHdl
= rLink
; }
365 const Link
& GetMRUChangedHdl() const { return maMRUChangedHdl
; }
367 bool IsSelectionChanged() const { return mbSelectionChanged
; }
368 sal_uInt16
GetSelectModifier() const { return mnSelectModifier
; }
370 void EnableSort( bool b
) { mbSort
= b
; }
372 void SetReadOnly( bool bReadOnly
) { mbReadOnly
= bReadOnly
; }
373 bool IsReadOnly() const { return mbReadOnly
; }
375 using Control::ImplInitSettings
;
376 void ImplInitSettings( sal_Bool bFont
, sal_Bool bForeground
, sal_Bool bBackground
);
377 sal_uInt16
ImplGetTextStyle() const;
379 // pb: #106948# explicit mirroring for calc
380 inline void EnableMirroring() { mbMirroring
= true; }
381 inline bool IsMirroring() const { return mbMirroring
; }
383 bool GetEdgeBlending() const { return mbEdgeBlending
; }
384 void SetEdgeBlending(bool bNew
) { mbEdgeBlending
= bNew
; }
387 // ISearchableStringList
388 virtual ::vcl::StringEntryIdentifier
CurrentEntry( String
& _out_entryText
) const;
389 virtual ::vcl::StringEntryIdentifier
NextEntry( ::vcl::StringEntryIdentifier _currentEntry
, String
& _out_entryText
) const;
390 virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry
);
397 class ImplListBox
: public Control
400 ImplListBoxWindow maLBWindow
;
401 ScrollBar
* mpHScrollBar
;
402 ScrollBar
* mpVScrollBar
;
403 ScrollBarBox
* mpScrollBarBox
;
406 bool mbVScroll
: 1; // VScroll an oder aus
407 bool mbHScroll
: 1; // HScroll an oder aus
408 bool mbAutoHScroll
: 1; // AutoHScroll an oder aus
409 bool mbEdgeBlending
: 1;
411 Link maScrollHdl
; // Weil der vom ImplListBoxWindow selbst benoetigt wird.
412 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxDNDListenerContainer
;
415 virtual void GetFocus();
416 virtual void StateChanged( StateChangedType nType
);
417 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
419 long Notify( NotifyEvent
& rNEvt
);
421 void ImplResizeControls();
422 void ImplCheckScrollBars();
423 void ImplInitScrollBars();
425 DECL_LINK( ScrollBarHdl
, ScrollBar
* );
426 DECL_LINK( LBWindowScrolled
, void* );
427 DECL_LINK( MRUChanged
, void* );
430 ImplListBox( Window
* pParent
, WinBits nWinStyle
);
433 const ImplEntryList
* GetEntryList() const { return maLBWindow
.GetEntryList(); }
434 ImplListBoxWindow
* GetMainWindow() { return &maLBWindow
; }
436 virtual void Resize();
437 virtual const Wallpaper
& GetDisplayBackground() const;
438 virtual Window
* GetPreferredKeyInputWindow();
440 sal_uInt16
InsertEntry( sal_uInt16 nPos
, const OUString
& rStr
);
441 sal_uInt16
InsertEntry( sal_uInt16 nPos
, const Image
& rImage
);
442 sal_uInt16
InsertEntry( sal_uInt16 nPos
, const OUString
& rStr
, const Image
& rImage
);
443 void RemoveEntry( sal_uInt16 nPos
);
444 void SetEntryData( sal_uInt16 nPos
, void* pNewData
) { maLBWindow
.GetEntryList()->SetEntryData( nPos
, pNewData
); }
447 void SetEntryFlags( sal_uInt16 nPos
, long nFlags
);
449 void SelectEntry( sal_uInt16 nPos
, sal_Bool bSelect
);
450 void SetNoSelection();
451 void ResetCurrentPos() { maLBWindow
.ResetCurrentPos(); }
452 sal_uInt16
GetCurrentPos() const { return maLBWindow
.GetCurrentPos(); }
454 sal_Bool
ProcessKeyInput( const KeyEvent
& rKEvt
) { return maLBWindow
.ProcessKeyInput( rKEvt
); }
455 sal_Bool
HandleWheelAsCursorTravel( const CommandEvent
& rCEvt
);
457 void SetSeparatorPos( sal_uInt16 n
) { maLBWindow
.SetSeparatorPos( n
); }
458 sal_uInt16
GetSeparatorPos() const { return maLBWindow
.GetSeparatorPos(); }
460 void SetTopEntry( sal_uInt16 nTop
) { maLBWindow
.SetTopEntry( nTop
); }
461 sal_uInt16
GetTopEntry() const { return maLBWindow
.GetTopEntry(); }
462 void ShowProminentEntry( sal_uInt16 nPos
) { maLBWindow
.ShowProminentEntry( nPos
); }
463 using Window::IsVisible
;
464 sal_Bool
IsVisible( sal_uInt16 nEntry
) const { return maLBWindow
.IsVisible( nEntry
); }
466 void SetProminentEntryType( ProminentEntry eType
) { maLBWindow
.SetProminentEntryType( eType
); }
467 ProminentEntry
GetProminentEntryType() const { return maLBWindow
.GetProminentEntryType(); }
469 long GetLeftIndent() const { return maLBWindow
.GetLeftIndent(); }
470 void SetLeftIndent( sal_uInt16 n
) { maLBWindow
.SetLeftIndent( n
); }
471 void ScrollHorz( short nDiff
) { maLBWindow
.ScrollHorz( nDiff
); }
473 void SetTravelSelect( sal_Bool bTravelSelect
) { maLBWindow
.SetTravelSelect( bTravelSelect
); }
474 sal_Bool
IsTravelSelect() const { return maLBWindow
.IsTravelSelect(); }
475 sal_Bool
IsTrackingSelect() const { return maLBWindow
.IsTrackingSelect(); }
477 void EnableMultiSelection( sal_Bool bMulti
, sal_Bool bStackMode
) { maLBWindow
.EnableMultiSelection( bMulti
, bStackMode
); }
478 sal_Bool
IsMultiSelectionEnabled() const { return maLBWindow
.IsMultiSelectionEnabled(); }
480 void SetMultiSelectionSimpleMode( sal_Bool bSimple
) { maLBWindow
.SetMultiSelectionSimpleMode( bSimple
); }
481 sal_Bool
IsMultiSelectionSimpleMode() const { return maLBWindow
.IsMultiSelectionSimpleMode(); }
483 void SetReadOnly( sal_Bool b
) { maLBWindow
.SetReadOnly( b
); }
484 sal_Bool
IsReadOnly() const { return maLBWindow
.IsReadOnly(); }
487 Size
CalcSize( sal_uInt16 nMaxLines
) const { return maLBWindow
.CalcSize( nMaxLines
); }
488 long GetEntryHeight() const { return maLBWindow
.GetEntryHeight(); }
489 long GetMaxEntryWidth() const { return maLBWindow
.GetMaxEntryWidth(); }
491 void SetScrollHdl( const Link
& rLink
) { maScrollHdl
= rLink
; }
492 const Link
& GetScrollHdl() const { return maScrollHdl
; }
493 void SetSelectHdl( const Link
& rLink
) { maLBWindow
.SetSelectHdl( rLink
); }
494 const Link
& GetSelectHdl() const { return maLBWindow
.GetSelectHdl(); }
495 void SetCancelHdl( const Link
& rLink
) { maLBWindow
.SetCancelHdl( rLink
); }
496 const Link
& GetCancelHdl() const { return maLBWindow
.GetCancelHdl(); }
497 void SetDoubleClickHdl( const Link
& rLink
) { maLBWindow
.SetDoubleClickHdl( rLink
); }
498 const Link
& GetDoubleClickHdl() const { return maLBWindow
.GetDoubleClickHdl(); }
499 void SetUserDrawHdl( const Link
& rLink
) { maLBWindow
.SetUserDrawHdl( rLink
); }
500 const Link
& GetUserDrawHdl() const { return maLBWindow
.GetUserDrawHdl(); }
502 void SetSelectionChangedHdl( const Link
& rLnk
) { maLBWindow
.GetEntryList()->SetSelectionChangedHdl( rLnk
); }
503 void SetCallSelectionChangedHdl( sal_Bool bCall
) { maLBWindow
.GetEntryList()->SetCallSelectionChangedHdl( bCall
); }
504 sal_Bool
IsSelectionChanged() const { return maLBWindow
.IsSelectionChanged(); }
505 sal_uInt16
GetSelectModifier() const { return maLBWindow
.GetSelectModifier(); }
507 void SetMRUEntries( const OUString
& rEntries
, sal_Unicode cSep
);
508 OUString
GetMRUEntries( sal_Unicode cSep
) const;
509 void SetMaxMRUCount( sal_uInt16 n
) { maLBWindow
.GetEntryList()->SetMaxMRUCount( n
); }
510 sal_uInt16
GetMaxMRUCount() const { return maLBWindow
.GetEntryList()->GetMaxMRUCount(); }
511 sal_uInt16
GetDisplayLineCount() const
512 { return maLBWindow
.GetDisplayLineCount(); }
514 bool GetEdgeBlending() const { return mbEdgeBlending
; }
515 void SetEdgeBlending(bool bNew
);
517 // pb: #106948# explicit mirroring for calc
518 inline void EnableMirroring() { maLBWindow
.EnableMirroring(); }
519 inline void SetDropTraget(const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& i_xDNDListenerContainer
){ mxDNDListenerContainer
= i_xDNDListenerContainer
; }
522 // -----------------------------
523 // - ImplListBoxFloatingWindow -
524 // -----------------------------
526 class ImplListBoxFloatingWindow
: public FloatingWindow
529 ImplListBox
* mpImplLB
;
531 sal_uInt16 mnDDLineCount
;
532 sal_uInt16 mnPopupModeStartSaveSelection
;
533 sal_Bool mbAutoWidth
;
536 long PreNotify( NotifyEvent
& rNEvt
);
539 ImplListBoxFloatingWindow( Window
* pParent
);
541 void SetImplListBox( ImplListBox
* pLB
) { mpImplLB
= pLB
; }
543 void SetPrefSize( const Size
& rSz
) { maPrefSz
= rSz
; }
544 const Size
& GetPrefSize() const { return maPrefSz
; }
546 void SetAutoWidth( sal_Bool b
) { mbAutoWidth
= b
; }
547 sal_Bool
IsAutoWidth() const { return mbAutoWidth
; }
549 Size
CalcFloatSize();
550 void StartFloat( sal_Bool bStartTracking
);
552 virtual void setPosSizePixel( long nX
, long nY
,
553 long nWidth
, long nHeight
, sal_uInt16 nFlags
= WINDOW_POSSIZE_ALL
);
554 void SetPosSizePixel( const Point
& rNewPos
, const Size
& rNewSize
)
555 { FloatingWindow::SetPosSizePixel( rNewPos
, rNewSize
); }
557 void SetDropDownLineCount( sal_uInt16 n
) { mnDDLineCount
= n
; }
558 sal_uInt16
GetDropDownLineCount() const { return mnDDLineCount
; }
560 sal_uInt16
GetPopupModeStartSaveSelection() const { return mnPopupModeStartSaveSelection
; }
562 virtual void Resize();
569 class ImplWin
: public Control
573 sal_uInt16 mnItemPos
; // because of UserDraw I have to know which item I draw
577 Rectangle maFocusRect
;
584 bool mbUserDrawEnabled
: 1;
585 bool mbInUserDraw
: 1;
586 bool mbEdgeBlending
: 1;
588 void ImplDraw( bool bLayout
= false );
590 virtual void FillLayoutData() const;
593 ImplWin( Window
* pParent
, WinBits nWinStyle
= 0 );
596 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
597 virtual void Paint( const Rectangle
& rRect
);
598 virtual void Resize();
599 virtual void GetFocus();
600 virtual void LoseFocus();
601 virtual long PreNotify( NotifyEvent
& rNEvt
);
603 sal_uInt16
GetItemPos() const { return mnItemPos
; }
604 void SetItemPos( sal_uInt16 n
) { mnItemPos
= n
; }
606 const OUString
& GetString() const { return maString
; }
607 void SetString( const OUString
& rStr
) { maString
= rStr
; }
609 const Image
& GetImage() const { return maImage
; }
610 void SetImage( const Image
& rImg
) { maImage
= rImg
; }
612 virtual void MBDown();
613 void SetMBDownHdl( const Link
& rLink
) { maMBDownHdl
= rLink
; }
614 const Link
& GetMBDownHdl() const { return maMBDownHdl
; }
616 void SetUserDrawHdl( const Link
& rLink
) { maUserDrawHdl
= rLink
; }
617 const Link
& GetUserDrawHdl() const { return maUserDrawHdl
; }
619 void SetUserItemSize( const Size
& rSz
) { maUserItemSize
= rSz
; }
620 const Size
& GetUserItemSize() const { return maUserItemSize
; }
622 void EnableUserDraw( bool bUserDraw
) { mbUserDrawEnabled
= bUserDraw
; }
623 bool IsUserDrawEnabled() const { return mbUserDrawEnabled
; }
625 void DrawEntry( sal_Bool bDrawImage
, sal_Bool bDrawText
, sal_Bool bDrawTextAtImagePos
= sal_False
, bool bLayout
= false );
627 bool GetEdgeBlending() const { return mbEdgeBlending
; }
628 void SetEdgeBlending(bool bNew
) { mbEdgeBlending
= bNew
; }
635 class ImplBtn
: public PushButton
643 ImplBtn( Window
* pParent
, WinBits nWinStyle
= 0 );
646 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
648 virtual void MBDown();
649 void SetMBDownHdl( const Link
& rLink
) { maMBDownHdl
= rLink
; }
650 const Link
& GetMBDownHdl() const { return maMBDownHdl
; }
654 void ImplInitFieldSettings( Window
* pWin
, sal_Bool bFont
, sal_Bool bForeground
, sal_Bool bBackground
);
655 void ImplInitDropDownButton( PushButton
* pButton
);
657 #endif // _SV_ILSTBOX_HXX
659 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */