summaryrefslogtreecommitdiff
path: root/framework/source/helper
diff options
context:
space:
mode:
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