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