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

Generated by: LCOV version 1.10