1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_framework.hxx"
30 
31 //_________________________________________________________________________________________________________________
32 //	my own includes
33 //_________________________________________________________________________________________________________________
34 #include <uielement/statusindicatorinterfacewrapper.hxx>
35 #include <uielement/progressbarwrapper.hxx>
36 #include <threadhelp/resetableguard.hxx>
37 
38 //_________________________________________________________________________________________________________________
39 //	other includes
40 //_________________________________________________________________________________________________________________
41 
42 #include <vcl/svapp.hxx>
43 #include <vos/mutex.hxx>
44 
45 using namespace cppu;
46 using namespace com::sun::star::uno;
47 using namespace com::sun::star::lang;
48 using namespace com::sun::star::beans;
49 
50 namespace framework
51 {
52 
53 
54 StatusIndicatorInterfaceWrapper::StatusIndicatorInterfaceWrapper(
55     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rStatusIndicatorImpl ) :
56     m_xStatusIndicatorImpl( rStatusIndicatorImpl )
57 {
58 }
59 
60 StatusIndicatorInterfaceWrapper::~StatusIndicatorInterfaceWrapper()
61 {
62 }
63 
64 
65 void SAL_CALL StatusIndicatorInterfaceWrapper::start(
66     const ::rtl::OUString& sText,
67     sal_Int32              nRange )
68 throw( ::com::sun::star::uno::RuntimeException )
69 {
70     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
71     if ( xComp.is() )
72     {
73         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
74         if ( pProgressBar )
75             pProgressBar->start( sText, nRange );
76     }
77 }
78 
79 void SAL_CALL StatusIndicatorInterfaceWrapper::end()
80 throw( ::com::sun::star::uno::RuntimeException )
81 {
82     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
83     if ( xComp.is() )
84     {
85         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
86         if ( pProgressBar )
87             pProgressBar->end();
88     }
89 }
90 
91 void SAL_CALL StatusIndicatorInterfaceWrapper::reset()
92 throw( ::com::sun::star::uno::RuntimeException )
93 {
94     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
95     if ( xComp.is() )
96     {
97         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
98         if ( pProgressBar )
99             pProgressBar->reset();
100     }
101 }
102 
103 void SAL_CALL StatusIndicatorInterfaceWrapper::setText(
104     const ::rtl::OUString& sText )
105 throw( ::com::sun::star::uno::RuntimeException )
106 {
107     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
108     if ( xComp.is() )
109     {
110         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
111         if ( pProgressBar )
112             pProgressBar->setText( sText );
113     }
114 }
115 
116 void SAL_CALL StatusIndicatorInterfaceWrapper::setValue(
117     sal_Int32 nValue )
118 throw( ::com::sun::star::uno::RuntimeException )
119 {
120     Reference< XComponent > xComp( m_xStatusIndicatorImpl );
121     if ( xComp.is() )
122     {
123         ProgressBarWrapper* pProgressBar = (ProgressBarWrapper*)xComp.get();
124         if ( pProgressBar )
125             pProgressBar->setValue( nValue );
126     }
127 }
128 
129 } // namespace framework
130 
131