27#include <com/sun/star/awt/XWindow2.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/frame/XLayoutManager2.hpp>
39#include <officecfg/Office/Common.hxx>
49 , m_bAllowReschedule (false)
50 , m_bAllowParentShow (false)
51 , m_bDisableReschedule(false)
62 if (lArguments.hasElements()) {
65 css::uno::Reference< css::frame::XFrame > xTmpFrame;
66 css::uno::Reference< css::awt::XWindow > xTmpWindow;
67 bool b1 = lArguments[0] >>= xTmpFrame;
68 bool b2 = lArguments[0] >>= xTmpWindow;
69 if (lArguments.getLength() == 3 && b1) {
74 }
else if (lArguments.getLength() == 3 && b2) {
108 const OUString& sText ,
111 css::uno::Reference< css::task::XStatusIndicator > xProgress;
114 std::scoped_lock aWriteLock(
m_mutex);
117 IndicatorStack::iterator pItem = ::std::find(
m_aStack.begin(),
m_aStack.end(), xChild);
131 xProgress->start(sText, nRange);
139 css::uno::Reference< css::task::XStatusIndicator > xActive;
140 css::uno::Reference< css::task::XStatusIndicator > xProgress;
143 std::scoped_lock aReadLock(
m_mutex);
146 IndicatorStack::iterator pItem = ::std::find(
m_aStack.begin(),
m_aStack.end(), xChild);
150 pItem->m_sText.clear();
161 (xChild == xActive) &&
171 css::uno::Reference< css::task::XStatusIndicator > xActive;
172 css::uno::Reference< css::task::XStatusIndicator > xProgress;
177 std::scoped_lock aWriteLock(
m_mutex);
180 IndicatorStack::iterator pItem = ::std::find(
m_aStack.begin(),
m_aStack.end(), xChild);
186 IndicatorStack::reverse_iterator pNext =
m_aStack.rbegin();
190 sText = pNext->m_sText;
205 xProgress->setText (sText );
206 xProgress->setValue(
nValue);
225 const OUString& sText )
227 css::uno::Reference< css::task::XStatusIndicator > xActive;
228 css::uno::Reference< css::task::XStatusIndicator > xProgress;
231 std::scoped_lock aWriteLock(
m_mutex);
233 IndicatorStack::iterator pItem = ::std::find(
m_aStack.begin(),
m_aStack.end(), xChild);
235 pItem->m_sText = sText;
245 (xChild == xActive) &&
249 xProgress->setText(sText);
258 sal_Int32 nOldValue = 0;
259 css::uno::Reference< css::task::XStatusIndicator > xActive;
260 css::uno::Reference< css::task::XStatusIndicator > xProgress;
263 std::scoped_lock aWriteLock(
m_mutex);
265 IndicatorStack::iterator pItem = ::std::find(
m_aStack.begin(),
m_aStack.end(), xChild);
268 nOldValue = pItem->m_nValue;
278 (xChild == xActive) &&
283 xProgress->setValue(
nValue);
291 css::uno::Reference< css::frame::XFrame >
xFrame;
292 css::uno::Reference< css::awt::XWindow > xPluggWindow;
293 css::uno::Reference< css::uno::XComponentContext > xContext;
296 std::scoped_lock aReadLock(
m_mutex);
307 css::uno::Reference< css::awt::XWindow > xParentWindow;
309 xParentWindow =
xFrame->getContainerWindow();
311 xParentWindow = xPluggWindow;
316 css::uno::Reference< css::awt::XWindow2 > xVisibleCheck(xParentWindow, css::uno::UNO_QUERY);
317 bool bIsVisible =
false;
318 if (xVisibleCheck.is())
319 bIsVisible = xVisibleCheck->isVisible();
329 css::uno::Reference< css::beans::XPropertySet > xPropSet(
xFrame, css::uno::UNO_QUERY);
332 css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
334 if (xLayoutManager.is())
336 if ( !xLayoutManager->isVisible() )
347 bool bHiddenDoc =
false;
350 css::uno::Reference< css::frame::XController >
xController;
351 css::uno::Reference< css::frame::XModel >
xModel;
358 bHiddenDoc = lDocArgs.getUnpackedValueOrDefault(
378 bool bForceFrontAndFocus(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get());
379 pWindow->Show(
true, bForceFrontAndFocus ? ShowFlags::ForegroundTask : ShowFlags::NONE );
386 css::uno::Reference< css::frame::XFrame >
xFrame;
387 css::uno::Reference< css::awt::XWindow > xWindow;
390 std::scoped_lock aReadLock(
m_mutex);
397 css::uno::Reference< css::task::XStatusIndicator > xProgress;
407 css::uno::Reference< css::beans::XPropertySet > xPropSet(
xFrame, css::uno::UNO_QUERY);
410 css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
412 if (xLayoutManager.is())
414 xLayoutManager->lock();
416 xLayoutManager->createElement( sPROGRESS_RESOURCE );
417 xLayoutManager->hideElement( sPROGRESS_RESOURCE );
419 css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(sPROGRESS_RESOURCE);
420 if (xProgressBar.is())
421 xProgress.set(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
422 xLayoutManager->unlock();
433 css::uno::Reference< css::frame::XFrame >
xFrame;
436 std::scoped_lock aReadLock(
m_mutex);
442 css::uno::Reference< css::task::XStatusIndicator > xProgress;
448 css::uno::Reference< css::beans::XPropertySet > xPropSet(
xFrame, css::uno::UNO_QUERY);
451 css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
453 if (xLayoutManager.is())
459 xLayoutManager->createElement( sPROGRESS_RESOURCE );
460 xLayoutManager->showElement( sPROGRESS_RESOURCE );
462 css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(sPROGRESS_RESOURCE);
463 if (xProgressBar.is())
464 xProgress.set(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
474 css::uno::Reference< css::frame::XFrame >
xFrame;
477 std::scoped_lock aReadLock(
m_mutex);
486 css::uno::Reference< css::beans::XPropertySet > xPropSet(
xFrame, css::uno::UNO_QUERY);
489 css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
491 if (xLayoutManager.is())
501 std::scoped_lock aReadLock(
m_mutex);
507 bool bReschedule = bForce;
518 static std::mutex rescheduleLock;
520 std::unique_lock aRescheduleGuard(rescheduleLock);
527 aRescheduleGuard.unlock();
536 aRescheduleGuard.lock();
569extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
571 css::uno::XComponentContext *context,
572 css::uno::Sequence<css::uno::Any>
const &)
static bool Reschedule(bool bHandleAllCurrentEvents=false)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
implement a factory service to create new status indicator objects
virtual void SAL_CALL update() override
void setText(const css::uno::Reference< css::task::XStatusIndicator > &xChild, const OUString &sText)
void impl_startWakeUpThread()
bool m_bDisableReschedule
enable/disable rescheduling.
bool m_bAllowReschedule
Our WakeUpThread calls us in our interface method "XUpdatable::update().
void end(const css::uno::Reference< css::task::XStatusIndicator > &xChild)
static sal_Int32 m_nInReschedule
prevent recursive calling of Application::Reschedule().
css::uno::Reference< css::task::XStatusIndicator > m_xActiveChild
most active indicator child, which could work with our shared indicator window only.
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &lArguments) override
IndicatorStack m_aStack
stack with all current indicator children.
void setValue(const css::uno::Reference< css::task::XStatusIndicator > &xChild, sal_Int32 nValue)
void start(const css::uno::Reference< css::task::XStatusIndicator > &xChild, const OUString &sText, sal_Int32 nRange)
StatusIndicatorFactory(css::uno::Reference< css::uno::XComponentContext > xContext)
void impl_reschedule(bool bForceUpdate)
try to "share the current thread in an intelligent manner" :-)
void impl_showProgress()
shows the internal used progress.
css::uno::WeakReference< css::frame::XFrame > m_xFrame
points to the frame, where we show the progress (in case m_xProgress points to a frame progress.
css::uno::Reference< css::task::XStatusIndicator > m_xProgress
used to show the progress on the frame (layouted!) or as a plugged vcl window.
virtual css::uno::Reference< css::task::XStatusIndicator > SAL_CALL createStatusIndicator() override
rtl::Reference< WakeUpThread > m_pWakeUp
Notify us if a fix time is over.
void implts_makeParentVisibleIfAllowed()
show the parent window of this progress ... if it's allowed to do so.
void impl_stopWakeUpThread()
void impl_createProgress()
creates a new internal used progress.
css::uno::WeakReference< css::awt::XWindow > m_xPluggWindow
points to an outside window, where we show the progress (in case we are plugged into such window).
void impl_hideProgress()
hides the internal used progress.
void reset(const css::uno::Reference< css::task::XStatusIndicator > &xChild)
bool m_bAllowParentShow
enable/disable automatic showing of our parent window.
css::uno::Reference< css::uno::XComponentContext > m_xContext
uno service manager to create own needed uno resources.
virtual ~StatusIndicatorFactory() override
implement a status indicator object
css::uno::Reference< css::uno::XComponentContext > m_xContext
constexpr OUStringLiteral PROGRESS_RESOURCE
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_LAYOUTMANAGER
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
@descr This struct hold some information about all currently running progress processes.
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel