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