summaryrefslogtreecommitdiff
path: root/doc/wait-to-exit.txt
blob: 9795e16c62f7c7f69bd445e4bdf161c98ce970b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
** 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 ...