1*6d739b60SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6d739b60SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6d739b60SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6d739b60SAndrew Rist * distributed with this work for additional information 6*6d739b60SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6d739b60SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6d739b60SAndrew Rist * "License"); you may not use this file except in compliance 9*6d739b60SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*6d739b60SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*6d739b60SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6d739b60SAndrew Rist * software distributed under the License is distributed on an 15*6d739b60SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6d739b60SAndrew Rist * KIND, either express or implied. See the License for the 17*6d739b60SAndrew Rist * specific language governing permissions and limitations 18*6d739b60SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*6d739b60SAndrew Rist *************************************************************/ 21*6d739b60SAndrew Rist 22*6d739b60SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_framework.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_______________________________________________ 28cdf0e10cSrcweir // include files of own module 29cdf0e10cSrcweir #include <helper/statusindicator.hxx> 30cdf0e10cSrcweir #include <threadhelp/readguard.hxx> 31cdf0e10cSrcweir #include <threadhelp/writeguard.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir //_______________________________________________ 34cdf0e10cSrcweir // namespace 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace framework{ 37cdf0e10cSrcweir 38cdf0e10cSrcweir //_______________________________________________ 39cdf0e10cSrcweir // declarations 40cdf0e10cSrcweir 41cdf0e10cSrcweir //*********************************************** 42cdf0e10cSrcweir // XInterface 43cdf0e10cSrcweir DEFINE_XINTERFACE_2(StatusIndicator , 44cdf0e10cSrcweir OWeakObject , 45cdf0e10cSrcweir DIRECT_INTERFACE(css::lang::XTypeProvider ), 46cdf0e10cSrcweir DIRECT_INTERFACE(css::task::XStatusIndicator)) 47cdf0e10cSrcweir 48cdf0e10cSrcweir //*********************************************** 49cdf0e10cSrcweir // XInterface 50cdf0e10cSrcweir DEFINE_XTYPEPROVIDER_2(StatusIndicator , 51cdf0e10cSrcweir css::lang::XTypeProvider , 52cdf0e10cSrcweir css::task::XStatusIndicator) 53cdf0e10cSrcweir 54cdf0e10cSrcweir //*********************************************** 55cdf0e10cSrcweir StatusIndicator::StatusIndicator(StatusIndicatorFactory* pFactory) 56cdf0e10cSrcweir : ThreadHelpBase ( ) 57cdf0e10cSrcweir , ::cppu::OWeakObject( ) 58cdf0e10cSrcweir , m_xFactory (pFactory) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir //*********************************************** 63cdf0e10cSrcweir StatusIndicator::~StatusIndicator() 64cdf0e10cSrcweir { 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir //*********************************************** 68cdf0e10cSrcweir void SAL_CALL StatusIndicator::start(const ::rtl::OUString& sText , 69cdf0e10cSrcweir sal_Int32 nRange) 70cdf0e10cSrcweir throw(css::uno::RuntimeException) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir // SAFE -> 73cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 74cdf0e10cSrcweir css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 75cdf0e10cSrcweir aReadLock.unlock(); 76cdf0e10cSrcweir // <- SAFE 77cdf0e10cSrcweir if (xFactory.is()) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 80cdf0e10cSrcweir pFactory->start(this, sText, nRange); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir } 83cdf0e10cSrcweir 84cdf0e10cSrcweir //*********************************************** 85cdf0e10cSrcweir void SAL_CALL StatusIndicator::end() 86cdf0e10cSrcweir throw(css::uno::RuntimeException) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir // SAFE -> 89cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 90cdf0e10cSrcweir css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 91cdf0e10cSrcweir aReadLock.unlock(); 92cdf0e10cSrcweir // <- SAFE 93cdf0e10cSrcweir if (xFactory.is()) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 96cdf0e10cSrcweir pFactory->end(this); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir //*********************************************** 101cdf0e10cSrcweir void SAL_CALL StatusIndicator::reset() 102cdf0e10cSrcweir throw(css::uno::RuntimeException) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir // SAFE -> 105cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 106cdf0e10cSrcweir css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 107cdf0e10cSrcweir aReadLock.unlock(); 108cdf0e10cSrcweir // <- SAFE 109cdf0e10cSrcweir if (xFactory.is()) 110cdf0e10cSrcweir { 111cdf0e10cSrcweir StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 112cdf0e10cSrcweir pFactory->reset(this); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir //*********************************************** 117cdf0e10cSrcweir void SAL_CALL StatusIndicator::setText(const ::rtl::OUString& sText) 118cdf0e10cSrcweir throw(css::uno::RuntimeException) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir // SAFE -> 121cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 122cdf0e10cSrcweir css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 123cdf0e10cSrcweir aReadLock.unlock(); 124cdf0e10cSrcweir // <- SAFE 125cdf0e10cSrcweir if (xFactory.is()) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 128cdf0e10cSrcweir pFactory->setText(this, sText); 129cdf0e10cSrcweir } 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir //*********************************************** 133cdf0e10cSrcweir void SAL_CALL StatusIndicator::setValue(sal_Int32 nValue) 134cdf0e10cSrcweir throw(css::uno::RuntimeException) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir // SAFE -> 137cdf0e10cSrcweir ReadGuard aReadLock(m_aLock); 138cdf0e10cSrcweir css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY); 139cdf0e10cSrcweir aReadLock.unlock(); 140cdf0e10cSrcweir // <- SAFE 141cdf0e10cSrcweir if (xFactory.is()) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get(); 144cdf0e10cSrcweir pFactory->setValue(this, nValue); 145cdf0e10cSrcweir } 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir } // namespace framework 149