LCOV - code coverage report
Current view: top level - sw/source/core/edit - edatmisc.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 77 0.0 %
Date: 2014-04-14 Functions: 0 6 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 <editsh.hxx>
      21             : #include <doc.hxx>
      22             : #include <IDocumentUndoRedo.hxx>
      23             : #include <pam.hxx>
      24             : #include <edimp.hxx>
      25             : #include <swundo.hxx>
      26             : #include <ndtxt.hxx>
      27             : 
      28             : /*
      29             :  * hard formatting (Attribute)
      30             :  */
      31             : 
      32           0 : void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
      33             : {
      34           0 :     SET_CURR_SHELL( this );
      35           0 :     SwPaM* pCrsr = pPaM ? pPaM : GetCrsr( );
      36             : 
      37           0 :     StartAllAction();
      38           0 :     bool bUndoGroup = pCrsr->GetNext() != pCrsr;
      39           0 :     if( bUndoGroup )
      40             :     {
      41           0 :         GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_RESETATTR, NULL);
      42             :     }
      43             : 
      44           0 :         SwPaM* pStartCrsr = pCrsr;
      45           0 :         do {
      46           0 :                 GetDoc()->ResetAttrs(*pCrsr, true, attrs);
      47           0 :         } while ( ( pCrsr = ( SwPaM* ) pCrsr->GetNext() ) != pStartCrsr );
      48             : 
      49           0 :     if( bUndoGroup )
      50             :     {
      51           0 :         GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_RESETATTR, NULL);
      52             :     }
      53           0 :     CallChgLnk();
      54           0 :     EndAllAction();
      55           0 : }
      56             : 
      57           0 : void SwEditShell::GCAttr()
      58             : {
      59           0 :     FOREACHPAM_START(GetCrsr())
      60           0 :         if ( !PCURCRSR->HasMark() )
      61             :         {
      62             :             SwTxtNode *const pTxtNode =
      63           0 :                 PCURCRSR->GetPoint()->nNode.GetNode().GetTxtNode();
      64           0 :             if (pTxtNode)
      65             :             {
      66           0 :                 pTxtNode->GCAttr();
      67             :             }
      68             :         }
      69             :         else
      70             :         {
      71           0 :             const SwNodeIndex& rEnd = PCURCRSR->End()->nNode;
      72           0 :             SwNodeIndex aIdx( PCURCRSR->Start()->nNode );
      73           0 :             SwNode* pNd = &aIdx.GetNode();
      74           0 :             do {
      75           0 :                 if( pNd->IsTxtNode() )
      76           0 :                     ((SwTxtNode*)pNd)->GCAttr();
      77             :             }
      78           0 :             while( 0 != ( pNd = GetDoc()->GetNodes().GoNext( &aIdx )) &&
      79           0 :                     aIdx <= rEnd );
      80             :         }
      81           0 :     FOREACHPAM_END()
      82           0 : }
      83             : 
      84             : /// Set the attribute as new default attribute in the document.
      85           0 : void SwEditShell::SetDefault( const SfxPoolItem& rFmtHint )
      86             : {
      87             :     // 7502: Action-Parenthesis
      88           0 :     StartAllAction();
      89           0 :     GetDoc()->SetDefault( rFmtHint );
      90           0 :     EndAllAction();
      91           0 : }
      92             : 
      93             : /// request the default attribute in this document.
      94           0 : const SfxPoolItem& SwEditShell::GetDefault( sal_uInt16 nFmtHint ) const
      95             : {
      96           0 :     return GetDoc()->GetDefault( nFmtHint );
      97             : }
      98             : 
      99           0 : void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, sal_uInt16 nFlags )
     100             : {
     101           0 :     SET_CURR_SHELL( this );
     102           0 :     StartAllAction();
     103           0 :     SwPaM* pCrsr = GetCrsr();
     104           0 :     if( pCrsr->GetNext() != pCrsr )     // Ring of Cursors
     105             :     {
     106           0 :         sal_Bool bIsTblMode = IsTableMode();
     107           0 :         GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
     108             : 
     109           0 :         FOREACHPAM_START(GetCrsr())
     110           0 :             if( PCURCRSR->HasMark() && ( bIsTblMode ||
     111           0 :                 *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ))
     112             :             {
     113           0 :                 GetDoc()->InsertPoolItem(*PCURCRSR, rHint, nFlags );
     114             :             }
     115           0 :         FOREACHPAM_END()
     116             : 
     117           0 :         GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
     118             :     }
     119             :     else
     120             :     {
     121           0 :         if( !HasSelection() )
     122           0 :             UpdateAttr();
     123           0 :         GetDoc()->InsertPoolItem( *pCrsr, rHint, nFlags );
     124             :     }
     125           0 :     EndAllAction();
     126           0 : }
     127             : 
     128           0 : void SwEditShell::SetAttrSet( const SfxItemSet& rSet, sal_uInt16 nFlags, SwPaM* pPaM )
     129             : {
     130           0 :     SET_CURR_SHELL( this );
     131             : 
     132           0 :     SwPaM* pCrsr = pPaM ? pPaM : GetCrsr();
     133           0 :     StartAllAction();
     134           0 :     if( pCrsr->GetNext() != pCrsr )     // Ring of Cursors
     135             :     {
     136           0 :         sal_Bool bIsTblMode = IsTableMode();
     137           0 :         GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
     138             : 
     139           0 :         SwPaM* pTmpCrsr = pCrsr;
     140           0 :         SwPaM* pStartPaM = pCrsr;
     141           0 :         do {
     142           0 :             if( pTmpCrsr->HasMark() && ( bIsTblMode ||
     143           0 :                 *pTmpCrsr->GetPoint() != *pTmpCrsr->GetMark() ))
     144             :             {
     145           0 :                 GetDoc()->InsertItemSet(*pTmpCrsr, rSet, nFlags );
     146             :             }
     147           0 :         } while ( ( pTmpCrsr = (SwPaM*)pTmpCrsr->GetNext() ) != pStartPaM );
     148             : 
     149           0 :         GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
     150             :     }
     151             :     else
     152             :     {
     153           0 :         if( !HasSelection() )
     154           0 :             UpdateAttr();
     155           0 :         GetDoc()->InsertItemSet( *pCrsr, rSet, nFlags );
     156             :     }
     157           0 :     EndAllAction();
     158           0 : }
     159             : 
     160             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10