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
This commit is contained in:
Pranam Lashkari 2024-11-25 19:47:26 +05:30
parent acc8b8c49d
commit f643a98b2b
14 changed files with 32 additions and 157 deletions

View file

@ -225,20 +225,6 @@ struct ScSheetLimits;
struct ScDataAreaExtras;
enum class ScConditionMode;
struct ScConditionEasyDialogData
{
ScConditionMode* Mode = nullptr;
bool IsManaged : 1 = false;
ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged)
: Mode(mode)
, IsManaged(isManaged)
{
}
ScConditionEasyDialogData() {}
};
namespace sc {
typedef std::map<OUString, BitmapEx> IconSetBitmapMap;
@ -479,7 +465,7 @@ private:
std::unique_ptr<ScExtDocOptions> pExtDocOptions; // for import etc.
std::unique_ptr<ScClipOptions> mpClipOptions; // clipboard options
std::unique_ptr<ScConsolidateParam> pConsolidateDlgData;
ScConditionEasyDialogData pConditionalFormatDialogData;
std::unique_ptr<ScConditionMode> pConditionalFormatDialogMode;
std::unique_ptr<ScAutoNameCache> pAutoNameCache; // for automatic name lookup during CompileXML
@ -727,10 +713,10 @@ public:
void SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam> pData );
const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData.get(); }
void SetEasyConditionalFormatDialogData(const ScConditionEasyDialogData& data);
const ScConditionEasyDialogData & GetEasyConditionalFormatDialogData() const
void SetEasyConditionalFormatDialogData(std::unique_ptr<ScConditionMode> pMode);
const ScConditionMode* GetEasyConditionalFormatDialogData() const
{
return pConditionalFormatDialogData;
return pConditionalFormatDialogMode.get();
}
void Clear( bool bFromDestructor = false );

View file

@ -93,7 +93,6 @@ public:
virtual std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList() = 0;
virtual bool CondFormatsChanged() const = 0;
virtual void ShowEasyConditionalDialog() = 0;
virtual void SetModified() = 0;

View file

@ -11,7 +11,6 @@ from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
from libreoffice.calc.document import get_sheet_from_doc
from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
import sys
class ConditionalFormatDlgTest(UITestCase):
@ -54,9 +53,9 @@ class ConditionalFormatDlgTest(UITestCase):
# and still only 2 conditional formats in the document
xList = xCondFormatMgr.getChild("CONTAINER")
list_state = get_state_as_dict(xList)
self.assertEqual(list_state['Children'], '3')
self.assertEqual(list_state['Children'], '2')
self.assertEqual(conditional_format_list.getLength(), 3)
self.assertEqual(conditional_format_list.getLength(), 2)
# close the conditional format manager
xCancelBtn = xCondFormatMgr.getChild("cancel")

View file

@ -219,8 +219,7 @@ interface CellSelection
SID_POPUP_EASY_CONDITIONAL_FORMAT []
SfxVoidItem ConditionalFormatEasy SID_EASY_CONDITIONAL_FORMAT_DIALOG
(
SfxInt16Item FormatRule FN_PARAM_1,
SfxBoolItem Managed FN_PARAM_2
SfxInt16Item FormatRule FN_PARAM_1
)
[
ExecMethod = Execute;

View file

@ -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)

View file

@ -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();

View file

@ -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

View file

@ -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)
{

View file

@ -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();

View file

@ -39,7 +39,6 @@ private:
ScViewData* mpViewData;
ScDocument& mrDocument;
ScConditionMode meMode;
bool mbIsManaged;
ScAddress maPosition;
std::unique_ptr<weld::Entry> mxNumberEntry;

View file

@ -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;

View file

@ -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);

View file

@ -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 );
}

View file

@ -163,67 +163,11 @@
</packing>
</child>
<child>
<object class="GtkBox" id="buttonbox2">
<object class="GtkButtonBox" id="buttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkComboBoxText" id="type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">0</property>
<items>
<item translatable="yes" context="condformatmanager|typex">Cell value</item>
<item translatable="yes" context="condformatmanager|typex">Formula is</item>
<item translatable="yes" context="condformatmanager|typex">Date is</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="typeis">
<property name="can_focus">False</property>
<property name="visible">True</property>
<property name="no_show_all">True</property>
<property name="active">0</property>
<items>
<item translatable="yes" context="condformatmanager|typeis" id="0">is equal to</item>
<item translatable="yes" context="condformatmanager|typeis" id="1">is less than</item>
<item translatable="yes" context="condformatmanager|typeis" id="2">is greater than</item>
<item translatable="yes" context="condformatmanager|typeis" id="3">is less than or equal to</item>
<item translatable="yes" context="condformatmanager|typeis" id="4">is greater than or equal to</item>
<item translatable="yes" context="condformatmanager|typeis" id="5">is not equal to</item>
<item translatable="yes" context="condformatmanager|typeis" id="6">is between</item>
<item translatable="yes" context="condformatmanager|typeis" id="7">is not between</item>
<item translatable="yes" context="condformatmanager|typeis" id="8">is duplicate</item>
<item translatable="yes" context="condformatmanager|typeis" id="9">is not duplicate</item>
<!-- <item translatable="yes" context="condformatmanager|typeis" id="10" >is direct</item> -->
<item translatable="yes" context="condformatmanager|typeis" id="11">is in top N elements</item>
<item translatable="yes" context="condformatmanager|typeis" id="12">is in bottom N elements</item>
<item translatable="yes" context="condformatmanager|typeis" id="13">is in top N percent</item>
<item translatable="yes" context="condformatmanager|typeis" id="14">is in bottom N percent</item>
<item translatable="yes" context="condformatmanager|typeis" id="15">is above average</item>
<item translatable="yes" context="condformatmanager|typeis" id="16">is below average</item>
<item translatable="yes" context="condformatmanager|typeis" id="17">is above or equal average</item>
<item translatable="yes" context="condformatmanager|typeis" id="18">is below or equal average</item>
<item translatable="yes" context="condformatmanager|typeis" id="19">is error</item>
<item translatable="yes" context="condformatmanager|typeis" id="20">is not error</item>
<item translatable="yes" context="condformatmanager|typeis" id="21">begins with</item>
<item translatable="yes" context="condformatmanager|typeis" id="22">ends with</item>
<item translatable="yes" context="condformatmanager|typeis" id="23">contains</item>
<item translatable="yes" context="condformatmanager|typeis" id="24">does not contain</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="add">
<property name="label" translatable="yes" context="condformatmanager|add">Add</property>
@ -239,7 +183,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -257,7 +201,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">1</property>
</packing>
</child>
<child>
@ -275,7 +219,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">2</property>
</packing>
</child>
</object>