SpreadsheetWidget.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include "SpreadsheetWidget.h"
  7. #include "CellSyntaxHighlighter.h"
  8. #include "HelpWindow.h"
  9. #include "LibFileSystemAccessClient/Client.h"
  10. #include <LibGUI/Application.h>
  11. #include <LibGUI/BoxLayout.h>
  12. #include <LibGUI/Button.h>
  13. #include <LibGUI/FilePicker.h>
  14. #include <LibGUI/InputBox.h>
  15. #include <LibGUI/Label.h>
  16. #include <LibGUI/Menu.h>
  17. #include <LibGUI/MessageBox.h>
  18. #include <LibGUI/Splitter.h>
  19. #include <LibGUI/TabWidget.h>
  20. #include <LibGUI/TextEditor.h>
  21. #include <LibGUI/Toolbar.h>
  22. #include <LibGUI/ToolbarContainer.h>
  23. #include <LibGfx/FontDatabase.h>
  24. #include <string.h>
  25. namespace Spreadsheet {
  26. SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVector<Sheet>&& sheets, bool should_add_sheet_if_empty)
  27. : m_workbook(make<Workbook>(move(sheets), parent_window))
  28. {
  29. set_fill_with_background_color(true);
  30. set_layout<GUI::VerticalBoxLayout>().set_margins(2);
  31. auto& toolbar_container = add<GUI::ToolbarContainer>();
  32. auto& toolbar = toolbar_container.add<GUI::Toolbar>();
  33. auto& container = add<GUI::VerticalSplitter>();
  34. auto& top_bar = container.add<GUI::Frame>();
  35. top_bar.set_layout<GUI::HorizontalBoxLayout>().set_spacing(1);
  36. top_bar.set_fixed_height(26);
  37. auto& current_cell_label = top_bar.add<GUI::Label>("");
  38. current_cell_label.set_fixed_width(50);
  39. auto& help_button = top_bar.add<GUI::Button>("i");
  40. help_button.set_fixed_size(20, 20);
  41. help_button.on_click = [&](auto) {
  42. if (!m_selected_view) {
  43. GUI::MessageBox::show_error(window(), "Can only show function documentation/help when a worksheet exists and is open");
  44. } else if (auto* sheet_ptr = m_selected_view->sheet_if_available()) {
  45. auto docs = sheet_ptr->gather_documentation();
  46. auto help_window = HelpWindow::the(window());
  47. help_window->set_docs(move(docs));
  48. help_window->show();
  49. }
  50. };
  51. auto& cell_value_editor = top_bar.add<GUI::TextEditor>(GUI::TextEditor::Type::SingleLine);
  52. cell_value_editor.set_font(Gfx::FontDatabase::default_fixed_width_font());
  53. cell_value_editor.set_scrollbars_enabled(false);
  54. cell_value_editor.on_return_pressed = [this]() {
  55. m_selected_view->move_cursor(GUI::AbstractView::CursorMovement::Down);
  56. };
  57. cell_value_editor.set_syntax_highlighter(make<CellSyntaxHighlighter>());
  58. cell_value_editor.set_enabled(false);
  59. current_cell_label.set_enabled(false);
  60. m_tab_widget = container.add<GUI::TabWidget>();
  61. m_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
  62. m_cell_value_editor = cell_value_editor;
  63. m_current_cell_label = current_cell_label;
  64. m_inline_documentation_window = GUI::Window::construct(window());
  65. m_inline_documentation_window->set_rect(m_cell_value_editor->rect().translated(0, m_cell_value_editor->height() + 7).inflated(6, 6));
  66. m_inline_documentation_window->set_window_type(GUI::WindowType::Tooltip);
  67. m_inline_documentation_window->set_resizable(false);
  68. auto& inline_widget = m_inline_documentation_window->set_main_widget<GUI::Frame>();
  69. inline_widget.set_fill_with_background_color(true);
  70. inline_widget.set_layout<GUI::VerticalBoxLayout>().set_margins(4);
  71. inline_widget.set_frame_shape(Gfx::FrameShape::Box);
  72. m_inline_documentation_label = inline_widget.add<GUI::Label>();
  73. m_inline_documentation_label->set_fill_with_background_color(true);
  74. m_inline_documentation_label->set_autosize(false);
  75. m_inline_documentation_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
  76. if (!m_workbook->has_sheets() && should_add_sheet_if_empty)
  77. m_workbook->add_sheet("Sheet 1");
  78. m_tab_context_menu = GUI::Menu::construct();
  79. m_rename_action = GUI::Action::create("Rename...", [this](auto&) {
  80. VERIFY(m_tab_context_menu_sheet_view);
  81. auto* sheet_ptr = m_tab_context_menu_sheet_view->sheet_if_available();
  82. VERIFY(sheet_ptr); // How did we get here without a sheet?
  83. auto& sheet = *sheet_ptr;
  84. String new_name;
  85. if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecOK) {
  86. sheet.set_name(new_name);
  87. sheet.update();
  88. m_tab_widget->set_tab_title(static_cast<GUI::Widget&>(*m_tab_context_menu_sheet_view), new_name);
  89. }
  90. });
  91. m_tab_context_menu->add_action(*m_rename_action);
  92. m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", [this](auto&) {
  93. String name;
  94. if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecOK) {
  95. NonnullRefPtrVector<Sheet> new_sheets;
  96. new_sheets.append(m_workbook->add_sheet(name));
  97. setup_tabs(move(new_sheets));
  98. }
  99. }));
  100. setup_tabs(m_workbook->sheets());
  101. m_new_action = GUI::Action::create("Add New Sheet", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
  102. add_sheet();
  103. });
  104. m_open_action = GUI::CommonActions::make_open_action([&](auto&) {
  105. Optional<String> load_path = GUI::FilePicker::get_open_filepath(window());
  106. if (!load_path.has_value())
  107. return;
  108. auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window()->window_id(), *load_path);
  109. if (response.error != 0) {
  110. if (response.error != -1)
  111. GUI::MessageBox::show_error(window(), String::formatted("Opening \"{}\" failed: {}", *response.chosen_file, strerror(response.error)));
  112. return;
  113. }
  114. load_file(*response.fd, *load_path);
  115. });
  116. m_save_action = GUI::CommonActions::make_save_action([&](auto&) {
  117. if (current_filename().is_empty()) {
  118. String name = "workbook";
  119. Optional<String> save_path = GUI::FilePicker::get_save_filepath(window(), name, "sheets");
  120. if (!save_path.has_value())
  121. return;
  122. save(save_path.value());
  123. } else {
  124. save(current_filename());
  125. }
  126. });
  127. m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
  128. String name = "workbook";
  129. Optional<String> save_path = GUI::FilePicker::get_save_filepath(window(), name, "sheets");
  130. if (!save_path.has_value())
  131. return;
  132. save(save_path.value());
  133. if (!current_filename().is_empty())
  134. set_filename(current_filename());
  135. });
  136. m_quit_action = GUI::CommonActions::make_quit_action([&](auto&) {
  137. if (!request_close())
  138. return;
  139. GUI::Application::the()->quit(0);
  140. });
  141. m_cut_action = GUI::CommonActions::make_cut_action([&](auto&) { clipboard_action(true); }, window());
  142. m_copy_action = GUI::CommonActions::make_copy_action([&](auto&) { clipboard_action(false); }, window());
  143. m_paste_action = GUI::CommonActions::make_paste_action([&](auto&) {
  144. ScopeGuard update_after_paste { [&] { update(); } };
  145. auto* worksheet_ptr = current_worksheet_if_available();
  146. if (!worksheet_ptr) {
  147. GUI::MessageBox::show_error(window(), "There are no active worksheets");
  148. return;
  149. }
  150. auto& sheet = *worksheet_ptr;
  151. auto& cells = sheet.selected_cells();
  152. VERIFY(!cells.is_empty());
  153. const auto& data = GUI::Clipboard::the().fetch_data_and_type();
  154. if (auto spreadsheet_data = data.metadata.get("text/x-spreadsheet-data"); spreadsheet_data.has_value()) {
  155. Vector<Spreadsheet::Position> source_positions, target_positions;
  156. auto lines = spreadsheet_data.value().split_view('\n');
  157. auto action = lines.take_first();
  158. for (auto& line : lines) {
  159. dbgln("Paste line '{}'", line);
  160. auto position = sheet.position_from_url(line);
  161. if (position.has_value())
  162. source_positions.append(position.release_value());
  163. }
  164. for (auto& position : sheet.selected_cells())
  165. target_positions.append(position);
  166. if (source_positions.is_empty())
  167. return;
  168. auto first_position = source_positions.take_first();
  169. sheet.copy_cells(move(source_positions), move(target_positions), first_position, action == "cut" ? Spreadsheet::Sheet::CopyOperation::Cut : Spreadsheet::Sheet::CopyOperation::Copy);
  170. } else {
  171. for (auto& cell : sheet.selected_cells())
  172. sheet.ensure(cell).set_data(StringView { data.data.data(), data.data.size() });
  173. update();
  174. }
  175. },
  176. window());
  177. m_functions_help_action = GUI::Action::create(
  178. "&Functions Help", [&](auto&) {
  179. if (auto* worksheet_ptr = current_worksheet_if_available()) {
  180. auto docs = worksheet_ptr->gather_documentation();
  181. auto help_window = Spreadsheet::HelpWindow::the(window());
  182. help_window->set_docs(move(docs));
  183. help_window->show();
  184. } else {
  185. GUI::MessageBox::show_error(window(), "Cannot prepare documentation/help without an active worksheet");
  186. }
  187. },
  188. window());
  189. m_about_action = GUI::CommonActions::make_about_action("Spreadsheet", GUI::Icon::default_icon("app-spreadsheet"), window());
  190. toolbar.add_action(*m_new_action);
  191. toolbar.add_action(*m_open_action);
  192. toolbar.add_action(*m_save_action);
  193. toolbar.add_separator();
  194. toolbar.add_action(*m_cut_action);
  195. toolbar.add_action(*m_copy_action);
  196. toolbar.add_action(*m_paste_action);
  197. }
  198. void SpreadsheetWidget::resize_event(GUI::ResizeEvent& event)
  199. {
  200. GUI::Widget::resize_event(event);
  201. if (m_inline_documentation_window && m_cell_value_editor && window())
  202. m_inline_documentation_window->set_rect(m_cell_value_editor->screen_relative_rect().translated(0, m_cell_value_editor->height() + 7).inflated(6, 6));
  203. }
  204. void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector<Sheet> new_sheets)
  205. {
  206. RefPtr<GUI::Widget> first_tab_widget;
  207. for (auto& sheet : new_sheets) {
  208. auto& tab = m_tab_widget->add_tab<SpreadsheetView>(sheet.name(), sheet);
  209. if (!first_tab_widget)
  210. first_tab_widget = &tab;
  211. }
  212. auto change = [&](auto& selected_widget) {
  213. if (m_selected_view) {
  214. m_selected_view->on_selection_changed = nullptr;
  215. m_selected_view->on_selection_dropped = nullptr;
  216. }
  217. m_selected_view = &static_cast<SpreadsheetView&>(selected_widget);
  218. m_selected_view->on_selection_changed = [&](Vector<Position>&& selection) {
  219. auto* sheet_ptr = m_selected_view->sheet_if_available();
  220. // How did this even happen?
  221. VERIFY(sheet_ptr);
  222. auto& sheet = *sheet_ptr;
  223. if (selection.is_empty()) {
  224. m_current_cell_label->set_enabled(false);
  225. m_current_cell_label->set_text({});
  226. m_cell_value_editor->on_change = nullptr;
  227. m_cell_value_editor->on_focusin = nullptr;
  228. m_cell_value_editor->on_focusout = nullptr;
  229. m_cell_value_editor->set_text("");
  230. m_cell_value_editor->set_enabled(false);
  231. return;
  232. }
  233. if (selection.size() == 1) {
  234. auto& position = selection.first();
  235. m_current_cell_label->set_enabled(true);
  236. m_current_cell_label->set_text(position.to_cell_identifier(sheet));
  237. auto& cell = sheet.ensure(position);
  238. m_cell_value_editor->on_change = nullptr;
  239. m_cell_value_editor->set_text(cell.source());
  240. m_cell_value_editor->on_change = [&] {
  241. auto text = m_cell_value_editor->text();
  242. // FIXME: Lines?
  243. auto offset = m_cell_value_editor->cursor().column();
  244. try_generate_tip_for_input_expression(text, offset);
  245. cell.set_data(move(text));
  246. sheet.update();
  247. update();
  248. };
  249. m_cell_value_editor->set_enabled(true);
  250. static_cast<CellSyntaxHighlighter*>(const_cast<Syntax::Highlighter*>(m_cell_value_editor->syntax_highlighter()))->set_cell(&cell);
  251. return;
  252. }
  253. // There are many cells selected, change all of them.
  254. StringBuilder builder;
  255. builder.appendff("<{}>", selection.size());
  256. m_current_cell_label->set_enabled(true);
  257. m_current_cell_label->set_text(builder.string_view());
  258. Vector<Cell&> cells;
  259. for (auto& position : selection)
  260. cells.append(sheet.ensure(position));
  261. auto& first_cell = cells.first();
  262. m_cell_value_editor->on_change = nullptr;
  263. m_cell_value_editor->set_text("");
  264. m_should_change_selected_cells = false;
  265. m_cell_value_editor->on_focusin = [this] { m_should_change_selected_cells = true; };
  266. m_cell_value_editor->on_focusout = [this] { m_should_change_selected_cells = false; };
  267. m_cell_value_editor->on_change = [cells = move(cells), this]() mutable {
  268. if (m_should_change_selected_cells) {
  269. auto* sheet_ptr = m_selected_view->sheet_if_available();
  270. if (!sheet_ptr)
  271. return;
  272. auto& sheet = *sheet_ptr;
  273. auto text = m_cell_value_editor->text();
  274. // FIXME: Lines?
  275. auto offset = m_cell_value_editor->cursor().column();
  276. try_generate_tip_for_input_expression(text, offset);
  277. for (auto& cell : cells)
  278. cell.set_data(text);
  279. sheet.update();
  280. update();
  281. }
  282. };
  283. m_cell_value_editor->set_enabled(true);
  284. static_cast<CellSyntaxHighlighter*>(const_cast<Syntax::Highlighter*>(m_cell_value_editor->syntax_highlighter()))->set_cell(&first_cell);
  285. };
  286. m_selected_view->on_selection_dropped = [&]() {
  287. m_cell_value_editor->set_enabled(false);
  288. static_cast<CellSyntaxHighlighter*>(const_cast<Syntax::Highlighter*>(m_cell_value_editor->syntax_highlighter()))->set_cell(nullptr);
  289. m_cell_value_editor->set_text("");
  290. m_current_cell_label->set_enabled(false);
  291. m_current_cell_label->set_text("");
  292. };
  293. };
  294. if (first_tab_widget)
  295. change(*first_tab_widget);
  296. m_tab_widget->on_change = [change = move(change)](auto& selected_widget) {
  297. change(selected_widget);
  298. };
  299. m_tab_widget->on_context_menu_request = [&](auto& widget, auto& event) {
  300. m_tab_context_menu_sheet_view = static_cast<SpreadsheetView&>(widget);
  301. m_tab_context_menu->popup(event.screen_position());
  302. };
  303. m_tab_widget->on_double_click = [&](auto& widget) {
  304. m_tab_context_menu_sheet_view = static_cast<SpreadsheetView&>(widget);
  305. VERIFY(m_tab_context_menu_sheet_view);
  306. auto* sheet_ptr = m_tab_context_menu_sheet_view->sheet_if_available();
  307. VERIFY(sheet_ptr); // How did we get here without a sheet?
  308. auto& sheet = *sheet_ptr;
  309. String new_name;
  310. if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecOK) {
  311. sheet.set_name(new_name);
  312. sheet.update();
  313. m_tab_widget->set_tab_title(static_cast<GUI::Widget&>(*m_tab_context_menu_sheet_view), new_name);
  314. }
  315. };
  316. }
  317. void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source, size_t cursor_offset)
  318. {
  319. auto* sheet_ptr = m_selected_view->sheet_if_available();
  320. if (!sheet_ptr)
  321. return;
  322. auto& sheet = *sheet_ptr;
  323. m_inline_documentation_window->set_rect(m_cell_value_editor->screen_relative_rect().translated(0, m_cell_value_editor->height() + 7).inflated(6, 6));
  324. if (!m_selected_view || !source.starts_with('=')) {
  325. m_inline_documentation_window->hide();
  326. return;
  327. }
  328. auto maybe_function_and_argument = get_function_and_argument_index(source.substring_view(0, cursor_offset));
  329. if (!maybe_function_and_argument.has_value()) {
  330. m_inline_documentation_window->hide();
  331. return;
  332. }
  333. auto& [name, index] = maybe_function_and_argument.value();
  334. auto text = sheet.generate_inline_documentation_for(name, index);
  335. if (text.is_empty()) {
  336. m_inline_documentation_window->hide();
  337. } else {
  338. m_inline_documentation_label->set_text(move(text));
  339. m_inline_documentation_window->show();
  340. }
  341. }
  342. void SpreadsheetWidget::save(StringView filename)
  343. {
  344. auto result = m_workbook->save(filename);
  345. if (result.is_error())
  346. GUI::MessageBox::show_error(window(), result.error());
  347. }
  348. void SpreadsheetWidget::load_file(int fd, StringView filename)
  349. {
  350. auto result = m_workbook->open_file(fd, filename);
  351. if (result.is_error()) {
  352. GUI::MessageBox::show_error(window(), result.error());
  353. return;
  354. }
  355. m_tab_widget->on_change = nullptr;
  356. m_cell_value_editor->on_change = nullptr;
  357. m_current_cell_label->set_text("");
  358. m_should_change_selected_cells = false;
  359. while (auto* widget = m_tab_widget->active_widget()) {
  360. m_tab_widget->remove_tab(*widget);
  361. }
  362. setup_tabs(m_workbook->sheets());
  363. }
  364. bool SpreadsheetWidget::request_close()
  365. {
  366. if (!m_workbook->dirty())
  367. return true;
  368. auto result = GUI::MessageBox::show(window(), "The spreadsheet has been modified. Would you like to save?", "Unsaved changes", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
  369. if (result == GUI::MessageBox::ExecYes) {
  370. if (current_filename().is_empty()) {
  371. String name = "workbook";
  372. Optional<String> save_path = GUI::FilePicker::get_save_filepath(window(), name, "sheets");
  373. if (!save_path.has_value())
  374. return false;
  375. save(save_path.value());
  376. } else {
  377. save(current_filename());
  378. }
  379. return true;
  380. }
  381. if (result == GUI::MessageBox::ExecNo)
  382. return true;
  383. return false;
  384. }
  385. void SpreadsheetWidget::add_sheet()
  386. {
  387. StringBuilder name;
  388. name.append("Sheet");
  389. name.appendff(" {}", m_workbook->sheets().size() + 1);
  390. NonnullRefPtrVector<Sheet> new_sheets;
  391. new_sheets.append(m_workbook->add_sheet(name.string_view()));
  392. setup_tabs(move(new_sheets));
  393. }
  394. void SpreadsheetWidget::add_sheet(NonnullRefPtr<Sheet>&& sheet)
  395. {
  396. VERIFY(m_workbook == &sheet->workbook());
  397. NonnullRefPtrVector<Sheet> new_sheets;
  398. new_sheets.append(move(sheet));
  399. m_workbook->sheets().extend(new_sheets);
  400. setup_tabs(new_sheets);
  401. }
  402. void SpreadsheetWidget::set_filename(const String& filename)
  403. {
  404. if (m_workbook->set_filename(filename)) {
  405. StringBuilder builder;
  406. builder.append("Spreadsheet - ");
  407. builder.append(current_filename());
  408. window()->set_title(builder.string_view());
  409. window()->update();
  410. }
  411. }
  412. void SpreadsheetWidget::clipboard_action(bool is_cut)
  413. {
  414. /// text/x-spreadsheet-data:
  415. /// - action: copy/cut
  416. /// - currently selected cell
  417. /// - selected cell+
  418. auto* worksheet_ptr = current_worksheet_if_available();
  419. if (!worksheet_ptr) {
  420. GUI::MessageBox::show_error(window(), "There are no active worksheets");
  421. return;
  422. }
  423. auto& worksheet = *worksheet_ptr;
  424. auto& cells = worksheet.selected_cells();
  425. VERIFY(!cells.is_empty());
  426. StringBuilder text_builder, url_builder;
  427. url_builder.append(is_cut ? "cut\n" : "copy\n");
  428. bool first = true;
  429. auto cursor = current_selection_cursor();
  430. if (cursor) {
  431. Spreadsheet::Position position { (size_t)cursor->column(), (size_t)cursor->row() };
  432. url_builder.append(position.to_url(worksheet).to_string());
  433. url_builder.append('\n');
  434. }
  435. for (auto& cell : cells) {
  436. if (first && !cursor) {
  437. url_builder.append(cell.to_url(worksheet).to_string());
  438. url_builder.append('\n');
  439. }
  440. url_builder.append(cell.to_url(worksheet).to_string());
  441. url_builder.append('\n');
  442. auto cell_data = worksheet.at(cell);
  443. if (!first)
  444. text_builder.append('\t');
  445. if (cell_data)
  446. text_builder.append(cell_data->data());
  447. first = false;
  448. }
  449. HashMap<String, String> metadata;
  450. metadata.set("text/x-spreadsheet-data", url_builder.to_string());
  451. dbgln(url_builder.to_string());
  452. GUI::Clipboard::the().set_data(text_builder.string_view().bytes(), "text/plain", move(metadata));
  453. }
  454. void SpreadsheetWidget::initialize_menubar(GUI::Window& window)
  455. {
  456. auto& file_menu = window.add_menu("&File");
  457. file_menu.add_action(*m_new_action);
  458. file_menu.add_action(*m_open_action);
  459. file_menu.add_action(*m_save_action);
  460. file_menu.add_action(*m_save_as_action);
  461. file_menu.add_separator();
  462. file_menu.add_action(*m_quit_action);
  463. auto& edit_menu = window.add_menu("&Edit");
  464. edit_menu.add_action(*m_cut_action);
  465. edit_menu.add_action(*m_copy_action);
  466. edit_menu.add_action(*m_paste_action);
  467. auto& help_menu = window.add_menu("&Help");
  468. help_menu.add_action(*m_functions_help_action);
  469. help_menu.add_action(*m_about_action);
  470. }
  471. SpreadsheetWidget::~SpreadsheetWidget()
  472. {
  473. }
  474. }