LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svl - itemprop.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 16 100.0 %
Date: 2013-07-09 Functions: 8 9 88.9 %
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             : #ifndef _SFX_ITEMPROP_HXX
      20             : #define _SFX_ITEMPROP_HXX
      21             : 
      22             : #include "svl/svldllapi.h"
      23             : #include <tools/solar.h>
      24             : #include <svl/itemset.hxx>
      25             : #include <cppuhelper/implbase1.hxx>
      26             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      27             : #include <com/sun/star/beans/PropertyState.hpp>
      28             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      29             : #include <vector>
      30             : 
      31             : // UNO III - Implementation
      32             : #define MAP_CHAR_LEN(cchar) cchar, sizeof(cchar) - 1
      33             : 
      34             : struct SfxItemPropertyMapEntry
      35             : {
      36             :     const char*                         pName;
      37             :     sal_uInt16                          nNameLen;
      38             :     sal_uInt16                          nWID;
      39             :     const com::sun::star::uno::Type*    pType;
      40             :     long                                nFlags;
      41             :     sal_uInt8                           nMemberId;
      42             : 
      43             : };
      44             : 
      45             : struct SfxItemPropertySimpleEntry
      46             : {
      47             :     sal_uInt16                          nWID;
      48             :     const com::sun::star::uno::Type*    pType;
      49             :     long                                nFlags;
      50             :     sal_uInt8                           nMemberId;
      51             : 
      52      210291 :     SfxItemPropertySimpleEntry()
      53             :         : nWID( 0 )
      54             :         , pType( 0 )
      55             :         , nFlags( 0 )
      56      210291 :         , nMemberId( 0 )
      57             :         {
      58      210291 :         }
      59             : 
      60       71838 :     SfxItemPropertySimpleEntry(sal_uInt16 _nWID, const com::sun::star::uno::Type* _pType,
      61             :                                long _nFlags, sal_uInt8 _nMemberId)
      62             :         : nWID(      _nWID )
      63             :         , pType(     _pType )
      64             :         , nFlags(    _nFlags )
      65       71838 :         , nMemberId( _nMemberId )
      66             :         {
      67       71838 :         }
      68             : 
      69      138580 :     SfxItemPropertySimpleEntry( const SfxItemPropertyMapEntry* pMapEntry )
      70             :         : nWID( pMapEntry->nWID )
      71             :         , pType( pMapEntry->pType )
      72             :         , nFlags( pMapEntry->nFlags )
      73      138580 :         , nMemberId( pMapEntry->nMemberId )
      74             :         {
      75      138580 :         }
      76             : 
      77             : };
      78      229431 : struct SfxItemPropertyNamedEntry : public SfxItemPropertySimpleEntry
      79             : {
      80             :     OUString sName;
      81       76477 :     SfxItemPropertyNamedEntry( const OUString& rName, const SfxItemPropertySimpleEntry& rSimpleEntry)
      82             :         : SfxItemPropertySimpleEntry( rSimpleEntry )
      83       76477 :         , sName( rName )
      84             : {
      85       76477 : }
      86             : 
      87             : };
      88             : typedef std::vector< SfxItemPropertyNamedEntry > PropertyEntryVector_t;
      89             : class SfxItemPropertyMap_Impl;
      90             : class SVL_DLLPUBLIC SfxItemPropertyMap
      91             : {
      92             :     SfxItemPropertyMap_Impl* m_pImpl;
      93             : public:
      94             :     SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries );
      95             :     SfxItemPropertyMap( const SfxItemPropertyMap& rSource );
      96             :     ~SfxItemPropertyMap();
      97             : 
      98             :     const SfxItemPropertySimpleEntry*  getByName( const OUString &rName ) const;
      99             :     com::sun::star::uno::Sequence< com::sun::star::beans::Property > getProperties() const;
     100             :     com::sun::star::beans::Property getPropertyByName( const OUString rName ) const
     101             :         throw( ::com::sun::star::beans::UnknownPropertyException );
     102             :     bool hasPropertyByName( const OUString& rName ) const;
     103             : 
     104             :     void mergeProperties( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rPropSeq );
     105             :     PropertyEntryVector_t getPropertyEntries() const;
     106             :     sal_uInt32 getSize() const;
     107             : 
     108             : };
     109             : 
     110             : class SVL_DLLPUBLIC SfxItemPropertySet
     111             : {
     112             :     SfxItemPropertyMap                                                              m_aMap;
     113             :     mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo;
     114             : protected:
     115             :     virtual sal_Bool            FillItem(SfxItemSet& rSet, sal_uInt16 nWhich, sal_Bool bGetProperty) const;
     116             : 
     117             : public:
     118        5126 :                             SfxItemPropertySet( const SfxItemPropertyMapEntry *pMap ) :
     119        5126 :                                 m_aMap(pMap) {}
     120             :                             virtual ~SfxItemPropertySet();
     121             : 
     122             :     void getPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
     123             :                                           const SfxItemSet& rSet,
     124             :                                           com::sun::star::uno::Any& rAny) const
     125             :                                           throw(::com::sun::star::uno::RuntimeException);
     126             :     void getPropertyValue( const OUString &rName,
     127             :                                             const SfxItemSet& rSet,
     128             :                                             com::sun::star::uno::Any& rAny) const
     129             :                                             throw(::com::sun::star::uno::RuntimeException,
     130             :                                                     ::com::sun::star::beans::UnknownPropertyException);
     131             :     com::sun::star::uno::Any
     132             :         getPropertyValue( const OUString &rName,
     133             :                                             const SfxItemSet& rSet ) const
     134             :                                             throw(::com::sun::star::uno::RuntimeException,
     135             :                                                     ::com::sun::star::beans::UnknownPropertyException);
     136             :     void                    setPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
     137             :                                           const com::sun::star::uno::Any& aVal,
     138             :                                           SfxItemSet& rSet ) const
     139             :                                           throw(::com::sun::star::uno::RuntimeException,
     140             :                                                   com::sun::star::lang::IllegalArgumentException);
     141             :     void                    setPropertyValue( const OUString& rPropertyName,
     142             :                                             const com::sun::star::uno::Any& aVal,
     143             :                                             SfxItemSet& rSet ) const
     144             :                                             throw(::com::sun::star::uno::RuntimeException,
     145             :                                                     com::sun::star::lang::IllegalArgumentException,
     146             :                                                     ::com::sun::star::beans::UnknownPropertyException);
     147             : 
     148             :     com::sun::star::beans::PropertyState
     149             :         getPropertyState(const OUString& rName, const SfxItemSet& rSet)const
     150             :                                     throw(com::sun::star::beans::UnknownPropertyException);
     151             :     com::sun::star::beans::PropertyState
     152             :         getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const
     153             :                                     throw();
     154             : 
     155             :     com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo>
     156             :         getPropertySetInfo() const;
     157      108760 :     const SfxItemPropertyMap& getPropertyMap() const {return m_aMap;}
     158             : };
     159             : 
     160             : struct SfxItemPropertySetInfo_Impl;
     161             : class SVL_DLLPUBLIC SfxItemPropertySetInfo : public
     162             :     cppu::WeakImplHelper1<com::sun::star::beans::XPropertySetInfo>
     163             : {
     164             :     SfxItemPropertySetInfo_Impl* m_pImpl;
     165             : 
     166             : public:
     167             :     SfxItemPropertySetInfo(const SfxItemPropertyMap &rMap );
     168             :     SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries );
     169             :     virtual ~SfxItemPropertySetInfo();
     170             : 
     171             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
     172             :         getProperties(  )
     173             :             throw(::com::sun::star::uno::RuntimeException);
     174             : 
     175             :     virtual ::com::sun::star::beans::Property SAL_CALL
     176             :         getPropertyByName( const OUString& aName )
     177             :             throw(::com::sun::star::beans::UnknownPropertyException,
     178             :                     ::com::sun::star::uno::RuntimeException);
     179             : 
     180             :     virtual sal_Bool SAL_CALL
     181             :         hasPropertyByName( const OUString& Name )
     182             :             throw(::com::sun::star::uno::RuntimeException);
     183             : 
     184             : };
     185             : 
     186             : class SVL_DLLPUBLIC SfxExtItemPropertySetInfo: public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySetInfo >
     187             : {
     188             :     SfxItemPropertyMap aExtMap;
     189             : public:
     190             :                             SfxExtItemPropertySetInfo(
     191             :                                 const SfxItemPropertyMapEntry *pMap,
     192             :                                 const com::sun::star::uno::Sequence<com::sun::star::beans::Property>& rPropSeq );
     193             :                             virtual ~SfxExtItemPropertySetInfo();
     194             : 
     195             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
     196             :         getProperties(  )
     197             :             throw(::com::sun::star::uno::RuntimeException);
     198             : 
     199             :     virtual ::com::sun::star::beans::Property SAL_CALL
     200             :         getPropertyByName( const OUString& aName )
     201             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     202             : 
     203             :     virtual sal_Bool SAL_CALL
     204             :         hasPropertyByName( const OUString& Name )
     205             :             throw(::com::sun::star::uno::RuntimeException);
     206             : };
     207             : 
     208             : #endif
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10