23 #define TITLEBLOCK_DEFAULT_ROW_HEIGHT TitleBlockDimension(25) 24 #define TITLEBLOCK_DEFAULT_COL_WIDTH TitleBlockDimension(50) 160 QUndoCommand(parent),
161 tbtemplate_(tbtemplate),
215 view_ -> updateLayout();
226 if (!tbtemplate)
return(
nullptr);
231 add_row_command ->
setType(
true);
232 add_row_command ->
setCells(tbtemplate -> createRow());
236 return(add_row_command);
247 if (!tbtemplate)
return(
nullptr);
252 add_column_command ->
setType(
false);
253 add_column_command ->
setCells(tbtemplate -> createColumn());
257 return(add_column_command);
268 if (!tbtemplate)
return(
nullptr);
273 del_row_command ->
setType(
true);
276 return(del_row_command);
287 if (!tbtemplate)
return(
nullptr);
292 del_column_command ->
setType(
false);
295 return(del_column_command);
415 setText(
QObject::tr(
"Insertion d'une ligne",
"label used in the title block template editor undo list"));
417 setText(
QObject::tr(
"Suppression d'une ligne",
"label used in the title block template editor undo list"));
421 setText(
QObject::tr(
"Insertion d'une colonne",
"label used in the title block template editor undo list"));
423 setText(
QObject::tr(
"Suppression d'une colonne",
"label used in the title block template editor undo list"));
454 view_ -> updateLayout();
556 setText(
QObject::tr(
"Modification d'une ligne",
"label used in the title block template editor undo list"));
558 setText(
QObject::tr(
"Modification d'une colonne",
"label used in the title block template editor undo list"));
575 view_ -> rowsDimensionsChanged();
577 view_ -> columnsDimensionsChanged();
591 spanning_cell_(nullptr),
595 if (!
canMerge(merged_cells, tbtemplate))
return;
599 if (!top_left_cell)
return;
617 if (!bottom_right_cell)
return;
624 "Fusion de %1 cellules",
625 "label used in the title block template editor undo list; %1 is the number of merged cells" 627 ).arg(merged_cells.count())
647 if (merged_cells.count() < 2)
return(
false);
651 if (!top_left_cell || !top_left_cell -> cell())
return(
false);
716 if (!bottom_right_cell)
return(
nullptr);
719 QSet<TitleBlockCell *> logical_cells = bottom_right_cell -> cells();
720 if (logical_cells.isEmpty())
return(
nullptr);
721 if (logical_cells.count() == 1)
return(logical_cells.toList().first());
724 int max_num_row = -1, max_num_col = -1;
727 if (cell -> num_row > max_num_row) max_num_row = cell -> num_row;
728 if (cell -> num_col > max_num_col) max_num_col = cell -> num_col;
729 if (cell -> num_row == max_num_row && cell -> num_col == max_num_col) {
746 spanning_cell_(nullptr),
747 row_span_before_(-1),
750 if (!
canSplit(splitted_cells, tbtemplate))
return;
764 "Séparation d'une cellule en %1",
765 "label used in the title block template editor undo list; %1 is the number of cells after the split" 786 if (splitted_cells.count() != 1)
return(
false);
790 if (!spanning_cell)
return(
false);
793 if (!spanning_cell -> spans())
return(
false);
835 cell -> spanner_cell =
nullptr;
855 QUndoCommand(QObject::
tr(
"modification des informations complémentaires",
"undo caption"), parent),
857 old_information_(old_info),
858 new_information_(new_info)
963 if (span_management) {
980 if (span_management) {
991 if (span_management) {
1001 cell -> loadContentFromCell(pasted_cell);
1003 if (span_management) {
1005 if ((pasted_cell.
row_span != cell -> row_span) || (pasted_cell.
col_span != cell -> col_span)) {
1010 cell -> row_span = qBound(0, pasted_cell.
row_span,
tbtemplate_ -> rowsCount() - 1 - cell -> num_row);
1011 cell -> col_span = qBound(0, pasted_cell.
col_span,
tbtemplate_ -> columnsCount() - 1 - cell -> num_col);
1013 if (cell -> row_span || cell -> col_span) {
1017 if (spanned_cell -> spanner_cell && spanned_cell -> spanner_cell != cell) {
1019 tbtemplate_ -> forgetSpanning(spanned_cell -> spanner_cell);
1029 if (span_management) {
int applied_col_span_before_
the applied_col_span attribute of the spanning cell before the merge
#define TITLEBLOCK_DEFAULT_ROW_HEIGHT
void setDimensionAfter(const TitleBlockDimension &)
QList< TitleBlockCell * > cells_
Cells composing the inserted/deleted row/column.
virtual void updateText()
TitleBlockCell * spanning_cell_
the cell spanning over the other ones
void setDimension(const TitleBlockDimension &)
~SplitCellsCommand() override
TitleBlockTemplateCommand(TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
~PasteTemplateCellsCommand() override
#define MODIFY_TITLE_BLOCK_CELL_COMMAND_ID
TitleBlockTemplate * tbtemplate_
Modified TitleBlock Template.
virtual void updateText()
TitleBlockDimension after_
Size of the row/column after it is changed.
TitleBlockTemplate * titleBlockTemplate() const
QHash< TitleBlockCell *, TitleBlockCell::TemplateCellType > cut_cells_
Cut cells.
int col_span_before_
the col_span attribute of the spanning cell before the merge
int row_span_before_
the row_span attribute of the spanning cell before the merge
void setCell(TitleBlockCell *)
QHash< TitleBlockCell *, TitleBlockCell > erased_cells_
Existing cells impacted by the paste operation.
QHash< TitleBlockCell *, TitleBlockCell > pasted_cells_
Pasted cells.
int span_state_before_
the span_state attribute of the spanning cell before splitting
void setView(TitleBlockTemplateView *)
TitleBlockCell * modified_cell_
modified cell
bool mergeWith(const QUndoCommand *) override
QHash< QString, QVariant > new_values_
values after the cell has been modified
int index_
Index of the inserted/deleted row/column.
virtual void addErasedCell(TitleBlockCell *, const TitleBlockCell &)
TitleBlockTemplateView * view() const
ModifyTitleBlockCellCommand(TitleBlockCell *, QUndoCommand *=nullptr)
static bool canMerge(const TitleBlockTemplateCellsSet &, TitleBlockTemplate *)
void setDimensionBefore(const TitleBlockDimension &)
int applied_col_span_before_
the applied_col_span attribute of the spanning cell before splitting
void setView(TitleBlockTemplateView *)
static bool canSplit(const TitleBlockTemplateCellsSet &splitted_cells, TitleBlockTemplate *tbtemplate)
int applied_row_span_before_
the applied_row_span attribute of the spanning cell before the merge
int row_span
number of extra rows spanned by this cell
the cell span parameters should be applied without restriction
~TitleBlockTemplateCommand() override
QSet< TitleBlockCell * > cells(bool=true) const
virtual void setCutCells(const QList< TitleBlockCell *> &)
int applied_row_span_before_
the applied_row_span attribute of the spanning cell before splitting
TitleBlockTemplateView * view() const
TitleBlockDimension dimension() const
QHash< TitleBlockCell *, TitleBlockCell * > spanner_cells_before_merge_
CutTemplateCellsCommand(TitleBlockTemplate *, QUndoCommand *=nullptr)
bool type_
true for a row, false for a column
TitleBlockDimension dimension_
width/height of the column/row, which interpretation depends on type_
QHash< QString, QVariant > old_values_
values before the cell is modified
TitleBlockTemplateVisualCell * topLeftCell() const
~ModifyTemplateDimension() override
int span_state_before_
the span_state attribute of the spanning cell before the merge
int row_span_before_
the row_span attribute of the spanning cell before splitting
PasteTemplateCellsCommand(TitleBlockTemplate *, QUndoCommand *=nullptr)
~MergeCellsCommand() override
static TitleBlockCell * getBottomRightCell(const TitleBlockTemplateCellsSet &)
int row_span_after_
the row_span attribute of the spanning cell after the merge
void setCells(const QList< TitleBlockCell *> &)
static ModifyTemplateGridCommand * deleteRow(TitleBlockTemplate *, int=-1)
~ModifyTitleBlockCellCommand() override
static ModifyTemplateGridCommand * addRow(TitleBlockTemplate *, int=-1)
void apply(const TitleBlockDimension &)
int col_span_after_
the col_span attribute of the spanning cell after the merge
MergeCellsCommand(const TitleBlockTemplateCellsSet &, TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
static ModifyTemplateGridCommand * deleteColumn(TitleBlockTemplate *, int=-1)
ModifyTemplateGridCommand(TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
static ModifyTemplateGridCommand * addColumn(TitleBlockTemplate *, int=-1)
QSet< TitleBlockCell * > spanned_cells_
the spanned cells
TitleBlockTemplateVisualCell * bottomRightCell() const
bool type_
true for a row, false for a column
~ModifyTemplateGridCommand() override
void setTitleBlockTemplate(TitleBlockTemplate *)
virtual void addPastedCell(TitleBlockCell *, const TitleBlockCell &)
TitleBlockDimension before_
Size of the row/column before it is changed.
#define TITLEBLOCK_DEFAULT_COL_WIDTH
virtual void addCell(TitleBlockCell *, const TitleBlockCell &, const TitleBlockCell &)
SplitCellsCommand(const TitleBlockTemplateCellsSet &, TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
TitleBlockTemplateView * view_
This class may trigger a view update.
~CutTemplateCellsCommand() override
ModifyTemplateDimension(TitleBlockTemplate *=nullptr, QUndoCommand *=nullptr)
int col_span_before_
the col_span attribute of the spanning cell before splitting
TitleBlockTemplateView * view_
This class may trigger a view update.
TitleBlockDimension dimensionAfter() const
QList< TitleBlockCell * > cells() const
TitleBlockDimension dimensionBefore() const
int col_span
number of extra columns spanned by this cell
TitleBlockCell * spanning_cell_
the cell spanning over the other ones
int index_
Index of the resized row/column.
TitleBlockCell * cell() const
void addModification(const QString &, const QVariant &, bool=false)
QHash< TitleBlockCell *, QPair< int, int > > spans_before_
Spans before operation.