** Notes on making OO.o wait to exit instead of immediate quit having
   spawned a new factory instance.

desktop/source/app/officeipcthread.[ch]xx:

class OfficeIPCThread : public vos::OThread
    ...
    vos::OPipe		maPipe;
    vos::OStreamPipe	maStreamPipe;


OfficeIPCThread::run():
    + maPipe.accept( maStreamPipe )
	    + UH !? - why do we put this in a global variable ?

vos/inc/vos/pipe.hxx:
    TPipeError SAL_CALL accept(OStreamPipe& Connection);

    class OStreamPipe : public NAMESPACE_VOS(OPipe),
	                public NAMESPACE_VOS(IStream)


    The client code waits for a reply to be written to the pipe;
ergo a quick hack is to add '-wait', for just 1 document; and
block the IPC thread until we get a reply [ pretty ugly ]

    'cProcessed.set()' - the condition we wait on for stuff
to happen - why bother ? why bother blocking all of OO.o for
stuff to happen ? [ perhaps a feature ? ] either way - we could
use cProcessed.set() - perhaps (?).

    Minimal changes:
	    + ie. continue to block / signal cProcessed
		( pRequest->pcProcessed ) in every case.
	    + allocate the stream connection ...

* ProcessDocumentsRequest does the real open
    + passed to app.cxx (OpenClients).
	[ it seems the args are just parsed on both sides ]
    + OfficeIPCThread::ExecuteCmdLineRequests
	+ builds DispatchWatcher::DispatchList aDispatchList ...
	+ invokes DispatchWatcher::GetDispatchWatcher() [ XDispatchListener ]
	( dispatchwatcher.cxx )
	   executeDispatchRequests
	    + This builds a set of (fake) URIs & argument data,
	    + iterates over doing a xDisp->dispatchWithNotification
		+ dispatchFinished then called per dispatch finished ...


    + Implementation in framework/source/dispatch/basedispatcher.cxx
	    + [ addStatusListener / removeStatusListener (progress) ]
	    + we need a handle to what got loaded though ...
	    




	    + need a new method 'fileFinished' [!?]
		+ and a map of who is waiting for whom ;->
		  [ a ] waits for [ b ]
		  simple struct list is fine.
			[ DispatchResultEvent ]
	    + also used in sfx2/source/appl/appopen.cxx


struct EventObject
{
    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > Source;
};
struct DispatchResultEvent: com::sun::star::lang::EventObject
{
    /** describes state of dispatch
    short State;
    /** describes result for given <var>State</var>
    any Result;
};


* framework/source/dispatch/basedispatcher.cxx:
	(implts_sendResultEvent)
	    + aEvent.State == css::frame::DispatchResultState::SUCCESS
	    + aEvent.Source = (css::frame::XDispatch*) this; [ BaseDispatcher ]
	    + aEvent.Result == css::uno::Reference< css::frame::XFrame >& xEventSource

* So - we need to work with the XFrame ...
	+ frameAction/FrameActionListener - seems uninteresting.

	+ frameworks/source/services/frame.cxx
	    + COMPONENT_DETACHING, REATTACHED, ATTACHED

	+ addCloseListener() ...

	'getController()->getModel()->

* sfx2/source/doc/sfxbasemodel.cxx
	+ 'addCloseListener' ...
	    + [ XCLOSELISTENER ]
	+ 'isModified'

* Security audit this mess [!] ...
	+ nasty hole in there.


* TODO / Test:
    + multiple files opened; we need some
      ref count / gateing somewhere.
    + file already open [!?] need a list of
      clients to notify ...


