sc/inc/conditio.hxx | 56 ----------- sc/inc/document.hxx | 4 sc/inc/strings.hrc | 63 +++++-------- sc/sdi/cellsh.sdi | 3 sc/source/core/data/conditio.cxx | 16 --- sc/source/core/data/documen2.cxx | 1 sc/source/ui/condformat/condformatdlgentry.cxx | 79 +++++----------- sc/source/ui/condformat/condformateasydlg.cxx | 118 ------------------------- sc/source/ui/condformat/condformatmgr.cxx | 97 -------------------- sc/source/ui/inc/condformatdlgentry.hxx | 2 sc/source/ui/inc/condformateasydlg.hxx | 1 sc/source/ui/inc/condformatmgr.hxx | 5 - sc/source/ui/view/cellsh3.cxx | 9 - sc/uiconfig/scalc/ui/condformatmanager.ui | 53 ----------- sc/uiconfig/scalc/ui/conditionaleasydialog.ui | 2 15 files changed, 62 insertions(+), 447 deletions(-)
New commits: commit ea9f4db1f7715caa796432c55e23b9a8715f4913 Author: Pranam Lashkari <[email protected]> AuthorDate: Mon Nov 25 19:47:16 2024 +0530 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Nov 26 09:38:45 2024 +0100 Revert "sc: added date condition option in conditional format manage dialog" This reverts commit 9928f1fa147d4ff838cbf6fcfe0d976ecef97cef. Change-Id: Ieb7dfdeccaffed4ad81ff9b5b0eb3b3b49fd8d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177289 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index b5edc8c285af..ba5e0289bab8 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -84,20 +84,6 @@ enum class ScConditionMode EndsWith, ContainsText, NotContainsText, - Formula, - Today, - Yesterday, - Tomorrow, - Last7days, - ThisWeek, - LastWeek, - NextWeek, - ThisMonth, - LastMonth, - NextMonth, - ThisYear, - LastYear, - NextYear, NONE }; @@ -182,48 +168,6 @@ inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, case ScConditionMode::NotContainsText: stream << "NOTCONTAINSTEXT"; break; - case ScConditionMode::Formula: - stream << "FORMULA"; - break; - case ScConditionMode::Today: - stream << "TODAY"; - break; - case ScConditionMode::Yesterday: - stream << "YESTERDAY"; - break; - case ScConditionMode::Tomorrow: - stream << "TOMORROW"; - break; - case ScConditionMode::Last7days: - stream << "LAST7DAYS"; - break; - case ScConditionMode::ThisWeek: - stream << "THISWEEK"; - break; - case ScConditionMode::LastWeek: - stream << "LASTWEEK"; - break; - case ScConditionMode::NextWeek: - stream << "NEXTWEEK"; - break; - case ScConditionMode::ThisMonth: - stream << "THISMONTH"; - break; - case ScConditionMode::LastMonth: - stream << "LASTMONTH"; - break; - case ScConditionMode::NextMonth: - stream << "NEXTMONTH"; - break; - case ScConditionMode::ThisYear: - stream << "THISYEAR"; - break; - case ScConditionMode::LastYear: - stream << "LASTYEAR"; - break; - case ScConditionMode::NextYear: - stream << "NEXTYEAR"; - break; case ScConditionMode::NONE: stream << "NONE"; break; diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index cbc4768f87e9..1e08d4adf68e 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -398,45 +398,30 @@ #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", "values equal to") -#define STR_CONDITION_LESS NC_("STR_CONDITION_LESS", "values less than") -#define STR_CONDITION_GREATER NC_("STR_CONDITION_GREATER", "values greater than") -#define STR_CONDITION_EQLESS NC_("STR_CONDITION_EQLESS", "values equal or less than") -#define STR_CONDITION_EQGREATER NC_("STR_CONDITION_EQGREATER", "values equal or greater than") -#define STR_CONDITION_NOT_EQUAL NC_("STR_CONDITION_NOT_EQUAL", "values not equal to") - -#define STR_CONDITION_BETWEEN NC_("STR_CONDITION_BETWEEN", "values between") -#define STR_CONDITION_NOT_BETWEEN NC_("STR_CONDITION_NOT_BETWEEN", "values not between") -#define STR_CONDITION_DUPLICATE NC_("STR_CONDITION_DUPLICATE", "values duplicate") -#define STR_CONDITION_NOT_DUPLICATE NC_("STR_CONDITION_NOT_DUPLICATE", "values not duplicate") -#define STR_CONDITION_TOP_N_ELEMENTS NC_("STR_CONDITION_TOP_N_ELEMENTS", "values in top N elements") -#define STR_CONDITION_BOTTOM_N_ELEMENTS NC_("STR_CONDITION_BOTTOM_N_ELEMENTS", "values in bottom N elements") -#define STR_CONDITION_TOP_N_PERCENT NC_("STR_CONDITION_TOP_N_PERCENT", "values in top N percent") -#define STR_CONDITION_BOTTOM_N_PERCENT NC_("STR_CONDITION_BOTTOM_N_PERCENT", "values in bottom N percent") -#define STR_CONDITION_ABOVE_AVERAGE NC_("STR_CONDITION_ABOVE_AVERAGE", "values above average") -#define STR_CONDITION_BELOW_AVERAGE NC_("STR_CONDITION_BELOW_AVERAGE", "values below average") -#define STR_CONDITION_ABOVE_OR_EQUAL_AVERAGE NC_("STR_CONDITION_ABOVE_OR_EQUAL_AVERAGE", "values above or equal average") -#define STR_CONDITION_BELOW_OR_EQUAL_AVERAGE NC_("STR_CONDITION_BELOW_OR_EQUAL_AVERAGE", "values below or equal average") -#define STR_CONDITION_ERROR NC_("STR_CONDITION_ERROR", "values have error") -#define STR_CONDITION_NOERROR NC_("STR_CONDITION_NOERROR", "values don't have error") -#define STR_CONDITION_BEGINS_WITH NC_("STR_CONDITION_BEGINS_WITH", "values begin with") -#define STR_CONDITION_ENDS_WITH NC_("STR_CONDITION_ENDS_WITH", "values end with") -#define STR_CONDITION_CONTAINS_TEXT NC_("STR_CONDITION_CONTAINS_TEXT", "values contain text") -#define STR_CONDITION_NOT_CONTAINS_TEXT NC_("STR_CONDITION_NOT_CONTAINS_TEXT", "values don't contain text") -#define STR_CONDITION_FORMULA NC_("STR_CONDITION_FORMULA", "formula is") -#define STR_CONDITION_TODAY NC_("STR_CONDITION_TODAY", "date is today") -#define STR_CONDITION_YESTERDAY NC_("STR_CONDITION_YESTERDAY", "date is yesterday") -#define STR_CONDITION_TOMORROW NC_("STR_CONDITION_TOMORROW", "date is tomorrow") -#define STR_CONDITION_LAST7DAYS NC_("STR_CONDITION_LAST7DAYS", "date is in last 7 days") -#define STR_CONDITION_THISWEEK NC_("STR_CONDITION_THISWEEK", "date is in this week") -#define STR_CONDITION_LASTWEEK NC_("STR_CONDITION_LASTWEEK", "date is in last week") -#define STR_CONDITION_NEXTWEEK NC_("STR_CONDITION_NEXTWEEK", "date is in next week") -#define STR_CONDITION_THISMONTH NC_("STR_CONDITION_THISMONTH", "date is in this month") -#define STR_CONDITION_LASTMONTH NC_("STR_CONDITION_LASTMONTH", "date is in last month") -#define STR_CONDITION_NEXTMONTH NC_("STR_CONDITION_NEXTMONTH", "date is in next month") -#define STR_CONDITION_THISYEAR NC_("STR_CONDITION_THISYEAR", "date is in this year") -#define STR_CONDITION_LASTYEAR NC_("STR_CONDITION_LASTYEAR", "date is in last year") -#define STR_CONDITION_NEXTYEAR NC_("STR_CONDITION_NEXTYEAR", "date is in next year") +#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_NOT_BETWEEN NC_("STR_CONDITION_NOT_BETWEEN", "not between") +#define STR_CONDITION_DUPLICATE NC_("STR_CONDITION_DUPLICATE", "duplicate") +#define STR_CONDITION_NOT_DUPLICATE NC_("STR_CONDITION_NOT_DUPLICATE", "not duplicate") +#define STR_CONDITION_TOP_N_ELEMENTS NC_("STR_CONDITION_TOP_N_ELEMENTS", "in top N elements") +#define STR_CONDITION_BOTTOM_N_ELEMENTS NC_("STR_CONDITION_BOTTOM_N_ELEMENTS", "in bottom N elements") +#define STR_CONDITION_TOP_N_PERCENT NC_("STR_CONDITION_TOP_N_PERCENT", "in top N percent") +#define STR_CONDITION_BOTTOM_N_PERCENT NC_("STR_CONDITION_BOTTOM_N_PERCENT", "in bottom N percent") +#define STR_CONDITION_ABOVE_AVERAGE NC_("STR_CONDITION_ABOVE_AVERAGE", "above average") +#define STR_CONDITION_BELOW_AVERAGE NC_("STR_CONDITION_BELOW_AVERAGE", "below average") +#define STR_CONDITION_ABOVE_OR_EQUAL_AVERAGE NC_("STR_CONDITION_ABOVE_OR_EQUAL_AVERAGE", "above or equal average") +#define STR_CONDITION_BELOW_OR_EQUAL_AVERAGE NC_("STR_CONDITION_BELOW_OR_EQUAL_AVERAGE", "below or equal average") +#define STR_CONDITION_ERROR NC_("STR_CONDITION_ERROR", "with error ") +#define STR_CONDITION_NOERROR NC_("STR_CONDITION_NOERROR", "without error ") +#define STR_CONDITION_BEGINS_WITH NC_("STR_CONDITION_BEGINS_WITH", "begins with") +#define STR_CONDITION_ENDS_WITH NC_("STR_CONDITION_ENDS_WITH", "ends with") +#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/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 543a36b11d2f..24bba7b06ba4 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1129,22 +1129,6 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rPos ) const if( eOp == ScConditionMode::NotContainsText ) bValid = !bValid; break; - case ScConditionMode::Formula: - case ScConditionMode::Today: - case ScConditionMode::Yesterday: - case ScConditionMode::Tomorrow: - case ScConditionMode::Last7days: - case ScConditionMode::ThisWeek: - case ScConditionMode::LastWeek: - case ScConditionMode::NextWeek: - case ScConditionMode::ThisMonth: - case ScConditionMode::LastMonth: - case ScConditionMode::NextMonth: - case ScConditionMode::ThisYear: - case ScConditionMode::LastYear: - case ScConditionMode::NextYear: - bValid = true; - break; default: SAL_WARN("sc", "unknown operation at ScConditionEntry"); break; diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index b16970a0a31c..99187b9e0693 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -122,45 +122,32 @@ void FillStyleListBox( const ScDocument* pDoc, weld::ComboBox& rLbStyle ) } -const ScConditionMode ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry::NUM_COND_ENTRIES] - = { ScConditionMode::Equal, - ScConditionMode::Less, - ScConditionMode::Greater, - ScConditionMode::EqLess, - ScConditionMode::EqGreater, - ScConditionMode::NotEqual, - ScConditionMode::Between, - ScConditionMode::NotBetween, - ScConditionMode::Duplicate, - ScConditionMode::NotDuplicate, - ScConditionMode::Top10, - ScConditionMode::Bottom10, - ScConditionMode::TopPercent, - ScConditionMode::BottomPercent, - ScConditionMode::AboveAverage, - ScConditionMode::BelowAverage, - ScConditionMode::AboveEqualAverage, - ScConditionMode::BelowEqualAverage, - ScConditionMode::Error, - ScConditionMode::NoError, - ScConditionMode::BeginsWith, - ScConditionMode::EndsWith, - ScConditionMode::ContainsText, - ScConditionMode::NotContainsText, - ScConditionMode::Formula, - ScConditionMode::Today, - ScConditionMode::Yesterday, - ScConditionMode::Tomorrow, - ScConditionMode::Last7days, - ScConditionMode::ThisWeek, - ScConditionMode::LastWeek, - ScConditionMode::NextWeek, - ScConditionMode::ThisMonth, - ScConditionMode::LastMonth, - ScConditionMode::NextMonth, - ScConditionMode::ThisYear, - ScConditionMode::LastYear, - ScConditionMode::NextYear }; +const ScConditionMode ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry::NUM_COND_ENTRIES] = { + ScConditionMode::Equal, + ScConditionMode::Less, + ScConditionMode::Greater, + ScConditionMode::EqLess, + ScConditionMode::EqGreater, + ScConditionMode::NotEqual, + ScConditionMode::Between, + ScConditionMode::NotBetween, + ScConditionMode::Duplicate, + ScConditionMode::NotDuplicate, + ScConditionMode::Top10, + ScConditionMode::Bottom10, + ScConditionMode::TopPercent, + ScConditionMode::BottomPercent, + ScConditionMode::AboveAverage, + ScConditionMode::BelowAverage, + ScConditionMode::AboveEqualAverage, + ScConditionMode::BelowEqualAverage, + ScConditionMode::Error, + ScConditionMode::NoError, + ScConditionMode::BeginsWith, + ScConditionMode::EndsWith, + ScConditionMode::ContainsText, + ScConditionMode::NotContainsText +}; ScConditionFrmtEntry::ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry) @@ -364,20 +351,6 @@ sal_Int32 ScConditionFrmtEntry::GetNumberEditFields( ScConditionMode eMode ) case ScConditionMode::BelowEqualAverage: case ScConditionMode::Duplicate: case ScConditionMode::NotDuplicate: - case ScConditionMode::Formula: - case ScConditionMode::Today: - case ScConditionMode::Yesterday: - case ScConditionMode::Tomorrow: - case ScConditionMode::Last7days: - case ScConditionMode::ThisWeek: - case ScConditionMode::LastWeek: - case ScConditionMode::NextWeek: - case ScConditionMode::ThisMonth: - case ScConditionMode::LastMonth: - case ScConditionMode::NextMonth: - case ScConditionMode::ThisYear: - case ScConditionMode::LastYear: - case ScConditionMode::NextYear: return 0; case ScConditionMode::Between: case ScConditionMode::NotBetween: diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 74210410e400..1488051876f0 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -31,41 +31,6 @@ void UpdateStyleList(const ScDocument* pDocument, weld::ComboBox& rCombo) FillStyleListBox(pDocument, rCombo); rCombo.set_active_text(sSelectedStyle); } - -condformat::ScCondFormatDateType GetScCondFormatDateType(ScConditionMode mode) -{ - switch (mode) - { - case ScConditionMode::Today: - return condformat::ScCondFormatDateType::TODAY; - case ScConditionMode::Yesterday: - return condformat::ScCondFormatDateType::YESTERDAY; - case ScConditionMode::Tomorrow: - return condformat::ScCondFormatDateType::TOMORROW; - case ScConditionMode::Last7days: - return condformat::ScCondFormatDateType::LAST7DAYS; - case ScConditionMode::ThisWeek: - return condformat::ScCondFormatDateType::THISWEEK; - case ScConditionMode::LastWeek: - return condformat::ScCondFormatDateType::LASTWEEK; - case ScConditionMode::NextWeek: - return condformat::ScCondFormatDateType::NEXTWEEK; - case ScConditionMode::ThisMonth: - return condformat::ScCondFormatDateType::THISMONTH; - case ScConditionMode::LastMonth: - return condformat::ScCondFormatDateType::LASTMONTH; - case ScConditionMode::NextMonth: - return condformat::ScCondFormatDateType::NEXTMONTH; - case ScConditionMode::ThisYear: - return condformat::ScCondFormatDateType::THISYEAR; - case ScConditionMode::LastYear: - return condformat::ScCondFormatDateType::LASTYEAR; - case ScConditionMode::NextYear: - return condformat::ScCondFormatDateType::NEXTYEAR; - default: - return condformat::ScCondFormatDateType::TODAY; - } -} } namespace sc @@ -196,62 +161,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, case ScConditionMode::NotContainsText: SetDescription(ScResId(STR_CONDITION_NOT_CONTAINS_TEXT)); break; - case ScConditionMode::Formula: - SetDescription(ScResId(STR_CONDITION_FORMULA)); - mxAllInputs->hide(); - break; - case ScConditionMode::Today: - SetDescription(ScResId(STR_CONDITION_TODAY)); - mxAllInputs->hide(); - break; - case ScConditionMode::Yesterday: - SetDescription(ScResId(STR_CONDITION_YESTERDAY)); - mxAllInputs->hide(); - break; - case ScConditionMode::Tomorrow: - SetDescription(ScResId(STR_CONDITION_TOMORROW)); - mxAllInputs->hide(); - break; - case ScConditionMode::Last7days: - SetDescription(ScResId(STR_CONDITION_LAST7DAYS)); - mxAllInputs->hide(); - break; - case ScConditionMode::ThisWeek: - SetDescription(ScResId(STR_CONDITION_THISWEEK)); - mxAllInputs->hide(); - break; - case ScConditionMode::LastWeek: - SetDescription(ScResId(STR_CONDITION_LASTWEEK)); - mxAllInputs->hide(); - break; - case ScConditionMode::NextWeek: - SetDescription(ScResId(STR_CONDITION_NEXTWEEK)); - mxAllInputs->hide(); - break; - case ScConditionMode::ThisMonth: - SetDescription(ScResId(STR_CONDITION_THISMONTH)); - mxAllInputs->hide(); - break; - case ScConditionMode::LastMonth: - SetDescription(ScResId(STR_CONDITION_LASTMONTH)); - mxAllInputs->hide(); - break; - case ScConditionMode::NextMonth: - SetDescription(ScResId(STR_CONDITION_NEXTMONTH)); - mxAllInputs->hide(); - break; - case ScConditionMode::ThisYear: - SetDescription(ScResId(STR_CONDITION_THISYEAR)); - mxAllInputs->hide(); - break; - case ScConditionMode::LastYear: - SetDescription(ScResId(STR_CONDITION_LASTYEAR)); - mxAllInputs->hide(); - break; - case ScConditionMode::NextYear: - SetDescription(ScResId(STR_CONDITION_NEXTYEAR)); - mxAllInputs->hide(); - break; default: SAL_WARN("sc", "ConditionalFormatEasyDialog::ConditionalFormatEasyDialog: invalid format"); @@ -346,29 +255,9 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo break; } - ScFormatEntry* pEntry; - if (meMode < ScConditionMode::Formula) - { - pEntry = new ScCondFormatEntry(meMode, sExpression1, sExpression2, *mpDocument, - maPosition, mxStyles->get_active_text()); - } - else if (meMode >= ScConditionMode::Today && meMode < ScConditionMode::NONE) - { - ScCondDateFormatEntry entry(mpDocument); - entry.SetDateType(GetScCondFormatDateType(meMode)); - entry.SetStyleName(mxStyles->get_active_text()); - pEntry = new ScCondDateFormatEntry(mpDocument, entry); - } - else if (meMode == ScConditionMode::Formula) - { - pEntry = new ScCondFormatEntry(ScConditionMode::Direct, "", OUString(), *mpDocument, - maPosition, mxStyles->get_active_text()); - } - else - { - DBG_ASSERT(false, "Invalid conidtion type selected."); - return; - } + ScFormatEntry* pEntry + = new ScCondFormatEntry(meMode, sExpression1, sExpression2, *mpDocument, maPosition, + mxStyles->get_active_text()); ScRangeList aRange; ScRefFlags nFlags diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 098b59fa887d..d77e57b79f85 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -21,7 +21,6 @@ #include <svl/eitem.hxx> #include <svl/intitem.hxx> #include <unotools/viewoptions.hxx> -#include <iostream> ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument& rDoc, ScConditionalFormatList* pFormatList) @@ -100,8 +99,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument , m_xFormatList(pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) , m_xConditionalType(m_xBuilder->weld_combo_box("type")) , m_xConditionalCellValue(m_xBuilder->weld_combo_box("typeis")) - , m_xConditionalFormula(m_xBuilder->weld_entry("formula")) - , m_xConditionalDate(m_xBuilder->weld_combo_box("datetype")) , m_xBtnAdd(m_xBuilder->weld_button("add")) , m_xBtnRemove(m_xBuilder->weld_button("remove")) , m_xBtnEdit(m_xBuilder->weld_button("edit")) @@ -112,8 +109,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument m_xBtnEdit->connect_clicked(LINK(this, ScCondFormatManagerDlg, EditBtnClickHdl)); m_xBtnAdd->connect_clicked(LINK(this, ScCondFormatManagerDlg, AddBtnHdl)); m_xTreeView->connect_row_activated(LINK(this, ScCondFormatManagerDlg, EditBtnHdl)); - m_xTreeView->connect_changed(LINK(this, ScCondFormatManagerDlg, EntryFocus)); - m_xConditionalType->connect_changed(LINK(this, ScCondFormatManagerDlg, ComboHdl)); SvtViewOptions aDlgOpt(EViewType::Dialog, "CondFormatDialog"); if (aDlgOpt.Exists()) @@ -151,29 +146,13 @@ ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected() void ScCondFormatManagerDlg::ShowEasyConditionalDialog() { auto id = m_xConditionalType->get_active(); - SfxBoolItem IsManaged(FN_PARAM_2, true); switch (id) { case 0: // Cell value { SfxInt16Item FormatRule(FN_PARAM_1, m_xConditionalCellValue->get_active_id().toUInt32()); - SfxViewShell::Current()->GetDispatcher()->ExecuteList( - SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged }); - } - break; - case 1: // Formula - { - SfxInt16Item FormatRule(FN_PARAM_1, static_cast<sal_Int16>(ScConditionMode::Formula)); - SfxViewShell::Current()->GetDispatcher()->ExecuteList( - SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged }); - } - break; - case 2: // Date - { - SfxInt16Item FormatRule(FN_PARAM_1, m_xConditionalDate->get_active_id().toUInt32()); + SfxBoolItem IsManaged(FN_PARAM_2, true); SfxViewShell::Current()->GetDispatcher()->ExecuteList( SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, { &FormatRule, &IsManaged }); @@ -215,67 +194,6 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl, weld::Button&, void) m_xDialog->response( DLG_RET_ADD ); } -IMPL_LINK_NOARG(ScCondFormatManagerDlg, ComboHdl, weld::ComboBox&, void) -{ - auto id = m_xConditionalType->get_active(); - switch (id) - { - case 0: - { - m_xConditionalCellValue->set_visible(true); - m_xConditionalFormula->set_visible(false); - m_xConditionalDate->set_visible(false); - } - break; - case 1: - { - m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->set_visible(true); - m_xConditionalDate->set_visible(false); - } - break; - case 2: - { - m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->set_visible(false); - m_xConditionalDate->set_visible(true); - } - break; - default: - break; - } -} - -IMPL_LINK_NOARG(ScCondFormatManagerDlg, EntryFocus, weld::TreeView&, void) -{ - ScConditionalFormat* conditionFrmt = m_xCtrlManager->GetSelection(); - - if (!conditionFrmt) - return; - - const ScFormatEntry* entry = conditionFrmt->GetEntry(0); - if (!entry) - return; - auto type = entry->GetType(); - - if (type == ScFormatEntry::Type::Condition) - { - const ScCondFormatEntry* conditionEntry = dynamic_cast<const ScCondFormatEntry*>(entry); - auto conditionType = conditionEntry->GetOperation(); - m_xConditionalType->set_active(0); - this->ComboHdl(*m_xConditionalType); - m_xConditionalCellValue->set_active(static_cast<int>(conditionType)); - } - else if (type == ScFormatEntry::Type::Date) - { - const ScCondDateFormatEntry* dateEntry = dynamic_cast<const ScCondDateFormatEntry*>(entry); - auto dateType = dateEntry->GetDateType(); - m_xConditionalType->set_active(2); - this->ComboHdl(*m_xConditionalType); - m_xConditionalDate->set_active(dateType); - } -} - void ScCondFormatManagerDlg::SetModified() { m_bModified = true; diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index 6f024643d4b3..6725ef94c940 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -103,7 +103,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener std::unique_ptr<weld::CustomWeld> mxWdPreview; bool mbIsInStyleCreate; - static const sal_Int32 NUM_COND_ENTRIES = 38; + static const sal_Int32 NUM_COND_ENTRIES = 24; // Lookup table from positions in maLbCondType to the condition mode enum static const ScConditionMode mpEntryToCond[NUM_COND_ENTRIES]; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 7361fb6830c7..51a251416b27 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -52,8 +52,6 @@ private: std::unique_ptr<weld::ComboBox> m_xConditionalType; std::unique_ptr<weld::ComboBox> m_xConditionalCellValue; - std::unique_ptr<weld::Entry> m_xConditionalFormula; - std::unique_ptr<weld::ComboBox> m_xConditionalDate; std::unique_ptr<weld::Button> m_xBtnAdd; std::unique_ptr<weld::Button> m_xBtnRemove; std::unique_ptr<weld::Button> m_xBtnEdit; @@ -66,8 +64,6 @@ private: DECL_LINK(EditBtnClickHdl, weld::Button&, void); DECL_LINK(AddBtnHdl, weld::Button&, void); DECL_LINK(EditBtnHdl, weld::TreeView&, bool); - DECL_LINK(ComboHdl, weld::ComboBox&, void); - DECL_LINK(EntryFocus, weld::TreeView&, void); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui index ae6904641090..74ea3d33bda9 100644 --- a/sc/uiconfig/scalc/ui/condformatmanager.ui +++ b/sc/uiconfig/scalc/ui/condformatmanager.ui @@ -224,54 +224,6 @@ <property name="position">1</property> </packing> </child> - <child> - <object class="GtkEntry" id="formula"> - <property name="can-focus">True</property> - <property name="no-show-all">True</property> - <property name="hexpand">True</property> - <property name="visibility">False</property> - <property name="truncate-multiline">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="formula-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="condformatmanager|extended_tip|formula">Here you can add formula for conditional formatting.</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="datetype"> - <property name="can-focus">False</property> - <property name="can_focus">False</property> - <property name="visible">False</property> - <property name="no_show_all">True</property> - <property name="active">0</property> - <items> - <item translatable="yes" context="condformatmanager|datetype" id="26">Today</item> - <item translatable="yes" context="condformatmanager|datetype" id="27">Yesterday</item> - <item translatable="yes" context="condformatmanager|datetype" id="28">Tomorrow</item> - <item translatable="yes" context="condformatmanager|datetype" id="29">Last 7 days</item> - <item translatable="yes" context="condformatmanager|datetype" id="30">This week</item> - <item translatable="yes" context="condformatmanager|datetype" id="31">Last week</item> - <item translatable="yes" context="condformatmanager|datetype" id="32">Next week</item> - <item translatable="yes" context="condformatmanager|datetype" id="33">This month</item> - <item translatable="yes" context="condformatmanager|datetype" id="34">Last month</item> - <item translatable="yes" context="condformatmanager|datetype" id="35">Next month</item> - <item translatable="yes" context="condformatmanager|datetype" id="36">This year</item> - <item translatable="yes" context="condformatmanager|datetype" id="37">Last year</item> - <item translatable="yes" context="condformatmanager|datetype" id="38">Next year</item> - </items> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> <child> <object class="GtkButton" id="add"> <property name="label" translatable="yes" context="condformatmanager|add">Add</property> @@ -287,7 +239,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">2</property> </packing> </child> <child> @@ -305,7 +257,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">3</property> </packing> </child> <child> @@ -323,7 +275,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">6</property> + <property name="position">4</property> </packing> </child> </object> diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui index 1392d6583d57..8d2709cbcdaa 100644 --- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui +++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui @@ -171,7 +171,7 @@ <object class="GtkLabel" id="description"> <property name="visible">True</property> <property name="can-focus">False</property> - <property name="label" translatable="yes" context="conditionaleasydialog|label">Highlight cells if %1</property> + <property name="label" translatable="yes" context="conditionaleasydialog|label">Highlight cells with values %1</property> <accessibility> <relation type="label-for" target="entryNumber"/> <relation type="label-for" target="entryNumber2"/> commit 4e5ff083dc145b4287d3cab0a1b24279e6f8dfdc Author: Pranam Lashkari <[email protected]> AuthorDate: Mon Nov 25 19:45:06 2024 +0530 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Nov 26 09:38:37 2024 +0100 Revert "sc: now formula conditions can be managed ...from condition format manager" This reverts commit 8374dd472cb4a2e2edab969a73ca88ffeaadbcd8. Change-Id: I532c17596adccfa5c88baaf2df897f3ffbee0fe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177288 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 0173a02766d4..d14136a84588 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -216,12 +216,10 @@ struct ScConditionEasyDialogData { ScConditionMode* Mode = nullptr; bool IsManaged : 1 = false; - OUString Formula; - ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged, const OUString& formula = "") + ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged) : Mode(mode) , IsManaged(isManaged) - , Formula(formula) { } diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index d3d7a4dfec3d..4b0b86114ea3 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -219,8 +219,7 @@ interface CellSelection SfxVoidItem ConditionalFormatEasy SID_EASY_CONDITIONAL_FORMAT_DIALOG ( SfxInt16Item FormatRule FN_PARAM_1, - SfxBoolItem Managed FN_PARAM_2, - SfxStringItem Formula FN_PARAM_3 + SfxBoolItem Managed FN_PARAM_2 ) [ ExecMethod = Execute; diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 9abcda14e745..cc939eba38a4 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1174,7 +1174,6 @@ void ScDocument::SetEasyConditionalFormatDialogData(const ScConditionEasyDialogD { pConditionalFormatDialogData.Mode = data.Mode; pConditionalFormatDialogData.IsManaged = data.IsManaged; - pConditionalFormatDialogData.Formula = data.Formula; } void ScDocument::SetChangeViewSettings(const ScChangeViewSettings& rNew) diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 2c454bc0f887..74210410e400 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -108,7 +108,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, { meMode = *CurrentData.Mode; mbIsManaged = CurrentData.IsManaged; - msFormula = CurrentData.Formula; } mxNumberEntry2->hide(); switch (meMode) @@ -362,8 +361,8 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo } else if (meMode == ScConditionMode::Formula) { - pEntry = new ScCondFormatEntry(ScConditionMode::Direct, msFormula, OUString(), - *mpDocument, maPosition, mxStyles->get_active_text()); + pEntry = new ScCondFormatEntry(ScConditionMode::Direct, "", OUString(), *mpDocument, + maPosition, mxStyles->get_active_text()); } else { diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 09b68f457b39..098b59fa887d 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -20,7 +20,6 @@ #include <sfx2/viewsh.hxx> #include <svl/eitem.hxx> #include <svl/intitem.hxx> -#include <svl/stritem.hxx> #include <unotools/viewoptions.hxx> #include <iostream> @@ -101,7 +100,7 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument , m_xFormatList(pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) , m_xConditionalType(m_xBuilder->weld_combo_box("type")) , m_xConditionalCellValue(m_xBuilder->weld_combo_box("typeis")) - , m_xConditionalFormula(new formula::RefEdit(m_xBuilder->weld_entry("formula"))) + , m_xConditionalFormula(m_xBuilder->weld_entry("formula")) , m_xConditionalDate(m_xBuilder->weld_combo_box("datetype")) , m_xBtnAdd(m_xBuilder->weld_button("add")) , m_xBtnRemove(m_xBuilder->weld_button("remove")) @@ -167,10 +166,9 @@ void ScCondFormatManagerDlg::ShowEasyConditionalDialog() case 1: // Formula { SfxInt16Item FormatRule(FN_PARAM_1, static_cast<sal_Int16>(ScConditionMode::Formula)); - SfxStringItem Formula(FN_PARAM_3, m_xConditionalFormula->GetText()); SfxViewShell::Current()->GetDispatcher()->ExecuteList( SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged, &Formula }); + { &FormatRule, &IsManaged }); } break; case 2: // Date @@ -225,21 +223,21 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, ComboHdl, weld::ComboBox&, void) case 0: { m_xConditionalCellValue->set_visible(true); - m_xConditionalFormula->GetWidget()->set_visible(false); + m_xConditionalFormula->set_visible(false); m_xConditionalDate->set_visible(false); } break; case 1: { m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->GetWidget()->set_visible(true); + m_xConditionalFormula->set_visible(true); m_xConditionalDate->set_visible(false); } break; case 2: { m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->GetWidget()->set_visible(false); + m_xConditionalFormula->set_visible(false); m_xConditionalDate->set_visible(true); } break; @@ -264,20 +262,9 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EntryFocus, weld::TreeView&, void) { const ScCondFormatEntry* conditionEntry = dynamic_cast<const ScCondFormatEntry*>(entry); auto conditionType = conditionEntry->GetOperation(); - - if (conditionType == ScConditionMode::Direct) // Formula conditions - { - m_xConditionalType->set_active(1); - this->ComboHdl(*m_xConditionalType); - m_xConditionalFormula->SetText( - conditionEntry->GetExpression(conditionEntry->GetSrcPos(), 0)); - } - else - { - m_xConditionalType->set_active(0); - this->ComboHdl(*m_xConditionalType); - m_xConditionalCellValue->set_active(static_cast<int>(conditionType)); - } + m_xConditionalType->set_active(0); + this->ComboHdl(*m_xConditionalType); + m_xConditionalCellValue->set_active(static_cast<int>(conditionType)); } else if (type == ScFormatEntry::Type::Date) { diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index e9d2f24a80a9..a9d27c9a1001 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -40,7 +40,6 @@ private: ScDocument* mpDocument; ScConditionMode meMode; bool mbIsManaged; - OUString msFormula; ScAddress maPosition; std::unique_ptr<weld::Entry> mxNumberEntry; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 26345d55894a..7361fb6830c7 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -10,7 +10,6 @@ #pragma once #include <vcl/weld.hxx> -#include <formula/funcutl.hxx> class ScDocument; class ScConditionalFormat; @@ -53,7 +52,7 @@ private: std::unique_ptr<weld::ComboBox> m_xConditionalType; std::unique_ptr<weld::ComboBox> m_xConditionalCellValue; - std::unique_ptr<formula::RefEdit> m_xConditionalFormula; + std::unique_ptr<weld::Entry> m_xConditionalFormula; std::unique_ptr<weld::ComboBox> m_xConditionalDate; std::unique_ptr<weld::Button> m_xBtnAdd; std::unique_ptr<weld::Button> m_xBtnRemove; diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 6df959030245..e5ef913e3ff9 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -468,15 +468,8 @@ void ScCellShell::Execute( SfxRequest& rReq ) bManaged = static_cast<const SfxBoolItem*>(pManaged)->GetValue(); } - const SfxPoolItem* pFormula; - OUString formula; - if (pReqArgs->HasItem(FN_PARAM_3, &pFormula)) - { - formula = static_cast<const SfxStringItem*>(pFormula)->GetValue(); - } - GetViewData().GetDocument().SetEasyConditionalFormatDialogData( - ScConditionEasyDialogData(&nFormat, bManaged, formula)); + ScConditionEasyDialogData(&nFormat, bManaged)); pScMod->SetRefDialog( nId, pWindow == nullptr ); } diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui index a0160fa8aa67..ae6904641090 100644 --- a/sc/uiconfig/scalc/ui/condformatmanager.ui +++ b/sc/uiconfig/scalc/ui/condformatmanager.ui @@ -229,6 +229,7 @@ <property name="can-focus">True</property> <property name="no-show-all">True</property> <property name="hexpand">True</property> + <property name="visibility">False</property> <property name="truncate-multiline">True</property> <child internal-child="accessible"> <object class="AtkObject" id="formula-atkobject">
