diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-01-21 18:22:24 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-01-21 18:24:07 +0100 |
commit | 1115adbb5dc2dc05354f2a24a27cb37e522c92b4 (patch) | |
tree | 54e7313f8744c629bc9379739d48d36844d168ff /framework | |
parent | ce6b20442a8f848848e7bffb42346cc9925ad4c8 (diff) |
bool improvements
Change-Id: I1588e6dcbc095d8c5fcde3601eea9111fbae15fb
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/macros/registration.hxx | 2 | ||||
-rw-r--r-- | framework/inc/macros/xinterface.hxx | 6 | ||||
-rw-r--r-- | framework/source/dispatch/menudispatcher.cxx | 15 | ||||
-rw-r--r-- | framework/source/helper/dockingareadefaultacceptor.cxx | 10 | ||||
-rw-r--r-- | framework/source/helper/ocomponentaccess.cxx | 25 | ||||
-rw-r--r-- | framework/source/helper/ocomponentenumeration.cxx | 13 | ||||
-rw-r--r-- | framework/source/helper/oframes.cxx | 56 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 2 | ||||
-rw-r--r-- | framework/source/services/desktop.cxx | 27 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 114 | ||||
-rw-r--r-- | framework/source/uielement/macrosmenucontroller.cxx | 2 |
11 files changed, 72 insertions, 200 deletions
diff --git a/framework/inc/macros/registration.hxx b/framework/inc/macros/registration.hxx index 74b54203e023..db2b95cb5ccb 100644 --- a/framework/inc/macros/registration.hxx +++ b/framework/inc/macros/registration.hxx @@ -78,7 +78,7 @@ ________________________________________________________________________________ /* IF_NAME_CREATECOMPONENTFACTORY(z)" */ \ IFFACTORIES \ /* Factory is valid, if service was found. */ \ - if ( xFactory.is() == sal_True ) \ + if ( xFactory.is() ) \ { \ xFactory->acquire(); \ pReturn = xFactory.get(); \ diff --git a/framework/inc/macros/xinterface.hxx b/framework/inc/macros/xinterface.hxx index c126696613d7..9ce2bbc43318 100644 --- a/framework/inc/macros/xinterface.hxx +++ b/framework/inc/macros/xinterface.hxx @@ -88,7 +88,7 @@ ________________________________________________________________________________ ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES \ ); \ /* If searched interface not supported by this class ... */ \ - if ( aReturn.hasValue() == sal_False ) \ + if ( !aReturn.hasValue() ) \ { \ /* ... ask baseclass for interfaces! */ \ aReturn = BASECLASS::queryInterface( aType ); \ @@ -109,12 +109,12 @@ ________________________________________________________________________________ ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES_FIRST \ ); \ /* If searched interface not supported by first group ... */ \ - if ( aReturn.hasValue() == sal_False ) \ + if ( !aReturn.hasValue() ) \ { \ /* ... search in second group. (cppuhelper support 12 items only!) */ \ aReturn = ::cppu::queryInterface INTERFACES_SECOND ; \ /* If searched interface not supported by this class ... */ \ - if ( aReturn.hasValue() == sal_False ) \ + if ( !aReturn.hasValue() ) \ { \ /* ... ask baseclass for interfaces! */ \ aReturn = BASECLASS::queryInterface( aType ); \ diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx index fbf1ba134149..6742625c6029 100644 --- a/framework/source/dispatch/menudispatcher.cxx +++ b/framework/source/dispatch/menudispatcher.cxx @@ -315,20 +315,7 @@ sal_Bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, sal_Bool bMenuFromR static sal_Bool impldbg_checkParameter_MenuDispatcher( const uno::Reference< XComponentContext >& xContext , const uno::Reference< XFrame >& xOwner ) { - // Set default return value. - sal_Bool bOK = sal_True; - // Check parameter. - if ( - ( &xContext == NULL ) || - ( &xOwner == NULL ) || - ( xContext.is() == sal_False ) || - ( xOwner.is() == sal_False ) - ) - { - bOK = sal_False ; - } - // Return result of check. - return bOK ; + return xContext.is() && xOwner.is(); } //***************************************************************************************************************** diff --git a/framework/source/helper/dockingareadefaultacceptor.cxx b/framework/source/helper/dockingareadefaultacceptor.cxx index 810c69275dfd..651f3002cc95 100644 --- a/framework/source/helper/dockingareadefaultacceptor.cxx +++ b/framework/source/helper/dockingareadefaultacceptor.cxx @@ -77,13 +77,12 @@ sal_Bool SAL_CALL DockingAreaDefaultAcceptor::requestDockingAreaSpace( const css css::uno::Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); aGuard.unlock(); - if ( xFrame.is() == sal_True ) + if ( xFrame.is() ) { css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() ); - if (( xContainerWindow.is() == sal_True ) && - ( xComponentWindow.is() == sal_True ) ) + if ( xContainerWindow.is() && xComponentWindow.is() ) { css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY ); // Convert relativ size to output size. @@ -113,13 +112,12 @@ void SAL_CALL DockingAreaDefaultAcceptor::setDockingAreaSpace( const css::awt::R // Try to "lock" the frame for access to taskscontainer. css::uno::Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); - if ( xFrame.is() == sal_True ) + if ( xFrame.is() ) { css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() ); - if (( xContainerWindow.is() == sal_True ) && - ( xComponentWindow.is() == sal_True ) ) + if ( xContainerWindow.is() && xComponentWindow.is() ) { css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY ); // Convert relativ size to output size. diff --git a/framework/source/helper/ocomponentaccess.cxx b/framework/source/helper/ocomponentaccess.cxx index 85e62cd4ab28..39894a895854 100644 --- a/framework/source/helper/ocomponentaccess.cxx +++ b/framework/source/helper/ocomponentaccess.cxx @@ -70,7 +70,7 @@ css::uno::Reference< XEnumeration > SAL_CALL OComponentAccess::createEnumeration // Try to "lock" the desktop for access to task container. css::uno::Reference< XInterface > xLock = m_xOwner.get(); - if ( xLock.is() == sal_True ) + if ( xLock.is() ) { // Desktop exist => pointer to task container must be valid. // Initialize a new enumeration ... if some tasks and his components exist! @@ -109,7 +109,7 @@ sal_Bool SAL_CALL OComponentAccess::hasElements() throw( RuntimeException ) // Try to "lock" the desktop for access to task container. css::uno::Reference< XFramesSupplier > xLock( m_xOwner.get(), UNO_QUERY ); - if ( xLock.is() == sal_True ) + if ( xLock.is() ) { // Ask container of owner for existing elements. bReturn = xLock->getFrames()->hasElements(); @@ -126,7 +126,7 @@ void OComponentAccess::impl_collectAllChildComponents( const css::uno::Refere Sequence< css::uno::Reference< XComponent > >& seqComponents ) { // If valid node was given ... - if( xNode.is() == sal_True ) + if( xNode.is() ) { // ... continue collection at these. @@ -142,7 +142,7 @@ void OComponentAccess::impl_collectAllChildComponents( const css::uno::Refere for( sal_Int32 nFrame=0; nFrame<nFrameCount; ++nFrame ) { css::uno::Reference< XComponent > xComponent = impl_getFrameComponent( seqFrames[nFrame] ); - if( xComponent.is() == sal_True ) + if( xComponent.is() ) { nComponentCount++; seqComponents.realloc( nComponentCount ); @@ -162,7 +162,7 @@ css::uno::Reference< XComponent > OComponentAccess::impl_getFrameComponent( cons css::uno::Reference< XComponent > xComponent = css::uno::Reference< XComponent >(); // Does no controller exists? css::uno::Reference< XController > xController = xFrame->getController(); - if ( xController.is() == sal_False ) + if ( !xController.is() ) { // Controller not exist - use the VCL-component. xComponent = css::uno::Reference< XComponent >( xFrame->getComponentWindow(), UNO_QUERY ); @@ -171,7 +171,7 @@ css::uno::Reference< XComponent > OComponentAccess::impl_getFrameComponent( cons { // Does no model exists? css::uno::Reference< XModel > xModel( xController->getModel(), UNO_QUERY ); - if ( xModel.is() == sal_True ) + if ( xModel.is() ) { // Model exist - use the model as component. xComponent = css::uno::Reference< XComponent >( xModel, UNO_QUERY ); @@ -203,18 +203,7 @@ css::uno::Reference< XComponent > OComponentAccess::impl_getFrameComponent( cons //***************************************************************************************************************** sal_Bool OComponentAccess::impldbg_checkParameter_OComponentAccessCtor( const css::uno::Reference< XDesktop >& xOwner ) { - // Set default return value. - sal_Bool bOK = sal_True; - // Check parameter. - if ( - ( &xOwner == NULL ) || - ( xOwner.is() == sal_False ) - ) - { - bOK = sal_False ; - } - // Return result of check. - return bOK ; + return xOwner.is(); } } // namespace framework diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx index 2a3de3bccba5..1ef375529451 100644 --- a/framework/source/helper/ocomponentenumeration.cxx +++ b/framework/source/helper/ocomponentenumeration.cxx @@ -174,18 +174,7 @@ sal_Bool OComponentEnumeration::impldbg_checkParameter_OComponentEnumerationCtor //***************************************************************************************************************** sal_Bool OComponentEnumeration::impldbg_checkParameter_disposing( const EventObject& aEvent ) { - // Set default return value. - sal_Bool bOK = sal_True; - // Check parameter. - if ( - ( &aEvent == NULL ) || - ( aEvent.Source.is() == sal_False ) - ) - { - bOK = sal_False ; - } - // Return result of check. - return bOK ; + return aEvent.Source.is(); } } // namespace framework diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx index 73fa91857f20..9ee7777e6614 100644 --- a/framework/source/helper/oframes.cxx +++ b/framework/source/helper/oframes.cxx @@ -78,7 +78,7 @@ void SAL_CALL OFrames::append( const css::uno::Reference< XFrame >& xFrame ) thr // Do the follow only, if owner instance valid! // Lock owner for follow operations - make a "hard reference"! css::uno::Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); - if ( xOwner.is() == sal_True ) + if ( xOwner.is() ) { // Append frame to the end of the container ... m_pFrameContainer->append( xFrame ); @@ -104,7 +104,7 @@ void SAL_CALL OFrames::remove( const css::uno::Reference< XFrame >& xFrame ) thr // Do the follow only, if owner instance valid! // Lock owner for follow operations - make a "hard reference"! css::uno::Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); - if ( xOwner.is() == sal_True ) + if ( xOwner.is() ) { // Search frame and remove it from container ... m_pFrameContainer->remove( xFrame ); @@ -134,7 +134,7 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); - if ( xOwner.is() == sal_True ) + if ( xOwner.is() ) { // Work only, if search was not started here ...! if( m_bRecursiveSearchProtection == sal_False ) @@ -160,7 +160,7 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int if( nSearchFlags & FrameSearchFlag::PARENT ) { css::uno::Reference< XFrame > xParent( xOwner->getCreator(), UNO_QUERY ); - if( xParent.is() == sal_True ) + if( xParent.is() ) { Sequence< css::uno::Reference< XFrame > > seqParent( 1 ); seqParent[0] = xParent; @@ -187,7 +187,7 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int // Ask parent of my owner for frames and append results to return list. css::uno::Reference< XFramesSupplier > xParent( xOwner->getCreator(), UNO_QUERY ); // If a parent exist ... - if ( xParent.is() == sal_True ) + if ( xParent.is() ) { // ... ask him for right frames. impl_appendSequence( seqFrames, xParent->getFrames()->queryFrames( nSearchFlags ) ); @@ -237,7 +237,7 @@ sal_Int32 SAL_CALL OFrames::getCount() throw( RuntimeException ) // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); - if ( xOwner.is() == sal_True ) + if ( xOwner.is() ) { // Set CURRENT size of container for return. nCount = m_pFrameContainer->getCount(); @@ -268,7 +268,7 @@ Any SAL_CALL OFrames::getByIndex( sal_Int32 nIndex ) throw( IndexOutOfBoundsExce // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); - if ( xOwner.is() == sal_True ) + if ( xOwner.is() ) { // Get element form container. // (If index not valid, FrameContainer return NULL!) @@ -301,7 +301,7 @@ sal_Bool SAL_CALL OFrames::hasElements() throw( RuntimeException ) // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); - if ( xOwner.is() == sal_True ) + if ( xOwner.is() ) { // If some elements exist ... if ( m_pFrameContainer->getCount() > 0 ) @@ -391,19 +391,7 @@ void OFrames::impl_appendSequence( Sequence< css::uno::Reference< XFram sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const css::uno::Reference< XFrame >& xOwner , FrameContainer* pFrameContainer ) { - // Set default return value. - sal_Bool bOK = sal_True; - // Check parameter. - if ( - ( &xOwner == NULL ) || - ( xOwner.is() == sal_False ) || - ( pFrameContainer == NULL ) - ) - { - bOK = sal_False ; - } - // Return result of check. - return bOK ; + return xOwner.is() && pFrameContainer != 0; } //***************************************************************************************************************** @@ -411,18 +399,7 @@ sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const css::uno::Refere // AND - alle frames must support XFrames-interface! sal_Bool OFrames::impldbg_checkParameter_append( const css::uno::Reference< XFrame >& xFrame ) { - // Set default return value. - sal_Bool bOK = sal_True; - // Check parameter. - if ( - ( &xFrame == NULL ) || - ( xFrame.is() == sal_False ) - ) - { - bOK = sal_False ; - } - // Return result of check. - return bOK ; + return xFrame.is(); } //***************************************************************************************************************** @@ -430,18 +407,7 @@ sal_Bool OFrames::impldbg_checkParameter_append( const css::uno::Reference< XFra // ... => You can only delete valid references! sal_Bool OFrames::impldbg_checkParameter_remove( const css::uno::Reference< XFrame >& xFrame ) { - // Set default return value. - sal_Bool bOK = sal_True; - // Check parameter. - if ( - ( &xFrame == NULL ) || - ( xFrame.is() == sal_False ) - ) - { - bOK = sal_False ; - } - // Return result of check. - return bOK ; + return xFrame.is(); } //***************************************************************************************************************** diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 5fdcfdd91ab3..c3710c0c7b32 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -2706,7 +2706,7 @@ throw( uno::RuntimeException ) // the container window of my DockingAreaAcceptor is not the same as of my frame // I still have to resize my frames' window as nobody else will do it Reference< awt::XWindow > xComponentWindow( m_xFrame->getComponentWindow() ); - if( xComponentWindow.is() == sal_True ) + if( xComponentWindow.is() ) { uno::Reference< awt::XDevice > xDevice( m_xFrame->getContainerWindow(), uno::UNO_QUERY ); diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 2ab1d3a7dcfd..d3715ed4dc1d 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -530,7 +530,7 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::getCurrentCompone // ... get component of this frame ... (It can be the window, the model or the controller.) // ... and return the result. css::uno::Reference< css::frame::XFrame > xCurrentFrame = getCurrentFrame(); - if( xCurrentFrame.is() == sal_True ) + if( xCurrentFrame.is() ) { xComponent = impl_getFrameComponent( xCurrentFrame ); } @@ -564,10 +564,10 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::getCurrentFrame() th // Search on his children for other active frames too. // Stop if no one could be found and return last of found ones. css::uno::Reference< css::frame::XFramesSupplier > xLast = css::uno::Reference< css::frame::XFramesSupplier >( getActiveFrame(), css::uno::UNO_QUERY ); - if( xLast.is() == sal_True ) + if( xLast.is() ) { css::uno::Reference< css::frame::XFramesSupplier > xNext = css::uno::Reference< css::frame::XFramesSupplier >( xLast->getActiveFrame(), css::uno::UNO_QUERY ); - while( xNext.is() == sal_True ) + while( xNext.is() ) { xLast = xNext; xNext = css::uno::Reference< css::frame::XFramesSupplier >( xNext->getActiveFrame(), css::uno::UNO_QUERY ); @@ -811,7 +811,7 @@ void SAL_CALL Desktop::setActiveFrame( const css::uno::Reference< css::frame::XF if( xLastActiveChild != xFrame ) { m_aChildTaskContainer.setActive( xFrame ); - if( xLastActiveChild.is() == sal_True ) + if( xLastActiveChild.is() ) { xLastActiveChild->deactivate(); } @@ -1688,7 +1688,7 @@ css::uno::Reference< css::lang::XComponent > Desktop::impl_getFrameComponent( co css::uno::Reference< css::lang::XComponent > xComponent; // Does no controller exists? css::uno::Reference< css::frame::XController > xController = xFrame->getController(); - if( xController.is() == sal_False ) + if( !xController.is() ) { // Controller not exist - use the VCL-component. xComponent = css::uno::Reference< css::lang::XComponent >( xFrame->getComponentWindow(), css::uno::UNO_QUERY ); @@ -1697,7 +1697,7 @@ css::uno::Reference< css::lang::XComponent > Desktop::impl_getFrameComponent( co { // Does no model exists? css::uno::Reference< css::frame::XModel > xModel( xController->getModel(), css::uno::UNO_QUERY ); - if( xModel.is() == sal_True ) + if( xModel.is() ) { // Model exist - use the model as component. xComponent = css::uno::Reference< css::lang::XComponent >( xModel, css::uno::UNO_QUERY ); @@ -1935,28 +1935,19 @@ void Desktop::impl_sendNotifyTerminationEvent() // We work with valid servicemanager only. sal_Bool Desktop::implcp_ctor( const css::uno::Reference< css::uno::XComponentContext >& xContext ) { - return( - ( &xContext == NULL ) || - ( xContext.is() == sal_False ) - ); + return !xContext.is(); } // We work with valid listener only. sal_Bool Desktop::implcp_addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) { - return( - ( &xListener == NULL ) || - ( xListener.is() == sal_False ) - ); + return !xListener.is(); } // We work with valid listener only. sal_Bool Desktop::implcp_removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) { - return( - ( &xListener == NULL ) || - ( xListener.is() == sal_False ) - ); + return !xListener.is(); } } // namespace framework diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 09fd420b7ddd..590d4116df25 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -807,14 +807,14 @@ void SAL_CALL Frame::setActiveFrame( const css::uno::Reference< css::frame::XFra m_aChildFrameContainer.setActive( xFrame ); if ( ( eActiveState != E_INACTIVE ) && - ( xActiveChild.is() == sal_True ) + xActiveChild.is() ) { xActiveChild->deactivate(); } } - if( xFrame.is() == sal_True ) + if( xFrame.is() ) { // If last active frame had focus ... // ... reset state to ACTIVE and send right FrameActionEvent for focus lost. @@ -1447,7 +1447,7 @@ void SAL_CALL Frame::activate() throw( css::uno::RuntimeException ) m_eActiveState = eState; aWriteLock.unlock(); // Deactivate sibling path and forward activation to parent ... if any parent exist! - if( xParent.is() == sal_True ) + if( xParent.is() ) { // Everytime set THIS frame as active child of parent and activate it. // We MUST have a valid path from bottom to top as active path! @@ -1475,21 +1475,14 @@ void SAL_CALL Frame::activate() throw( css::uno::RuntimeException ) // But ouer direct child of path is not active yet. // (It can be, if activation occur in the middle of a current path!) // In these case we activate path to bottom to set focus on right frame! - if ( - ( eState == E_ACTIVE ) && - ( xActiveChild.is() == sal_True ) && - ( xActiveChild->isActive() == sal_False ) - ) + if ( eState == E_ACTIVE && xActiveChild.is() && !xActiveChild->isActive() ) { xActiveChild->activate(); } //_________________________________________________________________________________________________________ // 3) I was active before or current activated. But if I have no active child => I will get the focus! - if ( - ( eState == E_ACTIVE ) && - ( xActiveChild.is() == sal_False ) - ) + if ( eState == E_ACTIVE && !xActiveChild.is() ) { aWriteLock.lock(); eState = E_FOCUS; @@ -1537,10 +1530,7 @@ void SAL_CALL Frame::deactivate() throw( css::uno::RuntimeException ) { //_____________________________________________________________________________________________________ // 1) Deactivate all active children. - if ( - ( xActiveChild.is() == sal_True ) && - ( xActiveChild->isActive() == sal_True ) - ) + if ( xActiveChild.is() && xActiveChild->isActive() ) { xActiveChild->deactivate(); } @@ -1575,10 +1565,7 @@ void SAL_CALL Frame::deactivate() throw( css::uno::RuntimeException ) // ... I'am on the top or in the middle of deactivated subtree and action was started here. // I must deactivate all frames from here to top, which are members of current path. // Stop, if THESE frame not the active frame of ouer parent! - if ( - ( xParent.is() == sal_True ) && - ( xParent->getActiveFrame() == xThis ) - ) + if ( xParent.is() && xParent->getActiveFrame() == xThis ) { // We MUST break the path - otherwise we will get the focus - not ouer parent! ... // Attention: Ouer parent don't call us again - WE ARE NOT ACTIVE YET! @@ -2261,7 +2248,7 @@ void SAL_CALL Frame::dispose() throw( css::uno::RuntimeException ) // It's important to do that before we free some other internal structures. // Because if our parent gets an activate and found us as last possible active frame // he try to deactivate us ... and we run into some trouble (DisposedExceptions!). - if( m_xParent.is() == sal_True ) + if( m_xParent.is() ) { m_xParent->getFrames()->remove( xThis ); m_xParent = css::uno::Reference< css::frame::XFramesSupplier >(); @@ -2582,7 +2569,7 @@ void SAL_CALL Frame::focusGained( const css::awt::FocusEvent& aEvent ) throw( cs aReadLock.unlock(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ - if( xComponentWindow.is() == sal_True ) + if( xComponentWindow.is() ) { xComponentWindow->setFocus(); } @@ -2652,10 +2639,8 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& aEvent ) t // is a parent window of the last active Window! SolarMutexClearableGuard aSolarGuard; Window* pFocusWindow = Application::GetFocusWindow(); - if ( - ( xContainerWindow.is() == sal_True ) && - ( xParent.is() == sal_True ) && - ( (css::uno::Reference< css::frame::XDesktop >( xParent, css::uno::UNO_QUERY )).is() == sal_False ) + if ( xContainerWindow.is() && xParent.is() && + !css::uno::Reference< css::frame::XDesktop >( xParent, css::uno::UNO_QUERY ).is() ) { css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow() ; @@ -2668,7 +2653,7 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& aEvent ) t if( pFocusWindow && pParentWindow->IsChild( pFocusWindow ) ) { css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY ); - if( xSupplier.is() == sal_True ) + if( xSupplier.is() ) { aSolarGuard.clear(); xSupplier->setActiveFrame( css::uno::Reference< css::frame::XFrame >() ); @@ -3071,7 +3056,7 @@ css::uno::Any SAL_CALL Frame::impl_getPropertyValue(const OUString& /*sProperty* *//*-*****************************************************************************************************/ void Frame::impl_disposeContainerWindow( css::uno::Reference< css::awt::XWindow >& xWindow ) { - if( xWindow.is() == sal_True ) + if( xWindow.is() ) { xWindow->setVisible( sal_False ); // All VclComponents are XComponents; so call dispose before discarding @@ -3162,7 +3147,7 @@ void Frame::implts_resizeComponentWindow() if ( !m_xLayoutManager.is() ) { css::uno::Reference< css::awt::XWindow > xComponentWindow( getComponentWindow() ); - if( xComponentWindow.is() == sal_True ) + if( xComponentWindow.is() ) { css::uno::Reference< css::awt::XDevice > xDevice( getContainerWindow(), css::uno::UNO_QUERY ); @@ -3205,10 +3190,7 @@ void Frame::implts_setIconOnWindow() aReadLock.unlock(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ - if( - ( xContainerWindow.is() == sal_True ) && - ( xController.is() == sal_True ) - ) + if( xContainerWindow.is() && xController.is() ) { //------------------------------------------------------------------------------------------------------------- // a) set default value to an invalid one. So we can start further searches for right icon id, if @@ -3220,7 +3202,7 @@ void Frame::implts_setIconOnWindow() // b) try to find information on controller propertyset directly // Don't forget to catch possible exceptions - because these property is an optional one! css::uno::Reference< css::beans::XPropertySet > xSet( xController, css::uno::UNO_QUERY ); - if( xSet.is() == sal_True ) + if( xSet.is() ) { try { @@ -3240,7 +3222,7 @@ void Frame::implts_setIconOnWindow() if( nIcon == -1 ) { css::uno::Reference< css::frame::XModel > xModel = xController->getModel(); - if( xModel.is() == sal_True ) + if( xModel.is() ) { SvtModuleOptions::EFactory eFactory = SvtModuleOptions::ClassifyFactoryByModel(xModel); if (eFactory != SvtModuleOptions::E_UNKNOWN_FACTORY) @@ -3309,19 +3291,19 @@ void Frame::implts_startWindowListening() aReadLock.unlock(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ - if( xContainerWindow.is() == sal_True ) + if( xContainerWindow.is() ) { xContainerWindow->addWindowListener( xWindowListener); xContainerWindow->addFocusListener ( xFocusListener ); css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY ); - if( xTopWindow.is() == sal_True ) + if( xTopWindow.is() ) { xTopWindow->addTopWindowListener( xTopWindowListener ); css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( xContext ); css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow ); - if( xDropTarget.is() == sal_True ) + if( xDropTarget.is() ) { xDropTarget->addDropTargetListener( xDragDropListener ); xDropTarget->setActive( sal_True ); @@ -3349,19 +3331,19 @@ void Frame::implts_stopWindowListening() aReadLock.unlock(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ - if( xContainerWindow.is() == sal_True ) + if( xContainerWindow.is() ) { xContainerWindow->removeWindowListener( xWindowListener); xContainerWindow->removeFocusListener ( xFocusListener ); css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY ); - if( xTopWindow.is() == sal_True ) + if( xTopWindow.is() ) { xTopWindow->removeTopWindowListener( xTopWindowListener ); css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( xContext ); css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow ); - if( xDropTarget.is() == sal_True ) + if( xDropTarget.is() ) { xDropTarget->removeDropTargetListener( xDragDropListener ); xDropTarget->setActive( sal_False ); @@ -3540,90 +3522,60 @@ void Frame::impl_checkMenuCloser() // And we accept frames only! No tasks and desktops! sal_Bool Frame::implcp_setActiveFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) { - return ( - ( &xFrame == NULL ) || - ( css::uno::Reference< css::frame::XDesktop >( xFrame, css::uno::UNO_QUERY ).is() == sal_True ) - ); + return css::uno::Reference< css::frame::XDesktop >( xFrame, css::uno::UNO_QUERY ).is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) { - return ( - ( &xListener == NULL ) || - ( xListener.is() == sal_False ) - ); + return !xListener.is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) { - return ( - ( &xListener == NULL ) || - ( xListener.is() == sal_False ) - ); + return !xListener.is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) { - return ( - ( &xListener == NULL ) || - ( xListener.is() == sal_False ) - ); + return !xListener.is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) { - return ( - ( &xListener == NULL ) || - ( xListener.is() == sal_False ) - ); + return !xListener.is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_windowResized( const css::awt::WindowEvent& aEvent ) { - return ( - ( &aEvent == NULL ) || - ( aEvent.Source.is() == sal_False ) - ); + return !aEvent.Source.is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_focusGained( const css::awt::FocusEvent& aEvent ) { - return ( - ( &aEvent == NULL ) || - ( aEvent.Source.is() == sal_False ) - ); + return !aEvent.Source.is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_windowActivated( const css::lang::EventObject& aEvent ) { - return ( - ( &aEvent == NULL ) || - ( aEvent.Source.is() == sal_False ) - ); + return !aEvent.Source.is(); } //***************************************************************************************************************** sal_Bool Frame::implcp_windowDeactivated( const css::lang::EventObject& aEvent ) { - return ( - ( &aEvent == NULL ) || - ( aEvent.Source.is() == sal_False ) - ); + return !aEvent.Source.is(); } sal_Bool Frame::implcp_disposing( const css::lang::EventObject& aEvent ) { - return ( - ( &aEvent == NULL ) || - ( aEvent.Source.is() == sal_False ) - ); + return !aEvent.Source.is(); } } diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 18c5460c3b65..99b3f570d9d6 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -176,7 +176,7 @@ void MacrosMenuController::addScriptItems( PopupMenu* pPopupMenu, sal_uInt16 sta while ( xEnum->hasMoreElements() ) { Reference< XServiceInfo > xServiceInfo; - if ( sal_False == ( xEnum->nextElement() >>= xServiceInfo ) ) + if ( !( xEnum->nextElement() >>= xServiceInfo ) ) { break; } |