summaryrefslogtreecommitdiff
path: root/framework/source/loadenv
diff options
context:
space:
mode:
Diffstat (limited to 'framework/source/loadenv')
-rw-r--r--framework/source/loadenv/loaddispatchlistener.cxx141
-rw-r--r--framework/source/loadenv/loadenv.cxx70
-rw-r--r--framework/source/loadenv/makefile.mk1
3 files changed, 44 insertions, 168 deletions
diff --git a/framework/source/loadenv/loaddispatchlistener.cxx b/framework/source/loadenv/loaddispatchlistener.cxx
deleted file mode 100644
index e0cce20c8758..000000000000
--- a/framework/source/loadenv/loaddispatchlistener.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * 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 <loadenv/loaddispatchlistener.hxx>
-#include <threadhelp/writeguard.hxx>
-#include <threadhelp/readguard.hxx>
-
-//_______________________________________________
-// includes of uno interface
-#include <com/sun/star/frame/DispatchResultState.hpp>
-
-//_______________________________________________
-// includes of an other project
-#include <vcl/svapp.hxx>
-
-//_______________________________________________
-// 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/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index c1d76d6f8985..b9f1d2c8a09a 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -321,22 +321,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& ) { }
@@ -346,27 +365,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;
}
/*-----------------------------------------------
@@ -818,7 +838,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;
@@ -1626,7 +1646,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)
@@ -1638,7 +1657,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!
@@ -1723,9 +1742,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 ----------------------------------
diff --git a/framework/source/loadenv/makefile.mk b/framework/source/loadenv/makefile.mk
index fead332b0678..c68ad8d304cb 100644
--- a/framework/source/loadenv/makefile.mk
+++ b/framework/source/loadenv/makefile.mk
@@ -38,7 +38,6 @@ ENABLE_EXCEPTIONS= TRUE
SLOFILES= \
$(SLO)$/loadenv.obj \
- $(SLO)$/loaddispatchlistener.obj \
$(SLO)$/targethelper.obj
# --- Targets ------------------------------------------------------