LCOV - code coverage report
Current view: top level - scripting/source/basprov - basmodnode.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 42 0.0 %
Date: 2014-04-14 Functions: 0 7 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 "basmodnode.hxx"
      21             : #include "basmethnode.hxx"
      22             : #include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
      23             : #include <osl/mutex.hxx>
      24             : #include <vcl/svapp.hxx>
      25             : #include <basic/sbx.hxx>
      26             : #include <basic/sbstar.hxx>
      27             : #include <basic/sbmod.hxx>
      28             : #include <basic/sbmeth.hxx>
      29             : 
      30             : 
      31             : using namespace ::com::sun::star;
      32             : using namespace ::com::sun::star::lang;
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star::script;
      35             : 
      36             : 
      37             : 
      38             : namespace basprov
      39             : {
      40             : 
      41             : 
      42             : 
      43             :     // BasicModuleNodeImpl
      44             : 
      45             : 
      46           0 :     BasicModuleNodeImpl::BasicModuleNodeImpl( const Reference< XComponentContext >& rxContext,
      47             :         const OUString& sScriptingContext, SbModule* pModule, bool isAppScript )
      48             :         :m_xContext( rxContext )
      49             :         ,m_sScriptingContext( sScriptingContext )
      50             :         ,m_pModule( pModule )
      51           0 :         ,m_bIsAppScript( isAppScript )
      52             :     {
      53           0 :     }
      54             : 
      55             : 
      56             : 
      57           0 :     BasicModuleNodeImpl::~BasicModuleNodeImpl()
      58             :     {
      59           0 :     }
      60             : 
      61             : 
      62             :     // XBrowseNode
      63             : 
      64             : 
      65           0 :     OUString BasicModuleNodeImpl::getName(  ) throw (RuntimeException, std::exception)
      66             :     {
      67           0 :         SolarMutexGuard aGuard;
      68             : 
      69           0 :         OUString sModuleName;
      70           0 :         if ( m_pModule )
      71           0 :             sModuleName = m_pModule->GetName();
      72             : 
      73           0 :         return sModuleName;
      74             :     }
      75             : 
      76             : 
      77             : 
      78           0 :     Sequence< Reference< browse::XBrowseNode > > BasicModuleNodeImpl::getChildNodes(  ) throw (RuntimeException, std::exception)
      79             :     {
      80           0 :         SolarMutexGuard aGuard;
      81             : 
      82           0 :         Sequence< Reference< browse::XBrowseNode > > aChildNodes;
      83             : 
      84           0 :         if ( m_pModule )
      85             :         {
      86           0 :             SbxArray* pMethods = m_pModule->GetMethods();
      87           0 :             if ( pMethods )
      88             :             {
      89           0 :                 sal_Int32 nCount = pMethods->Count();
      90           0 :                 sal_Int32 nRealCount = 0;
      91           0 :                 for ( sal_Int32 i = 0; i < nCount; ++i )
      92             :                 {
      93           0 :                     SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< sal_uInt16 >( i ) ) );
      94           0 :                     if ( pMethod && !pMethod->IsHidden() )
      95           0 :                         ++nRealCount;
      96             :                 }
      97           0 :                 aChildNodes.realloc( nRealCount );
      98           0 :                 Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();
      99             : 
     100           0 :                 sal_Int32 iTarget = 0;
     101           0 :                 for ( sal_Int32 i = 0; i < nCount; ++i )
     102             :                 {
     103           0 :                     SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< sal_uInt16 >( i ) ) );
     104           0 :                     if ( pMethod && !pMethod->IsHidden() )
     105           0 :                         pChildNodes[iTarget++] = static_cast< browse::XBrowseNode* >( new BasicMethodNodeImpl( m_xContext, m_sScriptingContext, pMethod, m_bIsAppScript ) );
     106             :                 }
     107             :             }
     108             :         }
     109             : 
     110           0 :         return aChildNodes;
     111             :     }
     112             : 
     113             : 
     114             : 
     115           0 :     sal_Bool BasicModuleNodeImpl::hasChildNodes(  ) throw (RuntimeException, std::exception)
     116             :     {
     117           0 :         SolarMutexGuard aGuard;
     118             : 
     119           0 :         sal_Bool bReturn = sal_False;
     120           0 :         if ( m_pModule )
     121             :         {
     122           0 :             SbxArray* pMethods = m_pModule->GetMethods();
     123           0 :             if ( pMethods && pMethods->Count() > 0 )
     124           0 :                 bReturn = sal_True;
     125             :         }
     126             : 
     127           0 :         return bReturn;
     128             :     }
     129             : 
     130             : 
     131             : 
     132           0 :     sal_Int16 BasicModuleNodeImpl::getType(  ) throw (RuntimeException, std::exception)
     133             :     {
     134           0 :         SolarMutexGuard aGuard;
     135             : 
     136           0 :         return browse::BrowseNodeTypes::CONTAINER;
     137             :     }
     138             : 
     139             : 
     140             : 
     141             : 
     142             : }   // namespace basprov
     143             : 
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10