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