[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Feb 25 23:29:13 PST 2013


 sc/source/ui/condformat/condformatdlgentry.cxx |   46 ++++++++++++++-----------
 1 file changed, 27 insertions(+), 19 deletions(-)

New commits:
commit 382bf0e42f1a9ad4109343a164341723da4f7ded
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Feb 19 19:18:35 2013 +0100

    respect local number format in cond format dlg, fdo#60574
    
    Change-Id: Iec185ac6c6447176731619249cdda4457f1bb8a3
    Reviewed-on: https://gerrit.libreoffice.org/2411
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index f750ed5..7039781 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -582,7 +582,7 @@ void ScFormulaFrmtEntry::SetInactive()
 
 namespace {
 
-void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol )
+void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol, ScDocument* pDoc )
 {
     // entry Automatic is not available for color scales
     sal_Int32 nIndex = static_cast<sal_Int32>(rEntry.GetType());
@@ -596,7 +596,13 @@ void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType,
         case COLORSCALE_PERCENTILE:
         case COLORSCALE_VALUE:
         case COLORSCALE_PERCENT:
-            rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue()));
+            {
+                double nVal = rEntry.GetValue();
+                SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
+                rtl::OUString aText;
+                pNumberFormatter->GetInputLineString(nVal, 0, aText);
+                rEdit.SetText(aText);
+            }
             break;
         case COLORSCALE_FORMULA:
             rEdit.SetText(rEntry.GetFormula(formula::FormulaGrammar::GRAM_DEFAULT));
@@ -672,9 +678,9 @@ ScColorScale2FrmtEntry::ScColorScale2FrmtEntry( Window* pParent, ScDocument* pDo
     if(pFormat)
     {
         ScColorScaleFormat::const_iterator itr = pFormat->begin();
-        SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin);
+        SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin, pDoc);
         ++itr;
-        SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax);
+        SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax, pDoc);
     }
     else
     {
@@ -825,12 +831,12 @@ ScColorScale3FrmtEntry::ScColorScale3FrmtEntry( Window* pParent, ScDocument* pDo
     if(pFormat)
     {
         ScColorScaleFormat::const_iterator itr = pFormat->begin();
-        SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin);
+        SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin, pDoc);
         assert(pFormat->size() == 3);
         ++itr;
-        SetColorScaleEntryTypes(*itr, maLbEntryTypeMiddle, maEdMiddle, maLbColMiddle);
+        SetColorScaleEntryTypes(*itr, maLbEntryTypeMiddle, maEdMiddle, maLbColMiddle, pDoc);
         ++itr;
-        SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax);
+        SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax, pDoc);
     }
     else
     {
@@ -1007,7 +1013,7 @@ IMPL_LINK_NOARG( ScConditionFrmtEntry, ConditionTypeSelectHdl )
 
 namespace {
 
-void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit )
+void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ScDocument* pDoc )
 {
     rLbType.SelectEntryPos(rEntry.GetType());
     switch(rEntry.GetType())
@@ -1016,18 +1022,20 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Ed
         case COLORSCALE_MIN:
         case COLORSCALE_MAX:
             break;
-        case COLORSCALE_PERCENTILE:
-            rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue()));
-            break;
+        case COLORSCALE_VALUE:
         case COLORSCALE_PERCENT:
-            rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue()));
+        case COLORSCALE_PERCENTILE:
+            {
+                double nVal = rEntry.GetValue();
+                SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
+                rtl::OUString aText;
+                pNumberFormatter->GetInputLineString(nVal, 0, aText);
+                rEdit.SetText(aText);
+            }
             break;
         case COLORSCALE_FORMULA:
             rEdit.SetText(rEntry.GetFormula(formula::FormulaGrammar::GRAM_DEFAULT));
             break;
-        case COLORSCALE_VALUE:
-            rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue()));
-            break;
     }
 }
 
@@ -1047,8 +1055,8 @@ ScDataBarFrmtEntry::ScDataBarFrmtEntry( Window* pParent, ScDocument* pDoc, const
     if(pFormat)
     {
         mpDataBarData.reset(new ScDataBarFormatData(*pFormat->GetDataBarData()));
-        SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin);
-        SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax);
+        SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin, pDoc);
+        SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax, pDoc);
         DataBarTypeSelectHdl(NULL);
     }
     else
@@ -1152,8 +1160,8 @@ IMPL_LINK_NOARG( ScDataBarFrmtEntry, OptionBtnHdl )
     if( pDlg->Execute() == RET_OK)
     {
         mpDataBarData.reset(pDlg->GetData());
-        SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin);
-        SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax);
+        SetDataBarEntryTypes(*mpDataBarData->mpLowerLimit, maLbDataBarMinType, maEdDataBarMin, mpDoc);
+        SetDataBarEntryTypes(*mpDataBarData->mpUpperLimit, maLbDataBarMaxType, maEdDataBarMax, mpDoc);
         DataBarTypeSelectHdl(NULL);
     }
     return 0;


More information about the Libreoffice-commits mailing list