Spreadsheet changes

Various changes to support in-place editing, and more.
This commit is contained in:
Zheng, Lei
2019-07-12 13:25:50 +08:00
committed by wmayer
parent 32ad54c9ef
commit e911b69769
17 changed files with 334 additions and 180 deletions

View File

@@ -148,6 +148,19 @@ bool SheetView::onMsg(const char *pMsg, const char **)
getGuiDocument()->saveAs();
return true;
}
else if(strcmp("Std_Delete",pMsg) == 0) {
std::vector<Range> ranges = selectedRanges();
if (sheet->hasCell(ranges)) {
Gui::Command::openCommand("Clear cell(s)");
std::vector<Range>::const_iterator i = ranges.begin();
for (; i != ranges.end(); ++i) {
FCMD_OBJ_CMD(sheet, "clear('" << i->rangeString() << "')");
}
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
}
return true;
}
else if (strcmp("Cut",pMsg) == 0) {
ui->cells->cutSelection();
return true;
@@ -233,16 +246,8 @@ void SheetView::columnResizeFinished()
return;
blockSignals(true);
Gui::Command::openCommand("Resize column");
QMap<int, int>::const_iterator i = newColumnSizes.begin();
while (i != newColumnSizes.end()) {
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.setColumnWidth('%s', %d)", sheet->getNameInDocument(),
columnName(i.key()).c_str(), i.value());
++i;
}
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
for(auto &v : newColumnSizes)
sheet->setColumnWidth(v.first,v.second);
blockSignals(false);
newColumnSizes.clear();
}
@@ -253,16 +258,8 @@ void SheetView::rowResizeFinished()
return;
blockSignals(true);
Gui::Command::openCommand("Resize row");
QMap<int, int>::const_iterator i = newRowSizes.begin();
while (i != newRowSizes.end()) {
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.setRowHeight('%s', %d)", sheet->getNameInDocument(),
rowName(i.key()).c_str(), i.value());
++i;
}
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
for(auto &v : newRowSizes)
sheet->setRowHeight(v.first,v.second);
blockSignals(false);
newRowSizes.clear();
}
@@ -333,7 +330,8 @@ void SheetView::updateCell(const App::Property *prop)
}
CellAddress address;
sheet->getCellAddress(prop, address);
if(!sheet->getCellAddress(prop, address))
return;
if (currentIndex().row() == address.row() && currentIndex().column() == address.col() )
updateContentLine();