summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-05 20:34:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 08:40:03 +0200
commitc2864be448b52cdac0f8712708cb6c988155fdc8 (patch)
tree3dec4f2b05b44c9dc45bbfa3a7ac273a63f03c8d /xmloff
parentc6cd931d67cf491ea442f615d2e0796cb45c8449 (diff)
loplugin:flatten in xml/chart
Change-Id: I6545b719af4d1250c236b2d48af666c78c3e157c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100189 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLAutoStylePoolP.cxx40
-rw-r--r--xmloff/source/chart/SchXMLAxisContext.cxx392
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx518
-rw-r--r--xmloff/source/chart/SchXMLParagraphContext.cxx36
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx285
-rw-r--r--xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx48
-rw-r--r--xmloff/source/chart/SchXMLSeries2Context.cxx42
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx174
8 files changed, 768 insertions, 767 deletions
diff --git a/xmloff/source/chart/SchXMLAutoStylePoolP.cxx b/xmloff/source/chart/SchXMLAutoStylePoolP.cxx
index f4296bc484dd..010a8bfbf189 100644
--- a/xmloff/source/chart/SchXMLAutoStylePoolP.cxx
+++ b/xmloff/source/chart/SchXMLAutoStylePoolP.cxx
@@ -44,30 +44,30 @@ void SchXMLAutoStylePoolP::exportStyleAttributes(
SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties,
rPropExp, rUnitConverter, rNamespaceMap );
- if( nFamily == XmlStyleFamily::SCH_CHART_ID )
+ if( nFamily != XmlStyleFamily::SCH_CHART_ID )
+ return;
+
+ for( const auto& rProp : rProperties )
{
- for( const auto& rProp : rProperties )
- {
- if( rProp.mnIndex == -1 )
- continue;
+ if( rProp.mnIndex == -1 )
+ continue;
- rtl::Reference< XMLPropertySetMapper > aPropMapper =
- mrSchXMLExport.GetPropertySetMapper();
- sal_Int16 nContextID = aPropMapper->GetEntryContextId( rProp.mnIndex );
- if( nContextID == XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT )
+ rtl::Reference< XMLPropertySetMapper > aPropMapper =
+ mrSchXMLExport.GetPropertySetMapper();
+ sal_Int16 nContextID = aPropMapper->GetEntryContextId( rProp.mnIndex );
+ if( nContextID == XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT )
+ {
+ sal_Int32 nNumberFormat = -1;
+ if( ( rProp.maValue >>= nNumberFormat ) &&
+ ( nNumberFormat != -1 ))
{
- sal_Int32 nNumberFormat = -1;
- if( ( rProp.maValue >>= nNumberFormat ) &&
- ( nNumberFormat != -1 ))
+ OUString sAttrValue = mrSchXMLExport.getDataStyleName( nNumberFormat );
+ if( !sAttrValue.isEmpty() )
{
- OUString sAttrValue = mrSchXMLExport.getDataStyleName( nNumberFormat );
- if( !sAttrValue.isEmpty() )
- {
- mrSchXMLExport.AddAttribute(
- aPropMapper->GetEntryNameSpace( rProp.mnIndex ),
- aPropMapper->GetEntryXMLName( rProp.mnIndex ),
- sAttrValue );
- }
+ mrSchXMLExport.AddAttribute(
+ aPropMapper->GetEntryNameSpace( rProp.mnIndex ),
+ aPropMapper->GetEntryXMLName( rProp.mnIndex ),
+ sAttrValue );
}
}
}
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx
index ef7300e2354a..0e1163ad75bb 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -442,150 +442,150 @@ void SchXMLAxisContext::CreateAxis()
}
// set properties
- if( m_xAxisProps.is())
- {
- uno::Any aTrueBool( uno::makeAny( true ));
- uno::Any aFalseBool( uno::makeAny( false ));
+ if( !m_xAxisProps.is())
+ return;
- // #i109879# the line color is black as default, in the model it is a light gray
- m_xAxisProps->setPropertyValue("LineColor",
- uno::makeAny( COL_BLACK ));
+ uno::Any aTrueBool( uno::makeAny( true ));
+ uno::Any aFalseBool( uno::makeAny( false ));
- m_xAxisProps->setPropertyValue("DisplayLabels", aFalseBool );
+ // #i109879# the line color is black as default, in the model it is a light gray
+ m_xAxisProps->setPropertyValue("LineColor",
+ uno::makeAny( COL_BLACK ));
- // Compatibility option: starting from LibreOffice 5.1 the rotated
- // layout is preferred to staggering for axis labels.
- // So the import default value for having compatibility with ODF
- // documents created with earlier LibreOffice versions is `true`.
- if( GetImport().getGeneratorVersion() != SvXMLImport::ProductVersionUnknown )
- m_xAxisProps->setPropertyValue("TryStaggeringFirst", aTrueBool );
+ m_xAxisProps->setPropertyValue("DisplayLabels", aFalseBool );
- // #88077# AutoOrigin 'on' is default
- m_xAxisProps->setPropertyValue("AutoOrigin", aTrueBool );
+ // Compatibility option: starting from LibreOffice 5.1 the rotated
+ // layout is preferred to staggering for axis labels.
+ // So the import default value for having compatibility with ODF
+ // documents created with earlier LibreOffice versions is `true`.
+ if( GetImport().getGeneratorVersion() != SvXMLImport::ProductVersionUnknown )
+ m_xAxisProps->setPropertyValue("TryStaggeringFirst", aTrueBool );
- if( m_bAxisTypeImported )
- m_xAxisProps->setPropertyValue("AxisType", uno::makeAny(m_nAxisType) );
+ // #88077# AutoOrigin 'on' is default
+ m_xAxisProps->setPropertyValue("AutoOrigin", aTrueBool );
- if( !m_aAutoStyleName.isEmpty())
+ if( m_bAxisTypeImported )
+ m_xAxisProps->setPropertyValue("AxisType", uno::makeAny(m_nAxisType) );
+
+ if( !m_aAutoStyleName.isEmpty())
+ {
+ const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext();
+ if (pStylesCtxt)
{
- const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext();
- if (pStylesCtxt)
+ SvXMLStyleContext* pStyle = const_cast<SvXMLStyleContext*>(pStylesCtxt->FindStyleChildContext(SchXMLImportHelper::GetChartFamilyID(), m_aAutoStyleName));
+
+ if (XMLPropStyleContext * pPropStyleContext = dynamic_cast<XMLPropStyleContext*>(pStyle))
{
- SvXMLStyleContext* pStyle = const_cast<SvXMLStyleContext*>(pStylesCtxt->FindStyleChildContext(SchXMLImportHelper::GetChartFamilyID(), m_aAutoStyleName));
+ pPropStyleContext->FillPropertySet(m_xAxisProps);
- if (XMLPropStyleContext * pPropStyleContext = dynamic_cast<XMLPropStyleContext*>(pStyle))
+ if( m_bAdaptWrongPercentScaleValues && m_aCurrentAxis.eDimension==SCH_XML_AXIS_Y )
{
- pPropStyleContext->FillPropertySet(m_xAxisProps);
-
- if( m_bAdaptWrongPercentScaleValues && m_aCurrentAxis.eDimension==SCH_XML_AXIS_Y )
+ //set scale data of added x axis back to default
+ Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
+ m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex ) );
+ if( xAxis.is() )
{
- //set scale data of added x axis back to default
- Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
- m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex ) );
- if( xAxis.is() )
- {
- chart2::ScaleData aScaleData( xAxis->getScaleData());
- if( lcl_AdaptWrongPercentScaleValues(aScaleData) )
- xAxis->setScaleData( aScaleData );
- }
+ chart2::ScaleData aScaleData( xAxis->getScaleData());
+ if( lcl_AdaptWrongPercentScaleValues(aScaleData) )
+ xAxis->setScaleData( aScaleData );
}
+ }
- if( m_bAddMissingXAxisForNetCharts )
- {
- //copy style from y axis to added x axis:
+ if( m_bAddMissingXAxisForNetCharts )
+ {
+ //copy style from y axis to added x axis:
- Reference< chart::XAxisSupplier > xAxisSuppl( xDiaProp, uno::UNO_QUERY );
- if( xAxisSuppl.is() )
- {
- Reference< beans::XPropertySet > xXAxisProp( xAxisSuppl->getAxis(0), uno::UNO_QUERY );
- pPropStyleContext->FillPropertySet(xXAxisProp);
- }
+ Reference< chart::XAxisSupplier > xAxisSuppl( xDiaProp, uno::UNO_QUERY );
+ if( xAxisSuppl.is() )
+ {
+ Reference< beans::XPropertySet > xXAxisProp( xAxisSuppl->getAxis(0), uno::UNO_QUERY );
+ pPropStyleContext->FillPropertySet(xXAxisProp);
+ }
- //set scale data of added x axis back to default
- Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
- 0 /*nDimensionIndex*/, 0 /*nAxisIndex*/ ) );
- if( xAxis.is() )
- {
- chart2::ScaleData aScaleData;
- aScaleData.AxisType = chart2::AxisType::CATEGORY;
- aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
- xAxis->setScaleData( aScaleData );
- }
+ //set scale data of added x axis back to default
+ Reference< chart2::XAxis > xAxis( lcl_getAxis( GetImport().GetModel(),
+ 0 /*nDimensionIndex*/, 0 /*nAxisIndex*/ ) );
+ if( xAxis.is() )
+ {
+ chart2::ScaleData aScaleData;
+ aScaleData.AxisType = chart2::AxisType::CATEGORY;
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ }
- //set line style of added x axis to invisible
- Reference< beans::XPropertySet > xNewAxisProp( xAxis, uno::UNO_QUERY );
- if( xNewAxisProp.is() )
- {
- xNewAxisProp->setPropertyValue("LineStyle"
- , uno::makeAny(drawing::LineStyle_NONE));
- }
+ //set line style of added x axis to invisible
+ Reference< beans::XPropertySet > xNewAxisProp( xAxis, uno::UNO_QUERY );
+ if( xNewAxisProp.is() )
+ {
+ xNewAxisProp->setPropertyValue("LineStyle"
+ , uno::makeAny(drawing::LineStyle_NONE));
}
+ }
- if( m_bAdaptXAxisOrientationForOld2DBarCharts && m_aCurrentAxis.eDimension == SCH_XML_AXIS_X )
+ if( m_bAdaptXAxisOrientationForOld2DBarCharts && m_aCurrentAxis.eDimension == SCH_XML_AXIS_X )
+ {
+ bool bIs3DChart = false;
+ if( xDiaProp.is() && ( xDiaProp->getPropertyValue("Dim3D") >>= bIs3DChart )
+ && !bIs3DChart )
{
- bool bIs3DChart = false;
- if( xDiaProp.is() && ( xDiaProp->getPropertyValue("Dim3D") >>= bIs3DChart )
- && !bIs3DChart )
+ Reference< chart2::XChartDocument > xChart2Document( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xChart2Document.is() )
{
- Reference< chart2::XChartDocument > xChart2Document( GetImport().GetModel(), uno::UNO_QUERY );
- if( xChart2Document.is() )
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChart2Document->getFirstDiagram(), uno::UNO_QUERY );
+ if( xCooSysCnt.is() )
{
- Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChart2Document->getFirstDiagram(), uno::UNO_QUERY );
- if( xCooSysCnt.is() )
+ uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
+ if( aCooSysSeq.hasElements() )
{
- uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
- if( aCooSysSeq.hasElements() )
+ bool bSwapXandYAxis = false;
+ Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
+ Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
+ if( xCooSysProp.is() && ( xCooSysProp->getPropertyValue("SwapXAndYAxis") >>= bSwapXandYAxis )
+ && bSwapXandYAxis )
{
- bool bSwapXandYAxis = false;
- Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
- Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY );
- if( xCooSysProp.is() && ( xCooSysProp->getPropertyValue("SwapXAndYAxis") >>= bSwapXandYAxis )
- && bSwapXandYAxis )
+ Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( 0, m_aCurrentAxis.nAxisIndex );
+ if( xAxis.is() )
{
- Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( 0, m_aCurrentAxis.nAxisIndex );
- if( xAxis.is() )
- {
- chart2::ScaleData aScaleData = xAxis->getScaleData();
- aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
- xAxis->setScaleData( aScaleData );
- }
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = chart2::AxisOrientation_REVERSE;
+ xAxis->setScaleData( aScaleData );
}
}
}
}
}
}
-
- m_rbAxisPositionAttributeImported = m_rbAxisPositionAttributeImported || SchXMLTools::getPropertyFromContext(
- "CrossoverPosition", pPropStyleContext, pStylesCtxt ).hasValue();
}
- }
- }
- if (m_aCurrentAxis.eDimension == SCH_XML_AXIS_X)
- {
- Reference<chart2::XAxis> xAxis(lcl_getAxis(GetImport().GetModel(), m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex));
- if (xAxis.is())
- {
- chart2::ScaleData aScaleData(xAxis->getScaleData());
- bool bIs3DChart = false;
- double fMajorOrigin = -1;
- OUString sChartType = m_xDiagram->getDiagramType();
- if ((xDiaProp->getPropertyValue("Dim3D") >>= bIs3DChart) && bIs3DChart
- && (sChartType == "com.sun.star.chart.BarDiagram" || sChartType == "com.sun.star.chart.StockDiagram"))
- {
- aScaleData.ShiftedCategoryPosition = true;
- xAxis->setScaleData(aScaleData);
- }
- else if ((m_xAxisProps->getPropertyValue("MajorOrigin") >>= fMajorOrigin)
- && (rtl::math::approxEqual(fMajorOrigin, 0.0) || rtl::math::approxEqual(fMajorOrigin, 0.5)))
- {
- aScaleData.ShiftedCategoryPosition = rtl::math::approxEqual(fMajorOrigin, 0.5);
- xAxis->setScaleData(aScaleData);
- }
+ m_rbAxisPositionAttributeImported = m_rbAxisPositionAttributeImported || SchXMLTools::getPropertyFromContext(
+ "CrossoverPosition", pPropStyleContext, pStylesCtxt ).hasValue();
}
}
}
+
+ if (m_aCurrentAxis.eDimension != SCH_XML_AXIS_X)
+ return;
+
+ Reference<chart2::XAxis> xAxis(lcl_getAxis(GetImport().GetModel(), m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex));
+ if (!xAxis.is())
+ return;
+
+ chart2::ScaleData aScaleData(xAxis->getScaleData());
+ bool bIs3DChart = false;
+ double fMajorOrigin = -1;
+ OUString sChartType = m_xDiagram->getDiagramType();
+ if ((xDiaProp->getPropertyValue("Dim3D") >>= bIs3DChart) && bIs3DChart
+ && (sChartType == "com.sun.star.chart.BarDiagram" || sChartType == "com.sun.star.chart.StockDiagram"))
+ {
+ aScaleData.ShiftedCategoryPosition = true;
+ xAxis->setScaleData(aScaleData);
+ }
+ else if ((m_xAxisProps->getPropertyValue("MajorOrigin") >>= fMajorOrigin)
+ && (rtl::math::approxEqual(fMajorOrigin, 0.0) || rtl::math::approxEqual(fMajorOrigin, 0.5)))
+ {
+ aScaleData.ShiftedCategoryPosition = rtl::math::approxEqual(fMajorOrigin, 0.5);
+ xAxis->setScaleData(aScaleData);
+ }
}
void SchXMLAxisContext::SetAxisTitle()
@@ -752,117 +752,117 @@ void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDoc
const OUString& rODFVersionOfFile,
bool bAxisPositionAttributeImported )
{
- if( rODFVersionOfFile.isEmpty() || rODFVersionOfFile == "1.0" || rODFVersionOfFile == "1.1"
- || ( rODFVersionOfFile == "1.2" && !bAxisPositionAttributeImported ) )
+ if( !(rODFVersionOfFile.isEmpty() || rODFVersionOfFile == "1.0" || rODFVersionOfFile == "1.1"
+ || ( rODFVersionOfFile == "1.2" && !bAxisPositionAttributeImported )) )
+ return;
+
+ try
{
- try
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+ if( aCooSysSeq.hasElements() )
{
- Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
- uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
- if( aCooSysSeq.hasElements() )
+ Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
+ if( xCooSys.is() )
{
- Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
- if( xCooSys.is() )
+ Reference< chart2::XAxis > xMainXAxis = lcl_getAxis( xCooSys, 0, 0 );
+ Reference< chart2::XAxis > xMainYAxis = lcl_getAxis( xCooSys, 1, 0 );
+ //Reference< chart2::XAxis > xMajorZAxis = lcl_getAxis( xCooSys, 2, 0 );
+ Reference< chart2::XAxis > xSecondaryXAxis = lcl_getAxis( xCooSys, 0, 1 );
+ Reference< chart2::XAxis > xSecondaryYAxis = lcl_getAxis( xCooSys, 1, 1 );
+
+ Reference< beans::XPropertySet > xMainXAxisProp( xMainXAxis, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xMainYAxisProp( xMainYAxis, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xSecondaryXAxisProp( xSecondaryXAxis, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xSecondaryYAxisProp( xSecondaryYAxis, uno::UNO_QUERY );
+
+ if( xMainXAxisProp.is() && xMainYAxisProp.is() )
{
- Reference< chart2::XAxis > xMainXAxis = lcl_getAxis( xCooSys, 0, 0 );
- Reference< chart2::XAxis > xMainYAxis = lcl_getAxis( xCooSys, 1, 0 );
- //Reference< chart2::XAxis > xMajorZAxis = lcl_getAxis( xCooSys, 2, 0 );
- Reference< chart2::XAxis > xSecondaryXAxis = lcl_getAxis( xCooSys, 0, 1 );
- Reference< chart2::XAxis > xSecondaryYAxis = lcl_getAxis( xCooSys, 1, 1 );
-
- Reference< beans::XPropertySet > xMainXAxisProp( xMainXAxis, uno::UNO_QUERY );
- Reference< beans::XPropertySet > xMainYAxisProp( xMainYAxis, uno::UNO_QUERY );
- Reference< beans::XPropertySet > xSecondaryXAxisProp( xSecondaryXAxis, uno::UNO_QUERY );
- Reference< beans::XPropertySet > xSecondaryYAxisProp( xSecondaryYAxis, uno::UNO_QUERY );
-
- if( xMainXAxisProp.is() && xMainYAxisProp.is() )
+ chart2::ScaleData aMainXScale = xMainXAxis->getScaleData();
+ if( rChartTypeServiceName == "com.sun.star.chart2.ScatterChartType" )
{
- chart2::ScaleData aMainXScale = xMainXAxis->getScaleData();
- if( rChartTypeServiceName == "com.sun.star.chart2.ScatterChartType" )
- {
- xMainYAxisProp->setPropertyValue("CrossoverPosition"
- , uno::makeAny( css::chart::ChartAxisPosition_VALUE) );
- double fCrossoverValue = 0.0;
- aMainXScale.Origin >>= fCrossoverValue;
- xMainYAxisProp->setPropertyValue("CrossoverValue"
- , uno::makeAny( fCrossoverValue ) );
-
- if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
- {
- xMainYAxisProp->setPropertyValue("LabelPosition"
- , uno::makeAny( css::chart::ChartAxisLabelPosition_OUTSIDE_END) );
- xMainYAxisProp->setPropertyValue("MarkPosition"
- , uno::makeAny( css::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
- , uno::makeAny( css::chart::ChartAxisPosition_START) );
- }
- else
- {
- xMainYAxisProp->setPropertyValue("LabelPosition"
- , uno::makeAny( css::chart::ChartAxisLabelPosition_OUTSIDE_START) );
- xMainYAxisProp->setPropertyValue("MarkPosition"
- , uno::makeAny( css::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
- , uno::makeAny( css::chart::ChartAxisPosition_END) );
- }
- }
- else
- {
- if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
- {
- xMainYAxisProp->setPropertyValue("CrossoverPosition"
- , uno::makeAny( css::chart::ChartAxisPosition_END) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
- , uno::makeAny( css::chart::ChartAxisPosition_START) );
- }
- else
- {
- xMainYAxisProp->setPropertyValue("CrossoverPosition"
- , uno::makeAny( css::chart::ChartAxisPosition_START) );
- if( xSecondaryYAxisProp.is() )
- xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
- , uno::makeAny( css::chart::ChartAxisPosition_END) );
- }
- }
-
- chart2::ScaleData aMainYScale = xMainYAxis->getScaleData();
- xMainXAxisProp->setPropertyValue("CrossoverPosition"
+ xMainYAxisProp->setPropertyValue("CrossoverPosition"
, uno::makeAny( css::chart::ChartAxisPosition_VALUE) );
double fCrossoverValue = 0.0;
- aMainYScale.Origin >>= fCrossoverValue;
- xMainXAxisProp->setPropertyValue("CrossoverValue"
+ aMainXScale.Origin >>= fCrossoverValue;
+ xMainYAxisProp->setPropertyValue("CrossoverValue"
, uno::makeAny( fCrossoverValue ) );
- if( aMainYScale.Orientation == chart2::AxisOrientation_REVERSE )
+ if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
{
- xMainXAxisProp->setPropertyValue("LabelPosition"
+ xMainYAxisProp->setPropertyValue("LabelPosition"
, uno::makeAny( css::chart::ChartAxisLabelPosition_OUTSIDE_END) );
- xMainXAxisProp->setPropertyValue("MarkPosition"
+ xMainYAxisProp->setPropertyValue("MarkPosition"
, uno::makeAny( css::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryXAxisProp.is() )
- xSecondaryXAxisProp->setPropertyValue("CrossoverPosition"
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
, uno::makeAny( css::chart::ChartAxisPosition_START) );
}
else
{
- xMainXAxisProp->setPropertyValue("LabelPosition"
+ xMainYAxisProp->setPropertyValue("LabelPosition"
, uno::makeAny( css::chart::ChartAxisLabelPosition_OUTSIDE_START) );
- xMainXAxisProp->setPropertyValue("MarkPosition"
+ xMainYAxisProp->setPropertyValue("MarkPosition"
, uno::makeAny( css::chart::ChartAxisMarkPosition_AT_LABELS) );
- if( xSecondaryXAxisProp.is() )
- xSecondaryXAxisProp->setPropertyValue("CrossoverPosition"
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
+ , uno::makeAny( css::chart::ChartAxisPosition_END) );
+ }
+ }
+ else
+ {
+ if( aMainXScale.Orientation == chart2::AxisOrientation_REVERSE )
+ {
+ xMainYAxisProp->setPropertyValue("CrossoverPosition"
, uno::makeAny( css::chart::ChartAxisPosition_END) );
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
+ , uno::makeAny( css::chart::ChartAxisPosition_START) );
+ }
+ else
+ {
+ xMainYAxisProp->setPropertyValue("CrossoverPosition"
+ , uno::makeAny( css::chart::ChartAxisPosition_START) );
+ if( xSecondaryYAxisProp.is() )
+ xSecondaryYAxisProp->setPropertyValue("CrossoverPosition"
+ , uno::makeAny( css::chart::ChartAxisPosition_END) );
}
}
+
+ chart2::ScaleData aMainYScale = xMainYAxis->getScaleData();
+ xMainXAxisProp->setPropertyValue("CrossoverPosition"
+ , uno::makeAny( css::chart::ChartAxisPosition_VALUE) );
+ double fCrossoverValue = 0.0;
+ aMainYScale.Origin >>= fCrossoverValue;
+ xMainXAxisProp->setPropertyValue("CrossoverValue"
+ , uno::makeAny( fCrossoverValue ) );
+
+ if( aMainYScale.Orientation == chart2::AxisOrientation_REVERSE )
+ {
+ xMainXAxisProp->setPropertyValue("LabelPosition"
+ , uno::makeAny( css::chart::ChartAxisLabelPosition_OUTSIDE_END) );
+ xMainXAxisProp->setPropertyValue("MarkPosition"
+ , uno::makeAny( css::chart::ChartAxisMarkPosition_AT_LABELS) );
+ if( xSecondaryXAxisProp.is() )
+ xSecondaryXAxisProp->setPropertyValue("CrossoverPosition"
+ , uno::makeAny( css::chart::ChartAxisPosition_START) );
+ }
+ else
+ {
+ xMainXAxisProp->setPropertyValue("LabelPosition"
+ , uno::makeAny( css::chart::ChartAxisLabelPosition_OUTSIDE_START) );
+ xMainXAxisProp->setPropertyValue("MarkPosition"
+ , uno::makeAny( css::chart::ChartAxisMarkPosition_AT_LABELS) );
+ if( xSecondaryXAxisProp.is() )
+ xSecondaryXAxisProp->setPropertyValue("CrossoverPosition"
+ , uno::makeAny( css::chart::ChartAxisPosition_END) );
+ }
}
}
}
- catch( uno::Exception & )
- {
- }
+ }
+ catch( uno::Exception & )
+ {
}
}
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 09444b16c47d..31a3582085e4 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -996,20 +996,20 @@ const rtl::Reference< XMLPropertySetMapper >& SchXMLExportHelper_Impl::GetProper
void SchXMLExportHelper_Impl::exportAutoStyles()
{
- if( mxExpPropMapper.is())
- {
- //ToDo: when embedded in calc/writer this is not necessary because the
- // numberformatter is shared between both documents
- mrExport.exportAutoDataStyles();
+ if( !mxExpPropMapper.is())
+ return;
- // export chart auto styles
- mrAutoStylePool.exportXML( XmlStyleFamily::SCH_CHART_ID );
+ //ToDo: when embedded in calc/writer this is not necessary because the
+ // numberformatter is shared between both documents
+ mrExport.exportAutoDataStyles();
- // export auto styles for additional shapes
- mrExport.GetShapeExport()->exportAutoStyles();
- // and for text in additional shapes
- mrExport.GetTextParagraphExport()->exportTextAutoStyles();
- }
+ // export chart auto styles
+ mrAutoStylePool.exportXML( XmlStyleFamily::SCH_CHART_ID );
+
+ // export auto styles for additional shapes
+ mrExport.GetShapeExport()->exportAutoStyles();
+ // and for text in additional shapes
+ mrExport.GetTextParagraphExport()->exportTextAutoStyles();
}
// private methods
@@ -2036,59 +2036,59 @@ void SchXMLExportHelper_Impl::exportPlotArea(
// wall and floor element
Reference< chart::X3DDisplay > xWallFloorSupplier( xDiagram, uno::UNO_QUERY );
- if( mxExpPropMapper.is() &&
- xWallFloorSupplier.is())
+ if( !(mxExpPropMapper.is() &&
+ xWallFloorSupplier.is()))
+ return;
+
+ // remove property states for autostyles
+ aPropertyStates.clear();
+
+ Reference< beans::XPropertySet > xWallPropSet = xWallFloorSupplier->getWall();
+ if( xWallPropSet.is())
{
- // remove property states for autostyles
- aPropertyStates.clear();
+ aPropertyStates = mxExpPropMapper->Filter( xWallPropSet );
- Reference< beans::XPropertySet > xWallPropSet = xWallFloorSupplier->getWall();
- if( xWallPropSet.is())
+ if( !aPropertyStates.empty() )
{
- aPropertyStates = mxExpPropMapper->Filter( xWallPropSet );
-
- if( !aPropertyStates.empty() )
+ // write element
+ if( bExportContent )
{
- // write element
- if( bExportContent )
- {
- // add style name attribute
- AddAutoStyleAttribute( aPropertyStates );
+ // add style name attribute
+ AddAutoStyleAttribute( aPropertyStates );
- SvXMLElementExport aWall( mrExport, XML_NAMESPACE_CHART, XML_WALL, true, true );
- }
- else // autostyles
- {
- CollectAutoStyle( aPropertyStates );
- }
+ SvXMLElementExport aWall( mrExport, XML_NAMESPACE_CHART, XML_WALL, true, true );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
}
}
+ }
- // floor element
- // remove property states for autostyles
- aPropertyStates.clear();
+ // floor element
+ // remove property states for autostyles
+ aPropertyStates.clear();
- Reference< beans::XPropertySet > xFloorPropSet = xWallFloorSupplier->getFloor();
- if( xFloorPropSet.is())
- {
- aPropertyStates = mxExpPropMapper->Filter( xFloorPropSet );
+ Reference< beans::XPropertySet > xFloorPropSet = xWallFloorSupplier->getFloor();
+ if( !xFloorPropSet.is())
+ return;
- if( !aPropertyStates.empty() )
- {
- // write element
- if( bExportContent )
- {
- // add style name attribute
- AddAutoStyleAttribute( aPropertyStates );
+ aPropertyStates = mxExpPropMapper->Filter( xFloorPropSet );
- SvXMLElementExport aFloor( mrExport, XML_NAMESPACE_CHART, XML_FLOOR, true, true );
- }
- else // autostyles
- {
- CollectAutoStyle( aPropertyStates );
- }
- }
- }
+ if( aPropertyStates.empty() )
+ return;
+
+ // write element
+ if( bExportContent )
+ {
+ // add style name attribute
+ AddAutoStyleAttribute( aPropertyStates );
+
+ SvXMLElementExport aFloor( mrExport, XML_NAMESPACE_CHART, XML_FLOOR, true, true );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
}
}
@@ -2139,26 +2139,26 @@ void SchXMLExportHelper_Impl::exportDateScale( const Reference< beans::XProperty
return;
chart::TimeIncrement aIncrement;
- if( rAxisProps->getPropertyValue("TimeIncrement") >>= aIncrement )
- {
- sal_Int32 nTimeResolution = css::chart::TimeUnit::DAY;
- if( aIncrement.TimeResolution >>= nTimeResolution )
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_BASE_TIME_UNIT, lcl_getTimeUnitToken( nTimeResolution ) );
+ if( !(rAxisProps->getPropertyValue("TimeIncrement") >>= aIncrement) )
+ return;
- chart::TimeInterval aInterval;
- if( aIncrement.MajorTimeInterval >>= aInterval )
- {
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_VALUE, OUString::number(aInterval.Number) );
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
- }
- if( aIncrement.MinorTimeInterval >>= aInterval )
- {
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_VALUE, OUString::number(aInterval.Number) );
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
- }
+ sal_Int32 nTimeResolution = css::chart::TimeUnit::DAY;
+ if( aIncrement.TimeResolution >>= nTimeResolution )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_BASE_TIME_UNIT, lcl_getTimeUnitToken( nTimeResolution ) );
- SvXMLElementExport aDateScale( mrExport, XML_NAMESPACE_CHART_EXT, XML_DATE_SCALE, true, true );//#i25706#todo: change namespace for next ODF version
+ chart::TimeInterval aInterval;
+ if( aIncrement.MajorTimeInterval >>= aInterval )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_VALUE, OUString::number(aInterval.Number) );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MAJOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
}
+ if( aIncrement.MinorTimeInterval >>= aInterval )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_VALUE, OUString::number(aInterval.Number) );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_MINOR_INTERVAL_UNIT, lcl_getTimeUnitToken( aInterval.TimeUnit ) );
+ }
+
+ SvXMLElementExport aDateScale( mrExport, XML_NAMESPACE_CHART_EXT, XML_DATE_SCALE, true, true );//#i25706#todo: change namespace for next ODF version
}
void SchXMLExportHelper_Impl::exportAxisTitle( const Reference< beans::XPropertySet >& rTitleProps, bool bExportContent )
@@ -2915,110 +2915,110 @@ void SchXMLExportHelper_Impl::exportRegressionCurve(
OSL_ASSERT( mxExpPropMapper.is());
Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer( xSeries, uno::UNO_QUERY );
- if( xRegressionCurveContainer.is() )
+ if( !xRegressionCurveContainer.is() )
+ return;
+
+ const Sequence< Reference< chart2::XRegressionCurve > > aRegCurveSeq = xRegressionCurveContainer->getRegressionCurves();
+
+ for( const auto& xRegCurve : aRegCurveSeq )
{
- const Sequence< Reference< chart2::XRegressionCurve > > aRegCurveSeq = xRegressionCurveContainer->getRegressionCurves();
+ std::vector< XMLPropertyState > aEquationPropertyStates;
+ if (!xRegCurve.is())
+ continue;
- for( const auto& xRegCurve : aRegCurveSeq )
- {
- std::vector< XMLPropertyState > aEquationPropertyStates;
- if (!xRegCurve.is())
- continue;
+ Reference< beans::XPropertySet > xProperties( xRegCurve , uno::UNO_QUERY );
+ if( !xProperties.is() )
+ continue;
- Reference< beans::XPropertySet > xProperties( xRegCurve , uno::UNO_QUERY );
- if( !xProperties.is() )
- continue;
+ Reference< lang::XServiceName > xServiceName( xProperties, uno::UNO_QUERY );
+ if( !xServiceName.is() )
+ continue;
- Reference< lang::XServiceName > xServiceName( xProperties, uno::UNO_QUERY );
- if( !xServiceName.is() )
- continue;
+ bool bShowEquation = false;
+ bool bShowRSquared = false;
+ bool bExportEquation = false;
- bool bShowEquation = false;
- bool bShowRSquared = false;
- bool bExportEquation = false;
+ OUString aService = xServiceName->getServiceName();
- OUString aService = xServiceName->getServiceName();
+ std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xProperties );
- std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xProperties );
+ // Add service name (which is regression type)
+ sal_Int32 nIndex = GetPropertySetMapper()->FindEntryIndex(XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE);
+ XMLPropertyState property(nIndex, uno::makeAny(aService));
+ aPropertyStates.push_back(property);
- // Add service name (which is regression type)
- sal_Int32 nIndex = GetPropertySetMapper()->FindEntryIndex(XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE);
- XMLPropertyState property(nIndex, uno::makeAny(aService));
- aPropertyStates.push_back(property);
+ Reference< beans::XPropertySet > xEquationProperties;
+ xEquationProperties.set( xRegCurve->getEquationProperties() );
+ if( xEquationProperties.is())
+ {
+ xEquationProperties->getPropertyValue( "ShowEquation") >>= bShowEquation;
+ xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient") >>= bShowRSquared;
- Reference< beans::XPropertySet > xEquationProperties;
- xEquationProperties.set( xRegCurve->getEquationProperties() );
- if( xEquationProperties.is())
+ bExportEquation = ( bShowEquation || bShowRSquared );
+ const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
+ if (nCurrentVersion < SvtSaveOptions::ODFSVER_012)
{
- xEquationProperties->getPropertyValue( "ShowEquation") >>= bShowEquation;
- xEquationProperties->getPropertyValue( "ShowCorrelationCoefficient") >>= bShowRSquared;
-
- bExportEquation = ( bShowEquation || bShowRSquared );
- const SvtSaveOptions::ODFSaneDefaultVersion nCurrentVersion(SvtSaveOptions().GetODFSaneDefaultVersion());
- if (nCurrentVersion < SvtSaveOptions::ODFSVER_012)
- {
- bExportEquation=false;
- }
- if( bExportEquation )
+ bExportEquation=false;
+ }
+ if( bExportEquation )
+ {
+ // number format
+ sal_Int32 nNumberFormat = 0;
+ if( (xEquationProperties->getPropertyValue("NumberFormat") >>= nNumberFormat ) &&
+ nNumberFormat != -1 )
{
- // number format
- sal_Int32 nNumberFormat = 0;
- if( (xEquationProperties->getPropertyValue("NumberFormat") >>= nNumberFormat ) &&
- nNumberFormat != -1 )
- {
- mrExport.addDataStyle( nNumberFormat );
- }
- aEquationPropertyStates = mxExpPropMapper->Filter( xEquationProperties );
+ mrExport.addDataStyle( nNumberFormat );
}
+ aEquationPropertyStates = mxExpPropMapper->Filter( xEquationProperties );
}
+ }
- if( !aPropertyStates.empty() || bExportEquation )
+ if( !aPropertyStates.empty() || bExportEquation )
+ {
+ // write element
+ if( bExportContent )
{
- // write element
- if( bExportContent )
+ // add style name attribute
+ if( !aPropertyStates.empty())
{
- // add style name attribute
- if( !aPropertyStates.empty())
+ AddAutoStyleAttribute( aPropertyStates );
+ }
+
+ SvXMLElementExport aRegressionExport( mrExport, XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, true, true );
+ if( bExportEquation )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_EQUATION, (bShowEquation ? XML_TRUE : XML_FALSE) );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_R_SQUARE, (bShowRSquared ? XML_TRUE : XML_FALSE) );
+
+ // export position
+ chart2::RelativePosition aRelativePosition;
+ if( xEquationProperties->getPropertyValue( "RelativePosition" ) >>= aRelativePosition )
{
- AddAutoStyleAttribute( aPropertyStates );
+ double fX = aRelativePosition.Primary * rPageSize.Width;
+ double fY = aRelativePosition.Secondary * rPageSize.Height;
+ awt::Point aPos;
+ aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( fX ));
+ aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY ));
+ addPosition( aPos );
}
- SvXMLElementExport aRegressionExport( mrExport, XML_NAMESPACE_CHART, XML_REGRESSION_CURVE, true, true );
- if( bExportEquation )
+ if( !aEquationPropertyStates.empty())
{
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_EQUATION, (bShowEquation ? XML_TRUE : XML_FALSE) );
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DISPLAY_R_SQUARE, (bShowRSquared ? XML_TRUE : XML_FALSE) );
-
- // export position
- chart2::RelativePosition aRelativePosition;
- if( xEquationProperties->getPropertyValue( "RelativePosition" ) >>= aRelativePosition )
- {
- double fX = aRelativePosition.Primary * rPageSize.Width;
- double fY = aRelativePosition.Secondary * rPageSize.Height;
- awt::Point aPos;
- aPos.X = static_cast< sal_Int32 >( ::rtl::math::round( fX ));
- aPos.Y = static_cast< sal_Int32 >( ::rtl::math::round( fY ));
- addPosition( aPos );
- }
-
- if( !aEquationPropertyStates.empty())
- {
- AddAutoStyleAttribute( aEquationPropertyStates );
- }
-
- SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_EQUATION, true, true );
+ AddAutoStyleAttribute( aEquationPropertyStates );
}
+
+ SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_EQUATION, true, true );
}
- else // autostyles
+ }
+ else // autostyles
+ {
+ if( !aPropertyStates.empty())
{
- if( !aPropertyStates.empty())
- {
- CollectAutoStyle( aPropertyStates );
- }
- if( bExportEquation && !aEquationPropertyStates.empty())
- {
- CollectAutoStyle( aEquationPropertyStates );
- }
+ CollectAutoStyle( aPropertyStates );
+ }
+ if( bExportEquation && !aEquationPropertyStates.empty())
+ {
+ CollectAutoStyle( aEquationPropertyStates );
}
}
}
@@ -3036,68 +3036,68 @@ void SchXMLExportHelper_Impl::exportErrorBar( const Reference<beans::XPropertySe
if (!bYError && nCurrentVersion < SvtSaveOptions::ODFSVER_012)
return;
- if (xSeriesProp.is())
+ if (!xSeriesProp.is())
+ return;
+
+ bool bNegative = false, bPositive = false;
+ sal_Int32 nErrorBarStyle = chart::ErrorBarStyle::NONE;
+ Reference< beans::XPropertySet > xErrorBarProp;
+
+ try
{
- bool bNegative = false, bPositive = false;
- sal_Int32 nErrorBarStyle = chart::ErrorBarStyle::NONE;
- Reference< beans::XPropertySet > xErrorBarProp;
+ Any aAny = xSeriesProp->getPropertyValue( bYError ? OUString("ErrorBarY") : OUString("ErrorBarX") );
+ aAny >>= xErrorBarProp;
- try
+ if ( xErrorBarProp.is() )
{
- Any aAny = xSeriesProp->getPropertyValue( bYError ? OUString("ErrorBarY") : OUString("ErrorBarX") );
- aAny >>= xErrorBarProp;
+ aAny = xErrorBarProp->getPropertyValue("ShowNegativeError" );
+ aAny >>= bNegative;
- if ( xErrorBarProp.is() )
- {
- aAny = xErrorBarProp->getPropertyValue("ShowNegativeError" );
- aAny >>= bNegative;
-
- aAny = xErrorBarProp->getPropertyValue("ShowPositiveError" );
- aAny >>= bPositive;
+ aAny = xErrorBarProp->getPropertyValue("ShowPositiveError" );
+ aAny >>= bPositive;
- aAny = xErrorBarProp->getPropertyValue("ErrorBarStyle" );
- aAny >>= nErrorBarStyle;
- }
+ aAny = xErrorBarProp->getPropertyValue("ErrorBarStyle" );
+ aAny >>= nErrorBarStyle;
}
- catch( const beans::UnknownPropertyException & )
+ }
+ catch( const beans::UnknownPropertyException & )
+ {
+ TOOLS_INFO_EXCEPTION("xmloff.chart", "Required property not found in DataRowProperties" );
+ }
+
+ if( !(nErrorBarStyle != chart::ErrorBarStyle::NONE && (bNegative || bPositive)))
+ return;
+
+ if( bExportContent && nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA )
+ {
+ // register data ranges for error bars for export in local table
+ ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences(
+ lcl_getErrorBarSequences( xErrorBarProp ));
+ for( const auto& rErrorBarSequence : aErrorBarSequences )
{
- TOOLS_INFO_EXCEPTION("xmloff.chart", "Required property not found in DataRowProperties" );
+ m_aDataSequencesToExport.emplace_back(
+ uno::Reference< chart2::data::XDataSequence >(), rErrorBarSequence );
}
+ }
- if( nErrorBarStyle != chart::ErrorBarStyle::NONE && (bNegative || bPositive))
- {
- if( bExportContent && nErrorBarStyle == chart::ErrorBarStyle::FROM_DATA )
- {
- // register data ranges for error bars for export in local table
- ::std::vector< Reference< chart2::data::XDataSequence > > aErrorBarSequences(
- lcl_getErrorBarSequences( xErrorBarProp ));
- for( const auto& rErrorBarSequence : aErrorBarSequences )
- {
- m_aDataSequencesToExport.emplace_back(
- uno::Reference< chart2::data::XDataSequence >(), rErrorBarSequence );
- }
- }
+ std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp );
- std::vector< XMLPropertyState > aPropertyStates = mxExpPropMapper->Filter( xErrorBarProp );
+ if( aPropertyStates.empty() )
+ return;
- if( !aPropertyStates.empty() )
- {
- // write element
- if( bExportContent )
- {
- // add style name attribute
- AddAutoStyleAttribute( aPropertyStates );
+ // write element
+ if( bExportContent )
+ {
+ // add style name attribute
+ AddAutoStyleAttribute( aPropertyStates );
- if (nCurrentVersion >= SvtSaveOptions::ODFSVER_012)
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, bYError ? XML_Y : XML_X );//#i114149#
- SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, true, true );
- }
- else // autostyles
- {
- CollectAutoStyle( aPropertyStates );
- }
- }
- }
+ if (nCurrentVersion >= SvtSaveOptions::ODFSVER_012)
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, bYError ? XML_Y : XML_X );//#i114149#
+ SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, true, true );
+ }
+ else // autostyles
+ {
+ CollectAutoStyle( aPropertyStates );
}
}
@@ -3449,28 +3449,28 @@ void SchXMLExportHelper_Impl::exportDataPoints(
aLastPoint = aPoint;
}
// write last element if it hasn't been written in last iteration
- if( aPoint.maStyleName == aLastPoint.maStyleName )
- {
- if( !aLastPoint.maStyleName.isEmpty() )
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME, aLastPoint.maStyleName );
+ if( aPoint.maStyleName != aLastPoint.maStyleName )
+ return;
- if( aLastPoint.mnRepeat > 1 )
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
- OUString::number( ( aLastPoint.mnRepeat ) ));
+ if( !aLastPoint.maStyleName.isEmpty() )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME, aLastPoint.maStyleName );
- for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+ if( aLastPoint.mnRepeat > 1 )
+ mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_REPEATED,
+ OUString::number( ( aLastPoint.mnRepeat ) ));
+
+ for (auto& deletedLegendEntry : deletedLegendEntriesSeq)
+ {
+ if (nIndex == deletedLegendEntry)
{
- if (nIndex == deletedLegendEntry)
- {
- mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_HIDE_LEGEND, OUString::boolean(true));
- break;
- }
+ mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_HIDE_LEGEND, OUString::boolean(true));
+ break;
}
-
- exportCustomLabelPosition(aLastPoint.mCustomLabelPos);
- SvXMLElementExport aPointElem( mrExport, XML_NAMESPACE_CHART, XML_DATA_POINT, true, true );
- exportCustomLabel(aLastPoint.mCustomLabelText);
}
+
+ exportCustomLabelPosition(aLastPoint.mCustomLabelPos);
+ SvXMLElementExport aPointElem( mrExport, XML_NAMESPACE_CHART, XML_DATA_POINT, true, true );
+ exportCustomLabel(aLastPoint.mCustomLabelText);
}
void SchXMLExportHelper_Impl::exportCustomLabel( const CustomLabelSeq & xCustomLabel )
@@ -3709,53 +3709,55 @@ rtl::Reference< XMLPropertySetMapper > const & SchXMLExport::GetPropertySetMappe
void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc )
{
- if( xChartDoc.is())
- try
+ if( !xChartDoc.is())
+ return;
+
+ try
+ {
+ Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
+ SAL_WARN_IF( !xDataProvider.is(), "xmloff.chart", "No DataProvider" );
+ if( xDataProvider.is())
{
- Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
- SAL_WARN_IF( !xDataProvider.is(), "xmloff.chart", "No DataProvider" );
- if( xDataProvider.is())
+ Reference< chart2::data::XDataSource > xDataSource( lcl_pressUsedDataIntoRectangularFormat( xChartDoc, mbHasCategoryLabels ));
+ const Sequence< beans::PropertyValue > aArgs( xDataProvider->detectArguments( xDataSource ));
+ OUString sCellRange, sBrokenRange;
+ bool bBrokenRangeAvailable = false;
+ for( const auto& rArg : aArgs )
{
- Reference< chart2::data::XDataSource > xDataSource( lcl_pressUsedDataIntoRectangularFormat( xChartDoc, mbHasCategoryLabels ));
- const Sequence< beans::PropertyValue > aArgs( xDataProvider->detectArguments( xDataSource ));
- OUString sCellRange, sBrokenRange;
- bool bBrokenRangeAvailable = false;
- for( const auto& rArg : aArgs )
+ if ( rArg.Name == "CellRangeRepresentation" )
+ rArg.Value >>= sCellRange;
+ else if ( rArg.Name == "BrokenCellRangeForExport" )
{
- if ( rArg.Name == "CellRangeRepresentation" )
- rArg.Value >>= sCellRange;
- else if ( rArg.Name == "BrokenCellRangeForExport" )
- {
- if( rArg.Value >>= sBrokenRange )
- bBrokenRangeAvailable = true;
- }
- else if ( rArg.Name == "DataRowSource" )
- {
- chart::ChartDataRowSource eRowSource;
- rArg.Value >>= eRowSource;
- mbRowSourceColumns = ( eRowSource == chart::ChartDataRowSource_COLUMNS );
- }
- else if ( rArg.Name == "SequenceMapping" )
- rArg.Value >>= maSequenceMapping;
+ if( rArg.Value >>= sBrokenRange )
+ bBrokenRangeAvailable = true;
}
-
- // #i79009# For Writer we have to export a broken version of the
- // range, where every row number is not too large, so that older
- // version can correctly read those files.
- msChartAddress = (bBrokenRangeAvailable ? sBrokenRange : sCellRange);
- if( !msChartAddress.isEmpty() )
+ else if ( rArg.Name == "DataRowSource" )
{
- // convert format to XML-conform one
- Reference< chart2::data::XRangeXMLConversion > xConversion( xDataProvider, uno::UNO_QUERY );
- if( xConversion.is())
- msChartAddress = xConversion->convertRangeToXML( msChartAddress );
+ chart::ChartDataRowSource eRowSource;
+ rArg.Value >>= eRowSource;
+ mbRowSourceColumns = ( eRowSource == chart::ChartDataRowSource_COLUMNS );
}
+ else if ( rArg.Name == "SequenceMapping" )
+ rArg.Value >>= maSequenceMapping;
+ }
+
+ // #i79009# For Writer we have to export a broken version of the
+ // range, where every row number is not too large, so that older
+ // version can correctly read those files.
+ msChartAddress = (bBrokenRangeAvailable ? sBrokenRange : sCellRange);
+ if( !msChartAddress.isEmpty() )
+ {
+ // convert format to XML-conform one
+ Reference< chart2::data::XRangeXMLConversion > xConversion( xDataProvider, uno::UNO_QUERY );
+ if( xConversion.is())
+ msChartAddress = xConversion->convertRangeToXML( msChartAddress );
}
}
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("xmloff.chart");
- }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("xmloff.chart");
+ }
}
// first version: everything goes in one storage
diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx
index 9161cfad0e24..8e56c0489e40 100644
--- a/xmloff/source/chart/SchXMLParagraphContext.cxx
+++ b/xmloff/source/chart/SchXMLParagraphContext.cxx
@@ -47,30 +47,30 @@ void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttr
{
// remember the id. It is used for storing the original cell range string in
// a local table (cached data)
- if( mpId )
+ if( !mpId )
+ return;
+
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ bool bHaveXmlId( false );
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- bool bHaveXmlId( false );
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ if (IsXMLToken(aLocalName, XML_ID))
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- if (IsXMLToken(aLocalName, XML_ID))
+ if (nPrefix == XML_NAMESPACE_XML)
{
- if (nPrefix == XML_NAMESPACE_XML)
+ (*mpId) = xAttrList->getValueByIndex( i );
+ bHaveXmlId = true;
+ }
+ if (nPrefix == XML_NAMESPACE_TEXT)
+ { // text:id shall be ignored if xml:id exists
+ if (!bHaveXmlId)
{
(*mpId) = xAttrList->getValueByIndex( i );
- bHaveXmlId = true;
- }
- if (nPrefix == XML_NAMESPACE_TEXT)
- { // text:id shall be ignored if xml:id exists
- if (!bHaveXmlId)
- {
- (*mpId) = xAttrList->getValueByIndex( i );
- }
}
}
}
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 6509cfc11d7c..1e32ac3d4d95 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -175,32 +175,31 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext(
uno::Reference< lang::XServiceInfo > xInfo( mxDiagram, uno::UNO_QUERY );
uno::Reference< beans::XPropertySet > xProp( mxDiagram, uno::UNO_QUERY );
- if( xInfo.is() &&
- xProp.is())
+ if( !xInfo.is() || !xProp.is() )
+ return;
+
+ try
{
- try
- {
- xProp->setPropertyValue("HasXAxis", aFalseBool );
- xProp->setPropertyValue("HasXAxisGrid", aFalseBool );
- xProp->setPropertyValue("HasXAxisDescription", aFalseBool );
- xProp->setPropertyValue("HasSecondaryXAxis", aFalseBool );
- xProp->setPropertyValue("HasSecondaryXAxisDescription", aFalseBool );
-
- xProp->setPropertyValue("HasYAxis", aFalseBool );
- xProp->setPropertyValue("HasYAxisGrid", aFalseBool );
- xProp->setPropertyValue("HasYAxisDescription", aFalseBool );
- xProp->setPropertyValue("HasSecondaryYAxis", aFalseBool );
- xProp->setPropertyValue("HasSecondaryYAxisDescription", aFalseBool );
-
- xProp->setPropertyValue("HasZAxis", aFalseBool );
- xProp->setPropertyValue("HasZAxisDescription", aFalseBool );
-
- xProp->setPropertyValue("DataRowSource", uno::Any(chart::ChartDataRowSource_COLUMNS) );
- }
- catch( const beans::UnknownPropertyException & )
- {
- SAL_WARN("xmloff.chart", "Property required by service not supported" );
- }
+ xProp->setPropertyValue("HasXAxis", aFalseBool );
+ xProp->setPropertyValue("HasXAxisGrid", aFalseBool );
+ xProp->setPropertyValue("HasXAxisDescription", aFalseBool );
+ xProp->setPropertyValue("HasSecondaryXAxis", aFalseBool );
+ xProp->setPropertyValue("HasSecondaryXAxisDescription", aFalseBool );
+
+ xProp->setPropertyValue("HasYAxis", aFalseBool );
+ xProp->setPropertyValue("HasYAxisGrid", aFalseBool );
+ xProp->setPropertyValue("HasYAxisDescription", aFalseBool );
+ xProp->setPropertyValue("HasSecondaryYAxis", aFalseBool );
+ xProp->setPropertyValue("HasSecondaryYAxisDescription", aFalseBool );
+
+ xProp->setPropertyValue("HasZAxis", aFalseBool );
+ xProp->setPropertyValue("HasZAxisDescription", aFalseBool );
+
+ xProp->setPropertyValue("DataRowSource", uno::Any(chart::ChartDataRowSource_COLUMNS) );
+ }
+ catch( const beans::UnknownPropertyException & )
+ {
+ SAL_WARN("xmloff.chart", "Property required by service not supported" );
}
}
@@ -777,32 +776,32 @@ bool SchXMLPositionAttributesHelper::isAutomatic() const
void SchXMLPositionAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue )
{
- if( XML_NAMESPACE_SVG == nPrefix )
+ if( XML_NAMESPACE_SVG != nPrefix )
+ return;
+
+ if( IsXMLToken( rLocalName, XML_X ) )
{
- if( IsXMLToken( rLocalName, XML_X ) )
- {
- m_rImport.GetMM100UnitConverter().convertMeasureToCore(
- m_aPosition.X, rValue );
- m_bHasPositionX = true;
- }
- else if( IsXMLToken( rLocalName, XML_Y ) )
- {
- m_rImport.GetMM100UnitConverter().convertMeasureToCore(
- m_aPosition.Y, rValue );
- m_bHasPositionY = true;
- }
- else if( IsXMLToken( rLocalName, XML_WIDTH ) )
- {
- m_rImport.GetMM100UnitConverter().convertMeasureToCore(
- m_aSize.Width, rValue );
- m_bHasSizeWidth = true;
- }
- else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
- {
- m_rImport.GetMM100UnitConverter().convertMeasureToCore(
- m_aSize.Height, rValue );
- m_bHasSizeHeight = true;
- }
+ m_rImport.GetMM100UnitConverter().convertMeasureToCore(
+ m_aPosition.X, rValue );
+ m_bHasPositionX = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_Y ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasureToCore(
+ m_aPosition.Y, rValue );
+ m_bHasPositionY = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_WIDTH ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasureToCore(
+ m_aSize.Width, rValue );
+ m_bHasSizeWidth = true;
+ }
+ else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
+ {
+ m_rImport.GetMM100UnitConverter().convertMeasureToCore(
+ m_aSize.Height, rValue );
+ m_bHasSizeHeight = true;
}
}
@@ -867,32 +866,32 @@ SchXMLWallFloorContext::~SchXMLWallFloorContext()
void SchXMLWallFloorContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
- if( mxWallFloorSupplier.is())
+ if( !mxWallFloorSupplier.is())
+ return;
+
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ OUString sAutoStyleName;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- OUString sAutoStyleName;
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- if( nPrefix == XML_NAMESPACE_CHART &&
- IsXMLToken( aLocalName, XML_STYLE_NAME ) )
- {
- sAutoStyleName = xAttrList->getValueByIndex( i );
- }
+ sAutoStyleName = xAttrList->getValueByIndex( i );
}
+ }
- // set properties
- uno::Reference< beans::XPropertySet > xProp = ( meContextType == CONTEXT_TYPE_WALL )
- ? mxWallFloorSupplier->getWall()
- : mxWallFloorSupplier->getFloor();
+ // set properties
+ uno::Reference< beans::XPropertySet > xProp = ( meContextType == CONTEXT_TYPE_WALL )
+ ? mxWallFloorSupplier->getWall()
+ : mxWallFloorSupplier->getFloor();
- if (!sAutoStyleName.isEmpty())
- mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
- }
+ if (!sAutoStyleName.isEmpty())
+ mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
}
SchXMLStockContext::SchXMLStockContext(
@@ -915,44 +914,44 @@ SchXMLStockContext::~SchXMLStockContext()
void SchXMLStockContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
{
- if( mxStockPropProvider.is())
+ if( !mxStockPropProvider.is())
+ return;
+
+ sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+ OUString sAutoStyleName;
+
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
- sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- OUString sAutoStyleName;
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ if( nPrefix == XML_NAMESPACE_CHART &&
+ IsXMLToken( aLocalName, XML_STYLE_NAME ) )
{
- OUString sAttrName = xAttrList->getNameByIndex( i );
- OUString aLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
-
- if( nPrefix == XML_NAMESPACE_CHART &&
- IsXMLToken( aLocalName, XML_STYLE_NAME ) )
- {
- sAutoStyleName = xAttrList->getValueByIndex( i );
- }
+ sAutoStyleName = xAttrList->getValueByIndex( i );
}
+ }
- if( !sAutoStyleName.isEmpty())
- {
- // set properties
- uno::Reference< beans::XPropertySet > xProp;
- switch( meContextType )
- {
- case CONTEXT_TYPE_GAIN:
- xProp = mxStockPropProvider->getUpBar();
- break;
- case CONTEXT_TYPE_LOSS:
- xProp = mxStockPropProvider->getDownBar();
- break;
- case CONTEXT_TYPE_RANGE:
- xProp = mxStockPropProvider->getMinMaxLine();
- break;
- }
+ if( sAutoStyleName.isEmpty())
+ return;
- mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
- }
+ // set properties
+ uno::Reference< beans::XPropertySet > xProp;
+ switch( meContextType )
+ {
+ case CONTEXT_TYPE_GAIN:
+ xProp = mxStockPropProvider->getUpBar();
+ break;
+ case CONTEXT_TYPE_LOSS:
+ xProp = mxStockPropProvider->getDownBar();
+ break;
+ case CONTEXT_TYPE_RANGE:
+ xProp = mxStockPropProvider->getMinMaxLine();
+ break;
}
+
+ mrImportHelper.FillAutoStyle(sAutoStyleName, xProp);
}
static void lcl_setErrorBarSequence ( const uno::Reference< chart2::XChartDocument > &xDoc,
@@ -1193,59 +1192,59 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax
}
}
- if( !sAutoStyleName.isEmpty() )
- {
- DataRowPointStyle aStyle( DataRowPointStyle::MEAN_VALUE, m_xSeries, -1, 1, sAutoStyleName );
+ if( sAutoStyleName.isEmpty() )
+ return;
- switch( meContextType )
- {
- case CONTEXT_TYPE_MEAN_VALUE_LINE:
- aStyle.meType = DataRowPointStyle::MEAN_VALUE;
- break;
- case CONTEXT_TYPE_ERROR_INDICATOR:
- {
- aStyle.meType = DataRowPointStyle::ERROR_INDICATOR;
+ DataRowPointStyle aStyle( DataRowPointStyle::MEAN_VALUE, m_xSeries, -1, 1, sAutoStyleName );
- uno::Reference< lang::XMultiServiceFactory > xFact = comphelper::getProcessServiceFactory();
+ switch( meContextType )
+ {
+ case CONTEXT_TYPE_MEAN_VALUE_LINE:
+ aStyle.meType = DataRowPointStyle::MEAN_VALUE;
+ break;
+ case CONTEXT_TYPE_ERROR_INDICATOR:
+ {
+ aStyle.meType = DataRowPointStyle::ERROR_INDICATOR;
- uno::Reference< beans::XPropertySet > xBarProp( xFact->createInstance("com.sun.star.chart2.ErrorBar" ),
- uno::UNO_QUERY );
+ uno::Reference< lang::XMultiServiceFactory > xFact = comphelper::getProcessServiceFactory();
- xBarProp->setPropertyValue("ErrorBarStyle",uno::makeAny(css::chart::ErrorBarStyle::NONE));
- xBarProp->setPropertyValue("PositiveError",uno::makeAny(0.0));
- xBarProp->setPropertyValue("NegativeError",uno::makeAny(0.0));
- xBarProp->setPropertyValue("Weight",uno::makeAny(1.0));
- xBarProp->setPropertyValue("ShowPositiveError",uno::makeAny(true));
- xBarProp->setPropertyValue("ShowNegativeError",uno::makeAny(true));
+ uno::Reference< beans::XPropertySet > xBarProp( xFact->createInstance("com.sun.star.chart2.ErrorBar" ),
+ uno::UNO_QUERY );
- // first import defaults from parent style
- SetErrorBarStyleProperties( maSeriesStyleName, xBarProp, mrImportHelper );
- SetErrorBarStyleProperties( sAutoStyleName, xBarProp, mrImportHelper );
- SetErrorBarPropertiesFromStyleName( maSeriesStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
- SetErrorBarPropertiesFromStyleName( sAutoStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
+ xBarProp->setPropertyValue("ErrorBarStyle",uno::makeAny(css::chart::ErrorBarStyle::NONE));
+ xBarProp->setPropertyValue("PositiveError",uno::makeAny(0.0));
+ xBarProp->setPropertyValue("NegativeError",uno::makeAny(0.0));
+ xBarProp->setPropertyValue("Weight",uno::makeAny(1.0));
+ xBarProp->setPropertyValue("ShowPositiveError",uno::makeAny(true));
+ xBarProp->setPropertyValue("ShowNegativeError",uno::makeAny(true));
- uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY);
+ // first import defaults from parent style
+ SetErrorBarStyleProperties( maSeriesStyleName, xBarProp, mrImportHelper );
+ SetErrorBarStyleProperties( sAutoStyleName, xBarProp, mrImportHelper );
+ SetErrorBarPropertiesFromStyleName( maSeriesStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
+ SetErrorBarPropertiesFromStyleName( sAutoStyleName, xBarProp, mrImportHelper, aPosRange, aNegRange );
- if (!aPosRange.isEmpty())
- lcl_setErrorBarSequence(xDoc,xBarProp,aPosRange,true,bYError, mrLSequencesPerIndex);
+ uno::Reference< chart2::XChartDocument > xDoc(GetImport().GetModel(),uno::UNO_QUERY);
- if (!aNegRange.isEmpty())
- lcl_setErrorBarSequence(xDoc,xBarProp,aNegRange,false,bYError, mrLSequencesPerIndex);
+ if (!aPosRange.isEmpty())
+ lcl_setErrorBarSequence(xDoc,xBarProp,aPosRange,true,bYError, mrLSequencesPerIndex);
- if ( !bYError )
- {
- aStyle.m_xErrorXProperties.set( xBarProp );
- }
- else
- {
- aStyle.m_xErrorYProperties.set( xBarProp );
- }
- }
- break;
- }
+ if (!aNegRange.isEmpty())
+ lcl_setErrorBarSequence(xDoc,xBarProp,aNegRange,false,bYError, mrLSequencesPerIndex);
- mrStyleVector.push_back( aStyle );
+ if ( !bYError )
+ {
+ aStyle.m_xErrorXProperties.set( xBarProp );
+ }
+ else
+ {
+ aStyle.m_xErrorYProperties.set( xBarProp );
+ }
+ }
+ break;
}
+
+ mrStyleVector.push_back( aStyle );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx b/xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx
index 13a31686424e..022a1f0ba6cd 100644
--- a/xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx
+++ b/xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx
@@ -163,37 +163,37 @@ void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttri
}
}
- if( !sAutoStyleName.isEmpty() || bShowEquation || bShowRSquare )
- {
- uno::Reference< beans::XPropertySet > xEquationProperties = chart2::RegressionEquation::create( comphelper::getProcessComponentContext() );
+ if( sAutoStyleName.isEmpty() && !bShowEquation && !bShowRSquare )
+ return;
+
+ uno::Reference< beans::XPropertySet > xEquationProperties = chart2::RegressionEquation::create( comphelper::getProcessComponentContext() );
- if( !sAutoStyleName.isEmpty() )
+ if( !sAutoStyleName.isEmpty() )
+ {
+ const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
+ if( pStylesCtxt )
{
- const SvXMLStylesContext* pStylesCtxt = mrImportHelper.GetAutoStylesContext();
- if( pStylesCtxt )
- {
- const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
- SchXMLImportHelper::GetChartFamilyID(), sAutoStyleName );
+ const SvXMLStyleContext* pStyle = pStylesCtxt->FindStyleChildContext(
+ SchXMLImportHelper::GetChartFamilyID(), sAutoStyleName );
- XMLPropStyleContext* pPropStyleContext =
- const_cast< XMLPropStyleContext* >( dynamic_cast< const XMLPropStyleContext* >( pStyle ));
+ XMLPropStyleContext* pPropStyleContext =
+ const_cast< XMLPropStyleContext* >( dynamic_cast< const XMLPropStyleContext* >( pStyle ));
- if( pPropStyleContext )
- pPropStyleContext->FillPropertySet( xEquationProperties );
- }
+ if( pPropStyleContext )
+ pPropStyleContext->FillPropertySet( xEquationProperties );
}
- xEquationProperties->setPropertyValue( "ShowEquation", uno::makeAny( bShowEquation ));
- xEquationProperties->setPropertyValue( "ShowCorrelationCoefficient", uno::makeAny( bShowRSquare ));
+ }
+ xEquationProperties->setPropertyValue( "ShowEquation", uno::makeAny( bShowEquation ));
+ xEquationProperties->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 );
- xEquationProperties->setPropertyValue( "RelativePosition", uno::makeAny( aRelPos ));
- }
- mrRegressionStyle.m_xEquationProperties.set( xEquationProperties );
+ 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 );
+ xEquationProperties->setPropertyValue( "RelativePosition", uno::makeAny( aRelPos ));
}
+ mrRegressionStyle.m_xEquationProperties.set( xEquationProperties );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 6663d111edbf..266bc5f65ce7 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -146,19 +146,19 @@ void lcl_setSymbolSizeIfNeeded( const uno::Reference< beans::XPropertySet >& xSe
return;
sal_Int32 nSymbolType = chart::ChartSymbolType::NONE;
- if( xSeriesOrPointProp.is() && ( xSeriesOrPointProp->getPropertyValue("SymbolType") >>= nSymbolType) )
+ if( !(xSeriesOrPointProp.is() && ( xSeriesOrPointProp->getPropertyValue("SymbolType") >>= nSymbolType)) )
+ return;
+
+ if(chart::ChartSymbolType::NONE!=nSymbolType)
{
- if(chart::ChartSymbolType::NONE!=nSymbolType)
+ if( chart::ChartSymbolType::BITMAPURL==nSymbolType )
{
- if( chart::ChartSymbolType::BITMAPURL==nSymbolType )
- {
- //set special size for graphics to indicate to use the bitmap size itself
- xSeriesOrPointProp->setPropertyValue("SymbolSize",uno::makeAny( awt::Size(-1,-1) ));
- }
- else
- {
- lcl_setAutomaticSymbolSize( xSeriesOrPointProp, rImport );
- }
+ //set special size for graphics to indicate to use the bitmap size itself
+ xSeriesOrPointProp->setPropertyValue("SymbolSize",uno::makeAny( awt::Size(-1,-1) ));
+ }
+ else
+ {
+ lcl_setAutomaticSymbolSize( xSeriesOrPointProp, rImport );
}
}
}
@@ -175,18 +175,18 @@ void lcl_setLinkNumberFormatToSourceIfNeeded( const uno::Reference< beans::XProp
, const XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt )
{
uno::Any aAny( SchXMLTools::getPropertyFromContext("LinkNumberFormatToSource", pPropStyleContext, pStylesCtxt) );
- if( !aAny.hasValue() )
- {
- if( !xPointProp.is() )
- return;
+ if( aAny.hasValue() )
+ return;
+
+ if( !xPointProp.is() )
+ return;
- bool bLinkToSource = false;
- if( xPointProp.is() && (xPointProp->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource) )
+ bool bLinkToSource = false;
+ if( xPointProp.is() && (xPointProp->getPropertyValue("LinkNumberFormatToSource") >>= bLinkToSource) )
+ {
+ if( bLinkToSource )
{
- if( bLinkToSource )
- {
- xPointProp->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(false));
- }
+ xPointProp->setPropertyValue("LinkNumberFormatToSource", uno::makeAny(false));
}
}
}
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index d4a7b143590a..16f656e24108 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -928,118 +928,118 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary(
//i91578 display of hidden values (copy paste scenario; use hidden flag during migration to locale table upon paste )
//remove series that consist only of hidden columns
Reference< chart2::XInternalDataProvider > xInternalDataProvider( xDataProv, uno::UNO_QUERY );
- if( xInternalDataProvider.is() && !rTable.aHiddenColumns.empty() )
+ if( !xInternalDataProvider.is() || rTable.aHiddenColumns.empty() )
+ return;
+
+ try
{
- try
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChartDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
+ for( const auto& rCooSys : aCooSysSeq )
{
- Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChartDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
- const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
- for( const auto& rCooSys : aCooSysSeq )
+ Reference< chart2::XChartTypeContainer > xCooSysContainer( rCooSys, uno::UNO_QUERY_THROW );
+ const Sequence< Reference< chart2::XChartType > > aChartTypeSeq( xCooSysContainer->getChartTypes());
+ for( const auto& rChartType : aChartTypeSeq )
{
- Reference< chart2::XChartTypeContainer > xCooSysContainer( rCooSys, uno::UNO_QUERY_THROW );
- const Sequence< Reference< chart2::XChartType > > aChartTypeSeq( xCooSysContainer->getChartTypes());
- for( const auto& rChartType : aChartTypeSeq )
- {
- Reference< chart2::XDataSeriesContainer > xSeriesContainer( rChartType, uno::UNO_QUERY );
- if(!xSeriesContainer.is())
- continue;
- const Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
- std::vector< Reference< chart2::XDataSeries > > aRemainingSeries;
+ Reference< chart2::XDataSeriesContainer > xSeriesContainer( rChartType, uno::UNO_QUERY );
+ if(!xSeriesContainer.is())
+ continue;
+ const Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
+ std::vector< Reference< chart2::XDataSeries > > aRemainingSeries;
- for( const auto& rSeries : aSeriesSeq )
+ for( const auto& rSeries : aSeriesSeq )
+ {
+ Reference< chart2::data::XDataSource > xDataSource( rSeries, uno::UNO_QUERY );
+ if( xDataSource.is() )
{
- Reference< chart2::data::XDataSource > xDataSource( rSeries, uno::UNO_QUERY );
- if( xDataSource.is() )
+ bool bHasUnhiddenColumns = false;
+ OUString aRange;
+ const uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences() );
+ for( const auto& xLabeledSequence : aSequences )
{
- bool bHasUnhiddenColumns = false;
- OUString aRange;
- const uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences() );
- for( const auto& xLabeledSequence : aSequences )
+ if(!xLabeledSequence.is())
+ continue;
+ Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
+ if( xValues.is() )
+ {
+ aRange = xValues->getSourceRangeRepresentation();
+ if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), aRange.toInt32() ) == rTable.aHiddenColumns.end() )
+ bHasUnhiddenColumns = true;
+ }
+ if( !bHasUnhiddenColumns )
{
- if(!xLabeledSequence.is())
- continue;
- Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
- if( xValues.is() )
+ Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
+ if( xLabel.is() )
{
- aRange = xValues->getSourceRangeRepresentation();
- if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), aRange.toInt32() ) == rTable.aHiddenColumns.end() )
+ aRange = xLabel->getSourceRangeRepresentation();
+ const sal_Int32 nId {aRange.getToken(1, ' ').toInt32()};
+ if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), nId ) == rTable.aHiddenColumns.end() )
bHasUnhiddenColumns = true;
}
- if( !bHasUnhiddenColumns )
- {
- Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
- if( xLabel.is() )
- {
- aRange = xLabel->getSourceRangeRepresentation();
- const sal_Int32 nId {aRange.getToken(1, ' ').toInt32()};
- if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), nId ) == rTable.aHiddenColumns.end() )
- bHasUnhiddenColumns = true;
- }
- }
}
- if( bHasUnhiddenColumns )
- aRemainingSeries.push_back( rSeries );
}
+ if( bHasUnhiddenColumns )
+ aRemainingSeries.push_back( rSeries );
}
+ }
- if( static_cast<sal_Int32>(aRemainingSeries.size()) != aSeriesSeq.getLength() )
- {
- //remove the series that have only hidden data
- xSeriesContainer->setDataSeries( comphelper::containerToSequence(aRemainingSeries) );
+ if( static_cast<sal_Int32>(aRemainingSeries.size()) != aSeriesSeq.getLength() )
+ {
+ //remove the series that have only hidden data
+ xSeriesContainer->setDataSeries( comphelper::containerToSequence(aRemainingSeries) );
- //remove unused sequences
- Reference< chart2::data::XDataSource > xDataSource( xChartDoc, uno::UNO_QUERY );
- if( xDataSource.is() )
+ //remove unused sequences
+ Reference< chart2::data::XDataSource > xDataSource( xChartDoc, uno::UNO_QUERY );
+ if( xDataSource.is() )
+ {
+ //first detect which columns are really used
+ std::map< sal_Int32, bool > aUsageMap;
+ OUString aRange;
+ const Sequence< Reference< chart2::data::XLabeledDataSequence > > aUsedSequences( xDataSource->getDataSequences() );
+ for( const auto& xLabeledSequence : aUsedSequences )
{
- //first detect which columns are really used
- std::map< sal_Int32, bool > aUsageMap;
- OUString aRange;
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aUsedSequences( xDataSource->getDataSequences() );
- for( const auto& xLabeledSequence : aUsedSequences )
+ if(!xLabeledSequence.is())
+ continue;
+ Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
+ if( xValues.is() )
{
- if(!xLabeledSequence.is())
- continue;
- Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
- if( xValues.is() )
- {
- aRange = xValues->getSourceRangeRepresentation();
- sal_Int32 nIndex = aRange.toInt32();
- if( nIndex!=0 || aRange != lcl_aCategoriesRange )
- aUsageMap[nIndex] = true;
- }
- Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
- if( xLabel.is() )
- {
- aRange = xLabel->getSourceRangeRepresentation();
- OUString aSecondToken = aRange.getToken(1, ' ');
- if( !aSecondToken.isEmpty() )
- aUsageMap[aSecondToken.toInt32()] = true;
- }
+ aRange = xValues->getSourceRangeRepresentation();
+ sal_Int32 nIndex = aRange.toInt32();
+ if( nIndex!=0 || aRange != lcl_aCategoriesRange )
+ aUsageMap[nIndex] = true;
}
-
- ::std::vector< sal_Int32 > aSequenceIndexesToDelete;
- std::copy_if(rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(),
- std::back_inserter(aSequenceIndexesToDelete),
- [&aUsageMap](sal_Int32 nSequenceIndex) { return aUsageMap.find(nSequenceIndex) == aUsageMap.end(); });
-
- // delete unnecessary sequences of the internal data
- // iterate using greatest index first, so that deletion does not
- // shift other sequences that will be deleted later
- ::std::sort( aSequenceIndexesToDelete.begin(), aSequenceIndexesToDelete.end());
- for( ::std::vector< sal_Int32 >::reverse_iterator aIt(
- aSequenceIndexesToDelete.rbegin()); aIt != aSequenceIndexesToDelete.rend(); ++aIt )
+ Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
+ if( xLabel.is() )
{
- if( *aIt != -1 )
- xInternalDataProvider->deleteSequence( *aIt );
+ aRange = xLabel->getSourceRangeRepresentation();
+ OUString aSecondToken = aRange.getToken(1, ' ');
+ if( !aSecondToken.isEmpty() )
+ aUsageMap[aSecondToken.toInt32()] = true;
}
}
+
+ ::std::vector< sal_Int32 > aSequenceIndexesToDelete;
+ std::copy_if(rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(),
+ std::back_inserter(aSequenceIndexesToDelete),
+ [&aUsageMap](sal_Int32 nSequenceIndex) { return aUsageMap.find(nSequenceIndex) == aUsageMap.end(); });
+
+ // delete unnecessary sequences of the internal data
+ // iterate using greatest index first, so that deletion does not
+ // shift other sequences that will be deleted later
+ ::std::sort( aSequenceIndexesToDelete.begin(), aSequenceIndexesToDelete.end());
+ for( ::std::vector< sal_Int32 >::reverse_iterator aIt(
+ aSequenceIndexesToDelete.rbegin()); aIt != aSequenceIndexesToDelete.rend(); ++aIt )
+ {
+ if( *aIt != -1 )
+ xInternalDataProvider->deleteSequence( *aIt );
+ }
}
}
}
}
- catch( const uno::Exception & )
- {
- }
+ }
+ catch( const uno::Exception & )
+ {
}
}