summaryrefslogtreecommitdiff
path: root/chart2/source/controller/dialogs/tp_DataSource.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 14:08:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-19 11:01:18 +0200
commit9df2821e61979dab32390d5c64dd49bee868adbb (patch)
tree5b827e29e73ac2300c164b0a389a784a358956e6 /chart2/source/controller/dialogs/tp_DataSource.cxx
parent8b0a69498b025e13d9772689e9e4fa3d6b05e609 (diff)
loplugin:flatten in chart2
Change-Id: Iadc4da6515a7d82e7a92b33d74d589b61fa2c64f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92480 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller/dialogs/tp_DataSource.cxx')
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx126
1 files changed, 63 insertions, 63 deletions
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index b4cad889bb7e..eb22751a0ec3 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -390,32 +390,32 @@ void DataSourceTabPage::fillRoleListBox()
bool bHasSelectedEntry = (pSeriesEntry != nullptr);
int nRoleIndex = m_xLB_ROLE->get_selected_index();
- if (bHasSelectedEntry)
- {
- DialogModel::tRolesWithRanges aRoles(
- DialogModel::getRolesWithRanges(
- pSeriesEntry->m_xDataSeries,
- lcl_GetSequenceNameForLabel( pSeriesEntry ),
- pSeriesEntry->m_xChartType ));
+ if (!bHasSelectedEntry)
+ return;
- // fill role list
- m_xLB_ROLE->freeze();
- m_xLB_ROLE->clear();
+ DialogModel::tRolesWithRanges aRoles(
+ DialogModel::getRolesWithRanges(
+ pSeriesEntry->m_xDataSeries,
+ lcl_GetSequenceNameForLabel( pSeriesEntry ),
+ pSeriesEntry->m_xChartType ));
- for (auto const& elemRole : aRoles)
- {
- InsertRoleLBEntry(elemRole.first, elemRole.second);
- }
+ // fill role list
+ m_xLB_ROLE->freeze();
+ m_xLB_ROLE->clear();
- m_xLB_ROLE->thaw();
+ for (auto const& elemRole : aRoles)
+ {
+ InsertRoleLBEntry(elemRole.first, elemRole.second);
+ }
- // series may contain no roles, check listbox size before selecting entries
- if (m_xLB_ROLE->n_children() > 0)
- {
- if (nRoleIndex == -1 || nRoleIndex >= m_xLB_ROLE->n_children())
- nRoleIndex = 0;
- m_xLB_ROLE->select(nRoleIndex);
- }
+ m_xLB_ROLE->thaw();
+
+ // series may contain no roles, check listbox size before selecting entries
+ if (m_xLB_ROLE->n_children() > 0)
+ {
+ if (nRoleIndex == -1 || nRoleIndex >= m_xLB_ROLE->n_children())
+ nRoleIndex = 0;
+ m_xLB_ROLE->select(nRoleIndex);
}
}
@@ -475,24 +475,24 @@ IMPL_LINK_NOARG(DataSourceTabPage, RoleSelectionChangedHdl, weld::TreeView&, voi
{
m_rDialogModel.startControllerLockTimer();
int nEntry = m_xLB_ROLE->get_selected_index();
- if (nEntry != -1)
- {
- OUString aSelectedRoleUI = lcl_GetSelectedRole( *m_xLB_ROLE, true );
- OUString aSelectedRange = lcl_GetSelectedRolesRange( *m_xLB_ROLE );
+ if (nEntry == -1)
+ return;
- // replace role in fixed text label
- const OUString aReplacementStr( "%VALUETYPE" );
- sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
- if( nIndex != -1 )
- {
- m_xFT_RANGE->set_label(
- m_aFixedTextRange.replaceAt(
- nIndex, aReplacementStr.getLength(), aSelectedRoleUI ));
- }
+ OUString aSelectedRoleUI = lcl_GetSelectedRole( *m_xLB_ROLE, true );
+ OUString aSelectedRange = lcl_GetSelectedRolesRange( *m_xLB_ROLE );
- m_xEDT_RANGE->set_text(aSelectedRange);
- isValid();
+ // replace role in fixed text label
+ const OUString aReplacementStr( "%VALUETYPE" );
+ sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
+ if( nIndex != -1 )
+ {
+ m_xFT_RANGE->set_label(
+ m_aFixedTextRange.replaceAt(
+ nIndex, aReplacementStr.getLength(), aSelectedRoleUI ));
}
+
+ m_xEDT_RANGE->set_text(aSelectedRange);
+ isValid();
}
IMPL_LINK_NOARG(DataSourceTabPage, MainRangeButtonClickedHdl, weld::Button&, void)
@@ -594,39 +594,39 @@ IMPL_LINK_NOARG(DataSourceTabPage, RemoveButtonClickedHdl, weld::Button&, void)
{
m_rDialogModel.startControllerLockTimer();
int nEntry = m_xLB_SERIES->get_selected_index();
- if (nEntry != -1)
- {
- SeriesEntry* pEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
- Reference< XDataSeries > xNewSelSeries;
- SeriesEntry * pNewSelEntry = nullptr;
- if (nEntry + 1 < m_xLB_SERIES->n_children())
- pNewSelEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry + 1).toInt64());
- else if (nEntry > 0)
- pNewSelEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry - 1).toInt64());
- if (pNewSelEntry)
- xNewSelSeries.set(pNewSelEntry->m_xDataSeries);
-
- m_rDialogModel.deleteSeries( pEntry->m_xDataSeries, pEntry->m_xChartType );
- setDirty();
+ if (nEntry == -1)
+ return;
- m_xLB_SERIES->remove(nEntry);
- fillSeriesListBox();
+ SeriesEntry* pEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+ Reference< XDataSeries > xNewSelSeries;
+ SeriesEntry * pNewSelEntry = nullptr;
+ if (nEntry + 1 < m_xLB_SERIES->n_children())
+ pNewSelEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry + 1).toInt64());
+ else if (nEntry > 0)
+ pNewSelEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry - 1).toInt64());
+ if (pNewSelEntry)
+ xNewSelSeries.set(pNewSelEntry->m_xDataSeries);
+
+ m_rDialogModel.deleteSeries( pEntry->m_xDataSeries, pEntry->m_xChartType );
+ setDirty();
+
+ m_xLB_SERIES->remove(nEntry);
+ fillSeriesListBox();
- // select previous or next series
- if (xNewSelSeries.is())
+ // select previous or next series
+ if (xNewSelSeries.is())
+ {
+ for (int i = 0; i < m_xLB_SERIES->n_children(); ++i)
{
- for (int i = 0; i < m_xLB_SERIES->n_children(); ++i)
+ pEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(i).toInt64());
+ if (pEntry->m_xDataSeries == xNewSelSeries)
{
- pEntry = reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(i).toInt64());
- if (pEntry->m_xDataSeries == xNewSelSeries)
- {
- m_xLB_SERIES->select(i);
- break;
- }
+ m_xLB_SERIES->select(i);
+ break;
}
}
- SeriesSelectionChangedHdl(*m_xLB_SERIES);
}
+ SeriesSelectionChangedHdl(*m_xLB_SERIES);
}
IMPL_LINK_NOARG(DataSourceTabPage, UpButtonClickedHdl, weld::Button&, void)