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