Kaydet (Commit) c86aed38 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

Support regression curve name in OOXML (import & export).

Change-Id: I847e0df4f160e4b5078961a0e77c1e1e3fff9bd4
üst 2b243ba5
...@@ -148,7 +148,7 @@ struct TrendlineModel ...@@ -148,7 +148,7 @@ struct TrendlineModel
ShapeRef mxShapeProp; /// Trendline formatting. ShapeRef mxShapeProp; /// Trendline formatting.
TrendlineLabelRef mxLabel; /// Trendline label text object. 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 > mfBackward; /// Size of trendline before first data point.
OptValue< double > mfForward; /// Size of trendline behind last data point. OptValue< double > mfForward; /// Size of trendline behind last data point.
OptValue< double > mfIntercept; /// Crossing point with Y axis. OptValue< double > mfIntercept; /// Crossing point with Y axis.
......
...@@ -433,6 +433,8 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat ...@@ -433,6 +433,8 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat
Reference< XRegressionCurve > xRegCurve( createInstance( aServiceName ), UNO_QUERY_THROW ); Reference< XRegressionCurve > xRegCurve( createInstance( aServiceName ), UNO_QUERY_THROW );
PropertySet aPropSet( xRegCurve ); PropertySet aPropSet( xRegCurve );
// Name
aPropSet.setProperty( PROP_CurveName, mrModel.maName );
aPropSet.setProperty( PROP_PolynomialDegree, mrModel.mnOrder ); aPropSet.setProperty( PROP_PolynomialDegree, mrModel.mnOrder );
aPropSet.setProperty( PROP_MovingAveragePeriod, mrModel.mnPeriod ); aPropSet.setProperty( PROP_MovingAveragePeriod, mrModel.mnPeriod );
......
...@@ -1540,8 +1540,7 @@ void ChartExport::exportSeries( Reference< chart2::XChartType > xChartType, sal_ ...@@ -1540,8 +1540,7 @@ void ChartExport::exportSeries( Reference< chart2::XChartType > xChartType, sal_
if( eChartType != chart::TYPEID_SCATTER && eChartType != chart::TYPEID_BAR ) if( eChartType != chart::TYPEID_SCATTER && eChartType != chart::TYPEID_BAR )
exportDataLabels( uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ), nSeriesLength ); 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 //export error bars here
Reference< XPropertySet > xSeriesPropSet( xSource, uno::UNO_QUERY ); Reference< XPropertySet > xSeriesPropSet( xSource, uno::UNO_QUERY );
...@@ -2523,14 +2522,22 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries ) ...@@ -2523,14 +2522,22 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
if (!xRegCurve.is()) if (!xRegCurve.is())
continue; continue;
Reference< XPropertySet > xProperties( xRegCurve , uno::UNO_QUERY );
pFS->startElement( FSNS( XML_c, XML_trendline ), FSEND ); 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 ); exportShapeProps( xProperties );
OUString aService; OUString aService;
Reference< lang::XServiceName > xServiceName( xProperties, UNO_QUERY ); Reference< lang::XServiceName > xServiceName( xProperties, UNO_QUERY );
if( !xServiceName.is() ) if( !xServiceName.is() )
continue; continue;
...@@ -2593,8 +2600,8 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries ) ...@@ -2593,8 +2600,8 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
double aExtrapolateForward = 0.0; double aExtrapolateForward = 0.0;
double aExtrapolateBackward = 0.0; double aExtrapolateBackward = 0.0;
xProperties->getPropertyValue( "ExtrapolateForward") >>= aExtrapolateForward; xProperties->getPropertyValue("ExtrapolateForward") >>= aExtrapolateForward;
xProperties->getPropertyValue( "ExtrapolateBackward") >>= aExtrapolateBackward; xProperties->getPropertyValue("ExtrapolateBackward") >>= aExtrapolateBackward;
pFS->singleElement( FSNS( XML_c, XML_forward ), pFS->singleElement( FSNS( XML_c, XML_forward ),
XML_val, OString::number(aExtrapolateForward).getStr(), XML_val, OString::number(aExtrapolateForward).getStr(),
...@@ -2605,29 +2612,28 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries ) ...@@ -2605,29 +2612,28 @@ void ChartExport::exportTrendlines( Reference< chart2::XDataSeries > xSeries )
FSEND ); FSEND );
sal_Bool aForceIntercept = false; sal_Bool aForceIntercept = false;
xProperties->getPropertyValue( "ForceIntercept") >>= aForceIntercept; xProperties->getPropertyValue("ForceIntercept") >>= aForceIntercept;
if (aForceIntercept) if (aForceIntercept)
{ {
double aInterceptValue = 0.0; double aInterceptValue = 0.0;
xProperties->getPropertyValue( "InterceptValue") >>= aInterceptValue; xProperties->getPropertyValue("InterceptValue") >>= aInterceptValue;
pFS->singleElement( FSNS( XML_c, XML_intercept ), pFS->singleElement( FSNS( XML_c, XML_intercept ),
XML_val, OString::number(aInterceptValue).getStr(), XML_val, OString::number(aInterceptValue).getStr(),
FSEND ); FSEND );
} }
// Equation properties // Equation properties
Reference< XPropertySet > xEquationProperties( xRegCurve->getEquationProperties() ); Reference< XPropertySet > xEquationProperties( xRegCurve->getEquationProperties() );
// Show Equation // Show Equation
sal_Bool aShowEquation = false; sal_Bool aShowEquation = false;
xEquationProperties->getPropertyValue( "ShowEquation" ) >>= aShowEquation; xEquationProperties->getPropertyValue("ShowEquation") >>= aShowEquation;
// Show R^2 // Show R^2
sal_Bool aShowCorrelationCoefficient = false; sal_Bool aShowCorrelationCoefficient = false;
xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient" ) >>= aShowCorrelationCoefficient; xEquationProperties->getPropertyValue("ShowCorrelationCoefficient") >>= aShowCorrelationCoefficient;
pFS->singleElement( FSNS( XML_c, XML_dispRSqr ), pFS->singleElement( FSNS( XML_c, XML_dispRSqr ),
XML_val, aShowCorrelationCoefficient ? "1" : "0", XML_val, aShowCorrelationCoefficient ? "1" : "0",
......
...@@ -109,6 +109,7 @@ CrossoverValue ...@@ -109,6 +109,7 @@ CrossoverValue
CursorPositionX CursorPositionX
CursorPositionY CursorPositionY
CurveStyle CurveStyle
CurveName
CustomShapeGeometry CustomShapeGeometry
D3DSceneAmbientColor D3DSceneAmbientColor
D3DSceneLightColor2 D3DSceneLightColor2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment