31#include <unonames.hxx>
33#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
34#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
35#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
36#include <com/sun/star/chart/ChartAxisPosition.hpp>
37#include <com/sun/star/beans/PropertyAttribute.hpp>
38#include <com/sun/star/awt/Size.hpp>
47using namespace ::com::sun::star::beans::PropertyAttribute;
49using ::com::sun::star::uno::Sequence;
50using ::com::sun::star::uno::Reference;
51using ::com::sun::star::beans::Property;
52using ::osl::MutexGuard;
60 PROP_AXIS_CROSSOVER_POSITION,
61 PROP_AXIS_CROSSOVER_VALUE,
62 PROP_AXIS_DISPLAY_LABELS,
63 PROP_AXIS_NUMBERFORMAT,
64 PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
65 PROP_AXIS_LABEL_POSITION,
66 PROP_AXIS_TEXT_ROTATION,
68 PROP_AXIS_TEXT_OVERLAP,
69 PROP_AXIS_TEXT_STACKED,
70 PROP_AXIS_TEXT_ARRANGE_ORDER,
71 PROP_AXIS_REFERENCE_DIAGRAM_SIZE,
73 PROP_AXIS_MAJOR_TICKMARKS,
74 PROP_AXIS_MINOR_TICKMARKS,
75 PROP_AXIS_MARK_POSITION,
77 PROP_AXIS_DISPLAY_UNITS,
78 PROP_AXIS_BUILTINUNIT,
80 PROP_AXIS_TRY_STAGGERING_FIRST,
81 PROP_AXIS_MAJOR_ORIGIN
84void lcl_AddPropertiesToVector(
85 std::vector< Property > & rOutProperties )
87 rOutProperties.emplace_back(
"Show",
90 beans::PropertyAttribute::BOUND
91 | beans::PropertyAttribute::MAYBEDEFAULT );
93 rOutProperties.emplace_back(
"CrossoverPosition",
94 PROP_AXIS_CROSSOVER_POSITION,
96 beans::PropertyAttribute::MAYBEDEFAULT );
98 rOutProperties.emplace_back(
"CrossoverValue",
99 PROP_AXIS_CROSSOVER_VALUE,
101 beans::PropertyAttribute::MAYBEVOID );
103 rOutProperties.emplace_back(
"DisplayLabels",
104 PROP_AXIS_DISPLAY_LABELS,
106 beans::PropertyAttribute::BOUND
107 | beans::PropertyAttribute::MAYBEDEFAULT );
110 PROP_AXIS_NUMBERFORMAT,
112 beans::PropertyAttribute::BOUND
113 | beans::PropertyAttribute::MAYBEDEFAULT );
116 PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
118 beans::PropertyAttribute::BOUND
119 | beans::PropertyAttribute::MAYBEDEFAULT );
121 rOutProperties.emplace_back(
"LabelPosition",
122 PROP_AXIS_LABEL_POSITION,
124 beans::PropertyAttribute::MAYBEDEFAULT );
126 rOutProperties.emplace_back(
"TextRotation",
127 PROP_AXIS_TEXT_ROTATION,
129 beans::PropertyAttribute::BOUND
130 | beans::PropertyAttribute::MAYBEDEFAULT );
132 rOutProperties.emplace_back(
"TextBreak",
133 PROP_AXIS_TEXT_BREAK,
135 beans::PropertyAttribute::BOUND
136 | beans::PropertyAttribute::MAYBEDEFAULT );
138 rOutProperties.emplace_back(
"TextOverlap",
139 PROP_AXIS_TEXT_OVERLAP,
141 beans::PropertyAttribute::BOUND
142 | beans::PropertyAttribute::MAYBEDEFAULT );
144 rOutProperties.emplace_back(
"StackCharacters",
145 PROP_AXIS_TEXT_STACKED,
147 beans::PropertyAttribute::BOUND
148 | beans::PropertyAttribute::MAYBEDEFAULT );
150 rOutProperties.emplace_back(
"ArrangeOrder",
151 PROP_AXIS_TEXT_ARRANGE_ORDER,
153 beans::PropertyAttribute::BOUND
154 | beans::PropertyAttribute::MAYBEDEFAULT );
156 rOutProperties.emplace_back(
"ReferencePageSize",
157 PROP_AXIS_REFERENCE_DIAGRAM_SIZE,
159 beans::PropertyAttribute::BOUND
160 | beans::PropertyAttribute::MAYBEVOID );
162 rOutProperties.emplace_back(
"MajorTickmarks",
163 PROP_AXIS_MAJOR_TICKMARKS,
165 beans::PropertyAttribute::BOUND
166 | beans::PropertyAttribute::MAYBEDEFAULT );
168 rOutProperties.emplace_back(
"MinorTickmarks",
169 PROP_AXIS_MINOR_TICKMARKS,
171 beans::PropertyAttribute::BOUND
172 | beans::PropertyAttribute::MAYBEDEFAULT );
174 rOutProperties.emplace_back(
"MarkPosition",
175 PROP_AXIS_MARK_POSITION,
177 beans::PropertyAttribute::MAYBEDEFAULT );
180 rOutProperties.emplace_back(
"DisplayUnits",
181 PROP_AXIS_DISPLAY_UNITS,
183 beans::PropertyAttribute::BOUND
184 | beans::PropertyAttribute::MAYBEDEFAULT );
187 rOutProperties.emplace_back(
"BuiltInUnit",
188 PROP_AXIS_BUILTINUNIT,
190 beans::PropertyAttribute::BOUND
191 | beans::PropertyAttribute::MAYBEDEFAULT );
195 rOutProperties.emplace_back(
"TryStaggeringFirst",
196 PROP_AXIS_TRY_STAGGERING_FIRST,
198 beans::PropertyAttribute::BOUND
199 | beans::PropertyAttribute::MAYBEDEFAULT );
201 rOutProperties.emplace_back(
"MajorOrigin",
202 PROP_AXIS_MAJOR_ORIGIN,
204 beans::PropertyAttribute::BOUND
205 | beans::PropertyAttribute::MAYBEVOID );
225 ::chart::PropertyHelper::setPropertyValueDefault< double >(
aMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
231 float fDefaultCharHeight = 10.0;
236 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >(
aMap, PROP_AXIS_MAJOR_TICKMARKS, 2 );
237 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >(
aMap, PROP_AXIS_MINOR_TICKMARKS, 0 );
243 return aStaticDefaults;
251 static ::cppu::OPropertyArrayHelper aPropHelper = []()
254 lcl_AddPropertiesToVector( aProperties );
267std::vector< rtl::Reference< ::chart::GridProperties > > lcl_CloneSubGrids(
270 std::vector< rtl::Reference< ::chart::GridProperties > > aDestination;
271 aDestination.reserve( rSource.size());
274 aDestination.push_back(new ::chart::GridProperties(*i));
286 m_aScaleData(
AxisHelper::createDefaultScale() ),
306 m_aScaleData( rOther.m_aScaleData )
346 catch(
const uno::Exception & )
360 std::vector< rtl::Reference< GridProperties > > aOldBroadcasters;
361 std::vector< rtl::Reference< GridProperties > > aNewBroadcasters;
365 xEventListener =
this;
367 sal_Int32 nNewSubIncCount =
m_aScaleData.IncrementData.SubIncrements.getLength();
370 if( nOldSubIncCount > nNewSubIncCount )
373 for( sal_Int32
i = nNewSubIncCount;
i < nOldSubIncCount; ++
i )
377 else if( nOldSubIncCount < nNewSubIncCount )
382 for( sal_Int32
i = nOldSubIncCount;
i < nNewSubIncCount; ++
i )
392 for (
auto const& oldBroadcaster : aOldBroadcasters)
394 for (
auto const& newBroadcaster : aNewBroadcasters)
408 xEventListener =
this;
415 if( xOldCategories.is() && xOldCategories != xNewCategories )
420 if( xNewCategories.is() && xOldCategories != xNewCategories )
458 OSL_FAIL(
"Not implemented yet" );
478 assert(!xNewTitle || xTitle);
484 Reference< util::XModifyListener > xModifyEventForwarder;
494 if( xOldTitle.is() && xOldTitle != xNewTitle )
496 if( xNewTitle.is() && xOldTitle != xNewTitle )
549 tPropertyValueMap::const_iterator aFound( rStaticDefaults.find(
nHandle ) );
550 if( aFound == rStaticDefaults.end() )
553 rAny = (*aFound).second;
558 return StaticAxisInfoHelper();
566 return xPropertySetInfo;
575OUString SAL_CALL
Axis::getImplementationName()
577 return "com.sun.star.comp.chart2.Axis";
588 "com.sun.star.chart2.Axis",
589 "com.sun.star.beans.PropertySet" };
594extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
596 css::uno::Sequence<css::uno::Any>
const &)
598 return cppu::acquire(new ::chart::Axis);
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart2_Axis_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
PropertiesInfo aProperties
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
rtl::Reference< ::chart::GridProperties > m_xGrid
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getGridProperties() override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void firePropertyChangeEvent() override
implement this method in derived classes to get called when properties change.
css::chart2::ScaleData m_aScaleData
virtual css::chart2::ScaleData SAL_CALL getScaleData() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
The InfoHelper table contains all property names and types of this object.
std::vector< rtl::Reference< ::chart::GridProperties > > m_aSubGridProperties
rtl::Reference< ::chart::GridProperties > getGridProperties2()
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const override
implement this method to provide default values for all properties supporting defaults.
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
std::vector< rtl::Reference< ::chart::GridProperties > > getSubGridProperties2()
virtual void SAL_CALL setScaleData(const css::chart2::ScaleData &rScaleData) override
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
rtl::Reference< ::chart::Title > getTitleObject2() const
rtl::Reference< ModifyEventForwarder > m_xModifyEventForwarder
virtual void SAL_CALL setTitleObject(const css::uno::Reference< css::chart2::XTitle > &Title) override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > SAL_CALL getSubTickProperties() override
virtual css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > SAL_CALL getSubGridProperties() override
virtual css::uno::Reference< css::chart2::XTitle > SAL_CALL getTitleObject() override
rtl::Reference< ::chart::Title > m_xTitle
This helper class serves as forwarder of modify events.
mutable::osl::Mutex m_aMutex
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
void SAL_CALL disposing()
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
The same as setFastPropertyValue; nHandle is always valid.
#define DBG_UNHANDLED_EXCEPTION(...)
OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap(::chart::tPropertyValueMap &rOutMap)
@ PROP_CHAR_COMPLEX_CHAR_HEIGHT
@ PROP_CHAR_ASIAN_CHAR_HEIGHT
OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(std::vector< css::beans::Property > &rOutProperties)
void addListener(const InterfaceRef &xObject, const css::uno::Reference< css::lang::XEventListener > &xListener)
void removeListener(const InterfaceRef &xObject, const css::uno::Reference< css::lang::XEventListener > &xListener)
void SetLineColor(const css::uno::Reference< css::beans::XPropertySet > &xGridProperties, sal_Int32 nColor)
void SetLineInvisible(const css::uno::Reference< css::beans::XPropertySet > &xLineProperties)
void removeListener(const InterfaceRef &xObject, const css::uno::Reference< css::util::XModifyListener > &xListener)
void removeListenerFromAllElements(const Container &rContainer, const css::uno::Reference< css::util::XModifyListener > &xListener)
void addListenerToAllElements(const Container &rContainer, const css::uno::Reference< css::util::XModifyListener > &xListener)
void addListener(const InterfaceRef &xObject, const css::uno::Reference< css::util::XModifyListener > &xListener)
void setPropertyValueDefault(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Calls setPropertyValue() but asserts that the given property hasn't been set before.
void setPropertyValue(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Set a property to a certain value in the given map.
::cppu::WeakImplHelper< css::chart2::XAxis, css::chart2::XTitled, css::lang::XServiceInfo, css::util::XCloneable, css::util::XModifyBroadcaster, css::util::XModifyListener > Axis_Base
std::unordered_map< tPropertyValueMapKey, css::uno::Any > tPropertyValueMap
OOO_DLLPUBLIC_CHARTTOOLSconst ::chart::tPropertyValueMap & StaticAxisDefaults()
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
HashMap_OWString_Interface aMap
constexpr OUStringLiteral CHART_UNONAME_LINK_TO_SRC_NUMFMT
constexpr OUStringLiteral CHART_UNONAME_NUMFMT