tdf#173575 Don’t display “%VALUETYPE” if range is too small

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 <nroberts@libreoffice.org>
This commit is contained in:
Neil Roberts
2026-09-18 14:42:31 +02:00
parent 54378c2b97
commit 643aab12aa
4 changed files with 6 additions and 13 deletions
+2
View File
@@ -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: */
@@ -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();
@@ -121,8 +121,6 @@ private:
std::vector<std::unique_ptr<SeriesEntry>> m_aEntries;
OUString m_aFixedTextRange;
ChartTypeTemplateProvider * m_pTemplateProvider;
DialogModel & m_rDialogModel;
weld::Entry* m_pCurrentRangeChoosingField;
+1 -1
View File
@@ -309,7 +309,7 @@
<object class="GtkLabel" id="FT_RANGE">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="tp_DataSource|FT_RANGE">Ran_ge for %VALUETYPE</property>
<property name="label" translatable="yes" context="tp_DataSource|FT_RANGE">Ran_ge</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">EDT_RANGE</property>
<property name="xalign">0</property>