LCOV - code coverage report
Current view: top level - sc/source/ui/inc - undobase.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 2 50.0 %
Date: 2012-08-25 Functions: 1 2 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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                 :            : #ifndef SC_UNDOBASE_HXX
      30                 :            : #define SC_UNDOBASE_HXX
      31                 :            : 
      32                 :            : #include <svl/undo.hxx>
      33                 :            : #include "global.hxx"
      34                 :            : #include "address.hxx"
      35                 :            : #include "docsh.hxx"
      36                 :            : 
      37                 :            : class ScDocument;
      38                 :            : class ScDocShell;
      39                 :            : class SdrUndoAction;
      40                 :            : class ScRefUndoData;
      41                 :            : class ScDBData;
      42                 :            : 
      43                 :            : //----------------------------------------------------------------------------
      44                 :            : 
      45                 :            : class ScSimpleUndo: public SfxUndoAction
      46                 :            : {
      47                 :            : public:
      48                 :            :                     TYPEINFO();
      49                 :            :                     ScSimpleUndo( ScDocShell* pDocSh );
      50                 :            :     virtual         ~ScSimpleUndo();
      51                 :            : 
      52                 :            :     virtual sal_Bool    Merge( SfxUndoAction *pNextAction );
      53                 :            : 
      54                 :            : protected:
      55                 :            :     ScDocShell*     pDocShell;
      56                 :            :     SfxUndoAction*  pDetectiveUndo;
      57                 :            : 
      58                 :          6 :     bool            IsPaintLocked() const { return pDocShell->IsPaintLocked(); }
      59                 :            : 
      60                 :            :     bool            SetViewMarkData( const ScMarkData& rMarkData );
      61                 :            : 
      62                 :            :     void            BeginUndo();
      63                 :            :     void            EndUndo();
      64                 :            :     void            BeginRedo();
      65                 :            :     void            EndRedo();
      66                 :            : 
      67                 :            :     static void     ShowTable( SCTAB nTab );
      68                 :            :     static void     ShowTable( const ScRange& rRange );
      69                 :            : };
      70                 :            : 
      71                 :            : //----------------------------------------------------------------------------
      72                 :            : 
      73                 :            : enum ScBlockUndoMode { SC_UNDO_SIMPLE, SC_UNDO_MANUALHEIGHT, SC_UNDO_AUTOHEIGHT };
      74                 :            : 
      75                 :            : class ScBlockUndo: public ScSimpleUndo
      76                 :            : {
      77                 :            : public:
      78                 :            :                     TYPEINFO();
      79                 :            :                     ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
      80                 :            :                                  ScBlockUndoMode eBlockMode );
      81                 :            :     virtual         ~ScBlockUndo();
      82                 :            : 
      83                 :            : protected:
      84                 :            :     ScRange         aBlockRange;
      85                 :            :     SdrUndoAction*  pDrawUndo;
      86                 :            :     ScBlockUndoMode eMode;
      87                 :            : 
      88                 :            :     void            BeginUndo();
      89                 :            :     void            EndUndo();
      90                 :            : //  void            BeginRedo();
      91                 :            :     void            EndRedo();
      92                 :            : 
      93                 :            :     sal_Bool            AdjustHeight();
      94                 :            :     void            ShowBlock();
      95                 :            : };
      96                 :            : 
      97                 :            : class ScMultiBlockUndo: public ScSimpleUndo
      98                 :            : {
      99                 :            : public:
     100                 :            :     TYPEINFO();
     101                 :            :     ScMultiBlockUndo(ScDocShell* pDocSh, const ScRangeList& rRanges,
     102                 :            :                      ScBlockUndoMode eBlockMode);
     103                 :            :     virtual ~ScMultiBlockUndo();
     104                 :            : 
     105                 :            : protected:
     106                 :            :     ScRangeList     maBlockRanges;
     107                 :            :     SdrUndoAction*  mpDrawUndo;
     108                 :            :     ScBlockUndoMode meMode;
     109                 :            : 
     110                 :            :     void BeginUndo();
     111                 :            :     void EndUndo();
     112                 :            :     void EndRedo();
     113                 :            : 
     114                 :            :     void AdjustHeight();
     115                 :            :     void ShowBlock();
     116                 :            : };
     117                 :            : 
     118                 :            : //----------------------------------------------------------------------------
     119                 :            : 
     120                 :            : // for functions that act on a database range - takes care of the unnamed database range
     121                 :            : // (collected separately, before the undo action, for showing dialogs etc.)
     122                 :            : 
     123                 :            : class ScDBFuncUndo: public ScSimpleUndo
     124                 :            : {
     125                 :            : protected:
     126                 :            :     ScDBData*       pAutoDBRange;
     127                 :            :     ScRange         aOriginalRange;
     128                 :            :     SdrUndoAction*  mpDrawUndo;
     129                 :            : 
     130                 :            : public:
     131                 :            :                     TYPEINFO();
     132                 :            :                     ScDBFuncUndo( ScDocShell* pDocSh, const ScRange& rOriginal, SdrUndoAction* pDrawUndo = 0 );
     133                 :            :     virtual         ~ScDBFuncUndo();
     134                 :            : 
     135                 :            :     void            SetDrawUndoAction( SdrUndoAction* pDrawUndo );
     136                 :            : 
     137                 :            :     void            BeginUndo();
     138                 :            :     void            EndUndo();
     139                 :            :     void            BeginRedo();
     140                 :            :     void            EndRedo();
     141                 :            : };
     142                 :            : 
     143                 :            : //----------------------------------------------------------------------------
     144                 :            : 
     145                 :            : enum ScMoveUndoMode { SC_UNDO_REFFIRST, SC_UNDO_REFLAST };
     146                 :            : 
     147                 :            : class ScMoveUndo: public ScSimpleUndo               // mit Referenzen
     148                 :            : {
     149                 :            : public:
     150                 :            :                     TYPEINFO();
     151                 :            :                     ScMoveUndo( ScDocShell* pDocSh,
     152                 :            :                                 ScDocument* pRefDoc, ScRefUndoData* pRefData,
     153                 :            :                                 ScMoveUndoMode eRefMode );
     154                 :            :     virtual         ~ScMoveUndo();
     155                 :            : 
     156                 :            : protected:
     157                 :            :     SdrUndoAction*  pDrawUndo;
     158                 :            :     ScDocument*     pRefUndoDoc;
     159                 :            :     ScRefUndoData*  pRefUndoData;
     160                 :            :     ScMoveUndoMode  eMode;
     161                 :            : 
     162                 :            :     void            BeginUndo();
     163                 :            :     void            EndUndo();
     164                 :            : //  void            BeginRedo();
     165                 :            : //  void            EndRedo();
     166                 :            : 
     167                 :            : private:
     168                 :            :     void            UndoRef();
     169                 :            : };
     170                 :            : 
     171                 :            : //----------------------------------------------------------------------------
     172                 :            : 
     173                 :            : class ScUndoWrapper: public SfxUndoAction           // for manual merging of actions
     174                 :            : {
     175                 :            :     SfxUndoAction*  pWrappedUndo;
     176                 :            : 
     177                 :            : public:
     178                 :            :                             TYPEINFO();
     179                 :            :                             ScUndoWrapper( SfxUndoAction* pUndo );
     180                 :            :     virtual                 ~ScUndoWrapper();
     181                 :            : 
     182                 :          0 :     SfxUndoAction*          GetWrappedUndo()        { return pWrappedUndo; }
     183                 :            :     void                    ForgetWrappedUndo();
     184                 :            : 
     185                 :            :     virtual sal_Bool            IsLinked();
     186                 :            :     virtual void            SetLinked( sal_Bool bIsLinked );
     187                 :            :     virtual void            Undo();
     188                 :            :     virtual void            Redo();
     189                 :            :     virtual void            Repeat(SfxRepeatTarget& rTarget);
     190                 :            :     virtual sal_Bool        CanRepeat(SfxRepeatTarget& rTarget) const;
     191                 :            :     virtual sal_Bool        Merge( SfxUndoAction *pNextAction );
     192                 :            :     virtual rtl::OUString   GetComment() const;
     193                 :            :     virtual String          GetRepeatComment(SfxRepeatTarget&) const;
     194                 :            :     virtual sal_uInt16      GetId() const;
     195                 :            : };
     196                 :            : 
     197                 :            : 
     198                 :            : #endif
     199                 :            : 
     200                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10