LibreOffice Module chart2 (master) 1
AxisHelper.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 <AxisHelper.hxx>
21#include <DiagramHelper.hxx>
22#include <Diagram.hxx>
23#include <ChartTypeHelper.hxx>
24#include <ChartType.hxx>
25#include <Axis.hxx>
26#include <AxisIndexDefines.hxx>
27#include <DataSource.hxx>
30#include <DataSeries.hxx>
31#include <DataSeriesHelper.hxx>
32#include <Scaling.hxx>
33#include <ChartModel.hxx>
34#include <ChartModelHelper.hxx>
35#include <DataSourceHelper.hxx>
38#include <unonames.hxx>
40#include <GridProperties.hxx>
41
42#include <o3tl/safeint.hxx>
43#include <unotools/saveopt.hxx>
44
45#include <com/sun/star/chart/ChartAxisPosition.hpp>
46#include <com/sun/star/chart2/AxisType.hpp>
47
48#include <sal/log.hxx>
49
50#include <com/sun/star/lang/XServiceName.hpp>
51#include <com/sun/star/uno/XComponentContext.hpp>
54
55#include <cstddef>
56#include <map>
57
58namespace chart
59{
60using namespace ::com::sun::star;
61using namespace ::com::sun::star::chart2;
62using ::com::sun::star::uno::Reference;
63using ::com::sun::star::uno::Sequence;
64
66{
67 return new LinearScaling( 1.0, 0.0 );
68}
69
71{
72 return new LogarithmicScaling( fBase );
73}
74
76{
77 ScaleData aScaleData;
78 aScaleData.AxisType = chart2::AxisType::REALNUMBER;
79 aScaleData.AutoDateAxis = true;
80 aScaleData.ShiftedCategoryPosition = false;
81 Sequence< SubIncrement > aSubIncrements{ SubIncrement() };
82 aScaleData.IncrementData.SubIncrements = aSubIncrements;
83 return aScaleData;
84}
85
86void AxisHelper::removeExplicitScaling( ScaleData& rScaleData )
87{
88 uno::Any aEmpty;
89 rScaleData.Minimum = rScaleData.Maximum = rScaleData.Origin = aEmpty;
90 rScaleData.Scaling = nullptr;
91 ScaleData aDefaultScale( createDefaultScale() );
92 rScaleData.IncrementData = aDefaultScale.IncrementData;
93 rScaleData.TimeIncrement = aDefaultScale.TimeIncrement;
94}
95
97{
98 Reference< lang::XServiceName > xServiceName( xScaling, uno::UNO_QUERY );
99 return xServiceName.is()
100 && xServiceName->getServiceName() == "com.sun.star.chart2.LogarithmicScaling";
101}
102
103chart2::ScaleData AxisHelper::getDateCheckedScale( const rtl::Reference< Axis >& xAxis, ChartModel& rModel )
104{
105 ScaleData aScale = xAxis->getScaleData();
107 if( aScale.AutoDateAxis && aScale.AxisType == AxisType::CATEGORY )
108 {
109 sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
110 AxisHelper::getIndicesForAxis(xAxis, xCooSys, nDimensionIndex, nAxisIndex );
111 bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), nDimensionIndex );
112 if( bChartTypeAllowsDateAxis )
113 aScale.AxisType = AxisType::DATE;
114 }
115 if( aScale.AxisType == AxisType::DATE )
116 {
117 ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, rModel );
118 if( !aExplicitCategoriesProvider.isDateAxis() )
119 aScale.AxisType = AxisType::CATEGORY;
120 }
121 return aScale;
122}
123
124void AxisHelper::checkDateAxis( chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis )
125{
126 if( rScale.AutoDateAxis && rScale.AxisType == AxisType::CATEGORY && bChartTypeAllowsDateAxis )
127 {
128 rScale.AxisType = AxisType::DATE;
129 removeExplicitScaling( rScale );
130 }
131 if( rScale.AxisType == AxisType::DATE && (!pExplicitCategoriesProvider || !pExplicitCategoriesProvider->isDateAxis()) )
132 {
133 rScale.AxisType = AxisType::CATEGORY;
134 removeExplicitScaling( rScale );
135 }
136}
137
139 const rtl::Reference< Axis >& xAxis
140 , const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem
141 , const rtl::Reference<ChartModel>& xChartDoc
142 , bool bSearchForParallelAxisIfNothingIsFound )
143{
144 sal_Int32 nNumberFormatKey(0);
145 sal_Int32 nAxisIndex = 0;
146 sal_Int32 nDimensionIndex = 1;
147 AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex );
148
149 if (!xAxis.is())
150 return 0;
151
152 bool bLinkToSource = true;
153 xAxis->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource;
154 xAxis->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey;
155
156 if (bLinkToSource)
157 {
158 bool bFormatSet = false;
159 //check whether we have a percent scale -> use percent format
160 if (xChartDoc)
161 {
162 ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *xChartDoc );
163 if( aData.AxisType==AxisType::PERCENT )
164 {
165 sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xChartDoc );
166 if( nPercentFormat != -1 )
167 {
168 nNumberFormatKey = nPercentFormat;
169 bFormatSet = true;
170 }
171 }
172 else if( aData.AxisType==AxisType::DATE )
173 {
174 if( aData.Categories.is() )
175 {
176 Reference< data::XDataSequence > xSeq( aData.Categories->getValues());
177 if( xSeq.is() && !( xChartDoc.is() && xChartDoc->hasInternalDataProvider()) )
178 nNumberFormatKey = xSeq->getNumberFormatKeyByIndex( -1 );
179 else
180 nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc );
181 bFormatSet = true;
182 }
183 }
184 else if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() && nDimensionIndex == 0 ) //maybe date axis
185 {
186 rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram() );
187 if( xDiagram->isSupportingDateAxis() )
188 {
189 nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc );
190 }
191 else
192 {
194 if( xSource.is() )
195 {
196 std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aXValues(
197 DataSeriesHelper::getAllDataSequencesByRole( xSource->getDataSequences(), "values-x" ) );
198 if( aXValues.empty() )
199 {
200 uno::Reference< chart2::data::XLabeledDataSequence > xCategories( xDiagram->getCategories() );
201 if( xCategories.is() )
202 {
203 Reference< data::XDataSequence > xSeq( xCategories->getValues());
204 if( xSeq.is() )
205 {
206 bool bHasValidDoubles = false;
207 double fTest=0.0;
208 Sequence< uno::Any > aCats( xSeq->getData() );
209 sal_Int32 nCount = aCats.getLength();
210 for( sal_Int32 i = 0; i < nCount; ++i )
211 {
212 if( (aCats[i]>>=fTest) && !std::isnan(fTest) )
213 {
214 bHasValidDoubles=true;
215 break;
216 }
217 }
218 if( bHasValidDoubles )
219 nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc );
220 }
221 }
222 }
223 }
224 }
225 bFormatSet = true;
226 }
227 }
228
229 if( !bFormatSet )
230 {
231 std::map< sal_Int32, sal_Int32 > aKeyMap;
232 bool bNumberFormatKeyFoundViaAttachedData = false;
233
234 try
235 {
236 OUString aRoleToMatch;
237 if( nDimensionIndex == 0 )
238 aRoleToMatch = "values-x";
239 const std::vector< rtl::Reference< ChartType > > & aChartTypes( xCorrespondingCoordinateSystem->getChartTypes2());
240 for( rtl::Reference< ChartType > const & chartType : aChartTypes )
241 {
242 if( nDimensionIndex != 0 )
244 for( rtl::Reference< DataSeries > const & xDataSeries : chartType->getDataSeries2() )
245 {
246 if( nDimensionIndex == 1 )
247 {
248 //only take those series into account that are attached to this axis
249 sal_Int32 nAttachedAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
250 if( nAttachedAxisIndex != nAxisIndex )
251 continue;
252 }
253
255 DataSeriesHelper::getDataSequenceByRole( xDataSeries, aRoleToMatch ) );
256
257 if( !xLabeledSeq.is() && nDimensionIndex==0 )
258 {
259 ScaleData aData = xAxis->getScaleData();
260 xLabeledSeq = aData.Categories;
261 }
262
263 if( xLabeledSeq.is() )
264 {
265 Reference< data::XDataSequence > xSeq( xLabeledSeq->getValues());
266 if( xSeq.is() )
267 {
268 sal_Int32 nKey = xSeq->getNumberFormatKeyByIndex( -1 );
269 // increase frequency
270 aKeyMap[ nKey ] ++;
271 }
272 }
273 }
274 }
275 }
276 catch( const uno::Exception & )
277 {
278 DBG_UNHANDLED_EXCEPTION("chart2");
279 }
280
281 if( ! aKeyMap.empty())
282 {
283 sal_Int32 nMaxFreq = 0;
284 // find most frequent key
285 for (auto const& elem : aKeyMap)
286 {
287 SAL_INFO(
288 "chart2.tools",
289 "NumberFormatKey " << elem.first << " appears "
290 << elem.second << " times");
291 // all values must at least be 1
292 if( elem.second > nMaxFreq )
293 {
294 nNumberFormatKey = elem.first;
295 bNumberFormatKeyFoundViaAttachedData = true;
296 nMaxFreq = elem.second;
297 }
298 }
299 }
300
301 if( bSearchForParallelAxisIfNothingIsFound )
302 {
303 //no format is set to this axis and no data is set to this axis
304 //--> try to obtain the format from the parallel y-axis
305 if( !bNumberFormatKeyFoundViaAttachedData && nDimensionIndex == 1 )
306 {
307 sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
308 rtl::Reference< Axis > xParallelAxis = AxisHelper::getAxis( 1, nParallelAxisIndex, xCorrespondingCoordinateSystem );
309 nNumberFormatKey = AxisHelper::getExplicitNumberFormatKeyForAxis(xParallelAxis, xCorrespondingCoordinateSystem, xChartDoc, false);
310 }
311 }
312 }
313 }
314
315 return nNumberFormatKey;
316}
317
319 sal_Int32 nDimensionIndex
320 , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
322 , const Reference< uno::XComponentContext > & xContext
323 , ReferenceSizeProvider * pRefSizeProvider )
324{
325 if( !xContext.is() || !xCooSys.is() )
326 return nullptr;
327 if( nDimensionIndex >= xCooSys->getDimension() )
328 return nullptr;
329
330 rtl::Reference< Axis > xAxis = new Axis();
331
332 xCooSys->setAxisByDimension( nDimensionIndex, xAxis, nAxisIndex );
333
334 if( nAxisIndex>0 )//when inserting secondary axes copy some things from the main axis
335 {
336 css::chart::ChartAxisPosition eNewAxisPos( css::chart::ChartAxisPosition_END );
337
338 rtl::Reference< Axis > xMainAxis = xCooSys->getAxisByDimension2( nDimensionIndex, 0 );
339 if( xMainAxis.is() )
340 {
341 ScaleData aScale = xAxis->getScaleData();
342 ScaleData aMainScale = xMainAxis->getScaleData();
343
344 aScale.AxisType = aMainScale.AxisType;
345 aScale.AutoDateAxis = aMainScale.AutoDateAxis;
346 aScale.Categories = aMainScale.Categories;
347 aScale.Orientation = aMainScale.Orientation;
348 aScale.ShiftedCategoryPosition = aMainScale.ShiftedCategoryPosition;
349
350 xAxis->setScaleData( aScale );
351
352 //ensure that the second axis is not placed on the main axis
353 css::chart::ChartAxisPosition eMainAxisPos( css::chart::ChartAxisPosition_ZERO );
354 xMainAxis->getPropertyValue("CrossoverPosition") >>= eMainAxisPos;
355 if( eMainAxisPos == css::chart::ChartAxisPosition_END )
356 eNewAxisPos = css::chart::ChartAxisPosition_START;
357 }
358
359 xAxis->setPropertyValue("CrossoverPosition", uno::Any(eNewAxisPos) );
360 }
361
362 try
363 {
364 // set correct initial AutoScale
365 if( pRefSizeProvider )
366 pRefSizeProvider->setValuesAtPropertySet( xAxis );
367 }
368 catch( const uno::Exception& )
369 {
370 TOOLS_WARN_EXCEPTION("chart2", "" );
371 }
372 return xAxis;
373}
374
375rtl::Reference< Axis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
376 , const rtl::Reference< Diagram >& xDiagram
377 , const Reference< uno::XComponentContext >& xContext
378 , ReferenceSizeProvider * pRefSizeProvider )
379{
380 OSL_ENSURE( xContext.is(), "need a context to create an axis" );
381 if( !xContext.is() )
382 return nullptr;
383
384 sal_Int32 nAxisIndex = bMainAxis ? MAIN_AXIS_INDEX : SECONDARY_AXIS_INDEX;
386
387 // create axis
389 nDimensionIndex, nAxisIndex, xCooSys, xContext, pRefSizeProvider );
390}
391
392void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
393 , const rtl::Reference< Diagram >& xDiagram
395 , ReferenceSizeProvider * pRefSizeProvider )
396{
397 if( !xDiagram.is() )
398 return;
399
400 bool bNewAxisCreated = false;
401 rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram );
402 if( !xAxis.is() && xContext.is() )
403 {
404 // create axis
405 bNewAxisCreated = true;
406 xAxis = AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, xContext, pRefSizeProvider );
407 }
408
409 OSL_ASSERT( xAxis.is());
410 if( !bNewAxisCreated ) //default is true already if created
412}
413
414void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
415 , const rtl::Reference< Diagram >& xDiagram )
416{
417 if( !xDiagram.is() )
418 return;
419
421 if(!xCooSys.is())
422 return;
423
424 rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys );
425 if(!xAxis.is())
426 {
427 //hhhh todo create axis without axis visibility
428 }
429 if(!xAxis.is())
430 return;
431
432 if( bMainGrid )
433 AxisHelper::makeGridVisible( xAxis->getGridProperties2() );
434 else
435 {
436 std::vector< rtl::Reference< GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
437 for( auto const & i : aSubGrids )
439 }
440}
441
443{
444 if( xAxis.is() )
445 {
446 xAxis->setPropertyValue( "Show", uno::Any( true ) );
448 xAxis->setPropertyValue( "DisplayLabels", uno::Any( true ) );
449 }
450}
451
453{
454 if( xGridProperties.is() )
455 {
456 xGridProperties->setPropertyValue( "Show", uno::Any( true ) );
457 LinePropertiesHelper::SetLineVisible( xGridProperties );
458 }
459}
460
461void AxisHelper::hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
462 , const rtl::Reference< Diagram >& xDiagram )
463{
464 AxisHelper::makeAxisInvisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
465}
466
468{
469 if( xAxis.is() )
470 {
471 xAxis->setPropertyValue( "Show", uno::Any( false ) );
472 }
473}
474
476{
477 //axis is hidden if no data is attached anymore but data is available
478 bool bOtherSeriesAttachedToThisAxis = false;
479 std::vector< rtl::Reference< DataSeries > > aSeriesVector = xDiagram->getDataSeries();
480 for (auto const& series : aSeriesVector)
481 {
482 rtl::Reference< Axis > xCurrentAxis = xDiagram->getAttachedAxis(series);
483 if( xCurrentAxis==xAxis )
484 {
485 bOtherSeriesAttachedToThisAxis = true;
486 break;
487 }
488 }
489 if(!bOtherSeriesAttachedToThisAxis && !aSeriesVector.empty() )
491}
492
493void AxisHelper::hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
494 , const rtl::Reference< Diagram >& xDiagram )
495{
496 if( !xDiagram.is() )
497 return;
498
500 if(!xCooSys.is())
501 return;
502
503 rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys );
504 if(!xAxis.is())
505 return;
506
507 if( bMainGrid )
508 AxisHelper::makeGridInvisible( xAxis->getGridProperties2() );
509 else
510 {
511 std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
512 for( auto const & i : aSubGrids)
514 }
515}
516
518{
519 if( xGridProperties.is() )
520 {
521 xGridProperties->setPropertyValue( "Show", uno::Any( false ) );
522 }
523}
524
525bool AxisHelper::isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
526 , const rtl::Reference< Diagram >& xDiagram )
527{
528 bool bRet = false;
529
531 if(!xCooSys.is())
532 return bRet;
533
534 rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDimensionIndex, MAIN_AXIS_INDEX, xCooSys );
535 if(!xAxis.is())
536 return bRet;
537
538 if( bMainGrid )
539 bRet = AxisHelper::isGridVisible( xAxis->getGridProperties2() );
540 else
541 {
542 std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
543 if( !aSubGrids.empty() )
544 bRet = AxisHelper::isGridVisible( aSubGrids[0] );
545 }
546
547 return bRet;
548}
549
551 const rtl::Reference< Diagram >& xDiagram, sal_Int32 nIndex )
552{
553 if(!xDiagram.is())
554 return nullptr;
555 auto aCooSysList = xDiagram->getBaseCoordinateSystems();
556 if(0<=nIndex && o3tl::make_unsigned(nIndex) < aCooSysList.size())
557 return aCooSysList[nIndex];
558 return nullptr;
559}
560
561rtl::Reference< Axis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
562 , const rtl::Reference< Diagram >& xDiagram )
563{
565 try
566 {
568 xRet = AxisHelper::getAxis( nDimensionIndex, bMainAxis ? 0 : 1, xCooSys );
569 }
570 catch( const uno::Exception & )
571 {
572 }
573 return xRet;
574}
575
576rtl::Reference< Axis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
578{
580 if(!xCooSys.is())
581 return xRet;
582
583 if(nDimensionIndex >= xCooSys->getDimension())
584 return xRet;
585
586 if(nAxisIndex > xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex))
587 return xRet;
588
589 assert(nAxisIndex >= 0);
590 assert(nDimensionIndex >= 0);
591 xRet = xCooSys->getAxisByDimension2( nDimensionIndex, nAxisIndex );
592 return xRet;
593}
594
597{
598 sal_Int32 nDimensionIndex = 0;
599 sal_Int32 nAxisIndex = 0;
600 AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
601 if( nDimensionIndex==2 )
602 {
603 nDimensionIndex=1;
604 bool bSwapXY = false;
605 if( (xCooSys->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXY) && bSwapXY )
606 nDimensionIndex=0;
607 }
608 else if( nDimensionIndex==1 )
609 nDimensionIndex=0;
610 else
611 nDimensionIndex=1;
612 return AxisHelper::getAxis( nDimensionIndex, 0, xCooSys );
613}
614
616 , const rtl::Reference< Diagram >& xDiagram )
617{
618 try
619 {
620 sal_Int32 nCooSysIndex=-1;
621 sal_Int32 nDimensionIndex=-1;
622 sal_Int32 nAxisIndex=-1;
623 if( getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
624 {
625 sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1;
626 return getAxis( nDimensionIndex, nParallelAxisIndex, getCoordinateSystemByIndex( xDiagram, nCooSysIndex ) );
627 }
628 }
629 catch( const uno::RuntimeException& )
630 {
631 }
632 return nullptr;
633}
634
635bool AxisHelper::isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
636 , const rtl::Reference< Diagram >& xDiagram )
637{
638 return AxisHelper::isAxisVisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) );
639}
640
642{
643 bool bRet = false;
644
645 if( xAxis.is() )
646 {
647 xAxis->getPropertyValue( "Show" ) >>= bRet;
648 bRet = bRet && ( LinePropertiesHelper::IsLineVisible( xAxis )
649 || areAxisLabelsVisible( xAxis ) );
650 }
651
652 return bRet;
653}
654
656{
657 bool bRet = false;
658 if( xAxis.is() )
659 {
660 xAxis->getPropertyValue( "DisplayLabels" ) >>= bRet;
661 }
662 return bRet;
663}
664
666{
667 bool bRet = false;
668
669 if( xGridproperties.is() )
670 {
671 xGridproperties->getPropertyValue( "Show" ) >>= bRet;
672 bRet = bRet && LinePropertiesHelper::IsLineVisible( xGridproperties );
673 }
674
675 return bRet;
676}
677
680 , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex, sal_Int32 nSubGridIndex )
681{
683
684 rtl::Reference< Axis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
685 if( xAxis.is() )
686 {
687 if( nSubGridIndex<0 )
688 xRet = xAxis->getGridProperties2();
689 else
690 {
691 std::vector< rtl::Reference< GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
692 if (nSubGridIndex < static_cast<sal_Int32>(aSubGrids.size()))
693 xRet = aSubGrids[nSubGridIndex];
694 }
695 }
696
697 return xRet;
698}
699
701 const rtl::Reference< Axis >& xAxis
702 , const rtl::Reference< Diagram >& xDiagram )
703{
704 sal_Int32 nDimensionIndex = -1;
705 sal_Int32 nCooSysIndex = -1;
706 sal_Int32 nAxisIndex = -1;
707 AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex , nDimensionIndex, nAxisIndex );
708 return nDimensionIndex;
709}
710
712 const rtl::Reference< Axis >& xAxis
714 , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex )
715{
716 //returns true if indices are found
717
718 rOutDimensionIndex = -1;
719 rOutAxisIndex = -1;
720
721 if( !xCooSys || !xAxis )
722 return false;
723
724 rtl::Reference< Axis > xCurrentAxis;
725 sal_Int32 nDimensionCount( xCooSys->getDimension() );
726 for( sal_Int32 nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
727 {
728 sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
729 for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
730 {
731 xCurrentAxis = xCooSys->getAxisByDimension2(nDimensionIndex,nAxisIndex);
732 if( xCurrentAxis == xAxis )
733 {
734 rOutDimensionIndex = nDimensionIndex;
735 rOutAxisIndex = nAxisIndex;
736 return true;
737 }
738 }
739 }
740 return false;
741}
742
744 , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex )
745{
746 //returns true if indices are found
747
748 rOutCooSysIndex = -1;
749 rOutDimensionIndex = -1;
750 rOutAxisIndex = -1;
751
752 const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysList = xDiagram->getBaseCoordinateSystems();
753 for( std::size_t nC=0; nC < aCooSysList.size(); ++nC )
754 {
755 if( AxisHelper::getIndicesForAxis( xAxis, aCooSysList[nC], rOutDimensionIndex, rOutAxisIndex ) )
756 {
757 rOutCooSysIndex = nC;
758 return true;
759 }
760 }
761
762 return false;
763}
764
765std::vector< rtl::Reference< Axis > > AxisHelper::getAllAxesOfCoordinateSystem(
767 , bool bOnlyVisible /* = false */ )
768{
769 std::vector< rtl::Reference< Axis > > aAxisVector;
770
771 if(xCooSys.is())
772 {
773 sal_Int32 nMaxDimensionIndex = xCooSys->getDimension() -1;
774 if( nMaxDimensionIndex>=0 )
775 {
776 sal_Int32 nDimensionIndex = 0;
777 for(; nDimensionIndex<=nMaxDimensionIndex; ++nDimensionIndex)
778 {
779 const sal_Int32 nMaximumAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
780 for(sal_Int32 nAxisIndex=0; nAxisIndex<=nMaximumAxisIndex; ++nAxisIndex)
781 {
782 try
783 {
784 rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( nDimensionIndex, nAxisIndex );
785 if( xAxis.is() )
786 {
787 bool bAddAxis = true;
788 if( bOnlyVisible )
789 {
790 if( !(xAxis->getPropertyValue( "Show") >>= bAddAxis) )
791 bAddAxis = false;
792 }
793 if( bAddAxis )
794 aAxisVector.push_back( xAxis );
795 }
796 }
797 catch( const uno::Exception & )
798 {
799 DBG_UNHANDLED_EXCEPTION("chart2");
800 }
801 }
802 }
803 }
804 }
805
806 return aAxisVector;
807}
808
809std::vector< rtl::Reference< Axis > > AxisHelper::getAllAxesOfDiagram(
810 const rtl::Reference< Diagram >& xDiagram
811 , bool bOnlyVisible )
812{
813 std::vector< rtl::Reference< Axis > > aAxisVector;
814
815 for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() )
816 {
817 std::vector< rtl::Reference< Axis > > aAxesPerCooSys = AxisHelper::getAllAxesOfCoordinateSystem( coords, bOnlyVisible );
818 aAxisVector.insert( aAxisVector.end(), aAxesPerCooSys.begin(), aAxesPerCooSys.end() );
819 }
820
821 return aAxisVector;
822}
823
824std::vector< rtl::Reference< GridProperties > > AxisHelper::getAllGrids( const rtl::Reference< Diagram >& xDiagram )
825{
826 const std::vector< rtl::Reference< Axis > > aAllAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
827 std::vector< rtl::Reference< GridProperties > > aGridVector;
828
829 for( rtl::Reference< Axis > const & xAxis : aAllAxes )
830 {
831 rtl::Reference< GridProperties > xGridProperties( xAxis->getGridProperties2() );
832 if( xGridProperties.is() )
833 aGridVector.push_back( xGridProperties );
834
835 std::vector< rtl::Reference< GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
836 for( rtl::Reference< GridProperties > const & xSubGrid : aSubGrids )
837 {
838 if( xSubGrid.is() )
839 aGridVector.push_back( xSubGrid );
840 }
841 }
842
843 return aGridVector;
844}
845
847 , const rtl::Reference< Diagram>& xDiagram, bool bAxis )
848{
849 rPossibilityList.realloc(6);
850 sal_Bool* pPossibilityList = rPossibilityList.getArray();
851
852 sal_Int32 nDimensionCount = -1;
853 if (xDiagram)
854 nDimensionCount = xDiagram->getDimension();
855
856 //set possibilities:
857 sal_Int32 nIndex=0;
859 if (xDiagram)
860 xChartType = xDiagram->getChartTypeByIndex( 0 );
861 for(nIndex=0;nIndex<3;nIndex++)
862 pPossibilityList[nIndex]=ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nIndex);
863 for(nIndex=3;nIndex<6;nIndex++)
864 if( bAxis )
865 pPossibilityList[nIndex]=ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount);
866 else
867 pPossibilityList[nIndex] = rPossibilityList[nIndex-3];
868}
869
871{
872 if( !xCooSys.is() )
873 return false;
874
875 const std::vector< rtl::Reference< ChartType > > & aChartTypes( xCooSys->getChartTypes2() );
876 for( rtl::Reference< ChartType > const & chartType : aChartTypes )
877 {
878 const std::vector< rtl::Reference< DataSeries > > & aSeriesList = chartType->getDataSeries2();
879 for( sal_Int32 nS = aSeriesList.size(); nS-- ; )
880 {
881 sal_Int32 nAttachedAxisIndex = 0;
882 if( ( aSeriesList[nS]->getPropertyValue( "AttachedAxisIndex" ) >>= nAttachedAxisIndex ) &&
883 nAttachedAxisIndex>0 )
884 return true;
885 }
886 }
887 return false;
888}
889
892{
893 bool bRet = false;
894
895 if( xAxis.is() && xCooSys.is() )
896 {
897 sal_Int32 nDimensionIndex=-1;
898 sal_Int32 nAxisIndex=-1;
899 if( AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ) )
900 {
901 sal_Int32 nDimensionCount = xCooSys->getDimension();
903
904 bool bMainAxis = (nAxisIndex==MAIN_AXIS_INDEX);
905 if( bMainAxis )
906 bRet = ChartTypeHelper::isSupportingMainAxis(xChartType,nDimensionCount,nDimensionIndex);
907 else
908 bRet = ChartTypeHelper::isSupportingSecondaryAxis(xChartType,nDimensionCount);
909 }
910 }
911
912 return bRet;
913}
914
916 , const rtl::Reference< Diagram>& xDiagram, bool bAxis )
917{
918 rExistenceList.realloc(6);
919 sal_Bool* pExistenceList = rExistenceList.getArray();
920
921 if(bAxis)
922 {
923 sal_Int32 nN;
924 for(nN=0;nN<3;nN++)
925 pExistenceList[nN] = AxisHelper::isAxisShown( nN, true, xDiagram );
926 for(nN=3;nN<6;nN++)
927 pExistenceList[nN] = AxisHelper::isAxisShown( nN%3, false, xDiagram );
928 }
929 else
930 {
931 sal_Int32 nN;
932
933 for(nN=0;nN<3;nN++)
934 pExistenceList[nN] = AxisHelper::isGridShown( nN, 0, true, xDiagram );
935 for(nN=3;nN<6;nN++)
936 pExistenceList[nN] = AxisHelper::isGridShown( nN%3, 0, false, xDiagram );
937 }
938}
939
941 , const Sequence< sal_Bool >& rOldExistenceList
942 , const Sequence< sal_Bool >& rNewExistenceList
944 , ReferenceSizeProvider * pRefSizeProvider )
945{
946 bool bChanged = false;
947 for(sal_Int32 nN=0;nN<6;nN++)
948 {
949 if(rOldExistenceList[nN]!=rNewExistenceList[nN])
950 {
951 bChanged = true;
952 if(rNewExistenceList[nN])
953 {
954 AxisHelper::showAxis( nN%3, nN<3, xDiagram, xContext, pRefSizeProvider );
955 }
956 else
957 AxisHelper::hideAxis( nN%3, nN<3, xDiagram );
958 }
959 }
960 return bChanged;
961}
962
964 , const Sequence< sal_Bool >& rOldExistenceList
965 , const Sequence< sal_Bool >& rNewExistenceList )
966{
967 bool bChanged = false;
968 for(sal_Int32 nN=0;nN<6;nN++)
969 {
970 if(rOldExistenceList[nN]!=rNewExistenceList[nN])
971 {
972 bChanged = true;
973 if(rNewExistenceList[nN])
974 AxisHelper::showGrid( nN%3, 0, nN<3, xDiagram );
975 else
976 AxisHelper::hideGrid( nN%3, 0, nN<3, xDiagram );
977 }
978 }
979 return bChanged;
980}
981
983 const rtl::Reference< Axis >& xAxis
984 , const rtl::Reference< Diagram >& xDiagram )
985{
986 if (!xDiagram)
987 return nullptr;
988
990 for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() )
991 {
992 std::vector< rtl::Reference< Axis > > aAllAxis = AxisHelper::getAllAxesOfCoordinateSystem( xCooSys );
993
994 auto aFound = std::find( aAllAxis.begin(), aAllAxis.end(), xAxis );
995 if( aFound != aAllAxis.end())
996 {
997 xRet = xCooSys;
998 break;
999 }
1000 }
1001 return xRet;
1002}
1003
1005{
1006 rtl::Reference< ChartType > xChartType;
1007
1008 if( xCooSys.is() )
1009 {
1010 const std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() );
1011 if( nIndex >= 0 && o3tl::make_unsigned(nIndex) < aChartTypeList.size() )
1012 xChartType = aChartTypeList[nIndex];
1013 }
1014
1015 return xChartType;
1016}
1017
1019{
1020 if( !xCooSys.is() )
1021 return;
1022
1023 bool bCartesian = xCooSys->getViewServiceName() == CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME;
1024 if( !bCartesian )
1025 return;
1026
1027 bool bVertical = false;
1028 xCooSys->getPropertyValue( "SwapXAndYAxis" ) >>= bVertical;
1029
1030 sal_Int32 nHorizontalAxisDimension = bVertical ? 1 : 0;
1031 sal_Int32 nVerticalAxisDimension = bVertical ? 0 : 1;
1032
1033 try
1034 {
1035 //reverse direction for horizontal main axis
1036 rtl::Reference< Axis > xHorizontalMainAxis = AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys );
1037 if( xHorizontalMainAxis.is() )
1038 {
1039 chart2::ScaleData aScale = xHorizontalMainAxis->getScaleData();
1040 aScale.Orientation = chart2::AxisOrientation_REVERSE;
1041 xHorizontalMainAxis->setScaleData(aScale);
1042 }
1043
1044 //mathematical direction for vertical main axis
1045 rtl::Reference< Axis > xVerticalMainAxis = AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys );
1046 if( xVerticalMainAxis.is() )
1047 {
1048 chart2::ScaleData aScale = xVerticalMainAxis->getScaleData();
1049 aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL;
1050 xVerticalMainAxis->setScaleData(aScale);
1051 }
1052 }
1053 catch( const uno::Exception & )
1054 {
1055 DBG_UNHANDLED_EXCEPTION("chart2" );
1056 }
1057
1058 try
1059 {
1060 //reverse direction for horizontal secondary axis
1061 rtl::Reference< Axis > xHorizontalSecondaryAxis = AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys );
1062 if( xHorizontalSecondaryAxis.is() )
1063 {
1064 chart2::ScaleData aScale = xHorizontalSecondaryAxis->getScaleData();
1065 aScale.Orientation = chart2::AxisOrientation_REVERSE;
1066 xHorizontalSecondaryAxis->setScaleData(aScale);
1067 }
1068
1069 //mathematical direction for vertical secondary axis
1070 rtl::Reference< Axis > xVerticalSecondaryAxis = AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys );
1071 if( xVerticalSecondaryAxis.is() )
1072 {
1073 chart2::ScaleData aScale = xVerticalSecondaryAxis->getScaleData();
1074 aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL;
1075 xVerticalSecondaryAxis->setScaleData(aScale);
1076 }
1077 }
1078 catch( const uno::Exception & )
1079 {
1080 DBG_UNHANDLED_EXCEPTION("chart2");
1081 }
1082}
1083
1085{
1086 rtl::Reference< ChartType > xChartType;
1087 std::vector< rtl::Reference< DataSeries > > aSeriesVector = xDiagram->getDataSeries();
1088 for (auto const& series : aSeriesVector)
1089 {
1090 sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex(series);
1091 if( nAttachedAxisIndex == nCurrentIndex )
1092 {
1093 xChartType = xDiagram->getChartTypeOfSeries(series);
1094 if(xChartType.is())
1095 break;
1096 }
1097 }
1098 return xChartType;
1099}
1100
1102{
1104 return nCurrentVersion >= SvtSaveOptions::ODFSVER_012;
1105}
1106
1107} //namespace chart
1108
1109/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool isLogarithmic(const css::uno::Reference< css::chart2::XScaling > &xScaling)
Definition: AxisHelper.cxx:96
static std::vector< rtl::Reference< ::chart::GridProperties > > getAllGrids(const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:824
static rtl::Reference< ::chart::Axis > getCrossingMainAxis(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys)
Definition: AxisHelper.cxx:595
static void makeAxisInvisible(const rtl::Reference< ::chart::Axis > &xAxis)
Definition: AxisHelper.cxx:467
static void getAxisOrGridExistence(css::uno::Sequence< sal_Bool > &rExistenceList, const rtl::Reference< ::chart::Diagram > &xDiagram, bool bAxis=true)
Definition: AxisHelper.cxx:915
static rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfAxis(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:982
static rtl::Reference< ::chart::Axis > getAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
static css::uno::Reference< css::chart2::XScaling > createLinearScaling()
Definition: AxisHelper.cxx:65
static rtl::Reference< ::chart::Axis > getParallelAxis(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:615
static rtl::Reference< ::chart::Axis > createAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider=nullptr)
static css::chart2::ScaleData getDateCheckedScale(const rtl::Reference< ::chart::Axis > &xAxis, ChartModel &rModel)
Definition: AxisHelper.cxx:103
static void makeGridInvisible(const rtl::Reference< ::chart::GridProperties > &xGridProperties)
Definition: AxisHelper.cxx:517
static std::vector< rtl::Reference< ::chart::Axis > > getAllAxesOfDiagram(const rtl::Reference< ::chart::Diagram > &xDiagram, bool bOnlyVisible=false)
Definition: AxisHelper.cxx:809
static css::chart2::ScaleData createDefaultScale()
Definition: AxisHelper.cxx:75
static SAL_DLLPRIVATE bool areAxisLabelsVisible(const rtl::Reference< ::chart::Axis > &xAxisProperties)
Definition: AxisHelper.cxx:655
static void checkDateAxis(css::chart2::ScaleData &rScale, ExplicitCategoriesProvider *pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis)
Definition: AxisHelper.cxx:124
static rtl::Reference< ::chart::ChartType > getChartTypeByIndex(const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys, sal_Int32 nIndex)
static rtl::Reference< ::chart::ChartType > getFirstChartTypeWithSeriesAttachedToAxisIndex(const rtl::Reference< ::chart::Diagram > &xDiagram, const sal_Int32 nAttachedAxisIndex)
static bool isAxisShown(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:635
static void makeAxisVisible(const rtl::Reference< ::chart::Axis > &xAxis)
Definition: AxisHelper.cxx:442
static sal_Int32 getExplicitNumberFormatKeyForAxis(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::BaseCoordinateSystem > &xCorrespondingCoordinateSystem, const rtl::Reference< ::chart::ChartModel > &xChartDoc, bool bSearchForParallelAxisIfNothingIsFound)
Definition: AxisHelper.cxx:138
static sal_Int32 getDimensionIndexOfAxis(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:700
static bool isGridVisible(const rtl::Reference< ::chart::GridProperties > &xGridProperties)
Definition: AxisHelper.cxx:665
static rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemByIndex(const rtl::Reference< ::chart::Diagram > &xDiagram, sal_Int32 nIndex)
Definition: AxisHelper.cxx:550
static void removeExplicitScaling(css::chart2::ScaleData &rScaleData)
Definition: AxisHelper.cxx:86
static rtl::Reference< ::chart::GridProperties > getGridProperties(const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex, sal_Int32 nSubGridIndex)
Definition: AxisHelper.cxx:678
static bool getIndicesForAxis(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys, sal_Int32 &rOutDimensionIndex, sal_Int32 &rOutAxisIndex)
static SAL_DLLPRIVATE std::vector< rtl::Reference< ::chart::Axis > > getAllAxesOfCoordinateSystem(const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys, bool bOnlyVisible=false)
Definition: AxisHelper.cxx:765
static css::uno::Reference< css::chart2::XScaling > createLogarithmicScaling(double fBase=10.0)
Definition: AxisHelper.cxx:70
static bool shouldAxisBeDisplayed(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys)
Definition: AxisHelper.cxx:890
static void hideAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:461
static void hideGrid(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:493
static void setRTLAxisLayout(const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys)
static bool isAxisPositioningEnabled()
static void hideAxisIfNoDataIsAttached(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:475
static void makeGridVisible(const rtl::Reference< ::chart::GridProperties > &xGridProperties)
Definition: AxisHelper.cxx:452
static void showAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider=nullptr)
Definition: AxisHelper.cxx:392
static bool isGridShown(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:525
static void getAxisOrGridPossibilities(css::uno::Sequence< sal_Bool > &rPossibilityList, const rtl::Reference< ::chart::Diagram > &xDiagram, bool bAxis=true)
Definition: AxisHelper.cxx:846
static bool changeVisibilityOfGrids(const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Sequence< sal_Bool > &rOldExistenceList, const css::uno::Sequence< sal_Bool > &rNewExistenceList)
Definition: AxisHelper.cxx:963
static bool isSecondaryYAxisNeeded(const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys)
Definition: AxisHelper.cxx:870
static bool isAxisVisible(const rtl::Reference< ::chart::Axis > &xAxis)
Definition: AxisHelper.cxx:641
static void showGrid(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:414
static bool changeVisibilityOfAxes(const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Sequence< sal_Bool > &rOldExistenceList, const css::uno::Sequence< sal_Bool > &rNewExistenceList, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider)
Definition: AxisHelper.cxx:940
static rtl::Reference< ::chart::BaseCoordinateSystem > getFirstCoordinateSystem(const rtl::Reference<::chart::ChartModel > &xModel)
static bool isSupportingDateAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionIndex)
static OUString getRoleOfSequenceForYAxisNumberFormatDetection(const rtl::Reference< ::chart::ChartType > &xChartType)
static bool isSupportingMainAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex)
static bool isSupportingSecondaryAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static rtl::Reference< ::chart::DataSource > getUsedData(ChartModel &rModel)
static sal_Int32 getPercentNumberFormat(const css::uno::Reference< css::util::XNumberFormatsSupplier > &xNumberFormatsSupplier)
static sal_Int32 getDateNumberFormat(const css::uno::Reference< css::util::XNumberFormatsSupplier > &xNumberFormatsSupplier)
SAL_DLLPRIVATE void setValuesAtPropertySet(const css::uno::Reference< css::beans::XPropertySet > &xProp, bool bAdaptFontSizes=true)
Sets the ReferencePageSize according to the internal settings of this class at the XPropertySet,...
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
sal_Int32 nIndex
#define SAL_INFO(area, stream)
constexpr OUStringLiteral aData
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence > getDataSequenceByRole(const css::uno::Reference< css::chart2::data::XDataSource > &xSource, const OUString &aRole, bool bMatchPrefix=false)
Retrieves the data sequence in the given data source that matches the given role.
OOO_DLLPUBLIC_CHARTTOOLS std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > getAllDataSequencesByRole(const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > &aDataSequences, const OUString &aRole)
Retrieves all data sequences in the given data source that match the given role prefix.
OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex(const rtl::Reference< ::chart::DataSeries > &xSeries)
void SetLineVisible(const css::uno::Reference< css::beans::XPropertySet > &xLineProperties)
bool IsLineVisible(const css::uno::Reference< css::beans::XPropertySet > &xLineProperties)
const sal_Int32 SECONDARY_AXIS_INDEX
const sal_Int32 MAIN_AXIS_INDEX
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
UNOTOOLS_DLLPUBLIC SvtSaveOptions::ODFSaneDefaultVersion GetODFSaneDefaultVersion()
constexpr OUStringLiteral CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME
unsigned char sal_Bool
constexpr OUStringLiteral CHART_UNONAME_LINK_TO_SRC_NUMFMT
Definition: unonames.hxx:21
constexpr OUStringLiteral CHART_UNONAME_NUMFMT
Definition: unonames.hxx:20