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 // include files of own module 29 #include <helper/statusindicator.hxx> 30 #include <threadhelp/readguard.hxx> 31 #include <threadhelp/writeguard.hxx> 32 33 //_______________________________________________ 34 // namespace 35 36 namespace framework{ 37 38 //_______________________________________________ 39 // declarations 40 41 //*********************************************** 42 // XInterface 43 DEFINE_XINTERFACE_2(StatusIndicator , 44 OWeakObject , 45 DIRECT_INTERFACE(css::lang::XTypeProvider ), 46 DIRECT_INTERFACE(css::task::XStatusIndicator)) 47 48 //*********************************************** 49 // XInterface 50 DEFINE_XTYPEPROVIDER_2(StatusIndicator , 51 css::lang::XTypeProvider , 52 css::task::XStatusIndicator) 53 54 //*********************************************** 55 StatusIndicator::StatusIndicator(StatusIndicatorFactory* pFactory) 56 : ThreadHelpBase ( ) 57 , ::cppu::OWeakObject( ) 58 , m_xFactory (pFactory) 59 { 60 } 61 62 //*********************************************** 63 StatusIndicator::~StatusIndicator() 64 { 65 } 66 67 //*********************************************** 68 void SAL_CALL StatusIndicator::start(const ::rtl::OUString& sText , 69 sal_Int32 nRange) 70 throw(css::uno::RuntimeException) 71 { 72 // SAFE -> 73 ReadGuard aReadLock(m_aLock); 74 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 75 aReadLock.unlock(); 76 // <- SAFE 77 if (xFactory.is()) 78 { 79 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 80 pFactory->start(this, sText, nRange); 81 } 82 } 83 84 //*********************************************** 85 void SAL_CALL StatusIndicator::end() 86 throw(css::uno::RuntimeException) 87 { 88 // SAFE -> 89 ReadGuard aReadLock(m_aLock); 90 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 91 aReadLock.unlock(); 92 // <- SAFE 93 if (xFactory.is()) 94 { 95 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 96 pFactory->end(this); 97 } 98 } 99 100 //*********************************************** 101 void SAL_CALL StatusIndicator::reset() 102 throw(css::uno::RuntimeException) 103 { 104 // SAFE -> 105 ReadGuard aReadLock(m_aLock); 106 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 107 aReadLock.unlock(); 108 // <- SAFE 109 if (xFactory.is()) 110 { 111 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 112 pFactory->reset(this); 113 } 114 } 115 116 //*********************************************** 117 void SAL_CALL StatusIndicator::setText(const ::rtl::OUString& sText) 118 throw(css::uno::RuntimeException) 119 { 120 // SAFE -> 121 ReadGuard aReadLock(m_aLock); 122 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 123 aReadLock.unlock(); 124 // <- SAFE 125 if (xFactory.is()) 126 { 127 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 128 pFactory->setText(this, sText); 129 } 130 } 131 132 //*********************************************** 133 void SAL_CALL StatusIndicator::setValue(sal_Int32 nValue) 134 throw(css::uno::RuntimeException) 135 { 136 // SAFE -> 137 ReadGuard aReadLock(m_aLock); 138 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 139 aReadLock.unlock(); 140 // <- SAFE 141 if (xFactory.is()) 142 { 143 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 144 pFactory->setValue(this, nValue); 145 } 146 } 147 148 } // namespace framework 149