Kaydet (Commit) 1e29007c authored tarafından Miklos Vajna's avatar Miklos Vajna

No need to have RowData as a template

Change-Id: Id93b97b69d1f9d44e5e5314698e7a3a0790e51e3
üst 95d27f46
...@@ -115,14 +115,12 @@ public: ...@@ -115,14 +115,12 @@ public:
bool isOpen() const { return mbOpen; } bool isOpen() const { return mbOpen; }
}; };
template <typename T, typename PropertiesPointer>
/** /**
Class to handle data of a table row. Class to handle data of a table row.
*/ */
class RowData class RowData
{ {
typedef typename CellData<T, PropertiesPointer>::Pointer_t typedef CellData<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>::Pointer_t CellDataPointer_t;
CellDataPointer_t;
typedef ::std::vector<CellDataPointer_t> Cells; typedef ::std::vector<CellDataPointer_t> Cells;
/** /**
...@@ -133,14 +131,14 @@ class RowData ...@@ -133,14 +131,14 @@ class RowData
/** /**
the properties of the row the properties of the row
*/ */
mutable PropertiesPointer mpProperties; mutable TablePropertyMapPtr mpProperties;
public: public:
typedef boost::shared_ptr<RowData <T, PropertiesPointer> > Pointer_t; typedef boost::shared_ptr<RowData> Pointer_t;
RowData() {} RowData() {}
RowData(const RowData<T, PropertiesPointer> & rRowData) RowData(const RowData& rRowData)
: mCells(rRowData.mCells), mpProperties(rRowData.mpProperties) : mCells(rRowData.mCells), mpProperties(rRowData.mpProperties)
{ {
} }
...@@ -154,14 +152,13 @@ public: ...@@ -154,14 +152,13 @@ public:
@param end the end handle of the cell @param end the end handle of the cell
@param pProps the properties of the cell @param pProps the properties of the cell
*/ */
void addCell(const T & start, PropertiesPointer pProps) void addCell(const css::uno::Reference<css::text::XTextRange>& start, TablePropertyMapPtr pProps)
{ {
CellDataPointer_t pCellData CellDataPointer_t pCellData(new CellData<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>(start, pProps));
(new CellData<T, PropertiesPointer>(start, pProps));
mCells.push_back(pCellData); mCells.push_back(pCellData);
} }
void endCell(const T & end) void endCell(const css::uno::Reference<css::text::XTextRange>& end)
{ {
if (mCells.size() > 0) if (mCells.size() > 0)
mCells.back()->setEnd(end); mCells.back()->setEnd(end);
...@@ -177,7 +174,7 @@ public: ...@@ -177,7 +174,7 @@ public:
@param pProperties the properties to set @param pProperties the properties to set
*/ */
void insertProperties(PropertiesPointer pProperties) void insertProperties(TablePropertyMapPtr pProperties)
{ {
if( pProperties.get() ) if( pProperties.get() )
{ {
...@@ -194,7 +191,7 @@ public: ...@@ -194,7 +191,7 @@ public:
@param i index of the cell @param i index of the cell
@param pProps the properties to add @param pProps the properties to add
*/ */
void insertCellProperties(unsigned int i, PropertiesPointer pProps) void insertCellProperties(unsigned int i, TablePropertyMapPtr pProps)
{ {
mCells[i]->insertProperties(pProps); mCells[i]->insertProperties(pProps);
} }
...@@ -202,9 +199,9 @@ public: ...@@ -202,9 +199,9 @@ public:
/** /**
Add properties to the last cell of the row. Add properties to the last cell of the row.
*/ */
void insertCellProperties(PropertiesPointer pProps) void insertCellProperties(TablePropertyMapPtr pProps)
{ {
if (! mCells.empty()) if (!mCells.empty())
mCells.back()->insertProperties(pProps); mCells.back()->insertProperties(pProps);
} }
...@@ -221,7 +218,7 @@ public: ...@@ -221,7 +218,7 @@ public:
@param i index of the cell @param i index of the cell
*/ */
const T & getCellStart(unsigned int i) const const css::uno::Reference<css::text::XTextRange>& getCellStart(unsigned int i) const
{ {
return mCells[i]->getStart(); return mCells[i]->getStart();
} }
...@@ -231,7 +228,7 @@ public: ...@@ -231,7 +228,7 @@ public:
@param i index of the cell @param i index of the cell
*/ */
const T & getCellEnd(unsigned int i) const const css::uno::Reference<css::text::XTextRange>& getCellEnd(unsigned int i) const
{ {
return mCells[i]->getEnd(); return mCells[i]->getEnd();
} }
...@@ -241,7 +238,7 @@ public: ...@@ -241,7 +238,7 @@ public:
@param i index of the cell @param i index of the cell
*/ */
PropertiesPointer getCellProperties(unsigned int i) const TablePropertyMapPtr getCellProperties(unsigned int i) const
{ {
return mCells[i]->getProperties(); return mCells[i]->getProperties();
} }
...@@ -249,7 +246,7 @@ public: ...@@ -249,7 +246,7 @@ public:
/** /**
Return properties of the row. Return properties of the row.
*/ */
PropertiesPointer getProperties() TablePropertyMapPtr getProperties()
{ {
return mpProperties; return mpProperties;
} }
...@@ -269,7 +266,7 @@ public: ...@@ -269,7 +266,7 @@ public:
*/ */
class TableData class TableData
{ {
typedef RowData<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>::Pointer_t RowPointer_t; typedef RowData::Pointer_t RowPointer_t;
typedef ::std::vector<RowPointer_t> Rows; typedef ::std::vector<RowPointer_t> Rows;
/** /**
...@@ -295,7 +292,7 @@ class TableData ...@@ -295,7 +292,7 @@ class TableData
/** /**
initialize mpRow initialize mpRow
*/ */
void newRow() { mpRow = RowPointer_t(new RowData<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>()); } void newRow() { mpRow = RowPointer_t(new RowData()); }
public: public:
typedef boost::shared_ptr<TableData> Pointer_t; typedef boost::shared_ptr<TableData> Pointer_t;
......
...@@ -312,7 +312,7 @@ void TableManager::resolveCurrentTable() ...@@ -312,7 +312,7 @@ void TableManager::resolveCurrentTable()
for (unsigned int nRow = 0; nRow < nRows; ++nRow) for (unsigned int nRow = 0; nRow < nRows; ++nRow)
{ {
RowData<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>::Pointer_t pRowData = pTableData->getRow(nRow); RowData::Pointer_t pRowData = pTableData->getRow(nRow);
unsigned int nCells = pRowData->getCellCount(); unsigned int nCells = pRowData->getCellCount();
......
...@@ -405,7 +405,7 @@ private: ...@@ -405,7 +405,7 @@ private:
for each level of nested tables there is one frame in the stack for each level of nested tables there is one frame in the stack
*/ */
std::stack<TableData::Pointer_t> mTableDataStack; std::stack<TableData::Pointer_t> mTableDataStack;
RowData<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>::Pointer_t mpUnfinishedRow; RowData::Pointer_t mpUnfinishedRow;
bool mbKeepUnfinishedRow; bool mbKeepUnfinishedRow;
typedef TableDataHandler<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>::Pointer_t TableDataHandlerPointer_t; typedef TableDataHandler<css::uno::Reference<css::text::XTextRange>, TablePropertyMapPtr>::Pointer_t TableDataHandlerPointer_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment