summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-06-02 22:22:43 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-07-03 21:46:41 +0200
commitd070003bc43e19ef22a737202d018d8c9712b80e (patch)
tree878b7fa479abb113cc1b590ace70b4ddb3872f3b /xmloff
parentf65a9efc9abadaa804d1c4e2a26a5c95bd3cd555 (diff)
Refactor regression curve handling in xmloff import to use chart2.
Additionally support more regression curves per one series and add polynomial an moving average tokens. Conflicts: xmloff/source/chart/SchXMLPlotAreaContext.cxx Change-Id: I9dfebb1f47942c88ab0ccff48ec7632136fb1bc9
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/Library_xo.mk2
-rw-r--r--xmloff/source/chart/PropertyMap.hxx14
-rw-r--r--xmloff/source/chart/PropertyMaps.cxx24
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx3
-rw-r--r--xmloff/source/chart/SchXMLChartContext.hxx1
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx14
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx128
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.hxx28
-rw-r--r--xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx208
-rw-r--r--xmloff/source/chart/SchXMLRegressionCurveObjectContext.hxx88
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.cxx97
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.hxx9
-rw-r--r--xmloff/source/chart/XMLRegressionTypePropertyHdl.cxx62
-rw-r--r--xmloff/source/chart/XMLRegressionTypePropertyHdl.hxx27
-rw-r--r--xmloff/source/chart/transporttypes.hxx36
-rw-r--r--xmloff/source/core/xmltoken.cxx1
16 files changed, 525 insertions, 217 deletions
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk
index ba9efca2ba7d..319683102154 100644
--- a/xmloff/Library_xo.mk
+++ b/xmloff/Library_xo.mk
@@ -69,6 +69,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
xmloff/source/chart/SchXMLLegendContext \
xmloff/source/chart/SchXMLParagraphContext \
xmloff/source/chart/SchXMLPlotAreaContext \
+ xmloff/source/chart/SchXMLRegressionCurveObjectContext \
xmloff/source/chart/SchXMLSeries2Context \
xmloff/source/chart/SchXMLSeriesHelper \
xmloff/source/chart/SchXMLTableContext \
@@ -80,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
xmloff/source/chart/XMLErrorBarStylePropertyHdl \
xmloff/source/chart/XMLErrorIndicatorPropertyHdl \
xmloff/source/chart/XMLLabelSeparatorContext \
+ xmloff/source/chart/XMLRegressionTypePropertyHdl \
xmloff/source/chart/XMLSymbolImageContext \
xmloff/source/chart/XMLSymbolTypePropertyHdl \
xmloff/source/chart/XMLTextOrientationHdl \
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index f19b36593e72..a5f1bd2e25d6 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -30,7 +30,6 @@
#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
-#include <com/sun/star/chart/ChartRegressionCurveType.hpp>
#include <com/sun/star/chart/ChartSolidType.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -184,7 +183,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
MAP_ENTRY( "ShowNegativeError", CHART, XML_ERROR_LOWER_INDICATOR, XML_TYPE_BOOL),
MAP_ENTRY( "ErrorBarStyle", CHART, XML_ERROR_CATEGORY, XML_SCH_TYPE_ERROR_BAR_STYLE ),
MAP_ENTRY( "PercentageError", CHART, XML_ERROR_PERCENTAGE, XML_TYPE_DOUBLE ),
- MAP_ENTRY( "RegressionCurves", CHART, XML_REGRESSION_TYPE, XML_SCH_TYPE_REGRESSION_TYPE ),
+ MAP_ENTRY( "RegressionType", CHART, XML_REGRESSION_TYPE, XML_SCH_TYPE_REGRESSION_TYPE ),
MAP_SPECIAL_ODF12( "ErrorBarRangePositive", CHART, XML_ERROR_UPPER_RANGE, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE ), // export only
MAP_SPECIAL_ODF12( "ErrorBarRangeNegative", CHART, XML_ERROR_LOWER_RANGE, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE ), // export only
@@ -256,17 +255,6 @@ SvXMLEnumMapEntry aXMLChartErrorBarStyleEnumMap[] =
{ ::xmloff::token::XML_TOKEN_INVALID, 0 }
};
-SvXMLEnumMapEntry aXMLChartRegressionCurveTypeEnumMap[] =
-{
- { ::xmloff::token::XML_NONE, ::com::sun::star::chart::ChartRegressionCurveType_NONE },
- { ::xmloff::token::XML_LINEAR, ::com::sun::star::chart::ChartRegressionCurveType_LINEAR },
- { ::xmloff::token::XML_LOGARITHMIC, ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM },
- { ::xmloff::token::XML_EXPONENTIAL, ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL },
- { ::xmloff::token::XML_POLYNOMIAL, ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL },
- { ::xmloff::token::XML_POWER, ::com::sun::star::chart::ChartRegressionCurveType_POWER },
- { ::xmloff::token::XML_TOKEN_INVALID, 0 }
-};
-
SvXMLEnumMapEntry aXMLChartSolidTypeEnumMap[] =
{
{ ::xmloff::token::XML_CUBOID, ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID },
diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx
index 1f8bd7809748..9a0f3eb77a83 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -28,8 +28,15 @@
#include <sax/tools/converter.hxx>
-#include "XMLChartPropertySetMapper.hxx"
#include "SchXMLTools.hxx"
+#include "XMLChartPropertySetMapper.hxx"
+#include "XMLErrorIndicatorPropertyHdl.hxx"
+#include "XMLErrorBarStylePropertyHdl.hxx"
+#include "XMLTextOrientationHdl.hxx"
+#include "XMLSymbolTypePropertyHdl.hxx"
+#include "XMLAxisPositionPropertyHdl.hxx"
+#include "XMLRegressionTypePropertyHdl.hxx"
+
#include <xmloff/EnumPropertyHdl.hxx>
#include <xmloff/XMLConstantsPropertyHandler.hxx>
#include <xmloff/attrlist.hxx>
@@ -39,17 +46,13 @@
#include <xmloff/NamedBoolPropertyHdl.hxx>
#include <xmloff/xmlexp.hxx>
#include <xmloff/xmltoken.hxx>
-#include "XMLErrorIndicatorPropertyHdl.hxx"
-#include "XMLErrorBarStylePropertyHdl.hxx"
-#include "XMLTextOrientationHdl.hxx"
-#include "XMLSymbolTypePropertyHdl.hxx"
-#include "XMLAxisPositionPropertyHdl.hxx"
-#include <com/sun/star/chart/ChartAxisMarks.hpp>
-#include <com/sun/star/chart/ChartDataCaption.hpp>
-#include <com/sun/star/chart/ChartSymbolType.hpp>
+
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/chart/ChartAxisMarks.hpp>
+#include <com/sun/star/chart/ChartDataCaption.hpp>
+#include <com/sun/star/chart/ChartSymbolType.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/ChartAxisPosition.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -116,8 +119,7 @@ const XMLPropertyHandler* XMLChartPropHdlFactory::GetPropertyHandler( sal_Int32
break;
case XML_SCH_TYPE_REGRESSION_TYPE:
- pHdl = new XMLEnumPropertyHdl( aXMLChartRegressionCurveTypeEnumMap,
- ::getCppuType((const chart::ChartRegressionCurveType*)0) );
+ pHdl = new XMLRegressionTypePropertyHdl( );
break;
case XML_SCH_TYPE_ERROR_INDICATOR_LOWER:
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index f45b21056bcf..16d733bc5e68 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -887,6 +887,9 @@ void SchXMLChartContext::EndElement()
// ... then set attributes for statistics (after their existence was set in the series)
SchXMLSeries2Context::setStylesToStatisticsObjects( maSeriesDefaultsAndStyles
, pStylesCtxt, pStyle, sCurrStyleName );
+
+ SchXMLSeries2Context::setStylesToRegressionCurves( maSeriesDefaultsAndStyles
+ , pStylesCtxt, pStyle, sCurrStyleName );
}
}
diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx
index 91057b84f16a..1e86bb3c4552 100644
--- a/xmloff/source/chart/SchXMLChartContext.hxx
+++ b/xmloff/source/chart/SchXMLChartContext.hxx
@@ -73,6 +73,7 @@ struct SeriesDefaultsAndStyles
//styles for series and datapoints
::std::list< DataRowPointStyle > maSeriesStyleList;
+ ::std::list< RegressionStyle > maRegressionStyleList;
};
class SchXMLChartContext : public SvXMLImportContext
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index cc45d6a4300e..0995189c99e4 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2668,7 +2668,6 @@ void SchXMLExportHelper_Impl::exportSeries(
sal_Int32 nSeriesLength = 0;
sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y;
sal_Bool bHasMeanValueLine = false;
- chart::ChartRegressionCurveType eRegressionType( chart::ChartRegressionCurveType_NONE );
Reference< beans::XPropertySet > xPropSet;
tLabelValuesDataPair aSeriesLabelValuesPair;
@@ -2725,10 +2724,6 @@ void SchXMLExportHelper_Impl::exportSeries(
aAny = xPropSet->getPropertyValue(
OUString( "MeanValue" ));
aAny >>= bHasMeanValueLine;
-
- aAny = xPropSet->getPropertyValue(
- OUString( "RegressionCurves" ));
- aAny >>= eRegressionType;
}
catch( const beans::UnknownPropertyException & rEx )
{
@@ -2889,8 +2884,7 @@ void SchXMLExportHelper_Impl::exportSeries(
}
}
- if( eRegressionType != chart::ChartRegressionCurveType_NONE &&
- xPropSet.is() &&
+ if( xPropSet.is() &&
mxExpPropMapper.is() )
{
exportRegressionCurve( aSeriesSeq[nSeriesIdx], xPropSet, rPageSize, bExportContent );
@@ -2914,9 +2908,9 @@ void SchXMLExportHelper_Impl::exportSeries(
}
void SchXMLExportHelper_Impl::exportRegressionCurve(
- const Reference< chart2::XDataSeries > & xSeries,
- const Reference< beans::XPropertySet > & xSeriesProp,
- const awt::Size & rPageSize,
+ const Reference< chart2::XDataSeries >& xSeries,
+ const Reference< beans::XPropertySet >& xSeriesProp,
+ const awt::Size& rPageSize,
sal_Bool bExportContent )
{
OSL_ASSERT( mxExpPropMapper.is());
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 516178d8b355..684be432b6b1 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -21,6 +21,7 @@
#include <sax/tools/converter.hxx>
#include "SchXMLPlotAreaContext.hxx"
+#include "SchXMLRegressionCurveObjectContext.hxx"
#include "SchXMLImport.hxx"
#include "SchXMLAxisContext.hxx"
#include "SchXMLSeries2Context.hxx"
@@ -46,7 +47,6 @@
#include <com/sun/star/chart/X3DDisplay.hpp>
#include <com/sun/star/chart/XStatisticDisplay.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
-#include <com/sun/star/chart2/RegressionEquation.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
@@ -491,6 +491,7 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext(
mrImportHelper, GetImport(), rLocalName,
mxNewDoc, maAxes,
mrSeriesDefaultsAndStyles.maSeriesStyleList,
+ mrSeriesDefaultsAndStyles.maRegressionStyleList,
mnSeries,
mbStockHasVolume,
m_aGlobalSeriesImportInfo,
@@ -996,7 +997,6 @@ static void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocume
}
SchXMLStatisticsObjectContext::SchXMLStatisticsObjectContext(
-
SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport,
sal_uInt16 nPrefix,
@@ -1136,7 +1136,6 @@ void SetErrorBarPropertiesFromStyleName( const OUString& aStyleName, uno::Refere
}
-
void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
@@ -1149,6 +1148,7 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
{
OUString sAttrName = xAttrList->getNameByIndex( i );
OUString aLocalName;
+
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
if( nPrefix == XML_NAMESPACE_CHART )
@@ -1164,9 +1164,7 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
}
}
- // note: regression-curves must get a style-object even if there is no
- // auto-style set, because they can contain an equation
- if( !sAutoStyleName.isEmpty() || meContextType == CONTEXT_TYPE_REGRESSION_CURVE )
+ if( !sAutoStyleName.isEmpty() )
{
DataRowPointStyle aStyle( DataRowPointStyle::MEAN_VALUE, m_xSeries, -1, 1, sAutoStyleName );
@@ -1175,14 +1173,10 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
case CONTEXT_TYPE_MEAN_VALUE_LINE:
aStyle.meType = DataRowPointStyle::MEAN_VALUE;
break;
- case CONTEXT_TYPE_REGRESSION_CURVE:
- aStyle.meType = DataRowPointStyle::REGRESSION;
- break;
case CONTEXT_TYPE_ERROR_INDICATOR:
{
aStyle.meType = DataRowPointStyle::ERROR_INDICATOR;
- ;
uno::Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(),
uno::UNO_QUERY );
@@ -1231,120 +1225,8 @@ SvXMLImportContext* SchXMLStatisticsObjectContext::CreateChildContext(
const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
SvXMLImportContext* pContext = 0;
-
- if( nPrefix == XML_NAMESPACE_CHART &&
- IsXMLToken( rLocalName, XML_EQUATION ) )
- {
- pContext = new SchXMLEquationContext(
- mrImportHelper, GetImport(), nPrefix, rLocalName, m_xSeries, maChartSize, mrStyleList.back());
- }
- else
- {
- pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
- }
-
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
return pContext;
}
-// ========================================
-
-SchXMLEquationContext::SchXMLEquationContext(
- SchXMLImportHelper& rImpHelper,
- SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries >& xSeries,
- const awt::Size & rChartSize,
- DataRowPointStyle & rRegressionStyle ) :
- SvXMLImportContext( rImport, nPrefix, rLocalName ),
- mrImportHelper( rImpHelper ),
- mrRegressionStyle( rRegressionStyle ),
- m_xSeries( xSeries ),
- maChartSize( rChartSize )
-{}
-
-SchXMLEquationContext::~SchXMLEquationContext()
-{}
-
-void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
-{
- // parse attributes
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- SchXMLImport& rImport = ( SchXMLImport& )GetImport();
- const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetRegEquationAttrTokenMap();
- OUString sAutoStyleName;
-
- bool bShowEquation = true;
- bool bShowRSquare = false;
- awt::Point aPosition;
- bool bHasXPos = false;
- bool bHasYPos = false;
-
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
- {
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- OUString aValue = xAttrList->getValueByIndex( i );
- sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
- {
- case XML_TOK_REGEQ_POS_X:
- rImport.GetMM100UnitConverter().convertMeasureToCore(
- aPosition.X, aValue );
- bHasXPos = true;
- break;
- case XML_TOK_REGEQ_POS_Y:
- rImport.GetMM100UnitConverter().convertMeasureToCore(
- aPosition.Y, aValue );
- bHasYPos = true;
- break;
- case XML_TOK_REGEQ_DISPLAY_EQUATION:
- ::sax::Converter::convertBool(bShowEquation, aValue);
- break;
- case XML_TOK_REGEQ_DISPLAY_R_SQUARE:
- ::sax::Converter::convertBool(bShowRSquare, aValue);
- break;
- case XML_TOK_REGEQ_STYLE_NAME:
- sAutoStyleName = aValue;
- break;
- }
- }
-
- if( !sAutoStyleName.isEmpty() || bShowEquation || bShowRSquare )
- {
- uno::Reference< beans::XPropertySet > xEqProp = chart2::RegressionEquation::create( comphelper::getProcessComponentContext() );
-
- if( !sAutoStyleName.isEmpty() )
- {
- const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
- if( pStylesCtxt )
- {
- const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
- mrImportHelper.GetChartFamilyID(), sAutoStyleName );
- // note: SvXMLStyleContext::FillPropertySet is not const
- XMLPropStyleContext * pPropStyleContext =
- const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
-
- if( pPropStyleContext )
- pPropStyleContext->FillPropertySet( xEqProp );
- }
- }
- xEqProp->setPropertyValue("ShowEquation", uno::makeAny( bShowEquation ));
- xEqProp->setPropertyValue("ShowCorrelationCoefficient", uno::makeAny( bShowRSquare ));
-
- if( bHasXPos && bHasYPos )
- {
- chart2::RelativePosition aRelPos;
- aRelPos.Primary = static_cast< double >( aPosition.X ) / static_cast< double >( maChartSize.Width );
- aRelPos.Secondary = static_cast< double >( aPosition.Y ) / static_cast< double >( maChartSize.Height );
- xEqProp->setPropertyValue("RelativePosition",
- uno::makeAny( aRelPos ));
- }
- SAL_WARN_IF( mrRegressionStyle.meType != DataRowPointStyle::REGRESSION, "xmloff.chart", "mrRegressionStyle.meType != DataRowPointStyle::REGRESSION" );
- mrRegressionStyle.m_xEquationProperties.set( xEqProp );
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
index cf945c142567..7fee620af78c 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -251,7 +251,6 @@ public:
enum ContextType
{
CONTEXT_TYPE_MEAN_VALUE_LINE,
- CONTEXT_TYPE_REGRESSION_CURVE,
CONTEXT_TYPE_ERROR_INDICATOR
};
@@ -287,33 +286,6 @@ private:
tSchXMLLSequencesPerIndex& mrLSequencesPerIndex;
};
-// ----------------------------------------
-
-class SchXMLEquationContext : public SvXMLImportContext
-{
-public:
- SchXMLEquationContext(
- SchXMLImportHelper& rImportHelper,
- SvXMLImport& rImport,
- sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries >& xSeries,
- const ::com::sun::star::awt::Size & rChartSize,
- DataRowPointStyle & rRegressionStyle );
-
- virtual ~SchXMLEquationContext();
-
- virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
-
-private:
- SchXMLImportHelper & mrImportHelper;
- DataRowPointStyle & mrRegressionStyle;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries > m_xSeries;
- ::com::sun::star::awt::Size maChartSize;
-};
-
#endif // _SCH_XMLPLOTAREACONTEXT_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx b/xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx
new file mode 100644
index 000000000000..0e45160d1a42
--- /dev/null
+++ b/xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "SchXMLRegressionCurveObjectContext.hxx"
+
+#include <sax/tools/converter.hxx>
+
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlement.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/prstylei.hxx>
+#include <xmloff/xmlstyle.hxx>
+
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/chart2/RegressionEquation.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+
+using namespace com::sun::star;
+using namespace xmloff::token;
+
+using com::sun::star::uno::Reference;
+
+SchXMLRegressionCurveObjectContext::SchXMLRegressionCurveObjectContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString &rSeriesStyleName,
+ std::list< RegressionStyle >& rRegressionStyleList,
+ const css::uno::Reference<
+ css::chart2::XDataSeries >& xSeries,
+ const awt::Size & rChartSize) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mxSeries( xSeries ),
+ maChartSize( rChartSize ),
+ maSeriesStyleName( rSeriesStyleName),
+ mrRegressionStyleList( rRegressionStyleList )
+{
+}
+
+SchXMLRegressionCurveObjectContext::~SchXMLRegressionCurveObjectContext()
+{
+}
+
+void SchXMLRegressionCurveObjectContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttributeList )
+{
+ sal_Int16 nAttributeCount = xAttributeList.is()? xAttributeList->getLength(): 0;
+ OUString sAutoStyleName;
+
+ for( sal_Int16 i = 0; i < nAttributeCount; i++ )
+ {
+ OUString sAttributeName = xAttributeList->getNameByIndex( i );
+ OUString aLocalName;
+
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttributeName, &aLocalName );
+
+ if( nPrefix == XML_NAMESPACE_CHART )
+ {
+ if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
+ {
+ sAutoStyleName = xAttributeList->getValueByIndex( i );
+ }
+ }
+ }
+
+ RegressionStyle aStyle( mxSeries, sAutoStyleName );
+ mrRegressionStyleList.push_back( aStyle );
+}
+
+SvXMLImportContext* SchXMLRegressionCurveObjectContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ SvXMLImportContext* pContext = 0;
+
+ if( nPrefix == XML_NAMESPACE_CHART && IsXMLToken( rLocalName, XML_EQUATION ) )
+ {
+ pContext = new SchXMLEquationContext(
+ mrImportHelper, GetImport(), nPrefix, rLocalName, mxSeries, maChartSize, mrRegressionStyleList.back());
+ }
+ else
+ {
+ pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
+ }
+
+ return pContext;
+}
+
+SchXMLEquationContext::SchXMLEquationContext(
+ SchXMLImportHelper& rImpHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const css::uno::Reference<
+ css::chart2::XDataSeries >& xSeries,
+ const awt::Size& rChartSize,
+ RegressionStyle& rRegressionStyle ) :
+
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mrImportHelper( rImpHelper ),
+ mrRegressionStyle( rRegressionStyle ),
+ mxSeries( xSeries ),
+ maChartSize( rChartSize )
+{}
+
+SchXMLEquationContext::~SchXMLEquationContext()
+{}
+
+void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ // parse attributes
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ SchXMLImport& rImport = ( SchXMLImport& )GetImport();
+ const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetRegEquationAttrTokenMap();
+ OUString sAutoStyleName;
+
+ bool bShowEquation = true;
+ bool bShowRSquare = false;
+ awt::Point aPosition;
+ bool bHasXPos = false;
+ bool bHasYPos = false;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ OUString aValue = xAttrList->getValueByIndex( i );
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+ {
+ case XML_TOK_REGEQ_POS_X:
+ rImport.GetMM100UnitConverter().convertMeasureToCore(
+ aPosition.X, aValue );
+ bHasXPos = true;
+ break;
+ case XML_TOK_REGEQ_POS_Y:
+ rImport.GetMM100UnitConverter().convertMeasureToCore(
+ aPosition.Y, aValue );
+ bHasYPos = true;
+ break;
+ case XML_TOK_REGEQ_DISPLAY_EQUATION:
+ ::sax::Converter::convertBool(bShowEquation, aValue);
+ break;
+ case XML_TOK_REGEQ_DISPLAY_R_SQUARE:
+ ::sax::Converter::convertBool(bShowRSquare, aValue);
+ break;
+ case XML_TOK_REGEQ_STYLE_NAME:
+ sAutoStyleName = aValue;
+ break;
+ }
+ }
+
+ if( !sAutoStyleName.isEmpty() || bShowEquation || bShowRSquare )
+ {
+ uno::Reference< beans::XPropertySet > xEqProp = chart2::RegressionEquation::create( comphelper::getProcessComponentContext() );
+
+ if( !sAutoStyleName.isEmpty() )
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
+ {
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ mrImportHelper.GetChartFamilyID(), sAutoStyleName );
+ // note: SvXMLStyleContext::FillPropertySet is not const
+ XMLPropStyleContext * pPropStyleContext =
+ const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
+
+ if( pPropStyleContext )
+ pPropStyleContext->FillPropertySet( xEqProp );
+ }
+ }
+ xEqProp->setPropertyValue( OUString( "ShowEquation"), uno::makeAny( bShowEquation ));
+ xEqProp->setPropertyValue( OUString( "ShowCorrelationCoefficient"), uno::makeAny( bShowRSquare ));
+
+ if( bHasXPos && bHasYPos )
+ {
+ chart2::RelativePosition aRelPos;
+ aRelPos.Primary = static_cast< double >( aPosition.X ) / static_cast< double >( maChartSize.Width );
+ aRelPos.Secondary = static_cast< double >( aPosition.Y ) / static_cast< double >( maChartSize.Height );
+ xEqProp->setPropertyValue( OUString( "RelativePosition" ),
+ uno::makeAny( aRelPos ));
+ }
+ mrRegressionStyle.m_xEquationProperties.set( xEqProp );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLRegressionCurveObjectContext.hxx b/xmloff/source/chart/SchXMLRegressionCurveObjectContext.hxx
new file mode 100644
index 000000000000..e355449cfce0
--- /dev/null
+++ b/xmloff/source/chart/SchXMLRegressionCurveObjectContext.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SCH_XMLREGRESSIONCURVEOBJECTCONTEXT_HXX_
+#define _SCH_XMLREGRESSIONCURVEOBJECTCONTEXT_HXX_
+
+#include "SchXMLImport.hxx"
+
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/shapeimport.hxx>
+#include <list>
+
+#include "transporttypes.hxx"
+
+class SchXMLRegressionCurveObjectContext : public SvXMLImportContext
+{
+public:
+ SchXMLRegressionCurveObjectContext(
+ SchXMLImportHelper& rImportHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const OUString &rSeriesStyleName,
+ std::list< RegressionStyle >& rRegressionStyleList,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::com::sun::star::awt::Size & rChartSize );
+
+ virtual ~SchXMLRegressionCurveObjectContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual SvXMLImportContext* CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+
+ SchXMLImportHelper& mrImportHelper;
+ com::sun::star::uno::Reference<com::sun::star::chart2::XDataSeries > mxSeries;
+ com::sun::star::awt::Size maChartSize;
+ OUString maSeriesStyleName;
+ std::list< RegressionStyle >& mrRegressionStyleList;
+};
+
+class SchXMLEquationContext : public SvXMLImportContext
+{
+public:
+ SchXMLEquationContext(
+ SchXMLImportHelper& rImportHelper,
+ SvXMLImport& rImport,
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries,
+ const ::com::sun::star::awt::Size & rChartSize,
+ RegressionStyle & rRegressionStyle );
+
+ virtual ~SchXMLEquationContext();
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ SchXMLImportHelper& mrImportHelper;
+ RegressionStyle& mrRegressionStyle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > mxSeries;
+ ::com::sun::star::awt::Size maChartSize;
+};
+
+#endif // _SCH_XMLPLOTAREACONTEXT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index d45774176ca1..f451da10ae2c 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -20,12 +20,14 @@
#include "SchXMLSeries2Context.hxx"
#include "SchXMLPlotAreaContext.hxx"
+#include "SchXMLRegressionCurveObjectContext.hxx"
#include "SchXMLTools.hxx"
#include "PropertyMap.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XRegressionCurve.hpp>
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart2/data/XDataSink.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
@@ -38,6 +40,8 @@
#include <com/sun/star/embed/XVisualObject.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/processfactory.hxx>
+
// header for define DBG_ERROR1
#include <tools/debug.hxx>
#include <rtl/ustrbuf.hxx>
@@ -247,6 +251,7 @@ SchXMLSeries2Context::SchXMLSeries2Context(
const Reference< chart2::XChartDocument > & xNewDoc,
std::vector< SchXMLAxis >& rAxes,
::std::list< DataRowPointStyle >& rStyleList,
+ ::std::list< RegressionStyle >& rRegressionStyleList,
sal_Int32 nSeriesIndex,
sal_Bool bStockHasVolume,
GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
@@ -259,6 +264,7 @@ SchXMLSeries2Context::SchXMLSeries2Context(
mxNewDoc( xNewDoc ),
mrAxes( rAxes ),
mrStyleList( rStyleList ),
+ mrRegressionStyleList( rRegressionStyleList ),
m_xSeries(0),
mnSeriesIndex( nSeriesIndex ),
mnDataPointIndex( 0 ),
@@ -644,12 +650,10 @@ SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
maChartSize, mrLSequencesPerIndex );
break;
case XML_TOK_SERIES_REGRESSION_CURVE:
- pContext = new SchXMLStatisticsObjectContext(
+ pContext = new SchXMLRegressionCurveObjectContext(
mrImportHelper, GetImport(),
- nPrefix, rLocalName, msAutoStyleName,
- mrStyleList, m_xSeries,
- SchXMLStatisticsObjectContext::CONTEXT_TYPE_REGRESSION_CURVE,
- maChartSize, mrLSequencesPerIndex );
+ nPrefix, rLocalName, msAutoStyleName, mrRegressionStyleList,
+ m_xSeries, maChartSize );
break;
case XML_TOK_SERIES_ERROR_INDICATOR:
pContext = new SchXMLStatisticsObjectContext(
@@ -842,6 +846,70 @@ void SchXMLSeries2Context::setStylesToSeries( SeriesDefaultsAndStyles& rSeriesDe
}
// static
+void SchXMLSeries2Context::setStylesToRegressionCurves(
+ SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
+ const SvXMLStylesContext* pStylesCtxt,
+ const SvXMLStyleContext*& rpStyle,
+ OUString& rCurrStyleName )
+{
+ std::list< RegressionStyle >::iterator iStyle;
+
+ // iterate over regession etc
+ for( iStyle = rSeriesDefaultsAndStyles.maRegressionStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maRegressionStyleList.end(); ++iStyle )
+ {
+ try
+ {
+ if( !(iStyle->msStyleName).isEmpty() )
+ {
+ if( !rCurrStyleName.equals( iStyle->msStyleName ) )
+ {
+ rCurrStyleName = iStyle->msStyleName;
+ rpStyle = pStylesCtxt->FindStyleChildContext(
+ SchXMLImportHelper::GetChartFamilyID(), rCurrStyleName );
+ }
+
+ XMLPropStyleContext* pPropStyleContext =
+ const_cast< XMLPropStyleContext* >(
+ dynamic_cast< const XMLPropStyleContext* >( rpStyle ));
+
+ if( pPropStyleContext )
+ {
+ uno::Any aAny = SchXMLTools::getPropertyFromContext("RegressionType", pPropStyleContext, pStylesCtxt);
+
+ if ( aAny.hasValue() )
+ {
+ OUString aServiceName;
+ aAny >>= aServiceName;
+
+ if( !aServiceName.isEmpty() )
+ {
+ Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
+ Reference< chart2::XRegressionCurve > xRegCurve( xMSF->createInstance( aServiceName ), uno::UNO_QUERY_THROW );
+ if( xRegCurve.is())
+ {
+ Reference< beans::XPropertySet > xCurveProperties( xRegCurve, uno::UNO_QUERY );
+ pPropStyleContext->FillPropertySet( xCurveProperties );
+
+ xRegCurve->setEquationProperties( iStyle->m_xEquationProperties );
+ }
+
+ Reference< chart2::XRegressionCurveContainer > xRegCurveCont( iStyle->m_xSeries, uno::UNO_QUERY_THROW );
+ xRegCurveCont->addRegressionCurve( xRegCurve );
+
+ }
+ }
+ }
+ }
+ }
+ catch( const uno::Exception & rEx )
+ {
+ SAL_INFO("xmloff.chart", "Exception caught during setting styles to series: " << rEx.Message );
+ }
+
+ }
+}
+
+// static
void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
, const SvXMLStylesContext* pStylesCtxt
, const SvXMLStyleContext*& rpStyle
@@ -852,8 +920,7 @@ void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles
// iterate over regession etc
for( iStyle = rSeriesDefaultsAndStyles.maSeriesStyleList.begin(); iStyle != rSeriesDefaultsAndStyles.maSeriesStyleList.end(); ++iStyle )
{
- if( iStyle->meType == DataRowPointStyle::REGRESSION ||
- iStyle->meType == DataRowPointStyle::ERROR_INDICATOR ||
+ if( iStyle->meType == DataRowPointStyle::ERROR_INDICATOR ||
iStyle->meType == DataRowPointStyle::MEAN_VALUE )
{
if ( iStyle->meType == DataRowPointStyle::ERROR_INDICATOR )
@@ -895,10 +962,6 @@ void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles
xSeriesProp->getPropertyValue(
OUString( "DataMeanValueProperties" )) >>= xStatPropSet;
break;
- case DataRowPointStyle::REGRESSION:
- xSeriesProp->getPropertyValue(
- OUString( "DataRegressionProperties" )) >>= xStatPropSet;
- break;
case DataRowPointStyle::ERROR_INDICATOR:
xSeriesProp->getPropertyValue(
OUString( "DataErrorProperties" )) >>= xStatPropSet;
@@ -910,18 +973,6 @@ void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles
pPropStyleContext->FillPropertySet( xStatPropSet );
}
}
-
- // set equation properties at a regression curve
- // note: this must be done after setting the regression
- // properties at the old API, otherwise the curve itself does
- // not exist here
- if( iStyle->meType == DataRowPointStyle::REGRESSION && iStyle->m_xEquationProperties.is())
- {
- SAL_WARN_IF( !iStyle->m_xSeries.is(), "xmloff.chart", "iStyle->m_xSeries is NULL");
- Reference< chart2::XRegressionCurve > xRegCurve( SchXMLTools::getRegressionCurve( iStyle->m_xSeries ));
- if( xRegCurve.is())
- xRegCurve->setEquationProperties( iStyle->m_xEquationProperties );
- }
}
catch( const uno::Exception & rEx )
{
diff --git a/xmloff/source/chart/SchXMLSeries2Context.hxx b/xmloff/source/chart/SchXMLSeries2Context.hxx
index 44819bb9a38b..7503bc1131b3 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.hxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.hxx
@@ -48,6 +48,8 @@ private:
::com::sun::star::chart2::XChartDocument > mxNewDoc;
::std::vector< SchXMLAxis >& mrAxes;
::std::list< DataRowPointStyle >& mrStyleList;
+ ::std::list< RegressionStyle >& mrRegressionStyleList;
+
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > m_xSeries;
sal_Int32 mnSeriesIndex;
sal_Int32 mnDataPointIndex;
@@ -77,6 +79,7 @@ public:
::com::sun::star::chart2::XChartDocument > & xNewDoc,
std::vector< SchXMLAxis >& rAxes,
::std::list< DataRowPointStyle >& rStyleList,
+ ::std::list< RegressionStyle >& rRegressionStyleList,
sal_Int32 nSeriesIndex,
sal_Bool bStockHasVolume,
GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
@@ -112,6 +115,12 @@ public:
, const SvXMLStyleContext*& rpStyle
, OUString &rCurrStyleName );
+ static void setStylesToRegressionCurves(
+ SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles,
+ const SvXMLStylesContext* pStylesCtxt,
+ const SvXMLStyleContext*& rpStyle,
+ OUString &rCurrStyleName );
+
static void setStylesToDataPoints( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
, const SvXMLStylesContext* pStylesCtxt
, const SvXMLStyleContext*& rpStyle
diff --git a/xmloff/source/chart/XMLRegressionTypePropertyHdl.cxx b/xmloff/source/chart/XMLRegressionTypePropertyHdl.cxx
new file mode 100644
index 000000000000..62e1ef7e38c7
--- /dev/null
+++ b/xmloff/source/chart/XMLRegressionTypePropertyHdl.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "XMLRegressionTypePropertyHdl.hxx"
+#include <xmloff/xmluconv.hxx>
+
+using namespace css;
+using namespace xmloff::token;
+
+XMLRegressionTypePropertyHdl::XMLRegressionTypePropertyHdl()
+{}
+
+XMLRegressionTypePropertyHdl::~XMLRegressionTypePropertyHdl()
+{}
+
+sal_Bool XMLRegressionTypePropertyHdl::importXML( const OUString& rStrImpValue,
+ uno::Any& rValue, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ OUString aServiceName;
+
+ if (IsXMLToken( rStrImpValue, XML_LINEAR ))
+ {
+ aServiceName = "com.sun.star.chart2.LinearRegressionCurve";
+ }
+ else if (IsXMLToken( rStrImpValue, XML_LOGARITHMIC))
+ {
+ aServiceName = "com.sun.star.chart2.LogarithmicRegressionCurve";
+ }
+ else if (IsXMLToken( rStrImpValue, XML_EXPONENTIAL))
+ {
+ aServiceName = "com.sun.star.chart2.ExponentialRegressionCurve";
+ }
+ else if (IsXMLToken( rStrImpValue, XML_POWER))
+ {
+ aServiceName = "com.sun.star.chart2.PotentialRegressionCurve";
+ }
+ else if (IsXMLToken( rStrImpValue, XML_POLYNOMIAL))
+ {
+ aServiceName = "com.sun.star.chart2.PolynomialRegressionCurve";
+ }
+ else if (IsXMLToken( rStrImpValue, XML_MOVING_AVERAGE))
+ {
+ aServiceName = "com.sun.star.chart2.MovingAverageRegressionCurve";
+ }
+ rValue <<= aServiceName;
+
+ return true;
+}
+
+sal_Bool XMLRegressionTypePropertyHdl::exportXML( OUString& /*rStrExpValue*/,
+ const uno::Any& /*rValue*/, const SvXMLUnitConverter& /*rUnitConverter*/ ) const
+{
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/XMLRegressionTypePropertyHdl.hxx b/xmloff/source/chart/XMLRegressionTypePropertyHdl.hxx
new file mode 100644
index 000000000000..c53544f4cd9f
--- /dev/null
+++ b/xmloff/source/chart/XMLRegressionTypePropertyHdl.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _XMLREGRESSIONTYPEPROPERTYHDL_HXX_
+#define _XMLREGRESSIONTYPEPROPERTYHDL_HXX_
+
+#include <xmloff/xmlprhdl.hxx>
+
+class XMLRegressionTypePropertyHdl : public XMLPropertyHandler
+{
+public:
+ XMLRegressionTypePropertyHdl();
+ virtual ~XMLRegressionTypePropertyHdl();
+
+ virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLERRORBARSTYLEPROPERTYHDL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx
index 92efcae36400..65afd19eaa27 100644
--- a/xmloff/source/chart/transporttypes.hxx
+++ b/xmloff/source/chart/transporttypes.hxx
@@ -151,6 +151,23 @@ struct GlobalSeriesImportInfo
sal_Int32 nFirstSecondDomainIndex;
};
+struct RegressionStyle
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::chart2::XDataSeries > m_xSeries;
+ com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet > m_xEquationProperties;
+
+ OUString msStyleName;
+
+ RegressionStyle(const com::sun::star::uno::Reference<
+ com::sun::star::chart2::XDataSeries >& xSeries,
+ OUString sStyleName) :
+ m_xSeries ( xSeries ),
+ msStyleName ( sStyleName )
+ {}
+};
+
struct DataRowPointStyle
{
enum StyleType
@@ -158,21 +175,22 @@ struct DataRowPointStyle
DATA_POINT,
DATA_SERIES,
MEAN_VALUE,
- REGRESSION,
ERROR_INDICATOR
};
StyleType meType;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries > m_xSeries;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > m_xOldAPISeries;
+ com::sun::star::uno::Reference<
+ com::sun::star::chart2::XDataSeries > m_xSeries;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySet > m_xOldAPISeries;
+
com::sun::star::uno::Reference<
com::sun::star::beans::XPropertySet > m_xErrorXProperties;
+
com::sun::star::uno::Reference<
com::sun::star::beans::XPropertySet > m_xErrorYProperties;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > m_xEquationProperties;
+
sal_Int32 m_nPointIndex;
sal_Int32 m_nPointRepeat;
OUString msStyleName;
@@ -181,8 +199,8 @@ struct DataRowPointStyle
bool mbSymbolSizeForSeriesIsMissingInFile;
DataRowPointStyle( StyleType eType
- , const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XDataSeries >& xSeries
+ , const com::sun::star::uno::Reference<
+ com::sun::star::chart2::XDataSeries >& xSeries
, sal_Int32 nPointIndex
, sal_Int32 nPointRepeat
, OUString sStyleName
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 1de31799cfbf..4448f5920c8d 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1231,6 +1231,7 @@ namespace xmloff { namespace token {
TOKEN( "movement", XML_MOVEMENT ),
TOKEN( "movement-cut-off", XML_MOVEMENT_CUT_OFF ),
TOKEN( "mover", XML_MOVER ),
+ TOKEN( "moving-average", XML_MOVING_AVERAGE ),
TOKEN( "mpadded", XML_MPADDED ),
TOKEN( "mphantom", XML_MPHANTOM ),
TOKEN( "mprescripts", XML_MPRESCRIPTS ),