LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/vcl - toolbox.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 28 49 57.1 %
Date: 2013-07-09 Functions: 22 35 62.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _SV_TOOLBOX_HXX
      21             : #define _SV_TOOLBOX_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <rsc/rsc-vcl-shared-types.hxx>
      25             : #include <vcl/dllapi.h>
      26             : #include <vcl/dockwin.hxx>
      27             : #include <vcl/image.hxx>
      28             : #include <vcl/timer.hxx>
      29             : #include <vector>
      30             : 
      31             : #include <com/sun/star/frame/XFrame.hpp>
      32             : 
      33             : class UserDrawEvent;
      34             : 
      35             : struct ImplToolItem;
      36             : struct ImplToolSize;
      37             : struct ImplToolBoxPrivateData;
      38             : class  ImplTrackRect;
      39             : class  PopupMenu;
      40             : 
      41             : namespace vcl
      42             : {
      43             :     class IImageListProvider;
      44             : }
      45             : 
      46             : // -------------------------
      47             : // - ToolBoxCustomizeEvent -
      48             : // -------------------------
      49             : 
      50             : #define TOOLBOX_CUSTOMIZE_RESIZE        ((sal_uInt16)0xFFFE)
      51             : 
      52             : class VCL_DLLPUBLIC ToolBoxCustomizeEvent
      53             : {
      54             : private:
      55             :     ToolBox*    mpTargetBox;
      56             :     void*       mpData;
      57             :     sal_uInt16      mnIdFrom;
      58             :     sal_uInt16      mnPosTo;
      59             : 
      60             : public:
      61             :                 ToolBoxCustomizeEvent();
      62             :                 ToolBoxCustomizeEvent( ToolBox* pDropBox,
      63             :                                        sal_uInt16 nId, sal_uInt16 nPos = 0,
      64             :                                        void* pUserData = NULL );
      65             : 
      66             :     ToolBox*    GetTargetBox() const { return mpTargetBox; }
      67             :     sal_uInt16      GetTargetPos() const { return mnPosTo; }
      68             :     sal_uInt16      GetSourceId() const { return mnIdFrom; }
      69             :     void*       GetData() const { return mpData; }
      70             :     sal_Bool        IsResized() const;
      71             : };
      72             : 
      73             : inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent()
      74             : {
      75             :     mpTargetBox = NULL;
      76             :     mnIdFrom    = 0;
      77             :     mnPosTo     = 0;
      78             :     mpData      = NULL;
      79             : }
      80             : 
      81           0 : inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent( ToolBox* pDropBox,
      82             :                                                      sal_uInt16 nId, sal_uInt16 nPos,
      83             :                                                      void* pUserData )
      84             : {
      85           0 :     mpTargetBox = pDropBox;
      86           0 :     mnIdFrom    = nId;
      87           0 :     mnPosTo     = nPos;
      88           0 :     mpData      = pUserData;
      89           0 : }
      90             : 
      91             : inline sal_Bool ToolBoxCustomizeEvent::IsResized() const
      92             : {
      93             :     if ( mnPosTo == TOOLBOX_CUSTOMIZE_RESIZE )
      94             :         return sal_True;
      95             :     else
      96             :         return sal_False;
      97             : }
      98             : 
      99             : // -----------------
     100             : // - ToolBox-Types -
     101             : // -----------------
     102             : 
     103             : #define TOOLBOX_STYLE_FLAT          ((sal_uInt16)0x0004)
     104             : 
     105             : #define TOOLBOX_APPEND              ((sal_uInt16)0xFFFF)
     106             : #define TOOLBOX_ITEM_NOTFOUND       ((sal_uInt16)0xFFFF)
     107             : 
     108             : // item ids in the custom menu may not exceed this constant
     109             : #define TOOLBOX_MENUITEM_START      ((sal_uInt16)0xE000)
     110             : 
     111             : // defines for the menubutton
     112             : #define TOOLBOX_MENUTYPE_NONE           ((sal_uInt16)0x0000)    // no menu at all, scrolling by spin buttons
     113             : #define TOOLBOX_MENUTYPE_CLIPPEDITEMS   ((sal_uInt16)0x0001)    // menu will contain "more" indicator
     114             : #define TOOLBOX_MENUTYPE_CUSTOMIZE      ((sal_uInt16)0x0002)    // menu will contain "customization" and "more" indicator
     115             : 
     116             : // small or large force an exact toolbox size for proper alignemnt
     117             : // dontcare will let the toolbox decide about its size
     118             : enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, TOOLBOX_BUTTONSIZE_LARGE };
     119             : 
     120             : // TBX_LAYOUT_NORMAL   - traditional layout, items are centered in the toolbar
     121             : // TBX_LAYOUT_LOCKVERT - special mode (currently used for calc input/formula
     122             : //                       bar) where item's vertical position is locked, e.g.
     123             : //                       toolbox is prevented from centering the items
     124             : enum ToolBoxLayoutMode { TBX_LAYOUT_NORMAL, TBX_LAYOUT_LOCKVERT };
     125             : 
     126             : struct ImplToolSize
     127             : {
     128             :     long mnWidth;
     129             :     long mnHeight;
     130             :     sal_uInt16 mnLines;
     131             : };
     132             : 
     133             : // -----------
     134             : // - ToolBox -
     135             : // -----------
     136             : 
     137             : class VCL_DLLPUBLIC ToolBox : public DockingWindow
     138             : {
     139             :     friend class FloatingWindow;
     140             :     friend class ImplTBDragMgr;
     141             : 
     142             : private:
     143             :     ImplToolBoxPrivateData*     mpData;
     144             :     std::vector<ImplToolSize> maFloatSizes;
     145             :     ImageList           maImageList;
     146             :     Timer               maTimer;
     147             :     Rectangle           maUpperRect;
     148             :     Rectangle           maLowerRect;
     149             :     Rectangle           maOutDockRect;
     150             :     Rectangle           maInDockRect;
     151             :     Rectangle           maPaintRect;
     152             :     FloatingWindow*     mpFloatWin;
     153             :     sal_uInt16              mnKeyModifier;
     154             :     long                mnDX;
     155             :     long                mnDY;
     156             :     long                mnMaxItemWidth;    // max item width
     157             :     long                mnMaxItemHeight;   // max item height (for standard items)
     158             :     long                mnWinHeight;    // max window height (for window items)
     159             :     long                mnLeftBorder;   // inner border
     160             :     long                mnTopBorder;
     161             :     long                mnRightBorder;
     162             :     long                mnBottomBorder;
     163             :     long                mnLastResizeDY;
     164             :     long                mnActivateCount;
     165             :     sal_uInt16              mnLastFocusItemId;
     166             :     sal_uInt16              mnFocusPos;
     167             :     sal_uInt16              mnOutStyle;
     168             :     sal_uInt16              mnHighItemId;
     169             :     sal_uInt16              mnCurItemId;
     170             :     sal_uInt16              mnDownItemId;
     171             :     sal_uInt16              mnCurPos;
     172             :     sal_uInt16              mnLines;        // total number of toolbox lines
     173             :     sal_uInt16              mnCurLine;      // the currently visible line
     174             :     sal_uInt16              mnCurLines;     // number of lines due to line breaking
     175             :     sal_uInt16              mnVisLines;     // number of visible lines (for scrolling)
     176             :     sal_uInt16              mnFloatLines;   // number of lines during floating mode
     177             :     sal_uInt16              mnDockLines;
     178             :     sal_uInt16              mnConfigItem;
     179             :     sal_uInt16              mnMouseClicks;
     180             :     sal_uInt16              mnMouseModifier;
     181             :     unsigned int        mbDrag:1,
     182             :                         mbSelection:1,
     183             :                         mbCommandDrag:1,
     184             :                         mbUpper:1,
     185             :                         mbLower:1,
     186             :                         mbIn:1,
     187             :                         mbCalc:1,
     188             :                         mbFormat:1,
     189             :                         mbFullPaint:1,
     190             :                         mbHorz:1,
     191             :                         mbScroll:1,
     192             :                         mbLastFloatMode:1,
     193             :                         mbCustomize:1,
     194             :                         mbCustomizeMode:1,
     195             :                         mbDragging:1,
     196             :                         mbMenuStrings:1,
     197             :                         mbIsShift:1,
     198             :                         mbIsKeyEvent:1,
     199             :                         mbChangingHighlight:1;
     200             :     WindowAlign         meAlign;
     201             :     WindowAlign         meDockAlign;
     202             :     ButtonType          meButtonType;
     203             :     PointerStyle        meLastStyle;
     204             :     WinBits             mnWinStyle;
     205             :     ToolBoxLayoutMode   meLayoutMode;
     206             :     Link                maClickHdl;
     207             :     Link                maDoubleClickHdl;
     208             :     Link                maActivateHdl;
     209             :     Link                maDeactivateHdl;
     210             :     Link                maHighlightHdl;
     211             :     Link                maSelectHdl;
     212             :     Link                maCommandHandler;
     213             :     Link                maStateChangedHandler;
     214             :     Link                maDataChangedHandler;
     215             : 
     216             :     public:
     217             :     using Window::ImplInit;
     218             :     private:
     219             :     SAL_DLLPRIVATE void            ImplInit( Window* pParent, WinBits nStyle );
     220             :     using DockingWindow::ImplInitSettings;
     221             :     SAL_DLLPRIVATE void            ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
     222             :     SAL_DLLPRIVATE void            ImplLoadRes( const ResId& rResId );
     223             :     SAL_DLLPRIVATE ImplToolItem*   ImplGetItem( sal_uInt16 nId ) const;
     224             :     SAL_DLLPRIVATE sal_Bool            ImplCalcItem();
     225             :     SAL_DLLPRIVATE sal_uInt16          ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool bCalcHorz );
     226             :     SAL_DLLPRIVATE void            ImplFormat( sal_Bool bResize = sal_False );
     227             :     SAL_DLLPRIVATE void            ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn );
     228             :     SAL_DLLPRIVATE void            ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect );
     229             :     SAL_DLLPRIVATE void            ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight = 0, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False );
     230             :     using Window::ImplInvalidate;
     231             :     SAL_DLLPRIVATE void            ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool bFullPaint = sal_False );
     232             :     SAL_DLLPRIVATE void            ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF );
     233             :     SAL_DLLPRIVATE const OUString ImplConvertMenuString( const XubString& rStr );
     234             :     SAL_DLLPRIVATE sal_Bool            ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat = sal_False );
     235             :     SAL_DLLPRIVATE sal_Bool            ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCancel = sal_False );
     236             :     SAL_DLLPRIVATE void            ImplChangeHighlight( ImplToolItem* pItem, sal_Bool bNoGrabFocus = sal_False );
     237             :     SAL_DLLPRIVATE sal_Bool            ImplChangeHighlightUpDn( sal_Bool bUp, sal_Bool bNoCycle = sal_False );
     238             :     SAL_DLLPRIVATE sal_uInt16          ImplGetItemLine( ImplToolItem* pCurrentItem );
     239             :     SAL_DLLPRIVATE ImplToolItem*   ImplGetFirstValidItem( sal_uInt16 nLine );
     240             :     SAL_DLLPRIVATE sal_Bool            ImplOpenItem( KeyCode aKeyCode );
     241             :     SAL_DLLPRIVATE sal_Bool            ImplActivateItem( KeyCode aKeyCode );
     242             :     SAL_DLLPRIVATE void            ImplShowFocus();
     243             :     SAL_DLLPRIVATE void            ImplHideFocus();
     244             :     SAL_DLLPRIVATE void            ImplUpdateInputEnable();
     245             :     SAL_DLLPRIVATE void            ImplFillLayoutData() const;
     246             :     SAL_DLLPRIVATE sal_Bool            ImplHasClippedItems();
     247             :     SAL_DLLPRIVATE Point           ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) const;
     248             :     SAL_DLLPRIVATE void            ImplExecuteCustomMenu();
     249             :     SAL_DLLPRIVATE sal_Bool            ImplIsFloatingMode() const;
     250             :     SAL_DLLPRIVATE sal_Bool            ImplIsInPopupMode() const;
     251             :     SAL_DLLPRIVATE const XubString& ImplGetHelpText( sal_uInt16 nItemId ) const;
     252             :     SAL_DLLPRIVATE Size            ImplGetOptimalFloatingSize();
     253             :     SAL_DLLPRIVATE sal_Bool            ImplHasExternalMenubutton();
     254             :     SAL_DLLPRIVATE void            ImplDrawFloatwinBorder( ImplToolItem* pItem );
     255             : 
     256             :     DECL_DLLPRIVATE_LINK(          ImplCallExecuteCustomMenu, void* );
     257             :     DECL_DLLPRIVATE_LINK(          ImplUpdateHdl, void* );
     258             :     DECL_DLLPRIVATE_LINK(          ImplResetAutoSizeTriesHdl, void* );
     259             :     DECL_DLLPRIVATE_LINK(          ImplCustomMenuListener, VclMenuEvent* );
     260             :     DECL_DLLPRIVATE_LINK(          ImplDropdownLongClickHdl, void* );
     261             : 
     262             :     // Copy assignment is forbidden and not implemented.
     263             :     SAL_DLLPRIVATE                 ToolBox (const ToolBox &);
     264             :     SAL_DLLPRIVATE        ToolBox& operator= (const ToolBox &);
     265             : 
     266             :     SAL_DLLPRIVATE void            ImplUpdateImageList(); // called if StateChanged
     267             : public:
     268             :     SAL_DLLPRIVATE void            ImplFloatControl( sal_Bool bStart, FloatingWindow* pWindow = NULL );
     269             :     SAL_DLLPRIVATE void            ImplDisableFlatButtons();
     270             : 
     271             :     static SAL_DLLPRIVATE int ImplGetDragWidth( ToolBox* pThis );
     272             :     static SAL_DLLPRIVATE void ImplUpdateDragArea( ToolBox *pThis );
     273             :     static SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
     274             :                                                long& rRight, long& rBottom, const ToolBox *pThis );
     275             :     static SAL_DLLPRIVATE void ImplDrawGrip( ToolBox* pThis );
     276             :     static SAL_DLLPRIVATE void ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapper *pWrapper );
     277             :     static SAL_DLLPRIVATE sal_Bool ImplDrawNativeBackground( ToolBox* pThis, const Region &rRegion );
     278             :     static SAL_DLLPRIVATE void ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegion );
     279             :     static SAL_DLLPRIVATE void ImplDrawConstantBackground( ToolBox* pThis, const Region &rRegion, sal_Bool bIsInPopupMode );
     280             :     static SAL_DLLPRIVATE void ImplDrawBackground( ToolBox* pThis, const Rectangle &rRect );
     281             :     static SAL_DLLPRIVATE void ImplErase( ToolBox* pThis, const Rectangle &rRect, sal_Bool bHighlight = sal_False, sal_Bool bHasOpenPopup = sal_False );
     282             :     static SAL_DLLPRIVATE void ImplDrawBorder( ToolBox* pWin );
     283             :     static SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem( const ToolBox* pThis );
     284             :     static SAL_DLLPRIVATE Size ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uInt16 nCalcMode = 0 );
     285             :     static SAL_DLLPRIVATE void ImplCalcFloatSizes( ToolBox* pThis );
     286             :     static SAL_DLLPRIVATE Size ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines );
     287             :     static SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMaxSize );
     288             :     static SAL_DLLPRIVATE void ImplSetMinMaxFloatSize( ToolBox *pThis );
     289             :     static SAL_DLLPRIVATE sal_uInt16 ImplCalcLines( ToolBox* pThis, long nToolSize );
     290             :     static SAL_DLLPRIVATE sal_uInt16 ImplTestLineSize( ToolBox* pThis, const Point& rPos );
     291             :     static SAL_DLLPRIVATE void ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect, sal_uInt16 nLineMode );
     292             :     static SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( ToolBox* pBox, const Point& rPos );
     293             :     static SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList );
     294             :     static SAL_DLLPRIVATE void ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight );
     295             :     static SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks( const ToolBox *pThis );
     296        2094 :     SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; }
     297             : 
     298             : protected:
     299           0 :     void                SetCurItemId(sal_uInt16 nSet) { mnCurItemId = nSet; }
     300             : 
     301             : public:
     302             :                         ToolBox( Window* pParent, WinBits nStyle = 0 );
     303             :                         ToolBox( Window* pParent, const ResId& rResId );
     304             :                         ~ToolBox();
     305             : 
     306             :     virtual void        Click();
     307             :     virtual void        DoubleClick();
     308             :     virtual void        Activate();
     309             :     virtual void        Deactivate();
     310             :     virtual void        Highlight();
     311             :     virtual void        Select();
     312             :     virtual void        Customize( const ToolBoxCustomizeEvent& rCEvt );
     313             :     virtual void        UserDraw( const UserDrawEvent& rUDEvt );
     314             : 
     315             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
     316             :     virtual void        MouseButtonUp( const MouseEvent& rMEvt );
     317             :     virtual void        MouseMove( const MouseEvent& rMEvt );
     318             :     virtual void        Tracking( const TrackingEvent& rTEvt );
     319             :     virtual void        Paint( const Rectangle& rRect );
     320             :     virtual void        Move();
     321             :     virtual void        Resize();
     322             :     virtual void        RequestHelp( const HelpEvent& rHEvt );
     323             :     virtual long        Notify( NotifyEvent& rNEvt );
     324             :     virtual void        Command( const CommandEvent& rCEvt );
     325             :     virtual void        StateChanged( StateChangedType nType );
     326             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
     327             : 
     328             :     virtual void        GetFocus();
     329             :     virtual void        LoseFocus();
     330             :     virtual void        KeyInput( const KeyEvent& rKEvt );
     331             : 
     332             :     virtual sal_Bool        PrepareToggleFloatingMode();
     333             :     virtual void        ToggleFloatingMode();
     334             :     virtual void        StartDocking();
     335             :     virtual sal_Bool        Docking( const Point& rPos, Rectangle& rRect );
     336             :     virtual void        EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
     337             :     virtual void        Resizing( Size& rSize );
     338             :     virtual Size        GetOptimalSize() const;
     339             : 
     340             :     void                InsertItem( const ResId& rResId,
     341             :                                     sal_uInt16 nPos = TOOLBOX_APPEND );
     342             :     /// Insert a command (like '.uno:Save').
     343             :     virtual void        InsertItem( const OUString& rCommand,
     344             :                                     const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame,
     345             :                                     ToolBoxItemBits nBits = 0,
     346             :                                     const Size& rRequestedSize = Size(),
     347             :                                     sal_uInt16 nPos = TOOLBOX_APPEND );
     348             :     void                InsertItem( sal_uInt16 nItemId, const Image& rImage,
     349             :                                     ToolBoxItemBits nBits = 0,
     350             :                                     sal_uInt16 nPos = TOOLBOX_APPEND );
     351             :     void                InsertItem( sal_uInt16 nItemId, const Image& rImage,
     352             :                                     const XubString& rText,
     353             :                                     ToolBoxItemBits nBits = 0,
     354             :                                     sal_uInt16 nPos = TOOLBOX_APPEND );
     355             :     void                InsertItem( sal_uInt16 nItemId, const XubString& rText,
     356             :                                     ToolBoxItemBits nBits = 0,
     357             :                                     sal_uInt16 nPos = TOOLBOX_APPEND );
     358             :     void                InsertWindow( sal_uInt16 nItemId, Window* pWindow,
     359             :                                       ToolBoxItemBits nBits = 0,
     360             :                                       sal_uInt16 nPos = TOOLBOX_APPEND );
     361             :     void                InsertSpace( sal_uInt16 nPos = TOOLBOX_APPEND );
     362             :     void                InsertSeparator( sal_uInt16 nPos = TOOLBOX_APPEND,
     363             :                                          sal_uInt16 nPixSize = 0 );
     364             :     void                InsertBreak( sal_uInt16 nPos = TOOLBOX_APPEND );
     365             :     void                RemoveItem( sal_uInt16 nPos );
     366             :     void                CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId,
     367             :                                   sal_uInt16 nNewPos = TOOLBOX_APPEND );
     368             :     void                Clear();
     369             : 
     370           0 :     const ImageList&    GetImageList() const { return maImageList; }
     371             :     void                SetImageList( const ImageList& rImageList );
     372             : 
     373             :     void                SetButtonType( ButtonType eNewType = BUTTON_SYMBOL );
     374           0 :     ButtonType          GetButtonType() const { return meButtonType; }
     375             : 
     376             :     // sets a fixed button size (small, large or dontcare (==autosize))
     377             :     void                SetToolboxButtonSize( ToolBoxButtonSize eSize );
     378             :     ToolBoxButtonSize   GetToolboxButtonSize() const;
     379             : 
     380             :     void                SetAlign( WindowAlign eNewAlign = WINDOWALIGN_TOP );
     381       81973 :     WindowAlign         GetAlign() const { return meAlign; }
     382       38310 :     sal_Bool                IsHorizontal() const { return mbHorz; }
     383             : 
     384             :     void                SetLineCount( sal_uInt16 nNewLines );
     385             :     sal_uInt16              GetLineCount() const { return mnLines; }
     386             :     sal_uInt16              GetCurLine() const { return mnCurLine; }
     387             :     void                ShowLine( sal_Bool bNext );
     388             : 
     389             :     // Used to enable/disable scrolling one page at a time for toolbar
     390             :     void                SetPageScroll( sal_Bool b );
     391             : 
     392             :     sal_uInt16              GetItemCount() const;
     393             :     ToolBoxItemType     GetItemType( sal_uInt16 nPos ) const;
     394             :     sal_uInt16              GetItemPos( sal_uInt16 nItemId ) const;
     395             :     sal_uInt16              GetItemPos( const Point& rPos ) const;
     396             :     sal_uInt16              GetItemId( sal_uInt16 nPos ) const;
     397             :     sal_uInt16              GetItemId( const Point& rPos ) const;
     398             :     /// Map the command name (like .uno:Save) back to item id.
     399             :     sal_uInt16          GetItemId( const OUString& rCommand ) const;
     400             :     Rectangle           GetItemRect( sal_uInt16 nItemId ) const;
     401             :     Rectangle           GetItemPosRect( sal_uInt16 nPos ) const;
     402             : 
     403             :     /// Returns size of the bitmap / text that is inside this toolbox item.
     404             :     Size                GetItemContentSize( sal_uInt16 nItemId ) const;
     405             : 
     406             :     /// Retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown)
     407             :     Point               GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const;
     408             : 
     409             :     Rectangle           GetScrollRect() const;
     410           6 :     sal_uInt16              GetCurItemId() const { return mnCurItemId; }
     411           0 :     sal_uInt16              GetDownItemId() const { return mnDownItemId; }
     412             :     sal_uInt16              GetClicks() const { return mnMouseClicks; }
     413           2 :     sal_uInt16              GetModifier() const { return mnMouseModifier; }
     414           0 :     sal_uInt16              GetKeyModifier() const { return mnKeyModifier; }
     415             : 
     416             :     void                SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits );
     417             :     ToolBoxItemBits     GetItemBits( sal_uInt16 nItemId ) const;
     418             : 
     419             :     void                SetItemData( sal_uInt16 nItemId, void* pNewData );
     420             :     void*               GetItemData( sal_uInt16 nItemId ) const;
     421             :     void                SetItemImage( sal_uInt16 nItemId, const Image& rImage );
     422             :     Image               GetItemImage( sal_uInt16 nItemId ) const;
     423             :     void                SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
     424             :     void                SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror );
     425             :     void                SetItemText( sal_uInt16 nItemId, const XubString& rText );
     426             :     const XubString&    GetItemText( sal_uInt16 nItemId ) const;
     427             :     void                SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow );
     428             :     Window*             GetItemWindow( sal_uInt16 nItemId ) const;
     429         492 :     sal_uInt16              GetHighlightItemId() const { return mnHighItemId; }
     430             : 
     431             :     void                StartSelection();
     432             :     void                EndSelection();
     433             : 
     434             :     void                SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease = sal_True );
     435             : 
     436             :     void                SetItemState( sal_uInt16 nItemId, TriState eState );
     437             :     TriState            GetItemState( sal_uInt16 nItemId ) const;
     438             : 
     439             :     void                CheckItem( sal_uInt16 nItemId, sal_Bool bCheck = sal_True );
     440             :     sal_Bool                IsItemChecked( sal_uInt16 nItemId ) const;
     441             : 
     442             :     void                EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True );
     443             :     sal_Bool                IsItemEnabled( sal_uInt16 nItemId ) const;
     444             : 
     445             :     void                TriggerItem( sal_uInt16 nItemId, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False );
     446             :     void                ShowItem( sal_uInt16 nItemId, sal_Bool bVisible = sal_True );
     447       13474 :     void                HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, sal_False ); }
     448             :     sal_Bool                IsItemVisible( sal_uInt16 nItemId ) const;
     449             :     sal_Bool                IsItemReallyVisible( sal_uInt16 nItemId ) const;
     450             : 
     451             :     void                SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
     452             :     const XubString&    GetItemCommand( sal_uInt16 nItemId ) const;
     453             : 
     454             :     using Window::SetQuickHelpText;
     455             :     void                SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText );
     456             :     using Window::GetQuickHelpText;
     457             :     const XubString&    GetQuickHelpText( sal_uInt16 nItemId ) const;
     458             : 
     459             :     void                SetHelpText( sal_uInt16 nItemId, const XubString& rText );
     460             :     const XubString&    GetHelpText( sal_uInt16 nItemId ) const;
     461             : 
     462             :     void                SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
     463             :     OString        GetHelpId( sal_uInt16 nItemId ) const;
     464             : 
     465             :     //  window size according to current alignment, floating state and number of lines
     466             :     Size                CalcWindowSizePixel() const;
     467             :     //  window size according to current alignment, floating state and a given number of lines
     468             :     Size                CalcWindowSizePixel( sal_uInt16 nCalcLines ) const;
     469             :     //  window size according to current floating state and a given number of lines and a given alignment
     470             :     Size                CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign ) const;
     471             :     // floating window size according to number of lines (uses the number of line breaks)
     472             :     Size                CalcFloatingWindowSizePixel() const;
     473             :     // floating window size with a given number of lines
     474             :     Size                CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines ) const;
     475             :     // automatic window size for popoup mode
     476             :     Size                CalcPopupWindowSizePixel() const;
     477             : 
     478             :     // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
     479             :     Size                CalcMinimumWindowSizePixel() const;
     480             : 
     481             :     void                SetDockingRects( const Rectangle& rOutRect,
     482             :                                          const Rectangle& rInRect );
     483             :     void                SetFloatingLines( sal_uInt16 nFloatLines );
     484             :     sal_uInt16              GetFloatingLines() const;
     485             : 
     486           1 :     void                SetStyle( WinBits nNewStyle ) { mnWinStyle = nNewStyle; }
     487         215 :     WinBits             GetStyle() const { return mnWinStyle; }
     488             : 
     489             :     // enable/disable undocking
     490             :     void                Lock( sal_Bool bLock = sal_True );
     491             : 
     492             :     // read configuration to determine locking behaviour
     493             :     static sal_Bool         AlwaysLocked();
     494             : 
     495           0 :     void                EnableMenuStrings( sal_Bool bEnable = sal_True ) { mbMenuStrings = (bEnable != 0); }
     496             :     sal_Bool                IsMenuStringsEnabled() const { return mbMenuStrings; }
     497             : 
     498             :     void                SetOutStyle( sal_uInt16 nNewStyle );
     499           0 :     sal_uInt16              GetOutStyle() const { return mnOutStyle; }
     500             : 
     501             :     void                EnableCustomize( sal_Bool bEnable = sal_True );
     502           0 :     sal_Bool                IsCustomize() { return mbCustomize; }
     503             :     sal_Bool                IsInCustomizeMode() const { return mbCustomizeMode; }
     504             : 
     505             :     void                SetHelpText( const XubString& rText )
     506             :                             { DockingWindow::SetHelpText( rText ); }
     507             :     const XubString&    GetHelpText() const
     508             :                             { return DockingWindow::GetHelpText(); }
     509             : 
     510        2586 :     void                SetHelpId( const OString& rId )
     511        2586 :                             { DockingWindow::SetHelpId( rId ); }
     512       57420 :     const OString& GetHelpId() const
     513       57420 :                             { return DockingWindow::GetHelpId(); }
     514             : 
     515        4670 :     void                SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
     516             :     const Link&         GetClickHdl() const { return maClickHdl; }
     517        4640 :     void                SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
     518             :     const Link&         GetDoubleClickHdl() const { return maDoubleClickHdl; }
     519             :     void                SetDropdownClickHdl( const Link& rLink );
     520             :     const Link&         GetDropdownClickHdl() const;
     521        4640 :     void                SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; }
     522             :     const Link&         GetActivateHdl() const { return maActivateHdl; }
     523        4640 :     void                SetDeactivateHdl( const Link& rLink ) { maDeactivateHdl = rLink; }
     524             :     const Link&         GetDeactivateHdl() const { return maDeactivateHdl; }
     525             :     void                SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
     526             :     const Link&         GetHighlightHdl() const { return maHighlightHdl; }
     527        6065 :     void                SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
     528           0 :     const Link&         GetSelectHdl() const { return maSelectHdl; }
     529        4640 :     void                SetCommandHdl( const Link& aLink ) { maCommandHandler = aLink; }
     530             :     const Link&         GetCommandHdl() const { return maCommandHandler; }
     531        4640 :     void                SetStateChangedHdl( const Link& aLink ) { maStateChangedHandler = aLink; }
     532             :     const Link&         GetStateChangedHdl() const { return maStateChangedHandler; }
     533        4640 :     void                SetDataChangedHdl( const Link& aLink ) { maDataChangedHandler = aLink; }
     534             :     const Link&         GetDataChangedHdl() { return maDataChangedHandler; }
     535             : 
     536             :     // support for custom menu (eg for configuration)
     537             :     // note: this menu will also be used to display currently
     538             :     //       clipped toolbox items, so you should only touch
     539             :     //       items that you added by yourself
     540             :     //       the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START
     541             :     // to allow for customization of the menu the coresponding handler is called
     542             :     // when the menu button was clicked and before the menu is executed
     543             :     void                SetMenuType( sal_uInt16 aType = TOOLBOX_MENUTYPE_CUSTOMIZE );
     544             :     sal_uInt16              GetMenuType() const;
     545             :     sal_Bool                IsMenuEnabled() const;
     546             :     PopupMenu*          GetMenu() const;
     547             :     void                UpdateCustomMenu();
     548             :     void                SetMenuButtonHdl( const Link& rLink );
     549             : 
     550             :     // open custommenu
     551             :     void                ExecuteCustomMenu();
     552             : 
     553             :     // allow Click Handler to detect special key
     554             :     bool                IsShift() const { return mbIsShift; }
     555             :     // allow Click Handler to distinguish between mouse and key input
     556           0 :     sal_Bool                IsKeyEvent() const { return mbIsKeyEvent; }
     557             : 
     558             :     // allows framework to set/query the planned popupmode
     559             :     sal_Bool                WillUsePopupMode() const;
     560             :     void                WillUsePopupMode( sal_Bool b);
     561             : 
     562             :     // accessibility helpers
     563             : 
     564             :     // gets the displayed text
     565             :     OUString GetDisplayText() const;
     566             :     // returns the bounding box for the character at index nIndex
     567             :     // where nIndex is relative to the starting index of the item
     568             :     // with id nItemId (in coordinates of the displaying window)
     569             :     Rectangle GetCharacterBounds( sal_uInt16 nItemId, long nIndex ) const;
     570             :     // -1 is returned if no character is at that point
     571             :     // if an index is found the corresponding item id is filled in (else 0)
     572             :     long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const;
     573             : 
     574             :     static const Size&  GetDefaultImageSize(bool bLarge);
     575             :     const Size&         GetDefaultImageSize() const;
     576             :     void                ChangeHighlight( sal_uInt16 nPos );
     577             : 
     578             :     void SetImageListProvider(vcl::IImageListProvider* _pProvider);
     579             :     void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
     580             : };
     581             : 
     582       24024 : inline void ToolBox::CheckItem( sal_uInt16 nItemId, sal_Bool bCheck )
     583             : {
     584       24024 :     SetItemState( nItemId, (bCheck) ? STATE_CHECK : STATE_NOCHECK );
     585       24024 : }
     586             : 
     587        1404 : inline sal_Bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const
     588             : {
     589        1404 :     return (GetItemState( nItemId ) == STATE_CHECK);
     590             : }
     591             : 
     592        9025 : inline Size ToolBox::CalcWindowSizePixel() const
     593             : {
     594        9025 :     return CalcWindowSizePixel( mnLines );
     595             : }
     596             : 
     597             : inline Rectangle ToolBox::GetScrollRect() const
     598             : {
     599             :     return maUpperRect.GetUnion( maLowerRect );
     600             : }
     601             : 
     602             : inline void ToolBox::SetDockingRects( const Rectangle& rOutRect,
     603             :                                       const Rectangle& rInRect )
     604             : {
     605             :     maOutDockRect = rOutRect;
     606             :     maInDockRect = rInRect;
     607             : }
     608             : 
     609           0 : inline void ToolBox::SetFloatingLines( sal_uInt16 nNewLines )
     610             : {
     611           0 :     mnFloatLines = nNewLines;
     612           0 : }
     613             : 
     614           0 : inline sal_uInt16 ToolBox::GetFloatingLines() const
     615             : {
     616           0 :     return mnFloatLines;
     617             : }
     618             : 
     619             : #endif  // _SV_TOOLBOX_HXX
     620             : 
     621             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10