LCOV - code coverage report
Current view: top level - sc/source/ui/inc - undocell.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 2 0.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_UNDOCELL_HXX
      21             : #define SC_UNDOCELL_HXX
      22             : 
      23             : #include "undobase.hxx"
      24             : #include "postit.hxx"
      25             : #include "cellvalue.hxx"
      26             : #include <cellvalues.hxx>
      27             : 
      28             : #include <boost/shared_ptr.hpp>
      29             : #include <boost/scoped_ptr.hpp>
      30             : 
      31             : class ScDocShell;
      32             : class ScPatternAttr;
      33             : class EditTextObject;
      34             : class SdrUndoAction;
      35             : class ScDetOpList;
      36             : class ScDetOpData;
      37             : class ScRangeName;
      38             : class ScDocument;
      39             : 
      40             : namespace sc {
      41             : 
      42             : class CellValues;
      43             : 
      44             : }
      45             : 
      46             : class ScUndoCursorAttr: public ScSimpleUndo
      47             : {
      48             : public:
      49             :                     TYPEINFO_OVERRIDE();
      50             :                     ScUndoCursorAttr( ScDocShell* pNewDocShell,
      51             :                             SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
      52             :                             const ScPatternAttr* pOldPat, const ScPatternAttr* pNewPat,
      53             :                             const ScPatternAttr* pApplyPat, bool bAutomatic );
      54             :     virtual         ~ScUndoCursorAttr();
      55             : 
      56             :     virtual void    Undo() SAL_OVERRIDE;
      57             :     virtual void    Redo() SAL_OVERRIDE;
      58             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
      59             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
      60             : 
      61             :     virtual OUString GetComment() const SAL_OVERRIDE;
      62             : 
      63             :     /** once the objects are passed to this class, their life-cycle is
      64             :         managed by this class; the calling function must pass new'ed
      65             :         objects to this method. */
      66             :     void            SetEditData( EditTextObject* pOld, EditTextObject* pNew );
      67             : 
      68             : private:
      69             :     SCCOL           nCol;
      70             :     SCROW           nRow;
      71             :     SCTAB           nTab;
      72             :     ScPatternAttr*  pOldPattern;
      73             :     ScPatternAttr*  pNewPattern;
      74             :     ScPatternAttr*  pApplyPattern;
      75             :     ::boost::shared_ptr<EditTextObject> pOldEditData;
      76             :     ::boost::shared_ptr<EditTextObject> pNewEditData;
      77             :     bool            bIsAutomatic;
      78             : 
      79             :     void            DoChange( const ScPatternAttr* pWhichPattern, const ::boost::shared_ptr<EditTextObject>& pEditData ) const;
      80             : };
      81             : 
      82             : 
      83             : class ScUndoEnterData: public ScSimpleUndo
      84             : {
      85             : public:
      86             :     TYPEINFO_OVERRIDE();
      87             : 
      88           0 :     struct Value
      89             :     {
      90             :         SCTAB mnTab;
      91             :         bool mbHasFormat;
      92             :         sal_uInt32 mnFormat;
      93             :         ScCellValue maCell;
      94             : 
      95             :         Value();
      96             :     };
      97             : 
      98             :     typedef std::vector<Value> ValuesType;
      99             : 
     100             :     ScUndoEnterData(
     101             :         ScDocShell* pNewDocShell, const ScAddress& rPos,
     102             :         ValuesType& rOldValues, const OUString& rNewStr, EditTextObject* pObj = NULL );
     103             : 
     104             :     virtual ~ScUndoEnterData();
     105             : 
     106             :     virtual void    Undo() SAL_OVERRIDE;
     107             :     virtual void    Redo() SAL_OVERRIDE;
     108             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
     109             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
     110             : 
     111             :     virtual OUString GetComment() const SAL_OVERRIDE;
     112             : 
     113             : private:
     114             :     ValuesType maOldValues;
     115             : 
     116             :     OUString  maNewString;
     117             :     boost::scoped_ptr<EditTextObject> mpNewEditData;
     118             :     sal_uLong mnEndChangeAction;
     119             :     ScAddress maPos;
     120             : 
     121             :     void            DoChange() const;
     122             :     void            SetChangeTrack();
     123             : };
     124             : 
     125             : 
     126             : class ScUndoEnterValue: public ScSimpleUndo
     127             : {
     128             : public:
     129             :                     TYPEINFO_OVERRIDE();
     130             :     ScUndoEnterValue(
     131             :         ScDocShell* pNewDocShell, const ScAddress& rNewPos,
     132             :         const ScCellValue& rUndoCell, double nVal );
     133             : 
     134             :     virtual         ~ScUndoEnterValue();
     135             : 
     136             :     virtual void    Undo() SAL_OVERRIDE;
     137             :     virtual void    Redo() SAL_OVERRIDE;
     138             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
     139             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
     140             : 
     141             :     virtual OUString GetComment() const SAL_OVERRIDE;
     142             : 
     143             : private:
     144             :     ScAddress       aPos;
     145             :     ScCellValue maOldCell;
     146             :     double          nValue;
     147             :     sal_uLong       nEndChangeAction;
     148             : 
     149             :     void            SetChangeTrack();
     150             : };
     151             : 
     152             : class ScUndoSetCell : public ScSimpleUndo
     153             : {
     154             : public:
     155             :     TYPEINFO_OVERRIDE();
     156             :     ScUndoSetCell( ScDocShell* pDocSh, const ScAddress& rPos, const ScCellValue& rOldVal, const ScCellValue& rNewVal );
     157             : 
     158             :     virtual ~ScUndoSetCell();
     159             : 
     160             :     virtual void Undo() SAL_OVERRIDE;
     161             :     virtual void Redo() SAL_OVERRIDE;
     162             :     virtual void Repeat( SfxRepeatTarget& rTarget ) SAL_OVERRIDE;
     163             :     virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const SAL_OVERRIDE;
     164             :     virtual OUString GetComment() const SAL_OVERRIDE;
     165             : 
     166             : private:
     167             :     void SetChangeTrack();
     168             :     void SetValue( const ScCellValue& rVal );
     169             : 
     170             : private:
     171             :     ScAddress maPos;
     172             :     ScCellValue maOldValue;
     173             :     ScCellValue maNewValue;
     174             :     sal_uLong mnEndChangeAction;
     175             : };
     176             : 
     177             : class ScUndoPageBreak: public ScSimpleUndo
     178             : {
     179             : public:
     180             :                     TYPEINFO_OVERRIDE();
     181             :                     ScUndoPageBreak( ScDocShell* pNewDocShell,
     182             :                             SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
     183             :                             bool bNewColumn, bool bNewInsert );
     184             :     virtual         ~ScUndoPageBreak();
     185             : 
     186             :     virtual void    Undo() SAL_OVERRIDE;
     187             :     virtual void    Redo() SAL_OVERRIDE;
     188             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
     189             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
     190             : 
     191             :     virtual OUString GetComment() const SAL_OVERRIDE;
     192             : 
     193             : private:
     194             :     SCCOL           nCol;
     195             :     SCROW           nRow;
     196             :     SCTAB           nTab;
     197             :     bool            bColumn;        // Column or row break
     198             :     bool            bInsert;        // Insert or Delete
     199             : 
     200             :     void            DoChange( bool bInsert ) const;
     201             : };
     202             : 
     203             : class ScUndoPrintZoom: public ScSimpleUndo
     204             : {
     205             : public:
     206             :                     TYPEINFO_OVERRIDE();
     207             :                     ScUndoPrintZoom( ScDocShell* pNewDocShell, SCTAB nT,
     208             :                                     sal_uInt16 nOS, sal_uInt16 nOP, sal_uInt16 nNS, sal_uInt16 nNP );
     209             :     virtual         ~ScUndoPrintZoom();
     210             : 
     211             :     virtual void    Undo() SAL_OVERRIDE;
     212             :     virtual void    Redo() SAL_OVERRIDE;
     213             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
     214             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
     215             : 
     216             :     virtual OUString GetComment() const SAL_OVERRIDE;
     217             : 
     218             : private:
     219             :     SCTAB           nTab;
     220             :     sal_uInt16      nOldScale;
     221             :     sal_uInt16      nOldPages;
     222             :     sal_uInt16      nNewScale;
     223             :     sal_uInt16      nNewPages;
     224             : 
     225             :     void            DoChange( bool bUndo );
     226             : };
     227             : 
     228             : class ScUndoThesaurus: public ScSimpleUndo
     229             : {
     230             : public:
     231             :                     TYPEINFO_OVERRIDE();
     232             :     ScUndoThesaurus( ScDocShell* pNewDocShell,
     233             :                      SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
     234             :                      const ScCellValue& rOldText, const ScCellValue& rNewText );
     235             :     virtual         ~ScUndoThesaurus();
     236             : 
     237             :     virtual void    Undo() SAL_OVERRIDE;
     238             :     virtual void    Redo() SAL_OVERRIDE;
     239             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
     240             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
     241             : 
     242             :     virtual OUString GetComment() const SAL_OVERRIDE;
     243             : 
     244             : private:
     245             :     SCCOL           nCol;
     246             :     SCROW           nRow;
     247             :     SCTAB           nTab;
     248             :     sal_uLong       nEndChangeAction;
     249             : 
     250             :     ScCellValue maOldText;
     251             :     ScCellValue maNewText;
     252             : 
     253             :     void DoChange( bool bUndo, const ScCellValue& rText );
     254             :     void SetChangeTrack( const ScCellValue& rOldCell );
     255             : };
     256             : 
     257             : /** Undo action for inserting, removing, and replacing a cell note. */
     258             : class ScUndoReplaceNote : public ScSimpleUndo
     259             : {
     260             : public:
     261             :                     TYPEINFO_OVERRIDE();
     262             : 
     263             :     /** Constructs an undo action for inserting or removing a cell note. */
     264             :                     ScUndoReplaceNote(
     265             :                         ScDocShell& rDocShell,
     266             :                         const ScAddress& rPos,
     267             :                         const ScNoteData& rNoteData,
     268             :                         bool bInsert,
     269             :                         SdrUndoAction* pDrawUndo );
     270             : 
     271             :     /** Constructs an undo action for replacing a cell note with another. */
     272             :                     ScUndoReplaceNote(
     273             :                         ScDocShell& rDocShell,
     274             :                         const ScAddress& rPos,
     275             :                         const ScNoteData& rOldData,
     276             :                         const ScNoteData& rNewData,
     277             :                         SdrUndoAction* pDrawUndo );
     278             : 
     279             :     virtual         ~ScUndoReplaceNote();
     280             : 
     281             :     virtual void    Undo() SAL_OVERRIDE;
     282             :     virtual void    Redo() SAL_OVERRIDE;
     283             :     virtual void    Repeat( SfxRepeatTarget& rTarget ) SAL_OVERRIDE;
     284             :     virtual bool    CanRepeat( SfxRepeatTarget& rTarget ) const SAL_OVERRIDE;
     285             : 
     286             :     virtual OUString GetComment() const SAL_OVERRIDE;
     287             : 
     288             : private:
     289             :     void            DoInsertNote( const ScNoteData& rNoteData );
     290             :     void            DoRemoveNote( const ScNoteData& rNoteData );
     291             : 
     292             : private:
     293             :     ScAddress       maPos;
     294             :     ScNoteData      maOldData;
     295             :     ScNoteData      maNewData;
     296             :     SdrUndoAction*  mpDrawUndo;
     297             : };
     298             : 
     299             : /** Undo action for showing or hiding a cell note caption. */
     300             : class ScUndoShowHideNote : public ScSimpleUndo
     301             : {
     302             : public:
     303             :                     TYPEINFO_OVERRIDE();
     304             :                     ScUndoShowHideNote( ScDocShell& rDocShell, const ScAddress& rPos, bool bShow );
     305             :     virtual         ~ScUndoShowHideNote();
     306             : 
     307             :     virtual void    Undo() SAL_OVERRIDE;
     308             :     virtual void    Redo() SAL_OVERRIDE;
     309             :     virtual void    Repeat( SfxRepeatTarget& rTarget ) SAL_OVERRIDE;
     310             :     virtual bool    CanRepeat( SfxRepeatTarget& rTarget ) const SAL_OVERRIDE;
     311             : 
     312             :     virtual OUString GetComment() const SAL_OVERRIDE;
     313             : 
     314             : private:
     315             :     ScAddress       maPos;
     316             :     bool            mbShown;
     317             : };
     318             : 
     319             : class ScUndoDetective: public ScSimpleUndo
     320             : {
     321             : public:
     322             :                     TYPEINFO_OVERRIDE();
     323             :                     ScUndoDetective( ScDocShell* pNewDocShell,
     324             :                                     SdrUndoAction* pDraw, const ScDetOpData* pOperation,
     325             :                                     ScDetOpList* pUndoList = NULL );
     326             :     virtual         ~ScUndoDetective();
     327             : 
     328             :     virtual void    Undo() SAL_OVERRIDE;
     329             :     virtual void    Redo() SAL_OVERRIDE;
     330             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
     331             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
     332             : 
     333             :     virtual OUString GetComment() const SAL_OVERRIDE;
     334             : 
     335             : private:
     336             :     bool            bIsDelete;
     337             :     ScDetOpList*    pOldList;
     338             :     sal_uInt16      nAction;
     339             :     ScAddress       aPos;
     340             :     SdrUndoAction*  pDrawUndo;
     341             : };
     342             : 
     343             : 
     344             : class ScUndoRangeNames: public ScSimpleUndo
     345             : {
     346             : public:
     347             :                     TYPEINFO_OVERRIDE();
     348             :                     //use nTab = -1 for global range names
     349             :                     ScUndoRangeNames( ScDocShell* pNewDocShell,
     350             :                                         ScRangeName* pOld, ScRangeName* pNew , SCTAB nTab = -1);
     351             :     virtual         ~ScUndoRangeNames();
     352             : 
     353             :     virtual void    Undo() SAL_OVERRIDE;
     354             :     virtual void    Redo() SAL_OVERRIDE;
     355             :     virtual void    Repeat(SfxRepeatTarget& rTarget) SAL_OVERRIDE;
     356             :     virtual bool    CanRepeat(SfxRepeatTarget& rTarget) const SAL_OVERRIDE;
     357             : 
     358             :     virtual OUString GetComment() const SAL_OVERRIDE;
     359             : 
     360             : private:
     361             :     ScRangeName*    pOldRanges;
     362             :     ScRangeName*    pNewRanges;
     363             :     SCTAB           mnTab;
     364             : 
     365             :     void            DoChange( bool bUndo );
     366             : };
     367             : 
     368             : namespace sc {
     369             : 
     370             : class UndoSetCells : public ScSimpleUndo
     371             : {
     372             :     ScAddress maTopPos;
     373             :     CellValues maOldValues;
     374             :     CellValues maNewValues;
     375             : 
     376             :     void DoChange( const CellValues& rValues );
     377             : 
     378             : public:
     379             :     UndoSetCells( ScDocShell* pDocSh, const ScAddress& rTopPos );
     380             :     virtual ~UndoSetCells();
     381             : 
     382             :     virtual void Undo() SAL_OVERRIDE;
     383             :     virtual void Redo() SAL_OVERRIDE;
     384             : 
     385             :     virtual bool CanRepeat( SfxRepeatTarget& ) const SAL_OVERRIDE;
     386             :     virtual OUString GetComment() const SAL_OVERRIDE;
     387             : 
     388             :     CellValues& GetOldValues();
     389             :     void SetNewValues( const std::vector<double>& rVals );
     390             : };
     391             : 
     392             : } // namespace sc
     393             : 
     394             : #endif
     395             : 
     396             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10