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

Generated by: LCOV version 1.10