summaryrefslogtreecommitdiff
path: root/UnoControls/source/controls/progressmonitor.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-02 20:09:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-02 22:45:48 +0200
commit33abb535a753b710e439b66ccc67e826f49f6275 (patch)
treecd59068e6bcdba67a4f1dcd7c73c1806662771db /UnoControls/source/controls/progressmonitor.cxx
parente2644b014005e1c79b0a7eaf1c3c4002464a1cf0 (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/controls/progressmonitor.cxx')
-rw-r--r--UnoControls/source/controls/progressmonitor.cxx106
1 files changed, 53 insertions, 53 deletions
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