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