1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_automation.hxx"
26 
27 // do not use Application Idle but AutoTimer instead
28 #define TIMERIDLE
29 
30 #define NO_JPEG
31 
32 #ifndef NO_JPEG
33 #include <svtools/jpeg.hxx>
34 #endif
35 #include <vcl/timer.hxx>
36 #include <vcl/wrkwin.hxx>
37 #include <osl/diagnose.h>
38 #include <osl/mutex.hxx>
39 
40 #ifndef _DIALOG_HXX //autogen
41 #include <vcl/dialog.hxx>
42 #endif
43 #include <tools/stream.hxx>
44 #include <tools/config.hxx>
45 
46 #include <vos/socket.hxx>
47 
48 #if 1
49 #include <svtools/ttprops.hxx>
50 #include <basic/ttstrhlp.hxx>
51 #include <svl/stritem.hxx>
52 #include <svtools/stringtransfer.hxx>
53 #include <vcl/sound.hxx>
54 #include "testtool.hrc"
55 #include <vcl/bitmap.hxx>
56 // Hat keinen Includeschutz
57 #include <svtools/svtdata.hxx>
58 //#ifndef _DTRANS_HXX //autogen
59 //#include <so2/dtrans.hxx>
60 //#endif
61 #endif // 1
62 #include <rtl/textenc.h>
63 #include <rtl/uri.h>
64 #include <rtl/uri.hxx>
65 #include "statemnt.hxx"
66 #include "scmdstrm.hxx"
67 #include "rcontrol.hxx"
68 #include "server.hxx"
69 #include "testtool.hxx"
70 #include "automation/automation.hxx"
71 #include "recorder.hxx"
72 
73 #include "basic/svtmsg.hrc"
74 
75 #ifdef DBG_UTIL
76 void TestToolDebugPrint( const sal_Char *pString )
77 {
78     if ( !DbgFilterMessage( pString ) )
79     	StatementList::DirectLog( S_AssertError, UniString( pString, RTL_TEXTENCODING_UTF8 ) );
80 }
81 void SAL_CALL osl_TestToolDebugPrint( const sal_Char *pString )
82 {
83     TestToolDebugPrint( pString );
84 }
85 #endif
86 
87 
88 sal_uLong RemoteControlCommunicationManager::nPortIs = TT_PORT_NOT_INITIALIZED;
89 sal_uInt16 RemoteControlCommunicationManager::nComm = 0;
90 sal_Bool RemoteControlCommunicationManager::bQuiet = sal_False;
91 
92 #if OSL_DEBUG_LEVEL > 1
93 RemoteControlCommunicationManager::RemoteControlCommunicationManager( EditWindow * pDbgWin )
94 #else
95 RemoteControlCommunicationManager::RemoteControlCommunicationManager()
96 #endif
97 : CommunicationManagerServerViaSocket( GetPort(), 1, sal_True )
98 #if OSL_DEBUG_LEVEL > 1
99 , m_pDbgWin( pDbgWin )
100 #endif
101 , pTimer( NULL )
102 {
103 	bIsPortValid = ( GetPort() != 0 );
104 	if ( bQuiet )
105 	{
106 		SetInfoType( CM_NO_TEXT );
107 	}
108 	else
109 	{
110 		SetInfoType( CM_SHORT_TEXT | CM_ALL );
111         ByteString aByteString;
112 		InfoMsg( InfoString( aByteString, CM_ALL ) );	// Anzeigen, da� wir da sind
113 	}
114 }
115 
116 RemoteControlCommunicationManager::~RemoteControlCommunicationManager()
117 {
118 	if ( pTimer )
119 		delete pTimer;
120     DoQuickShutdown();
121 }
122 
123 void RemoteControlCommunicationManager::ConnectionOpened( CommunicationLink* pCL )
124 {
125 	StatementFlow::pCommLink = pCL;
126 	CommunicationManagerServerViaSocket::ConnectionOpened( pCL );
127 }
128 
129 
130 void RemoteControlCommunicationManager::ConnectionClosed( CommunicationLink* pCL )
131 {
132 	StatementFlow::pCommLink = NULL;
133 	CommunicationManagerServerViaSocket::ConnectionClosed( pCL );
134 }
135 
136 
137 IMPL_LINK( RemoteControlCommunicationManager, SetWinCaption, Timer*, EMPTYARG )
138 {
139 	if ( pTimer )
140 	{
141 		delete pTimer;
142 		pTimer = NULL;
143 	}
144 
145 	if ( StatementList::GetFirstDocFrame() )
146 	{
147 		if ( !aOriginalWinCaption.Len() )
148 			aOriginalWinCaption = StatementList::GetFirstDocFrame()->GetText();
149 		StatementList::GetFirstDocFrame()->SetText(String(aOriginalWinCaption).AppendAscii(" TT").Append(aAdditionalWinCaption).AppendAscii("[").Append(UniString::CreateFromInt32(nPortToListen)).AppendAscii("]"));
150 	}
151 	else
152 	{	// Dann Probieren wir es eben in 1 Sekunde nochmal
153 		pTimer = new Timer();	// Wird im Link gel�scht
154 		pTimer->SetTimeout( 1000 );
155 		pTimer->SetTimeoutHdl( LINK( this, RemoteControlCommunicationManager, SetWinCaption ) );
156 		pTimer->Start();
157 	}
158 	return 0;
159 }
160 
161 void RemoteControlCommunicationManager::InfoMsg( InfoString aMsg )
162 {
163 	if ( !bIsPortValid )
164 		return;
165 	aAdditionalWinCaption = UniString( aMsg, RTL_TEXTENCODING_ASCII_US );
166 	SetWinCaption();
167 #if OSL_DEBUG_LEVEL > 1
168 	m_pDbgWin->AddText( UniString( (ByteString)aMsg, RTL_TEXTENCODING_ASCII_US ) );
169 	m_pDbgWin->AddText( "\n" );
170 #endif
171 }
172 
173 sal_uLong RemoteControlCommunicationManager::GetPort()
174 {
175 	if ( TT_PORT_NOT_INITIALIZED == nPortIs )
176 	{	// Read Config
177 
178         sal_uInt16 i;
179         // are we to be automated at all?
180         sal_Bool bAutomate = sal_False;
181 		for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
182 		{
183 			if ( Application::GetCommandLineParam( i ).EqualsIgnoreCaseAscii("/enableautomation")
184 				|| Application::GetCommandLineParam( i ).EqualsIgnoreCaseAscii("-enableautomation"))
185             {
186                 bAutomate = sal_True;
187                 break;
188             }
189         }
190 
191 // if started within Portal determin location of testtool.ini/rc by analysing the commandline
192 // /userid:demo1[/export/home/user/demo1]
193 // -userid:demo1[/export/home/user/demo1]
194 		String aIniFileDir;
195 		for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
196 		{
197 			if ( Application::GetCommandLineParam( i ).Copy(0,8).EqualsIgnoreCaseAscii("/userid:")
198 				|| Application::GetCommandLineParam( i ).Copy(0,8).EqualsIgnoreCaseAscii("-userid:") )
199 			{
200 				rtl::OUString aEncHome
201 					= Application::GetCommandLineParam(i).GetBuffer();
202 
203 				rtl::OUString aDecHome = rtl::Uri::decode(aEncHome,
204 						rtl_UriDecodeWithCharset,
205 						RTL_TEXTENCODING_UTF8);
206 
207 				aIniFileDir = aDecHome;
208 				aIniFileDir.Erase( 0, aIniFileDir.Search('[')+1 );
209 				aIniFileDir.Erase( aIniFileDir.Search(']') );
210 			}
211 		}
212 
213 		if ( ! aIniFileDir.Len() )
214 			aIniFileDir = Config::GetDefDirectory();
215 
216 		Config aConf(Config::GetConfigName( aIniFileDir, CUniString("testtool") ));
217 		aConf.SetGroup("Communication");
218 
219 		ByteString aNoTesttoolKey( ByteString("Exclude_").Append( ByteString( Application::GetAppFileName(), RTL_TEXTENCODING_UTF8 ) ) );
220 // -notesttool
221 		for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
222 		{
223 			if ( Application::GetCommandLineParam( i ).CompareIgnoreCaseToAscii("-notesttool") == COMPARE_EQUAL )
224 				aConf.WriteKey( aNoTesttoolKey, "something" );
225 		}
226 
227 		nPortIs = aConf.ReadKey("TTPort","0").ToInt32();
228 
229         // noch pr�fen ob dieses Office getestet werden soll.
230 		if ( !bAutomate || aConf.ReadKey( aNoTesttoolKey, "" ) != "" )
231 			nPortIs = 0;
232 
233 		nComm = (sal_uInt16)aConf.ReadKey("Comm","0").ToInt32();
234 		if ( nComm )
235 			aConf.DeleteKey("Comm");
236 
237 		bQuiet = ( aConf.ReadKey("Quiet","no").CompareIgnoreCaseToAscii("yes") == COMPARE_EQUAL );
238 	}
239 	return nPortIs;
240 }
241 
242 #if OSL_DEBUG_LEVEL > 1
243 #define MIN_IDLE 10000		// Ruhe vor dem Sturm min 10 Sekunden
244 #else
245 #define MIN_IDLE 60000		// Ruhe vor dem Sturm min 1 Minuten
246 #endif
247 
248 class ExtraIdle : public AutoTimer
249 {
250 	virtual void    Timeout();
251 
252 	sal_uInt16 nStep;
253 	ImplRemoteControl *pRemoteControl;
254 public:
255 	ExtraIdle( ImplRemoteControl *pRC );
256 };
257 
258 
259 ExtraIdle::ExtraIdle( ImplRemoteControl *pRC )
260 : nStep( 0 )
261 , pRemoteControl (pRC )
262 {
263 	SetTimeout( 120000 );	// 2 Minuten
264 #if OSL_DEBUG_LEVEL > 1
265 	SetTimeout( 40000 );	// 40 Sekunden
266 #endif
267 	Start();
268 }
269 
270 void ExtraIdle::Timeout()
271 {
272 	if ( !StatementList::pTTProperties )
273 		StatementList::pTTProperties = new TTProperties();
274 
275 	if ( !StatementList::pTTProperties->GetSlots() )
276 	{
277 		delete this;
278 		return;
279 	}
280 
281 	// M�ssen wir selbst idlen?
282 #if OSL_DEBUG_LEVEL > 1
283 	sal_uLong nLastInputInterval = Application::GetLastInputInterval();
284 	sal_Bool bIsInModalMode = Application::IsInModalMode();
285 	if ( bIsInModalMode || nLastInputInterval < MIN_IDLE )
286 #else
287 	if ( Application::IsInModalMode() || Application::GetLastInputInterval() < MIN_IDLE )
288 #endif
289 	{
290 		if ( nStep )	// Schon angefangen? dann abbrechen, sonst sp�ter nochmal
291 		{
292             if ( nStep < 15 )
293             {
294 			    Sound::Beep();
295 			    Sound::Beep();
296             }
297 #if OSL_DEBUG_LEVEL < 2
298 			delete this;
299 #endif
300 		}
301 #if OSL_DEBUG_LEVEL > 1
302         if ( nStep < 15 )
303         {
304 			Sound::Beep();
305 			Sound::Beep();
306         }
307 #endif
308 		return;
309 	}
310 
311 	if ( StatementList::pFirst )	// Verarbeitung neu aufsetzen
312 	{
313 		GetpApp()->PostUserEvent( LINK( pRemoteControl, ImplRemoteControl, CommandHdl ) );
314 		return;
315 	}
316 
317 
318 	switch ( nStep++ )		// Probieren ob wir noch was machen k�nnen
319 	{
320 		case 0:
321 		{
322 			SfxPoolItem *pItem = new SfxStringItem((sal_uInt16)StatementList::pTTProperties->nSidNewDocDirect, CUniString("swriter/web") );
323 			new StatementSlot( StatementList::pTTProperties->nSidNewDocDirect, pItem );
324 			SetTimeout(30000);
325 			return;
326 		}
327 		case 1:
328 		{
329 			new StatementSlot( StatementList::pTTProperties->nSidSourceView );
330 #if OSL_DEBUG_LEVEL > 1
331 			SetTimeout(7000);
332 #else
333 			SetTimeout(1500);
334 #endif
335 			return;
336 		}
337 		case 2:
338 		{
339 			new StatementSlot( StatementList::pTTProperties->nSidSelectAll );
340 			return;
341 		}
342 		case 3:
343 		{
344 
345 #if OSL_DEBUG_LEVEL > 1
346 //#define TT_NO_DECRYPT
347 #define TT_CODE
348 #else
349 #define TT_CODE
350 #endif
351 
352 #ifdef TT_NO_DECRYPT
353 			String aStr =
354 				""
355 				;
356 
357 #else
358 			ByteString aStr =
359 				"\n"
360 				"VRQJ`ob\n"
361 				"YEZO\n"
362 				"ob\n"
363 				"UmRo`\n"
364 				"5J~O2o5+90~5,6xW$+5:c9o0UXRm`Y	UQ~JP~X]`Y\\|%Y`Yo]~O||2[pP0Y1J,|V),,7:,+|JS+U*[/O|K\n"
365 				"|KaLYNV~]]2W/]*Y9|`*Y,P=[5P|U\n"
366 				"]}mqbw`zZU\\L\n"
367 				"LZdYWo9\n"
368 				"/J\n"
369 				"U~[QoZ\n"
370 				"Rqd~V\n"
371 				",)1~00\n"
372 				"\n"
373 				")0~*2=\n"
374 				"++2\\5&K|~5n9r~9/*9<*~051*Q|0~0rY|~./97~Q*7,Z9<|KY0:=K*<=w~qY`IbOKzLwN,`7b,V~]E`]b\\ORE~\n"
375 				"\n"
376 				"Vq~bR`W;a+Y\\J=LKJa+W*I/PbR~JLUX[|b~`Z2P/R*[9a~W=9~/9p8=a*P=J0OZ~7L`JbL=P<WbaLQbPO]JYKbD\n"
377 				"aY`J5J:b~7=2~+9)9W1,50b9X3P0`YbYVJ`Jb	\\`Z]`Vb\n"
378 				"VRQJ`b"
379 				;
380 #endif
381 
382 #ifdef TT_CODE
383 			for ( sal_uInt16 i = 0 ; i < aStr.Len() ; i++ )
384 			{
385 				if ( aStr.GetChar(i) < 32 || aStr.GetChar(i) > 126 )
386 				{
387 					// do nothing
388 				}
389 				else
390 				{
391 					aStr.SetChar( i, aStr.GetChar(i) - 32 );
392 					aStr.SetChar( i, 126 - aStr.GetChar(i) );
393 				}
394 
395 				if ( i > (aStr.Len() / 2) && (i&1) )
396 				{
397 					sal_Char c = aStr.GetChar(i);
398 					aStr.SetChar( i, aStr.GetChar(aStr.Len()-i-1) );
399 					aStr.SetChar( aStr.Len()-i-1, c );
400 				}
401 			}
402 #endif
403 
404 			::svt::OStringTransfer::CopyString( UniString( aStr, RTL_TEXTENCODING_ASCII_US ), StatementList::GetFirstDocFrame()  );
405 
406 			new StatementSlot( StatementList::pTTProperties->nSidPaste );
407 			return;
408 		}
409 		case 4:
410 		{
411 			new StatementSlot( StatementList::pTTProperties->nSidSourceView );
412 			return;
413 		}
414 		case 5:
415 		{
416 			new StatementSlot( StatementList::pTTProperties->nSidSelectAll );
417 			new StatementSlot( StatementList::pTTProperties->nSidCopy );
418 			new StatementSlot( StatementList::pTTProperties->nSidPaste );
419 			return;
420 		}
421 		case 6:
422 		{
423 			ByteString aTr("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-");
424 			ByteString aData =
425 "P-S-0U04Fihixh00l0004b0b300-PS0g30428333y243q334j44426a6a65576c8k97aJecf7feccedg2inj3ghlshde5krk+lno"
426 "PpqpBfjsgusp1unp-po-PS0gm044x465e6b6L6boygeg-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo"
427 "-ooo-ooo-oo-1M04020Y30J0o080B040R040M-N0M700l010l000k000000000006000N011I112r222M-N0gJ40D000U001R011"
428 "0110500vr0001014p148mcg1R4koV18s95cwkAE2V8gImM5kgQY9WcosCw22I556p669I99aoaadrddd6eeeNghhIhhiriik6lll"
429 "NlmmImoprppp6qqqNsttItturuuw6xxxNxyyHyAA6BBBNBCCHCEE6FFFNFGGHGII6JJJNJKKHKMM6NNNNNOOHOQQ6RRRNRSSCSUU"
430 "NUVVIVVWpWWYIYYZrZZZ6+++M-N0Q700R000l000l000g00000006000N011I112r222M-N0kJ40C0003110d1110110r00t6000"
431 "Q041l18cF14gtk1ous48Acw295gAlEIMv28cxkY5FosQE2595dU9sY56q669N9aaCaddNdeeIeghrhhh6iiiNkllIllmrmmo6ppp"
432 "NpqqIqstrttt6uuuIwwxrxxx6yyyIAABrBBB6CCCIEEFrFFF6GGGIIIJrJJJ6KKKIMMNrNNN6OOOIQQRrRRR6SSSIUUVrVVV6WWW"
433 "IYYZrZZZ6+++U-S0d3009004Q040Of0TPU5QGjFCdPoji85WiqEopkCag321kP8dW4yO4KRlNi9iwzeTKup+Yk0lrdcicCEeLtVQ"
434 "z1IFeROmSJBa7VYMYY-0EWGkJWH6LpAVdrUepM7ScEpkTBkenX3YGuoFVU0IGk+dSzPpv0N6U07eTPFgid-YtvOD2ws5C96qDgIL"
435 "vhsoWmBPAozc+KgPjiVuW0TJnrt6PqF63p2VJEJ6A+l33JqESWh0G4yn1JkcaaEBnw17xmaf0q4BGkVy40Jj+FAyioG3KEukCtP1"
436 "OAdOe4ASVCPuUrQDFsqBoRWN6jqxOBfH-30WbgyZy+HtyI6xNVvt3M0lnfscjA8rBUeoRXifTPCceY6t46AR9ooG2jVzdmo+PQ6R"
437 "cAEDd7VE3GvUyDJzn2e0yyzypEdnCzUZorT029pk4LHJYsRQmR5smaW9EuCbt2A2s2Nd9ZKAkcJSWoTGPV5p6d1PZCiYt6kVETBB"
438 "K7zNWhRK7kMBCag7zELQ2e6HWHM+BwO4nJA-30uF2a2WgcgndWuk6gPbha0D5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MxeEwbi-uGP8BGO4vGgV0IFbgswumfhk14OF3q+1qwRFpq4hr1s6zQEAgoVAW3QE4tsQpYW3JkcqDcnSOjbePZeFrFMor-o3UG2F"
481 "jmw8667eXk3UiM9vq5EpyrbQxexsJ3tKy7w6lGsumfMWIlcSglkLUzicysuPgqT5Wuzn8MkGvTYve2UyunErUnD-+Qwr0rDo1tOG"
482 "bbtcNNeFInx5rDK3DHahjTON3d3oTpePxioVK3sRLDh185yKMzTQv812ADCFcwvFHbetPF41f7kot00O2OMUkw4OPvuTRkhdAhgd"
483 "il2SM9bunNaNHqh9Ov8Qv3SKEl1O-BwzjYF0VWjkxycswQFqQotUPw+Q-6FrCPFWvaF2CP2F319stMfD-8bHsd87KZfQ9ChereG4"
484 "Z8XP8dNMipn-evkOVVFqfgN16dO8Ya9nqGFIpIW1Ljv7wOAzdZFsm5C1EuQoKzwyXDO0BDjceBsyTt40H0upG8D1N1ZP66OPIeQy"
485 "oXQwI63e+NnuYA0687-d6N6rDscj+VHn2R0RUXQFZ2+EANqcqvan4y0Erpl01fAfmLaI8pmOgsRUDvuF5e9YnWNhxtSzS4fsjj1J"
486 "1EIGpcw0WfiaOul1s19ZIECoLBx-#S";
487 
488 
489 //#if OSL_DEBUG_LEVEL > 1
490 //			SvFileStream aStream( "d:\\gh_writeback.jpg" , STREAM_STD_READWRITE | STREAM_TRUNC );
491 //#else
492 			SvMemoryStream aStream;
493 //#endif
494 			xub_StrLen c;
495 			xub_StrLen cRest = 0;
496 
497 			xub_StrLen nIndex;
498 			for ( nIndex = 0 ; nIndex < aData.Len() ; nIndex++ )
499 			{
500 				if ( ( nIndex & 3 ) == 0 )
501 				{
502 					cRest = aData.GetChar( nIndex );
503 					cRest = aTr.Search( (sal_Char)cRest );
504 				}
505 				else
506 				{
507 					c = aData.GetChar( nIndex );
508 					c = aTr.Search( (sal_Char)c );
509 
510 					c <<= 2;
511 					c |= ( ( cRest & 0x30 ) >> 4 );
512 					cRest <<= 2;
513 
514 					aStream << sal_Char(c);
515 				}
516 			}
517 
518 			aStream.Seek(0);
519 #ifndef NO_JPEG
520 			Graphic aGraphic;
521 			if ( ImportJPEG( aStream, aGraphic, NULL ) )
522 			{
523 				Bitmap *pBmp = new Bitmap( aGraphic.GetBitmap() );
524 				StatementList::pTTProperties->Img( pBmp );
525 				delete pBmp;
526 			}
527 			else
528 #endif
529 			{
530 				::svt::OStringTransfer::CopyString( CUniString("\nSorry! no bitmap"), StatementList::GetFirstDocFrame() );
531 			}
532 
533 /***********************************************************************
534 //			sal_uInt16 nBC = pBmp->GetBitCount();
535 //			pBmp->Scale( 0.02, 0.02 );
536 //			nBC = pBmp->GetBitCount();
537 //			SvMemoryStream aStream;
538 			SvFileStream aStream( "d:\gh_small50.jpg", STREAM_STD_READ );
539 
540 			aStream.Seek( 0 );
541 			xub_StrLen c;
542 			String aOut;
543 			String aDreierGruppe;
544 			xub_StrLen cRest=0;
545 			aStream >> c;
546 			while ( !aStream.IsEof() )
547 			{
548 				cRest <<= 2;		// Im ersten Durchgang egal, da immer 0
549 				cRest |= ( c & 0x03 );
550 				c >>= 2;
551 				aDreierGruppe += aTr.GetChar( c );
552 
553 				if ( aDreierGruppe.Len() == 3 )
554 				{
555 					aOut += aTr.GetChar( cRest );
556 					aOut += aDreierGruppe;
557 					cRest = 0;
558 					aDreierGruppe = "";
559 				}
560 				aStream >> c;
561 			}
562 			if ( aDreierGruppe.Len() )
563 			{
564 				aOut += cRest;
565 				aOut += aDreierGruppe;
566 			}
567 			::svt::OStringTransfer::CopyString( aOut );
568 **********************************************************************************/
569 
570 			new StatementSlot( StatementList::pTTProperties->nSidPaste );
571 			return;
572 		}
573 		case 7:
574 		{
575 			new StatementSlot( 20384 );	// FN_TOOL_ANKER_CHAR aus SW?
576 			return;
577 		}
578 	}
579 
580 	// Wir sind am Ende
581 
582 #if OSL_DEBUG_LEVEL < 2
583 	delete this;
584 #endif
585 }
586 
587 IMPL_LINK( ImplRemoteControl, IdleHdl, Application*, EMPTYARG )
588 {
589 	if( StatementList::pFirst )
590 	{
591         #if OSL_DEBUG_LEVEL > 1
592 		m_pDbgWin->AddText( "* " );
593 		#endif
594 		GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) );
595 	}
596 	return 0;
597 }
598 
599 
600 
601 IMPL_LINK( ImplRemoteControl, CommandHdl, Application*, EMPTYARG )
602 {
603 #if OSL_DEBUG_LEVEL > 1
604 	m_pDbgWin->AddText( "Entering CommandHdl\n" );
605 #endif
606 
607 	if ( StatementList::MaybeResetSafeReschedule() )
608 	{
609 		StatementList::bExecuting = sal_False;		// Wird nacher im SafeReschedule wieder zur�ckgesetzt
610 #if OSL_DEBUG_LEVEL > 1
611 		m_pDbgWin->AddText( "SafeReschedule has been reset\n" );
612 #endif
613 	}
614 
615 	if ( ( StatementList::bReadingCommands && !StatementList::bDying ) ||
616 		 ( StatementList::bExecuting ) ||
617 		 ( StatementList::IsInReschedule() ) )
618 		{
619 #if OSL_DEBUG_LEVEL > 1
620 			if ( StatementList::bReadingCommands )
621 				m_pDbgWin->AddText( "Reading Commands " );
622 			if ( StatementList::bExecuting )
623 				m_pDbgWin->AddText( "In Execute " );
624 			if ( StatementList::IsInReschedule() )
625 			{
626 				m_pDbgWin->AddText( "In Reschedule FocusWindow: 0x" );
627 				m_pDbgWin->AddText(
628 				        String::CreateFromInt64(
629 				            sal::static_int_cast< sal_Int64 >(
630 				                reinterpret_cast< sal_IntPtr >(GetpApp()->GetFocusWindow())),
631 				            16 ));
632                                 m_pDbgWin->AddText( " " );
633 			}
634 			m_pDbgWin->AddText( "Leaving CommandHdl\n" );
635 #endif
636 			return 0;        // Garnicht erst irgendwelchen bl�dsinn machen
637 		}
638 
639 	while( StatementList::pFirst && ( !StatementList::bReadingCommands || StatementList::bDying ) )
640 		// Schleift hier bis Befehl nicht zur�ckkommt,
641 		// Wird dann rekursiv �ber IdleHdl und PostUserEvent aufgerufen.
642 	{
643         m_bInsideExecutionLoop = sal_True;
644 #ifdef TIMERIDLE
645         m_aIdleTimer.Stop();
646         m_aIdleTimer.Start();
647 #endif
648 		StatementList *pC = StatementList::pFirst;
649 
650 //      MessBox MB( pMainWin, WB_DEF_OK|WB_OK, "Pause ...", "... und Weiter" );
651 //      MB.Execute();
652 
653         if ( !StatementList::bCatchGPF )
654         {
655 			if (!pC->CheckWindowWait()  ||  !pC->Execute())
656 			{
657 #if OSL_DEBUG_LEVEL > 1
658 				m_pDbgWin->AddText( "Leaving CommandHdl\n" );
659 #endif
660 				return 0;        // So dass die App nochmal �ne chance bekommt
661 			}
662         }
663         else
664         {
665 		    try
666 		    {
667 			    if (!pC->CheckWindowWait()  ||  !pC->Execute())
668 			    {
669 #if OSL_DEBUG_LEVEL > 1
670 				    m_pDbgWin->AddText( "Leaving CommandHdl\n" );
671 #endif
672 				    return 0;        // So dass die App nochmal �ne chance bekommt
673 			    }
674 		    }
675 		    catch( ... )
676 		    {
677 			    if ( !StatementFlow::bUseIPC )
678 				    throw;	// aus der Hilfe heraus nicht leise abbrechen
679 
680 			    try
681 			    {
682 				    ModelessDialog *pDlg = new ModelessDialog(NULL);
683 				    pDlg->SetOutputSizePixel(Size(150,0));
684 				    pDlg->SetText( String ( TTProperties::GetSvtResId( TT_GPF ) ) );
685 				    pDlg->Show();
686 				    DBG_ERROR("GPF");
687 				    pC->ReportError( GEN_RES_STR0( S_GPF_ABORT ) );
688 				    StatementList::bDying = sal_True;
689 				    while ( StatementList::pFirst )			// Kommandos werden �bersprungen
690 					    StatementList::NormalReschedule();
691 				    delete pDlg;
692 			    }
693 			    catch ( ... )
694 			    {
695 				    Application::Quit();
696 			    }
697 			    Application::Quit();
698 		    }
699         }
700 
701 /*  #i46293# remove reschedules
702 		for (int xx = 1;xx < 20;xx++)
703 			StatementList::NormalReschedule();
704 */
705         m_bInsideExecutionLoop = sal_False;
706 	}
707 
708 	StatementList::aWindowWaitUId = rtl::OString();  // Warten r�cksetzen, da handler sowieso verlassen wird
709 
710 /*    if( StatementList::pFirst && !StatementList::bReadingCommands )
711 		 // Abfrage n�tig, da andere CommandHdl aktiv sein k�nnen oder
712 		 // neue Commands gelesen werden k�nnen
713 	{
714 		delete StatementList::pFirst;     // L�scht die gesamte Liste !!
715 		StatementList::pFirst   = NULL;
716 		StatementList::pCurrent = NULL;   // Nur zur Sicherheit, sollte hier sowieso NULL sein
717 	}*/
718 
719 #if OSL_DEBUG_LEVEL > 1
720 	m_pDbgWin->AddText( "Leaving CommandHdl\n" );
721 #endif
722 	return 0;
723 }
724 
725 IMPL_LINK( ImplRemoteControl, QueCommandsEvent, CommunicationLink*, pCL )
726 {
727 	SvStream *pTemp = pCL->GetServiceData();
728 	QueCommands( SI_IPCCommandBlock, pTemp );
729 	delete pTemp;
730 	return 0;
731 }
732 
733 sal_Bool ImplRemoteControl::QueCommands( sal_uLong nServiceId, SvStream *pIn )
734 {
735 //    return sal_True;
736 	sal_uInt16 nId;
737 
738 	if( !m_bIdleInserted )
739 	{
740 #ifdef TIMERIDLE
741         m_aIdleTimer.SetTimeoutHdl( LINK( this, ImplRemoteControl, IdleHdl ) );
742         m_aIdleTimer.SetTimeout( 500 );
743         m_aIdleTimer.Start();
744 #else
745 		GetpApp()->InsertIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ), 1 );
746 #endif
747 		m_bIdleInserted = sal_True;
748 	}
749 
750 
751 	StatementList::bReadingCommands = sal_True;
752 
753 #if OSL_DEBUG_LEVEL > 1
754 	if (!m_pDbgWin->bQuiet)
755 		m_pDbgWin->Show();
756 	m_pDbgWin->AddText( "Reading " );
757 	m_pDbgWin->AddText( String::CreateFromInt64( nServiceId ) );
758 	m_pDbgWin->AddText( " :\n" );
759 #endif
760 
761 	if( nServiceId != SI_IPCCommandBlock && nServiceId != SI_DirectCommandBlock )
762 	{
763 		DBG_ERROR1( "Ung�ltiger Request :%i", (int)nServiceId );
764 		return sal_False;
765 	}
766 
767 	SCmdStream *pCmdStream = new SCmdStream(pIn);
768 
769 	pCmdStream->Read( nId );
770 	while( !pIn->IsEof() )
771 	{
772 		switch( nId )
773 		{
774 			case SICommand:
775 			{
776 				new StatementCommand( pCmdStream );     // Wird im Konstruktor an Liste angeh�ngt
777 				break;
778 			}
779 			case SIControl:
780 			case SIStringControl:
781 			{
782 				new StatementControl( pCmdStream, nId );     // Wird im Konstruktor an Liste angeh�ngt
783 				break;
784 			}
785 			case SISlot:
786 			{
787 				new StatementSlot( pCmdStream );    // Wird im Konstruktor an Liste angeh�ngt
788 				break;
789 			}
790 			case SIUnoSlot:
791 			{
792 				new StatementUnoSlot( pCmdStream );    // Wird im Konstruktor an Liste angeh�ngt
793 				break;
794 			}
795 			case SIFlow:
796 			{
797 				new StatementFlow( nServiceId, pCmdStream, this );              // Wird im Konstruktor an Liste angeh�ngt
798 				break;
799 			}
800 			default:
801 				DBG_ERROR1( "Unbekannter Request Nr:%i", nId );
802 				break;
803 		}
804 		if( !pIn->IsEof() )
805 			pCmdStream->Read( nId );
806 		else {
807 			DBG_ERROR( "truncated input stream" );
808         }
809 	}
810 
811 	StatementList::bReadingCommands = sal_False;
812 
813 	delete pCmdStream;
814 #if OSL_DEBUG_LEVEL > 1
815 	m_pDbgWin->AddText( "Done Reading " );
816 	m_pDbgWin->AddText( String::CreateFromInt64( nServiceId ) );
817 	m_pDbgWin->AddText( " :\n" );
818 #endif
819     if ( !m_bInsideExecutionLoop )
820     {
821 #ifdef DEBUG
822         m_pDbgWin->AddText( "Posting Event for CommandHdl.\n" );
823 #endif
824 
825         GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) );
826     }
827 #ifdef DEBUG
828     else
829         m_bInsideExecutionLoop = sal_True;
830 #endif
831 	return sal_True;
832 } // sal_Bool ImplRemoteControl::QueCommands( sal_uLong nServiceId, SvStream *pIn )
833 
834 
835 SvStream* ImplRemoteControl::GetReturnStream()
836 {
837 	SvStream* pTemp = pRetStream;
838 	pRetStream = NULL;
839 	return pTemp;
840 }
841 
842 ImplRemoteControl::ImplRemoteControl()
843 : m_bIdleInserted( sal_False )
844 , m_bInsideExecutionLoop( sal_False )
845 #if OSL_DEBUG_LEVEL > 1
846 , m_pDbgWin(NULL)
847 #endif
848 , pRetStream(NULL)
849 {
850 #if OSL_DEBUG_LEVEL > 1
851 	if ( RemoteControlCommunicationManager::GetPort() != TT_NO_PORT_DEFINED || RemoteControlCommunicationManager::nComm )
852 	{
853 		m_pDbgWin = new EditWindow( NULL, CUniString("Debug Window"), WB_VSCROLL );
854 		m_pDbgWin->bQuiet = sal_True;
855 		m_pDbgWin->Hide();
856 		m_pDbgWin->bQuiet = sal_False;
857         m_pDbgWin->Show();
858 
859 		StatementList::m_pDbgWin = m_pDbgWin;
860 	}
861 #endif
862 	if ( RemoteControlCommunicationManager::GetPort() == TT_NO_PORT_DEFINED )
863 		pServiceMgr = NULL;
864 	else
865 	{
866 #if OSL_DEBUG_LEVEL > 1
867 		pServiceMgr = new RemoteControlCommunicationManager( m_pDbgWin );
868 #else
869 		pServiceMgr = new RemoteControlCommunicationManager();
870 #endif
871 		pServiceMgr->SetDataReceivedHdl( LINK( this, ImplRemoteControl, QueCommandsEvent ) );
872 		pServiceMgr->StartCommunication();
873 
874 #ifdef DBG_UTIL
875 		DbgSetPrintTestTool( TestToolDebugPrint );
876 		// first change it, so we get the original Pointer
877 		StatementCommand::pOriginal_osl_DebugMessageFunc = osl_setDebugMessageFunc( osl_TestToolDebugPrint );
878 		if ( DbgGetErrorOut() != DBG_OUT_TESTTOOL )
879 			osl_setDebugMessageFunc( StatementCommand::pOriginal_osl_DebugMessageFunc );
880 #endif
881 	}
882 	if ( RemoteControlCommunicationManager::nComm )
883 		new ExtraIdle( this );		// Setzt die Bearbeitung wieder auf
884 }
885 
886 ImplRemoteControl::~ImplRemoteControl()
887 {
888     if ( MacroRecorder::HasMacroRecorder() )
889         MacroRecorder::GetMacroRecorder()->SetActionRecord( sal_False );   // Will delete MacroRecorder if necessary
890 
891 
892     StatementList::bDying = sal_True;
893 #if OSL_DEBUG_LEVEL > 1
894 	if ( m_pDbgWin )
895 		m_pDbgWin->bQuiet = sal_True;	// Keine Ausgabe mehr im Debugwindow
896 #endif
897 
898 #ifdef DBG_UTIL
899 	// Zur�cksetzen, so da� nachfolgende Assertions nicht verloren gehen
900 	DbgSetPrintTestTool( NULL );
901     osl_setDebugMessageFunc( StatementCommand::pOriginal_osl_DebugMessageFunc );
902 #endif
903 
904 	if ( StatementList::pFirst )
905 	{	// Es sind noch Kommandos da, also auch eine M�glichkeit zur�ckzusenden.
906 		StatementList::pFirst->ReportError( GEN_RES_STR0( S_APP_SHUTDOWN ) );
907 		while ( StatementList::pFirst )				// Kommandos werden �bersprungen
908 			StatementList::NormalReschedule();		// Fehler zur�ckgeschickt
909 	}
910 
911 	if ( pServiceMgr )
912 		pServiceMgr->StopCommunication();
913 
914     if ( GetTTSettings()->pDisplayHidWin )
915     {
916         delete (Window*)(GetTTSettings()->pDisplayHidWin);
917         GetTTSettings()->pDisplayHidWin = NULL;
918     }
919     if ( GetTTSettings()->pTranslateWin )
920     {
921         delete (Window*)(GetTTSettings()->pTranslateWin);
922         GetTTSettings()->pTranslateWin = NULL;
923     }
924 #if OSL_DEBUG_LEVEL > 1
925 	delete m_pDbgWin;
926 #endif
927 	if( m_bIdleInserted )
928 	{
929 #ifdef TIMERIDLE
930         m_aIdleTimer.Stop();
931 #else
932 		GetpApp()->RemoveIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ) );
933 #endif
934 		m_bIdleInserted = sal_False;
935 	}
936 	delete pServiceMgr;
937 }
938 
939 RemoteControl::RemoteControl()
940 {
941 	pImpl = new ImplRemoteControl;
942 }
943 
944 RemoteControl::~RemoteControl()
945 {
946 	delete pImpl;
947 }
948 
949 static ::osl::Mutex aMutex;
950 static RemoteControl* pRemoteControl = 0;
951 extern "C" void CreateRemoteControl()
952 {
953 	if ( !pRemoteControl )
954 	{
955 		::osl::MutexGuard aGuard( aMutex );
956 		if ( !pRemoteControl )
957 			pRemoteControl = new RemoteControl();
958 	}
959 }
960 
961 extern "C" void DestroyRemoteControl()
962 {
963 	::osl::MutexGuard aGuard( aMutex );
964 	delete pRemoteControl;
965 	pRemoteControl = 0;
966 }
967 
968 extern "C" void CreateEventLogger()
969 {
970     MacroRecorder::GetMacroRecorder()->SetActionLog();
971 }
972 
973 extern "C" void DestroyEventLogger()
974 {
975     MacroRecorder::GetMacroRecorder()->SetActionLog( sal_False );   // Will delete MacroRecorder if necessary
976 }
977 
978