Export chart X,Y errorbars.
- Remove using older properties to get errorbars data. - Only export X errorbars when using ODF VERSION >= 1.2. - Use the dimension attribute to set errorbar direction.
This commit is contained in:
committed by
Markus Mohrhard
parent
181a7d7512
commit
f1c9be8706
@@ -248,8 +248,8 @@ public:
|
|||||||
sal_Bool bExportContent );
|
sal_Bool bExportContent );
|
||||||
|
|
||||||
void exportErrorBar (
|
void exportErrorBar (
|
||||||
const ::com::sun::star::uno::Reference<beans::XPropertySet> &xSeriesProp,
|
const ::com::sun::star::uno::Reference<beans::XPropertySet> &xSeriesProp, bool bYError,
|
||||||
sal_Bool bExportContent );
|
bool bExportContent );
|
||||||
|
|
||||||
/// add svg position as attribute for current element
|
/// add svg position as attribute for current element
|
||||||
void addPosition( const ::com::sun::star::awt::Point & rPosition );
|
void addPosition( const ::com::sun::star::awt::Point & rPosition );
|
||||||
@@ -2992,7 +2992,8 @@ void SchXMLExportHelper_Impl::exportSeries(
|
|||||||
exportRegressionCurve( aSeriesSeq[nSeriesIdx], xPropSet, rPageSize, bExportContent );
|
exportRegressionCurve( aSeriesSeq[nSeriesIdx], xPropSet, rPageSize, bExportContent );
|
||||||
}
|
}
|
||||||
|
|
||||||
exportErrorBar( xPropSet,bExportContent );
|
exportErrorBar( xPropSet,false, bExportContent ); // X ErrorBar
|
||||||
|
exportErrorBar( xPropSet,true, bExportContent ); // Y ErrorBar
|
||||||
|
|
||||||
exportDataPoints(
|
exportDataPoints(
|
||||||
uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ),
|
uno::Reference< beans::XPropertySet >( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ),
|
||||||
@@ -3116,24 +3117,40 @@ void SchXMLExportHelper_Impl::exportRegressionCurve(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySet> &xSeriesProp,
|
void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySet> &xSeriesProp,
|
||||||
sal_Bool bExportContent )
|
bool bYError, bool bExportContent )
|
||||||
{
|
{
|
||||||
assert(mxExpPropMapper.is());
|
assert(mxExpPropMapper.is());
|
||||||
|
|
||||||
|
const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
|
||||||
|
|
||||||
|
/// Dont export X ErrorBars for older ODF versions.
|
||||||
|
if ( !bYError && nCurrentVersion < SvtSaveOptions::ODFVER_012 )
|
||||||
|
return;
|
||||||
|
|
||||||
if (xSeriesProp.is())
|
if (xSeriesProp.is())
|
||||||
{
|
{
|
||||||
Any aAny;
|
bool bNegative = false, bPositive = false;
|
||||||
std::vector< XMLPropertyState > aPropertyStates;
|
|
||||||
sal_Int32 nErrorBarStyle = chart::ErrorBarStyle::NONE;
|
sal_Int32 nErrorBarStyle = chart::ErrorBarStyle::NONE;
|
||||||
chart::ChartErrorIndicatorType eErrorType = chart::ChartErrorIndicatorType_NONE;
|
Reference< beans::XPropertySet > xErrorBarProp;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
aAny = xSeriesProp->getPropertyValue("ErrorIndicator" );
|
Any aAny;
|
||||||
aAny >>= eErrorType;
|
|
||||||
|
|
||||||
aAny = xSeriesProp->getPropertyValue("ErrorBarStyle" );
|
aAny = xSeriesProp->getPropertyValue( bYError ? "ErrorBarY" : "ErrorBarX" );
|
||||||
aAny >>= nErrorBarStyle;
|
aAny >>= xErrorBarProp;
|
||||||
|
|
||||||
|
if ( xErrorBarProp.is() )
|
||||||
|
{
|
||||||
|
aAny = xErrorBarProp->getPropertyValue("ShowNegativeError" );
|
||||||
|
aAny >>= bNegative;
|
||||||
|
|
||||||
|
aAny = xErrorBarProp->getPropertyValue("ShowPositiveError" );
|
||||||
|
aAny >>= bPositive;
|
||||||
|
|
||||||
|
aAny = xErrorBarProp->getPropertyValue("ErrorBarStyle" );
|
||||||
|
aAny >>= nErrorBarStyle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( const beans::UnknownPropertyException & rEx )
|
catch( const beans::UnknownPropertyException & rEx )
|
||||||
{
|
{
|
||||||
@@ -3144,56 +3161,37 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe
|
|||||||
RTL_TEXTENCODING_ASCII_US ).getStr());
|
RTL_TEXTENCODING_ASCII_US ).getStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
if( nErrorBarStyle != chart::ErrorBarStyle::NONE &&
|
if( nErrorBarStyle != chart::ErrorBarStyle::NONE && (bNegative || bPositive))
|
||||||
eErrorType != chart::ChartErrorIndicatorType_NONE)
|
|
||||||
{
|
{
|
||||||
Reference< beans::XPropertySet > xErrorBarProp;
|
if( bExportContent && nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
aAny = xSeriesProp->getPropertyValue("DataErrorProperties" );
|
// register data ranges for error bars for export in local table
|
||||||
aAny >>= xErrorBarProp;
|
::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences(
|
||||||
}
|
lcl_getErrorBarSequences( xErrorBarProp ));
|
||||||
catch( const uno::Exception & rEx )
|
for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt(
|
||||||
{
|
aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt )
|
||||||
(void)rEx; // avoid warning for pro build
|
|
||||||
OSL_TRACE( "Exception caught during Export of series - optional DataErrorProperties not available: %s",
|
|
||||||
OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( xErrorBarProp.is() )
|
|
||||||
{
|
|
||||||
if( bExportContent &&
|
|
||||||
nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA )
|
|
||||||
{
|
{
|
||||||
// register data ranges for error bars for export in local table
|
m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt ));
|
||||||
::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences(
|
|
||||||
lcl_getErrorBarSequences( xErrorBarProp ));
|
|
||||||
for( ::std::vector< Reference< chart2::data::XDataSequence > >::const_iterator aIt(
|
|
||||||
aErrorBarSequences.begin()); aIt != aErrorBarSequences.end(); ++aIt )
|
|
||||||
{
|
|
||||||
m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt ));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp );
|
std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp );
|
||||||
|
|
||||||
if( !aPropertyStates.empty() )
|
if( !aPropertyStates.empty() )
|
||||||
|
{
|
||||||
|
// write element
|
||||||
|
if( bExportContent )
|
||||||
{
|
{
|
||||||
// write element
|
// add style name attribute
|
||||||
if( bExportContent )
|
AddAutoStyleAttribute( aPropertyStates );
|
||||||
{
|
|
||||||
// add style name attribute
|
|
||||||
AddAutoStyleAttribute( aPropertyStates );
|
|
||||||
|
|
||||||
const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
|
if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 )
|
||||||
if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 )
|
mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, bYError ? XML_Y : XML_X );//#i114149#
|
||||||
mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149#
|
SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True );
|
||||||
SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True );
|
}
|
||||||
}
|
else // autostyles
|
||||||
else // autostyles
|
{
|
||||||
{
|
CollectAutoStyle( aPropertyStates );
|
||||||
CollectAutoStyle( aPropertyStates );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user