summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx8
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx14
-rw-r--r--sc/source/ui/view/cellsh1.cxx5
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 );