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

Generated by: LCOV version 1.10