diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-06 06:24:30 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-06 21:25:11 +0200 |
commit | d8a854364f6c3d9a7a1de2073d3ff5f17c5c2762 (patch) | |
tree | 3fbf6836eab64d84c2755f5f3a646d81886956fd /sc/source/ui | |
parent | c2d8d60748769d32133f33efb43be3e9ea28f8c8 (diff) |
enable the add button in manage conditional formats
Change-Id: I82a0abf58f8fc68d0e9e145923961fa3e3c654fe
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/condformat/condformatmgr.cxx | 37 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatmgr.hxx | 1 |
2 files changed, 37 insertions, 1 deletions
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 6eeecd108dc8..c6a6465a785d 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -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: */ diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index c71e2ef5e249..5b0d1e8a9f82 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -106,6 +106,7 @@ private: DECL_LINK(RemoveBtnHdl, void*); DECL_LINK(EditBtnHdl, void*); + DECL_LINK(AddBtnHdl, void*); bool mbModified; }; |