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

Generated by: LCOV version 1.10