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 #pragma once
21 
22 #include <helper/uielementwrapperbase.hxx>
23 
24 #include <com/sun/star/awt/XWindow.hpp>
25 
26 #include <cppuhelper/weakref.hxx>
27 
28 namespace framework{
29 
30 class ProgressBarWrapper final : public UIElementWrapperBase
31 {
32     public:
33 
34         //  constructor / destructor
35 
36         ProgressBarWrapper();
37         virtual ~ProgressBarWrapper() override;
38 
39         // public interfaces
40         void setStatusBar( const css::uno::Reference< css::awt::XWindow >& rStatusBar, bool bOwnsInstance = false );
41         css::uno::Reference< css::awt::XWindow > getStatusBar() const;
42 
43         // wrapped methods of css::task::XStatusIndicator
44         /// @throws css::uno::RuntimeException
45         void start( const OUString& Text, ::sal_Int32 Range );
46         /// @throws css::uno::RuntimeException
47         void end();
48         /// @throws css::uno::RuntimeException
49         void setText( const OUString& Text );
50         /// @throws css::uno::RuntimeException
51         void setValue( ::sal_Int32 Value );
52         /// @throws css::uno::RuntimeException
53         void reset();
54 
55         // UNO interfaces
56         // XComponent
57         virtual void SAL_CALL dispose() override;
58 
59         // XInitialization
60         virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
61 
62         // XUpdatable
63         virtual void SAL_CALL update() override;
64 
65         // XUIElement
66         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRealInterface() override;
67 
68     //  variables
69     //  (should be private everyway!)
70 
71     private:
72         css::uno::Reference< css::awt::XWindow >         m_xStatusBar;    // Reference to our status bar XWindow
73         css::uno::WeakReference< css::uno::XInterface >  m_xProgressBarIfacWrapper;
74         bool                                             m_bOwnsInstance; // Indicator that we are owner of the XWindow
75         sal_Int32                                        m_nRange;
76         sal_Int32                                        m_nValue;
77         OUString                                         m_aText;
78 };      //  class ProgressBarWrapper
79 
80 }       //  namespace framework
81 
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
83