LCOV - code coverage report
Current view: top level - forms/source/richtext - rtattributehandler.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 186 0.5 %
Date: 2014-11-03 Functions: 2 33 6.1 %
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, ScriptType _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, ScriptType /*_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, ScriptType /*_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, ScriptType /*_nForScriptType*/ ) const
     262             :     {
     263             :         OSL_ENSURE( !_pAdditionalArg, "EscapementHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
     264             :             // well, in theory we could allow an SvxEscapementItem here, but this is not needed
     265             :         (void)_pAdditionalArg;
     266             : 
     267           0 :         bool bIsChecked = getCheckState( _rCurrentAttribs ) == eChecked;
     268           0 :         _rNewAttribs.Put( SvxEscapementItem( bIsChecked ? SVX_ESCAPEMENT_OFF : m_eEscapement, getWhich() ) );
     269           0 :     }
     270             : 
     271           0 :     SlotHandler::SlotHandler( AttributeId _nAttributeId, WhichId _nWhichId )
     272             :         :AttributeHandler( _nAttributeId, _nWhichId )
     273           0 :         ,m_bScriptDependent( false )
     274             :     {
     275             :         m_bScriptDependent = ( SID_ATTR_CHAR_WEIGHT == _nAttributeId )
     276           0 :                          ||  ( SID_ATTR_CHAR_POSTURE == _nAttributeId )
     277           0 :                          ||  ( SID_ATTR_CHAR_FONT == _nAttributeId );
     278           0 :     }
     279             : 
     280             : 
     281           0 :     AttributeState SlotHandler::getState( const SfxItemSet& _rAttribs ) const
     282             :     {
     283           0 :         AttributeState aState( eIndetermined );
     284             : 
     285           0 :         const SfxPoolItem* pItem = _rAttribs.GetItem( getWhich() );
     286           0 :         if ( pItem )
     287           0 :             aState.setItem( pItem->Clone() );
     288             : 
     289           0 :         return aState;
     290             :     }
     291             : 
     292             : 
     293           0 :     void SlotHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const
     294             :     {
     295           0 :         if ( _pAdditionalArg )
     296             :         {
     297           0 :             SfxPoolItem* pCorrectWich = _pAdditionalArg->Clone();
     298           0 :             pCorrectWich->SetWhich( getWhich() );
     299             : 
     300           0 :             if ( m_bScriptDependent )
     301           0 :                 putItemForScript( _rNewAttribs, *pCorrectWich, _nForScriptType );
     302             :             else
     303           0 :                 _rNewAttribs.Put( *pCorrectWich );
     304           0 :             DELETEZ( pCorrectWich );
     305             :         }
     306             :         else
     307             :             OSL_FAIL( "SlotHandler::executeAttribute: need attributes to do something!" );
     308           0 :     }
     309             : 
     310           0 :     FontSizeHandler::FontSizeHandler( AttributeId _nAttributeId, WhichId _nWhichId )
     311           0 :         :AttributeHandler( _nAttributeId, _nWhichId )
     312             :     {
     313             :         OSL_ENSURE( ( _nAttributeId == SID_ATTR_CHAR_FONTHEIGHT ) || ( _nAttributeId == SID_ATTR_CHAR_CTL_FONTHEIGHT )
     314             :             || ( _nAttributeId == SID_ATTR_CHAR_CJK_FONTHEIGHT ) || ( _nAttributeId == SID_ATTR_CHAR_LATIN_FONTHEIGHT ),
     315             :             "FontSizeHandler::FontSizeHandler: invalid attribute id!" );
     316           0 :     }
     317             : 
     318             : 
     319           0 :     AttributeState FontSizeHandler::getState( const SfxItemSet& _rAttribs ) const
     320             :     {
     321           0 :         AttributeState aState( eIndetermined );
     322             : 
     323           0 :         const SfxPoolItem* pItem = _rAttribs.GetItem( getWhich() );
     324           0 :         const SvxFontHeightItem* pFontHeightItem = PTR_CAST( SvxFontHeightItem, pItem );
     325             :         OSL_ENSURE( pFontHeightItem || !pItem, "FontSizeHandler::getState: invalid item!" );
     326           0 :         if ( pFontHeightItem )
     327             :         {
     328             :             // by definition, the item should have the unit twip
     329           0 :             sal_uLong nHeight = pFontHeightItem->GetHeight();
     330           0 :             if ( _rAttribs.GetPool()->GetMetric( getWhich() ) != SFX_MAPUNIT_TWIP )
     331             :             {
     332             :                 nHeight = OutputDevice::LogicToLogic(
     333             :                     Size( 0, nHeight ),
     334           0 :                     MapMode( (MapUnit)( _rAttribs.GetPool()->GetMetric( getWhich() ) ) ),
     335             :                     MapMode( MAP_TWIP )
     336           0 :                 ).Height();
     337             :             }
     338             : 
     339           0 :             SvxFontHeightItem* pNewItem = new SvxFontHeightItem( nHeight, 100, getWhich() );
     340           0 :             pNewItem->SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
     341           0 :             aState.setItem( pNewItem );
     342             :         }
     343             : 
     344           0 :         return aState;
     345             :     }
     346             : 
     347             : 
     348           0 :     void FontSizeHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const
     349             :     {
     350           0 :         const SvxFontHeightItem* pFontHeightItem = PTR_CAST( SvxFontHeightItem, _pAdditionalArg );
     351             :         OSL_ENSURE( pFontHeightItem, "FontSizeHandler::executeAttribute: need a FontHeightItem!" );
     352             : 
     353           0 :         if ( pFontHeightItem )
     354             :         {
     355             :             // correct measurement units
     356           0 :             SfxMapUnit eItemMapUnit = pFontHeightItem->GetPropUnit(); (void)eItemMapUnit;
     357           0 :             sal_uLong nHeight = pFontHeightItem->GetHeight();
     358           0 :             if ( _rNewAttribs.GetPool()->GetMetric( getWhich() ) != SFX_MAPUNIT_TWIP )
     359             :             {
     360             :                 nHeight = OutputDevice::LogicToLogic(
     361             :                     Size( 0, nHeight ),
     362             :                     MapMode( (MapUnit)( SFX_MAPUNIT_TWIP ) ),
     363           0 :                     MapMode( (MapUnit)( _rNewAttribs.GetPool()->GetMetric( getWhich() ) ) )
     364           0 :                 ).Height();
     365             :             }
     366             : 
     367           0 :             SvxFontHeightItem aNewItem( nHeight, 100, getWhich() );
     368           0 :             aNewItem.SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
     369             : 
     370           0 :             if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType )
     371           0 :                 putItemForScript( _rNewAttribs, aNewItem, _nForScriptType );
     372             :             else
     373           0 :                 _rNewAttribs.Put( aNewItem );
     374             :         }
     375           0 :     }
     376             : 
     377           0 :     ParagraphDirectionHandler::ParagraphDirectionHandler( AttributeId _nAttributeId )
     378             :         :AttributeHandler( _nAttributeId, EE_PARA_WRITINGDIR )
     379             :         ,m_eParagraphDirection( FRMDIR_HORI_LEFT_TOP )
     380             :         ,m_eDefaultAdjustment( SVX_ADJUST_RIGHT )
     381           0 :         ,m_eOppositeDefaultAdjustment( SVX_ADJUST_LEFT )
     382             :     {
     383           0 :         switch ( getAttributeId() )
     384             :         {
     385           0 :             case SID_ATTR_PARA_LEFT_TO_RIGHT: m_eParagraphDirection = FRMDIR_HORI_LEFT_TOP; m_eDefaultAdjustment = SVX_ADJUST_LEFT; break;
     386           0 :             case SID_ATTR_PARA_RIGHT_TO_LEFT: m_eParagraphDirection = FRMDIR_HORI_RIGHT_TOP; m_eDefaultAdjustment = SVX_ADJUST_RIGHT; break;
     387             :             default:
     388             :                 OSL_FAIL( "ParagraphDirectionHandler::ParagraphDirectionHandler: invalid attribute id!" );
     389             :         }
     390             : 
     391           0 :         if ( SVX_ADJUST_RIGHT == m_eDefaultAdjustment )
     392           0 :             m_eOppositeDefaultAdjustment = SVX_ADJUST_LEFT;
     393             :         else
     394           0 :             m_eOppositeDefaultAdjustment = SVX_ADJUST_RIGHT;
     395           0 :     }
     396             : 
     397             : 
     398           0 :     AttributeCheckState ParagraphDirectionHandler::implGetCheckState( const SfxPoolItem& _rItem ) const
     399             :     {
     400             :         OSL_ENSURE( _rItem.ISA( SvxFrameDirectionItem ), "ParagraphDirectionHandler::implGetCheckState: invalid pool item!" );
     401           0 :         SvxFrameDirection eDirection = static_cast< SvxFrameDirection >( static_cast< const SvxFrameDirectionItem& >( _rItem ).GetValue() );
     402           0 :         return ( eDirection == m_eParagraphDirection ) ? eChecked : eUnchecked;
     403             :     }
     404             : 
     405             : 
     406           0 :     void ParagraphDirectionHandler::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* /*_pAdditionalArg*/, ScriptType /*_nForScriptType*/ ) const
     407             :     {
     408           0 :         _rNewAttribs.Put( SvxFrameDirectionItem( m_eParagraphDirection, getWhich() ) );
     409             : 
     410             :         // if the current adjustment of the was the default adjustment for the *previous* text direction,
     411             :         // then we toggle the adjustment, too
     412           0 :         SvxAdjust eCurrentAdjustment = SVX_ADJUST_LEFT;
     413           0 :         const SfxPoolItem* pCurrentAdjustment = NULL;
     414           0 :         if ( SfxItemState::SET == _rCurrentAttribs.GetItemState( EE_PARA_JUST, true, &pCurrentAdjustment ) )
     415           0 :             eCurrentAdjustment = static_cast< const SvxAdjustItem* >( pCurrentAdjustment )->GetAdjust();
     416             : 
     417           0 :         if ( eCurrentAdjustment == m_eOppositeDefaultAdjustment )
     418           0 :             _rNewAttribs.Put( SvxAdjustItem( m_eDefaultAdjustment, EE_PARA_JUST ) );
     419           0 :     }
     420             : 
     421           0 :     BooleanHandler::BooleanHandler( AttributeId _nAttributeId, WhichId _nWhichId )
     422           0 :         :AttributeHandler( _nAttributeId, _nWhichId )
     423             :     {
     424           0 :     }
     425             : 
     426             : 
     427           0 :     AttributeCheckState BooleanHandler::implGetCheckState( const SfxPoolItem& _rItem ) const
     428             :     {
     429             :         OSL_ENSURE( _rItem.ISA( SfxBoolItem ), "BooleanHandler::implGetCheckState: invalid item!" );
     430           0 :         if ( _rItem.ISA( SfxBoolItem ) )
     431           0 :             return static_cast< const SfxBoolItem& >( _rItem ).GetValue() ? eChecked : eUnchecked;
     432             : 
     433           0 :         return eIndetermined;
     434             :     }
     435             : 
     436             : 
     437           0 :     void BooleanHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType /*_nForScriptType*/ ) const
     438             :     {
     439             :         OSL_ENSURE( _pAdditionalArg && _pAdditionalArg->ISA( SfxBoolItem ), "BooleanHandler::executeAttribute: invalid argument!" );
     440           0 :         if ( _pAdditionalArg )
     441             :         {
     442           0 :             SfxPoolItem* pCorrectWich = _pAdditionalArg->Clone();
     443           0 :             pCorrectWich->SetWhich( getWhich() );
     444           0 :             _rNewAttribs.Put( *pCorrectWich );
     445           0 :             DELETEZ( pCorrectWich );
     446             :         }
     447           0 :     }
     448             : 
     449             : 
     450         192 : }   // namespace frm
     451             : 
     452             : 
     453             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10