LCOV - code coverage report
Current view: top level - sw/source/core/edit - edfmt.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 66 16.7 %
Date: 2015-06-13 12:38:46 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::GetCharFormatCount() const
      33             : {
      34           0 :     return GetDoc()->GetCharFormats()->size();
      35             : }
      36             : 
      37           0 : SwCharFormat& SwEditShell::GetCharFormat(sal_uInt16 nFormat) const
      38             : {
      39           0 :     return *((*(GetDoc()->GetCharFormats()))[nFormat]);
      40             : }
      41             : 
      42        1664 : SwCharFormat* SwEditShell::GetCurCharFormat() const
      43             : {
      44        1664 :     SwCharFormat *pFormat = 0;
      45        1664 :     SfxItemSet aSet( GetDoc()->GetAttrPool(), RES_TXTATR_CHARFMT,
      46        1664 :                                                 RES_TXTATR_CHARFMT );
      47             :     const SfxPoolItem* pItem;
      48        3328 :     if( GetCurAttr( aSet ) && SfxItemState::SET ==
      49        1664 :         aSet.GetItemState( RES_TXTATR_CHARFMT, false, &pItem ) )
      50          23 :         pFormat = static_cast<const SwFormatCharFormat*>(pItem)->GetCharFormat();
      51             : 
      52        1664 :     return pFormat;
      53             : }
      54             : 
      55           0 : void SwEditShell::FillByEx(SwCharFormat* pCharFormat, bool bReset)
      56             : {
      57           0 :     if ( bReset )
      58             :     {
      59           0 :         pCharFormat->ResetAllFormatAttr();
      60             :     }
      61             : 
      62           0 :     SwPaM* pPam = GetCrsr();
      63           0 :     const SwContentNode* pCNd = pPam->GetContentNode();
      64           0 :     if( pCNd->IsTextNode() )
      65             :     {
      66           0 :         SwTextNode const*const pTextNode(pCNd->GetTextNode());
      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 = pTextNode->GetText().getLength();
      94             :             }
      95             :         }
      96             :         else
      97           0 :             nStt = nEnd = pPam->GetPoint()->nContent.GetIndex();
      98             : 
      99           0 :         SfxItemSet aSet( mpDoc->GetAttrPool(),
     100           0 :                             pCharFormat->GetAttrSet().GetRanges() );
     101           0 :         pTextNode->GetAttr( aSet, nStt, nEnd );
     102           0 :         pCharFormat->SetFormatAttr( aSet );
     103             :     }
     104           0 :     else if( pCNd->HasSwAttrSet() )
     105           0 :         pCharFormat->SetFormatAttr( *pCNd->GetpSwAttrSet() );
     106           0 : }
     107             : 
     108          40 : size_t SwEditShell::GetTableFrameFormatCount(bool bUsed) const
     109             : {
     110          40 :     return GetDoc()->GetTableFrameFormatCount(bUsed);
     111             : }
     112             : 
     113           0 : SwFrameFormat& SwEditShell::GetTableFrameFormat(size_t nFormat, bool bUsed ) const
     114             : {
     115           0 :     return GetDoc()->GetTableFrameFormat(nFormat, bUsed );
     116             : }
     117             : 
     118           0 : OUString SwEditShell::GetUniqueTableName() const
     119             : {
     120           0 :     return GetDoc()->GetUniqueTableName();
     121             : }
     122             : 
     123           0 : SwCharFormat* SwEditShell::MakeCharFormat( const OUString& rName,
     124             :                                     SwCharFormat* pDerivedFrom )
     125             : {
     126           0 :     if( !pDerivedFrom )
     127           0 :         pDerivedFrom = GetDoc()->GetDfltCharFormat();
     128             : 
     129           0 :     return GetDoc()->MakeCharFormat( rName, pDerivedFrom );
     130             : }
     131             : 
     132           0 : SwTextFormatColl* SwEditShell::GetTextCollFromPool( sal_uInt16 nId )
     133             : {
     134           0 :     return GetDoc()->getIDocumentStylePoolAccess().GetTextCollFromPool( nId );
     135             : }
     136             : 
     137             : /// return the requested automatic format - base-class !
     138           0 : SwFormat* SwEditShell::GetFormatFromPool( sal_uInt16 nId )
     139             : {
     140           0 :     return GetDoc()->getIDocumentStylePoolAccess().GetFormatFromPool( 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 SwFlyFrameFormat* SwEditShell::FindFlyByName( const OUString& rName, sal_uInt8 nNdTyp ) const
     154             : {
     155           0 :     return mpDoc->FindFlyByName(rName, nNdTyp);
     156             : }
     157             : 
     158           0 : SwCharFormat* SwEditShell::FindCharFormatByName( const OUString& rName ) const
     159             : {
     160           0 :     return mpDoc->FindCharFormatByName( rName );
     161             : }
     162             : 
     163           0 : SwTextFormatColl* SwEditShell::FindTextFormatCollByName( const OUString& rName ) const
     164             : {
     165           0 :     return mpDoc->FindTextFormatCollByName( rName );
     166         177 : }
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11