LCOV - code coverage report
Current view: top level - svx/source/table - tableundo.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 8 25.0 %
Date: 2015-06-13 12:38:46 Functions: 4 10 40.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_SVX_SOURCE_TABLE_TABLEUNDO_HXX
      21             : #define INCLUDED_SVX_SOURCE_TABLE_TABLEUNDO_HXX
      22             : 
      23             : #include <com/sun/star/container/XIndexAccess.hpp>
      24             : #include <com/sun/star/table/CellContentType.hpp>
      25             : 
      26             : #include "svx/svdotable.hxx"
      27             : #include "svx/svdobj.hxx"
      28             : #include "svx/svdundo.hxx"
      29             : #include <svx/sdrobjectuser.hxx>
      30             : 
      31             : #include "celltypes.hxx"
      32             : 
      33             : namespace sdr { namespace properties {
      34             :     class TextProperties;
      35             : } }
      36             : 
      37             : class OutlinerParaObject;
      38             : 
      39             : 
      40             : 
      41             : namespace sdr { namespace table {
      42             : 
      43             : class CellUndo : public SdrUndoAction, public sdr::ObjectUser
      44             : {
      45             : public:
      46             :     CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell );
      47             :     virtual ~CellUndo();
      48             : 
      49             :     virtual void            Undo() SAL_OVERRIDE;
      50             :     virtual void            Redo() SAL_OVERRIDE;
      51             :     virtual bool            Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
      52             : 
      53             :     void dispose();
      54             :     virtual void ObjectInDestruction(const SdrObject& rObject) SAL_OVERRIDE;
      55             : 
      56             : private:
      57           0 :     struct Data
      58             :     {
      59             :         sdr::properties::TextProperties* mpProperties;
      60             :         OutlinerParaObject* mpOutlinerParaObject;
      61             : 
      62             :         ::com::sun::star::table::CellContentType mnCellContentType;
      63             : 
      64             :         OUString msFormula;
      65             :         double          mfValue;
      66             :         ::sal_Int32     mnError;
      67             :         bool      mbMerged;
      68             :         ::sal_Int32     mnRowSpan;
      69             :         ::sal_Int32     mnColSpan;
      70             : 
      71           0 :         Data()
      72             :             : mpProperties(NULL)
      73             :             , mpOutlinerParaObject(NULL)
      74             :             , mnCellContentType(css::table::CellContentType_EMPTY)
      75             :             , mfValue(0)
      76             :             , mnError(0)
      77             :             , mbMerged(false)
      78             :             , mnRowSpan(0)
      79           0 :             , mnColSpan(0)
      80             :         {
      81           0 :         }
      82             :     };
      83             : 
      84             :     void setDataToCell( const Data& rData );
      85             :     void getDataFromCell( Data& rData );
      86             : 
      87             :     SdrObjectWeakRef mxObjRef;
      88             :     CellRef mxCell;
      89             :     Data maUndoData;
      90             :     Data maRedoData;
      91             :     bool mbUndo;
      92             : };
      93             : 
      94             : 
      95             : 
      96             : class InsertRowUndo : public SdrUndoAction
      97             : {
      98             : public:
      99             :     InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
     100             :     virtual ~InsertRowUndo();
     101             : 
     102             :     virtual void            Undo() SAL_OVERRIDE;
     103             :     virtual void            Redo() SAL_OVERRIDE;
     104             : 
     105             : private:
     106             :     TableModelRef mxTable;
     107             :     sal_Int32 mnIndex;
     108             :     RowVector maRows;
     109             :     bool mbUndo;
     110             : };
     111             : 
     112             : 
     113             : 
     114             : class RemoveRowUndo : public SdrUndoAction
     115             : {
     116             : public:
     117             :     RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
     118             :     virtual ~RemoveRowUndo();
     119             : 
     120             :     virtual void            Undo() SAL_OVERRIDE;
     121             :     virtual void            Redo() SAL_OVERRIDE;
     122             : 
     123             : private:
     124             :     TableModelRef mxTable;
     125             :     sal_Int32 mnIndex;
     126             :     RowVector maRows;
     127             :     bool mbUndo;
     128             : };
     129             : 
     130             : 
     131             : 
     132             : class InsertColUndo : public SdrUndoAction
     133             : {
     134             : public:
     135             :     InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
     136             :     virtual ~InsertColUndo();
     137             : 
     138             :     virtual void            Undo() SAL_OVERRIDE;
     139             :     virtual void            Redo() SAL_OVERRIDE;
     140             : 
     141             : private:
     142             :     TableModelRef mxTable;
     143             :     sal_Int32 mnIndex;
     144             :     ColumnVector maColumns;
     145             :     CellVector maCells;
     146             :     bool mbUndo;
     147             : };
     148             : 
     149             : 
     150             : 
     151             : class RemoveColUndo : public SdrUndoAction
     152             : {
     153             : public:
     154             :     RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
     155             :     virtual ~RemoveColUndo();
     156             : 
     157             :     virtual void            Undo() SAL_OVERRIDE;
     158             :     virtual void            Redo() SAL_OVERRIDE;
     159             : 
     160             : private:
     161             :     TableModelRef mxTable;
     162             :     sal_Int32 mnIndex;
     163             :     ColumnVector maColumns;
     164             :     CellVector maCells;
     165             :     bool mbUndo;
     166             : };
     167             : 
     168             : 
     169             : 
     170             : class TableColumnUndo : public SdrUndoAction
     171             : {
     172             : public:
     173             :     explicit TableColumnUndo( const TableColumnRef& xCol );
     174             :     virtual ~TableColumnUndo();
     175             : 
     176             :     virtual void            Undo() SAL_OVERRIDE;
     177             :     virtual void            Redo() SAL_OVERRIDE;
     178             :     virtual bool            Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
     179             : 
     180             : private:
     181         258 :     struct Data
     182             :     {
     183             :         sal_Int32   mnColumn;
     184             :         sal_Int32   mnWidth;
     185             :         bool    mbOptimalWidth;
     186             :         bool    mbIsVisible;
     187             :         bool    mbIsStartOfNewPage;
     188             :         OUString maName;
     189             :     };
     190             : 
     191             :     void setData( const Data& rData );
     192             :     void getData( Data& rData );
     193             : 
     194             :     TableColumnRef mxCol;
     195             :     Data maUndoData;
     196             :     Data maRedoData;
     197             :     bool mbHasRedoData;
     198             : };
     199             : 
     200             : 
     201             : 
     202             : class TableRowUndo : public SdrUndoAction
     203             : {
     204             : public:
     205             :     explicit TableRowUndo( const TableRowRef& xRow );
     206             :     virtual ~TableRowUndo();
     207             : 
     208             :     virtual void            Undo() SAL_OVERRIDE;
     209             :     virtual void            Redo() SAL_OVERRIDE;
     210             :     virtual bool            Merge( SfxUndoAction *pNextAction ) SAL_OVERRIDE;
     211             : 
     212             : private:
     213         304 :     struct Data
     214             :     {
     215             :         CellVector  maCells;
     216             :         sal_Int32   mnRow;
     217             :         sal_Int32   mnHeight;
     218             :         bool    mbOptimalHeight;
     219             :         bool    mbIsVisible;
     220             :         bool    mbIsStartOfNewPage;
     221             :         OUString maName;
     222             :     };
     223             : 
     224             :     void setData( const Data& rData );
     225             :     void getData( Data& rData );
     226             : 
     227             :     TableRowRef mxRow;
     228             :     Data maUndoData;
     229             :     Data maRedoData;
     230             :     bool mbHasRedoData;
     231             : };
     232             : 
     233           0 : class TableStyleUndo : public SdrUndoAction
     234             : {
     235             : public:
     236             :     explicit TableStyleUndo( const SdrTableObj& rTableObj );
     237             : 
     238             :     virtual void            Undo() SAL_OVERRIDE;
     239             :     virtual void            Redo() SAL_OVERRIDE;
     240             : 
     241             : private:
     242             :     SdrObjectWeakRef mxObjRef;
     243             : 
     244           0 :     struct Data
     245             :     {
     246             :         TableStyleSettings maSettings;
     247             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableStyle;
     248             :     };
     249             : 
     250             :     void setData( const Data& rData );
     251             :     void getData( Data& rData );
     252             : 
     253             :     Data maUndoData;
     254             :     Data maRedoData;
     255             :     bool mbHasRedoData;
     256             : };
     257             : 
     258             : } }
     259             : 
     260             : #endif
     261             : 
     262             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11