/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// create new info structure for this child or move it to the front of our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); if (pItem != m_aStack.end())
m_aStack.erase(pItem);
IndicatorInfo aInfo(xChild, sText);
m_aStack.push_back (aInfo );
// reset the internal info structure related to this child
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); if (pItem != m_aStack.end())
{
pItem->m_nValue = 0;
pItem->m_sText.clear();
}
// remove this child from our stack
IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild); if (pItem != m_aStack.end())
m_aStack.erase(pItem);
// activate next child ... or finish the progress if there is no further one.
m_xActiveChild.clear();
IndicatorStack::reverse_iterator pNext = m_aStack.rbegin(); if (pNext != m_aStack.rend())
{
m_xActiveChild = pNext->m_xIndicator;
sText = pNext->m_sText;
nValue = pNext->m_nValue;
}
if (xActive.is())
{ // There is at least one further child indicator. // Actualize our progress, so it shows these values from now. if (xProgress.is())
{
xProgress->setText (sText );
xProgress->setValue(nValue);
}
} else
{ // Our stack is empty. No further child exists. // Se we must "end" our progress really if (xProgress.is())
xProgress->end(); // Now hide the progress bar again.
impl_hideProgress();
// don't disturb user in case he put the loading document into the background! // Suppress any setVisible() or toFront() call in case the initial show was // already made.
css::uno::Reference< css::awt::XWindow2 > xVisibleCheck(xParentWindow, css::uno::UNO_QUERY); bool bIsVisible = false; if (xVisibleCheck.is())
bIsVisible = xVisibleCheck->isVisible();
if (bIsVisible)
{
impl_showProgress(); return;
}
// Check if the layout manager has been set to invisible state. It this case we are also // not allowed to set the frame visible!
css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY); if (xPropSet.is())
{
css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
xPropSet->getPropertyValue(FRAME_PROPNAME_ASCII_LAYOUTMANAGER) >>= xLayoutManager; if (xLayoutManager.is())
{ if ( !xLayoutManager->isVisible() ) return;
}
}
// Ok the window should be made visible... because it is not currently visible. // BUT..! // We need a Hack for our applications: They get her progress from the frame directly // on saving documents. Because there is no progress set on the MediaDescriptor. // But that's wrong. In case the document was opened hidden, they should not use any progress .-( // They only possible workaround: don't show the parent window here, if the document was opened hidden. bool bHiddenDoc = false; if (xFrame.is())
{
css::uno::Reference< css::frame::XController > xController;
css::uno::Reference< css::frame::XModel > xModel;
xController = xFrame->getController(); if (xController.is())
xModel = xController->getModel(); if (xModel.is())
{
utl::MediaDescriptor lDocArgs(xModel->getArgs());
bHiddenDoc = lDocArgs.getUnpackedValueOrDefault(
utl::MediaDescriptor::PROP_HIDDEN, false);
}
}
if (bHiddenDoc) return;
// OK: The document was not opened in hidden mode ... // and the window isn't already visible. // Show it and bring it to front. // But before we have to be sure, that our internal used helper progress // is visible too.
impl_showProgress();
// use frame layouted progress implementation
css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY); if (xPropSet.is())
{
css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
xPropSet->getPropertyValue(FRAME_PROPNAME_ASCII_LAYOUTMANAGER) >>= xLayoutManager; if (xLayoutManager.is())
{ // Be sure that we have always a progress. It can be that our frame // was recycled and therefore the progress was destroyed! // CreateElement does nothing if there is already a valid progress.
OUString sPROGRESS_RESOURCE(PROGRESS_RESOURCE);
xLayoutManager->createElement( sPROGRESS_RESOURCE );
xLayoutManager->showElement( sPROGRESS_RESOURCE );
// coverity[missing_lock: FALSE] - coverity fails to see the aRescheduleGuard ctor as taking a lock
++m_nInReschedule;
aRescheduleGuard.unlock(); // <- SAFE
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.