diff options
Diffstat (limited to 'chart2/source/view/axes/VAxisBase.cxx')
-rw-r--r-- | chart2/source/view/axes/VAxisBase.cxx | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx index 79c2529873aa..0159fb20cad6 100644 --- a/chart2/source/view/axes/VAxisBase.cxx +++ b/chart2/source/view/axes/VAxisBase.cxx @@ -79,23 +79,31 @@ void SAL_CALL VAxisBase::initAxisLabelProperties( const ::com::sun::star::awt::S if( !m_aAxisProperties.m_bDisplayLabels ) return; - if( AxisType::CATEGORY==m_aAxisProperties.m_nAxisType - || AxisType::SERIES==m_aAxisProperties.m_nAxisType ) + if( AxisType::SERIES==m_aAxisProperties.m_nAxisType ) { if( m_aAxisProperties.m_xAxisTextProvider.is() ) m_aTextLabels = m_aAxisProperties.m_xAxisTextProvider->getTextualData(); m_bUseTextLabels = true; - if( m_aTextLabels.getLength() == 1 && AxisType::SERIES==m_aAxisProperties.m_nAxisType ) + if( m_aTextLabels.getLength() == 1 ) { //don't show a single series name m_aAxisProperties.m_bDisplayLabels = false; return; } } + else if( AxisType::CATEGORY==m_aAxisProperties.m_nAxisType ) + { + if( m_aAxisProperties.m_pExplicitCategoriesProvider ) + m_aTextLabels = m_aAxisProperties.m_pExplicitCategoriesProvider->getSimpleCategories(); + + m_bUseTextLabels = true; + } m_aAxisLabelProperties.nNumberFormatKey = m_aAxisProperties.m_nNumberFormatKey; m_aAxisLabelProperties.init(m_aAxisProperties.m_xAxisModel); + if( m_aAxisProperties.m_bComplexCategories && AxisType::CATEGORY == m_aAxisProperties.m_nAxisType ) + m_aAxisLabelProperties.eStaggering = SIDE_BY_SIDE; } void VAxisBase::recordMaximumTextSize( const Reference< drawing::XShape >& xShape, double fRotationAngleDegree ) @@ -152,6 +160,12 @@ void SAL_CALL VAxisBase::setExplicitScaleAndIncrement( m_aIncrement = rIncrement; } +void VAxisBase::createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) +{ + std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() ); + apTickmarkHelper->getAllTicks( rAllTickInfos ); +} + bool VAxisBase::prepareShapeCreation() { //returns true if all is ready for further shape creation and any shapes need to be created @@ -162,14 +176,9 @@ bool VAxisBase::prepareShapeCreation() { //----------------------------------------- //create all scaled tickmark values - if( m_xTextTarget.is() ) - { - TickIter aRemoveIter( m_aAllTickInfos, m_aIncrement, 0, 0 ); - removeTextShapesFromTicks( aRemoveIter, m_xTextTarget ); - } + removeTextShapesFromTicks(); - std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() ); - apTickmarkHelper->getAllTicks( m_aAllTickInfos ); + createAllTickInfos(m_aAllTickInfos); m_bReCreateAllTickInfos = false; } @@ -203,15 +212,25 @@ sal_Int32 VAxisBase::getIndexOfLongestLabel( const uno::Sequence< rtl::OUString return nRet; } -void VAxisBase::removeTextShapesFromTicks( TickIter& rIter, const Reference< drawing::XShapes >& xTarget ) +void VAxisBase::removeTextShapesFromTicks() { - for( TickInfo* pTickInfo = rIter.firstInfo() - ; pTickInfo; pTickInfo = rIter.nextInfo() ) + if( m_xTextTarget.is() ) { - if(pTickInfo->xTextShape.is()) + ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = m_aAllTickInfos.begin(); + const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = m_aAllTickInfos.end(); + for( ; aDepthIter != aDepthEnd; aDepthIter++ ) { - xTarget->remove(pTickInfo->xTextShape); - pTickInfo->xTextShape = NULL; + ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin(); + const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end(); + for( ; aTickIter != aTickEnd; aTickIter++ ) + { + TickInfo& rTickInfo = (*aTickIter); + if(rTickInfo.xTextShape.is()) + { + m_xTextTarget->remove(rTickInfo.xTextShape); + rTickInfo.xTextShape = NULL; + } + } } } } |