LCOV - code coverage report
Current view: top level - include/oox/helper - progressbar.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 3 100.0 %
Date: 2015-06-13 12:38:46 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 <memory>
      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        1656 : 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             : 
      60             : 
      61             : 
      62             : class ISegmentProgressBar;
      63             : typedef std::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef;
      64             : 
      65             : /** Interface for a segment in a progress bar, that is able to create sub
      66             :     segments from itself.
      67             :  */
      68        1511 : class OOX_DLLPUBLIC ISegmentProgressBar : public IProgressBar
      69             : {
      70             : public:
      71             :     virtual             ~ISegmentProgressBar();
      72             : 
      73             :     /** Returns the length that is still free for creating sub segments. */
      74             :     virtual double      getFreeLength() const = 0;
      75             : 
      76             :     /** Adds a new segment with the specified length. */
      77             :     virtual ISegmentProgressBarRef createSegment( double fLength ) = 0;
      78             : };
      79             : 
      80             : 
      81             : 
      82             : 
      83             : /** A simple progress bar.
      84             :  */
      85             : class OOX_DLLPUBLIC ProgressBar : public IProgressBar
      86             : {
      87             : public:
      88             :     explicit            ProgressBar(
      89             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
      90             :                             const OUString& rText );
      91             : 
      92             :     virtual             ~ProgressBar();
      93             : 
      94             :     /** Returns the current position of the progress bar. */
      95             :     virtual double      getPosition() const SAL_OVERRIDE;
      96             :     /** Sets the current position of the progress bar. */
      97             :     virtual void        setPosition( double fPosition ) SAL_OVERRIDE;
      98             : 
      99             : private:
     100             :     ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >
     101             :                         mxIndicator;
     102             :     double              mfPosition;
     103             : };
     104             : 
     105             : 
     106             : 
     107             : /** A progress bar containing several independent segments.
     108             :  */
     109         290 : class OOX_DLLPUBLIC SegmentProgressBar : public ISegmentProgressBar
     110             : {
     111             : public:
     112             :     explicit            SegmentProgressBar(
     113             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
     114             :                             const OUString& rText );
     115             : 
     116             :     /** Returns the current position of the progress bar segment. */
     117             :     virtual double      getPosition() const SAL_OVERRIDE;
     118             :     /** Sets the current position of the progress bar segment. */
     119             :     virtual void        setPosition( double fPosition ) SAL_OVERRIDE;
     120             : 
     121             :     /** Returns the length that is still free for creating sub segments. */
     122             :     virtual double      getFreeLength() const SAL_OVERRIDE;
     123             :     /** Adds a new segment with the specified length. */
     124             :     virtual ISegmentProgressBarRef createSegment( double fLength ) SAL_OVERRIDE;
     125             : 
     126             : private:
     127             :     ProgressBar         maProgress;
     128             :     double              mfFreeStart;
     129             : };
     130             : 
     131             : 
     132             : 
     133             : } // namespace oox
     134             : 
     135             : #endif
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11