[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - chart2/source

Katarina Behrens bubli at bubli.org
Thu Oct 9 03:38:27 PDT 2014


 chart2/source/controller/dialogs/res_ErrorBar.cxx |   20 ++++++++++++--------
 chart2/source/controller/inc/res_ErrorBar.hxx     |    2 ++
 2 files changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 38f6065b0272ae4bc80f5f35866012b4ea0bc38b
Author: Katarina Behrens <bubli at bubli.org>
Date:   Thu Jul 17 22:35:46 2014 +0200

    fdo#77319: set spinbox value AFTER adjusting no. of decimal places
    
    Doing it the other way round truncates the values
    
    Change-Id: Ieb14c9d1b9dde496eac24737aced7c8da8ce1346
    Reviewed-on: https://gerrit.libreoffice.org/11865
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx
index 60b4987..8157301 100644
--- a/chart2/source/controller/dialogs/res_ErrorBar.cxx
+++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx
@@ -93,6 +93,8 @@ ErrorBarResources::ErrorBarResources( VclBuilderContainer* pParent, Dialog * pPa
         m_eErrorBarType( eType ),
         m_nConstDecimalDigits( 1 ),
         m_nConstSpinSize( 1 ),
+        m_fPlusValue(0.0),
+        m_fMinusValue(0.0),
         m_pParentDialog( pParentDialog ),
         m_pCurrentRangeChoosingField( 0 ),
         m_bHasInternalDataProvider( true ),
@@ -271,6 +273,13 @@ void ErrorBarResources::UpdateControlStates()
         m_pMfNegative->SetDecimalDigits( m_nConstDecimalDigits );
         m_pMfNegative->SetSpinSize( m_nConstSpinSize );
     }
+
+    sal_Int32 nPlusValue = static_cast< sal_Int32 >( m_fPlusValue * pow(10.0,m_pMfPositive->GetDecimalDigits()) );
+    sal_Int32 nMinusValue = static_cast< sal_Int32 >( m_fMinusValue * pow(10.0,m_pMfNegative->GetDecimalDigits()) );
+
+    m_pMfPositive->SetValue( nPlusValue );
+    m_pMfNegative->SetValue( nMinusValue );
+
     m_pMfPositive->SetCustomUnitText( aCustomUnit );
     m_pMfNegative->SetCustomUnitText( aCustomUnit );
 
@@ -530,24 +539,19 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs)
     // parameters
     aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, true, &pPoolItem );
     m_bPlusUnique = ( aState != SFX_ITEM_DONTCARE );
-    double fPlusValue = 0.0;
     if( aState == SFX_ITEM_SET )
     {
-        fPlusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
-        sal_Int32 nPlusValue = static_cast< sal_Int32 >( fPlusValue * pow(10.0,m_pMfPositive->GetDecimalDigits()) );
-        m_pMfPositive->SetValue( nPlusValue );
+        m_fPlusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
     }
 
     aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, true, &pPoolItem );
     m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE );
     if( aState == SFX_ITEM_SET )
     {
-        double fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
-        sal_Int32 nMinusValue = static_cast< sal_Int32 >( fMinusValue * pow(10.0,m_pMfNegative->GetDecimalDigits()) );
-        m_pMfNegative->SetValue( nMinusValue );
+        m_fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue();
 
         if( m_eErrorKind != CHERROR_RANGE &&
-            fPlusValue == fMinusValue )
+            m_fPlusValue == m_fMinusValue )
             m_pCbSyncPosNeg->Check();
     }
 
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
index 7851418..95706bc 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -114,6 +114,8 @@ private:
     tErrorBarType        m_eErrorBarType;
     sal_uInt16           m_nConstDecimalDigits;
     sal_Int64            m_nConstSpinSize;
+    double               m_fPlusValue;
+    double               m_fMinusValue;
 
     Dialog *             m_pParentDialog;
     boost::scoped_ptr< RangeSelectionHelper >  m_apRangeSelectionHelper;


More information about the Libreoffice-commits mailing list