LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/contnr - imivctl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 59 0.0 %
Date: 2012-12-27 Functions: 0 33 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _IMPICNVW_HXX
      21             : #define _IMPICNVW_HXX
      22             : 
      23             : #include <vcl/virdev.hxx>
      24             : #include <vcl/scrbar.hxx>
      25             : #include <vcl/timer.hxx>
      26             : #include <vcl/seleng.hxx>
      27             : #include <tools/debug.hxx>
      28             : #include "svtaccessiblefactory.hxx"
      29             : 
      30             : #include <limits.h>
      31             : 
      32             : #include <svtools/ivctrl.hxx>
      33             : #include <boost/ptr_container/ptr_map.hpp>
      34             : 
      35             : class IcnCursor_Impl;
      36             : class SvtIconChoiceCtrl;
      37             : class SvxIconChoiceCtrlEntry;
      38             : class IcnViewEdit_Impl;
      39             : class IcnGridMap_Impl;
      40             : 
      41             : ///////////////////////////////////////////////////////////////////////////////
      42             : //
      43             : // some defines
      44             : //
      45             : #define PAINTFLAG_HOR_CENTERED  0x0001
      46             : #define PAINTFLAG_VER_CENTERED  0x0002
      47             : 
      48             : #define F_VER_SBARSIZE_WITH_HBAR        0x0001
      49             : #define F_HOR_SBARSIZE_WITH_VBAR        0x0002
      50             : #define F_PAINTED                       0x0004  // sal_True after first paint
      51             : #define F_ADD_MODE                      0x0008
      52             : #define F_SELECTING_RECT                0x0020
      53             : #define F_DOWN_CTRL                     0x0080
      54             : #define F_DOWN_DESELECT                 0x0100
      55             : #define F_START_EDITTIMER_IN_MOUSEUP    0x0400
      56             : #define F_MOVED_ENTRIES                 0x0800
      57             : #define F_ENTRYLISTPOS_VALID            0x1000
      58             : #define F_CLEARING_SELECTION            0x2000
      59             : #define F_ARRANGING                     0x4000
      60             : 
      61             : // unit = pixels
      62             : // distances from window borders
      63             : #define LROFFS_WINBORDER            4
      64             : #define TBOFFS_WINBORDER            4
      65             : // for the bounding rectangle
      66             : #define LROFFS_BOUND                2
      67             : #define TBOFFS_BOUND                2
      68             : // distance icon to text
      69             : #define HOR_DIST_BMP_STRING         3
      70             : #define VER_DIST_BMP_STRING         3
      71             : //  width offset of highlight rectangle for Text
      72             : #define LROFFS_TEXT                 2
      73             : 
      74             : #define DEFAULT_MAX_VIRT_WIDTH      200
      75             : #define DEFAULT_MAX_VIRT_HEIGHT     200
      76             : 
      77             : #define VIEWMODE_MASK   (WB_ICON | WB_SMALLICON | WB_DETAILS)
      78             : 
      79             : ///////////////////////////////////////////////////////////////////////////////
      80             : //
      81             : //
      82             : //
      83             : enum IcnViewFieldType
      84             : {
      85             :     IcnViewFieldTypeDontknow = 0,
      86             :     IcnViewFieldTypeImage = 1,
      87             :     IcnViewFieldTypeText = 2
      88             : };
      89             : 
      90             : ///////////////////////////////////////////////////////////////////////////////
      91             : //
      92             : // Data about the focus of entries
      93             : //
      94             : struct LocalFocus
      95             : {
      96             :     sal_Bool    bOn;
      97             :     Rectangle   aRect;
      98             :     Color       aPenColor;
      99             : 
     100           0 :     LocalFocus() { bOn = sal_False; }
     101             : };
     102             : 
     103             : ///////////////////////////////////////////////////////////////////////////////
     104             : //
     105             : // Entry-List
     106             : //
     107             : typedef ::std::vector< SvxIconChoiceCtrlEntry* > SvxIconChoiceCtrlEntryList_impl;
     108             : 
     109             : class EntryList_Impl
     110             : {
     111             : private:
     112             :     SvxIconChoiceCtrlEntryList_impl maIconChoiceCtrlEntryList;
     113             :     SvxIconChoiceCtrl_Impl*         _pOwner;
     114             : 
     115             : public:
     116             :                             EntryList_Impl( SvxIconChoiceCtrl_Impl* );
     117             :                             ~EntryList_Impl();
     118             : 
     119             :     void                    clear();
     120             : 
     121           0 :     size_t                  size()
     122             :                             {
     123           0 :                                 return maIconChoiceCtrlEntryList.size();
     124             :                             }
     125           0 :     size_t                  size() const
     126             :                             {
     127           0 :                                 return maIconChoiceCtrlEntryList.size();
     128             :                             }
     129             : 
     130           0 :     SvxIconChoiceCtrlEntry* operator[]( size_t nPos )
     131             :                             {
     132           0 :                                 return  ( nPos < maIconChoiceCtrlEntryList.size() )
     133           0 :                                         ? maIconChoiceCtrlEntryList[ nPos ]
     134           0 :                                         : NULL;
     135             :                             }
     136           0 :     SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) const
     137             :                             {
     138           0 :                                 return  ( nPos < maIconChoiceCtrlEntryList.size() )
     139           0 :                                         ? maIconChoiceCtrlEntryList[ nPos ]
     140           0 :                                         : NULL;
     141             :                             }
     142             :     void                    insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry );
     143             : };
     144             : 
     145             : 
     146             : ///////////////////////////////////////////////////////////////////////////////
     147             : //
     148             : // Implementation-class of IconChoiceCtrl
     149             : //
     150             : 
     151             : typedef boost::ptr_map<sal_uInt16, SvxIconChoiceCtrlColumnInfo> SvxIconChoiceCtrlColumnInfoMap;
     152             : typedef std::vector<SvxIconChoiceCtrlEntry*> SvxIconChoiceCtrlEntryPtrVec;
     153             : 
     154             : class SvxIconChoiceCtrl_Impl
     155             : {
     156             :     friend class IcnCursor_Impl;
     157             :     friend class EntryList_Impl;
     158             :     friend class IcnGridMap_Impl;
     159             : 
     160             :     sal_Bool                bChooseWithCursor;
     161             :     EntryList_Impl          aEntries;
     162             :     ScrollBar               aVerSBar;
     163             :     ScrollBar               aHorSBar;
     164             :     ScrollBarBox            aScrBarBox;
     165             :     Rectangle               aCurSelectionRect;
     166             :     std::vector<Rectangle*> aSelectedRectList;
     167             :     Timer                   aEditTimer;                 // for editing in place
     168             :     Timer                   aAutoArrangeTimer;
     169             :     Timer                   aDocRectChangedTimer;
     170             :     Timer                   aVisRectChangedTimer;
     171             :     Timer                   aCallSelectHdlTimer;
     172             :     Size                    aVirtOutputSize;
     173             :     Size                    aImageSize;
     174             :     Size                    aDefaultTextSize;
     175             :     Size                    aOutputSize; // Pixel
     176             :     Point                   aDDLastEntryPos;
     177             :     Point                   aDDLastRectPos;
     178             :     Point                   aDDPaintOffs;
     179             :     Point                   aDDStartPos;
     180             :     SvtIconChoiceCtrl*      pView;
     181             :     IcnCursor_Impl*         pImpCursor;
     182             :     IcnGridMap_Impl*        pGridMap;
     183             :     long                    nMaxVirtWidth;  // max. width aVirtOutputSize for ALIGN_TOP
     184             :     long                    nMaxVirtHeight; // max. height aVirtOutputSize for ALIGN_LEFT
     185             :     SvxIconChoiceCtrlEntryList_impl*    pZOrderList;
     186             :     SvxIconChoiceCtrlColumnInfoMap* pColumns;
     187             :     IcnViewEdit_Impl*       pEdit;
     188             :     WinBits                 nWinBits;
     189             :     long                    nMaxBoundHeight;            // height of highest BoundRects
     190             :     sal_uInt16              nFlags;
     191             :     sal_uInt16              nCurTextDrawFlags;
     192             :     sal_uLong               nUserEventAdjustScrBars;
     193             :     sal_uLong               nUserEventShowCursor;
     194             :     SvxIconChoiceCtrlEntry* pCurHighlightFrame;
     195             :     sal_Bool                bHighlightFramePressed;
     196             :     SvxIconChoiceCtrlEntry* pHead;                      // top left entry
     197             :     SvxIconChoiceCtrlEntry* pCursor;
     198             :     SvxIconChoiceCtrlEntry* pPrevDropTarget;
     199             :     SvxIconChoiceCtrlEntry* pHdlEntry;
     200             :     SvxIconChoiceCtrlEntry* pDDRefEntry;
     201             :     VirtualDevice*          pDDDev;
     202             :     VirtualDevice*          pDDBufDev;
     203             :     VirtualDevice*          pDDTempDev;
     204             :     VirtualDevice*          pEntryPaintDev;
     205             :     SvxIconChoiceCtrlEntry* pAnchor;                    // for selection
     206             :     LocalFocus              aFocus;                             // Data for focusrect
     207             :     ::svt::AccessibleFactoryAccess aAccFactory;
     208             : 
     209             :     SvxIconChoiceCtrlEntry* pCurEditedEntry;
     210             :     SvxIconChoiceCtrlTextMode eTextMode;
     211             :     SelectionMode           eSelectionMode;
     212             :     sal_uLong               nSelectionCount;
     213             :     SvxIconChoiceCtrlPositionMode ePositionMode;
     214             :     sal_Bool                bBoundRectsDirty;
     215             :     sal_Bool                bUpdateMode;
     216             :     sal_Bool                bEntryEditingEnabled;
     217             : 
     218             :     void                ShowCursor( sal_Bool bShow );
     219             : 
     220             :     void                ImpArrange( sal_Bool bKeepPredecessors = sal_False );
     221             :     void                AdjustVirtSize( const Rectangle& );
     222             :     void                ResetVirtSize();
     223             :     void                CheckScrollBars();
     224             : 
     225             :                         DECL_LINK( ScrollUpDownHdl, ScrollBar * );
     226             :                         DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
     227             :                         DECL_LINK(EditTimeoutHdl, void *);
     228             :                         DECL_LINK( UserEventHdl, void* );
     229             :                         DECL_LINK( EndScrollHdl, void* );
     230             :                         DECL_LINK( AutoArrangeHdl, void* );
     231             :                         DECL_LINK( DocRectChangedHdl, void* );
     232             :                         DECL_LINK( VisRectChangedHdl, void* );
     233             :                         DECL_LINK( CallSelectHdlHdl, void* );
     234             : 
     235             :     void                AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False);
     236             :     void                PositionScrollBars( long nRealWidth, long nRealHeight );
     237           0 :     long                GetScrollBarPageSize( long nVisibleRange ) const
     238             :                         {
     239           0 :                             return ((nVisibleRange*75)/100);
     240             :                         }
     241           0 :     long                GetScrollBarLineSize() const
     242             :                         {
     243           0 :                             return nMaxBoundHeight / 2;
     244             :                         }
     245             :     sal_Bool            HandleScrollCommand( const CommandEvent& rCmd );
     246           0 :     void                ToDocPos( Point& rPosPixel )
     247             :                         {
     248           0 :                             rPosPixel -= pView->GetMapMode().GetOrigin();
     249           0 :                         }
     250             :     void                InitScrollBarBox();
     251             :     void                ToggleSelection( SvxIconChoiceCtrlEntry* );
     252             :     void                DeselectAllBut( SvxIconChoiceCtrlEntry*, sal_Bool bPaintSync=sal_False );
     253             :     void                Center( SvxIconChoiceCtrlEntry* pEntry ) const;
     254           0 :     void                StopEditTimer() { aEditTimer.Stop(); }
     255           0 :     void                StartEditTimer() { aEditTimer.Start(); }
     256             :     void                ImpHideDDIcon();
     257             :     void                CallSelectHandler( SvxIconChoiceCtrlEntry* );
     258             :     void                SelectRect(
     259             :                             SvxIconChoiceCtrlEntry* pEntry1,
     260             :                             SvxIconChoiceCtrlEntry* pEntry2,
     261             :                             sal_Bool bAdd = sal_True,
     262             :                             std::vector<Rectangle*>* pOtherRects = 0
     263             :                         );
     264             : 
     265             :     void                SelectRange(
     266             :                             SvxIconChoiceCtrlEntry* pStart,
     267             :                             SvxIconChoiceCtrlEntry* pEnd,
     268             :                             sal_Bool bAdd = sal_True
     269             :                         );
     270             : 
     271             :     void                AddSelectedRect( const Rectangle& );
     272             :     void                AddSelectedRect(
     273             :                             SvxIconChoiceCtrlEntry* pEntry1,
     274             :                             SvxIconChoiceCtrlEntry* pEntry2
     275             :                         );
     276             : 
     277             :     void                ClearSelectedRectList();
     278             :     void                ClearColumnList();
     279             :     Rectangle           CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const;
     280             : 
     281             :     void                ClipAtVirtOutRect( Rectangle& rRect ) const;
     282             :     void                AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
     283             :     Point               AdjustAtGrid(
     284             :                             const Rectangle& rCenterRect, // balance point of object (typically Bmp-Rect)
     285             :                             const Rectangle& rBoundRect
     286             :                         ) const;
     287             :     sal_uLong           GetPredecessorGrid( const Point& rDocPos) const;
     288             : 
     289             :     void                InitPredecessors();
     290             :     void                ClearPredecessors();
     291             : 
     292             :     sal_Bool            CheckVerScrollBar();
     293             :     sal_Bool            CheckHorScrollBar();
     294             :     void                CancelUserEvents();
     295             :     void                EntrySelected(
     296             :                             SvxIconChoiceCtrlEntry* pEntry,
     297             :                             sal_Bool bSelect,
     298             :                             sal_Bool bSyncPaint
     299             :                         );
     300             :     void                RepaintEntries( sal_uInt16 nEntryFlagsMask );
     301             :     void                SetListPositions();
     302             :     void                SetDefaultTextSize();
     303           0 :     sal_Bool            IsAutoArrange() const
     304             :                         {
     305           0 :                             return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange);
     306             :                         }
     307             :     sal_Bool            IsAutoAdjust() const
     308             :                         {
     309             :                             return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust);
     310             :                         }
     311           0 :     void                DocRectChanged() { aDocRectChangedTimer.Start(); }
     312           0 :     void                VisRectChanged() { aVisRectChangedTimer.Start(); }
     313             :     void                SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False );
     314             : 
     315             :                         DECL_LINK(TextEditEndedHdl, void *);
     316             : 
     317             :     void                ShowFocus ( Rectangle& rRect );
     318             :     void                DrawFocusRect ( OutputDevice* pOut );
     319             : 
     320             :     sal_Bool            IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const;
     321             : 
     322             : public:
     323             : 
     324             :     long                nGridDX;
     325             :     long                nGridDY;
     326             :     long                nHorSBarHeight;
     327             :     long                nVerSBarWidth;
     328             : 
     329             :                         SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
     330             :                         ~SvxIconChoiceCtrl_Impl();
     331             : 
     332           0 :     sal_Bool            SetChoiceWithCursor ( sal_Bool bDo = sal_True ) { sal_Bool bOld=bChooseWithCursor; bChooseWithCursor = bDo; return bOld; }
     333             :     void                Clear( sal_Bool bInCtor = sal_False );
     334             :     void                SetStyle( WinBits nWinStyle );
     335           0 :     WinBits             GetStyle() const { return nWinBits; }
     336             :     void                InsertEntry( SvxIconChoiceCtrlEntry*, size_t nPos, const Point* pPos=0 );
     337             :     void                CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL );
     338             :     void                FontModified();
     339             :     void                SelectAll( sal_Bool bSelect = sal_True, sal_Bool bPaint = sal_True );
     340             :     void                SelectEntry(
     341             :                             SvxIconChoiceCtrlEntry*,
     342             :                             sal_Bool bSelect,
     343             :                             sal_Bool bCallHdl = sal_True,
     344             :                             sal_Bool bAddToSelection = sal_False,
     345             :                             sal_Bool bSyncPaint = sal_False
     346             :                         );
     347             :     void                Paint( const Rectangle& rRect );
     348             :     sal_Bool            MouseButtonDown( const MouseEvent& );
     349             :     sal_Bool            MouseButtonUp( const MouseEvent& );
     350             :     sal_Bool            MouseMove( const MouseEvent&);
     351             :     sal_Bool            RequestHelp( const HelpEvent& rHEvt );
     352             :     void                SetCursor_Impl(
     353             :                             SvxIconChoiceCtrlEntry* pOldCursor,
     354             :                             SvxIconChoiceCtrlEntry* pNewCursor,
     355             :                             sal_Bool bMod1,
     356             :                             sal_Bool bShift,
     357             :                             sal_Bool bPaintSync = sal_False
     358             :                         );
     359             :     sal_Bool            KeyInput( const KeyEvent& );
     360             :     void                Resize();
     361             :     void                GetFocus();
     362             :     void                LoseFocus();
     363             :     void                SetUpdateMode( sal_Bool bUpdate );
     364           0 :     sal_Bool            GetUpdateMode() const { return bUpdateMode; }
     365             :     void                PaintEntry(
     366             :                             SvxIconChoiceCtrlEntry* pEntry,
     367             :                             sal_Bool bIsBackgroundPainted=sal_False
     368             :                         );
     369             :     void                PaintEntry(
     370             :                             SvxIconChoiceCtrlEntry*,
     371             :                             const Point&,
     372             :                             OutputDevice* pOut = 0,
     373             :                             sal_Bool bIsBackgroundPainted = sal_False
     374             :                         );
     375             :     void                PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* );
     376             : 
     377             :     void                SetEntryPos(
     378             :                             SvxIconChoiceCtrlEntry* pEntry,
     379             :                             const Point& rPos,
     380             :                             sal_Bool bAdjustRow = sal_False,
     381             :                             sal_Bool bCheckScrollBars = sal_False,
     382             :                             sal_Bool bKeepGridMap = sal_False
     383             :                         );
     384             : 
     385             :     void                InvalidateEntry( SvxIconChoiceCtrlEntry* );
     386             : 
     387             :     void                SetNoSelection();
     388             : 
     389           0 :     SvxIconChoiceCtrlEntry* GetCurEntry() const { return pCursor; }
     390             :     void                SetCursor(
     391             :                             SvxIconChoiceCtrlEntry*,
     392             :                             // sal_True == carry selection when single-selecting
     393             :                             sal_Bool bSyncSingleSelection = sal_True,
     394             :                             sal_Bool bShowFocusAsync = sal_False
     395             :                         );
     396             : 
     397             :     SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, sal_Bool bHit = sal_False );
     398             : 
     399             :     Point               GetEntryPos( SvxIconChoiceCtrlEntry* );
     400             :     void                MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True );
     401             : 
     402             :     void                Arrange(
     403             :                             sal_Bool bKeepPredecessors = sal_False,
     404             :                             long nSetMaxVirtWidth =0,
     405             :                             long nSetMaxVirtHeight =0
     406             :                         );
     407             : 
     408             :     Rectangle           CalcFocusRect( SvxIconChoiceCtrlEntry* );
     409             :     Rectangle           CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 );
     410             :     Rectangle           CalcTextRect(
     411             :                             SvxIconChoiceCtrlEntry*,
     412             :                             const Point* pPos = 0,
     413             :                             sal_Bool bForInplaceEdit = sal_False,
     414             :                             const String* pStr = 0
     415             :                         );
     416             : 
     417             :     long                CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const;
     418             :     long                CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const;
     419             :     Size                CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const;
     420             :     void                FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry );
     421             :     void                SetBoundingRect_Impl(
     422             :                             SvxIconChoiceCtrlEntry* pEntry,
     423             :                             const Point& rPos,
     424             :                             const Size& rBoundingSize
     425             :                         );
     426             :     // recalculates all invalid BoundRects
     427             :     void                RecalcAllBoundingRectsSmart();
     428             :     const Rectangle&    GetEntryBoundRect( SvxIconChoiceCtrlEntry* );
     429           0 :     void                InvalidateBoundingRect( Rectangle& rRect )
     430             :                         {
     431           0 :                             rRect.Right() = LONG_MAX;
     432           0 :                             bBoundRectsDirty = sal_True;
     433           0 :                         }
     434           0 :     sal_Bool            IsBoundingRectValid( const Rectangle& rRect ) const { return (sal_Bool)( rRect.Right() != LONG_MAX ); }
     435             : 
     436             :     void                PaintEmphasis(
     437             :                             const Rectangle& rRect1,
     438             :                             const Rectangle& rRect2,
     439             :                             sal_Bool bSelected,
     440             :                             sal_Bool bDropTarget,
     441             :                             sal_Bool bCursored,
     442             :                             OutputDevice* pOut,
     443             :                             sal_Bool bIsBackgroundPainted = sal_False
     444             :                         );
     445             : 
     446             :     void                PaintItem(
     447             :                             const Rectangle& rRect,
     448             :                             IcnViewFieldType eItem,
     449             :                             SvxIconChoiceCtrlEntry* pEntry,
     450             :                             sal_uInt16 nPaintFlags,
     451             :                             OutputDevice* pOut,
     452             :                             const String* pStr = 0,
     453             :                             ::vcl::ControlLayoutData* _pLayoutData = NULL
     454             :                         );
     455             : 
     456             :     // recalculates all BoundingRects if bMustRecalcBoundingRects == sal_True
     457           0 :     void                CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); }
     458             :     // recalculates all invalidated BoundingRects
     459             :     void                ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow );
     460             :     void                Command( const CommandEvent& rCEvt );
     461             :     void                ToTop( SvxIconChoiceCtrlEntry* );
     462             : 
     463             :     sal_uLong           GetSelectionCount() const;
     464             :     void                SetGrid( const Size& );
     465             :     Size                GetMinGrid() const;
     466             :     void                Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False );
     467             :     const Size&         GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const;
     468             : 
     469             :     void                HideDDIcon();
     470             : 
     471             :     bool                IsOver(
     472             :                             std::vector<Rectangle*>* pSelectedRectList,
     473             :                             const Rectangle& rEntryBoundRect
     474             :                         ) const;
     475             : 
     476             :     void                SelectRect(
     477             :                             const Rectangle&,
     478             :                             bool bAdd = true,
     479             :                             std::vector<Rectangle*>* pOtherRects = 0
     480             :                         );
     481             : 
     482             :     sal_Bool            IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
     483             :     void                MakeVisible(
     484             :                             const Rectangle& rDocPos,
     485             :                             sal_Bool bInScrollBarEvent=sal_False,
     486             :                             sal_Bool bCallRectChangedHdl = sal_True
     487             :                         );
     488             : 
     489             :     void                AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 );
     490             :     void                SetEntryTextMode(
     491             :                             SvxIconChoiceCtrlTextMode,
     492             :                             SvxIconChoiceCtrlEntry* pEntry = 0
     493             :                         );
     494             :     void                EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; }
     495           0 :     sal_Bool            IsEntryEditingEnabled() const { return bEntryEditingEnabled; }
     496           0 :     sal_Bool            IsEntryEditing() const { return (sal_Bool)(pCurEditedEntry!=0); }
     497             :     void                EditEntry( SvxIconChoiceCtrlEntry* pEntry );
     498             :     void                StopEntryEditing( sal_Bool bCancel );
     499           0 :     size_t              GetEntryCount() const { return aEntries.size(); }
     500           0 :     SvxIconChoiceCtrlEntry* GetEntry( size_t nPos )
     501             :                             {
     502           0 :                                 return aEntries[ nPos ];
     503             :                             }
     504           0 :     SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) const
     505             :                             {
     506           0 :                                 return aEntries[ nPos ];
     507             :                             }
     508             :     SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const;
     509             :     SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; }
     510             :     void                SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; }
     511             : 
     512             :     SvxIconChoiceCtrlTextMode GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const;
     513           0 :     void                SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; }
     514             :     SelectionMode       GetSelectionMode() const { return eSelectionMode; }
     515             :     sal_Bool            AreEntriesMoved() const { return (sal_Bool)((nFlags & F_MOVED_ENTRIES)!=0); }
     516           0 :     void                SetEntriesMoved( sal_Bool bMoved )
     517             :                         {
     518           0 :                             if( bMoved )
     519           0 :                                 nFlags |= F_MOVED_ENTRIES;
     520             :                             else
     521           0 :                                 nFlags &= ~(F_MOVED_ENTRIES);
     522           0 :                         }
     523             :     sal_uLong           GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
     524             :     void                SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; }
     525             :     void                InitSettings();
     526             :     Rectangle           GetOutputRect() const;
     527             : 
     528             :     sal_Bool            ArePredecessorsSet() const { return (sal_Bool)(pHead != 0); }
     529             :     SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; }
     530             :     void                SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor);
     531             :     // only delivers valid results when in AutoArrange mode!
     532             :     SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& );
     533             : 
     534             :     void                SetPositionMode( SvxIconChoiceCtrlPositionMode );
     535             :     SvxIconChoiceCtrlPositionMode GetPositionMode() const { return ePositionMode;}
     536             : 
     537             :     void                SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& );
     538             :     const SvxIconChoiceCtrlColumnInfo* GetColumn( sal_uInt16 nIndex ) const;
     539             : 
     540           0 :     Rectangle           GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); }
     541           0 :     Rectangle           GetVisibleRect() const { return GetOutputRect(); }
     542             : 
     543             :     void                SetEntryHighlightFrame(
     544             :                             SvxIconChoiceCtrlEntry* pEntry,
     545             :                             sal_Bool bKeepHighlightFlags=sal_False
     546             :                         );
     547             :     void                HideEntryHighlightFrame();
     548             :     void                DrawHighlightFrame(
     549             :                             OutputDevice* pOut,
     550             :                             const Rectangle& rBmpRect,
     551             :                             sal_Bool bHide
     552             :                         );
     553             :     void                StopSelectTimer() { aCallSelectHdlTimer.Stop(); }
     554             : 
     555             :     void                CallEventListeners( sal_uLong nEvent, void* pData = NULL );
     556             : 
     557           0 :     inline ::svt::IAccessibleFactory& GetAccessibleFactory()
     558             :                         {
     559           0 :                             return aAccFactory.getFactory();
     560             :                         }
     561             : };
     562             : 
     563             : // ----------------------------------------------------------------------------------------------
     564             : 
     565             : typedef std::map<sal_uInt16, SvxIconChoiceCtrlEntryPtrVec> IconChoiceMap;
     566             : 
     567             : class IcnCursor_Impl
     568             : {
     569             :     SvxIconChoiceCtrl_Impl* pView;
     570             :     boost::scoped_ptr<IconChoiceMap> pColumns;
     571             :     boost::scoped_ptr<IconChoiceMap> pRows;
     572             :     long                    nCols;
     573             :     long                    nRows;
     574             :     short                   nDeltaWidth;
     575             :     short                   nDeltaHeight;
     576             :     SvxIconChoiceCtrlEntry* pCurEntry;
     577             :     void                    SetDeltas();
     578             :     void                    ImplCreate();
     579           0 :     void                    Create() {  if( !pColumns ) ImplCreate(); }
     580             : 
     581             :     sal_uInt16              GetSortListPos(
     582             :                                 SvxIconChoiceCtrlEntryPtrVec& rList,
     583             :                                 long nValue,
     584             :                                 int bVertical);
     585             :     SvxIconChoiceCtrlEntry* SearchCol(
     586             :                                 sal_uInt16 nCol,
     587             :                                 sal_uInt16 nTop,
     588             :                                 sal_uInt16 nBottom,
     589             :                                 sal_uInt16 nPref,
     590             :                                 bool bDown,
     591             :                                 bool bSimple
     592             :                             );
     593             : 
     594             :     SvxIconChoiceCtrlEntry* SearchRow(
     595             :                                 sal_uInt16 nRow,
     596             :                                 sal_uInt16 nRight,
     597             :                                 sal_uInt16 nLeft,
     598             :                                 sal_uInt16 nPref,
     599             :                                 bool bRight,
     600             :                                 bool bSimple
     601             :                             );
     602             : 
     603             : public:
     604             :                             IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner );
     605             :                             ~IcnCursor_Impl();
     606             :     void                    Clear();
     607             : 
     608             :     // for Cursortravelling etc.
     609             :     SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight );
     610             :     SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, sal_Bool bDown );
     611             :     SvxIconChoiceCtrlEntry* GoPageUpDown( SvxIconChoiceCtrlEntry*, sal_Bool bDown );
     612             : 
     613             :     // Creates a list of entries for every row (height = nGridDY) sorted by
     614             :     // BoundRect.Left(). A list may be empty. The lists become the property of
     615             :     // the caller and have to be deleted with DestroyGridAdjustData.
     616             :     void                    CreateGridAjustData( IconChoiceMap& pLists, SvxIconChoiceCtrlEntry* pRow=0);
     617             :     static void             DestroyGridAdjustData( IconChoiceMap& rLists );
     618             : };
     619             : 
     620             : // ----------------------------------------------------------------------------------------------
     621             : 
     622             : typedef sal_uLong GridId;
     623             : 
     624             : #define GRID_NOT_FOUND  ((GridId)ULONG_MAX)
     625             : 
     626             : class IcnGridMap_Impl
     627             : {
     628             :     Rectangle               _aLastOccupiedGrid;
     629             :     SvxIconChoiceCtrl_Impl* _pView;
     630             :     sal_Bool*               _pGridMap;
     631             :     sal_uInt16              _nGridCols, _nGridRows;
     632             : 
     633             :     void                Expand();
     634             :     void                Create_Impl();
     635           0 :     void                Create() { if(!_pGridMap) Create_Impl(); }
     636             : 
     637             :     void                GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const;
     638             : 
     639             : public:
     640             :                         IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView);
     641             :                         ~IcnGridMap_Impl();
     642             : 
     643             :     void                Clear();
     644             : 
     645             :     GridId              GetGrid( const Point& rDocPos, sal_Bool* pbClipped = 0 );
     646             :     GridId              GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY );
     647             :     GridId              GetUnoccupiedGrid( sal_Bool bOccupyFound=sal_True );
     648             : 
     649             :     void                OccupyGrids( const SvxIconChoiceCtrlEntry*, sal_Bool bOccupy = sal_True );
     650           0 :     void                OccupyGrid( GridId nId, sal_Bool bOccupy = sal_True )
     651             :                         {
     652             :                             DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId");
     653           0 :                             if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) )
     654           0 :                                 _pGridMap[ nId ] = bOccupy;
     655           0 :                         }
     656             : 
     657             :     Rectangle           GetGridRect( GridId );
     658             :     void                GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY );
     659             :     static sal_uLong    GetGridCount(
     660             :                             const Size& rSizePixel,
     661             :                             sal_uInt16 nGridWidth,
     662             :                             sal_uInt16 nGridHeight
     663             :                         );
     664             : 
     665             :     void                OutputSizeChanged();
     666             : };
     667             : 
     668             : #endif
     669             : 
     670             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10