Kaydet (Commit) cec72eff authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Don't bother ensuring progress bar LibreOfficeKit callbacks are monotonical

It can well be that the StatusIndicator code is called for multiple
independent sections while loading some document format, and that the first
progress is not the one that actually takes much time at all, so following
just the progress of that would be misleading, the progress would be "stuck"
at the highest value set by the first progress (forever, if it has gone up to
100%).

For example, when loading the odk/examples/java/DocumentHandling/
test/test1.odt sample document, the code first calls the StatusIndicator while
parsing the styles.xml, going from 0% to 100%. But the styles.xml is typically
rather small. Then the code calls the StatusIndicator *again* while parsing
the much more relevant concent.xml. For that particular document, this time
the progress goes from 0% to 27% only, for some reason. Oh well, GIGO.

Change-Id: I87bfc586a53efcbeb94924f21dd365ca63da88d7
üst 951c986d
......@@ -69,8 +69,6 @@ class StatusIndicator : public ::cppu::WeakImplHelper1< css::task::XStatusIndic
css::uno::WeakReference< css::task::XStatusIndicatorFactory > m_xFactory;
sal_Int32 m_nRange;
// We want the callback percentages to increase monotonically
int m_nLastCallbackPercent;
// c++ interface
public:
......
......@@ -38,7 +38,6 @@ void SAL_CALL StatusIndicator::start(const OUString& sText ,
if (comphelper::LibreOfficeKit::isActive())
{
m_nRange = nRange;
m_nLastCallbackPercent = -1;
comphelper::LibreOfficeKit::statusIndicatorStart();
return;
......@@ -103,11 +102,7 @@ void SAL_CALL StatusIndicator::setValue(sal_Int32 nValue)
if (comphelper::LibreOfficeKit::isActive())
{
int nPercent = (100*nValue)/m_nRange;
if (nPercent > m_nLastCallbackPercent)
{
comphelper::LibreOfficeKit::statusIndicatorSetValue(nPercent);
m_nLastCallbackPercent = nPercent;
}
comphelper::LibreOfficeKit::statusIndicatorSetValue(nPercent);
return;
}
......
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