1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "ChartTypeHelper.hxx"
31 #include "DiagramHelper.hxx"
32 #include "DataSeriesHelper.hxx"
34 #include "servicenames_charttypes.hxx"
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/chart/DataLabelPlacement.hpp>
38 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
39 #include <com/sun/star/chart/MissingValueTreatment.hpp>
41 //.............................................................................
42 using namespace ::com::sun::star
;
43 using namespace ::com::sun::star::chart2
;
45 //.............................................................................
49 bool ChartTypeHelper::isSupportingAxisSideBySide(
50 const uno::Reference
< chart2::XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
54 if( xChartType
.is() &&
58 bool bAmbiguous
=false;
59 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, 0 );
60 if( eStackMode
== StackMode_NONE
&& !bAmbiguous
)
62 rtl::OUString aChartTypeName
= xChartType
->getChartType();
63 bResult
= ( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) ||
64 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) );
71 sal_Bool
ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
73 //form tab only for 3D-bar and 3D-column charts.
75 //@todo ask charttype itself --> need model change first
78 if(nDimensionCount
==3)
80 rtl::OUString aChartTypeName
= xChartType
->getChartType();
81 if( aChartTypeName
.equals(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
83 if( aChartTypeName
.equals(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) )
90 sal_Bool
ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
92 //3D charts, pie, net and stock do not support statistic properties
94 //@todo ask charttype itself (and series? --> stock chart?) --> need model change first
97 if(nDimensionCount
==3)
100 rtl::OUString aChartTypeName
= xChartType
->getChartType();
101 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
103 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
105 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
107 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
109 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) ) //todo: BubbleChart support error bars and trend lines
115 sal_Bool
ChartTypeHelper::isSupportingRegressionProperties( const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
117 // note: old chart: only scatter chart
118 return isSupportingStatisticProperties( xChartType
, nDimensionCount
);
121 sal_Bool
ChartTypeHelper::isSupportingAreaProperties( const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
123 //2D line charts, net and stock do not support area properties
125 //@todo ask charttype itself --> need model change first
128 if(nDimensionCount
==2)
130 rtl::OUString aChartTypeName
= xChartType
->getChartType();
131 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) )
133 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
135 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
137 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
144 sal_Bool
ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
146 //2D line charts, 2D scatter charts and 2D net charts do support symbols
148 //@todo ask charttype itself --> need model change first
151 if(nDimensionCount
==3)
154 rtl::OUString aChartTypeName
= xChartType
->getChartType();
155 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) )
157 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
159 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
165 sal_Bool
ChartTypeHelper::isSupportingMainAxis( const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
, sal_Int32 nDimensionIndex
)
167 //pie charts do not support axis at all
168 //no 3rd axis for 2D charts
170 //@todo ask charttype itself --> need model change first
173 rtl::OUString aChartTypeName
= xChartType
->getChartType();
174 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
177 if( nDimensionIndex
== 2 )
178 return nDimensionCount
== 3;
183 sal_Bool
ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
, sal_Int32
/*nDimensionIndex*/ )
185 //3D, pie and net charts do not support a secondary axis at all
187 //@todo ask charttype itself --> need model change first
190 if(nDimensionCount
==3)
193 rtl::OUString aChartTypeName
= xChartType
->getChartType();
194 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
196 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
198 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
204 sal_Bool
ChartTypeHelper::isSupportingOverlapAndGapWidthProperties(
205 const uno::Reference
< XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
207 //2D bar charts do support a this special properties
209 //@todo ask charttype itself --> need model change first
212 if(nDimensionCount
==3)
215 rtl::OUString aChartTypeName
= xChartType
->getChartType();
216 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) )
218 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
224 sal_Bool
ChartTypeHelper::isSupportingBarConnectors(
225 const uno::Reference
< chart2::XChartType
>& xChartType
, sal_Int32 nDimensionCount
)
227 //2D bar charts with stacked series support this
229 //@todo ask charttype itself --> need model change first
232 if(nDimensionCount
==3)
236 bool bAmbiguous
=false;
237 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, 0 );
238 if( eStackMode
!= StackMode_Y_STACKED
|| bAmbiguous
)
241 rtl::OUString aChartTypeName
= xChartType
->getChartType();
242 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) )
244 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
245 return sal_True
; // note: old chart was false here
250 uno::Sequence
< sal_Int32
> ChartTypeHelper::getSupportedLabelPlacements( const uno::Reference
< chart2::XChartType
>& xChartType
251 , sal_Int32 nDimensionCount
, sal_Bool bSwapXAndY
252 , const uno::Reference
< chart2::XDataSeries
>& xSeries
)
254 (void)nDimensionCount
;
256 uno::Sequence
< sal_Int32
> aRet
;
257 if( !xChartType
.is() )
260 rtl::OUString aChartTypeName
= xChartType
->getChartType();
261 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
264 uno::Reference
< beans::XPropertySet
> xChartTypeProp( xChartType
, uno::UNO_QUERY_THROW
);
265 if(xChartTypeProp
.is())
266 xChartTypeProp
->getPropertyValue( C2U("UseRings")) >>= bDonut
;
271 sal_Int32
* pSeq
= aRet
.getArray();
272 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::AVOID_OVERLAP
;
273 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE
;
274 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::INSIDE
;
275 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::CENTER
;
280 sal_Int32
* pSeq
= aRet
.getArray();
281 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::CENTER
;
284 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
285 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
)
286 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
)
290 sal_Int32
* pSeq
= aRet
.getArray();
291 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::TOP
;
292 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM
;
293 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::LEFT
;
294 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT
;
295 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::CENTER
;
297 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
298 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) )
301 bool bStacked
= false;
303 uno::Reference
< beans::XPropertySet
> xSeriesProp( xSeries
, uno::UNO_QUERY
);
304 chart2::StackingDirection eStacking
= chart2::StackingDirection_NO_STACKING
;
305 xSeriesProp
->getPropertyValue( C2U("StackingDirection") ) >>= eStacking
;
306 bStacked
= (chart2::StackingDirection_Y_STACKING
== eStacking
);
309 aRet
.realloc( bStacked
? 3 : 6 );
310 sal_Int32
* pSeq
= aRet
.getArray();
315 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT
;
316 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::LEFT
;
320 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::TOP
;
321 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM
;
324 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::CENTER
;
326 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE
;
327 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::INSIDE
;
328 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::NEAR_ORIGIN
;
330 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
333 sal_Int32
* pSeq
= aRet
.getArray();
334 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::TOP
;
336 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
339 sal_Int32
* pSeq
= aRet
.getArray();
340 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE
;
341 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::TOP
;
342 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM
;
343 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::LEFT
;
344 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT
;
345 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::CENTER
;
347 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
350 sal_Int32
* pSeq
= aRet
.getArray();
351 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE
;
353 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
356 sal_Int32
* pSeq
= aRet
.getArray();
357 *pSeq
++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE
;
361 OSL_FAIL( "unknown charttype" );
367 sal_Bool
ChartTypeHelper::isSupportingRightAngledAxes( const uno::Reference
< chart2::XChartType
>& xChartType
)
371 rtl::OUString aChartTypeName
= xChartType
->getChartType();
372 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
378 bool ChartTypeHelper::isSupportingStartingAngle( const uno::Reference
< chart2::XChartType
>& xChartType
)
382 rtl::OUString aChartTypeName
= xChartType
->getChartType();
383 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
388 bool ChartTypeHelper::isSupportingBaseValue( const uno::Reference
< chart2::XChartType
>& xChartType
)
392 rtl::OUString aChartTypeName
= xChartType
->getChartType();
393 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
394 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
395 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
)
402 bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference
< chart2::XChartType
>& xChartType
, sal_Int32 nDimensionCount
, sal_Int32 nDimensionIndex
)
406 rtl::OUString aChartTypeName
= xChartType
->getChartType();
407 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
409 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
412 if( nDimensionCount
==3 )
413 return nDimensionIndex
<2;
417 bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference
< chart2::XChartType
>& xChartType
, sal_Int32
/*nDimensionCount*/, sal_Int32 nDimensionIndex
)
419 if( nDimensionIndex
!=0 )
421 if( xChartType
.is() )
423 sal_Int32 nType
= ChartTypeHelper::getAxisType( xChartType
, nDimensionIndex
);
424 if( nType
!= AxisType::CATEGORY
)
426 rtl::OUString aChartTypeName
= xChartType
->getChartType();
427 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
429 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) )
431 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
437 bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference
< chart2::XChartType
>& xChartType
)
441 rtl::OUString aChartTypeName
= xChartType
->getChartType();
442 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
)
443 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
)
444 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
450 bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference
< chart2::XChartType
>& xChartType
)
454 rtl::OUString aChartTypeName
= xChartType
->getChartType();
455 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
461 sal_Int32
ChartTypeHelper::getDefaultDirectLightColor( bool bSimple
, const uno::Reference
< chart2::XChartType
>& xChartType
)
463 sal_Int32 nRet
= static_cast< sal_Int32
>( 0x808080 ); // grey
464 if( xChartType
.is() )
466 rtl::OUString aChartType
= xChartType
->getChartType();
467 if( aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
470 nRet
= static_cast< sal_Int32
>( 0x333333 ); // grey80
472 nRet
= static_cast< sal_Int32
>( 0xb3b3b3 ); // grey30
474 else if( aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE
)
475 || aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
476 nRet
= static_cast< sal_Int32
>( 0x666666 ); // grey60
481 sal_Int32
ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple
, const uno::Reference
< chart2::XChartType
>& xChartType
)
483 sal_Int32 nRet
= static_cast< sal_Int32
>( 0x999999 ); // grey40
484 if( xChartType
.is() )
486 rtl::OUString aChartType
= xChartType
->getChartType();
487 if( aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
490 nRet
= static_cast< sal_Int32
>( 0xcccccc ); // grey20
492 nRet
= static_cast< sal_Int32
>( 0x666666 ); // grey60
498 drawing::Direction3D
ChartTypeHelper::getDefaultSimpleLightDirection( const uno::Reference
< chart2::XChartType
>& xChartType
)
500 drawing::Direction3D
aRet(0.0, 0.0, 1.0);
501 if( xChartType
.is() )
503 rtl::OUString aChartType
= xChartType
->getChartType();
504 if( aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
505 aRet
= drawing::Direction3D(0.0, 0.8, 0.5);
506 else if( aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE
)
507 || aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
508 aRet
= drawing::Direction3D(0.9, 0.5, 0.05);
513 drawing::Direction3D
ChartTypeHelper::getDefaultRealisticLightDirection( const uno::Reference
< chart2::XChartType
>& xChartType
)
515 drawing::Direction3D
aRet(0.0, 0.0, 1.0);
516 if( xChartType
.is() )
518 rtl::OUString aChartType
= xChartType
->getChartType();
519 if( aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) )
520 aRet
= drawing::Direction3D(0.6, 0.6, 0.6);
521 else if( aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE
)
522 || aChartType
.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
523 aRet
= drawing::Direction3D(0.9, 0.5, 0.05);
528 sal_Int32
ChartTypeHelper::getAxisType( const uno::Reference
<
529 XChartType
>& xChartType
, sal_Int32 nDimensionIndex
)
531 //retruned is a constant from constant group ::com::sun::star::chart2::AxisType
533 //@todo ask charttype itself --> need model change first
535 return AxisType::CATEGORY
;
537 rtl::OUString aChartTypeName
= xChartType
->getChartType();
538 if(2==nDimensionIndex
)//z-axis
539 return AxisType::SERIES
;
540 if(1==nDimensionIndex
)//y-axis
541 return AxisType::REALNUMBER
;
542 if(0==nDimensionIndex
)//x-axis
544 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
)
545 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
546 return AxisType::REALNUMBER
;
547 return AxisType::CATEGORY
;
549 return AxisType::CATEGORY
;
552 sal_Int32
ChartTypeHelper::getNumberOfDisplayedSeries(
553 const uno::Reference
< XChartType
>& xChartType
,
554 sal_Int32 nNumberOfSeries
)
556 if( xChartType
.is() )
560 rtl::OUString aChartTypeName
= xChartType
->getChartType();
561 if( aChartTypeName
.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE
))
563 uno::Reference
< beans::XPropertySet
> xChartTypeProp( xChartType
, uno::UNO_QUERY_THROW
);
565 if( (xChartTypeProp
->getPropertyValue( C2U("UseRings")) >>= bDonut
)
568 return nNumberOfSeries
>0 ? 1 : 0;
572 catch( const uno::Exception
& ex
)
574 ASSERT_EXCEPTION( ex
);
577 return nNumberOfSeries
;
580 uno::Sequence
< sal_Int32
> ChartTypeHelper::getSupportedMissingValueTreatments( const uno::Reference
< XChartType
>& xChartType
)
582 uno::Sequence
< sal_Int32
> aRet
;
583 if( !xChartType
.is() )
586 bool bStacked
= false;
588 bool bAmbiguous
=false;
589 StackMode eStackMode
= DiagramHelper::getStackModeFromChartType( xChartType
, bFound
, bAmbiguous
, 0 );
590 bStacked
= bFound
&& (StackMode_Y_STACKED
== eStackMode
);
592 rtl::OUString aChartTypeName
= xChartType
->getChartType();
593 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
) ||
594 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR
) ||
595 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
598 sal_Int32
* pSeq
= aRet
.getArray();
599 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP
;
600 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
;
602 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
604 aRet
.realloc( bStacked
? 1 : 2 );
605 sal_Int32
* pSeq
= aRet
.getArray();
606 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
;
608 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE
;
610 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
611 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_NET
) ||
612 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
614 aRet
.realloc( bStacked
? 2 : 3 );
615 sal_Int32
* pSeq
= aRet
.getArray();
616 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP
;
617 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
;
619 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE
;
621 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) )
624 sal_Int32
* pSeq
= aRet
.getArray();
625 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE
;
626 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP
;
627 *pSeq
++ = ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
;
629 else if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE
) ||
630 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
636 OSL_FAIL( "unknown charttype" );
642 bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference
< XChartType
>& xChartType
)
644 if( xChartType
.is() )
646 rtl::OUString aChartTypeName
= xChartType
->getChartType();
647 if( aChartTypeName
.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
) )
653 rtl::OUString
ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference
< XChartType
>& xChartType
)
655 rtl::OUString
aRet( C2U( "values-y" ) );
656 if( !xChartType
.is() )
658 rtl::OUString aChartTypeName
= xChartType
->getChartType();
659 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
660 aRet
= xChartType
->getRoleOfSequenceForSeriesLabel();
664 rtl::OUString
ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const uno::Reference
< XChartType
>& xChartType
)
666 rtl::OUString
aRet( C2U( "values-y" ) );
667 if( !xChartType
.is() )
669 rtl::OUString aChartTypeName
= xChartType
->getChartType();
670 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
)
671 || aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
672 aRet
= xChartType
->getRoleOfSequenceForSeriesLabel();
676 bool ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( const uno::Reference
< XChartType
>& xChartType
)
679 rtl::OUString aChartTypeName
= xChartType
->getChartType();
680 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
) )
685 bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference
< XChartType
>& xChartType
)
688 if( !xChartType
.is() )
691 rtl::OUString aChartTypeName
= xChartType
->getChartType();
692 if( aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE
) ||
693 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
) ||
694 aChartTypeName
.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA
) )
701 //.............................................................................
703 //.............................................................................
705 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */