diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-21 15:49:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-22 12:15:38 +0100 |
commit | 3fbbd74b7bc6aef4af5f0c4b23a73a6726b9afbf (patch) | |
tree | b3a0df75c42a93645f5342863a7291c871e520eb /svx/source/fmcomp/gridctrl.cxx | |
parent | 4b7490fe49bb93f895e974602a2616fa80b74019 (diff) |
loplugin:flatten in svx
Change-Id: Idc4d0186ecc6f0722c2b1358486a2430f037ae29
Reviewed-on: https://gerrit.libreoffice.org/45036
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/fmcomp/gridctrl.cxx')
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index e688ef251705..b99594b3ee33 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -2980,65 +2980,65 @@ void DbGridControl::Dispatch(sal_uInt16 nId) void DbGridControl::Undo() { - if (!IsFilterMode() && IsValid(m_xCurrentRow) && IsModified()) - { - // check if we have somebody doin' the UNDO for us - int nState = -1; - if (m_aMasterStateProvider.IsSet()) - nState = m_aMasterStateProvider.Call(DbGridControlNavigationBarState::Undo); - if (nState>0) - { // yes, we have, and the slot is enabled - DBG_ASSERT(m_aMasterSlotExecutor.IsSet(), "DbGridControl::Undo : a state, but no execute link ?"); - bool lResult = m_aMasterSlotExecutor.Call(DbGridControlNavigationBarState::Undo); - if (lResult) - // handled - return; - } - else if (nState == 0) - // yes, we have, and the slot is disabled + if (IsFilterMode() || !IsValid(m_xCurrentRow) || !IsModified()) + return; + + // check if we have somebody doin' the UNDO for us + int nState = -1; + if (m_aMasterStateProvider.IsSet()) + nState = m_aMasterStateProvider.Call(DbGridControlNavigationBarState::Undo); + if (nState>0) + { // yes, we have, and the slot is enabled + DBG_ASSERT(m_aMasterSlotExecutor.IsSet(), "DbGridControl::Undo : a state, but no execute link ?"); + bool lResult = m_aMasterSlotExecutor.Call(DbGridControlNavigationBarState::Undo); + if (lResult) + // handled return; + } + else if (nState == 0) + // yes, we have, and the slot is disabled + return; - BeginCursorAction(); + BeginCursorAction(); - bool bAppending = m_xCurrentRow->IsNew(); - bool bDirty = m_xCurrentRow->IsModified(); + bool bAppending = m_xCurrentRow->IsNew(); + bool bDirty = m_xCurrentRow->IsModified(); - try - { - // cancel editing - Reference< XResultSetUpdate > xUpdateCursor(Reference< XInterface >(*m_pDataCursor), UNO_QUERY); - // no effects if we're not updating currently - if (bAppending) - // just refresh the row - xUpdateCursor->moveToInsertRow(); - else - xUpdateCursor->cancelRowUpdates(); + try + { + // cancel editing + Reference< XResultSetUpdate > xUpdateCursor(Reference< XInterface >(*m_pDataCursor), UNO_QUERY); + // no effects if we're not updating currently + if (bAppending) + // just refresh the row + xUpdateCursor->moveToInsertRow(); + else + xUpdateCursor->cancelRowUpdates(); - } - catch(Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } + } + catch(Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } - EndCursorAction(); + EndCursorAction(); - m_xDataRow->SetState(m_pDataCursor, false); - if (m_xPaintRow == m_xCurrentRow) - m_xPaintRow = m_xCurrentRow = m_xDataRow; - else - m_xCurrentRow = m_xDataRow; + m_xDataRow->SetState(m_pDataCursor, false); + if (m_xPaintRow == m_xCurrentRow) + m_xPaintRow = m_xCurrentRow = m_xDataRow; + else + m_xCurrentRow = m_xDataRow; - if (bAppending && (EditBrowseBox::IsModified() || bDirty)) - // remove the row - if (m_nCurrentPos == GetRowCount() - 2) - { // maybe we already removed it (in resetCurrentRow, called if the above moveToInsertRow - // caused our data source form to be reset - which should be the usual case ....) - RowRemoved(GetRowCount() - 1); - m_aBar->InvalidateAll(m_nCurrentPos); - } + if (bAppending && (EditBrowseBox::IsModified() || bDirty)) + // remove the row + if (m_nCurrentPos == GetRowCount() - 2) + { // maybe we already removed it (in resetCurrentRow, called if the above moveToInsertRow + // caused our data source form to be reset - which should be the usual case ....) + RowRemoved(GetRowCount() - 1); + m_aBar->InvalidateAll(m_nCurrentPos); + } - RowModified(m_nCurrentPos); - } + RowModified(m_nCurrentPos); } void DbGridControl::resetCurrentRow() |