Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / controller / chartapiwrapper / AxisWrapper.cxx
blobea50320e506e638bad9d17bd9f68e5fad21eb4e3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "AxisWrapper.hxx"
21 #include <Axis.hxx>
22 #include <AxisHelper.hxx>
23 #include <TitleHelper.hxx>
24 #include "Chart2ModelContact.hxx"
25 #include <WrappedDirectStateProperty.hxx>
26 #include "GridWrapper.hxx"
27 #include "TitleWrapper.hxx"
28 #include <DisposeHelper.hxx>
29 #include <unonames.hxx>
31 #include <comphelper/sequence.hxx>
32 #include <cppuhelper/supportsservice.hxx>
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
34 #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
35 #include <com/sun/star/chart/ChartAxisPosition.hpp>
36 #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
37 #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
38 #include <com/sun/star/chart2/XAxis.hpp>
40 #include <CharacterProperties.hxx>
41 #include <LinePropertiesHelper.hxx>
42 #include <UserDefinedProperties.hxx>
43 #include "WrappedCharacterHeightProperty.hxx"
44 #include "WrappedTextRotationProperty.hxx"
45 #include "WrappedGapwidthProperty.hxx"
46 #include "WrappedScaleProperty.hxx"
47 #include "WrappedNumberFormatProperty.hxx"
48 #include "WrappedScaleTextProperties.hxx"
50 #include <algorithm>
51 #include <utility>
52 #include <comphelper/diagnose_ex.hxx>
54 using namespace ::com::sun::star;
55 using namespace ::com::sun::star::chart2;
57 using ::com::sun::star::beans::Property;
58 using ::com::sun::star::uno::Reference;
59 using ::com::sun::star::uno::Sequence;
60 using ::com::sun::star::uno::Any;
62 namespace
65 enum
67 PROP_AXIS_MAX,
68 PROP_AXIS_MIN,
69 PROP_AXIS_STEPMAIN,
70 PROP_AXIS_STEPHELP, //deprecated property use 'StepHelpCount' instead
71 PROP_AXIS_STEPHELP_COUNT,
72 PROP_AXIS_AUTO_MAX,
73 PROP_AXIS_AUTO_MIN,
74 PROP_AXIS_AUTO_STEPMAIN,
75 PROP_AXIS_AUTO_STEPHELP,
76 PROP_AXIS_TYPE,
77 PROP_AXIS_TIME_INCREMENT,
78 PROP_AXIS_EXPLICIT_TIME_INCREMENT,
79 PROP_AXIS_LOGARITHMIC,
80 PROP_AXIS_REVERSEDIRECTION,
81 PROP_AXIS_VISIBLE,
82 PROP_AXIS_CROSSOVER_POSITION,
83 PROP_AXIS_CROSSOVER_VALUE,
84 PROP_AXIS_ORIGIN,
85 PROP_AXIS_AUTO_ORIGIN,
86 PROP_AXIS_MARKS,
87 PROP_AXIS_HELPMARKS,
88 PROP_AXIS_MARK_POSITION,
89 PROP_AXIS_DISPLAY_LABELS,
90 PROP_AXIS_NUMBERFORMAT,
91 PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
92 PROP_AXIS_LABEL_POSITION,
93 PROP_AXIS_TEXT_ROTATION,
94 PROP_AXIS_ARRANGE_ORDER,
95 PROP_AXIS_TEXTBREAK,
96 PROP_AXIS_CAN_OVERLAP,
97 PROP_AXIS_STACKEDTEXT,
98 PROP_AXIS_OVERLAP,
99 PROP_AXIS_GAP_WIDTH,
100 PROP_AXIS_DISPLAY_UNITS,
101 PROP_AXIS_BUILTINUNIT,
102 PROP_AXIS_TRY_STAGGERING_FIRST,
103 PROP_AXIS_MAJOR_ORIGIN
106 void lcl_AddPropertiesToVector(
107 std::vector< Property > & rOutProperties )
109 //Properties for scaling:
110 rOutProperties.emplace_back( "Max",
111 PROP_AXIS_MAX,
112 cppu::UnoType<double>::get(),
113 beans::PropertyAttribute::BOUND
114 | beans::PropertyAttribute::MAYBEVOID );
116 rOutProperties.emplace_back( "Min",
117 PROP_AXIS_MIN,
118 cppu::UnoType<double>::get(),
119 beans::PropertyAttribute::BOUND
120 | beans::PropertyAttribute::MAYBEVOID );
122 rOutProperties.emplace_back( "StepMain",
123 PROP_AXIS_STEPMAIN,
124 cppu::UnoType<double>::get(),
125 beans::PropertyAttribute::BOUND
126 | beans::PropertyAttribute::MAYBEVOID );
128 rOutProperties.emplace_back( "StepHelpCount",
129 PROP_AXIS_STEPHELP_COUNT,
130 cppu::UnoType<sal_Int32>::get(),
131 beans::PropertyAttribute::BOUND
132 | beans::PropertyAttribute::MAYBEVOID );
134 //deprecated property use 'StepHelpCount' instead
135 rOutProperties.emplace_back( "StepHelp",
136 PROP_AXIS_STEPHELP,
137 cppu::UnoType<double>::get(),
138 beans::PropertyAttribute::BOUND
139 | beans::PropertyAttribute::MAYBEVOID );
141 rOutProperties.emplace_back( "AutoMax",
142 PROP_AXIS_AUTO_MAX,
143 cppu::UnoType<bool>::get(),
144 //#i111967# no PropertyChangeEvent is fired on change so far
145 beans::PropertyAttribute::MAYBEDEFAULT );
147 rOutProperties.emplace_back( "AutoMin",
148 PROP_AXIS_AUTO_MIN,
149 cppu::UnoType<bool>::get(),
150 //#i111967# no PropertyChangeEvent is fired on change so far
151 beans::PropertyAttribute::MAYBEDEFAULT );
153 rOutProperties.emplace_back( "AutoStepMain",
154 PROP_AXIS_AUTO_STEPMAIN,
155 cppu::UnoType<bool>::get(),
156 //#i111967# no PropertyChangeEvent is fired on change so far
157 beans::PropertyAttribute::MAYBEDEFAULT );
159 rOutProperties.emplace_back( "AutoStepHelp",
160 PROP_AXIS_AUTO_STEPHELP,
161 cppu::UnoType<bool>::get(),
162 //#i111967# no PropertyChangeEvent is fired on change so far
163 beans::PropertyAttribute::MAYBEDEFAULT );
165 rOutProperties.emplace_back( "AxisType",
166 PROP_AXIS_TYPE,
167 cppu::UnoType<sal_Int32>::get(), //type css::chart::ChartAxisType
168 //#i111967# no PropertyChangeEvent is fired on change so far
169 beans::PropertyAttribute::MAYBEDEFAULT );
171 rOutProperties.emplace_back( "TimeIncrement",
172 PROP_AXIS_TIME_INCREMENT,
173 cppu::UnoType<css::chart::TimeIncrement>::get(),
174 //#i111967# no PropertyChangeEvent is fired on change so far
175 beans::PropertyAttribute::MAYBEVOID );
177 rOutProperties.emplace_back( "ExplicitTimeIncrement",
178 PROP_AXIS_EXPLICIT_TIME_INCREMENT,
179 cppu::UnoType<css::chart::TimeIncrement>::get(),
180 beans::PropertyAttribute::READONLY |
181 beans::PropertyAttribute::MAYBEVOID );
183 rOutProperties.emplace_back( "Logarithmic",
184 PROP_AXIS_LOGARITHMIC,
185 cppu::UnoType<bool>::get(),
186 //#i111967# no PropertyChangeEvent is fired on change so far
187 beans::PropertyAttribute::MAYBEDEFAULT );
189 rOutProperties.emplace_back( "ReverseDirection",
190 PROP_AXIS_REVERSEDIRECTION,
191 cppu::UnoType<bool>::get(),
192 //#i111967# no PropertyChangeEvent is fired on change so far
193 beans::PropertyAttribute::MAYBEDEFAULT );
195 //todo: this property is missing in the API
196 rOutProperties.emplace_back( "Visible",
197 PROP_AXIS_VISIBLE,
198 cppu::UnoType<bool>::get(),
199 beans::PropertyAttribute::BOUND
200 | beans::PropertyAttribute::MAYBEDEFAULT );
202 rOutProperties.emplace_back( "CrossoverPosition",
203 PROP_AXIS_CROSSOVER_POSITION,
204 cppu::UnoType<css::chart::ChartAxisPosition>::get(),
205 beans::PropertyAttribute::MAYBEDEFAULT );
207 rOutProperties.emplace_back( "CrossoverValue",
208 PROP_AXIS_CROSSOVER_VALUE,
209 cppu::UnoType<double>::get(),
210 beans::PropertyAttribute::MAYBEVOID );
212 rOutProperties.emplace_back( "Origin",
213 PROP_AXIS_ORIGIN,
214 cppu::UnoType<double>::get(),
215 beans::PropertyAttribute::BOUND
216 | beans::PropertyAttribute::MAYBEVOID );
218 rOutProperties.emplace_back( "AutoOrigin",
219 PROP_AXIS_AUTO_ORIGIN,
220 cppu::UnoType<bool>::get(),
221 //#i111967# no PropertyChangeEvent is fired on change so far
222 beans::PropertyAttribute::MAYBEDEFAULT );
224 //Properties for interval marks:
225 rOutProperties.emplace_back( "Marks",
226 PROP_AXIS_MARKS,
227 cppu::UnoType<sal_Int32>::get(),
228 beans::PropertyAttribute::BOUND
229 | beans::PropertyAttribute::MAYBEDEFAULT );
231 rOutProperties.emplace_back( "HelpMarks",
232 PROP_AXIS_HELPMARKS,
233 cppu::UnoType<sal_Int32>::get(),
234 beans::PropertyAttribute::BOUND
235 | beans::PropertyAttribute::MAYBEDEFAULT );
237 rOutProperties.emplace_back( "MarkPosition",
238 PROP_AXIS_MARK_POSITION,
239 cppu::UnoType<css::chart::ChartAxisMarkPosition>::get(),
240 beans::PropertyAttribute::MAYBEDEFAULT );
242 //Properties for labels:
243 rOutProperties.emplace_back( "DisplayLabels",
244 PROP_AXIS_DISPLAY_LABELS,
245 cppu::UnoType<bool>::get(),
246 beans::PropertyAttribute::BOUND
247 | beans::PropertyAttribute::MAYBEDEFAULT );
249 rOutProperties.emplace_back( CHART_UNONAME_NUMFMT,
250 PROP_AXIS_NUMBERFORMAT,
251 cppu::UnoType<sal_Int32>::get(),
252 beans::PropertyAttribute::BOUND
253 | beans::PropertyAttribute::MAYBEDEFAULT );
255 rOutProperties.emplace_back( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
256 PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
257 cppu::UnoType<bool>::get(),
258 beans::PropertyAttribute::BOUND
259 | beans::PropertyAttribute::MAYBEDEFAULT );
261 rOutProperties.emplace_back( "LabelPosition",
262 PROP_AXIS_LABEL_POSITION,
263 cppu::UnoType<css::chart::ChartAxisLabelPosition>::get(),
264 beans::PropertyAttribute::MAYBEDEFAULT );
266 rOutProperties.emplace_back( "TextRotation",
267 PROP_AXIS_TEXT_ROTATION,
268 cppu::UnoType<sal_Int32>::get(),
269 beans::PropertyAttribute::BOUND
270 | beans::PropertyAttribute::MAYBEDEFAULT );
272 rOutProperties.emplace_back( "ArrangeOrder",
273 PROP_AXIS_ARRANGE_ORDER,
274 cppu::UnoType<css::chart::ChartAxisArrangeOrderType>::get(),
275 beans::PropertyAttribute::BOUND
276 | beans::PropertyAttribute::MAYBEDEFAULT );
278 rOutProperties.emplace_back( "TextBreak",
279 PROP_AXIS_TEXTBREAK,
280 cppu::UnoType<bool>::get(),
281 beans::PropertyAttribute::BOUND
282 | beans::PropertyAttribute::MAYBEDEFAULT );
284 rOutProperties.emplace_back( "TextCanOverlap",
285 PROP_AXIS_CAN_OVERLAP,
286 cppu::UnoType<bool>::get(),
287 beans::PropertyAttribute::BOUND
288 | beans::PropertyAttribute::MAYBEDEFAULT );
290 rOutProperties.emplace_back( "StackedText",
291 PROP_AXIS_STACKEDTEXT,
292 cppu::UnoType<bool>::get(),
293 beans::PropertyAttribute::BOUND
294 | beans::PropertyAttribute::MAYBEDEFAULT );
296 // Properties related to bar charts:
297 rOutProperties.emplace_back( "Overlap",
298 PROP_AXIS_OVERLAP,
299 cppu::UnoType<sal_Int32>::get(),
300 //#i111967# no PropertyChangeEvent is fired on change so far
301 beans::PropertyAttribute::MAYBEDEFAULT );
303 rOutProperties.emplace_back( "GapWidth",
304 PROP_AXIS_GAP_WIDTH,
305 cppu::UnoType<sal_Int32>::get(),
306 //#i111967# no PropertyChangeEvent is fired on change so far
307 beans::PropertyAttribute::MAYBEDEFAULT );
309 //Properties for display units:
310 rOutProperties.emplace_back( "DisplayUnits",
311 PROP_AXIS_DISPLAY_UNITS,
312 cppu::UnoType<bool>::get(),
313 beans::PropertyAttribute::BOUND
314 | beans::PropertyAttribute::MAYBEDEFAULT );
316 //Properties for labels:
317 rOutProperties.emplace_back( "BuiltInUnit",
318 PROP_AXIS_BUILTINUNIT,
319 cppu::UnoType<OUString>::get(),
320 beans::PropertyAttribute::BOUND
321 | beans::PropertyAttribute::MAYBEDEFAULT );
323 // Compatibility option: starting from LibreOffice 5.1 the rotated
324 // layout is preferred to staggering for axis labels.
325 rOutProperties.emplace_back( "TryStaggeringFirst",
326 PROP_AXIS_TRY_STAGGERING_FIRST,
327 cppu::UnoType<bool>::get(),
328 beans::PropertyAttribute::BOUND
329 | beans::PropertyAttribute::MAYBEDEFAULT );
331 rOutProperties.emplace_back( "MajorOrigin",
332 PROP_AXIS_MAJOR_ORIGIN,
333 cppu::UnoType<double>::get(),
334 beans::PropertyAttribute::BOUND
335 | beans::PropertyAttribute::MAYBEVOID );
338 const Sequence< Property >& StaticAxisWrapperPropertyArray()
340 static Sequence< Property > aPropSeq = []()
342 std::vector< css::beans::Property > aProperties;
343 lcl_AddPropertiesToVector( aProperties );
344 ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
345 ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
346 ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
347 ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
349 std::sort( aProperties.begin(), aProperties.end(),
350 ::chart::PropertyNameLess() );
352 return comphelper::containerToSequence( aProperties );
353 }();
354 return aPropSeq;
357 } // anonymous namespace
359 namespace chart::wrapper
362 AxisWrapper::AxisWrapper(
363 tAxisType eType, std::shared_ptr<Chart2ModelContact> spChart2ModelContact) :
364 m_spChart2ModelContact(std::move( spChart2ModelContact )),
365 m_eType( eType )
369 AxisWrapper::~AxisWrapper()
373 // ____ chart::XAxis ____
374 Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getAxisTitle()
376 if( !m_xAxisTitle.is() )
378 TitleHelper::eTitleType eTitleType( TitleHelper::X_AXIS_TITLE );
379 switch( m_eType )
381 case X_AXIS:
382 eTitleType = TitleHelper::X_AXIS_TITLE;
383 break;
384 case Y_AXIS:
385 eTitleType = TitleHelper::Y_AXIS_TITLE;
386 break;
387 case Z_AXIS:
388 eTitleType = TitleHelper::Z_AXIS_TITLE;
389 break;
390 case SECOND_X_AXIS:
391 eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
392 break;
393 case SECOND_Y_AXIS:
394 eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
395 break;
396 default:
397 return nullptr;
399 m_xAxisTitle = new TitleWrapper( eTitleType, m_spChart2ModelContact );
401 return m_xAxisTitle;
403 Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMajorGrid()
405 if( !m_xMajorGrid.is() )
407 GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
408 switch( m_eType )
410 case X_AXIS:
411 eGridType = GridWrapper::X_MAJOR_GRID;
412 break;
413 case Y_AXIS:
414 eGridType = GridWrapper::Y_MAJOR_GRID;
415 break;
416 case Z_AXIS:
417 eGridType = GridWrapper::Z_MAJOR_GRID;
418 break;
419 default:
420 return nullptr;
422 m_xMajorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
424 return m_xMajorGrid;
426 Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMinorGrid()
428 if( !m_xMinorGrid.is() )
430 GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
431 switch( m_eType )
433 case X_AXIS:
434 eGridType = GridWrapper::X_MINOR_GRID;
435 break;
436 case Y_AXIS:
437 eGridType = GridWrapper::Y_MINOR_GRID;
438 break;
439 case Z_AXIS:
440 eGridType = GridWrapper::Z_MINOR_GRID;
441 break;
442 default:
443 return nullptr;
445 m_xMinorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
447 return m_xMinorGrid;
450 // ____ XShape ____
451 awt::Point SAL_CALL AxisWrapper::getPosition()
453 awt::Point aResult( m_spChart2ModelContact->GetAxisPosition( getAxis() ) );
454 return aResult;
457 void SAL_CALL AxisWrapper::setPosition( const awt::Point& /*aPosition*/ )
459 OSL_FAIL( "trying to set position of Axis" );
462 awt::Size SAL_CALL AxisWrapper::getSize()
464 awt::Size aSize( m_spChart2ModelContact->GetAxisSize( getAxis() ) );
465 return aSize;
468 void SAL_CALL AxisWrapper::setSize( const awt::Size& /*aSize*/ )
470 OSL_FAIL( "trying to set size of Axis" );
473 // ____ XShapeDescriptor (base of XShape) ____
474 OUString SAL_CALL AxisWrapper::getShapeType()
476 return "com.sun.star.chart.ChartAxis";
479 // ____ XNumberFormatsSupplier ____
480 uno::Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getNumberFormatSettings()
482 rtl::Reference<ChartModel> xChartModel( m_spChart2ModelContact->getDocumentModel() );
483 if( xChartModel )
484 return xChartModel->getNumberFormatSettings();
486 return uno::Reference< beans::XPropertySet >();
489 uno::Reference< util::XNumberFormats > SAL_CALL AxisWrapper::getNumberFormats()
491 rtl::Reference<ChartModel> xChartModel( m_spChart2ModelContact->getDocumentModel() );
492 if( xChartModel )
493 return xChartModel->getNumberFormats();
495 return uno::Reference< util::XNumberFormats >();
498 void AxisWrapper::getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, bool& rbMainAxis )
500 switch( eType )
502 case X_AXIS:
503 rnDimensionIndex = 0; rbMainAxis = true; break;
504 case Y_AXIS:
505 rnDimensionIndex = 1; rbMainAxis = true; break;
506 case Z_AXIS:
507 rnDimensionIndex = 2; rbMainAxis = true; break;
508 case SECOND_X_AXIS:
509 rnDimensionIndex = 0; rbMainAxis = false; break;
510 case SECOND_Y_AXIS:
511 rnDimensionIndex = 1; rbMainAxis = false; break;
515 // ____ XComponent ____
516 void SAL_CALL AxisWrapper::dispose()
518 std::unique_lock g(m_aMutex);
519 Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
520 m_aEventListenerContainer.disposeAndClear( g, lang::EventObject( xSource ) );
522 DisposeHelper::DisposeAndClear( m_xAxisTitle );
523 DisposeHelper::DisposeAndClear( m_xMajorGrid );
524 DisposeHelper::DisposeAndClear( m_xMinorGrid );
526 clearWrappedPropertySet();
529 void SAL_CALL AxisWrapper::addEventListener(
530 const Reference< lang::XEventListener >& xListener )
532 std::unique_lock g(m_aMutex);
533 m_aEventListenerContainer.addInterface( g, xListener );
536 void SAL_CALL AxisWrapper::removeEventListener(
537 const Reference< lang::XEventListener >& aListener )
539 std::unique_lock g(m_aMutex);
540 m_aEventListenerContainer.removeInterface( g, aListener );
543 //ReferenceSizePropertyProvider
544 void AxisWrapper::updateReferenceSize()
546 Reference< beans::XPropertySet > xProp( getAxis(), uno::UNO_QUERY );
547 if( xProp.is() )
549 if( xProp->getPropertyValue("ReferencePageSize").hasValue() )
550 xProp->setPropertyValue("ReferencePageSize", uno::Any(
551 m_spChart2ModelContact->GetPageSize() ));
554 Any AxisWrapper::getReferenceSize()
556 Any aRet;
557 Reference< beans::XPropertySet > xProp( getAxis(), uno::UNO_QUERY );
558 if( xProp.is() )
559 aRet = xProp->getPropertyValue("ReferencePageSize");
560 return aRet;
562 awt::Size AxisWrapper::getCurrentSizeForReference()
564 return m_spChart2ModelContact->GetPageSize();
567 Reference< chart2::XAxis > AxisWrapper::getAxis()
569 rtl::Reference< Axis > xAxis;
572 sal_Int32 nDimensionIndex = 0;
573 bool bMainAxis = true;
574 AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
576 rtl::Reference< Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
577 xAxis = AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram );
578 if( !xAxis.is() )
580 xAxis = AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, m_spChart2ModelContact->m_xContext );
581 if( xAxis.is() )
582 xAxis->setPropertyValue("Show", uno::Any( false ) );
585 catch( const uno::Exception & )
587 DBG_UNHANDLED_EXCEPTION("chart2");
589 return xAxis;
592 // WrappedPropertySet
593 Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet()
595 return Reference< beans::XPropertySet >( getAxis(), uno::UNO_QUERY );
598 const Sequence< beans::Property >& AxisWrapper::getPropertySequence()
600 return StaticAxisWrapperPropertyArray();
603 std::vector< std::unique_ptr<WrappedProperty> > AxisWrapper::createWrappedProperties()
605 std::vector< std::unique_ptr<WrappedProperty> > aWrappedProperties;
607 aWrappedProperties.emplace_back( new WrappedTextRotationProperty() );
608 aWrappedProperties.emplace_back( new WrappedProperty("Marks","MajorTickmarks") );
609 aWrappedProperties.emplace_back( new WrappedProperty("HelpMarks","MinorTickmarks") );
610 aWrappedProperties.emplace_back( new WrappedProperty("TextCanOverlap","TextOverlap") );
611 aWrappedProperties.emplace_back( new WrappedProperty("ArrangeOrder","ArrangeOrder") );
612 aWrappedProperties.emplace_back( new WrappedProperty("Visible","Show") );
613 aWrappedProperties.emplace_back( new WrappedDirectStateProperty("DisplayLabels","DisplayLabels") );
614 aWrappedProperties.emplace_back( new WrappedDirectStateProperty("TryStaggeringFirst","TryStaggeringFirst") );
615 aWrappedProperties.emplace_back( new WrappedDirectStateProperty("TextBreak","TextBreak") );
616 aWrappedProperties.emplace_back( new WrappedNumberFormatProperty(m_spChart2ModelContact) );
617 aWrappedProperties.emplace_back( new WrappedLinkNumberFormatProperty );
618 aWrappedProperties.emplace_back( new WrappedProperty("StackedText","StackCharacters") );
619 aWrappedProperties.emplace_back( new WrappedDirectStateProperty("CrossoverPosition","CrossoverPosition") );
620 aWrappedProperties.emplace_back( new WrappedDirectStateProperty("MajorOrigin","MajorOrigin") );
622 WrappedGapwidthProperty* pWrappedGapwidthProperty( new WrappedGapwidthProperty( m_spChart2ModelContact ) );
623 WrappedBarOverlapProperty* pWrappedBarOverlapProperty( new WrappedBarOverlapProperty( m_spChart2ModelContact ) );
624 sal_Int32 nDimensionIndex = 0;
625 bool bMainAxis = true;
626 sal_Int32 nAxisIndex = 0;
627 AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
628 if( !bMainAxis )
629 nAxisIndex = 1;
630 pWrappedGapwidthProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
631 pWrappedBarOverlapProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
632 aWrappedProperties.emplace_back( pWrappedGapwidthProperty );
633 aWrappedProperties.emplace_back( pWrappedBarOverlapProperty );
636 WrappedScaleProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
638 WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
639 WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
641 return aWrappedProperties;
644 OUString SAL_CALL AxisWrapper::getImplementationName()
646 return "com.sun.star.comp.chart.Axis";
649 sal_Bool SAL_CALL AxisWrapper::supportsService( const OUString& rServiceName )
651 return cppu::supportsService(this, rServiceName);
654 css::uno::Sequence< OUString > SAL_CALL AxisWrapper::getSupportedServiceNames()
656 return {
657 "com.sun.star.chart.ChartAxis",
658 "com.sun.star.xml.UserDefinedAttributesSupplier",
659 "com.sun.star.style.CharacterProperties"
663 } // namespace chart
665 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */