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

Generated by: LCOV version 1.10