diff options
author | Oliver Bolte <obo@openoffice.org> | 2008-07-22 12:47:16 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2008-07-22 12:47:16 +0000 |
commit | b483f80c0c6ddc31d93d96fc3c46d5183de50e73 (patch) | |
tree | d60c5d62568f782bc35723a8244912cbeb208809 /oox/source/drawingml/chart/axisconverter.cxx | |
parent | 6ea2e3f0ddaf620f35d714dab823459ed8bc14af (diff) |
INTEGRATION: CWS xmlfilter06 (1.2.6); FILE MERGED
2008/06/27 09:18:00 dr 1.2.6.8: fill properties cleanup, resolve line gradients to solid color
2008/06/25 14:58:39 dr 1.2.6.7: import chart data point labels and trendline label
2008/06/24 14:03:14 dr 1.2.6.6: axis number formats, constant series source data
2008/06/23 15:31:41 dr 1.2.6.5: more chart axis settings
2008/06/23 12:55:46 dr 1.2.6.4: final chart font formatting
2008/06/20 11:58:16 dr 1.2.6.3: line/fill/character properties rework; first steps of chart text formatting and rotation import; make line arrow import work
2008/06/06 16:27:53 dr 1.2.6.2: chart formatting: builtin line/fill/effect styles, manual line formatting
2008/05/27 10:40:37 dr 1.2.6.1: joined changes from CWS xmlfilter05
Diffstat (limited to 'oox/source/drawingml/chart/axisconverter.cxx')
-rw-r--r-- | oox/source/drawingml/chart/axisconverter.cxx | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 89f49443f5ee..7f221db7ea5d 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -8,7 +8,7 @@ * * $RCSfile: axisconverter.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -31,10 +31,12 @@ #include "oox/drawingml/chart/axisconverter.hxx" #include <com/sun/star/chart2/AxisPosition.hpp> +#include <com/sun/star/chart2/TickmarkStyle.hpp> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/XCoordinateSystem.hpp> #include <com/sun/star/chart2/XTitled.hpp> +#include "oox/drawingml/lineproperties.hxx" #include "oox/drawingml/chart/axismodel.hxx" #include "oox/drawingml/chart/titleconverter.hxx" #include "oox/drawingml/chart/typegroupconverter.hxx" @@ -46,6 +48,7 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::chart2::IncrementData; using ::com::sun::star::chart2::ScaleData; using ::com::sun::star::chart2::SubIncrement; @@ -76,6 +79,18 @@ void lclSetScaledValueOrClearAny( Any& orAny, const OptValue< double >& rofValue lclSetValueOrClearAny( orAny, rofValue ); } +sal_Int32 lclGetTickMark( sal_Int32 nToken ) +{ + using namespace ::com::sun::star::chart2::TickmarkStyle; + switch( nToken ) + { + case XML_in: return INNER; + case XML_out: return OUTER; + case XML_cross: return INNER | OUTER; + } + return NONE; +} + } // namespace // ============================================================================ @@ -95,23 +110,49 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo Reference< XAxis > xAxis; try { + const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo(); + ObjectFormatter& rFormatter = getFormatter(); + // create the axis object (always) xAxis.set( createInstance( CREATE_OUSTRING( "com.sun.star.chart2.Axis" ) ), UNO_QUERY_THROW ); PropertySet aAxisProp( xAxis ); // #i58688# axis enabled aAxisProp.setProperty( CREATE_OUSTRING( "Show" ), !mrModel.mbDeleted ); - // axis line properties ----------------------------------------------- - - //! TODO - - // axis ticks and tick labels ----------------------------------------- - - //! TODO + // axis line, tick, and gridline properties --------------------------- + + // show axis labels + aAxisProp.setProperty( CREATE_OUSTRING( "DisplayLabels" ), mrModel.mnTickLabelPos != XML_none ); + // no X axis line in radar charts + if( (nAxisIdx == API_X_AXIS) && (rTypeInfo.meTypeCategory == TYPECATEGORY_RADAR) ) + mrModel.mxShapeProp.getOrCreate().getLineProperties().maLineFill.moFillType = XML_noFill; + // axis line and tick label formatting + rFormatter.convertFormatting( aAxisProp, mrModel.mxShapeProp, mrModel.mxTextProp, OBJECTTYPE_AXIS ); + // tick label rotation + rFormatter.convertTextRotation( aAxisProp, mrModel.mxTextProp ); + + // tick mark style + aAxisProp.setProperty( CREATE_OUSTRING( "MajorTickmarks" ), lclGetTickMark( mrModel.mnMajorTickMark ) ); + aAxisProp.setProperty( CREATE_OUSTRING( "MinorTickmarks" ), lclGetTickMark( mrModel.mnMinorTickMark ) ); + + // main grid + PropertySet aGridProp( xAxis->getGridProperties() ); + aGridProp.setProperty( CREATE_OUSTRING( "Show" ), mrModel.mxMajorGridLines.is() ); + if( mrModel.mxMajorGridLines.is() ) + rFormatter.convertFrameFormatting( aGridProp, mrModel.mxMajorGridLines, OBJECTTYPE_MAJORGRIDLINE ); + + // sub grid + Sequence< Reference< XPropertySet > > aSubGridPropSeq = xAxis->getSubGridProperties(); + if( aSubGridPropSeq.hasElements() ) + { + PropertySet aSubGridProp( aSubGridPropSeq[ 0 ] ); + aSubGridProp.setProperty( CREATE_OUSTRING( "Show" ), mrModel.mxMinorGridLines.is() ); + if( mrModel.mxMinorGridLines.is() ) + rFormatter.convertFrameFormatting( aSubGridProp, mrModel.mxMinorGridLines, OBJECTTYPE_MINORGRIDLINE ); + } // axis type and X axis categories ------------------------------------ - const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo(); ScaleData aScaleData = xAxis->getScaleData(); // set axis type namespace ApiAxisType = ::com::sun::star::chart2::AxisType; @@ -213,9 +254,10 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo // write back scaling data xAxis->setScaleData( aScaleData ); - // grid --------------------------------------------------------------- + // number format ------------------------------------------------------ - //! TODO + if( (aScaleData.AxisType == ApiAxisType::REALNUMBER) || (aScaleData.AxisType == ApiAxisType::PERCENT) ) + getFormatter().convertNumberFormat( aAxisProp, mrModel.maNumberFormat ); // axis position ------------------------------------------------------ @@ -229,7 +271,7 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo { Reference< XTitled > xTitled( xAxis, UNO_QUERY_THROW ); TitleConverter aTitleConv( *this, *mrModel.mxTitle ); - aTitleConv.convertFromModel( xTitled, CREATE_OUSTRING( "Axis Title" ) ); + aTitleConv.convertFromModel( xTitled, CREATE_OUSTRING( "Axis Title" ), OBJECTTYPE_AXISTITLE ); } } catch( Exception& ) |