LCOV - code coverage report
Current view: top level - sw/source/core/undo - unfmco.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 30 0.0 %
Date: 2014-04-14 Functions: 0 8 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 "swundo.hxx"
      22             : #include "pam.hxx"
      23             : #include "ndtxt.hxx"
      24             : #include <UndoCore.hxx>
      25             : #include "rolbck.hxx"
      26             : #include "docary.hxx"
      27             : 
      28           0 : SwUndoFmtColl::SwUndoFmtColl( const SwPaM& rRange,
      29             :                               SwFmtColl* pColl,
      30             :                               const bool bReset,
      31             :                               const bool bResetListAttrs )
      32             :     : SwUndo( UNDO_SETFMTCOLL ),
      33             :       SwUndRng( rRange ),
      34           0 :       pHistory( new SwHistory ),
      35             :       pFmtColl( pColl ),
      36             :       mbReset( bReset ),
      37           0 :       mbResetListAttrs( bResetListAttrs )
      38             : {
      39             :     // #i31191#
      40           0 :     if ( pColl )
      41           0 :         aFmtName = pColl->GetName();
      42           0 : }
      43             : 
      44           0 : SwUndoFmtColl::~SwUndoFmtColl()
      45             : {
      46           0 :     delete pHistory;
      47           0 : }
      48             : 
      49           0 : void SwUndoFmtColl::UndoImpl(::sw::UndoRedoContext & rContext)
      50             : {
      51             :     // restore old values
      52           0 :     pHistory->TmpRollback(& rContext.GetDoc(), 0);
      53           0 :     pHistory->SetTmpEnd( pHistory->Count() );
      54             : 
      55             :     // create cursor for undo range
      56           0 :     AddUndoRedoPaM(rContext);
      57           0 : }
      58             : 
      59           0 : void SwUndoFmtColl::RedoImpl(::sw::UndoRedoContext & rContext)
      60             : {
      61           0 :     SwPaM & rPam = AddUndoRedoPaM(rContext);
      62             : 
      63           0 :     DoSetFmtColl(rContext.GetDoc(), rPam);
      64           0 : }
      65             : 
      66           0 : void SwUndoFmtColl::RepeatImpl(::sw::RepeatContext & rContext)
      67             : {
      68           0 :     DoSetFmtColl(rContext.GetDoc(), rContext.GetRepeatPaM());
      69           0 : }
      70             : 
      71           0 : void SwUndoFmtColl::DoSetFmtColl(SwDoc & rDoc, SwPaM & rPaM)
      72             : {
      73             :     // Only one TextFrmColl can be applied to a section, thus request only in
      74             :     // this array.
      75             :     sal_uInt16 const nPos = rDoc.GetTxtFmtColls()->GetPos(
      76           0 :                                                      (SwTxtFmtColl*)pFmtColl );
      77             :     // does the format still exist?
      78           0 :     if( USHRT_MAX != nPos )
      79             :     {
      80             :         rDoc.SetTxtFmtColl(rPaM,
      81             :                                           (SwTxtFmtColl*)pFmtColl,
      82             :                                           mbReset,
      83           0 :                                           mbResetListAttrs );
      84             :     }
      85           0 : }
      86             : 
      87           0 : SwRewriter SwUndoFmtColl::GetRewriter() const
      88             : {
      89           0 :     SwRewriter aResult;
      90             : 
      91             :     // #i31191# Use stored format name instead of
      92             :     // pFmtColl->GetName(), because pFmtColl does not have to be available
      93             :     // anymore.
      94           0 :     aResult.AddRule(UndoArg1, aFmtName );
      95             : 
      96           0 :     return aResult;
      97             : }
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10