LCOV - code coverage report
Current view: top level - libreoffice/framework/source/helper - statusindicator.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 42 52 80.8 %
Date: 2012-12-27 Functions: 10 13 76.9 %
Legend: Lines: hit not hit

          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       31944 : 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         236 : StatusIndicator::StatusIndicator(StatusIndicatorFactory* pFactory)
      46             :     : ThreadHelpBase     (        )
      47             :     , ::cppu::OWeakObject(        )
      48         236 :     , m_xFactory         (pFactory)
      49             : {
      50         236 : }
      51             : 
      52             : //***********************************************
      53         472 : StatusIndicator::~StatusIndicator()
      54             : {
      55         472 : }
      56             : 
      57             : //***********************************************
      58         151 : void SAL_CALL StatusIndicator::start(const ::rtl::OUString& sText ,
      59             :                                            sal_Int32        nRange)
      60             :     throw(css::uno::RuntimeException)
      61             : {
      62             :     // SAFE ->
      63         151 :     ReadGuard aReadLock(m_aLock);
      64         151 :     css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
      65         151 :     aReadLock.unlock();
      66             :     // <- SAFE
      67         151 :     if (xFactory.is())
      68             :     {
      69         151 :         StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
      70         151 :         pFactory->start(this, sText, nRange);
      71         151 :     }
      72         151 : }
      73             : 
      74             : //***********************************************
      75         142 : void SAL_CALL StatusIndicator::end()
      76             :     throw(css::uno::RuntimeException)
      77             : {
      78             :     // SAFE ->
      79         142 :     ReadGuard aReadLock(m_aLock);
      80         142 :     css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
      81         142 :     aReadLock.unlock();
      82             :     // <- SAFE
      83         142 :     if (xFactory.is())
      84             :     {
      85         142 :         StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
      86         142 :         pFactory->end(this);
      87         142 :     }
      88         142 : }
      89             : 
      90             : //***********************************************
      91          18 : void SAL_CALL StatusIndicator::reset()
      92             :     throw(css::uno::RuntimeException)
      93             : {
      94             :     // SAFE ->
      95          18 :     ReadGuard aReadLock(m_aLock);
      96          18 :     css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
      97          18 :     aReadLock.unlock();
      98             :     // <- SAFE
      99          18 :     if (xFactory.is())
     100             :     {
     101          18 :         StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
     102          18 :         pFactory->reset(this);
     103          18 :     }
     104          18 : }
     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        5455 : void SAL_CALL StatusIndicator::setValue(sal_Int32 nValue)
     124             :     throw(css::uno::RuntimeException)
     125             : {
     126             :     // SAFE ->
     127        5455 :     ReadGuard aReadLock(m_aLock);
     128        5455 :     css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
     129        5455 :     aReadLock.unlock();
     130             :     // <- SAFE
     131        5455 :     if (xFactory.is())
     132             :     {
     133        5455 :         StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
     134        5455 :         pFactory->setValue(this, nValue);
     135        5455 :     }
     136        5455 : }
     137             : 
     138             : } // namespace framework
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10