diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-02 20:09:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-02 22:45:48 +0200 |
commit | 33abb535a753b710e439b66ccc67e826f49f6275 (patch) | |
tree | cd59068e6bcdba67a4f1dcd7c73c1806662771db /UnoControls/source | |
parent | e2644b014005e1c79b0a7eaf1c3c4002464a1cf0 (diff) |
loplugin:flatten in UnoControls
Change-Id: I0702283083297fc956eb8bd5132a1144286e1fcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99968
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'UnoControls/source')
-rw-r--r-- | UnoControls/source/base/basecontainercontrol.cxx | 104 | ||||
-rw-r--r-- | UnoControls/source/base/basecontrol.cxx | 86 | ||||
-rw-r--r-- | UnoControls/source/base/multiplexer.cxx | 36 | ||||
-rw-r--r-- | UnoControls/source/controls/progressbar.cxx | 102 | ||||
-rw-r--r-- | UnoControls/source/controls/progressmonitor.cxx | 106 | ||||
-rw-r--r-- | UnoControls/source/controls/statusindicator.cxx | 58 |
6 files changed, 246 insertions, 246 deletions
diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx index dda72799d550..2f21979cc644 100644 --- a/UnoControls/source/base/basecontainercontrol.cxx +++ b/UnoControls/source/base/basecontainercontrol.cxx @@ -114,18 +114,18 @@ Any SAL_CALL BaseContainerControl::queryAggregation( const Type& aType ) void SAL_CALL BaseContainerControl::createPeer( const Reference< XToolkit >& xToolkit , const Reference< XWindowPeer >& xParent ) { - if ( !getPeer().is() ) - { - // create own peer - BaseControl::createPeer( xToolkit, xParent ); + if ( getPeer().is() ) + return; - // create peers at all children - Sequence< Reference< XControl > > seqControlList = getControls(); + // create own peer + BaseControl::createPeer( xToolkit, xParent ); - for ( auto& rxControl : seqControlList ) - { - rxControl->createPeer( xToolkit, getPeer() ); - } + // create peers at all children + Sequence< Reference< XControl > > seqControlList = getControls(); + + for ( auto& rxControl : seqControlList ) + { + rxControl->createPeer( xToolkit, getPeer() ); } } @@ -221,22 +221,22 @@ void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Re // Send message to all listener OInterfaceContainerHelper* pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); - if (pInterfaceContainer) - { - // Build event - ContainerEvent aEvent; + if (!pInterfaceContainer) + return; - aEvent.Source = *this; - aEvent.Element <<= rControl; + // Build event + ContainerEvent aEvent; - // Get all listener - OInterfaceIteratorHelper aIterator (*pInterfaceContainer); + aEvent.Source = *this; + aEvent.Element <<= rControl; - // Send event - while ( aIterator.hasMoreElements() ) - { - static_cast<XContainerListener*>(aIterator.next())->elementInserted (aEvent); - } + // Get all listener + OInterfaceIteratorHelper aIterator (*pInterfaceContainer); + + // Send event + while ( aIterator.hasMoreElements() ) + { + static_cast<XContainerListener*>(aIterator.next())->elementInserted (aEvent); } } @@ -244,46 +244,46 @@ void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Re void SAL_CALL BaseContainerControl::removeControl ( const Reference< XControl > & rControl ) { - if ( rControl.is() ) - { - // Ready for multithreading - MutexGuard aGuard (m_aMutex); + if ( !rControl.is() ) + return; + + // Ready for multithreading + MutexGuard aGuard (m_aMutex); - size_t nControls = maControlInfoList.size(); + size_t nControls = maControlInfoList.size(); - for ( size_t n = 0; n < nControls; n++ ) + for ( size_t n = 0; n < nControls; n++ ) + { + // Search for right control + IMPL_ControlInfo* pControl = maControlInfoList[ n ].get(); + if ( rControl == pControl->xControl ) { - // Search for right control - IMPL_ControlInfo* pControl = maControlInfoList[ n ].get(); - if ( rControl == pControl->xControl ) - { - //.is it found ... remove listener from control - pControl->xControl->removeEventListener (static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) )); - pControl->xControl->setContext ( Reference< XInterface > () ); + //.is it found ... remove listener from control + pControl->xControl->removeEventListener (static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) )); + pControl->xControl->setContext ( Reference< XInterface > () ); - // ... free memory - maControlInfoList.erase(maControlInfoList.begin() + n); + // ... free memory + maControlInfoList.erase(maControlInfoList.begin() + n); - // Send message to all other listener - OInterfaceContainerHelper * pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); + // Send message to all other listener + OInterfaceContainerHelper * pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); - if (pInterfaceContainer) - { - ContainerEvent aEvent; + if (pInterfaceContainer) + { + ContainerEvent aEvent; - aEvent.Source = *this; - aEvent.Element <<= rControl; + aEvent.Source = *this; + aEvent.Element <<= rControl; - OInterfaceIteratorHelper aIterator (*pInterfaceContainer); + OInterfaceIteratorHelper aIterator (*pInterfaceContainer); - while ( aIterator.hasMoreElements() ) - { - static_cast<XContainerListener*>(aIterator.next())->elementRemoved (aEvent); - } + while ( aIterator.hasMoreElements() ) + { + static_cast<XContainerListener*>(aIterator.next())->elementRemoved (aEvent); } - // Break "for" ! - break; } + // Break "for" ! + break; } } } diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx index fc9d0b890d0b..1993e74c64b4 100644 --- a/UnoControls/source/base/basecontrol.cxx +++ b/UnoControls/source/base/basecontrol.cxx @@ -261,54 +261,54 @@ void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToo // Ready for multithreading MutexGuard aGuard( m_aMutex ); - if ( !m_xPeer.is() ) + if ( m_xPeer.is() ) + return; + + // use method "BaseControl::getWindowDescriptor()" to change window attributes! + WindowDescriptor aDescriptor = impl_getWindowDescriptor( xParentPeer ); + + if ( m_bVisible ) { - // use method "BaseControl::getWindowDescriptor()" to change window attributes! - WindowDescriptor aDescriptor = impl_getWindowDescriptor( xParentPeer ); + aDescriptor.WindowAttributes |= WindowAttribute::SHOW; + } - if ( m_bVisible ) - { - aDescriptor.WindowAttributes |= WindowAttribute::SHOW; - } + // very slow under remote conditions! + // create the window on the server + Reference< XToolkit > xLocalToolkit = xToolkit; + if ( !xLocalToolkit.is() ) + { + // but first create well known toolkit, if it not exist + xLocalToolkit.set( Toolkit::create(m_xComponentContext), UNO_QUERY_THROW ); + } + m_xPeer = xLocalToolkit->createWindow( aDescriptor ); + m_xPeerWindow.set( m_xPeer, UNO_QUERY ); - // very slow under remote conditions! - // create the window on the server - Reference< XToolkit > xLocalToolkit = xToolkit; - if ( !xLocalToolkit.is() ) - { - // but first create well known toolkit, if it not exist - xLocalToolkit.set( Toolkit::create(m_xComponentContext), UNO_QUERY_THROW ); - } - m_xPeer = xLocalToolkit->createWindow( aDescriptor ); - m_xPeerWindow.set( m_xPeer, UNO_QUERY ); + if ( !m_xPeerWindow.is() ) + return; - if ( m_xPeerWindow.is() ) - { - if ( m_xMultiplexer.is() ) - { - m_xMultiplexer->setPeer( m_xPeerWindow ); - } - - // create new reference to xgraphics for painting on a peer - // and add a paint listener - Reference< XDevice > xDevice( m_xPeerWindow, UNO_QUERY ); - - if ( xDevice.is() ) - { - m_xGraphicsPeer = xDevice->createGraphics(); - } - - if ( m_xGraphicsPeer.is() ) - { - addPaintListener( this ); - addWindowListener( this ); - } - - m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, PosSize::POSSIZE ); - m_xPeerWindow->setEnable( m_bEnable ); - m_xPeerWindow->setVisible( m_bVisible && !m_bInDesignMode ); - } + if ( m_xMultiplexer.is() ) + { + m_xMultiplexer->setPeer( m_xPeerWindow ); + } + + // create new reference to xgraphics for painting on a peer + // and add a paint listener + Reference< XDevice > xDevice( m_xPeerWindow, UNO_QUERY ); + + if ( xDevice.is() ) + { + m_xGraphicsPeer = xDevice->createGraphics(); + } + + if ( m_xGraphicsPeer.is() ) + { + addPaintListener( this ); + addWindowListener( this ); } + + m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, PosSize::POSSIZE ); + m_xPeerWindow->setEnable( m_bEnable ); + m_xPeerWindow->setVisible( m_bVisible && !m_bInDesignMode ); } // XControl diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx index 3b51249d09ff..2e0f48dd75fb 100644 --- a/UnoControls/source/base/multiplexer.cxx +++ b/UnoControls/source/base/multiplexer.cxx @@ -153,25 +153,25 @@ void SAL_CALL OMRCListenerMultiplexerHelper::release() throw() void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) { MutexGuard aGuard( m_aMutex ); - if( m_xPeer != xPeer ) + if( m_xPeer == xPeer ) + return; + + if( m_xPeer.is() ) { - if( m_xPeer.is() ) - { - // get all types from the listener added to the peer - const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); - // loop over all listener types and remove the listeners from the peer - for( const auto& rContainedType : aContainedTypes ) - impl_unadviseFromPeer( m_xPeer, rContainedType ); - } - m_xPeer = xPeer; - if( m_xPeer.is() ) - { - // get all types from the listener added to the peer - const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); - // loop over all listener types and add the listeners to the peer - for( const auto& rContainedType : aContainedTypes ) - impl_adviseToPeer( m_xPeer, rContainedType ); - } + // get all types from the listener added to the peer + const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); + // loop over all listener types and remove the listeners from the peer + for( const auto& rContainedType : aContainedTypes ) + impl_unadviseFromPeer( m_xPeer, rContainedType ); + } + m_xPeer = xPeer; + if( m_xPeer.is() ) + { + // get all types from the listener added to the peer + const Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); + // loop over all listener types and add the listeners to the peer + for( const auto& rContainedType : aContainedTypes ) + impl_adviseToPeer( m_xPeer, rContainedType ); } } diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx index 6b8de14f0b0f..f88aca35034b 100644 --- a/UnoControls/source/controls/progressbar.cxx +++ b/UnoControls/source/controls/progressbar.cxx @@ -292,68 +292,68 @@ void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGra // This paint method is not buffered !! // Every request paint the completely control. ( but only, if peer exist ) - if ( rGraphics.is () ) - { - MutexGuard aGuard (m_aMutex); + if ( !rGraphics.is () ) + return; + + MutexGuard aGuard (m_aMutex); - // Clear background - // (same color for line and fill) - rGraphics->setFillColor ( sal_Int32(m_nBackgroundColor) ); - rGraphics->setLineColor ( sal_Int32(m_nBackgroundColor) ); - rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() ); + // Clear background + // (same color for line and fill) + rGraphics->setFillColor ( sal_Int32(m_nBackgroundColor) ); + rGraphics->setLineColor ( sal_Int32(m_nBackgroundColor) ); + rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() ); - // same color for line and fill for blocks - rGraphics->setFillColor ( sal_Int32(m_nForegroundColor) ); - rGraphics->setLineColor ( sal_Int32(m_nForegroundColor) ); + // same color for line and fill for blocks + rGraphics->setFillColor ( sal_Int32(m_nForegroundColor) ); + rGraphics->setLineColor ( sal_Int32(m_nForegroundColor) ); - sal_Int32 nBlockStart = 0; // = left site of new block - sal_Int32 nBlockCount = m_nBlockValue!=0.00 ? static_cast<sal_Int32>((m_nValue-m_nMinRange)/m_nBlockValue) : 0; // = number of next block + sal_Int32 nBlockStart = 0; // = left site of new block + sal_Int32 nBlockCount = m_nBlockValue!=0.00 ? static_cast<sal_Int32>((m_nValue-m_nMinRange)/m_nBlockValue) : 0; // = number of next block - // Draw horizontal progressbar - // decision in "recalcRange()" - if (m_bHorizontal) + // Draw horizontal progressbar + // decision in "recalcRange()" + if (m_bHorizontal) + { + // Step to left side of window + nBlockStart = nX; + + for ( sal_Int32 i=1; i<=nBlockCount; ++i ) { - // Step to left side of window - nBlockStart = nX; - - for ( sal_Int32 i=1; i<=nBlockCount; ++i ) - { - // step free field - nBlockStart += PROGRESSBAR_FREESPACE; - // paint block - rGraphics->drawRect (nBlockStart, nY+PROGRESSBAR_FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height); - // step next free field - nBlockStart += m_aBlockSize.Width; - } + // step free field + nBlockStart += PROGRESSBAR_FREESPACE; + // paint block + rGraphics->drawRect (nBlockStart, nY+PROGRESSBAR_FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height); + // step next free field + nBlockStart += m_aBlockSize.Width; } - // draw vertical progressbar - // decision in "recalcRange()" - else + } + // draw vertical progressbar + // decision in "recalcRange()" + else + { + // step to bottom side of window + nBlockStart = nY+impl_getHeight(); + nBlockStart -= m_aBlockSize.Height; + + for ( sal_Int32 i=1; i<=nBlockCount; ++i ) { - // step to bottom side of window - nBlockStart = nY+impl_getHeight(); + // step free field + nBlockStart -= PROGRESSBAR_FREESPACE; + // paint block + rGraphics->drawRect (nX+PROGRESSBAR_FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height); + // step next free field nBlockStart -= m_aBlockSize.Height; - - for ( sal_Int32 i=1; i<=nBlockCount; ++i ) - { - // step free field - nBlockStart -= PROGRESSBAR_FREESPACE; - // paint block - rGraphics->drawRect (nX+PROGRESSBAR_FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height); - // step next free field - nBlockStart -= m_aBlockSize.Height; - } } + } - // Paint shadow border around the progressbar - rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_SHADOW ); - rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); - rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); + // Paint shadow border around the progressbar + rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_SHADOW ); + rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); + rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); - rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_BRIGHT ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); - } + rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_BRIGHT ); + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); } // protected method diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx index 46f6fda8bcec..905213b1e8e5 100644 --- a/UnoControls/source/controls/progressmonitor.cxx +++ b/UnoControls/source/controls/progressmonitor.cxx @@ -238,35 +238,35 @@ void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbe // Search the topic ... IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ); - if ( pSearchItem != nullptr ) - { - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ); - - // ... delete item from right list ... - if ( bbeforeProgress ) - { - auto itr = std::find_if( maTextlist_Top.begin(), maTextlist_Top.end(), - [&] (std::unique_ptr<IMPL_TextlistItem> const &p) - { return p.get() == pSearchItem; } ); - if (itr != maTextlist_Top.end()) - maTextlist_Top.erase(itr); - } - else - { - auto itr = std::find_if( maTextlist_Bottom.begin(), maTextlist_Bottom.end(), - [&] (std::unique_ptr<IMPL_TextlistItem> const &p) - { return p.get() == pSearchItem; } ); - if (itr != maTextlist_Bottom.end()) - maTextlist_Bottom.erase(itr); - } + if ( pSearchItem == nullptr ) + return; - delete pSearchItem; + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ); - // ... and update window. - impl_rebuildFixedText (); - impl_recalcLayout (); + // ... delete item from right list ... + if ( bbeforeProgress ) + { + auto itr = std::find_if( maTextlist_Top.begin(), maTextlist_Top.end(), + [&] (std::unique_ptr<IMPL_TextlistItem> const &p) + { return p.get() == pSearchItem; } ); + if (itr != maTextlist_Top.end()) + maTextlist_Top.erase(itr); } + else + { + auto itr = std::find_if( maTextlist_Bottom.begin(), maTextlist_Bottom.end(), + [&] (std::unique_ptr<IMPL_TextlistItem> const &p) + { return p.get() == pSearchItem; } ); + if (itr != maTextlist_Bottom.end()) + maTextlist_Bottom.erase(itr); + } + + delete pSearchItem; + + // ... and update window. + impl_rebuildFixedText (); + impl_recalcLayout (); } // XProgressMonitor @@ -533,27 +533,27 @@ void SAL_CALL ProgressMonitor::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int3 // protected method void ProgressMonitor::impl_paint ( sal_Int32 nX, sal_Int32 nY, const css::uno::Reference< XGraphics > & rGraphics ) { - if (rGraphics.is()) - { - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ); + if (!rGraphics.is()) + return; - // paint shadowed border around the progressmonitor - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ); - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ); - rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); - rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); + // paint shadowed border around the progressmonitor + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ); + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); - // Paint 3D-line - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ); - rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ); + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ); + rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); + rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ); - rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ); - } + // Paint 3D-line + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ); + rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ); + + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ); + rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ); } // private method @@ -761,19 +761,19 @@ void ProgressMonitor::impl_rebuildFixedText () } // Rebuild right site of text - if (m_xText_Bottom.is()) - { - OUStringBuffer aCollectString; + if (!m_xText_Bottom.is()) + return; - // Collect all topics from list and format text. - // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! - for (auto const & pSearchItem : maTextlist_Bottom) - { - aCollectString.append(pSearchItem->sText).append("\n"); - } + OUStringBuffer aCollectString; - m_xText_Bottom->setText ( aCollectString.makeStringAndClear() ); + // Collect all topics from list and format text. + // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! + for (auto const & pSearchItem : maTextlist_Bottom) + { + aCollectString.append(pSearchItem->sText).append("\n"); } + + m_xText_Bottom->setText ( aCollectString.makeStringAndClear() ); } // private method diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx index 9c70f92dcd88..3ce92b94ceed 100644 --- a/UnoControls/source/controls/statusindicator.cxx +++ b/UnoControls/source/controls/statusindicator.cxx @@ -364,35 +364,35 @@ void StatusIndicator::impl_paint ( sal_Int32 nX, sal_Int32 nY, const css::uno::R { // This paint method is not buffered! // Every request paint the completely control. (But only, if peer exist) - if ( rGraphics.is () ) - { - MutexGuard aGuard (m_aMutex); - - // background = gray - css::uno::Reference< XWindowPeer > xPeer( impl_getPeerWindow(), UNO_QUERY ); - if( xPeer.is() ) - xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); - - // FixedText background = gray - css::uno::Reference< XControl > xTextControl( m_xText, UNO_QUERY ); - xPeer = xTextControl->getPeer(); - if( xPeer.is() ) - xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); - - // Progress background = gray - xPeer = m_xProgressBar->getPeer(); - if( xPeer.is() ) - xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); - - // paint shadow border - rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_BRIGHT ); - rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); - rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); - - rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_SHADOW ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); - } + if ( !rGraphics.is () ) + return; + + MutexGuard aGuard (m_aMutex); + + // background = gray + css::uno::Reference< XWindowPeer > xPeer( impl_getPeerWindow(), UNO_QUERY ); + if( xPeer.is() ) + xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); + + // FixedText background = gray + css::uno::Reference< XControl > xTextControl( m_xText, UNO_QUERY ); + xPeer = xTextControl->getPeer(); + if( xPeer.is() ) + xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); + + // Progress background = gray + xPeer = m_xProgressBar->getPeer(); + if( xPeer.is() ) + xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); + + // paint shadow border + rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_BRIGHT ); + rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); + rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); + + rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_SHADOW ); + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); } // protected method |