LCOV - code coverage report
Current view: top level - include/vcl - status.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.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_STATUS_HXX
      21             : #define INCLUDED_VCL_STATUS_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <vcl/dllapi.h>
      25             : #include <vcl/window.hxx>
      26             : #include <vector>
      27             : 
      28             : struct ImplStatusItem;
      29             : typedef ::std::vector< ImplStatusItem* > ImplStatusItemList;
      30             : 
      31             : 
      32             : // - Progress-Ausgabe -
      33             : 
      34             : void VCL_DLLPUBLIC DrawProgress(vcl::Window* pWindow, vcl::RenderContext& rRenderContext, const Point& rPos,
      35             :                                 long nOffset, long nPrgsWidth, long nPrgsHeight,
      36             :                                 sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount,
      37             :                                 const Rectangle& rFramePosSize);
      38             : 
      39             : 
      40             : // - StatusBarItemBits -
      41             : 
      42             : 
      43             : typedef sal_uInt16 StatusBarItemBits;
      44             : 
      45             : 
      46             : // - Bits fuer StatusBarItems -
      47             : 
      48             : 
      49             : #define SIB_LEFT                    ((StatusBarItemBits)0x0001)
      50             : #define SIB_CENTER                  ((StatusBarItemBits)0x0002)
      51             : #define SIB_RIGHT                   ((StatusBarItemBits)0x0004)
      52             : #define SIB_IN                      ((StatusBarItemBits)0x0008)
      53             : #define SIB_OUT                     ((StatusBarItemBits)0x0010)
      54             : #define SIB_FLAT                    ((StatusBarItemBits)0x0020)
      55             : #define SIB_AUTOSIZE                ((StatusBarItemBits)0x0040)
      56             : #define SIB_USERDRAW                ((StatusBarItemBits)0x0080)
      57             : 
      58             : 
      59             : // - StatusBar-Types -
      60             : 
      61             : 
      62             : #define STATUSBAR_APPEND            ((sal_uInt16)0xFFFF)
      63             : #define STATUSBAR_ITEM_NOTFOUND     ((sal_uInt16)0xFFFF)
      64             : #define STATUSBAR_OFFSET            ((long)5)
      65             : 
      66             : 
      67             : // - StatusBar -
      68             : 
      69             : 
      70             : class VCL_DLLPUBLIC StatusBar : public vcl::Window
      71             : {
      72             :     class   ImplData;
      73             : private:
      74             :     ImplStatusItemList* mpItemList;
      75             :     ImplData*           mpImplData;
      76             :     OUString            maPrgsTxt;
      77             :     Point               maPrgsTxtPos;
      78             :     Rectangle           maPrgsFrameRect;
      79             :     long                mnPrgsSize;
      80             :     long                mnItemsWidth;
      81             :     long                mnDX;
      82             :     long                mnDY;
      83             :     long                mnCalcHeight;
      84             :     long                mnTextY;
      85             :     long                mnItemY;
      86             :     sal_uInt16          mnCurItemId;
      87             :     sal_uInt16          mnPercent;
      88             :     sal_uInt16          mnPercentCount;
      89             :     bool                mbVisibleItems;
      90             :     bool                mbFormat;
      91             :     bool                mbProgressMode;
      92             :     bool                mbInUserDraw;
      93             :     bool                mbAdjustHiDPI;
      94             :     Link<>              maClickHdl;
      95             :     Link<>              maDoubleClickHdl;
      96             : 
      97             :     using Window::ImplInit;
      98             :     SAL_DLLPRIVATE void      ImplInit( vcl::Window* pParent, WinBits nStyle );
      99             :     SAL_DLLPRIVATE void      ImplInitSettings();
     100             :     SAL_DLLPRIVATE void      ImplFormat();
     101             :     SAL_DLLPRIVATE bool      ImplIsItemUpdate();
     102             : 
     103             :     SAL_DLLPRIVATE void      ImplDrawText(vcl::RenderContext& rRenderContext, bool bOffScreen,
     104             :                                           long nOldTextWidth);
     105             :     SAL_DLLPRIVATE void      ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen,
     106             :                                           sal_uInt16 nPos, bool bDrawText, bool bDrawFrame);
     107             :     SAL_DLLPRIVATE void      ImplDrawProgress(vcl::RenderContext& rRenderContext, bool bPaint,
     108             :                                               sal_uInt16 nOldPerc, sal_uInt16 nNewPerc);
     109             :     SAL_DLLPRIVATE void      ImplCalcProgressRect();
     110             :     SAL_DLLPRIVATE Rectangle ImplGetItemRectPos( sal_uInt16 nPos ) const;
     111             :     SAL_DLLPRIVATE sal_uInt16    ImplGetFirstVisiblePos() const;
     112             : 
     113             : protected:
     114             :     virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
     115             : 
     116             : public:
     117             :                         StatusBar( vcl::Window* pParent,
     118             :                                    WinBits nWinStyle = WB_BORDER | WB_RIGHT );
     119             :     virtual             ~StatusBar();
     120             :     virtual void        dispose() SAL_OVERRIDE;
     121             : 
     122             :     void                AdjustItemWidthsForHiDPI(bool bAdjustHiDPI);
     123             : 
     124             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     125             :     virtual void        Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
     126             :     virtual void        Move() SAL_OVERRIDE;
     127             :     virtual void        Resize() SAL_OVERRIDE;
     128             :     virtual void        RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
     129             :     virtual void        StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     130             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     131             : 
     132             :     void                Click();
     133             :     void                DoubleClick();
     134             :     virtual void        UserDraw( const UserDrawEvent& rUDEvt );
     135             : 
     136             :     void                InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
     137             :                                     StatusBarItemBits nBits = SIB_CENTER | SIB_IN,
     138             :                                     long nOffset = STATUSBAR_OFFSET,
     139             :                                     sal_uInt16 nPos = STATUSBAR_APPEND );
     140             :     void                RemoveItem( sal_uInt16 nItemId );
     141             : 
     142             :     void                ShowItem( sal_uInt16 nItemId );
     143             :     void                HideItem( sal_uInt16 nItemId );
     144             :     bool                IsItemVisible( sal_uInt16 nItemId ) const;
     145             : 
     146       23517 :     bool                AreItemsVisible() const { return mbVisibleItems; }
     147             : 
     148             :     void                RedrawItem( sal_uInt16 nItemId );
     149             : 
     150             :     void                Clear();
     151             : 
     152             :     sal_uInt16              GetItemCount() const;
     153             :     sal_uInt16              GetItemId( sal_uInt16 nPos ) const;
     154             :     sal_uInt16              GetItemId( const Point& rPos ) const;
     155             :     sal_uInt16              GetItemPos( sal_uInt16 nItemId ) const;
     156             :     Rectangle           GetItemRect( sal_uInt16 nItemId ) const;
     157             :     Point               GetItemTextPos( sal_uInt16 nItemId ) const;
     158       23578 :     sal_uInt16              GetCurItemId() const { return mnCurItemId; }
     159             : 
     160             :     sal_uLong               GetItemWidth( sal_uInt16 nItemId ) const;
     161             :     StatusBarItemBits   GetItemBits( sal_uInt16 nItemId ) const;
     162             : 
     163             :     long                GetItemOffset( sal_uInt16 nItemId ) const;
     164             : 
     165             :     void                SetItemText( sal_uInt16 nItemId, const OUString& rText );
     166             :     const OUString&    GetItemText( sal_uInt16 nItemId ) const;
     167             : 
     168             :     void                SetItemData( sal_uInt16 nItemId, void* pNewData );
     169             :     void*               GetItemData( sal_uInt16 nItemId ) const;
     170             : 
     171             :     void                SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
     172             :     const OUString      GetItemCommand( sal_uInt16 nItemId );
     173             : 
     174             :     void                SetHelpText( sal_uInt16 nItemId, const OUString& rText );
     175             :     const OUString&    GetHelpText( sal_uInt16 nItemId ) const;
     176             : 
     177             :     using Window::SetQuickHelpText;
     178             :     void                SetQuickHelpText( sal_uInt16 nItemId, const OUString& rText );
     179             :     using Window::GetQuickHelpText;
     180             :     const OUString&     GetQuickHelpText( sal_uInt16 nItemId ) const;
     181             : 
     182             :     void                SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
     183             :     OString             GetHelpId( sal_uInt16 nItemId ) const;
     184             : 
     185             :     void                StartProgressMode( const OUString& rText );
     186             :     void                SetProgressValue( sal_uInt16 nPercent );
     187             :     void                EndProgressMode();
     188       38585 :     bool                IsProgressMode() const { return mbProgressMode; }
     189             : 
     190             :     void                SetText( const OUString& rText ) SAL_OVERRIDE;
     191             : 
     192             :     void                SetHelpText( const OUString& rText )
     193             :                             { Window::SetHelpText( rText ); }
     194             :     const OUString&    GetHelpText() const
     195             :                             { return Window::GetHelpText(); }
     196             : 
     197             :     void                SetHelpId( const OString& rId )
     198             :                             { Window::SetHelpId( rId ); }
     199             :     const OString&      GetHelpId() const
     200             :                             { return Window::GetHelpId(); }
     201             : 
     202             :     Size                CalcWindowSizePixel() const;
     203             : 
     204        3213 :     void                SetClickHdl( const Link<>& rLink ) { maClickHdl = rLink; }
     205             :     const Link<>&       GetClickHdl() const { return maClickHdl; }
     206        3213 :     void                SetDoubleClickHdl( const Link<>& rLink ) { maDoubleClickHdl = rLink; }
     207             :     const Link<>&       GetDoubleClickHdl() const { return maDoubleClickHdl; }
     208             : 
     209             :     using Window::SetAccessibleName;
     210             :     void                SetAccessibleName( sal_uInt16 nItemId, const OUString& rName );
     211             :     using Window::GetAccessibleName;
     212             :     const OUString&     GetAccessibleName( sal_uInt16 nItemId ) const;
     213             : };
     214             : 
     215             : #endif // INCLUDED_VCL_STATUS_HXX
     216             : 
     217             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11