diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-14 12:39:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-14 13:33:20 +0200 |
commit | fcabb9a7263d4128ae934636b5a8eebc2a0217cc (patch) | |
tree | 28badfa7a81d578610f6abfc895d330f8a6437e4 /forms/source/richtext | |
parent | 600b35480da436b2683b720149b576e85c16aa84 (diff) |
loplugin:flatten in forms
Change-Id: I7e264cc1e60280b80a4e2e87b8944de4912c563d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92162
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms/source/richtext')
-rw-r--r-- | forms/source/richtext/richtextcontrol.cxx | 72 | ||||
-rw-r--r-- | forms/source/richtext/rtattributehandler.cxx | 34 |
2 files changed, 53 insertions, 53 deletions
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index 4cf1f3912f89..1c96b9870361 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -168,51 +168,51 @@ namespace frm SolarMutexGuard aGuard; - if (!getPeer().is()) - { - mbCreatingPeer = true; + if (getPeer().is()) + return; - // determine the VLC window for the parent - vcl::Window* pParentWin = nullptr; - if ( _rParentPeer.is() ) - { - VCLXWindow* pParentXWin = comphelper::getUnoTunnelImplementation<VCLXWindow>( _rParentPeer ); - if ( pParentXWin ) - pParentWin = pParentXWin->GetWindow().get(); - DBG_ASSERT( pParentWin, "ORichTextControl::createPeer: could not obtain the VCL-level parent window!" ); - } + mbCreatingPeer = true; - // create the peer - Reference< XControlModel > xModel( getModel() ); - rtl::Reference<ORichTextPeer> pPeer = ORichTextPeer::Create( xModel, pParentWin, getWinBits( xModel ) ); - DBG_ASSERT( pPeer, "ORichTextControl::createPeer: invalid peer returned!" ); - if ( pPeer ) - { - // announce the peer to the base class - setPeer( pPeer.get() ); + // determine the VLC window for the parent + vcl::Window* pParentWin = nullptr; + if ( _rParentPeer.is() ) + { + VCLXWindow* pParentXWin = comphelper::getUnoTunnelImplementation<VCLXWindow>( _rParentPeer ); + if ( pParentXWin ) + pParentWin = pParentXWin->GetWindow().get(); + DBG_ASSERT( pParentWin, "ORichTextControl::createPeer: could not obtain the VCL-level parent window!" ); + } - // initialize ourself (and thus the peer) with the model properties - updateFromModel(); + // create the peer + Reference< XControlModel > xModel( getModel() ); + rtl::Reference<ORichTextPeer> pPeer = ORichTextPeer::Create( xModel, pParentWin, getWinBits( xModel ) ); + DBG_ASSERT( pPeer, "ORichTextControl::createPeer: invalid peer returned!" ); + if ( pPeer ) + { + // announce the peer to the base class + setPeer( pPeer.get() ); - Reference< XView > xPeerView( getPeer(), UNO_QUERY ); - if ( xPeerView.is() ) - { - xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY ); - xPeerView->setGraphics( mxGraphics ); - } + // initialize ourself (and thus the peer) with the model properties + updateFromModel(); - // a lot of initial settings from our component infos - setPosSize( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight, PosSize::POSSIZE ); + Reference< XView > xPeerView( getPeer(), UNO_QUERY ); + if ( xPeerView.is() ) + { + xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY ); + xPeerView->setGraphics( mxGraphics ); + } - pPeer->setVisible ( maComponentInfos.bVisible && !mbDesignMode ); - pPeer->setEnable ( maComponentInfos.bEnable ); - pPeer->setDesignMode( mbDesignMode ); + // a lot of initial settings from our component infos + setPosSize( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight, PosSize::POSSIZE ); - peerCreated(); - } + pPeer->setVisible ( maComponentInfos.bVisible && !mbDesignMode ); + pPeer->setEnable ( maComponentInfos.bEnable ); + pPeer->setDesignMode( mbDesignMode ); - mbCreatingPeer = false; + peerCreated(); } + + mbCreatingPeer = false; } OUString SAL_CALL ORichTextControl::getImplementationName() diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx index 1f17b32c3396..ee7a3fe73b77 100644 --- a/forms/source/richtext/rtattributehandler.cxx +++ b/forms/source/richtext/rtattributehandler.cxx @@ -345,26 +345,26 @@ namespace frm const SvxFontHeightItem* pFontHeightItem = dynamic_cast<const SvxFontHeightItem*>( _pAdditionalArg ); OSL_ENSURE( pFontHeightItem, "FontSizeHandler::executeAttribute: need a FontHeightItem!" ); - if ( pFontHeightItem ) + if ( !pFontHeightItem ) + return; + + sal_uLong nHeight = pFontHeightItem->GetHeight(); + if ( _rNewAttribs.GetPool()->GetMetric( getWhich() ) != MapUnit::MapTwip ) { - sal_uLong nHeight = pFontHeightItem->GetHeight(); - if ( _rNewAttribs.GetPool()->GetMetric( getWhich() ) != MapUnit::MapTwip ) - { - nHeight = OutputDevice::LogicToLogic( - Size( 0, nHeight ), - MapMode( MapUnit::MapTwip ), - MapMode( _rNewAttribs.GetPool()->GetMetric( getWhich() ) ) - ).Height(); - } + nHeight = OutputDevice::LogicToLogic( + Size( 0, nHeight ), + MapMode( MapUnit::MapTwip ), + MapMode( _rNewAttribs.GetPool()->GetMetric( getWhich() ) ) + ).Height(); + } - SvxFontHeightItem aNewItem( nHeight, 100, getWhich() ); - aNewItem.SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() ); + SvxFontHeightItem aNewItem( nHeight, 100, getWhich() ); + aNewItem.SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() ); - if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType != SvtScriptType::NONE) - putItemForScript( _rNewAttribs, aNewItem, _nForScriptType ); - else - _rNewAttribs.Put( aNewItem ); - } + if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType != SvtScriptType::NONE) + putItemForScript( _rNewAttribs, aNewItem, _nForScriptType ); + else + _rNewAttribs.Put( aNewItem ); } ParagraphDirectionHandler::ParagraphDirectionHandler( AttributeId _nAttributeId ) |