diff options
author | Muthu Subramanian <sumuthu@novell.com> | 2011-07-07 12:22:49 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@novell.com> | 2011-07-07 12:22:49 +0530 |
commit | bb1a16323ea80f5d8d6b579af94ad1cd1ad4e36e (patch) | |
tree | fdd2e7d51028a9e6d4c589445418a9b66836f879 /oox | |
parent | Some more ODG style mappings that LO understands and displays properly (diff) | |
download | core-bb1a16323ea80f5d8d6b579af94ad1cd1ad4e36e.tar.gz core-bb1a16323ea80f5d8d6b579af94ad1cd1ad4e36e.zip |
n#694356: Using formatcode while displaying labels.
Used when the lables don't have their own formatcode
and depend on the data's format code for formatting.
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/chart/axisconverter.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/chart/chartconverter.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/chart/seriesconverter.cxx | 14 |
3 files changed, 21 insertions, 3 deletions
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 2225d7f5ae27..d07d28c79ae8 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -315,7 +315,11 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo // number format ------------------------------------------------------ if( (aScaleData.AxisType == cssc2::AxisType::REALNUMBER) || (aScaleData.AxisType == cssc2::AxisType::PERCENT) ) + { + if( mrModel.maNumberFormat.maFormatCode.indexOfAsciiL("%",1) >= 0) + mrModel.maNumberFormat.mbSourceLinked = false; getFormatter().convertNumberFormat( aAxisProp, mrModel.maNumberFormat ); + } // position of crossing axis ------------------------------------------ diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index e66eca6bc0e2..261494327efd 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -59,7 +59,7 @@ static const sal_Unicode API_TOKEN_ARRAY_CLOSE = '}'; static const sal_Unicode API_TOKEN_ARRAY_ROWSEP = '|'; static const sal_Unicode API_TOKEN_ARRAY_COLSEP = ';'; -// Code similar to oox/source/xls/FormulaParser.cxx +// Code similar to oox/source/xls/formulabase.cxx static OUString lclGenerateApiString( const OUString& rString ) { OUString aRetString = rString; @@ -69,7 +69,7 @@ static OUString lclGenerateApiString( const OUString& rString ) return OUStringBuffer().append( sal_Unicode( '"' ) ).append( aRetString ).append( sal_Unicode( '"' ) ).makeStringAndClear(); } - static ::rtl::OUString lclGenerateApiArray( const Matrix< Any >& rMatrix ) +static ::rtl::OUString lclGenerateApiArray( const Matrix< Any >& rMatrix ) { OSL_ENSURE( !rMatrix.empty(), "ChartConverter::lclGenerateApiArray - missing matrix values" ); OUStringBuffer aBuffer; @@ -156,7 +156,7 @@ Reference< XDataSequence > ChartConverter::createDataSequence( const Reference< } catch( Exception& ) { - OSL_FAIL( "ExcelChartConverter::createDataSequence - cannot create data sequence" ); + OSL_FAIL( "ChartConverter::createDataSequence - cannot create data sequence" ); } } diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 4005ac46c46e..8a98471abca9 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -124,6 +124,13 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt bool bShowValue = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( false ); bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.get( false ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE); + if( bShowValue && + !bShowPercent && rTypeInfo.meTypeCategory == TYPECATEGORY_PIE && + rDataLabel.maNumberFormat.maFormatCode.indexOfAsciiL("%", 1) >= 0 ) + { + bShowValue = false; + bShowPercent = true; + } bool bShowCateg = !rDataLabel.mbDeleted && rDataLabel.mobShowCatName.get( false ); bool bShowSymbol = !rDataLabel.mbDeleted && rDataLabel.mobShowLegendKey.get( false ); @@ -237,6 +244,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa // data point label settings for( DataLabelsModel::DataLabelVector::iterator aIt = mrModel.maPointLabels.begin(), aEnd = mrModel.maPointLabels.end(); aIt != aEnd; ++aIt ) { + (*aIt)->maNumberFormat.maFormatCode = mrModel.maNumberFormat.maFormatCode; DataLabelConverter aLabelConv( *this, **aIt ); aLabelConv.convertFromModel( rxDataSeries, rTypeGroup ); } @@ -627,6 +635,12 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve ModelRef< DataLabelsModel > xLabels = mrModel.mxLabels.is() ? mrModel.mxLabels : rTypeGroup.getModel().mxLabels; if( xLabels.is() ) { + if( xLabels->maNumberFormat.maFormatCode.isEmpty() ) + { + // Use number format code from Value series + DataSourceModel* pValues = mrModel.maSources.get( SeriesModel::VALUES ).get(); + xLabels->maNumberFormat.maFormatCode = pValues->mxDataSeq->maFormatCode; + } DataLabelsConverter aLabelsConv( *this, *xLabels ); aLabelsConv.convertFromModel( xDataSeries, rTypeGroup ); } |