summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2024-11-25 19:47:26 +0530
committerPranam Lashkari <lpranam@collabora.com>2024-12-03 16:12:38 +0100
commitf643a98b2b60ccad63f7b4647ff6bc0141df0718 (patch)
tree008d5329631ad6ecc37be1044dbda4b60766d27d /sc/source
parentacc8b8c49da3a0f2a1cc25e4425a56ed87edff4b (diff)
Revert "sc: manage conditional format with simpler dialog"
This reverts commit 58c3f70c514ef4ce0de5419ab7daa3bebfb96f37. Change-Id: I500a96508684547c158cdd1814540a4b24f667d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177290 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177341 Tested-by: Jenkins
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen2.cxx5
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx5
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx1
-rw-r--r--sc/source/ui/condformat/condformateasydlg.cxx17
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx33
-rw-r--r--sc/source/ui/inc/condformateasydlg.hxx1
-rw-r--r--sc/source/ui/inc/condformatmgr.hxx3
-rw-r--r--sc/source/ui/view/cellsh1.cxx12
-rw-r--r--sc/source/ui/view/cellsh3.cxx15
9 files changed, 20 insertions, 72 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index bab0668a38e9..3890a5194e85 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1185,10 +1185,9 @@ void ScDocument::SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam> pDat
pConsolidateDlgData = std::move(pData);
}
-void ScDocument::SetEasyConditionalFormatDialogData(const ScConditionEasyDialogData& data)
+void ScDocument::SetEasyConditionalFormatDialogData(std::unique_ptr<ScConditionMode> pMode)
{
- pConditionalFormatDialogData.Mode = data.Mode;
- pConditionalFormatDialogData.IsManaged = data.IsManaged;
+ pConditionalFormatDialogMode = std::move(pMode);
}
void ScDocument::SetChangeViewSettings(const ScChangeViewSettings& rNew)
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index e70283b4b5ce..c088322f01a2 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -739,11 +739,6 @@ 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 7e9761180ef9..fe60d59bc8e6 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -116,7 +116,6 @@ 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 bf745747fee4..71ae8745df53 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -58,7 +58,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
u"CondFormatEasyDlg"_ustr)
, mpViewData(pViewData)
, mrDocument(mpViewData->GetDocument())
- , mbIsManaged(false)
, mxNumberEntry(m_xBuilder->weld_entry(u"entryNumber"_ustr))
, mxNumberEntry2(m_xBuilder->weld_entry(u"entryNumber2"_ustr))
, mxAllInputs(m_xBuilder->weld_container(u"allInputs"_ustr))
@@ -70,9 +69,9 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
, mxButtonCancel(m_xBuilder->weld_button(u"cancel"_ustr))
{
mxButtonRangeEdit->SetReferences(this, mxRangeEntry.get());
- const ScConditionEasyDialogData CurrentData
+ const ScConditionMode* pCurrentMode
= pViewData->GetDocument().GetEasyConditionalFormatDialogData();
- if (!CurrentData.Mode)
+ if (!pCurrentMode)
{
SAL_WARN(
"sc",
@@ -81,8 +80,7 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
}
else
{
- meMode = *CurrentData.Mode;
- mbIsManaged = CurrentData.IsManaged;
+ meMode = *pCurrentMode;
}
mxNumberEntry2->hide();
switch (meMode)
@@ -199,14 +197,7 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
mxStyles->set_active(1);
}
-ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog()
-{
- if (mbIsManaged)
- {
- GetBindings().GetDispatcher()->Execute(SID_OPENDLG_CONDFRMT_MANAGER,
- SfxCallMode::ASYNCHRON);
- }
-}
+ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog() {}
void ConditionalFormatEasyDialog::Notify(SfxBroadcaster&, const SfxHint& rHint)
{
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 9ddae34551a3..2e5cef3a01a0 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -8,18 +8,11 @@
*/
#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,
@@ -99,8 +92,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument
u"CondFormatManager"_ustr)
, m_bModified(false)
, 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(u"add"_ustr))
, m_xBtnRemove(m_xBuilder->weld_button(u"remove"_ustr))
, m_xBtnEdit(m_xBuilder->weld_button(u"edit"_ustr))
@@ -145,30 +136,6 @@ ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected()
return m_xCtrlManager->GetSelection();
}
-void ScCondFormatManagerDlg::ShowEasyConditionalDialog()
-{
- SfxViewShell* pViewShell = SfxViewShell::Current();
- if (!pViewShell)
- return;
-
- 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 772312040c88..933d2e51e207 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -39,7 +39,6 @@ private:
ScViewData* mpViewData;
ScDocument& mrDocument;
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 51a251416b27..ca9f16e8a55f 100644
--- a/sc/source/ui/inc/condformatmgr.hxx
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -44,14 +44,11 @@ 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 331ba8a5efca..4b94a67eed1a 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2944,7 +2944,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
else if (nRet == DLG_RET_ADD)
{
- pDlg->ShowEasyConditionalDialog();
+ // Put the xml string parameter to initialize the
+ // Conditional Format Dialog. ( add new )
+ pTabViewShell->setScCondFormatDlgItem(
+ std::make_shared<ScCondFormatDlgData>(
+ std::shared_ptr<ScConditionalFormatList>(
+ pCondFormatList.release()),
+ -1, true));
+ // Queue message to open Conditional Format Dialog
+ GetViewData().GetDispatcher().Execute(SID_OPENDLG_CONDFRMT,
+ SfxCallMode::ASYNCHRON);
}
else if (nRet == DLG_RET_EDIT)
{
@@ -2957,7 +2966,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
std::shared_ptr<ScConditionalFormatList>(
pCondFormatList.release()),
nIndex, true));
-
// Queue message to open Conditional Format Dialog
GetViewData().GetDispatcher().Execute(SID_OPENDLG_CONDFRMT,
SfxCallMode::ASYNCHRON);
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 98a67f26e32a..033ecf8982cb 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -456,20 +456,13 @@ void ScCellShell::Execute( SfxRequest& rReq )
const SfxPoolItem* pFormat;
if (pReqArgs->HasItem( FN_PARAM_1, &pFormat))
{
- ScConditionMode nFormat = static_cast<ScConditionMode>(
- static_cast<const SfxInt16Item*>(pFormat)->GetValue());
+ sal_Int16 nFormat = static_cast<const SfxInt16Item*>(pFormat)->GetValue();
sal_uInt16 nId = sc::ConditionalFormatEasyDialogWrapper::GetChildWindowId();
SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
- SfxChildWindow* pWindow = rViewFrame.GetChildWindow( nId );
- const SfxPoolItem* pManaged;
- bool bManaged = false;
- if (pReqArgs->HasItem(FN_PARAM_2, &pManaged))
- {
- bManaged = static_cast<const SfxBoolItem*>(pManaged)->GetValue();
- }
-
+ SfxChildWindow* pWindow = rViewFrame.GetChildWindow(nId);
GetViewData().GetDocument().SetEasyConditionalFormatDialogData(
- ScConditionEasyDialogData(&nFormat, bManaged));
+ std::make_unique<ScConditionMode>(
+ static_cast<ScConditionMode>(nFormat)));
pScMod->SetRefDialog( nId, pWindow == nullptr );
}