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