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