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

Generated by: LCOV version 1.11