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

Generated by: LCOV version 1.10