LCOV - code coverage report
Current view: top level - unotools/source/ucbhelper - progresshandlerwrap.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 30 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 5 0.0 %
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             : #include <unotools/progresshandlerwrap.hxx>
      21             : 
      22             : namespace utl
      23             : {
      24             : 
      25             : using namespace ::com::sun::star::uno;
      26             : using namespace ::com::sun::star::task;
      27             : using namespace ::com::sun::star::ucb;
      28             : 
      29           0 : ProgressHandlerWrap::ProgressHandlerWrap( ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > xSI )
      30           0 : : m_xStatusIndicator( xSI )
      31             : {
      32           0 : }
      33             : 
      34           0 : bool getStatusFromAny_Impl( const Any& aAny, OUString& aText, sal_Int32& nNum )
      35             : {
      36           0 :     bool bNumIsSet = false;
      37             : 
      38           0 :     Sequence< Any > aSetList;
      39           0 :     if( ( aAny >>= aSetList ) && aSetList.getLength() )
      40           0 :         for( int ind = 0; ind < aSetList.getLength(); ind++ )
      41             :         {
      42           0 :             if( !bNumIsSet && ( aSetList[ind] >>= nNum ) )
      43           0 :                 bNumIsSet = true;
      44             :             else
      45           0 :                 aText.isEmpty() && ( aSetList[ind] >>= aText );
      46             :         }
      47             : 
      48           0 :     return bNumIsSet;
      49             : }
      50             : 
      51           0 : void SAL_CALL ProgressHandlerWrap::push( const Any& Status )
      52             :     throw( RuntimeException, std::exception )
      53             : {
      54           0 :     if( !m_xStatusIndicator.is() )
      55           0 :         return;
      56             : 
      57           0 :     OUString aText;
      58             :     sal_Int32 nRange;
      59             : 
      60           0 :     if( getStatusFromAny_Impl( Status, aText, nRange ) )
      61           0 :         m_xStatusIndicator->start( aText, nRange );
      62             : }
      63             : 
      64           0 : void SAL_CALL ProgressHandlerWrap::update( const Any& Status )
      65             :     throw( RuntimeException, std::exception )
      66             : {
      67           0 :     if( !m_xStatusIndicator.is() )
      68           0 :         return;
      69             : 
      70           0 :     OUString aText;
      71             :     sal_Int32 nValue;
      72             : 
      73           0 :     if( getStatusFromAny_Impl( Status, aText, nValue ) )
      74             :     {
      75           0 :         if( !aText.isEmpty() ) m_xStatusIndicator->setText( aText );
      76           0 :         m_xStatusIndicator->setValue( nValue );
      77           0 :     }
      78             : }
      79             : 
      80           0 : void SAL_CALL ProgressHandlerWrap::pop()
      81             :         throw( RuntimeException, std::exception )
      82             : {
      83           0 :     if( m_xStatusIndicator.is() )
      84           0 :         m_xStatusIndicator->end();
      85           0 : }
      86             : 
      87             : } // namespace utl
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11