From 73005868eed0fe2c59bdc115f7f5af89411a4dbe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 12:32:21 +0100 Subject: autorecovery: explicitly specify 'Hidden' when recovering documents, and remove the hack of not showing a frame when there is a 'SalvagedFile' item in the load args --- framework/source/loadenv/loadenv.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'framework/source/loadenv') diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index ee39e583e5e7..911a0430763f 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1629,7 +1629,6 @@ void LoadEnv::impl_reactForLoadingState() // We dont hide already visible frames here ... css::uno::Reference< css::awt::XWindow > xWindow = m_xTargetFrame->getContainerWindow(); sal_Bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN(), sal_False); - sal_Bool bRecovered = (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()) != m_lMediaDescriptor.end()); sal_Bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_MINIMIZED(), sal_False); if (bMinimized) @@ -1641,7 +1640,7 @@ void LoadEnv::impl_reactForLoadingState() ((WorkWindow*)pWindow)->Minimize(); } else - if (!bHidden && !bRecovered) + if (!bHidden) { // show frame ... if it's not still visible ... // But do nothing if it's already visible! @@ -1750,18 +1749,18 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X Window* pWindow = VCLUnoHelper::GetWindow(xWindow); if ( pWindow ) { - bool bForceFrontAndFocus(false); - css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey( - xSMGR, - ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"), - ::rtl::OUString::createFromAscii("NewDocumentHandling"), - ::rtl::OUString::createFromAscii("ForceFocusAndToFront"), - ::comphelper::ConfigurationHelper::E_READONLY); + bool bForceFrontAndFocus(false); + css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey( + xSMGR, + ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"), + ::rtl::OUString::createFromAscii("NewDocumentHandling"), + ::rtl::OUString::createFromAscii("ForceFocusAndToFront"), + ::comphelper::ConfigurationHelper::E_READONLY); a >>= bForceFrontAndFocus; pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 ); } - + /* #i19976# We tried to prevent a toFront() call in case the user putted the loading document into the background .. -- cgit From eafba820349005ea5426cab58911f9ff99969966 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 5 Jan 2010 22:32:38 +0100 Subject: autorecovery: define a new css.document.XDocumentRecovery interface, implement it in both SFX and DBACCESS, and use it in the autorecovery In this course, the auto recovery learned to restore multiple views of a document. Also, in the course of the change, the LoadDispatchListener became superfluous, and was removed. Also, the loader code in dbaccess was slightly adjusted, since now the connectController call is in the responsibility of the loader, and must not happen inside the XController::attachModel call anymore. This change made the ModelControllerConnector class superfluous, so it has been removed, too. --- framework/source/loadenv/loaddispatchlistener.cxx | 144 ---------------------- framework/source/loadenv/makefile.mk | 1 - 2 files changed, 145 deletions(-) delete mode 100644 framework/source/loadenv/loaddispatchlistener.cxx (limited to 'framework/source/loadenv') diff --git a/framework/source/loadenv/loaddispatchlistener.cxx b/framework/source/loadenv/loaddispatchlistener.cxx deleted file mode 100644 index ca9e5118f582..000000000000 --- a/framework/source/loadenv/loaddispatchlistener.cxx +++ /dev/null @@ -1,144 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: loaddispatchlistener.cxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_______________________________________________ -// includes of own project -#include -#include -#include - -//_______________________________________________ -// includes of uno interface -#include - -//_______________________________________________ -// includes of an other project -#include - -//_______________________________________________ -// namespace - -namespace framework{ - -// may there exist already a define .-( -#ifndef css -namespace css = ::com::sun::star; -#endif - -//_______________________________________________ -// declarations - -//----------------------------------------------- -DEFINE_XINTERFACE_2(LoadDispatchListener , - OWeakObject , - DIRECT_INTERFACE (css::frame::XDispatchResultListener ), - DERIVED_INTERFACE(css::lang::XEventListener, css::frame::XDispatchResultListener)) - -//----------------------------------------------- -LoadDispatchListener::LoadDispatchListener() - : ThreadHelpBase(&Application::GetSolarMutex()) -{ - // reset the condition object - so our user can wait there. - m_aUserWait.reset(); - // set defined state for our result value - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); -} - -//----------------------------------------------- -LoadDispatchListener::~LoadDispatchListener() -{ -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::dispatchFinished(const css::frame::DispatchResultEvent& aEvent) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult = aEvent; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::disposing(const css::lang::EventObject&) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void LoadDispatchListener::setURL(const ::rtl::OUString & sURL) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_sURL = sURL; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- -} - -//----------------------------------------------- -sal_Bool LoadDispatchListener::wait(sal_Int32 /*nWait_ms*/) -{ - // Wait till an event occures - m_aUserWait.wait(0); - // reset the condition, so this method can be called again. - // Of course a new action has to be started outside too! - m_aUserWait.reset(); - - // TODO implement real timeout :-) - return sal_True; -} - -//----------------------------------------------- -css::frame::DispatchResultEvent LoadDispatchListener::getResult() const -{ - // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); - return m_aResult; - // <- SAFE ---------------------------------- -} - -} // namespace framework diff --git a/framework/source/loadenv/makefile.mk b/framework/source/loadenv/makefile.mk index e0fa0940f5eb..105cc92c78ab 100644 --- a/framework/source/loadenv/makefile.mk +++ b/framework/source/loadenv/makefile.mk @@ -42,7 +42,6 @@ ENABLE_EXCEPTIONS= TRUE SLOFILES= \ $(SLO)$/loadenv.obj \ - $(SLO)$/loaddispatchlistener.obj \ $(SLO)$/targethelper.obj # --- Targets ------------------------------------------------------ -- cgit From 3b2321d5120d8c9d654120312819bf1459941a20 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 14:14:21 +0100 Subject: autorecovery: only include documents in the autorecovery which support the XDocumentRecovery interface --- framework/source/loadenv/loadenv.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'framework/source/loadenv') diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 911a0430763f..8fbe1dc6cb7b 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -821,7 +821,7 @@ void LoadEnv::impl_detectTypeAndFilter() // Attention: Because our stl media descriptor is a copy of an uno sequence // we cant use as an in/out parameter here. Copy it before and dont forget to - // actualize structure afterwards again! + // update structure afterwards again! css::uno::Sequence< css::beans::PropertyValue > lDescriptor = m_lMediaDescriptor.getAsConstPropertyValueList(); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; -- cgit From d69335c9383d953d27f56d8dbde3c0982faa70ca Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 22 Jan 2010 22:22:41 +0100 Subject: autorecovery: preserve the complete exception when throwing the LoadEnvException, not only the css.uno.Exception base info --- framework/source/loadenv/loadenv.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'framework/source/loadenv') diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 2cf0ef38918f..e7910f417a3c 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1725,9 +1725,8 @@ void LoadEnv::impl_reactForLoadingState() if (bThrow) { - css::uno::Exception aEx; - if ( aRequest >>= aEx ) - throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aEx ); + if ( aRequest.isExtractableTo( ::cppu::UnoType< css::uno::Exception >::get() ) ) + throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aRequest ); } // <- SAFE ---------------------------------- -- cgit From c0899590afa6bda70e18ac68a831bd6210bac45a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 22 Jan 2010 22:46:39 +0100 Subject: autorecovery: since the AR service does not use the LoadEnv anymore, it needs to care for some media descriptor defaults (like for MacroExecutionMode) itself --- framework/source/loadenv/loadenv.cxx | 60 ++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 20 deletions(-) (limited to 'framework/source/loadenv') diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index e7910f417a3c..fb6d522b69d1 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -324,22 +324,41 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& /*TODO progress is bound to a frame ... How can we set it here? */ + // UI mode + const bool bUIMode = + ( ( m_eFeature & E_WORK_WITH_UI ) == E_WORK_WITH_UI ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False ) == sal_False ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False ) == sal_False ); + + initializeUIDefaults( + m_xSMGR, + m_lMediaDescriptor, + bUIMode, + &m_pQuietInteraction + ); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +/*----------------------------------------------- + 22.01.2010 +-----------------------------------------------*/ +void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + ::comphelper::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode, + QuietInteraction** o_ppQuietInteraction ) +{ css::uno::Reference< css::task::XInteractionHandler > xInteractionHandler; sal_Int16 nMacroMode ; sal_Int16 nUpdateMode ; - // UI mode - if ( - ((m_eFeature & E_WORK_WITH_UI) == E_WORK_WITH_UI) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False) == sal_False ) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False) == sal_False ) - ) + if ( i_bUIMode ) { nMacroMode = css::document::MacroExecMode::USE_CONFIG; nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG; try { - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(m_xSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(i_rSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); } catch(const css::uno::RuntimeException&) {throw;} catch(const css::uno::Exception& ) { } @@ -349,27 +368,28 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& { nMacroMode = css::document::MacroExecMode::NEVER_EXECUTE; nUpdateMode = css::document::UpdateDocMode::NO_UPDATE; - m_pQuietInteraction = new QuietInteraction(); - m_pQuietInteraction->acquire(); - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(m_pQuietInteraction), css::uno::UNO_QUERY); + QuietInteraction* pQuietInteraction = new QuietInteraction(); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(pQuietInteraction), css::uno::UNO_QUERY); + if ( o_ppQuietInteraction != NULL ) + { + *o_ppQuietInteraction = pQuietInteraction; + (*o_ppQuietInteraction)->acquire(); + } } if ( - (xInteractionHandler.is() ) && - (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == m_lMediaDescriptor.end()) + (xInteractionHandler.is() ) && + (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == io_lMediaDescriptor.end()) ) { - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; } - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; } /*----------------------------------------------- -- cgit