diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-18 15:07:00 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-19 09:14:12 +0100 |
commit | e2170dd77ffbeda24aabb2b704deedd4440d7620 (patch) | |
tree | 7f7984f1a601dfd66761657f522ea139d68f2245 /sc | |
parent | PRODUCTEXTENSION: fix various obvious strings and such... (diff) | |
download | core-e2170dd77ffbeda24aabb2b704deedd4440d7620.tar.gz core-e2170dd77ffbeda24aabb2b704deedd4440d7620.zip |
prevent to create cond formats with empty range, fdo#58778
Change-Id: I54bac843dc60c419c23c6d3f22c8d2f4b5805327
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatmgr.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 5 |
3 files changed, 19 insertions, 8 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 784f1ed94c46..4bd4c05b3467 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -467,12 +467,20 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument*) ScConditionalFormat* ScCondFormatDlg::GetConditionalFormat() const { rtl::OUString aRangeStr = maEdRange.GetText(); + if(aRangeStr.isEmpty()) + return NULL; + ScRangeList aRange; sal_uInt16 nFlags = aRange.Parse(aRangeStr, mpDoc, SCA_VALID, mpDoc->GetAddressConvention(), maPos.Tab()); ScConditionalFormat* pFormat = maCondFormList.GetConditionalFormat(); if(nFlags & SCA_VALID && !aRange.empty() && pFormat) pFormat->AddRange(aRange); + else + { + delete pFormat; + pFormat = NULL; + } return pFormat; } diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index af9e383f3cf0..977cc3647eb5 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -275,14 +275,14 @@ 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(); + if(pNewFormat) + { + mpFormatList->InsertNew(pNewFormat); + pNewFormat->SetKey(FindKey(mpFormatList)); + maCtrlManager.Update(); - mbModified = true; + mbModified = true; + } } Show(true, 0); pScMod->SetRefDialog( nId, false ); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 5c4d42bfb0a0..0c96dd5478aa 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1886,7 +1886,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( pCondFormatDlg->Execute() == RET_OK ) { ScConditionalFormat* pFormat = pCondFormatDlg->GetConditionalFormat(); - pData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nKey, pFormat, aPos.Tab(), pFormat->GetRange()); + if(pFormat) + pData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nKey, pFormat, aPos.Tab(), pFormat->GetRange()); + else + pData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nKey, NULL, aPos.Tab(), ScRangeList()); } pScMod->SetRefDialog( nId, false ); |