Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1780

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/80/1780/1

prevent to create cond formats with empty range, fdo#58778

Change-Id: I54bac843dc60c419c23c6d3f22c8d2f4b5805327
---
M sc/source/ui/condformat/condformatdlg.cxx
M sc/source/ui/condformat/condformatmgr.cxx
M sc/source/ui/view/cellsh1.cxx
3 files changed, 19 insertions(+), 8 deletions(-)



diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 9a7be09..1af8118 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -463,12 +463,20 @@
 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 5a5ea1b..e9278a0 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -276,14 +276,14 @@
     if(pDlg->Execute() == RET_OK)
     {
         ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat();
-        if(!pNewFormat)
-            return 0;
+        if(pNewFormat)
+        {
+            mpFormatList->InsertNew(pNewFormat);
+            pNewFormat->SetKey(FindKey(mpFormatList));
+            maCtrlManager.Update();
 
-        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 2227c19..f67717d 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1879,7 +1879,10 @@
                 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 );

-- 
To view, visit https://gerrit.libreoffice.org/1780
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54bac843dc60c419c23c6d3f22c8d2f4b5805327
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Markus Mohrhard <markus.mohrhard@googlemail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.