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