LCOV - code coverage report
Current view: top level - sw/source/core/edit - edfmt.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 65 0.0 %
Date: 2014-04-14 Functions: 0 15 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 "doc.hxx"
      21             : #include "editsh.hxx"
      22             : #include "swtable.hxx"
      23             : #include "pam.hxx"
      24             : #include <docary.hxx>
      25             : #include <fchrfmt.hxx>
      26             : #include <frmfmt.hxx>
      27             : #include <charfmt.hxx>
      28             : #include "ndtxt.hxx"
      29             : #include "hints.hxx"
      30             : 
      31           0 : sal_uInt16 SwEditShell::GetCharFmtCount() const
      32             : {
      33           0 :     return GetDoc()->GetCharFmts()->size();
      34             : }
      35             : 
      36           0 : SwCharFmt& SwEditShell::GetCharFmt(sal_uInt16 nFmt) const
      37             : {
      38           0 :     return *((*(GetDoc()->GetCharFmts()))[nFmt]);
      39             : }
      40             : 
      41           0 : SwCharFmt* SwEditShell::GetCurCharFmt() const
      42             : {
      43           0 :     SwCharFmt *pFmt = 0;
      44           0 :     SfxItemSet aSet( GetDoc()->GetAttrPool(), RES_TXTATR_CHARFMT,
      45           0 :                                                 RES_TXTATR_CHARFMT );
      46             :     const SfxPoolItem* pItem;
      47           0 :     if( GetCurAttr( aSet ) && SFX_ITEM_SET ==
      48           0 :         aSet.GetItemState( RES_TXTATR_CHARFMT, false, &pItem ) )
      49           0 :         pFmt = ((SwFmtCharFmt*)pItem)->GetCharFmt();
      50             : 
      51           0 :     return pFmt;
      52             : }
      53             : 
      54           0 : void SwEditShell::FillByEx(SwCharFmt* pCharFmt, sal_Bool bReset)
      55             : {
      56           0 :     if ( bReset )
      57             :     {
      58           0 :         pCharFmt->ResetAllFmtAttr();
      59             :     }
      60             : 
      61           0 :     SwPaM* pPam = GetCrsr();
      62           0 :     const SwCntntNode* pCNd = pPam->GetCntntNode();
      63           0 :     if( pCNd->IsTxtNode() )
      64             :     {
      65           0 :         SwTxtNode const*const pTxtNode(static_cast<SwTxtNode const*>(pCNd));
      66             :         sal_Int32 nStt;
      67             :         sal_Int32 nEnd;
      68           0 :         if( pPam->HasMark() )
      69             :         {
      70           0 :             const SwPosition* pPtPos = pPam->GetPoint();
      71           0 :             const SwPosition* pMkPos = pPam->GetMark();
      72           0 :             if( pPtPos->nNode == pMkPos->nNode )        // in the same node?
      73             :             {
      74           0 :                 nStt = pPtPos->nContent.GetIndex();
      75           0 :                 if( nStt < pMkPos->nContent.GetIndex() )
      76           0 :                     nEnd = pMkPos->nContent.GetIndex();
      77             :                 else
      78             :                 {
      79           0 :                     nEnd = nStt;
      80           0 :                     nStt = pMkPos->nContent.GetIndex();
      81             :                 }
      82             :             }
      83             :             else
      84             :             {
      85           0 :                 nStt = pMkPos->nContent.GetIndex();
      86           0 :                 if( pPtPos->nNode < pMkPos->nNode )
      87             :                 {
      88           0 :                     nEnd = nStt;
      89           0 :                     nStt = 0;
      90             :                 }
      91             :                 else
      92           0 :                     nEnd = pTxtNode->GetTxt().getLength();
      93             :             }
      94             :         }
      95             :         else
      96           0 :             nStt = nEnd = pPam->GetPoint()->nContent.GetIndex();
      97             : 
      98           0 :         SfxItemSet aSet( mpDoc->GetAttrPool(),
      99           0 :                             pCharFmt->GetAttrSet().GetRanges() );
     100           0 :         pTxtNode->GetAttr( aSet, nStt, nEnd );
     101           0 :         pCharFmt->SetFmtAttr( aSet );
     102             :     }
     103           0 :     else if( pCNd->HasSwAttrSet() )
     104           0 :         pCharFmt->SetFmtAttr( *pCNd->GetpSwAttrSet() );
     105           0 : }
     106             : 
     107           0 : sal_uInt16 SwEditShell::GetTblFrmFmtCount(bool bUsed) const
     108             : {
     109           0 :     return GetDoc()->GetTblFrmFmtCount(bUsed);
     110             : }
     111             : 
     112           0 : SwFrmFmt& SwEditShell::GetTblFrmFmt(sal_uInt16 nFmt, bool bUsed ) const
     113             : {
     114           0 :     return GetDoc()->GetTblFrmFmt(nFmt, bUsed );
     115             : }
     116             : 
     117           0 : OUString SwEditShell::GetUniqueTblName() const
     118             : {
     119           0 :     return GetDoc()->GetUniqueTblName();
     120             : }
     121             : 
     122           0 : SwCharFmt* SwEditShell::MakeCharFmt( const OUString& rName,
     123             :                                     SwCharFmt* pDerivedFrom )
     124             : {
     125           0 :     if( !pDerivedFrom )
     126           0 :         pDerivedFrom = GetDoc()->GetDfltCharFmt();
     127             : 
     128           0 :     return GetDoc()->MakeCharFmt( rName, pDerivedFrom );
     129             : }
     130             : 
     131           0 : SwTxtFmtColl* SwEditShell::GetTxtCollFromPool( sal_uInt16 nId )
     132             : {
     133           0 :     return GetDoc()->GetTxtCollFromPool( nId );
     134             : }
     135             : 
     136             : /// return the requested automatic format - base-class !
     137           0 : SwFmt* SwEditShell::GetFmtFromPool( sal_uInt16 nId )
     138             : {
     139           0 :     return GetDoc()->GetFmtFromPool( nId );
     140             : }
     141             : 
     142           0 : SwPageDesc* SwEditShell::GetPageDescFromPool( sal_uInt16 nId )
     143             : {
     144           0 :     return GetDoc()->GetPageDescFromPool( nId );
     145             : }
     146             : 
     147           0 : bool SwEditShell::IsUsed( const SwModify& rModify ) const
     148             : {
     149           0 :     return mpDoc->IsUsed( rModify );
     150             : }
     151             : 
     152           0 : const SwFlyFrmFmt* SwEditShell::FindFlyByName( const OUString& rName, sal_uInt8 nNdTyp ) const
     153             : {
     154           0 :     return mpDoc->FindFlyByName(rName, nNdTyp);
     155             : }
     156             : 
     157           0 : SwCharFmt* SwEditShell::FindCharFmtByName( const OUString& rName ) const
     158             : {
     159           0 :     return mpDoc->FindCharFmtByName( rName );
     160             : }
     161             : 
     162           0 : SwTxtFmtColl* SwEditShell::FindTxtFmtCollByName( const OUString& rName ) const
     163             : {
     164           0 :     return mpDoc->FindTxtFmtCollByName( rName );
     165             : }
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10