update dev300-m58
[ooovba.git] / applied_patches / 0012-cws-kohei03-chart2.diff
blob119afcce7deb5cc6dd7379858072bdfdbbf234f6
1 diff --git chart2/source/view/charttypes/PieChart.cxx chart2/source/view/charttypes/PieChart.cxx
2 index 80f856e..3596d17 100644
3 --- chart2/source/view/charttypes/PieChart.cxx
4 +++ chart2/source/view/charttypes/PieChart.cxx
5 @@ -129,6 +129,8 @@ PieChart::PieChart( const uno::Reference<XChartType>& xChartTypeModel
6 , m_pPosHelper( new PiePositionHelper( NormalAxis_Z, (m_nDimension==3)?0.0:90.0 ) )
7 , m_bUseRings(false)
9 + ::rtl::math::setNan(&m_fMaxOffset);
11 PlotterBase::m_pPosHelper = m_pPosHelper;
12 VSeriesPlotter::m_pMainPosHelper = m_pPosHelper;
13 m_pPosHelper->m_fRadiusOffset = 0.0;
14 @@ -248,27 +250,31 @@ double PieChart::getMinimumX()
16 return 0.5;
18 -double PieChart::getMaxOffset() const
19 +double PieChart::getMaxOffset()
21 - double fRet = 0.0;
22 + if (!::rtl::math::isNan(m_fMaxOffset))
23 + // Value already cached. Use it.
24 + return m_fMaxOffset;
26 + m_fMaxOffset = 0.0;
27 if( m_aZSlots.size()<=0 )
28 - return fRet;
29 + return m_fMaxOffset;
30 if( m_aZSlots[0].size()<=0 )
31 - return fRet;
32 + return m_fMaxOffset;
34 const ::std::vector< VDataSeries* >& rSeriesList( m_aZSlots[0][0].m_aSeriesVector );
35 if( rSeriesList.size()<=0 )
36 - return fRet;
37 + return m_fMaxOffset;
39 VDataSeries* pSeries = rSeriesList[0];
40 uno::Reference< beans::XPropertySet > xSeriesProp( pSeries->getPropertiesOfSeries() );
41 if( !xSeriesProp.is() )
42 - return fRet;
43 + return m_fMaxOffset;
45 double fExplodePercentage=0.0;
46 xSeriesProp->getPropertyValue( C2U( "Offset" )) >>= fExplodePercentage;
47 - if(fExplodePercentage>fRet)
48 - fRet=fExplodePercentage;
49 + if(fExplodePercentage>m_fMaxOffset)
50 + m_fMaxOffset=fExplodePercentage;
52 uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
53 if( xSeriesProp->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
54 @@ -280,12 +286,12 @@ double PieChart::getMaxOffset() const
56 fExplodePercentage=0.0;
57 xPointProp->getPropertyValue( C2U( "Offset" )) >>= fExplodePercentage;
58 - if(fExplodePercentage>fRet)
59 - fRet=fExplodePercentage;
60 + if(fExplodePercentage>m_fMaxOffset)
61 + m_fMaxOffset=fExplodePercentage;
65 - return fRet;
66 + return m_fMaxOffset;
68 double PieChart::getMaximumX()
70 @@ -357,6 +363,7 @@ void PieChart::createShapes()
71 nExplodeableSlot = m_aZSlots[0].size()-1;
73 m_aLabelInfoList.clear();
74 + ::rtl::math::setNan(&m_fMaxOffset);
76 //=============================================================================
77 for( double fSlotX=0; aXSlotIter != aXSlotEnd && (m_bUseRings||fSlotX<0.5 ); aXSlotIter++, fSlotX+=1.0 )
78 diff --git chart2/source/view/charttypes/PieChart.hxx chart2/source/view/charttypes/PieChart.hxx
79 index e32a9e8..6447515 100644
80 --- chart2/source/view/charttypes/PieChart.hxx
81 +++ chart2/source/view/charttypes/PieChart.hxx
82 @@ -105,7 +105,7 @@ private: //methods
83 , double fLogicZ, double fDepth, double fExplodePercentage
84 , tPropertyNameValueMap* pOverWritePropertiesMap );
86 - double getMaxOffset() const;
87 + double getMaxOffset();
88 bool detectLabelOverlapsAndMove(const ::com::sun::star::awt::Size& rPageSize);//returns true when there might be more to do
89 void resetLabelPositionsToPreviousState();
90 struct PieLabelInfo;
91 @@ -137,6 +137,8 @@ private: //member
94 ::std::vector< PieLabelInfo > m_aLabelInfoList;
96 + double m_fMaxOffset; /// cached max offset value (init'ed to NaN)
98 //.............................................................................
99 } //namespace chart