[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - include/oox oox/source
Tomaž Vajngerl
quikee at gmail.com
Tue Dec 3 01:31:43 PST 2013
include/oox/drawingml/chart/seriesmodel.hxx | 2 -
oox/source/drawingml/chart/seriesconverter.cxx | 2 +
oox/source/export/chartexport.cxx | 28 +++++++++++++++----------
oox/source/token/properties.txt | 1
4 files changed, 21 insertions(+), 12 deletions(-)
New commits:
commit fc294a5c1ecc9465a3700f2a479be524e9f4f0de
Author: Tomaž Vajngerl <quikee at gmail.com>
Date: Sat Nov 23 20:30:49 2013 +0100
Support regression curve name in OOXML (import & export).
Change-Id: I847e0df4f160e4b5078961a0e77c1e1e3fff9bd4
Reviewed-on: https://gerrit.libreoffice.org/6875
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
Reviewed-by: Thorsten Behrens <thb at documentfoundation.org>
Tested-by: Thorsten Behrens <thb at documentfoundation.org>
diff --git a/include/oox/drawingml/chart/seriesmodel.hxx b/include/oox/drawingml/chart/seriesmodel.hxx
index c374e52..1d426cb 100644
--- a/include/oox/drawingml/chart/seriesmodel.hxx
+++ b/include/oox/drawingml/chart/seriesmodel.hxx
@@ -148,7 +148,7 @@ struct TrendlineModel
ShapeRef mxShapeProp; /// Trendline formatting.
TrendlineLabelRef mxLabel; /// Trendline label text object.
- OUString maName; /// User-defined name of the trendline.
+ OUString maName; /// User-defined name of the trendline.
OptValue< double > mfBackward; /// Size of trendline before first data point.
OptValue< double > mfForward; /// Size of trendline behind last data point.
OptValue< double > mfIntercept; /// Crossing point with Y axis.
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 1b56fef..5c85d99 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -433,6 +433,8 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat
Reference< XRegressionCurve > xRegCurve( createInstance( aServiceName ), UNO_QUERY_THROW );
PropertySet aPropSet( xRegCurve );
+ // Name
+ aPropSet.setProperty( PROP_CurveName, mrModel.maName );
aPropSet.setProperty( PROP_PolynomialDegree, mrModel.mnOrder );
aPropSet.setProperty( PROP_MovingAveragePeriod, mrModel.mnPeriod );
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 756f2ed..659252b 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1543,8 +1543,7 @@ void ChartExport::exportSeries( Reference< chart2::XChartType > xChartType, sal_
if( eChartType != chart::TYPEID_SCATTER && eChartType != chart::TYPEID_BAR )
exportDataLabels( uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ), nSeriesLength );
- if( eChartType == chart::TYPEID_SCATTER )
- exportTrendlines( aSeriesSeq[nSeriesIdx] );
+ exportTrendlines( aSeriesSeq[nSeriesIdx] );
//export error bars here
Reference< XPropertySet > xSeriesPropSet( xSource, uno::UNO_QUERY );
@@ -2526,14 +2525,22 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
if (!xRegCurve.is())
continue;
+ Reference< XPropertySet > xProperties( xRegCurve , uno::UNO_QUERY );
+
pFS->startElement( FSNS( XML_c, XML_trendline ), FSEND );
- Reference< XPropertySet > xProperties( xRegCurve , uno::UNO_QUERY );
+ OUString aName;
+ xProperties->getPropertyValue("CurveName") >>= aName;
+ if(!aName.isEmpty())
+ {
+ pFS->startElement( FSNS( XML_c, XML_name), FSEND);
+ pFS->writeEscaped(aName);
+ pFS->endElement( FSNS( XML_c, XML_name) );
+ }
exportShapeProps( xProperties );
OUString aService;
-
Reference< lang::XServiceName > xServiceName( xProperties, UNO_QUERY );
if( !xServiceName.is() )
continue;
@@ -2596,8 +2603,8 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
double aExtrapolateForward = 0.0;
double aExtrapolateBackward = 0.0;
- xProperties->getPropertyValue( "ExtrapolateForward") >>= aExtrapolateForward;
- xProperties->getPropertyValue( "ExtrapolateBackward") >>= aExtrapolateBackward;
+ xProperties->getPropertyValue("ExtrapolateForward") >>= aExtrapolateForward;
+ xProperties->getPropertyValue("ExtrapolateBackward") >>= aExtrapolateBackward;
pFS->singleElement( FSNS( XML_c, XML_forward ),
XML_val, OString::number(aExtrapolateForward).getStr(),
@@ -2608,29 +2615,28 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
FSEND );
sal_Bool aForceIntercept = false;
- xProperties->getPropertyValue( "ForceIntercept") >>= aForceIntercept;
+ xProperties->getPropertyValue("ForceIntercept") >>= aForceIntercept;
if (aForceIntercept)
{
double aInterceptValue = 0.0;
- xProperties->getPropertyValue( "InterceptValue") >>= aInterceptValue;
+ xProperties->getPropertyValue("InterceptValue") >>= aInterceptValue;
pFS->singleElement( FSNS( XML_c, XML_intercept ),
XML_val, OString::number(aInterceptValue).getStr(),
FSEND );
}
-
// Equation properties
Reference< XPropertySet > xEquationProperties( xRegCurve->getEquationProperties() );
// Show Equation
sal_Bool aShowEquation = false;
- xEquationProperties->getPropertyValue( "ShowEquation" ) >>= aShowEquation;
+ xEquationProperties->getPropertyValue("ShowEquation") >>= aShowEquation;
// Show R^2
sal_Bool aShowCorrelationCoefficient = false;
- xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient" ) >>= aShowCorrelationCoefficient;
+ xEquationProperties->getPropertyValue("ShowCorrelationCoefficient") >>= aShowCorrelationCoefficient;
pFS->singleElement( FSNS( XML_c, XML_dispRSqr ),
XML_val, aShowCorrelationCoefficient ? "1" : "0",
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index d89ae44..b0001e3 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -109,6 +109,7 @@ CrossoverValue
CursorPositionX
CursorPositionY
CurveStyle
+CurveName
CustomShapeGeometry
D3DSceneAmbientColor
D3DSceneLightColor2
More information about the Libreoffice-commits
mailing list