summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-07-03 11:31:14 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-07-06 07:04:50 +0000
commite9c3583c2cc27fc88ee81047c236ec99dd51e8de (patch)
treeb3e8394ca1ec402a31b227339366fc790124c1f8 /oox
parent89c77994d4638c86635c70535fab6508e2f3d900 (diff)
improve the returnbyref loplugin
Change-Id: I1b510a6194282dfa4a9001d473127c5ebc8b44eb Reviewed-on: https://gerrit.libreoffice.org/16731 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/chart/converterbase.hxx2
-rw-r--r--oox/source/drawingml/chart/chartspaceconverter.cxx5
-rw-r--r--oox/source/drawingml/chart/converterbase.cxx4
-rw-r--r--oox/source/drawingml/chart/datasourceconverter.cxx53
4 files changed, 29 insertions, 35 deletions
diff --git a/oox/inc/drawingml/chart/converterbase.hxx b/oox/inc/drawingml/chart/converterbase.hxx
index bf3f7b5a303e..52a7072e2ad1 100644
--- a/oox/inc/drawingml/chart/converterbase.hxx
+++ b/oox/inc/drawingml/chart/converterbase.hxx
@@ -76,7 +76,7 @@ protected:
/** Returns the filter object of the imported/exported document. */
::oox::core::XmlFilterBase& getFilter() const;
/** Returns the chart converter. */
- ChartConverter* getChartConverter() const;
+ ChartConverter& getChartConverter() const;
/** Returns the API chart document model. */
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
getChartDocument() const;
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index b841954513db..758ad647751d 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -67,12 +67,9 @@ ChartSpaceConverter::~ChartSpaceConverter()
void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExternalPage, const awt::Point& rChartPos )
{
- if( !getChartConverter() )
- return;
-
/* create data provider (virtual function in the ChartConverter class,
derived converters may create an external data provider) */
- getChartConverter()->createDataProvider( getChartDocument() );
+ getChartConverter().createDataProvider( getChartDocument() );
// formatting of the chart background. The default fill style varies with applications.
PropertySet aBackPropSet( getChartDocument()->getPageBackground() );
diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx
index 022d8675499d..73fd81865665 100644
--- a/oox/source/drawingml/chart/converterbase.cxx
+++ b/oox/source/drawingml/chart/converterbase.cxx
@@ -239,9 +239,9 @@ XmlFilterBase& ConverterRoot::getFilter() const
return mxData->mrFilter;
}
-ChartConverter* ConverterRoot::getChartConverter() const
+ChartConverter& ConverterRoot::getChartConverter() const
{
- return &mxData->mrConverter;
+ return mxData->mrConverter;
}
Reference< XChartDocument > ConverterRoot::getChartDocument() const
diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx
index 8b1725f4dea5..2c3dbcf7b1fb 100644
--- a/oox/source/drawingml/chart/datasourceconverter.cxx
+++ b/oox/source/drawingml/chart/datasourceconverter.cxx
@@ -44,42 +44,39 @@ Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUSt
{
// create data sequence from data source model (virtual call at chart converter)
Reference< XDataSequence > xDataSeq;
- if( getChartConverter() )
+ // the internal data table does not support complex labels
+ // this is only supported in Calc!!!
+ // merge the labels into a single one
+ if(rRole == "label")
{
- // the internal data table does not support complex labels
- // this is only supported in Calc!!!
- // merge the labels into a single one
- if(rRole == "label")
+ mrModel.mnPointCount = std::min<sal_Int32>(mrModel.mnPointCount, 1);
+ OUStringBuffer aTitle;
+ bool bFirst = true;
+ for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(),
+ itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr)
{
- mrModel.mnPointCount = std::min<sal_Int32>(mrModel.mnPointCount, 1);
- OUStringBuffer aTitle;
- bool bFirst = true;
- for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(),
- itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr)
+ Any aAny = itr->second;
+ if(aAny.has<OUString>())
{
- Any aAny = itr->second;
- if(aAny.has<OUString>())
- {
- if(!bFirst)
- aTitle.append(" ");
+ if(!bFirst)
+ aTitle.append(" ");
- aTitle.append(aAny.get<OUString>());
- bFirst = false;
- }
- }
-
- if(!bFirst)
- {
- mrModel.maData.clear();
- mrModel.maData.insert(std::make_pair<sal_Int32, Any>(1, Any(aTitle.makeStringAndClear())));
+ aTitle.append(aAny.get<OUString>());
+ bFirst = false;
}
}
- xDataSeq = getChartConverter()->createDataSequence(getChartDocument()->getDataProvider(), mrModel, rRole);
- // set sequence role
- PropertySet aSeqProp( xDataSeq );
- aSeqProp.setProperty( PROP_Role, rRole );
+ if(!bFirst)
+ {
+ mrModel.maData.clear();
+ mrModel.maData.insert(std::make_pair<sal_Int32, Any>(1, Any(aTitle.makeStringAndClear())));
+ }
}
+ xDataSeq = getChartConverter().createDataSequence(getChartDocument()->getDataProvider(), mrModel, rRole);
+
+ // set sequence role
+ PropertySet aSeqProp( xDataSeq );
+ aSeqProp.setProperty( PROP_Role, rRole );
return xDataSeq;
}