diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/documen2.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformateasydlg.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatmgr.cxx | 34 | ||||
-rw-r--r-- | sc/source/ui/inc/condformateasydlg.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatmgr.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 13 |
9 files changed, 69 insertions, 16 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 1fac12dbebba..cc939eba38a4 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1170,9 +1170,10 @@ void ScDocument::SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam> pDat pConsolidateDlgData = std::move(pData); } -void ScDocument::SetEasyConditionalFormatDialogData(std::unique_ptr<ScConditionMode> pMode) +void ScDocument::SetEasyConditionalFormatDialogData(const ScConditionEasyDialogData& data) { - pConditionalFormatDialogMode = std::move(pMode); + pConditionalFormatDialogData.Mode = data.Mode; + pConditionalFormatDialogData.IsManaged = data.IsManaged; } void ScDocument::SetChangeViewSettings(const ScChangeViewSettings& rNew) diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 7fe3435d1bce..bc8422d0fc3e 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -719,6 +719,11 @@ ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected( return m_xDlg->GetCondFormatSelected(); } +void AbstractScCondFormatManagerDlg_Impl::ShowEasyConditionalDialog() +{ + m_xDlg->ShowEasyConditionalDialog(); +} + int AbstractScMetricInputDlg_Impl::GetInputValue() const { return m_xDlg->GetInputValue(); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 880c1f153652..e2b27738f53a 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -115,6 +115,7 @@ public: virtual bool CondFormatsChanged() const override; virtual void SetModified() override; virtual ScConditionalFormat* GetCondFormatSelected() override; + virtual void ShowEasyConditionalDialog() override; }; class AbstractScDataPilotDatabaseDlg_Impl :public AbstractScDataPilotDatabaseDlg diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 2e0b0b0815a3..e796b83eddb6 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -59,9 +59,9 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, , mxButtonCancel(m_xBuilder->weld_button("cancel")) { mxButtonRangeEdit->SetReferences(this, mxRangeEntry.get()); - const ScConditionMode* pCurrentMode + const ScConditionEasyDialogData CurrentData = pViewData->GetDocument().GetEasyConditionalFormatDialogData(); - if (!pCurrentMode) + if (!CurrentData.Mode) { SAL_WARN( "sc", @@ -70,7 +70,8 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, } else { - meMode = *pCurrentMode; + meMode = *CurrentData.Mode; + mbIsManaged = CurrentData.IsManaged; } mxNumberEntry2->hide(); switch (meMode) @@ -187,7 +188,14 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, mxStyles->set_active(1); } -ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog() {} +ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog() +{ + if (mbIsManaged) + { + GetBindings().GetDispatcher()->Execute(SID_OPENDLG_CONDFRMT_MANAGER, + SfxCallMode::ASYNCHRON); + } +} void ConditionalFormatEasyDialog::Notify(SfxBroadcaster&, const SfxHint& rHint) { diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 31e16ab8c08c..d77e57b79f85 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -8,11 +8,18 @@ */ #include <condformatmgr.hxx> +#include <condformateasydlg.hxx> #include <condformathelper.hxx> #include <condformatdlg.hxx> #include <document.hxx> #include <conditio.hxx> +#include <sc.hrc> #include <o3tl/safeint.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sfxsids.hrc> +#include <sfx2/viewsh.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> #include <unotools/viewoptions.hxx> ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView, @@ -85,10 +92,13 @@ void ScCondFormatManagerWindow::setColSizes() mrTreeView.set_column_fixed_widths(aWidths); } -ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList) +ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument& rDoc, + const ScConditionalFormatList* pFormatList) : GenericDialogController(pParent, "modules/scalc/ui/condformatmanager.ui", "CondFormatManager") , m_bModified(false) - , m_xFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) + , m_xFormatList(pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) + , m_xConditionalType(m_xBuilder->weld_combo_box("type")) + , m_xConditionalCellValue(m_xBuilder->weld_combo_box("typeis")) , m_xBtnAdd(m_xBuilder->weld_button("add")) , m_xBtnRemove(m_xBuilder->weld_button("remove")) , m_xBtnEdit(m_xBuilder->weld_button("edit")) @@ -133,6 +143,26 @@ ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected() return m_xCtrlManager->GetSelection(); } +void ScCondFormatManagerDlg::ShowEasyConditionalDialog() +{ + auto id = m_xConditionalType->get_active(); + switch (id) + { + case 0: // Cell value + { + SfxInt16Item FormatRule(FN_PARAM_1, + m_xConditionalCellValue->get_active_id().toUInt32()); + SfxBoolItem IsManaged(FN_PARAM_2, true); + SfxViewShell::Current()->GetDispatcher()->ExecuteList( + SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, + { &FormatRule, &IsManaged }); + } + break; + default: + break; + } +} + IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl, weld::Button&, void) { m_xCtrlManager->DeleteSelection(); diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index ad7501c1bd3b..a9d27c9a1001 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -39,6 +39,7 @@ private: ScViewData* mpViewData; ScDocument* mpDocument; ScConditionMode meMode; + bool mbIsManaged; 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 ca9f16e8a55f..51a251416b27 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -44,11 +44,14 @@ public: void SetModified(); ScConditionalFormat* GetCondFormatSelected(); + void ShowEasyConditionalDialog(); private: bool m_bModified; std::unique_ptr<ScConditionalFormatList> m_xFormatList; + std::unique_ptr<weld::ComboBox> m_xConditionalType; + std::unique_ptr<weld::ComboBox> m_xConditionalCellValue; std::unique_ptr<weld::Button> m_xBtnAdd; std::unique_ptr<weld::Button> m_xBtnRemove; std::unique_ptr<weld::Button> m_xBtnEdit; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index dfdcb2281251..500ad80f0781 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2924,12 +2924,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else if(nRet == DLG_RET_ADD) { - // Put the xml string parameter to initialize the - // Conditional Format Dialog. ( add new ) - pTabViewShell->GetPool().DirectPutItemInPool(ScCondFormatDlgItem( - std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), -1, true)); - // Queue message to open Conditional Format Dialog - GetViewData().GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON ); + pDlg->ShowEasyConditionalDialog(); } else if (nRet == DLG_RET_EDIT) { diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index b7bd2daa4450..e5ef913e3ff9 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -456,11 +456,20 @@ void ScCellShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pFormat; if (pReqArgs->HasItem( FN_PARAM_1, &pFormat)) { - sal_Int16 nFormat = static_cast<const SfxInt16Item*>(pFormat)->GetValue(); + ScConditionMode nFormat = static_cast<ScConditionMode>( + static_cast<const SfxInt16Item*>(pFormat)->GetValue()); sal_uInt16 nId = sc::ConditionalFormatEasyDialogWrapper::GetChildWindowId(); SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame(); SfxChildWindow* pWindow = rViewFrame.GetChildWindow( nId ); - GetViewData().GetDocument().SetEasyConditionalFormatDialogData(std::make_unique<ScConditionMode>(static_cast<ScConditionMode>(nFormat))); + const SfxPoolItem* pManaged; + bool bManaged = false; + if (pReqArgs->HasItem(FN_PARAM_2, &pManaged)) + { + bManaged = static_cast<const SfxBoolItem*>(pManaged)->GetValue(); + } + + GetViewData().GetDocument().SetEasyConditionalFormatDialogData( + ScConditionEasyDialogData(&nFormat, bManaged)); pScMod->SetRefDialog( nId, pWindow == nullptr ); } |