1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <ChartTypeHelper.hxx>
21 #include <ChartType.hxx>
22 #include <BaseCoordinateSystem.hxx>
23 #include <DataSeriesProperties.hxx>
24 #include <DiagramHelper.hxx>
25 #include <servicenames_charttypes.hxx>
27 #include <com/sun/star/chart/DataLabelPlacement.hpp>
28 #include <com/sun/star/chart/MissingValueTreatment.hpp>
29 #include <com/sun/star/chart2/AxisType.hpp>
30 #include <com/sun/star/chart2/StackingDirection.hpp>
31 #include <comphelper/diagnose_ex.hxx>
33 using namespace ::com::sun::star
;
34 using namespace ::com::sun::star::chart2
;
35 using namespace ::chart::DataSeriesProperties
;
40 bool ChartTypeHelper::isSupportingAxisSideBySide(
41 const rtl::Reference
< ::chart::ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
45 if( xChartType
.is() &&
49 bool bAmbiguous
=false;
50 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, nullptr );
51 if( eStackMode
== StackMode::NONE
&& !bAmbiguous
)
53 OUString aChartTypeName
= xChartType
->getChartType();
54 bResult
= ( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) ||
55 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) );
62 bool ChartTypeHelper::isSupportingGeometryProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
64 //form tab only for 3D-bar and 3D-column charts.
66 //@todo ask charttype itself --> need model change first
69 if(nDimensionCount
==3)
71 OUString aChartTypeName
= xChartType
->getChartType();
72 if( aChartTypeName
== CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
74 if( aChartTypeName
== CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
81 bool ChartTypeHelper::isSupportingStatisticProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
83 //3D charts, pie, net and stock do not support statistic properties
85 //@todo ask charttype itself (and series? --> stock chart?) --> need model change first
88 if(nDimensionCount
==3)
91 OUString aChartTypeName
= xChartType
->getChartType();
92 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
94 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
96 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
98 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
100 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) ) //todo: BubbleChart support error bars and trend lines
106 bool ChartTypeHelper::isSupportingRegressionProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
108 // note: old chart: only scatter chart
109 return isSupportingStatisticProperties( xChartType
, nDimensionCount
);
112 bool ChartTypeHelper::isSupportingAreaProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
114 //2D line charts, net and stock do not support area properties
116 //@todo ask charttype itself --> need model change first
119 if(nDimensionCount
==2)
121 OUString aChartTypeName
= xChartType
->getChartType();
122 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) )
124 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
126 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
128 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
135 bool ChartTypeHelper::isSupportingSymbolProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
137 //2D line charts, 2D scatter charts and 2D net charts do support symbols
139 //@todo ask charttype itself --> need model change first
142 if(nDimensionCount
==3)
145 OUString aChartTypeName
= xChartType
->getChartType();
146 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) )
148 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
150 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
156 bool ChartTypeHelper::isSupportingMainAxis( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
, sal_Int32 nDimensionIndex
)
158 //pie charts do not support axis at all
159 //no 3rd axis for 2D charts
161 //@todo ask charttype itself --> need model change first
164 OUString aChartTypeName
= xChartType
->getChartType();
165 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
168 if( nDimensionIndex
== 2 )
169 return nDimensionCount
== 3;
174 bool ChartTypeHelper::isSupportingSecondaryAxis( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
176 //3D, pie and net charts do not support a secondary axis at all
178 //@todo ask charttype itself --> need model change first
181 if(nDimensionCount
==3)
184 OUString aChartTypeName
= xChartType
->getChartType();
185 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
187 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
189 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
195 bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties(
196 const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
198 //2D bar charts do support a this special properties
200 //@todo ask charttype itself --> need model change first
203 if(nDimensionCount
==3)
206 OUString aChartTypeName
= xChartType
->getChartType();
207 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) )
209 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
211 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM
) )
217 bool ChartTypeHelper::isSupportingBarConnectors(
218 const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
220 //2D bar charts with stacked series support this
222 //@todo ask charttype itself --> need model change first
225 if(nDimensionCount
==3)
229 bool bAmbiguous
=false;
230 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, nullptr );
231 if( eStackMode
!= StackMode::YStacked
|| bAmbiguous
)
234 OUString aChartTypeName
= xChartType
->getChartType();
235 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) )
237 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
238 return true; // note: old chart was false here
243 uno::Sequence
< sal_Int32
> ChartTypeHelper::getSupportedLabelPlacements( const rtl::Reference
< ChartType
>& xChartType
245 , const rtl::Reference
< DataSeries
>& xSeries
)
247 uno::Sequence
< sal_Int32
> aRet
;
248 if( !xChartType
.is() )
251 OUString aChartTypeName
= xChartType
->getChartType();
252 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
255 xChartType
->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS
) >>= bDonut
; // "UseRings"
260 sal_Int32
* pSeq
= aRet
.getArray();
261 *pSeq
++ = css::chart::DataLabelPlacement::AVOID_OVERLAP
;
262 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
263 *pSeq
++ = css::chart::DataLabelPlacement::INSIDE
;
264 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
265 *pSeq
++ = css::chart::DataLabelPlacement::CUSTOM
;
270 sal_Int32
* pSeq
= aRet
.getArray();
271 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
274 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
275 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
)
276 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
)
280 sal_Int32
* pSeq
= aRet
.getArray();
281 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
282 *pSeq
++ = css::chart::DataLabelPlacement::BOTTOM
;
283 *pSeq
++ = css::chart::DataLabelPlacement::LEFT
;
284 *pSeq
++ = css::chart::DataLabelPlacement::RIGHT
;
285 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
287 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
288 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
291 bool bStacked
= false;
293 chart2::StackingDirection eStacking
= chart2::StackingDirection_NO_STACKING
;
294 xSeries
->getFastPropertyValue( PROP_DATASERIES_STACKING_DIRECTION
) >>= eStacking
; // "StackingDirection"
295 bStacked
= (eStacking
== chart2::StackingDirection_Y_STACKING
);
298 aRet
.realloc( bStacked
? 3 : 6 );
299 sal_Int32
* pSeq
= aRet
.getArray();
304 *pSeq
++ = css::chart::DataLabelPlacement::RIGHT
;
305 *pSeq
++ = css::chart::DataLabelPlacement::LEFT
;
309 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
310 *pSeq
++ = css::chart::DataLabelPlacement::BOTTOM
;
313 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
315 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
316 *pSeq
++ = css::chart::DataLabelPlacement::INSIDE
;
317 *pSeq
++ = css::chart::DataLabelPlacement::NEAR_ORIGIN
;
319 else if (aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM
))
322 sal_Int32
* pSeq
= aRet
.getArray();
324 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
325 *pSeq
++ = css::chart::DataLabelPlacement::BOTTOM
;
326 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
327 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
328 *pSeq
++ = css::chart::DataLabelPlacement::INSIDE
;
329 *pSeq
++ = css::chart::DataLabelPlacement::NEAR_ORIGIN
;
331 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
333 bool bStacked
= false;
335 chart2::StackingDirection eStacking
= chart2::StackingDirection_NO_STACKING
;
336 xSeries
->getFastPropertyValue(PROP_DATASERIES_STACKING_DIRECTION
) >>= eStacking
; // "StackingDirection"
337 bStacked
= (eStacking
== chart2::StackingDirection_Y_STACKING
);
341 sal_Int32
* pSeq
= aRet
.getArray();
344 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
345 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
349 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
350 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
353 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
356 sal_Int32
* pSeq
= aRet
.getArray();
357 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
358 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
359 *pSeq
++ = css::chart::DataLabelPlacement::BOTTOM
;
360 *pSeq
++ = css::chart::DataLabelPlacement::LEFT
;
361 *pSeq
++ = css::chart::DataLabelPlacement::RIGHT
;
362 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
364 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
367 sal_Int32
* pSeq
= aRet
.getArray();
368 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
370 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
373 sal_Int32
* pSeq
= aRet
.getArray();
374 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
378 OSL_FAIL( "unknown charttype" );
384 bool ChartTypeHelper::isSupportingRightAngledAxes( const rtl::Reference
< ChartType
>& xChartType
)
388 OUString aChartTypeName
= xChartType
->getChartType();
389 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
395 bool ChartTypeHelper::isSupportingStartingAngle( const rtl::Reference
< ChartType
>& xChartType
)
399 OUString aChartTypeName
= xChartType
->getChartType();
400 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
405 bool ChartTypeHelper::isSupportingBaseValue( const rtl::Reference
< ChartType
>& xChartType
)
409 OUString aChartTypeName
= xChartType
->getChartType();
410 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
411 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
412 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
)
419 bool ChartTypeHelper::isSupportingAxisPositioning( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
, sal_Int32 nDimensionIndex
)
423 OUString aChartTypeName
= xChartType
->getChartType();
424 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
426 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
429 if( nDimensionCount
==3 )
430 return nDimensionIndex
<2;
434 bool ChartTypeHelper::isSupportingDateAxis( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionIndex
)
436 if( nDimensionIndex
!=0 )
438 if( xChartType
.is() )
440 sal_Int32 nType
= ChartTypeHelper::getAxisType( xChartType
, nDimensionIndex
);
441 if( nType
!= AxisType::CATEGORY
)
443 OUString aChartTypeName
= xChartType
->getChartType();
444 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
446 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
448 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
454 bool ChartTypeHelper::isSupportingComplexCategory( const rtl::Reference
< ChartType
>& xChartType
)
456 if( xChartType
.is() )
458 OUString aChartTypeName
= xChartType
->getChartType();
459 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
465 bool ChartTypeHelper::isSupportingCategoryPositioning( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
467 if( xChartType
.is() )
469 OUString aChartTypeName
= xChartType
->getChartType();
470 if (aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) ||
471 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
472 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
))
474 else if (nDimensionCount
== 2 &&
475 (aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) ||
476 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) ||
477 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM
)))
483 bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const rtl::Reference
< ChartType
>& xChartType
)
487 OUString aChartTypeName
= xChartType
->getChartType();
488 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
489 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
490 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
496 bool ChartTypeHelper::noBordersForSimpleScheme( const rtl::Reference
< ChartType
>& xChartType
)
500 OUString aChartTypeName
= xChartType
->getChartType();
501 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
507 sal_Int32
ChartTypeHelper::getDefaultDirectLightColor( bool bSimple
, const rtl::Reference
< ChartType
>& xChartType
)
509 sal_Int32 nRet
= static_cast< sal_Int32
>( 0x808080 ); // grey
510 if( xChartType
.is() )
512 OUString aChartType
= xChartType
->getChartType();
513 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
516 nRet
= static_cast< sal_Int32
>( 0x333333 ); // grey80
518 nRet
= static_cast< sal_Int32
>( 0xb3b3b3 ); // grey30
520 else if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_LINE
521 || aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
522 nRet
= static_cast< sal_Int32
>( 0x666666 ); // grey60
527 sal_Int32
ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple
, const rtl::Reference
< ChartType
>& xChartType
)
529 sal_Int32 nRet
= static_cast< sal_Int32
>( 0x999999 ); // grey40
530 if( xChartType
.is() )
532 OUString aChartType
= xChartType
->getChartType();
533 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
536 nRet
= static_cast< sal_Int32
>( 0xcccccc ); // grey20
538 nRet
= static_cast< sal_Int32
>( 0x666666 ); // grey60
544 drawing::Direction3D
ChartTypeHelper::getDefaultSimpleLightDirection( const rtl::Reference
< ChartType
>& xChartType
)
546 drawing::Direction3D
aRet(0.0, 0.0, 1.0);
547 if( xChartType
.is() )
549 OUString aChartType
= xChartType
->getChartType();
550 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
551 aRet
= drawing::Direction3D(0.0, 0.8, 0.5);
552 else if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_LINE
553 || aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
554 aRet
= drawing::Direction3D(0.9, 0.5, 0.05);
559 drawing::Direction3D
ChartTypeHelper::getDefaultRealisticLightDirection( const rtl::Reference
< ChartType
>& xChartType
)
561 drawing::Direction3D
aRet(0.0, 0.0, 1.0);
562 if( xChartType
.is() )
564 OUString aChartType
= xChartType
->getChartType();
565 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
566 aRet
= drawing::Direction3D(0.6, 0.6, 0.6);
567 else if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_LINE
568 || aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
569 aRet
= drawing::Direction3D(0.9, 0.5, 0.05);
574 sal_Int32
ChartTypeHelper::getAxisType( const rtl::Reference
<
575 ChartType
>& xChartType
, sal_Int32 nDimensionIndex
)
577 //returned is a constant from constant group css::chart2::AxisType
579 //@todo ask charttype itself --> need model change first
581 return AxisType::CATEGORY
;
583 OUString aChartTypeName
= xChartType
->getChartType();
584 if(nDimensionIndex
==2)//z-axis
585 return AxisType::SERIES
;
586 if(nDimensionIndex
==1)//y-axis
587 return AxisType::REALNUMBER
;
588 if(nDimensionIndex
==0)//x-axis
590 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
591 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
592 return AxisType::REALNUMBER
;
593 return AxisType::CATEGORY
;
595 return AxisType::CATEGORY
;
598 sal_Int32
ChartTypeHelper::getNumberOfDisplayedSeries(
599 const rtl::Reference
< ChartType
>& xChartType
,
600 sal_Int32 nNumberOfSeries
)
602 if( xChartType
.is() )
606 OUString aChartTypeName
= xChartType
->getChartType();
607 if( aChartTypeName
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
610 if( (xChartType
->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS
) >>= bDonut
) // "UseRings"
613 return nNumberOfSeries
>0 ? 1 : 0;
617 catch( const uno::Exception
& )
619 DBG_UNHANDLED_EXCEPTION("chart2");
622 return nNumberOfSeries
;
625 uno::Sequence
< sal_Int32
> ChartTypeHelper::getSupportedMissingValueTreatments( const rtl::Reference
< ChartType
>& xChartType
)
627 uno::Sequence
< sal_Int32
> aRet
;
628 if( !xChartType
.is() )
632 bool bAmbiguous
=false;
633 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, nullptr );
634 bool bStacked
= bFound
&& (eStackMode
== StackMode::YStacked
);
636 OUString aChartTypeName
= xChartType
->getChartType();
637 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) ||
638 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) ||
639 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
642 sal_Int32
* pSeq
= aRet
.getArray();
643 *pSeq
++ = css::chart::MissingValueTreatment::LEAVE_GAP
;
644 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
646 else if (aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM
))
648 // Assuming histograms typically use zero for missing values
650 sal_Int32
* pSeq
= aRet
.getArray();
651 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
653 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
655 aRet
.realloc( bStacked
? 1 : 2 );
656 sal_Int32
* pSeq
= aRet
.getArray();
657 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
659 *pSeq
++ = css::chart::MissingValueTreatment::CONTINUE
;
661 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
662 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) ||
663 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
665 aRet
.realloc( bStacked
? 2 : 3 );
666 sal_Int32
* pSeq
= aRet
.getArray();
667 *pSeq
++ = css::chart::MissingValueTreatment::LEAVE_GAP
;
668 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
670 *pSeq
++ = css::chart::MissingValueTreatment::CONTINUE
;
672 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
675 sal_Int32
* pSeq
= aRet
.getArray();
676 *pSeq
++ = css::chart::MissingValueTreatment::CONTINUE
;
677 *pSeq
++ = css::chart::MissingValueTreatment::LEAVE_GAP
;
678 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
680 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) ||
681 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
687 OSL_FAIL( "unknown charttype" );
693 bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const rtl::Reference
< ChartType
>& xChartType
)
695 if( xChartType
.is() )
697 OUString aChartTypeName
= xChartType
->getChartType();
698 if( aChartTypeName
.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
704 OUString
ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference
< ChartType
>& xChartType
)
706 OUString
aRet( u
"values-y"_ustr
);
707 if( !xChartType
.is() )
709 OUString aChartTypeName
= xChartType
->getChartType();
710 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
711 aRet
= xChartType
->getRoleOfSequenceForSeriesLabel();
715 OUString
ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference
< ChartType
>& xChartType
)
717 OUString
aRet( u
"values-y"_ustr
);
718 if( !xChartType
.is() )
720 OUString aChartTypeName
= xChartType
->getChartType();
721 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
)
722 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
723 aRet
= xChartType
->getRoleOfSequenceForSeriesLabel();
727 bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const rtl::Reference
< ChartType
>& xChartType
)
730 if( !xChartType
.is() )
733 OUString aChartTypeName
= xChartType
->getChartType();
734 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
735 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) ||
736 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
745 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */