summaryrefslogtreecommitdiff
path: root/framework/source/helper
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-05-06 16:18:42 +0300
committerTor Lillqvist <tml@collabora.com>2015-05-06 17:55:58 +0300
commita00cd9025b017c86431db17ca7076f7434462fd7 (patch)
tree781335898b0a25691959ae272d448603c6d677cf /framework/source/helper
parent44724236a014072a5a5012a9e77fb9d2a903fe1d (diff)
Add support for progress bar callbacks to LibreOfficeKit clients
The framework bits. Change-Id: I9cbd649c7766284bfcf8846d2b5e129dd2731ee8
Diffstat (limited to 'framework/source/helper')
-rw-r--r--framework/source/helper/statusindicator.cxx52
1 files changed, 34 insertions, 18 deletions
diff --git a/framework/source/helper/statusindicator.cxx b/framework/source/helper/statusindicator.cxx
index 307adcf24ff1..fc5ae8b3ed35 100644
--- a/framework/source/helper/statusindicator.cxx
+++ b/framework/source/helper/statusindicator.cxx
@@ -19,6 +19,7 @@
#include <config_features.h>
+#include <comphelper/lok.hxx>
#include <helper/statusindicator.hxx>
namespace framework{
@@ -33,76 +34,91 @@ StatusIndicator::~StatusIndicator()
}
void SAL_CALL StatusIndicator::start(const OUString& sText ,
- sal_Int32 nRange)
+ sal_Int32 nRange)
throw(css::uno::RuntimeException, std::exception)
{
-#if !HAVE_FEATURE_DESKTOP
- (void) sText;
- (void) nRange;
-#else
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ m_nRange = nRange;
+ m_nLastCallbackPercent = -1;
+
+ comphelper::LibreOfficeKit::statusIndicatorStart();
+ return;
+ }
+
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
if (xFactory.is())
{
StatusIndicatorFactory* pFactory = static_cast<StatusIndicatorFactory*>(xFactory.get());
pFactory->start(this, sText, nRange);
}
-#endif
}
void SAL_CALL StatusIndicator::end()
throw(css::uno::RuntimeException, std::exception)
{
-#if HAVE_FEATURE_DESKTOP
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ comphelper::LibreOfficeKit::statusIndicatorFinish();
+ return;
+ }
+
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
if (xFactory.is())
{
StatusIndicatorFactory* pFactory = static_cast<StatusIndicatorFactory*>(xFactory.get());
pFactory->end(this);
}
-#endif
}
void SAL_CALL StatusIndicator::reset()
throw(css::uno::RuntimeException, std::exception)
{
-#if HAVE_FEATURE_DESKTOP
+ if (comphelper::LibreOfficeKit::isActive())
+ return;
+
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
if (xFactory.is())
{
StatusIndicatorFactory* pFactory = static_cast<StatusIndicatorFactory*>(xFactory.get());
pFactory->reset(this);
}
-#endif
}
void SAL_CALL StatusIndicator::setText(const OUString& sText)
throw(css::uno::RuntimeException, std::exception)
{
-#if !HAVE_FEATURE_DESKTOP
- (void) sText;
-#else
+ if (comphelper::LibreOfficeKit::isActive())
+ return;
+
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
if (xFactory.is())
{
StatusIndicatorFactory* pFactory = static_cast<StatusIndicatorFactory*>(xFactory.get());
pFactory->setText(this, sText);
}
-#endif
}
void SAL_CALL StatusIndicator::setValue(sal_Int32 nValue)
throw(css::uno::RuntimeException, std::exception)
{
-#if !HAVE_FEATURE_DESKTOP
- (void) nValue;
-#else
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ int nPercent = (100*nValue)/m_nRange;
+ if (nPercent > m_nLastCallbackPercent)
+ {
+ comphelper::LibreOfficeKit::statusIndicatorSetValue(nPercent);
+ m_nLastCallbackPercent = nPercent;
+ }
+ return;
+ }
+
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
if (xFactory.is())
{
StatusIndicatorFactory* pFactory = static_cast<StatusIndicatorFactory*>(xFactory.get());
pFactory->setValue(this, nValue);
}
-#endif
}
} // namespace framework