xref: /AOO41X/main/automation/source/server/statemnt.cxx (revision 54628ca40d27d15cc98fe861da7fff7e60c2f7d6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_automation.hxx"
26 #include <com/sun/star/frame/XFramesSupplier.hpp>
27 #include <com/sun/star/frame/XDispatch.hpp>
28 #include <com/sun/star/frame/XDispatchProvider.hpp>
29 #include <com/sun/star/util/XURLTransformer.hpp>
30 #include <comphelper/processfactory.hxx>
31 #include <comphelper/uieventslogger.hxx>
32 
33 #include <tools/wintypes.hxx>
34 #ifndef _DIALOG_HXX //autogen
35 #include <vcl/dialog.hxx>
36 #endif
37 #ifndef _BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
39 #endif
40 #include <vcl/menubtn.hxx>
41 #include <svtools/svtreebx.hxx>
42 #include <svtools/brwbox.hxx>
43 #ifndef _MSGBOX_HXX //autogen
44 #include <vcl/msgbox.hxx>
45 #endif
46 #ifndef _DOCKWIN_HXX //autogen
47 #include <vcl/dockwin.hxx>
48 #endif
49 #ifndef _FLOATWIN_HXX //autogen
50 #include <vcl/floatwin.hxx>
51 #endif
52 #ifndef _LSTBOX_HXX //autogen
53 #include <vcl/lstbox.hxx>
54 #endif
55 #ifndef _COMBOBOX_HXX //autogen
56 #include <vcl/combobox.hxx>
57 #endif
58 #ifndef _MOREBTN_HXX //autogen
59 #include <vcl/morebtn.hxx>
60 #endif
61 #ifndef _FIELD_HXX //autogen
62 #include <vcl/field.hxx>
63 #endif
64 #ifndef _TOOLBOX_HXX //autogen
65 #include <vcl/toolbox.hxx>
66 #endif
67 #include <vcl/tabctrl.hxx>
68 #include <vcl/tabpage.hxx>
69 #include <vcl/menu.hxx>
70 #include <vcl/status.hxx>
71 #include <svtools/prgsbar.hxx>
72 #include <svtools/editbrowsebox.hxx>
73 #include <vcl/splitwin.hxx>
74 #include <vcl/group.hxx>
75 #include <vcl/fixed.hxx>
76 #include <vcl/wrkwin.hxx>
77 #include <osl/diagnose.h>
78 #include <svtools/valueset.hxx>
79 #include <svtools/roadmap.hxx>
80 #include <svtools/table/tablecontrol.hxx>
81 #include <svtools/table/tablecontrolinterface.hxx>
82 #include <svl/poolitem.hxx>
83 #include <svtools/extensionlistbox.hxx>
84 // Hat keinen Includeschutz
85 #include <svtools/svtdata.hxx>
86 #include <tools/time.hxx>
87 #include <svtools/stringtransfer.hxx>
88 #include <tools/stream.hxx>
89 #include <tools/fsys.hxx>
90 #include <svl/stritem.hxx>
91 #include <svtools/ttprops.hxx>
92 #ifndef _BASIC_TTRESHLP_HXX
93 #include <basic/ttstrhlp.hxx>
94 #endif
95 #include <basic/dispdefs.hxx>
96 #include <basic/sbuno.hxx>
97 #include <vos/socket.hxx>
98 #include <svl/pickerhistory.hxx>
99 #include <com/sun/star/util/XCancellable.hpp>
100 
101 #include <sot/storage.hxx>
102 #include <sot/storinfo.hxx>
103 #include "statemnt.hxx"
104 #include "scmdstrm.hxx"
105 
106 #ifndef _RETSRTM_HXX
107 #include "retstrm.hxx"
108 #endif
109 
110 #if OSL_DEBUG_LEVEL > 1
111 #include "editwin.hxx"
112 #endif
113 #include "rcontrol.hxx"
114 #include <automation/communi.hxx>
115 #include "testtool.hxx"
116 
117 #include "profiler.hxx"
118 
119 #include "recorder.hxx"
120 
121 #include "testtool.hrc"
122 #include <basic/svtmsg.hrc>
123 
124 #include <algorithm>
125 
126 
127 using namespace com::sun::star::frame;
128 using namespace com::sun::star::uno;
129 //using namespace com::sun::star::util; geht wegen Color nicht
130 using namespace com::sun::star::beans;
131 using namespace svt;
132 //using namespace svt::table;
133 
134 
135 #ifndef SBX_VALUE_DECL_DEFINED
136 #define SBX_VALUE_DECL_DEFINED
137 SV_DECL_REF(SbxValue)
138 #endif
139 SV_IMPL_REF(SbxValue)
140 
141 CommunicationLink *StatementFlow::pCommLink = NULL;
142 sal_Bool StatementFlow::bUseIPC = sal_True;
143 sal_Bool StatementFlow::bSending = sal_False;
144 ImplRemoteControl *StatementFlow::pRemoteControl = NULL;
145 
146 sal_uInt16 StatementCommand::nDirPos = 0;
147 Dir *StatementCommand::pDir = NULL;
148 pfunc_osl_printDebugMessage StatementCommand::pOriginal_osl_DebugMessageFunc = NULL;
149 
150 
151 #define RESET_APPLICATION_TO_BACKING_WINDOW
152 
153 
154 #define SET_WINP_CLOSING(pWin) \
155     pWindowWaitPointer = pWin; \
156     aWindowWaitUId = pControl->GetUniqueOrHelpId(); \
157     aWindowWaitOldHelpId = pWin->GetHelpId(); \
158     aWindowWaitOldUniqueId = pWin->GetUniqueId(); \
159     pWin->SetHelpId( rtl::OString("TT_Win_is_closing_HID") ); \
160     pWin->SetUniqueId( rtl::OString("TT_Win_is_closing_UID") );
161 
162 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
163 
164 StatementFlow::StatementFlow( StatementList *pAfterThis, sal_uInt16 nArtP )
165 : nArt(nArtP)
166 , nParams(0)
167 , nSNr1(0)
168 , nLNr1(0)
169 , aString1()
170 , bBool1(sal_False)
171 {
172     QueStatement( pAfterThis );
173 }
174 
175 StatementFlow::StatementFlow( sal_uLong nServiceId, SCmdStream *pCmdIn, ImplRemoteControl *pRC )
176 : nArt(0)
177 , nParams(0)
178 , nSNr1(0)
179 , nLNr1(0)
180 , aString1()
181 , bBool1(sal_False)
182 {
183     QueStatement( NULL );
184     bUseIPC = (nServiceId == SI_IPCCommandBlock);
185     pRemoteControl = pRC;
186     pCmdIn->Read( nArt );
187     pCmdIn->Read( nParams );
188 
189     if( nParams & PARAM_USHORT_1 )  pCmdIn->Read( nSNr1 );
190     if( nParams & PARAM_ULONG_1 )   pCmdIn->Read( nLNr1 );
191     if( nParams & PARAM_STR_1 )     pCmdIn->Read( aString1 );
192     if( nParams & PARAM_BOOL_1 )    pCmdIn->Read( bBool1 ); // sollte nie auftreten!!
193 
194 #if OSL_DEBUG_LEVEL > 1
195     m_pDbgWin->AddText( "Reading FlowControl: " );
196     m_pDbgWin->AddText( String::CreateFromInt32( nArt ) );
197     m_pDbgWin->AddText( " Params:" );
198     if( nParams & PARAM_USHORT_1 )  {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nSNr1 ) );}
199     if( nParams & PARAM_ULONG_1 )   {m_pDbgWin->AddText( " l1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
200     if( nParams & PARAM_STR_1 )     {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
201     if( nParams & PARAM_BOOL_1 )    {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
202     m_pDbgWin->AddText( "\n" );
203 #endif
204 }
205 
206 void StatementFlow::SendViaSocket()
207 {
208     if ( bSending )
209     {
210 #if OSL_DEBUG_LEVEL > 1
211         m_pDbgWin->AddText( "SendViaSocket called recursively. Aborted!!!\n" );
212 #endif
213         DBG_ERROR("SendViaSocket called recursively. Aborted!!!");
214         return;
215     }
216     bSending = sal_True;
217     if ( pCommLink )
218     {
219         if ( !pCommLink->TransferDataStream( pRet->GetStream() ) )  // tritt ein Fehler auf, so wird sofort gel�scht ...
220             pCommLink = NULL;
221     }
222     else
223     {
224         // Macht nix. Wenn das Basic nicht mehr da ist, ist sowiso alles egal
225         DBG_ERROR("Cannot send results to TestTool");
226     }
227 
228     pRet->Reset();
229     bSending = sal_False;
230     IsError = sal_False;
231 }
232 
233 sal_Bool StatementFlow::Execute()
234 {
235 #if OSL_DEBUG_LEVEL > 1
236     m_pDbgWin->AddText( "Executing Flow: " );
237     m_pDbgWin->AddText( String::CreateFromInt32( nArt ) );
238     m_pDbgWin->AddText( "\n" );
239 #endif
240     switch ( nArt )
241     {
242     case F_EndCommandBlock:
243         {
244 
245             if ( !bUseIPC )
246             {
247                 // bBool1 wurde im CTOR auf sal_False initialisiert
248                 if ( !bBool1 )  // also erster Durchlauf
249                 {
250                     pRemoteControl->pRetStream = pRet->GetStream();
251                     bBool1 = sal_True;  // wurde im CTOR auf sal_False initialisiert
252                     nRetryCount = nRetryCount * 4;
253                 }
254                 if ( pRemoteControl->pRetStream && (nRetryCount--) )    // also solange nicht abgeholt
255                 {
256                     return sal_False;   // Bitte einmal vom Callstack runter
257                 }
258             }
259 
260         }
261         break;
262     }
263 
264     Advance();
265     switch ( nArt )
266     {
267     case F_EndCommandBlock:
268         if ( !bUseIPC )
269         {   // wird oben abgehandelt
270             pRet->Reset();
271             IsError = sal_False;
272         }
273         else
274             SendViaSocket();
275 
276         break;
277 
278     case F_Sequence:
279 
280         pRet->GenReturn(RET_Sequence,nLNr1);
281         #if OSL_DEBUG_LEVEL > 1
282         m_pDbgWin->AddText( "Sending Sequence Nr: " );
283         m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );
284         m_pDbgWin->AddText( "\n" );
285         #endif
286 
287         break;
288 //  case RET_:
289     default:
290         DBG_ERROR( "Unknown Flowcontrol" );
291         break;
292     }
293 
294     delete this;
295     return sal_True;
296 }
297 
298 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
299 
300 // neue Hilfsfunktion, die stetig erweitert werden muss
301 static short ImpGetRType( Window *pWin )
302 {
303     short nRT = C_NoType;
304     WindowType eRT = pWin->GetType();
305     switch( eRT ) {
306         case WINDOW_WINDOW:             nRT = C_Window            ; break;
307 
308         case WINDOW_TABCONTROL:         nRT = C_TabControl        ; break;
309         case WINDOW_RADIOBUTTON:        nRT = C_RadioButton       ; break;
310         case WINDOW_CHECKBOX:           nRT = C_CheckBox          ; break;
311         case WINDOW_TRISTATEBOX:        nRT = C_TriStateBox       ; break;
312         case WINDOW_EDIT:               nRT = C_Edit              ; break;
313         case WINDOW_MULTILINEEDIT:      nRT = C_MultiLineEdit     ; break;
314         case WINDOW_MULTILISTBOX:       nRT = C_MultiListBox      ; break;
315         case WINDOW_LISTBOX:            nRT = C_ListBox           ; break;
316         case WINDOW_COMBOBOX:           nRT = C_ComboBox          ; break;
317         case WINDOW_PUSHBUTTON:         nRT = C_PushButton        ; break;
318         case WINDOW_SPINFIELD:          nRT = C_SpinField         ; break;
319         case WINDOW_PATTERNFIELD:       nRT = C_PatternField      ; break;
320         case WINDOW_NUMERICFIELD:       nRT = C_NumericField      ; break;
321         case WINDOW_METRICFIELD:        nRT = C_MetricField       ; break;
322         case WINDOW_CURRENCYFIELD:      nRT = C_CurrencyField     ; break;
323         case WINDOW_DATEFIELD:          nRT = C_DateField         ; break;
324         case WINDOW_TIMEFIELD:          nRT = C_TimeField         ; break;
325         case WINDOW_IMAGERADIOBUTTON:   nRT = C_ImageRadioButton  ; break;
326         case WINDOW_NUMERICBOX:         nRT = C_NumericBox        ; break;
327         case WINDOW_METRICBOX:          nRT = C_MetricBox         ; break;
328         case WINDOW_CURRENCYBOX:        nRT = C_CurrencyBox       ; break;
329         case WINDOW_DATEBOX:            nRT = C_DateBox           ; break;
330         case WINDOW_TIMEBOX:            nRT = C_TimeBox           ; break;
331         case WINDOW_IMAGEBUTTON:        nRT = C_ImageButton       ; break;
332         case WINDOW_MENUBUTTON:         nRT = C_MenuButton        ; break;
333         case WINDOW_MOREBUTTON:         nRT = C_MoreButton        ; break;
334 
335 
336         case WINDOW_TABPAGE:            nRT = C_TabPage;        break;
337         case WINDOW_MODALDIALOG:        nRT = C_ModalDlg;       break;
338         case WINDOW_FLOATINGWINDOW:     nRT = C_FloatWin;       break;
339         case WINDOW_MODELESSDIALOG:     nRT = C_ModelessDlg;    break;
340         case WINDOW_WORKWINDOW:         nRT = C_WorkWin;        break;
341         case WINDOW_DOCKINGWINDOW:      nRT = C_DockingWin;     break;
342 
343         case WINDOW_MESSBOX:            nRT = C_MessBox;        break;
344         case WINDOW_INFOBOX:            nRT = C_InfoBox;        break;
345         case WINDOW_WARNINGBOX:         nRT = C_WarningBox;     break;
346         case WINDOW_ERRORBOX:           nRT = C_ErrorBox;       break;
347         case WINDOW_QUERYBOX:           nRT = C_QueryBox;       break;
348 #if 0 //ifndef VCL
349         case WINDOW_FILEDIALOG:         nRT = C_FileDlg;        break;
350         case WINDOW_PATHDIALOG:         nRT = C_PathDlg;        break;
351         case WINDOW_PRINTDIALOG:        nRT = C_PrintDlg;       break;
352         case WINDOW_PRINTERSETUPDIALOG: nRT = C_PrinterSetupDlg;break;
353         case WINDOW_COLORDIALOG:        nRT = C_ColorDlg;       break;
354 #endif
355         case WINDOW_TABDIALOG:          nRT = C_TabDlg;         break;
356 //      case WINDOW_TABDIALOG:          nRT = C_SingleTabDlg;   break;
357 
358         case WINDOW_PATTERNBOX:         nRT = C_PatternBox;     break;
359         case WINDOW_TOOLBOX:            nRT = C_ToolBox;        break;
360 // Gibts nicht       case WINDOW_VALUESET:          nRT = C_ValueSet;       break;
361         case WINDOW_CONTROL:            nRT = C_Control;        break;
362         case WINDOW_OKBUTTON:           nRT = C_OkButton;       break;
363         case WINDOW_CANCELBUTTON:       nRT = C_CancelButton;   break;
364         case WINDOW_BUTTONDIALOG:       nRT = C_ButtonDialog;   break;
365         case WINDOW_TREELISTBOX:        nRT = C_TreeListBox;    break;
366 
367         case WINDOW_DIALOG:             nRT = C_Dialog;         break;
368     }
369     return nRT;
370 }
371 
372 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
373 
374 StatementSlot::StatementSlot( SCmdStream *pCmdIn )
375 : pItemArr(NULL)
376 {
377     QueStatement( NULL );
378     pCmdIn->Read( nFunctionId );
379 #if OSL_DEBUG_LEVEL > 1
380     m_pDbgWin->AddText( "Reading Slot: " );
381     m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
382     m_pDbgWin->AddText( "\n" );
383 #endif
384     pCmdIn->Read( nAnzahl );
385     if ( nAnzahl )
386     {
387         switch ( pCmdIn->GetNextType() )
388         {
389             case BinUSHORT: // use old calling method
390                 {
391                     nAnzahl++;
392                     pItemArr = new SfxPoolItem*[nAnzahl];
393                     for (sal_uInt16 i = 0 ; i+1 < nAnzahl ; i++)
394                         pCmdIn->Read( pItemArr[i] );
395                     pItemArr[nAnzahl-1] = NULL;
396                 }
397                 break;
398             case BinString: // new Method
399                 {
400                     aArgs.realloc(nAnzahl);
401                     PropertyValue* pArg = aArgs.getArray();
402                     for (sal_uInt16 i = 0 ; i < nAnzahl ; i++)
403                         pCmdIn->Read( pArg[i] );
404                 }
405                 break;
406         }
407     }
408 }
409 
410 // Constructor for UnoSlot
411 StatementSlot::StatementSlot()
412 : nAnzahl( 0 )
413 , pItemArr(NULL)
414 , nFunctionId( 0 )
415 , bMenuClosed(sal_False)
416 {}
417 
418 StatementSlot::StatementSlot( sal_uLong nSlot, SfxPoolItem* pItem )
419 : pItemArr(NULL)
420 , bMenuClosed(sal_False)
421 {
422     QueStatement( NULL );
423     nFunctionId = sal_uInt16(nSlot);
424 #if OSL_DEBUG_LEVEL > 1
425     m_pDbgWin->AddText( "Reading Slot: " );
426     m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
427     m_pDbgWin->AddText( "\n" );
428 #endif
429     if ( pItem )
430     {
431         nAnzahl = 2;
432         pItemArr = new SfxPoolItem*[2];
433         pItemArr[0] = pItem;
434         pItemArr[1] = NULL;
435     }
436     else
437         nAnzahl = 0;
438 }
439 
440 StatementSlot::~StatementSlot()
441 {
442     if (nAnzahl)
443     {
444         if ( pItemArr )
445         {
446             for (sal_uInt16 i = 0 ; i+1 < nAnzahl ; i++)
447                 delete pItemArr[i];
448             delete[] pItemArr;
449         }
450 
451         aArgs.realloc( 0 );
452     }
453 }
454 
455 void StatementSlot::AddReferer()
456 {
457     HACK( "only to test!" );
458 // because slot 6102 /*SID_VERB_START*/ crashes when called with Property Referer
459 // We return to the previous behavior (which was a bug realy) of not adding this Property to calls which have no properties at all
460 // according to MBA most likely this Property can be removed at all and is maybe only needed for Slots with URLs
461     if ( !nAnzahl )
462         return;
463 
464     PropertyValue* pArg;
465 
466     nAnzahl++;
467     aArgs.realloc(nAnzahl);
468     pArg = aArgs.getArray();
469     pArg[nAnzahl-1].Name = rtl::OUString::createFromAscii("Referer");
470     pArg[nAnzahl-1].Value <<= ::rtl::OUString::createFromAscii("private:user");
471 
472     nAnzahl++;
473     aArgs.realloc(nAnzahl);
474     pArg = aArgs.getArray();
475     pArg[nAnzahl-1].Name = rtl::OUString::createFromAscii("SynchronMode");
476     pArg[nAnzahl-1].Value <<= sal_Bool( sal_True );
477 }
478 
479 class SlotStatusListener : public cppu::WeakImplHelper1< XStatusListener >
480 {
481 public:
482     SlotStatusListener();
483 
484     // XStatusListener
485     virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
486     // XEventListener
487     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
488 
489     // local Members
490     sal_Bool bDisposed;
491     sal_Bool bEnabled;
492 };
493 /*
494 struct FeatureStateEvent : public ::com::sun::star::lang::EventObject
495     ::com::sun::star::util::URL FeatureURL;
496     ::rtl::OUString FeatureDescriptor;
497     sal_Bool IsEnabled;
498     sal_Bool Requery;
499     ::com::sun::star::uno::Any State;
500 
501     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > Source;
502 */
503 
504 SlotStatusListener::SlotStatusListener()
505 : bDisposed( sal_False )
506 , bEnabled( sal_True )
507 {}
508 
509 // XStatusListener
510 void SAL_CALL SlotStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
511 {
512 //    DBG_ERROR1("FeatureURL: %s", ByteString( String( Event.FeatureURL.Complete ), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
513 //    DBG_ERROR1("FeatureDescriptor: %s", ByteString( String( Event.FeatureDescriptor ), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
514     bEnabled = Event.IsEnabled;
515 //    DBG_ASSERT( Event.IsEnabled, "Not enabled" );
516 //    DBG_ASSERT( !Event.Requery, "Requery" );
517 }
518 
519 // XEventListener
520 void SAL_CALL SlotStatusListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
521 {
522     bDisposed = sal_True;
523 }
524 
525 sal_Bool StatementSlot::Execute()
526 {
527     if ( IsError )
528     {
529         #if OSL_DEBUG_LEVEL > 1
530         m_pDbgWin->AddText( "Skipping Slot: " );
531         m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
532         m_pDbgWin->AddText( "\n" );
533         #endif
534 
535         Advance();
536         delete this;
537         return sal_True;
538     }
539 
540     InitProfile();
541 #if OSL_DEBUG_LEVEL > 1
542     m_pDbgWin->AddText( "Executing Slot: " );
543     m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
544     m_pDbgWin->AddText( "\n" );
545 #endif
546 
547     PopupMenu *pPopup = NULL;
548     MenuBar *pMenuBar = NULL;
549     Menu *pMenu;
550 
551     GetCurrentMenues( pPopup, pMenuBar, pMenu );
552     if ( pPopup )
553     {
554         if ( !bMenuClosed )
555         {
556             pPopup->EndExecute(0);
557             aSubMenuId1 = 0;
558             aSubMenuId2 = 0;
559             aSubMenuId3 = 0;
560             pMenuWindow = NULL;
561             bMenuClosed = sal_True;
562 #if OSL_DEBUG_LEVEL > 1
563             m_pDbgWin->AddText( "Closed contextmenu\n" );
564 #endif
565             return sal_False;
566         }
567         else if ( nRetryCount-- )
568         {
569 #if OSL_DEBUG_LEVEL > 1
570             m_pDbgWin->AddText( "Waiting for contextmenu to close\n" );
571 #endif
572             return sal_False;
573         }
574         else
575             ReportError( GEN_RES_STR0( S_MENU_NOT_CLOSING ) );
576     }
577 
578     Advance();
579 
580     if ( !IsError )
581     {
582         if ( ( nAnzahl == 0 && !getenv("OLDSLOTHANDLING") ) || aArgs.hasElements() )
583         {   // trying to call slots via uno
584             AddReferer();
585             if ( !aUnoUrl.Len() )
586                 aUnoUrl = CUniString("slot:").Append( String::CreateFromInt32( nFunctionId ) );
587             ::com::sun::star::util::URL aTargetURL;
588             aTargetURL.Complete = aUnoUrl;
589             Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.frame.Desktop") ), UNO_QUERY );
590             Reference < XFrame > xFrame;
591 
592             if ( xDesktop.is() )
593             {
594                 xFrame = xDesktop->getActiveFrame();
595                 if ( !xFrame.is() )
596                 {
597                     Reference < XFrames > xFrames;
598                     xFrames = xDesktop->getFrames();
599                     if ( xFrames.is() && xFrames->getCount() > 0 )
600                     {
601                         Any aFrame = xFrames->getByIndex( xFrames->getCount() -1 );
602                         aFrame >>= xFrame;
603                     }
604                 }
605                 if ( !xFrame.is() )
606                 {
607                     if ( GetFirstDocFrame() )
608                         GetFirstDocFrame()->ToTop();
609                     xFrame = xDesktop->getActiveFrame();
610                 }
611             }
612 
613             if ( xFrame.is() )
614                 xDesktop = Reference < XFramesSupplier >( xFrame, UNO_QUERY );
615             else
616                 xDesktop.clear();
617 
618             while ( xDesktop.is() && xDesktop->getActiveFrame().is() )
619             {
620                 xFrame = xDesktop->getActiveFrame();
621 #if OSL_DEBUG_LEVEL > 1
622                 ::rtl::OUString aName;
623                 if ( xFrame.is() )
624                     aName = xFrame->getName();
625 #endif
626                 xDesktop = Reference < XFramesSupplier >( xFrame, UNO_QUERY );
627             }
628 
629             if ( !xFrame.is() )
630                 ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_FRAME, aTargetURL.Complete ) );
631             else
632             {
633                 Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY );
634                 xTrans->parseStrict( aTargetURL );
635 
636                 Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
637                 Reference < XDispatch > xDisp;
638                 while ( xProv.is() && !xDisp.is() )
639                 {
640                     xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
641                     if ( !xDisp.is() )
642                     {
643                         xFrame = Reference < XFrame > ( xFrame->getCreator(), UNO_QUERY );
644                         xProv = Reference < XDispatchProvider > ( xFrame, UNO_QUERY );
645                     }
646                 }
647 
648                 if ( xDisp.is() )
649                 {
650                     Reference < XStatusListener > xListener = ( XStatusListener* )new SlotStatusListener;
651                     xDisp->addStatusListener( xListener, aTargetURL );
652                     if ( static_cast< SlotStatusListener* >(xListener.get())->bEnabled )
653                     {
654                         if ( bIsSlotInExecute )
655                             ReportError( GEN_RES_STR0( S_SLOT_IN_EXECUTE ) );
656                         else
657                         {
658                             bIsSlotInExecute = sal_True;
659                             xDisp->dispatch( aTargetURL, aArgs );
660                             bIsSlotInExecute = sal_False;
661                         }
662                     }
663                     else
664                         ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_DISABLED, aTargetURL.Complete ) );
665                     xDisp->removeStatusListener( xListener, aTargetURL );
666                 }
667                 else
668                     ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_DISPATCHER, aTargetURL.Complete ) );
669             }
670         }
671         else
672         {
673             DirectLog( S_QAError, GEN_RES_STR0( S_DEPRECATED ) );
674             if ( !pTTProperties )
675                 pTTProperties = new TTProperties();
676 
677             switch ( pTTProperties->ExecuteFunction( nFunctionId, pItemArr, EXECUTEMODE_DIALOGASYNCHRON | nUseBindings ) )
678             {
679             case TT_PR_ERR_NODISPATCHER:
680                 {
681                     ReportError( rtl::OString::valueOf((sal_Int32)nFunctionId), GEN_RES_STR0( S_SID_EXECUTE_FAILED_NO_DISPATCHER ) );
682                 }
683                 break;
684             case TT_PR_ERR_NOEXECUTE:
685                 {
686                     ReportError( rtl::OString::valueOf((sal_Int32)nFunctionId), GEN_RES_STR0( S_SID_EXECUTE_FAILED ) );
687                 }
688                 break;
689             }
690         }
691     }
692 
693 
694 /*  Neues Verfahren ab 334!
695     Neue Methode zum einstellen, da� Modale Dialoge immer Asynchron aufgerufen werden
696     und echter Returnwert, ob Slot geklappt hat
697     und Testen ob Slot �berhaupt durch UI aufgerufen werden kann        */
698 
699 
700     SendProfile( SlotString( nFunctionId ) );
701     delete this;
702     return sal_True;
703 }
704 
705 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
706 
707 StatementUnoSlot::StatementUnoSlot(SCmdStream *pIn)
708 {
709     QueStatement( NULL );
710 
711     pIn->Read( aUnoUrl );
712 
713 #if OSL_DEBUG_LEVEL > 1
714     StatementList::m_pDbgWin->AddText( "UnoUrl:" );
715     StatementList::m_pDbgWin->AddText( aUnoUrl );
716     StatementList::m_pDbgWin->AddText( "\n" );
717 #endif
718 
719 }
720 
721 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
722 
723 StatementCommand::StatementCommand( StatementList *pAfterThis, sal_uInt16 MethodId, sal_uInt16 Params, sal_uInt16 Nr1 )
724 : nMethodId( MethodId )
725 , nParams(Params)
726 , nNr1(Nr1)
727 , nNr2(0)
728 , nNr3(0)
729 , nNr4(0)
730 , nLNr1(0)
731 , aString1()
732 , aString2()
733 , bBool1(sal_False)
734 , bBool2(sal_False)
735 {
736     QueStatement( pAfterThis );
737 
738 #if OSL_DEBUG_LEVEL > 1
739     m_pDbgWin->AddText( "Directly adding Conmmand:" );
740     m_pDbgWin->AddText( " Methode: " );
741     m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
742     m_pDbgWin->AddText( " Params:" );
743     if( nParams & PARAM_USHORT_1 )  {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
744     if( nParams & PARAM_USHORT_2 )  {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
745     if( nParams & PARAM_USHORT_3 )  {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
746     if( nParams & PARAM_USHORT_4 )  {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
747     if( nParams & PARAM_ULONG_1 )   {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
748     if( nParams & PARAM_STR_1 )     {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
749     if( nParams & PARAM_STR_2 )     {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
750     if( nParams & PARAM_BOOL_1 )    {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
751     if( nParams & PARAM_BOOL_2 )    {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );}
752     m_pDbgWin->AddText( "\n" );
753 #endif
754 }
755 
756 
757 StatementCommand::StatementCommand( SCmdStream *pCmdIn )
758 : nMethodId(0)
759 , nParams(0)
760 , nNr1(0)
761 , nNr2(0)
762 , nNr3(0)
763 , nNr4(0)
764 , nLNr1(0)
765 , aString1()
766 , aString2()
767 , bBool1(sal_False)
768 , bBool2(sal_False)
769 {
770     QueStatement( NULL );
771     pCmdIn->Read( nMethodId );
772     pCmdIn->Read( nParams );
773 
774     if( nParams & PARAM_USHORT_1 )  pCmdIn->Read( nNr1 );
775     if( nParams & PARAM_USHORT_2 )  pCmdIn->Read( nNr2 );
776     if( nParams & PARAM_USHORT_3 )  pCmdIn->Read( nNr3 );
777     if( nParams & PARAM_USHORT_4 )  pCmdIn->Read( nNr4 );
778     if( nParams & PARAM_ULONG_1 )   pCmdIn->Read( nLNr1 );
779     if( nParams & PARAM_STR_1 )     pCmdIn->Read( aString1 );
780     if( nParams & PARAM_STR_2 )     pCmdIn->Read( aString2 );
781     if( nParams & PARAM_BOOL_1 )    pCmdIn->Read( bBool1 );
782     if( nParams & PARAM_BOOL_2 )    pCmdIn->Read( bBool2 );
783 
784 #if OSL_DEBUG_LEVEL > 1
785     m_pDbgWin->AddText( "Reading Conmmand:" );
786     m_pDbgWin->AddText( " Methode: " );
787     m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
788     m_pDbgWin->AddText( " Params:" );
789     if( nParams & PARAM_USHORT_1 )  {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
790     if( nParams & PARAM_USHORT_2 )  {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
791     if( nParams & PARAM_USHORT_3 )  {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
792     if( nParams & PARAM_USHORT_4 )  {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
793     if( nParams & PARAM_ULONG_1 )   {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
794     if( nParams & PARAM_STR_1 )     {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
795     if( nParams & PARAM_STR_2 )     {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
796     if( nParams & PARAM_BOOL_1 )    {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
797     if( nParams & PARAM_BOOL_2 )    {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );}
798     m_pDbgWin->AddText( "\n" );
799 #endif
800 
801     if ( nMethodId == RC_AppAbort )
802     {
803         #if OSL_DEBUG_LEVEL > 1
804         m_pDbgWin->AddText( "*Deleting all Commands:\n" );
805         #endif
806         bReadingCommands = sal_False;
807         while ( StatementList::pFirst != this ) // Alles L�schen au�er mich selbst
808         {
809             StatementList *pDeQue = StatementList::pFirst;
810             pDeQue->Advance();
811             delete pDeQue;
812         }
813         bReadingCommands = sal_True;
814         #if OSL_DEBUG_LEVEL > 1
815         m_pDbgWin->AddText( "*Done deleting all Commands:\n" );
816         #endif
817     }
818 
819 }
820 
821 void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Bool bFirst )
822 {
823 
824     if ( IsDialog(pBase) && !bFirst )
825         return;
826 
827     if ( bFirst )
828         pRet->GenReturn ( RET_WinInfo, rtl::OString(), (comm_ULONG)nConf | DH_MODE_DATA_VALID, UniString(), sal_True );
829 
830     if ( bFirst )
831     {
832         if ( pBase->GetType() == WINDOW_WINDOW && pBase->GetParent() && pBase->GetParent()->GetType() == WINDOW_CONTROL &&
833              dynamic_cast< svt::table::TableControl* > ( pBase->GetParent() ) )
834             pBase = pBase->GetParent();
835     }
836 
837     {   // Klammerung, so da� der String nicht w�hrend der Rekursion bestehen bleibt
838         String aName;
839         sal_Bool bSkip = sal_False;
840 
841         switch ( pBase->GetType() )
842         {
843             case WINDOW_RADIOBUTTON:
844             case WINDOW_CHECKBOX:
845             case WINDOW_TRISTATEBOX:
846             case WINDOW_PUSHBUTTON:
847             case WINDOW_OKBUTTON:
848             case WINDOW_CANCELBUTTON:
849             case WINDOW_IMAGERADIOBUTTON:
850             case WINDOW_IMAGEBUTTON:
851             case WINDOW_MENUBUTTON:
852             case WINDOW_MOREBUTTON:
853             case WINDOW_TABPAGE:
854             case WINDOW_MODALDIALOG:
855             case WINDOW_FLOATINGWINDOW:
856             case WINDOW_MODELESSDIALOG:
857             case WINDOW_WORKWINDOW:
858             case WINDOW_DOCKINGWINDOW:
859             case WINDOW_CONTROL:
860 
861             case WINDOW_FILEDIALOG:
862             case WINDOW_PATHDIALOG:
863             case WINDOW_PRINTDIALOG:
864             case WINDOW_PRINTERSETUPDIALOG:
865             case WINDOW_COLORDIALOG:
866             case WINDOW_TABDIALOG:
867 
868             case WINDOW_BUTTONDIALOG:
869 
870             case WINDOW_MENUBARWINDOW:
871                 aName = pBase->GetText().EraseAllChars('~');
872                 break;
873 
874             case WINDOW_EDIT:
875             case WINDOW_MULTILINEEDIT:
876             case WINDOW_MULTILISTBOX:
877             case WINDOW_LISTBOX:
878             case WINDOW_COMBOBOX:
879             case WINDOW_SPINFIELD:
880             case WINDOW_PATTERNFIELD:
881             case WINDOW_NUMERICFIELD:
882             case WINDOW_METRICFIELD:
883             case WINDOW_CURRENCYFIELD:
884             case WINDOW_DATEFIELD:
885             case WINDOW_TIMEFIELD:
886             case WINDOW_NUMERICBOX:
887             case WINDOW_METRICBOX:
888             case WINDOW_CURRENCYBOX:
889             case WINDOW_DATEBOX:
890             case WINDOW_TIMEBOX:
891             case WINDOW_PATTERNBOX:
892             case WINDOW_TOOLBOX:
893                 aName = pBase->GetQuickHelpText();
894                 break;
895 
896             case WINDOW_MESSBOX:
897             case WINDOW_INFOBOX:
898             case WINDOW_WARNINGBOX:
899             case WINDOW_ERRORBOX:
900             case WINDOW_QUERYBOX:
901                 aName = ((MessBox*)pBase)->GetMessText();
902                 break;
903 
904             default:
905                 if ( ( pBase->GetUniqueOrHelpId().getLength() == 0 ) && !( nConf & DH_MODE_ALLWIN ) )
906                     bSkip = sal_True;
907                 break;
908         }
909 
910         if ( !bSkip )
911         {
912             if ( aName.Len() == 0 )
913                 aName = pBase->GetQuickHelpText();
914             if ( aName.Len() == 0 )
915                 aName = pBase->GetHelpText();
916             if ( aName.Len() == 0 )
917                 aName = pBase->GetText();
918 
919 
920             String aTypeSuffix;
921             if ( pBase->GetType() == WINDOW_CONTROL )
922             {
923                 if ( dynamic_cast< EditBrowseBox* >(pBase) )
924                     aTypeSuffix.AppendAscii( "/BrowseBox", 10 );
925                 else if ( dynamic_cast< ValueSet* >(pBase) )
926                     aTypeSuffix.AppendAscii( "/ValueSet", 9 );
927                 else if ( dynamic_cast< ORoadmap* >(pBase) )
928                     aTypeSuffix.AppendAscii( "/RoadMap", 8 );
929                 else if ( dynamic_cast< IExtensionListBox* >(pBase) )
930                     aTypeSuffix.AppendAscii( "/ExtensionListBox" );
931                 else if ( dynamic_cast< svt::table::TableControl* >(pBase) )
932                     aTypeSuffix.AppendAscii( "/TableControl" );
933                 else
934                     aTypeSuffix.AppendAscii( "/Unknown", 8 );
935             }
936 
937             rtl::OString aId = pBase->GetUniqueOrHelpId();
938             pRet->GenReturn ( RET_WinInfo, aId, (comm_ULONG)pBase->GetType(),
939                 TypeString(pBase->GetType()).Append(aTypeSuffix).AppendAscii(": ").Append(aName), sal_False );
940 
941 
942             if ( pBase->GetType() == WINDOW_TOOLBOX )   // Buttons und Controls auf Toolboxen.
943             {
944                 ToolBox *pTB = ((ToolBox*)pBase);
945                 sal_uInt16 i;
946                 for ( i = 0; i < pTB->GetItemCount() ; i++ )
947                 {
948                     aName = String();
949 //                  if ( aName.Len() == 0 )
950 //                      aName = pTB->GetQuickHelpText();
951                     if ( aName.Len() == 0 )
952                         aName = pTB->GetHelpText( pTB->GetItemId( i ) );
953                     if ( aName.Len() == 0 )
954                         aName = pTB->GetItemText( pTB->GetItemId( i ) );
955 
956                     Window *pItemWin;
957                     pItemWin = pTB->GetItemWindow( pTB->GetItemId( i ) );
958                     if ( pTB->GetItemType( i ) == TOOLBOXITEM_BUTTON && ( !pItemWin || !pItemWin->IsVisible() ) )
959                     {
960                         if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
961                             pRet->GenReturn ( RET_WinInfo, Str2Id(pTB->GetItemCommand(pTB->GetItemId( i ))), (comm_ULONG)WINDOW_BUTTON,
962                                 TypeString(WINDOW_BUTTON).AppendAscii(": ").Append(aName), sal_False );
963                         if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
964                             pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_ULONG)WINDOW_BUTTON,
965                                 TypeString(WINDOW_BUTTON).AppendAscii(": ").Append(aName), sal_False );
966                     }
967                     else
968                     {
969                         if ( pItemWin )
970                         {
971                             if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
972                                 pRet->GenReturn ( RET_WinInfo, Str2Id(pTB->GetItemCommand(pTB->GetItemId( i ))), (comm_ULONG)pItemWin->GetType(),
973                                     TypeString(pItemWin->GetType()).AppendAscii(": ").Append(aName), sal_False );
974                             if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
975                                 pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_ULONG)pItemWin->GetType(),
976                                     TypeString(pItemWin->GetType()).AppendAscii(": ").Append(aName), sal_False );
977                             sal_uInt16 ii;
978                             for( ii = 0 ; ii < pItemWin->GetChildCount(); ii++ )
979                                 WriteControlData( pItemWin->GetChild(ii), nConf, sal_False );
980                         }
981                         else
982                         {
983                             if ( nConf & DH_MODE_ALLWIN )
984                             {
985                                 String aToolBoxItemType;
986                                 switch ( pTB->GetItemType( i ) )
987                                 {
988                                 case TOOLBOXITEM_DONTKNOW:
989                                     aToolBoxItemType.AssignAscii("TOOLBOXITEM_DONTKNOW");
990                                     break;
991                                 case TOOLBOXITEM_BUTTON:
992                                     aToolBoxItemType.AssignAscii("TOOLBOXITEM_BUTTON");
993                                     break;
994                                 case TOOLBOXITEM_SPACE:
995                                     aToolBoxItemType.AssignAscii("TOOLBOXITEM_SPACE");
996                                     break;
997                                 case TOOLBOXITEM_SEPARATOR:
998                                     aToolBoxItemType.AssignAscii("TOOLBOXITEM_SEPARATOR");
999                                     break;
1000                                 case TOOLBOXITEM_BREAK:
1001                                     aToolBoxItemType.AssignAscii("TOOLBOXITEM_BREAK");
1002                                     break;
1003                                 default:
1004                                     DBG_ERROR1( "Unknown TOOLBOXITEM %i", pTB->GetItemType( i ) );
1005                                 }
1006                                 if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
1007                                     pRet->GenReturn ( RET_WinInfo, Str2Id( pTB->GetItemCommand(pTB->GetItemId( i )) ), (comm_ULONG)WINDOW_BASE,
1008                                         aToolBoxItemType.AppendAscii(": ").Append(aName), sal_False );
1009                                 if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
1010                                     pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_ULONG)WINDOW_BASE,
1011                                         aToolBoxItemType.AppendAscii(": ").Append(aName), sal_False );
1012                             }
1013                         }
1014                     }
1015                 }
1016 
1017                 return; // ToolBox ist hier schon komplett abgehandelt.
1018             }
1019 
1020 
1021             if ( pBase->GetType() == WINDOW_BUTTONDIALOG    // Buttons auf Buttondialogen mit ID
1022                 || pBase->GetType() == WINDOW_MESSBOX
1023                 || pBase->GetType() == WINDOW_INFOBOX
1024                 || pBase->GetType() == WINDOW_WARNINGBOX
1025                 || pBase->GetType() == WINDOW_ERRORBOX
1026                 || pBase->GetType() == WINDOW_QUERYBOX )
1027             {
1028                 ButtonDialog *pBD = ((ButtonDialog*)pBase);
1029                 sal_uInt16 i;
1030                 for ( i = 0; i < pBD->GetButtonCount() ; i++ )
1031                 {
1032                     aName = String();
1033                     if ( aName.Len() == 0 )
1034                         aName = pBD->GetPushButton( pBD->GetButtonId(i) )->GetText();
1035                     ByteString aID;
1036                     switch ( pBD->GetButtonId(i) )
1037                     {
1038                         case BUTTONID_OK:
1039                             aID.Assign("Ok");
1040                             break;
1041                         case BUTTONID_CANCEL:
1042                             aID.Assign("Cancel");
1043                             break;
1044                         case BUTTONID_YES:
1045                             aID.Assign("Yes");
1046                             break;
1047                         case BUTTONID_NO:
1048                             aID.Assign("No");
1049                             break;
1050                         case BUTTONID_RETRY:
1051                             aID.Assign("Retry");
1052                             break;
1053                         case BUTTONID_HELP:
1054                             aID.Assign("Help");
1055                             break;
1056                         default:
1057                             aID = ByteString::CreateFromInt32( pBD->GetButtonId(i) );
1058                             break;
1059                     }
1060 
1061                     pRet->GenReturn ( RET_WinInfo, aID, (comm_ULONG)pBD->GetPushButton( pBD->GetButtonId(i) )->GetType(),   // So da� der Text angezeigt wird!
1062                         TypeString(pBD->GetPushButton( pBD->GetButtonId(i) )->GetType()).AppendAscii(": ").Append(aName)
1063                         .AppendAscii(" ButtonId = ").AppendAscii( aID.GetBuffer() ), sal_False );
1064                 }
1065 
1066                 return; // ButtonDialog ist hier schon komplett abgehandelt.
1067             }
1068 
1069 
1070             Menu* pMenu = GetMatchingMenu( pBase );
1071 
1072             if ( pMenu )    // Menus
1073             {
1074                 sal_uInt16 i;
1075                 for ( i = 0; i < pMenu->GetItemCount() ; i++ )
1076                 {
1077                     sal_uInt16 nID = pMenu->GetItemId( i );
1078 
1079                     aName = String();
1080                     if ( aName.Len() == 0 )
1081                         aName = pMenu->GetHelpText( nID );
1082                     if ( aName.Len() == 0 )
1083                         aName = pMenu->GetItemText( nID );
1084 
1085 
1086                     if ( pMenu->GetItemType( i ) == MENUITEM_STRING || pMenu->GetItemType( i ) ==  MENUITEM_IMAGE || pMenu->GetItemType( i ) == MENUITEM_STRINGIMAGE || (nConf & DH_MODE_ALLWIN) )
1087                     {
1088                         String aMenuItemType;
1089                         switch ( pMenu->GetItemType( i ) )
1090                         {
1091                         case MENUITEM_STRING:
1092                             aMenuItemType.AssignAscii("MENUITEM_STRING");
1093                             break;
1094                         case MENUITEM_STRINGIMAGE:
1095                             aMenuItemType.AssignAscii("MENUITEM_STRINGIMAGE");
1096                             break;
1097                         case MENUITEM_IMAGE:
1098                             aMenuItemType.AssignAscii("MENUITEM_IMAGE");
1099                             break;
1100                         case MENUITEM_SEPARATOR:
1101                             aMenuItemType.AssignAscii("MENUITEM_SEPARATOR");
1102                             break;
1103                         case MENUITEM_DONTKNOW:
1104                             aMenuItemType.AssignAscii("MENUITEM_DONTKNOW");
1105                             break;
1106                         default:
1107                             DBG_ERROR1( "Unknown MENUITEM %i", pMenu->GetItemType( i ) );
1108                         }
1109                         if ( pMenu->GetItemCommand(nID).Len() || ( nConf & DH_MODE_ALLWIN ) )
1110                             pRet->GenReturn ( RET_WinInfo, Str2Id( pMenu->GetItemCommand(nID) ), (comm_ULONG)0,
1111                                 aMenuItemType.AppendAscii(": ").Append(aName), sal_False );
1112                         if ( !pMenu->GetItemCommand(nID).Len() || ( nConf & DH_MODE_ALLWIN ) )
1113                             pRet->GenReturn ( RET_WinInfo, rtl::OString::valueOf( (sal_Int32)nID ), (comm_ULONG)0,
1114                                 aMenuItemType.AppendAscii(": ").Append(aName), sal_False );
1115                     }
1116                 }
1117 
1118                 return; // Menu ist hier schon komplett abgehandelt.
1119             }
1120         }
1121     }
1122 
1123     for( sal_uInt16 i = 0 ; i < pBase->GetChildCount(); i++ )
1124         WriteControlData( pBase->GetChild(i), nConf, sal_False );
1125 }
1126 
1127 class SysWinContainer : public WorkWindow
1128 {
1129 private:
1130     ToolBox *pClientWin;
1131     DockingWindow *pDock;
1132 public:
1133     SysWinContainer( ToolBox *pClient );
1134     ~SysWinContainer();
1135     virtual void    Resize();
1136     virtual void    Resizing( Size& rSize );
1137 };
1138 
1139 SysWinContainer::SysWinContainer( ToolBox *pClient )
1140 : WorkWindow( NULL, WB_BORDER | WB_SIZEMOVE | WB_CLOSEABLE )
1141 , pClientWin( pClient )
1142 {
1143     pDock = new DockingWindow( this );
1144     pClientWin->SetParent( pDock );
1145     pClientWin->SetFloatingMode( sal_False );
1146     SetText( pClient->GetText() );
1147     SetPosPixel( Point( 1,40 ) );
1148     Resize();
1149     pDock->Show();
1150     EnableAlwaysOnTop();
1151     Show();
1152 }
1153 
1154 SysWinContainer::~SysWinContainer()
1155 {
1156     delete pDock;
1157 }
1158 
1159 void SysWinContainer::Resize()
1160 {
1161     Size aSize( GetOutputSizePixel() );
1162     Resizing( aSize );
1163 //  aSize = pClientWin->GetSizePixel();
1164 //  aSize = pClientWin->CalcWindowSizePixel();
1165     if ( aSize != GetSizePixel() )
1166     {
1167         SetOutputSizePixel( aSize );
1168         pDock->SetSizePixel( aSize );
1169         pClientWin->SetSizePixel( aSize );
1170     }
1171 }
1172 
1173 void SysWinContainer::Resizing( Size& rSize )
1174 {
1175     Size aSize;
1176     Size aBestSize;
1177     sal_uInt16 i;
1178     sal_Bool bHasValue = sal_False;
1179     sal_uLong nBestValue = 0;
1180     sal_uLong nThisValue;
1181     for ( i=1 ; i<=1 ; i++ )
1182     {
1183         aSize = pClientWin->CalcWindowSizePixel( i );
1184         nThisValue = Abs( aSize.Width() - rSize.Width() ) + Abs( aSize.Height() - rSize.Height() );
1185         if ( !bHasValue || ( nThisValue < nBestValue ) )
1186         {
1187             nBestValue = nThisValue;
1188             aBestSize = aSize;
1189             bHasValue = sal_True;
1190         }
1191     }
1192     rSize = aBestSize;
1193 }
1194 
1195 
1196 class DisplayHidWin : public ToolBox
1197 {
1198     Edit    *pEdit;
1199     Size    aMinEditSize;
1200     sal_uInt16  nLastItemID;
1201     sal_Bool bIsDraging;
1202     sal_Bool bIsPermanentDraging;
1203     void SetDraging( sal_Bool bNewDraging );
1204     Image *pShow, *pShow2;
1205     sal_Bool bConfigChanged;
1206     void EnableButtons( sal_uLong nConf );
1207 
1208     sal_uLong nEventHookID;
1209     static long stub_VCLEventHookProc( NotifyEvent& rEvt, void* pData )
1210     {
1211         return ((DisplayHidWin*)pData)->VCLEventHook( rEvt );
1212     }
1213 
1214     long VCLEventHook( NotifyEvent& rEvt );
1215     Window *pLastMouseMoveWin;
1216 
1217     SysWinContainer *pContainer;
1218 
1219     // aborting by pressing shist twice
1220     sal_Bool bOldShift;
1221     Time aLatest;
1222     sal_uInt16 nShiftCount;
1223 
1224 public:
1225     DisplayHidWin();
1226     ~DisplayHidWin();
1227 
1228     virtual void    Tracking( const TrackingEvent& rTEvt );
1229     virtual void    Click();
1230     virtual void    Select();
1231     virtual void    SetText( const XubString& rStr );
1232 
1233     void SetDisplayText( const String &aNewText ){ pEdit->SetText(aNewText); }
1234     String GetDisplayText() const { return pEdit->GetText(); }
1235     sal_Bool IsDisplayTextModified() const { return pEdit->IsModified(); }
1236     void ClearDisplayTextModified() const { pEdit->ClearModifyFlag(); }
1237 
1238     void SetConfig( sal_uLong nConf );
1239     sal_uLong GetConfig();
1240 
1241     sal_Bool IsConfigChanged() { return bConfigChanged; }
1242     void ConfigSent() { bConfigChanged = sal_False; }
1243 
1244     sal_Bool IsSendData() { return GetItemState( TT_SEND_DATA ) == STATE_CHECK; }
1245 //  sal_Bool IsAllWin() { return GetItemState( TT_ALLWIN ) == STATE_CHECK; }
1246 
1247     sal_Bool IsDraging() { return bIsDraging; }
1248 
1249     Window* LastMouseMoveWin() { return pLastMouseMoveWin; }
1250 };
1251 
1252 DisplayHidWin::DisplayHidWin()
1253 : ToolBox( StatementList::GetFirstDocFrame(), TTProperties::GetSvtResId(DisplayHidToolBox) )
1254 , bIsDraging( sal_False )
1255 , bIsPermanentDraging( sal_False )
1256 , pShow( NULL )
1257 , pShow2( NULL )
1258 , pLastMouseMoveWin( NULL )
1259 , bOldShift( 0 )
1260 , nShiftCount( 0 )
1261 {
1262     SetOutStyle( TOOLBOX_STYLE_HANDPOINTER | TOOLBOX_STYLE_FLAT );
1263     pEdit = new Edit( this, WB_CENTER | WB_BORDER );
1264     aMinEditSize = GetItemRect( TT_OUTPUT ).GetSize();
1265 /**/    aMinEditSize=Size(20,20);
1266     aMinEditSize.Width() *= 12;
1267     pEdit->SetSizePixel( aMinEditSize );
1268     pEdit->Show();
1269     SetItemWindow( TT_OUTPUT, pEdit );
1270     Resize();
1271     pContainer = new SysWinContainer( this );
1272     nEventHookID = Application::AddEventHook( stub_VCLEventHookProc, this );
1273 }
1274 
1275 DisplayHidWin::~DisplayHidWin()
1276 {
1277     Application::RemoveEventHook( nEventHookID );
1278     Hide(); // so GetFirstDocFrame won't return ourselves (needed for SOPlayer)
1279     SetParent( StatementList::GetFirstDocFrame() );
1280     delete pContainer;
1281     delete pEdit;
1282 }
1283 
1284 void DisplayHidWin::SetDraging( sal_Bool bNewDraging )
1285 {
1286     if ( !pShow )
1287         pShow = new Image( GetItemImage( TT_SHOW ) );
1288     if ( !pShow2 )
1289         pShow2 = new Image( Bitmap( TTProperties::GetSvtResId( TT_SHOW2 ) ) );
1290 
1291     if ( bNewDraging )
1292         SetItemImage( TT_SHOW, *pShow2 );
1293     else
1294         SetItemImage( TT_SHOW, *pShow );
1295 
1296     bIsDraging = bNewDraging;
1297 }
1298 
1299 void DisplayHidWin::EnableButtons( sal_uLong nConf )
1300 {
1301     sal_Bool bSend = sal_Bool(nConf & DH_MODE_SEND_DATA);
1302     EnableItem( TT_ALLWIN, bSend );
1303     EnableItem( TT_KURZNAME, bSend );
1304     EnableItem( TT_LANGNAME, bSend );
1305 }
1306 
1307 void DisplayHidWin::Tracking( const TrackingEvent& rTEvt )
1308 {
1309 //  if ( nLastItemID == TT_SHOW && GetItemState( TT_SHOW ) == STATE_NOCHECK && ( rTEvt.IsTrackingEnded() || rTEvt.IsTrackingCanceled() ) )
1310 //      SetDraging( sal_False );
1311     if ( nLastItemID == TT_SHOW && GetItemState( TT_SHOW ) == STATE_NOCHECK )
1312         EndTracking( ENDTRACK_CANCEL );
1313     ToolBox::Tracking( rTEvt);
1314 }
1315 
1316 void DisplayHidWin::Click()
1317 {
1318     nLastItemID = GetCurItemId();
1319     if ( nLastItemID == TT_SHOW )
1320     {
1321         SetDraging( sal_True );
1322     }
1323     ToolBox::Click();
1324 }
1325 
1326 void DisplayHidWin::Select()
1327 {
1328     if ( GetItemState( GetCurItemId() ) == STATE_NOCHECK )
1329     {
1330         SetItemState( GetCurItemId(), STATE_CHECK );
1331         if ( GetCurItemId() == TT_SHOW )
1332         {
1333             bIsPermanentDraging = sal_True;
1334             SetDraging( sal_True );
1335         }
1336     }
1337     else
1338     {
1339         SetItemState( GetCurItemId(), STATE_NOCHECK );
1340         if ( GetCurItemId() == TT_SHOW )
1341         {
1342             bIsPermanentDraging = sal_False;
1343             SetDraging( sal_False );
1344         }
1345     }
1346     if ( GetCurItemId() == TT_SEND_DATA )
1347     {
1348         EnableButtons( GetConfig() );
1349     }
1350 }
1351 
1352 void DisplayHidWin::SetConfig( sal_uLong nConf )
1353 {
1354     SetItemState( TT_KURZNAME,  ( nConf & DH_MODE_KURZNAME )  ? STATE_CHECK : STATE_NOCHECK );
1355     SetItemState( TT_LANGNAME,  ( nConf & DH_MODE_LANGNAME )  ? STATE_CHECK : STATE_NOCHECK );
1356     SetItemState( TT_ALLWIN,    ( nConf & DH_MODE_ALLWIN )    ? STATE_CHECK : STATE_NOCHECK );
1357     SetItemState( TT_SEND_DATA, ( nConf & DH_MODE_SEND_DATA ) ? STATE_CHECK : STATE_NOCHECK );
1358     EnableButtons( nConf );
1359 }
1360 
1361 sal_uLong DisplayHidWin::GetConfig()
1362 {
1363     sal_uLong nConf = 0;
1364     if ( GetItemState( TT_KURZNAME ) == STATE_CHECK )
1365         nConf |= DH_MODE_KURZNAME;
1366     if ( GetItemState( TT_LANGNAME ) == STATE_CHECK )
1367         nConf |= DH_MODE_LANGNAME;
1368     if ( GetItemState( TT_ALLWIN ) == STATE_CHECK )
1369         nConf |= DH_MODE_ALLWIN;
1370     if ( IsSendData() )
1371         nConf |= DH_MODE_SEND_DATA;
1372 
1373     return nConf;
1374 }
1375 
1376 void DisplayHidWin::SetText( const XubString& rStr )
1377 {
1378     pContainer->SetText( rStr );
1379 }
1380 
1381 long DisplayHidWin::VCLEventHook( NotifyEvent& rEvt )
1382 {
1383     if ( EVENT_MOUSEMOVE == rEvt.GetType() )
1384     {
1385         pLastMouseMoveWin = rEvt.GetWindow();
1386 
1387         // check if abort with pressing shift twice
1388         MouseEvent* pMEvt = (MouseEvent*)rEvt.GetMouseEvent();
1389 
1390         if ( (  pMEvt->IsShift() && !bOldShift ) )    // Shift pressed
1391         {
1392             if ( aLatest < Time() )
1393             {
1394                 nShiftCount = 0;
1395                 aLatest = Time()+Time( 0, 0, 0, 50 );
1396             }
1397             nShiftCount++;
1398         }
1399         if ( ( !pMEvt->IsShift() &&  bOldShift ) )    // Shift released
1400         {
1401             nShiftCount++;
1402             if ( nShiftCount == 4 && aLatest > Time() )
1403             {
1404                 bIsPermanentDraging = sal_False;
1405                 SetDraging( sal_False );
1406                 SetItemState( TT_SHOW, STATE_NOCHECK );
1407             }
1408         }
1409         bOldShift = pMEvt->IsShift();
1410     }
1411     if ( ( ( EVENT_MOUSEBUTTONUP == rEvt.GetType() && rEvt.GetMouseEvent()->GetButtons() == MOUSE_LEFT) || ( EVENT_MOUSEMOVE == rEvt.GetType() && !rEvt.GetMouseEvent()->GetButtons() ) )
1412             && IsDraging() && !bIsPermanentDraging )
1413         SetDraging( sal_False );
1414     return 0;
1415 }
1416 
1417 
1418 sal_Bool StatementCommand::DisplayHID()
1419 {
1420     // Return sal_True -> reexecute command
1421 
1422     if ( !bBool2 )  // Wird auf sal_False initialisiert
1423     {
1424         bBool2 = sal_True;              // Wir sind initialisiert.
1425         GetTTSettings()->pDisplayInstance = this;   // Und haben die Macht (Alle anderen beenden sich)
1426 
1427         if ( !(nParams & PARAM_ULONG_1) )
1428         {
1429             if( GetTTSettings()->pDisplayHidWin )   // Nichts ver�ndern
1430                 nLNr1 = GetTTSettings()->pDisplayHidWin->GetConfig();
1431             else    // Beim ersten Aufruf wollen wir alles richtig einstellen
1432                 nLNr1 = DH_MODE_KURZNAME | DH_MODE_LANGNAME;
1433 
1434             if( ((nParams & PARAM_BOOL_1) && bBool1) )
1435                 nLNr1 |= DH_MODE_SEND_DATA;
1436             else
1437                 nLNr1 &= ( ~DH_MODE_SEND_DATA );
1438         }
1439 
1440         if ( GetTTSettings()->pDisplayHidWin )
1441             GetTTSettings()->pDisplayHidWin->SetConfig( nLNr1 );
1442     }
1443 
1444     if ( GetTTSettings()->pDisplayInstance && GetTTSettings()->pDisplayInstance != this )
1445     {
1446         DBG_WARNING("Mehrere DisplayHID am laufen");
1447         return sal_False;       // Noch eine andere Instanz macht das gleiche!
1448     }
1449 
1450     if ( !GetTTSettings()->pDisplayHidWin )
1451     {
1452         GetTTSettings()->pDisplayHidWin = new DisplayHidWin();
1453         GetTTSettings()->aOriginalCaption = GetTTSettings()->pDisplayHidWin->GetText();
1454         GetTTSettings()->pDisplayHidWin->Show();
1455         if ( bBool1 )
1456             nLNr1 |= DH_MODE_SEND_DATA;
1457         GetTTSettings()->pDisplayHidWin->SetConfig( nLNr1 );
1458 
1459         GetTTSettings()->Old = NULL;
1460         GetTTSettings()->Act = NULL;
1461         GetTTSettings()->pDisplayInstance = this;
1462     }
1463     else
1464     {
1465         GetTTSettings()->pDisplayHidWin->GetWindow( WINDOW_OVERLAP )->Enable( sal_True, sal_True );
1466         GetTTSettings()->pDisplayHidWin->GetWindow( WINDOW_OVERLAP )->EnableInput( sal_True, sal_True );
1467     }
1468 
1469 
1470     if ( GetTTSettings()->pDisplayHidWin->IsVisible() && !bDying )
1471     {
1472 
1473         if ( GetTTSettings()->pDisplayHidWin->IsDraging() )
1474         {
1475 
1476 
1477 #define HIGHLIGHT_WIN( WinPtr )                                     \
1478         {                                                           \
1479             Color aLineColMem = WinPtr->GetLineColor();             \
1480             WinPtr->SetLineColor( Color( COL_WHITE ) );             \
1481             Color aFillColMem = WinPtr->GetFillColor();             \
1482             WinPtr->SetFillColor( Color( COL_LIGHTRED ) );          \
1483             RasterOp aROp = WinPtr->GetRasterOp();                  \
1484             WinPtr->SetRasterOp( ROP_XOR );                         \
1485             Size aSz = WinPtr->PixelToLogic( WinPtr->GetSizePixel() );\
1486             sal_uLong nMaxCornerRadius = WinPtr->PixelToLogic( Point( 80, 0 ) ).X();\
1487             sal_uLong iCorner = std::max ((sal_uLong) 8, (sal_uLong) std::min( nMaxCornerRadius, (sal_uLong) std::min((sal_uLong) (aSz.Width() / 6), (sal_uLong)(aSz.Height() / 6))));\
1488             WinPtr->DrawRect(Rectangle(Point(),aSz), iCorner, iCorner);\
1489             WinPtr->SetLineColor( aLineColMem );                    \
1490             WinPtr->SetFillColor( aFillColMem );                    \
1491             WinPtr->SetRasterOp( aROp );                            \
1492         }
1493 
1494 
1495 #define SET_WIN( WinPtr )                                           \
1496             if ( StatementList::WinPtrValid(WinPtr) )   \
1497             {                                                       \
1498                 HIGHLIGHT_WIN ( WinPtr );                           \
1499             }
1500 
1501 #define RESET_WIN( WinPtr )                                         \
1502             if ( StatementList::WinPtrValid(WinPtr) )   \
1503             {                                                       \
1504                 WinPtr->Invalidate( INVALIDATE_NOTRANSPARENT );     \
1505                 WinPtr->Update();       \
1506             }
1507 
1508 
1509             GetTTSettings()->Old = GetTTSettings()->Act;
1510 //          GetTTSettings()->Act = GetMouseWin();
1511             GetTTSettings()->Act = GetTTSettings()->pDisplayHidWin->LastMouseMoveWin();
1512 
1513             if ( !StatementList::WinPtrValid ( GetTTSettings()->Old ) )
1514                 GetTTSettings()->Old = NULL;
1515             if ( !StatementList::WinPtrValid ( GetTTSettings()->Act ) )
1516                 GetTTSettings()->Act = NULL;
1517 
1518             if ( GetTTSettings()->Act && GetTTSettings()->Act->GetType() == WINDOW_BORDERWINDOW )
1519                 GetTTSettings()->Act = GetTTSettings()->Act->GetWindow( WINDOW_CLIENT );
1520 
1521             if ( GetTTSettings()->Act != GetTTSettings()->Old )
1522             {
1523                 if ( GetTTSettings()->Old )
1524                 {
1525                     RESET_WIN(GetTTSettings()->Old);
1526                 }
1527                 if ( GetTTSettings()->Act )
1528                 {
1529                     SET_WIN(GetTTSettings()->Act);
1530                     GetTTSettings()->pDisplayHidWin->SetDisplayText( Id2Str(GetTTSettings()->Act->GetUniqueOrHelpId()).AppendAscii(" WinType: ")
1531                         .Append(UniString::CreateFromInt64(GetTTSettings()->Act->GetType())).AppendAscii("  ").Append(GetTTSettings()->Act->GetText()));
1532                     if ( GetTTSettings()->Act && !GetTTSettings()->Act->GetUniqueId().equals( GetTTSettings()->Act->GetHelpId() ) )
1533                         GetTTSettings()->pDisplayHidWin->SetText(UniString( TTProperties::GetSvtResId( TT_ALTERNATE_CAPTION ) ).AppendAscii(GetTTSettings()->Act->GetHelpId().getStr()));
1534                     else
1535                         GetTTSettings()->pDisplayHidWin->SetText( GetTTSettings()->aOriginalCaption );
1536                 }
1537                 else
1538                     GetTTSettings()->pDisplayHidWin->SetDisplayText(CUniString("Kein Window/Control gefunden"));
1539             }
1540             else if ( GetTTSettings()->Act )
1541             {
1542 //              SET_WIN(GetTTSettings()->Act);
1543                 // allow setting a HelpID manually (just enter the ID in the displayHID Window and terminate it by |
1544                 if ( GetTTSettings()->pDisplayHidWin->IsDisplayTextModified() && GetTTSettings()->pDisplayHidWin->GetDisplayText().GetTokenCount( '|' ) > 1 )
1545                 {
1546                     GetTTSettings()->Act->SetUniqueId( Str2Id( GetTTSettings()->pDisplayHidWin->GetDisplayText().GetToken( '|' ) ) );
1547                     GetTTSettings()->pDisplayHidWin->ClearDisplayTextModified();
1548                 }
1549             }
1550 /*          if ( Application::GetLastInputInterval() > 5000 )   // 5 Sekunden lang nix geschehen
1551             {
1552                 GetTTSettings()->pDisplayHidWin->ToTop( TOTOP_NOGRABFOCUS );
1553             }
1554 */
1555             if ( GetTTSettings()->pDisplayHidWin->IsSendData() /*&& bBool2*/ && GetTTSettings()->Act )
1556             {
1557                 if ( !StatementFlow::bSending )
1558                 {   // Normalerweise syncronisierung �ber Protokoll. Hier ist das aber asyncron!!!
1559                     WriteControlData( GetTTSettings()->Act, GetTTSettings()->pDisplayHidWin->GetConfig() );
1560                     new StatementFlow( this, F_EndCommandBlock );   // Kommando zum Senden erzeugen und in que eintragen
1561                 }
1562             }
1563         }   //if ( GetTTSettings()->pDisplayHidWin->IsDraging() )
1564         else
1565         {
1566             if ( GetTTSettings()->Act )
1567             {
1568                 RESET_WIN(GetTTSettings()->Act);
1569                 GetTTSettings()->Act = NULL;
1570             }
1571         }
1572 
1573         if ( pFirst == this )   // Sollte immer so sein, aber besser isses
1574             if ( pNext )        // Befehle warten auf Ausf�hrung
1575             {                   // An Ende neu einsortieren
1576                 Advance();
1577                 QueStatement( NULL );
1578             }
1579 //          {                   // Ersten und 2. austauschen.
1580 //              pFirst = pNext;
1581 //              pNext = pNext->pNext;
1582 //              pFirst->pNext = this;
1583 //          }
1584 
1585     }
1586     else
1587     {
1588         delete GetTTSettings()->pDisplayHidWin;
1589         GetTTSettings()->pDisplayHidWin = NULL;
1590         GetTTSettings()->pDisplayInstance = NULL;
1591     }
1592 
1593     return GetTTSettings()->pDisplayHidWin != NULL;
1594 }
1595 
1596 class TranslateWin : public WorkWindow
1597 {
1598 private:
1599     DECL_LINK( DoAccept, PushButton* );
1600     DECL_LINK( DoNext, PushButton* );
1601     DECL_LINK( DoSelect, PushButton* );
1602     DECL_LINK( DoRestore, PushButton* );
1603     DECL_LINK( TranslationChanged, Edit* );
1604     DECL_LINK( ShowInplace, Timer* );
1605 
1606     Timer InplaceTimer;
1607 
1608 //  virtual void MouseButtonUp( const MouseEvent& rMEvt );
1609 //  virtual void MouseMove( const MouseEvent& rMEvt );
1610 
1611     PushButton PushButtonTT_PB_NEXT;
1612     GroupBox GroupBoxTT_GB_TRANSLATION;
1613     Edit EditTT_E_NEW;
1614     GroupBox GroupBoxTT_GB_COMMENT;
1615     Edit EditTT_E_COMMENT;
1616     PushButton PushButtonTT_PB_ACCEPT;
1617     FixedText FixedTextTT_FT_OLD;
1618     PushButton PushButtonTT_PB_SELECT;
1619     PushButton PushButtonTT_PB_RESTORE;
1620 
1621     Window *Old;
1622     Window *Act;
1623     Window *pTranslateWin;
1624     sal_Bool bSelecting;
1625 
1626     sal_Bool bAvailable;
1627     sal_Bool bNext;
1628 
1629     sal_Bool TestChangedDataSaved();
1630 
1631 
1632     sal_uLong nEventHookID;
1633     static long stub_VCLEventHookProc( NotifyEvent& rEvt, void* pData )
1634     {
1635         return ((TranslateWin*)pData)->VCLEventHook( rEvt );
1636     }
1637 
1638     long VCLEventHook( NotifyEvent& rEvt );
1639 
1640 public:
1641     TranslateWin();
1642     ~TranslateWin();
1643 
1644     static String MarkShortcutErrors( Window* pBase, sal_Bool bMark );
1645 
1646     sal_Bool IsTranslationAvailable(){ return bAvailable; }
1647     sal_Bool IsNextDialog(){ return bNext; }
1648     void ResetNextDialog(){ bNext = sal_False; }
1649 
1650     Window* GetTranslationWindow(){ return pTranslateWin; }
1651     String GetOriginalText(){ return FixedTextTT_FT_OLD.GetText(); }
1652     String GetTranslationText(){ return EditTT_E_NEW.GetText(); }
1653     String GetComment(){ return EditTT_E_COMMENT.GetText(); }
1654 
1655     void EnableTranslation();
1656 };
1657 
1658 TranslateWin::TranslateWin()
1659 : WorkWindow( NULL, TTProperties::GetSvtResId( TT_INLINE_TRANSLATION ) )
1660 , PushButtonTT_PB_NEXT( this, TTProperties::GetSvtResId( TT_PB_NEXT ) )
1661 , GroupBoxTT_GB_TRANSLATION( this, TTProperties::GetSvtResId( TT_GB_TRANSLATION ) )
1662 , EditTT_E_NEW( this, TTProperties::GetSvtResId( TT_E_NEW ) )
1663 , GroupBoxTT_GB_COMMENT( this, TTProperties::GetSvtResId( TT_GB_COMMENT ) )
1664 , EditTT_E_COMMENT( this, TTProperties::GetSvtResId( TT_E_COMMENT ) )
1665 , PushButtonTT_PB_ACCEPT( this, TTProperties::GetSvtResId( TT_PB_ACCEPT ) )
1666 , FixedTextTT_FT_OLD( this, TTProperties::GetSvtResId( TT_FT_OLD ) )
1667 , PushButtonTT_PB_SELECT( this, TTProperties::GetSvtResId( TT_PB_SELECT ) )
1668 , PushButtonTT_PB_RESTORE( this, TTProperties::GetSvtResId( TT_PB_RESTORE ) )
1669 , Old( NULL )
1670 , Act( NULL )
1671 , pTranslateWin( NULL )
1672 , bSelecting( sal_False )
1673 , bAvailable( sal_False )
1674 , bNext( sal_False )
1675 {
1676     FreeResource();
1677     PushButtonTT_PB_NEXT.SetClickHdl( LINK( this, TranslateWin, DoNext ) );
1678     PushButtonTT_PB_ACCEPT.SetClickHdl( LINK( this, TranslateWin, DoAccept ) );
1679     PushButtonTT_PB_SELECT.SetClickHdl( LINK( this, TranslateWin, DoSelect ) );
1680     PushButtonTT_PB_RESTORE.SetClickHdl( LINK( this, TranslateWin, DoRestore ) );
1681     EditTT_E_NEW.SetModifyHdl( LINK( this, TranslateWin, TranslationChanged ) );
1682     InplaceTimer.SetTimeout( 250 );
1683     InplaceTimer.SetTimeoutHdl( LINK( this, TranslateWin, ShowInplace ) );
1684     EnableAlwaysOnTop();
1685     nEventHookID = Application::AddEventHook( stub_VCLEventHookProc, this );
1686 }
1687 
1688 TranslateWin::~TranslateWin()
1689 {
1690     Application::RemoveEventHook( nEventHookID );
1691 }
1692 
1693 sal_Bool TranslateWin::TestChangedDataSaved()
1694 {
1695     if ( ( EditTT_E_NEW.GetText().CompareTo( FixedTextTT_FT_OLD.GetText() ) != COMPARE_EQUAL
1696             || EditTT_E_COMMENT.GetText().Len() )
1697         && PushButtonTT_PB_ACCEPT.IsEnabled() )
1698     {
1699         return MessBox( this, TTProperties::GetSvtResId( TT_DISCARD_CHANGED_DATA ) ).Execute() == RET_YES;
1700     }
1701     else
1702         return sal_True;
1703 }
1704 
1705 IMPL_LINK( TranslateWin, DoAccept, PushButton*, EMPTYARG )
1706 {
1707     PushButtonTT_PB_SELECT.Disable();
1708     PushButtonTT_PB_NEXT.Disable();
1709         PushButtonTT_PB_RESTORE.Disable();
1710     EditTT_E_NEW.Disable();
1711     EditTT_E_COMMENT.Disable();
1712     PushButtonTT_PB_ACCEPT.Disable();
1713     bAvailable = sal_True;
1714     return 0;
1715 }
1716 
1717 IMPL_LINK( TranslateWin, DoNext, PushButton*, EMPTYARG )
1718 {
1719     if ( TestChangedDataSaved() )
1720     {
1721         PushButtonTT_PB_SELECT.Disable();
1722         PushButtonTT_PB_NEXT.Disable();
1723         PushButtonTT_PB_RESTORE.Disable();
1724         EditTT_E_NEW.Disable();
1725         EditTT_E_COMMENT.Disable();
1726         PushButtonTT_PB_ACCEPT.Disable();
1727         bNext = sal_True;
1728     }
1729     return 0;
1730 }
1731 
1732 IMPL_LINK( TranslateWin, DoSelect, PushButton*, EMPTYARG )
1733 {
1734     if ( bSelecting )
1735     {
1736 //      ReleaseMouse();
1737         bSelecting = sal_False;
1738     }
1739     else
1740     {
1741         if ( TestChangedDataSaved() )
1742         {
1743             PushButtonTT_PB_RESTORE.Disable();
1744 //          CaptureMouse();
1745             bSelecting = sal_True;
1746         }
1747     }
1748     return 0;
1749 }
1750 
1751 IMPL_LINK( TranslateWin, DoRestore, PushButton*, EMPTYARG )
1752 {
1753     String sTT_E_OLD( FixedTextTT_FT_OLD.GetText());
1754     sTT_E_OLD.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
1755     sTT_E_OLD.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
1756 
1757     String sTT_E_NEW( EditTT_E_NEW.GetText());
1758     sTT_E_NEW.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
1759     sTT_E_NEW.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
1760 
1761     if ( StatementList::WinPtrValid( pTranslateWin ) && pTranslateWin->GetText().CompareTo( sTT_E_NEW ) == COMPARE_EQUAL )
1762     {   // Im ersten schritt nur in der UI zur�ck
1763         pTranslateWin->SetText( sTT_E_OLD );
1764     }
1765     else
1766     {   // Im zweite Schritt auch den eingegebenen Text
1767         EditTT_E_NEW.SetText( FixedTextTT_FT_OLD.GetText() );
1768         PushButtonTT_PB_RESTORE.Disable();
1769     }
1770     if ( StatementList::WinPtrValid( pTranslateWin ) )
1771         MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True );
1772     return 0;
1773 }
1774 
1775 IMPL_LINK( TranslateWin, TranslationChanged, Edit*, pEdit )
1776 {
1777     (void) pEdit; /* avoid warning about unused parameter */
1778     PushButtonTT_PB_RESTORE.Enable();
1779     InplaceTimer.Start();
1780     return 0;
1781 }
1782 
1783 IMPL_LINK( TranslateWin, ShowInplace, Timer*, EMPTYARG )
1784 {
1785     PushButtonTT_PB_RESTORE.Enable();
1786     if ( StatementList::WinPtrValid( pTranslateWin ) )
1787     {
1788         String sTT_E_NEW( EditTT_E_NEW.GetText());
1789         // alle CRs UnQuoten
1790         sTT_E_NEW.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
1791         // alle TABSs UnQuoten
1792         sTT_E_NEW.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
1793         pTranslateWin->SetText( sTT_E_NEW );
1794 
1795         MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True );
1796     }
1797     return 0;
1798 }
1799 
1800 long TranslateWin::VCLEventHook( NotifyEvent& rEvt )
1801 {
1802     if ( EVENT_MOUSEMOVE == rEvt.GetType() )
1803     {
1804         if ( bSelecting )
1805         {
1806             const MouseEvent *pMEvt = rEvt.GetMouseEvent();
1807             Old = Act;
1808             Act = rEvt.GetWindow();
1809 
1810             if ( Act )
1811             {
1812                 Window *pWin = Act;
1813                 sal_uInt16 i;
1814                 for ( i = 0 ; i < Act->GetChildCount() ; i++ )
1815                 {
1816                     pWin = Act->GetChild(i);
1817                     Rectangle aWinPosSize( pWin->GetPosPixel(), pWin->GetSizePixel() );
1818 
1819                     if ( ( pWin->IsMouseTransparent() || !pWin->IsEnabled() ) && aWinPosSize.IsInside( pMEvt->GetPosPixel() ) )
1820                     {
1821                         Act = pWin;
1822                         break;
1823                     }
1824                 }
1825             }
1826 
1827             if ( !StatementList::WinPtrValid ( Old ) )
1828                 Old = NULL;
1829 
1830             if ( Act != Old )
1831             {
1832                 if ( Old )
1833                 {
1834                     Window *pWin;
1835                     if ( Old->IsMouseTransparent() && Old->GET_REAL_PARENT() )
1836                         pWin = Old->GET_REAL_PARENT();
1837                     else
1838                         pWin = Old;
1839                     RESET_WIN(pWin);
1840                 }
1841                 if ( Act )
1842                 {
1843                     SET_WIN(Act);
1844                     FixedTextTT_FT_OLD.SetText( Act->GetText() );
1845                 }
1846                 else
1847                     FixedTextTT_FT_OLD.SetText( String() );
1848             }
1849             else if ( Act )
1850             {
1851     //          SET_WIN(Act);
1852             }
1853     /*      if ( Application::GetLastInputInterval() > 5000 )   // 5 Sekunden lang nix geschehen
1854             {
1855                 ToTop();
1856             }
1857     */
1858         }   //if ( bSelecting )
1859         else
1860         {
1861             if ( Act )
1862             {
1863                 if ( Act->IsMouseTransparent() && Act->GET_REAL_PARENT() )
1864                     Act = Act->GET_REAL_PARENT();
1865                 RESET_WIN(Act);
1866                 Act = NULL;
1867             }
1868         }
1869     }
1870     else if ( EVENT_MOUSEBUTTONUP == rEvt.GetType() )
1871     {
1872         if ( bSelecting )
1873         {
1874             pTranslateWin = Act;
1875             if ( pTranslateWin )
1876             {
1877                 MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True );
1878                 // alle CRs quoten (NF)
1879                 String sTT_E_NEW( pTranslateWin->GetText());
1880                 sTT_E_NEW.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") );
1881                 // alle TABSs quoten ()
1882                 sTT_E_NEW.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") );
1883 
1884                 FixedTextTT_FT_OLD.SetText( sTT_E_NEW );
1885                 EditTT_E_NEW.SetText( sTT_E_NEW );
1886                 EditTT_E_NEW.Enable();
1887                 EditTT_E_NEW.GrabFocus();
1888                 EditTT_E_COMMENT.SetText( String() );
1889                 EditTT_E_COMMENT.Enable();
1890                 PushButtonTT_PB_ACCEPT.Enable();
1891             }
1892     //      ReleaseMouse();
1893             bSelecting = sal_False;
1894         }
1895     }
1896 
1897     return 0;
1898 }
1899 
1900 #define FDS_ACTION_COLLECT  1
1901 #define FDS_ACTION_MARK     2
1902 #define FDS_ACTION_UNMARK   3
1903 
1904 class FindShortcutErrors: public Search
1905 {
1906     String aShortcuts,aDoubleShortcuts;
1907     sal_uInt16 nAction;
1908 public:
1909     FindShortcutErrors();
1910     virtual sal_Bool IsWinOK( Window *pWin );
1911     void SetAction( sal_uInt16 nA );
1912     String GetDoubleShortcuts() { return aDoubleShortcuts; }
1913 };
1914 
1915 FindShortcutErrors::FindShortcutErrors()
1916 : Search( SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN )
1917 {
1918     SetAction( FDS_ACTION_COLLECT );    // Wir fange immer mit sammeln an, ODER??
1919 }
1920 
1921 void FindShortcutErrors::SetAction( sal_uInt16 nA )
1922 {
1923     nAction = nA;
1924     if ( FDS_ACTION_COLLECT == nAction )
1925     {
1926         aShortcuts = UniString();
1927         aDoubleShortcuts = UniString();
1928     }
1929 }
1930 
1931 sal_Bool FindShortcutErrors::IsWinOK( Window *pWin )
1932 {
1933     if ( pWin->IsReallyVisible() )
1934     {
1935         String aText = pWin->GetText();
1936         xub_StrLen nPos = aText.Search('~');
1937         String aShortcut;
1938         sal_Bool bHasAccel = sal_False;
1939         if ( nPos != STRING_NOTFOUND )
1940         {
1941             aShortcut = aText.Copy( nPos+1, 1 );
1942             aShortcut.ToLowerAscii();
1943             bHasAccel = aShortcut.Len() == 1;
1944         }
1945 
1946         switch ( nAction )
1947         {
1948             case FDS_ACTION_COLLECT:
1949                 {
1950                     if ( aShortcuts.Search( aShortcut ) != STRING_NOTFOUND )
1951                         aDoubleShortcuts += aShortcut;
1952                     else
1953                         aShortcuts += aShortcut;
1954                 }
1955                 break;
1956             case FDS_ACTION_MARK:
1957                 {
1958                     sal_Bool bMissing = sal_False;
1959                     if ( !bHasAccel && aText.Len() )    // should there be an accelarator defined
1960                     {
1961 
1962                         Window*     pChild;
1963                         pChild = pWin->GetWindow( WINDOW_CLIENT );
1964 
1965                         if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
1966                              (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
1967                              (pChild->GetType() == WINDOW_CHECKBOX) ||
1968                              (pChild->GetType() == WINDOW_TRISTATEBOX) ||
1969                              (pChild->GetType() == WINDOW_PUSHBUTTON) )
1970                         {
1971                             if ( !pChild->GetText().EqualsAscii( "..." ) )
1972                                 bMissing = sal_True;
1973                         }
1974 
1975                         if ( pChild->GetType() == WINDOW_FIXEDTEXT )
1976                         {
1977                             Window* pTempChild = pWin->GetWindow( WINDOW_NEXT );
1978                             if ( pTempChild )
1979                                 pTempChild = pTempChild->GetWindow( WINDOW_CLIENT );
1980 
1981                             if ( pTempChild && pChild->GetText().Len() )
1982                             {
1983                                 if ( (pTempChild->GetType() == WINDOW_EDIT) ||
1984                                      (pTempChild->GetType() == WINDOW_MULTILINEEDIT) ||
1985                                      (pTempChild->GetType() == WINDOW_SPINFIELD) ||
1986                                      (pTempChild->GetType() == WINDOW_PATTERNFIELD) ||
1987                                      (pTempChild->GetType() == WINDOW_NUMERICFIELD) ||
1988                                      (pTempChild->GetType() == WINDOW_METRICFIELD) ||
1989                                      (pTempChild->GetType() == WINDOW_CURRENCYFIELD) ||
1990                                      (pTempChild->GetType() == WINDOW_DATEFIELD) ||
1991                                      (pTempChild->GetType() == WINDOW_TIMEFIELD) ||
1992                                      (pTempChild->GetType() == WINDOW_LISTBOX) ||
1993                                      (pTempChild->GetType() == WINDOW_MULTILISTBOX) ||
1994                                      (pTempChild->GetType() == WINDOW_COMBOBOX) ||
1995                                      (pTempChild->GetType() == WINDOW_PATTERNBOX) ||
1996                                      (pTempChild->GetType() == WINDOW_NUMERICBOX) ||
1997                                      (pTempChild->GetType() == WINDOW_METRICBOX) ||
1998                                      (pTempChild->GetType() == WINDOW_CURRENCYBOX) ||
1999                                      (pTempChild->GetType() == WINDOW_DATEBOX) ||
2000                                      (pTempChild->GetType() == WINDOW_TIMEBOX) )
2001                                 {
2002                                     bMissing = sal_True;
2003                                 }
2004                             }
2005                         }
2006                     }
2007 
2008                     if ( bHasAccel && aDoubleShortcuts.Search( aShortcut ) != STRING_NOTFOUND )
2009                     {
2010                         if ( pWin->GetType() == WINDOW_GROUPBOX )
2011                             pWin->SetControlForeground( Color( COL_LIGHTRED ) );
2012                         else
2013                         {
2014                             pWin->SetControlBackground();
2015                             Color aCol(COL_GRAY);
2016                             aCol.SetRed( 0xff );
2017                             pWin->SetControlBackground( aCol );
2018                         }
2019                     }
2020                     else if ( bMissing )
2021                     {
2022                         pWin->SetControlBackground();
2023                         Color aCol(COL_GRAY);
2024                         aCol.SetRed( 0xff );
2025                         aCol.SetGreen( 0xff );
2026                         pWin->SetControlBackground( aCol );
2027                     }
2028                     else
2029                     {
2030                         pWin->SetControlForeground();
2031                         pWin->SetControlBackground();
2032                     }
2033                 }
2034                 break;
2035             case FDS_ACTION_UNMARK:
2036                 {
2037                     pWin->SetControlForeground();
2038                     pWin->SetControlBackground();
2039                 }
2040                 break;
2041         }
2042     }
2043     else
2044         if ( FDS_ACTION_MARK == nAction || FDS_ACTION_UNMARK == nAction )
2045         {
2046             pWin->SetControlForeground();
2047             pWin->SetControlBackground();
2048         }
2049 
2050     return sal_False;
2051 }
2052 
2053 String TranslateWin::MarkShortcutErrors( Window* pBase, sal_Bool bMark )
2054 {
2055     if ( pBase )
2056     {
2057         FindShortcutErrors aFinder;
2058         if ( bMark )
2059         {
2060             StatementList::SearchAllWin( pBase, aFinder, sal_True );    // collect Shortcuts first
2061             aFinder.SetAction( FDS_ACTION_MARK );
2062         }
2063         else
2064             aFinder.SetAction( FDS_ACTION_UNMARK );
2065         StatementList::SearchAllWin( pBase, aFinder, sal_True );
2066         return aFinder.GetDoubleShortcuts();
2067     }
2068     return UniString();
2069 }
2070 
2071 void TranslateWin::EnableTranslation()
2072 {
2073     PushButtonTT_PB_SELECT.Enable();
2074     PushButtonTT_PB_NEXT.Enable();
2075     bAvailable = sal_False;
2076     bNext = sal_False;
2077 }
2078 
2079 void StatementCommand::Translate()
2080 {
2081     // Es wurde eine initale UniqueId mitgegeben. Dann nur die dopelten Shortcuts liefern
2082     if( (nParams & PARAM_STR_1) && nLNr1 )
2083     {
2084         String aDouble;
2085         Window *pWin = SearchTree( Str2Id( aString1 ) ,sal_False );
2086         if ( pWin )
2087         {
2088             pWin = pWin->GetWindow( WINDOW_OVERLAP );
2089             aDouble = TranslateWin::MarkShortcutErrors( pWin, sal_True );
2090         }
2091         pRet->GenReturn ( RET_Value, nMethodId, aDouble );
2092         return;
2093     }
2094 
2095     if ( !GetTTSettings()->pTranslateWin )
2096     {
2097         GetTTSettings()->pTranslateWin = new TranslateWin;
2098         GetTTSettings()->bToTop = sal_True;
2099     }
2100 
2101     GetTTSettings()->pTranslateWin->Show();
2102     if ( GetTTSettings()->bToTop )
2103     {
2104         GetTTSettings()->pTranslateWin->ToTop();
2105         GetTTSettings()->bToTop = sal_False;
2106     }
2107 
2108 //  GetTTSettings()->pTranslateWin->GetWindow( WINDOW_OVERLAP )->Enable( sal_True, sal_True );
2109     GetTTSettings()->pTranslateWin->GetWindow( WINDOW_OVERLAP )->EnableInput( sal_True, sal_True );
2110 
2111     if ( GetTTSettings()->pTranslateWin->IsTranslationAvailable() )
2112     {
2113         String aTranslation;
2114         Window* pTranslationWindow = GetTTSettings()->pTranslateWin->GetTranslationWindow();
2115 
2116         DBG_ASSERT( pTranslationWindow, "Kein Translation Window" );
2117 
2118         if ( WinPtrValid( pTranslationWindow ) )
2119         {
2120             if ( pTranslationWindow->GetType() == WINDOW_BORDERWINDOW && pTranslationWindow->GetWindow( WINDOW_CLIENT ) )
2121             {
2122                 Window* pNew = pTranslationWindow->GetWindow( WINDOW_CLIENT );
2123                 // Bei Dockingwindoes das kanze Geraffel von Docking Floating �berspringen
2124                 while ( IsDialog( pNew ) && !pNew->GetUniqueOrHelpId().getLength() && pNew->GetChildCount() == 1 )
2125                     pNew = pNew->GetChild( 0 );
2126                 pTranslationWindow = pNew;
2127             }
2128 
2129             aTranslation = CUniString("0;");
2130 
2131             aTranslation += Id2Str( pTranslationWindow->GetUniqueOrHelpId() );
2132             aTranslation += ';';
2133 
2134             aTranslation += TypeString( pTranslationWindow->GetType() );
2135             aTranslation += ';';
2136 
2137             Window* pParentDialog = pTranslationWindow;
2138             while ( pParentDialog && !IsDialog( pParentDialog ) )
2139             {
2140                 pParentDialog = pParentDialog->GET_REAL_PARENT();
2141             }
2142 
2143             if ( pParentDialog )
2144             {
2145                 aTranslation += Id2Str(pParentDialog->GetUniqueOrHelpId());
2146                 aTranslation += ';';
2147                 aTranslation += TypeString( pParentDialog->GetType() );
2148             }
2149             else
2150                 aTranslation.AppendAscii( "0;" );       // Zahl + leerer String
2151             aTranslation += ';';
2152 
2153             aTranslation += '\"';
2154             aTranslation += GetTTSettings()->pTranslateWin->GetOriginalText();
2155             aTranslation += '\"';
2156 
2157             aTranslation += ';';
2158 
2159             aTranslation += '\"';
2160             aTranslation += GetTTSettings()->pTranslateWin->GetTranslationText();
2161             aTranslation += '\"';
2162 
2163             aTranslation += ';';
2164 
2165             aTranslation += '\"';
2166             aTranslation += GetTTSettings()->pTranslateWin->GetComment();
2167             aTranslation += '\"';
2168 
2169             // alle CRs quoten (NF)
2170             aTranslation.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") );
2171             // alle TABSs quoten ()
2172             aTranslation.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") );
2173 
2174             pRet->GenReturn ( RET_Value, nMethodId, aTranslation );
2175             GetTTSettings()->pTranslateWin->EnableTranslation();
2176             GetTTSettings()->bToTop = sal_True;
2177         }
2178         else
2179         {
2180             pRet->GenReturn ( RET_Value, nMethodId, String() );
2181             GetTTSettings()->pTranslateWin->EnableTranslation();
2182             ErrorBox err( GetTTSettings()->pTranslateWin, TTProperties::GetSvtResId( TT_NO_CONTROL ));
2183             err.Execute();
2184             GetTTSettings()->bToTop = sal_True;
2185         }
2186 
2187     }
2188     else if ( GetTTSettings()->pTranslateWin->IsNextDialog() )
2189     {
2190         pRet->GenReturn ( RET_Value, nMethodId, CUniString("1") );
2191         GetTTSettings()->pTranslateWin->ResetNextDialog();
2192         GetTTSettings()->pTranslateWin->LoseFocus();
2193         GetTTSettings()->bToTop = sal_True;
2194     }
2195     else
2196     {
2197         GetTTSettings()->pTranslateWin->EnableTranslation();
2198         pRet->GenReturn ( RET_Value, nMethodId, String() );
2199     }
2200 }
2201 
2202 Window* StatementCommand::GetNextOverlap( Window* pBase )
2203 {   // Findet irgendwelche Overlap-Fenster, die schlie�bar aussehen
2204     // Eventuell mu� noch die Auswahl verfeinert werden.
2205 
2206     if ( pBase->GetType() != WINDOW_BORDERWINDOW )
2207         pBase = pBase->GetWindow( WINDOW_OVERLAP );
2208 
2209     Window *pControl = NULL;
2210     if ( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) )
2211     {
2212         pControl = GetNextOverlap( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) );
2213     }
2214 
2215     if ( !pControl && pBase->GetWindow( WINDOW_NEXT ) )
2216     {
2217         pControl = GetNextOverlap( pBase->GetWindow( WINDOW_NEXT ) );
2218     }
2219 
2220     if ( !pControl )
2221     {
2222         Window *pTest = pBase->GetWindow( WINDOW_CLIENT );
2223         if ( IsAccessable (pTest)
2224             && pTest->IsEnabled()
2225             && pTest->IsVisible()
2226             && ((pTest->GetStyle() & WB_CLOSEABLE ) || (pBase->GetStyle() & WB_CLOSEABLE )) )
2227             return pTest;
2228         else
2229             return NULL;
2230     }
2231     else
2232         return pControl;
2233 }
2234 
2235 Window* StatementCommand::GetNextRecoverWin()
2236 {
2237     // �ber die TopLevelWindows der App iterieren
2238     Window* pBase = Application::GetFirstTopLevelWindow();
2239     Window *pControl = NULL;
2240     Window* pMyFirstDocFrame = NULL;
2241     while ( pBase )
2242     {
2243         // zuerst weitere Fenster auf dem Fenster suchen und schliessen
2244         pControl = GetNextOverlap( pBase );
2245         if ( pControl && pControl->GetType() == WINDOW_HELPTEXTWINDOW )
2246         {}  // skip it
2247         else
2248         {
2249             if ( pControl && pControl->IsVisible() && !IsFirstDocFrame( pControl ) && !IsIMEWin( pControl ) )
2250             {
2251                 Window* pTB = pControl->GetChild( 0 );
2252                 if ( pControl->GetChildCount() == 1 && pTB->GetType() == WINDOW_TOOLBOX )
2253 //                  return pTB;
2254                     ;   // do not act on floating toolboxes #i38796
2255                 else
2256                     return pControl;
2257             }
2258 
2259             // dann das Fenster selbst Schliessen
2260             // erstes DocWin �berspringen
2261             // Assumption that Doc Windows are Borderwindows and ButtonDialog and such are not
2262             if ( pBase->IsVisible() && !IsFirstDocFrame( pBase ) && pBase->GetType() != WINDOW_BORDERWINDOW && !IsIMEWin( pBase ) )
2263                 return pBase;
2264 
2265             if ( !pMyFirstDocFrame && IsFirstDocFrame( pBase ) )
2266                 pMyFirstDocFrame = pBase;
2267         }
2268 
2269         pBase = Application::GetNextTopLevelWindow( pBase );
2270     }
2271 #ifdef RESET_APPLICATION_TO_BACKING_WINDOW
2272     // close the FirstDocFrame last, It will not be closed, but the Document inside will be closed.
2273     if ( IsDocWin( pMyFirstDocFrame ) )
2274         return pMyFirstDocFrame;
2275 #endif // def RESET_APPLICATION_TO_BACKING_WINDOW
2276 
2277     return NULL;
2278 }
2279 
2280 sal_Bool StatementCommand::Execute()
2281 {
2282     if ( IsError )
2283     {
2284 #if OSL_DEBUG_LEVEL > 1
2285         m_pDbgWin->AddText( "Skipping Command: " );
2286         m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
2287         m_pDbgWin->AddText( "\n" );
2288         #endif
2289 
2290         Advance();
2291         delete this;
2292         return sal_True;
2293     }
2294 
2295     InitProfile();
2296 #if OSL_DEBUG_LEVEL > 1
2297     m_pDbgWin->AddText( "Executing Command: " );
2298     m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
2299     m_pDbgWin->AddText( "\n" );
2300 #endif
2301 
2302 
2303 
2304 
2305 
2306 #if OSL_DEBUG_LEVEL > 1
2307 #define REPORT_WIN_CLOSED(pControl, aInfo)          \
2308     _REPORT_WIN_CLOSED(pControl, aInfo)             \
2309     m_pDbgWin->AddText( aInfo.AppendAscii(" \"").Append( pControl->GetText() ).AppendAscii("\" geschlossen, RType = ").Append( TypeString(pControl->GetType()) ).AppendAscii(", UId = ").Append( UIdString( pControl->GetUniqueOrHelpId() ) ) );
2310 #else
2311 #define REPORT_WIN_CLOSED(pControl, aInfo) _REPORT_WIN_CLOSED(pControl, aInfo)
2312 #endif
2313 
2314 #define REPORT_WIN_CLOSEDc(pControl, aInfo )        \
2315     REPORT_WIN_CLOSED(pControl, CUniString(aInfo) )
2316 
2317 #define _REPORT_WIN_CLOSED(pControl, aInfo)         \
2318     if ( aString1.Len() )                           \
2319         aString1 += '\n';                           \
2320     aString1 += aInfo;                              \
2321     aString1.AppendAscii(" \"");                    \
2322     aString1 += pControl->GetText();                \
2323     aString1.AppendAscii("\" geschlossen, RType = ");\
2324     aString1 += TypeString(pControl->GetType());    \
2325     aString1.AppendAscii(", UId = ");               \
2326     aString1 += UIdString(pControl->GetUniqueOrHelpId());
2327 
2328 
2329     switch ( nMethodId )
2330     {
2331         case RC_AppDelay:
2332             if ( !bBool1 )
2333             {
2334                 nLNr1 = Time().GetTime() + nNr1/10;
2335                 bBool1 = sal_True;
2336             }
2337             if ( Time().GetTime() < long(nLNr1) )   // Aktuelle Zeit kleiner Endzeit
2338                 return sal_False;
2339             break;
2340         case RC_DisplayHid:
2341             if ( DisplayHID() )
2342                 return sal_False;
2343             break;
2344         case RC_ResetApplication:
2345             {
2346                 if ( !bBool1 )
2347                 {
2348                     nRetryCount = 150;      // das sollte reichen.
2349                     bBool1 = sal_True;          // Nur beim ersten mal!
2350                     nNr1 = 1;               // Welcher Button ist dran?
2351                     nLNr1 = 0;              // Speichern des AppWin
2352                     aString1 = UniString(); // Liste der geschlossenen Fenster
2353 
2354                     // So da� nacher auch wieder alles auf Default steht
2355                     nUseBindings = 0;
2356                     bCatchGPF = sal_True;
2357                     bUsePostEvents = sal_True;
2358 
2359                     aSubMenuId1 = 0;
2360                     aSubMenuId2 = 0;
2361                     aSubMenuId3 = 0;
2362                     pMenuWindow = NULL;
2363                 }
2364                 if ( !nRetryCount )
2365                     ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_COMPLEX ) );
2366 
2367                 Window *pControl = GetNextRecoverWin();
2368 
2369                 if ( pControl )
2370                 {
2371                     bBool2 = sal_False; // flag for wait when all windows are closed
2372                     pControl->GrabFocus();
2373 
2374                     if (    pControl->GetType() != WINDOW_DOCKINGWINDOW
2375                          && pControl->GetType() != WINDOW_FLOATINGWINDOW
2376                          && pControl->GetType() != WINDOW_MODELESSDIALOG
2377                          && pControl->GetType() != WINDOW_WORKWINDOW
2378                          && pControl->GetType() != WINDOW_TOOLBOX
2379                          && pControl->GetType() != WINDOW_BORDERWINDOW
2380                          && nRetryCount-- )
2381                     {
2382                         short nRT = ImpGetRType( pControl );
2383 
2384                         if ( nRT == C_TabControl && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
2385                         {   // Bei Tabcontrol den zugeh�rigen Tabdialog nehmen
2386                             pControl = pControl->GET_REAL_PARENT();
2387                             nRT = ImpGetRType( pControl );
2388                         }
2389 
2390                         switch( nRT )
2391                         {
2392                             case C_ModalDlg:
2393                             case C_Dialog:
2394                             case C_TabDlg:
2395                                 REPORT_WIN_CLOSEDc(pControl, "Dialog");
2396                                 SET_WINP_CLOSING(pControl);
2397                                 ((SystemWindow*)pControl)->Close();
2398                                 break;
2399                             case C_WorkWin:
2400                                 break;
2401                             case C_MessBox:
2402                             case C_InfoBox:
2403                             case C_WarningBox:
2404                             case C_ErrorBox:
2405                             case C_QueryBox:
2406                             case C_ButtonDialog:
2407                                 {
2408                                     ButtonDialog* pBD = (ButtonDialog*)pControl;
2409                                     // nNr1 >= 10 bedeutet (Custom)-Buttons durchgehen
2410                                     if ( nNr1 >= 10+pBD->GetButtonCount() ) nNr1 = 1;
2411                                     switch( nNr1 )
2412                                     {
2413                                         case 5:
2414                                             if ( pBD->GetPushButton( BUTTONID_OK ) )
2415                                             {
2416                                                 REPORT_WIN_CLOSEDc(pControl, "Message Box (OK)");
2417                                                 SET_WINP_CLOSING(pControl);
2418                                                 pBD->EndDialog(RET_OK);
2419                                             }
2420                                             nNr1 = 10;  // Nochmal alle Buttons der Reihe nach
2421                                             break;
2422                                         case 4:
2423                                             if ( pBD->GetPushButton( BUTTONID_CANCEL ) )
2424                                             {
2425                                                 REPORT_WIN_CLOSEDc(pControl, "Message Box (Cancel)");
2426                                                 SET_WINP_CLOSING(pControl);
2427                                                 pBD->EndDialog(RET_CANCEL);
2428                                             }
2429                                             nNr1++;
2430                                             break;
2431                                         case 3:
2432                                             if ( pBD->GetPushButton( BUTTONID_YES ) )
2433                                             {
2434                                                 REPORT_WIN_CLOSEDc(pControl, "Message Box (Yes)");
2435                                                 SET_WINP_CLOSING(pControl);
2436                                                 pBD->EndDialog(RET_YES);
2437                                             }
2438                                             nNr1++;
2439                                             break;
2440                                         case 2:     // BUG 48239
2441                                         case 1:
2442                                             if ( pBD->GetPushButton( BUTTONID_NO ) )
2443                                             {
2444                                                 REPORT_WIN_CLOSEDc(pControl, "Message Box (No)");
2445                                                 SET_WINP_CLOSING(pControl);
2446                                                 pBD->EndDialog(RET_NO);
2447                                             }
2448                                             nNr1++;
2449                                             break;
2450                                         default:
2451                                             {
2452                                                 sal_uInt16 nID = pBD->GetButtonId( nNr1-10 );
2453                                                 if ( nID != BUTTONID_HELP )
2454                                                 {
2455                                                     REPORT_WIN_CLOSED(pControl, CUniString("Message Box (").Append( UniString::CreateFromInt32(nID) ).AppendAscii(")"));
2456                                                     SET_WINP_CLOSING(pControl);
2457                                                     pBD->EndDialog(nID);
2458                                                 }
2459                                                 nNr1++;
2460                                             }
2461                                     }
2462                                     break;
2463                                 }
2464                             default:
2465                                 DBG_ERROR( "Unknown Windowtype" );
2466                                 REPORT_WIN_CLOSEDc(pControl, "Unknown Windowtype");
2467                                 ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_UNKNOWN ), pControl->GetType() );
2468                                 #if OSL_DEBUG_LEVEL > 1
2469                                 m_pDbgWin->AddText( " Unbekannter Objekttyp aus UId" );
2470                                 #endif
2471                                 break;
2472                         }
2473                         return sal_False;
2474                     }
2475                     else
2476                     {
2477                         if ( (pControl->GetType() == WINDOW_DOCKINGWINDOW || pControl->GetType() == WINDOW_TOOLBOX) && nRetryCount-- )
2478                         {
2479                             if ( (((DockingWindow*)pControl)->GetStyle() | ((DockingWindow*)pControl)->GetFloatStyle()) & WB_CLOSEABLE )
2480                             {
2481                                 REPORT_WIN_CLOSED(pControl, TypeString(pControl->GetType()));
2482                                 SET_WINP_CLOSING(pControl);
2483                                 ((DockingWindow*)pControl)->Close();
2484 
2485                                 // Eigentlich nur bei TaskWindows! Hoffen wir mal, da� keine anderen DockingWindows dazwischen hauen.
2486                                 if ( (Window*)nLNr1 != pControl )
2487                                     nNr1 = 1;       // Zum durchprobieren der Buttons beim Schlie�en
2488                                 nLNr1 = (sal_uLong)pControl;
2489 
2490                                 return sal_False;
2491                             }
2492                         }
2493                         if ( nRetryCount--
2494                                 && (    (pControl->GetType() == WINDOW_FLOATINGWINDOW)
2495                                     ||  (pControl->GetType() == WINDOW_MODELESSDIALOG)
2496                                     ||  (pControl->GetType() == WINDOW_WORKWINDOW)
2497                                     ||  (pControl->GetType() == WINDOW_BORDERWINDOW) ) )
2498                         {
2499     //                      if ( pControl->GetStyle() & WB_CLOSEABLE )
2500                             {
2501 #ifdef RESET_APPLICATION_TO_BACKING_WINDOW
2502                                 // Special handling for last Document; do not close the Frame, only the Document
2503                                 if ( GetDocWinCount() == 1 && IsDocFrame( pControl ) )
2504                                 {
2505                                     if ( IsDocWin( pControl ) )
2506                                     {
2507                                         if ( GetDocFrameMenuBar( pControl ) )
2508                                         {
2509                                             MenuBar* pMenu = GetDocFrameMenuBar( pControl );
2510                                             if ( pMenu->HasCloser() )
2511                                             {
2512                                                 REPORT_WIN_CLOSED( pControl, TypeString(pControl->GetType()));
2513                                                 SET_WINP_CLOSING(pControl);
2514 
2515                                                 pMenu->GetCloserHdl().Call( pMenu );
2516 
2517                                                 // nur bei TaskWindows!
2518                                                 if ( (Window*)nLNr1 != pControl )
2519                                                     nNr1 = 1;       // Zum durchprobieren der Buttons beim Schlie�en
2520                                                 nLNr1 = (sal_uLong)pControl;
2521 
2522                                                 return sal_False;
2523                                             }
2524                                         }
2525                                     }
2526                                 }
2527                                 else
2528 #endif // def RESET_APPLICATION_TO_BACKING_WINDOW
2529                                 {
2530                                     REPORT_WIN_CLOSED( pControl, TypeString(pControl->GetType()));
2531                                     SET_WINP_CLOSING(pControl);
2532                                     ((SystemWindow*)pControl)->Close();
2533 
2534                                     // Eigentlich nur bei TaskWindows!
2535                                     if ( (Window*)nLNr1 != pControl )
2536                                         nNr1 = 1;       // Zum durchprobieren der Buttons beim Schlie�en
2537                                     nLNr1 = (sal_uLong)pControl;
2538 
2539                                     return sal_False;
2540                                 }
2541                             }
2542                         }
2543                     }
2544                 }
2545                 // wait for some time if more windows show up
2546                 // E.g.: Floating toolbars on a Task which was hidden by another Task before
2547                 if ( !bBool2 )
2548                 {
2549                     nLNr1 = Time().GetTime() + 100; // 100 = 1 Second
2550                     bBool2 = sal_True;
2551                 }
2552                 if ( Time().GetTime() < long(nLNr1) )   // Aktuelle Zeit kleiner Endzeit
2553                     return sal_False;
2554                 else
2555                     pRet->GenReturn ( RET_Value, nMethodId, aString1);
2556             }
2557             break;
2558         case RC_WaitSlot:
2559             {
2560                 if ( ! (nParams & PARAM_USHORT_1) )
2561                     nNr1 = 1000;    // defaults to 1000 = 1 Sec.
2562                 if ( !bBool1 )
2563                 {
2564                     nLNr1 = Time().GetTime() + nNr1/10;
2565                     bBool1 = sal_True;
2566                 }
2567 
2568                 if ( !bIsSlotInExecute )
2569                     pRet->GenReturn ( RET_Value, nMethodId, comm_USHORT(CONST_WSFinished) );
2570                 else
2571                 {
2572                     if ( Time().GetTime() < long(nLNr1) )   // Aktuelle Zeit kleiner Endzeit
2573                         return sal_False;
2574                     pRet->GenReturn ( RET_Value, nMethodId, comm_USHORT(CONST_WSTimeout) );
2575                 }
2576             }
2577             break;
2578     }
2579 
2580 
2581     Advance();
2582 
2583 
2584     switch ( nMethodId )
2585     {
2586         case RC_AppDelay:       // Diese Befehle werden anderswo behandelt
2587         case RC_DisplayHid:
2588         case RC_ResetApplication:
2589         case RC_WaitSlot:
2590 
2591         case RC_AppAbort:       // Sofortiges L�schen aller Befehle
2592             break;
2593         case RC_Assert:
2594             {
2595                 ByteString aAssertion( "Diese Assertion wurde vom Testtool per Befehl ausgel�st" );
2596                 aAssertion = ByteString( String( aAssertion, RTL_TEXTENCODING_MS_1252 ), RTL_TEXTENCODING_UTF8 );
2597                 DBG_ASSERT( !aString1.Len(), ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
2598                 DBG_ASSERT(  aString1.Len(), aAssertion.GetBuffer() );
2599                 OSL_ENSURE( !aString1.Len(), ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
2600                 OSL_ENSURE(  aString1.Len(), aAssertion.GetBuffer() );
2601             }
2602             break;
2603         case RC_CaptureAssertions:
2604 #ifdef DBG_UTIL
2605             if( !(nParams & PARAM_BOOL_1) || bBool1 )
2606             {
2607                 DBG_INSTOUTERROR( DBG_OUT_TESTTOOL );
2608                 osl_setDebugMessageFunc( osl_TestToolDebugPrint );
2609             }
2610             else
2611             {
2612                 DBG_INSTOUTERROR( DBG_OUT_MSGBOX );
2613                 osl_setDebugMessageFunc( pOriginal_osl_DebugMessageFunc );
2614             }
2615 #endif
2616             break;
2617         case RC_Translate:
2618             Translate();
2619             break;
2620         case RC_ApplicationBusy:
2621         {
2622             sal_Bool bWait = sal_False;
2623             ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW ) );
2624 //          if ( Application::GetAppWindow() )
2625 //              bWait = Application::GetAppWindow()->IsWait();
2626             pRet->GenReturn ( RET_Value, nMethodId, bWait );
2627             break;
2628         }
2629         case RC_GetClipboard:
2630             {
2631                 ::rtl::OUString aTemp;
2632                 ::svt::OStringTransfer::PasteString( aTemp, GetFirstDocFrame() );
2633                 pRet->GenReturn ( RET_Value, nMethodId, String( aTemp ) );
2634             }
2635             break;
2636         case RC_SetClipboard:
2637             ::svt::OStringTransfer::CopyString(aString1,GetFirstDocFrame());
2638             break;
2639         case RC_WinTree:
2640             pRet->GenReturn ( RET_Value, nMethodId, Tree( NULL, 0));
2641             break;
2642     #if OSL_DEBUG_LEVEL > 1
2643         case RC_NoDebug:
2644             m_pDbgWin->bQuiet = sal_True;
2645             m_pDbgWin->Hide();
2646             m_pDbgWin->Clear();
2647             break;
2648         case RC_Debug:
2649             m_pDbgWin->bQuiet = sal_False;
2650             m_pDbgWin->Show();
2651             break;
2652     #endif
2653         case RC_GPF:
2654             ((TabControl*)NULL)->SetCurPageId( 12345 );
2655             break;
2656         case RC_GetNextCloseWindow:
2657             {
2658                 Window *pWin = GetActive( WINDOW_BASE );      // WINDOW_ANYTYPE
2659                 if ( !pWin )
2660                     ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW ) );
2661                 else if ( !IsDialog(pWin) )
2662                     ReportError( GEN_RES_STR0( S_NO_DIALOG_IN_GETACTIVE ) );
2663                 else
2664                 {
2665                     pRet->GenReturn( RET_Value, nMethodId, Id2Str(pWin->GetUniqueOrHelpId()) );
2666                 }
2667             }
2668             break;
2669         case RC_UseBindings:
2670             if( !(nParams & PARAM_BOOL_1) || bBool1 )
2671                 nUseBindings = SFX_USE_BINDINGS;
2672             else
2673                 nUseBindings = 0;
2674             break;
2675         case RC_Profile:
2676             //  Bei folgenden Parametern passiert folgendes:
2677             //  ein boolean=false                   Alles Profiling stoppen (Ergebnisse liefern)
2678             //  ein boolean=true, 1-4 ints          Einteilung der Zeiten in K�stchen
2679             //  kein! boolean keine ints            loggen jeden Befehls
2680             //  kein! boolean 1 int                 loggen alle int Millisekunden
2681             //  ein String                          wird in das Logfile �bernommen(sonst passiert nichts)
2682             if( !(nParams & PARAM_BOOL_1) || bBool1 )
2683             {
2684                 if ( !pProfiler )
2685                 {
2686                     pProfiler = new TTProfiler;
2687                     InitProfile();
2688                 }
2689 
2690                 if( !(nParams & PARAM_BOOL_1) && (nParams & PARAM_USHORT_1) )
2691                 {   // Autoprofiling: Profile nNr
2692                     if ( pProfiler->IsProfilingPerCommand() )
2693                     {
2694                         pProfiler->StopProfilingPerCommand();
2695                     }
2696                     pProfiler->StartAutoProfiling( nNr1 );
2697 
2698                     // Der Header ist abh�ngig vom Modus
2699                     pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() );
2700                 }
2701                 else if ( nParams & PARAM_USHORT_1 )
2702                 {   // Partitioning initialisieren: Profile true [,nNr][,nNr][,nNr][,nNr]
2703                     comm_ULONG nAnzahl=0;
2704                     if ( nParams & PARAM_USHORT_1 ) { nAnzahl++; };
2705                     if ( nParams & PARAM_USHORT_2 ) { nAnzahl++; };
2706                     if ( nParams & PARAM_USHORT_3 ) { nAnzahl++; };
2707                     if ( nParams & PARAM_USHORT_4 ) { nAnzahl++; };
2708 
2709                     // Hier werden die Parameter ans Testtool zur�ck �bertragen.
2710                     // Das ist zwar etwas eigenartig, aber ansonsten m�sste man im Testtool
2711                     // die einfache Struktur der Remotebefehle aufbrechen.
2712                     pRet->GenReturn( RET_ProfileInfo, S_ProfileReset, nAnzahl );
2713 
2714                     // Und die einzelnen Grenzen
2715                     if ( nParams & PARAM_USHORT_1 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder1, (comm_ULONG)nNr1 ); };
2716                     if ( nParams & PARAM_USHORT_2 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder2, (comm_ULONG)nNr2 ); };
2717                     if ( nParams & PARAM_USHORT_3 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder3, (comm_ULONG)nNr3 ); };
2718                     if ( nParams & PARAM_USHORT_4 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder4, (comm_ULONG)nNr4 ); };
2719 
2720                     pProfiler->StartPartitioning();
2721                 }
2722                 else if( nParams == PARAM_STR_1 )   // Genau ein String!
2723                 {   // Nur einen String ins Profiling aufnehmen
2724                     aString1 += '\n';
2725                     pRet->GenReturn( RET_ProfileInfo, 0, aString1 );
2726                 }
2727                 else
2728                 {   // Normales Profiling je Kommando: profile
2729                     if ( pProfiler->IsAutoProfiling() )
2730                     {
2731                         pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() );
2732                         pProfiler->StopAutoProfiling();
2733                     }
2734                     pProfiler->StartProfilingPerCommand();
2735 
2736                     // Der Header ist abh�ngig vom Modus
2737                     pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() );
2738                 }
2739             }
2740             else        // Profiling wieder ausschalten: Profile false
2741                 if ( pProfiler )
2742                 {
2743                     if ( pProfiler->IsProfilingPerCommand() )
2744                         pProfiler->StopProfilingPerCommand();
2745 
2746                     if ( pProfiler->IsAutoProfiling() )
2747                     {
2748                         pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() );
2749                         pProfiler->StopAutoProfiling();
2750                     }
2751 
2752                     if ( pProfiler->IsPartitioning() )
2753                     {
2754                         pRet->GenReturn( RET_ProfileInfo, S_ProfileDump, (comm_ULONG)0 );
2755                         pProfiler->StopPartitioning();
2756                     }
2757 
2758                     delete pProfiler;
2759                     pProfiler = NULL;
2760                 }
2761             break;
2762         case RC_MenuGetItemCount:
2763         case RC_MenuGetItemId:
2764         case RC_MenuGetItemPos:
2765         case RC_MenuIsSeperator:
2766         case RC_MenuIsItemChecked:
2767         case RC_MenuIsItemEnabled:
2768         case RC_MenuGetItemText:
2769         case RC_MenuGetItemCommand:
2770         case RC_MenuHasSubMenu:
2771         case RC_MenuSelect:
2772             {
2773                 PopupMenu *pPopup = NULL;
2774                 MenuBar *pMenuBar = NULL;
2775                 Menu *pMenu;
2776 
2777                 sal_uInt16 nErr = GetCurrentMenues( pPopup, pMenuBar, pMenu );
2778 
2779                 if ( !pMenu )
2780                 {
2781                     if ( nErr == 1 )
2782                         ReportError( GEN_RES_STR0( S_NO_POPUP ) );
2783                     else
2784                         ReportError( GEN_RES_STR0( S_NO_SUBMENU ) );
2785                     break;
2786                 }
2787 
2788                 sal_uInt16 nItemCount = 0;
2789                 switch ( nMethodId )
2790                 {
2791                     case RC_MenuGetItemCount:
2792                     case RC_MenuGetItemId:
2793                     case RC_MenuIsSeperator:
2794                         {
2795                             nItemCount = pMenu->GetItemCount();
2796                             if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
2797                             {   // jep, we have to adjust the count
2798                                 sal_Bool bLastWasSeperator = sal_True;  // sal_True for Separator at the top
2799                                 for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() ; i++ )
2800                                 {
2801                                     if ( !pMenu->IsItemEnabled( pMenu->GetItemId( i ) ) )
2802                                         nItemCount--;
2803                                     else
2804                                     {
2805                                         if ( pMenu->GetItemType( i ) == MENUITEM_SEPARATOR && bLastWasSeperator )
2806                                             nItemCount--;
2807                                         bLastWasSeperator = pMenu->GetItemType( i ) == MENUITEM_SEPARATOR;
2808                                     }
2809                                 }
2810                                 if ( bLastWasSeperator )    // Separator at bottom
2811                                     nItemCount--;
2812                             }
2813                         }
2814                         break;
2815                 }
2816 
2817                 // for certain methods calculate the physical index (reinserting the hidden entries)
2818                 sal_uInt16 nPhysicalIndex = 0;
2819                 switch ( nMethodId )
2820                 {
2821                     case RC_MenuGetItemId:
2822                     case RC_MenuIsSeperator:
2823                         {
2824                             nPhysicalIndex = nNr1;
2825                             if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
2826                             {   // jep, we have to adjust the position
2827                                 sal_Bool bLastWasSeperator = sal_True;  // sal_True for Separator at the top
2828                                 sal_uInt16 nVisibleCount = 0;
2829                                 for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() && nVisibleCount < nNr1 ; i++ )
2830                                 {
2831                                     if ( pMenu->IsItemEnabled( pMenu->GetItemId( i ) )
2832                                          && !( pMenu->GetItemType( i ) == MENUITEM_SEPARATOR && bLastWasSeperator ) )
2833                                     {
2834                                         nVisibleCount++;
2835                                         bLastWasSeperator = pMenu->GetItemType( i ) == MENUITEM_SEPARATOR;
2836                                     }
2837                                     else
2838                                         nPhysicalIndex++;
2839                                 }
2840                                 DBG_ASSERT( nVisibleCount == nNr1, "Adaption of Index failed: nVisibleCount != nNr1" );
2841                             }
2842                         }
2843                         break;
2844                 }
2845 
2846 
2847 
2848                 switch ( nMethodId )
2849                 {
2850                     case RC_MenuGetItemCount:
2851                         {
2852                             pRet->GenReturn ( RET_Value, nMethodId, (comm_ULONG)nItemCount );
2853                         }
2854                         break;
2855                     case RC_MenuGetItemId:
2856                         {
2857                             if ( ValueOK( rtl::OString(), RcString( nMethodId ),nNr1,nItemCount) )
2858                                 pRet->GenReturn ( RET_Value, nMethodId, (comm_ULONG)pMenu->GetItemId(nPhysicalIndex-1) );
2859                         }
2860                         break;
2861                     case RC_MenuGetItemPos:
2862                         {
2863                             sal_uInt16 nLogicalPos = pMenu->GetItemPos(nNr1);
2864                             if ( MENU_ITEM_NOTFOUND != nLogicalPos && pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
2865                             {   // jep, we have to adjust the position
2866                                 if ( !pMenu->IsItemEnabled( nNr1 ) )
2867                                     nLogicalPos = MENU_ITEM_NOTFOUND;
2868                                 else
2869                                 {
2870                                     sal_Bool bLastWasSeperator = sal_False;
2871                                     for ( int i = nLogicalPos ; i >= 0 ; i-- )
2872                                     {
2873                                         if ( !pMenu->IsItemEnabled( pMenu->GetItemId( sal::static_int_cast< sal_uInt16 >(i) ) ) ||
2874                                              ( pMenu->GetItemType( sal::static_int_cast< sal_uInt16 >(i) ) == MENUITEM_SEPARATOR && bLastWasSeperator ) )
2875                                             nLogicalPos--;
2876                                         bLastWasSeperator = pMenu->GetItemType( sal::static_int_cast< sal_uInt16 >(i) ) == MENUITEM_SEPARATOR;
2877                                     }
2878                                 }
2879                             }
2880                             pRet->GenReturn ( RET_Value, nMethodId, (comm_ULONG)(nLogicalPos+1) );
2881                         }
2882                         break;
2883                     case RC_MenuIsSeperator:
2884                         {
2885                             if ( ValueOK( rtl::OString(), RcString( nMethodId ),nNr1,nItemCount) )
2886                                 pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)(pMenu->GetItemType(nPhysicalIndex-1) == MENUITEM_SEPARATOR) );
2887                         }
2888                         break;
2889                     case RC_MenuIsItemChecked:
2890                         {
2891                             pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)pMenu->IsItemChecked(nNr1) );
2892                         }
2893                         break;
2894                     case RC_MenuIsItemEnabled:
2895                         {
2896                             pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)pMenu->IsItemEnabled(nNr1) );
2897                         }
2898                         break;
2899                     case RC_MenuGetItemText:
2900                         {
2901                             pRet->GenReturn ( RET_Value, nMethodId, (String)pMenu->GetItemText(nNr1) );
2902                         }
2903                         break;
2904                     case RC_MenuGetItemCommand:
2905                         {
2906                             pRet->GenReturn ( RET_Value, nMethodId, (String)pMenu->GetItemCommand(nNr1) );
2907                         }
2908                         break;
2909                     case RC_MenuHasSubMenu:
2910                         {
2911                             pRet->GenReturn ( RET_Value, nMethodId, (sal_Bool)(pMenu->GetPopupMenu(nNr1) != NULL) );
2912                         }
2913                         break;
2914                     case RC_MenuSelect:
2915                         {
2916                             if ( pMenu->GetPopupMenu(nNr1) )
2917                             {
2918                                 if ( !aSubMenuId1 )
2919                                     aSubMenuId1 = nNr1;
2920                                 else if ( !aSubMenuId2 )
2921                                     aSubMenuId2 = nNr1;
2922                                 else if ( !aSubMenuId3 )
2923                                     aSubMenuId3 = nNr1;
2924 
2925                                 if ( pPopup )
2926                                     pPopup->SelectEntry(nNr1);
2927                                 else
2928                                     pMenuBar->SelectEntry(nNr1);
2929                             }
2930                             else
2931                             {
2932                                 if ( pPopup )
2933                                 {
2934                                     pPopup->EndExecute(nNr1);
2935                                     aSubMenuId1 = 0;
2936                                     aSubMenuId2 = 0;
2937                                     aSubMenuId3 = 0;
2938                                     pMenuWindow = NULL;
2939                                 }
2940                                 else
2941                                 {
2942                                     pMenuBar->SelectEntry(nNr1);
2943                                     aSubMenuId1 = 0;
2944                                     aSubMenuId2 = 0;
2945                                     aSubMenuId3 = 0;
2946                                     pMenuWindow = NULL;
2947                                 }
2948                             }
2949                         }
2950                         break;
2951                 }
2952             }
2953             break;
2954         case RC_SetControlType:
2955             {
2956                 DirectLog( S_QAError, GEN_RES_STR0( S_DEPRECATED ) );
2957             }
2958             break;
2959         case RC_Kill:
2960         case RC_RmDir:
2961         case RC_MkDir:
2962         case RC_FileCopy:
2963         case RC_Name:
2964         case RC_Dir:
2965         case RC_FileLen:
2966         case RC_FileDateTime:
2967             {
2968                 long nErrorcode = FSYS_ERR_OK;
2969                 switch ( nMethodId )
2970                 {
2971                     case RC_Kill:
2972                         {
2973                             DirEntry aFile( aString1 );
2974                             nErrorcode = aFile.GetError();
2975                             if ( FSYS_ERR_OK == nErrorcode && FileStat( aFile ).IsKind( FSYS_KIND_FILE ) )
2976                                 nErrorcode = aFile.Kill();
2977                             else
2978                                 nErrorcode = FSYS_ERR_NOTAFILE;
2979                         }
2980                         break;
2981                     case RC_RmDir:
2982                         {
2983                             DirEntry aDir( aString1 );
2984                             nErrorcode = aDir.GetError();
2985                             if ( FSYS_ERR_OK == nErrorcode && FileStat( aDir ).IsKind( FSYS_KIND_DIR ) )
2986                                 nErrorcode = aDir.Kill();
2987                             else
2988                                 nErrorcode = FSYS_ERR_NOTADIRECTORY;
2989                         }
2990                         break;
2991                     case RC_MkDir:
2992                         {
2993                             DirEntry aDir( aString1 );
2994                             nErrorcode = aDir.GetError();
2995                             if ( !nErrorcode && !aDir.MakeDir() )
2996                                 nErrorcode = FSYS_ERR_UNKNOWN;
2997 //  Workaround f�r Bug 60693
2998 //                              nErrorcode = aDir.GetError();
2999                         }
3000                         break;
3001                     case RC_FileCopy:
3002                         {
3003                             nErrorcode = DirEntry( aString1 ).CopyTo( DirEntry( aString2 ), FSYS_ACTION_COPYFILE );
3004                         }
3005                         break;
3006                     case RC_Name:
3007                         {
3008                             nErrorcode = DirEntry( aString1 ).MoveTo( DirEntry( aString2 ) );
3009                         }
3010                         break;
3011                     case RC_Dir:
3012                         {
3013 
3014                             String aPath;
3015                             sal_uInt16 nDirFlags = 0;
3016 // from basic/source/inc/runtime.hxx
3017 #define Sb_ATTR_NORMAL          0x0000
3018 #define Sb_ATTR_HIDDEN          0x0002
3019 #define Sb_ATTR_SYSTEM          0x0004
3020 #define Sb_ATTR_VOLUME          0x0008
3021 #define Sb_ATTR_DIRECTORY       0x0010
3022 #define Sb_ATTR_ARCHIVE         0x0020
3023                             // copied from Basic and adapted  basic/source/runtime/methods.cxx Revision 1.54
3024                             if ( (nParams & PARAM_STR_1) )
3025                             {
3026                                 delete pDir;
3027                                 pDir = NULL; // wg. Sonderbehandlung Sb_ATTR_VOLUME
3028                                 DirEntry aEntry( aString1 );
3029                                 FileStat aStat( aEntry );
3030                                 if(!aStat.GetError() && (aStat.GetKind() & FSYS_KIND_FILE))
3031                                 {
3032                                     // OK, only a filename
3033                                     // cut off path (VB4)
3034                                     aPath = aEntry.GetName();
3035                                 }
3036                                 else
3037                                 {
3038                                     sal_uInt16 nFlags = 0;
3039                                     if ( (nParams & PARAM_USHORT_1) )
3040                                         nDirFlags = nFlags = nNr1;
3041                                     else
3042                                         nDirFlags = nFlags = Sb_ATTR_HIDDEN | Sb_ATTR_SYSTEM | Sb_ATTR_DIRECTORY;
3043 
3044                                     // Nur diese Bitmaske ist unter Windows erlaubt
3045                                     // Sb_ATTR_VOLUME wird getrennt gehandelt
3046                                     if( nDirFlags & Sb_ATTR_VOLUME )
3047                                         aPath = aEntry.GetVolume();
3048                                     else
3049                                     {
3050                                         // Die richtige Auswahl treffen
3051                                         sal_uInt16 nMode = FSYS_KIND_FILE;
3052                                         if( nFlags & Sb_ATTR_DIRECTORY )
3053                                             nMode |= FSYS_KIND_DIR;
3054                                         if( nFlags == Sb_ATTR_DIRECTORY )
3055                                             nMode = FSYS_KIND_DIR;
3056                                         pDir = new Dir( aEntry, (DirEntryKind) nMode );
3057                                         nErrorcode = pDir->GetError();
3058                                         nDirPos = 0;
3059                                     }
3060                                 }
3061                             }
3062 
3063                             if( pDir )
3064                             {
3065                                 for( ;; )
3066                                 {
3067                                     if( nDirPos >= pDir->Count() )
3068                                     {
3069                                         delete pDir;
3070                                         pDir = NULL;
3071                                         aPath.Erase();
3072                                         break;
3073                                     }
3074                                     DirEntry aNextEntry=(*(pDir))[nDirPos++];
3075                                     aPath = aNextEntry.GetName(); //Full();
3076                                     break;
3077                                 }
3078                             }
3079                             if ( !nErrorcode )
3080                             {
3081                                 pRet->GenReturn ( RET_Value, nMethodId, aPath );
3082                             }
3083 
3084 
3085 
3086 /* keep old Implementation for now
3087                             // neues Verzeichnis einlesen
3088                             if ( (nParams & PARAM_STR_1) )
3089                             {
3090                                 if ( pDir )
3091                                 {
3092                                     delete pDir;
3093                                     pDir = NULL;
3094                                 }
3095                                 DirEntryKind aDirEntryKind = FSYS_KIND_FILE | FSYS_KIND_DIR;
3096                                 if ( (nParams & PARAM_USHORT_1) && nNr1 )
3097                                 {
3098                                     if ( nNr1 & 16 )
3099                                         aDirEntryKind = FSYS_KIND_DIR;
3100                                     else
3101                                         ReportError( GEN_RES_STR0( S_SELECTION_BY_ATTRIBUTE_ONLY_DIRECTORIES ) );
3102                                 }
3103 
3104                                 DirEntry aEntry( aString1 );
3105                                 nErrorcode = aEntry.GetError();
3106                                 if ( !nErrorcode )
3107                                 {
3108                                     nDirPos = 0;
3109                                     FileStat aFS( aEntry );
3110                                     if ( !aFS.IsKind( FSYS_KIND_WILD ) && !aFS.IsKind( FSYS_KIND_DIR ) && aEntry.Exists() )
3111                                     {   // Sonderbehandlung f�r genau einen Eintrag
3112                                         if ( !aFS.IsKind( FSYS_KIND_DIR ) && ( aDirEntryKind == FSYS_KIND_DIR ) )
3113                                             pRet->GenReturn ( RET_Value, nMethodId, String() );
3114                                         else
3115                                             pRet->GenReturn ( RET_Value, nMethodId, (String)(aEntry.GetName()) );
3116 
3117                                         break;
3118                                     }
3119                                     else
3120                                     {
3121                                         pDir = new Dir( aEntry, aDirEntryKind );
3122                                         nErrorcode = pDir->GetError();
3123                                     }
3124                                 }
3125                             }
3126 
3127                             if ( !pDir )
3128                                 pDir = new Dir;
3129 
3130                             if ( !nErrorcode && ValueOK( nMethodId, GEN_RES_STR0( S_NO_MORE_FILES ), nDirPos+1, pDir->Count()+1 ) )
3131                             {
3132                                 if ( nDirPos == pDir->Count() )
3133                                     pRet->GenReturn ( RET_Value, nMethodId, String() );
3134                                 else
3135                                     pRet->GenReturn ( RET_Value, nMethodId, (String)((*pDir)[ nDirPos ].GetName()) );
3136                                 nDirPos++;
3137                             }*/
3138                         }
3139                         break;
3140                     case RC_FileLen:
3141                         {
3142                             DirEntry aFile( aString1 );
3143                             nErrorcode = aFile.GetError();
3144                             if ( FSYS_ERR_OK == nErrorcode )
3145                             {
3146                                 FileStat aFS( aFile );
3147                                 pRet->GenReturn ( RET_Value, nMethodId, static_cast<comm_ULONG>(aFS.GetSize()) ); //GetSize() sal_uLong != comm_ULONG on 64bit
3148                                 nErrorcode = aFS.GetError();
3149                             }
3150                         }
3151                         break;
3152                     case RC_FileDateTime:
3153                         {
3154                             DirEntry aFile( aString1 );
3155                             nErrorcode = aFile.GetError();
3156                             if ( FSYS_ERR_OK == nErrorcode )
3157                             {
3158                                 FileStat aStat( aFile );
3159                                 Time aTime( aStat.TimeModified() );
3160                                 Date aDate( aStat.DateModified() );
3161                                 nErrorcode = aStat.GetError();
3162 
3163                                 double fSerial = (double)( aDate - Date(30,12,1899) );
3164                                 long nSeconds = aTime.GetHour();
3165                                 nSeconds *= 3600;
3166                                 nSeconds += aTime.GetMin() * 60;
3167                                 nSeconds += aTime.GetSec();
3168                                 double nDays = ((double)nSeconds) / (double)(24.0*3600.0);
3169                                 fSerial += nDays;
3170 
3171                                 SbxValueRef xValue = new SbxValue( SbxDATE );
3172                                 xValue->PutDate( fSerial );
3173 
3174                                 pRet->GenReturn ( RET_Value, nMethodId, *xValue );
3175                             }
3176                         }
3177                         break;
3178                 }
3179                 switch ( nErrorcode )
3180                 {
3181                     case FSYS_ERR_OK:
3182                         break;
3183                     case FSYS_ERR_MISPLACEDCHAR:
3184                         {
3185                             ReportError( CUniString("MISPLACEDCHAR") );
3186                         }
3187                         break;
3188                     case FSYS_ERR_INVALIDCHAR:
3189                         {
3190                             ReportError( CUniString("INVALIDCHAR") );
3191                         }
3192                         break;
3193                     case FSYS_ERR_NOTEXISTS:
3194                         {
3195                             ReportError( CUniString("NOTEXISTS") );
3196                         }
3197                         break;
3198                     case FSYS_ERR_ALREADYEXISTS:
3199                         {
3200                             ReportError( CUniString("ALREADYEXISTS") );
3201                         }
3202                         break;
3203                     case FSYS_ERR_NOTADIRECTORY:
3204                         {
3205                             ReportError( CUniString("NOTADIRECTORY") );
3206                         }
3207                         break;
3208                     case FSYS_ERR_NOTAFILE:
3209                         {
3210                             ReportError( CUniString("NOTAFILE") );
3211                         }
3212                         break;
3213                     case FSYS_ERR_INVALIDDEVICE:
3214                         {
3215                             ReportError( CUniString("INVALIDDEVICE") );
3216                         }
3217                         break;
3218                     case FSYS_ERR_ACCESSDENIED:
3219                         {
3220                             ReportError( CUniString("ACCESSDENIED") );
3221                         }
3222                         break;
3223                     case FSYS_ERR_LOCKVIOLATION:
3224                         {
3225                             ReportError( CUniString("LOCKVIOLATION") );
3226                         }
3227                         break;
3228                     case FSYS_ERR_VOLUMEFULL:
3229                         {
3230                             ReportError( CUniString("VOLUMEFULL") );
3231                         }
3232                         break;
3233                     case FSYS_ERR_ISWILDCARD:
3234                         {
3235                             ReportError( CUniString("ISWILDCARD") );
3236                         }
3237                         break;
3238                     case FSYS_ERR_NOTSUPPORTED:
3239                         {
3240                             ReportError( CUniString("NOTSUPPORTED") );
3241                         }
3242                         break;
3243                     case FSYS_ERR_UNKNOWN:
3244                         {
3245                             ReportError( CUniString("UNKNOWN") );
3246                         }
3247                         break;
3248                     default:
3249                         {
3250                             ReportError( CUniString("Not an FSYS Error") );
3251                         }
3252                 }
3253 
3254             }
3255             break;
3256         case RC_TypeKeysDelay:
3257             {
3258                 if( (nParams & PARAM_BOOL_1) )
3259                 {
3260                     bDoTypeKeysDelay = bBool1;
3261                 }
3262                 else if( nParams & PARAM_USHORT_1 )
3263                 {
3264                     nMinTypeKeysDelay = nNr1;
3265                     if( nParams & PARAM_USHORT_2 )
3266                         nMaxTypeKeysDelay = nNr2;
3267                     else
3268                         nMaxTypeKeysDelay = nMinTypeKeysDelay;
3269                 }
3270                 else
3271                     ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
3272             }
3273             break;
3274         case RC_GetMouseStyle:
3275             {
3276                 Pointer aPointer;
3277 //              if ( DragManager::GetDragManager() )
3278 //                  aPointer = DragManager::GetDragManager()->GetDragPointer();
3279 //              else
3280                 {
3281                     Window *pActualWin = GetMouseWin();
3282                     if ( pActualWin )
3283                         aPointer = pActualWin->GetPointer();
3284                     else
3285                     {
3286                         ReportError( GEN_RES_STR1( S_POINTER_OUTSIDE_APPWIN, RcString( nMethodId ) ) );
3287                         aPointer = Pointer( POINTER_NULL );
3288                     }
3289                 }
3290                 pRet->GenReturn ( RET_Value, nMethodId, (comm_ULONG)aPointer.GetStyle() );
3291             }
3292             break;
3293         case RC_UnpackStorage:
3294             {
3295                 if( (nParams & PARAM_STR_1) )
3296                 {
3297                     String aFileName( aString1 );
3298                     DirEntry aDestPath;
3299                     if( (nParams & PARAM_STR_2) )
3300                         aDestPath = DirEntry( aString2 );
3301                     else
3302                     {
3303                         aDestPath = DirEntry( aFileName );
3304                         aDestPath.SetExtension( CUniString( "plaintext" ) );
3305                     }
3306 
3307 #if OSL_DEBUG_LEVEL > 1
3308                     sal_uInt16 nEntries = Dir( aDestPath, FSYS_KIND_FILE | FSYS_KIND_DIR ).Count();
3309                     (void) nEntries; /* avoid warning about unused parameter */
3310 #endif
3311                     // The Count is only larger than 2 is the path is a directory which is not empty
3312                     // the Count of 2 results from the "." and ".." directory
3313                     if ( Dir( aDestPath, FSYS_KIND_FILE | FSYS_KIND_DIR ).Count() > 2 )
3314                         DirectLog( S_QAError, GEN_RES_STR1( S_DIRECTORY_NOT_EMPTY, aDestPath.GetFull() ) );
3315 
3316                     SotStorageRef xStorage = new SotStorage( aFileName, STREAM_STD_READ );
3317                     if ( xStorage->GetError() )
3318                         ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aFileName, aDestPath.GetFull()) );
3319                     else
3320                         UnpackStorage( xStorage, aDestPath );
3321                 }
3322                 else
3323                     ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
3324             }
3325             break;
3326         case RC_CloseSysDialog:
3327         case RC_ExistsSysDialog:
3328             {
3329                 if( (nParams & PARAM_USHORT_1) )
3330                 {
3331                     Reference < ::com::sun::star::util::XCancellable > xPicker;
3332                     switch( nNr1 )
3333                     {
3334                         case CONST_FilePicker:
3335                             {
3336                                 xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) );
3337                             }
3338                             break;
3339                         case CONST_FolderPicker:
3340                             {
3341                                 xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) );
3342                             }
3343                             break;
3344                         default:
3345                             ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
3346                     }
3347                     switch( nMethodId )
3348                     {
3349                         case RC_CloseSysDialog:
3350                             {
3351                                 if ( xPicker.is() )
3352                                     xPicker->cancel();
3353                                 else
3354                                     ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
3355                             }
3356                             break;
3357                         case RC_ExistsSysDialog:
3358                             {
3359                                 pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)xPicker.is() );
3360                             }
3361                             break;
3362                         default:
3363                             ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
3364                     }
3365                 }
3366                 else
3367                     ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
3368             }
3369             break;
3370         case RC_SAXCheckWellformed:
3371         case RC_SAXReadFile:
3372 
3373         case RC_SAXGetNodeType:
3374         case RC_SAXGetAttributeCount:
3375         case RC_SAXGetAttributeName:
3376         case RC_SAXGetAttributeValue:
3377         case RC_SAXGetChildCount:
3378         case RC_SAXGetElementName:
3379         case RC_SAXGetChars:
3380 
3381         case RC_SAXSeekElement:
3382         case RC_SAXHasElement:
3383         case RC_SAXGetElementPath:
3384 
3385         case RC_SAXRelease:
3386             {
3387                 HandleSAXParser();
3388             }
3389             break;
3390         case RC_RecordMacro:
3391             {
3392                 if ( ! (nParams & PARAM_BOOL_1) )
3393                     bBool1 = sal_True;
3394 
3395                 MacroRecorder::GetMacroRecorder()->SetActionRecord( bBool1 );
3396             }
3397             break;
3398         case RC_GetDocumentCount :
3399             {
3400                 pRet->GenReturn ( RET_Value, nMethodId, (comm_USHORT)GetDocWinCount() );
3401             }
3402             break;
3403         case RC_ActivateDocument :
3404             {
3405                 if( nParams & PARAM_USHORT_1 )
3406                 {
3407                     if ( ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, GetDocWinCount() ) )
3408                     {
3409                         Window* pWin = GetDocWin( nNr1-1 );
3410                         if ( pWin )
3411                         {
3412                             pWin->ToTop();
3413                             pWin->GrabFocus();
3414                         }
3415                     }
3416                 }
3417                 else
3418                     ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
3419             }
3420             break;
3421         case RC_GetSystemLanguage :
3422             {
3423                 pRet->GenReturn ( RET_Value, nMethodId, (comm_USHORT)Application::GetSettings().GetLanguage() );
3424             }
3425             break;
3426         case RC_CatchGPF :
3427             {
3428                 if( (nParams & PARAM_BOOL_1) )
3429                     bCatchGPF = bBool1;
3430                 else
3431                     bCatchGPF = sal_True;
3432             }
3433             break;
3434         case RC_IsProduct :
3435             {
3436                 sal_Bool bIsProduct;
3437                 #ifdef DBG_UTIL
3438                     bIsProduct = sal_False;
3439                 #else
3440                     bIsProduct = sal_True;
3441                 #endif
3442                 pRet->GenReturn ( RET_Value, nMethodId, (sal_Bool)bIsProduct );
3443             }
3444             break;
3445         case RC_UsePostEvents :
3446             {
3447                 if( (nParams & PARAM_BOOL_1) )
3448                     bUsePostEvents = bBool1;
3449                 else
3450                     bUsePostEvents = sal_True;
3451             }
3452             break;
3453         default:
3454             ReportError( GEN_RES_STR1( S_UNKNOWN_COMMAND, RcString( nMethodId ) ) );
3455     }
3456     SendProfile( RcString(nMethodId) );
3457     delete this;
3458     return sal_True;
3459 }
3460 
3461 
3462 sal_Bool StatementCommand::UnpackStorage( SotStorageRef xStorage, DirEntry &aBaseDir )
3463 {
3464     SvStorageInfoList aList;
3465     xStorage->FillInfoList( &aList );
3466 
3467     for( sal_uInt16 i = 0; i < aList.Count(); i++ )
3468     {
3469         SvStorageInfo& rInfo = aList.GetObject( i );
3470         String aName = rInfo.GetName();
3471         DirEntry aPath ( aBaseDir );
3472         aPath += DirEntry( aName );
3473         sal_Bool bIsStorage = xStorage->IsStorage( aName );
3474         if ( bIsStorage )
3475         {
3476             SotStorageRef xSubStorage = xStorage->OpenSotStorage( aName, STREAM_STD_READ );
3477                 if ( xSubStorage->GetError() )
3478                 {
3479                     ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aName, aPath.GetFull()) );
3480                     return sal_False;
3481                 }
3482                 UnpackStorage( xSubStorage, aPath );
3483         }
3484         else
3485         {
3486             if ( !aPath.MakeDir( sal_True ) )
3487             {
3488                 ReportError( GEN_RES_STR1(S_CANNOT_CREATE_DIRECTORY, aPath.GetFull()) );
3489                 return sal_False;
3490             }
3491             SotStorageStreamRef xStream = xStorage->OpenSotStream( aName, STREAM_STD_READ );
3492             SvFileStream aDestination( aPath.GetFull(), STREAM_STD_READWRITE | STREAM_TRUNC );
3493             (*xStream) >> aDestination;
3494             if ( aDestination.GetError() != ERRCODE_NONE )
3495             {
3496                 ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aName, aPath.GetFull()) );
3497                 return sal_False;
3498             }
3499             aDestination.Close();
3500         }
3501     }
3502     return sal_True;
3503 }
3504 
3505 
3506 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3507 
3508 StatementControl::StatementControl( SCmdStream *pCmdIn, sal_uInt16 nControlIdType )
3509 : StatementList()
3510 , nNr1( 0 )
3511 , nNr2( 0 )
3512 , nNr3( 0 )
3513 , nNr4( 0 )
3514 , nLNr1( 0 )
3515 , aString1()
3516 , aString2()
3517 , bBool1(sal_False)
3518 , bBool2(sal_False)
3519 {
3520     QueStatement( NULL );
3521     //HELPID BACKWARD (SIControl is no longer needed)
3522     if ( nControlIdType == SIControl )
3523     {
3524         comm_ULONG nId;
3525         pCmdIn->Read( nId );
3526         aUId = rtl::OString( nId );
3527         if ( nId == 0 )
3528             aUId = UID_ACTIVE;
3529         else
3530             ReportError( aUId, GEN_RES_STR1c( S_INTERNAL_ERROR, "using numeric HelpID from old Testtool" ) );
3531     }
3532     else if ( nControlIdType == SIStringControl )
3533     {
3534         String aId;
3535         pCmdIn->Read( aId );
3536         aUId = Str2Id( aId );
3537     }
3538     else
3539     {
3540         DBG_ERROR( "Wrong ControlType" );
3541     }
3542 
3543     pCmdIn->Read( nMethodId );
3544     pCmdIn->Read( nParams );
3545 
3546     if( nParams & PARAM_USHORT_1 )  pCmdIn->Read( nNr1 );
3547     if( nParams & PARAM_USHORT_2 )  pCmdIn->Read( nNr2 );
3548     if( nParams & PARAM_USHORT_3 )  pCmdIn->Read( nNr3 );
3549     if( nParams & PARAM_USHORT_4 )  pCmdIn->Read( nNr4 );
3550     if( nParams & PARAM_ULONG_1 )   pCmdIn->Read( nLNr1 );
3551     if( nParams & PARAM_STR_1 )     pCmdIn->Read( aString1 );
3552     if( nParams & PARAM_STR_2 )     pCmdIn->Read( aString2 );
3553     if( nParams & PARAM_BOOL_1 )    pCmdIn->Read( bBool1 );
3554     if( nParams & PARAM_BOOL_2 )    pCmdIn->Read( bBool2 );
3555 
3556 #if OSL_DEBUG_LEVEL > 1
3557     m_pDbgWin->AddText( "Reading Control: UId: " );
3558     m_pDbgWin->AddText( Id2Str( aUId ) );
3559     m_pDbgWin->AddText( " Methode: " );
3560     m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
3561     m_pDbgWin->AddText( " Params:" );
3562     if( nParams & PARAM_USHORT_1 )  {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
3563     if( nParams & PARAM_USHORT_2 )  {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
3564     if( nParams & PARAM_USHORT_3 )  {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
3565     if( nParams & PARAM_USHORT_4 )  {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
3566     if( nParams & PARAM_ULONG_1 )   {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
3567     if( nParams & PARAM_STR_1 )     {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
3568     if( nParams & PARAM_STR_2 )     {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
3569 /*    if( nParams & PARAM_BOOL_1 )    pCmdIn->Read( bBool1 );
3570     if( nParams & PARAM_BOOL_2 )    pCmdIn->Read( bBool2 );*/
3571     m_pDbgWin->AddText( "\n" );
3572 #endif
3573 }
3574 
3575 sal_Bool IsDialog(Window *pWin)
3576 {   // Alles was von SystemWindow abgeleitet ist
3577     if ( !pWin )
3578         return sal_False;
3579 
3580     switch (pWin->GetType())
3581     {
3582         case WINDOW_FLOATINGWINDOW:
3583         case WINDOW_DOCKINGWINDOW:
3584         case WINDOW_MODELESSDIALOG:
3585         case WINDOW_DIALOG:
3586         case WINDOW_MODALDIALOG:
3587         case WINDOW_WORKWINDOW:
3588         case WINDOW_TABDIALOG:
3589 
3590         case WINDOW_MESSBOX:
3591         case WINDOW_INFOBOX:
3592         case WINDOW_WARNINGBOX:
3593         case WINDOW_ERRORBOX:
3594         case WINDOW_QUERYBOX:
3595         case WINDOW_BUTTONDIALOG:
3596         case WINDOW_FILEDIALOG:
3597         case WINDOW_PRINTDIALOG:
3598         case WINDOW_PRINTERSETUPDIALOG:
3599 
3600 // ab hier nicht ansprechbar (da nicht implementiert)
3601         case WINDOW_SYSWINDOW:
3602         case WINDOW_SYSTEMDIALOG:
3603         case WINDOW_COLORDIALOG:
3604         case WINDOW_FONTDIALOG:
3605         case WINDOW_PATHDIALOG:
3606 
3607 
3608             return sal_True;
3609 //          break;
3610         default:
3611             return sal_False;
3612 //          break;
3613     }
3614 }
3615 
3616 
3617 sal_Bool IsAccessable(Window *pWin)
3618 {
3619     if ( pWin == NULL )
3620         return sal_False;
3621 
3622     return pWin->IsEnabled() && pWin->IsInputEnabled();
3623 }
3624 
3625 
3626 
3627 // neue Hilfsfunktion
3628 static Window*ImpGetButton( Window *pBase, WinBits nMask, WinBits nWinBits )
3629 {
3630     sal_uInt16 n = pBase->GetChildCount();
3631     for( sal_uInt16 i = 0 ; i < n; i++ ) {
3632         Window *pChild = pBase->GetChild(i);
3633         if(    pChild->GetType() == WINDOW_OKBUTTON
3634             || pChild->GetType() == WINDOW_CANCELBUTTON
3635             || pChild->GetType() == WINDOW_HELPBUTTON
3636             || pChild->GetType() == WINDOW_PUSHBUTTON )
3637             if( !nMask || ( pChild->GetStyle() & nMask ) == nWinBits )
3638                 return pChild;
3639     }
3640     return NULL;
3641 }
3642 
3643 sal_Bool StatementControl::ControlOK( Window *pControl, const sal_Char* cBezeichnung )
3644 {
3645     if ( pControl && ( ( ( IsAccessable(pControl) || (nMethodId & M_WITH_RETURN) ) &&
3646                          pControl->IsVisible() ) ||
3647                          aUId.equals( UID_ACTIVE ) ) )
3648         return sal_True;
3649     else
3650     {
3651         UniString aBezeichnung( cBezeichnung, RTL_TEXTENCODING_ASCII_US );
3652         if ( aBezeichnung.Len() > 0 )
3653         {
3654             if (!pControl)
3655                 ReportError( aUId, GEN_RES_STR1( S_WIN_NOT_FOUND, aBezeichnung ) );
3656             else if ( !pControl->IsVisible() )
3657                 ReportError( aUId, GEN_RES_STR1( S_WIN_INVISIBLE, aBezeichnung ) );
3658             else
3659                 ReportError( aUId, GEN_RES_STR1( S_WIN_DISABLED, aBezeichnung ) );
3660         }
3661         #if OSL_DEBUG_LEVEL > 1
3662         m_pDbgWin->AddText( aBezeichnung.AppendAscii(" NotFound or Disabled or Invisible") );
3663         #endif
3664 
3665         return sal_False;
3666     }
3667 }
3668 
3669 
3670 sal_Bool StatementList::ValueOK( rtl::OString aId, String aBezeichnung, sal_uLong nValue, sal_uLong nMax )
3671 {
3672 
3673     if ( nMax < nValue )
3674     {
3675         if ( aBezeichnung.Len() > 0 )
3676             ReportError( aId, GEN_RES_STR3( S_NUMBER_TOO_BIG, aBezeichnung, UniString::CreateFromInt32( nValue ), UniString::CreateFromInt32( nMax ) ) );
3677         return sal_False;
3678     }
3679     if ( nValue < 1 )
3680     {
3681         if ( aBezeichnung.Len() > 0 )
3682             ReportError( aId, GEN_RES_STR3c3( S_NUMBER_TOO_SMALL, aBezeichnung, UniString::CreateFromInt32( nValue ), "1" ) );
3683         return sal_False;
3684     }
3685     return sal_True;
3686 }
3687 
3688 sal_uInt16 StatementList::GetCurrentMenues( PopupMenu *&pPopup, MenuBar *&pMenuBar, Menu *&pMenu )
3689 {
3690     if ( WinPtrValid( pMenuWindow ) )
3691         pMenuBar = pMenuWindow->GetMenuBar();
3692 
3693     if ( pMenuBar )     // use MenuBar as base
3694         pMenu = pMenuBar;
3695     else        // use contextmenu as base
3696     {
3697         pMenu = PopupMenu::GetActivePopupMenu();
3698         pPopup = PopupMenu::GetActivePopupMenu();
3699     }
3700 
3701     if ( !pMenu )
3702         return 1;
3703 
3704     if ( aSubMenuId1 )
3705     {
3706         pPopup = pMenu->GetPopupMenu( aSubMenuId1 );
3707         pMenu = pPopup;
3708     }
3709 
3710     if ( pMenu && aSubMenuId2 )
3711     {
3712         pPopup = pMenu->GetPopupMenu( aSubMenuId2 );
3713         pMenu = pPopup;
3714     }
3715 
3716     if ( pMenu && aSubMenuId3 )
3717     {
3718         pPopup = pMenu->GetPopupMenu( aSubMenuId3 );
3719         pMenu = pPopup;
3720     }
3721 
3722     return 0;
3723 }
3724 
3725 void StatementControl::AnimateMouse( Window *pControl, TTHotSpots aWohin )
3726 {
3727     Point aZiel;
3728 
3729     switch (aWohin)
3730     {
3731         case MitteLinks:
3732             {
3733                 long nHeight = pControl->GetSizePixel().Height();
3734                 aZiel.X() += 5;
3735                 aZiel.Y() += nHeight / 2;
3736             }
3737             break;
3738         case Mitte:
3739             {
3740                 Size aSize = pControl->GetOutputSizePixel();
3741                 aZiel.Move( aSize.Width() / 2, aSize.Height() / 2 );
3742             }
3743             break;
3744         case MitteOben:
3745             {
3746                 long nWidth = pControl->GetSizePixel().Width();
3747                 aZiel.X() += nWidth / 2;
3748                 aZiel.Y() += 5;
3749             }
3750             break;
3751     }
3752     AnimateMouse( pControl, aZiel );
3753 }
3754 
3755 
3756 void StatementControl::AnimateMouse( Window *pControl, Point aWohin )
3757 {
3758     Point aAkt = pControl->GetPointerPosPixel();
3759     Point aZiel = aWohin;
3760 
3761     long nSteps;
3762     Point aDiff = aAkt - aZiel;
3763 
3764     if ( Abs(aDiff.X()) < Abs(aDiff.Y()) )
3765         nSteps = Abs(aDiff.Y()) / 5;
3766     else
3767         nSteps = Abs(aDiff.X()) / 5;
3768     if ( nSteps == 0 )
3769         return;
3770 
3771     aDiff *= 1000;
3772     aDiff /= nSteps;
3773 
3774     StatementList::bExecuting = sal_True;       // Bah ist das ein ekliger Hack
3775                                                 // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird.
3776 
3777     for ( ; nSteps ; nSteps-- )
3778     {
3779         if ( Abs((aAkt - pControl->GetPointerPosPixel()).X()) > 5 ||
3780              Abs((aAkt - pControl->GetPointerPosPixel()).Y()) > 5 )
3781             nSteps = 1;
3782         aAkt = aZiel + aDiff * nSteps / 1000;
3783         pControl->SetPointerPosPixel(aAkt);
3784         SafeReschedule();
3785     }
3786     pControl->SetPointerPosPixel(aZiel);
3787     StatementList::bExecuting = sal_False;  // Bah ist das ein ekliger Hack
3788 }
3789 
3790 
3791 sal_Bool StatementControl::MaybeDoTypeKeysDelay( Window *pTestWindow )
3792 {
3793     if ( bDoTypeKeysDelay )
3794     {
3795         sal_uLong nTimeWait = nMinTypeKeysDelay;
3796         if ( nMaxTypeKeysDelay != nMinTypeKeysDelay )
3797             nTimeWait  += Time::GetSystemTicks() % ( nMaxTypeKeysDelay - nMinTypeKeysDelay );
3798         Timer aTimer;
3799         aTimer.SetTimeout( nTimeWait );
3800         aTimer.Start();
3801         StatementList::bExecuting = sal_True;       // Bah ist das ein ekliger Hack
3802                                                     // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird.
3803         while ( aTimer.IsActive() )
3804         {
3805             SafeReschedule( sal_True );
3806         }
3807         StatementList::bExecuting = sal_False;  // Bah ist das ein ekliger Hack
3808         if ( !WinPtrValid(pTestWindow ) )
3809         {
3810             ReportError( aUId, GEN_RES_STR1( S_WINDOW_DISAPPEARED, MethodString( nMethodId ) ) );
3811             return sal_False;
3812         }
3813     }
3814     return sal_True;
3815 }
3816 
3817 sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
3818 {
3819     if( pControl )      // Also auch bei Disabled nicht jedoch bei Invisible
3820     {
3821         switch( nMethodId )
3822         {
3823         case M_IsEnabled:
3824             pRet->GenReturn ( RET_Value, aUId, IsAccessable(pControl) );
3825             break;
3826         case M_IsVisible:
3827             pRet->GenReturn ( RET_Value, aUId, pControl->IsVisible() );
3828             break;
3829         case M_GetPosX:
3830             if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
3831                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r FloatingWindows
3832             if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
3833                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r TabDialoge
3834             if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
3835                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r Border
3836             if ( (nParams & PARAM_BOOL_1) && bBool1 )
3837                 pControl = pControl->GetWindow( WINDOW_OVERLAP );
3838 
3839             if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW )
3840             {
3841                 Point aPos = pControl->GetPosPixel();
3842                 aPos = pControl->GET_REAL_PARENT()->OutputToScreenPixel( aPos );
3843                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)aPos.X() );
3844             }
3845             else
3846                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pControl->GetPosPixel().X() );
3847             break;
3848         case M_GetPosY:
3849             if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
3850                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r FloatingWindows
3851             if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
3852                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r TabDialoge
3853             if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
3854                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r Border
3855             if ( (nParams & PARAM_BOOL_1) && bBool1 )
3856                 pControl = pControl->GetWindow( WINDOW_OVERLAP );
3857 
3858             if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW )
3859             {
3860                 Point aPos = pControl->GetPosPixel();
3861                 aPos = pControl->GET_REAL_PARENT()->OutputToScreenPixel( aPos );
3862                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)aPos.Y() );
3863             }
3864             else
3865                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pControl->GetPosPixel().Y() );
3866             break;
3867         case M_GetSizeX:
3868             if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
3869                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r FloatingWindows
3870             if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
3871                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r TabDialoge
3872             if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
3873                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r Border
3874             if ( (nParams & PARAM_BOOL_1) && bBool1 )
3875                 pControl = pControl->GetWindow( WINDOW_OVERLAP );
3876 
3877             pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pControl->GetSizePixel().Width() );
3878             break;
3879         case M_GetSizeY:
3880             if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
3881                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r FloatingWindows
3882             if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
3883                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r TabDialoge
3884             if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
3885                 pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r Border
3886             if ( (nParams & PARAM_BOOL_1) && bBool1 )
3887                 pControl = pControl->GetWindow( WINDOW_OVERLAP );
3888 
3889             pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pControl->GetSizePixel().Height() );
3890             break;
3891         case M_SnapShot:
3892             {
3893                 if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
3894                     pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r FloatingWindows
3895                 if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
3896                     pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r TabDialoge
3897                 if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
3898                     pControl = pControl->GET_REAL_PARENT();     // Sonderbehandlung f�r Border
3899                 if ( (nParams & PARAM_BOOL_1) && bBool1 )
3900                     pControl = pControl->GetWindow( WINDOW_OVERLAP );
3901 
3902                 Bitmap aBmp = pControl->SnapShot();
3903                 if ( pControl->GetType() == WINDOW_WORKWINDOW )
3904                 {
3905                     Point aStart = pControl->GetPosPixel();
3906                     if ( !(nParams & PARAM_USHORT_4) )
3907                     {
3908                         nParams |= PARAM_USHORT_1;
3909                         nParams |= PARAM_USHORT_2;
3910                         nParams |= PARAM_USHORT_3;
3911                         nParams |= PARAM_USHORT_4;
3912                         nNr1 = (sal_uInt16)-aStart.X();
3913                         nNr2 = (sal_uInt16)-aStart.Y();
3914                         nNr3 = (sal_uInt16)pControl->GetSizePixel().Width() + 2*(sal_uInt16)aStart.X();
3915                         nNr4 = (sal_uInt16)pControl->GetSizePixel().Height() + 2*(sal_uInt16)aStart.Y();
3916                     }
3917                     nNr1 = std::max((sal_uInt16)-aStart.X(),nNr1);
3918                     nNr2 = std::max((sal_uInt16)-aStart.Y(),nNr2);
3919                     nNr3 = std::min((sal_uInt16)(pControl->GetSizePixel().Width() + 2*(sal_uInt16)aStart.X()),nNr3);
3920                     nNr4 = std::min((sal_uInt16)(pControl->GetSizePixel().Height() + 2*(sal_uInt16)aStart.Y()),nNr4);
3921                 }
3922                 if( nParams & PARAM_USHORT_4 )
3923                 {   // Zuschneiden
3924                     Point aPt(-nNr1,-nNr2);
3925                     Size aSz(nNr3,nNr4);
3926                     VirtualDevice aVDev( *pControl );
3927 
3928                     aVDev.SetOutputSizePixel( aSz );
3929                     aVDev.DrawBitmap( aPt, aBmp );
3930                     aBmp = aVDev.GetBitmap( Point(), aSz );
3931                 }
3932 
3933                 SvFileStream fOut;
3934                 fOut.Open(aString1,STREAM_STD_WRITE);
3935                 aBmp.Write(fOut);
3936                 if ( fOut.GetError() )
3937                     ReportError( aUId, GEN_RES_STR1( S_ERROR_SAVING_IMAGE, UniString::CreateFromInt32( fOut.GetError() ) ) );
3938                 fOut.Close();
3939             }
3940             break;
3941         case M_GetFixedTextCount:
3942             {
3943                 pRet->GenReturn ( RET_Value, aUId, CountWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True ) );
3944             }
3945             break;
3946         case M_GetFixedText:
3947             {
3948                 if( ( nParams & PARAM_USHORT_1 ) == 0 )
3949                     nNr1 = 1;
3950 
3951                 FixedText* pFixedText = (FixedText*)GetWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True, nNr1-1 );
3952                 if ( pFixedText )
3953                     pRet->GenReturn ( RET_Value, aUId, pFixedText->GetText() );
3954                 else
3955                     ValueOK(aUId, MethodString( nMethodId ),nNr1,CountWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True ) );
3956             }
3957             break;
3958         case M_HasFocus:
3959             {
3960                 pRet->GenReturn ( RET_Value, aUId, pControl->HasFocus() );
3961             break;
3962             }
3963         case M_GetScreenRectangle:
3964             {
3965                 Rectangle aRect =  bBool1 ? pControl->GetClientWindowExtentsRelative(NULL) : pControl->GetWindowExtentsRelative( NULL );
3966                 pRet->GenReturn ( RET_Value, aUId,
3967                     UniString::CreateFromInt32(aRect.Left()).
3968                     AppendAscii(",").Append(UniString::CreateFromInt32(aRect.Top())).
3969                     AppendAscii(",").Append(UniString::CreateFromInt32(aRect.GetWidth())).
3970                     AppendAscii(",").Append(UniString::CreateFromInt32(aRect.GetHeight()))
3971                     );
3972             }
3973             break;
3974         case M_GetHelpText:
3975             {
3976                 pRet->GenReturn ( RET_Value, aUId, pControl->GetHelpText());
3977             }
3978             break;
3979         case M_GetQuickHelpText:
3980             {
3981                 pRet->GenReturn ( RET_Value, aUId,pControl->GetQuickHelpText());
3982             }
3983             break;
3984         default:
3985             return sal_False;
3986         }
3987         SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) );
3988         return sal_True;
3989     }
3990     return sal_False;
3991 }
3992 
3993 sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
3994 {
3995     switch( nMethodId )     // Diese k�nnen an jedem Window ausgef�hrt werden
3996     {
3997         case M_Exists:          // Oben schon Behandelt. Unterdr�ckt hier nur Fehler
3998         case M_NotExists:
3999         case M_IsEnabled:
4000         case M_IsVisible:
4001         case M_SnapShot:
4002             break;
4003         case M_Caption :
4004             {
4005                 if ( pControl->GetText().Len() == 0 && IsDocFrame( pControl->GetWindow( WINDOW_FRAME ) ) )
4006                     pRet->GenReturn ( RET_Value, aUId, pControl->GetWindow( WINDOW_FRAME )->GetText());
4007                 else
4008                     pRet->GenReturn ( RET_Value, aUId, pControl->GetText());
4009             }
4010             break;
4011         case M_GetRT:
4012             {
4013                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pControl->GetType() );
4014             }
4015             break;
4016         case M_TypeKeys:
4017             {
4018                 if( !(nParams & PARAM_USHORT_1) )   // Anzahl wiederholungen
4019                     nNr1 = 1;
4020                 if( !(nParams & PARAM_BOOL_1) )     // Follow Focus
4021                     bBool1 = sal_False;     // so bleibt das bisherige Verhalten
4022 
4023                 if ( !bBool1 )          // Altes Verhalten
4024                     pControl->GrabFocus();
4025                 else    // If focus is not inside given control we grab it once.
4026                 {
4027                     Window *pFocus = GetpApp()->GetFocusWindow();
4028                     if ( !pFocus || !pControl->IsWindowOrChild( pFocus, sal_True ) )
4029                         pControl->GrabFocus();
4030                 }
4031 
4032 
4033                 // maybe this can get removed since we are using GetPreferredKeyInputWindow()
4034                 if ( pControl->GetType() == WINDOW_COMBOBOX )
4035                 {   // Bei COMBOBOX an das Edit direkt liefern
4036                     Window *pTemp = NULL;
4037                     for ( sal_uInt16 i = 0 ; i < pControl->GetChildCount() && !pTemp ; i++ )
4038                         if ( pControl->GetChild( i )->GetType() == WINDOW_EDIT )
4039                             pTemp = pControl->GetChild( i );
4040                     if ( pTemp )
4041                         pControl = pTemp;
4042                 }
4043 
4044                 Window *pDeliverHere = pControl;
4045                 for (int j = 0; j < nNr1; j++)
4046                     for (xub_StrLen i = 0; i < aString1.Len(); i++)
4047                     {
4048                         if ( StatementList::bUsePostEvents )
4049                         { // grab focus every time
4050                             Window *pFocus = GetpApp()->GetFocusWindow();
4051                             if ( !pFocus || !pControl->IsWindowOrChild( pFocus, sal_True ) )
4052                                 pControl->GrabFocus();
4053                         }
4054                         if ( bBool1 )   // Jedesmal das FocusWindow finden
4055                         {
4056                             Window *pFocus = GetpApp()->GetFocusWindow();
4057                             if ( pFocus && pControl->IsWindowOrChild( pFocus, sal_True ) )
4058                                 pDeliverHere = pFocus;
4059                             else    // sonst fallback auf das Basisfenster
4060                                 pDeliverHere = pControl;
4061                         }
4062                         pDeliverHere = pDeliverHere->GetPreferredKeyInputWindow();
4063                         KeyEvent aEvent;
4064                         if ( ((sal_uInt16)aString1.GetChar(i)) <= 7 )
4065                         {
4066                             sal_uInt16 nVal = 0;
4067                             switch (aString1.GetChar(i))
4068                             {
4069                                 case 1: nVal = aString1.GetChar(i+1) + (aString1.GetChar(i+2) << 8);
4070                                         i += 2;
4071                                         break;
4072                                 case 3: nVal = (aString1.GetChar(i+1) << 8);
4073                                         i++;
4074                                         break;
4075                                 case 5: nVal = aString1.GetChar(i+1);
4076                                         i++;
4077                                         break;
4078                                 case 7: nVal = 0;
4079                                         break;
4080                             }
4081                             // #105672#
4082                             // find out the keycode
4083                             sal_uInt16 nKeygroup = nVal & KEYGROUP_TYPE;
4084                             sal_uInt16 nKeyCode = nVal & KEY_CODE;
4085                             sal_Unicode aCh;
4086                             switch (nKeygroup)
4087                             {
4088                                 case KEYGROUP_NUM:
4089                                     aCh = nKeyCode - KEY_0 + '0';
4090                                     break;
4091                                 case KEYGROUP_ALPHA:
4092                                     aCh = nKeyCode - KEY_A;
4093                                     if ( nVal & KEY_MOD1 )
4094                                     {}
4095                                     else if ( nVal & KEY_SHIFT )
4096                                         aCh += 'A';
4097                                     else
4098                                         aCh += 'a';
4099                                 break;
4100                                 case KEYGROUP_MISC:
4101                                     {                           //  CR  ESC TAB BACK
4102                                         ByteString aPrintableMisc("\x0d\x1b\x09\x08 **+-*/.,<>=",16);
4103                                         if ( nKeyCode-KEY_RETURN < aPrintableMisc.Len()
4104                                             && nKeyCode != KEY_INSERT && nKeyCode != KEY_DELETE )
4105                                             aCh = aPrintableMisc.GetChar( nKeyCode-KEY_RETURN );
4106                                         else
4107                                             aCh = 0;
4108                                     }
4109                                     break;
4110                                 case KEYGROUP_CURSOR:
4111                                 case KEYGROUP_FKEYS:
4112                                 default:
4113                                     aCh = 0;
4114                             }
4115                             aEvent = KeyEvent(aCh,KeyCode(nVal & 0xFFF,nVal & 0xF000));
4116                         }
4117                         else
4118                         {
4119                                                             //   CR  ESC TAB BACK
4120                             String aPrintableMisc = CUniString("\x0d\x1b\x09\x08 xx+-*/.,<>=");
4121                             sal_Unicode aCh = aString1.GetChar(i);
4122                             if ( aCh >= 'a' && aCh <= 'z' )
4123                                 aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_ALPHA + aCh-'a', 0));
4124                             else if ( aCh >= 'A' && aCh <= 'Z' )
4125                                 aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_ALPHA + aCh-'a', KEY_SHIFT));
4126                             else if ( aCh >= '0' && aCh <= '9' )
4127                                 aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_NUM + aCh-'0', 0));
4128                             else if ( aPrintableMisc.Search(aCh) != STRING_NOTFOUND )
4129                                 aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_MISC + (sal_uInt16)aPrintableMisc.Search(aCh), 0));
4130                             else    // Sollte eigentlich nicht auftreten
4131                                 aEvent = KeyEvent(aCh, KeyCode());
4132                         }
4133                         ImplKeyInput( pDeliverHere, aEvent );
4134                         if ( !MaybeDoTypeKeysDelay( pControl ) )
4135                             break;
4136                         else
4137                             SafeReschedule();SafeReschedule();SafeReschedule();
4138                     }
4139             }
4140             break;
4141 
4142 #define CalcMouseButton\
4143     sal_uInt16 nButton = MOUSE_LEFT;\
4144     if ( (nParams & PARAM_USHORT_3) )\
4145     {\
4146         switch ( nNr3 )\
4147         {\
4148             case 1: nButton = MOUSE_LEFT; break;\
4149             case 2: nButton = MOUSE_MIDDLE; break;\
4150             case 3: nButton = MOUSE_RIGHT; break;\
4151         }\
4152     }\
4153 
4154         case M_MouseDown:
4155             {
4156                 CalcMouseButton;
4157                 Size aS = pControl->GetOutputSizePixel();
4158                 Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
4159                 Window *pActualWin = pControl->FindWindow( aPos );
4160 //                  AnimateMouse( pControl, aPos );
4161 
4162                 if ( pActualWin )
4163                     aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
4164 //                  aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4165                 else
4166                     pActualWin = pControl;
4167 
4168                 AnimateMouse( pActualWin, aPos );
4169                 pActualWin->GrabFocus();
4170                 MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton);
4171                 ImplMouseButtonDown( pActualWin, aMEvnt );
4172             }
4173             break;
4174         case M_MouseUp:
4175             {
4176                 CalcMouseButton;
4177                 Size aS = pControl->GetOutputSizePixel();
4178                 Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
4179                 Window *pActualWin = pControl->FindWindow( aPos );
4180 
4181                 if ( pActualWin )
4182                     aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
4183 //                  aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4184                 else
4185                     pActualWin = pControl;
4186 
4187                 AnimateMouse( pActualWin, aPos );
4188 //                  pActualWin->GrabFocus();
4189                 MouseEvent aMEvt( aPos, 1, MOUSE_SIMPLECLICK|MOUSE_SELECT, nButton );
4190                 ImplMouseButtonUp( pActualWin, aMEvt );
4191             }
4192             break;
4193         case M_MouseMove:
4194             {
4195                 CalcMouseButton;
4196                 Size aS = pControl->GetOutputSizePixel();
4197                 Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
4198                 Window *pActualWin = pControl->FindWindow( aPos );
4199 
4200                 if ( pActualWin )
4201                 {
4202                     aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
4203 //                  aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4204                 }
4205                 else
4206                     pActualWin = pControl;
4207 
4208                 AnimateMouse( pActualWin, aPos );
4209 //                  pActualWin->GrabFocus();
4210                 MouseEvent aMEvt( aPos, 0, MOUSE_SIMPLEMOVE|MOUSE_DRAGMOVE, nButton );
4211                 ImplMouseMove( pActualWin, aMEvt );
4212             }
4213             break;
4214         case M_MouseDoubleClick:
4215             {
4216                 CalcMouseButton;
4217                 Size aS = pControl->GetOutputSizePixel();
4218                 Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
4219                 Window *pActualWin = pControl->FindWindow( aPos );
4220 
4221                 if ( pActualWin )
4222                 {
4223                     aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
4224 //                  aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4225                 }
4226                 else
4227                     pActualWin = pControl;
4228 
4229                 AnimateMouse( pActualWin, aPos );
4230                 pActualWin->GrabFocus();
4231                 MouseEvent aMEvnt;
4232                 aMEvnt = MouseEvent(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton);
4233                 ImplMouseButtonDown( pActualWin, aMEvnt );
4234                 ImplMouseButtonUp  ( pActualWin, aMEvnt );
4235                 aMEvnt = MouseEvent(aPos,2,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton);
4236                 ImplMouseButtonDown( pActualWin, aMEvnt );
4237                 ImplMouseButtonUp  ( pActualWin, aMEvnt );
4238             }
4239             break;
4240         case M_DisplayPercent:
4241             {
4242                 ModelessDialog *pDlg = new ModelessDialog(NULL);
4243                 pDlg->SetOutputSizePixel(Size(100,30));
4244 
4245                 Edit *pMyEd = new Edit(pDlg,WB_CENTER | WB_BORDER );
4246                 pMyEd->SetSizePixel(Size(100,30));
4247                 pDlg->SetText(UniString("Schlie�en", RTL_TEXTENCODING_ISO_8859_1));
4248                 pDlg->Show();
4249                 pMyEd->Show();
4250                 sal_uLong nTime = Time().GetTime();
4251 
4252                 while (pDlg->IsVisible())
4253                 {
4254                     pDlg->ToTop();
4255                     for (int i = 1 ; i<10 ; i++)
4256                         SafeReschedule();
4257                     Point Pos = pControl->GetPointerPosPixel();
4258                     Size Siz=pControl->GetOutputSizePixel();
4259                     if ( Time().GetTime() - nTime > 10 )
4260                     {
4261                         nTime = Time().GetTime();
4262                         pMyEd->SetText(UniString::CreateFromInt32(Pos.X()*100/Siz.Width()).AppendAscii("%x").Append( UniString::CreateFromInt32(Pos.Y()*100/Siz.Height()) ).Append('%'));
4263                     }
4264                 }
4265 
4266                 delete pMyEd;
4267                 delete pDlg;
4268             }
4269             break;
4270         case M_OpenContextMenu:
4271             {
4272                 aSubMenuId1 = 0;
4273                 aSubMenuId2 = 0;
4274                 aSubMenuId3 = 0;
4275                 pMenuWindow = NULL;
4276                 Point aPos;
4277                 ToolBox* pTB = (ToolBox*)pControl;
4278                 if ( (pControl->GetType() == WINDOW_TOOLBOX) && pTB->IsMenuEnabled() )
4279                 {
4280                     pTB->ExecuteCustomMenu();
4281 /*                    Rectangle aRect = pTB->GetMenubuttonRect();
4282                     AnimateMouse( pControl, aRect.Center() );
4283                     MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
4284                     ImplMouseButtonDown( pTB, aMEvnt );*/
4285                 }
4286                 else
4287                 {
4288                     sal_Bool bAtMousePos = ( nParams & PARAM_BOOL_1 ) && bBool1;
4289                     if ( bAtMousePos )
4290                     {
4291                         aPos = pControl->GetPointerPosPixel();
4292                         Window *pActualWin = pControl->FindWindow( aPos );
4293 
4294                         if ( pActualWin )
4295                         {
4296                             aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
4297     //                      aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4298                             pControl = pActualWin;
4299                         }
4300                     }
4301                     CommandEvent aEvent( aPos, COMMAND_CONTEXTMENU, bAtMousePos );
4302                     ImplCommand( pControl, aEvent );
4303                 }
4304             }
4305             break;
4306         case M_UseMenu:
4307             {
4308                 aSubMenuId1 = 0;
4309                 aSubMenuId2 = 0;
4310                 aSubMenuId3 = 0;
4311                 pMenuWindow = NULL;
4312 
4313                 while ( pControl && !( ( pControl->GetType() == WINDOW_SYSWINDOW || pControl->GetType() == WINDOW_WORKWINDOW ) && ControlOK( pControl, "" ) ) )
4314                     pControl = pControl->GET_REAL_PARENT();
4315 
4316                 if ( pControl && ((SystemWindow*)pControl)->GetMenuBar() )
4317                     pMenuWindow = ((SystemWindow*)pControl);
4318                 else
4319                     ReportError( GEN_RES_STR1( S_NO_MENU, MethodString( nMethodId ) ) );
4320             }
4321             break;
4322         case M_FadeIn:
4323         case M_FadeOut:
4324         case M_Pin:
4325         case M_IsFadeIn:
4326         case M_IsPin:
4327             {
4328                 WindowAlign aWindowAlign = WINDOWALIGN_LEFT;
4329                 if ( (nParams & PARAM_USHORT_1) )
4330                 {
4331                     switch ( nNr1 )
4332                     {
4333                         case CONST_ALIGN_LEFT:
4334                             aWindowAlign = WINDOWALIGN_LEFT;
4335                             break;
4336                         case CONST_ALIGN_TOP:
4337                             aWindowAlign = WINDOWALIGN_TOP;
4338                             break;
4339                         case CONST_ALIGN_RIGHT:
4340                             aWindowAlign = WINDOWALIGN_RIGHT;
4341                             break;
4342                         case CONST_ALIGN_BOTTOM:
4343                             aWindowAlign = WINDOWALIGN_BOTTOM;
4344                             break;
4345                         default:
4346                             ReportError( aUId, GEN_RES_STR1( S_INVALID_POSITION, MethodString( nMethodId ) ) );
4347                     }
4348                 }
4349 
4350                 Window* pTemp = NULL;
4351                 while ( !pTemp && pControl )
4352                 {
4353                     pTemp = GetFadeSplitWin( pControl, aWindowAlign );
4354                     pControl = pControl->GET_REAL_PARENT();
4355                 }
4356 
4357                 if ( !pTemp )
4358                 {
4359                     ReportError( aUId, GEN_RES_STR1( S_SPLITWIN_NOT_FOUND, MethodString( nMethodId ) ) );
4360                     break;
4361                 }
4362 
4363                 pControl = pTemp;   // So da� wir unten ohne Fehler durchkommen
4364                 SplitWindow *pSW = (SplitWindow*) pTemp;
4365 
4366 //  Rectangle           GetAutoHideRect() const;
4367 //  Rectangle           GetFadeInRect() const;
4368 //  Rectangle           GetFadeOutRect() const;
4369 
4370                 switch( nMethodId )
4371                 {
4372                     case M_FadeIn:
4373                         if ( pSW->IsFadeInButtonVisible() )
4374                             pSW->FadeIn();
4375                         break;
4376                     case M_FadeOut:
4377                         if ( pSW->IsFadeOutButtonVisible() )
4378                             pSW->FadeOut();
4379                         break;
4380                     case M_Pin:
4381                         if (   ( pSW->GetAutoHideState() && bBool1 )
4382                             || ( !pSW->GetAutoHideState() && !bBool1 ) )
4383                         {
4384                             MouseEvent aMEvnt;
4385                             Point aPt( pSW->GetAutoHideRect().Center() );
4386                             aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT );
4387                             ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL );
4388                             ImplMouseButtonUp  ( pControl, aMEvnt, FORCE_DIRECT_CALL );
4389                         }
4390 //                              pSW->AutoHide();
4391                         break;
4392                     case M_IsFadeIn:
4393                         pRet->GenReturn ( RET_Value, aUId, pSW->IsFadeOutButtonVisible() );
4394                         break;
4395                     case M_IsPin:
4396                         pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)!pSW->GetAutoHideState() );
4397                         break;
4398                     default:
4399                         ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
4400                 }
4401                 SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) );
4402             }
4403             break;
4404         case M_StatusGetText:
4405         case M_StatusIsProgress:
4406         case M_StatusGetItemCount:
4407         case M_StatusGetItemId:
4408             {
4409                 StatusBar *pStatus = NULL;
4410                 while ( !pStatus && pControl )
4411                 {
4412                     pStatus = (StatusBar*)GetWinByRT( pControl, WINDOW_STATUSBAR, sal_True );
4413                     pControl = pControl->GET_REAL_PARENT();
4414                 }
4415 
4416                 if ( !pStatus )
4417                 {
4418                     ReportError( aUId, GEN_RES_STR1( S_NO_STATUSBAR, MethodString( nMethodId ) ) );
4419                     break;
4420                 }
4421 
4422                 switch ( nMethodId )
4423                 {
4424                     case M_StatusGetText:
4425                         {
4426                             if ( (nParams & PARAM_USHORT_1) )
4427                             {
4428                                 if ( pStatus->AreItemsVisible() )
4429                                     pRet->GenReturn ( RET_Value, aUId, String(pStatus->GetItemText(nNr1)));
4430                                 else
4431                                     ReportError( aUId, GEN_RES_STR1( S_ITEMS_INVISIBLE, MethodString( nMethodId ) ) );
4432                             }
4433                             else
4434                             {
4435                                 if ( pStatus->AreItemsVisible() )
4436                                 {
4437                                     if ( pStatus->GetItemCount() == 1 )
4438                                     {
4439                                         pRet->GenReturn ( RET_Value, aUId, pStatus->GetItemText( pStatus->GetItemId(0) ));
4440                                     }
4441                                     else
4442                                     {
4443                                         pRet->GenReturn ( RET_Value, aUId, String() );
4444                                     }
4445                                 }
4446                                 else
4447                                     pRet->GenReturn ( RET_Value, aUId, (String)pStatus->GetText() );
4448                             }
4449                         }
4450                         break;
4451                     case M_StatusIsProgress:
4452                         {
4453                             pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)pStatus->IsProgressMode() );
4454                         }
4455                         break;
4456                     case M_StatusGetItemCount:
4457                         if ( pStatus->AreItemsVisible() )
4458                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(pStatus->GetItemCount()));
4459                         else
4460                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(0));
4461                         break;
4462                     case M_StatusGetItemId:
4463                         if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pStatus->GetItemCount()) )
4464                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(pStatus->GetItemId(nNr1-1)));
4465                         break;
4466                 }
4467             }
4468             break;
4469         case M_HasScrollBar:
4470         case M_IsScrollBarEnabled:
4471             {
4472                 if ( (nParams | PARAM_USHORT_1) != PARAM_USHORT_1 )     // so there are other params
4473                 {
4474                     ReportError( aUId, GEN_RES_STR0( S_INVALID_PARAMETERS ) );
4475                     break;
4476                 }
4477 
4478                 if( !(nParams & PARAM_USHORT_1) )
4479                     nNr1 = CONST_ALIGN_RIGHT;       // default is right Scrollbar(vertical)
4480 
4481                 if ( (nNr1 != CONST_ALIGN_RIGHT) && (nNr1 != CONST_ALIGN_BOTTOM) )
4482                 {
4483                     ReportError( aUId, GEN_RES_STR1( S_INVALID_POSITION, MethodString( nMethodId ) ) );
4484                     break;
4485                 }
4486 
4487                 ScrollBar *pScroll = NULL;
4488 
4489                 sal_uInt16 nSteps = 2;
4490                 while ( !pScroll && pControl && nSteps-- )
4491                 {
4492                     pScroll = GetScrollBar( pControl, nNr1, sal_True );
4493                     pControl = pControl->GET_REAL_PARENT();
4494                 }
4495 
4496                 switch ( nMethodId )
4497                 {
4498                     case M_HasScrollBar:
4499                         {
4500                             if ( pScroll )
4501                                 pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_True );
4502                             else
4503                                 pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_False );
4504                         }
4505                         break;
4506                     case M_IsScrollBarEnabled:
4507                         {
4508                             if ( !pScroll )
4509                             {
4510                                 ReportError( aUId, GEN_RES_STR1( S_NO_SCROLLBAR, MethodString( nMethodId ) ) );
4511                                 break;
4512                             }
4513                             pRet->GenReturn ( RET_Value, aUId, pScroll->IsEnabled() );
4514                         }
4515                         break;
4516                 }
4517             }
4518             break;
4519         default:
4520             return sal_False;
4521     }
4522     return sal_True;
4523 }
4524 
4525 
4526 sal_Bool StatementControl::Execute()
4527 {
4528     Window *pControl;
4529     sal_Bool bStatementDone = sal_True;
4530 
4531 
4532     if ( IsError )
4533     {
4534         #if OSL_DEBUG_LEVEL > 1
4535         m_pDbgWin->AddText( "Skipping Window: " );
4536         m_pDbgWin->AddText( Id2Str( aUId ) );
4537         m_pDbgWin->AddText( " Method: " );
4538         m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
4539         m_pDbgWin->AddText( "\n" );
4540         #endif
4541         Advance();
4542         delete this;
4543         return sal_True;
4544     }
4545 
4546     InitProfile();
4547 #if OSL_DEBUG_LEVEL > 1
4548     m_pDbgWin->AddText( "Executing Window: " );
4549     m_pDbgWin->AddText( Id2Str( aUId ) );
4550     m_pDbgWin->AddText( " Method: " );
4551     m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
4552     m_pDbgWin->AddText( "\n" );
4553 #endif
4554 
4555 
4556     if ( aUId.equals( UID_ACTIVE ) )
4557         pControl = GetAnyActive();
4558     else
4559     {
4560         sal_Bool bSearchButtonOnToolbox = (nParams == PARAM_NONE) && ((M_Click == nMethodId) || (M_TearOff == nMethodId) || (M_IsEnabled == nMethodId) || (M_OpenMenu == nMethodId));
4561         bSearchButtonOnToolbox |= (nParams == PARAM_USHORT_1) && (M_GetState == nMethodId);
4562         if ( nMethodId == M_TypeKeys || nMethodId == M_MouseDown
4563             || nMethodId == M_MouseUp || nMethodId ==  M_MouseMove
4564             || nMethodId == M_SnapShot )
4565         {
4566             pControl = NULL;
4567             if ( /*(nMethodId == M_SnapShot || nMethodId == M_TypeKeys) &&*/ !pControl )
4568                 pControl = SearchTree( aUId ,bSearchButtonOnToolbox );
4569         }
4570         else
4571             pControl = SearchTree( aUId ,bSearchButtonOnToolbox );
4572     }
4573 
4574 
4575     if ( pControl && pControl->GetType() == WINDOW_TOOLBOX )
4576     {
4577         if ( !aUId.equals( pControl->GetUniqueOrHelpId() ) )
4578         {   // Also wenn wir irgendwas auf einer Toolbox gefunden haben
4579             switch ( nMethodId )
4580             {
4581                 case M_Click:
4582                 case M_TearOff:
4583                 case M_OpenMenu:
4584                 case M_GetState:
4585                     break;
4586                 case M_IsEnabled:
4587                     nMethodId = _M_IsEnabled;   // Umlabeln, da die Behandlung essentiell anders ist!
4588                     break;
4589                 default:
4590                     pControl = NULL;
4591             }
4592         }
4593     }
4594 
4595 
4596     switch ( nMethodId )
4597     {
4598         case M_Exists:
4599         case M_NotExists:
4600             Time aT;
4601             sal_uInt16 aSeconds = aT.GetMin()*60+aT.GetSec();
4602             if ( !bBool2 )          // wurde im Konstruktor auf sal_False gesetzt
4603             {
4604                 bBool2 = sal_True;
4605                 nNr2 = aSeconds;
4606                 if( !(nParams & PARAM_USHORT_1) )
4607                     nNr1 = 0;       // defaultm��ig sofort zur�ck
4608             }
4609             if ( aSeconds < nNr2 )          // Falls die Stunde umgesprungen ist
4610                 aSeconds += 60*60;
4611 
4612             if ( /* !IsAccessable(pControl)#87019# */ !pControl || !pControl->IsVisible() )
4613                 pControl = NULL;
4614             if ( ((nMethodId == M_Exists) && pControl) ||
4615                  ((nMethodId == M_NotExists) && !pControl) )
4616             {   // Wenn Bedingung erf�llt
4617                 pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_True );
4618             }
4619             else
4620                 if ( aSeconds <= nNr2 + nNr1 )      // Zeit ist noch nicht abgelaufen
4621                     return sal_False;
4622                 else
4623                     pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_False );
4624 
4625             Advance();
4626             delete this;
4627             return sal_True;
4628 //          break;
4629     }
4630 
4631 
4632     short nRT = 0;
4633 
4634     if( pControl )          // Das Fenster Existiert irgendwo, kann aber auch hidden sein!
4635     {
4636         nRT = ImpGetRType( pControl );
4637 #if OSL_DEBUG_LEVEL > 1
4638         m_pDbgWin->AddText( "Type is: " );
4639         m_pDbgWin->AddText( String::CreateFromInt32( nRT ) );
4640         m_pDbgWin->AddText( "\n" );
4641 #endif
4642     }
4643 
4644     if (   nRT == C_Window &&       // Search for WorkWindow to satisfy these commands
4645          ( nMethodId == M_Close
4646 //      || nMethodId == M_Size
4647 //      || nMethodId == M_Move
4648         || nMethodId == M_IsMax
4649         || nMethodId == M_IsMin
4650         || nMethodId == M_IsRestore
4651         || nMethodId == M_Minimize
4652         || nMethodId == M_Maximize
4653         || nMethodId == M_Restore ) )
4654     {
4655         Window* pNewControl = pControl;
4656         while ( pNewControl && pNewControl->GetType() != WINDOW_WORKWINDOW )
4657             pNewControl = pNewControl->GET_REAL_PARENT();
4658 
4659         if ( pNewControl )
4660         {
4661             pControl = pNewControl;
4662             nRT = C_WorkWin;
4663         }
4664     }
4665 
4666 
4667     if ( (!ControlOK( pControl, "" )) && ( nMethodId != M_SnapShot ) && (nRetryCount--))
4668     {
4669 #if OSL_DEBUG_LEVEL > 1
4670         m_pDbgWin->AddText( CUniString("Reschedule command (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") );
4671 #endif
4672         return sal_False;
4673     }
4674 
4675     if( ControlOK( pControl, "" ) )
4676     {
4677         if ( nMethodId == M_OpenContextMenu && !bBool2 )
4678         {
4679             pControl->GrabFocus();  // to get asyncron focus on unix
4680             bBool2 = sal_True;
4681             return sal_False;
4682         }
4683         // TODO: handle GetFocus for all Methods and Windows like this (remove part below)
4684         //       See for impact of changed focus for HandleVisibleControls() (taking Snapshots might be different, possible exclude those methods)
4685         if (( (nRT == C_TreeListBox) && !bBool2 )
4686             && nMethodId != M_TypeKeys          // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht
4687             && nMethodId != M_MouseDown
4688             && nMethodId != M_MouseUp
4689             && nMethodId != M_MouseMove
4690             /*&& nMethodId != M_MouseDoubleClick*/ )
4691         {
4692             if ( !pControl->HasFocus() )
4693             {
4694                 pControl->GrabFocus();
4695                 int i = 10;
4696                 while ( i-- && !pControl->HasFocus() )    // reschedule a bit
4697                 {
4698                     SafeReschedule();
4699                     if ( !WinPtrValid( pControl ) )
4700                         return sal_False;
4701                 }
4702                 if ( !pControl->HasFocus() )  // to get asyncronous focus
4703                 {
4704                     bBool2 = sal_True;
4705                     return sal_False;
4706                 }
4707             }
4708         }
4709     }
4710 
4711     Advance();
4712 
4713     if ( HandleVisibleControls( pControl ) )
4714     {
4715         delete this;
4716         return sal_True;
4717     }
4718     if( ControlOK( pControl, "Window/Control" ) )
4719     {
4720         if (((( nRT < C_TabPage && nRT > C_TabControl )
4721               || nRT == C_PatternBox
4722               || nRT == C_ToolBox
4723               || nRT == C_ValueSet
4724               || nRT == C_Control
4725               || nRT == C_TreeListBox
4726              )
4727             || nMethodId == M_OpenContextMenu )
4728             && nMethodId != M_TypeKeys          // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht
4729             && nMethodId != M_MouseDown
4730             && nMethodId != M_MouseUp
4731             && nMethodId != M_MouseMove
4732             /*&& nMethodId != M_MouseDoubleClick*/ )
4733             pControl->GrabFocus();
4734 
4735 /*  leads to problems because settext sets the text whereas typekeys adds to the text.
4736         if ( bDoTypeKeysDelay && nMethodId == M_SetText && ( nParams & PARAM_STR_1 ) )
4737         {   // Hier wird das Statement auf ein TypeKeys umgebogen
4738             nMethodId = M_TypeKeys;
4739             nParams = PARAM_BOOL_1 | PARAM_STR_1;
4740             bBool1 = sal_True;
4741             pControl->GrabFocus();
4742         }
4743 */
4744         if ( !HandleCommonMethods( pControl ) )
4745         {
4746             switch( nRT )
4747             {
4748                 case C_TabControl:
4749                     switch( nMethodId )
4750                     {
4751                         case M_GetPageId:
4752                             if ( (nParams & PARAM_USHORT_1) )
4753                             {
4754                                 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((TabControl*)pControl)->GetPageCount() ) )
4755                                     pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)((TabControl*)pControl)->GetPageId(nNr1-1));
4756                             }
4757                             else
4758                                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)((TabControl*)pControl)->GetCurPageId());
4759                             break;
4760                         case M_GetPageCount:
4761                             pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)((TabControl*)pControl)->GetPageCount());
4762                             break;
4763                         case M_SetPageId:
4764                             if (((TabControl*)pControl)->GetCurPageId())
4765                                 ((TabControl*)pControl)->DeactivatePage();
4766                             ((TabControl*)pControl)->SetCurPageId( nNr1 );
4767                             ((TabControl*)pControl)->ActivatePage();
4768                             break;
4769                         case M_SetPageNr:
4770                             if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((TabControl*)pControl)->GetPageCount() ) )
4771                             {
4772                                 if (((TabControl*)pControl)->GetCurPageId())
4773                                     ((TabControl*)pControl)->DeactivatePage();
4774                                 ((TabControl*)pControl)->SetCurPageId( ((TabControl*)pControl)->GetPageId( nNr1-1 ) );
4775                                 ((TabControl*)pControl)->ActivatePage();
4776                             }
4777                             break;
4778                         case M_GetPage:
4779                             pRet->GenReturn ( RET_Value, aUId, Id2Str( ((TabControl*)pControl)->GetTabPage(((TabControl*)pControl)->GetCurPageId())->GetUniqueOrHelpId() ) );
4780                             break;
4781                         case M_SetPage :
4782                             {       // Wegen lokaler Variablen
4783                                 TabControl *pTControl = ((TabControl*)pControl);
4784                                 sal_uInt16 nActive = pTControl->GetCurPageId();
4785                                 sal_uInt16 i,anz;
4786                                 rtl::OString aID;
4787                                 rtl::OString aWantedID;
4788                                 //HELPID BACKWARD (No numbers please (remove PARAM_ULONG_1 part)
4789                                 if ( (nParams & PARAM_ULONG_1) )
4790                                 {
4791                                     //aWantedID = rtl::OString( nLNr1 );
4792                                     ReportError( aUId, GEN_RES_STR1c( S_INTERNAL_ERROR, "using numeric HelpID from old Testtool" ) );
4793                                 }
4794                                 else if ( (nParams & PARAM_STR_1) )
4795                                 {
4796                                     aWantedID = Str2Id( aString1 );
4797                                 }
4798                                 else
4799                                     ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
4800 
4801                                 i = pTControl->GetPagePos( pTControl->GetCurPageId() );
4802                                 for ( anz=0 ; anz < pTControl->GetPageCount() && !aID.equals( aWantedID ) ; anz++ )
4803                                 {
4804                                     pTControl->SelectTabPage( pTControl->GetPageId(i) );
4805                                     /*if (pTControl->GetCurPageId())
4806                                         pTControl->DeactivatePage();
4807                                     pTControl->SetCurPageId( pTControl->GetPageId(i) );
4808                                     pTControl->ActivatePage();*/
4809                                     aID = pTControl->GetTabPage(pTControl->GetCurPageId())->GetUniqueOrHelpId();
4810                                     i++;
4811                                     if ( i >= pTControl->GetPageCount() )
4812                                         i = 0;
4813                                     if ( !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) )   // 3 Mal aufrufen
4814                                         break;
4815                                 }
4816                                 if ( !aID.equals( aWantedID ) )
4817                                 {
4818                                     pTControl->SelectTabPage( nActive );
4819                                     /*if (pTControl->GetCurPageId())
4820                                         pTControl->DeactivatePage();
4821                                     pTControl->SetCurPageId( nActive );
4822                                     pTControl->ActivatePage();*/
4823                                     ReportError( aWantedID, GEN_RES_STR1( S_TABPAGE_NOT_FOUND, MethodString( nMethodId ) ) );
4824                                 }
4825                             }
4826                             break;
4827                         default:
4828                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TabControl" ) );
4829                             break;
4830                     }
4831                     break;
4832                 case C_RadioButton:
4833                 case C_ImageRadioButton:
4834                     switch( nMethodId )
4835                     {
4836                         case M_AnimateMouse :
4837                             AnimateMouse( pControl, MitteLinks);
4838                             break;
4839                         case M_IsChecked :
4840                             pRet->GenReturn ( RET_Value, aUId, ((RadioButton*)pControl)->IsChecked());
4841                             break;
4842                         case M_Check :
4843                             ((RadioButton*)pControl)->Check();
4844                             ((RadioButton*)pControl)->Click();
4845                             break;
4846                         default:
4847                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RadioButton" ) );
4848                             break;
4849                     }
4850                     break;
4851                 case C_CheckBox:
4852                 case C_TriStateBox:
4853                     switch( nMethodId )
4854                     {
4855                         case M_AnimateMouse :
4856                             AnimateMouse( pControl, MitteLinks);
4857                             break;
4858                         case M_IsChecked :
4859                             pRet->GenReturn ( RET_Value, aUId, comm_BOOL( ((TriStateBox*)pControl)->GetState() == STATE_CHECK) );
4860                             break;
4861                         case M_IsTristate :
4862                             pRet->GenReturn ( RET_Value, aUId, comm_BOOL( ((TriStateBox*)pControl)->GetState() == STATE_DONTKNOW) );
4863                             break;
4864                         case M_GetState :
4865                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((TriStateBox*)pControl)->GetState()));
4866                             break;
4867                         case M_Check :
4868                             ((TriStateBox*)pControl)->SetState( STATE_CHECK );
4869                             ((TriStateBox*)pControl)->Click();
4870                             break;
4871                         case M_UnCheck :
4872                             ((TriStateBox*)pControl)->SetState( STATE_NOCHECK );
4873                             ((TriStateBox*)pControl)->Click();
4874                             break;
4875                         case M_TriState :
4876                             if ( ((TriStateBox*)pControl)->IsTriStateEnabled() )
4877                             {
4878                                 ((TriStateBox*)pControl)->SetState( STATE_DONTKNOW );
4879                                 ((TriStateBox*)pControl)->Click();
4880                             }
4881                             else
4882                             {
4883                                 ReportError( aUId, GEN_RES_STR0( S_TRISTATE_NOT_ALLOWED ) );
4884                             }
4885                             break;
4886                         case M_Click :
4887                             {
4888                                 TriStateBox *pTB = ((TriStateBox*)pControl);
4889                                 if ( pTB->GetState() == STATE_NOCHECK )
4890                                     pTB->SetState( STATE_CHECK );
4891                                 else if ( pTB->GetState() == STATE_CHECK )
4892                                 {
4893                                     if ( pTB->IsTriStateEnabled() )
4894                                         pTB->SetState( STATE_DONTKNOW );
4895                                     else
4896                                         pTB->SetState( STATE_NOCHECK );
4897                                 }
4898                                 else
4899                                     pTB->SetState( STATE_NOCHECK );
4900                                 pTB->Click();
4901                                 }
4902                             break;
4903                         default:
4904                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TriStateBox" ) );
4905                             break;
4906                     }
4907                     break;
4908                 case C_Edit:
4909                 case C_MultiLineEdit:
4910                     switch( nMethodId )
4911                     {
4912                         case M_AnimateMouse :
4913                             AnimateMouse( pControl, Mitte);
4914                             break;
4915                         case M_GetText :
4916                             pRet->GenReturn ( RET_Value, aUId, ((Edit*)pControl)->GetText());
4917                             break;
4918                         case M_IsWritable:
4919                             pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((Edit*)pControl)->IsReadOnly() );
4920                             break;
4921                         default:
4922                             if ( ! ((Edit*)pControl)->IsReadOnly() )
4923                             {
4924                                 switch( nMethodId )
4925                                 {
4926                                     case M_SetText :
4927                                         ((Edit*)pControl)->SetText( aString1 );
4928                                         if ( nRT == C_MultiLineEdit )   // since SetModifyFlag is not virtual we have to do this
4929                                             ((MultiLineEdit*)pControl)->SetModifyFlag();
4930                                         else
4931                                             ((Edit*)pControl)->SetModifyFlag();
4932                                         ((Edit*)pControl)->Modify();
4933                                         if ( ((Edit*)pControl)->GetText().CompareTo(aString1) != COMPARE_EQUAL )
4934                                             ReportError( aUId, GEN_RES_STR1( S_ERROR_IN_SET_TEXT, MethodString( nMethodId ) ) );
4935                                         break;
4936                                     default:
4937                                         ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "(MultiLine)Edit" ) );
4938                                         break;
4939                                 }
4940                             }
4941                             else
4942                                 ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "(MultiLine)Edit" ) );
4943                     }
4944                     break;
4945                 case C_MultiListBox:
4946                 case C_ListBox:
4947                     switch( nMethodId )
4948                     {
4949                         case M_AnimateMouse :
4950                             AnimateMouse( pControl, MitteOben);
4951                             break;
4952                         case M_GetSelCount :
4953                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((ListBox*)pControl)->GetSelectEntryCount()));
4954                             break;
4955                         case M_GetSelIndex :
4956                             if ( ! (nParams & PARAM_USHORT_1) )
4957                             {
4958                                 if ( ((ListBox*)pControl)->GetSelectEntryCount() == 0 )
4959                                 {
4960                                     pRet->GenReturn ( RET_Value, aUId, comm_ULONG(0));
4961                                     break;
4962                                 }
4963                                 nNr1 = 1;
4964                             }
4965                             ValueOK(aUId, MethodString( nMethodId ),nNr1,((ListBox*)pControl)->GetSelectEntryCount());
4966                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((ListBox*)pControl)->GetSelectEntryPos(nNr1-1)) +1);
4967                             break;
4968                         case M_GetSelText :
4969                             if ( ! (nParams & PARAM_USHORT_1) )
4970                                 nNr1 = 1;
4971                             pRet->GenReturn ( RET_Value, aUId, ((ListBox*)pControl)->GetSelectEntry(nNr1-1));
4972                             break;
4973                         case M_GetItemCount :
4974                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((ListBox*)pControl)->GetEntryCount()));
4975                             break;
4976                         case M_GetItemText :
4977                             pRet->GenReturn ( RET_Value, aUId, ((ListBox*)pControl)->GetEntry(nNr1-1));
4978                             break;
4979                         case M_Select:
4980                         case M_MultiSelect:
4981                             {
4982                                 sal_Bool bUnselectBeforeSelect = ( nMethodId == M_Select );
4983                                 sal_Bool bFehler = sal_False;
4984                                 if ( ! (nParams & PARAM_BOOL_1) )
4985                                     bBool1 = sal_True;
4986 
4987                                 if ( nMethodId == M_MultiSelect && nRT == C_ListBox )
4988                                 {
4989                                     ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ListBox" ) );
4990                                     bFehler = sal_True;
4991                                 }
4992 
4993                                 if ( !bBool1 && nMethodId == M_Select )
4994                                 {
4995                                     ReportError( aUId, GEN_RES_STR1( S_NO_SELECT_FALSE, MethodString( nMethodId ) ) );
4996                                     bFehler = sal_True;
4997                                 }
4998 
4999                                 if ( !bFehler )
5000                                 {
5001                                     if( nParams & PARAM_STR_1 )
5002                                     {
5003                                         ListBox *pLB = ((ListBox*)pControl);
5004                                         sal_uInt16 nPos;
5005                                         if ( (nPos = pLB->GetEntryPos( aString1 )) == LISTBOX_ENTRY_NOTFOUND )
5006                                             ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
5007                                         else
5008                                         {
5009                                             if ( bUnselectBeforeSelect )
5010                                                 pLB->SetNoSelection();
5011                                             pLB->SelectEntryPos( nPos, bBool1 );
5012                                             if ( pLB->IsEntryPosSelected( nPos ) ? !bBool1 : bBool1 )   // XOR rein mit BOOL
5013                                                 ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) );
5014                                         }
5015                                     }
5016                                     else
5017                                     {
5018                                         ListBox *pLB = ((ListBox*)pControl);
5019                                         pLB = static_cast<ListBox*>(pControl);
5020                                         if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pLB->GetEntryCount()) )
5021                                         {
5022                                             if ( bUnselectBeforeSelect )
5023                                                 pLB->SetNoSelection();
5024                                             pLB->SelectEntryPos( nNr1-1, bBool1 );
5025                                             if ( pLB->IsEntryPosSelected( nNr1-1 ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL
5026                                                 ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), UniString::CreateFromInt32( nNr1 ) ) );
5027                                         }
5028                                     }
5029                                     ((ListBox*)pControl)->Select();
5030                                 }
5031                             }
5032                             break;
5033                         case M_SetNoSelection :
5034                             ((ListBox*)pControl)->SetNoSelection();
5035                             ((ListBox*)pControl)->Select();
5036                             break;
5037                         default:
5038                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "(Multi)ListBox" ) );
5039                             break;
5040                     }
5041                     break;
5042                 case C_ComboBox:
5043                 case C_PatternBox:
5044                 case C_NumericBox:
5045                 case C_MetricBox:
5046                 case C_CurrencyBox:
5047                 case C_DateBox:
5048                 case C_TimeBox:
5049                     switch( nMethodId )
5050                     {
5051                         case M_AnimateMouse :
5052                             AnimateMouse( pControl, MitteOben);
5053                             break;
5054                         case M_GetSelText :
5055                             pRet->GenReturn ( RET_Value, aUId, ((ComboBox*)pControl)->GetText());
5056                             break;
5057                         case M_GetSelIndex :
5058                             {
5059                                 sal_uInt16 nPos = ((ComboBox*)pControl)->GetEntryPos(((ComboBox*)pControl)->GetText());
5060                                 if ( nPos == COMBOBOX_ENTRY_NOTFOUND )
5061                                     nPos = 0;
5062                                 else
5063                                     nPos++;
5064                                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG) nPos);
5065                             }
5066                             break;
5067                         case M_GetItemCount :
5068                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((ComboBox*)pControl)->GetEntryCount()));
5069                             break;
5070                         case M_GetItemText :
5071                             pRet->GenReturn ( RET_Value, aUId, ((ComboBox*)pControl)->GetEntry(nNr1-1));
5072                             break;
5073                         case M_IsWritable:
5074                             pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((ComboBox*)pControl)->IsReadOnly() );
5075                             break;
5076                         case M_Select :
5077                             if( nParams & PARAM_USHORT_1 )
5078                             {
5079                                 if ( !ValueOK(aUId, MethodString( nMethodId ),nNr1,((ComboBox*)pControl)->GetEntryCount()) )
5080                                     break;
5081                                 aString1 = ((ComboBox*)pControl)->GetEntry(nNr1-1);
5082                             }
5083                             else
5084                             {
5085                                 if ( ((ComboBox*)pControl)->GetEntryPos( aString1 ) == COMBOBOX_ENTRY_NOTFOUND )
5086                                 {
5087                                     ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
5088                                     break;
5089                                 }
5090                             }
5091 
5092 
5093                             ((ComboBox*)pControl)->SetText( aString1 );
5094                             ((ComboBox*)pControl)->SetModifyFlag();
5095                             ((ComboBox*)pControl)->Modify();
5096                             break;
5097                         case M_SetText :
5098                             if ( ! ((ComboBox*)pControl)->IsReadOnly() )
5099                             {
5100                                 if ( ! (nParams & PARAM_STR_1) )
5101                                     aString1 = String();
5102                                 ((ComboBox*)pControl)->SetText( aString1 );
5103                                 ((ComboBox*)pControl)->SetModifyFlag();
5104                                 ((ComboBox*)pControl)->Modify();
5105                             }
5106                             else
5107                                 ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "ComboBox" ) );
5108                             break;
5109                         default:
5110                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ComboBox" ) );
5111                             break;
5112                     }
5113                     break;
5114                 case C_PushButton:
5115                 case C_OkButton:
5116                 case C_CancelButton:
5117                 case C_ImageButton:
5118                     switch( nMethodId )
5119                     {
5120                         case M_AnimateMouse :
5121                             AnimateMouse( pControl, Mitte);
5122                             break;
5123                         case M_Click :
5124                             ((PushButton*)pControl)->Click();
5125                             break;
5126                         default:
5127                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "PushButton" ) );
5128                             break;
5129                     }
5130                     break;
5131                 case C_MoreButton:
5132                     switch( nMethodId )
5133                     {
5134                         case M_AnimateMouse :
5135                             AnimateMouse( pControl, Mitte);
5136                             break;
5137                         case M_IsOpen :
5138                             pRet->GenReturn ( RET_Value, aUId, ((MoreButton*)pControl)->GetState());
5139                             break;
5140                         case M_Click :
5141                             ((MoreButton*)pControl)->Click();
5142                             break;
5143                         case M_Open :
5144                             ((MoreButton*)pControl)->SetState(sal_True);
5145                             break;
5146                         case M_Close :
5147                             ((MoreButton*)pControl)->SetState(sal_False);
5148                             break;
5149                         default:
5150                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MoreButton" ) );
5151                             break;
5152                     }
5153                     break;
5154                 case C_SpinField:
5155                 case C_PatternField:
5156                 case C_NumericField:
5157                 case C_MetricField:
5158                 case C_CurrencyField:
5159                 case C_DateField:
5160                 case C_TimeField:
5161                     switch( nMethodId )
5162                     {
5163                         case M_AnimateMouse :
5164                             AnimateMouse( pControl, Mitte);
5165                             break;
5166                         case M_GetText :
5167                             pRet->GenReturn ( RET_Value, aUId, ((SpinField*)pControl)->GetText());
5168                             break;
5169                         case M_IsWritable:
5170                             pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((SpinField*)pControl)->IsReadOnly() );
5171                             break;
5172                         case M_SetText :
5173                             if ( ! ((SpinField*)pControl)->IsReadOnly() )
5174                             {
5175                                 ((SpinField*)pControl)->SetText( aString1 );
5176                                 ((SpinField*)pControl)->SetModifyFlag();
5177                                 ((SpinField*)pControl)->Modify();
5178                             }
5179                             else
5180                                 ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "SpinField" ) );
5181                             break;
5182                         case M_More :
5183                             {
5184                                 if ( !(nParams & PARAM_USHORT_1) )
5185                                     nNr1 = 1;
5186                                 for (int i = 1; i<= nNr1; i++)
5187                                 {
5188                                     ((SpinField*)pControl)->Up();
5189                                     ((SpinField*)pControl)->SetModifyFlag();
5190                                     ((SpinField*)pControl)->Modify();
5191                                 }
5192                             }
5193                             break;
5194                         case M_Less :
5195                             {
5196                                 if ( !(nParams & PARAM_USHORT_1) )
5197                                     nNr1 = 1;
5198                                 for (int i = 1; i<= nNr1; i++)
5199                                 {
5200                                     ((SpinField*)pControl)->Down();
5201                                     ((SpinField*)pControl)->SetModifyFlag();
5202                                     ((SpinField*)pControl)->Modify();
5203                                 }
5204                             }
5205                             break;
5206                         case M_ToMin :
5207                             ((SpinField*)pControl)->First();
5208                             ((SpinField*)pControl)->SetModifyFlag();
5209                             ((SpinField*)pControl)->Modify();
5210                             break;
5211                         case M_ToMax :
5212                             ((SpinField*)pControl)->Last();
5213                             ((SpinField*)pControl)->SetModifyFlag();
5214                             ((SpinField*)pControl)->Modify();
5215                             break;
5216                         default:
5217                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "SpinField" ) );
5218                             break;
5219                     }
5220                     break;
5221 
5222                 case C_MenuButton:
5223                         switch( nMethodId )
5224                         {
5225                         case M_AnimateMouse :
5226                             AnimateMouse( pControl, Mitte);
5227                             break;
5228                         case M_Click :
5229                             {
5230                                 MouseEvent aMEvnt;
5231                                 Point aPt( pControl->GetSizePixel().Width() / 2, pControl->GetSizePixel().Height() / 2 );
5232                                 aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT );
5233                                 ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL );
5234                                 ImplMouseButtonUp  ( pControl, aMEvnt, FORCE_DIRECT_CALL );
5235                             }
5236                             break;
5237                         case M_Open :
5238                         case M_OpenMenu :
5239                             {
5240                                 MouseEvent aMEvnt;
5241                                 Point aPt( pControl->GetSizePixel().Width() / 2, pControl->GetSizePixel().Height() / 2 );
5242                                 aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT );
5243                                 ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL );
5244 
5245                                 sal_uLong nStart = Time::GetSystemTicks();
5246                                 sal_uLong nDelay = pControl->GetSettings().GetMouseSettings().GetActionDelay();
5247                                 while ( ( Time::GetSystemTicks() - nStart ) < nDelay + 100 )
5248                                     SafeReschedule();
5249 
5250                                 ImplMouseButtonUp  ( pControl, aMEvnt, FORCE_DIRECT_CALL );
5251 
5252                                 aSubMenuId1 = 0;
5253                                 aSubMenuId2 = 0;
5254                                 aSubMenuId3 = 0;
5255                                 pMenuWindow = NULL;
5256                             }
5257                             break;
5258                         default:
5259                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MenuButton" ) );
5260                             break;
5261                     }
5262                     break;
5263                 case C_ToolBox:
5264                     {
5265                         ToolBox *pTB = ((ToolBox*)pControl);
5266                         if ( !aUId.equals( pTB->GetUniqueOrHelpId() ) ) // So we found a Button on the ToolBox
5267                         {
5268                             if ( (nParams == PARAM_NONE) || (nParams == PARAM_USHORT_1) )
5269                             {           // Wir f�lschen einen Parameter
5270                                 nParams |= PARAM_STR_1;
5271                                 aString1 = Id2Str( aUId );
5272                             }
5273                             else
5274                                 ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
5275                         }
5276 
5277 #define FIND_ITEM\
5278     sal_uInt16 nItemPos = 0;\
5279     sal_Bool bItemFound = sal_False;\
5280     {\
5281         rtl::OString aButtonId;\
5282         if( nParams & PARAM_STR_1 )\
5283             aButtonId = Str2Id( aString1 );\
5284         else\
5285             ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );\
5286         for ( nItemPos = 0; nItemPos < pTB->GetItemCount() && !aButtonId.equals(Str2Id( pTB->GetItemCommand(pTB->GetItemId(nItemPos)) )) &&\
5287                                                       !aButtonId.equals(pTB->GetHelpId(pTB->GetItemId(nItemPos))) ; nItemPos++ ) {}\
5288         bItemFound = aButtonId.equals(Str2Id( pTB->GetItemCommand(pTB->GetItemId(nItemPos)) )) || aButtonId.equals(pTB->GetHelpId(pTB->GetItemId(nItemPos)));\
5289         if ( !bItemFound )\
5290             ReportError( aUId, GEN_RES_STR1( S_HELPID_ON_TOOLBOX_NOT_FOUND, MethodString( nMethodId ) ) );\
5291         else\
5292         {\
5293             if ( !pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) && nMethodId != _M_IsEnabled && nMethodId != M_GetState )\
5294             {\
5295                 ReportError( aUId, GEN_RES_STR1( S_BUTTON_DISABLED_ON_TOOLBOX, MethodString( nMethodId ) ) );\
5296                 bItemFound = sal_False;\
5297             }\
5298             else if ( !pTB->IsItemVisible( pTB->GetItemId(nItemPos) ) && nMethodId != M_GetState )\
5299             {\
5300                 ReportError( aUId, GEN_RES_STR1( S_BUTTON_HIDDEN_ON_TOOLBOX, MethodString( nMethodId ) ) );\
5301                 bItemFound = sal_False;\
5302             }\
5303             else\
5304             {\
5305                 if ( pTB->IsMenuEnabled() )\
5306                 {   /* button is in Menu */\
5307                 }\
5308                 else\
5309                 {   /* Try the multi line way */\
5310                     if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\
5311                     {\
5312                         sal_uInt16 nLine = pTB->GetCurLine();\
5313                         do\
5314                         {\
5315                             pTB->ShowLine( sal_False );\
5316                             for ( int i = 1 ; i < 30 ; i++ )\
5317                                 SafeReschedule();\
5318                         }\
5319                         while ( pTB->GetCurLine() != nLine && pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() );\
5320                         pTB->Invalidate( pTB->GetScrollRect() );\
5321                     }\
5322                     if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\
5323                     {\
5324                         ReportError( aUId, GEN_RES_STR1( S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX, MethodString( nMethodId ) ) );\
5325                         bItemFound = sal_False;\
5326                     }\
5327                 }\
5328             }\
5329         }\
5330     }
5331 
5332                         switch( nMethodId )
5333                         {
5334                             case M_AnimateMouse :
5335                                 AnimateMouse( pControl, MitteLinks);
5336                                 break;
5337                             case M_Click :
5338                                 {
5339                                     FIND_ITEM;
5340                                     if ( bItemFound )   // FIND_ITEM Erfolgreich
5341                                     {
5342                                         Rectangle aRect = pTB->GetItemRect(pTB->GetItemId(nItemPos));
5343                                         if ( aRect.IsEmpty() )
5344                                         {
5345                                             pTB->ExecuteCustomMenu();
5346 /*                                          aRect = pTB->GetMenubuttonRect();
5347                                             MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
5348                                             ImplMouseButtonDown( pTB, aMEvnt );*/
5349 
5350                                             aSubMenuId1 = 0;
5351                                             aSubMenuId2 = 0;
5352                                             aSubMenuId3 = 0;
5353                                             pMenuWindow = NULL;
5354 
5355                                             new StatementCommand( this, RC_MenuSelect, PARAM_USHORT_1, pTB->GetItemId(nItemPos) + TOOLBOX_MENUITEM_START );
5356                                         }
5357                                         else
5358                                         {
5359                                             aRect = pTB->GetItemRect(pTB->GetItemId(nItemPos));
5360                                             MouseEvent aMEvnt;
5361                                             aMEvnt = MouseEvent(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
5362                                             ImplMouseButtonDown( pTB, aMEvnt, FORCE_DIRECT_CALL );
5363                                             ImplMouseButtonUp  ( pTB, aMEvnt, FORCE_DIRECT_CALL );
5364                                         }
5365                                     }
5366                                 }
5367                                 break;
5368                             case M_TearOff :
5369                                 {
5370                                     FIND_ITEM;
5371                                     if ( bItemFound )   // FIND_ITEM Erfolgreich
5372                                     {
5373                                         Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos );
5374                                         AnimateMouse( pControl, aRect.Center() );
5375                                         MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
5376                                         ImplMouseButtonDown( pTB, aMEvnt, FORCE_DIRECT_CALL );
5377 
5378                                         Window *pWin = NULL;
5379                                         // Wait for the window to open.
5380                                         StatementList::bExecuting = sal_True;       // Bah ist das ein ekliger Hack
5381                                         {                                           // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird.
5382                                             Time aDelay;
5383                                             while ( !pWin && ( (pWin = GetPopupFloatingWin()) == NULL ) && ( Time() - aDelay ).GetSec() < 15 )
5384                                                 SafeReschedule();
5385                                         }
5386                                         StatementList::bExecuting = sal_False;  // Bah ist das ein ekliger Hack
5387 
5388                                         if ( pWin && pWin->GetType() == WINDOW_FLOATINGWINDOW )
5389                                         {
5390                                             aMEvnt = MouseEvent(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
5391                                             ImplMouseButtonUp( pTB, aMEvnt, FORCE_DIRECT_CALL );
5392                                             ((FloatingWindow*)pWin)->EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF );
5393                                         }
5394                                         else
5395                                         {
5396                                             aMEvnt = MouseEvent(Point(1,-10), 1, MOUSE_SIMPLECLICK,MOUSE_LEFT);
5397                                             ImplMouseButtonUp( pTB, aMEvnt, FORCE_DIRECT_CALL );
5398                                             ReportError( aUId, GEN_RES_STR1( S_TEAROFF_FAILED, MethodString( nMethodId ) ) );
5399                                         }
5400                                     }
5401                                 }
5402                                 break;
5403                             case M_OpenMenu :
5404                                 {
5405                                     FIND_ITEM;
5406                                     if ( bItemFound )   // FIND_ITEM Erfolgreich
5407                                     {
5408                                         Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos );
5409                                         AnimateMouse( pControl, aRect.Center() );
5410                                         MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
5411                                         ImplMouseButtonDown( pTB, aMEvnt);
5412                                         ImplMouseButtonUp( pTB, aMEvnt);
5413 
5414                                         // Das Fenster ist offen.
5415                                         aSubMenuId1 = 0;
5416                                         aSubMenuId2 = 0;
5417                                         aSubMenuId3 = 0;
5418                                         pMenuWindow = NULL;
5419                                     }
5420                                 }
5421                                 break;
5422                             case _M_IsEnabled:
5423                                 {
5424                                     FIND_ITEM;
5425                                     if ( bItemFound )   // FIND_ITEM Erfolgreich
5426                                     {
5427                                         pRet->GenReturn ( RET_Value, aUId, pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) );
5428                                     }
5429                                 }
5430                                 break;
5431                             case M_GetState :
5432                                 {
5433                                     FIND_ITEM;
5434                                     if ( bItemFound )   // FIND_ITEM Erfolgreich
5435                                     {
5436                                         if ( ValueOK( aUId, CUniString("GetState"), nNr1, 4 ) )
5437                                             switch (nNr1)
5438                                             {
5439                                             case 0:
5440                                                 pRet->GenReturn ( RET_Value, aUId, Id2Str( pTB->GetHelpId(pTB->GetItemId(nItemPos)) ) );
5441                                                 break;
5442                                             case 1:
5443                                                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTB->GetItemType(nItemPos));
5444                                                 break;
5445                                             case 2:
5446                                                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTB->GetItemState(pTB->GetItemId(nItemPos)));
5447                                                 break;
5448                                             case 3:
5449                                                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTB->GetItemId(nItemPos));
5450                                                 break;
5451                                             case 11:
5452                                                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG) nItemPos + 1);
5453                                                 break;
5454                                             case 12:
5455                                                 pRet->GenReturn ( RET_Value, aUId, Id2Str(pTB->GetHelpId())); // The toolbox's help id
5456                                                 break;
5457                                             case 13:
5458                                             {
5459                                                 Rectangle aRect = pTB->GetItemPosRect( nItemPos );
5460                                                 Rectangle aTBRect = pTB->GetWindowExtentsRelative( NULL );
5461                                                 pRet->GenReturn ( RET_Value, aUId,
5462                                                 UniString::CreateFromInt32(aRect.Left()+aTBRect.Left()).
5463                                                     AppendAscii(",").Append(UniString::CreateFromInt32(aRect.Top()+aTBRect.Top())).
5464                                                     AppendAscii(",").Append(UniString::CreateFromInt32(aRect.GetWidth())).
5465                                                     AppendAscii(",").Append(UniString::CreateFromInt32(aRect.GetHeight()))
5466                                                 );
5467                                                 break;
5468                                             }
5469                                             default:
5470                                                 ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
5471                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG(0));
5472                                                 break;
5473                                             }
5474                                     }
5475                                 }
5476                                 break;
5477                             case M_GetItemHelpText :
5478                                 if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTB->GetItemCount() ))
5479                                     pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetHelpText(pTB->GetItemId(nNr1-1)));
5480                                 break;
5481                             case M_GetItemQuickHelpText :
5482                                 if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTB->GetItemCount() ))
5483                                     pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetQuickHelpText(pTB->GetItemId(nNr1-1)));
5484                                 break;
5485                             case M_GetItemText2:
5486                                 if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTB->GetItemCount() ))
5487                                     pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetItemText(pTB->GetItemId(nNr1-1)));
5488                                 break;
5489                             case M_GetItemText :
5490                                 pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetItemText(nNr1));
5491                                 break;
5492                             case M_GetText :
5493                                 pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetText());
5494                                 break;
5495                             case M_GetItemCount :
5496                                 pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTB->GetItemCount());
5497                                 break;
5498                             case M_SetNextToolBox :
5499                                 if ( (nParams & PARAM_STR_1) )
5500                                     pTB->SetNextToolBox( aString1 );
5501                                 else
5502                                     pTB->SetNextToolBox( pTB->GetNextToolBox() );
5503                                 pTB->NextToolBox();
5504                                 break;
5505                             case M_GetNextToolBox :
5506                                 pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetNextToolBox());
5507                                 break;
5508                             case M_Dock :
5509                             case M_Undock :
5510                             case M_IsDocked :
5511                             case M_Close:
5512                             case M_Size:
5513                             case M_Move:
5514                             case M_IsMax:
5515                             case M_Minimize:
5516                             case M_Maximize:
5517                             case M_Help:        // Alles was unten weiterbehandelt werden soll
5518                                 goto DockingWin;
5519                             default:
5520                                 ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ToolBox" ) );
5521                                 break;
5522                         }
5523                     }
5524                     break;
5525 
5526                 case C_TreeListBox:
5527                     switch( nMethodId )
5528                     {
5529 
5530 
5531 
5532 #define GET_NTH_ENTRY_LBOX( First, Next, Anzahl)    \
5533     SvLBoxEntry *pThisEntry = ((SvTreeListBox*)pControl)->First(); \
5534     { \
5535         int niTemp = Anzahl; \
5536         while ( niTemp-- ) \
5537         { \
5538             pThisEntry = ((SvTreeListBox*)pControl)->Next( pThisEntry ); \
5539         } \
5540     }
5541 
5542                         case M_GetText :               // Get the first text of the given (default=1) line
5543                             {                          // should get removed some time
5544                                 SvTreeListBox *pTree = (SvTreeListBox*)pControl;
5545                                 SvLBoxEntry *pThisEntry = pTree->GetCurEntry();
5546                                 if ( ! (nParams & PARAM_USHORT_1) )
5547                                     nNr1 = 1;
5548                                 if ( pThisEntry )
5549                                 {
5550                                     SvLBoxString* pItem = NULL;
5551                                     sal_uInt16 nValidTextItemCount = 0;
5552                                     {
5553                                         sal_uInt16 nIndex = 0;
5554                                         SvLBoxItem *pMyItem;
5555                                         while ( ( nValidTextItemCount < nNr1 ) && nIndex < pThisEntry->ItemCount() )
5556                                         {
5557                                             pMyItem = pThisEntry->GetItem( nIndex );
5558                                             if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING )
5559                                             {
5560                                                 pItem = (SvLBoxString*)pMyItem;
5561                                                 nValidTextItemCount++;
5562                                             }
5563                                             nIndex++;
5564                                         }
5565                                     }
5566                                     if ( ValueOK( aUId, CUniString("GetText"), nNr1, nValidTextItemCount ) )
5567                                         pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
5568                                 }
5569                                 else
5570                                     ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) );
5571                             }
5572                             break;
5573                         case M_GetSelCount :
5574                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((SvLBox*)pControl)->GetSelectionCount()));
5575                             break;
5576                         case M_GetItemCount :
5577                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((SvLBox*)pControl)->GetVisibleCount()) );
5578                             break;
5579                         case M_GetSelIndex :
5580                             if ( ! (nParams & PARAM_USHORT_1) )
5581                                 nNr1 = 1;
5582                             if ( ValueOK(aUId, CUniString("GetSelIndex"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
5583                             {
5584                                 nNr1--;
5585                                 GET_NTH_ENTRY_LBOX( FirstSelected, NextSelected, nNr1);
5586                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( ((SvTreeListBox*)pControl)->GetVisiblePos( pThisEntry )) +1 );
5587                             }
5588                             break;
5589                         case M_Select :
5590                             if ( ! (nParams & PARAM_BOOL_1) )
5591                                 bBool1 = sal_True;
5592                             if( nParams & PARAM_STR_1 )
5593                             {
5594 /*                                  ListBox *pLB = ((ListBox*)pControl);
5595                                 if ( pLB->GetEntryPos( aString1 ) == LISTBOX_ENTRY_NOTFOUND )
5596                                     ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
5597                                 else
5598                                 {
5599                                     pLB->SelectEntry( aString1, bBool1 );
5600                                     if ( pLB->IsEntrySelected( aString1 ) ? !bBool1 : bBool1 )  // XOR rein mit BOOL
5601                                         ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) );
5602                                 }
5603 */                                  ReportError( aUId, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED, MethodString( nMethodId ) ) );
5604                             }
5605                             else
5606                             {
5607                                 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5608                                 {
5609                                     SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
5610                                     ((SvTreeListBox*)pControl)->Select ( pEntry, bBool1 );
5611                                 }
5612                             }
5613                             break;
5614                         case M_Collapse :
5615                             if( nParams & PARAM_STR_1 )
5616                             {
5617                                 ReportError( aUId, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED, MethodString( nMethodId ) ) );
5618                             }
5619                             else
5620                             {
5621                                 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5622                                 {
5623                                     SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
5624                                     ((SvTreeListBox*)pControl)->Collapse ( pEntry );
5625                                 }
5626                             }
5627                             break;
5628                         case M_Expand :
5629                             if( nParams & PARAM_STR_1 )
5630                             {
5631                                 ReportError( aUId, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED, MethodString( nMethodId ) ) );
5632                             }
5633                             else
5634                             {
5635                                 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5636                                 {
5637                                     SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
5638                                     ((SvTreeListBox*)pControl)->Expand ( pEntry );
5639                                 }
5640                             }
5641                             break;
5642                         case M_GetSelText :
5643                             if ( ! (nParams & PARAM_USHORT_1) )
5644                                 nNr1 = 1;
5645                             if ( ! (nParams & PARAM_USHORT_2) )
5646                                 nNr2 = 1;
5647                             if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
5648                             {
5649                                 nNr1--;
5650                                 GET_NTH_ENTRY_LBOX( FirstSelected, NextSelected, nNr1);
5651                                 if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
5652                                 {
5653                                     SvLBoxString* pItem = NULL;
5654                                     if ( ! (nParams & PARAM_USHORT_2) )
5655                                         pItem = (SvLBoxString*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING );
5656                                     else
5657                                     {
5658                                         SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
5659                                         if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING )
5660                                             pItem = (SvLBoxString*)pMyItem;
5661                                     }
5662 
5663                                     if ( pItem )
5664                                         pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
5665                                     else
5666                                         ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_STRING, MethodString( nMethodId ) ) );
5667                                 }
5668                             }
5669                             break;
5670                         case M_GetItemText :
5671                             if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5672                             {
5673                                 SvLBoxEntry *pThisEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
5674                                 if ( ! (nParams & PARAM_USHORT_2) )
5675                                     nNr2 = 1;
5676                                 if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
5677                                 {
5678                                     SvLBoxString* pItem = NULL;
5679                                     if ( ! (nParams & PARAM_USHORT_2) )
5680                                         pItem = (SvLBoxString*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING );
5681                                     else
5682                                     {
5683                                         SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
5684                                         if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING )
5685                                             pItem = (SvLBoxString*)pMyItem;
5686                                     }
5687 
5688                                     if ( pItem )
5689                                         pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
5690                                     else
5691                                         ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_STRING, MethodString( nMethodId ) ) );
5692                                 }
5693                             }
5694                             break;
5695                         case M_IsChecked :
5696                         case M_IsTristate :
5697                         case M_GetState :
5698                         case M_Check :
5699                         case M_UnCheck :
5700                         case M_TriState :
5701                             {
5702                                 SvTreeListBox *pTree = (SvTreeListBox*)pControl;
5703                                 SvLBoxEntry *pThisEntry = NULL;
5704 
5705                                 if ( ! (nParams & PARAM_USHORT_1) )
5706                                 {
5707                                     pThisEntry = pTree->GetCurEntry();
5708                                     if ( !pThisEntry )
5709                                         ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) );
5710                                 }
5711                                 else
5712                                 {
5713                                     if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5714                                     {
5715                                         pThisEntry = (SvLBoxEntry*)pTree->GetEntryAtVisPos( nNr1-1 );
5716                                     }
5717                                 }
5718 
5719                                 if ( ! (nParams & PARAM_USHORT_2) )
5720                                     nNr2 = 1;
5721 
5722                                 if ( pThisEntry )
5723                                 {
5724                                     if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
5725                                     {
5726                                         SvLBoxButton* pItem = NULL;
5727                                         if ( ! (nParams & PARAM_USHORT_2) )
5728                                             pItem = (SvLBoxButton*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXBUTTON );
5729                                         else
5730                                         {
5731                                             SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
5732                                             if ( pMyItem->IsA() == SV_ITEM_ID_LBOXBUTTON )
5733                                                 pItem = (SvLBoxButton*)pMyItem;
5734                                         }
5735 
5736                                         if ( pItem )
5737                                         {
5738                                             switch( nMethodId )
5739                                             {
5740                                                 case M_IsChecked :
5741                                                     pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pItem->IsStateChecked() ) );
5742                                                     break;
5743                                                 case M_IsTristate :
5744                                                     pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pItem->IsStateTristate() ) );
5745                                                     break;
5746                                                 case M_GetState :
5747                                                     pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pItem->GetButtonFlags() & ~SV_STATE_MASK ));
5748                                                     break;
5749                                                 case M_Check :
5750                                                     if ( !pItem->IsStateChecked() )
5751                                                     {
5752                                                         pItem->SetStateChecked();
5753                                                         pTree->CheckButtonHdl();
5754                                                         pTree->InvalidateEntry( pThisEntry );
5755                                                     }
5756                                                     break;
5757                                                 case M_UnCheck :
5758                                                     if ( pItem->IsStateChecked() || pItem->IsStateTristate() )
5759                                                     {
5760                                                         pItem->SetStateUnchecked();
5761                                                         pTree->CheckButtonHdl();
5762                                                         pTree->InvalidateEntry( pThisEntry );
5763                                                     }
5764                                                     break;
5765                                                 case M_TriState :
5766                                                     if ( !pItem->IsStateTristate() )
5767                                                     {
5768                                                         pItem->SetStateTristate();
5769                                                         pTree->CheckButtonHdl();
5770                                                         pTree->InvalidateEntry( pThisEntry );
5771                                                     }
5772                                                     break;
5773                                                 default:
5774                                                     ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
5775                                                     break;
5776                                             }
5777                                         }
5778                                         else
5779                                             ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_BUTTON, MethodString( nMethodId ) ) );
5780                                     }
5781                                 }
5782                             }
5783                             break;
5784                         case M_GetItemType :
5785                             {
5786                                 SvTreeListBox *pTree = (SvTreeListBox*)pControl;
5787                                 SvLBoxEntry *pThisEntry = NULL;
5788 
5789                                 if ( ! (nParams & PARAM_USHORT_1) )
5790                                 {
5791                                     pThisEntry = pTree->GetCurEntry();
5792                                     if ( !pThisEntry )
5793                                         ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) );
5794                                 }
5795                                 else
5796                                 {
5797                                     if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5798                                     {
5799                                         pThisEntry = (SvLBoxEntry*)pTree->GetEntryAtVisPos( nNr1-1 );
5800                                     }
5801                                 }
5802 
5803                                 if ( pThisEntry )
5804                                 {
5805                                     if ( ! (nParams & PARAM_USHORT_2) )
5806                                         nNr2 = 1;
5807                                     if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
5808                                     {
5809                                         SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
5810                                         comm_USHORT nType;
5811                                         switch ( pMyItem->IsA() )
5812                                         {
5813                                             case SV_ITEM_ID_LBOXSTRING: nType = CONST_ItemTypeText ; break;
5814                                             case SV_ITEM_ID_LBOXBMP: nType = CONST_ItemTypeBMP ; break;
5815                                             case SV_ITEM_ID_LBOXBUTTON: nType = CONST_ItemTypeCheckbox ; break;
5816                                             case SV_ITEM_ID_LBOXCONTEXTBMP: nType = CONST_ItemTypeContextBMP ; break;
5817                                             default: nType = CONST_ItemTypeUnknown;
5818                                         }
5819                                         pRet->GenReturn ( RET_Value, aUId, nType );
5820                                     }
5821                                 }
5822                             }
5823                             break;
5824                         default:
5825                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TreeListBox" ) );
5826                             break;
5827                     }
5828                     break;
5829                 case C_Control:
5830                 {
5831                     sal_uInt16 nRealControlType = 0;
5832                     if ( dynamic_cast< EditBrowseBox* >(pControl) )
5833                         nRealControlType = CONST_CTBrowseBox;
5834                     else if ( dynamic_cast< ValueSet* >(pControl) )
5835                         nRealControlType = CONST_CTValueSet;
5836                     else if ( dynamic_cast< ORoadmap* >(pControl) )
5837                         nRealControlType = CONST_CTORoadmap;
5838                     else if ( dynamic_cast< IExtensionListBox* >(pControl) )
5839                         nRealControlType = CONST_CTIExtensionListBox;
5840                     else if ( dynamic_cast< ::svt::table::TableControl* >(pControl) )
5841                         nRealControlType = CONST_CTTableControl;
5842                     else
5843                         nRealControlType = CONST_CTUnknown;
5844 
5845                     switch( nMethodId )
5846                     {
5847                         case M_AnimateMouse :
5848                             AnimateMouse( pControl, MitteOben);
5849                             break;
5850                         default:
5851                             switch( nRealControlType )
5852                             {
5853                                 case CONST_CTBrowseBox:
5854                                     {
5855                                         EditBrowseBox* pEBBox = dynamic_cast< EditBrowseBox* >(pControl);
5856                                         switch( nMethodId )
5857                                         {
5858 
5859 
5860     /*
5861 
5862 
5863     sal_Bool            MakeFieldVisible( long nRow, sal_uInt16 nColId, sal_Bool bComplete = sal_False );
5864     // access to dynamic values of cursor row
5865     String          GetColumnTitle( sal_uInt16 nColumnId ) const;
5866     sal_uInt16          GetColumnId( sal_uInt16 nPos ) const;
5867     sal_uInt16          GetColumnPos( sal_uInt16 nColumnId ) const;
5868     // access and movement of cursor
5869     long            GetCurRow() const { return nCurRow; }
5870     sal_uInt16          GetCurColumnId() const { return nCurColId; }
5871     sal_Bool            GoToRow( long nRow );
5872     sal_Bool            GoToRowAndDoNotModifySelection( long nRow );
5873     sal_Bool            GoToColumnId( sal_uInt16 nColId );
5874     sal_Bool            GoToRowColumnId( long nRow, sal_uInt16 nColId );
5875     // selections
5876     void            SetNoSelection();
5877     void            SelectAll();
5878     void            SelectRow( long nRow, sal_Bool bSelect = sal_True, sal_Bool bExpand = sal_True );
5879     void            SelectColumnPos( sal_uInt16 nCol, sal_Bool bSelect = sal_True )
5880                         { SelectColumnPos( nCol, bSelect, sal_True); }
5881     void            SelectColumnId( sal_uInt16 nColId, sal_Bool bSelect = sal_True )
5882                         { SelectColumnPos( GetColumnPos(nColId), bSelect, sal_True); }
5883     long            GetSelectRowCount() const;
5884     sal_uInt16          GetSelectColumnCount() const;
5885     sal_Bool            IsRowSelected( long nRow ) const;
5886     sal_Bool            IsColumnSelected( sal_uInt16 nColumnId ) const;
5887     long            FirstSelectedRow( sal_Bool bInverse = sal_False );
5888     long            LastSelectedRow( sal_Bool bInverse = sal_False );
5889     long            PrevSelectedRow();
5890     long            NextSelectedRow();
5891     const MultiSelection* GetSelection() const
5892                     { return bMultiSelection ? uRow.pSel : 0; }
5893     void            SetSelection( const MultiSelection &rSelection );
5894 
5895     virtual String  GetCellText(long _nRow, sal_uInt16 _nColId) const;
5896     sal_uInt16 GetColumnCount() const { return ColCount(); }
5897 protected:
5898     virtual long    GetRowCount() const;
5899 
5900 
5901     EditBrowseBox
5902 
5903             sal_Bool IsEditing() const {return aController.Is();}
5904             void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);}
5905             void InvalidateHandleColumn();
5906 
5907             CellControllerRef Controller() const { return aController; }
5908             sal_Int32   GetBrowserFlags() const { return m_nBrowserFlags; }
5909 
5910             virtual void ActivateCell(long nRow, sal_uInt16 nCol, sal_Bool bSetCellFocus = sal_True);
5911             virtual void DeactivateCell(sal_Bool bUpdate = sal_True);
5912 
5913 
5914 
5915     */
5916                                             case M_GetSelText :
5917                                                 {
5918                                                     pRet->GenReturn ( RET_Value, aUId, pEBBox->GetCellText( pEBBox->GetCurrRow(), pEBBox->GetColumnId( pEBBox->GetCurrColumn() )));
5919                                                 }
5920                                                 break;
5921                                             case M_GetColumnCount :
5922                                                 {
5923                                                     sal_uInt16 nColCount = pEBBox->GetColumnCount();
5924                                                     comm_USHORT nUnfrozenColCount = 0;
5925                                                     sal_uInt16 i;
5926                                                     for ( i=0 ; i < nColCount ; i++ )
5927                                                     {
5928                                                         if ( !pEBBox->IsFrozen( pEBBox->GetColumnId( i ) ) )
5929                                                             nUnfrozenColCount++;
5930                                                     }
5931                                                     pRet->GenReturn ( RET_Value, aUId, nUnfrozenColCount );
5932                                                 }
5933                                                 break;
5934                                             case M_GetRowCount :
5935                                                 {
5936                                                     pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pEBBox->GetRowCount() );
5937                                                 }
5938                                                 break;
5939                                             case M_IsEditing :
5940                                                 {
5941                                                     CellControllerRef aControler;
5942                                                     aControler = pEBBox->Controller();
5943                                                     pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)aControler.Is() );
5944                                                 }
5945                                                 break;
5946                                             case M_Select :
5947                                                 {
5948                                                     if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pEBBox->GetRowCount() ) )
5949                                                     {
5950                                                         sal_uInt16 nColCount = pEBBox->GetColumnCount();
5951                                                         comm_USHORT nUnfrozenColCount = 0;
5952                                                         sal_uInt16 i;
5953                                                         for ( i=0 ; i < nColCount ; i++ )
5954                                                         {
5955                                                             if ( !pEBBox->IsFrozen( pEBBox->GetColumnId( i ) ) )
5956                                                                 nUnfrozenColCount++;
5957                                                         }
5958                                                         if ( ValueOK(aUId, MethodString( nMethodId ),nNr2,nUnfrozenColCount ) )
5959                                                             pEBBox->GoToRowColumnId( nNr1-1, pEBBox->GetColumnId( nNr2 ) );
5960                                                     }
5961                                                 }
5962                                                 break;
5963 
5964 
5965 
5966                                                 /*
5967                                             case M_GetSelCount :
5968                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((SvLBox*)pControl)->GetSelectionCount()));
5969                                                 break;
5970                                             case M_GetSelIndex :
5971                                                 if ( ! (nParams & PARAM_USHORT_1) )
5972                                                     nNr1 = 1;
5973                                                 if ( ValueOK(aUId, CUniString("GetSelIndex"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
5974                                                 {
5975                                                     nNr1--;
5976                                                     COUNT_LBOX( FirstSelected, NextSelected, nNr1);
5977                                                     pRet->GenReturn ( RET_Value, aUId, comm_ULONG( ((SvTreeListBox*)pControl)->GetVisiblePos( pThisEntry )) +1 );
5978                                                 }
5979                                                 break;
5980                                             case M_GetSelText :
5981                                                 if ( ! (nParams & PARAM_USHORT_1) )
5982                                                     nNr1 = 1;
5983                                                 if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
5984                                                 {
5985                                                     nNr1--;
5986                                                     COUNT_LBOX( FirstSelected, NextSelected, nNr1);
5987                                                     GetFirstValidTextItem( pThisEntry );
5988                                                     pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
5989                                                 }
5990                                                 break;
5991                                             case M_GetItemCount :
5992                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((SvLBox*)pControl)->GetVisibleCount()) );
5993                                                 break;
5994                                             case M_GetItemText :
5995                                                 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5996                                                 {
5997                                                     SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
5998                                                     GetFirstValidTextItem( pEntry );
5999                                                     pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
6000                                                 }
6001                                                 break;
6002                                             case M_Select :
6003                                                 if ( ! (nParams & PARAM_BOOL_1) )
6004                                                     bBool1 = sal_True;
6005                                                 if( nParams & PARAM_STR_1 )
6006                                                 {
6007                 / *                                 ListBox *pLB = ((ListBox*)pControl);
6008                                                     if ( pLB->GetEntryPos( aString1 ) == LISTBOX_ENTRY_NOTFOUND )
6009                                                         ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
6010                                                     else
6011                                                     {
6012                                                         pLB->SelectEntry( aString1, bBool1 );
6013                                                         if ( pLB->IsEntrySelected( aString1 ) ? !bBool1 : bBool1 )  // XOR rein mit BOOL
6014                                                             ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) );
6015                                                     }
6016                 * /                                 ReportError( aUId, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED, MethodString( nMethodId ) ) );
6017                                                 }
6018                                                 else
6019                                                 {
6020                                                     if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
6021                                                     {
6022                                                         SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
6023                                                         ((SvTreeListBox*)pControl)->Select ( pEntry, bBool1 );
6024                                                     }
6025                                                 }
6026                                                 break;*/
6027                                             default:
6028                                                 ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "EditBrowseBox" ) );
6029                                                 break;
6030                                         }
6031                                     }
6032                                     break;
6033                                 case CONST_CTValueSet:
6034                                     {
6035                                         ValueSet *pVS = dynamic_cast< ValueSet* >(pControl);
6036                                         switch ( nMethodId )
6037                                         {
6038                                         case M_GetItemCount:
6039                                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pVS->GetItemCount()));
6040                                             break;
6041                                         case M_GetItemText:
6042                                             if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pVS->GetItemCount() ))
6043                                                 pRet->GenReturn ( RET_Value, aUId, pVS->GetItemText( pVS->GetItemId( nNr1-1 ) ) );
6044                                             break;
6045                                         case M_Select:
6046                                             if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pVS->GetItemCount() ))
6047                                                 pVS->SelectItem( pVS->GetItemId( nNr1-1 ) );
6048                                             break;
6049                                         case M_GetSelIndex :
6050                                             if ( pVS->IsNoSelection() )
6051                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG(0));
6052                                             else
6053                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pVS->GetItemPos( pVS->GetSelectItemId() ) +1));
6054                                             break;
6055                                         case M_GetSelText :
6056                                             if ( pVS->IsNoSelection() )
6057                                                 pRet->GenReturn ( RET_Value, aUId, String() );
6058                                             else
6059                                                 pRet->GenReturn ( RET_Value, aUId, pVS->GetItemText( pVS->GetSelectItemId() ) );
6060                                             break;
6061                                         case M_SetNoSelection :
6062                                             pVS->SetNoSelection();
6063                                             break;
6064                                         default:
6065                                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ValueSet" ) );
6066                                             break;
6067                                         }
6068                                     }
6069                                     break;
6070                                 case CONST_CTORoadmap:
6071                                     {
6072                                         ORoadmap *pRM = dynamic_cast< ORoadmap* >(pControl);
6073                                         switch ( nMethodId )
6074                                         {
6075                                         case M_GetItemCount:
6076                                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pRM->GetItemCount()));
6077                                             break;
6078                                         case M_GetItemText:
6079                                             if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() ))
6080                                                 pRet->GenReturn ( RET_Value, aUId, pRM->GetRoadmapItemLabel( pRM->GetItemID( nNr1-1 ) ) );
6081                                             break;
6082                                         case M_Select:
6083                                             if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() ))
6084                                             {
6085                                                 if ( pRM->IsRoadmapItemEnabled( pRM->GetItemID( nNr1-1 ) ) )
6086                                                     pRM->SelectRoadmapItemByID( pRM->GetItemID( nNr1-1 ) );
6087                                                 else
6088                                                     ReportError( aUId, GEN_RES_STR1c( S_WIN_DISABLED, "RoadmapItem" ) );
6089                                             }
6090                                             break;
6091                                         case M_GetSelIndex :
6092                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pRM->GetItemIndex( pRM->GetCurrentRoadmapItemID() ) +1));
6093                                             break;
6094                                         case M_GetSelText :
6095                                                 pRet->GenReturn ( RET_Value, aUId, pRM->GetRoadmapItemLabel( pRM->GetCurrentRoadmapItemID() ) );
6096                                             break;
6097                                         case M_IsItemEnabled :
6098                                             if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() ))
6099                                                 pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)pRM->IsRoadmapItemEnabled( pRM->GetItemID( nNr1-1 ) ) );
6100                                             break;
6101                                         default:
6102                                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RoadMap" ) );
6103                                             break;
6104                                         }
6105                                     }
6106                                     break;
6107                                 case CONST_CTIExtensionListBox:
6108                                     {
6109                                         IExtensionListBox *pELB = dynamic_cast< IExtensionListBox* >(pControl);
6110                                         switch ( nMethodId )
6111                                         {
6112                                         case M_GetItemCount:
6113                                             pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pELB->getItemCount()));
6114                                             break;
6115                                         case M_GetItemText:
6116                                             if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pELB->getItemCount() ))
6117                                                 switch ( nNr2 )
6118                                                 {
6119                                                 case 1:
6120                                                     pRet->GenReturn ( RET_Value, aUId, pELB->getItemName( nNr1 -1 ) );
6121                                                     break;
6122                                                 case 2:
6123                                                     pRet->GenReturn ( RET_Value, aUId, pELB->getItemVersion( nNr1 -1 ) );
6124                                                     break;
6125                                                 case 3:
6126                                                     pRet->GenReturn ( RET_Value, aUId, pELB->getItemDescription( nNr1 -1 ) );
6127                                                     break;
6128                                                 case 4:
6129                                                     pRet->GenReturn ( RET_Value, aUId, pELB->getItemPublisher( nNr1 -1 ) );
6130                                                     break;
6131                                                 case 5:
6132                                                     pRet->GenReturn ( RET_Value, aUId, pELB->getItemPublisherLink( nNr1 -1 ) );
6133                                                     break;
6134                                                 default:
6135                                                     ValueOK( aUId, MethodString( nMethodId ).AppendAscii(" String Number"), nNr2, 5 );
6136                                                 }
6137                                             break;
6138                                         case M_Select:
6139                                             if ( (nParams & PARAM_USHORT_1) )
6140                                             {
6141                                                 if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pELB->getItemCount() ))
6142                                                 {
6143                                                     pELB->select( nNr1-1 );
6144                                                 }
6145                                             }
6146                                             else if ( (nParams & PARAM_STR_1) )
6147                                             {
6148                                                 pELB->select( aString1 );
6149                                                 sal_Bool bSuccess = sal_True;
6150                                                 if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
6151                                                     bSuccess = sal_False;
6152                                                 else
6153                                                 {
6154                                                     if ( !aString1.Equals( String( pELB->getItemName( pELB->getSelIndex() ) ) ) )
6155                                                         bSuccess = sal_False;
6156                                                 }
6157                                                 if ( !bSuccess )
6158                                                     ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
6159                                             }
6160                                             break;
6161                                         case M_GetSelCount :
6162                                             if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
6163                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( 0 ));
6164                                             else
6165                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( 1 ));
6166                                             break;
6167                                         case M_GetSelIndex :
6168                                             if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
6169                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( 0 ));
6170                                             else
6171                                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( pELB->getSelIndex() +1));
6172                                             break;
6173 /*                                      xxxcase M_SetNoSelection :
6174                                             ((ListBox*)pControl)->SetNoSelection();
6175                                             ((ListBox*)pControl)->Select();
6176                                             break; */
6177                                         default:
6178                                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RoadMap" ) );
6179                                             break;
6180                                         }
6181                                     }
6182                                     break;
6183 
6184                                 case CONST_CTTableControl:
6185                                     {
6186                                         ::svt::table::TableControl *pTC = dynamic_cast< ::svt::table::TableControl* >(pControl);
6187                                         switch ( nMethodId )
6188                                         {
6189                                            case M_GetItemType :
6190                                                 {
6191                                                     if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
6192                                                          ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
6193                                                     {
6194                                                         ::svt::table::PTableModel pModel = pTC->GetModel();
6195                                                         Any aCell;
6196                                                         pModel->getCellContent( nNr1-1, nNr2-1, aCell );
6197                                                         pRet->GenReturn ( RET_Value, aUId, String( aCell.getValueTypeName() ));
6198                                                     }
6199                                                 }
6200                                                 break;
6201                                            case M_GetItemText :
6202                                                 {
6203                                                     if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
6204                                                          ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
6205                                                     {
6206                                                         ::svt::table::PTableModel pModel = pTC->GetModel();
6207                                                         Any aCell;
6208                                                         pModel->getCellContent( nNr1-1, nNr2-1, aCell );
6209                                                         /* doesn't work ATM since it gets casted to SbxDATE in VCLTestTool unfortunately
6210                                                         SbxVariableRef xRes = new SbxVariable( SbxVARIANT );
6211                                                         unoToSbxValue( xRes, aCell );
6212                                                         pRet->GenReturn ( RET_Value, aUId, *xRes );*/
6213 
6214                                                         Type aType = aCell.getValueType();
6215                                                         TypeClass eTypeClass = aType.getTypeClass();
6216                                                         switch( eTypeClass )
6217                                                         {
6218                                                             /*case TypeClass_ENUM:
6219                                                                 {
6220                                                                     sal_Int32 nEnum = 0;
6221                                                                     enum2int( nEnum, aValue );
6222                                                                     pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)nEnum );
6223                                                                 }
6224                                                                 break;*/
6225                                                             case TypeClass_BOOLEAN:
6226                                                                 pRet->GenReturn ( RET_Value, aUId, *(sal_Bool*)aCell.getValue() );
6227                                                                 break;
6228                                                             case TypeClass_CHAR:
6229                                                                 {
6230                                                                     ::rtl::OUString aContent( *(sal_Unicode*)aCell.getValue() );
6231                                                                     pRet->GenReturn ( RET_Value, aUId, aContent );
6232                                                                 }
6233                                                                 break;
6234                                                             case TypeClass_STRING:
6235                                                                 {
6236                                                                     ::rtl::OUString aContent;
6237                                                                     aCell >>= aContent;
6238                                                                     pRet->GenReturn ( RET_Value, aUId, aContent );
6239                                                                 }
6240                                                                 break;
6241                                                             //case TypeClass_FLOAT:         break;
6242                                                             //case TypeClass_DOUBLE:        break;
6243                                                             //case TypeClass_OCTET:         break;
6244                                                             case TypeClass_BYTE:
6245                                                             case TypeClass_SHORT:
6246                                                             case TypeClass_LONG:
6247                                                             case TypeClass_HYPER:
6248                                                             case TypeClass_UNSIGNED_LONG:
6249                                                             case TypeClass_UNSIGNED_HYPER:
6250                                                                 {
6251                                                                     comm_ULONG val = 0;
6252                                                                     aCell >>= val;
6253                                                                     pRet->GenReturn ( RET_Value, aUId, val );
6254                                                                 }
6255                                                                 break;
6256                                                             //case TypeClass_UNSIGNED_OCTET:break;
6257                                                             case TypeClass_UNSIGNED_SHORT:
6258                                                                 {
6259                                                                     comm_USHORT val = 0;
6260                                                                     aCell >>= val;
6261                                                                     pRet->GenReturn ( RET_Value, aUId, val );
6262                                                                 }
6263                                                                 break;
6264                                                             default:
6265                                                                 pRet->GenReturn ( RET_Value, aUId, comm_USHORT(0) );
6266                                                                 break;
6267                                                         }
6268                                                     }
6269                                                 }
6270                                                 break;
6271                                             case M_GetColumnCount :
6272                                                 {
6273                                                     pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetColumnCount() );
6274                                                 }
6275                                                 break;
6276                                             case M_GetRowCount :
6277                                                 {
6278                                                     pRet->GenReturn ( RET_Value, aUId, (comm_ULONG)pTC->GetRowCount() );
6279                                                 }
6280                                                 break;
6281                                             case M_Select :
6282                                                 {
6283                                                     if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetRowCount() ))
6284                                                     {
6285                                                         if ( pTC->GoToRow( ::svt::table::RowPos( nNr1-1 ) ) )
6286                                                         {
6287                                                             Size aSize( pTC->GetSizePixel() );
6288 //                                                            DirectLog( S_QAError, UniString::CreateFromInt32( aSize.Width() ).Append( UniString::CreateFromInt32( aSize.Height() ) ) );
6289                                                             Point aPos( aSize.Width() / 2, aSize.Height() / 2 );
6290                                                             long nStep = aSize.Height() / 4;
6291                                                             ::svt::table::RowPos nLastPos;
6292                                                             while ( ( nLastPos = pTC->getTableControlInterface().hitTest( aPos ).nRow ) != nNr1-1 && nStep > 0 )
6293                                                             {
6294                                                                 if ( nLastPos > nNr1-1 || nLastPos == ROW_INVALID )
6295                                                                     aPos.Y() -= nStep;
6296                                                                 else
6297                                                                     aPos.Y() += nStep;
6298                                                                 nStep /= 2;
6299                                                             }
6300                                                             if ( pTC->getTableControlInterface().hitTest( aPos ).nRow == nNr1-1 )
6301                                                             {
6302                                                                 MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,MOUSE_LEFT,KEY_MOD1);
6303                                                                 pTC->getSelEngine()->SelMouseButtonDown( aMEvnt );
6304                                                                 pTC->getSelEngine()->SelMouseButtonUp( aMEvnt );
6305                                                                 if ( pTC->IsRowSelected( nNr1-1 ) )
6306                                                                     pTC->Select();
6307                                                             }
6308                                                             else
6309                                                                 ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "find pos" ) );
6310                                                         }
6311                                                         else
6312                                                             ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "GoTo" ) );
6313                                                     }
6314                                                 }
6315                                                 break;
6316                                             case M_GetSelCount :
6317                                                 pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRowCount() ));
6318                                                 break;
6319                                             case M_GetSelIndex :
6320                                                 if ( ! (nParams & PARAM_USHORT_1) )
6321                                                     nNr1 = 1;
6322                                                 if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRowCount() ) )
6323                                                     pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRowIndex( nNr1-1 ) +1 ) );
6324                                                 break;
6325 /*                                          case M_GetSelText :
6326                                                 if ( ! (nParams & PARAM_USHORT_1) )
6327                                                     nNr1 = 1;
6328                                                 if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
6329                                                 {
6330                                                     nNr1--;
6331                                                     COUNT_LBOX( FirstSelected, NextSelected, nNr1);
6332                                                     GetFirstValidTextItem( pThisEntry );
6333                                                     pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
6334                                                 }
6335                                                 break;
6336                                                 */
6337                                         default:
6338                                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TableControl" ) );
6339                                             break;
6340                                         }
6341                                     }
6342                                     break;
6343 
6344                                 case CONST_CTUnknown:
6345                                     ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) );
6346                                     break;
6347                                 default:
6348                                     ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
6349                                     break;
6350                             }
6351                     }
6352                     break;
6353                 }
6354                 case C_Window:
6355                     switch( nMethodId )
6356                     {
6357                         case M_AnimateMouse :
6358                             AnimateMouse( pControl, MitteOben);
6359                             break;
6360                         default:
6361                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "Window" ) );
6362                             break;
6363                     }
6364                     break;
6365 
6366                 case C_DockingWin:
6367                     DockingWin:
6368                     switch( nMethodId )
6369                     {
6370                         case M_AnimateMouse :
6371                             AnimateMouse( pControl, MitteOben);
6372                             break;
6373                         case M_Dock :
6374                             if ( ((DockingWindow*)pControl)->IsFloatingMode() )
6375                                 ((DockingWindow*)pControl)->SetFloatingMode(sal_False);
6376                             else
6377                                 ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) );
6378                             break;
6379                         case M_Undock :
6380                             if ( !((DockingWindow*)pControl)->IsFloatingMode() )
6381                                 ((DockingWindow*)pControl)->SetFloatingMode(sal_True);
6382                             else
6383                                 ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) );
6384                             break;
6385                         case M_IsDocked :
6386                             pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((DockingWindow*)pControl)->IsFloatingMode());
6387                             break;
6388                         case M_Close:
6389                                 //aWindowWaitUId = aUId;
6390                             DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6391                             SET_WINP_CLOSING(pControl);
6392                             ((DockingWindow*)pControl)->Close();
6393                             break;
6394                         case M_Size:
6395                         case M_Move:
6396                         case M_IsMax:
6397                         case M_Minimize:
6398                         case M_Maximize:
6399                             if ( ((DockingWindow*)pControl)->IsFloatingMode() )
6400                             {
6401                                 Window* pFloat = ((DockingWindow*)pControl)->GetFloatingWindow();
6402                                 if ( !pFloat && ((DockingWindow*)pControl)->IsFloatingMode() )
6403                                 {
6404                                     if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
6405                                         pFloat = pControl->GET_REAL_PARENT();
6406                                     else
6407                                     {
6408                                         DBG_ERROR("FloatingMode set but Parent is no FloatingWindow");
6409                                     }
6410                                 }
6411                                 if ( pFloat && pFloat->GetType() == WINDOW_FLOATINGWINDOW )
6412                                 {
6413                                     pControl = pFloat;
6414                                     goto FloatWin;
6415                                 }
6416                                 else
6417                                     ReportError( aUId, GEN_RES_STR1( S_CANNOT_FIND_FLOATING_WIN, MethodString( nMethodId ) ) );
6418                             }
6419                             else
6420                                 ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_DOCKING_MODE, MethodString( nMethodId ) ) );
6421                             break;
6422                         case M_Help:        // Alles was unten weiterbehandelt werden soll
6423                             goto MoreDialog;
6424 
6425                         default:
6426                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "DockingWindow" ) );
6427                             break;
6428                     }
6429                     break;
6430                 case C_FloatWin:
6431                     FloatWin:
6432                     switch( nMethodId )
6433                     {
6434                         case M_AnimateMouse :
6435                             AnimateMouse( pControl, MitteOben);
6436                             break;
6437                         case M_IsMax :
6438                             pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)!((FloatingWindow*)pControl)->IsRollUp());
6439                             break;
6440                         case M_Minimize :
6441                             ((FloatingWindow*)pControl)->RollUp();
6442                             break;
6443                         case M_Maximize :
6444                             ((FloatingWindow*)pControl)->RollDown();
6445                             break;
6446                         case M_Size:
6447                         {
6448                             if ( pControl->GetStyle() & WB_SIZEABLE )
6449                             {
6450                                 Size aMin = ((FloatingWindow*)pControl)->GetMinOutputSizePixel();
6451                                 if ( aMin.Width() <= nNr1 && aMin.Height() <= nNr2 )
6452                                 {
6453                                     pControl->SetSizePixel(Size(nNr1,nNr2));
6454                                     pControl->Resize();
6455                                 }
6456                                 else
6457                                 {
6458                                     ReportError( aUId, GEN_RES_STR2( S_SIZE_BELOW_MINIMUM, String::CreateFromInt32( aMin.Width() ), String::CreateFromInt32( aMin.Height() ) ) );
6459                                 }
6460                             }
6461                             else
6462                                 ReportError( aUId, GEN_RES_STR1( S_SIZE_NOT_CHANGEABLE, MethodString( nMethodId ) ) );
6463                             break;
6464                         }
6465                         case M_Close:
6466                             DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6467                             SET_WINP_CLOSING(pControl);
6468                             ((FloatingWindow*)pControl)->Close();
6469                             break;
6470                         case M_Help:        // Alles was unten weiterbehandelt werden soll
6471                         case M_Move:
6472                             goto MoreDialog;
6473                         default:
6474                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "FloatingWin" ) );
6475                             break;
6476                     }
6477                     break;
6478                 case C_ModelessDlg:
6479                 case C_ModalDlg:
6480                 case C_Dialog:
6481                 case C_TabDlg:
6482                     MoreDialog:
6483                     switch( nMethodId )
6484                     {
6485                         case M_AnimateMouse :
6486                             AnimateMouse( pControl, MitteOben);
6487                             break;
6488                         case M_Close:
6489                             DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6490                             SET_WINP_CLOSING(pControl);
6491                             ((SystemWindow*)pControl)->Close();
6492                             break;
6493                         case M_OK:
6494                         {
6495                             Window *pChild = GetWinByRT( pControl, WINDOW_OKBUTTON );
6496                             if( ControlOK( pChild, "OK Button" ) )
6497                             {
6498                                 DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6499                                 SET_WINP_CLOSING(pControl);
6500                                 ((Button*)pChild)->Click();
6501                             }
6502                             break;
6503                         }
6504                         case M_Cancel:
6505                         {
6506                             Window *pChild = GetWinByRT( pControl, WINDOW_CANCELBUTTON );
6507                             if( ControlOK( pChild, "Cancel Button" ) )
6508                             {
6509                                 DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6510                                 SET_WINP_CLOSING(pControl);
6511                                 ((Button*)pChild)->Click();
6512                             }
6513                             break;
6514                         }
6515                         case M_Help:
6516                         {
6517                             Window *pChild = GetWinByRT( pControl, WINDOW_HELPBUTTON );
6518                             if( ControlOK( pChild, "Help Button" ) )
6519                                 ((Button*)pChild)->Click();
6520                             break;
6521                         }
6522                         case M_Default:
6523                         {
6524                             Window *pChild = ImpGetButton( pControl, WB_DEFBUTTON, WB_DEFBUTTON );
6525                             if( ControlOK( pChild, "Default Button" ) )
6526                                 ((Button*)pChild)->Click();
6527                             break;
6528                         }
6529                         case M_Move:
6530                         {
6531                             pControl->SetPosPixel(Point(nNr1,nNr2));
6532                             break;
6533                         }
6534                         default:
6535                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "Dialog" ) );
6536                             break;
6537                     }
6538                     break;
6539                 case C_WorkWin:
6540                     switch( nMethodId )
6541                     {
6542                         case M_AnimateMouse :
6543                             AnimateMouse( pControl, MitteOben);
6544                             break;
6545                         case M_Close:
6546                             DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6547                             SET_WINP_CLOSING(pControl);
6548                             ((WorkWindow*)pControl)->Close();
6549                             break;
6550                         case M_Size:
6551                         case M_Move:
6552                             goto FloatWin;
6553 //                          break;
6554                         case M_IsMax :
6555                             pRet->GenReturn ( RET_Value, aUId, ((WorkWindow*)pControl)->IsMaximized() );
6556                             break;
6557                         case M_IsMin :
6558                             pRet->GenReturn ( RET_Value, aUId, ((WorkWindow*)pControl)->IsMinimized() );
6559                             break;
6560                         case M_IsRestore :
6561                             pRet->GenReturn ( RET_Value, aUId, comm_BOOL (!((WorkWindow*)pControl)->IsMaximized() && !((WorkWindow*)pControl)->IsMinimized()) );
6562                             break;
6563                         case M_Minimize :
6564                             ((WorkWindow*)pControl)->Maximize( sal_False );
6565                             ((WorkWindow*)pControl)->Minimize();
6566                             break;
6567                         case M_Maximize :
6568                             ((WorkWindow*)pControl)->Maximize();
6569                             break;
6570                         case M_Restore :
6571                             ((WorkWindow*)pControl)->Maximize( sal_False );
6572                             ((WorkWindow*)pControl)->Restore();
6573                             break;
6574                         case M_Help:        // Alles was unten weiterbehandelt werden soll
6575                             goto MoreDialog;
6576                         default:
6577                             ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "WorkWindow" ) );
6578                             break;
6579                     }
6580                     break;
6581                 case C_TabPage:
6582                     ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
6583                     break;
6584                 case C_MessBox:
6585                 case C_InfoBox:
6586                 case C_WarningBox:
6587                 case C_ErrorBox:
6588                 case C_QueryBox:
6589                     {
6590                         sal_Bool bDone = sal_True;
6591                         MessBox* pMB = (MessBox*)pControl;
6592                         switch( nMethodId )
6593                         {
6594                             case M_GetCheckBoxText:
6595                                 pRet->GenReturn ( RET_Value, aUId, pMB->GetCheckBoxText() );
6596                                 break;
6597                             case M_IsChecked :
6598                                 pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pMB->GetCheckBoxState() == STATE_CHECK) );
6599                                 break;
6600                             case M_Check :
6601                                 pMB->SetCheckBoxState( sal_True );
6602                                 break;
6603                             case M_UnCheck :
6604                                 pMB->SetCheckBoxState( sal_False );
6605                                 break;
6606                             case M_GetText :
6607                                 pRet->GenReturn ( RET_Value, aUId, pMB->GetMessText());
6608                                 break;
6609 
6610                             default:
6611                                 bDone = sal_False;
6612                                 break;
6613                         }
6614                         if ( bDone )
6615                             break;  // break the case here else continue at C_ButtonDialog
6616                     }
6617                 case C_ButtonDialog:
6618                     {
6619                         ButtonDialog* pBD = (ButtonDialog*)pControl;
6620 #if OSL_DEBUG_LEVEL > 1
6621                         m_pDbgWin->AddText( "Working MessBox: " );
6622                         if (pControl->IsVisible())
6623                             m_pDbgWin->AddText("*(Visible)\n");
6624                         else
6625                             m_pDbgWin->AddText("*(nicht Visible)\n");
6626 #endif
6627                         switch( nMethodId )
6628                         {
6629                             case M_AnimateMouse :
6630                                 AnimateMouse( pControl, Mitte);
6631                                 break;
6632                             case M_OK:
6633                                 if ( pBD->GetPushButton( BUTTONID_OK ) )
6634                                 {
6635                                     SET_WINP_CLOSING(pControl);
6636                                     pBD->EndDialog(RET_OK);
6637                                 }
6638                                 else
6639                                     ReportError( aUId, GEN_RES_STR1( S_NO_OK_BUTTON, MethodString( nMethodId ) ) );
6640                                 break;
6641                             case M_Cancel:
6642                                 if ( pBD->GetPushButton( BUTTONID_CANCEL ) )
6643                                 {
6644                                     SET_WINP_CLOSING(pControl);
6645                                     pBD->EndDialog(RET_CANCEL);
6646                                 }
6647                                 else
6648                                     ReportError( aUId, GEN_RES_STR1( S_NO_CANCEL_BUTTON, MethodString( nMethodId ) ) );
6649                                 break;
6650                             case M_Yes:
6651                                 if ( pBD->GetPushButton( BUTTONID_YES ) )
6652                                 {
6653                                     SET_WINP_CLOSING(pControl);
6654                                     pBD->EndDialog(RET_YES);
6655                                 }
6656                                 else
6657                                     ReportError( aUId, GEN_RES_STR1( S_NO_YES_BUTTON, MethodString( nMethodId ) ) );
6658                                 break;
6659                             case M_No:
6660                                 if ( pBD->GetPushButton( BUTTONID_NO ) )
6661                                 {
6662                                     SET_WINP_CLOSING(pControl);
6663                                     pBD->EndDialog(RET_NO);
6664                                 }
6665                                 else
6666                                     ReportError( aUId, GEN_RES_STR1( S_NO_NO_BUTTON, MethodString( nMethodId ) ) );
6667                                 break;
6668                             case M_Repeat:
6669                                 if ( pBD->GetPushButton( BUTTONID_RETRY ) )
6670                                 {
6671                                     SET_WINP_CLOSING(pControl);
6672                                     pBD->EndDialog(RET_RETRY);
6673                                 }
6674                                 else
6675                                     ReportError( aUId, GEN_RES_STR1( S_NO_RETRY_BUTTON, MethodString( nMethodId ) ) );
6676                                 break;
6677                             case M_Help:
6678                                 if ( pBD->GetPushButton( BUTTONID_HELP ) )
6679                                 {
6680                                     SET_WINP_CLOSING(pControl);
6681                                     pBD->EndDialog(BUTTONID_HELP);
6682                                 }
6683                                 else
6684                                     ReportError( aUId, GEN_RES_STR1( S_NO_HELP_BUTTON, MethodString( nMethodId ) ) );
6685                                 break;
6686                             case M_Default:
6687                                 {
6688                                     WinBits Style = pControl->GetStyle();
6689                                     if      ( Style & WB_DEF_OK )
6690                                     {
6691                                         SET_WINP_CLOSING(pControl);
6692                                         pBD->EndDialog(RET_OK);
6693                                     }
6694                                     else if ( Style & WB_DEF_CANCEL )
6695                                     {
6696                                         SET_WINP_CLOSING(pControl);
6697                                         pBD->EndDialog(RET_CANCEL);
6698                                     }
6699                                     else if ( Style & WB_DEF_YES )
6700                                     {
6701                                         SET_WINP_CLOSING(pControl);
6702                                         pBD->EndDialog(RET_YES);
6703                                     }
6704                                     else if ( Style & WB_DEF_NO )
6705                                     {
6706                                         SET_WINP_CLOSING(pControl);
6707                                         pBD->EndDialog(RET_NO);
6708                                     }
6709                                     else if ( Style & WB_DEF_RETRY )
6710                                     {
6711                                         SET_WINP_CLOSING(pControl);
6712                                         pBD->EndDialog(RET_RETRY);
6713                                     }
6714                                     else
6715                                         ReportError( aUId, GEN_RES_STR1( S_NO_DEFAULT_BUTTON, MethodString( nMethodId ) ) );
6716                                 }
6717                                 break;
6718                             case M_GetText :
6719                                 pRet->GenReturn ( RET_Value, aUId, pControl->GetText());
6720                                 break;
6721                             case M_Click:
6722                                 if ( nParams & PARAM_USHORT_1 )
6723                                 {
6724                                     if ( pBD->GetPushButton( nNr1 ) )
6725                                     {
6726                                         if ( nNr1 != BUTTONID_HELP )
6727                                         {
6728                                             SET_WINP_CLOSING(pControl);
6729                                         }
6730                                         pBD->GetPushButton( nNr1 )->Click();
6731                                     }
6732                                     else
6733                                         ReportError( aUId, GEN_RES_STR2( S_NO_DEFAULT_BUTTON, UniString::CreateFromInt32( nNr1 ), MethodString( nMethodId ) ) );
6734                                 }
6735                                 else
6736                                     ReportError( aUId, GEN_RES_STR1( S_BUTTONID_REQUIRED, MethodString( nMethodId ) ) );
6737                                 break;
6738                             case M_GetButtonCount :
6739                                 pRet->GenReturn ( RET_Value, aUId, comm_ULONG(pBD->GetButtonCount()));
6740                                 break;
6741                             case M_GetButtonId :
6742                                 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pBD->GetButtonCount()) )
6743                                     pRet->GenReturn ( RET_Value, aUId, comm_ULONG(pBD->GetButtonId(nNr1-1)));
6744                                 break;
6745                             default:
6746                                 ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MessageBox" ) );
6747                                 break;
6748                         }
6749                         break;
6750                     }
6751                 default:
6752                     DBG_ERROR( "Unknown Objekttype from UId or Method not suported" );
6753                     ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) );
6754 #if OSL_DEBUG_LEVEL > 1
6755                     m_pDbgWin->AddText( " Unknown Objekttype from UId or Method not suported" );
6756 #endif
6757                     break;
6758             }
6759         }
6760         for( int i = 0; i < 32; i++ )
6761             SafeReschedule();
6762     }
6763 #if OSL_DEBUG_LEVEL > 1
6764     m_pDbgWin->AddText( "\n" );
6765 #endif
6766     if ( bStatementDone )
6767     {
6768         SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) );
6769         delete this;
6770     }
6771     else
6772     {
6773         if ( nRetryCount-- )
6774         {
6775 #if OSL_DEBUG_LEVEL > 1
6776             m_pDbgWin->AddText( CUniString("Reschedule command (requed) (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") );
6777 #endif
6778             QueStatement( this );   // will que at the start of the list
6779         }
6780         else
6781         {
6782             bStatementDone=sal_True;
6783         }
6784     }
6785     return bStatementDone;
6786 
6787 #define FINISH_NEXT
6788 #define FINISH_SAME
6789 
6790 }
6791