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/beans/XPropertySet.hpp>
28 #include <com/sun/star/chart/DataLabelPlacement.hpp>
29 #include <com/sun/star/chart/MissingValueTreatment.hpp>
30 #include <com/sun/star/chart2/AxisType.hpp>
31 #include <com/sun/star/chart2/StackingDirection.hpp>
32 #include <com/sun/star/chart2/XDataSeries.hpp>
33 #include <comphelper/diagnose_ex.hxx>
35 using namespace ::com::sun::star
;
36 using namespace ::com::sun::star::chart2
;
37 using namespace ::chart::DataSeriesProperties
;
42 bool ChartTypeHelper::isSupportingAxisSideBySide(
43 const rtl::Reference
< ::chart::ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
47 if( xChartType
.is() &&
51 bool bAmbiguous
=false;
52 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, nullptr );
53 if( eStackMode
== StackMode::NONE
&& !bAmbiguous
)
55 OUString aChartTypeName
= xChartType
->getChartType();
56 bResult
= ( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) ||
57 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) );
64 bool ChartTypeHelper::isSupportingGeometryProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
66 //form tab only for 3D-bar and 3D-column charts.
68 //@todo ask charttype itself --> need model change first
71 if(nDimensionCount
==3)
73 OUString aChartTypeName
= xChartType
->getChartType();
74 if( aChartTypeName
== CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
76 if( aChartTypeName
== CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
83 bool ChartTypeHelper::isSupportingStatisticProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
85 //3D charts, pie, net and stock do not support statistic properties
87 //@todo ask charttype itself (and series? --> stock chart?) --> need model change first
90 if(nDimensionCount
==3)
93 OUString aChartTypeName
= xChartType
->getChartType();
94 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
96 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
98 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
100 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
102 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) ) //todo: BubbleChart support error bars and trend lines
108 bool ChartTypeHelper::isSupportingRegressionProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
110 // note: old chart: only scatter chart
111 return isSupportingStatisticProperties( xChartType
, nDimensionCount
);
114 bool ChartTypeHelper::isSupportingAreaProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
116 //2D line charts, net and stock do not support area properties
118 //@todo ask charttype itself --> need model change first
121 if(nDimensionCount
==2)
123 OUString aChartTypeName
= xChartType
->getChartType();
124 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) )
126 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
128 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
130 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
137 bool ChartTypeHelper::isSupportingSymbolProperties( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
139 //2D line charts, 2D scatter charts and 2D net charts do support symbols
141 //@todo ask charttype itself --> need model change first
144 if(nDimensionCount
==3)
147 OUString aChartTypeName
= xChartType
->getChartType();
148 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) )
150 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
152 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
158 bool ChartTypeHelper::isSupportingMainAxis( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
, sal_Int32 nDimensionIndex
)
160 //pie charts do not support axis at all
161 //no 3rd axis for 2D charts
163 //@todo ask charttype itself --> need model change first
166 OUString aChartTypeName
= xChartType
->getChartType();
167 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
170 if( nDimensionIndex
== 2 )
171 return nDimensionCount
== 3;
176 bool ChartTypeHelper::isSupportingSecondaryAxis( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
178 //3D, pie and net charts do not support a secondary axis at all
180 //@todo ask charttype itself --> need model change first
183 if(nDimensionCount
==3)
186 OUString aChartTypeName
= xChartType
->getChartType();
187 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
189 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
191 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
197 bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties(
198 const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
200 //2D bar charts do support a this special properties
202 //@todo ask charttype itself --> need model change first
205 if(nDimensionCount
==3)
208 OUString aChartTypeName
= xChartType
->getChartType();
209 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) )
211 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
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_AREA
) )
321 bool bStacked
= false;
323 chart2::StackingDirection eStacking
= chart2::StackingDirection_NO_STACKING
;
324 xSeries
->getFastPropertyValue(PROP_DATASERIES_STACKING_DIRECTION
) >>= eStacking
; // "StackingDirection"
325 bStacked
= (eStacking
== chart2::StackingDirection_Y_STACKING
);
329 sal_Int32
* pSeq
= aRet
.getArray();
332 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
333 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
337 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
338 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
341 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
344 sal_Int32
* pSeq
= aRet
.getArray();
345 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
346 *pSeq
++ = css::chart::DataLabelPlacement::TOP
;
347 *pSeq
++ = css::chart::DataLabelPlacement::BOTTOM
;
348 *pSeq
++ = css::chart::DataLabelPlacement::LEFT
;
349 *pSeq
++ = css::chart::DataLabelPlacement::RIGHT
;
350 *pSeq
++ = css::chart::DataLabelPlacement::CENTER
;
352 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
355 sal_Int32
* pSeq
= aRet
.getArray();
356 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
358 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
361 sal_Int32
* pSeq
= aRet
.getArray();
362 *pSeq
++ = css::chart::DataLabelPlacement::OUTSIDE
;
366 OSL_FAIL( "unknown charttype" );
372 bool ChartTypeHelper::isSupportingRightAngledAxes( const rtl::Reference
< ChartType
>& xChartType
)
376 OUString aChartTypeName
= xChartType
->getChartType();
377 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
383 bool ChartTypeHelper::isSupportingStartingAngle( const rtl::Reference
< ChartType
>& xChartType
)
387 OUString aChartTypeName
= xChartType
->getChartType();
388 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
393 bool ChartTypeHelper::isSupportingBaseValue( const rtl::Reference
< ChartType
>& xChartType
)
397 OUString aChartTypeName
= xChartType
->getChartType();
398 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
399 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
400 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
)
407 bool ChartTypeHelper::isSupportingAxisPositioning( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
, sal_Int32 nDimensionIndex
)
411 OUString aChartTypeName
= xChartType
->getChartType();
412 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
414 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
417 if( nDimensionCount
==3 )
418 return nDimensionIndex
<2;
422 bool ChartTypeHelper::isSupportingDateAxis( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionIndex
)
424 if( nDimensionIndex
!=0 )
426 if( xChartType
.is() )
428 sal_Int32 nType
= ChartTypeHelper::getAxisType( xChartType
, nDimensionIndex
);
429 if( nType
!= AxisType::CATEGORY
)
431 OUString aChartTypeName
= xChartType
->getChartType();
432 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
434 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
436 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
442 bool ChartTypeHelper::isSupportingComplexCategory( const rtl::Reference
< ChartType
>& xChartType
)
444 if( xChartType
.is() )
446 OUString aChartTypeName
= xChartType
->getChartType();
447 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
453 bool ChartTypeHelper::isSupportingCategoryPositioning( const rtl::Reference
< ChartType
>& xChartType
, sal_Int32 nDimensionCount
)
455 if( xChartType
.is() )
457 OUString aChartTypeName
= xChartType
->getChartType();
458 if (aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) ||
459 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
460 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
))
462 else if (nDimensionCount
== 2 &&
463 (aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
)))
469 bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const rtl::Reference
< ChartType
>& xChartType
)
473 OUString aChartTypeName
= xChartType
->getChartType();
474 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
475 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
476 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
482 bool ChartTypeHelper::noBordersForSimpleScheme( const rtl::Reference
< ChartType
>& xChartType
)
486 OUString aChartTypeName
= xChartType
->getChartType();
487 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
493 sal_Int32
ChartTypeHelper::getDefaultDirectLightColor( bool bSimple
, const rtl::Reference
< ChartType
>& xChartType
)
495 sal_Int32 nRet
= static_cast< sal_Int32
>( 0x808080 ); // grey
496 if( xChartType
.is() )
498 OUString aChartType
= xChartType
->getChartType();
499 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
502 nRet
= static_cast< sal_Int32
>( 0x333333 ); // grey80
504 nRet
= static_cast< sal_Int32
>( 0xb3b3b3 ); // grey30
506 else if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_LINE
507 || aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
508 nRet
= static_cast< sal_Int32
>( 0x666666 ); // grey60
513 sal_Int32
ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple
, const rtl::Reference
< ChartType
>& xChartType
)
515 sal_Int32 nRet
= static_cast< sal_Int32
>( 0x999999 ); // grey40
516 if( xChartType
.is() )
518 OUString aChartType
= xChartType
->getChartType();
519 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
522 nRet
= static_cast< sal_Int32
>( 0xcccccc ); // grey20
524 nRet
= static_cast< sal_Int32
>( 0x666666 ); // grey60
530 drawing::Direction3D
ChartTypeHelper::getDefaultSimpleLightDirection( const rtl::Reference
< ChartType
>& xChartType
)
532 drawing::Direction3D
aRet(0.0, 0.0, 1.0);
533 if( xChartType
.is() )
535 OUString aChartType
= xChartType
->getChartType();
536 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
537 aRet
= drawing::Direction3D(0.0, 0.8, 0.5);
538 else if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_LINE
539 || aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
540 aRet
= drawing::Direction3D(0.9, 0.5, 0.05);
545 drawing::Direction3D
ChartTypeHelper::getDefaultRealisticLightDirection( const rtl::Reference
< ChartType
>& xChartType
)
547 drawing::Direction3D
aRet(0.0, 0.0, 1.0);
548 if( xChartType
.is() )
550 OUString aChartType
= xChartType
->getChartType();
551 if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
552 aRet
= drawing::Direction3D(0.6, 0.6, 0.6);
553 else if( aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_LINE
554 || aChartType
== CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
555 aRet
= drawing::Direction3D(0.9, 0.5, 0.05);
560 sal_Int32
ChartTypeHelper::getAxisType( const rtl::Reference
<
561 ChartType
>& xChartType
, sal_Int32 nDimensionIndex
)
563 //returned is a constant from constant group css::chart2::AxisType
565 //@todo ask charttype itself --> need model change first
567 return AxisType::CATEGORY
;
569 OUString aChartTypeName
= xChartType
->getChartType();
570 if(nDimensionIndex
==2)//z-axis
571 return AxisType::SERIES
;
572 if(nDimensionIndex
==1)//y-axis
573 return AxisType::REALNUMBER
;
574 if(nDimensionIndex
==0)//x-axis
576 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
577 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
578 return AxisType::REALNUMBER
;
579 return AxisType::CATEGORY
;
581 return AxisType::CATEGORY
;
584 sal_Int32
ChartTypeHelper::getNumberOfDisplayedSeries(
585 const rtl::Reference
< ChartType
>& xChartType
,
586 sal_Int32 nNumberOfSeries
)
588 if( xChartType
.is() )
592 OUString aChartTypeName
= xChartType
->getChartType();
593 if( aChartTypeName
== CHART2_SERVICE_NAME_CHARTTYPE_PIE
)
596 if( (xChartType
->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS
) >>= bDonut
) // "UseRings"
599 return nNumberOfSeries
>0 ? 1 : 0;
603 catch( const uno::Exception
& )
605 DBG_UNHANDLED_EXCEPTION("chart2");
608 return nNumberOfSeries
;
611 uno::Sequence
< sal_Int32
> ChartTypeHelper::getSupportedMissingValueTreatments( const rtl::Reference
< ChartType
>& xChartType
)
613 uno::Sequence
< sal_Int32
> aRet
;
614 if( !xChartType
.is() )
618 bool bAmbiguous
=false;
619 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, nullptr );
620 bool bStacked
= bFound
&& (eStackMode
== StackMode::YStacked
);
622 OUString aChartTypeName
= xChartType
->getChartType();
623 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) ||
624 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) ||
625 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
628 sal_Int32
* pSeq
= aRet
.getArray();
629 *pSeq
++ = css::chart::MissingValueTreatment::LEAVE_GAP
;
630 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
632 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
634 aRet
.realloc( bStacked
? 1 : 2 );
635 sal_Int32
* pSeq
= aRet
.getArray();
636 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
638 *pSeq
++ = css::chart::MissingValueTreatment::CONTINUE
;
640 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
641 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) ||
642 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
644 aRet
.realloc( bStacked
? 2 : 3 );
645 sal_Int32
* pSeq
= aRet
.getArray();
646 *pSeq
++ = css::chart::MissingValueTreatment::LEAVE_GAP
;
647 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
649 *pSeq
++ = css::chart::MissingValueTreatment::CONTINUE
;
651 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
654 sal_Int32
* pSeq
= aRet
.getArray();
655 *pSeq
++ = css::chart::MissingValueTreatment::CONTINUE
;
656 *pSeq
++ = css::chart::MissingValueTreatment::LEAVE_GAP
;
657 *pSeq
++ = css::chart::MissingValueTreatment::USE_ZERO
;
659 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) ||
660 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
666 OSL_FAIL( "unknown charttype" );
672 bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const rtl::Reference
< ChartType
>& xChartType
)
674 if( xChartType
.is() )
676 OUString aChartTypeName
= xChartType
->getChartType();
677 if( aChartTypeName
.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
683 OUString
ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference
< ChartType
>& xChartType
)
685 OUString
aRet( "values-y" );
686 if( !xChartType
.is() )
688 OUString aChartTypeName
= xChartType
->getChartType();
689 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
690 aRet
= xChartType
->getRoleOfSequenceForSeriesLabel();
694 OUString
ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference
< ChartType
>& xChartType
)
696 OUString
aRet( "values-y" );
697 if( !xChartType
.is() )
699 OUString aChartTypeName
= xChartType
->getChartType();
700 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
)
701 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
702 aRet
= xChartType
->getRoleOfSequenceForSeriesLabel();
706 bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const rtl::Reference
< ChartType
>& xChartType
)
709 if( !xChartType
.is() )
712 OUString aChartTypeName
= xChartType
->getChartType();
713 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
714 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) ||
715 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
724 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */