From 5e69b3619d3a2b05930c5b8b8521d7f2938c709d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 17 Nov 2017 11:18:40 +0200 Subject: loplugin:flatten in toolkit..writerfilter Change-Id: I4da2a768b6b55869c3a3d6f8a8d50dc018709acd Reviewed-on: https://gerrit.libreoffice.org/44865 Tested-by: Jenkins Reviewed-by: Noel Grandin --- toolkit/source/controls/dialogcontrol.cxx | 100 +++++++++++++++--------------- 1 file changed, 51 insertions(+), 49 deletions(-) (limited to 'toolkit/source/controls/dialogcontrol.cxx') diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 2a27b237ee57..8ca31adf47d3 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -488,65 +488,67 @@ void SAL_CALL UnoDialogControl::windowResized( const css::awt::WindowEvent& e ) { OutputDevice*pOutDev = Application::GetDefaultDevice(); DBG_ASSERT( pOutDev, "Missing Default Device!" ); - if ( pOutDev && !mbSizeModified ) - { - // Currentley we are simply using MapUnit::MapAppFont - ::Size aAppFontSize( e.Width, e.Height ); + if ( !pOutDev || mbSizeModified ) + return; - Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW ); - Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY ); - OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" ); + // Currentley we are simply using MapUnit::MapAppFont + ::Size aAppFontSize( e.Width, e.Height ); - // #i87592 In design mode the drawing layer works with sizes with decoration. - // Therefore we have to subtract them before writing back to the properties (model). - if ( xDialogDevice.is() && mbDesignMode ) - { - DeviceInfo aDeviceInfo( xDialogDevice->getInfo() ); - aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; - aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; - } + Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW ); + Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY ); + OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" ); - aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize ); - - // Remember that changes have been done by listener. No need to - // update the position because of property change event. - mbSizeModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - // Properties in a sequence must be sorted! - aProps[0] = "Height"; - aProps[1] = "Width"; - aValues[0] <<= aAppFontSize.Height(); - aValues[1] <<= aAppFontSize.Width(); - - ImplSetPropertyValues( aProps, aValues, true ); - mbSizeModified = false; + // #i87592 In design mode the drawing layer works with sizes with decoration. + // Therefore we have to subtract them before writing back to the properties (model). + if ( xDialogDevice.is() && mbDesignMode ) + { + DeviceInfo aDeviceInfo( xDialogDevice->getInfo() ); + aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; + aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; } + + aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize ); + + // Remember that changes have been done by listener. No need to + // update the position because of property change event. + mbSizeModified = true; + Sequence< OUString > aProps( 2 ); + Sequence< Any > aValues( 2 ); + // Properties in a sequence must be sorted! + aProps[0] = "Height"; + aProps[1] = "Width"; + aValues[0] <<= aAppFontSize.Height(); + aValues[1] <<= aAppFontSize.Width(); + + ImplSetPropertyValues( aProps, aValues, true ); + mbSizeModified = false; + } void SAL_CALL UnoDialogControl::windowMoved( const css::awt::WindowEvent& e ) { OutputDevice*pOutDev = Application::GetDefaultDevice(); DBG_ASSERT( pOutDev, "Missing Default Device!" ); - if ( pOutDev && !mbPosModified ) - { - // Currentley we are simply using MapUnit::MapAppFont - ::Size aTmp( e.X, e.Y ); - aTmp = ImplMapPixelToAppFont( pOutDev, aTmp ); - - // Remember that changes have been done by listener. No need to - // update the position because of property change event. - mbPosModified = true; - Sequence< OUString > aProps( 2 ); - Sequence< Any > aValues( 2 ); - aProps[0] = "PositionX"; - aProps[1] = "PositionY"; - aValues[0] <<= aTmp.Width(); - aValues[1] <<= aTmp.Height(); - - ImplSetPropertyValues( aProps, aValues, true ); - mbPosModified = false; - } + if ( !pOutDev || mbPosModified ) + return; + + // Currentley we are simply using MapUnit::MapAppFont + ::Size aTmp( e.X, e.Y ); + aTmp = ImplMapPixelToAppFont( pOutDev, aTmp ); + + // Remember that changes have been done by listener. No need to + // update the position because of property change event. + mbPosModified = true; + Sequence< OUString > aProps( 2 ); + Sequence< Any > aValues( 2 ); + aProps[0] = "PositionX"; + aProps[1] = "PositionY"; + aValues[0] <<= aTmp.Width(); + aValues[1] <<= aTmp.Height(); + + ImplSetPropertyValues( aProps, aValues, true ); + mbPosModified = false; + } void SAL_CALL UnoDialogControl::windowShown( const EventObject& ) {} -- cgit