diff options
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/condformat/condformatdlgentry.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformateasydlg.cxx | 119 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatmgr.cxx | 84 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlgentry.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatmgr.hxx | 4 |
5 files changed, 7 insertions, 232 deletions
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 1f8ad16a42bb..d534227d197b 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -153,21 +153,7 @@ const ScConditionMode ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry:: 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 }; + ScConditionMode::NotContainsText }; ScConditionFrmtEntry::ScConditionFrmtEntry(ScCondFormatList* pParent, ScDocument& rDoc, ScCondFormatDlg* pDialogParent, const ScAddress& rPos, const ScCondFormatEntry* pFormatEntry) @@ -373,20 +359,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 67a51f42ea9b..bf745747fee4 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -40,41 +40,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 @@ -206,62 +171,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"); @@ -357,29 +266,9 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo break; } - std::unique_ptr<ScFormatEntry> xEntry; - if (meMode < ScConditionMode::Formula) - { - xEntry.reset(new ScCondFormatEntry(meMode, sExpression1, sExpression2, mrDocument, - maPosition, mxStyles->get_active_text())); - } - else if (meMode >= ScConditionMode::Today && meMode < ScConditionMode::NONE) - { - ScCondDateFormatEntry entry(&mrDocument); - entry.SetDateType(GetScCondFormatDateType(meMode)); - entry.SetStyleName(mxStyles->get_active_text()); - xEntry.reset(new ScCondDateFormatEntry(&mrDocument, entry)); - } - else if (meMode == ScConditionMode::Formula) - { - xEntry.reset(new ScCondFormatEntry(ScConditionMode::Direct, "", OUString(), mrDocument, - maPosition, mxStyles->get_active_text())); - } - else - { - DBG_ASSERT(false, "Invalid condition type selected."); - return; - } + std::unique_ptr<ScFormatEntry> pEntry + = std::make_unique<ScCondFormatEntry>(meMode, sExpression1, sExpression2, mrDocument, + maPosition, mxStyles->get_active_text()); ScRangeList aRange; ScRefFlags nFlags @@ -387,7 +276,7 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo mpViewData->GetDocument().GetAddressConvention(), maPosition.Tab()); if ((nFlags & ScRefFlags::VALID) && !aRange.empty()) { - pFormat->AddEntry(xEntry.release()); + pFormat->AddEntry(pEntry.release()); pFormat->SetRange(aRange); auto& rRangeList = pFormat->GetRange(); mpViewData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat( diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 4aaf1b32932c..9ddae34551a3 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) @@ -102,8 +101,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(u"add"_ustr)) , m_xBtnRemove(m_xBuilder->weld_button(u"remove"_ustr)) , m_xBtnEdit(m_xBuilder->weld_button(u"edit"_ustr)) @@ -114,8 +111,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, u"CondFormatDialog"_ustr); if (aDlgOpt.Exists()) @@ -157,34 +152,18 @@ void ScCondFormatManagerDlg::ShowEasyConditionalDialog() return; 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()); - pViewShell->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)); + SfxBoolItem IsManaged(FN_PARAM_2, true); 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()); - pViewShell->GetDispatcher()->ExecuteList(SID_EASY_CONDITIONAL_FORMAT_DIALOG, - SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged }); - } - break; default: break; } @@ -221,67 +200,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); - 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); - 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 05cb252e9b68..33b218b181e6 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: */ |