LCOV - code coverage report
Current view: top level - vcl/inc - ilstbox.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 103 132 78.0 %
Date: 2012-08-25 Functions: 94 118 79.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 12 26 46.2 %

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

Generated by: LCOV version 1.10