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

Generated by: LCOV version 1.10