diff options
author | Eike Rathke <erack@redhat.com> | 2017-07-20 18:32:57 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-07-21 12:24:27 +0200 |
commit | fcd0361d6be8d088be12e500f0120afd7995d1ac (patch) | |
tree | 9e18c0310405d68d9151db9073cc8f6926df077d /chart2/source/view/axes | |
parent | 2e486daff35ab16e810bfdafb24b19bcbf2fe8cd (diff) |
Eliminate Date::operator+=() and -=() and replace with Date::AddDays()
Clarifies code and gets rid of explicitly casting the operand to sal_Int32.
Also in preparation of removing DateTime::operator+=(sal_Int32) that is
confusingly similar to DateTime::operator+=(double) and just depends on type.
Change-Id: I83422e2940fbb017978db9b5734b4966228af3de
Reviewed-on: https://gerrit.libreoffice.org/40248
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'chart2/source/view/axes')
-rw-r--r-- | chart2/source/view/axes/DateHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/axes/DateScaling.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/axes/ScaleAutomatism.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/axes/Tickmarks_Dates.cxx | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/chart2/source/view/axes/DateHelper.cxx b/chart2/source/view/axes/DateHelper.cxx index afefa628ff89..f90ac57e7c5d 100644 --- a/chart2/source/view/axes/DateHelper.cxx +++ b/chart2/source/view/axes/DateHelper.cxx @@ -69,7 +69,7 @@ bool DateHelper::IsLessThanOneYearAway( const Date& rD1, const Date& rD2 ) double DateHelper::RasterizeDateValue( double fValue, const Date& rNullDate, long TimeResolution ) { - Date aDate(rNullDate); aDate += static_cast<sal_Int32>(::rtl::math::approxFloor(fValue)); + Date aDate(rNullDate); aDate.AddDays(::rtl::math::approxFloor(fValue)); switch(TimeResolution) { case css::chart::TimeUnit::DAY: diff --git a/chart2/source/view/axes/DateScaling.cxx b/chart2/source/view/axes/DateScaling.cxx index 449c25c461c9..663e55e1e386 100644 --- a/chart2/source/view/axes/DateScaling.cxx +++ b/chart2/source/view/axes/DateScaling.cxx @@ -59,7 +59,7 @@ double SAL_CALL DateScaling::doScaling( double value ) else { Date aDate(m_aNullDate); - aDate += static_cast<sal_Int32>(::rtl::math::approxFloor(value)); + aDate.AddDays(::rtl::math::approxFloor(value)); switch( m_nTimeUnit ) { case DAY: diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx index 97d84fa310e5..f712ecf33f91 100644 --- a/chart2/source/view/axes/ScaleAutomatism.cxx +++ b/chart2/source/view/axes/ScaleAutomatism.cxx @@ -548,8 +548,8 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis( ExplicitIncrementData& rExplicitIncrement, bool bAutoMinimum, bool bAutoMaximum ) const { - Date aMinDate(m_aNullDate); aMinDate += static_cast<sal_Int32>(::rtl::math::approxFloor(rExplicitScale.Minimum)); - Date aMaxDate(m_aNullDate); aMaxDate += static_cast<sal_Int32>(::rtl::math::approxFloor(rExplicitScale.Maximum)); + Date aMinDate(m_aNullDate); aMinDate.AddDays(::rtl::math::approxFloor(rExplicitScale.Minimum)); + Date aMaxDate(m_aNullDate); aMaxDate.AddDays(::rtl::math::approxFloor(rExplicitScale.Maximum)); rExplicitIncrement.PostEquidistant = false; if( aMinDate > aMaxDate ) diff --git a/chart2/source/view/axes/Tickmarks_Dates.cxx b/chart2/source/view/axes/Tickmarks_Dates.cxx index b7ba8487b72a..2b14d86a4bc2 100644 --- a/chart2/source/view/axes/Tickmarks_Dates.cxx +++ b/chart2/source/view/axes/Tickmarks_Dates.cxx @@ -98,7 +98,7 @@ void DateTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos, bool bShif switch( m_aIncrement.MajorTimeInterval.TimeUnit ) { case DAY: - aDate += m_aIncrement.MajorTimeInterval.Number; + aDate.AddDays( m_aIncrement.MajorTimeInterval.Number ); break; case YEAR: aDate = DateHelper::GetDateSomeYearsAway( aDate, m_aIncrement.MajorTimeInterval.Number ); @@ -129,7 +129,7 @@ void DateTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos, bool bShif switch( m_aIncrement.MinorTimeInterval.TimeUnit ) { case DAY: - aDate += m_aIncrement.MinorTimeInterval.Number; + aDate.AddDays( m_aIncrement.MinorTimeInterval.Number ); break; case YEAR: aDate = DateHelper::GetDateSomeYearsAway( aDate, m_aIncrement.MinorTimeInterval.Number ); |