summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@novell.com>2011-07-07 12:22:49 +0530
committerMuthu Subramanian <sumuthu@novell.com>2011-07-07 12:22:49 +0530
commit8faf3f2e8b085285b51bd6a993efd2c9f68714d1 (patch)
treeaba8711ddd917753b33ede01363c41a6c8ec3343
parent4d564758097fee84cb531b6f6b754c5724b24587 (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.
-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 4cc2a8da2..3c17c98b8 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 8f56b629b..c9f44d0d4 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 7b3d2666f..2a2564fc8 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 );
}