summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-10-06 06:52:28 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-10-06 21:25:12 +0200
commitce8ac5bbe40e4cb57e1826a81b3b5c4632474789 (patch)
tree682f01079953d191398adaca356027ca9fea02d9 /sc/source
parent7f127204ce0d601ef4b956b92c6ba433f753d534 (diff)
prevent creating cond formats without a attached range
Change-Id: Ic4c13fa3d0eae54b7db1fa5a4e5c5040582b21ed
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx17
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx1
2 files changed, 18 insertions, 0 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 9dc6350241e9..4c5708a00c84 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 c7a247ce8cf4..52c03e504468 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);