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 544 : VCoordinateSystem* VCoordinateSystem::createCoordinateSystem(
52 : const Reference< XCoordinateSystem >& xCooSysModel )
53 : {
54 544 : if( !xCooSysModel.is() )
55 0 : return 0;
56 :
57 544 : OUString aViewServiceName = xCooSysModel->getViewServiceName();
58 :
59 : //@todo: in future the coordinatesystems should be instantiated via service factory
60 544 : VCoordinateSystem* pRet=NULL;
61 544 : if( aViewServiceName.equals( CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ) )
62 524 : pRet = new VCartesianCoordinateSystem(xCooSysModel);
63 20 : else if( aViewServiceName.equals( CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME ) )
64 20 : pRet = new VPolarCoordinateSystem(xCooSysModel);
65 544 : if(!pRet)
66 0 : pRet = new VCoordinateSystem(xCooSysModel);
67 544 : return pRet;
68 : }
69 :
70 544 : 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 544 : , m_apExplicitCategoriesProvider(NULL)
84 : {
85 544 : if( !m_xCooSysModel.is() || m_xCooSysModel->getDimension()<3 )
86 : {
87 507 : m_aExplicitScales[2].Minimum = 1.0;
88 507 : m_aExplicitScales[2].Maximum = 2.0;
89 507 : m_aExplicitScales[2].Orientation = AxisOrientation_MATHEMATICAL;
90 : }
91 544 : }
92 518 : VCoordinateSystem::~VCoordinateSystem()
93 : {
94 518 : }
95 :
96 544 : 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 544 : sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
106 : //create group shape for grids first thus axes are always painted above grids
107 544 : AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory);
108 544 : if(nDimensionCount==2)
109 : {
110 : //create and add to target
111 507 : m_xLogicTargetForGrids = pShapeFactory->createGroup2D( xLogicTarget );
112 507 : xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup2D( xLogicTarget );
113 507 : m_xLogicTargetForAxes = pShapeFactory->createGroup2D( xLogicTarget );
114 : }
115 : else
116 : {
117 : //create and added to target
118 37 : m_xLogicTargetForGrids = pShapeFactory->createGroup3D( xLogicTarget );
119 37 : xLogicTargetForSeriesBehindAxis = pShapeFactory->createGroup3D( xLogicTarget );
120 37 : m_xLogicTargetForAxes = pShapeFactory->createGroup3D( xLogicTarget );
121 : }
122 544 : m_xFinalTarget = xFinalTarget;
123 544 : m_xShapeFactory = xShapeFactory;
124 544 : }
125 :
126 544 : void VCoordinateSystem::setParticle( const OUString& rCooSysParticle )
127 : {
128 544 : m_aCooSysParticle = rCooSysParticle;
129 544 : }
130 :
131 2152 : void VCoordinateSystem::setTransformationSceneToScreen(
132 : const drawing::HomogenMatrix& rMatrix )
133 : {
134 2152 : m_aMatrixSceneToScreen = rMatrix;
135 :
136 : //correct transformation for axis
137 2152 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
138 2152 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
139 6524 : for( ; aIt != aEnd; ++aIt )
140 : {
141 4372 : VAxisBase* pVAxis = aIt->second.get();
142 4372 : if( pVAxis )
143 : {
144 4372 : if(2==pVAxis->getDimensionCount())
145 3952 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
146 : }
147 : }
148 2152 : }
149 :
150 : //better performance for big data
151 550 : uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution(
152 : const awt::Size& rPageSize, const awt::Size& rPageResolution )
153 : {
154 550 : uno::Sequence< sal_Int32 > aResolution(2);
155 :
156 550 : sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
157 550 : if(nDimensionCount>2)
158 37 : aResolution.realloc(nDimensionCount);
159 550 : sal_Int32 nN = 0;
160 1687 : for( nN = 0 ;nN<aResolution.getLength(); nN++ )
161 1137 : aResolution[nN]=1000;
162 :
163 : ::basegfx::B3DTuple aScale( BaseGFXHelper::GetScaleFromMatrix(
164 : BaseGFXHelper::HomogenMatrixToB3DHomMatrix(
165 1100 : m_aMatrixSceneToScreen ) ) );
166 :
167 550 : double fCoosysWidth = static_cast< double >( fabs(aScale.getX()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
168 550 : double fCoosysHeight = static_cast< double >( fabs(aScale.getY()*FIXED_SIZE_FOR_3D_CHART_VOLUME));
169 :
170 550 : double fPageWidth = rPageSize.Width;
171 550 : double fPageHeight = rPageSize.Height;
172 :
173 : //factor 2 to avoid rounding problems
174 550 : sal_Int32 nXResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Width)*fCoosysWidth/fPageWidth);
175 550 : sal_Int32 nYResolution = static_cast<sal_Int32>(2.0*static_cast<double>(rPageResolution.Height)*fCoosysHeight/fPageHeight);
176 :
177 550 : if( nXResolution < 10 )
178 0 : nXResolution = 10;
179 550 : if( nYResolution < 10 )
180 0 : nYResolution = 10;
181 :
182 550 : if( this->getPropertySwapXAndYAxis() )
183 19 : std::swap(nXResolution,nYResolution);
184 :
185 : //2D
186 550 : if( 2 == aResolution.getLength() )
187 : {
188 513 : aResolution[0]=nXResolution;
189 513 : aResolution[1]=nYResolution;
190 : }
191 : else
192 : {
193 : //this maybe can be optimized further ...
194 37 : sal_Int32 nMaxResolution = std::max( nXResolution, nYResolution );
195 37 : nMaxResolution*=2;
196 148 : for( nN = 0 ;nN<aResolution.getLength(); nN++ )
197 111 : aResolution[nN]=nMaxResolution;
198 : }
199 :
200 1100 : return aResolution;
201 : }
202 :
203 2246 : Reference< XAxis > VCoordinateSystem::getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
204 : {
205 2246 : if( m_xCooSysModel.is() )
206 2246 : return m_xCooSysModel->getAxisByDimension( nDimensionIndex, nAxisIndex );
207 0 : return 0;
208 : }
209 :
210 1083 : Sequence< Reference< beans::XPropertySet > > VCoordinateSystem::getGridListFromAxis( const Reference< XAxis >& xAxis )
211 : {
212 1083 : std::vector< Reference< beans::XPropertySet > > aRet;
213 :
214 1083 : if( xAxis.is() )
215 : {
216 1083 : aRet.push_back( xAxis->getGridProperties() );
217 1083 : std::vector< Reference< beans::XPropertySet > > aSubGrids( ContainerHelper::SequenceToVector( xAxis->getSubGridProperties() ) );
218 1083 : aRet.insert( aRet.end(), aSubGrids.begin(), aSubGrids.end() );
219 : }
220 :
221 1083 : return ContainerHelper::ContainerToSequence( aRet );
222 : }
223 :
224 24712 : void VCoordinateSystem::impl_adjustDimension( sal_Int32& rDimensionIndex ) const
225 : {
226 24712 : if( rDimensionIndex<0 )
227 0 : rDimensionIndex=0;
228 24712 : if( rDimensionIndex>2 )
229 0 : rDimensionIndex=2;
230 24712 : }
231 :
232 20204 : void VCoordinateSystem::impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const
233 : {
234 20204 : impl_adjustDimension( rDimensionIndex );
235 :
236 20204 : if( rAxisIndex < 0 || rAxisIndex > this->getMaximumAxisIndexByDimension(rDimensionIndex) )
237 0 : rAxisIndex = 0;
238 20204 : }
239 :
240 544 : void VCoordinateSystem::setExplicitCategoriesProvider( ExplicitCategoriesProvider* pExplicitCategoriesProvider /*takes ownership*/ )
241 : {
242 544 : m_apExplicitCategoriesProvider.reset(pExplicitCategoriesProvider);
243 544 : }
244 :
245 2796 : ExplicitCategoriesProvider* VCoordinateSystem::getExplicitCategoriesProvider()
246 : {
247 2796 : return m_apExplicitCategoriesProvider.get();
248 : }
249 :
250 4353 : std::vector< ExplicitScaleData > VCoordinateSystem::getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
251 : {
252 4353 : std::vector< ExplicitScaleData > aRet(m_aExplicitScales);
253 :
254 4353 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
255 4353 : aRet[nDimensionIndex]=this->getExplicitScale( nDimensionIndex, nAxisIndex );
256 :
257 4353 : return aRet;
258 : }
259 :
260 0 : std::vector< ExplicitIncrementData > VCoordinateSystem::getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
261 : {
262 0 : std::vector< ExplicitIncrementData > aRet(m_aExplicitIncrements);
263 :
264 0 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
265 0 : aRet[nDimensionIndex]=this->getExplicitIncrement( nDimensionIndex, nAxisIndex );
266 :
267 0 : return aRet;
268 : }
269 :
270 10666 : ExplicitScaleData VCoordinateSystem::getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
271 : {
272 10666 : ExplicitScaleData aRet;
273 :
274 10666 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
275 :
276 10666 : if( nAxisIndex == 0)
277 : {
278 10578 : aRet = m_aExplicitScales[nDimensionIndex];
279 : }
280 : else
281 : {
282 88 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
283 88 : tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.find( aFullAxisIndex );
284 88 : if( aIt != m_aSecondaryExplicitScales.end() )
285 88 : aRet = aIt->second;
286 : else
287 0 : aRet = m_aExplicitScales[nDimensionIndex];
288 : }
289 :
290 10666 : return aRet;
291 : }
292 :
293 5185 : ExplicitIncrementData VCoordinateSystem::getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const
294 : {
295 5185 : ExplicitIncrementData aRet;
296 :
297 5185 : impl_adjustDimensionAndIndex( nDimensionIndex, nAxisIndex );
298 :
299 5185 : if( nAxisIndex == 0)
300 : {
301 5153 : aRet = m_aExplicitIncrements[nDimensionIndex];
302 : }
303 : else
304 : {
305 32 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
306 32 : tFullExplicitIncrementMap::const_iterator aIt = m_aSecondaryExplicitIncrements.find( aFullAxisIndex );
307 32 : if( aIt != m_aSecondaryExplicitIncrements.end() )
308 32 : aRet = aIt->second;
309 : else
310 0 : aRet = m_aExplicitIncrements[nDimensionIndex];
311 : }
312 :
313 5185 : return aRet;
314 : }
315 :
316 1095 : OUString VCoordinateSystem::createCIDForAxis( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
317 : {
318 1095 : OUString aAxisParticle( ObjectIdentifier::createParticleForAxis( nDimensionIndex, nAxisIndex ) );
319 1095 : return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aAxisParticle );
320 : }
321 1083 : OUString VCoordinateSystem::createCIDForGrid( const Reference< chart2::XAxis >& /* xAxis */, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
322 : {
323 1083 : OUString aGridParticle( ObjectIdentifier::createParticleForGrid( nDimensionIndex, nAxisIndex ) );
324 1083 : return ObjectIdentifier::createClassifiedIdentifierForParticles( m_aCooSysParticle, aGridParticle );
325 : }
326 :
327 21284 : sal_Int32 VCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const
328 : {
329 21284 : sal_Int32 nRet = 0;
330 21284 : tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.begin();
331 21284 : tFullExplicitScaleMap::const_iterator aEnd = m_aSecondaryExplicitScales.end();
332 22800 : for(; aIt!=aEnd; ++aIt)
333 : {
334 1516 : if(aIt->first.first==nDimensionIndex)
335 : {
336 676 : sal_Int32 nLocalIdx = aIt->first.second;
337 676 : if( nRet < nLocalIdx )
338 676 : nRet = nLocalIdx;
339 : }
340 : }
341 21284 : 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 2268 : void VCoordinateSystem::prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex )
360 : {
361 2268 : 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 2268 : double fMin = 0.0;
374 2268 : double fMax = 0.0;
375 2268 : ::rtl::math::setInf(&fMin, false);
376 2268 : ::rtl::math::setInf(&fMax, true);
377 2268 : if( 0 == nDimIndex )
378 : {
379 : // x dimension
380 1100 : fMin = m_aMergedMinMaxSupplier.getMinimumX();
381 1100 : fMax = m_aMergedMinMaxSupplier.getMaximumX();
382 : }
383 1168 : else if( 1 == nDimIndex )
384 : {
385 : // y dimension
386 1096 : ExplicitScaleData aScale = getExplicitScale( 0, 0 );
387 1096 : fMin = m_aMergedMinMaxSupplier.getMinimumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
388 1096 : fMax = m_aMergedMinMaxSupplier.getMaximumYInRange(aScale.Minimum,aScale.Maximum, nAxisIndex);
389 : }
390 72 : else if( 2 == nDimIndex )
391 : {
392 : // z dimension
393 72 : fMin = m_aMergedMinMaxSupplier.getMinimumZ();
394 72 : fMax = m_aMergedMinMaxSupplier.getMaximumZ();
395 : }
396 :
397 : //merge our values with those already contained in rScaleAutomatism
398 2268 : rScaleAutomatism.expandValueRange( fMin, fMax );
399 :
400 : rScaleAutomatism.setAutoScalingOptions(
401 2268 : m_aMergedMinMaxSupplier.isExpandBorderToIncrementRhythm( nDimIndex ),
402 2268 : m_aMergedMinMaxSupplier.isExpandIfValuesCloseToBorder( nDimIndex ),
403 2268 : m_aMergedMinMaxSupplier.isExpandWideValuesToZero( nDimIndex ),
404 9072 : m_aMergedMinMaxSupplier.isExpandNarrowValuesTowardZero( nDimIndex ) );
405 :
406 2268 : VAxisBase* pVAxis = getVAxis(nDimIndex, nAxisIndex);
407 2268 : if( pVAxis )
408 2198 : rScaleAutomatism.setMaximumAutoMainIncrementCount( pVAxis->estimateMaximumAutoMainIncrementCount() );
409 2268 : }
410 :
411 2268 : VAxisBase* VCoordinateSystem::getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
412 : {
413 2268 : VAxisBase* pRet = 0;
414 :
415 2268 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
416 :
417 2268 : tVAxisMap::const_iterator aIt = m_aAxisMap.find( aFullAxisIndex );
418 2268 : if( aIt != m_aAxisMap.end() )
419 2198 : pRet = aIt->second.get();
420 :
421 2268 : return pRet;
422 : }
423 :
424 4508 : void VCoordinateSystem::setExplicitScaleAndIncrement(
425 : sal_Int32 nDimensionIndex
426 : , sal_Int32 nAxisIndex
427 : , const ExplicitScaleData& rExplicitScale
428 : , const ExplicitIncrementData& rExplicitIncrement )
429 : {
430 4508 : impl_adjustDimension( nDimensionIndex );
431 :
432 4508 : if( nAxisIndex==0 )
433 : {
434 4416 : m_aExplicitScales[nDimensionIndex]=rExplicitScale;
435 4416 : m_aExplicitIncrements[nDimensionIndex]=rExplicitIncrement;
436 : }
437 : else
438 : {
439 92 : tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
440 92 : m_aSecondaryExplicitScales[aFullAxisIndex] = rExplicitScale;
441 92 : m_aSecondaryExplicitIncrements[aFullAxisIndex] = rExplicitIncrement;
442 : }
443 4508 : }
444 :
445 37 : void VCoordinateSystem::set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos )
446 : {
447 37 : m_eLeftWallPos = eLeftWallPos;
448 37 : m_eBackWallPos = eBackWallPos;
449 37 : m_eBottomPos = eBottomPos;
450 37 : }
451 :
452 524 : void VCoordinateSystem::createMaximumAxesLabels()
453 : {
454 524 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
455 524 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
456 1619 : for( ; aIt != aEnd; ++aIt )
457 : {
458 1095 : VAxisBase* pVAxis = aIt->second.get();
459 1095 : if( pVAxis )
460 : {
461 1095 : if(2==pVAxis->getDimensionCount())
462 990 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
463 1095 : pVAxis->createMaximumLabels();
464 : }
465 : }
466 524 : }
467 524 : void VCoordinateSystem::createAxesLabels()
468 : {
469 524 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
470 524 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
471 1619 : for( ; aIt != aEnd; ++aIt )
472 : {
473 1095 : VAxisBase* pVAxis = aIt->second.get();
474 1095 : if( pVAxis )
475 : {
476 1095 : if(2==pVAxis->getDimensionCount())
477 990 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
478 1095 : pVAxis->createLabels();
479 : }
480 : }
481 524 : }
482 :
483 524 : void VCoordinateSystem::updatePositions()
484 : {
485 524 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
486 524 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
487 1619 : for( ; aIt != aEnd; ++aIt )
488 : {
489 1095 : VAxisBase* pVAxis = aIt->second.get();
490 1095 : if( pVAxis )
491 : {
492 1095 : if(2==pVAxis->getDimensionCount())
493 990 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
494 1095 : pVAxis->updatePositions();
495 : }
496 : }
497 524 : }
498 :
499 544 : void VCoordinateSystem::createAxesShapes()
500 : {
501 544 : tVAxisMap::iterator aIt( m_aAxisMap.begin() );
502 544 : tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
503 1639 : for( ; aIt != aEnd; ++aIt )
504 : {
505 1095 : VAxisBase* pVAxis = aIt->second.get();
506 1095 : if( pVAxis )
507 : {
508 1095 : if(2==pVAxis->getDimensionCount())
509 990 : pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
510 :
511 1095 : tFullAxisIndex aFullAxisIndex = aIt->first;
512 1095 : if( aFullAxisIndex.second == 0 )
513 : {
514 1083 : if( aFullAxisIndex.first == 0 )
515 : {
516 524 : if( AxisType::CATEGORY!=m_aExplicitScales[1].AxisType )
517 : pVAxis->setExrtaLinePositionAtOtherAxis(
518 524 : m_aExplicitScales[1].Origin );
519 : }
520 559 : else if( aFullAxisIndex.first == 1 )
521 : {
522 524 : if( AxisType::CATEGORY!=m_aExplicitScales[0].AxisType )
523 : pVAxis->setExrtaLinePositionAtOtherAxis(
524 50 : m_aExplicitScales[0].Origin );
525 : }
526 : }
527 :
528 1095 : pVAxis->createShapes();
529 : }
530 : }
531 544 : }
532 0 : void VCoordinateSystem::createGridShapes()
533 : {
534 0 : }
535 550 : void VCoordinateSystem::addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
536 : {
537 550 : m_aMergedMinMaxSupplier.addMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
538 550 : }
539 :
540 2200 : bool VCoordinateSystem::hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier )
541 : {
542 2200 : return m_aMergedMinMaxSupplier.hasMinimumAndMaximumSupplier(pMinimumAndMaximumSupplier);
543 : }
544 :
545 544 : void VCoordinateSystem::clearMinimumAndMaximumSupplierList()
546 : {
547 544 : m_aMergedMinMaxSupplier.clearMinimumAndMaximumSupplierList();
548 544 : }
549 :
550 3786 : bool VCoordinateSystem::getPropertySwapXAndYAxis() const
551 : {
552 3786 : Reference<beans::XPropertySet> xProp(m_xCooSysModel, uno::UNO_QUERY );
553 3786 : bool bSwapXAndY = false;
554 3786 : if( xProp.is()) try
555 : {
556 3786 : xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
557 : }
558 0 : catch( const uno::Exception& e )
559 : {
560 : ASSERT_EXCEPTION( e );
561 : }
562 3786 : return bSwapXAndY;
563 : }
564 :
565 544 : bool VCoordinateSystem::needSeriesNamesForAxis() const
566 : {
567 544 : return ( m_xCooSysModel.is() && m_xCooSysModel->getDimension() == 3 );
568 : }
569 37 : void VCoordinateSystem::setSeriesNamesForAxis( const Sequence< OUString >& rSeriesNames )
570 : {
571 37 : m_aSeriesNamesForZAxis = rSeriesNames;
572 37 : }
573 :
574 1029 : sal_Int32 VCoordinateSystem::getNumberFormatKeyForAxis(
575 : const Reference< chart2::XAxis >& xAxis
576 : , const Reference<chart2::XChartDocument>& xChartDoc)
577 : {
578 : return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
579 1029 : xAxis, m_xCooSysModel, xChartDoc);
580 : }
581 :
582 108 : } //namespace chart
583 :
584 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|