Kaydet (Commit) 6d157312 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in chart2 *ItemConverter

Change-Id: I83da56774b37b1c9c6abc4d6b1e7624db3f66de4
Reviewed-on: https://gerrit.libreoffice.org/55696Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7f19b2fa
......@@ -68,7 +68,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private:
std::vector< ItemConverter * > m_aConverters;
std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
bool m_bDataSeries;
bool m_bOverwriteLabelsForAttributedDataPointsAlso;
bool m_bUseSpecialFillColor;
......
......@@ -55,7 +55,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private:
std::vector< ItemConverter * > m_aConverters;
std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
};
} // namespace wrapper
......
......@@ -41,7 +41,7 @@ public:
protected:
MultipleItemConverter( SfxItemPool& rItemPool );
std::vector< ItemConverter * > m_aConverters;
std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
};
}}
......
......@@ -55,7 +55,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private:
std::vector< ItemConverter * > m_aConverters;
std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
};
}}
......
......@@ -55,7 +55,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private:
std::vector<ItemConverter*> maConverters;
std::vector<std::unique_ptr<ItemConverter>> maConverters;
sal_Int32 mnNumberFormat;
sal_Int32 mnPercentNumberFormat;
css::uno::Sequence<sal_Int32> maAvailableLabelPlacements;
......
......@@ -51,7 +51,7 @@ protected:
virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override;
private:
std::vector< ItemConverter * > m_aConverters;
std::vector< std::unique_ptr<ItemConverter> > m_aConverters;
};
}}
......
......@@ -215,13 +215,13 @@ DataPointItemConverter::DataPointItemConverter(
m_aAvailableLabelPlacements(),
m_bForbidPercentValue(true)
{
m_aConverters.push_back( new GraphicPropertyItemConverter(
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
m_aConverters.push_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
m_aConverters.emplace_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
if( bDataSeries )
{
m_aConverters.push_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
m_aConverters.push_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
m_aConverters.emplace_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
m_aConverters.emplace_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
}
uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
......@@ -236,7 +236,6 @@ DataPointItemConverter::DataPointItemConverter(
DataPointItemConverter::~DataPointItemConverter()
{
std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
}
void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
......@@ -49,17 +49,16 @@ LegendItemConverter::LegendItemConverter(
const awt::Size* pRefSize ) :
ItemConverter( rPropertySet, rItemPool )
{
m_aConverters.push_back( new GraphicPropertyItemConverter(
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
GraphicObjectType::LineAndFillProperties ));
m_aConverters.push_back( new CharacterPropertyItemConverter(
m_aConverters.emplace_back( new CharacterPropertyItemConverter(
rPropertySet, rItemPool, pRefSize,
"ReferencePageSize" ));
}
LegendItemConverter::~LegendItemConverter()
{
std::for_each( m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
}
void LegendItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
......@@ -51,7 +51,7 @@ AllAxisItemConverter::AllAxisItemConverter(
for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
{
uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY);
m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter(
m_aConverters.emplace_back( new ::chart::wrapper::AxisItemConverter(
xObjectProperties, rItemPool, rDrawModel,
uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), nullptr, nullptr,
pRefSize));
......@@ -80,7 +80,7 @@ AllGridItemConverter::AllGridItemConverter(
for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
{
Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]);
m_aConverters.push_back( new ::chart::wrapper::GraphicPropertyItemConverter(
m_aConverters.emplace_back( new ::chart::wrapper::GraphicPropertyItemConverter(
xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
::chart::wrapper::GraphicObjectType::LineProperties ) );
}
......@@ -115,7 +115,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter(
sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
m_aConverters.push_back(
m_aConverters.emplace_back(
new ::chart::wrapper::DataPointItemConverter(
xChartModel, xContext, xObjectProperties, series, rItemPool, rDrawModel,
xNamedPropertyContainerFactory, GraphicObjectType::FilledDataPoint,
......@@ -146,7 +146,7 @@ AllTitleItemConverter::AllTitleItemConverter(
if(!xTitle.is())
continue;
uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY);
m_aConverters.push_back(
m_aConverters.emplace_back(
new ::chart::wrapper::TitleItemConverter(
xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, nullptr));
}
......@@ -173,7 +173,7 @@ AllSeriesStatisticsConverter::AllSeriesStatisticsConverter(
for (auto const& series : aSeriesList)
{
uno::Reference< beans::XPropertySet > xObjectProperties(series, uno::UNO_QUERY);
m_aConverters.push_back( new ::chart::wrapper::StatisticsItemConverter(
m_aConverters.emplace_back( new ::chart::wrapper::StatisticsItemConverter(
xChartModel, xObjectProperties, rItemPool ));
}
}
......
......@@ -33,13 +33,12 @@ MultipleItemConverter::MultipleItemConverter( SfxItemPool& rItemPool )
}
MultipleItemConverter::~MultipleItemConverter()
{
std::for_each( m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
}
void MultipleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
{
std::vector< ItemConverter* >::const_iterator aIter = m_aConverters.begin();
const std::vector< ItemConverter* >::const_iterator aEnd = m_aConverters.end();
auto aIter = m_aConverters.begin();
auto aEnd = m_aConverters.end();
if( aIter != aEnd )
{
(*aIter)->FillItemSet( rOutItemSet );
......
......@@ -55,18 +55,17 @@ RegressionEquationItemConverter::RegressionEquationItemConverter(
const awt::Size* pRefSize ) :
ItemConverter( rPropertySet, rItemPool )
{
m_aConverters.push_back( new GraphicPropertyItemConverter(
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel,
xNamedPropertyContainerFactory,
GraphicObjectType::LineAndFillProperties ));
m_aConverters.push_back(
m_aConverters.emplace_back(
new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
}
RegressionEquationItemConverter::~RegressionEquationItemConverter()
{
std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
}
void RegressionEquationItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
......@@ -194,7 +194,7 @@ TextLabelItemConverter::TextLabelItemConverter(
mbDataSeries(bDataSeries),
mbForbidPercentValue(true)
{
maConverters.push_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
maConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
uno::Reference<XDiagram> xDiagram(ChartModelHelper::findDiagram(xChartModel));
uno::Reference<XChartType> xChartType(DiagramHelper::getChartTypeOfSeries(xDiagram, xSeries));
......@@ -208,7 +208,6 @@ TextLabelItemConverter::TextLabelItemConverter(
TextLabelItemConverter::~TextLabelItemConverter()
{
std::for_each(maConverters.begin(), maConverters.end(), std::default_delete<ItemConverter>());
}
void TextLabelItemConverter::FillItemSet( SfxItemSet& rOutItemSet ) const
......
......@@ -74,11 +74,11 @@ FormattedStringsConverter::FormattedStringsConverter(
if( xProp.is())
{
if( bHasRefSize )
m_aConverters.push_back(
m_aConverters.emplace_back(
new CharacterPropertyItemConverter(
xProp, rItemPool, pRefSize, "ReferencePageSize", xParentProp));
else
m_aConverters.push_back( new CharacterPropertyItemConverter( xProp, rItemPool ));
m_aConverters.emplace_back( new CharacterPropertyItemConverter( xProp, rItemPool ));
}
}
}
......@@ -96,7 +96,7 @@ TitleItemConverter::TitleItemConverter(
const awt::Size* pRefSize ) :
ItemConverter( rPropertySet, rItemPool )
{
m_aConverters.push_back( new GraphicPropertyItemConverter(
m_aConverters.emplace_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel,
xNamedPropertyContainerFactory,
GraphicObjectType::LineAndFillProperties ));
......@@ -109,7 +109,7 @@ TitleItemConverter::TitleItemConverter(
uno::Sequence< uno::Reference< chart2::XFormattedString > > aStringSeq( xTitle->getText());
if( aStringSeq.getLength() > 0 )
{
m_aConverters.push_back(
m_aConverters.emplace_back(
new FormattedStringsConverter( aStringSeq, rItemPool, pRefSize, rPropertySet ));
}
}
......@@ -117,7 +117,6 @@ TitleItemConverter::TitleItemConverter(
TitleItemConverter::~TitleItemConverter()
{
std::for_each(m_aConverters.begin(), m_aConverters.end(), std::default_delete<ItemConverter>());
}
void TitleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment