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 #include <uielement/statusindicatorinterfacewrapper.hxx>
21 #include <uielement/progressbarwrapper.hxx>
22 
23 #include <vcl/svapp.hxx>
24 
25 using namespace cppu;
26 using namespace com::sun::star::uno;
27 using namespace com::sun::star::lang;
28 using namespace com::sun::star::beans;
29 
30 namespace framework
31 {
32 
StatusIndicatorInterfaceWrapper(const css::uno::Reference<css::lang::XComponent> & rStatusIndicatorImpl)33 StatusIndicatorInterfaceWrapper::StatusIndicatorInterfaceWrapper(
34     const css::uno::Reference< css::lang::XComponent >& rStatusIndicatorImpl ) :
35     m_xStatusIndicatorImpl( rStatusIndicatorImpl )
36 {
37 }
38 
~StatusIndicatorInterfaceWrapper()39 StatusIndicatorInterfaceWrapper::~StatusIndicatorInterfaceWrapper()
40 {
41 }
42 
start(const OUString & sText,sal_Int32 nRange)43 void SAL_CALL StatusIndicatorInterfaceWrapper::start(
44     const OUString& sText,
45     sal_Int32              nRange )
46 {
47     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
48     if ( xComp.is() )
49     {
50         ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get());
51         if ( pProgressBar )
52             pProgressBar->start( sText, nRange );
53     }
54 }
55 
end()56 void SAL_CALL StatusIndicatorInterfaceWrapper::end()
57 {
58     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
59     if ( xComp.is() )
60     {
61         ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get());
62         if ( pProgressBar )
63             pProgressBar->end();
64     }
65 }
66 
reset()67 void SAL_CALL StatusIndicatorInterfaceWrapper::reset()
68 {
69     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
70     if ( xComp.is() )
71     {
72         ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get());
73         if ( pProgressBar )
74             pProgressBar->reset();
75     }
76 }
77 
setText(const OUString & sText)78 void SAL_CALL StatusIndicatorInterfaceWrapper::setText(
79     const OUString& sText )
80 {
81     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
82     if ( xComp.is() )
83     {
84         ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get());
85         if ( pProgressBar )
86             pProgressBar->setText( sText );
87     }
88 }
89 
setValue(sal_Int32 nValue)90 void SAL_CALL StatusIndicatorInterfaceWrapper::setValue(
91     sal_Int32 nValue )
92 {
93     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
94     if ( xComp.is() )
95     {
96         ProgressBarWrapper* pProgressBar = static_cast<ProgressBarWrapper*>(xComp.get());
97         if ( pProgressBar )
98             pProgressBar->setValue( nValue );
99     }
100 }
101 
102 } // namespace framework
103 
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
105