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

Generated by: LCOV version 1.10