Update ooo320-m1
[ooovba.git] / applied_patches / 0019-cws-koheichart02-chart2.diff
blob1c4e474f6b0dc28fc03b5f443a8478a786dda6ff
1 diff --git chart2/source/model/template/AreaChartType.cxx chart2/source/model/template/AreaChartType.cxx
2 index db529a7..3a562f0 100644
3 --- chart2/source/model/template/AreaChartType.cxx
4 +++ chart2/source/model/template/AreaChartType.cxx
5 @@ -33,8 +33,72 @@
6 #include "AreaChartType.hxx"
7 #include "macros.hxx"
8 #include "servicenames_charttypes.hxx"
9 +#include "PropertyHelper.hxx"
10 +#include "ContainerHelper.hxx"
12 +#include <com/sun/star/beans/PropertyAttribute.hpp>
14 using namespace ::com::sun::star;
15 +using ::com::sun::star::beans::Property;
16 +using ::com::sun::star::uno::Sequence;
18 +namespace
21 +enum
23 + PROP_AREACHARTTYPE_STACKED,
24 + PROP_AREACHARTTYPE_PERCENT
25 +};
27 +void lcl_AddPropertiesToVector(
28 + ::std::vector< Property > & rOutProperties )
30 + rOutProperties.push_back(
31 + Property( C2U( "Stacked" ),
32 + PROP_AREACHARTTYPE_STACKED,
33 + ::getBooleanCppuType(),
34 + beans::PropertyAttribute::BOUND
35 + | beans::PropertyAttribute::MAYBEDEFAULT ));
36 + rOutProperties.push_back(
37 + Property( C2U( "Percent" ),
38 + PROP_AREACHARTTYPE_PERCENT,
39 + ::getBooleanCppuType(),
40 + beans::PropertyAttribute::BOUND
41 + | beans::PropertyAttribute::MAYBEDEFAULT ));
44 +void lcl_AddDefaultsToMap(
45 + ::chart::tPropertyValueMap & rOutMap )
47 + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AREACHARTTYPE_STACKED, false );
48 + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AREACHARTTYPE_PERCENT, false );
51 +const Sequence< Property > & lcl_GetPropertySequence()
53 + static Sequence< Property > aPropSeq;
55 + // /--
56 + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
57 + if( 0 == aPropSeq.getLength() )
58 + {
59 + // get properties
60 + ::std::vector< ::com::sun::star::beans::Property > aProperties;
61 + lcl_AddPropertiesToVector( aProperties );
63 + // and sort them for access via bsearch
64 + ::std::sort( aProperties.begin(), aProperties.end(),
65 + ::chart::PropertyNameLess() );
67 + // transfer result to static Sequence
68 + aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
69 + }
71 + return aPropSeq;
74 +} // anonymous namespace
76 namespace chart
78 @@ -65,6 +129,56 @@ uno::Reference< util::XCloneable > SAL_CALL AreaChartType::createClone()
79 return CHART2_SERVICE_NAME_CHARTTYPE_AREA;
82 +// ____ OPropertySet ____
83 +uno::Any AreaChartType::GetDefaultValue( sal_Int32 nHandle ) const
84 + throw(beans::UnknownPropertyException)
86 + static tPropertyValueMap aStaticDefaults;
88 + // /--
89 + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
90 + if( 0 == aStaticDefaults.size() )
91 + {
92 + // initialize defaults
93 + lcl_AddDefaultsToMap( aStaticDefaults );
94 + }
96 + tPropertyValueMap::const_iterator aFound(
97 + aStaticDefaults.find( nHandle ));
99 + if( aFound == aStaticDefaults.end())
100 + return uno::Any();
102 + return (*aFound).second;
103 + // \--
106 +::cppu::IPropertyArrayHelper & SAL_CALL AreaChartType::getInfoHelper()
108 + static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
109 + /* bSorted = */ sal_True );
111 + return aArrayHelper;
114 +// ____ XPropertySet ____
115 +uno::Reference< beans::XPropertySetInfo > SAL_CALL AreaChartType::getPropertySetInfo()
116 + throw (uno::RuntimeException)
118 + static uno::Reference< beans::XPropertySetInfo > xInfo;
120 + // /--
121 + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
122 + if( !xInfo.is())
124 + xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
125 + getInfoHelper());
128 + return xInfo;
129 + // \--
132 uno::Sequence< ::rtl::OUString > AreaChartType::getSupportedServiceNames_Static()
134 uno::Sequence< ::rtl::OUString > aServices( 2 );
135 diff --git chart2/source/model/template/AreaChartType.hxx chart2/source/model/template/AreaChartType.hxx
136 index 9783074..d3f905d 100644
137 --- chart2/source/model/template/AreaChartType.hxx
138 +++ chart2/source/model/template/AreaChartType.hxx
139 @@ -56,6 +56,16 @@ protected:
140 virtual ::rtl::OUString SAL_CALL getChartType()
141 throw (::com::sun::star::uno::RuntimeException);
143 + // ____ OPropertySet ____
144 + virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
145 + throw(::com::sun::star::beans::UnknownPropertyException);
146 + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
148 + // ____ XPropertySet ____
149 + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
150 + getPropertySetInfo()
151 + throw (::com::sun::star::uno::RuntimeException);
153 // ____ XCloneable ____
154 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
155 throw (::com::sun::star::uno::RuntimeException);
156 diff --git chart2/source/model/template/AreaChartTypeTemplate.cxx chart2/source/model/template/AreaChartTypeTemplate.cxx
157 index 98874ef..f7d24a5 100644
158 --- chart2/source/model/template/AreaChartTypeTemplate.cxx
159 +++ chart2/source/model/template/AreaChartTypeTemplate.cxx
160 @@ -48,6 +48,8 @@ using ::com::sun::star::beans::Property;
161 using ::com::sun::star::uno::Sequence;
162 using ::com::sun::star::uno::Reference;
163 using ::com::sun::star::uno::Any;
164 +using ::com::sun::star::uno::UNO_QUERY;
165 +using ::com::sun::star::uno::UNO_QUERY_THROW;
166 using ::osl::MutexGuard;
168 namespace
169 @@ -275,6 +277,7 @@ Reference< chart2::XChartType > SAL_CALL AreaChartTypeTemplate::getChartTypeForN
171 Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
172 ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
173 + setStackModePropertiesToChartType(xResult);
174 return xResult;
177 diff --git chart2/source/model/template/BarChartTypeTemplate.cxx chart2/source/model/template/BarChartTypeTemplate.cxx
178 index e6382d5..0e5904d 100644
179 --- chart2/source/model/template/BarChartTypeTemplate.cxx
180 +++ chart2/source/model/template/BarChartTypeTemplate.cxx
181 @@ -221,6 +221,7 @@ Reference< chart2::XChartType > SAL_CALL BarChartTypeTemplate::getChartTypeForNe
183 Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
184 ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
185 + setStackModePropertiesToChartType(xResult);
186 return xResult;
189 diff --git chart2/source/model/template/ChartTypeTemplate.cxx chart2/source/model/template/ChartTypeTemplate.cxx
190 index 9d6524e..fb0cff0 100644
191 --- chart2/source/model/template/ChartTypeTemplate.cxx
192 +++ chart2/source/model/template/ChartTypeTemplate.cxx
193 @@ -62,6 +62,7 @@ using ::rtl::OUString;
194 using ::com::sun::star::uno::Sequence;
195 using ::com::sun::star::uno::Reference;
196 using ::com::sun::star::uno::Any;
197 +using ::com::sun::star::uno::UNO_QUERY;
199 // ======================================================================
201 @@ -943,6 +944,48 @@ void ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem(
202 comphelper::copyProperties( xSource, xDestination );
205 +void ChartTypeTemplate::setStackModePropertiesToChartType(const Reference<XChartType>& xChartType)
207 + Reference<beans::XPropertySet> xPropSet(xChartType, UNO_QUERY);
208 + if (!xPropSet.is())
209 + return;
211 + bool bStacked = false;
212 + bool bPercent = false;
213 + switch (getStackMode(0))
215 + case StackMode_Y_STACKED:
216 + bStacked = true;
217 + break;
218 + case StackMode_Y_STACKED_PERCENT:
219 + bStacked = true;
220 + bPercent = true;
221 + break;
222 + case StackMode_Z_STACKED:
223 + break;
224 + default:
228 + try
230 + xPropSet->setPropertyValue(
231 + C2U("Stacked"), uno::makeAny(static_cast<sal_Bool>(bStacked)));
233 + catch (const beans::UnknownPropertyException&)
237 + try
239 + xPropSet->setPropertyValue(
240 + C2U("Percent"), uno::makeAny(static_cast<sal_Bool>(bPercent)));
242 + catch (const beans::UnknownPropertyException&)
247 // ________
249 Sequence< OUString > ChartTypeTemplate::getSupportedServiceNames_Static()
250 diff --git chart2/source/model/template/ChartTypeTemplate.hxx chart2/source/model/template/ChartTypeTemplate.hxx
251 index d8b2b7b..0469478 100644
252 --- chart2/source/model/template/ChartTypeTemplate.hxx
253 +++ chart2/source/model/template/ChartTypeTemplate.hxx
254 @@ -272,6 +272,11 @@ protected:
255 const ::com::sun::star::uno::Reference<
256 ::com::sun::star::chart2::XChartType > & xNewChartType );
258 + void setStackModePropertiesToChartType(
259 + const ::com::sun::star::uno::Reference<
260 + ::com::sun::star::chart2::XChartType>& xChartType );
263 protected:
264 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
265 m_xContext;
266 diff --git chart2/source/model/template/ColumnChartType.cxx chart2/source/model/template/ColumnChartType.cxx
267 index ed5aea8..a326aa4 100644
268 --- chart2/source/model/template/ColumnChartType.cxx
269 +++ chart2/source/model/template/ColumnChartType.cxx
270 @@ -49,7 +49,9 @@ namespace
271 enum
273 PROP_BARCHARTTYPE_OVERLAP_SEQUENCE,
274 - PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE
275 + PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE,
276 + PROP_BARCHARTTYPE_STACKED,
277 + PROP_BARCHARTTYPE_PERCENT
280 void lcl_AddPropertiesToVector(
281 @@ -68,6 +70,19 @@ void lcl_AddPropertiesToVector(
282 ::getCppuType( reinterpret_cast< const Sequence< sal_Int32 > * >(0)),
283 beans::PropertyAttribute::BOUND
284 | beans::PropertyAttribute::MAYBEDEFAULT ));
286 + rOutProperties.push_back(
287 + Property( C2U( "Stacked" ),
288 + PROP_BARCHARTTYPE_STACKED,
289 + ::getBooleanCppuType(),
290 + beans::PropertyAttribute::BOUND
291 + | beans::PropertyAttribute::MAYBEDEFAULT ));
292 + rOutProperties.push_back(
293 + Property( C2U( "Percent" ),
294 + PROP_BARCHARTTYPE_PERCENT,
295 + ::getBooleanCppuType(),
296 + beans::PropertyAttribute::BOUND
297 + | beans::PropertyAttribute::MAYBEDEFAULT ));
300 void lcl_AddDefaultsToMap(
301 @@ -80,6 +95,9 @@ void lcl_AddDefaultsToMap(
303 aSeq[0] = aSeq[1] = 100;
304 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE, aSeq );
306 + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_STACKED, false );
307 + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_PERCENT, false );
310 const Sequence< Property > & lcl_GetPropertySequence()
311 diff --git chart2/source/model/template/ColumnLineChartTypeTemplate.cxx chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
312 index 54e7ea8..4d92176 100644
313 --- chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
314 +++ chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
315 @@ -410,6 +410,7 @@ Reference< XChartType > SAL_CALL ColumnLineChartTypeTemplate::getChartTypeForNew
316 ASSERT_EXCEPTION( ex );
319 + setStackModePropertiesToChartType(xResult);
320 return xResult;
323 diff --git chart2/source/model/template/LineChartType.cxx chart2/source/model/template/LineChartType.cxx
324 index 05f6b43..274abb0 100644
325 --- chart2/source/model/template/LineChartType.cxx
326 +++ chart2/source/model/template/LineChartType.cxx
327 @@ -54,7 +54,9 @@ enum
329 PROP_LINECHARTTYPE_CURVE_STYLE,
330 PROP_LINECHARTTYPE_CURVE_RESOLUTION,
331 - PROP_LINECHARTTYPE_SPLINE_ORDER
332 + PROP_LINECHARTTYPE_SPLINE_ORDER,
333 + PROP_LINECHARTTYPE_STACKED,
334 + PROP_LINECHARTTYPE_PERCENT
337 void lcl_AddPropertiesToVector(
338 @@ -79,6 +81,19 @@ void lcl_AddPropertiesToVector(
339 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
340 beans::PropertyAttribute::BOUND
341 | beans::PropertyAttribute::MAYBEDEFAULT ));
343 + rOutProperties.push_back(
344 + Property( C2U( "Stacked" ),
345 + PROP_LINECHARTTYPE_STACKED,
346 + ::getBooleanCppuType(),
347 + beans::PropertyAttribute::BOUND
348 + | beans::PropertyAttribute::MAYBEDEFAULT ));
349 + rOutProperties.push_back(
350 + Property( C2U( "Percent" ),
351 + PROP_LINECHARTTYPE_PERCENT,
352 + ::getBooleanCppuType(),
353 + beans::PropertyAttribute::BOUND
354 + | beans::PropertyAttribute::MAYBEDEFAULT ));
357 void lcl_AddDefaultsToMap(
358 @@ -90,6 +105,9 @@ void lcl_AddDefaultsToMap(
359 // todo: check whether order 3 means polygons of order 3 or 2. (see
360 // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
361 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_SPLINE_ORDER, 3 );
363 + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_STACKED, false );
364 + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_PERCENT, false );
367 const Sequence< Property > & lcl_GetPropertySequence()
368 diff --git chart2/source/model/template/LineChartTypeTemplate.cxx chart2/source/model/template/LineChartTypeTemplate.cxx
369 index 749a3b1..93cd9c8 100644
370 --- chart2/source/model/template/LineChartTypeTemplate.cxx
371 +++ chart2/source/model/template/LineChartTypeTemplate.cxx
372 @@ -336,6 +336,7 @@ Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForIndex( sal
373 ASSERT_EXCEPTION( ex );
376 + setStackModePropertiesToChartType(xResult);
377 return xResult;
380 diff --git chart2/source/model/template/NetChartTypeTemplate.cxx chart2/source/model/template/NetChartTypeTemplate.cxx
381 index f21857c..a9bc6bc 100644
382 --- chart2/source/model/template/NetChartTypeTemplate.cxx
383 +++ chart2/source/model/template/NetChartTypeTemplate.cxx
384 @@ -213,6 +213,7 @@ Reference< chart2::XChartType > SAL_CALL NetChartTypeTemplate::getChartTypeForNe
386 Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
387 ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
388 + setStackModePropertiesToChartType(xResult);
389 return xResult;
392 diff --git chart2/source/model/template/PieChartTypeTemplate.cxx chart2/source/model/template/PieChartTypeTemplate.cxx
393 index 8280389..233ae85 100644
394 --- chart2/source/model/template/PieChartTypeTemplate.cxx
395 +++ chart2/source/model/template/PieChartTypeTemplate.cxx
396 @@ -474,6 +474,7 @@ Reference< chart2::XChartType > SAL_CALL PieChartTypeTemplate::getChartTypeForNe
397 ASSERT_EXCEPTION( ex );
400 + setStackModePropertiesToChartType(xResult);
401 return xResult;
404 diff --git chart2/source/model/template/ScatterChartTypeTemplate.cxx chart2/source/model/template/ScatterChartTypeTemplate.cxx
405 index bc384a9..b9e18c9 100644
406 --- chart2/source/model/template/ScatterChartTypeTemplate.cxx
407 +++ chart2/source/model/template/ScatterChartTypeTemplate.cxx
408 @@ -374,6 +374,7 @@ Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForIndex(
409 ASSERT_EXCEPTION( ex );
412 + setStackModePropertiesToChartType(xResult);
413 return xResult;
416 diff --git chart2/source/model/template/StockChartTypeTemplate.cxx chart2/source/model/template/StockChartTypeTemplate.cxx
417 index 32c8eea..fc9538a 100644
418 --- chart2/source/model/template/StockChartTypeTemplate.cxx
419 +++ chart2/source/model/template/StockChartTypeTemplate.cxx
420 @@ -527,6 +527,7 @@ Reference< XChartType > SAL_CALL StockChartTypeTemplate::getChartTypeForNewSerie
421 ASSERT_EXCEPTION( ex );
424 + setStackModePropertiesToChartType(xResult);
425 return xResult;
428 diff --git chart2/source/view/axes/ScaleAutomatism.cxx chart2/source/view/axes/ScaleAutomatism.cxx
429 index 085d300..57922f1 100644
430 --- chart2/source/view/axes/ScaleAutomatism.cxx
431 +++ chart2/source/view/axes/ScaleAutomatism.cxx
432 @@ -131,7 +131,15 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
433 if( bAutoMinimum )
435 if( m_aSourceScale.AxisType==AxisType::PERCENT )
437 rExplicitScale.Minimum = 0.0;
438 + if (!::rtl::math::isNan(m_fValueMinimum))
440 + double fMin = m_fValueMinimum / 100.0;
441 + if (rExplicitScale.Minimum > fMin)
442 + rExplicitScale.Minimum = fMin;
445 else if( ::rtl::math::isNan( m_fValueMinimum ) )
446 rExplicitScale.Minimum = 0.0; //@todo get Minimum from scaling or from plotter????
447 else
448 @@ -142,7 +150,15 @@ void ScaleAutomatism::calculateExplicitScaleAndIncrement(
449 if( bAutoMaximum )
451 if( m_aSourceScale.AxisType==AxisType::PERCENT )
453 rExplicitScale.Maximum = 1.0;
454 + if (!::rtl::math::isNan(m_fValueMaximum))
456 + double fMax = m_fValueMaximum / 100.0;
457 + if (rExplicitScale.Maximum < fMax)
458 + rExplicitScale.Maximum = fMax;
461 else if( ::rtl::math::isNan( m_fValueMaximum ) )
462 rExplicitScale.Maximum = 10.0; //@todo get Maximum from scaling or from plotter????
463 else
464 diff --git chart2/source/view/charttypes/AreaChart.cxx chart2/source/view/charttypes/AreaChart.cxx
465 index f8bc0f0..159f665 100644
466 --- chart2/source/view/charttypes/AreaChart.cxx
467 +++ chart2/source/view/charttypes/AreaChart.cxx
468 @@ -603,6 +603,19 @@ struct FormerPoint
470 void AreaChart::createShapes()
472 + sal_Bool bPercent = sal_False;
473 + uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
474 + if (xPropSet.is())
476 + try
478 + xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
480 + catch (const beans::UnknownPropertyException&)
485 if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
486 return;
488 @@ -752,9 +765,30 @@ void AreaChart::createShapes()
489 if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
490 fLogicY = fabs( fLogicY );
492 - if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( aLogicYSumMap[nAttachedAxisIndex], 0.0 ) )
493 + if (bPercent)
494 + {
495 + // This data series is percent-stacked.
497 + if (::rtl::math::approxEqual(aLogicYSumMap[nAttachedAxisIndex], 0.0))
498 + fLogicY = 0.0;
499 + else
500 + fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex];
502 + if (!pPosHelper->isPercentY())
503 + {
504 + // When the axis itself is not percent-stacked,
505 + // their internal range value is 0 - 100. So we
506 + // need to adjust the data point values
507 + // accordingly.
508 + fLogicY *= 100.0;
511 + else if (pPosHelper->isPercentY())
513 - fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex];
514 + // The data series is not percent-stacked, but the
515 + // axis itself is. In this case, the axis' internal
516 + // range is 0 to 1. Adjust the data point values.
517 + fLogicY /= 100.0;
520 if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
521 diff --git chart2/source/view/charttypes/BarChart.cxx chart2/source/view/charttypes/BarChart.cxx
522 index f57ffa7..124d4af 100644
523 --- chart2/source/view/charttypes/BarChart.cxx
524 +++ chart2/source/view/charttypes/BarChart.cxx
525 @@ -466,6 +466,19 @@ void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis()
527 void BarChart::createShapes()
529 + uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
530 + sal_Bool bPercent = sal_False;
531 + if (xPropSet.is())
533 + try
535 + xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
537 + catch (const beans::UnknownPropertyException&)
542 if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
543 return;
545 diff --git chart2/source/view/charttypes/VSeriesPlotter.cxx chart2/source/view/charttypes/VSeriesPlotter.cxx
546 index 67cac8b..8a246ba 100644
547 --- chart2/source/view/charttypes/VSeriesPlotter.cxx
548 +++ chart2/source/view/charttypes/VSeriesPlotter.cxx
549 @@ -1149,6 +1149,23 @@ double VSeriesPlotter::getMaximumX()
551 double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
553 + sal_Bool bPercent = sal_False;
554 + uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
555 + if (xPropSet.is())
557 + try
559 + xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
561 + catch (const beans::UnknownPropertyException&)
566 + if (bPercent)
567 + // This plotter is percent-stacked.
568 + return 0.0;
570 if( !m_bCategoryXAxis )
572 double fMinY, fMaxY;
573 @@ -1183,6 +1200,23 @@ double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s
575 double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
577 + sal_Bool bPercent = sal_False;
578 + uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
579 + if (xPropSet.is())
581 + try
583 + xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
585 + catch (const beans::UnknownPropertyException&)
590 + if (bPercent)
591 + // This plotter is percent-stacked.
592 + return 100.0;
594 if( !m_bCategoryXAxis )
596 double fMinY, fMaxY;
597 diff --git chart2/source/view/main/ChartView.cxx chart2/source/view/main/ChartView.cxx
598 index 09d510f..b5af9db 100644
599 --- chart2/source/view/main/ChartView.cxx
600 +++ chart2/source/view/main/ChartView.cxx
601 @@ -1751,7 +1751,15 @@ sal_Int32 lcl_getExplicitNumberFormatKeyForAxis(
602 if( nDimensionIndex == 0 )
603 aRoleToMatch = C2U("values-x");
604 Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
605 - for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
606 + sal_Int32 nCTCount = aChartTypes.getLength();
607 + if (nCTCount > 0)
608 + // When multiple chart types share the same axis, always
609 + // use the first chart type for automatic detection of
610 + // desired number format. This is in line with the
611 + // fact that the axis type is also determined from the
612 + // first chart type alone.
613 + nCTCount = 1;
614 + for( sal_Int32 nCTIdx=0; nCTIdx<nCTCount; ++nCTIdx )
616 if( nDimensionIndex != 0 )
617 aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] );