LCOV - code coverage report
Current view: top level - forms/source/misc - componenttools.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 35 0.0 %
Date: 2014-04-14 Functions: 0 8 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 "componenttools.hxx"
      21             : 
      22             : #include <com/sun/star/container/XChild.hpp>
      23             : 
      24             : #include <algorithm>
      25             : #include <iterator>
      26             : 
      27             : 
      28             : namespace frm
      29             : {
      30             : 
      31             : 
      32             :     using ::com::sun::star::frame::XModel;
      33             :     using ::com::sun::star::uno::XInterface;
      34             :     using ::com::sun::star::uno::Reference;
      35             :     using ::com::sun::star::uno::UNO_QUERY;
      36             :     using ::com::sun::star::container::XChild;
      37             : 
      38             : 
      39             :     //= TypeBag
      40             : 
      41             : 
      42           0 :     TypeBag::TypeBag( const TypeSequence& _rTypes1 )
      43             :     {
      44           0 :         addTypes( _rTypes1 );
      45           0 :     }
      46             : 
      47             : 
      48           0 :     TypeBag::TypeBag( const TypeSequence& _rTypes1, const TypeSequence& _rTypes2 )
      49             :     {
      50           0 :         addTypes( _rTypes1 );
      51           0 :         addTypes( _rTypes2 );
      52           0 :     }
      53             : 
      54             : 
      55           0 :     TypeBag::TypeBag( const TypeSequence& _rTypes1, const TypeSequence& _rTypes2, const TypeSequence& _rTypes3 )
      56             :     {
      57           0 :         addTypes( _rTypes1 );
      58           0 :         addTypes( _rTypes2 );
      59           0 :         addTypes( _rTypes3 );
      60           0 :     }
      61             : 
      62             : 
      63           0 :     void TypeBag::addTypes( const TypeSequence& _rTypes )
      64             :     {
      65             :         ::std::copy(
      66             :             _rTypes.getConstArray(),
      67           0 :             _rTypes.getConstArray() + _rTypes.getLength(),
      68             :             ::std::insert_iterator< TypeSet >( m_aTypes, m_aTypes.begin() )
      69           0 :         );
      70           0 :     }
      71             : 
      72             : 
      73           0 :     void TypeBag::addType( const Type& i_rType )
      74             :     {
      75           0 :         m_aTypes.insert( i_rType );
      76           0 :     }
      77             : 
      78             : 
      79           0 :     void TypeBag::removeType( const TypeBag::Type& i_rType )
      80             :     {
      81           0 :         m_aTypes.erase( i_rType );
      82           0 :     }
      83             : 
      84             : 
      85           0 :     TypeBag::TypeSequence TypeBag::getTypes() const
      86             :     {
      87           0 :         TypeSequence aTypes( m_aTypes.size() );
      88           0 :         ::std::copy( m_aTypes.begin(), m_aTypes.end(), aTypes.getArray() );
      89           0 :         return aTypes;
      90             :     }
      91             : 
      92             : 
      93           0 :     Reference< XModel >  getXModel( const Reference< XInterface >& _rxComponent )
      94             :     {
      95           0 :         Reference< XInterface > xParent = _rxComponent;
      96           0 :         Reference< XModel > xModel( xParent, UNO_QUERY );
      97           0 :         while ( xParent.is() && !xModel.is() )
      98             :         {
      99           0 :             Reference< XChild > xChild( xParent, UNO_QUERY );
     100           0 :             xParent.set( xChild.is() ? xChild->getParent() : Reference< XInterface >(), UNO_QUERY );
     101           0 :             xModel.set( xParent, UNO_QUERY );
     102           0 :         }
     103           0 :         return xModel;
     104             :     }
     105             : 
     106             : 
     107             : } // namespace frm
     108             : 
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10