[Libreoffice-commits] .: Branch 'feature/cond-format-rework' - 3 commits - sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Oct 5 21:54:39 PDT 2012
sc/source/ui/condformat/condformatdlg.cxx | 17 ++++++++++++
sc/source/ui/condformat/condformatmgr.cxx | 40 +++++++++++++++++++++++++++++-
sc/source/ui/inc/condformatdlg.hxx | 1
sc/source/ui/inc/condformatmgr.hxx | 1
4 files changed, 58 insertions(+), 1 deletion(-)
New commits:
commit 980adbc460c28a6ab43efed952c2c248fda37f3e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 6 06:52:28 2012 +0200
prevent creating cond formats without a attached range
Change-Id: Ic4c13fa3d0eae54b7db1fa5a4e5c5040582b21ed
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 9dc6350..4c5708a 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -1133,6 +1133,7 @@ ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScCond
maBtnAdd.SetClickHdl( LINK( &maCondFormList, ScCondFormatList, AddBtnHdl ) );
maBtnRemove.SetClickHdl( LINK( &maCondFormList, ScCondFormatList, RemoveBtnHdl ) );
maEdRange.SetModifyHdl( LINK( this, ScCondFormatDlg, EdRangeModifyHdl ) );
+ maBtnOk.SetClickHdl( LINK( this, ScCondFormatDlg, OkBtnHdl ) );
FreeResource();
maEdRange.SetText(aRangeString);
@@ -1207,5 +1208,21 @@ IMPL_LINK( ScCondFormatDlg, EdRangeModifyHdl, Edit*, pEdit )
return 0;
}
+IMPL_LINK_NOARG( ScCondFormatDlg, OkBtnHdl )
+{
+ rtl::OUString aRangeStr = maEdRange.GetText();
+ ScRangeList aRange;
+ aRange.Parse(aRangeStr, mpDoc, SCA_VALID, mpDoc->GetAddressConvention());
+ boost::scoped_ptr<ScConditionalFormat> pFormat(maCondFormList.GetConditionalFormat());
+ if(pFormat && pFormat->GetRange().empty() && aRange.empty())
+ return 0;
+ else
+ {
+ EndDialog(RET_OK);
+ }
+
+ return 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index c7a247c..52c03e5 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -205,6 +205,7 @@ private:
ScDocument* mpDoc;
DECL_LINK( EdRangeModifyHdl, Edit* );
+ DECL_LINK( OkBtnHdl, void* );
public:
ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
commit 5400ea5b75f6d0375725336b828b06ae74cc0e5c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 6 06:52:03 2012 +0200
prevent crash when no cond format will be defined in cond format dlg
Change-Id: Iffc54ada1fcf586c00eddf934079fa671f263ce0
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index c6a6465..0bd3538 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -257,6 +257,9 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl)
if(pDlg->Execute() == RET_OK)
{
ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat();
+ if(!pNewFormat)
+ return 0;
+
mpFormatList->InsertNew(pNewFormat);
pNewFormat->SetKey(FindKey(mpFormatList));
maCtrlManager.Update();
commit 716642988f01d3023561bd215d83efaefee6efaf
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 6 06:24:30 2012 +0200
enable the add button in manage conditional formats
Change-Id: I82a0abf58f8fc68d0e9e145923961fa3e3c654fe
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 6eeecd1..c6a6465 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 c71e2ef..5b0d1e8 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;
};
More information about the Libreoffice-commits
mailing list