1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_framework.hxx"
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 #include <uielement/statusindicatorinterfacewrapper.hxx>
31 #include <uielement/progressbarwrapper.hxx>
32 #include <threadhelp/resetableguard.hxx>
33 
34 //_________________________________________________________________________________________________________________
35 //	other includes
36 //_________________________________________________________________________________________________________________
37 
38 #include <vcl/svapp.hxx>
39 #include <vos/mutex.hxx>
40 
41 using namespace cppu;
42 using namespace com::sun::star::uno;
43 using namespace com::sun::star::lang;
44 using namespace com::sun::star::beans;
45 
46 namespace framework
47 {
48 
49 
StatusIndicatorInterfaceWrapper(const::com::sun::star::uno::Reference<::com::sun::star::lang::XComponent> & rStatusIndicatorImpl)50 StatusIndicatorInterfaceWrapper::StatusIndicatorInterfaceWrapper(
51     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rStatusIndicatorImpl ) :
52     m_xStatusIndicatorImpl( rStatusIndicatorImpl )
53 {
54 }
55 
~StatusIndicatorInterfaceWrapper()56 StatusIndicatorInterfaceWrapper::~StatusIndicatorInterfaceWrapper()
57 {
58 }
59 
60 
start(const::rtl::OUString & sText,sal_Int32 nRange)61 void SAL_CALL StatusIndicatorInterfaceWrapper::start(
62     const ::rtl::OUString& sText,
63     sal_Int32              nRange )
64 throw( ::com::sun::star::uno::RuntimeException )
65 {
66     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
67     if ( xComp.is() )
68     {
69         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
70         if ( pProgressBar )
71             pProgressBar->start( sText, nRange );
72     }
73 }
74 
end()75 void SAL_CALL StatusIndicatorInterfaceWrapper::end()
76 throw( ::com::sun::star::uno::RuntimeException )
77 {
78     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
79     if ( xComp.is() )
80     {
81         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
82         if ( pProgressBar )
83             pProgressBar->end();
84     }
85 }
86 
reset()87 void SAL_CALL StatusIndicatorInterfaceWrapper::reset()
88 throw( ::com::sun::star::uno::RuntimeException )
89 {
90     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
91     if ( xComp.is() )
92     {
93         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
94         if ( pProgressBar )
95             pProgressBar->reset();
96     }
97 }
98 
setText(const::rtl::OUString & sText)99 void SAL_CALL StatusIndicatorInterfaceWrapper::setText(
100     const ::rtl::OUString& sText )
101 throw( ::com::sun::star::uno::RuntimeException )
102 {
103     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
104     if ( xComp.is() )
105     {
106         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
107         if ( pProgressBar )
108             pProgressBar->setText( sText );
109     }
110 }
111 
setValue(sal_Int32 nValue)112 void SAL_CALL StatusIndicatorInterfaceWrapper::setValue(
113     sal_Int32 nValue )
114 throw( ::com::sun::star::uno::RuntimeException )
115 {
116     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
117     if ( xComp.is() )
118     {
119         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
120         if ( pProgressBar )
121             pProgressBar->setValue( nValue );
122     }
123 }
124 
125 } // namespace framework
126 
127