Kaydet (Commit) d8a85436 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

enable the add button in manage conditional formats

Change-Id: I82a0abf58f8fc68d0e9e145923961fa3e3c654fe
üst c2d8d607
......@@ -181,8 +181,8 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc
maBtnRemove.SetClickHdl(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
maBtnEdit.SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
maBtnAdd.SetClickHdl(LINK(this, ScCondFormatManagerDlg, AddBtnHdl));
maCtrlManager.GetListControl().SetDoubleClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
maBtnAdd.Hide();
}
ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
......@@ -233,4 +233,39 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
return 0;
}
namespace {
sal_uInt32 FindKey(ScConditionalFormatList* pFormatList)
{
sal_uInt32 nKey = 0;
for(ScConditionalFormatList::const_iterator itr = pFormatList->begin(), itrEnd = pFormatList->end();
itr != itrEnd; ++itr)
{
if(itr->GetKey() > nKey)
nKey = itr->GetKey();
}
return nKey + 1;
}
}
IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl)
{
boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(),
maPos, condformat::dialog::CONDITION));
if(pDlg->Execute() == RET_OK)
{
ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat();
mpFormatList->InsertNew(pNewFormat);
pNewFormat->SetKey(FindKey(mpFormatList));
maCtrlManager.Update();
mbModified = true;
}
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -106,6 +106,7 @@ private:
DECL_LINK(RemoveBtnHdl, void*);
DECL_LINK(EditBtnHdl, void*);
DECL_LINK(AddBtnHdl, void*);
bool mbModified;
};
......
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