LCOV - code coverage report
Current view: top level - libreoffice/vcl/inc - ilstbox.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 132 0.0 %
Date: 2012-12-27 Functions: 0 118 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10