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

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Jul 1 06:26:41 PDT 2013


 sc/source/ui/condformat/condformatdlgentry.cxx |   28 +++++++++++++++----------
 1 file changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 9b557cfd01131544639285dace81e11ed3c49aa7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Jun 27 20:44:19 2013 +0200

    use the local setting aware method for the UI, fdo#64754
    
    Change-Id: Ie3117c26b347e1a8996ef9cbcb8b0d6ee561b5b3
    (cherry picked from commit a539cf2c09bdd62d1c4a0124ed536f88d4fd01d5)
    Reviewed-on: https://gerrit.libreoffice.org/4612
    Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>
    Tested-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index d8acc85..46feaa8 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -596,6 +596,14 @@ void ScFormulaFrmtEntry::SetInactive()
 
 namespace {
 
+OUString convertNumberToString(double nVal, ScDocument* pDoc)
+{
+    SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
+    OUString aText;
+    pNumberFormatter->GetInputLineString(nVal, 0, aText);
+    return aText;
+}
+
 void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol, ScDocument* pDoc )
 {
     // entry Automatic is not available for color scales
@@ -612,10 +620,7 @@ void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType,
         case COLORSCALE_PERCENT:
             {
                 double nVal = rEntry.GetValue();
-                SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
-                OUString aText;
-                pNumberFormatter->GetInputLineString(nVal, 0, aText);
-                rEdit.SetText(aText);
+                rEdit.SetText(convertNumberToString(nVal, pDoc));
             }
             break;
         case COLORSCALE_FORMULA:
@@ -1259,14 +1264,15 @@ class ScIconSetFrmtDataEntry : public Control
         ListBox maLbEntryType;
 
     public:
-        ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType eType, sal_Int32 i, const ScColorScaleEntry* pEntry = NULL );
+        ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType eType, ScDocument* pDoc,
+                sal_Int32 i, const ScColorScaleEntry* pEntry = NULL );
 
         ScColorScaleEntry* CreateEntry(ScDocument* pDoc, const ScAddress& rPos) const;
 
         void SetFirstEntry();
 };
 
-ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType eType, sal_Int32 i, const ScColorScaleEntry* pEntry ):
+ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType eType, ScDocument* pDoc, sal_Int32 i, const ScColorScaleEntry* pEntry ):
     Control( pParent, ScResId( RID_ICON_SET_ENTRY ) ),
     maImgIcon( this, ScResId( IMG_ICON ) ),
     maFtEntry( this, ScResId( FT_ICON_SET_ENTRY_TEXT ) ),
@@ -1280,15 +1286,15 @@ ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry( Window* pParent, ScIconSetType e
         {
             case COLORSCALE_VALUE:
                 maLbEntryType.SelectEntryPos(0);
-                maEdEntry.SetText(OUString::valueOf(pEntry->GetValue()));
+                maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc));
                 break;
             case COLORSCALE_PERCENTILE:
                 maLbEntryType.SelectEntryPos(2);
-                maEdEntry.SetText(OUString::valueOf(pEntry->GetValue()));
+                maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc));
                 break;
             case COLORSCALE_PERCENT:
                 maLbEntryType.SelectEntryPos(1);
-                maEdEntry.SetText(OUString::valueOf(pEntry->GetValue()));
+                maEdEntry.SetText(convertNumberToString(pEntry->GetValue(), pDoc));
                 break;
             case COLORSCALE_FORMULA:
                 maLbEntryType.SelectEntryPos(3);
@@ -1367,7 +1373,7 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry( Window* pParent, ScDocument* pDoc, const
         for(size_t i = 0, n = pIconSetFormatData->maEntries.size();
                 i < n; ++i)
         {
-            maEntries.push_back( new ScIconSetFrmtDataEntry( this, eType, i, &pIconSetFormatData->maEntries[i] ) );
+            maEntries.push_back( new ScIconSetFrmtDataEntry( this, eType, pDoc, i, &pIconSetFormatData->maEntries[i] ) );
             Point aPos = maEntries[0].GetPosPixel();
             aPos.Y() += maEntries[0].GetSizePixel().Height() * i * 1.2;
             maEntries[i].SetPosPixel( aPos );
@@ -1397,7 +1403,7 @@ IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl )
 
     for(size_t i = 0; i < nElements; ++i)
     {
-        maEntries.push_back( new ScIconSetFrmtDataEntry( this, static_cast<ScIconSetType>(nPos), i ) );
+        maEntries.push_back( new ScIconSetFrmtDataEntry( this, static_cast<ScIconSetType>(nPos), mpDoc, i ) );
         Point aPos = maEntries[0].GetPosPixel();
         aPos.Y() += maEntries[0].GetSizePixel().Height() * i * 1.2;
         maEntries[i].SetPosPixel( aPos );


More information about the Libreoffice-commits mailing list