Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / oox / helper / progressbar.hxx
blob88ddb99ff91969d88f1e5879321d7ccf157f97ea
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <memory>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <oox/dllapi.h>
27 #include <rtl/ustring.hxx>
29 namespace com { namespace sun { namespace star {
30 namespace task { class XStatusIndicator; }
31 } } }
33 namespace oox {
35 // Interfaces =================================================================
37 /** Interface for progress bar classes.
39 class OOX_DLLPUBLIC IProgressBar
41 public:
42 virtual ~IProgressBar();
44 /** Returns the current position of the progress bar.
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.
49 virtual double getPosition() const = 0;
51 /** Sets the current position of the progress bar.
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.
57 virtual void setPosition( double fPosition ) = 0;
61 class ISegmentProgressBar;
62 typedef std::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef;
64 /** Interface for a segment in a progress bar, that is able to create sub
65 segments from itself.
67 class OOX_DLLPUBLIC ISegmentProgressBar : public IProgressBar
69 public:
70 virtual ~ISegmentProgressBar() override;
72 /** Returns the length that is still free for creating sub segments. */
73 virtual double getFreeLength() const = 0;
75 /** Adds a new segment with the specified length. */
76 virtual ISegmentProgressBarRef createSegment( double fLength ) = 0;
80 /** A simple progress bar.
82 class OOX_DLLPUBLIC ProgressBar : public IProgressBar
84 public:
85 explicit ProgressBar(
86 const css::uno::Reference< css::task::XStatusIndicator >& rxIndicator,
87 const OUString& rText );
89 virtual ~ProgressBar() override;
91 /** Returns the current position of the progress bar. */
92 virtual double getPosition() const override;
93 /** Sets the current position of the progress bar. */
94 virtual void setPosition( double fPosition ) override;
96 private:
97 css::uno::Reference< css::task::XStatusIndicator >
98 mxIndicator;
99 double mfPosition;
103 /** A progress bar containing several independent segments.
105 class OOX_DLLPUBLIC SegmentProgressBar : public ISegmentProgressBar
107 public:
108 explicit SegmentProgressBar(
109 const css::uno::Reference< css::task::XStatusIndicator >& rxIndicator,
110 const OUString& rText );
112 /** Returns the current position of the progress bar segment. */
113 virtual double getPosition() const override;
114 /** Sets the current position of the progress bar segment. */
115 virtual void setPosition( double fPosition ) override;
117 /** Returns the length that is still free for creating sub segments. */
118 virtual double getFreeLength() const override;
119 /** Adds a new segment with the specified length. */
120 virtual ISegmentProgressBarRef createSegment( double fLength ) override;
122 private:
123 ProgressBar maProgress;
124 double mfFreeStart;
128 } // namespace oox
130 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */