1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "BubbleChartTypeTemplate.hxx"
21 #include "BubbleChartType.hxx"
22 #include "BubbleDataInterpreter.hxx"
23 #include <DataSeries.hxx>
24 #include <DataSeriesHelper.hxx>
25 #include <com/sun/star/drawing/LineStyle.hpp>
26 #include <PropertyHelper.hxx>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <comphelper/diagnose_ex.hxx>
32 using namespace ::com::sun::star
;
34 using ::com::sun::star::uno::Reference
;
35 using ::com::sun::star::uno::Sequence
;
36 using ::com::sun::star::beans::Property
;
41 ::cppu::OPropertyArrayHelper
& StaticBubbleChartTypeTemplateInfoHelper()
43 static ::cppu::OPropertyArrayHelper aPropHelper
= []()
45 std::vector
< css::beans::Property
> aProperties
;
46 std::sort( aProperties
.begin(), aProperties
.end(),
47 ::chart::PropertyNameLess() );
48 return comphelper::containerToSequence( aProperties
);
53 } // anonymous namespace
58 BubbleChartTypeTemplate::BubbleChartTypeTemplate(
60 uno::XComponentContext
> const & xContext
,
61 const OUString
& rServiceName
) :
62 ChartTypeTemplate( xContext
, rServiceName
)
66 BubbleChartTypeTemplate::~BubbleChartTypeTemplate()
69 // ____ OPropertySet ____
70 void BubbleChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle
, uno::Any
& rAny
) const
72 static ::chart::tPropertyValueMap aStaticDefaults
;
73 tPropertyValueMap::const_iterator
aFound( aStaticDefaults
.find( nHandle
) );
74 if( aFound
== aStaticDefaults
.end() )
77 rAny
= (*aFound
).second
;
80 ::cppu::IPropertyArrayHelper
& SAL_CALL
BubbleChartTypeTemplate::getInfoHelper()
82 return StaticBubbleChartTypeTemplateInfoHelper();
85 // ____ XPropertySet ____
86 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
BubbleChartTypeTemplate::getPropertySetInfo()
88 static const uno::Reference
< beans::XPropertySetInfo
> xPropertySetInfo(
89 ::cppu::OPropertySetHelper::createPropertySetInfo(StaticBubbleChartTypeTemplateInfoHelper() ) );
90 return xPropertySetInfo
;
93 sal_Int32
BubbleChartTypeTemplate::getDimension() const
98 StackMode
BubbleChartTypeTemplate::getStackMode( sal_Int32
/* nChartTypeIndex */ ) const
100 return StackMode::NONE
;
103 void BubbleChartTypeTemplate::applyStyle2(
104 const rtl::Reference
< DataSeries
>& xSeries
,
105 ::sal_Int32 nChartTypeIndex
,
106 ::sal_Int32 nSeriesIndex
,
107 ::sal_Int32 nSeriesCount
)
109 ChartTypeTemplate::applyStyle2( xSeries
, nChartTypeIndex
, nSeriesIndex
, nSeriesCount
);
110 DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries
, u
"BorderStyle"_ustr
, uno::Any( drawing::LineStyle_NONE
) );
113 // ____ XChartTypeTemplate ____
114 sal_Bool SAL_CALL
BubbleChartTypeTemplate::supportsCategories()
119 rtl::Reference
< ChartType
> BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32
/*nChartTypeIndex*/ )
121 return new BubbleChartType();
124 rtl::Reference
< ChartType
> BubbleChartTypeTemplate::getChartTypeForNewSeries2(
125 const std::vector
< rtl::Reference
< ChartType
> >& aFormerlyUsedChartTypes
)
127 rtl::Reference
< ChartType
> xResult
;
131 xResult
= new BubbleChartType();
133 ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes
, xResult
);
135 catch( const uno::Exception
& )
137 DBG_UNHANDLED_EXCEPTION("chart2");
143 rtl::Reference
< DataInterpreter
> BubbleChartTypeTemplate::getDataInterpreter2()
145 if( ! m_xDataInterpreter
.is())
146 m_xDataInterpreter
.set( new BubbleDataInterpreter
);
148 return m_xDataInterpreter
;
151 IMPLEMENT_FORWARD_XINTERFACE2( BubbleChartTypeTemplate
, ChartTypeTemplate
, OPropertySet
)
152 IMPLEMENT_FORWARD_XTYPEPROVIDER2( BubbleChartTypeTemplate
, ChartTypeTemplate
, OPropertySet
)
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */