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

Generated by: LCOV version 1.11