From 7fc96ad09520abea4833ed7410fd3a2d1b63d7b1 Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Mon, 26 Sep 2022 00:46:00 +0200 Subject: tdf#150473 Wrap text and set min size for Function description This patch does the following changes to the Functions sidebar in Calc: 1) The function description now uses a TextView instead of a Label so that the text can now wrap. This is important because many descriptions are long and require more than a single line of text. 2) The minimum size of the description TextView is set to 6 lines of text. Because there's no easy way to set this minimum size (since it is inside a Slider control), then the following rule was applied. - If the user resizes the slider to less than 6 rows (in this case, moves it down), the next time a new function is clicked the slider is positioned so that 6 lines of text become visible. - Moving the slider up, thus giving more space to the description view is still allowed as prior to this patch. Change-Id: I52dfa8bef52b645fdce379408e6b790f6e8e5dea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140507 Tested-by: Jenkins Tested-by: Heiko Tietze Reviewed-by: Heiko Tietze --- sc/source/ui/formdlg/dwfunctr.cxx | 12 +- sc/source/ui/inc/dwfunctr.hxx | 2 +- sc/uiconfig/scalc/ui/functionpanel.ui | 232 +++++++++++++++------------------- 3 files changed, 111 insertions(+), 135 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 424c0ee99ca8..438f8fb70e24 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -49,17 +49,17 @@ ScFunctionWin::ScFunctionWin(weld::Widget* pParent) , xCatBox(m_xBuilder->weld_combo_box("category")) , xFuncList(m_xBuilder->weld_tree_view("funclist")) , xInsertButton(m_xBuilder->weld_button("insert")) - , xFiFuncDesc(m_xBuilder->weld_label("funcdesc")) + , xFiFuncDesc(m_xBuilder->weld_text_view("funcdesc")) , xConfigListener(new comphelper::ConfigurationListener("/org.openoffice.Office.Calc/Formula/Syntax")) , xConfigChange(std::make_unique(xConfigListener, this)) , pFuncDesc(nullptr) { - xFuncList->set_size_request(-1, xFuncList->get_height_rows(10)); - InitLRUList(); nArgs=0; - xFiFuncDesc->set_size_request(-1, 5 * xFiFuncDesc->get_text_height()); + + // Description box has a height of 8 lines of text + xFiFuncDesc->set_size_request(-1, 8 * xFiFuncDesc->get_text_height()); xCatBox->connect_changed(LINK( this, ScFunctionWin, SelComboHdl)); xFuncList->connect_changed(LINK( this, ScFunctionWin, SelTreeHdl)); @@ -162,7 +162,7 @@ void ScFunctionWin::UpdateLRUList() void ScFunctionWin::SetDescription() { - xFiFuncDesc->set_label(OUString()); + xFiFuncDesc->set_text(OUString()); const ScFuncDesc* pDesc = weld::fromId(xFuncList->get_selected_id()); if (pDesc) @@ -175,7 +175,7 @@ void ScFunctionWin::SetDescription() "\n\n" + *pDesc->mxFuncDesc; - xFiFuncDesc->set_label(aBuf); + xFiFuncDesc->set_text(aBuf); } } diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx index eda067e0b93a..9b984b918e11 100644 --- a/sc/source/ui/inc/dwfunctr.hxx +++ b/sc/source/ui/inc/dwfunctr.hxx @@ -46,7 +46,7 @@ private: std::unique_ptr xCatBox; std::unique_ptr xFuncList; std::unique_ptr xInsertButton; - std::unique_ptr xFiFuncDesc; + std::unique_ptr xFiFuncDesc; rtl::Reference xConfigListener; std::unique_ptr xConfigChange; diff --git a/sc/uiconfig/scalc/ui/functionpanel.ui b/sc/uiconfig/scalc/ui/functionpanel.ui index 7959ffebf870..380bf7b6b651 100644 --- a/sc/uiconfig/scalc/ui/functionpanel.ui +++ b/sc/uiconfig/scalc/ui/functionpanel.ui @@ -1,11 +1,11 @@ - + True - False - sc/res/fx.png + False + sc/res/fx.png @@ -18,184 +18,160 @@ True - False + False True True - 6 - + True - False + False True True - 6 - 6 + 6 + 6 - + + True - True + False True True - vertical - True + 6 - + True - False + False True - True - 6 + 12 - - + True - False - True - 12 - - - True - True - True - True - Insert Function into calculation sheet - image1 - True - - - 0 - 0 - - - - - True - False - True - - Last Used - All - Database - Date&Time - Financial - Information - Logical - Mathematical - Array - Statistical - Spreadsheet - Text - Add-in - - - - Displays the available functions. - - - - - 1 - 0 - - + True + True + True + Insert Function into calculation sheet + image1 + True - 0 - 0 + 0 + 0 - + True - True + False True - True - in - - - True - True - True - liststore1 - False - False - 0 - False - - - - - - - - - 0 - - - - - - - Displays the available functions. - - + + Last Used + All + Database + Date&Time + Financial + Information + Logical + Mathematical + Array + Statistical + Spreadsheet + Text + Add-in + + + + Displays the available functions. - 0 - 1 + 1 + 0 - True - True + 0 + 0 - + True - True - never - never - in + True + True + True + in - + True - False + True + True + True + liststore1 + False + False + 0 + False + + + - - funcdesc - 0 - True - False - label - True - 0 - 0 + + + + + 0 + + + + + + + Displays the available functions. - False - True + 0 + 1 - 0 - 0 + 0 + 0 + + + + + True + True + end + in + + + True + True + False + word-char + False + + + + + 0 + 1 - 0 - 0 + 0 + 0 -- cgit