LCOV - code coverage report
Current view: top level - forms/source/richtext - rtattributes.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 40 0.0 %
Date: 2014-04-14 Functions: 0 10 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             : #ifndef INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
      21             : #define INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <svl/poolitem.hxx>
      25             : 
      26             : namespace frm
      27             : {
      28             : 
      29             :     /// the id of an attribute
      30             :     typedef sal_Int32   AttributeId;
      31             :     /// the "which id" of an item in an SfxItemSet
      32             :     typedef sal_uInt16      WhichId;
      33             :     /// a SFX slot id
      34             :     typedef sal_uInt16      SfxSlotId;
      35             :     /// a script type
      36             :     typedef sal_uInt16      ScriptType;
      37             : 
      38             :     enum AttributeCheckState
      39             :     {
      40             :         eChecked,
      41             :         eUnchecked,
      42             :         eIndetermined
      43             :     };
      44             : 
      45             :     struct AttributeState
      46             :     {
      47             :     private:
      48             :         SfxItemHandle*      pItemHandle;
      49             : 
      50             :     public:
      51             :         AttributeCheckState eSimpleState;
      52             : 
      53             :         inline          AttributeState( );
      54             :         inline explicit AttributeState( AttributeCheckState _eCheckState );
      55             :         inline          AttributeState( const AttributeState& _rSource );
      56             :         inline          ~AttributeState( );
      57             : 
      58             :         inline AttributeState& operator=( const AttributeState& _rSource );
      59             : 
      60             :         inline bool operator==( const AttributeState& _rRHS );
      61             : 
      62             :         inline const SfxPoolItem* getItem() const;
      63             :         inline void setItem( const SfxPoolItem* _pItem );
      64             :     };
      65             : 
      66           0 :     inline AttributeState::AttributeState( )
      67             :         :pItemHandle( NULL )
      68           0 :         ,eSimpleState( eIndetermined )
      69             :     {
      70           0 :     }
      71             : 
      72           0 :     inline AttributeState::AttributeState( AttributeCheckState _eCheckState )
      73             :         :pItemHandle( NULL )
      74           0 :         ,eSimpleState( _eCheckState )
      75             :     {
      76           0 :     }
      77             : 
      78           0 :     inline AttributeState::AttributeState( const AttributeState& _rSource )
      79             :         :pItemHandle( NULL )
      80           0 :         ,eSimpleState( eIndetermined )
      81             :     {
      82           0 :         operator=( _rSource );
      83           0 :     }
      84             : 
      85           0 :     inline AttributeState::~AttributeState( )
      86             :     {
      87           0 :         delete(pItemHandle);
      88           0 :     }
      89             : 
      90           0 :     inline AttributeState& AttributeState::operator=( const AttributeState& _rSource )
      91             :     {
      92           0 :         if ( &_rSource == this )
      93           0 :             return *this;
      94             : 
      95           0 :         eSimpleState = _rSource.eSimpleState;
      96           0 :         setItem( _rSource.getItem() );
      97           0 :         return *this;
      98             :     }
      99             : 
     100           0 :     inline const SfxPoolItem* AttributeState::getItem() const
     101             :     {
     102           0 :         return pItemHandle ? &pItemHandle->GetItem() : NULL;
     103             :     }
     104             : 
     105           0 :     inline void AttributeState::setItem( const SfxPoolItem* _pItem )
     106             :     {
     107           0 :         if ( pItemHandle )
     108           0 :             delete pItemHandle;
     109           0 :         if ( _pItem )
     110           0 :             pItemHandle = new SfxItemHandle( *const_cast< SfxPoolItem* >( _pItem ) );
     111             :         else
     112           0 :             pItemHandle = NULL;
     113           0 :     }
     114             : 
     115           0 :     inline bool AttributeState::operator==( const AttributeState& _rRHS )
     116             :     {
     117           0 :         if ( eSimpleState != _rRHS.eSimpleState )
     118           0 :             return false;
     119             : 
     120           0 :         if ( pItemHandle && !_rRHS.pItemHandle )
     121           0 :             return false;
     122             : 
     123           0 :         if ( !pItemHandle && _rRHS.pItemHandle )
     124           0 :             return false;
     125             : 
     126           0 :         if ( !pItemHandle && !_rRHS.pItemHandle )
     127           0 :             return true;
     128             : 
     129           0 :         return ( pItemHandle->GetItem() == _rRHS.pItemHandle->GetItem() );
     130             :     }
     131             : 
     132           0 :     class IMultiAttributeDispatcher
     133             :     {
     134             :     public:
     135             :         virtual AttributeState  getState( AttributeId _nAttributeId ) const = 0;
     136             :         virtual void            executeAttribute( AttributeId _nAttributeId, const SfxPoolItem* _pArgument ) = 0;
     137             : 
     138             :     protected:
     139           0 :         ~IMultiAttributeDispatcher() {}
     140             :     };
     141             : 
     142             : } // namespace frm
     143             : 
     144             : #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RTATTRIBUTES_HXX
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10