[PATCH libreoffice-4-0-2] error bar range is also part of chart range, related fdo#521...
Markus Mohrhard (via Code Review)
gerrit at gerrit.libreoffice.org
Mon Mar 25 02:52:38 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2984
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/84/2984/1
error bar range is also part of chart range, related fdo#52159
Change-Id: I344448db559de8435dcc26e2be4597c385724a7b
(cherry picked from commit e15d8ef44fbf9fc23da58648e4d288782a81c7c1)
Reviewed-on: https://gerrit.libreoffice.org/2820
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
(cherry picked from commit 875a8fb01238e998fc6e64fbf7a4e51c18973e61)
---
M sc/source/ui/view/drawvie4.cxx
1 file changed, 70 insertions(+), 17 deletions(-)
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index ceebfbd..adf45ee 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -46,6 +46,9 @@
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/XComponentSupplier.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
using namespace com::sun::star;
@@ -151,6 +154,70 @@
namespace {
+void getRangeFromDataSource( uno::Reference< chart2::data::XDataSource > xDataSource, std::vector<OUString>& rRangeRep)
+{
+ uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence> > xSeqs = xDataSource->getDataSequences();
+ for (sal_Int32 i = 0, n = xSeqs.getLength(); i < n; ++i)
+ {
+ uno::Reference<chart2::data::XLabeledDataSequence> xLS = xSeqs[i];
+ uno::Reference<chart2::data::XDataSequence> xSeq = xLS->getValues();
+ if (xSeq.is())
+ {
+ OUString aRep = xSeq->getSourceRangeRepresentation();
+ rRangeRep.push_back(aRep);
+ }
+ xSeq = xLS->getLabel();
+ if (xSeq.is())
+ {
+ OUString aRep = xSeq->getSourceRangeRepresentation();
+ rRangeRep.push_back(aRep);
+ }
+ }
+}
+
+
+void getRangeFromErrorBar(const uno::Reference< chart2::XChartDocument > xChartDoc, std::vector<OUString>& rRangeRep)
+{
+ uno::Reference <chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+ if(!xDiagram.is())
+ return;
+
+ uno::Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY);
+ if(!xCooSysContainer.is())
+ return;
+
+ uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
+ for(sal_Int32 i = 0; i < xCooSysSequence.getLength(); ++i)
+ {
+ uno::Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[i], uno::UNO_QUERY);
+ if(!xChartTypeContainer.is())
+ continue;
+
+ uno::Sequence< uno::Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
+ for(sal_Int32 nChartType = 0; nChartType < xChartTypeSequence.getLength(); ++nChartType)
+ {
+ uno::Reference< chart2::XDataSeriesContainer > xDataSequenceContainer( xChartTypeSequence[nChartType], uno::UNO_QUERY);
+ if(!xDataSequenceContainer.is())
+ continue;
+
+ uno::Sequence< uno::Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() );
+ for(sal_Int32 nDataSeries = 0; nDataSeries < xSeriesSequence.getLength(); ++nDataSeries)
+ {
+ uno::Reference< chart2::XDataSeries > xSeries = xSeriesSequence[nDataSeries];
+ uno::Reference< beans::XPropertySet > xPropSet( xSeries, uno::UNO_QUERY);
+ uno::Reference< chart2::data::XDataSource > xErrorBarY;
+ xPropSet->getPropertyValue("ErrorBarY") >>= xErrorBarY;
+ if(xErrorBarY.is())
+ getRangeFromDataSource(xErrorBarY, rRangeRep);
+ uno::Reference< chart2::data::XDataSource > xErrorBarX;
+ xPropSet->getPropertyValue("ErrorBarX") >>= xErrorBarX;
+ if(xErrorBarX.is())
+ getRangeFromDataSource(xErrorBarX, rRangeRep);
+ }
+ }
+ }
+}
+
void getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector<OUString>& rRangeRep)
{
if (!rObj.IsChart())
@@ -172,28 +239,14 @@
if(xChartDoc->hasInternalDataProvider())
return;
+ getRangeFromErrorBar(xChartDoc, rRangeRep);
+
uno::Reference<chart2::data::XDataSource> xDataSource(xChartDoc, uno::UNO_QUERY);
if (!xDataSource.is())
return;
// Get all data sources used in this chart.
- uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence> > xSeqs = xDataSource->getDataSequences();
- for (sal_Int32 i = 0, n = xSeqs.getLength(); i < n; ++i)
- {
- uno::Reference<chart2::data::XLabeledDataSequence> xLS = xSeqs[i];
- uno::Reference<chart2::data::XDataSequence> xSeq = xLS->getValues();
- if (xSeq.is())
- {
- OUString aRep = xSeq->getSourceRangeRepresentation();
- rRangeRep.push_back(aRep);
- }
- xSeq = xLS->getLabel();
- if (xSeq.is())
- {
- OUString aRep = xSeq->getSourceRangeRepresentation();
- rRangeRep.push_back(aRep);
- }
- }
+ getRangeFromDataSource(xDataSource, rRangeRep);
}
/**
--
To view, visit https://gerrit.libreoffice.org/2984
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I344448db559de8435dcc26e2be4597c385724a7b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0-2
Gerrit-Owner: Markus Mohrhard <markus.mohrhard at googlemail.com>
Gerrit-Reviewer: Fridrich Strba <fridrich at documentfoundation.org>
More information about the LibreOffice
mailing list