LibreOffice Module chart2 (master) 1
ChartTypeHelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <ChartTypeHelper.hxx>
21#include <ChartType.hxx>
24#include <DiagramHelper.hxx>
26
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>
34
35using namespace ::com::sun::star;
36using namespace ::com::sun::star::chart2;
37using namespace ::chart::DataSeriesProperties;
38
39namespace chart
40{
41
43 const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount )
44{
45 bool bResult = false;
46
47 if( xChartType.is() &&
48 nDimensionCount < 3 )
49 {
50 bool bFound=false;
51 bool bAmbiguous=false;
52 StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, nullptr );
53 if( eStackMode == StackMode::NONE && !bAmbiguous )
54 {
55 OUString aChartTypeName = xChartType->getChartType();
56 bResult = ( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) ||
57 aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) );
58 }
59 }
60
61 return bResult;
62}
63
64bool ChartTypeHelper::isSupportingGeometryProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
65{
66 //form tab only for 3D-bar and 3D-column charts.
67
68 //@todo ask charttype itself --> need model change first
69 if(xChartType.is())
70 {
71 if(nDimensionCount==3)
72 {
73 OUString aChartTypeName = xChartType->getChartType();
74 if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_BAR )
75 return true;
76 if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN )
77 return true;
78 }
79 }
80 return false;
81}
82
83bool ChartTypeHelper::isSupportingStatisticProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
84{
85 //3D charts, pie, net and stock do not support statistic properties
86
87 //@todo ask charttype itself (and series? --> stock chart?) --> need model change first
88 if(xChartType.is())
89 {
90 if(nDimensionCount==3)
91 return false;
92
93 OUString aChartTypeName = xChartType->getChartType();
94 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
95 return false;
96 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
97 return false;
98 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
99 return false;
100 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
101 return false;
102 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines
103 return false;
104 }
105 return true;
106}
107
108bool ChartTypeHelper::isSupportingRegressionProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
109{
110 // note: old chart: only scatter chart
111 return isSupportingStatisticProperties( xChartType, nDimensionCount );
112}
113
114bool ChartTypeHelper::isSupportingAreaProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
115{
116 //2D line charts, net and stock do not support area properties
117
118 //@todo ask charttype itself --> need model change first
119 if(xChartType.is())
120 {
121 if(nDimensionCount==2)
122 {
123 OUString aChartTypeName = xChartType->getChartType();
124 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) )
125 return false;
126 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
127 return false;
128 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
129 return false;
130 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
131 return false;
132 }
133 }
134 return true;
135}
136
137bool ChartTypeHelper::isSupportingSymbolProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
138{
139 //2D line charts, 2D scatter charts and 2D net charts do support symbols
140
141 //@todo ask charttype itself --> need model change first
142 if(xChartType.is())
143 {
144 if(nDimensionCount==3)
145 return false;
146
147 OUString aChartTypeName = xChartType->getChartType();
148 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) )
149 return true;
150 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
151 return true;
152 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
153 return true;
154 }
155 return false;
156}
157
158bool ChartTypeHelper::isSupportingMainAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
159{
160 //pie charts do not support axis at all
161 //no 3rd axis for 2D charts
162
163 //@todo ask charttype itself --> need model change first
164 if(xChartType.is())
165 {
166 OUString aChartTypeName = xChartType->getChartType();
167 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
168 return false;
169
170 if( nDimensionIndex == 2 )
171 return nDimensionCount == 3;
172 }
173 return true;
174}
175
176bool ChartTypeHelper::isSupportingSecondaryAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
177{
178 //3D, pie and net charts do not support a secondary axis at all
179
180 //@todo ask charttype itself --> need model change first
181 if(xChartType.is())
182 {
183 if(nDimensionCount==3)
184 return false;
185
186 OUString aChartTypeName = xChartType->getChartType();
187 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
188 return false;
189 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
190 return false;
191 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
192 return false;
193 }
194 return true;
195}
196
198 const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
199{
200 //2D bar charts do support a this special properties
201
202 //@todo ask charttype itself --> need model change first
203 if(xChartType.is())
204 {
205 if(nDimensionCount==3)
206 return false;
207
208 OUString aChartTypeName = xChartType->getChartType();
209 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
210 return true;
211 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
212 return true;
213 }
214 return false;
215}
216
218 const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
219{
220 //2D bar charts with stacked series support this
221
222 //@todo ask charttype itself --> need model change first
223 if(xChartType.is())
224 {
225 if(nDimensionCount==3)
226 return false;
227
228 bool bFound=false;
229 bool bAmbiguous=false;
230 StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, nullptr );
231 if( eStackMode != StackMode::YStacked || bAmbiguous )
232 return false;
233
234 OUString aChartTypeName = xChartType->getChartType();
235 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
236 return true;
237 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
238 return true; // note: old chart was false here
239 }
240 return false;
241}
242
244 , bool bSwapXAndY
245 , const rtl::Reference< DataSeries >& xSeries )
246{
248 if( !xChartType.is() )
249 return aRet;
250
251 OUString aChartTypeName = xChartType->getChartType();
252 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
253 {
254 bool bDonut = false;
255 xChartType->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bDonut; // "UseRings"
256
257 if(!bDonut)
258 {
259 aRet.realloc(5);
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;
266 }
267 else
268 {
269 aRet.realloc(1);
270 sal_Int32* pSeq = aRet.getArray();
271 *pSeq++ = css::chart::DataLabelPlacement::CENTER;
272 }
273 }
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)
277 )
278 {
279 aRet.realloc(5);
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;
286 }
287 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN)
288 || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
289 {
290
291 bool bStacked = false;
292 {
293 chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING;
294 xSeries->getFastPropertyValue( PROP_DATASERIES_STACKING_DIRECTION ) >>= eStacking; // "StackingDirection"
295 bStacked = (eStacking == chart2::StackingDirection_Y_STACKING);
296 }
297
298 aRet.realloc( bStacked ? 3 : 6 );
299 sal_Int32* pSeq = aRet.getArray();
300 if(!bStacked)
301 {
302 if(bSwapXAndY)
303 {
304 *pSeq++ = css::chart::DataLabelPlacement::RIGHT;
305 *pSeq++ = css::chart::DataLabelPlacement::LEFT;
306 }
307 else
308 {
309 *pSeq++ = css::chart::DataLabelPlacement::TOP;
310 *pSeq++ = css::chart::DataLabelPlacement::BOTTOM;
311 }
312 }
313 *pSeq++ = css::chart::DataLabelPlacement::CENTER;
314 if(!bStacked)
315 *pSeq++ = css::chart::DataLabelPlacement::OUTSIDE;
316 *pSeq++ = css::chart::DataLabelPlacement::INSIDE;
317 *pSeq++ = css::chart::DataLabelPlacement::NEAR_ORIGIN;
318 }
319 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
320 {
321 bool bStacked = false;
322 {
323 chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING;
324 xSeries->getFastPropertyValue(PROP_DATASERIES_STACKING_DIRECTION) >>= eStacking; // "StackingDirection"
325 bStacked = (eStacking == chart2::StackingDirection_Y_STACKING);
326 }
327
328 aRet.realloc(2);
329 sal_Int32* pSeq = aRet.getArray();
330 if (bStacked)
331 {
332 *pSeq++ = css::chart::DataLabelPlacement::CENTER;
333 *pSeq++ = css::chart::DataLabelPlacement::TOP;
334 }
335 else
336 {
337 *pSeq++ = css::chart::DataLabelPlacement::TOP;
338 *pSeq++ = css::chart::DataLabelPlacement::CENTER;
339 }
340 }
341 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
342 {
343 aRet.realloc(6);
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;
351 }
352 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
353 {
354 aRet.realloc(1);
355 sal_Int32* pSeq = aRet.getArray();
356 *pSeq++ = css::chart::DataLabelPlacement::OUTSIDE;
357 }
358 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
359 {
360 aRet.realloc( 1 );
361 sal_Int32* pSeq = aRet.getArray();
362 *pSeq++ = css::chart::DataLabelPlacement::OUTSIDE;
363 }
364 else
365 {
366 OSL_FAIL( "unknown charttype" );
367 }
368
369 return aRet;
370}
371
373{
374 if(xChartType.is())
375 {
376 OUString aChartTypeName = xChartType->getChartType();
377 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
378 return false;
379 }
380 return true;
381}
382
384{
385 if(xChartType.is())
386 {
387 OUString aChartTypeName = xChartType->getChartType();
388 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
389 return true;
390 }
391 return false;
392}
394{
395 if(xChartType.is())
396 {
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)
401 )
402 return true;
403 }
404 return false;
405}
406
407bool ChartTypeHelper::isSupportingAxisPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
408{
409 if(xChartType.is())
410 {
411 OUString aChartTypeName = xChartType->getChartType();
412 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
413 return false;
414 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
415 return false;
416 }
417 if( nDimensionCount==3 )
418 return nDimensionIndex<2;
419 return true;
420}
421
422bool ChartTypeHelper::isSupportingDateAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionIndex )
423{
424 if( nDimensionIndex!=0 )
425 return false;
426 if( xChartType.is() )
427 {
428 sal_Int32 nType = ChartTypeHelper::getAxisType( xChartType, nDimensionIndex );
429 if( nType != AxisType::CATEGORY )
430 return false;
431 OUString aChartTypeName = xChartType->getChartType();
432 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
433 return false;
434 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
435 return false;
436 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
437 return false;
438 }
439 return true;
440}
441
443{
444 if( xChartType.is() )
445 {
446 OUString aChartTypeName = xChartType->getChartType();
447 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
448 return false;
449 }
450 return true;
451}
452
453bool ChartTypeHelper::isSupportingCategoryPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount )
454{
455 if( xChartType.is() )
456 {
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))
461 return true;
462 else if (nDimensionCount == 2 &&
463 (aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR)))
464 return true;
465 }
466 return false;
467}
468
470{
471 if(xChartType.is())
472 {
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) )
477 return true;
478 }
479 return false;
480}
481
483{
484 if(xChartType.is())
485 {
486 OUString aChartTypeName = xChartType->getChartType();
487 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
488 return true;
489 }
490 return false;
491}
492
494{
495 sal_Int32 nRet = static_cast< sal_Int32 >( 0x808080 ); // grey
496 if( xChartType .is() )
497 {
498 OUString aChartType = xChartType->getChartType();
499 if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
500 {
501 if( bSimple )
502 nRet = static_cast< sal_Int32 >( 0x333333 ); // grey80
503 else
504 nRet = static_cast< sal_Int32 >( 0xb3b3b3 ); // grey30
505 }
506 else if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_LINE
508 nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60
509 }
510 return nRet;
511}
512
514{
515 sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40
516 if( xChartType .is() )
517 {
518 OUString aChartType = xChartType->getChartType();
519 if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
520 {
521 if( bSimple )
522 nRet = static_cast< sal_Int32 >( 0xcccccc ); // grey20
523 else
524 nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60
525 }
526 }
527 return nRet;
528}
529
531{
532 drawing::Direction3D aRet(0.0, 0.0, 1.0);
533 if( xChartType .is() )
534 {
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
540 aRet = drawing::Direction3D(0.9, 0.5, 0.05);
541 }
542 return aRet;
543}
544
546{
547 drawing::Direction3D aRet(0.0, 0.0, 1.0);
548 if( xChartType .is() )
549 {
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
555 aRet = drawing::Direction3D(0.9, 0.5, 0.05);
556 }
557 return aRet;
558}
559
561 ChartType >& xChartType, sal_Int32 nDimensionIndex )
562{
563 //returned is a constant from constant group css::chart2::AxisType
564
565 //@todo ask charttype itself --> need model change first
566 if(!xChartType.is())
567 return AxisType::CATEGORY;
568
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
575 {
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;
580 }
581 return AxisType::CATEGORY;
582}
583
585 const rtl::Reference< ChartType >& xChartType,
586 sal_Int32 nNumberOfSeries )
587{
588 if( xChartType.is() )
589 {
590 try
591 {
592 OUString aChartTypeName = xChartType->getChartType();
593 if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
594 {
595 bool bDonut = false;
596 if( (xChartType->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bDonut) // "UseRings"
597 && !bDonut )
598 {
599 return nNumberOfSeries>0 ? 1 : 0;
600 }
601 }
602 }
603 catch( const uno::Exception & )
604 {
605 DBG_UNHANDLED_EXCEPTION("chart2");
606 }
607 }
608 return nNumberOfSeries;
609}
610
612{
614 if( !xChartType.is() )
615 return aRet;
616
617 bool bFound=false;
618 bool bAmbiguous=false;
619 StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, bFound, bAmbiguous, nullptr );
620 bool bStacked = bFound && (eStackMode == StackMode::YStacked);
621
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) )
626 {
627 aRet.realloc( 2 );
628 sal_Int32* pSeq = aRet.getArray();
629 *pSeq++ = css::chart::MissingValueTreatment::LEAVE_GAP;
630 *pSeq++ = css::chart::MissingValueTreatment::USE_ZERO;
631 }
632 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
633 {
634 aRet.realloc( bStacked ? 1 : 2 );
635 sal_Int32* pSeq = aRet.getArray();
636 *pSeq++ = css::chart::MissingValueTreatment::USE_ZERO;
637 if( !bStacked )
638 *pSeq++ = css::chart::MissingValueTreatment::CONTINUE;
639 }
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) )
643 {
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;
648 if( !bStacked )
649 *pSeq++ = css::chart::MissingValueTreatment::CONTINUE;
650 }
651 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
652 {
653 aRet.realloc( 3 );
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;
658 }
659 else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ||
660 aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
661 {
662 aRet.realloc( 0 );
663 }
664 else
665 {
666 OSL_FAIL( "unknown charttype" );
667 }
668
669 return aRet;
670}
671
673{
674 if( xChartType.is() )
675 {
676 OUString aChartTypeName = xChartType->getChartType();
677 if( aChartTypeName.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
678 return false;
679 }
680 return true;
681}
682
684{
685 OUString aRet( "values-y" );
686 if( !xChartType.is() )
687 return aRet;
688 OUString aChartTypeName = xChartType->getChartType();
689 if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
690 aRet = xChartType->getRoleOfSequenceForSeriesLabel();
691 return aRet;
692}
693
695{
696 OUString aRet( "values-y" );
697 if( !xChartType.is() )
698 return aRet;
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();
703 return aRet;
704}
705
707{
708 bool bRet = false;
709 if( !xChartType.is() )
710 return bRet;
711
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) )
716 {
717 bRet = true;
718 }
719 return bRet;
720}
721
722} //namespace chart
723
724/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool isSupportingRegressionProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static SAL_DLLPRIVATE sal_Int32 getDefaultAmbientLightColor(bool bSimple, const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingAxisSideBySide(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static sal_Int32 getNumberOfDisplayedSeries(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nNumberOfSeries)
static bool isSupportingAxisPositioning(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex)
static css::uno::Sequence< sal_Int32 > getSupportedLabelPlacements(const rtl::Reference< ::chart::ChartType > &xChartType, bool bSwapXAndY, const rtl::Reference< ::chart::DataSeries > &xSeries)
static bool isSupportingBaseValue(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingOnlyDeepStackingFor3D(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool shiftCategoryPosAtXAxisPerDefault(const rtl::Reference< ::chart::ChartType > &xChartType)
static css::uno::Sequence< sal_Int32 > getSupportedMissingValueTreatments(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingAreaProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static bool isSeriesInFrontOfAxisLine(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingDateAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionIndex)
static bool isSupportingBarConnectors(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static bool isSupportingComplexCategory(const rtl::Reference< ::chart::ChartType > &xChartType)
static OUString getRoleOfSequenceForYAxisNumberFormatDetection(const rtl::Reference< ::chart::ChartType > &xChartType)
static SAL_DLLPRIVATE sal_Int32 getDefaultDirectLightColor(bool bSimple, const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingCategoryPositioning(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static SAL_DLLPRIVATE css::drawing::Direction3D getDefaultRealisticLightDirection(const rtl::Reference< ::chart::ChartType > &xChartType)
static OUString getRoleOfSequenceForDataLabelNumberFormatDetection(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingMainAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex)
static bool isSupportingOverlapAndGapWidthProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static sal_Int32 getAxisType(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionIndex)
static bool isSupportingStatisticProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static bool isSupportingStartingAngle(const rtl::Reference< ::chart::ChartType > &xChartType)
static SAL_DLLPRIVATE bool noBordersForSimpleScheme(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingGeometryProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static bool isSupportingRightAngledAxes(const rtl::Reference< ::chart::ChartType > &xChartType)
static SAL_DLLPRIVATE css::drawing::Direction3D getDefaultSimpleLightDirection(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingSymbolProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static bool isSupportingSecondaryAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static StackMode getStackModeFromChartType(const rtl::Reference< ::chart::ChartType > &xChartType, bool &rbFound, bool &rbAmbiguous, const rtl::Reference< ::chart::BaseCoordinateSystem > &xCorrespondingCoordinateSystem)
Retrieves the stackmode of the first DataSeries or none.
#define DBG_UNHANDLED_EXCEPTION(...)
@ PROP_PIECHARTTYPE_USE_RINGS
Definition: ChartType.hxx:43
QPRO_FUNC_TYPE nType
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_PIE
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_BAR
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_AREA
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_LINE
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_NET