LCOV - code coverage report
Current view: top level - sw/source/core/para - paratr.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 104 0.0 %
Date: 2014-04-14 Functions: 0 37 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 "hintids.hxx"
      21             : #include <swtypes.hxx>
      22             : #include "unomid.h"
      23             : #include <com/sun/star/style/LineSpacingMode.hpp>
      24             : #include <com/sun/star/style/ParagraphAdjust.hpp>
      25             : #include <com/sun/star/style/DropCapFormat.hpp>
      26             : #include <com/sun/star/style/LineSpacing.hpp>
      27             : #include <com/sun/star/text/RelOrientation.hpp>
      28             : #include <com/sun/star/text/VertOrientation.hpp>
      29             : #include <com/sun/star/text/HorizontalAdjust.hpp>
      30             : #include <com/sun/star/text/DocumentStatistic.hpp>
      31             : #include <com/sun/star/text/HoriOrientation.hpp>
      32             : #include <com/sun/star/text/HoriOrientationFormat.hpp>
      33             : #include <com/sun/star/text/NotePrintMode.hpp>
      34             : #include <com/sun/star/text/SizeType.hpp>
      35             : #include <com/sun/star/text/VertOrientationFormat.hpp>
      36             : #include <com/sun/star/text/WrapTextMode.hpp>
      37             : #include <unostyle.hxx>
      38             : #include <SwStyleNameMapper.hxx>
      39             : #include "paratr.hxx"
      40             : #include "charfmt.hxx"
      41             : #include "cmdid.h"
      42             : 
      43             : using namespace ::com::sun::star;
      44             : 
      45           0 : TYPEINIT2_AUTOFACTORY( SwFmtDrop, SfxPoolItem, SwClient);
      46           0 : TYPEINIT1_AUTOFACTORY( SwRegisterItem, SfxBoolItem);
      47           0 : TYPEINIT1_AUTOFACTORY( SwNumRuleItem, SfxStringItem);
      48           0 : TYPEINIT1_AUTOFACTORY( SwParaConnectBorderItem, SfxBoolItem);
      49             : 
      50           0 : SwFmtDrop::SwFmtDrop()
      51             :     : SfxPoolItem( RES_PARATR_DROP ),
      52             :     SwClient( 0 ),
      53             :     pDefinedIn( 0 ),
      54             :     nDistance( 0 ),
      55             :     nReadFmt( USHRT_MAX ),
      56             :     nLines( 0 ),
      57             :     nChars( 0 ),
      58           0 :     bWholeWord( sal_False )
      59             : {
      60           0 : }
      61             : 
      62           0 : SwFmtDrop::SwFmtDrop( const SwFmtDrop &rCpy )
      63             :     : SfxPoolItem( RES_PARATR_DROP ),
      64             :     SwClient( rCpy.GetRegisteredInNonConst() ),
      65             :     pDefinedIn( 0 ),
      66           0 :     nDistance( rCpy.GetDistance() ),
      67             :     nReadFmt( rCpy.nReadFmt ),
      68           0 :     nLines( rCpy.GetLines() ),
      69           0 :     nChars( rCpy.GetChars() ),
      70           0 :     bWholeWord( rCpy.GetWholeWord() )
      71             : {
      72           0 : }
      73             : 
      74           0 : SwFmtDrop::~SwFmtDrop()
      75             : {
      76           0 : }
      77             : 
      78           0 : void SwFmtDrop::SetCharFmt( SwCharFmt *pNew )
      79             : {
      80             :     // Rewire
      81           0 :     if ( GetRegisteredIn() )
      82           0 :         GetRegisteredInNonConst()->Remove( this );
      83           0 :     if(pNew)
      84           0 :         pNew->Add( this );
      85           0 :     nReadFmt = USHRT_MAX;
      86           0 : }
      87             : 
      88           0 : void SwFmtDrop::Modify( const SfxPoolItem*, const SfxPoolItem * )
      89             : {
      90           0 :     if( pDefinedIn )
      91             :     {
      92           0 :         if( !pDefinedIn->ISA( SwFmt ))
      93           0 :             pDefinedIn->ModifyNotification( this, this );
      94           0 :         else if( pDefinedIn->GetDepends() &&
      95           0 :                 !pDefinedIn->IsModifyLocked() )
      96             :         {
      97             :             // Notify those who are dependend on the format on our own.
      98             :             // The format itself wouldn't pass on the notify as it does not get past the check.
      99           0 :             pDefinedIn->ModifyBroadcast( this, this );
     100             :         }
     101             :     }
     102           0 : }
     103             : 
     104           0 : bool SwFmtDrop::GetInfo( SfxPoolItem& ) const
     105             : {
     106           0 :     return true; // Continue
     107             : }
     108             : 
     109           0 : bool SwFmtDrop::operator==( const SfxPoolItem& rAttr ) const
     110             : {
     111             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "No mathing attributes" );
     112           0 :     return ( nLines == ((SwFmtDrop&)rAttr).GetLines() &&
     113           0 :              nChars == ((SwFmtDrop&)rAttr).GetChars() &&
     114           0 :              nDistance ==  ((SwFmtDrop&)rAttr).GetDistance() &&
     115           0 :              bWholeWord == ((SwFmtDrop&)rAttr).GetWholeWord() &&
     116           0 :              GetCharFmt() == ((SwFmtDrop&)rAttr).GetCharFmt() &&
     117           0 :              pDefinedIn == ((SwFmtDrop&)rAttr).pDefinedIn );
     118             : }
     119             : 
     120           0 : SfxPoolItem* SwFmtDrop::Clone( SfxItemPool* ) const
     121             : {
     122           0 :     return new SwFmtDrop( *this );
     123             : }
     124             : 
     125           0 : bool SwFmtDrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
     126             : {
     127           0 :     switch(nMemberId&~CONVERT_TWIPS)
     128             :     {
     129           0 :         case MID_DROPCAP_LINES : rVal <<= (sal_Int16)nLines; break;
     130           0 :         case MID_DROPCAP_COUNT : rVal <<= (sal_Int16)nChars; break;
     131           0 :         case MID_DROPCAP_DISTANCE : rVal <<= (sal_Int16) convertTwipToMm100(nDistance); break;
     132             :         case MID_DROPCAP_FORMAT:
     133             :         {
     134           0 :              style::DropCapFormat aDrop;
     135           0 :             aDrop.Lines = nLines   ;
     136           0 :             aDrop.Count = nChars   ;
     137           0 :             aDrop.Distance  = convertTwipToMm100(nDistance);
     138           0 :             rVal.setValue(&aDrop, ::getCppuType((const style::DropCapFormat*)0));
     139             :         }
     140           0 :         break;
     141             :         case MID_DROPCAP_WHOLE_WORD:
     142           0 :             rVal.setValue(&bWholeWord, ::getBooleanCppuType());
     143           0 :         break;
     144             :         case MID_DROPCAP_CHAR_STYLE_NAME :
     145             :         {
     146           0 :             OUString sName;
     147           0 :             if(GetCharFmt())
     148             :                 sName = SwStyleNameMapper::GetProgName(
     149           0 :                         GetCharFmt()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
     150           0 :             rVal <<= sName;
     151             :         }
     152           0 :         break;
     153             :     }
     154           0 :     return true;
     155             : }
     156             : 
     157           0 : bool SwFmtDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     158             : {
     159           0 :     switch(nMemberId&~CONVERT_TWIPS)
     160             :     {
     161             :         case MID_DROPCAP_LINES :
     162             :         {
     163           0 :             sal_Int8 nTemp = 0;
     164           0 :             rVal >>= nTemp;
     165           0 :             if(nTemp >=1 && nTemp < 0x7f)
     166           0 :                 nLines = (sal_uInt8)nTemp;
     167             :         }
     168           0 :         break;
     169             :         case MID_DROPCAP_COUNT :
     170             :         {
     171           0 :             sal_Int16 nTemp = 0;
     172           0 :             rVal >>= nTemp;
     173           0 :             if(nTemp >=1 && nTemp < 0x7f)
     174           0 :                 nChars = (sal_uInt8)nTemp;
     175             :         }
     176           0 :         break;
     177             :         case MID_DROPCAP_DISTANCE :
     178             :         {
     179           0 :             sal_Int16 nVal = 0;
     180           0 :             if ( rVal >>= nVal )
     181           0 :                 nDistance = (sal_Int16) convertMm100ToTwip((sal_Int32)nVal);
     182             :             else
     183           0 :                 return false;
     184           0 :             break;
     185             :         }
     186             :         case MID_DROPCAP_FORMAT:
     187             :         {
     188           0 :             if(rVal.getValueType()  == ::getCppuType((const style::DropCapFormat*)0))
     189             :             {
     190           0 :                 const style::DropCapFormat* pDrop = (const style::DropCapFormat*)rVal.getValue();
     191           0 :                 nLines      = pDrop->Lines;
     192           0 :                 nChars      = pDrop->Count;
     193           0 :                 nDistance   = convertMm100ToTwip(pDrop->Distance);
     194             :             }
     195             :             else {
     196             :             }
     197             :         }
     198           0 :         break;
     199             :         case MID_DROPCAP_WHOLE_WORD:
     200           0 :             bWholeWord = *(sal_Bool*)rVal.getValue();
     201           0 :         break;
     202             :         case MID_DROPCAP_CHAR_STYLE_NAME :
     203             :             OSL_FAIL("char format cannot be set in PutValue()!");
     204           0 :         break;
     205             :     }
     206           0 :     return true;
     207             : }
     208             : 
     209             : /**
     210             :  * SwRegisterItem
     211             :  */
     212             : 
     213           0 : SfxPoolItem* SwRegisterItem::Clone( SfxItemPool * ) const
     214             : {
     215           0 :     return new SwRegisterItem( *this );
     216             : }
     217             : 
     218             : /**
     219             :  * SwNumRuleItem
     220             :  */
     221           0 : SfxPoolItem* SwNumRuleItem::Clone( SfxItemPool * ) const
     222             : {
     223           0 :     return new SwNumRuleItem( *this );
     224             : }
     225           0 : bool SwNumRuleItem::operator==( const SfxPoolItem& rAttr ) const
     226             : {
     227             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "No matching attributes" );
     228             : 
     229           0 :     return GetValue() == ((SwNumRuleItem&)rAttr).GetValue();
     230             : }
     231             : 
     232           0 : bool    SwNumRuleItem::QueryValue( uno::Any& rVal, sal_uInt8 ) const
     233             : {
     234           0 :     OUString sRet = SwStyleNameMapper::GetProgName(GetValue(), nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
     235           0 :     rVal <<= sRet;
     236           0 :     return true;
     237             : }
     238             : 
     239           0 : bool    SwNumRuleItem::PutValue( const uno::Any& rVal, sal_uInt8 )
     240             : {
     241           0 :     OUString uName;
     242           0 :     rVal >>= uName;
     243           0 :     SetValue(SwStyleNameMapper::GetUIName(uName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE));
     244           0 :     return true;
     245             : }
     246             : 
     247           0 : SfxPoolItem* SwParaConnectBorderItem::Clone( SfxItemPool * ) const
     248             : {
     249           0 :     return new SwParaConnectBorderItem( *this );
     250             : }
     251             : 
     252             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10