[Libreoffice-commits] core.git: chart2/source

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Fri Jan 8 02:54:30 PST 2016


 chart2/source/view/axes/ScaleAutomatism.cxx |   14 ++++++++++++--
 chart2/source/view/inc/ScaleAutomatism.hxx  |    1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 5553d6a9314fd778b9a124d8a2c7e9dd1d7a58a3
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sat Jan 2 15:02:00 2016 +0100

    tdf#96807 Reset min/max of auto scale
    
    Y minimum for auto scale was accidentaly set to 0.
    This avoided correct calculation of Y auto log scale (tdf#96807)
    But also set linear Y auto scale from 0 (tdf#85690)
    
    This fix detects if both min and max are equal to 0, and reset them (+-inf)
    
    Change-Id: Ifaf306831f3b5a18a86483c88e807f478b447c77
    Reviewed-on: https://gerrit.libreoffice.org/21055
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    Tested-by: jan iversen <jani at documentfoundation.org>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx
index f58bde4..61df0af 100644
--- a/chart2/source/view/axes/ScaleAutomatism.cxx
+++ b/chart2/source/view/axes/ScaleAutomatism.cxx
@@ -99,8 +99,7 @@ ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale, const Date& rNu
                     , m_nTimeResolution(::com::sun::star::chart::TimeUnit::DAY)
                     , m_aNullDate(rNullDate)
 {
-    ::rtl::math::setNan( &m_fValueMinimum );
-    ::rtl::math::setNan( &m_fValueMaximum );
+    resetValueRange();
 
     double fExplicitOrigin = 0.0;
     if( m_aSourceScale.Origin >>= fExplicitOrigin )
@@ -110,8 +109,19 @@ ScaleAutomatism::~ScaleAutomatism()
 {
 }
 
+void ScaleAutomatism::resetValueRange( )
+{
+    ::rtl::math::setNan( &m_fValueMinimum );
+    ::rtl::math::setNan( &m_fValueMaximum );
+}
+
 void ScaleAutomatism::expandValueRange( double fMinimum, double fMaximum )
 {
+    // if m_fValueMinimum and m_fValueMaximum == 0, it means that they were not determined.
+    // m_fValueMinimum == 0 makes impossible to determine real minimum,
+    // so they need to be reseted tdf#96807
+    if( (m_fValueMinimum == 0.0) && (m_fValueMaximum == 0.0) )
+        resetValueRange();
     if( (fMinimum < m_fValueMinimum) || ::rtl::math::isNan( m_fValueMinimum ) )
         m_fValueMinimum = fMinimum;
     if( (fMaximum > m_fValueMaximum) || ::rtl::math::isNan( m_fValueMaximum ) )
diff --git a/chart2/source/view/inc/ScaleAutomatism.hxx b/chart2/source/view/inc/ScaleAutomatism.hxx
index 17370fb..513cf7d 100644
--- a/chart2/source/view/inc/ScaleAutomatism.hxx
+++ b/chart2/source/view/inc/ScaleAutomatism.hxx
@@ -53,6 +53,7 @@ public:
      *  undefined (that is empty `uno::Any` objects).
      */
     void                expandValueRange( double fMinimum, double fMaximum );
+    void                resetValueRange();
 
     /** Sets additional auto scaling options.
         @param bExpandBorderToIncrementRhythm  If true, expands automatic


More information about the Libreoffice-commits mailing list