summaryrefslogtreecommitdiff
path: root/chart2/source/controller
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-01 14:02:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-01 15:00:52 +0200
commit18d4e89fdd63479e20d096c3a578153aa4328aee (patch)
tree005c5a618d702e2d5e333262bdff0c8fe224f64e /chart2/source/controller
parent762aacc4e055fffbc605be81f66f2274dccb4be8 (diff)
loplugin:reducevarscope in canvas,chart2
Change-Id: I6c73e609cc8ce0ed9cf0f5a6b68c6e299bf26a44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103761 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller')
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx2
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx4
-rw-r--r--chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx6
-rw-r--r--chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx4
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx3
5 files changed, 8 insertions, 11 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 6f7ada12cbec..89036649c500 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -699,12 +699,12 @@ OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const
if( m_apDataBrowserModel->getCellType( nColIndex ) == DataBrowserModel::NUMBER )
{
double fData( m_apDataBrowserModel->getCellNumber( nColIndex, nRow ));
- Color nLabelColor;
if( ! std::isnan( fData ) &&
m_spNumberFormatterWrapper )
{
bool bColorChanged = false;
+ Color nLabelColor;
aResult = m_spNumberFormatterWrapper->getFormattedString(
GetNumberFormatKey( nColumnId ),
fData, nLabelColor, bColorChanged );
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 302c56280fa0..9703f9dd398d 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -368,9 +368,9 @@ bool DataPointItemConverter::ApplySpecialItem(
case SCHATTR_DATADESCR_SEPARATOR:
{
OUString aNewValue = static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue();
- OUString aOldValue;
try
{
+ OUString aOldValue;
GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aOldValue;
if( m_bOverwriteLabelsForAttributedDataPointsAlso )
{
@@ -689,9 +689,9 @@ void DataPointItemConverter::FillSpecialItem(
case SCHATTR_DATADESCR_SEPARATOR:
{
- OUString aValue;
try
{
+ OUString aValue;
GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aValue;
rOutItemSet.Put( SfxStringItem( nWhichId, aValue ));
}
diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
index b4c4405ff88b..c0691daf24cf 100644
--- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx
@@ -107,11 +107,10 @@ uno::Reference< beans::XPropertySet > lcl_getEquationProperties(
// ensure that a trendline is on
if( pItemSet )
{
- SvxChartRegress eRegress = SvxChartRegress::NONE;
const SfxPoolItem *pPoolItem = nullptr;
if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem ) == SfxItemState::SET )
{
- eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
+ SvxChartRegress eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
bEquationExists = ( eRegress != SvxChartRegress::NONE );
}
}
@@ -138,11 +137,10 @@ uno::Reference< beans::XPropertySet > lcl_getCurveProperties(
// ensure that a trendline is on
if( pItemSet )
{
- SvxChartRegress eRegress = SvxChartRegress::NONE;
const SfxPoolItem *pPoolItem = nullptr;
if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem ) == SfxItemState::SET )
{
- eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
+ SvxChartRegress eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
bExists = ( eRegress != SvxChartRegress::NONE );
}
}
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index 5fe31b1bcd5f..1ee04136f45c 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -314,9 +314,9 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
case SCHATTR_DATADESCR_SEPARATOR:
{
OUString aNewValue = static_cast<const SfxStringItem&>(rItemSet.Get(nWhichId)).GetValue();
- OUString aOldValue;
try
{
+ OUString aOldValue;
GetPropertySet()->getPropertyValue("LabelSeparator") >>= aOldValue;
if (mbDataSeries)
{
@@ -601,9 +601,9 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
break;
case SCHATTR_DATADESCR_SEPARATOR:
{
- OUString aValue;
try
{
+ OUString aValue;
GetPropertySet()->getPropertyValue("LabelSeparator") >>= aValue;
rOutItemSet.Put(SfxStringItem(nWhichId, aValue));
}
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 1f6230709efb..de1c21af679a 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -459,10 +459,9 @@ void ChartAreaPanel::updateData()
GraphicObject aBitmap = getXBitmapFromName(mxModel, aBitmapName);
XFillBitmapItem aBitmapItem(aBitmapName, aBitmap);
std::unique_ptr<XFillBitmapItem> pBitmapItem;
- DrawModelWrapper* pModelWrapper = nullptr;
try
{
- pModelWrapper = getDrawModelWrapper(mxModel);
+ DrawModelWrapper* pModelWrapper = getDrawModelWrapper(mxModel);
if (pModelWrapper)
{
pBitmapItem = aBitmapItem.checkForUniqueItem(&pModelWrapper->getSdrModel());