31#include <com/sun/star/uno/XComponentContext.hpp>
33#include <com/sun/star/beans/PropertyAttribute.hpp>
34#include <com/sun/star/drawing/LineStyle.hpp>
43using ::com::sun::star::uno::Reference;
44using ::com::sun::star::uno::Sequence;
45using ::com::sun::star::beans::Property;
52 PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
53 PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
54 PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH,
55 PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE
58void lcl_AddPropertiesToVector(
59 std::vector< Property > & rOutProperties )
61 rOutProperties.emplace_back(
"Volume",
62 PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
64 beans::PropertyAttribute::BOUND
65 | beans::PropertyAttribute::MAYBEDEFAULT );
66 rOutProperties.emplace_back(
"Open",
67 PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
69 beans::PropertyAttribute::BOUND
70 | beans::PropertyAttribute::MAYBEDEFAULT );
71 rOutProperties.emplace_back(
"LowHigh",
72 PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH,
74 beans::PropertyAttribute::BOUND
75 | beans::PropertyAttribute::MAYBEDEFAULT );
76 rOutProperties.emplace_back(
"Japanese",
77 PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE,
79 beans::PropertyAttribute::BOUND
80 | beans::PropertyAttribute::MAYBEDEFAULT );
94 return aStaticDefaults;
99 static ::cppu::OPropertyArrayHelper aPropHelper =
102 lcl_AddPropertiesToVector( aProperties );
113uno::Reference< beans::XPropertySetInfo >& GetStaticStockChartTypeTemplateInfo()
115 static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
117 return xPropertySetInfo;
127 uno::XComponentContext >
const & xContext,
128 const OUString & rServiceName,
130 bool bJapaneseStyle ) :
132 m_eStockVariant( eVariant )
135 PROP_STOCKCHARTTYPE_TEMPLATE_OPEN,
139 PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME,
143 PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE,
153 const tPropertyValueMap& rStaticDefaults = GetStaticStockChartTypeTemplateDefaults();
154 tPropertyValueMap::const_iterator aFound( rStaticDefaults.find(
nHandle ) );
155 if( aFound == rStaticDefaults.end() )
158 rAny = (*aFound).second;
163 return GetStaticStockChartTypeTemplateInfoHelper();
169 return GetStaticStockChartTypeTemplateInfo();
175 if( nDimension <= 0 )
178 if( nDimension >= 2 )
182 OSL_ASSERT( nDimension == 1 );
183 bool bHasVolume =
false;
185 return bHasVolume ? 2 : 1;
190 ::sal_Int32 nChartTypeIndex,
191 ::sal_Int32 nSeriesIndex,
192 ::sal_Int32 nSeriesCount )
197 sal_Int32 nNewAxisIndex = 0;
199 bool bHasVolume =
false;
201 if( bHasVolume && nChartTypeIndex != 0 )
204 xSeries->setPropertyValue(
"AttachedAxisIndex",
uno::Any( nNewAxisIndex ) );
206 if( bHasVolume && nChartTypeIndex==0 )
214 drawing::LineStyle eStyle = drawing::LineStyle_NONE;
215 xSeries->getPropertyValue(
"LineStyle" ) >>= eStyle;
216 if( eStyle == drawing::LineStyle_NONE )
217 xSeries->setPropertyValue(
"LineStyle",
uno::Any( drawing::LineStyle_SOLID ));
221 catch(
const uno::Exception & )
233 std::vector< rtl::Reference< DataSeries > > aSeriesVec =
234 xDiagram->getDataSeries();
235 for (
auto const& series : aSeriesVec)
237 series->setPropertyValue(
"AttachedAxisIndex",
uno::Any( sal_Int32(0) ) );
241 xDiagram->setVertical(
false );
247 bool bHasVolume =
false;
251 if( nChartTypeIndex == 0 )
253 else if( nChartTypeIndex == 1 )
260 if( nChartTypeIndex == 0 )
273 if( rCoordSys.empty() )
278 bool bHasVolume =
false;
279 bool bShowFirst =
false;
280 bool bJapaneseStyle =
false;
281 bool bShowHighLow =
true;
288 std::size_t nSeriesIndex = 0;
290 std::vector< rtl::Reference< ChartType > > aChartTypeVec;
296 aChartTypeVec.push_back( xCT );
298 if( aSeriesSeq.size() > nSeriesIndex &&
299 !aSeriesSeq[nSeriesIndex].empty() )
301 xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
307 aChartTypeVec.push_back( xCT );
309 xCT->setPropertyValue(
"Japanese",
uno::Any( bJapaneseStyle ));
310 xCT->setPropertyValue(
"ShowFirst",
uno::Any( bShowFirst ));
311 xCT->setPropertyValue(
"ShowHighLow",
uno::Any( bShowHighLow ));
313 if( aSeriesSeq.size() > nSeriesIndex &&
314 !aSeriesSeq[ nSeriesIndex ].empty() )
316 xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
321 if( aSeriesSeq.size() > nSeriesIndex &&
322 !aSeriesSeq[ nSeriesIndex ].empty() )
325 aChartTypeVec.push_back( xCT );
327 xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
330 rCoordSys[ 0 ]->setChartTypes( aChartTypeVec );
332 catch(
const uno::Exception & )
343 bool bResult =
false;
350 bool bHasVolume =
false, bHasOpenValue =
false, bHasJapaneseStyle =
false;
359 sal_Int32 nNumberOfChartTypes = 0;
365 ++nNumberOfChartTypes;
366 if( nNumberOfChartTypes > 3 )
368 OUString aCTService = chartType->getChartType();
370 xVolumeChartType = chartType;
372 xCandleStickChartType = chartType;
374 xLineChartType = chartType;
376 if( nNumberOfChartTypes > 3 )
380 if (xCandleStickChartType.is() && bHasVolume == xVolumeChartType.is())
385 bool bJapaneseProp =
false;
386 xCandleStickChartType->getPropertyValue(
"Japanese") >>= bJapaneseProp;
387 bResult = bResult && ( bHasJapaneseStyle == bJapaneseProp );
390 bool bShowFirstProp =
false;
391 xCandleStickChartType->getPropertyValue(
"ShowFirst") >>= bShowFirstProp;
392 bResult = bResult && ( bHasOpenValue == bShowFirstProp );
395 catch(
const uno::Exception & )
413 catch(
const uno::Exception & )
PropertiesInfo aProperties
For creating diagrams and modifying existing diagrams.
virtual sal_Int32 getDimension() const
returns 2 by default. Supported are 2 and 3
static void copyPropertiesFromOldToNewCoordinateSystem(const std::vector< rtl::Reference< ChartType > > &rOldChartTypesSeq, const rtl::Reference< ChartType > &xNewChartType)
rtl::Reference< ::chart::DataInterpreter > m_xDataInterpreter
virtual void applyStyle2(const rtl::Reference< ::chart::DataSeries > &xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount)
virtual void resetStyles2(const rtl::Reference< ::chart::Diagram > &xDiagram)
virtual bool matchesTemplate2(const rtl::Reference< ::chart::Diagram > &xDiagram, bool bAdaptProperties) override
virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override
StockVariant m_eStockVariant
virtual void createChartTypes(const std::vector< std::vector< rtl::Reference< ::chart::DataSeries > > > &aSeriesSeq, const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &rCoordSys, const std::vector< rtl::Reference< ChartType > > &aOldChartTypesSeq) override
create a data series tree, that fits the requirements of the chart type.
virtual ~StockChartTypeTemplate() override
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const override
merge XInterface implementations
virtual rtl::Reference< ::chart::ChartType > getChartTypeForIndex(sal_Int32 nChartTypeIndex) override
StockChartTypeTemplate(css::uno::Reference< css::uno::XComponentContext > const &xContext, const OUString &rServiceName, StockVariant eVariant, bool bJapaneseStyle)
CTOR.
virtual rtl::Reference< ::chart::ChartType > getChartTypeForNewSeries2(const std::vector< rtl::Reference< ::chart::ChartType > > &aFormerlyUsedChartTypes) override
virtual void applyStyle2(const rtl::Reference< ::chart::DataSeries > &xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
The InfoHelper table contains all property names and types of this object.
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void resetStyles2(const rtl::Reference< ::chart::Diagram > &xDiagram) override
virtual sal_Int32 getAxisCountByDimension(sal_Int32 nDimension) override
Give the number of requested axis per dimension here.
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
The same as getFastPropertyValue, but return the value through rValue and nHandle is always valid.
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 setPropertyAlsoToAllAttributedDataPoints(const rtl::Reference< ::chart::DataSeries > &xSeries, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
void setPropertyValueDefault(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Calls setPropertyValue() but asserts that the given property hasn't been set before.
std::unordered_map< tPropertyValueMapKey, css::uno::Any > tPropertyValueMap
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_LINE