sc/inc/strings.hrc | 15 +++++++ sc/source/ui/condformat/condformateasydlg.cxx | 54 +++++++++++++++++++++++--- sc/source/ui/inc/condformateasydlg.hxx | 2 3 files changed, 65 insertions(+), 6 deletions(-)
New commits: commit 47ee01c28701e22e55a9ef7d66e0836c5a0a5899 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Oct 27 11:53:57 2023 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Oct 27 22:21:03 2023 +0200 Make simple conditional formatting dialog translated Followup for commit a9f6f63d21e368fe6bcc9080fd1ba23bcccc0e52 sc: Add easy to use conditional formatting menu - make strings translated - add more conditions - TODO: add other missing conditions Change-Id: I0d25b3352067e7006b88f42f3401d4670b3a5061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158536 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 74c15b5b698b..d58777176e52 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -396,4 +396,19 @@ #define STR_A11Y_DESC_USERDEF NC_("subtotaloptionspage|extended_tip|lbuserdef", "Uses a custom sorting order that you defined in the Options dialog box at %PRODUCTNAME Calc - Sort Lists.") #define STR_A11Y_DESC_ANNOT NC_("extended_tip|annot", "Specifies that a small rectangle in the top right corner of the cell indicates that a comment exists. The comment will be shown only when you enable tips under %PRODUCTNAME - General in the Options dialog box.") +// Simple conditional formatting dialog +#define STR_CONDITION_EQUAL NC_("STR_CONDITION_EQUAL", "equal to") +#define STR_CONDITION_LESS NC_("STR_CONDITION_LESS", "less than") +#define STR_CONDITION_GREATER NC_("STR_CONDITION_GREATER", "greater than") +#define STR_CONDITION_EQLESS NC_("STR_CONDITION_EQLESS", "equal or less than") +#define STR_CONDITION_EQGREATER NC_("STR_CONDITION_EQGREATER", "equal or greater than") +#define STR_CONDITION_NOT_EQUAL NC_("STR_CONDITION_NOT_EQUAL", "not equal to") + +#define STR_CONDITION_BETWEEN NC_("STR_CONDITION_BETWEEN", "between") + +#define STR_CONDITION_ERROR NC_("STR_CONDITION_ERROR", "with error ") +#define STR_CONDITION_NOERROR NC_("STR_CONDITION_NOERROR", "without error ") +#define STR_CONDITION_CONTAINS_TEXT NC_("STR_CONDITION_CONTAINS_TEXT", "containing text") +#define STR_CONDITION_NOT_CONTAINS_TEXT NC_("STR_CONDITION_NOT_CONTAINS_TEXT", "not containing text") + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 8ddb297269dc..c371861ac355 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -3,7 +3,9 @@ #include <stlpool.hxx> #include <viewdata.hxx> #include <reffact.hxx> +#include <scresid.hxx> #include <svl/style.hxx> +#include <strings.hrc> namespace { @@ -49,6 +51,11 @@ ScTabViewShell* GetTabViewShell(const SfxBindings* pBindings) namespace sc { +void ConditionalFormatEasyDialog::SetDescription(std::u16string_view rCondition) +{ + mxDescription->set_label(mxDescription->get_label() + ": " + rCondition); +} + ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, SfxChildWindow* pChildWindow, weld::Window* pParent, @@ -89,19 +96,54 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, mxNumberEntry2->set_increments(1, 0); switch (meMode) { - case ScConditionMode::Greater: - mxDescription->set_label(mxDescription->get_label() + " greater than "); + case ScConditionMode::Equal: + SetDescription(ScResId(STR_CONDITION_EQUAL)); break; case ScConditionMode::Less: - mxDescription->set_label(mxDescription->get_label() + " less than "); + SetDescription(ScResId(STR_CONDITION_LESS)); break; - case ScConditionMode::Equal: - mxDescription->set_label(mxDescription->get_label() + " equal to "); + case ScConditionMode::Greater: + SetDescription(ScResId(STR_CONDITION_GREATER)); + break; + case ScConditionMode::EqLess: + SetDescription(ScResId(STR_CONDITION_EQLESS)); + break; + case ScConditionMode::EqGreater: + SetDescription(ScResId(STR_CONDITION_EQGREATER)); + break; + case ScConditionMode::NotEqual: + SetDescription(ScResId(STR_CONDITION_NOT_EQUAL)); break; case ScConditionMode::Between: - mxDescription->set_label(mxDescription->get_label() + " between "); + SetDescription(ScResId(STR_CONDITION_BETWEEN)); mxNumberEntry2->show(); break; + // NotBetween + // Duplicate + // NotDuplicate + // Direct + // Top10 + // Bottom10 + // TopPercent + // BottomPercent + // AboveAverage + // BelowAverage + // AboveEqualAverage + // BelowEqualAverage + case ScConditionMode::Error: + SetDescription(ScResId(STR_CONDITION_ERROR)); + break; + case ScConditionMode::NoError: + SetDescription(ScResId(STR_CONDITION_NOERROR)); + break; + // BeginsWith + // EndsWith + case ScConditionMode::ContainsText: + SetDescription(ScResId(STR_CONDITION_CONTAINS_TEXT)); + break; + case ScConditionMode::NotContainsText: + SetDescription(ScResId(STR_CONDITION_NOT_CONTAINS_TEXT)); + break; default: SAL_WARN("sc", "ConditionalFormatEasyDialog::ConditionalFormatEasyDialog: invalid format"); diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index 001414396522..469613d2f1c8 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -34,6 +34,8 @@ public: DECL_LINK(ButtonPressed, weld::Button&, void); private: + void SetDescription(std::u16string_view rCondition); + ScViewData* mpViewData; ScDocument* mpDocument; ScConditionMode meMode;