LCOV - code coverage report
Current view: top level - libreoffice/forms/source/component - FormsCollection.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 58 46.6 %
Date: 2012-12-27 Functions: 8 16 50.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             : 
      21             : #include "FormsCollection.hxx"
      22             : #include "services.hxx"
      23             : #include <comphelper/sequence.hxx>
      24             : #include <tools/debug.hxx>
      25             : #include <com/sun/star/form/XForm.hpp>
      26             : #include <rtl/logfile.hxx>
      27             : 
      28             : //.........................................................................
      29             : namespace frm
      30             : {
      31             : //.........................................................................
      32             : using namespace ::com::sun::star::lang;
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star::form;
      35             : using namespace ::com::sun::star::container;
      36             : using namespace ::com::sun::star::util;
      37             : 
      38             : //------------------------------------------------------------------
      39             : DBG_NAME(OFormsCollection)
      40             : //------------------------------------------------------------------
      41          18 : InterfaceRef SAL_CALL OFormsCollection_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
      42             : {
      43          18 :     return *(new OFormsCollection(_rxFactory));
      44             : }
      45             : 
      46             : //------------------------------------------------------------------------------
      47           0 : ::rtl::OUString SAL_CALL OFormsCollection::getServiceName() throw(RuntimeException)
      48             : {
      49           0 :     return FRM_SUN_FORMS_COLLECTION;
      50             : }
      51             : 
      52             : //------------------------------------------------------------------------------
      53           0 : Sequence< sal_Int8 > SAL_CALL OFormsCollection::getImplementationId(  ) throw(RuntimeException)
      54             : {
      55           0 :     return OImplementationIds::getImplementationId(getTypes());
      56             : }
      57             : 
      58             : //------------------------------------------------------------------------------
      59           0 : Sequence<Type> SAL_CALL OFormsCollection::getTypes() throw(RuntimeException)
      60             : {
      61           0 :     return concatSequences(OInterfaceContainer::getTypes(), FormsCollectionComponentBase::getTypes(), OFormsCollection_BASE::getTypes());
      62             : }
      63             : 
      64             : //------------------------------------------------------------------
      65          18 : OFormsCollection::OFormsCollection(const Reference<XMultiServiceFactory>& _rxFactory)
      66             :     :FormsCollectionComponentBase( m_aMutex )
      67          18 :     ,OInterfaceContainer( _rxFactory, m_aMutex, XForm::static_type() )
      68          36 :     ,OFormsCollection_BASE()
      69             : {
      70             :     DBG_CTOR(OFormsCollection, NULL);
      71          18 : }
      72             : 
      73             : //------------------------------------------------------------------------------
      74           0 : OFormsCollection::OFormsCollection( const OFormsCollection& _cloneSource )
      75             :     :FormsCollectionComponentBase( m_aMutex )
      76             :     ,OInterfaceContainer( m_aMutex, _cloneSource )
      77           0 :     ,OFormsCollection_BASE()
      78             : {
      79             :     DBG_CTOR( OFormsCollection, NULL );
      80           0 : }
      81             : 
      82             : //------------------------------------------------------------------------------
      83          27 : OFormsCollection::~OFormsCollection()
      84             : {
      85             :     DBG_DTOR(OFormsCollection, NULL);
      86           9 :     if (!FormsCollectionComponentBase::rBHelper.bDisposed)
      87             :     {
      88           0 :         acquire();
      89           0 :         dispose();
      90             :     }
      91          18 : }
      92             : 
      93             : //------------------------------------------------------------------------------
      94         320 : Any SAL_CALL OFormsCollection::queryAggregation(const Type& _rType) throw(RuntimeException)
      95             : {
      96         320 :     Any aReturn = OFormsCollection_BASE::queryInterface(_rType);
      97         320 :     if (!aReturn.hasValue())
      98             :     {
      99         246 :         aReturn = OInterfaceContainer::queryInterface(_rType);
     100             : 
     101         246 :         if (!aReturn.hasValue())
     102          87 :             aReturn = FormsCollectionComponentBase::queryAggregation(_rType);
     103             :     }
     104             : 
     105         320 :     return aReturn;
     106             : }
     107             : 
     108             : //------------------------------------------------------------------------------
     109           0 : ::rtl::OUString SAL_CALL OFormsCollection::getImplementationName() throw(RuntimeException)
     110             : {
     111           0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.forms.OFormsCollection") );
     112             : }
     113             : 
     114             : //------------------------------------------------------------------------------
     115           0 : sal_Bool SAL_CALL OFormsCollection::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
     116             : {
     117           0 :     Sequence<rtl::OUString> aSupported = getSupportedServiceNames();
     118           0 :     const rtl::OUString* pSupported = aSupported.getConstArray();
     119           0 :     for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported)
     120           0 :         if (pSupported->equals(_rServiceName))
     121           0 :             return sal_True;
     122           0 :     return sal_False;
     123             : }
     124             : 
     125             : //------------------------------------------------------------------------------
     126           0 : StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(RuntimeException)
     127             : {
     128           0 :     StringSequence aReturn(2);
     129             : 
     130           0 :     aReturn.getArray()[0] = FRM_SUN_FORMS_COLLECTION;
     131           0 :     aReturn.getArray()[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.FormComponents") );
     132             : 
     133           0 :     return aReturn;
     134             : }
     135             : 
     136             : // XCloneable
     137             : //------------------------------------------------------------------------------
     138           0 : Reference< XCloneable > SAL_CALL OFormsCollection::createClone(  ) throw (RuntimeException)
     139             : {
     140           0 :     OFormsCollection* pClone = new OFormsCollection( *this );
     141           0 :     osl_atomic_increment( &pClone->m_refCount );
     142           0 :     pClone->clonedFrom( *this );
     143           0 :     osl_atomic_decrement( &pClone->m_refCount );
     144           0 :     return pClone;
     145             : }
     146             : 
     147             : // OComponentHelper
     148             : //------------------------------------------------------------------------------
     149           9 : void OFormsCollection::disposing()
     150             : {
     151             :     {
     152             :         RTL_LOGFILE_CONTEXT( aLogger, "forms::OFormsCollection::disposing" );
     153           9 :         OInterfaceContainer::disposing();
     154             :     }
     155           9 :     FormsCollectionComponentBase::disposing();
     156           9 :     m_xParent = NULL;
     157           9 : }
     158             : 
     159             : //XChild
     160             : //------------------------------------------------------------------------------
     161          17 : void OFormsCollection::setParent(const InterfaceRef& Parent) throw( NoSupportException, RuntimeException )
     162             : {
     163          17 :     ::osl::MutexGuard aGuard( m_aMutex );
     164          17 :     m_xParent = Parent;
     165          17 : }
     166             : 
     167             : //------------------------------------------------------------------------------
     168          13 : InterfaceRef  OFormsCollection::getParent() throw( RuntimeException )
     169             : {
     170          13 :     return m_xParent;
     171             : }
     172             : 
     173             : //.........................................................................
     174             : }   // namespace frm
     175             : //.........................................................................
     176             : 
     177             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10