LCOV - code coverage report
Current view: top level - editeng/source/outliner - outlundo.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 108 0.0 %
Date: 2014-04-14 Functions: 0 24 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             : 
      21             : #include <svl/intitem.hxx>
      22             : #include <editeng/editeng.hxx>
      23             : #include <editeng/editview.hxx>
      24             : #include <editeng/editdata.hxx>
      25             : #include <editeng/eerdll.hxx>
      26             : #include <editeng/lrspitem.hxx>
      27             : #include <editeng/fhgtitem.hxx>
      28             : 
      29             : #include <editeng/outliner.hxx>
      30             : #include <outlundo.hxx>
      31             : 
      32             : 
      33           0 : OutlinerUndoBase::OutlinerUndoBase( sal_uInt16 _nId, Outliner* pOutliner )
      34           0 :     : EditUndo( _nId, NULL )
      35             : {
      36             :     DBG_ASSERT( pOutliner, "Undo: Outliner?!" );
      37           0 :     mpOutliner = pOutliner;
      38           0 : }
      39             : 
      40           0 : OutlinerUndoChangeParaFlags::OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_Int32 nPara, sal_uInt16 nOldFlags, sal_uInt16 nNewFlags )
      41           0 : : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
      42             : {
      43           0 :     mnPara = nPara;
      44           0 :     mnOldFlags = nOldFlags;
      45           0 :     mnNewFlags = nNewFlags;
      46           0 : }
      47             : 
      48           0 : void OutlinerUndoChangeParaFlags::Undo()
      49             : {
      50           0 :     ImplChangeFlags( mnOldFlags );
      51           0 : }
      52             : 
      53           0 : void OutlinerUndoChangeParaFlags::Redo()
      54             : {
      55           0 :     ImplChangeFlags( mnNewFlags );
      56           0 : }
      57             : 
      58           0 : void OutlinerUndoChangeParaFlags::ImplChangeFlags( sal_uInt16 nFlags )
      59             : {
      60           0 :     Outliner* pOutliner = GetOutliner();
      61           0 :     Paragraph* pPara = pOutliner->GetParagraph( mnPara );
      62           0 :     if( pPara )
      63             :     {
      64           0 :         pOutliner->nDepthChangedHdlPrevDepth = pPara->GetDepth();
      65           0 :         pOutliner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
      66           0 :         pOutliner->pHdlParagraph = pPara;
      67             : 
      68           0 :         pPara->nFlags = nFlags;
      69           0 :         pOutliner->DepthChangedHdl();
      70             :     }
      71           0 : }
      72             : 
      73           0 : OutlinerUndoChangeParaNumberingRestart::OutlinerUndoChangeParaNumberingRestart( Outliner* pOutliner, sal_Int32 nPara,
      74             :         sal_Int16 nOldNumberingStartValue, sal_Int16 nNewNumberingStartValue,
      75             :         sal_Bool  bOldParaIsNumberingRestart, sal_Bool bNewParaIsNumberingRestart )
      76           0 : : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
      77             : {
      78           0 :     mnPara = nPara;
      79             : 
      80           0 :     maUndoData.mnNumberingStartValue = nOldNumberingStartValue;
      81           0 :     maUndoData.mbParaIsNumberingRestart = bOldParaIsNumberingRestart;
      82           0 :     maRedoData.mnNumberingStartValue = nNewNumberingStartValue;
      83           0 :     maRedoData.mbParaIsNumberingRestart = bNewParaIsNumberingRestart;
      84           0 : }
      85             : 
      86           0 : void OutlinerUndoChangeParaNumberingRestart::Undo()
      87             : {
      88           0 :     ImplApplyData( maUndoData );
      89           0 : }
      90             : 
      91           0 : void OutlinerUndoChangeParaNumberingRestart::Redo()
      92             : {
      93           0 :     ImplApplyData( maRedoData );
      94           0 : }
      95             : 
      96           0 : void OutlinerUndoChangeParaNumberingRestart::ImplApplyData( const ParaRestartData& rData )
      97             : {
      98           0 :     Outliner* pOutliner = GetOutliner();
      99           0 :     pOutliner->SetNumberingStartValue( mnPara, rData.mnNumberingStartValue );
     100           0 :     pOutliner->SetParaIsNumberingRestart( mnPara, rData.mbParaIsNumberingRestart );
     101           0 : }
     102             : 
     103           0 : OutlinerUndoChangeDepth::OutlinerUndoChangeDepth( Outliner* pOutliner, sal_Int32 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth )
     104           0 :     : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
     105             : {
     106           0 :     mnPara = nPara;
     107           0 :     mnOldDepth = nOldDepth;
     108           0 :     mnNewDepth = nNewDepth;
     109           0 : }
     110             : 
     111           0 : void OutlinerUndoChangeDepth::Undo()
     112             : {
     113           0 :     GetOutliner()->ImplInitDepth( mnPara, mnOldDepth, false );
     114           0 : }
     115             : 
     116           0 : void OutlinerUndoChangeDepth::Redo()
     117             : {
     118           0 :     GetOutliner()->ImplInitDepth( mnPara, mnNewDepth, false );
     119           0 : }
     120             : 
     121           0 : void OutlinerUndoChangeDepth::Repeat()
     122             : {
     123             :     OSL_FAIL( "Repeat not implemented!" );
     124           0 : }
     125             : 
     126             : 
     127           0 : OutlinerUndoCheckPara::OutlinerUndoCheckPara( Outliner* pOutliner, sal_Int32 nPara )
     128           0 :     : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
     129             : {
     130           0 :     mnPara = nPara;
     131           0 : }
     132             : 
     133           0 : void OutlinerUndoCheckPara::Undo()
     134             : {
     135           0 :     Paragraph* pPara = GetOutliner()->GetParagraph( mnPara );
     136           0 :     pPara->Invalidate();
     137           0 :     GetOutliner()->ImplCalcBulletText( mnPara, false, false );
     138           0 : }
     139             : 
     140           0 : void OutlinerUndoCheckPara::Redo()
     141             : {
     142           0 :     Paragraph* pPara = GetOutliner()->GetParagraph( mnPara );
     143           0 :     pPara->Invalidate();
     144           0 :     GetOutliner()->ImplCalcBulletText( mnPara, false, false );
     145           0 : }
     146             : 
     147           0 : void OutlinerUndoCheckPara::Repeat()
     148             : {
     149             :     OSL_FAIL( "Repeat not implemented!" );
     150           0 : }
     151             : 
     152             : 
     153           0 : OLUndoExpand::OLUndoExpand(Outliner* pOut, sal_uInt16 _nId )
     154           0 :     : EditUndo( _nId, 0 )
     155             : {
     156             :     DBG_ASSERT(pOut,"Undo:No Outliner");
     157           0 :     pOutliner = pOut;
     158           0 :     nCount = 0;
     159           0 :     pParas = 0;
     160           0 : }
     161             : 
     162             : 
     163           0 : OLUndoExpand::~OLUndoExpand()
     164             : {
     165           0 :     delete pParas;
     166           0 : }
     167             : 
     168             : 
     169           0 : void OLUndoExpand::Restore( sal_Bool bUndo )
     170             : {
     171             :     DBG_ASSERT(pOutliner,"Undo:No Outliner");
     172             :     DBG_ASSERT(pOutliner->pEditEngine,"Outliner already deleted");
     173             :     Paragraph* pPara;
     174             : 
     175           0 :     sal_Bool bExpand = sal_False;
     176           0 :     sal_uInt16 _nId = GetId();
     177           0 :     if((_nId == OLUNDO_EXPAND && !bUndo) || (_nId == OLUNDO_COLLAPSE && bUndo))
     178           0 :         bExpand = sal_True;
     179           0 :     if( !pParas )
     180             :     {
     181           0 :         pPara = pOutliner->GetParagraph( nCount );
     182           0 :         if( bExpand )
     183           0 :             pOutliner->Expand( pPara );
     184             :         else
     185           0 :             pOutliner->Collapse( pPara );
     186             :     }
     187             :     else
     188             :     {
     189           0 :         for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
     190             :         {
     191           0 :             pPara = pOutliner->GetParagraph( pParas[nIdx] );
     192           0 :             if( bExpand )
     193           0 :                 pOutliner->Expand( pPara );
     194             :             else
     195           0 :                 pOutliner->Collapse( pPara );
     196             :         }
     197             :     }
     198           0 : }
     199             : 
     200             : 
     201           0 : void OLUndoExpand::Undo()
     202             : {
     203           0 :     Restore( sal_True );
     204           0 : }
     205             : 
     206             : 
     207           0 : void OLUndoExpand::Redo()
     208             : {
     209           0 :     Restore( sal_False );
     210           0 : }
     211             : 
     212             : 
     213           0 : void OLUndoExpand::Repeat()
     214             : {
     215             :     OSL_FAIL("Not implemented");
     216           0 : }
     217             : 
     218             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10