LCOV - code coverage report
Current view: top level - forms/source/richtext - rtattributehandler.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 185 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 31 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 "rtattributehandler.hxx"
      21             : 
      22             : #include <svx/svxids.hrc>
      23             : #include <editeng/eeitem.hxx>
      24             : #include <svl/itemset.hxx>
      25             : #include <svl/itempool.hxx>
      26             : #include <tools/mapunit.hxx>
      27             : #include <vcl/mapmod.hxx>
      28             : #include <vcl/outdev.hxx>
      29             : 
      30             : #include <editeng/adjustitem.hxx>
      31             : #include <editeng/wghtitem.hxx>
      32             : #include <editeng/escapementitem.hxx>
      33             : #include <editeng/lspcitem.hxx>
      34             : #include <editeng/fhgtitem.hxx>
      35             : #include <editeng/frmdiritem.hxx>
      36             : #include <editeng/scripttypeitem.hxx>
      37             : 
      38             : 
      39             : namespace frm
      40             : {
      41             : 
      42             : 
      43           0 :     AttributeHandler::AttributeHandler( AttributeId _nAttributeId, WhichId _nWhichId )
      44             :         :m_nAttribute( _nAttributeId )
      45           0 :         ,m_nWhich    ( _nWhichId     )
      46             :     {
      47           0 :     }
      48             : 
      49             : 
      50           0 :     AttributeHandler::~AttributeHandler()
      51             :     {
      52           0 :     }
      53             : 
      54             : 
      55           0 :     AttributeId AttributeHandler::getAttributeId( ) const
      56             :     {
      57           0 :         return getAttribute();
      58             :     }
      59             : 
      60             : 
      61           0 :     AttributeCheckState AttributeHandler::implGetCheckState( const SfxPoolItem& /*_rItem*/ ) const
      62             :     {
      63             :         OSL_FAIL( "AttributeHandler::implGetCheckState: not to be called!" );
      64           0 :         return eIndetermined;
      65             :     }
      66             : 
      67             : 
      68           0 :     void AttributeHandler::putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, SvtScriptType _nForScriptType ) const
      69             :     {
      70           0 :         SvxScriptSetItem aSetItem( (WhichId)getAttributeId(), *_rAttribs.GetPool() );
      71           0 :         aSetItem.PutItemForScriptType( _nForScriptType, _rItem );
      72           0 :         _rAttribs.Put( aSetItem.GetItemSet(), false );
      73           0 :     }
      74             : 
      75             : 
      76           0 :     AttributeCheckState AttributeHandler::getCheckState( const SfxItemSet& _rAttribs ) const
      77             :     {
      78           0 :         AttributeCheckState eSimpleState( eIndetermined );
      79           0 :         const SfxPoolItem* pItem = _rAttribs.GetItem( getWhich() );
      80           0 :         if ( pItem )
      81           0 :             eSimpleState = implGetCheckState( *pItem );
      82           0 :         return eSimpleState;
      83             :     }
      84             : 
      85             : 
      86           0 :     AttributeState AttributeHandler::getState( const SfxItemSet& _rAttribs ) const
      87             :     {
      88           0 :         AttributeState aState( eIndetermined );
      89           0 :         aState.eSimpleState = getCheckState( _rAttribs );
      90           0 :         return aState;
      91             :     }
      92             : 
      93             : 
      94             :     //= AttributeHandlerFactory
      95             : 
      96             : 
      97             :     namespace
      98             :     {
      99           0 :         static WhichId lcl_implGetWhich( const SfxItemPool& _rPool, AttributeId _nAttributeId )
     100             :         {
     101           0 :             WhichId nWhich = 0;
     102           0 :             switch ( _nAttributeId )
     103             :             {
     104           0 :             case SID_ATTR_CHAR_LATIN_FONTHEIGHT:nWhich = EE_CHAR_FONTHEIGHT;break;
     105           0 :             case SID_ATTR_CHAR_LATIN_FONT:      nWhich = EE_CHAR_FONTINFO;  break;
     106           0 :             case SID_ATTR_CHAR_LATIN_LANGUAGE:  nWhich = EE_CHAR_LANGUAGE;  break;
     107           0 :             case SID_ATTR_CHAR_LATIN_POSTURE:   nWhich = EE_CHAR_ITALIC;    break;
     108           0 :             case SID_ATTR_CHAR_LATIN_WEIGHT:    nWhich = EE_CHAR_WEIGHT;    break;
     109             : 
     110             :             default:
     111           0 :                 nWhich = _rPool.GetWhich( (SfxSlotId)_nAttributeId );
     112             :             }
     113           0 :             return nWhich;
     114             :         }
     115             :     }
     116             : 
     117           0 :     ::rtl::Reference< IAttributeHandler > AttributeHandlerFactory::getHandlerFor( AttributeId _nAttributeId, const SfxItemPool& _rEditEnginePool )
     118             :     {
     119           0 :         ::rtl::Reference< IAttributeHandler > pReturn;
     120           0 :         switch ( _nAttributeId )
     121             :         {
     122             :         case SID_ATTR_PARA_ADJUST_LEFT  :
     123             :         case SID_ATTR_PARA_ADJUST_CENTER:
     124             :         case SID_ATTR_PARA_ADJUST_RIGHT :
     125             :         case SID_ATTR_PARA_ADJUST_BLOCK :
     126           0 :             pReturn = new ParaAlignmentHandler( _nAttributeId );
     127           0 :             break;
     128             : 
     129             :         case SID_ATTR_PARA_LINESPACE_10:
     130             :         case SID_ATTR_PARA_LINESPACE_15:
     131             :         case SID_ATTR_PARA_LINESPACE_20:
     132           0 :             pReturn = new LineSpacingHandler( _nAttributeId );
     133           0 :             break;
     134             : 
     135             :         case SID_SET_SUPER_SCRIPT:
     136             :         case SID_SET_SUB_SCRIPT:
     137           0 :             pReturn = new EscapementHandler( _nAttributeId );
     138           0 :             break;
     139             : 
     140             :         case SID_ATTR_CHAR_FONTHEIGHT:
     141             :         case SID_ATTR_CHAR_CTL_FONTHEIGHT:
     142             :         case SID_ATTR_CHAR_CJK_FONTHEIGHT:
     143             :         case SID_ATTR_CHAR_LATIN_FONTHEIGHT:
     144           0 :             pReturn = new FontSizeHandler( _nAttributeId, lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) );
     145           0 :             break;
     146             : 
     147             :         case SID_ATTR_PARA_LEFT_TO_RIGHT:
     148             :         case SID_ATTR_PARA_RIGHT_TO_LEFT:
     149           0 :             pReturn = new ParagraphDirectionHandler( _nAttributeId );
     150           0 :             break;
     151             : 
     152             :         case SID_ATTR_PARA_HANGPUNCTUATION:
     153             :         case SID_ATTR_PARA_FORBIDDEN_RULES:
     154             :         case SID_ATTR_PARA_SCRIPTSPACE:
     155           0 :             pReturn = new BooleanHandler( _nAttributeId, lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) );
     156           0 :             break;
     157             : 
     158             :         default:
     159           0 :             pReturn = new SlotHandler( (SfxSlotId)_nAttributeId, lcl_implGetWhich( _rEditEnginePool, _nAttributeId ) );
     160           0 :             break;
     161             : 
     162             :         }
     163             : 
     164           0 :         return pReturn;
     165             :     }
     166             : 
     167           0 :     ParaAlignmentHandler::ParaAlignmentHandler( AttributeId _nAttributeId )
     168             :         :AttributeHandler( _nAttributeId, EE_PARA_JUST )
     169           0 :         ,m_eAdjust( SVX_ADJUST_CENTER )
     170             :     {
     171           0 :         switch ( getAttribute() )
     172             :         {
     173           0 :             case SID_ATTR_PARA_ADJUST_LEFT  : m_eAdjust = SVX_ADJUST_LEFT;    break;
     174           0 :             case SID_ATTR_PARA_ADJUST_CENTER: m_eAdjust = SVX_ADJUST_CENTER;  break;
     175           0 :             case SID_ATTR_PARA_ADJUST_RIGHT : m_eAdjust = SVX_ADJUST_RIGHT;   break;
     176           0 :             case SID_ATTR_PARA_ADJUST_BLOCK : m_eAdjust = SVX_ADJUST_BLOCK;   break;
     177             :             default:
     178             :                 OSL_FAIL( "ParaAlignmentHandler::ParaAlignmentHandler: invalid slot!" );
     179           0 :                 break;
     180             :         }
     181           0 :     }
     182             : 
     183             : 
     184           0 :     AttributeCheckState ParaAlignmentHandler::implGetCheckState( const SfxPoolItem& _rItem ) const
     185             :     {
     186             :         OSL_ENSURE( _rItem.ISA( SvxAdjustItem ), "ParaAlignmentHandler::implGetCheckState: invalid pool item!" );
     187           0 :         SvxAdjust eAdjust = static_cast< const SvxAdjustItem& >( _rItem ).GetAdjust();
     188           0 :         return ( eAdjust == m_eAdjust ) ? eChecked : eUnchecked;
     189             :     }
     190             : 
     191             : 
     192           0 :     void ParaAlignmentHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const
     193             :     {
     194             :         OSL_ENSURE( !_pAdditionalArg, "ParaAlignmentHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
     195             :         (void)_pAdditionalArg;
     196           0 :         _rNewAttribs.Put( SvxAdjustItem( m_eAdjust, getWhich() ) );
     197           0 :     }
     198             : 
     199           0 :     LineSpacingHandler::LineSpacingHandler( AttributeId _nAttributeId )
     200             :         :AttributeHandler( _nAttributeId, EE_PARA_SBL )
     201           0 :         ,m_nLineSpace( 100 )
     202             :     {
     203           0 :         switch ( getAttribute() )
     204             :         {
     205           0 :             case SID_ATTR_PARA_LINESPACE_10: m_nLineSpace = 100; break;
     206           0 :             case SID_ATTR_PARA_LINESPACE_15: m_nLineSpace = 150; break;
     207           0 :             case SID_ATTR_PARA_LINESPACE_20: m_nLineSpace = 200; break;
     208             :             default:
     209             :                 OSL_FAIL( "LineSpacingHandler::LineSpacingHandler: invalid slot!" );
     210           0 :                 break;
     211             :         }
     212           0 :     }
     213             : 
     214             : 
     215           0 :     AttributeCheckState LineSpacingHandler::implGetCheckState( const SfxPoolItem& _rItem ) const
     216             :     {
     217             :         OSL_ENSURE( _rItem.ISA( SvxLineSpacingItem ), "LineSpacingHandler::implGetCheckState: invalid pool item!" );
     218           0 :         sal_uInt16 nLineSpace = static_cast< const SvxLineSpacingItem& >( _rItem ).GetPropLineSpace();
     219           0 :         return ( nLineSpace == m_nLineSpace ) ? eChecked : eUnchecked;
     220             :     }
     221             : 
     222             : 
     223           0 :     void LineSpacingHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const
     224             :     {
     225             :         OSL_ENSURE( !_pAdditionalArg, "LineSpacingHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
     226             :         (void)_pAdditionalArg;
     227             : 
     228           0 :         SvxLineSpacingItem aLineSpacing( m_nLineSpace, getWhich() );
     229           0 :         aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     230           0 :         if ( 100 == m_nLineSpace )
     231           0 :             aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
     232             :         else
     233           0 :             aLineSpacing.SetPropLineSpace( (sal_uInt8)m_nLineSpace );
     234             : 
     235           0 :         _rNewAttribs.Put( aLineSpacing );
     236           0 :     }
     237             : 
     238           0 :     EscapementHandler::EscapementHandler( AttributeId _nAttributeId )
     239             :         :AttributeHandler( _nAttributeId, EE_CHAR_ESCAPEMENT )
     240           0 :         ,m_eEscapement( SVX_ESCAPEMENT_OFF )
     241             :     {
     242           0 :         switch ( getAttribute() )
     243             :         {
     244           0 :             case SID_SET_SUPER_SCRIPT   : m_eEscapement = SVX_ESCAPEMENT_SUPERSCRIPT; break;
     245           0 :             case SID_SET_SUB_SCRIPT     : m_eEscapement = SVX_ESCAPEMENT_SUBSCRIPT;   break;
     246             :             default:
     247             :                 OSL_FAIL( "EscapementHandler::EscapementHandler: invalid slot!" );
     248           0 :                 break;
     249             :         }
     250           0 :     }
     251             : 
     252             : 
     253           0 :     AttributeCheckState EscapementHandler::implGetCheckState( const SfxPoolItem& _rItem ) const
     254             :     {
     255             :         OSL_ENSURE( _rItem.ISA( SvxEscapementItem ), "EscapementHandler::getState: invalid pool item!" );
     256           0 :         SvxEscapement eEscapement = static_cast< const SvxEscapementItem& >( _rItem ).GetEscapement();
     257           0 :         return ( eEscapement == m_eEscapement ) ? eChecked : eUnchecked;
     258             :     }
     259             : 
     260             : 
     261           0 :     void EscapementHandler::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const    {
     262             :         OSL_ENSURE( !_pAdditionalArg, "EscapementHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
     263             :             // well, in theory we could allow an SvxEscapementItem here, but this is not needed
     264             :         (void)_pAdditionalArg;
     265             : 
     266           0 :         bool bIsChecked = getCheckState( _rCurrentAttribs ) == eChecked;
     267           0 :         _rNewAttribs.Put( SvxEscapementItem( bIsChecked ? SVX_ESCAPEMENT_OFF : m_eEscapement, getWhich() ) );
     268           0 :     }
     269             : 
     270           0 :     SlotHandler::SlotHandler( AttributeId _nAttributeId, WhichId _nWhichId )
     271             :         :AttributeHandler( _nAttributeId, _nWhichId )
     272           0 :         ,m_bScriptDependent( false )
     273             :     {
     274             :         m_bScriptDependent = ( SID_ATTR_CHAR_WEIGHT == _nAttributeId )
     275           0 :                          ||  ( SID_ATTR_CHAR_POSTURE == _nAttributeId )
     276           0 :                          ||  ( SID_ATTR_CHAR_FONT == _nAttributeId );
     277           0 :     }
     278             : 
     279             : 
     280           0 :     AttributeState SlotHandler::getState( const SfxItemSet& _rAttribs ) const
     281             :     {
     282           0 :         AttributeState aState( eIndetermined );
     283             : 
     284           0 :         const SfxPoolItem* pItem = _rAttribs.GetItem( getWhich() );
     285           0 :         if ( pItem )
     286           0 :             aState.setItem( pItem->Clone() );
     287             : 
     288           0 :         return aState;
     289             :     }
     290             : 
     291             : 
     292           0 :     void SlotHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const
     293             :     {
     294           0 :         if ( _pAdditionalArg )
     295             :         {
     296           0 :             SfxPoolItem* pCorrectWich = _pAdditionalArg->Clone();
     297           0 :             pCorrectWich->SetWhich( getWhich() );
     298             : 
     299           0 :             if ( m_bScriptDependent )
     300           0 :                 putItemForScript( _rNewAttribs, *pCorrectWich, _nForScriptType );
     301             :             else
     302           0 :                 _rNewAttribs.Put( *pCorrectWich );
     303           0 :             DELETEZ( pCorrectWich );
     304             :         }
     305             :         else
     306             :             OSL_FAIL( "SlotHandler::executeAttribute: need attributes to do something!" );
     307           0 :     }
     308             : 
     309           0 :     FontSizeHandler::FontSizeHandler( AttributeId _nAttributeId, WhichId _nWhichId )
     310           0 :         :AttributeHandler( _nAttributeId, _nWhichId )
     311             :     {
     312             :         OSL_ENSURE( ( _nAttributeId == SID_ATTR_CHAR_FONTHEIGHT ) || ( _nAttributeId == SID_ATTR_CHAR_CTL_FONTHEIGHT )
     313             :             || ( _nAttributeId == SID_ATTR_CHAR_CJK_FONTHEIGHT ) || ( _nAttributeId == SID_ATTR_CHAR_LATIN_FONTHEIGHT ),
     314             :             "FontSizeHandler::FontSizeHandler: invalid attribute id!" );
     315           0 :     }
     316             : 
     317             : 
     318           0 :     AttributeState FontSizeHandler::getState( const SfxItemSet& _rAttribs ) const
     319             :     {
     320           0 :         AttributeState aState( eIndetermined );
     321             : 
     322           0 :         const SfxPoolItem* pItem = _rAttribs.GetItem( getWhich() );
     323           0 :         const SvxFontHeightItem* pFontHeightItem = PTR_CAST( SvxFontHeightItem, pItem );
     324             :         OSL_ENSURE( pFontHeightItem || !pItem, "FontSizeHandler::getState: invalid item!" );
     325           0 :         if ( pFontHeightItem )
     326             :         {
     327             :             // by definition, the item should have the unit twip
     328           0 :             sal_uLong nHeight = pFontHeightItem->GetHeight();
     329           0 :             if ( _rAttribs.GetPool()->GetMetric( getWhich() ) != SFX_MAPUNIT_TWIP )
     330             :             {
     331             :                 nHeight = OutputDevice::LogicToLogic(
     332             :                     Size( 0, nHeight ),
     333           0 :                     MapMode( (MapUnit)( _rAttribs.GetPool()->GetMetric( getWhich() ) ) ),
     334             :                     MapMode( MAP_TWIP )
     335           0 :                 ).Height();
     336             :             }
     337             : 
     338           0 :             SvxFontHeightItem* pNewItem = new SvxFontHeightItem( nHeight, 100, getWhich() );
     339           0 :             pNewItem->SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
     340           0 :             aState.setItem( pNewItem );
     341             :         }
     342             : 
     343           0 :         return aState;
     344             :     }
     345             : 
     346             : 
     347           0 :     void FontSizeHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const
     348             :     {
     349           0 :         const SvxFontHeightItem* pFontHeightItem = PTR_CAST( SvxFontHeightItem, _pAdditionalArg );
     350             :         OSL_ENSURE( pFontHeightItem, "FontSizeHandler::executeAttribute: need a FontHeightItem!" );
     351             : 
     352           0 :         if ( pFontHeightItem )
     353             :         {
     354             :             // correct measurement units
     355           0 :             SfxMapUnit eItemMapUnit = pFontHeightItem->GetPropUnit(); (void)eItemMapUnit;
     356           0 :             sal_uLong nHeight = pFontHeightItem->GetHeight();
     357           0 :             if ( _rNewAttribs.GetPool()->GetMetric( getWhich() ) != SFX_MAPUNIT_TWIP )
     358             :             {
     359             :                 nHeight = OutputDevice::LogicToLogic(
     360             :                     Size( 0, nHeight ),
     361             :                     MapMode( (MapUnit)( SFX_MAPUNIT_TWIP ) ),
     362           0 :                     MapMode( (MapUnit)( _rNewAttribs.GetPool()->GetMetric( getWhich() ) ) )
     363           0 :                 ).Height();
     364             :             }
     365             : 
     366           0 :             SvxFontHeightItem aNewItem( nHeight, 100, getWhich() );
     367           0 :             aNewItem.SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
     368             : 
     369           0 :             if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType != SvtScriptType::NONE)
     370           0 :                 putItemForScript( _rNewAttribs, aNewItem, _nForScriptType );
     371             :             else
     372           0 :                 _rNewAttribs.Put( aNewItem );
     373             :         }
     374           0 :     }
     375             : 
     376           0 :     ParagraphDirectionHandler::ParagraphDirectionHandler( AttributeId _nAttributeId )
     377             :         :AttributeHandler( _nAttributeId, EE_PARA_WRITINGDIR )
     378             :         ,m_eParagraphDirection( FRMDIR_HORI_LEFT_TOP )
     379             :         ,m_eDefaultAdjustment( SVX_ADJUST_RIGHT )
     380           0 :         ,m_eOppositeDefaultAdjustment( SVX_ADJUST_LEFT )
     381             :     {
     382           0 :         switch ( getAttributeId() )
     383             :         {
     384           0 :             case SID_ATTR_PARA_LEFT_TO_RIGHT: m_eParagraphDirection = FRMDIR_HORI_LEFT_TOP; m_eDefaultAdjustment = SVX_ADJUST_LEFT; break;
     385           0 :             case SID_ATTR_PARA_RIGHT_TO_LEFT: m_eParagraphDirection = FRMDIR_HORI_RIGHT_TOP; m_eDefaultAdjustment = SVX_ADJUST_RIGHT; break;
     386             :             default:
     387             :                 OSL_FAIL( "ParagraphDirectionHandler::ParagraphDirectionHandler: invalid attribute id!" );
     388             :         }
     389             : 
     390           0 :         if ( SVX_ADJUST_RIGHT == m_eDefaultAdjustment )
     391           0 :             m_eOppositeDefaultAdjustment = SVX_ADJUST_LEFT;
     392             :         else
     393           0 :             m_eOppositeDefaultAdjustment = SVX_ADJUST_RIGHT;
     394           0 :     }
     395             : 
     396             : 
     397           0 :     AttributeCheckState ParagraphDirectionHandler::implGetCheckState( const SfxPoolItem& _rItem ) const
     398             :     {
     399             :         OSL_ENSURE( _rItem.ISA( SvxFrameDirectionItem ), "ParagraphDirectionHandler::implGetCheckState: invalid pool item!" );
     400           0 :         SvxFrameDirection eDirection = static_cast< SvxFrameDirection >( static_cast< const SvxFrameDirectionItem& >( _rItem ).GetValue() );
     401           0 :         return ( eDirection == m_eParagraphDirection ) ? eChecked : eUnchecked;
     402             :     }
     403             : 
     404             : 
     405           0 :     void ParagraphDirectionHandler::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* /*_pAdditionalArg*/, SvtScriptType /*_nForScriptType*/ ) const
     406             :     {
     407           0 :         _rNewAttribs.Put( SvxFrameDirectionItem( m_eParagraphDirection, getWhich() ) );
     408             : 
     409             :         // if the current adjustment of the was the default adjustment for the *previous* text direction,
     410             :         // then we toggle the adjustment, too
     411           0 :         SvxAdjust eCurrentAdjustment = SVX_ADJUST_LEFT;
     412           0 :         const SfxPoolItem* pCurrentAdjustment = NULL;
     413           0 :         if ( SfxItemState::SET == _rCurrentAttribs.GetItemState( EE_PARA_JUST, true, &pCurrentAdjustment ) )
     414           0 :             eCurrentAdjustment = static_cast< const SvxAdjustItem* >( pCurrentAdjustment )->GetAdjust();
     415             : 
     416           0 :         if ( eCurrentAdjustment == m_eOppositeDefaultAdjustment )
     417           0 :             _rNewAttribs.Put( SvxAdjustItem( m_eDefaultAdjustment, EE_PARA_JUST ) );
     418           0 :     }
     419             : 
     420           0 :     BooleanHandler::BooleanHandler( AttributeId _nAttributeId, WhichId _nWhichId )
     421           0 :         :AttributeHandler( _nAttributeId, _nWhichId )
     422             :     {
     423           0 :     }
     424             : 
     425             : 
     426           0 :     AttributeCheckState BooleanHandler::implGetCheckState( const SfxPoolItem& _rItem ) const
     427             :     {
     428             :         OSL_ENSURE( _rItem.ISA( SfxBoolItem ), "BooleanHandler::implGetCheckState: invalid item!" );
     429           0 :         if ( _rItem.ISA( SfxBoolItem ) )
     430           0 :             return static_cast< const SfxBoolItem& >( _rItem ).GetValue() ? eChecked : eUnchecked;
     431             : 
     432           0 :         return eIndetermined;
     433             :     }
     434             : 
     435             : 
     436           0 :     void BooleanHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const
     437             :     {
     438             :         OSL_ENSURE( _pAdditionalArg && _pAdditionalArg->ISA( SfxBoolItem ), "BooleanHandler::executeAttribute: invalid argument!" );
     439           0 :         if ( _pAdditionalArg )
     440             :         {
     441           0 :             SfxPoolItem* pCorrectWich = _pAdditionalArg->Clone();
     442           0 :             pCorrectWich->SetWhich( getWhich() );
     443           0 :             _rNewAttribs.Put( *pCorrectWich );
     444           0 :             DELETEZ( pCorrectWich );
     445             :         }
     446           0 :     }
     447             : 
     448             : 
     449             : }   // namespace frm
     450             : 
     451             : 
     452             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11