From 643aab12aa0946fd268eb99094a98b3ad46ece1b Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 18 Sep 2026 11:32:22 +0200 Subject: [PATCH] =?UTF-8?q?tdf#173575=20Don=E2=80=99t=20display=20?= =?UTF-8?q?=E2=80=9C%VALUETYPE=E2=80=9D=20if=20range=20is=20too=20small?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the selected range is too small when Insert->Chart is used then most of the controls in the “Data Series” tab are disabled. Additionally, nothing was updating the “Range for %VALUETYPE” label defined in the UI file so it would be left with this stub visible in the UI. This patch makes the default label instead just be “Range”. The previous string is now defined in strings.hrc instead of reading from the label value when creating the dialog so that it can be updated when a valid range is selected. Change-Id: Ib926383825f32042dc0c6d33a115d139a50c5aa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211102 Tested-by: Jenkins Reviewed-by: Neil Roberts --- chart2/inc/strings.hrc | 2 ++ chart2/source/controller/dialogs/tp_DataSource.cxx | 13 +++---------- chart2/source/controller/dialogs/tp_DataSource.hxx | 2 -- chart2/uiconfig/ui/tp_DataSource.ui | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/chart2/inc/strings.hrc b/chart2/inc/strings.hrc index 9d09aef45c36..3442f6bc06a6 100644 --- a/chart2/inc/strings.hrc +++ b/chart2/inc/strings.hrc @@ -185,6 +185,8 @@ #define STR_INVALID_TIME_UNIT NC_("STR_INVALID_TIME_UNIT", "The major and minor interval need to be greater or equal to the resolution. Check your input.") #define STR_UNSUPPORTED_CHART_TYPE NC_("STR_UNSUPPORTED_CHART_TYPE", "One or more chart types are unsupported in this version of %PRODUCTNAME") +#define STR_RANGE_FOR_VALUETYPE NC_("tp_DataSource|FT_RANGE", "Ran_ge for %VALUETYPE") + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index 2206e89c7f1f..27b9b2f016dd 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -183,7 +183,6 @@ DataSourceTabPage::DataSourceTabPage(weld::Container* pPage, weld::DialogControl m_xLB_ROLE->get_height_rows(5)); m_xFT_CAPTION->set_visible(!bHideDescription); - m_aFixedTextRange = m_xFT_RANGE->get_label(); SetPageTitle(SchResId(STR_OBJECT_DATASERIES_PLURAL)); // set handlers @@ -473,15 +472,9 @@ IMPL_LINK_NOARG(DataSourceTabPage, RoleSelectionChangedHdl, weld::ItemView&, voi OUString aSelectedRoleUI = lcl_GetSelectedRole( *m_xLB_ROLE, true ); OUString aSelectedRange = lcl_GetSelectedRolesRange( *m_xLB_ROLE ); - // replace role in fixed text label - static constexpr OUString aReplacementStr( u"%VALUETYPE"_ustr ); - sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr ); - if( nIndex != -1 ) - { - m_xFT_RANGE->set_label( - m_aFixedTextRange.replaceAt( - nIndex, aReplacementStr.getLength(), aSelectedRoleUI )); - } + // add the role in fixed text label + m_xFT_RANGE->set_label( + SchResId(STR_RANGE_FOR_VALUETYPE).replaceFirst(u"%VALUETYPE", aSelectedRoleUI)); m_xEDT_RANGE->set_text(aSelectedRange); isValid(); diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx index 0ecb3dffd2bc..22efd8449d34 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.hxx +++ b/chart2/source/controller/dialogs/tp_DataSource.hxx @@ -121,8 +121,6 @@ private: std::vector> m_aEntries; - OUString m_aFixedTextRange; - ChartTypeTemplateProvider * m_pTemplateProvider; DialogModel & m_rDialogModel; weld::Entry* m_pCurrentRangeChoosingField; diff --git a/chart2/uiconfig/ui/tp_DataSource.ui b/chart2/uiconfig/ui/tp_DataSource.ui index 3794fb73f5a7..31ffe58948dd 100644 --- a/chart2/uiconfig/ui/tp_DataSource.ui +++ b/chart2/uiconfig/ui/tp_DataSource.ui @@ -309,7 +309,7 @@ True False - Ran_ge for %VALUETYPE + Ran_ge True EDT_RANGE 0