LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/oox/helper - progressbar.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-12-27 Functions: 4 4 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 OOX_HELPER_PROGRESSBAR_HXX
      21             : #define OOX_HELPER_PROGRESSBAR_HXX
      22             : 
      23             : #include <boost/shared_ptr.hpp>
      24             : #include <com/sun/star/uno/Reference.hxx>
      25             : #include "oox/dllapi.h"
      26             : 
      27             : namespace rtl { class OUString; }
      28             : 
      29             : namespace com { namespace sun { namespace star {
      30             :     namespace task { class XStatusIndicator; }
      31             : } } }
      32             : 
      33             : namespace oox {
      34             : 
      35             : // Interfaces =================================================================
      36             : 
      37             : /** Interface for progress bar classes.
      38             :  */
      39         119 : class IProgressBar
      40             : {
      41             : public:
      42             :     virtual             ~IProgressBar();
      43             : 
      44             :     /** Returns the current position of the progress bar.
      45             : 
      46             :         @return  Position of the progress bar, in the range from 0.0 (beginning
      47             :         of the progress bar) to 1.0 (end of the progress bar) inclusive.
      48             :      */
      49             :     virtual double      getPosition() const = 0;
      50             : 
      51             :     /** Sets the current position of the progress bar.
      52             : 
      53             :         @param fPosition  New position of the progress bar, in the range from
      54             :         0.0 (beginning of the progress bar) to 1.0 (end of the progress bar)
      55             :         inclusive.
      56             :      */
      57             :     virtual void        setPosition( double fPosition ) = 0;
      58             : };
      59             : 
      60             : typedef ::boost::shared_ptr< IProgressBar > IProgressBarRef;
      61             : 
      62             : // ----------------------------------------------------------------------------
      63             : 
      64             : class ISegmentProgressBar;
      65             : typedef ::boost::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef;
      66             : 
      67             : /** Interface for a segment in a progress bar, that is able to create sub
      68             :     segments from itself.
      69             :  */
      70         108 : class ISegmentProgressBar : public IProgressBar
      71             : {
      72             : public:
      73             :     virtual             ~ISegmentProgressBar();
      74             : 
      75             :     /** Returns the length that is still free for creating sub segments. */
      76             :     virtual double      getFreeLength() const = 0;
      77             : 
      78             :     /** Adds a new segment with the specified length. */
      79             :     virtual ISegmentProgressBarRef createSegment( double fLength ) = 0;
      80             : };
      81             : 
      82             : // ============================================================================
      83             : // ============================================================================
      84             : 
      85             : /** A simple progress bar.
      86             :  */
      87             : class OOX_DLLPUBLIC ProgressBar : public IProgressBar
      88             : {
      89             : public:
      90             :     explicit            ProgressBar(
      91             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
      92             :                             const ::rtl::OUString& rText );
      93             : 
      94             :     virtual             ~ProgressBar();
      95             : 
      96             :     /** Returns the current position of the progress bar. */
      97             :     virtual double      getPosition() const;
      98             :     /** Sets the current position of the progress bar. */
      99             :     virtual void        setPosition( double fPosition );
     100             : 
     101             : private:
     102             :     ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >
     103             :                         mxIndicator;
     104             :     double              mfPosition;
     105             : };
     106             : 
     107             : // ============================================================================
     108             : 
     109             : /** A progress bar containing several independent segments.
     110             :  */
     111          22 : class OOX_DLLPUBLIC SegmentProgressBar : public ISegmentProgressBar
     112             : {
     113             : public:
     114             :     explicit            SegmentProgressBar(
     115             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
     116             :                             const ::rtl::OUString& rText );
     117             : 
     118             :     /** Returns the current position of the progress bar segment. */
     119             :     virtual double      getPosition() const;
     120             :     /** Sets the current position of the progress bar segment. */
     121             :     virtual void        setPosition( double fPosition );
     122             : 
     123             :     /** Returns the length that is still free for creating sub segments. */
     124             :     virtual double      getFreeLength() const;
     125             :     /** Adds a new segment with the specified length. */
     126             :     virtual ISegmentProgressBarRef createSegment( double fLength );
     127             : 
     128             : private:
     129             :     ProgressBar         maProgress;
     130             :     double              mfFreeStart;
     131             : };
     132             : 
     133             : // ============================================================================
     134             : 
     135             : } // namespace oox
     136             : 
     137             : #endif
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10