[Libreoffice-commits] .: 3 commits - xmloff/inc xmloff/source
Rafael Dominguez
rdominguez at kemper.freedesktop.org
Sun Jun 3 06:43:24 PDT 2012
xmloff/inc/xmloff/xmltoken.hxx | 1
xmloff/source/chart/PropertyMap.hxx | 10 +
xmloff/source/chart/SchXMLExport.cxx | 24 +++
xmloff/source/chart/SchXMLPlotAreaContext.cxx | 181 +++++++++++++++++++++++---
xmloff/source/chart/SchXMLPlotAreaContext.hxx | 2
xmloff/source/chart/SchXMLSeries2Context.cxx | 17 ++
xmloff/source/chart/SchXMLSeries2Context.hxx | 2
xmloff/source/chart/transporttypes.hxx | 4
xmloff/source/core/xmltoken.cxx | 2
9 files changed, 224 insertions(+), 19 deletions(-)
New commits:
commit 27cd9157ac0e824197aa40c67fe6a4bfab3b2e38
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sat Apr 28 14:46:51 2012 -0430
Import X errorbars.
Change-Id: I069271ad1c0f2fc5ec0854d6fb13aa0dc25be01d
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index f293b79..b295eed 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -182,6 +182,10 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
MAP_FULL( "MarkPosition", CHART, XML_TICK_MARK_POSITION, XML_SCH_TYPE_TICK_MARK_POSITION, 0, SvtSaveOptions::ODFVER_012 ),
// statistical properties
+
+ MAP_ENTRY_ODF_EXT( "ShowPositiveError", CHART, XML_ERROR_UPPER_INDICATOR, XML_TYPE_BOOL),
+ MAP_ENTRY_ODF_EXT( "ShowNegativeError", CHART, XML_ERROR_LOWER_INDICATOR, XML_TYPE_BOOL),
+
MAP_ENTRY( "MeanValue", CHART, XML_MEAN_VALUE, XML_TYPE_BOOL ),
MAP_ENTRY( "ErrorMargin", CHART, XML_ERROR_MARGIN, XML_TYPE_DOUBLE ),
MAP_ENTRY( "ConstantErrorLow", CHART, XML_ERROR_LOWER_LIMIT, XML_TYPE_DOUBLE ),
@@ -198,8 +202,6 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
MAP_ENTRY_ODF_EXT( "PositiveError", CHART, XML_ERROR_LOWER_LIMIT, XML_TYPE_DOUBLE),
MAP_ENTRY_ODF_EXT( "NegativeError", CHART, XML_ERROR_UPPER_LIMIT, XML_TYPE_DOUBLE),
MAP_ENTRY_ODF_EXT( "Weigth", CHART, XML_ERROR_STANDARD_WEIGTH, XML_TYPE_DOUBLE),
- MAP_ENTRY_ODF_EXT( "ShowPositiveError", CHART, XML_ERROR_UPPER_INDICATOR, XML_TYPE_BOOL),
- MAP_ENTRY_ODF_EXT( "ShowNegativeError", CHART, XML_ERROR_LOWER_INDICATOR, XML_TYPE_BOOL),
// series/data-point properties
MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_NUMBER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER ), // convert one constant
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 588d819..535e6d2 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -50,10 +50,14 @@
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/ChartErrorCategory.hpp>
+#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
#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/data/XDataSink.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
@@ -386,13 +390,6 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri
mrSeriesDefaultsAndStyles.maSymbolTypeDefault = xProp->getPropertyValue(::rtl::OUString("SymbolType"));
mrSeriesDefaultsAndStyles.maDataCaptionDefault = xProp->getPropertyValue(::rtl::OUString("DataCaption"));
- mrSeriesDefaultsAndStyles.maErrorIndicatorDefault = xProp->getPropertyValue(::rtl::OUString("ErrorIndicator"));
- mrSeriesDefaultsAndStyles.maErrorCategoryDefault = xProp->getPropertyValue(::rtl::OUString("ErrorCategory"));
- mrSeriesDefaultsAndStyles.maConstantErrorLowDefault = xProp->getPropertyValue(::rtl::OUString("ConstantErrorLow"));
- mrSeriesDefaultsAndStyles.maConstantErrorHighDefault = xProp->getPropertyValue(::rtl::OUString("ConstantErrorHigh"));
- mrSeriesDefaultsAndStyles.maPercentageErrorDefault = xProp->getPropertyValue(::rtl::OUString("PercentageError"));
- mrSeriesDefaultsAndStyles.maErrorMarginDefault = xProp->getPropertyValue(::rtl::OUString("ErrorMargin"));
-
mrSeriesDefaultsAndStyles.maMeanValueDefault = xProp->getPropertyValue(::rtl::OUString("MeanValue"));
mrSeriesDefaultsAndStyles.maRegressionCurvesDefault = xProp->getPropertyValue(::rtl::OUString("RegressionCurves"));
@@ -971,12 +968,70 @@ void SchXMLStockContext::StartElement( const uno::Reference< xml::sax::XAttribut
// ========================================
+void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocument > &xDoc,
+ const uno::Reference< beans::XPropertySet > &xBarProp,
+ const rtl::OUString &aRange,
+ bool bPositiveValue, bool bYError )
+{
+ uno::Reference< com::sun::star::chart2::data::XDataProvider > xDataProvider(xDoc->getDataProvider());
+ uno::Reference< com::sun::star::chart2::data::XDataSource > xDataSource( xBarProp, uno::UNO_QUERY );
+ uno::Reference< com::sun::star::chart2::data::XDataSink > xDataSink( xDataSource, uno::UNO_QUERY );
+
+ assert( xDataSink.is() && xDataSource.is() && xDataProvider.is() );
+
+ rtl::OUString aXMLRange(lcl_ConvertRange(aRange,xDoc));
+
+ uno::Reference< chart2::data::XDataSequence > xNewSequence(
+ xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
+
+ if( xNewSequence.is())
+ {
+ SchXMLTools::setXMLRangePropertyAtDataSequence(xNewSequence,aXMLRange);
+
+ rtl::OUStringBuffer aRoleBuffer("error-bars-");
+ if( bYError )
+ aRoleBuffer.append( sal_Unicode( 'y' ));
+ else
+ aRoleBuffer.append( sal_Unicode( 'x' ));
+
+ rtl::OUString aPlainRole = aRoleBuffer.makeStringAndClear();
+ aRoleBuffer.append( aPlainRole );
+ aRoleBuffer.append( sal_Unicode( '-' ));
+
+ if( bPositiveValue )
+ aRoleBuffer = aRoleBuffer.appendAscii( "positive" );
+ else
+ aRoleBuffer = aRoleBuffer.appendAscii( "negative" );
+
+ rtl::OUString aRole = aRoleBuffer.makeStringAndClear();
+
+ Reference< beans::XPropertySet > xSeqProp( xNewSequence, uno::UNO_QUERY );
+
+ xSeqProp->setPropertyValue("Role", uno::makeAny( aRole ));
+
+ Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+
+ Reference< chart2::data::XLabeledDataSequence > xLabelSeq(
+ xFact->createInstance("com.sun.star.chart2.data.LabeledDataSequence"), uno::UNO_QUERY );
+
+ xLabelSeq->setValues( xNewSequence );
+
+ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences(
+ xDataSource->getDataSequences());
+
+ aSequences.realloc( aSequences.getLength() + 1 );
+ aSequences[ aSequences.getLength() - 1 ] = xLabelSeq;
+ xDataSink->setData( aSequences );
+ }
+}
+
SchXMLStatisticsObjectContext::SchXMLStatisticsObjectContext(
SchXMLImportHelper& rImpHelper,
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const rtl::OUString& rLocalName,
+ const rtl::OUString &rSeriesStyleName,
::std::list< DataRowPointStyle >& rStyleList,
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDataSeries >& xSeries,
@@ -988,7 +1043,8 @@ SchXMLStatisticsObjectContext::SchXMLStatisticsObjectContext(
mrStyleList( rStyleList ),
m_xSeries( xSeries ),
meContextType( eContextType ),
- maChartSize( rChartSize )
+ maChartSize( rChartSize ),
+ maSeriesStyleName( rSeriesStyleName)
{}
SchXMLStatisticsObjectContext::~SchXMLStatisticsObjectContext()
@@ -1000,6 +1056,9 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
::rtl::OUString aValue;
::rtl::OUString sAutoStyleName;
+ rtl::OUString aPosRange;
+ rtl::OUString aNegRange;
+ bool bYError = true; /// Default errorbar, to be backward compatible with older files!
for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
@@ -1011,6 +1070,12 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
{
if( IsXMLToken( aLocalName, XML_STYLE_NAME ) )
sAutoStyleName = xAttrList->getValueByIndex( i );
+ else if( IsXMLToken( aLocalName, XML_DIMENSION ) )
+ bYError = xAttrList->getValueByIndex(i) == "y";
+ else if( IsXMLToken( aLocalName, XML_ERROR_UPPER_RANGE) )
+ aPosRange = xAttrList->getValueByIndex(i);
+ else if( IsXMLToken( aLocalName, XML_ERROR_LOWER_RANGE) )
+ aNegRange = xAttrList->getValueByIndex(i);
}
}
@@ -1018,21 +1083,109 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
// auto-style set, because they can contain an equation
if( !sAutoStyleName.isEmpty() || meContextType == CONTEXT_TYPE_REGRESSION_CURVE )
{
- DataRowPointStyle::StyleType eType = DataRowPointStyle::MEAN_VALUE;
+ DataRowPointStyle aStyle( DataRowPointStyle::MEAN_VALUE, m_xSeries, -1, 1, sAutoStyleName );
+
switch( meContextType )
{
case CONTEXT_TYPE_MEAN_VALUE_LINE:
- eType = DataRowPointStyle::MEAN_VALUE;
+ aStyle.meType = DataRowPointStyle::MEAN_VALUE;
break;
case CONTEXT_TYPE_REGRESSION_CURVE:
- eType = DataRowPointStyle::REGRESSION;
+ aStyle.meType = DataRowPointStyle::REGRESSION;
break;
case CONTEXT_TYPE_ERROR_INDICATOR:
- eType = DataRowPointStyle::ERROR_INDICATOR;
+ {
+ aStyle.meType = DataRowPointStyle::ERROR_INDICATOR;
+
+ ;
+ uno::Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(),
+ uno::UNO_QUERY );
+
+ uno::Reference< beans::XPropertySet > xBarProp( xFact->createInstance("com.sun.star.chart2.ErrorBar" ),
+ uno::UNO_QUERY );
+
+ xBarProp->setPropertyValue("ErrorBarStyle",uno::makeAny(com::sun::star::chart::ErrorBarStyle::NONE));
+ xBarProp->setPropertyValue("PositiveError",uno::makeAny(static_cast<double>(0.0)));
+ xBarProp->setPropertyValue("NegativeError",uno::makeAny(static_cast<double>(0.0)));
+ xBarProp->setPropertyValue("Weight",uno::makeAny(static_cast<double>(1.0)));
+ 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 );
+
+ uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY);
+
+ if (!aPosRange.isEmpty())
+ lcl_setErrorBarSequence(xDoc,xBarProp,aPosRange,true,bYError);
+
+ if (!aNegRange.isEmpty())
+ lcl_setErrorBarSequence(xDoc,xBarProp,aNegRange,false,bYError);
+
+ if ( !bYError )
+ {
+ aStyle.m_xErrorXProperties.set( xBarProp );
+ }
+ 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 );
+ }
+ }
break;
}
- DataRowPointStyle aStyle(
- eType, m_xSeries, -1, 1, sAutoStyleName );
+
mrStyleList.push_back( aStyle );
}
}
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
index 92a8b48..7308e69 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx
@@ -276,6 +276,7 @@ public:
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const rtl::OUString& rLocalName,
+ const rtl::OUString &rSeriesStyleName,
::std::list< DataRowPointStyle >& rStyleList,
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDataSeries >& xSeries,
@@ -297,6 +298,7 @@ private:
::com::sun::star::chart2::XDataSeries > m_xSeries;
ContextType meContextType;
::com::sun::star::awt::Size maChartSize;
+ rtl::OUString maSeriesStyleName;
};
// ----------------------------------------
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 8e50d4a..26f10f0 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -658,7 +658,7 @@ SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
case XML_TOK_SERIES_MEAN_VALUE_LINE:
pContext = new SchXMLStatisticsObjectContext(
mrImportHelper, GetImport(),
- nPrefix, rLocalName,
+ nPrefix, rLocalName, msAutoStyleName,
mrStyleList, m_xSeries,
SchXMLStatisticsObjectContext::CONTEXT_TYPE_MEAN_VALUE_LINE,
maChartSize );
@@ -666,7 +666,7 @@ SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
case XML_TOK_SERIES_REGRESSION_CURVE:
pContext = new SchXMLStatisticsObjectContext(
mrImportHelper, GetImport(),
- nPrefix, rLocalName,
+ nPrefix, rLocalName, msAutoStyleName,
mrStyleList, m_xSeries,
SchXMLStatisticsObjectContext::CONTEXT_TYPE_REGRESSION_CURVE,
maChartSize );
@@ -674,7 +674,7 @@ SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
case XML_TOK_SERIES_ERROR_INDICATOR:
pContext = new SchXMLStatisticsObjectContext(
mrImportHelper, GetImport(),
- nPrefix, rLocalName,
+ nPrefix, rLocalName, msAutoStyleName,
mrStyleList, m_xSeries,
SchXMLStatisticsObjectContext::CONTEXT_TYPE_ERROR_INDICATOR,
maChartSize );
@@ -878,6 +878,17 @@ void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles
iStyle->meType == DataRowPointStyle::ERROR_INDICATOR ||
iStyle->meType == DataRowPointStyle::MEAN_VALUE )
{
+ if ( iStyle->meType == DataRowPointStyle::ERROR_INDICATOR )
+ {
+ uno::Reference< beans::XPropertySet > xNewSeriesProp(iStyle->m_xSeries,uno::UNO_QUERY);
+
+ if (iStyle->m_xErrorXProperties.is())
+ xNewSeriesProp->setPropertyValue("ErrorBarX",uno::makeAny(iStyle->m_xErrorXProperties));
+
+ if (iStyle->m_xErrorYProperties.is())
+ xNewSeriesProp->setPropertyValue("ErrorBarY",uno::makeAny(iStyle->m_xErrorYProperties));
+ }
+
try
{
uno::Reference< beans::XPropertySet > xSeriesProp( iStyle->m_xOldAPISeries );
diff --git a/xmloff/source/chart/SchXMLSeries2Context.hxx b/xmloff/source/chart/SchXMLSeries2Context.hxx
index 0bb17b0..4699de4 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.hxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.hxx
@@ -119,7 +119,7 @@ public:
static void setStylesToStatisticsObjects( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
, const SvXMLStylesContext* pStylesCtxt
, const SvXMLStyleContext*& rpStyle
- , ::rtl::OUString& rCurrStyleName );
+ , rtl::OUString &rCurrStyleName );
static void setStylesToDataPoints( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
, const SvXMLStylesContext* pStylesCtxt
diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx
index 7ecf086..be60fcd 100644
--- a/xmloff/source/chart/transporttypes.hxx
+++ b/xmloff/source/chart/transporttypes.hxx
@@ -176,6 +176,10 @@ struct DataRowPointStyle
::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;
commit 5e1dfa9952724c1909acb3679369e3ec8e3f99ae
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Apr 8 19:10:23 2012 -0430
Export errorbars attributes and styles to XML.
- Instead of exporting the errorbar data to the series in a global way now each errorbar has its own attributes depending on their user settings,
so we can have different data for each type bar (only when using ODF 1.2 extended) and still keeping it backward compatible with old formats.
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index c661ac2..f0c7783 100755
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3121,7 +3121,7 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe
const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() );
/// Dont export X ErrorBars for older ODF versions.
- if ( !bYError && nCurrentVersion < SvtSaveOptions::ODFVER_012 )
+ if ( !bYError && nCurrentVersion != SvtSaveOptions::ODFVER_LATEST )
return;
if (xSeriesProp.is())
@@ -3162,12 +3162,34 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe
{
if( bExportContent && nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA )
{
+ uno::Reference< chart2::XChartDocument > xNewDoc(mrExport.GetModel(), uno::UNO_QUERY);
+
// register data ranges for error bars for export in local table
::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 )
{
+ if ( nCurrentVersion == SvtSaveOptions::ODFVER_LATEST )
+ {
+ rtl::OUString aRole, aRange;
+ Reference< beans::XPropertySet > xSeqProp( *aIt, uno::UNO_QUERY_THROW );
+ xSeqProp->getPropertyValue("Role") >>= aRole;
+
+ aRange = lcl_ConvertRange((*aIt)->getSourceRangeRepresentation(), xNewDoc );
+
+ if ( aRole.indexOf("positive") != -1 )
+ {
+ if ( bPositive )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ERROR_UPPER_RANGE, aRange );
+ }
+ else
+ {
+ if ( bNegative )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ERROR_LOWER_RANGE, aRange );
+ }
+ }
+
m_aDataSequencesToExport.push_back( tLabelValuesDataPair( 0, *aIt ));
}
}
commit b4b403305a32ca989fb4cff9c6a726ec937f1f9d
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Sun Apr 8 19:08:19 2012 -0430
Map errorbars properties from chart2 API to xml.
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 3dc4b12..b850e3e 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3162,6 +3162,7 @@ namespace xmloff { namespace token {
XML_HORIZONTAL_BAR,
XML_VERTICAL_BAR,
+ XML_ERROR_STANDARD_WEIGTH, // errorbar standard deviation error weigth
XML_TOKEN_END
};
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index d0aab8b..f293b79 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -94,6 +94,7 @@
#define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, EarliestODFVersionForExport ) { ApiName, sizeof(ApiName)-1, XML_NAMESPACE_##NameSpace, xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, EarliestODFVersionForExport }
#define MAP_ENTRY( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFVER_010 }
#define MAP_ENTRY_ODF12( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFVER_012 }
+#define MAP_ENTRY_ODF_EXT( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFVER_LATEST }
#define MAP_CONTEXT( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, c, SvtSaveOptions::ODFVER_010 }
#define MAP_SPECIAL( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFVER_010 }
#define MAP_SPECIAL_ODF12( a, ns, nm, t, c ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART | MID_FLAG_SPECIAL_ITEM, c, SvtSaveOptions::ODFVER_012 }
@@ -193,6 +194,13 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
MAP_ENTRY_ODF12( "ErrorBarRangePositive", CHART, XML_ERROR_UPPER_RANGE, XML_TYPE_STRING ),
MAP_ENTRY_ODF12( "ErrorBarRangeNegative", CHART, XML_ERROR_LOWER_RANGE, XML_TYPE_STRING ),
+ // errorbars properties (chart2)
+ MAP_ENTRY_ODF_EXT( "PositiveError", CHART, XML_ERROR_LOWER_LIMIT, XML_TYPE_DOUBLE),
+ MAP_ENTRY_ODF_EXT( "NegativeError", CHART, XML_ERROR_UPPER_LIMIT, XML_TYPE_DOUBLE),
+ MAP_ENTRY_ODF_EXT( "Weigth", CHART, XML_ERROR_STANDARD_WEIGTH, XML_TYPE_DOUBLE),
+ MAP_ENTRY_ODF_EXT( "ShowPositiveError", CHART, XML_ERROR_UPPER_INDICATOR, XML_TYPE_BOOL),
+ MAP_ENTRY_ODF_EXT( "ShowNegativeError", CHART, XML_ERROR_LOWER_INDICATOR, XML_TYPE_BOOL),
+
// series/data-point properties
MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_NUMBER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER ), // convert one constant
MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_TEXT, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT ), // to 'tristate' and two bools
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 6240b0c..5296cae 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3158,6 +3158,8 @@ namespace xmloff { namespace token {
TOKEN( "horizontal-bar", XML_HORIZONTAL_BAR ),
TOKEN( "vertical-bar", XML_VERTICAL_BAR ),
+ TOKEN( "std-weight", XML_ERROR_STANDARD_WEIGTH ),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, NULL, NULL, XML_TOKEN_END }
#else
More information about the Libreoffice-commits
mailing list