bump product version to 4.1.6.2
[LibreOffice.git] / framework / source / helper / statusindicator.cxx
blob02df7c03973c33190f32fbfba0f910be9a6f27e5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 //_______________________________________________
22 // include files of own module
23 #include <helper/statusindicator.hxx>
24 #include <threadhelp/readguard.hxx>
25 #include <threadhelp/writeguard.hxx>
28 namespace framework{
31 //***********************************************
32 // XInterface
33 DEFINE_XINTERFACE_2(StatusIndicator ,
34 OWeakObject ,
35 DIRECT_INTERFACE(css::lang::XTypeProvider ),
36 DIRECT_INTERFACE(css::task::XStatusIndicator))
38 //***********************************************
39 // XInterface
40 DEFINE_XTYPEPROVIDER_2(StatusIndicator ,
41 css::lang::XTypeProvider ,
42 css::task::XStatusIndicator)
44 //***********************************************
45 StatusIndicator::StatusIndicator(StatusIndicatorFactory* pFactory)
46 : ThreadHelpBase ( )
47 , ::cppu::OWeakObject( )
48 , m_xFactory (pFactory)
52 //***********************************************
53 StatusIndicator::~StatusIndicator()
57 //***********************************************
58 void SAL_CALL StatusIndicator::start(const OUString& sText ,
59 sal_Int32 nRange)
60 throw(css::uno::RuntimeException)
62 // SAFE ->
63 ReadGuard aReadLock(m_aLock);
64 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
65 aReadLock.unlock();
66 // <- SAFE
67 if (xFactory.is())
69 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
70 pFactory->start(this, sText, nRange);
74 //***********************************************
75 void SAL_CALL StatusIndicator::end()
76 throw(css::uno::RuntimeException)
78 // SAFE ->
79 ReadGuard aReadLock(m_aLock);
80 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
81 aReadLock.unlock();
82 // <- SAFE
83 if (xFactory.is())
85 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
86 pFactory->end(this);
90 //***********************************************
91 void SAL_CALL StatusIndicator::reset()
92 throw(css::uno::RuntimeException)
94 // SAFE ->
95 ReadGuard aReadLock(m_aLock);
96 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
97 aReadLock.unlock();
98 // <- SAFE
99 if (xFactory.is())
101 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
102 pFactory->reset(this);
106 //***********************************************
107 void SAL_CALL StatusIndicator::setText(const OUString& sText)
108 throw(css::uno::RuntimeException)
110 // SAFE ->
111 ReadGuard aReadLock(m_aLock);
112 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
113 aReadLock.unlock();
114 // <- SAFE
115 if (xFactory.is())
117 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
118 pFactory->setText(this, sText);
122 //***********************************************
123 void SAL_CALL StatusIndicator::setValue(sal_Int32 nValue)
124 throw(css::uno::RuntimeException)
126 // SAFE ->
127 ReadGuard aReadLock(m_aLock);
128 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
129 aReadLock.unlock();
130 // <- SAFE
131 if (xFactory.is())
133 StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
134 pFactory->setValue(this, nValue);
138 } // namespace framework
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */