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