Kaydet (Commit) b63d1e56 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

get at least the y-error-bar import working again, fdo#60083

This still does not help with the x-error-bars but it is a first step in
the right direction. There are still some nasty problems around the
different possibilities how the error bar information can be stored in
the file.

Change-Id: I8022fbfc8d372c9863d236253a2a63364198bfc8
üst 33fc459b
...@@ -1037,6 +1037,90 @@ SchXMLStatisticsObjectContext::~SchXMLStatisticsObjectContext() ...@@ -1037,6 +1037,90 @@ 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;
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 ) void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{ {
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
...@@ -1096,15 +1180,10 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax ...@@ -1096,15 +1180,10 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
xBarProp->setPropertyValue("ShowPositiveError",uno::makeAny(sal_True)); xBarProp->setPropertyValue("ShowPositiveError",uno::makeAny(sal_True));
xBarProp->setPropertyValue("ShowNegativeError",uno::makeAny(sal_True)); xBarProp->setPropertyValue("ShowNegativeError",uno::makeAny(sal_True));
const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext( // first import defaults from parent style
mrImportHelper.GetChartFamilyID(), sAutoStyleName ); SetErrorBarPropertiesFromStyleName( maSeriesStyleName, xBarProp, mrImportHelper );
// note: SvXMLStyleContext::FillPropertySet is not const SetErrorBarPropertiesFromStyleName( sAutoStyleName, xBarProp, mrImportHelper );
XMLPropStyleContext * pErrorStyleContext =
const_cast< XMLPropStyleContext * >( dynamic_cast< const XMLPropStyleContext * >( pStyle ));
pErrorStyleContext->FillPropertySet( xBarProp );
uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY); uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY);
...@@ -1120,51 +1199,6 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax ...@@ -1120,51 +1199,6 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
} }
else 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 ); aStyle.m_xErrorYProperties.set( xBarProp );
} }
} }
......
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