Kaydet (Commit) b8061f41 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld ScCondFormatManagerDlg

Change-Id: Iccf2657f2c8fe98b4e975936fb75d56fc9523b5a
Reviewed-on: https://gerrit.libreoffice.org/72162
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 28e9dcca
...@@ -423,7 +423,6 @@ ...@@ -423,7 +423,6 @@
#define STR_UNDO_INSERT_CURRENT_TIME NC_("STR_UNDO_INSERT_CURRENT_TIME", "Insert Current Time") #define STR_UNDO_INSERT_CURRENT_TIME NC_("STR_UNDO_INSERT_CURRENT_TIME", "Insert Current Time")
#define STR_MANAGE_NAMES NC_("STR_MANAGE_NAMES", "Manage Names...") #define STR_MANAGE_NAMES NC_("STR_MANAGE_NAMES", "Manage Names...")
#define STR_HEADER_NAME NC_("STR_HEADER_NAME", "Name") #define STR_HEADER_NAME NC_("STR_HEADER_NAME", "Name")
#define STR_HEADER_RANGE_OR_EXPR NC_("STR_HEADER_RANGE_OR_EXPR", "Range or formula expression")
#define STR_HEADER_SCOPE NC_("STR_HEADER_SCOPE", "Scope") #define STR_HEADER_SCOPE NC_("STR_HEADER_SCOPE", "Scope")
#define STR_MULTI_SELECT NC_("STR_MULTI_SELECT", "(multiple)") #define STR_MULTI_SELECT NC_("STR_MULTI_SELECT", "(multiple)")
#define STR_GLOBAL_SCOPE NC_("STR_GLOBAL_SCOPE", "Document (Global)") #define STR_GLOBAL_SCOPE NC_("STR_GLOBAL_SCOPE", "Document (Global)")
...@@ -431,8 +430,6 @@ ...@@ -431,8 +430,6 @@
#define STR_ERR_NAME_INVALID NC_("STR_ERR_NAME_INVALID", "Invalid name. Only use letters, numbers and underscore.") #define STR_ERR_NAME_INVALID NC_("STR_ERR_NAME_INVALID", "Invalid name. Only use letters, numbers and underscore.")
#define STR_UNSAVED_EXT_REF NC_("STR_UNSAVED_EXT_REF", "This Document contains external references to unsaved documents.\n\nDo you want to continue?") #define STR_UNSAVED_EXT_REF NC_("STR_UNSAVED_EXT_REF", "This Document contains external references to unsaved documents.\n\nDo you want to continue?")
#define STR_CLOSE_WITH_UNSAVED_REFS NC_("STR_CLOSE_WITH_UNSAVED_REFS", "This Document is referenced by another document and not yet saved. Closing it without saving will result in data loss.") #define STR_CLOSE_WITH_UNSAVED_REFS NC_("STR_CLOSE_WITH_UNSAVED_REFS", "This Document is referenced by another document and not yet saved. Closing it without saving will result in data loss.")
#define STR_HEADER_RANGE NC_("STR_HEADER_RANGE", "Range")
#define STR_HEADER_COND NC_("STR_HEADER_COND", "First Condition")
#define STR_COND_CONDITION NC_("STR_COND_CONDITION", "Cell value is") #define STR_COND_CONDITION NC_("STR_COND_CONDITION", "Cell value is")
#define STR_COND_COLORSCALE NC_("STR_COND_COLORSCALE", "ColorScale") #define STR_COND_COLORSCALE NC_("STR_COND_COLORSCALE", "ColorScale")
#define STR_COND_DATABAR NC_("STR_COND_DATABAR", "DataBar") #define STR_COND_DATABAR NC_("STR_COND_DATABAR", "DataBar")
......
...@@ -410,7 +410,7 @@ public: ...@@ -410,7 +410,7 @@ public:
virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) = 0; virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) = 0;
virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) = 0; virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) = 0;
virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) = 0; virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) = 0;
......
...@@ -82,7 +82,15 @@ short AbstractScColRowLabelDlg_Impl::Execute() ...@@ -82,7 +82,15 @@ short AbstractScColRowLabelDlg_Impl::Execute()
return m_xDlg->run(); return m_xDlg->run();
} }
IMPL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl); short AbstractScCondFormatManagerDlg_Impl::Execute()
{
return m_xDlg->run();
}
bool AbstractScCondFormatManagerDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
{
return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
}
short AbstractScDataPilotDatabaseDlg_Impl::Execute() short AbstractScDataPilotDatabaseDlg_Impl::Execute()
{ {
...@@ -510,22 +518,22 @@ sal_uLong AbstractScLinkedAreaDlg_Impl::GetRefresh() ...@@ -510,22 +518,22 @@ sal_uLong AbstractScLinkedAreaDlg_Impl::GetRefresh()
std::unique_ptr<ScConditionalFormatList> AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList() std::unique_ptr<ScConditionalFormatList> AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList()
{ {
return pDlg->GetConditionalFormatList(); return m_xDlg->GetConditionalFormatList();
} }
bool AbstractScCondFormatManagerDlg_Impl::CondFormatsChanged() const bool AbstractScCondFormatManagerDlg_Impl::CondFormatsChanged() const
{ {
return pDlg->CondFormatsChanged(); return m_xDlg->CondFormatsChanged();
} }
void AbstractScCondFormatManagerDlg_Impl::SetModified() void AbstractScCondFormatManagerDlg_Impl::SetModified()
{ {
return pDlg->SetModified(); return m_xDlg->SetModified();
} }
ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected() ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected()
{ {
return pDlg->GetCondFormatSelected(); return m_xDlg->GetCondFormatSelected();
} }
int AbstractScMetricInputDlg_Impl::GetInputValue() const int AbstractScMetricInputDlg_Impl::GetInputValue() const
...@@ -761,10 +769,9 @@ VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarni ...@@ -761,10 +769,9 @@ VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarni
return VclPtr<AbstractScSortWarningDlg_Impl>::Create(std::make_unique<ScSortWarningDlg>(pParent, rExtendText, rCurrentText)); return VclPtr<AbstractScSortWarningDlg_Impl>::Create(std::make_unique<ScSortWarningDlg>(pParent, rExtendText, rCurrentText));
} }
VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList )
{ {
VclPtr<ScCondFormatManagerDlg> pDlg = VclPtr<ScCondFormatManagerDlg>::Create( pParent, pDoc, pFormatList ); return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create(std::make_unique<ScCondFormatManagerDlg>(pParent, pDoc, pFormatList));
return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create( pDlg );
} }
VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(weld::Window* pParent) VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(weld::Window* pParent)
......
...@@ -131,14 +131,17 @@ public: ...@@ -131,14 +131,17 @@ public:
class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDlg class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDlg
{ {
DECL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl, ScCondFormatManagerDlg) std::shared_ptr<ScCondFormatManagerDlg> m_xDlg;
public:
explicit AbstractScCondFormatManagerDlg_Impl(std::unique_ptr<ScCondFormatManagerDlg> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
virtual std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList() override; virtual std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList() override;
virtual bool CondFormatsChanged() const override; virtual bool CondFormatsChanged() const override;
virtual void SetModified() override; virtual void SetModified() override;
virtual ScConditionalFormat* GetCondFormatSelected() override; virtual ScConditionalFormat* GetCondFormatSelected() override;
}; };
...@@ -597,7 +600,7 @@ public: ...@@ -597,7 +600,7 @@ public:
virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) override; virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) override;
virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) override; virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) override;
virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) override; virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) override;
......
...@@ -15,194 +15,155 @@ ...@@ -15,194 +15,155 @@
#include <document.hxx> #include <document.hxx>
#include <conditio.hxx> #include <conditio.hxx>
ScCondFormatManagerWindow::ScCondFormatManagerWindow(SvSimpleTableContainer& rParent, ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView,
ScDocument* pDoc, ScConditionalFormatList* pFormatList) ScDocument* pDoc, ScConditionalFormatList* pFormatList)
: SvSimpleTable(rParent, WB_HSCROLL | WB_SORT | WB_TABSTOP) : mrTreeView(rTreeView)
, mpDoc(pDoc) , mpDoc(pDoc)
, mpFormatList(pFormatList) , mpFormatList(pFormatList)
{ {
OUString aConditionStr(ScResId(STR_HEADER_COND)); mrTreeView.set_size_request(mrTreeView.get_approximate_digit_width() * 70,
OUString aRangeStr(ScResId(STR_HEADER_RANGE)); mrTreeView.get_height_rows(20));
OUStringBuffer sHeader;
sHeader.append(aRangeStr).append("\t").append(aConditionStr);
InsertHeaderEntry(sHeader.makeStringAndClear(), HEADERBAR_APPEND, HeaderBarItemBits::LEFT);
setColSizes(); setColSizes();
Init(); Init();
Show(); mrTreeView.set_selection_mode(SelectionMode::Multiple);
SetSelectionMode(SelectionMode::Multiple); mrTreeView.make_sorted();
}
OUString ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat& rFormat)
{
const ScRangeList& aRange = rFormat.GetRange();
OUString aStr;
aRange.Format(aStr, ScRefFlags::VALID, mpDoc, mpDoc->GetAddressConvention());
aStr += "\t";
aStr += ScCondFormatHelper::GetExpression(rFormat, aRange.GetTopLeftCorner());
return aStr;
} }
void ScCondFormatManagerWindow::Init() void ScCondFormatManagerWindow::Init()
{ {
SetUpdateMode(false); mrTreeView.freeze();
if (mpFormatList) if (mpFormatList)
{ {
int nRow = 0;
OUString sRangeStr;
for(const auto& rItem : *mpFormatList) for(const auto& rItem : *mpFormatList)
{ {
SvTreeListEntry* pEntry = InsertEntryToColumn( createEntryString(*rItem) ); const ScRangeList& aRange = rItem->GetRange();
maMapLBoxEntryToCondIndex.insert(std::pair<SvTreeListEntry*,sal_Int32>(pEntry, rItem->GetKey())); aRange.Format(sRangeStr, ScRefFlags::VALID, mpDoc, mpDoc->GetAddressConvention());
mrTreeView.append(OUString::number(rItem->GetKey()), sRangeStr);
mrTreeView.set_text(nRow, ScCondFormatHelper::GetExpression(*rItem, aRange.GetTopLeftCorner()), 1);
++nRow;
} }
} }
SetUpdateMode(true); mrTreeView.thaw();
if (mpFormatList && !mpFormatList->empty()) if (mpFormatList && !mpFormatList->empty())
SelectRow(0); mrTreeView.select(0);
}
void ScCondFormatManagerWindow::Resize()
{
SvSimpleTable::Resize();
if (GetParentDialog()->isCalculatingInitialLayoutSize())
setColSizes();
} }
void ScCondFormatManagerWindow::DeleteSelection() void ScCondFormatManagerWindow::DeleteSelection()
{ {
if(GetSelectionCount()) auto aSelectedRows = mrTreeView.get_selected_rows();
std::sort(aSelectedRows.begin(), aSelectedRows.end());
for (auto it = aSelectedRows.rbegin(); it != aSelectedRows.rend(); ++it)
{ {
for(SvTreeListEntry* pEntry = FirstSelected(); pEntry != nullptr; pEntry = NextSelected(pEntry)) sal_Int32 nIndex = mrTreeView.get_id(*it).toInt32();
{ mpFormatList->erase(nIndex);
sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second; mrTreeView.remove(*it);
mpFormatList->erase(nIndex);
}
RemoveSelection();
} }
} }
ScConditionalFormat* ScCondFormatManagerWindow::GetSelection() ScConditionalFormat* ScCondFormatManagerWindow::GetSelection()
{ {
SvTreeListEntry* pEntry = FirstSelected(); int nEntry = mrTreeView.get_selected_index();
if(!pEntry) if (nEntry == -1)
return nullptr; return nullptr;
sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second; sal_Int32 nIndex = mrTreeView.get_id(nEntry).toInt32();
return mpFormatList->GetFormat(nIndex); return mpFormatList->GetFormat(nIndex);
} }
void ScCondFormatManagerWindow::setColSizes() void ScCondFormatManagerWindow::setColSizes()
{ {
HeaderBar &rBar = GetTheHeaderBar(); std::vector<int> aWidths;
if (rBar.GetItemCount() < 2) aWidths.push_back(mrTreeView.get_size_request().Width() / 2);
return; mrTreeView.set_column_fixed_widths(aWidths);
long aStaticTabs[]= { 0, 0 };
aStaticTabs[1] = rBar.GetSizePixel().Width() / 2;
SvSimpleTable::SetTabs(SAL_N_ELEMENTS(aStaticTabs), aStaticTabs, MapUnit::MapPixel);
}
ScCondFormatManagerDlg::ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList):
ModalDialog(pParent, "CondFormatManager", "modules/scalc/ui/condformatmanager.ui"),
mpFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr),
mbModified(false)
{
SvSimpleTableContainer *pContainer = get<SvSimpleTableContainer>("CONTAINER");
Size aSize(LogicToPixel(Size(290, 220), MapMode(MapUnit::MapAppFont)));
pContainer->set_width_request(aSize.Width());
pContainer->set_height_request(aSize.Height());
m_pCtrlManager = VclPtr<ScCondFormatManagerWindow>::Create(*pContainer, pDoc, mpFormatList.get());
get(m_pBtnAdd, "add");
get(m_pBtnRemove, "remove");
get(m_pBtnEdit, "edit");
m_pBtnRemove->SetClickHdl(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
m_pBtnEdit->SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnClickHdl));
m_pBtnAdd->SetClickHdl(LINK(this, ScCondFormatManagerDlg, AddBtnHdl));
m_pCtrlManager->SetDoubleClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
UpdateButtonSensitivity();
} }
ScCondFormatManagerDlg::~ScCondFormatManagerDlg() ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList)
: GenericDialogController(pParent, "modules/scalc/ui/condformatmanager.ui", "CondFormatManager")
, m_bModified(false)
, m_xFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr)
, m_xBtnAdd(m_xBuilder->weld_button("add"))
, m_xBtnRemove(m_xBuilder->weld_button("remove"))
, m_xBtnEdit(m_xBuilder->weld_button("edit"))
, m_xTreeView(m_xBuilder->weld_tree_view("CONTAINER"))
, m_xCtrlManager(new ScCondFormatManagerWindow(*m_xTreeView, pDoc, m_xFormatList.get()))
{ {
disposeOnce(); m_xBtnRemove->connect_clicked(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
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));
UpdateButtonSensitivity();
} }
void ScCondFormatManagerDlg::dispose() ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
{ {
mpFormatList.reset();
m_pBtnAdd.clear();
m_pBtnRemove.clear();
m_pBtnEdit.clear();
m_pCtrlManager.disposeAndClear();
ModalDialog::dispose();
} }
std::unique_ptr<ScConditionalFormatList> ScCondFormatManagerDlg::GetConditionalFormatList() std::unique_ptr<ScConditionalFormatList> ScCondFormatManagerDlg::GetConditionalFormatList()
{ {
return std::move(mpFormatList); return std::move(m_xFormatList);
} }
void ScCondFormatManagerDlg::UpdateButtonSensitivity() void ScCondFormatManagerDlg::UpdateButtonSensitivity()
{ {
OUString aNewSensitivity = mpFormatList->empty() ? OUString("false") : OUString("true"); bool bNewSensitivity = !m_xFormatList->empty();
m_pBtnRemove->set_property("sensitive", aNewSensitivity); m_xBtnRemove->set_sensitive(bNewSensitivity);
m_pBtnEdit->set_property("sensitive", aNewSensitivity); m_xBtnEdit->set_sensitive(bNewSensitivity);
} }
// Get the current conditional format selected. // Get the current conditional format selected.
// //
ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected() ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected()
{ {
return m_pCtrlManager->GetSelection(); return m_xCtrlManager->GetSelection();
} }
IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl, Button*, void) IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl, weld::Button&, void)
{ {
m_pCtrlManager->DeleteSelection(); m_xCtrlManager->DeleteSelection();
mbModified = true; m_bModified = true;
UpdateButtonSensitivity(); UpdateButtonSensitivity();
} }
IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnClickHdl, Button*, void) IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnClickHdl, weld::Button&, void)
{ {
mbModified = true; EditBtnHdl(*m_xTreeView);
EditBtnHdl(nullptr);
// EditBtnHdl() might call EndDialog which will blow us away
if (!IsDisposed())
UpdateButtonSensitivity();
} }
IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl, SvTreeListBox*, bool)
IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl, weld::TreeView&, void)
{ {
ScConditionalFormat* pFormat = m_pCtrlManager->GetSelection(); ScConditionalFormat* pFormat = m_xCtrlManager->GetSelection();
if(!pFormat) if (!pFormat)
return false; return;
mbModified = true; m_bModified = true;
EndDialog( DLG_RET_EDIT ); m_xDialog->response( DLG_RET_EDIT );
return false; return;
} }
IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl, Button*, void) IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl, weld::Button&, void)
{ {
mbModified = true; m_bModified = true;
EndDialog( DLG_RET_ADD ); m_xDialog->response( DLG_RET_ADD );
} }
void ScCondFormatManagerDlg::SetModified() void ScCondFormatManagerDlg::SetModified()
{ {
mbModified = true; m_bModified = true;
UpdateButtonSensitivity(); UpdateButtonSensitivity();
} }
bool ScCondFormatManagerDlg::CondFormatsChanged() const bool ScCondFormatManagerDlg::CondFormatsChanged() const
{ {
return mbModified; return m_bModified;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX #ifndef INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX
#define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX #define INCLUDED_SC_SOURCE_UI_INC_CONDFORMATMGR_HXX
#include <vcl/dialog.hxx> #include <vcl/weld.hxx>
#include <vcl/button.hxx>
#include <svtools/simptabl.hxx>
#include <map> #include <map>
...@@ -20,31 +18,28 @@ class ScDocument; ...@@ -20,31 +18,28 @@ class ScDocument;
class ScConditionalFormat; class ScConditionalFormat;
class ScConditionalFormatList; class ScConditionalFormatList;
class ScCondFormatManagerWindow : public SvSimpleTable class ScCondFormatManagerWindow
{ {
private: private:
void Init(); void Init();
OUString createEntryString(const ScConditionalFormat& rFormat);
void setColSizes(); void setColSizes();
weld::TreeView& mrTreeView;
ScDocument* const mpDoc; ScDocument* const mpDoc;
ScConditionalFormatList* mpFormatList; ScConditionalFormatList* mpFormatList;
std::map<SvTreeListEntry*, sal_Int32> maMapLBoxEntryToCondIndex;
public: public:
ScCondFormatManagerWindow(SvSimpleTableContainer& rParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList); ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument* pDoc, ScConditionalFormatList* pFormatList);
void DeleteSelection(); void DeleteSelection();
ScConditionalFormat* GetSelection(); ScConditionalFormat* GetSelection();
virtual void Resize() override;
}; };
class ScCondFormatManagerDlg : public ModalDialog class ScCondFormatManagerDlg : public weld::GenericDialogController
{ {
public: public:
ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList); ScCondFormatManagerDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList);
virtual ~ScCondFormatManagerDlg() override; virtual ~ScCondFormatManagerDlg() override;
virtual void dispose() override;
std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList(); std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList();
...@@ -54,19 +49,21 @@ public: ...@@ -54,19 +49,21 @@ public:
ScConditionalFormat* GetCondFormatSelected(); ScConditionalFormat* GetCondFormatSelected();
private: private:
VclPtr<PushButton> m_pBtnAdd; bool m_bModified;
VclPtr<PushButton> m_pBtnRemove; std::unique_ptr<ScConditionalFormatList> m_xFormatList;
VclPtr<PushButton> m_pBtnEdit;
std::unique_ptr<ScConditionalFormatList> mpFormatList; std::unique_ptr<weld::Button> m_xBtnAdd;
VclPtr<ScCondFormatManagerWindow> m_pCtrlManager; std::unique_ptr<weld::Button> m_xBtnRemove;
void UpdateButtonSensitivity(); std::unique_ptr<weld::Button> m_xBtnEdit;
std::unique_ptr<weld::TreeView> m_xTreeView;
std::unique_ptr<ScCondFormatManagerWindow> m_xCtrlManager;
DECL_LINK(RemoveBtnHdl, Button*, void); void UpdateButtonSensitivity();
DECL_LINK(EditBtnClickHdl, Button*, void);
DECL_LINK(AddBtnHdl, Button*, void);
DECL_LINK(EditBtnHdl, SvTreeListBox*, bool);
bool mbModified; DECL_LINK(RemoveBtnHdl, weld::Button&, void);
DECL_LINK(EditBtnClickHdl, weld::Button&, void);
DECL_LINK(AddBtnHdl, weld::Button&, void);
DECL_LINK(EditBtnHdl, weld::TreeView&, void);
}; };
#endif #endif
......
...@@ -2541,8 +2541,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ...@@ -2541,8 +2541,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if (!pList) if (!pList)
pList = pDoc->GetCondFormList( aPos.Tab() ); pList = pDoc->GetCondFormList( aPos.Tab() );
vcl::Window* pWin = pTabViewShell->GetDialogParent();
VclPtr<AbstractScCondFormatManagerDlg> pDlg(pFact->CreateScCondFormatMgrDlg( VclPtr<AbstractScCondFormatManagerDlg> pDlg(pFact->CreateScCondFormatMgrDlg(
pTabViewShell->GetDialogParent(), pDoc, pList)); pWin ? pWin->GetFrameWeld() : nullptr, pDoc, pList));
if (pDlgItem) if (pDlgItem)
pDlg->SetModified(); pDlg->SetModified();
...@@ -2579,6 +2580,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ...@@ -2579,6 +2580,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if (pDlgItem) if (pDlgItem)
pTabViewShell->GetPool().Remove(*pDlgItem); pTabViewShell->GetPool().Remove(*pDlgItem);
pDlg->disposeOnce();
}); });
} }
break; break;
......
...@@ -140,10 +140,6 @@ ...@@ -140,10 +140,6 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<style>
<class name="notebook"/>
<class name="stack"/>
</style>
</object> </object>
</child> </child>
</object> </object>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment