summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-10-07 22:22:54 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-10-09 16:33:42 -0400
commita66ab02f04e2541e457f72cb0580b1c226ebd79d (patch)
treee15d0a16dee600f2bde84ea66aa0fbb6c05a90a8
parent4dfd8ba4ab9e5375edb3ce9a8de30bc0240f31ff (diff)
Make thie method consistent with the others.
Change-Id: I028f0dd833cb2307e842805636458f51c71dbd66
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx19
-rw-r--r--chart2/source/view/axes/VCartesianAxis.hxx9
2 files changed, 20 insertions, 8 deletions
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index c5f0bc91ba40..c9c35ad18930 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -847,17 +847,22 @@ double VCartesianAxis::getLabelLineIntersectionValue() const
return getAxisIntersectionValue();
}
-bool VCartesianAxis::getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis ) const
+double VCartesianAxis::getExtraLineIntersectionValue() const
{
+ double fNan;
+ rtl::math::setNan(&fNan);
+
if( !m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
- return false;
+ return fNan;
+
double fMin = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMinY();
double fMax = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMaxY();
+
if( *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis <= fMin
|| *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis >= fMax )
- return false;
- fCrossesOtherAxis = *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis;
- return true;
+ return fNan;
+
+ return *m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis;
}
B2DVector VCartesianAxis::getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const
@@ -1640,8 +1645,8 @@ void VCartesianAxis::createShapes()
//create an additional line at NULL
if( !AxisHelper::isAxisPositioningEnabled() )
{
- double fExtraLineCrossesOtherAxis;
- if( getLogicValueWhereExtraLineCrossesOtherAxis(fExtraLineCrossesOtherAxis) )
+ double fExtraLineCrossesOtherAxis = getExtraLineIntersectionValue();
+ if (!rtl::math::isNan(fExtraLineCrossesOtherAxis))
{
B2DVector aStart, aEnd;
this->get2DAxisMainLine( aStart, aEnd, fExtraLineCrossesOtherAxis );
diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx
index 757fd1a971a3..2f320f3c229c 100644
--- a/chart2/source/view/axes/VCartesianAxis.hxx
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -63,7 +63,14 @@ public:
*/
double getLabelLineIntersectionValue() const;
- bool getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis) const;
+ /**
+ * Get the value at which extra line crosses the other axis.
+ *
+ * @return a NaN if the line doesn't cross the other axis, a non-NaN value
+ * otherwise.
+ */
+ double getExtraLineIntersectionValue() const;
+
void get2DAxisMainLine( ::basegfx::B2DVector& rStart, ::basegfx::B2DVector& rEnd, double fCrossesOtherAxis );
//Layout interface for cartesian axes: