summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 15:21:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 17:13:30 +0100
commitf19599c929ac6ae2708b19b9eff62ff70b44ee75 (patch)
tree6ed489ee28db5b89c6f26ddc068197bf0fd94b6d /extensions
parente519d7465f38367205b37bc80f0244029e352306 (diff)
loplugin:flatten in editeng..extensions
Change-Id: Ica8f0a6e3d30dba3b5a083e3c04522073de8303f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127233 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/bibliography/general.cxx32
-rw-r--r--extensions/source/scanner/grid.cxx46
-rw-r--r--extensions/source/scanner/sanedlg.cxx76
3 files changed, 76 insertions, 78 deletions
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 4307d9f206d2..b5447af165ec 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -454,27 +454,25 @@ IMPL_LINK(BibGeneralPage, LastElementKeyInputHdl, const KeyEvent&, rKeyEvent, bo
bool bShift = rKeyEvent.GetKeyCode().IsShift();
bool bCtrl = rKeyEvent.GetKeyCode().IsMod1();
bool bAlt = rKeyEvent.GetKeyCode().IsMod2();
- if (KEY_TAB == nCode && !bShift && !bCtrl && !bAlt)
+ if (KEY_TAB != nCode || bShift || bCtrl || bAlt)
+ return false;
+ SaveChanges();
+ uno::Reference<sdbc::XRowSet> xRowSet(pDatMan->getForm(), UNO_QUERY);
+ if (xRowSet.is())
{
- SaveChanges();
- uno::Reference<sdbc::XRowSet> xRowSet(pDatMan->getForm(), UNO_QUERY);
- if (xRowSet.is())
+ if (xRowSet->isLast())
{
- if (xRowSet->isLast())
- {
- uno::Reference<sdbc::XResultSetUpdate> xUpdateCursor(xRowSet, UNO_QUERY);
- if (xUpdateCursor.is())
- xUpdateCursor->moveToInsertRow();
- }
- else
- (void)xRowSet->next();
+ uno::Reference<sdbc::XResultSetUpdate> xUpdateCursor(xRowSet, UNO_QUERY);
+ if (xUpdateCursor.is())
+ xUpdateCursor->moveToInsertRow();
}
- xIdentifierED->grab_focus();
- xIdentifierED->select_region(0, -1);
- GainFocusHdl(*xIdentifierED);
- return true;
+ else
+ (void)xRowSet->next();
}
- return false;
+ xIdentifierED->grab_focus();
+ xIdentifierED->select_region(0, -1);
+ GainFocusHdl(*xIdentifierED);
+ return true;
}
BibGeneralPage::~BibGeneralPage()
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 85f22fb017e7..110779c55080 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -523,32 +523,32 @@ void GridWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl
bool GridWindow::MouseMove( const MouseEvent& rEvt )
{
- if( rEvt.GetButtons() == MOUSE_LEFT && m_nDragIndex != npos )
- {
- Point aPoint( rEvt.GetPosPixel() );
+ if( rEvt.GetButtons() != MOUSE_LEFT || m_nDragIndex == npos )
+ return false;
- if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1)
- {
- aPoint.setX( m_aHandles[m_nDragIndex].maPos.X() );
- }
- else
- {
- if(aPoint.X() < m_aGridArea.Left())
- aPoint.setX( m_aGridArea.Left() );
- else if(aPoint.X() > m_aGridArea.Right())
- aPoint.setX( m_aGridArea.Right() );
- }
+ Point aPoint( rEvt.GetPosPixel() );
+
+ if( m_nDragIndex == 0 || m_nDragIndex == m_aHandles.size() - 1)
+ {
+ aPoint.setX( m_aHandles[m_nDragIndex].maPos.X() );
+ }
+ else
+ {
+ if(aPoint.X() < m_aGridArea.Left())
+ aPoint.setX( m_aGridArea.Left() );
+ else if(aPoint.X() > m_aGridArea.Right())
+ aPoint.setX( m_aGridArea.Right() );
+ }
- if( aPoint.Y() < m_aGridArea.Top() )
- aPoint.setY( m_aGridArea.Top() );
- else if( aPoint.Y() > m_aGridArea.Bottom() )
- aPoint.setY( m_aGridArea.Bottom() );
+ if( aPoint.Y() < m_aGridArea.Top() )
+ aPoint.setY( m_aGridArea.Top() );
+ else if( aPoint.Y() > m_aGridArea.Bottom() )
+ aPoint.setY( m_aGridArea.Bottom() );
- if( aPoint != m_aHandles[m_nDragIndex].maPos )
- {
- m_aHandles[m_nDragIndex].maPos = aPoint;
- Invalidate( m_aGridArea );
- }
+ if( aPoint != m_aHandles[m_nDragIndex].maPos )
+ {
+ m_aHandles[m_nDragIndex].maPos = aPoint;
+ Invalidate( m_aGridArea );
}
return false;
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index e76575cd9bc9..8486195c93e6 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -1052,46 +1052,46 @@ void SaneDlg::EstablishButtonOption()
bool ScanPreview::MouseMove(const MouseEvent& rMEvt)
{
- if( mbIsDragging )
+ if( !mbIsDragging )
+ return false;
+
+ Point aMousePos = rMEvt.GetPosPixel();
+ // move into valid area
+ Point aLogicPos = GetLogicPos( aMousePos );
+ aMousePos = GetPixelPos( aLogicPos );
+ switch( meDragDirection )
{
- Point aMousePos = rMEvt.GetPosPixel();
- // move into valid area
- Point aLogicPos = GetLogicPos( aMousePos );
- aMousePos = GetPixelPos( aLogicPos );
- switch( meDragDirection )
- {
- case TopLeft: maTopLeft = aMousePos; break;
- case Top: maTopLeft.setY( aMousePos.Y() ); break;
- case TopRight:
- maTopLeft.setY( aMousePos.Y() );
- maBottomRight.setX( aMousePos.X() );
- break;
- case Right: maBottomRight.setX( aMousePos.X() ); break;
- case BottomRight: maBottomRight = aMousePos; break;
- case Bottom: maBottomRight.setY( aMousePos.Y() ); break;
- case BottomLeft:
- maTopLeft.setX( aMousePos.X() );
- maBottomRight.setY( aMousePos.Y() );
- break;
- case Left: maTopLeft.setX( aMousePos.X() ); break;
- default: break;
- }
- int nSwap;
- if( maTopLeft.X() > maBottomRight.X() )
- {
- nSwap = maTopLeft.X();
- maTopLeft.setX( maBottomRight.X() );
- maBottomRight.setX( nSwap );
- }
- if( maTopLeft.Y() > maBottomRight.Y() )
- {
- nSwap = maTopLeft.Y();
- maTopLeft.setY( maBottomRight.Y() );
- maBottomRight.setY( nSwap );
- }
- Invalidate();
- mpParentDialog->UpdateScanArea(false);
+ case TopLeft: maTopLeft = aMousePos; break;
+ case Top: maTopLeft.setY( aMousePos.Y() ); break;
+ case TopRight:
+ maTopLeft.setY( aMousePos.Y() );
+ maBottomRight.setX( aMousePos.X() );
+ break;
+ case Right: maBottomRight.setX( aMousePos.X() ); break;
+ case BottomRight: maBottomRight = aMousePos; break;
+ case Bottom: maBottomRight.setY( aMousePos.Y() ); break;
+ case BottomLeft:
+ maTopLeft.setX( aMousePos.X() );
+ maBottomRight.setY( aMousePos.Y() );
+ break;
+ case Left: maTopLeft.setX( aMousePos.X() ); break;
+ default: break;
+ }
+ int nSwap;
+ if( maTopLeft.X() > maBottomRight.X() )
+ {
+ nSwap = maTopLeft.X();
+ maTopLeft.setX( maBottomRight.X() );
+ maBottomRight.setX( nSwap );
+ }
+ if( maTopLeft.Y() > maBottomRight.Y() )
+ {
+ nSwap = maTopLeft.Y();
+ maTopLeft.setY( maBottomRight.Y() );
+ maBottomRight.setY( nSwap );
}
+ Invalidate();
+ mpParentDialog->UpdateScanArea(false);
return false;
}