summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@novell.com>2011-07-07 12:22:49 +0530
committerMichael Meeks <michael.meeks@novell.com>2011-07-11 12:08:45 +0100
commit8dbc5e5e88d9b01a6fd08b793bc3b7339e044004 (patch)
tree52970e51ff24136582fb6b31197b3588a25c6778
parent1f9298feba39e3262e6a8120e403f9ab898e7a4b (diff)
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. Signed-off-by: Michael Meeks <michael.meeks@novell.com>
-rw-r--r--oox/source/drawingml/chart/axisconverter.cxx4
-rw-r--r--oox/source/drawingml/chart/chartconverter.cxx6
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx14
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 );
}