LCOV - code coverage report
Current view: top level - libreoffice/ucb/source/ucp/file - filprp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 42 64.3 %
Date: 2012-12-27 Functions: 6 12 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             : #include "shell.hxx"
      21             : #include "prov.hxx"
      22             : #include "filprp.hxx"
      23             : 
      24             : using namespace fileaccess;
      25             : using namespace com::sun::star;
      26             : using namespace com::sun::star::uno;
      27             : using namespace com::sun::star::ucb;
      28             : 
      29             : 
      30             : #include "filinl.hxx"
      31             : 
      32             : 
      33        1431 : XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const rtl::OUString& aUnqPath )
      34             :     : m_pMyShell( pMyShell ),
      35             :       m_xProvider( pMyShell->m_pProvider ),
      36             :       m_count( 0 ),
      37        1431 :       m_seq( 0 )
      38             : {
      39        1431 :     m_pMyShell->m_pProvider->acquire();
      40             : 
      41        1431 :     shell::ContentMap::iterator it = m_pMyShell->m_aContent.find( aUnqPath );
      42             : 
      43        1431 :     shell::PropertySet& properties = *(it->second.properties);
      44        1431 :     shell::PropertySet::iterator it1 = properties.begin();
      45             : 
      46        1431 :     m_seq.realloc( properties.size() );
      47             : 
      48       24327 :     while( it1 != properties.end() )
      49             :     {
      50       42930 :         m_seq[ m_count++ ] = beans::Property( it1->getPropertyName(),
      51       21465 :                                               it1->getHandle(),
      52       21465 :                                               it1->getType(),
      53       64395 :                                               it1->getAttributes() );
      54       21465 :         ++it1;
      55             :     }
      56        1431 : }
      57             : 
      58             : 
      59           0 : XPropertySetInfo_impl::XPropertySetInfo_impl( shell* pMyShell,const Sequence< beans::Property >& seq )
      60             :     : m_pMyShell( pMyShell ),
      61           0 :       m_count( seq.getLength() ),
      62           0 :       m_seq( seq )
      63             : {
      64           0 :     m_pMyShell->m_pProvider->acquire();
      65           0 : }
      66             : 
      67             : 
      68        4293 : XPropertySetInfo_impl::~XPropertySetInfo_impl()
      69             : {
      70        1431 :     m_pMyShell->m_pProvider->release();
      71        2862 : }
      72             : 
      73             : 
      74             : void SAL_CALL
      75        4293 : XPropertySetInfo_impl::acquire(
      76             :                   void )
      77             :   throw()
      78             : {
      79        4293 :   OWeakObject::acquire();
      80        4293 : }
      81             : 
      82             : 
      83             : void SAL_CALL
      84        4293 : XPropertySetInfo_impl::release(
      85             :               void )
      86             :   throw()
      87             : {
      88        4293 :   OWeakObject::release();
      89        4293 : }
      90             : 
      91             : 
      92             : 
      93           0 : XTYPEPROVIDER_IMPL_2( XPropertySetInfo_impl,
      94             :                          lang::XTypeProvider,
      95             :                       beans::XPropertySetInfo )
      96             : 
      97             : 
      98             : Any SAL_CALL
      99           0 : XPropertySetInfo_impl::queryInterface(
     100             :                      const Type& rType )
     101             :   throw( RuntimeException )
     102             : {
     103             :   Any aRet = cppu::queryInterface( rType,
     104             :                     (static_cast< lang::XTypeProvider* >(this)),
     105           0 :                     (static_cast< beans::XPropertySetInfo* >(this)) );
     106           0 :   return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
     107             : }
     108             : 
     109             : 
     110             : beans::Property SAL_CALL
     111           0 : XPropertySetInfo_impl::getPropertyByName(
     112             :                      const rtl::OUString& aName )
     113             :   throw( beans::UnknownPropertyException,
     114             :      RuntimeException)
     115             : {
     116           0 :   for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
     117           0 :     if( m_seq[i].Name == aName ) return m_seq[i];
     118             : 
     119           0 :   throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
     120             : }
     121             : 
     122             : 
     123             : 
     124             : Sequence< beans::Property > SAL_CALL
     125           0 : XPropertySetInfo_impl::getProperties(
     126             :                     void )
     127             :   throw( RuntimeException )
     128             : {
     129           0 :   return m_seq;
     130             : }
     131             : 
     132             : 
     133             : sal_Bool SAL_CALL
     134        2454 : XPropertySetInfo_impl::hasPropertyByName(
     135             :                      const rtl::OUString& aName )
     136             :   throw( RuntimeException )
     137             : {
     138       39264 :   for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
     139       36810 :     if( m_seq[i].Name == aName ) return true;
     140        2454 :   return false;
     141             : }
     142             : 
     143             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10