The title block template editor now supports pasting multiple cells.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1597 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-03-25 16:34:53 +00:00
parent e31a8a375e
commit 8b1e7904c4
6 changed files with 181 additions and 18 deletions

View File

@@ -1021,6 +1021,35 @@ QSet<TitleBlockCell *> TitleBlockTemplate::spannedCells(const TitleBlockCell *gi
return(set);
}
/**
Export the span parameters of all cell in the current grid.
*/
QHash<TitleBlockCell *, QPair<int, int> > TitleBlockTemplate::getAllSpans() const {
QHash<TitleBlockCell *, QPair<int, int> > spans;
for (int j = 0 ; j < rows_heights_.count() ; ++ j) {
for (int i = 0 ; i < columns_width_.count() ; ++ i) {
spans.insert(
cells_[i][j],
QPair<int, int>(
cells_[i][j] -> row_span,
cells_[i][j] -> col_span
)
);
}
}
return(spans);
}
/**
Restore a set of span parameters.
*/
void TitleBlockTemplate::setAllSpans(const QHash<TitleBlockCell *, QPair<int, int> > &spans) {
foreach (TitleBlockCell *cell, spans.keys()) {
cell -> row_span = spans[cell].first;
cell -> col_span = spans[cell].second;
}
}
/**
@param logo_name Logo name to be added / replaced
@param logo_data Logo data
@@ -1333,6 +1362,21 @@ void TitleBlockTemplate::forgetSpanning() {
}
}
/**
Set the spanner_cell attribute of every cell spanned by \a spanning_cell to 0.
@param modify_cell (Optional, defaults to true) Whether to set row_span and col_span of \a spanning_cell to 0.
*/
void TitleBlockTemplate::forgetSpanning(TitleBlockCell *spanning_cell, bool modify_cell) {
if (!spanning_cell) return;
foreach (TitleBlockCell *spanned_cell, spannedCells(spanning_cell)) {
spanned_cell -> spanner_cell = 0;
}
if (modify_cell) {
spanning_cell -> row_span = 0;
spanning_cell -> col_span = 0;
}
}
/**
Forget any previously applied span, then apply again all spans defined
by existing cells.