summaryrefslogtreecommitdiff
path: root/svtools/source/hatchwindow
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-22 11:26:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-22 11:54:12 +0100
commit1ae61b0ac4187b2938647f3ca0289a070a5dc7d2 (patch)
tree9461c0532919f4fe61f3e0e3fa8556e954244fbd /svtools/source/hatchwindow
parent04bb9549e0a0ee567f3bd48a7707286c5abd631a (diff)
loplugin:flatten in svtools
almost completely automatically rewritten, only had to tweak the indentation on a couple of lines. Change-Id: Ieec92e5b602d180d7ec556e3421ce3c835c1f646 Reviewed-on: https://gerrit.libreoffice.org/45072 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source/hatchwindow')
-rw-r--r--svtools/source/hatchwindow/documentcloser.cxx68
-rw-r--r--svtools/source/hatchwindow/hatchwindow.cxx22
-rw-r--r--svtools/source/hatchwindow/ipwin.cxx75
3 files changed, 83 insertions, 82 deletions
diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx
index f911712b1cd5..cbe95f7bcdc6 100644
--- a/svtools/source/hatchwindow/documentcloser.cxx
+++ b/svtools/source/hatchwindow/documentcloser.cxx
@@ -101,45 +101,45 @@ void MainThreadFrameCloserRequest::Start( MainThreadFrameCloserRequest* pMTReque
IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, void*, p, void )
{
MainThreadFrameCloserRequest* pMTRequest = static_cast<MainThreadFrameCloserRequest*>(p);
- if ( pMTRequest )
+ if ( !pMTRequest )
+ return;
+
+ if ( pMTRequest->m_xFrame.is() )
{
- if ( pMTRequest->m_xFrame.is() )
+ // this is the main thread, the solar mutex must be locked
+ SolarMutexGuard aGuard;
+
+ try
{
- // this is the main thread, the solar mutex must be locked
- SolarMutexGuard aGuard;
-
- try
- {
- uno::Reference< awt::XWindow > xWindow = pMTRequest->m_xFrame->getContainerWindow();
- uno::Reference< awt::XVclWindowPeer > xWinPeer( xWindow, uno::UNO_QUERY_THROW );
-
- xWindow->setVisible( false );
-
- // reparent the window
- xWinPeer->setProperty( "PluginParent", uno::makeAny( (sal_Int64) 0 ) );
-
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow )
- Dialog::EndAllDialogs( pWindow );
- }
- catch( uno::Exception& )
- {
- // ignore all the errors
- }
-
- try
- {
- uno::Reference< util::XCloseable > xCloseable( pMTRequest->m_xFrame, uno::UNO_QUERY_THROW );
- xCloseable->close( true );
- }
- catch( uno::Exception& )
- {
- // ignore all the errors
- }
+ uno::Reference< awt::XWindow > xWindow = pMTRequest->m_xFrame->getContainerWindow();
+ uno::Reference< awt::XVclWindowPeer > xWinPeer( xWindow, uno::UNO_QUERY_THROW );
+
+ xWindow->setVisible( false );
+
+ // reparent the window
+ xWinPeer->setProperty( "PluginParent", uno::makeAny( (sal_Int64) 0 ) );
+
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow )
+ Dialog::EndAllDialogs( pWindow );
+ }
+ catch( uno::Exception& )
+ {
+ // ignore all the errors
}
- delete pMTRequest;
+ try
+ {
+ uno::Reference< util::XCloseable > xCloseable( pMTRequest->m_xFrame, uno::UNO_QUERY_THROW );
+ xCloseable->close( true );
+ }
+ catch( uno::Exception& )
+ {
+ // ignore all the errors
+ }
}
+
+ delete pMTRequest;
}
ODocumentCloser::ODocumentCloser(const css::uno::Sequence< css::uno::Any >& aArguments)
diff --git a/svtools/source/hatchwindow/hatchwindow.cxx b/svtools/source/hatchwindow/hatchwindow.cxx
index 4c0a9819ede6..0e8b4b964182 100644
--- a/svtools/source/hatchwindow/hatchwindow.cxx
+++ b/svtools/source/hatchwindow/hatchwindow.cxx
@@ -69,18 +69,18 @@ void VCLXHatchWindow::initializeWindow( const uno::Reference< awt::XWindowPeer >
void VCLXHatchWindow::QueryObjAreaPixel( tools::Rectangle & aRect )
{
- if ( m_xController.is() )
- {
- awt::Rectangle aUnoRequestRect = AWTRectangle( aRect );
+ if ( !m_xController.is() )
+ return;
- try {
- awt::Rectangle aUnoResultRect = m_xController->calcAdjustedRectangle( aUnoRequestRect );
- aRect = VCLRectangle( aUnoResultRect );
- }
- catch( uno::Exception& )
- {
- OSL_FAIL( "Can't adjust rectangle size!" );
- }
+ awt::Rectangle aUnoRequestRect = AWTRectangle( aRect );
+
+ try {
+ awt::Rectangle aUnoResultRect = m_xController->calcAdjustedRectangle( aUnoRequestRect );
+ aRect = VCLRectangle( aUnoResultRect );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_FAIL( "Can't adjust rectangle size!" );
}
}
diff --git a/svtools/source/hatchwindow/ipwin.cxx b/svtools/source/hatchwindow/ipwin.cxx
index af5d75cfaba5..071e47c7f4c0 100644
--- a/svtools/source/hatchwindow/ipwin.cxx
+++ b/svtools/source/hatchwindow/ipwin.cxx
@@ -463,31 +463,32 @@ void SvResizeWindow::SelectMouse( const Point & rPos )
short nGrab = m_aResizer.SelectMove( this, rPos );
if( nGrab >= 4 )
nGrab -= 4;
- if( m_nMoveGrab != nGrab )
- { // Pointer did change
- if( -1 == nGrab )
- SetPointer( m_aOldPointer );
- else
+ if( m_nMoveGrab == nGrab )
+ return;
+
+ // Pointer did change
+ if( -1 == nGrab )
+ SetPointer( m_aOldPointer );
+ else
+ {
+ PointerStyle aStyle = PointerStyle::Move;
+ if( nGrab == 3 )
+ aStyle = PointerStyle::ESize;
+ else if( nGrab == 2 )
+ aStyle = PointerStyle::NESize;
+ else if( nGrab == 1 )
+ aStyle = PointerStyle::SSize;
+ else if( nGrab == 0 )
+ aStyle = PointerStyle::SESize;
+ if( m_nMoveGrab == -1 ) // the first time
{
- PointerStyle aStyle = PointerStyle::Move;
- if( nGrab == 3 )
- aStyle = PointerStyle::ESize;
- else if( nGrab == 2 )
- aStyle = PointerStyle::NESize;
- else if( nGrab == 1 )
- aStyle = PointerStyle::SSize;
- else if( nGrab == 0 )
- aStyle = PointerStyle::SESize;
- if( m_nMoveGrab == -1 ) // the first time
- {
- m_aOldPointer = GetPointer();
- SetPointer( Pointer( aStyle ) );
- }
- else
- SetPointer( Pointer( aStyle ) );
+ m_aOldPointer = GetPointer();
+ SetPointer( Pointer( aStyle ) );
}
- m_nMoveGrab = nGrab;
+ else
+ SetPointer( Pointer( aStyle ) );
}
+ m_nMoveGrab = nGrab;
}
/*************************************************************************
@@ -532,23 +533,23 @@ void SvResizeWindow::MouseMove( const MouseEvent & rEvt )
*************************************************************************/
void SvResizeWindow::MouseButtonUp( const MouseEvent & rEvt )
{
- if( m_aResizer.GetGrab() != -1 )
- {
- tools::Rectangle aRect( m_aResizer.GetTrackRectPixel( rEvt.GetPosPixel() ) );
- Point aDiff = GetPosPixel();
- aRect.SetPos( aRect.TopLeft() + aDiff );
- // aRect -= GetAllBorderPixel();
- m_aResizer.ValidateRect( aRect );
+ if( m_aResizer.GetGrab() == -1 )
+ return;
- m_pWrapper->QueryObjAreaPixel( aRect );
+ tools::Rectangle aRect( m_aResizer.GetTrackRectPixel( rEvt.GetPosPixel() ) );
+ Point aDiff = GetPosPixel();
+ aRect.SetPos( aRect.TopLeft() + aDiff );
+ // aRect -= GetAllBorderPixel();
+ m_aResizer.ValidateRect( aRect );
- tools::Rectangle aOutRect;
- if( m_aResizer.SelectRelease( this, rEvt.GetPosPixel(), aOutRect ) )
- {
- m_nMoveGrab = -1;
- SetPointer( m_aOldPointer );
- m_pWrapper->RequestObjAreaPixel( aRect );
- }
+ m_pWrapper->QueryObjAreaPixel( aRect );
+
+ tools::Rectangle aOutRect;
+ if( m_aResizer.SelectRelease( this, rEvt.GetPosPixel(), aOutRect ) )
+ {
+ m_nMoveGrab = -1;
+ SetPointer( m_aOldPointer );
+ m_pWrapper->RequestObjAreaPixel( aRect );
}
}