32#include <com/sun/star/beans/PropertyAttribute.hpp>
33#include <com/sun/star/drawing/LineStyle.hpp>
34#include <com/sun/star/uno/XComponentContext.hpp>
42using ::com::sun::star::uno::Reference;
43using ::com::sun::star::uno::Sequence;
44using ::com::sun::star::beans::Property;
51 PROP_COL_LINE_NUMBER_OF_LINES
60 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_COL_LINE_NUMBER_OF_LINES, 1 );
63 return aStaticDefaults;
68 static ::cppu::OPropertyArrayHelper aPropHelper(
73 PROP_COL_LINE_NUMBER_OF_LINES,
75 beans::PropertyAttribute::BOUND
76 | beans::PropertyAttribute::MAYBEDEFAULT } };
86uno::Reference< beans::XPropertySetInfo >& StaticColumnLineChartTypeTemplateInfo()
88 static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
90 return xPropertySetInfo;
100 uno::XComponentContext >
const & xContext,
101 const OUString & rServiceName,
103 sal_Int32 nNumberOfLines ) :
116 const tPropertyValueMap& rStaticDefaults = StaticColumnLineChartTypeTemplateDefaults();
117 tPropertyValueMap::const_iterator aFound( rStaticDefaults.find(
nHandle ) );
118 if( aFound == rStaticDefaults.end() )
121 rAny = (*aFound).second;
126 return StaticColumnLineChartTypeTemplateInfoHelper();
132 return StaticColumnLineChartTypeTemplateInfo();
140 if( rCoordSys.empty() )
145 const std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq(
FlattenSequence( aSeriesSeq ));
146 sal_Int32 nNumberOfSeries = aFlatSeriesSeq.size();
147 sal_Int32 nNumberOfLines = 0;
148 sal_Int32 nNumberOfColumns = 0;
151 OSL_ENSURE( nNumberOfLines>=0,
"number of lines should be not negative" );
152 if( nNumberOfLines < 0 )
155 if( nNumberOfLines >= nNumberOfSeries )
157 if( nNumberOfSeries > 0 )
159 nNumberOfLines = nNumberOfSeries - 1;
160 nNumberOfColumns = 1;
166 nNumberOfColumns = nNumberOfSeries - nNumberOfLines;
174 rCoordSys[ 0 ]->setChartTypes( std::vector{xCT} );
176 if( nNumberOfColumns > 0 )
178 std::vector< rtl::Reference< DataSeries > > aColumnSeq( nNumberOfColumns );
179 std::copy( aFlatSeriesSeq.begin(),
180 aFlatSeriesSeq.begin() + nNumberOfColumns,
182 xCT->setDataSeries( aColumnSeq );
188 rCoordSys[ 0 ]->addChartType( xCT );
190 if( nNumberOfLines > 0 )
192 std::vector< rtl::Reference< DataSeries > > aLineSeq( nNumberOfLines );
193 std::copy( aFlatSeriesSeq.begin() + nNumberOfColumns,
194 aFlatSeriesSeq.end(),
196 xCT->setDataSeries( aLineSeq );
199 catch(
const uno::Exception & )
207 ::sal_Int32 nChartTypeIndex,
208 ::sal_Int32 nSeriesIndex,
209 ::sal_Int32 nSeriesCount )
213 if( nChartTypeIndex==0 )
217 else if( nChartTypeIndex==1 )
227 if( nChartTypeIndex == 0 )
235 bool bAdaptProperties )
237 bool bResult =
false;
247 sal_Int32 nNumberOfChartTypes = 0;
251 const std::vector< rtl::Reference< ChartType > > aChartTypeSeq( coords->getChartTypes2());
254 ++nNumberOfChartTypes;
255 if( nNumberOfChartTypes > 2 )
257 OUString aCTService = chartType->getChartType();
260 xColumnChartType = chartType;
261 xColumnChartCooSys = coords;
264 xLineChartType = chartType;
266 if( nNumberOfChartTypes > 2 )
270 if( nNumberOfChartTypes == 2 &&
271 xColumnChartType.is() &&
274 OSL_ASSERT( xColumnChartCooSys.is());
277 bResult = (xColumnChartCooSys->getDimension() ==
getDimension());
281 bool bAmbiguous=
false;
283 xColumnChartType, bFound, bAmbiguous,
287 if( bResult && bAdaptProperties )
289 if( xLineChartType.is() )
291 sal_Int32 nNumberOfLines = xLineChartType->getDataSeries().getLength();
298 catch(
const uno::Exception & )
308 if( nChartTypeIndex == 0 )
324 catch(
const uno::Exception & )
336 sal_Int32 nNumberOfLines = 1;
343 OSL_FAIL(
"number of lines may not be valid anymore in the datainterpreter" );
const StackMode m_eStackMode
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 bool matchesTemplate2(const rtl::Reference< ::chart::Diagram > &xDiagram, bool bAdaptProperties) override
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 void applyStyle2(const rtl::Reference< ::chart::DataSeries > &xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
ColumnLineChartTypeTemplate(css::uno::Reference< css::uno::XComponentContext > const &xContext, const OUString &rServiceName, StackMode eStackMode, sal_Int32 nNumberOfLines)
virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override
virtual ~ColumnLineChartTypeTemplate() override
virtual StackMode getStackMode(sal_Int32 nChartTypeIndex) const override
returns StackMode::NONE by default.
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
The InfoHelper table contains all property names and types of this object.
virtual rtl::Reference< ::chart::ChartType > getChartTypeForIndex(sal_Int32 nChartTypeIndex) override
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const override
merge XInterface implementations
virtual rtl::Reference< ::chart::ChartType > getChartTypeForNewSeries2(const std::vector< rtl::Reference< ::chart::ChartType > > &aFormerlyUsedChartTypes) override
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.
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
css::uno::Type const & get()
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 switchLinesOnOrOff(const rtl::Reference< ::chart::DataSeries > &xSeries, bool bLinesOn)
OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints(const rtl::Reference< ::chart::DataSeries > &xSeries, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
OOO_DLLPUBLIC_CHARTTOOLS void makeLinesThickOrThin(const rtl::Reference< ::chart::DataSeries > &xSeries, bool bThick)
OOO_DLLPUBLIC_CHARTTOOLS void switchSymbolsOnOrOff(const rtl::Reference< ::chart::DataSeries > &xSeries, bool bSymbolsOn, sal_Int32 nSeriesIndex)
std::unordered_map< tPropertyValueMapKey, css::uno::Any > tPropertyValueMap
std::vector< T > FlattenSequence(const std::vector< std::vector< T > > &aSeqSeq)
std::vector< std::vector< T > > -> std::vector< T >
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_LINE