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

Generated by: LCOV version 1.10