LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/attr - hints.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 59 89 66.3 %
Date: 2013-07-09 Functions: 17 24 70.8 %
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 <com/sun/star/i18n/ScriptType.hpp>
      21             : #include <editeng/scripttypeitem.hxx>
      22             : #include <hintids.hxx>
      23             : #include <hints.hxx>
      24             : #include <ndtxt.hxx>
      25             : #include <swtypes.hxx>
      26             : 
      27       21492 : SwFmtChg::SwFmtChg( SwFmt* pFmt )
      28       21492 :     : SwMsgPoolItem( RES_FMT_CHG ), pChangedFmt( pFmt )
      29             : {
      30       21492 : }
      31             : 
      32        5224 : SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL )
      33        5224 :     : SwMsgPoolItem( RES_INS_TXT ), nPos( nP ), nLen( nL )
      34             : {
      35        5224 : }
      36             : 
      37         232 : SwDelChr::SwDelChr( xub_StrLen nP )
      38         232 :     : SwMsgPoolItem( RES_DEL_CHR ), nPos( nP )
      39             : {
      40         232 : }
      41             : 
      42         949 : SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )
      43         949 :     : SwMsgPoolItem( RES_DEL_TXT ), nStart( nS ), nLen( nL )
      44             : {
      45         949 : }
      46             : 
      47       11953 : SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, sal_uInt16 nW )
      48       11953 :     : SwMsgPoolItem( RES_UPDATE_ATTR ), nStart( nS ), nEnd( nE ), nWhichAttr( nW )
      49             : {
      50       11953 : }
      51             : 
      52             : 
      53             : /** Is sent if reference marks should be updated.
      54             : 
      55             :     To get the page/chapter number, the frame has to be asked. For that we need
      56             :     the current OutputDevice.
      57             : */
      58           0 : SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
      59             :     : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
      60           0 :     pOut( pOutput )
      61             : {
      62             :     OSL_ENSURE( pOut, "No OutputDevice pointer" );
      63           0 : }
      64             : 
      65         939 : SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDcPos )
      66         939 :     : SwMsgPoolItem( RES_DOCPOS_UPDATE ), nDocPos(nDcPos)
      67             : {
      68         939 : }
      69             : 
      70             : /** Is sent if a table should be recalculated */
      71         240 : SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
      72             :     : SwMsgPoolItem( RES_TABLEFML_UPDATE ),
      73             :     pTbl( pNewTbl ), pHistory( 0 ), nSplitLine( USHRT_MAX ),
      74         240 :     eFlags( TBL_CALC )
      75             : {
      76         240 :     DATA.pDelTbl = 0;
      77         240 :     bModified = bBehindSplitLine = sal_False;
      78             :     OSL_ENSURE( pTbl, "No Table pointer" );
      79         240 : }
      80             : 
      81       89725 : SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
      82       89725 :     : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ), pCntntNode( 0 ), pNodes( pNds )
      83             : {
      84       89725 : }
      85             : 
      86      150602 : SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
      87             :     : SwMsgPoolItem( RES_ATTRSET_CHG ),
      88             :     bDelSet( sal_False ),
      89             :     pChgSet( &rSet ),
      90      150602 :     pTheChgdSet( &rTheSet )
      91             : {
      92      150602 : }
      93             : 
      94      166520 : SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
      95             :     : SwMsgPoolItem( RES_ATTRSET_CHG ),
      96             :     bDelSet( sal_True ),
      97      166520 :     pTheChgdSet( rChgSet.pTheChgdSet )
      98             : {
      99      166520 :     pChgSet = new SwAttrSet( *rChgSet.pChgSet );
     100      166520 : }
     101             : 
     102      634244 : SwAttrSetChg::~SwAttrSetChg()
     103             : {
     104      317122 :     if( bDelSet )
     105      166520 :         delete pChgSet;
     106      317122 : }
     107             : 
     108             : #ifdef DBG_UTIL
     109             : void SwAttrSetChg::ClearItem( sal_uInt16 nWhch )
     110             : {
     111             :     OSL_ENSURE( bDelSet, "The Set may not be changed!" );
     112             :     pChgSet->ClearItem( nWhch );
     113             : }
     114             : #endif
     115             : 
     116      480548 : SwMsgPoolItem::SwMsgPoolItem( sal_uInt16 nWhch )
     117      480548 :     : SfxPoolItem( nWhch )
     118             : {
     119      480548 : }
     120             : 
     121             : // "Overhead" of SfxPoolItem
     122           0 : int SwMsgPoolItem::operator==( const SfxPoolItem& ) const
     123             : {
     124             :     OSL_FAIL( "SwMsgPoolItem knows no ==" );
     125           0 :     return 0;
     126             : }
     127             : 
     128           0 : SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
     129             : {
     130             :     OSL_FAIL( "SwMsgPoolItem knows no Clone" );
     131           0 :     return 0;
     132             : }
     133             : 
     134             : #if OSL_DEBUG_LEVEL > 0
     135             : /** Get the default attribute from corresponding default attribute table.
     136             : 
     137             :     @param[in] nWhich Position in table
     138             :     @return Attribute if found, null pointer otherwise
     139             : */
     140             : const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
     141             : {
     142             :     OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN );
     143             : 
     144             :     SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
     145             :     OSL_ENSURE( pHt, "GetDfltFmtAttr(): Dflt == 0" );
     146             :     return pHt;
     147             : }
     148             : #else
     149             : /** Get the default attribute from corresponding default attribute table.
     150             : 
     151             :     @param[in] nWhich Position in table
     152             : */
     153        2021 : const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich )
     154             : {
     155        2021 :     return aAttrTab[ nWhich - POOLATTR_BEGIN ];
     156             : }
     157             : #endif
     158             : 
     159           0 : SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt )
     160           0 :     : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt )
     161             : {
     162           0 : }
     163             : 
     164           0 : SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) :
     165           0 :     SwMsgPoolItem( RES_VIRTPAGENUM_INFO ), pPage( 0 ), pOrigPage( pPg ), pFrm( 0 )
     166             : {
     167           0 : }
     168             : 
     169             : 
     170           7 : SwFindNearestNode::SwFindNearestNode( const SwNode& rNd )
     171           7 :     : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 )
     172             : {
     173           7 : }
     174             : 
     175           0 : void SwFindNearestNode::CheckNode( const SwNode& rNd )
     176             : {
     177           0 :     if( &pNd->GetNodes() == &rNd.GetNodes() )
     178             :     {
     179           0 :         sal_uLong nIdx = rNd.GetIndex();
     180           0 :         if( nIdx < pNd->GetIndex() &&
     181           0 :             ( !pFnd || nIdx > pFnd->GetIndex() ) &&
     182           0 :             nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
     183           0 :             pFnd = &rNd;
     184             :     }
     185           0 : }
     186             : 
     187      110123 : sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript )
     188             : {
     189             :     static const sal_uInt16 aLangMap[3] =
     190             :         { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
     191             :     static const sal_uInt16 aFontMap[3] =
     192             :         { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,  RES_CHRATR_CTL_FONT};
     193             :     static const sal_uInt16 aFontSizeMap[3] =
     194             :         { RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE,  RES_CHRATR_CTL_FONTSIZE };
     195             :     static const sal_uInt16 aWeightMap[3] =
     196             :         { RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT,  RES_CHRATR_CTL_WEIGHT};
     197             :     static const sal_uInt16 aPostureMap[3] =
     198             :         { RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE,  RES_CHRATR_CTL_POSTURE};
     199             : 
     200             :     const sal_uInt16* pM;
     201      110123 :     switch( nWhich )
     202             :     {
     203             :     case RES_CHRATR_LANGUAGE:
     204             :     case RES_CHRATR_CJK_LANGUAGE:
     205             :     case RES_CHRATR_CTL_LANGUAGE:
     206      108774 :         pM = aLangMap;
     207      108774 :         break;
     208             : 
     209             :     case RES_CHRATR_FONT:
     210             :     case RES_CHRATR_CJK_FONT:
     211             :     case RES_CHRATR_CTL_FONT:
     212        1349 :         pM = aFontMap;
     213        1349 :         break;
     214             : 
     215             :     case RES_CHRATR_FONTSIZE:
     216             :     case RES_CHRATR_CJK_FONTSIZE:
     217             :     case RES_CHRATR_CTL_FONTSIZE:
     218           0 :         pM = aFontSizeMap;
     219           0 :         break;
     220             : 
     221             :     case  RES_CHRATR_WEIGHT:
     222             :     case  RES_CHRATR_CJK_WEIGHT:
     223             :     case  RES_CHRATR_CTL_WEIGHT:
     224           0 :         pM = aWeightMap;
     225           0 :         break;
     226             : 
     227             :     case RES_CHRATR_POSTURE:
     228             :     case RES_CHRATR_CJK_POSTURE:
     229             :     case RES_CHRATR_CTL_POSTURE:
     230           0 :         pM = aPostureMap;
     231           0 :         break;
     232             : 
     233             :     default:
     234           0 :         pM = 0;
     235             :     }
     236             : 
     237             :     sal_uInt16 nRet;
     238      110123 :     if( pM )
     239             :     {
     240             :         using namespace ::com::sun::star;
     241             :         {
     242      110123 :             if( i18n::ScriptType::WEAK == nScript )
     243         556 :                 nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
     244      110123 :             switch( nScript)
     245             :             {
     246             :             case i18n::ScriptType::COMPLEX:
     247           0 :                 ++pM;  // no break;
     248             :             case i18n::ScriptType::ASIAN:
     249          46 :                 ++pM;  // no break;
     250             :             default:
     251      110123 :                 nRet = *pM;
     252             :             }
     253             :         }
     254             :     }
     255             :     else
     256           0 :         nRet = nWhich;
     257      110123 :     return nRet;
     258          99 : }
     259             : 
     260             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10