diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-01-21 09:49:41 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-01-21 09:49:41 +0000 |
commit | c7cbb43e3de1a68334f4f62d7426a701ce7038d8 (patch) | |
tree | a4120d6475e9f381fc93a9590b02bf9395202f2b /chart2/source/tools/AxisHelper.cxx | |
parent | 5d675f273cf524130394fe594f62c201e25ac4cd (diff) |
CWS-TOOLING: integrate CWS rtlchart03
2009-01-08 16:18:26 +0100 iha r266022 : build error due to warnings
2009-01-07 12:05:50 +0100 iha r265958 : #i91970# RTL Chart: legend symbols should be on the right side in case of right-to-left writing direction
2009-01-05 15:47:13 +0100 iha r265876 : CWS-TOOLING: rebase CWS rtlchart03 to trunk@265758 (milestone: DEV300:m38)
2008-11-26 20:45:14 +0100 iha r264434 : CWS-TOOLING: rebase CWS rtlchart03 to trunk@264325 (milestone: DEV300:m36)
2008-11-20 10:08:30 +0100 iha r264033 : #i91968#:legend should be on the left per default in rtl mode - migrate CWS rtlchart03 to SVN.
2008-11-20 10:03:10 +0100 iha r264032 : #i96215#: context menu pops up at wrong position in rtl mode - migrate CWS rtlchart03 to SVN.
2008-11-20 10:00:45 +0100 iha r264031 : #i91763#: repaint errors on rtl charts - migrate CWS rtlchart03 to SVN.
2008-11-20 09:42:50 +0100 iha r264029 : #i91963#: reverse x-axis per default for an Arabic version- migrate CWS rtlchart03 to SVN.
Diffstat (limited to 'chart2/source/tools/AxisHelper.cxx')
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 86fee326497b..b9778042baed 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -38,11 +38,13 @@ #include "AxisIndexDefines.hxx" #include "LineProperties.hxx" #include "ContainerHelper.hxx" +#include "servicenames_coosystems.hxx" #include "DataSeriesHelper.hxx" #include <svtools/saveopt.hxx> #include <com/sun/star/chart/ChartAxisPosition.hpp> + #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> @@ -848,6 +850,74 @@ Reference< XChartType > AxisHelper::getChartTypeByIndex( const Reference< XCoord return xChartType; } +void AxisHelper::setRTLAxisLayout( const Reference< XCoordinateSystem >& xCooSys ) +{ + if( xCooSys.is() ) + { + bool bCartesian = xCooSys->getViewServiceName().equals( CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ); + if( bCartesian ) + { + bool bVertical = false; + Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY ); + if( xCooSysProp.is() ) + xCooSysProp->getPropertyValue( C2U("SwapXAndYAxis") ) >>= bVertical; + + sal_Int32 nHorizontalAxisDimension = bVertical ? 1 : 0; + sal_Int32 nVerticalAxisDimension = bVertical ? 0 : 1; + + try + { + //reverse direction for horizontal main axis + Reference< chart2::XAxis > xHorizontalMainAxis( AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); + if( xHorizontalMainAxis.is() ) + { + chart2::ScaleData aScale = xHorizontalMainAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_REVERSE; + xHorizontalMainAxis->setScaleData(aScale); + } + + //mathematical direction for vertical main axis + Reference< chart2::XAxis > xVerticalMainAxis( AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); + if( xVerticalMainAxis.is() ) + { + chart2::ScaleData aScale = xVerticalMainAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL; + xVerticalMainAxis->setScaleData(aScale); + } + } + catch( uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } + + try + { + //reverse direction for horizontal secondary axis + Reference< chart2::XAxis > xHorizontalSecondaryAxis( AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); + if( xHorizontalSecondaryAxis.is() ) + { + chart2::ScaleData aScale = xHorizontalSecondaryAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_REVERSE; + xHorizontalSecondaryAxis->setScaleData(aScale); + } + + //mathematical direction for vertical secondary axis + Reference< chart2::XAxis > xVerticalSecondaryAxis( AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); + if( xVerticalSecondaryAxis.is() ) + { + chart2::ScaleData aScale = xVerticalSecondaryAxis->getScaleData(); + aScale.Orientation = chart2::AxisOrientation_MATHEMATICAL; + xVerticalSecondaryAxis->setScaleData(aScale); + } + } + catch( uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } + } + } +} + Reference< XChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const Reference< chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ) { Reference< XChartType > xChartType; |