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