Kaydet (Commit) 1115adbb authored tarafından Stephan Bergmann's avatar Stephan Bergmann

bool improvements

Change-Id: I1588e6dcbc095d8c5fcde3601eea9111fbae15fb
üst ce6b2044
......@@ -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(); \
......
......@@ -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 ); \
......
......@@ -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();
}
//*****************************************************************************************************************
......
......@@ -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.
......
......@@ -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
......
......@@ -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
......
......@@ -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();
}
//*****************************************************************************************************************
......
......@@ -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 );
......
......@@ -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
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment