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