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 "VCoordinateSystem.hxx"
21 : : #include "VCartesianCoordinateSystem.hxx"
22 : : #include "VPolarCoordinateSystem.hxx"
23 : : #include "ScaleAutomatism.hxx"
24 : : #include "VSeriesPlotter.hxx"
25 : : #include "ShapeFactory.hxx"
26 : : #include "servicenames_coosystems.hxx"
27 : : #include "macros.hxx"
28 : : #include "AxisIndexDefines.hxx"
29 : : #include "ObjectIdentifier.hxx"
30 : : #include "ExplicitCategoriesProvider.hxx"
31 : : #include "AxisHelper.hxx"
32 : : #include "ContainerHelper.hxx"
33 : : #include "VAxisBase.hxx"
34 : : #include "ViewDefines.hxx"
35 : : #include "DataSeriesHelper.hxx"
36 : : #include "chartview/ExplicitValueProvider.hxx"
37 : : #include <com/sun/star/chart2/AxisType.hpp>
38 : : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
39 : : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
40 : :
41 : : #include <rtl/math.hxx>
42 : :
43 : : //.............................................................................
44 : : namespace chart
45 : : {
46 : : //.............................................................................
47 : : using namespace ::com::sun::star;
48 : : using namespace ::com::sun::star::chart2;
49 : : using ::com::sun::star::uno::Reference;
50 : : using ::com::sun::star::uno::Sequence;
51 : :
52 : 982 : VCoordinateSystem* VCoordinateSystem::createCoordinateSystem(
53 : : const Reference< XCoordinateSystem >& xCooSysModel )
54 : : {
55 [ - + ]: 982 : if( !xCooSysModel.is() )
56 : 0 : return 0;
57 : :
58 [ + - ][ + - ]: 982 : rtl::OUString aViewServiceName = xCooSysModel->getViewServiceName();
59 : :
60 : : //@todo: in future the coordinatesystems should be instanciated via service factory
61 : 982 : VCoordinateSystem* pRet=NULL;
62 [ + - ][ + + ]: 982 : if( aViewServiceName.equals( CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ) )
63 [ + - ][ + - ]: 962 : pRet = new VCartesianCoordinateSystem(xCooSysModel);
64 [ + - ][ + - ]: 20 : else if( aViewServiceName.equals( CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME ) )
65 [ + - ][ + - ]: 20 : pRet = new VPolarCoordinateSystem(xCooSysModel);
66 [ - + ]: 982 : if(!pRet)
67 [ # # ][ # # ]: 0 : pRet = new VCoordinateSystem(xCooSysModel);
68 : 982 : return pRet;
69 : : }
70 : :
71 : 982 : VCoordinateSystem::VCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
72 : : : m_xCooSysModel(xCooSys)
73 : : , m_xLogicTargetForGrids(0)
74 : : , m_xLogicTargetForAxes(0)
75 : : , m_xFinalTarget(0)
76 : : , m_xShapeFactory(0)
77 : : , m_aMatrixSceneToScreen()
78 : : , m_eLeftWallPos(CuboidPlanePosition_Left)
79 : : , m_eBackWallPos(CuboidPlanePosition_Back)
80 : : , m_eBottomPos(CuboidPlanePosition_Bottom)
81 : : , m_aMergedMinimumAndMaximumSupplier()
82 : : , m_aExplicitScales(3)
83 : : , m_aExplicitIncrements(3)
84 [ + - ][ + - ]: 982 : , m_apExplicitCategoriesProvider(NULL)
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
85 : : {
86 [ + - ][ + - ]: 982 : if( !m_xCooSysModel.is() || m_xCooSysModel->getDimension()<3 )
[ + + ][ + + ]
[ + - ]
87 : : {
88 [ + - ]: 968 : m_aExplicitScales[2].Minimum = 1.0;
89 [ + - ]: 968 : m_aExplicitScales[2].Maximum = 2.0;
90 [ + - ]: 968 : m_aExplicitScales[2].Orientation = AxisOrientation_MATHEMATICAL;
91 : : }
92 : 982 : }
93 [ + - ][ + - ]: 982 : VCoordinateSystem::~VCoordinateSystem()
[ + - ]
94 : : {
95 [ - + ]: 982 : }
96 : :
97 : 982 : void VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget
98 : : , const Reference< drawing::XShapes >& xFinalTarget
99 : : , const Reference< lang::XMultiServiceFactory >& xShapeFactory
100 : : , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
101 : : throw (uno::RuntimeException)
102 : : {
103 : : OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
104 : : //is only allowed to be called once
105 : :
106 [ + - ][ + - ]: 982 : sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
107 : : //create group shape for grids first thus axes are always painted above grids
108 [ + - ]: 982 : ShapeFactory aShapeFactory(xShapeFactory);
109 [ + + ]: 982 : if(nDimensionCount==2)
110 : : {
111 : : //create and add to target
112 [ + - ][ + - ]: 968 : m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget );
113 [ + - ][ + - ]: 968 : xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup2D( xLogicTarget );
114 [ + - ][ + - ]: 968 : m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget );
115 : : }
116 : : else
117 : : {
118 : : //create and added to target
119 [ + - ][ + - ]: 14 : m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget );
120 [ + - ][ + - ]: 14 : xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup3D( xLogicTarget );
121 [ + - ][ + - ]: 14 : m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget );
122 : : }
123 [ + - ]: 982 : m_xFinalTarget = xFinalTarget;
124 [ + - ][ + - ]: 982 : m_xShapeFactory = xShapeFactory;
125 : 982 : }
126 : :
127 : 982 : void VCoordinateSystem::setParticle( const rtl::OUString& rCooSysParticle )
128 : : {
129 : 982 : m_aCooSysParticle = rCooSysParticle;
130 : 982 : }
131 : :
132 : 3538 : void VCoordinateSystem::setTransformationSceneToScreen(
133 : : const drawing::HomogenMatrix& rMatrix )
134 : : {
135 : 3538 : m_aMatrixSceneToScreen = rMatrix;
136 : :
137 : : //correct transformation for axis
138 : 3538 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
139 : 3538 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
140 [ + + ]: 10547 : for( ; aIt != aEnd; ++aIt )
141 : : {
142 : 7009 : VAxisBase* pVAxis = aIt->second.get();
143 [ + - ]: 7009 : if( pVAxis )
144 : : {
145 [ + - ][ + + ]: 7009 : if(2==pVAxis->getDimensionCount())
146 [ + - ]: 6850 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
147 : : }
148 : : }
149 : 3538 : }
150 : :
151 : 984 : drawing::HomogenMatrix VCoordinateSystem::getTransformationSceneToScreen()
152 : : {
153 : 984 : return m_aMatrixSceneToScreen;
154 : : }
155 : :
156 : : //better performance for big data
157 : 981 : uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
158 : : const awt::Size& rPageSize, const awt::Size& rPageResolution )
159 : : {
160 [ + - ]: 981 : uno::Sequence< sal_Int32 > aResolution(2);
161 : :
162 [ + - ][ + - ]: 981 : sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
163 [ + + ]: 981 : if(nDimensionCount>2)
164 [ + - ]: 14 : aResolution.realloc(nDimensionCount);
165 : 981 : sal_Int32 nN = 0;
166 [ + + ]: 2957 : for( nN = 0 ;nN<aResolution.getLength(); nN++ )
167 [ + - ]: 1976 : aResolution[nN]=1000;
168 : :
169 : : ::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix(
170 : : BaseGFXHelper::HomogenMatrixToB3DHomMatrix(
171 [ + - ][ + - ]: 981 : m_aMatrixSceneToScreen ) ) );
[ + - ]
172 : :
173 : 981 : double fCoosysWidth = static_cast< double >( fabs(aScale.getX()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
174 : 981 : double fCoosysHeight = static_cast< double >( fabs(aScale.getY()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
175 : :
176 : 981 : double fPageWidth = rPageSize.Width;
177 : 981 : double fPageHeight = rPageSize.Height;
178 : :
179 : : //factor 2 to avoid rounding problems
180 : 981 : sal_Int32 nXResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Width)*fCoosysWidth/fPageWidth);
181 : 981 : sal_Int32 nYResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Height)*fCoosysHeight/fPageHeight);
182 : :
183 [ - + ]: 981 : if( nXResolution < 10 )
184 : 0 : nXResolution = 10;
185 [ - + ]: 981 : if( nYResolution < 10 )
186 : 0 : nYResolution = 10;
187 : :
188 [ + - ][ + + ]: 981 : if( this->getPropertySwapXAndYAxis() )
189 : 4 : std::swap(nXResolution,nYResolution);
190 : :
191 : : //2D
192 [ + + ]: 981 : if( 2 == aResolution.getLength() )
193 : : {
194 [ + - ]: 967 : aResolution[0]=nXResolution;
195 [ + - ]: 967 : aResolution[1]=nYResolution;
196 : : }
197 : : else
198 : : {
199 : : //this maybe can be optimized further ...
200 [ + - ]: 14 : sal_Int32 nMaxResolution = std::max( nXResolution, nYResolution );
201 : 14 : nMaxResolution*=2;
202 [ + + ]: 56 : for( nN = 0 ;nN<aResolution.getLength(); nN++ )
203 [ + - ]: 42 : aResolution[nN]=nMaxResolution;
204 : : }
205 : :
206 : 981 : return aResolution;
207 : : }
208 : :
209 : 6253 : Reference< XCoordinateSystem > VCoordinateSystem::getModel() const
210 : : {
211 : 6253 : return m_xCooSysModel;
212 : : }
213 : :
214 : 3930 : Reference< XAxis > VCoordinateSystem::getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
215 : : {
216 [ + - ]: 3930 : if( m_xCooSysModel.is() )
217 : 3930 : return m_xCooSysModel->getAxisByDimension( nDimensionIndex, nAxisIndex );
218 : 3930 : return 0;
219 : : }
220 : :
221 : 1938 : Sequence< Reference< beans::XPropertySet > > VCoordinateSystem::getGridListFromAxis( const Reference< XAxis >& xAxis )
222 : : {
223 [ + - ]: 1938 : std::vector< Reference< beans::XPropertySet > > aRet;
224 : :
225 [ + - ]: 1938 : if( xAxis.is() )
226 : : {
227 [ + - ][ + - ]: 1938 : aRet.push_back( xAxis->getGridProperties() );
[ + - ]
228 [ + - ][ + - ]: 1938 : std::vector< Reference< beans::XPropertySet > > aSubGrids( ContainerHelper::SequenceToVector( xAxis->getSubGridProperties() ) );
[ + - ][ + - ]
229 [ + - ]: 1938 : aRet.insert( aRet.end(), aSubGrids.begin(), aSubGrids.end() );
230 : : }
231 : :
232 [ + - ]: 1938 : return ContainerHelper::ContainerToSequence( aRet );
233 : : }
234 : :
235 : 39738 : void VCoordinateSystem::impl_adjustDimension( sal_Int32& rDimensionIndex ) const
236 : : {
237 [ - + ]: 39738 : if( rDimensionIndex<0 )
238 : 0 : rDimensionIndex=0;
239 [ - + ]: 39738 : if( rDimensionIndex>2 )
240 : 0 : rDimensionIndex=2;
241 : 39738 : }
242 : :
243 : 33836 : void VCoordinateSystem::impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const
244 : : {
245 : 33836 : impl_adjustDimension( rDimensionIndex );
246 : :
247 [ - + ][ - + ]: 33836 : if( rAxisIndex < 0 || rAxisIndex > this->getMaximumAxisIndexByDimension(rDimensionIndex) )
[ + - ]
248 : 0 : rAxisIndex = 0;
249 : 33836 : }
250 : :
251 : 982 : void VCoordinateSystem::setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider /*takes ownership*/ )
252 : : {
253 : 982 : m_apExplicitCategoriesProvider.reset(pExplicitCategoriesProvider);
254 : 982 : }
255 : :
256 : 4911 : ExplicitCategoriesProvider* VCoordinateSystem::getExplicitCategoriesProvider()
257 : : {
258 : 4911 : return m_apExplicitCategoriesProvider.get();
259 : : }
260 : :
261 : 7757 : std::vector< ExplicitScaleData > VCoordinateSystem::getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
262 : : {
263 : 7757 : std::vector< ExplicitScaleData > aRet(m_aExplicitScales);
264 : :
265 [ + - ]: 7757 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
266 [ + - ][ + - ]: 7757 : aRet[nDimensionIndex]=this->getExplicitScale( nDimensionIndex, nAxisIndex );
[ + - ][ + - ]
267 : :
268 : 7757 : return aRet;
269 : : }
270 : :
271 : 0 : std::vector< ExplicitIncrementData > VCoordinateSystem::getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
272 : : {
273 : 0 : std::vector< ExplicitIncrementData > aRet(m_aExplicitIncrements);
274 : :
275 [ # # ]: 0 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
276 [ # # ][ # # ]: 0 : aRet[nDimensionIndex]=this->getExplicitIncrement( nDimensionIndex, nAxisIndex );
277 : :
278 : 0 : return aRet;
279 : : }
280 : :
281 : 17911 : ExplicitScaleData VCoordinateSystem::getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
282 : : {
283 : 17911 : ExplicitScaleData aRet;
284 : :
285 [ + - ]: 17911 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
286 : :
287 [ + + ]: 17911 : if( nAxisIndex == 0)
288 : : {
289 [ + - ][ + - ]: 17883 : aRet = m_aExplicitScales[nDimensionIndex];
290 : : }
291 : : else
292 : : {
293 [ + - ]: 28 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
294 [ + - ]: 28 : tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.find( aFullAxisIndex );
295 [ + - ][ + - ]: 28 : if( aIt != m_aSecondaryExplicitScales.end() )
296 [ + - ][ + - ]: 28 : aRet = aIt->second;
297 : : else
298 [ # # ][ # # ]: 28 : aRet = m_aExplicitScales[nDimensionIndex];
299 : : }
300 : :
301 : 17911 : return aRet;
302 : : }
303 : :
304 : 8168 : ExplicitIncrementData VCoordinateSystem::getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
305 : : {
306 : 8168 : ExplicitIncrementData aRet;
307 : :
308 [ + - ]: 8168 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
309 : :
310 [ + + ]: 8168 : if( nAxisIndex == 0)
311 : : {
312 [ + - ][ + - ]: 8154 : aRet = m_aExplicitIncrements[nDimensionIndex];
313 : : }
314 : : else
315 : : {
316 [ + - ]: 14 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
317 [ + - ]: 14 : tFullExplicitIncrementMap::const_iterator aIt = m_aSecondaryExplicitIncrements.find( aFullAxisIndex );
318 [ + - ][ + - ]: 14 : if( aIt != m_aSecondaryExplicitIncrements.end() )
319 [ + - ][ + - ]: 14 : aRet = aIt->second;
320 : : else
321 [ # # ][ # # ]: 14 : aRet = m_aExplicitIncrements[nDimensionIndex];
322 : : }
323 : :
324 : 8168 : return aRet;
325 : : }
326 : :
327 : 1938 : rtl::OUString VCoordinateSystem::createCIDForAxis( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
328 : : {
329 [ + - ]: 1938 : rtl::OUString aAxisParticle( ObjectIdentifier::createParticleForAxis( nDimensionIndex, nAxisIndex ) );
330 [ + - ]: 1938 : return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aAxisParticle );
331 : : }
332 : 1938 : rtl::OUString VCoordinateSystem::createCIDForGrid( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
333 : : {
334 [ + - ]: 1938 : rtl::OUString aGridParticle( ObjectIdentifier::createParticleForGrid( nDimensionIndex, nAxisIndex ) );
335 [ + - ]: 1938 : return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aGridParticle );
336 : : }
337 : :
338 : 35779 : sal_Int32 VCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const
339 : : {
340 : 35779 : sal_Int32 nRet = 0;
341 : 35779 : tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.begin();
342 : 35779 : tFullExplicitScaleMap::const_iterator aEnd = m_aSecondaryExplicitScales.end();
343 [ + - ][ + - ]: 36626 : for(; aIt!=aEnd; ++aIt)
[ + + ]
344 : : {
345 [ + - ][ + + ]: 847 : if(aIt->first.first==nDimensionIndex)
346 : : {
347 [ + - ]: 343 : sal_Int32 nLocalIdx = aIt->first.second;
348 [ + - ]: 343 : if( nRet < nLocalIdx )
349 : 343 : nRet = nLocalIdx;
350 : : }
351 : : }
352 : 35779 : return nRet;
353 : : }
354 : :
355 : 0 : void VCoordinateSystem::createVAxisList(
356 : : const uno::Reference< util::XNumberFormatsSupplier > & /* xNumberFormatsSupplier */
357 : : , const awt::Size& /* rFontReferenceSize */
358 : : , const awt::Rectangle& /* rMaximumSpaceForLabels */
359 : : )
360 : : {
361 : 0 : }
362 : :
363 : 0 : void VCoordinateSystem::initVAxisInList()
364 : : {
365 : 0 : }
366 : 0 : void VCoordinateSystem::updateScalesAndIncrementsOnAxes()
367 : : {
368 : 0 : }
369 : :
370 : 3958 : void VCoordinateSystem::prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
371 : : {
372 [ + - ][ - + ]: 3958 : if( rScaleAutomatism.getScale().AxisType==AxisType::DATE && nDimIndex==0 )
[ # # ][ + - ]
[ + - ]
[ - + # # ]
373 : : {
374 : 0 : sal_Int32 nTimeResolution = ::com::sun::star::chart::TimeUnit::MONTH;
375 [ # # ][ # # ]: 0 : if( !(rScaleAutomatism.getScale().TimeIncrement.TimeResolution >>= nTimeResolution) )
[ # # ]
376 : : {
377 [ # # ]: 0 : nTimeResolution = m_aMergedMinimumAndMaximumSupplier.calculateTimeResolutionOnXAxis();
378 [ # # ]: 0 : rScaleAutomatism.setAutomaticTimeResolution( nTimeResolution );
379 : : }
380 [ # # ][ # # ]: 0 : m_aMergedMinimumAndMaximumSupplier.setTimeResolutionOnXAxis( nTimeResolution, rScaleAutomatism.getNullDate() );
381 : : }
382 : :
383 : 3958 : double fMin = 0.0;
384 : 3958 : double fMax = 0.0;
385 : 3958 : ::rtl::math::setInf(&fMin, false);
386 : 3958 : ::rtl::math::setInf(&fMax, true);
387 [ + + ]: 3958 : if( 0 == nDimIndex )
388 : : {
389 [ + - ]: 1958 : fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumX();
390 [ + - ]: 1958 : fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumX();
391 : : }
392 [ + + ]: 2000 : else if( 1 == nDimIndex )
393 : : {
394 [ + - ]: 1972 : ExplicitScaleData aScale = getExplicitScale( 0, 0 );
395 [ + - ]: 1972 : fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
396 [ + - ][ + - ]: 1972 : fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
397 : : }
398 [ + - ]: 28 : else if( 2 == nDimIndex )
399 : : {
400 [ + - ]: 28 : fMin = m_aMergedMinimumAndMaximumSupplier.getMinimumZ();
401 [ + - ]: 28 : fMax = m_aMergedMinimumAndMaximumSupplier.getMaximumZ();
402 : : }
403 : :
404 : : //merge our values with those already contained in rScaleAutomatism
405 [ + - ]: 3958 : rScaleAutomatism.expandValueRange( fMin, fMax );
406 : :
407 : : rScaleAutomatism.setAutoScalingOptions(
408 [ + - ]: 3958 : m_aMergedMinimumAndMaximumSupplier.isExpandBorderToIncrementRhythm( nDimIndex ),
409 [ + - ]: 3958 : m_aMergedMinimumAndMaximumSupplier.isExpandIfValuesCloseToBorder( nDimIndex ),
410 [ + - ]: 3958 : m_aMergedMinimumAndMaximumSupplier.isExpandWideValuesToZero( nDimIndex ),
411 [ + - ][ + - ]: 7916 : m_aMergedMinimumAndMaximumSupplier.isExpandNarrowValuesTowardZero( nDimIndex ) );
412 : :
413 [ + - ]: 3958 : VAxisBase* pVAxis( this->getVAxis( nDimIndex, nAxisIndex ) );
414 [ + + ]: 3958 : if( pVAxis )
415 [ + - ][ + - ]: 3890 : rScaleAutomatism.setMaximumAutoMainIncrementCount( pVAxis->estimateMaximumAutoMainIncrementCount() );
416 : 3958 : }
417 : :
418 : 3958 : VAxisBase* VCoordinateSystem::getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
419 : : {
420 : 3958 : VAxisBase* pRet = 0;
421 : :
422 [ + - ]: 3958 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
423 : :
424 [ + - ]: 3958 : tVAxisMap::const_iterator aIt = m_aAxisMap.find( aFullAxisIndex );
425 [ + + ]: 3958 : if( aIt != m_aAxisMap.end() )
426 : 3890 : pRet = aIt->second.get();
427 : :
428 : 3958 : return pRet;
429 : : }
430 : :
431 : 5902 : void VCoordinateSystem::setExplicitScaleAndIncrement(
432 : : sal_Int32 nDimensionIndex
433 : : , sal_Int32 nAxisIndex
434 : : , const ExplicitScaleData& rExplicitScale
435 : : , const ExplicitIncrementData& rExplicitIncrement )
436 : : {
437 : 5902 : impl_adjustDimension( nDimensionIndex );
438 : :
439 [ + + ]: 5902 : if( nAxisIndex==0 )
440 : : {
441 : 5860 : m_aExplicitScales[nDimensionIndex]=rExplicitScale;
442 : 5860 : m_aExplicitIncrements[nDimensionIndex]=rExplicitIncrement;
443 : : }
444 : : else
445 : : {
446 [ + - ]: 42 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
447 [ + - ][ + - ]: 42 : m_aSecondaryExplicitScales[aFullAxisIndex] = rExplicitScale;
448 [ + - ][ + - ]: 42 : m_aSecondaryExplicitIncrements[aFullAxisIndex] = rExplicitIncrement;
449 : : }
450 : 5902 : }
451 : :
452 : 14 : void VCoordinateSystem::set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos )
453 : : {
454 : 14 : m_eLeftWallPos = eLeftWallPos;
455 : 14 : m_eBackWallPos = eBackWallPos;
456 : 14 : m_eBottomPos = eBottomPos;
457 : 14 : }
458 : :
459 : 962 : void VCoordinateSystem::createMaximumAxesLabels()
460 : : {
461 : 962 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
462 : 962 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
463 [ + + ]: 2900 : for( ; aIt != aEnd; ++aIt )
464 : : {
465 : 1938 : VAxisBase* pVAxis = aIt->second.get();
466 [ + - ]: 1938 : if( pVAxis )
467 : : {
468 [ + - ][ + + ]: 1938 : if(2==pVAxis->getDimensionCount())
469 [ + - ]: 1896 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
470 [ + - ]: 1938 : pVAxis->createMaximumLabels();
471 : : }
472 : : }
473 : 962 : }
474 : 962 : void VCoordinateSystem::createAxesLabels()
475 : : {
476 : 962 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
477 : 962 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
478 [ + + ]: 2900 : for( ; aIt != aEnd; ++aIt )
479 : : {
480 : 1938 : VAxisBase* pVAxis = aIt->second.get();
481 [ + - ]: 1938 : if( pVAxis )
482 : : {
483 [ + - ][ + + ]: 1938 : if(2==pVAxis->getDimensionCount())
484 [ + - ]: 1896 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
485 [ + - ]: 1938 : pVAxis->createLabels();
486 : : }
487 : : }
488 : 962 : }
489 : :
490 : 962 : void VCoordinateSystem::updatePositions()
491 : : {
492 : 962 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
493 : 962 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
494 [ + + ]: 2900 : for( ; aIt != aEnd; ++aIt )
495 : : {
496 : 1938 : VAxisBase* pVAxis = aIt->second.get();
497 [ + - ]: 1938 : if( pVAxis )
498 : : {
499 [ + - ][ + + ]: 1938 : if(2==pVAxis->getDimensionCount())
500 [ + - ]: 1896 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
501 [ + - ]: 1938 : pVAxis->updatePositions();
502 : : }
503 : : }
504 : 962 : }
505 : :
506 : 982 : void VCoordinateSystem::createAxesShapes()
507 : : {
508 : 982 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
509 : 982 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
510 [ + + ]: 2920 : for( ; aIt != aEnd; ++aIt )
511 : : {
512 : 1938 : VAxisBase* pVAxis = aIt->second.get();
513 [ + - ]: 1938 : if( pVAxis )
514 : : {
515 [ + - ][ + + ]: 1938 : if(2==pVAxis->getDimensionCount())
516 [ + - ]: 1896 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
517 : :
518 : 1938 : tFullAxisIndex aFullAxisIndex = aIt->first;
519 [ + - ]: 1938 : if( aFullAxisIndex.second == 0 )
520 : : {
521 [ + + ]: 1938 : if( aFullAxisIndex.first == 0 )
522 : : {
523 [ + - ][ + - ]: 962 : if( AxisType::CATEGORY!=m_aExplicitScales[1].AxisType )
524 : : pVAxis->setExrtaLinePositionAtOtherAxis(
525 [ + - ][ + - ]: 962 : m_aExplicitScales[1].Origin );
526 : : }
527 [ + + ]: 976 : else if( aFullAxisIndex.first == 1 )
528 : : {
529 [ + - ][ - + ]: 962 : if( AxisType::CATEGORY!=m_aExplicitScales[0].AxisType )
530 : : pVAxis->setExrtaLinePositionAtOtherAxis(
531 [ # # ][ # # ]: 0 : m_aExplicitScales[0].Origin );
532 : : }
533 : : }
534 : :
535 [ + - ]: 1938 : pVAxis->createShapes();
536 : : }
537 : : }
538 : 982 : }
539 : 0 : void VCoordinateSystem::createGridShapes()
540 : : {
541 : 0 : }
542 : 981 : void VCoordinateSystem::addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
543 : : {
544 : 981 : m_aMergedMinimumAndMaximumSupplier.addMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
545 : 981 : }
546 : :
547 : 3924 : bool VCoordinateSystem::hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
548 : : {
549 : 3924 : return m_aMergedMinimumAndMaximumSupplier.hasMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
550 : : }
551 : :
552 : 982 : void VCoordinateSystem::clearMinimumAndMaximumSupplierList()
553 : : {
554 : 982 : m_aMergedMinimumAndMaximumSupplier.clearMinimumAndMaximumSupplierList();
555 : 982 : }
556 : :
557 : 6831 : bool VCoordinateSystem::getPropertySwapXAndYAxis() const
558 : : {
559 [ + - ]: 6831 : Reference<beans::XPropertySet> xProp(m_xCooSysModel, uno::UNO_QUERY );
560 : 6831 : sal_Bool bSwapXAndY = false;
561 [ + - ]: 6831 : if( xProp.is()) try
562 : : {
563 [ + - ][ + - ]: 6831 : xProp->getPropertyValue( C2U( "SwapXAndYAxis" ) ) >>= bSwapXAndY;
[ + - ][ # # ]
564 : : }
565 [ # # ]: 0 : catch( const uno::Exception& e )
566 : : {
567 : : ASSERT_EXCEPTION( e );
568 : : }
569 : 6831 : return bSwapXAndY;
570 : : }
571 : :
572 : 981 : bool VCoordinateSystem::needSeriesNamesForAxis() const
573 : : {
574 [ + - ][ + + ]: 981 : return ( m_xCooSysModel.is() && m_xCooSysModel->getDimension() == 3 );
575 : : }
576 : 14 : void VCoordinateSystem::setSeriesNamesForAxis( const Sequence< rtl::OUString >& rSeriesNames )
577 : : {
578 : 14 : m_aSeriesNamesForZAxis = rSeriesNames;
579 : 14 : }
580 : :
581 : 1781 : sal_Int32 VCoordinateSystem::getNumberFormatKeyForAxis(
582 : : const Reference< chart2::XAxis >& xAxis
583 : : , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
584 : : {
585 : : return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
586 : 1781 : xAxis, m_xCooSysModel, xNumberFormatsSupplier );
587 : : }
588 : :
589 : : //.............................................................................
590 : : } //namespace chart
591 : : //.............................................................................
592 : :
593 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|