1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef OOX_HELPER_PROGRESSBAR_HXX
21 #define OOX_HELPER_PROGRESSBAR_HXX
23 #include <boost/shared_ptr.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include "oox/dllapi.h"
28 namespace com
{ namespace sun
{ namespace star
{
29 namespace task
{ class XStatusIndicator
; }
34 // Interfaces =================================================================
36 /** Interface for progress bar classes.
41 virtual ~IProgressBar();
43 /** Returns the current position of the progress bar.
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.
48 virtual double getPosition() const = 0;
50 /** Sets the current position of the progress bar.
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)
56 virtual void setPosition( double fPosition
) = 0;
59 typedef ::boost::shared_ptr
< IProgressBar
> IProgressBarRef
;
61 // ----------------------------------------------------------------------------
63 class ISegmentProgressBar
;
64 typedef ::boost::shared_ptr
< ISegmentProgressBar
> ISegmentProgressBarRef
;
66 /** Interface for a segment in a progress bar, that is able to create sub
69 class ISegmentProgressBar
: public IProgressBar
72 virtual ~ISegmentProgressBar();
74 /** Returns the length that is still free for creating sub segments. */
75 virtual double getFreeLength() const = 0;
77 /** Adds a new segment with the specified length. */
78 virtual ISegmentProgressBarRef
createSegment( double fLength
) = 0;
81 // ============================================================================
82 // ============================================================================
84 /** A simple progress bar.
86 class OOX_DLLPUBLIC ProgressBar
: public IProgressBar
90 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XStatusIndicator
>& rxIndicator
,
91 const OUString
& rText
);
93 virtual ~ProgressBar();
95 /** Returns the current position of the progress bar. */
96 virtual double getPosition() const;
97 /** Sets the current position of the progress bar. */
98 virtual void setPosition( double fPosition
);
101 ::com::sun::star::uno::Reference
< ::com::sun::star::task::XStatusIndicator
>
106 // ============================================================================
108 /** A progress bar containing several independent segments.
110 class OOX_DLLPUBLIC SegmentProgressBar
: public ISegmentProgressBar
113 explicit SegmentProgressBar(
114 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XStatusIndicator
>& rxIndicator
,
115 const OUString
& rText
);
117 /** Returns the current position of the progress bar segment. */
118 virtual double getPosition() const;
119 /** Sets the current position of the progress bar segment. */
120 virtual void setPosition( double fPosition
);
122 /** Returns the length that is still free for creating sub segments. */
123 virtual double getFreeLength() const;
124 /** Adds a new segment with the specified length. */
125 virtual ISegmentProgressBarRef
createSegment( double fLength
);
128 ProgressBar maProgress
;
132 // ============================================================================
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */