summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-02-26 07:38:06 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-02-26 09:06:28 +0000
commit01f8d0a1dffce854a66c0f957e81e6df6d361a86 (patch)
tree7f83150fb6d4504f9cf171e7e8006b514395a5d0
parent3b605c98a1e6385211e1f2ab76a1b86202f988cb (diff)
get error bar import working again, fdo#60083
Change-Id: I8022fbfc8d372c9863d236253a2a63364198bfc8 Reviewed-on: https://gerrit.libreoffice.org/2415 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx141
1 files changed, 88 insertions, 53 deletions
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 0697e8e89593..e5b16fd321ec 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -1037,6 +1037,91 @@ SchXMLStatisticsObjectContext::~SchXMLStatisticsObjectContext()
{
}
+namespace {
+
+void SetErrorBarPropertiesFromStyleName( const OUString& aStyleName, uno::Reference< beans::XPropertySet> xBarProp,
+ SchXMLImportHelper& rImportHelper)
+{
+ const SvXMLStylesContext* pStylesCtxt = rImportHelper.GetAutoStylesContext();
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(rImportHelper.GetChartFamilyID(),
+ aStyleName);
+
+ XMLPropStyleContext * pSeriesStyleContext =
+ const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
+
+ uno::Any aAny = SchXMLTools::getPropertyFromContext("ErrorBarStyle",
+ pSeriesStyleContext,pStylesCtxt);
+
+ if ( aAny.hasValue() )
+ {
+ sal_Int32 aBarStyle = com::sun::star::chart::ErrorBarStyle::NONE;
+ aAny >>= aBarStyle;
+ xBarProp->setPropertyValue("ErrorBarStyle", aAny);
+
+ aAny = SchXMLTools::getPropertyFromContext("ShowPositiveError",
+ pSeriesStyleContext,pStylesCtxt);
+
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("ShowPositiveError",aAny);
+
+ aAny = SchXMLTools::getPropertyFromContext("ShowNegativeError",
+ pSeriesStyleContext,pStylesCtxt);
+
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("ShowNegativeError",aAny);
+
+ aAny = SchXMLTools::getPropertyFromContext("PositiveError",
+ pSeriesStyleContext, pStylesCtxt);
+
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("PositiveError", aAny);
+ else
+ {
+ aAny = SchXMLTools::getPropertyFromContext("ConstantErrorHigh",
+ pSeriesStyleContext, pStylesCtxt);
+
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("PositiveError", aAny);
+ }
+
+ aAny = SchXMLTools::getPropertyFromContext("NegativeError",
+ pSeriesStyleContext, pStylesCtxt);
+
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("NegativeError", aAny);
+ else
+ {
+ aAny = SchXMLTools::getPropertyFromContext("ConstantErrorLow",
+ pSeriesStyleContext, pStylesCtxt);
+
+ if(aAny.hasValue())
+ xBarProp->setPropertyValue("NegativeError", aAny);
+ }
+
+ switch(aBarStyle)
+ {
+ case com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
+ {
+ aAny = SchXMLTools::getPropertyFromContext("NegativeError",
+ pSeriesStyleContext,pStylesCtxt);
+
+ xBarProp->setPropertyValue("NegativeError",aAny);
+
+ aAny = SchXMLTools::getPropertyFromContext("PositiveError",
+ pSeriesStyleContext,pStylesCtxt);
+
+ xBarProp->setPropertyValue("PositiveError",aAny);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+}
+
+
void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
@@ -1096,15 +1181,10 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
xBarProp->setPropertyValue("ShowPositiveError",uno::makeAny(sal_True));
xBarProp->setPropertyValue("ShowNegativeError",uno::makeAny(sal_True));
- const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
- const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
- mrImportHelper.GetChartFamilyID(), sAutoStyleName );
- // note: SvXMLStyleContext::FillPropertySet is not const
- XMLPropStyleContext * pErrorStyleContext =
- const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
-
- pErrorStyleContext->FillPropertySet( xBarProp );
+ // first import defaults from parent style
+ SetErrorBarPropertiesFromStyleName( maSeriesStyleName, xBarProp, mrImportHelper );
+ SetErrorBarPropertiesFromStyleName( sAutoStyleName, xBarProp, mrImportHelper );
uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY);
@@ -1120,51 +1200,6 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
}
else
{
- /// Keep 0DF12 and below support
- pStyle = pStylesCtxt->FindStyleChildContext(mrImportHelper.GetChartFamilyID(),
- maSeriesStyleName);
-
- XMLPropStyleContext * pSeriesStyleContext =
- const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
-
- uno::Any aAny = SchXMLTools::getPropertyFromContext("ErrorBarStyle",
- pSeriesStyleContext,pStylesCtxt);
-
- if ( aAny.hasValue() )
- {
- sal_Int32 aBarStyle = com::sun::star::chart::ErrorBarStyle::NONE;
- aAny >>= aBarStyle;
-
- aAny = SchXMLTools::getPropertyFromContext("ShowPositiveError",
- pSeriesStyleContext,pStylesCtxt);
-
- xBarProp->setPropertyValue("ShowPositiveError",aAny);
-
- aAny = SchXMLTools::getPropertyFromContext("ShowNegativeError",
- pSeriesStyleContext,pStylesCtxt);
-
- xBarProp->setPropertyValue("ShowNegativeError",aAny);
-
- switch(aBarStyle)
- {
- case com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
- {
- aAny = SchXMLTools::getPropertyFromContext("NegativeError",
- pSeriesStyleContext,pStylesCtxt);
-
- xBarProp->setPropertyValue("NegativeError",aAny);
-
- aAny = SchXMLTools::getPropertyFromContext("PositiveError",
- pSeriesStyleContext,pStylesCtxt);
-
- xBarProp->setPropertyValue("PositiveError",aAny);
- }
- break;
- default:
- break;
- }
- }
-
aStyle.m_xErrorYProperties.set( xBarProp );
}
}