1 #pragma once
2 
3 #ifndef CELLDATA_INCLUDED
4 #define CELLDATA_INCLUDED
5 
6 #include "toonzqt/dvmimedata.h"
7 
8 #include "toonz/txshcell.h"
9 #include "tsound.h"
10 
11 //=============================================================================
12 // forward declarations
13 class TXsheet;
14 class TXshColumn;
15 
16 //=============================================================================
17 // TCellData
18 //-----------------------------------------------------------------------------
19 
20 class TCellData final : public DvMimeData {
21   std::vector<TXshCell> m_cells;
22   int m_rowCount, m_colCount;
23 
24 public:
25   TCellData();
26   TCellData(const TCellData *src);
27   ~TCellData();
28 
getRowCount()29   int getRowCount() const { return m_rowCount; }
getColCount()30   int getColCount() const { return m_colCount; }
getCellCount()31   int getCellCount() const { return m_cells.size(); }
32 
getCell(int index)33   const TXshCell getCell(int index) const { return m_cells[index]; }
34   const TXshCell getCell(int row, int col) const;
35 
clone()36   TCellData *clone() const override { return new TCellData(this); }
37 
38   // data <- xsh
39   void setCells(TXsheet *xsh, int r0, int c0, int r1, int c1);
40 
41   // data -> xsh;
42   /*! If insert == true insert cells and shift old one.
43 If column type don't match (sound vs not sound) don't set column cells.
44 If doZeraryClone == true clone zerary cells fx.
45 If skipEmptyCells == false do not skip setting empty cells in data*/
46   bool getCells(TXsheet *xsh, int r0, int c0, int &r1, int &c1,
47                 bool insert = true, bool doZeraryClone = true,
48                 bool skipEmptyCells = true) const;
49 
50   // Paste only cell numbers.
51   // As a special behavior, enable to copy one column and paste into
52   // multiple columns.
53   bool getNumbers(TXsheet *xsh, int r0, int c0, int &r1, int &c1) const;
54 
55   //! Return true if cell in TCellData can be set in \b xsh xsheet.
56   bool canChange(TXsheet *xsh, int c0) const;
57 
58   // This is used when pasting duplicate frames
replaceCells(std::vector<TXshCell> newCells)59   void replaceCells(std::vector<TXshCell> newCells) { m_cells = newCells; }
60 
61 protected:
62   bool canChange(TXshColumn *column, int index) const;
63   void cloneZeraryFx(int index, std::vector<TXshCell> &cells) const;
64 };
65 
66 #endif
67