1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
31 //***********************************************
33 DEFINE_XINTERFACE_2(StatusIndicator
,
35 DIRECT_INTERFACE(css::lang::XTypeProvider
),
36 DIRECT_INTERFACE(css::task::XStatusIndicator
))
38 //***********************************************
40 DEFINE_XTYPEPROVIDER_2(StatusIndicator
,
41 css::lang::XTypeProvider
,
42 css::task::XStatusIndicator
)
44 //***********************************************
45 StatusIndicator::StatusIndicator(StatusIndicatorFactory
* pFactory
)
47 , ::cppu::OWeakObject( )
48 , m_xFactory (pFactory
)
52 //***********************************************
53 StatusIndicator::~StatusIndicator()
57 //***********************************************
58 void SAL_CALL
StatusIndicator::start(const OUString
& sText
,
60 throw(css::uno::RuntimeException
)
63 ReadGuard
aReadLock(m_aLock
);
64 css::uno::Reference
< css::task::XStatusIndicatorFactory
> xFactory(m_xFactory
.get(), css::uno::UNO_QUERY
);
69 StatusIndicatorFactory
* pFactory
= (StatusIndicatorFactory
*)xFactory
.get();
70 pFactory
->start(this, sText
, nRange
);
74 //***********************************************
75 void SAL_CALL
StatusIndicator::end()
76 throw(css::uno::RuntimeException
)
79 ReadGuard
aReadLock(m_aLock
);
80 css::uno::Reference
< css::task::XStatusIndicatorFactory
> xFactory(m_xFactory
.get(), css::uno::UNO_QUERY
);
85 StatusIndicatorFactory
* pFactory
= (StatusIndicatorFactory
*)xFactory
.get();
90 //***********************************************
91 void SAL_CALL
StatusIndicator::reset()
92 throw(css::uno::RuntimeException
)
95 ReadGuard
aReadLock(m_aLock
);
96 css::uno::Reference
< css::task::XStatusIndicatorFactory
> xFactory(m_xFactory
.get(), css::uno::UNO_QUERY
);
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
)
111 ReadGuard
aReadLock(m_aLock
);
112 css::uno::Reference
< css::task::XStatusIndicatorFactory
> xFactory(m_xFactory
.get(), css::uno::UNO_QUERY
);
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
)
127 ReadGuard
aReadLock(m_aLock
);
128 css::uno::Reference
< css::task::XStatusIndicatorFactory
> xFactory(m_xFactory
.get(), css::uno::UNO_QUERY
);
133 StatusIndicatorFactory
* pFactory
= (StatusIndicatorFactory
*)xFactory
.get();
134 pFactory
->setValue(this, nValue
);
138 } // namespace framework
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */