LCOV - code coverage report
Current view: top level - editeng/source/outliner - outlundo.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 108 14.8 %
Date: 2012-08-25 Functions: 3 24 12.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 20 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <svl/intitem.hxx>
      31                 :            : #include <editeng/editeng.hxx>
      32                 :            : #include <editeng/editview.hxx>
      33                 :            : #include <editeng/editdata.hxx>
      34                 :            : #include <editeng/eerdll.hxx>
      35                 :            : #include <editeng/lrspitem.hxx>
      36                 :            : #include <editeng/fhgtitem.hxx>
      37                 :            : 
      38                 :            : #define _OUTLINER_CXX
      39                 :            : #include <editeng/outliner.hxx>
      40                 :            : #include <outlundo.hxx>
      41                 :            : 
      42                 :            : 
      43                 :         52 : OutlinerUndoBase::OutlinerUndoBase( sal_uInt16 _nId, Outliner* pOutliner )
      44                 :         52 :     : EditUndo( _nId, NULL )
      45                 :            : {
      46                 :            :     DBG_ASSERT( pOutliner, "Undo: Outliner?!" );
      47                 :         52 :     mpOutliner = pOutliner;
      48                 :         52 : }
      49                 :            : 
      50                 :          0 : OutlinerUndoChangeParaFlags::OutlinerUndoChangeParaFlags( Outliner* pOutliner, sal_uInt16 nPara, sal_uInt16 nOldFlags, sal_uInt16 nNewFlags )
      51                 :          0 : : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
      52                 :            : {
      53                 :          0 :     mnPara = nPara;
      54                 :          0 :     mnOldFlags = nOldFlags;
      55                 :          0 :     mnNewFlags = nNewFlags;
      56                 :          0 : }
      57                 :            : 
      58                 :          0 : void OutlinerUndoChangeParaFlags::Undo()
      59                 :            : {
      60                 :          0 :     ImplChangeFlags( mnOldFlags );
      61                 :          0 : }
      62                 :            : 
      63                 :          0 : void OutlinerUndoChangeParaFlags::Redo()
      64                 :            : {
      65                 :          0 :     ImplChangeFlags( mnNewFlags );
      66                 :          0 : }
      67                 :            : 
      68                 :          0 : void OutlinerUndoChangeParaFlags::ImplChangeFlags( sal_uInt16 nFlags )
      69                 :            : {
      70                 :          0 :     Outliner* pOutliner = GetOutliner();
      71                 :          0 :     Paragraph* pPara = pOutliner->GetParagraph( mnPara );
      72         [ #  # ]:          0 :     if( pPara )
      73                 :            :     {
      74                 :          0 :         pOutliner->nDepthChangedHdlPrevDepth = pPara->GetDepth();
      75                 :          0 :         pOutliner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
      76                 :          0 :         pOutliner->pHdlParagraph = pPara;
      77                 :            : 
      78                 :          0 :         pPara->nFlags = nFlags;
      79                 :          0 :         pOutliner->DepthChangedHdl();
      80                 :            :     }
      81                 :          0 : }
      82                 :            : 
      83                 :         16 : OutlinerUndoChangeParaNumberingRestart::OutlinerUndoChangeParaNumberingRestart( Outliner* pOutliner, sal_uInt16 nPara,
      84                 :            :         sal_Int16 nOldNumberingStartValue, sal_Int16 nNewNumberingStartValue,
      85                 :            :         sal_Bool  bOldParaIsNumberingRestart, sal_Bool bNewParaIsNumberingRestart )
      86                 :         16 : : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
      87                 :            : {
      88                 :         16 :     mnPara = nPara;
      89                 :            : 
      90                 :         16 :     maUndoData.mnNumberingStartValue = nOldNumberingStartValue;
      91                 :         16 :     maUndoData.mbParaIsNumberingRestart = bOldParaIsNumberingRestart;
      92                 :         16 :     maRedoData.mnNumberingStartValue = nNewNumberingStartValue;
      93                 :         16 :     maRedoData.mbParaIsNumberingRestart = bNewParaIsNumberingRestart;
      94                 :         16 : }
      95                 :            : 
      96                 :          0 : void OutlinerUndoChangeParaNumberingRestart::Undo()
      97                 :            : {
      98                 :          0 :     ImplApplyData( maUndoData );
      99                 :          0 : }
     100                 :            : 
     101                 :          0 : void OutlinerUndoChangeParaNumberingRestart::Redo()
     102                 :            : {
     103                 :          0 :     ImplApplyData( maRedoData );
     104                 :          0 : }
     105                 :            : 
     106                 :          0 : void OutlinerUndoChangeParaNumberingRestart::ImplApplyData( const ParaRestartData& rData )
     107                 :            : {
     108                 :          0 :     Outliner* pOutliner = GetOutliner();
     109                 :          0 :     pOutliner->SetNumberingStartValue( mnPara, rData.mnNumberingStartValue );
     110                 :          0 :     pOutliner->SetParaIsNumberingRestart( mnPara, rData.mbParaIsNumberingRestart );
     111                 :          0 : }
     112                 :            : 
     113                 :          0 : OutlinerUndoChangeDepth::OutlinerUndoChangeDepth( Outliner* pOutliner, sal_uInt16 nPara, sal_Int16 nOldDepth, sal_Int16 nNewDepth )
     114                 :          0 :     : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
     115                 :            : {
     116                 :          0 :     mnPara = nPara;
     117                 :          0 :     mnOldDepth = nOldDepth;
     118                 :          0 :     mnNewDepth = nNewDepth;
     119                 :          0 : }
     120                 :            : 
     121                 :          0 : void OutlinerUndoChangeDepth::Undo()
     122                 :            : {
     123                 :          0 :     GetOutliner()->ImplInitDepth( mnPara, mnOldDepth, sal_False );
     124                 :          0 : }
     125                 :            : 
     126                 :          0 : void OutlinerUndoChangeDepth::Redo()
     127                 :            : {
     128                 :          0 :     GetOutliner()->ImplInitDepth( mnPara, mnNewDepth, sal_False );
     129                 :          0 : }
     130                 :            : 
     131                 :          0 : void OutlinerUndoChangeDepth::Repeat()
     132                 :            : {
     133                 :            :     OSL_FAIL( "Repeat not implemented!" );
     134                 :          0 : }
     135                 :            : 
     136                 :            : 
     137                 :         36 : OutlinerUndoCheckPara::OutlinerUndoCheckPara( Outliner* pOutliner, sal_uInt16 nPara )
     138                 :         36 :     : OutlinerUndoBase( OLUNDO_DEPTH, pOutliner )
     139                 :            : {
     140                 :         36 :     mnPara = nPara;
     141                 :         36 : }
     142                 :            : 
     143                 :          0 : void OutlinerUndoCheckPara::Undo()
     144                 :            : {
     145                 :          0 :     Paragraph* pPara = GetOutliner()->GetParagraph( mnPara );
     146                 :          0 :     pPara->Invalidate();
     147                 :          0 :     GetOutliner()->ImplCalcBulletText( mnPara, sal_False, sal_False );
     148                 :          0 : }
     149                 :            : 
     150                 :          0 : void OutlinerUndoCheckPara::Redo()
     151                 :            : {
     152                 :          0 :     Paragraph* pPara = GetOutliner()->GetParagraph( mnPara );
     153                 :          0 :     pPara->Invalidate();
     154                 :          0 :     GetOutliner()->ImplCalcBulletText( mnPara, sal_False, sal_False );
     155                 :          0 : }
     156                 :            : 
     157                 :          0 : void OutlinerUndoCheckPara::Repeat()
     158                 :            : {
     159                 :            :     OSL_FAIL( "Repeat not implemented!" );
     160                 :          0 : }
     161                 :            : 
     162                 :            : DBG_NAME(OLUndoExpand);
     163                 :            : 
     164                 :          0 : OLUndoExpand::OLUndoExpand(Outliner* pOut, sal_uInt16 _nId )
     165                 :          0 :     : EditUndo( _nId, 0 )
     166                 :            : {
     167                 :            :     DBG_CTOR(OLUndoExpand,0);
     168                 :            :     DBG_ASSERT(pOut,"Undo:No Outliner");
     169                 :          0 :     pOutliner = pOut;
     170                 :          0 :     nCount = 0;
     171                 :          0 :     pParas = 0;
     172                 :          0 : }
     173                 :            : 
     174                 :            : 
     175                 :          0 : OLUndoExpand::~OLUndoExpand()
     176                 :            : {
     177                 :            :     DBG_DTOR(OLUndoExpand,0);
     178                 :          0 :     delete pParas;
     179         [ #  # ]:          0 : }
     180                 :            : 
     181                 :            : 
     182                 :          0 : void OLUndoExpand::Restore( sal_Bool bUndo )
     183                 :            : {
     184                 :            :     DBG_CHKTHIS(OLUndoExpand,0);
     185                 :            :     DBG_ASSERT(pOutliner,"Undo:No Outliner");
     186                 :            :     DBG_ASSERT(pOutliner->pEditEngine,"Outliner already deleted");
     187                 :            :     Paragraph* pPara;
     188                 :            : 
     189                 :          0 :     sal_Bool bExpand = sal_False;
     190                 :          0 :     sal_uInt16 _nId = GetId();
     191 [ #  # ][ #  # ]:          0 :     if((_nId == OLUNDO_EXPAND && !bUndo) || (_nId == OLUNDO_COLLAPSE && bUndo))
         [ #  # ][ #  # ]
     192                 :          0 :         bExpand = sal_True;
     193         [ #  # ]:          0 :     if( !pParas )
     194                 :            :     {
     195                 :          0 :         pPara = pOutliner->GetParagraph( (sal_uLong)nCount );
     196         [ #  # ]:          0 :         if( bExpand )
     197                 :          0 :             pOutliner->Expand( pPara );
     198                 :            :         else
     199                 :          0 :             pOutliner->Collapse( pPara );
     200                 :            :     }
     201                 :            :     else
     202                 :            :     {
     203         [ #  # ]:          0 :         for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++ )
     204                 :            :         {
     205                 :          0 :             pPara = pOutliner->GetParagraph( (sal_uLong)(pParas[nIdx]) );
     206         [ #  # ]:          0 :             if( bExpand )
     207                 :          0 :                 pOutliner->Expand( pPara );
     208                 :            :             else
     209                 :          0 :                 pOutliner->Collapse( pPara );
     210                 :            :         }
     211                 :            :     }
     212                 :          0 : }
     213                 :            : 
     214                 :            : 
     215                 :          0 : void OLUndoExpand::Undo()
     216                 :            : {
     217                 :            :     DBG_CHKTHIS(OLUndoExpand,0);
     218                 :          0 :     Restore( sal_True );
     219                 :          0 : }
     220                 :            : 
     221                 :            : 
     222                 :          0 : void OLUndoExpand::Redo()
     223                 :            : {
     224                 :            :     DBG_CHKTHIS(OLUndoExpand,0);
     225                 :          0 :     Restore( sal_False );
     226                 :          0 : }
     227                 :            : 
     228                 :            : 
     229                 :          0 : void OLUndoExpand::Repeat()
     230                 :            : {
     231                 :            :     DBG_CHKTHIS(OLUndoExpand,0);
     232                 :            :     OSL_FAIL("Not implemented");
     233                 :          0 : }
     234                 :            : 
     235                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10