The const_cast shows the place where const correctness is violated, this is
no longer hidden by lying member functions.
-Tabular::CellData & Tabular::cellInfo(idx_type cell) const
+Tabular::CellData const & Tabular::cellInfo(idx_type cell) const
+{
+ return cell_info[cellRow(cell)][cellColumn(cell)];
+}
+
+
+Tabular::CellData & Tabular::cellInfo(idx_type cell)
{
return cell_info[cellRow(cell)][cellColumn(cell)];
}
{
return cell_info[cellRow(cell)][cellColumn(cell)];
}
if (getAlignment(cell) == LYX_ALIGN_DECIMAL) {
// copy cell and split in 2
InsetTableCell head = InsetTableCell(*cellInset(cell));
if (getAlignment(cell) == LYX_ALIGN_DECIMAL) {
// copy cell and split in 2
InsetTableCell head = InsetTableCell(*cellInset(cell));
- head.setBuffer(buffer());
+ head.setBuffer(const_cast<Buffer &>(buffer()));
DocIterator dit = cellInset(cell)->getText(0)->macrocontextPosition();
dit.pop_back();
dit.push_back(CursorSlice(head));
DocIterator dit = cellInset(cell)->getText(0)->macrocontextPosition();
dit.pop_back();
dit.push_back(CursorSlice(head));
#ifndef INSET_TABULAR_H
#define INSET_TABULAR_H
#ifndef INSET_TABULAR_H
#define INSET_TABULAR_H
#include "InsetText.h"
#include "Length.h"
#include "InsetText.h"
#include "Length.h"
///
shared_ptr<InsetTableCell> inset;
};
///
shared_ptr<InsetTableCell> inset;
};
- CellData & cellInfo(idx_type cell) const;
+ ///
+ CellData const & cellInfo(idx_type cell) const;
+ ///
+ CellData & cellInfo(idx_type cell);
///
typedef std::vector<CellData> cell_vector;
///
///
typedef std::vector<CellData> cell_vector;
///
/// change associated Buffer
void setBuffer(Buffer & buffer);
/// retrieve associated Buffer
/// change associated Buffer
void setBuffer(Buffer & buffer);
/// retrieve associated Buffer
- Buffer & buffer() const { return *buffer_; }
+ Buffer const & buffer() const { return *buffer_; }
+ /// retrieve associated Buffer
+ Buffer & buffer() { return *buffer_; }
private:
Buffer * buffer_;
private:
Buffer * buffer_;