summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-07-20 18:32:57 +0200
committerEike Rathke <erack@redhat.com>2017-07-21 12:24:27 +0200
commitfcd0361d6be8d088be12e500f0120afd7995d1ac (patch)
tree9e18c0310405d68d9151db9073cc8f6926df077d /chart2
parent2e486daff35ab16e810bfdafb24b19bcbf2fe8cd (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')
-rw-r--r--chart2/source/view/axes/DateHelper.cxx2
-rw-r--r--chart2/source/view/axes/DateScaling.cxx2
-rw-r--r--chart2/source/view/axes/ScaleAutomatism.cxx4
-rw-r--r--chart2/source/view/axes/Tickmarks_Dates.cxx4
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx4
-rw-r--r--chart2/source/view/main/ChartView.cxx2
6 files changed, 9 insertions, 9 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 );
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 3697f9456601..b4173b69fe41 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1382,11 +1382,11 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis()
aNullDate = m_apNumberFormatterWrapper->getNullDate();
if( aIt!=aEnd )
{
- Date aPrevious(aNullDate); aPrevious+=static_cast<sal_Int32>(rtl::math::approxFloor(*aIt));
+ Date aPrevious(aNullDate); aPrevious.AddDays(rtl::math::approxFloor(*aIt));
++aIt;
for(;aIt!=aEnd;++aIt)
{
- Date aCurrent(aNullDate); aCurrent+=static_cast<sal_Int32>(rtl::math::approxFloor(*aIt));
+ Date aCurrent(aNullDate); aCurrent.AddDays(rtl::math::approxFloor(*aIt));
if( nRet == css::chart::TimeUnit::YEAR )
{
if( DateHelper::IsInSameYear( aPrevious, aCurrent ) )
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 181b283545fe..20a4c1cb493c 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1861,7 +1861,7 @@ bool ChartView::getExplicitValuesForAxis(
//remove 'one' from max
if( rExplicitScale.AxisType == css::chart2::AxisType::DATE )
{
- Date aMaxDate(rExplicitScale.NullDate); aMaxDate += static_cast<sal_Int32>(::rtl::math::approxFloor(rExplicitScale.Maximum));
+ Date aMaxDate(rExplicitScale.NullDate); aMaxDate.AddDays(::rtl::math::approxFloor(rExplicitScale.Maximum));
//for explicit scales with shifted categories we need one interval more
switch( rExplicitScale.TimeResolution )
{