Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #include "MultipleChartConverters.hxx"
21 : :
22 : : #include "chartview/ChartSfxItemIds.hxx"
23 : : #include "SchWhichPairs.hxx"
24 : : #include "AxisItemConverter.hxx"
25 : : #include "StatisticsItemConverter.hxx"
26 : : #include "GraphicPropertyItemConverter.hxx"
27 : : #include "DataPointItemConverter.hxx"
28 : : #include "ChartModelHelper.hxx"
29 : : #include "TitleHelper.hxx"
30 : : #include "TitleItemConverter.hxx"
31 : : #include "AxisHelper.hxx"
32 : : #include "chartview/ExplicitValueProvider.hxx"
33 : : #include "DiagramHelper.hxx"
34 : :
35 : : using namespace ::com::sun::star;
36 : : using namespace ::com::sun::star::chart2;
37 : : using ::com::sun::star::uno::Reference;
38 : : using ::com::sun::star::uno::Sequence;
39 : :
40 : : namespace chart
41 : : {
42 : : namespace wrapper
43 : : {
44 : :
45 : : //-----------------------------------------------------------------------------
46 : :
47 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
48 : 0 : AllAxisItemConverter::AllAxisItemConverter(
49 : : const uno::Reference< frame::XModel > & xChartModel,
50 : : SfxItemPool& rItemPool,
51 : : SdrModel& rDrawModel,
52 : : const uno::Reference< lang::XMultiServiceFactory > & /*xNamedPropertyContainerFactory*/,
53 : : ::std::auto_ptr< awt::Size > pRefSize )
54 : 0 : : MultipleItemConverter( rItemPool )
55 : : {
56 [ # # ]: 0 : Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
57 [ # # ]: 0 : Sequence< Reference< XAxis > > aElementList( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
58 [ # # ]: 0 : for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
59 : : {
60 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY);
61 [ # # ]: 0 : if( pRefSize.get())
62 : : m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter(
63 : : xObjectProperties, rItemPool, rDrawModel,
64 : : uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), 0, 0,
65 [ # # ][ # # ]: 0 : ::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize )) ));
[ # # ][ # # ]
[ # # ]
66 : : else
67 : : m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter(
68 : : xObjectProperties, rItemPool, rDrawModel,
69 [ # # ][ # # ]: 0 : uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), 0, 0 ) );
[ # # ][ # # ]
70 [ # # ]: 0 : }
71 : 0 : }
72 : : SAL_WNODEPRECATED_DECLARATIONS_POP
73 : :
74 : 0 : AllAxisItemConverter::~AllAxisItemConverter()
75 : : {
76 [ # # ]: 0 : }
77 : :
78 : 0 : const sal_uInt16 * AllAxisItemConverter::GetWhichPairs() const
79 : : {
80 : : // must span all used items!
81 : 0 : return nAllAxisWhichPairs;
82 : : }
83 : :
84 : : //-----------------------------------------------------------------------------
85 : :
86 : 0 : AllGridItemConverter::AllGridItemConverter(
87 : : const uno::Reference< frame::XModel > & xChartModel,
88 : : SfxItemPool& rItemPool,
89 : : SdrModel& rDrawModel,
90 : : const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory )
91 : 0 : : MultipleItemConverter( rItemPool )
92 : : {
93 [ # # ]: 0 : Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
94 [ # # ]: 0 : Sequence< Reference< beans::XPropertySet > > aElementList( AxisHelper::getAllGrids( xDiagram ) );
95 [ # # ]: 0 : for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
96 : : {
97 [ # # ]: 0 : Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]);
98 : : m_aConverters.push_back( new ::chart::wrapper::GraphicPropertyItemConverter(
99 : : xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
100 [ # # ][ # # ]: 0 : ::chart::wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES ) );
[ # # ]
101 [ # # ]: 0 : }
102 : 0 : }
103 : :
104 : 0 : AllGridItemConverter::~AllGridItemConverter()
105 : : {
106 [ # # ]: 0 : }
107 : :
108 : 0 : const sal_uInt16 * AllGridItemConverter::GetWhichPairs() const
109 : : {
110 : : // must span all used items!
111 : 0 : return nGridWhichPairs;
112 : : }
113 : :
114 : : //-----------------------------------------------------------------------------
115 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
116 : 0 : AllDataLabelItemConverter::AllDataLabelItemConverter(
117 : : const uno::Reference< frame::XModel > & xChartModel,
118 : : SfxItemPool& rItemPool,
119 : : SdrModel& rDrawModel,
120 : : const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
121 : : ::std::auto_ptr< awt::Size > pRefSize )
122 : 0 : : MultipleItemConverter( rItemPool )
123 : : {
124 : : ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
125 [ # # ]: 0 : ::chart::ChartModelHelper::getDataSeries( xChartModel ));
126 : :
127 : 0 : ::std::vector< uno::Reference< chart2::XDataSeries > >::const_iterator aIt;
128 [ # # ][ # # ]: 0 : for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
[ # # ]
129 : : {
130 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
131 [ # # ]: 0 : uno::Reference< uno::XComponentContext> xContext(0);//do not need Context for label properties
132 : :
133 [ # # ][ # # ]: 0 : sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties, *aIt, -1/*nPointIndex*/, ChartModelHelper::findDiagram( xChartModel ) );
134 : : sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
135 [ # # ][ # # ]: 0 : xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
136 : :
137 : : m_aConverters.push_back( new ::chart::wrapper::DataPointItemConverter(
138 : : xChartModel, xContext,
139 : : xObjectProperties, *aIt, rItemPool, rDrawModel, NULL,
140 : : xNamedPropertyContainerFactory,
141 : : GraphicPropertyItemConverter::FILLED_DATA_POINT,
142 : 0 : ::std::auto_ptr< awt::Size >( pRefSize.get() ? new awt::Size( *pRefSize ) : 0),
143 : : true, /*bDataSeries*/
144 : : false, /*bUseSpecialFillColor*/
145 : : 0, /*nSpecialFillColor*/
146 : : true /*bOverwriteLabelsForAttributedDataPointsAlso*/,
147 : : nNumberFormat, nPercentNumberFormat
148 [ # # ][ # # ]: 0 : ));
[ # # ][ # # ]
[ # # ]
149 : 0 : }
150 : 0 : }
151 : : SAL_WNODEPRECATED_DECLARATIONS_POP
152 : :
153 : 0 : AllDataLabelItemConverter::~AllDataLabelItemConverter()
154 : : {
155 [ # # ]: 0 : }
156 : :
157 : 0 : const sal_uInt16 * AllDataLabelItemConverter::GetWhichPairs() const
158 : : {
159 : : // must span all used items!
160 : 0 : return nDataLabelWhichPairs;
161 : : }
162 : :
163 : : //-----------------------------------------------------------------------------
164 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
165 : 0 : AllTitleItemConverter::AllTitleItemConverter(
166 : : const uno::Reference< frame::XModel > & xChartModel,
167 : : SfxItemPool& rItemPool,
168 : : SdrModel& rDrawModel,
169 : : const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
170 : : ::std::auto_ptr< awt::Size > pRefSize )
171 : 0 : : MultipleItemConverter( rItemPool )
172 : : {
173 [ # # ]: 0 : for(sal_Int32 nTitle = TitleHelper::TITLE_BEGIN; nTitle < TitleHelper::NORMAL_TITLE_END; nTitle++ )
174 : : {
175 [ # # ]: 0 : uno::Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( TitleHelper::eTitleType(nTitle), xChartModel ) );
176 [ # # ]: 0 : if(!xTitle.is())
177 : 0 : continue;
178 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY);
179 : 0 : ::std::auto_ptr< awt::Size > pSingleRefSize(0);
180 [ # # ]: 0 : if( pRefSize.get())
181 [ # # ]: 0 : pSingleRefSize = ::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize ));
182 : : m_aConverters.push_back( new ::chart::wrapper::TitleItemConverter(
183 [ # # ][ # # ]: 0 : xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, pSingleRefSize ));
[ # # ]
184 [ # # ]: 0 : }
185 : 0 : }
186 : : SAL_WNODEPRECATED_DECLARATIONS_POP
187 : :
188 : 0 : AllTitleItemConverter::~AllTitleItemConverter()
189 : : {
190 [ # # ]: 0 : }
191 : :
192 : 0 : const sal_uInt16 * AllTitleItemConverter::GetWhichPairs() const
193 : : {
194 : : // must span all used items!
195 : 0 : return nTitleWhichPairs;
196 : : }
197 : :
198 : : //-----------------------------------------------------------------------------
199 : :
200 : 0 : AllSeriesStatisticsConverter::AllSeriesStatisticsConverter(
201 : : const uno::Reference< frame::XModel > & xChartModel,
202 : : SfxItemPool& rItemPool )
203 : 0 : : MultipleItemConverter( rItemPool )
204 : : {
205 : : ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
206 [ # # ]: 0 : ::chart::ChartModelHelper::getDataSeries( xChartModel ));
207 : :
208 : 0 : ::std::vector< uno::Reference< chart2::XDataSeries > >::const_iterator aIt;
209 [ # # ][ # # ]: 0 : for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
[ # # ]
210 : : {
211 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
212 : : m_aConverters.push_back( new ::chart::wrapper::StatisticsItemConverter(
213 [ # # ][ # # ]: 0 : xChartModel, xObjectProperties, rItemPool ));
[ # # ]
214 : 0 : }
215 : 0 : }
216 : :
217 : 0 : AllSeriesStatisticsConverter::~AllSeriesStatisticsConverter()
218 [ # # ]: 0 : {}
219 : :
220 : 0 : const sal_uInt16 * AllSeriesStatisticsConverter::GetWhichPairs() const
221 : : {
222 : : // must span all used items!
223 : 0 : return nStatWhichPairs;
224 : : }
225 : :
226 : : } // namespace wrapper
227 : : } // namespace chart
228 : :
229 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|