[Libreoffice-commits] .: 3 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 12 19:34:51 PDT 2012


 sc/source/core/data/table2.cxx                 |   18 ++++++++++++----
 sc/source/ui/condformat/condformatdlgentry.cxx |   27 ++++++++++++++++++++++++-
 sc/source/ui/condformat/condformathelper.cxx   |   19 +++++++++++++++--
 sc/source/ui/inc/condformatdlgentry.hxx        |    7 ++++++
 sc/source/ui/inc/condformathelper.hxx          |    3 +-
 5 files changed, 66 insertions(+), 8 deletions(-)

New commits:
commit 2ec03fc221e80479557f05f53972ca864f1ff4bb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 12 16:46:55 2012 +0200

    don't insert notes from deleted cells, fdo#55885
    
    Change-Id: I036f0531dc2290c5eb480258bc70ec13b810e6bc

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 69c7d00..88a7ea1 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -264,8 +264,13 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
 
         if (nRow >= nStartRow)
         {
-            aNotes.insert(nCol, nRow - nSize, pPostIt);
-            maNotes.ReleaseNote(nCol, nRow);
+            if(nRow > static_cast<SCROW>(nSize))
+            {
+                aNotes.insert(nCol, nRow - nSize, pPostIt);
+                maNotes.ReleaseNote(nCol, nRow);
+            }
+            else
+                maNotes.erase(nCol, nRow);
         }
     }
 
@@ -483,8 +488,13 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
 
         if (nCol >= nStartCol)
         {
-            aNotes.insert(nCol - nSize, nRow, pPostIt);
-            maNotes.ReleaseNote(nCol, nRow);
+            if(nCol > static_cast<SCCOL>(nSize))
+            {
+                aNotes.insert(nCol - nSize, nRow, pPostIt);
+                maNotes.ReleaseNote(nCol, nRow);
+            }
+            else
+                maNotes.erase(nCol, nRow);
         }
     }
 
commit 979c4753831eec5e05df685880cc2052bea64307
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 12 11:57:07 2012 +0200

    improve showing the condition text when the entry is collapsed
    
    Change-Id: I298f80c9df39156f950880a530076e0b0edf27b5

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 646f928..58f59bb 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -289,7 +289,7 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const
 
 rtl::OUString ScConditionFrmtEntry::GetExpressionString()
 {
-    return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos());
+    return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos(), maEdVal1.GetText(), maEdVal2.GetText());
 }
 
 ScFormatEntry* ScConditionFrmtEntry::GetEntry() const
@@ -483,7 +483,7 @@ ScFormatEntry* ScFormulaFrmtEntry::GetEntry() const
 
 rtl::OUString ScFormulaFrmtEntry::GetExpressionString()
 {
-    return ScCondFormatHelper::GetExpression(FORMULA, 0);
+    return ScCondFormatHelper::GetExpression(FORMULA, 0, maEdFormula.GetText());
 }
 
 void ScFormulaFrmtEntry::SetActive()
diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx
index 1ec8607..1f658e3 100644
--- a/sc/source/ui/condformat/condformathelper.cxx
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -91,7 +91,7 @@ rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rForm
                             aBuffer.append(rtl::OUString(" and "));
                             aBuffer.append(pEntry->GetExpression(rPos, 1));
                         }
-                        else
+                        else if(eMode <= SC_COND_NOTEQUAL)
                         {
                             aBuffer.append(pEntry->GetExpression(rPos, 0));
                         }
@@ -110,12 +110,27 @@ rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rForm
     return aBuffer.makeStringAndClear();
 }
 
-rtl::OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex )
+rtl::OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex,
+        rtl::OUString aStr1, rtl::OUString aStr2 )
 {
     rtl::OUStringBuffer aBuffer(getTextForType(eType));
     aBuffer.append(rtl::OUString(" "));
     if(eType == CONDITION)
+    {
         aBuffer.append(getExpression(nIndex));
+        if(nIndex <= 7)
+        {
+            aBuffer.append(" ").append(aStr1);
+            if(nIndex == 6 || nIndex == 7)
+            {
+                aBuffer.append(" and ").append(aStr2);
+            }
+        }
+    }
+    else if(eType == FORMULA)
+    {
+        aBuffer.append(" ").append(aStr1);
+    }
 
     return aBuffer.makeStringAndClear();
 }
diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx
index 48c269d..297d032 100644
--- a/sc/source/ui/inc/condformathelper.hxx
+++ b/sc/source/ui/inc/condformathelper.hxx
@@ -26,7 +26,8 @@ class ScCondFormatHelper
 public:
     static SC_DLLPUBLIC rtl::OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos);
 
-    static SC_DLLPUBLIC rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex );
+    static SC_DLLPUBLIC rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex,
+            rtl::OUString aStr1 = rtl::OUString(), rtl::OUString aStr2 = rtl::OUString() );
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 90306e95c6896c1f3b7f6369581d7bada8f15d7c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Oct 12 08:16:20 2012 +0200

    add the text for collapsed entries back
    
    Change-Id: I67d4f3122e1fe13bda7bf91f500b479ee6853cab

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 447e97b..646f928 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -103,7 +103,7 @@ void ScCondFrmtEntry::Select()
 
 void ScCondFrmtEntry::Deselect()
 {
-    rtl::OUString maCondText("deselected");// = ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos());
+    rtl::OUString maCondText = GetExpressionString();
     maFtCondition.SetText(maCondText);
     maFtCondition.Show();
     maLbType.Hide();
@@ -287,6 +287,11 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const
     return pEntry;
 }
 
+rtl::OUString ScConditionFrmtEntry::GetExpressionString()
+{
+    return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos());
+}
+
 ScFormatEntry* ScConditionFrmtEntry::GetEntry() const
 {
     return createConditionEntry();
@@ -476,6 +481,11 @@ ScFormatEntry* ScFormulaFrmtEntry::GetEntry() const
     return createFormulaEntry();
 }
 
+rtl::OUString ScFormulaFrmtEntry::GetExpressionString()
+{
+    return ScCondFormatHelper::GetExpression(FORMULA, 0);
+}
+
 void ScFormulaFrmtEntry::SetActive()
 {
     maWdPreview.Show();
@@ -654,6 +664,11 @@ ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const
     return pColorScale;
 }
 
+rtl::OUString ScColorScale2FrmtEntry::GetExpressionString()
+{
+    return ScCondFormatHelper::GetExpression( COLORSCALE, 0 );
+}
+
 ScFormatEntry* ScColorScale2FrmtEntry::GetEntry() const
 {
     return createColorscaleEntry();
@@ -823,6 +838,11 @@ ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const
     return pColorScale;
 }
 
+rtl::OUString ScColorScale3FrmtEntry::GetExpressionString()
+{
+    return ScCondFormatHelper::GetExpression( COLORSCALE, 0 );
+}
+
 ScFormatEntry* ScColorScale3FrmtEntry::GetEntry() const
 {
     return createColorscaleEntry();
@@ -994,6 +1014,11 @@ ScFormatEntry* ScDataBarFrmtEntry::createDatabarEntry() const
     return pDataBar;
 }
 
+rtl::OUString ScDataBarFrmtEntry::GetExpressionString()
+{
+    return ScCondFormatHelper::GetExpression( DATABAR, 0 );
+}
+
 void ScDataBarFrmtEntry::SetActive()
 {
     maLbColorFormat.Show();
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx
index c9c61db..0abe83b 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -52,6 +52,8 @@ protected:
     void Select();
     void Deselect();
 
+    virtual rtl::OUString GetExpressionString() = 0;
+
 public:
     ScCondFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos );
     virtual ~ScCondFrmtEntry();
@@ -83,6 +85,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry
 
     ScFormatEntry* createConditionEntry() const;
 
+    virtual rtl::OUString GetExpressionString();
     void Init();
     DECL_LINK( StyleSelectHdl, void* );
     DECL_LINK( ConditionTypeSelectHdl, void* );
@@ -105,6 +108,7 @@ class ScFormulaFrmtEntry : public ScCondFrmtEntry
     formula::RefEdit maEdFormula;
 
     ScFormatEntry* createFormulaEntry() const;
+    virtual rtl::OUString GetExpressionString();
     void Init();
 
     DECL_LINK( StyleSelectHdl, void* );
@@ -136,6 +140,7 @@ class ScColorScale2FrmtEntry : public ScCondFrmtEntry
 
     ScFormatEntry* createColorscaleEntry() const;
 
+    virtual rtl::OUString GetExpressionString();
     void Init();
 
     DECL_LINK( EntryTypeHdl, ListBox* );
@@ -168,6 +173,7 @@ class ScColorScale3FrmtEntry : public ScCondFrmtEntry
 
     ScFormatEntry* createColorscaleEntry() const;
 
+    virtual rtl::OUString GetExpressionString();
     void Init();
 
     DECL_LINK( EntryTypeHdl, ListBox* );
@@ -196,6 +202,7 @@ class ScDataBarFrmtEntry : public ScCondFrmtEntry
 
     ScFormatEntry* createDatabarEntry() const;
 
+    virtual rtl::OUString GetExpressionString();
     void Init();
 
     DECL_LINK( OptionBtnHdl, void* );


More information about the Libreoffice-commits mailing list