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 INCLUDED_OOX_HELPER_PROGRESSBAR_HXX
21 #define INCLUDED_OOX_HELPER_PROGRESSBAR_HXX
23 #include <config_options.h>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <oox/dllapi.h>
28 #include <rtl/ustring.hxx>
30 namespace com::sun::star
{
31 namespace task
{ class XStatusIndicator
; }
36 // Interfaces =================================================================
38 /** Interface for progress bar classes.
40 class OOX_DLLPUBLIC IProgressBar
43 virtual ~IProgressBar();
45 /** Returns the current position of the progress bar.
47 @return Position of the progress bar, in the range from 0.0 (beginning
48 of the progress bar) to 1.0 (end of the progress bar) inclusive.
50 virtual double getPosition() const = 0;
52 /** Sets the current position of the progress bar.
54 @param fPosition New position of the progress bar, in the range from
55 0.0 (beginning of the progress bar) to 1.0 (end of the progress bar)
58 virtual void setPosition( double fPosition
) = 0;
62 class ISegmentProgressBar
;
63 typedef std::shared_ptr
< ISegmentProgressBar
> ISegmentProgressBarRef
;
65 /** Interface for a segment in a progress bar, that is able to create sub
68 class OOX_DLLPUBLIC ISegmentProgressBar
: public IProgressBar
71 virtual ~ISegmentProgressBar() override
;
73 /** Returns the length that is still free for creating sub segments. */
74 virtual double getFreeLength() const = 0;
76 /** Adds a new segment with the specified length. */
77 virtual ISegmentProgressBarRef
createSegment( double fLength
) = 0;
81 /** A simple progress bar.
83 class OOX_DLLPUBLIC ProgressBar final
: public IProgressBar
87 const css::uno::Reference
< css::task::XStatusIndicator
>& rxIndicator
,
88 const OUString
& rText
);
90 virtual ~ProgressBar() override
;
92 /** Returns the current position of the progress bar. */
93 virtual double getPosition() const override
;
94 /** Sets the current position of the progress bar. */
95 virtual void setPosition( double fPosition
) override
;
98 css::uno::Reference
< css::task::XStatusIndicator
>
104 /** A progress bar containing several independent segments.
106 class OOX_DLLPUBLIC SegmentProgressBar final
: public ISegmentProgressBar
109 explicit SegmentProgressBar(
110 const css::uno::Reference
< css::task::XStatusIndicator
>& rxIndicator
,
111 const OUString
& rText
);
113 /** Returns the current position of the progress bar segment. */
114 virtual double getPosition() const override
;
115 /** Sets the current position of the progress bar segment. */
116 virtual void setPosition( double fPosition
) override
;
118 /** Returns the length that is still free for creating sub segments. */
119 virtual double getFreeLength() const override
;
120 /** Adds a new segment with the specified length. */
121 virtual ISegmentProgressBarRef
createSegment( double fLength
) override
;
124 ProgressBar maProgress
;
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */