LibreOffice Module framework (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
framework::LoadEnv Class Reference

implements general mechanism for loading documents. More...

#include <loadenv.hxx>

Collaboration diagram for framework::LoadEnv:
[legend]

Public Types

enum  EContentType {
  E_UNSUPPORTED_CONTENT ,
  E_CAN_BE_HANDLED ,
  E_CAN_BE_LOADED ,
  E_CAN_BE_SET
}
 classify a content. More...
 

Public Member Functions

 LoadEnv (css::uno::Reference< css::uno::XComponentContext > xContext)
 initialize a new instance of this load environment. More...
 
 ~LoadEnv ()
 deinitialize an instance of this class in the right way. More...
 
void startLoading (const OUString &sURL, const css::uno::Sequence< css::beans::PropertyValue > &lMediaDescriptor, const css::uno::Reference< css::frame::XFrame > &xBaseFrame, const OUString &sTarget, sal_Int32 nSearchFlags, LoadEnvFeatures eFeature=LoadEnvFeatures::NONE)
 start loading of a resource More...
 
bool waitWhileLoading (sal_uInt32 nTimeout=0)
 wait for an already running load request (started by calling startLoading() before). More...
 
css::uno::Reference< css::lang::XComponent > getTargetComponent () const
 TODO document me ... More...
 
void impl_setResult (bool bResult)
 TODO document me ... More...
 
css::uno::Reference< css::uno::XInterface > impl_searchLoader ()
 TODO document me ... More...
 
void impl_reactForLoadingState ()
 it means; show the frame, bring it to front, might set the right icon etcpp. More...
 

Static Public Member Functions

static css::uno::Reference< css::lang::XComponent > loadComponentFromURL (const css::uno::Reference< css::frame::XComponentLoader > &xLoader, const css::uno::Reference< css::uno::XComponentContext > &xContext, const OUString &sURL, const OUString &sTarget, sal_Int32 nFlags, const css::uno::Sequence< css::beans::PropertyValue > &lArgs)
 
static EContentType classifyContent (const OUString &sURL, const css::uno::Sequence< css::beans::PropertyValue > &lMediaDescriptor)
 checks if the specified content can be handled by a ContentHandler only and is not related to a target frame, or if it can be loaded by a FrameLoader into a target frame as "visible" component. More...
 
static void initializeUIDefaults (const css::uno::Reference< css::uno::XComponentContext > &i_rxContext, utl::MediaDescriptor &io_lMediaDescriptor, const bool _bUIMode, rtl::Reference< QuietInteraction > *o_ppQuiteInteraction)
 TODO document me ... More...
 

Private Member Functions

void start ()
 
void impl_detectTypeAndFilter ()
 tries to detect the type and the filter of the specified content. More...
 
bool impl_handleContent ()
 tries to use ContentHandler objects for loading. More...
 
bool impl_loadContent ()
 tries to use FrameLoader objects for loading. More...
 
css::uno::Reference< css::frame::XFrame > impl_searchAlreadyLoaded ()
 checks if the specified content is already loaded. More...
 
css::uno::Reference< css::frame::XFrame > impl_searchRecycleTarget ()
 search for any target frame, which seems to be usable for this load request. More...
 
void impl_makeFrameWindowVisible (const css::uno::Reference< css::awt::XWindow > &xWindow, bool bForceToFront)
 because showing of a frame is needed more than once... it's implemented as a separate method . More...
 
bool impl_isFrameAlreadyUsedForLoading (const css::uno::Reference< css::frame::XFrame > &xFrame) const
 checks whether a frame is already used for another load request or not. More...
 
void impl_applyPersistentWindowState (const css::uno::Reference< css::awt::XWindow > &xWindow)
 try to determine the used application module of this load request and apply right position and size for this document window... hopefully before we show it . More...
 
bool impl_furtherDocsAllowed ()
 determine if it's allowed to open new document frames. More...
 
void impl_jumpToMark (const css::uno::Reference< css::frame::XFrame > &xFrame, const css::util::URL &aURL)
 jumps to the requested bookmark inside a given document. More...
 
bool impl_filterHasInteractiveDialog () const
 determine if this loader has an interactive dialog shown before loading the document. More...
 
bool shouldFocusAndToFront () const
 checks if this should bring to front and get focus on load, according to user settings and to the load flags. More...
 

Private Attributes

osl::Mutex m_mutex
 
css::uno::Reference< css::uno::XComponentContext > m_xContext
 reference to a uno service manager, which must be used to created on needed services on demand. More...
 
css::uno::Reference< css::frame::XFrame > m_xBaseFrame
 points to the frame, which uses this LoadEnv object and must be used to start target search there. More...
 
css::uno::Reference< css::frame::XFrame > m_xTargetFrame
 points to the frame, into which the new component was loaded. More...
 
OUString m_sTarget
 contains the name of the target, in which the specified resource of this instance must be loaded. More...
 
sal_Int32 m_nSearchFlags
 if m_sTarget is not a special one, this flags regulate searching of a suitable one. More...
 
utl::MediaDescriptor m_lMediaDescriptor
 contains all needed information about the resource, which should be loaded. More...
 
css::util::URL m_aURL
 because the mediadescriptor contains the complete URL ... but some functionality need the structured version, we hold it twice :-(. More...
 
LoadEnvFeatures m_eFeature
 enable/disable special features of a load request. More...
 
EContentType m_eContentType
 classify the content, which should be loaded by this instance. More...
 
bool m_bCloseFrameOnError
 it indicates, that the member m_xTargetFrame was new created for this load request and must be closed in case loading (not handling!) operation failed. More...
 
bool m_bReactivateControllerOnError
 it indicates, that the old document (which was located inside m_xBaseFrame in combination with the m_sTarget value "_self") was suspended. More...
 
css::uno::Reference< css::uno::XInterface > m_xAsynchronousJob
 it holds one (!) asynchronous used contenthandler or frameloader alive, till the asynchronous operation will be finished. More...
 
bool m_bLoaded
 holds the information about the finished load process. More...
 
bool m_bFocusedAndToFront = false
 If we already brought it to front; do not do that again (the user could switch elsewhere after the first activation, and we shouldn't nag them again). More...
 
ActionLockGuard m_aTargetLock
 holds an XActionLock on the internal used task member. More...
 
rtl::Reference< QuietInteractionm_pQuietInteraction
 

Detailed Description

implements general mechanism for loading documents.

@descr An instance of this class can be used inside the API calls XComponentLoader::loadComponentFromURL() and XDispatch::dispatch().

Definition at line 67 of file loadenv.hxx.

Member Enumeration Documentation

◆ EContentType

classify a content.

@descr The load environment must know, if a content is related to a target frame or not. Only "visible" components, which fulfill the requirements of the model-controller-view paradigm can be loaded into a frame. Such contents are classified as E_CAN_BE_LOADED.

But e.g. for the dispatch framework exists special ContentHandler objects, which can load a content in "non visible" mode ... and do not need a target frame for its operation. Such ContentHandler e.g. plays sounds. Such contents are classified as E_CAN_BE_HANDLED.

And last but not least a content can be "not valid" in general.

Enumerator
E_UNSUPPORTED_CONTENT 

identifies a content, which seems to be invalid in general

E_CAN_BE_HANDLED 

identifies a content, which can be used with a ContentHandler and is not related to a target frame

E_CAN_BE_LOADED 

identifies a content, which can be loaded into a target frame

E_CAN_BE_SET 

special mode for non real loading, In such case the model is given directly!

Definition at line 86 of file loadenv.hxx.

Constructor & Destructor Documentation

◆ LoadEnv()

framework::LoadEnv::LoadEnv ( css::uno::Reference< css::uno::XComponentContext >  xContext)

initialize a new instance of this load environment.

Parameters
xContextreference to a uno service manager, which can be used internally to create on needed services on demand.
Exceptions
Currentlythere is no reason to throw such exception!
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 134 of file loadenv.cxx.

References NONE.

◆ ~LoadEnv()

framework::LoadEnv::~LoadEnv ( )

deinitialize an instance of this class in the right way.

Definition at line 145 of file loadenv.cxx.

Member Function Documentation

◆ classifyContent()

LoadEnv::EContentType framework::LoadEnv::classifyContent ( const OUString &  sURL,
const css::uno::Sequence< css::beans::PropertyValue > &  lMediaDescriptor 
)
static

checks if the specified content can be handled by a ContentHandler only and is not related to a target frame, or if it can be loaded by a FrameLoader into a target frame as "visible" component.

@descr using: switch(classifyContent(...)) { case E_CAN_BE_HANDLED : handleIt(...); break;

case E_CAN_BE_LOADED : xFrame = locateTargetFrame(); loadIt(xFrame); break;

case E_NOT_A_CONTENT : default : throw ...; }

Parameters
sURLdescribe the content.
lMediaDescriptordescribe the content more detailed!
Returns
A suitable enum value, which classify the specified content.

Definition at line 544 of file loadenv.cxx.

References E_CAN_BE_HANDLED, E_CAN_BE_LOADED, E_CAN_BE_SET, E_UNSUPPORTED_CONTENT, framework::ProtocolCheck::isProtocol(), framework::Macro, framework::MailTo, framework::News, framework::PrivateFactory, framework::PrivateObject, framework::PrivateStream, utl::MediaDescriptor::PROP_INPUTSTREAM, utl::MediaDescriptor::PROP_MODEL, PROP_TYPES, SAL_INFO, framework::Service, framework::Slot, sType, framework::Uno, xModel, and xStream.

Referenced by framework::DispatchProvider::implts_isLoadableContent(), and startLoading().

◆ getTargetComponent()

css::uno::Reference< css::lang::XComponent > framework::LoadEnv::getTargetComponent ( ) const

TODO document me ...

Definition at line 460 of file loadenv.cxx.

References m_mutex, m_xTargetFrame, xController, and xModel.

Referenced by framework::LoadDispatcher::impl_dispatch(), and loadComponentFromURL().

◆ impl_applyPersistentWindowState()

void framework::LoadEnv::impl_applyPersistentWindowState ( const css::uno::Reference< css::awt::XWindow > &  xWindow)
private

◆ impl_detectTypeAndFilter()

void framework::LoadEnv::impl_detectTypeAndFilter ( )
private

tries to detect the type and the filter of the specified content.

@descr This method update the available media descriptor of this instance, so it contains the right type, a corresponding filter, may a valid frame loader etc. In case detection failed, this descriptor is corrected first, before a suitable exception will be thrown. (Excepting a RuntimeException occurrence!)

Attention: \n Not all types we know, are supported by filters. So it does not
indicates an error, if no suitable filter(loader etcpp will be found for a type. But a type must be detected for the specified content. Otherwise it's an error and loading can't be finished successfully.
Exceptions
ALoadEnvException if detection failed.
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 737 of file loadenv.cxx.

References comphelper::SequenceAsHashMap::getUnpackedValueOrDefault(), framework::LoadEnvException::ID_UNSUPPORTED_CONTENT, m_lMediaDescriptor, m_mutex, m_xContext, utl::MediaDescriptor::PROP_ABORTED, utl::MediaDescriptor::PROP_ASTEMPLATE, utl::MediaDescriptor::PROP_DOCUMENTSERVICE, utl::MediaDescriptor::PROP_FILTERNAME, utl::MediaDescriptor::PROP_FILTERPROVIDER, utl::MediaDescriptor::PROP_TYPENAME, framework::SERVICENAME_FILTERFACTORY, and sType.

Referenced by start().

◆ impl_filterHasInteractiveDialog()

bool framework::LoadEnv::impl_filterHasInteractiveDialog ( ) const
private

determine if this loader has an interactive dialog shown before loading the document.

Definition at line 991 of file loadenv.cxx.

References comphelper::SequenceAsHashMap::getUnpackedValueOrDefault(), m_aURL, m_lMediaDescriptor, m_xContext, utl::MediaDescriptor::PROP_FILTERNAME, and framework::SERVICENAME_FILTERFACTORY.

Referenced by impl_loadContent().

◆ impl_furtherDocsAllowed()

bool framework::LoadEnv::impl_furtherDocsAllowed ( )
private

◆ impl_handleContent()

bool framework::LoadEnv::impl_handleContent ( )
private

tries to use ContentHandler objects for loading.

@descr It searches for a suitable content handler object, registered for the detected content type (must be done before by calling impl_detectTypeAndFilter()). Because such handler does not depend from a real target frame, location of such frame will be suppressed here. In case handle failed all new created resources will be removed before a suitable exception is thrown. (Excepting a RuntimeException occurrence!)

Returns
TODO
Exceptions
ALoadEnvException if handling failed.
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 862 of file loadenv.cxx.

References aURL, comphelper::SequenceAsHashMap::getUnpackedValueOrDefault(), framework::LoadEnvException::ID_INVALID_MEDIADESCRIPTOR, m_aURL, m_lMediaDescriptor, m_mutex, m_xAsynchronousJob, m_xContext, PROP_NAME, utl::MediaDescriptor::PROP_TYPENAME, PROP_TYPES, and sType.

Referenced by start().

◆ impl_isFrameAlreadyUsedForLoading()

bool framework::LoadEnv::impl_isFrameAlreadyUsedForLoading ( const css::uno::Reference< css::frame::XFrame > &  xFrame) const
private

checks whether a frame is already used for another load request or not.

@descr Such frames can't be used for our "recycle feature"!

Parameters
xFramethe frame, which should be checked.
Returns
[sal_Bool] sal_True if this frame is already used for loading, sal_False otherwise.

Definition at line 1436 of file loadenv.cxx.

References xFrame.

Referenced by impl_searchRecycleTarget().

◆ impl_jumpToMark()

void framework::LoadEnv::impl_jumpToMark ( const css::uno::Reference< css::frame::XFrame > &  xFrame,
const css::util::URL &  aURL 
)
private

jumps to the requested bookmark inside a given document.

Definition at line 1251 of file loadenv.cxx.

References aURL, comphelper::SequenceAsHashMap::getAsConstPropertyValueList(), m_mutex, m_xContext, framework::SPECIALTARGET_SELF, and xFrame.

Referenced by impl_searchAlreadyLoaded().

◆ impl_loadContent()

bool framework::LoadEnv::impl_loadContent ( )
private

tries to use FrameLoader objects for loading.

@descr First the target frame will be located. If it could be found or new created a filter/frame loader will be instantiated and used to load the content into this frame. In case loading failed all new created resources will be removed before a suitable exception is thrown. (Excepting a RuntimeException occurrence!)

Returns
TODO
Exceptions
ALoadEnvException if loading failed.
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 1023 of file loadenv.cxx.

References aArguments, framework::TargetHelper::Blank, framework::TaskCreator::createTask(), framework::TargetHelper::Default, framework::LoadEnvException::ID_NO_TARGET_FOUND, impl_applyPersistentWindowState(), impl_filterHasInteractiveDialog(), impl_furtherDocsAllowed(), impl_makeFrameWindowVisible(), impl_searchAlreadyLoaded(), impl_searchLoader(), impl_searchRecycleTarget(), impl_setResult(), comphelper::InitAnyPropertySequence(), m_aTargetLock, m_aURL, m_bCloseFrameOnError, m_bFocusedAndToFront, m_lMediaDescriptor, m_mutex, m_nSearchFlags, m_sTarget, m_xAsynchronousJob, m_xBaseFrame, m_xContext, m_xTargetFrame, framework::TargetHelper::matchSpecialTarget(), utl::MediaDescriptor::PROP_HIDDEN, utl::MediaDescriptor::PROP_INTERACTIONHANDLER, utl::MediaDescriptor::PROP_MINIMIZED, utl::MediaDescriptor::PROP_PREVIEW, utl::MediaDescriptor::PROP_STATUSINDICATOR, framework::ActionLockGuard::setResource(), shouldFocusAndToFront(), and framework::SPECIALTARGET_BLANK.

Referenced by start().

◆ impl_makeFrameWindowVisible()

void framework::LoadEnv::impl_makeFrameWindowVisible ( const css::uno::Reference< css::awt::XWindow > &  xWindow,
bool  bForceToFront 
)
private

because showing of a frame is needed more than once... it's implemented as a separate method .

-)

@descr Note: Showing of a frame is bound to a special feature... a) If we recycle any existing frame, we must bring it to front. Showing of such frame is not needed really... because we recycle visible frames only! b) If the document was already shown (e.g. by our progress implementation) we do nothing here. The reason behind: The document was already shown... and it was already make a top window... If the user activated another frame inbetween (because loading needed some time) it's not allowed to disturb the user again. Then the frame must resists in the background. c) If the frame was not shown before... but loading of a visible document into this frame was finished... we need both actions: setVisible() and toFront().

Parameters
xWindowpoints to the container window of a frame.
bForceToFrontif it's set to sal_False... showing of the window is done more intelligent. setVisible() is called only if the window was not shown before. This mode is needed by b) and c) If it's set to sal_True... both actions has to be done: setVisible(), toFront()! This mode is needed by a)

Definition at line 1706 of file loadenv.cxx.

References VCLUnoHelper::GetWindow().

Referenced by impl_loadContent(), and impl_reactForLoadingState().

◆ impl_reactForLoadingState()

void framework::LoadEnv::impl_reactForLoadingState ( )

it means; show the frame, bring it to front, might set the right icon etcpp.

in case loading was successfully or reactivate a might existing old document or close the frame if it was created before in case loading failed.

Exceptions
ALoadEnvException only in cases, where an internal error indicates, that the complete load environment seems to be not usable in general. In such cases a RuntimeException would be to hard for the outside code :-)
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 1583 of file loadenv.cxx.

References framework::ActionLockGuard::freeResource(), VclPtr< class reference_type >::get(), VCLUnoHelper::GetWindow(), framework::LoadEnvException::ID_COULD_NOT_REACTIVATE_CONTROLLER, framework::LoadEnvException::ID_GENERAL_ERROR, impl_makeFrameWindowVisible(), framework::TargetHelper::isValidNameForFrame(), m_aTargetLock, m_bCloseFrameOnError, m_bFocusedAndToFront, m_bLoaded, m_bReactivateControllerOnError, m_lMediaDescriptor, m_mutex, m_pQuietInteraction, m_xTargetFrame, utl::MediaDescriptor::PROP_FRAMENAME, utl::MediaDescriptor::PROP_HIDDEN, utl::MediaDescriptor::PROP_MINIMIZED, sFrameName, and shouldFocusAndToFront().

Referenced by impl_setResult().

◆ impl_searchAlreadyLoaded()

css::uno::Reference< css::frame::XFrame > framework::LoadEnv::impl_searchAlreadyLoaded ( )
private

checks if the specified content is already loaded.

@descr It depends from the set target information, if such search is allowed or not! So this method checks first, if the target is the special one "_default". If not it returns with an empty result immediately! In case search is allowed, an existing document with the same URL is searched. If it could be found, the corresponding view will get the focus and this method return the corresponding frame. Optional jumpmarks will be accepted here too. So the view of the document will be updated to show the position inside the document, which is related to the jumpmark.

Returns
A valid reference to the target frame, which contains the already loaded content and could be activated successfully. An empty reference otherwise.
Exceptions
ALoadEnvException only in cases, where an internal error indicates, that the complete load environment seems to be not usable in general. In such cases a RuntimeException would be to hard for the outside code :-)
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 1282 of file loadenv.cxx.

References count, framework::TargetHelper::Default, i, impl_jumpToMark(), framework::ProtocolCheck::isProtocol(), m_aURL, m_lMediaDescriptor, m_mutex, m_sTarget, m_xContext, framework::TargetHelper::matchSpecialTarget(), framework::PrivateObject, framework::PrivateStream, utl::MediaDescriptor::PROP_ASTEMPLATE, utl::MediaDescriptor::PROP_HIDDEN, utl::MediaDescriptor::PROP_OPENNEWVIEW, utl::MediaDescriptor::PROP_VERSION, xController, and xModel.

Referenced by impl_loadContent().

◆ impl_searchLoader()

css::uno::Reference< css::uno::XInterface > framework::LoadEnv::impl_searchLoader ( )

◆ impl_searchRecycleTarget()

css::uno::Reference< css::frame::XFrame > framework::LoadEnv::impl_searchRecycleTarget ( )
private

search for any target frame, which seems to be usable for this load request.

@descr Because this special feature is bound to the target specifier "_default" its checked inside first. If it's not set => this method return an empty reference. Otherwise any currently existing frame will be analyzed, if it can be used here. The following rules exists:

  • The frame must be empty ...
  • or contains an empty document of the same application module which the new document will have (Note: the filter of the new content must be well known here!)
  • and(!) this target must not be already used by any other load request.

If a suitable target is located it will be locked. That's why the last rule exists! If this method returns a valid frame reference, it was locked to be usable for this load request only. (Don't forget to reset this state later!) Concurrent LoadEnv instances can synchronize her work be using such locks :-) HOPEFULLY

Exceptions
ALoadEnvException only in cases, where an internal error indicates, that the complete load environment seems to be not usable in general. In such cases a RuntimeException would be to hard for the outside code :-)
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 1450 of file loadenv.cxx.

References BackingComponent, SvtModuleOptions::ClassifyFactoryByModel(), SvtModuleOptions::ClassifyFactoryByURL(), VCLUnoHelper::GetWindow(), impl_isFrameAlreadyUsedForLoading(), framework::ProtocolCheck::isProtocol(), m_aTargetLock, m_aURL, m_bReactivateControllerOnError, m_lMediaDescriptor, m_mutex, m_xContext, framework::PrivateFactory, framework::PrivateObject, framework::PrivateStream, utl::MediaDescriptor::PROP_ASTEMPLATE, utl::MediaDescriptor::PROP_HIDDEN, utl::MediaDescriptor::PROP_OPENNEWVIEW, utl::MediaDescriptor::PROP_REPLACEABLE, framework::ActionLockGuard::setResource(), xController, and xModel.

Referenced by impl_loadContent().

◆ impl_setResult()

void framework::LoadEnv::impl_setResult ( bool  bResult)

TODO document me ...

Definition at line 526 of file loadenv.cxx.

References impl_reactForLoadingState(), m_bLoaded, m_mutex, and m_xAsynchronousJob.

Referenced by impl_loadContent().

◆ initializeUIDefaults()

void framework::LoadEnv::initializeUIDefaults ( const css::uno::Reference< css::uno::XComponentContext > &  i_rxContext,
utl::MediaDescriptor io_lMediaDescriptor,
const bool  _bUIMode,
rtl::Reference< QuietInteraction > *  o_ppQuiteInteraction 
)
static

◆ loadComponentFromURL()

css::uno::Reference< css::lang::XComponent > framework::LoadEnv::loadComponentFromURL ( const css::uno::Reference< css::frame::XComponentLoader > &  xLoader,
const css::uno::Reference< css::uno::XComponentContext > &  xContext,
const OUString &  sURL,
const OUString &  sTarget,
sal_Int32  nFlags,
const css::uno::Sequence< css::beans::PropertyValue > &  lArgs 
)
static

◆ shouldFocusAndToFront()

bool framework::LoadEnv::shouldFocusAndToFront ( ) const
private

checks if this should bring to front and get focus on load, according to user settings and to the load flags.

Definition at line 1698 of file loadenv.cxx.

References m_lMediaDescriptor, and utl::MediaDescriptor::PROP_PREVIEW.

Referenced by impl_loadContent(), and impl_reactForLoadingState().

◆ start()

void framework::LoadEnv::start ( )
private

◆ startLoading()

void framework::LoadEnv::startLoading ( const OUString &  sURL,
const css::uno::Sequence< css::beans::PropertyValue > &  lMediaDescriptor,
const css::uno::Reference< css::frame::XFrame > &  xBaseFrame,
const OUString &  sTarget,
sal_Int32  nSearchFlags,
LoadEnvFeatures  eFeature = LoadEnvFeatures::NONE 
)

start loading of a resource

@descr The parameter for targeting, the content description, and some environment specifier (UI, dispatch functionality) can be set here. Of course a still running load request will be detected here and a suitable exception will be thrown. Such constellation can be detected outside by using provided synchronisation methods or callbacks.

There is no direct return value possible here. Because it depends from the usage of this instance! E.g. for loading a "visible component" a frame with a controller/model inside can be possible. For loading of a "non visible component" only an information about a successfully start can be provided. Further it can't be guaranteed, that the internal process runs synchronous. that's why we prefer using of specialized methods afterwards e.g. to:

  • wait till the internal job will be finished and get the results
  • or to let it run without any further control from outside.
Parameters
sURLpoints to the resource, which should be loaded.
lMediaDescriptorcontains additional information for the following load request.
xBaseFramepoints to the frame which must be used as start point for target search.
sTargetregulate searching/creating of frames, which should contain the new loaded component afterwards.
nSearchFlagsregulate searching of targets, if sTarget is not a special one.
eFeatureflag field, which enable/disable special features of this new instance for following load call.
Exceptions
ALoadEnvException e.g. if another load operation is till in progress or initialization of a new one fail by other reasons. The real reason, a suitable message and ID will be given here immediately.
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 231 of file loadenv.cxx.

References classifyContent(), E_UNSUPPORTED_CONTENT, framework::LoadEnvException::ID_STILL_RUNNING, framework::LoadEnvException::ID_UNSUPPORTED_CONTENT, initializeUIDefaults(), comphelper::LibreOfficeKit::isActive(), tools::IsMappedWebDAVPath(), m_aURL, m_bCloseFrameOnError, m_bLoaded, m_bReactivateControllerOnError, m_eContentType, m_eFeature, m_lMediaDescriptor, m_mutex, m_nSearchFlags, m_pQuietInteraction, m_sTarget, m_xAsynchronousJob, m_xBaseFrame, m_xContext, m_xTargetFrame, utl::MediaDescriptor::PROP_FILENAME, utl::MediaDescriptor::PROP_HIDDEN, utl::MediaDescriptor::PROP_INTERACTIONHANDLER, utl::MediaDescriptor::PROP_JUMPMARK, utl::MediaDescriptor::PROP_PREVIEW, utl::MediaDescriptor::PROP_SILENT, utl::MediaDescriptor::PROP_URL, start(), and WorkWithUI.

Referenced by framework::LoadDispatcher::impl_dispatch(), and loadComponentFromURL().

◆ waitWhileLoading()

bool framework::LoadEnv::waitWhileLoading ( sal_uInt32  nTimeout = 0)

wait for an already running load request (started by calling startLoading() before).

@descr The timeout parameter can be used to wait some times only or forever. The return value indicates if the load request was finished during the specified timeout period. But it indicates not, if the load request was successful or not!

Parameters
nTimeoutspecify a timeout in [ms]. A value 0 let it wait forever!
Returns
sal_True if the started load process could be finished in time; sal_False if the specified time was over.
Exceptions
...currently not used :-)
ARuntimeException in case any internal process indicates, that the whole runtime can't be used any longer.

Definition at line 426 of file loadenv.cxx.

References Application::IsQuit(), m_mutex, m_xAsynchronousJob, and Application::Yield().

Referenced by framework::LoadDispatcher::impl_dispatch(), and loadComponentFromURL().

Member Data Documentation

◆ m_aTargetLock

ActionLockGuard framework::LoadEnv::m_aTargetLock
private

holds an XActionLock on the internal used task member.

@seealso m_xTargetFrame

Definition at line 192 of file loadenv.hxx.

Referenced by impl_loadContent(), impl_reactForLoadingState(), and impl_searchRecycleTarget().

◆ m_aURL

css::util::URL framework::LoadEnv::m_aURL
private

because the mediadescriptor contains the complete URL ... but some functionality need the structured version, we hold it twice :-(.

Definition at line 147 of file loadenv.hxx.

Referenced by impl_filterHasInteractiveDialog(), impl_handleContent(), impl_loadContent(), impl_searchAlreadyLoaded(), impl_searchRecycleTarget(), and startLoading().

◆ m_bCloseFrameOnError

bool framework::LoadEnv::m_bCloseFrameOnError
private

it indicates, that the member m_xTargetFrame was new created for this load request and must be closed in case loading (not handling!) operation failed.

The default value is sal_False!

Definition at line 159 of file loadenv.hxx.

Referenced by impl_loadContent(), impl_reactForLoadingState(), and startLoading().

◆ m_bFocusedAndToFront

bool framework::LoadEnv::m_bFocusedAndToFront = false
private

If we already brought it to front; do not do that again (the user could switch elsewhere after the first activation, and we shouldn't nag them again).

Definition at line 186 of file loadenv.hxx.

Referenced by impl_loadContent(), and impl_reactForLoadingState().

◆ m_bLoaded

bool framework::LoadEnv::m_bLoaded
private

holds the information about the finished load process.

@descr The content of m_xTargetFrame can't be used as valid indicator, (in case the existing old document was reactivated) we must hold the result of the load process explicitly.

Definition at line 180 of file loadenv.hxx.

Referenced by impl_reactForLoadingState(), impl_setResult(), and startLoading().

◆ m_bReactivateControllerOnError

bool framework::LoadEnv::m_bReactivateControllerOnError
private

it indicates, that the old document (which was located inside m_xBaseFrame in combination with the m_sTarget value "_self") was suspended.

Normally it will be replaced by the new loaded document. But in case loading (not handling!) failed, it must be reactivated. The default value is sal_False!

Definition at line 167 of file loadenv.hxx.

Referenced by impl_reactForLoadingState(), impl_searchRecycleTarget(), and startLoading().

◆ m_eContentType

EContentType framework::LoadEnv::m_eContentType
private

classify the content, which should be loaded by this instance.

Definition at line 153 of file loadenv.hxx.

Referenced by impl_searchLoader(), start(), and startLoading().

◆ m_eFeature

LoadEnvFeatures framework::LoadEnv::m_eFeature
private

enable/disable special features of a load request.

Definition at line 150 of file loadenv.hxx.

Referenced by start(), and startLoading().

◆ m_lMediaDescriptor

utl::MediaDescriptor framework::LoadEnv::m_lMediaDescriptor
private

contains all needed information about the resource, which should be loaded.

@descr Inside this struct e.g. the URL, its type and filter name, the stream or a model directly are saved.

Definition at line 142 of file loadenv.hxx.

Referenced by impl_applyPersistentWindowState(), impl_detectTypeAndFilter(), impl_filterHasInteractiveDialog(), impl_furtherDocsAllowed(), impl_handleContent(), impl_loadContent(), impl_reactForLoadingState(), impl_searchAlreadyLoaded(), impl_searchLoader(), impl_searchRecycleTarget(), shouldFocusAndToFront(), and startLoading().

◆ m_mutex

osl::Mutex framework::LoadEnv::m_mutex
mutableprivate

◆ m_nSearchFlags

sal_Int32 framework::LoadEnv::m_nSearchFlags
private

if m_sTarget is not a special one, this flags regulate searching of a suitable one.

Definition at line 134 of file loadenv.hxx.

Referenced by impl_loadContent(), and startLoading().

◆ m_pQuietInteraction

rtl::Reference<QuietInteraction> framework::LoadEnv::m_pQuietInteraction
private

Definition at line 194 of file loadenv.hxx.

Referenced by impl_reactForLoadingState(), and startLoading().

◆ m_sTarget

OUString framework::LoadEnv::m_sTarget
private

contains the name of the target, in which the specified resource of this instance must be loaded.

Definition at line 129 of file loadenv.hxx.

Referenced by impl_loadContent(), impl_searchAlreadyLoaded(), and startLoading().

◆ m_xAsynchronousJob

css::uno::Reference< css::uno::XInterface > framework::LoadEnv::m_xAsynchronousJob
private

it holds one (!) asynchronous used contenthandler or frameloader alive, till the asynchronous operation will be finished.

Definition at line 172 of file loadenv.hxx.

Referenced by impl_handleContent(), impl_loadContent(), impl_setResult(), start(), startLoading(), and waitWhileLoading().

◆ m_xBaseFrame

css::uno::Reference< css::frame::XFrame > framework::LoadEnv::m_xBaseFrame
private

points to the frame, which uses this LoadEnv object and must be used to start target search there.

Definition at line 109 of file loadenv.hxx.

Referenced by impl_loadContent(), and startLoading().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > framework::LoadEnv::m_xContext
private

◆ m_xTargetFrame

css::uno::Reference< css::frame::XFrame > framework::LoadEnv::m_xTargetFrame
private

points to the frame, into which the new component was loaded.

@descr Note: This reference will be empty if loading failed or a non visible content was loaded! It can be the same frame as m_xBaseFrame it describe, in case the target "_self", "" or the search flag "SELF" was used. Otherwise it's the new created or recycled frame, which was used for loading and contains further the new component.

Please use method getTarget() or getTargetComponent() to return the frame/controller or model to any interested user of the results of this load request.

Definition at line 124 of file loadenv.hxx.

Referenced by getTargetComponent(), impl_loadContent(), impl_reactForLoadingState(), and startLoading().


The documentation for this class was generated from the following files: