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

Generated by: LCOV version 1.10