1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: statemnt.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_automation.hxx"
33 #include <com/sun/star/frame/XFramesSupplier.hpp>
34 #include <com/sun/star/frame/XDispatch.hpp>
35 #include <com/sun/star/frame/XDispatchProvider.hpp>
36 #include <com/sun/star/util/XURLTransformer.hpp>
37 #include <comphelper/processfactory.hxx>
38 #include <comphelper/uieventslogger.hxx>
40 #include <vcl/wintypes.hxx>
41 #ifndef _DIALOG_HXX //autogen
42 #include <vcl/dialog.hxx>
44 #ifndef _BUTTON_HXX //autogen
45 #include <vcl/button.hxx>
47 #include <vcl/menubtn.hxx>
48 #include <svtools/svtreebx.hxx>
49 #include <svtools/brwbox.hxx>
50 #ifndef _MSGBOX_HXX //autogen
51 #include <vcl/msgbox.hxx>
53 #ifndef _DOCKWIN_HXX //autogen
54 #include <vcl/dockwin.hxx>
56 #ifndef _FLOATWIN_HXX //autogen
57 #include <vcl/floatwin.hxx>
59 #ifndef _LSTBOX_HXX //autogen
60 #include <vcl/lstbox.hxx>
62 #ifndef _COMBOBOX_HXX //autogen
63 #include <vcl/combobox.hxx>
65 #ifndef _MOREBTN_HXX //autogen
66 #include <vcl/morebtn.hxx>
68 #ifndef _FIELD_HXX //autogen
69 #include <vcl/field.hxx>
71 #ifndef _TOOLBOX_HXX //autogen
72 #include <vcl/toolbox.hxx>
74 #include <vcl/tabctrl.hxx>
75 #include <vcl/tabpage.hxx>
76 #include <vcl/menu.hxx>
77 #include <vcl/status.hxx>
78 #include <svtools/prgsbar.hxx>
79 #include <svtools/editbrowsebox.hxx>
80 #include <vcl/splitwin.hxx>
81 #include <vcl/group.hxx>
82 #include <vcl/fixed.hxx>
83 #include <vcl/wrkwin.hxx>
84 #include <osl/diagnose.h>
85 #include <vcl/wintypes.hxx>
86 #include <svtools/valueset.hxx>
87 #include <svtools/roadmap.hxx>
88 #include <svtools/poolitem.hxx>
89 #include <svtools/extensionlistbox.hxx>
90 // Hat keinen Includeschutz
91 #include <svtools/svtdata.hxx>
92 #include <tools/time.hxx>
93 #include <svtools/stringtransfer.hxx>
94 #ifndef _PRINT_HXX //autogen
95 #include <vcl/print.hxx>
97 #ifndef _PRNDLG_HXX //autogen
98 #include <vcl/prndlg.hxx>
100 #include <tools/stream.hxx>
101 #ifndef _SV_DRAG_HXX //autogen
102 //#include <vcl/drag.hxx>
104 #include <tools/fsys.hxx>
105 #include <svtools/stritem.hxx>
106 #include <svtools/ttprops.hxx>
107 #ifndef _BASIC_TTRESHLP_HXX
108 #include <basic/ttstrhlp.hxx>
110 #include <basic/dispdefs.hxx>
111 #include <vos/socket.hxx>
112 #include <svtools/pickerhistory.hxx>
113 #include <com/sun/star/util/XCancellable.hpp>
115 #include <sot/storage.hxx>
116 #include <sot/storinfo.hxx>
117 #include "statemnt.hxx"
118 #include "scmdstrm.hxx"
121 #include "retstrm.hxx"
124 #if OSL_DEBUG_LEVEL > 1
125 #include "editwin.hxx"
127 #include "rcontrol.hxx"
128 #include <automation/communi.hxx>
129 #include "testtool.hxx"
131 #include "profiler.hxx"
133 #include "recorder.hxx"
135 #include "testtool.hrc"
136 #include <basic/svtmsg.hrc>
141 using namespace com::sun::star::frame
;
142 using namespace com::sun::star::uno
;
143 using namespace com::sun::star::util
;
144 using namespace com::sun::star::beans
;
148 #ifndef SBX_VALUE_DECL_DEFINED
149 #define SBX_VALUE_DECL_DEFINED
150 SV_DECL_REF(SbxValue
)
152 SV_IMPL_REF(SbxValue
)
154 CommunicationLink
*StatementFlow::pCommLink
= NULL
;
155 BOOL
StatementFlow::bUseIPC
= TRUE
;
156 BOOL
StatementFlow::bSending
= FALSE
;
157 ImplRemoteControl
*StatementFlow::pRemoteControl
= NULL
;
159 USHORT
StatementCommand::nDirPos
= 0;
160 Dir
*StatementCommand::pDir
= NULL
;
161 pfunc_osl_printDebugMessage
StatementCommand::pOriginal_osl_DebugMessageFunc
= NULL
;
164 #define RESET_APPLICATION_TO_BACKING_WINDOW
167 #define SET_WINP_CLOSING(pWin) \
168 pWindowWaitPointer = pWin; \
169 aWindowWaitUId = pControl->GetSmartUniqueOrHelpId(); \
170 aWindowWaitOldHelpId = pWin->GetSmartHelpId(); \
171 aWindowWaitOldUniqueId = pWin->GetSmartUniqueId(); \
172 pWin->SetSmartHelpId( SmartId(4321) ); \
173 pWin->SetSmartUniqueId( SmartId(1234) );
175 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
177 StatementFlow::StatementFlow( StatementList
*pAfterThis
, USHORT nArtP
)
185 QueStatement( pAfterThis
);
188 StatementFlow::StatementFlow( ULONG nServiceId
, SCmdStream
*pCmdIn
, ImplRemoteControl
*pRC
)
196 QueStatement( NULL
);
197 bUseIPC
= (nServiceId
== SI_IPCCommandBlock
);
198 pRemoteControl
= pRC
;
199 pCmdIn
->Read( nArt
);
200 pCmdIn
->Read( nParams
);
202 if( nParams
& PARAM_USHORT_1
) pCmdIn
->Read( nSNr1
);
203 if( nParams
& PARAM_ULONG_1
) pCmdIn
->Read( nLNr1
);
204 if( nParams
& PARAM_STR_1
) pCmdIn
->Read( aString1
);
205 if( nParams
& PARAM_BOOL_1
) pCmdIn
->Read( bBool1
); // sollte nie auftreten!!
207 #if OSL_DEBUG_LEVEL > 1
208 m_pDbgWin
->AddText( "Reading FlowControl: " );
209 m_pDbgWin
->AddText( String::CreateFromInt32( nArt
) );
210 m_pDbgWin
->AddText( " Params:" );
211 if( nParams
& PARAM_USHORT_1
) {m_pDbgWin
->AddText( " n1:" );m_pDbgWin
->AddText( String::CreateFromInt32( nSNr1
) );}
212 if( nParams
& PARAM_ULONG_1
) {m_pDbgWin
->AddText( " l1:" );m_pDbgWin
->AddText( String::CreateFromInt64( nLNr1
) );}
213 if( nParams
& PARAM_STR_1
) {m_pDbgWin
->AddText( " s1:" );m_pDbgWin
->AddText( aString1
);}
214 if( nParams
& PARAM_BOOL_1
) {m_pDbgWin
->AddText( " b2:" );m_pDbgWin
->AddText( bBool1
? "TRUE" : "FALSE" );}
215 m_pDbgWin
->AddText( "\n" );
219 void StatementFlow::SendViaSocket()
223 #if OSL_DEBUG_LEVEL > 1
224 m_pDbgWin
->AddText( "SendViaSocket called recursively. Aborted!!!\n" );
226 DBG_ERROR("SendViaSocket called recursively. Aborted!!!");
232 if ( !pCommLink
->TransferDataStream( pRet
->GetStream() ) ) // tritt ein Fehler auf, so wird sofort gelöscht ...
237 // Macht nix. Wenn das Basic nicht mehr da ist, ist sowiso alles egal
238 DBG_ERROR("Cannot send results to TestTool");
246 BOOL
StatementFlow::Execute()
248 #if OSL_DEBUG_LEVEL > 1
249 m_pDbgWin
->AddText( "Executing Flow: " );
250 m_pDbgWin
->AddText( String::CreateFromInt32( nArt
) );
251 m_pDbgWin
->AddText( "\n" );
255 case F_EndCommandBlock
:
260 // bBool1 wurde im CTOR auf FALSE initialisiert
261 if ( !bBool1
) // also erster Durchlauf
263 pRemoteControl
->pRetStream
= pRet
->GetStream();
264 bBool1
= TRUE
; // wurde im CTOR auf FALSE initialisiert
265 nRetryCount
= nRetryCount
* 4;
267 if ( pRemoteControl
->pRetStream
&& (nRetryCount
--) ) // also solange nicht abgeholt
269 return FALSE
; // Bitte einmal vom Callstack runter
280 case F_EndCommandBlock
:
282 { // wird oben abgehandelt
293 pRet
->GenReturn(RET_Sequence
,nLNr1
);
294 #if OSL_DEBUG_LEVEL > 1
295 m_pDbgWin
->AddText( "Sending Sequence Nr: " );
296 m_pDbgWin
->AddText( String::CreateFromInt64( nLNr1
) );
297 m_pDbgWin
->AddText( "\n" );
303 DBG_ERROR( "Unknown Flowcontrol" );
311 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
313 // neue Hilfsfunktion, die stetig erweitert werden muss
314 static short ImpGetRType( Window
*pWin
, SmartId aUId
)
316 ULONG nUId
= aUId
.GetNum(); // GetNum() is always zero if no num is defined
317 // GGGg gggg::gggg gggg::ggLL LLLl::llll llll
318 DBG_ASSERT( pWin
, "missing Parameter" );
320 if( (nUId
& 0xE0000000) == 0 ) // keine auto ID
323 // if( (nUId & 0x1F) == 0 ) // globale Resource
324 if( (nUId
& 0x1FF) == 0 ) // globale Resource GH: soweit ich das verstanden habe 1FF
325 nRT
= (short)(C_TabPage
- 1 + (nUId
>> 29));
327 nRT
= (short)((nUId
& 0x00003E00) >> 9);
328 if ( nRT
== C_TabPage
) // wegen TabDialog.UId = TabPage.UId
341 WindowType eRT
= pWin
->GetType();
343 case WINDOW_WINDOW
: nRT
= C_Window
; break;
345 case WINDOW_TABCONTROL
: nRT
= C_TabControl
; break;
346 case WINDOW_RADIOBUTTON
: nRT
= C_RadioButton
; break;
347 case WINDOW_CHECKBOX
: nRT
= C_CheckBox
; break;
348 case WINDOW_TRISTATEBOX
: nRT
= C_TriStateBox
; break;
349 case WINDOW_EDIT
: nRT
= C_Edit
; break;
350 case WINDOW_MULTILINEEDIT
: nRT
= C_MultiLineEdit
; break;
351 case WINDOW_MULTILISTBOX
: nRT
= C_MultiListBox
; break;
352 case WINDOW_LISTBOX
: nRT
= C_ListBox
; break;
353 case WINDOW_COMBOBOX
: nRT
= C_ComboBox
; break;
354 case WINDOW_PUSHBUTTON
: nRT
= C_PushButton
; break;
355 case WINDOW_SPINFIELD
: nRT
= C_SpinField
; break;
356 case WINDOW_PATTERNFIELD
: nRT
= C_PatternField
; break;
357 case WINDOW_NUMERICFIELD
: nRT
= C_NumericField
; break;
358 case WINDOW_METRICFIELD
: nRT
= C_MetricField
; break;
359 case WINDOW_CURRENCYFIELD
: nRT
= C_CurrencyField
; break;
360 case WINDOW_DATEFIELD
: nRT
= C_DateField
; break;
361 case WINDOW_TIMEFIELD
: nRT
= C_TimeField
; break;
362 case WINDOW_IMAGERADIOBUTTON
: nRT
= C_ImageRadioButton
; break;
363 case WINDOW_NUMERICBOX
: nRT
= C_NumericBox
; break;
364 case WINDOW_METRICBOX
: nRT
= C_MetricBox
; break;
365 case WINDOW_CURRENCYBOX
: nRT
= C_CurrencyBox
; break;
366 case WINDOW_DATEBOX
: nRT
= C_DateBox
; break;
367 case WINDOW_TIMEBOX
: nRT
= C_TimeBox
; break;
368 case WINDOW_IMAGEBUTTON
: nRT
= C_ImageButton
; break;
369 case WINDOW_MENUBUTTON
: nRT
= C_MenuButton
; break;
370 case WINDOW_MOREBUTTON
: nRT
= C_MoreButton
; break;
373 case WINDOW_TABPAGE
: nRT
= C_TabPage
; break;
374 case WINDOW_MODALDIALOG
: nRT
= C_ModalDlg
; break;
375 case WINDOW_FLOATINGWINDOW
: nRT
= C_FloatWin
; break;
376 case WINDOW_MODELESSDIALOG
: nRT
= C_ModelessDlg
; break;
377 case WINDOW_WORKWINDOW
: nRT
= C_WorkWin
; break;
378 case WINDOW_DOCKINGWINDOW
: nRT
= C_DockingWin
; break;
380 case WINDOW_MESSBOX
: nRT
= C_MessBox
; break;
381 case WINDOW_INFOBOX
: nRT
= C_InfoBox
; break;
382 case WINDOW_WARNINGBOX
: nRT
= C_WarningBox
; break;
383 case WINDOW_ERRORBOX
: nRT
= C_ErrorBox
; break;
384 case WINDOW_QUERYBOX
: nRT
= C_QueryBox
; break;
386 case WINDOW_FILEDIALOG
: nRT
= C_FileDlg
; break;
387 case WINDOW_PATHDIALOG
: nRT
= C_PathDlg
; break;
388 case WINDOW_PRINTDIALOG
: nRT
= C_PrintDlg
; break;
389 case WINDOW_PRINTERSETUPDIALOG
: nRT
= C_PrinterSetupDlg
;break;
390 case WINDOW_COLORDIALOG
: nRT
= C_ColorDlg
; break;
392 case WINDOW_TABDIALOG
: nRT
= C_TabDlg
; break;
393 // case WINDOW_TABDIALOG: nRT = C_SingleTabDlg; break;
395 case WINDOW_PATTERNBOX
: nRT
= C_PatternBox
; break;
396 case WINDOW_TOOLBOX
: nRT
= C_ToolBox
; break;
397 // Gibts nicht case WINDOW_VALUESET: nRT = C_ValueSet; break;
398 case WINDOW_CONTROL
: nRT
= C_Control
; break;
399 case WINDOW_OKBUTTON
: nRT
= C_OkButton
; break;
400 case WINDOW_CANCELBUTTON
: nRT
= C_CancelButton
; break;
401 case WINDOW_BUTTONDIALOG
: nRT
= C_ButtonDialog
; break;
402 case WINDOW_TREELISTBOX
: nRT
= C_TreeListBox
; break;
404 case WINDOW_DIALOG
: nRT
= C_Dialog
; break;
407 // Die Werte n sind bei den WindowTypen nicht mehr vergeben, werden aber in der AutoID noch verwendet
408 // Sie werden jetzt durch den Typ nRT implementiert.
409 DBG_ASSERT( n
== C_NoType
|| n
== nRT
410 || ( n
== C_ImageButton
&& nRT
== C_PushButton
)
411 || ( n
== C_TriStateBox
&& nRT
== C_CheckBox
)
412 || ( n
== C_ImageRadioButton
&& nRT
== C_RadioButton
)
413 , "error in algorithm" );
418 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
420 StatementSlot::StatementSlot( SCmdStream
*pCmdIn
)
423 QueStatement( NULL
);
424 pCmdIn
->Read( nFunctionId
);
425 #if OSL_DEBUG_LEVEL > 1
426 m_pDbgWin
->AddText( "Reading Slot: " );
427 m_pDbgWin
->AddText( String::CreateFromInt32( nFunctionId
) );
428 m_pDbgWin
->AddText( "\n" );
430 pCmdIn
->Read( nAnzahl
);
433 switch ( pCmdIn
->GetNextType() )
435 case BinUSHORT
: // use old calling method
438 pItemArr
= new SfxPoolItem
*[nAnzahl
];
439 for (USHORT i
= 0 ; i
+1 < nAnzahl
; i
++)
440 pCmdIn
->Read( pItemArr
[i
] );
441 pItemArr
[nAnzahl
-1] = NULL
;
444 case BinString
: // new Method
446 aArgs
.realloc(nAnzahl
);
447 PropertyValue
* pArg
= aArgs
.getArray();
448 for (USHORT i
= 0 ; i
< nAnzahl
; i
++)
449 pCmdIn
->Read( pArg
[i
] );
456 // Constructor for UnoSlot
457 StatementSlot::StatementSlot()
464 StatementSlot::StatementSlot( ULONG nSlot
, SfxPoolItem
* pItem
)
468 QueStatement( NULL
);
469 nFunctionId
= USHORT(nSlot
);
470 #if OSL_DEBUG_LEVEL > 1
471 m_pDbgWin
->AddText( "Reading Slot: " );
472 m_pDbgWin
->AddText( String::CreateFromInt32( nFunctionId
) );
473 m_pDbgWin
->AddText( "\n" );
478 pItemArr
= new SfxPoolItem
*[2];
486 StatementSlot::~StatementSlot()
492 for (USHORT i
= 0 ; i
+1 < nAnzahl
; i
++)
501 void StatementSlot::AddReferer()
503 HACK( "only to test!" );
504 // because slot 6102 /*SID_VERB_START*/ crashes when called with Property Referer
505 // We return to the previous behavior (which was a bug realy) of not adding this Property to calls which have no properties at all
506 // according to MBA most likely this Property can be removed at all and is maybe only needed for Slots with URLs
513 aArgs
.realloc(nAnzahl
);
514 pArg
= aArgs
.getArray();
515 pArg
[nAnzahl
-1].Name
= rtl::OUString::createFromAscii("Referer");
516 pArg
[nAnzahl
-1].Value
<<= ::rtl::OUString::createFromAscii("private:user");
519 aArgs
.realloc(nAnzahl
);
520 pArg
= aArgs
.getArray();
521 pArg
[nAnzahl
-1].Name
= rtl::OUString::createFromAscii("SynchronMode");
522 pArg
[nAnzahl
-1].Value
<<= sal_Bool( TRUE
);
525 class SlotStatusListener
: public cppu::WeakImplHelper1
< XStatusListener
>
528 SlotStatusListener();
531 virtual void SAL_CALL
statusChanged( const ::com::sun::star::frame::FeatureStateEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
533 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
540 struct FeatureStateEvent : public ::com::sun::star::lang::EventObject
541 ::com::sun::star::util::URL FeatureURL;
542 ::rtl::OUString FeatureDescriptor;
545 ::com::sun::star::uno::Any State;
547 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > Source;
550 SlotStatusListener::SlotStatusListener()
556 void SAL_CALL
SlotStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
)
558 // DBG_ERROR1("FeatureURL: %s", ByteString( String( Event.FeatureURL.Complete ), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
559 // DBG_ERROR1("FeatureDescriptor: %s", ByteString( String( Event.FeatureDescriptor ), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
560 bEnabled
= Event
.IsEnabled
;
561 // DBG_ASSERT( Event.IsEnabled, "Not enabled" );
562 // DBG_ASSERT( !Event.Requery, "Requery" );
566 void SAL_CALL
SlotStatusListener::disposing( const ::com::sun::star::lang::EventObject
& ) throw (::com::sun::star::uno::RuntimeException
)
571 BOOL
StatementSlot::Execute()
575 #if OSL_DEBUG_LEVEL > 1
576 m_pDbgWin
->AddText( "Skipping Slot: " );
577 m_pDbgWin
->AddText( String::CreateFromInt32( nFunctionId
) );
578 m_pDbgWin
->AddText( "\n" );
587 #if OSL_DEBUG_LEVEL > 1
588 m_pDbgWin
->AddText( "Executing Slot: " );
589 m_pDbgWin
->AddText( String::CreateFromInt32( nFunctionId
) );
590 m_pDbgWin
->AddText( "\n" );
593 PopupMenu
*pPopup
= NULL
;
594 MenuBar
*pMenuBar
= NULL
;
597 GetCurrentMenues( pPopup
, pMenuBar
, pMenu
);
602 pPopup
->EndExecute(0);
603 aSubMenuId1
= SmartId();
604 aSubMenuId2
= SmartId();
605 aSubMenuId3
= SmartId();
608 #if OSL_DEBUG_LEVEL > 1
609 m_pDbgWin
->AddText( "Closed contextmenu\n" );
613 else if ( nRetryCount
-- )
615 #if OSL_DEBUG_LEVEL > 1
616 m_pDbgWin
->AddText( "Waiting for contextmenu to close\n" );
621 ReportError( GEN_RES_STR0( S_MENU_NOT_CLOSING
) );
628 if ( ( nAnzahl
== 0 && !getenv("OLDSLOTHANDLING") ) || aArgs
.hasElements() )
629 { // trying to call slots via uno
631 if ( !aUnoUrl
.Len() )
632 aUnoUrl
= CUniString("slot:").Append( String::CreateFromInt32( nFunctionId
) );
634 aTargetURL
.Complete
= aUnoUrl
;
635 Reference
< XFramesSupplier
> xDesktop
= Reference
< XFramesSupplier
>( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.frame.Desktop") ), UNO_QUERY
);
636 Reference
< XFrame
> xFrame
;
640 xFrame
= xDesktop
->getActiveFrame();
643 Reference
< XFrames
> xFrames
;
644 xFrames
= xDesktop
->getFrames();
645 if ( xFrames
.is() && xFrames
->getCount() > 0 )
647 Any aFrame
= xFrames
->getByIndex( xFrames
->getCount() -1 );
653 if ( GetFirstDocFrame() )
654 GetFirstDocFrame()->ToTop();
655 xFrame
= xDesktop
->getActiveFrame();
660 xDesktop
= Reference
< XFramesSupplier
>( xFrame
, UNO_QUERY
);
664 while ( xDesktop
.is() && xDesktop
->getActiveFrame().is() )
666 xFrame
= xDesktop
->getActiveFrame();
667 #if OSL_DEBUG_LEVEL > 1
668 ::rtl::OUString aName
;
670 aName
= xFrame
->getName();
672 xDesktop
= Reference
< XFramesSupplier
>( xFrame
, UNO_QUERY
);
676 ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_FRAME
, aTargetURL
.Complete
) );
679 Reference
< XURLTransformer
> xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY
);
680 xTrans
->parseStrict( aTargetURL
);
682 Reference
< XDispatchProvider
> xProv( xFrame
, UNO_QUERY
);
683 Reference
< XDispatch
> xDisp
;
684 while ( xProv
.is() && !xDisp
.is() )
686 xDisp
= xProv
->queryDispatch( aTargetURL
, ::rtl::OUString(), 0 );
689 xFrame
= Reference
< XFrame
> ( xFrame
->getCreator(), UNO_QUERY
);
690 xProv
= Reference
< XDispatchProvider
> ( xFrame
, UNO_QUERY
);
696 Reference
< XStatusListener
> xListener
= ( XStatusListener
* )new SlotStatusListener
;
697 xDisp
->addStatusListener( xListener
, aTargetURL
);
698 if ( static_cast< SlotStatusListener
* >(xListener
.get())->bEnabled
)
700 if ( bIsSlotInExecute
)
701 ReportError( GEN_RES_STR0( S_SLOT_IN_EXECUTE
) );
704 bIsSlotInExecute
= TRUE
;
705 xDisp
->dispatch( aTargetURL
, aArgs
);
706 bIsSlotInExecute
= FALSE
;
710 ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_DISABLED
, aTargetURL
.Complete
) );
711 xDisp
->removeStatusListener( xListener
, aTargetURL
);
714 ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_DISPATCHER
, aTargetURL
.Complete
) );
719 DirectLog( S_QAError
, GEN_RES_STR0( S_DEPRECATED
) );
720 if ( !pTTProperties
)
721 pTTProperties
= new TTProperties();
723 switch ( pTTProperties
->ExecuteFunction( nFunctionId
, pItemArr
, EXECUTEMODE_DIALOGASYNCHRON
| nUseBindings
) )
725 case TT_PR_ERR_NODISPATCHER
:
727 ReportError( SmartId(nFunctionId
), GEN_RES_STR0( S_SID_EXECUTE_FAILED_NO_DISPATCHER
) );
730 case TT_PR_ERR_NOEXECUTE
:
732 ReportError(SmartId(nFunctionId
), GEN_RES_STR0( S_SID_EXECUTE_FAILED
) );
740 /* Neues Verfahren ab 334!
741 Neue Methode zum einstellen, daß Modale Dialoge immer Asynchron aufgerufen werden
742 und echter Returnwert, ob Slot geklappt hat
743 und Testen ob Slot überhaupt durch UI aufgerufen werden kann */
746 SendProfile( SlotString( nFunctionId
) );
751 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
753 StatementUnoSlot::StatementUnoSlot(SCmdStream
*pIn
)
755 QueStatement( NULL
);
757 pIn
->Read( aUnoUrl
);
759 #if OSL_DEBUG_LEVEL > 1
760 StatementList::m_pDbgWin
->AddText( "UnoUrl:" );
761 StatementList::m_pDbgWin
->AddText( aUnoUrl
);
762 StatementList::m_pDbgWin
->AddText( "\n" );
767 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
769 StatementCommand::StatementCommand( StatementList
*pAfterThis
, USHORT MethodId
, USHORT Params
, USHORT Nr1
)
770 : nMethodId( MethodId
)
783 QueStatement( pAfterThis
);
784 aSmartMethodId
= SmartId( nMethodId
);
786 #if OSL_DEBUG_LEVEL > 1
787 m_pDbgWin
->AddText( "Directly adding Conmmand:" );
788 m_pDbgWin
->AddText( " Methode: " );
789 m_pDbgWin
->AddText( aSmartMethodId
.GetText() );
790 m_pDbgWin
->AddText( " Params:" );
791 if( nParams
& PARAM_USHORT_1
) {m_pDbgWin
->AddText( " n1:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr1
) );}
792 if( nParams
& PARAM_USHORT_2
) {m_pDbgWin
->AddText( " n2:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr2
) );}
793 if( nParams
& PARAM_USHORT_3
) {m_pDbgWin
->AddText( " n3:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr3
) );}
794 if( nParams
& PARAM_USHORT_4
) {m_pDbgWin
->AddText( " n4:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr4
) );}
795 if( nParams
& PARAM_ULONG_1
) {m_pDbgWin
->AddText( " nl1:" );m_pDbgWin
->AddText( String::CreateFromInt64( nLNr1
) );}
796 if( nParams
& PARAM_STR_1
) {m_pDbgWin
->AddText( " s1:" );m_pDbgWin
->AddText( aString1
);}
797 if( nParams
& PARAM_STR_2
) {m_pDbgWin
->AddText( " s2:" );m_pDbgWin
->AddText( aString2
);}
798 if( nParams
& PARAM_BOOL_1
) {m_pDbgWin
->AddText( " b1:" );m_pDbgWin
->AddText( bBool1
? "TRUE" : "FALSE" );}
799 if( nParams
& PARAM_BOOL_2
) {m_pDbgWin
->AddText( " b2:" );m_pDbgWin
->AddText( bBool2
? "TRUE" : "FALSE" );}
800 m_pDbgWin
->AddText( "\n" );
805 StatementCommand::StatementCommand( SCmdStream
*pCmdIn
)
819 QueStatement( NULL
);
820 pCmdIn
->Read( nMethodId
);
821 aSmartMethodId
= SmartId( nMethodId
);
822 pCmdIn
->Read( nParams
);
824 if( nParams
& PARAM_USHORT_1
) pCmdIn
->Read( nNr1
);
825 if( nParams
& PARAM_USHORT_2
) pCmdIn
->Read( nNr2
);
826 if( nParams
& PARAM_USHORT_3
) pCmdIn
->Read( nNr3
);
827 if( nParams
& PARAM_USHORT_4
) pCmdIn
->Read( nNr4
);
828 if( nParams
& PARAM_ULONG_1
) pCmdIn
->Read( nLNr1
);
829 if( nParams
& PARAM_STR_1
) pCmdIn
->Read( aString1
);
830 if( nParams
& PARAM_STR_2
) pCmdIn
->Read( aString2
);
831 if( nParams
& PARAM_BOOL_1
) pCmdIn
->Read( bBool1
);
832 if( nParams
& PARAM_BOOL_2
) pCmdIn
->Read( bBool2
);
834 #if OSL_DEBUG_LEVEL > 1
835 m_pDbgWin
->AddText( "Reading Conmmand:" );
836 m_pDbgWin
->AddText( " Methode: " );
837 m_pDbgWin
->AddText( aSmartMethodId
.GetText() );
838 m_pDbgWin
->AddText( " Params:" );
839 if( nParams
& PARAM_USHORT_1
) {m_pDbgWin
->AddText( " n1:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr1
) );}
840 if( nParams
& PARAM_USHORT_2
) {m_pDbgWin
->AddText( " n2:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr2
) );}
841 if( nParams
& PARAM_USHORT_3
) {m_pDbgWin
->AddText( " n3:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr3
) );}
842 if( nParams
& PARAM_USHORT_4
) {m_pDbgWin
->AddText( " n4:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr4
) );}
843 if( nParams
& PARAM_ULONG_1
) {m_pDbgWin
->AddText( " nl1:" );m_pDbgWin
->AddText( String::CreateFromInt64( nLNr1
) );}
844 if( nParams
& PARAM_STR_1
) {m_pDbgWin
->AddText( " s1:" );m_pDbgWin
->AddText( aString1
);}
845 if( nParams
& PARAM_STR_2
) {m_pDbgWin
->AddText( " s2:" );m_pDbgWin
->AddText( aString2
);}
846 if( nParams
& PARAM_BOOL_1
) {m_pDbgWin
->AddText( " b1:" );m_pDbgWin
->AddText( bBool1
? "TRUE" : "FALSE" );}
847 if( nParams
& PARAM_BOOL_2
) {m_pDbgWin
->AddText( " b2:" );m_pDbgWin
->AddText( bBool2
? "TRUE" : "FALSE" );}
848 m_pDbgWin
->AddText( "\n" );
851 if ( nMethodId
== RC_AppAbort
)
853 #if OSL_DEBUG_LEVEL > 1
854 m_pDbgWin
->AddText( "*Deleting all Commands:\n" );
856 bReadingCommands
= FALSE
;
857 while ( StatementList::pFirst
!= this ) // Alles Löschen außer mich selbst
859 StatementList
*pDeQue
= StatementList::pFirst
;
863 bReadingCommands
= TRUE
;
864 #if OSL_DEBUG_LEVEL > 1
865 m_pDbgWin
->AddText( "*Done deleting all Commands:\n" );
871 void StatementCommand::WriteControlData( Window
*pBase
, ULONG nConf
, BOOL bFirst
)
874 if ( IsDialog(pBase
) && !bFirst
)
878 pRet
->GenReturn ( RET_WinInfo
, SmartId(), (comm_ULONG
)nConf
| DH_MODE_DATA_VALID
, UniString(), TRUE
);
880 { // Klammerung, so daß der String nicht während der Rekursion bestehen bleibt
884 switch ( pBase
->GetType() )
886 case WINDOW_RADIOBUTTON
:
887 case WINDOW_CHECKBOX
:
888 case WINDOW_TRISTATEBOX
:
889 case WINDOW_PUSHBUTTON
:
890 case WINDOW_OKBUTTON
:
891 case WINDOW_CANCELBUTTON
:
892 case WINDOW_IMAGERADIOBUTTON
:
893 case WINDOW_IMAGEBUTTON
:
894 case WINDOW_MENUBUTTON
:
895 case WINDOW_MOREBUTTON
:
897 case WINDOW_MODALDIALOG
:
898 case WINDOW_FLOATINGWINDOW
:
899 case WINDOW_MODELESSDIALOG
:
900 case WINDOW_WORKWINDOW
:
901 case WINDOW_DOCKINGWINDOW
:
904 case WINDOW_FILEDIALOG
:
905 case WINDOW_PATHDIALOG
:
906 case WINDOW_PRINTDIALOG
:
907 case WINDOW_PRINTERSETUPDIALOG
:
908 case WINDOW_COLORDIALOG
:
909 case WINDOW_TABDIALOG
:
911 case WINDOW_BUTTONDIALOG
:
913 case WINDOW_MENUBARWINDOW
:
914 aName
= pBase
->GetText().EraseAllChars('~');
918 case WINDOW_MULTILINEEDIT
:
919 case WINDOW_MULTILISTBOX
:
921 case WINDOW_COMBOBOX
:
922 case WINDOW_SPINFIELD
:
923 case WINDOW_PATTERNFIELD
:
924 case WINDOW_NUMERICFIELD
:
925 case WINDOW_METRICFIELD
:
926 case WINDOW_CURRENCYFIELD
:
927 case WINDOW_DATEFIELD
:
928 case WINDOW_TIMEFIELD
:
929 case WINDOW_NUMERICBOX
:
930 case WINDOW_METRICBOX
:
931 case WINDOW_CURRENCYBOX
:
934 case WINDOW_PATTERNBOX
:
936 aName
= pBase
->GetQuickHelpText();
941 case WINDOW_WARNINGBOX
:
942 case WINDOW_ERRORBOX
:
943 case WINDOW_QUERYBOX
:
944 aName
= ((MessBox
*)pBase
)->GetMessText();
948 if ( pBase
->GetSmartUniqueOrHelpId().Equals( SmartId() ) && !( nConf
& DH_MODE_ALLWIN
) )
954 if ( aName
.Len() == 0 )
955 aName
= pBase
->GetQuickHelpText();
956 if ( aName
.Len() == 0 )
957 aName
= pBase
->GetHelpText();
958 if ( aName
.Len() == 0 )
959 aName
= pBase
->GetText();
963 if ( pBase
->GetType() == WINDOW_CONTROL
)
965 if ( dynamic_cast< EditBrowseBox
* >(pBase
) )
966 aTypeSuffix
.AppendAscii( "/BrowseBox", 10 );
967 else if ( dynamic_cast< ValueSet
* >(pBase
) )
968 aTypeSuffix
.AppendAscii( "/ValueSet", 9 );
969 else if ( dynamic_cast< ORoadmap
* >(pBase
) )
970 aTypeSuffix
.AppendAscii( "/RoadMap", 8 );
971 else if ( dynamic_cast< IExtensionListBox
* >(pBase
) )
972 aTypeSuffix
.AppendAscii( "/ExtensionListBox" );
974 aTypeSuffix
.AppendAscii( "/Unknown", 8 );
977 SmartId aId
= pBase
->GetSmartUniqueOrHelpId();
978 if ( aId
.HasString() || ( nConf
& DH_MODE_ALLWIN
) )
979 pRet
->GenReturn ( RET_WinInfo
, SmartId( aId
.GetStr() ), (comm_ULONG
)pBase
->GetType(),
980 TypeString(pBase
->GetType()).Append(aTypeSuffix
).AppendAscii(": ").Append(aName
), FALSE
);
981 if ( !aId
.HasString() || ( nConf
& DH_MODE_ALLWIN
) )
982 pRet
->GenReturn ( RET_WinInfo
, SmartId( aId
.GetNum() ), (comm_ULONG
)pBase
->GetType(),
983 TypeString(pBase
->GetType()).Append(aTypeSuffix
).AppendAscii(": ").Append(aName
), FALSE
);
986 if ( pBase
->GetType() == WINDOW_TOOLBOX
) // Buttons und Controls auf Toolboxen.
988 ToolBox
*pTB
= ((ToolBox
*)pBase
);
990 for ( i
= 0; i
< pTB
->GetItemCount() ; i
++ )
993 // if ( aName.Len() == 0 )
994 // aName = pTB->GetQuickHelpText();
995 if ( aName
.Len() == 0 )
996 aName
= pTB
->GetHelpText( pTB
->GetItemId( i
) );
997 if ( aName
.Len() == 0 )
998 aName
= pTB
->GetItemText( pTB
->GetItemId( i
) );
1001 pItemWin
= pTB
->GetItemWindow( pTB
->GetItemId( i
) );
1002 if ( pTB
->GetItemType( i
) == TOOLBOXITEM_BUTTON
&& ( !pItemWin
|| !pItemWin
->IsVisible() ) )
1004 if ( pTB
->GetItemCommand(pTB
->GetItemId( i
)).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1005 pRet
->GenReturn ( RET_WinInfo
, SmartId( pTB
->GetItemCommand(pTB
->GetItemId( i
)) ), (comm_ULONG
)WINDOW_BUTTON
,
1006 TypeString(WINDOW_BUTTON
).AppendAscii(": ").Append(aName
), FALSE
);
1007 if ( !pTB
->GetItemCommand(pTB
->GetItemId( i
)).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1008 pRet
->GenReturn ( RET_WinInfo
, SmartId( pTB
->GetHelpId(pTB
->GetItemId( i
)) ), (comm_ULONG
)WINDOW_BUTTON
,
1009 TypeString(WINDOW_BUTTON
).AppendAscii(": ").Append(aName
), FALSE
);
1015 if ( pTB
->GetItemCommand(pTB
->GetItemId( i
)).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1016 pRet
->GenReturn ( RET_WinInfo
, SmartId( pTB
->GetItemCommand(pTB
->GetItemId( i
)) ), (comm_ULONG
)pItemWin
->GetType(),
1017 TypeString(pItemWin
->GetType()).AppendAscii(": ").Append(aName
), FALSE
);
1018 if ( !pTB
->GetItemCommand(pTB
->GetItemId( i
)).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1019 pRet
->GenReturn ( RET_WinInfo
, SmartId( pTB
->GetHelpId(pTB
->GetItemId( i
)) ), (comm_ULONG
)pItemWin
->GetType(),
1020 TypeString(pItemWin
->GetType()).AppendAscii(": ").Append(aName
), FALSE
);
1022 for( ii
= 0 ; ii
< pItemWin
->GetChildCount(); ii
++ )
1023 WriteControlData( pItemWin
->GetChild(ii
), nConf
, FALSE
);
1027 if ( nConf
& DH_MODE_ALLWIN
)
1029 String aToolBoxItemType
;
1030 switch ( pTB
->GetItemType( i
) )
1032 case TOOLBOXITEM_DONTKNOW
:
1033 aToolBoxItemType
.AssignAscii("TOOLBOXITEM_DONTKNOW");
1035 case TOOLBOXITEM_BUTTON
:
1036 aToolBoxItemType
.AssignAscii("TOOLBOXITEM_BUTTON");
1038 case TOOLBOXITEM_SPACE
:
1039 aToolBoxItemType
.AssignAscii("TOOLBOXITEM_SPACE");
1041 case TOOLBOXITEM_SEPARATOR
:
1042 aToolBoxItemType
.AssignAscii("TOOLBOXITEM_SEPARATOR");
1044 case TOOLBOXITEM_BREAK
:
1045 aToolBoxItemType
.AssignAscii("TOOLBOXITEM_BREAK");
1048 DBG_ERROR1( "Unknown TOOLBOXITEM %i", pTB
->GetItemType( i
) );
1050 if ( pTB
->GetItemCommand(pTB
->GetItemId( i
)).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1051 pRet
->GenReturn ( RET_WinInfo
, SmartId( pTB
->GetItemCommand(pTB
->GetItemId( i
)) ), (comm_ULONG
)WINDOW_BASE
,
1052 aToolBoxItemType
.AppendAscii(": ").Append(aName
), FALSE
);
1053 if ( !pTB
->GetItemCommand(pTB
->GetItemId( i
)).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1054 pRet
->GenReturn ( RET_WinInfo
, SmartId( pTB
->GetHelpId(pTB
->GetItemId( i
)) ), (comm_ULONG
)WINDOW_BASE
,
1055 aToolBoxItemType
.AppendAscii(": ").Append(aName
), FALSE
);
1061 return; // ToolBox ist hier schon komplett abgehandelt.
1065 if ( pBase
->GetType() == WINDOW_BUTTONDIALOG
// Buttons auf Buttondialogen mit ID
1066 || pBase
->GetType() == WINDOW_MESSBOX
1067 || pBase
->GetType() == WINDOW_INFOBOX
1068 || pBase
->GetType() == WINDOW_WARNINGBOX
1069 || pBase
->GetType() == WINDOW_ERRORBOX
1070 || pBase
->GetType() == WINDOW_QUERYBOX
)
1072 ButtonDialog
*pBD
= ((ButtonDialog
*)pBase
);
1074 for ( i
= 0; i
< pBD
->GetButtonCount() ; i
++ )
1077 if ( aName
.Len() == 0 )
1078 aName
= pBD
->GetPushButton( pBD
->GetButtonId(i
) )->GetText();
1080 switch ( pBD
->GetButtonId(i
) )
1083 aID
.AssignAscii("Ok");
1085 case BUTTONID_CANCEL
:
1086 aID
.AssignAscii("Cancel");
1089 aID
.AssignAscii("Yes");
1092 aID
.AssignAscii("No");
1094 case BUTTONID_RETRY
:
1095 aID
.AssignAscii("Retry");
1098 aID
.AssignAscii("Help");
1101 aID
= UniString::CreateFromInt32( pBD
->GetButtonId(i
) );
1105 pRet
->GenReturn ( RET_WinInfo
, SmartId( aID
), (comm_ULONG
)pBD
->GetPushButton( pBD
->GetButtonId(i
) )->GetType(), // So daß der Text angezeigt wird!
1106 TypeString(pBD
->GetPushButton( pBD
->GetButtonId(i
) )->GetType()).AppendAscii(": ").Append(aName
)
1107 .AppendAscii(" ButtonId = ").Append(aID
), FALSE
);
1110 return; // ButtonDialog ist hier schon komplett abgehandelt.
1114 Menu
* pMenu
= GetMatchingMenu( pBase
);
1116 if ( pMenu
) // Menus
1119 for ( i
= 0; i
< pMenu
->GetItemCount() ; i
++ )
1121 USHORT nID
= pMenu
->GetItemId( i
);
1124 if ( aName
.Len() == 0 )
1125 aName
= pMenu
->GetHelpText( nID
);
1126 if ( aName
.Len() == 0 )
1127 aName
= pMenu
->GetItemText( nID
);
1130 if ( pMenu
->GetItemType( i
) == MENUITEM_STRING
|| pMenu
->GetItemType( i
) == MENUITEM_IMAGE
|| pMenu
->GetItemType( i
) == MENUITEM_STRINGIMAGE
|| (nConf
& DH_MODE_ALLWIN
) )
1132 String aMenuItemType
;
1133 switch ( pMenu
->GetItemType( i
) )
1135 case MENUITEM_STRING
:
1136 aMenuItemType
.AssignAscii("MENUITEM_STRING");
1138 case MENUITEM_STRINGIMAGE
:
1139 aMenuItemType
.AssignAscii("MENUITEM_STRINGIMAGE");
1141 case MENUITEM_IMAGE
:
1142 aMenuItemType
.AssignAscii("MENUITEM_IMAGE");
1144 case MENUITEM_SEPARATOR
:
1145 aMenuItemType
.AssignAscii("MENUITEM_SEPARATOR");
1147 case MENUITEM_DONTKNOW
:
1148 aMenuItemType
.AssignAscii("MENUITEM_DONTKNOW");
1151 DBG_ERROR1( "Unknown MENUITEM %i", pMenu
->GetItemType( i
) );
1153 if ( pMenu
->GetItemCommand(nID
).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1154 pRet
->GenReturn ( RET_WinInfo
, SmartId( pMenu
->GetItemCommand(nID
) ), (comm_ULONG
)0,
1155 aMenuItemType
.AppendAscii(": ").Append(aName
), FALSE
);
1156 if ( !pMenu
->GetItemCommand(nID
).Len() || ( nConf
& DH_MODE_ALLWIN
) )
1157 pRet
->GenReturn ( RET_WinInfo
, SmartId( nID
), (comm_ULONG
)0,
1158 aMenuItemType
.AppendAscii(": ").Append(aName
), FALSE
);
1162 return; // Menu ist hier schon komplett abgehandelt.
1167 for( USHORT i
= 0 ; i
< pBase
->GetChildCount(); i
++ )
1168 WriteControlData( pBase
->GetChild(i
), nConf
, FALSE
);
1171 class SysWinContainer
: public WorkWindow
1174 ToolBox
*pClientWin
;
1175 DockingWindow
*pDock
;
1177 SysWinContainer( ToolBox
*pClient
);
1179 virtual void Resize();
1180 virtual void Resizing( Size
& rSize
);
1183 SysWinContainer::SysWinContainer( ToolBox
*pClient
)
1184 : WorkWindow( NULL
, WB_BORDER
| WB_SIZEMOVE
| WB_CLOSEABLE
)
1185 , pClientWin( pClient
)
1187 pDock
= new DockingWindow( this );
1188 pClientWin
->SetParent( pDock
);
1189 pClientWin
->SetFloatingMode( FALSE
);
1190 SetText( pClient
->GetText() );
1191 SetPosPixel( Point( 1,40 ) );
1194 EnableAlwaysOnTop();
1198 SysWinContainer::~SysWinContainer()
1203 void SysWinContainer::Resize()
1205 Size
aSize( GetOutputSizePixel() );
1207 // aSize = pClientWin->GetSizePixel();
1208 // aSize = pClientWin->CalcWindowSizePixel();
1209 if ( aSize
!= GetSizePixel() )
1211 SetOutputSizePixel( aSize
);
1212 pDock
->SetSizePixel( aSize
);
1213 pClientWin
->SetSizePixel( aSize
);
1217 void SysWinContainer::Resizing( Size
& rSize
)
1222 BOOL bHasValue
= FALSE
;
1223 ULONG nBestValue
= 0;
1225 for ( i
=1 ; i
<=1 ; i
++ )
1227 aSize
= pClientWin
->CalcWindowSizePixel( i
);
1228 nThisValue
= Abs( aSize
.Width() - rSize
.Width() ) + Abs( aSize
.Height() - rSize
.Height() );
1229 if ( !bHasValue
|| ( nThisValue
< nBestValue
) )
1231 nBestValue
= nThisValue
;
1240 class DisplayHidWin
: public ToolBox
1246 BOOL bIsPermanentDraging
;
1247 void SetDraging( BOOL bNewDraging
);
1248 Image
*pShow
, *pShow2
;
1249 BOOL bConfigChanged
;
1250 void EnableButtons( ULONG nConf
);
1253 static long stub_VCLEventHookProc( NotifyEvent
& rEvt
, void* pData
)
1255 return ((DisplayHidWin
*)pData
)->VCLEventHook( rEvt
);
1258 long VCLEventHook( NotifyEvent
& rEvt
);
1259 Window
*pLastMouseMoveWin
;
1261 SysWinContainer
*pContainer
;
1263 // aborting by pressing shist twice
1272 virtual void Tracking( const TrackingEvent
& rTEvt
);
1273 virtual void Click();
1274 virtual void Select();
1275 virtual void SetText( const XubString
& rStr
);
1277 void SetDisplayText( const String
&aNewText
){ pEdit
->SetText(aNewText
); }
1278 String
GetDisplayText() const { return pEdit
->GetText(); }
1279 BOOL
IsDisplayTextModified() const { return pEdit
->IsModified(); }
1280 void ClearDisplayTextModified() const { pEdit
->ClearModifyFlag(); }
1282 void SetConfig( ULONG nConf
);
1285 BOOL
IsConfigChanged() { return bConfigChanged
; }
1286 void ConfigSent() { bConfigChanged
= FALSE
; }
1288 BOOL
IsSendData() { return GetItemState( TT_SEND_DATA
) == STATE_CHECK
; }
1289 // BOOL IsAllWin() { return GetItemState( TT_ALLWIN ) == STATE_CHECK; }
1291 BOOL
IsDraging() { return bIsDraging
; }
1293 Window
* LastMouseMoveWin() { return pLastMouseMoveWin
; }
1296 DisplayHidWin::DisplayHidWin()
1297 : ToolBox( StatementList::GetFirstDocFrame(), TTProperties::GetSvtResId(DisplayHidToolBox
) )
1298 , bIsDraging( FALSE
)
1299 , bIsPermanentDraging( FALSE
)
1302 , pLastMouseMoveWin( NULL
)
1306 SetOutStyle( TOOLBOX_STYLE_HANDPOINTER
| TOOLBOX_STYLE_FLAT
);
1307 pEdit
= new Edit( this, WB_CENTER
| WB_BORDER
);
1308 aMinEditSize
= GetItemRect( TT_OUTPUT
).GetSize();
1309 /**/ aMinEditSize
=Size(20,20);
1310 aMinEditSize
.Width() *= 12;
1311 pEdit
->SetSizePixel( aMinEditSize
);
1313 SetItemWindow( TT_OUTPUT
, pEdit
);
1315 pContainer
= new SysWinContainer( this );
1316 nEventHookID
= Application::AddEventHook( stub_VCLEventHookProc
, this );
1319 DisplayHidWin::~DisplayHidWin()
1321 Application::RemoveEventHook( nEventHookID
);
1322 Hide(); // so GetFirstDocFrame won't return ourselves (needed for SOPlayer)
1323 SetParent( StatementList::GetFirstDocFrame() );
1328 void DisplayHidWin::SetDraging( BOOL bNewDraging
)
1331 pShow
= new Image( GetItemImage( TT_SHOW
) );
1333 pShow2
= new Image( Bitmap( TTProperties::GetSvtResId( TT_SHOW2
) ) );
1336 SetItemImage( TT_SHOW
, *pShow2
);
1338 SetItemImage( TT_SHOW
, *pShow
);
1340 bIsDraging
= bNewDraging
;
1343 void DisplayHidWin::EnableButtons( ULONG nConf
)
1345 BOOL bSend
= BOOL(nConf
& DH_MODE_SEND_DATA
);
1346 EnableItem( TT_ALLWIN
, bSend
);
1347 EnableItem( TT_KURZNAME
, bSend
);
1348 EnableItem( TT_LANGNAME
, bSend
);
1351 void DisplayHidWin::Tracking( const TrackingEvent
& rTEvt
)
1353 // if ( nLastItemID == TT_SHOW && GetItemState( TT_SHOW ) == STATE_NOCHECK && ( rTEvt.IsTrackingEnded() || rTEvt.IsTrackingCanceled() ) )
1354 // SetDraging( FALSE );
1355 if ( nLastItemID
== TT_SHOW
&& GetItemState( TT_SHOW
) == STATE_NOCHECK
)
1356 EndTracking( ENDTRACK_CANCEL
);
1357 ToolBox::Tracking( rTEvt
);
1360 void DisplayHidWin::Click()
1362 nLastItemID
= GetCurItemId();
1363 if ( nLastItemID
== TT_SHOW
)
1370 void DisplayHidWin::Select()
1372 if ( GetItemState( GetCurItemId() ) == STATE_NOCHECK
)
1374 SetItemState( GetCurItemId(), STATE_CHECK
);
1375 if ( GetCurItemId() == TT_SHOW
)
1377 bIsPermanentDraging
= TRUE
;
1383 SetItemState( GetCurItemId(), STATE_NOCHECK
);
1384 if ( GetCurItemId() == TT_SHOW
)
1386 bIsPermanentDraging
= FALSE
;
1387 SetDraging( FALSE
);
1390 if ( GetCurItemId() == TT_SEND_DATA
)
1392 EnableButtons( GetConfig() );
1396 void DisplayHidWin::SetConfig( ULONG nConf
)
1398 SetItemState( TT_KURZNAME
, ( nConf
& DH_MODE_KURZNAME
) ? STATE_CHECK
: STATE_NOCHECK
);
1399 SetItemState( TT_LANGNAME
, ( nConf
& DH_MODE_LANGNAME
) ? STATE_CHECK
: STATE_NOCHECK
);
1400 SetItemState( TT_ALLWIN
, ( nConf
& DH_MODE_ALLWIN
) ? STATE_CHECK
: STATE_NOCHECK
);
1401 SetItemState( TT_SEND_DATA
, ( nConf
& DH_MODE_SEND_DATA
) ? STATE_CHECK
: STATE_NOCHECK
);
1402 EnableButtons( nConf
);
1405 ULONG
DisplayHidWin::GetConfig()
1408 if ( GetItemState( TT_KURZNAME
) == STATE_CHECK
)
1409 nConf
|= DH_MODE_KURZNAME
;
1410 if ( GetItemState( TT_LANGNAME
) == STATE_CHECK
)
1411 nConf
|= DH_MODE_LANGNAME
;
1412 if ( GetItemState( TT_ALLWIN
) == STATE_CHECK
)
1413 nConf
|= DH_MODE_ALLWIN
;
1415 nConf
|= DH_MODE_SEND_DATA
;
1420 void DisplayHidWin::SetText( const XubString
& rStr
)
1422 pContainer
->SetText( rStr
);
1425 long DisplayHidWin::VCLEventHook( NotifyEvent
& rEvt
)
1427 if ( EVENT_MOUSEMOVE
== rEvt
.GetType() )
1429 pLastMouseMoveWin
= rEvt
.GetWindow();
1431 // check if abort with pressing shift twice
1432 MouseEvent
* pMEvt
= (MouseEvent
*)rEvt
.GetMouseEvent();
1434 if ( ( pMEvt
->IsShift() && !bOldShift
) ) // Shift pressed
1436 if ( aLatest
< Time() )
1439 aLatest
= Time()+Time( 0, 0, 0, 50 );
1443 if ( ( !pMEvt
->IsShift() && bOldShift
) ) // Shift released
1446 if ( nShiftCount
== 4 && aLatest
> Time() )
1448 bIsPermanentDraging
= FALSE
;
1449 SetDraging( FALSE
);
1450 SetItemState( TT_SHOW
, STATE_NOCHECK
);
1453 bOldShift
= pMEvt
->IsShift();
1455 if ( ( ( EVENT_MOUSEBUTTONUP
== rEvt
.GetType() && rEvt
.GetMouseEvent()->GetButtons() == MOUSE_LEFT
) || ( EVENT_MOUSEMOVE
== rEvt
.GetType() && !rEvt
.GetMouseEvent()->GetButtons() ) )
1456 && IsDraging() && !bIsPermanentDraging
)
1457 SetDraging( FALSE
);
1462 BOOL
StatementCommand::DisplayHID()
1464 // Return TRUE -> reexecute command
1466 if ( !bBool2
) // Wird auf FALSE initialisiert
1468 bBool2
= TRUE
; // Wir sind initialisiert.
1469 GetTTSettings()->pDisplayInstance
= this; // Und haben die Macht (Alle anderen beenden sich)
1471 if ( !(nParams
& PARAM_ULONG_1
) )
1473 if( GetTTSettings()->pDisplayHidWin
) // Nichts verändern
1474 nLNr1
= GetTTSettings()->pDisplayHidWin
->GetConfig();
1475 else // Beim ersten Aufruf wollen wir alles richtig einstellen
1476 nLNr1
= DH_MODE_KURZNAME
| DH_MODE_LANGNAME
;
1478 if( ((nParams
& PARAM_BOOL_1
) && bBool1
) )
1479 nLNr1
|= DH_MODE_SEND_DATA
;
1481 nLNr1
&= ( ~DH_MODE_SEND_DATA
);
1484 if ( GetTTSettings()->pDisplayHidWin
)
1485 GetTTSettings()->pDisplayHidWin
->SetConfig( nLNr1
);
1488 if ( GetTTSettings()->pDisplayInstance
&& GetTTSettings()->pDisplayInstance
!= this )
1490 DBG_WARNING("Mehrere DisplayHID am laufen");
1491 return FALSE
; // Noch eine andere Instanz macht das gleiche!
1494 if ( !GetTTSettings()->pDisplayHidWin
)
1496 GetTTSettings()->pDisplayHidWin
= new DisplayHidWin();
1497 GetTTSettings()->aOriginalCaption
= GetTTSettings()->pDisplayHidWin
->GetText();
1498 GetTTSettings()->pDisplayHidWin
->Show();
1500 nLNr1
|= DH_MODE_SEND_DATA
;
1501 GetTTSettings()->pDisplayHidWin
->SetConfig( nLNr1
);
1503 GetTTSettings()->Old
= NULL
;
1504 GetTTSettings()->Act
= NULL
;
1505 GetTTSettings()->pDisplayInstance
= this;
1509 GetTTSettings()->pDisplayHidWin
->GetWindow( WINDOW_OVERLAP
)->Enable( TRUE
, TRUE
);
1510 GetTTSettings()->pDisplayHidWin
->GetWindow( WINDOW_OVERLAP
)->EnableInput( TRUE
, TRUE
);
1514 if ( GetTTSettings()->pDisplayHidWin
->IsVisible() && !bDying
)
1517 if ( GetTTSettings()->pDisplayHidWin
->IsDraging() )
1521 #define HIGHLIGHT_WIN( WinPtr ) \
1523 Color aLineColMem = WinPtr->GetLineColor(); \
1524 WinPtr->SetLineColor( Color( COL_WHITE ) ); \
1525 Color aFillColMem = WinPtr->GetFillColor(); \
1526 WinPtr->SetFillColor( Color( COL_LIGHTRED ) ); \
1527 RasterOp aROp = WinPtr->GetRasterOp(); \
1528 WinPtr->SetRasterOp( ROP_XOR ); \
1529 Size aSz = WinPtr->PixelToLogic( WinPtr->GetSizePixel() );\
1530 ULONG nMaxCornerRadius = WinPtr->PixelToLogic( Point( 80, 0 ) ).X();\
1531 ULONG iCorner = std::max ((ULONG) 8, (ULONG) std::min( nMaxCornerRadius, (ULONG) std::min((ULONG) (aSz.Width() / 6), (ULONG)(aSz.Height() / 6))));\
1532 WinPtr->DrawRect(Rectangle(Point(),aSz), iCorner, iCorner);\
1533 WinPtr->SetLineColor( aLineColMem ); \
1534 WinPtr->SetFillColor( aFillColMem ); \
1535 WinPtr->SetRasterOp( aROp ); \
1539 #define SET_WIN( WinPtr ) \
1540 if ( StatementList::WinPtrValid(WinPtr) ) \
1542 HIGHLIGHT_WIN ( WinPtr ); \
1545 #define RESET_WIN( WinPtr ) \
1546 if ( StatementList::WinPtrValid(WinPtr) ) \
1548 WinPtr->Invalidate( INVALIDATE_NOTRANSPARENT ); \
1553 GetTTSettings()->Old
= GetTTSettings()->Act
;
1554 // GetTTSettings()->Act = GetMouseWin();
1555 GetTTSettings()->Act
= GetTTSettings()->pDisplayHidWin
->LastMouseMoveWin();
1557 if ( !StatementList::WinPtrValid ( GetTTSettings()->Old
) )
1558 GetTTSettings()->Old
= NULL
;
1559 if ( !StatementList::WinPtrValid ( GetTTSettings()->Act
) )
1560 GetTTSettings()->Act
= NULL
;
1562 if ( GetTTSettings()->Act
&& GetTTSettings()->Act
->GetType() == WINDOW_BORDERWINDOW
)
1563 GetTTSettings()->Act
= GetTTSettings()->Act
->GetWindow( WINDOW_CLIENT
);
1565 if ( GetTTSettings()->Act
!= GetTTSettings()->Old
)
1567 if ( GetTTSettings()->Old
)
1569 RESET_WIN(GetTTSettings()->Old
);
1571 if ( GetTTSettings()->Act
)
1573 SET_WIN(GetTTSettings()->Act
);
1574 GetTTSettings()->pDisplayHidWin
->SetDisplayText(GetTTSettings()->Act
->GetSmartUniqueOrHelpId().GetText().AppendAscii(" WinType: ")
1575 .Append(UniString::CreateFromInt64(GetTTSettings()->Act
->GetType())).AppendAscii(" ").Append(GetTTSettings()->Act
->GetText()));
1576 if ( GetTTSettings()->Act
&& !GetTTSettings()->Act
->GetSmartUniqueId().Equals( GetTTSettings()->Act
->GetSmartHelpId() ) )
1577 GetTTSettings()->pDisplayHidWin
->SetText(UniString( TTProperties::GetSvtResId( TT_ALTERNATE_CAPTION
) ).Append(GetTTSettings()->Act
->GetSmartHelpId().GetText()));
1579 GetTTSettings()->pDisplayHidWin
->SetText( GetTTSettings()->aOriginalCaption
);
1582 GetTTSettings()->pDisplayHidWin
->SetDisplayText(CUniString("Kein Window/Control gefunden"));
1584 else if ( GetTTSettings()->Act
)
1586 // SET_WIN(GetTTSettings()->Act);
1587 if ( GetTTSettings()->pDisplayHidWin
->IsDisplayTextModified() && GetTTSettings()->pDisplayHidWin
->GetDisplayText().Len() > 0 )
1589 GetTTSettings()->Act
->SetSmartUniqueId( SmartId( GetTTSettings()->pDisplayHidWin
->GetDisplayText().ToInt32() ) );
1590 GetTTSettings()->pDisplayHidWin
->ClearDisplayTextModified();
1593 /* if ( Application::GetLastInputInterval() > 5000 ) // 5 Sekunden lang nix geschehen
1595 GetTTSettings()->pDisplayHidWin->ToTop( TOTOP_NOGRABFOCUS );
1598 if ( GetTTSettings()->pDisplayHidWin
->IsSendData() /*&& bBool2*/ && GetTTSettings()->Act
)
1600 if ( !StatementFlow::bSending
)
1601 { // Normalerweise syncronisierung über Protokoll. Hier ist das aber asyncron!!!
1602 WriteControlData( GetTTSettings()->Act
, GetTTSettings()->pDisplayHidWin
->GetConfig() );
1603 new StatementFlow( this, F_EndCommandBlock
); // Kommando zum Senden erzeugen und in que eintragen
1606 } //if ( GetTTSettings()->pDisplayHidWin->IsDraging() )
1609 if ( GetTTSettings()->Act
)
1611 RESET_WIN(GetTTSettings()->Act
);
1612 GetTTSettings()->Act
= NULL
;
1616 if ( pFirst
== this ) // Sollte immer so sein, aber besser isses
1617 if ( pNext
) // Befehle warten auf Ausführung
1618 { // An Ende neu einsortieren
1620 QueStatement( NULL
);
1622 // { // Ersten und 2. austauschen.
1624 // pNext = pNext->pNext;
1625 // pFirst->pNext = this;
1631 delete GetTTSettings()->pDisplayHidWin
;
1632 GetTTSettings()->pDisplayHidWin
= NULL
;
1633 GetTTSettings()->pDisplayInstance
= NULL
;
1636 return GetTTSettings()->pDisplayHidWin
!= NULL
;
1639 class TranslateWin
: public WorkWindow
1642 DECL_LINK( DoAccept
, PushButton
* );
1643 DECL_LINK( DoNext
, PushButton
* );
1644 DECL_LINK( DoSelect
, PushButton
* );
1645 DECL_LINK( DoRestore
, PushButton
* );
1646 DECL_LINK( TranslationChanged
, Edit
* );
1647 DECL_LINK( ShowInplace
, Timer
* );
1651 // virtual void MouseButtonUp( const MouseEvent& rMEvt );
1652 // virtual void MouseMove( const MouseEvent& rMEvt );
1654 PushButton PushButtonTT_PB_NEXT
;
1655 GroupBox GroupBoxTT_GB_TRANSLATION
;
1657 GroupBox GroupBoxTT_GB_COMMENT
;
1658 Edit EditTT_E_COMMENT
;
1659 PushButton PushButtonTT_PB_ACCEPT
;
1660 FixedText FixedTextTT_FT_OLD
;
1661 PushButton PushButtonTT_PB_SELECT
;
1662 PushButton PushButtonTT_PB_RESTORE
;
1666 Window
*pTranslateWin
;
1672 BOOL
TestChangedDataSaved();
1676 static long stub_VCLEventHookProc( NotifyEvent
& rEvt
, void* pData
)
1678 return ((TranslateWin
*)pData
)->VCLEventHook( rEvt
);
1681 long VCLEventHook( NotifyEvent
& rEvt
);
1687 static String
MarkShortcutErrors( Window
* pBase
, BOOL bMark
);
1689 BOOL
IsTranslationAvailable(){ return bAvailable
; }
1690 BOOL
IsNextDialog(){ return bNext
; }
1691 void ResetNextDialog(){ bNext
= FALSE
; }
1693 Window
* GetTranslationWindow(){ return pTranslateWin
; }
1694 String
GetOriginalText(){ return FixedTextTT_FT_OLD
.GetText(); }
1695 String
GetTranslationText(){ return EditTT_E_NEW
.GetText(); }
1696 String
GetComment(){ return EditTT_E_COMMENT
.GetText(); }
1698 void EnableTranslation();
1701 TranslateWin::TranslateWin()
1702 : WorkWindow( NULL
, TTProperties::GetSvtResId( TT_INLINE_TRANSLATION
) )
1703 , PushButtonTT_PB_NEXT( this, TTProperties::GetSvtResId( TT_PB_NEXT
) )
1704 , GroupBoxTT_GB_TRANSLATION( this, TTProperties::GetSvtResId( TT_GB_TRANSLATION
) )
1705 , EditTT_E_NEW( this, TTProperties::GetSvtResId( TT_E_NEW
) )
1706 , GroupBoxTT_GB_COMMENT( this, TTProperties::GetSvtResId( TT_GB_COMMENT
) )
1707 , EditTT_E_COMMENT( this, TTProperties::GetSvtResId( TT_E_COMMENT
) )
1708 , PushButtonTT_PB_ACCEPT( this, TTProperties::GetSvtResId( TT_PB_ACCEPT
) )
1709 , FixedTextTT_FT_OLD( this, TTProperties::GetSvtResId( TT_FT_OLD
) )
1710 , PushButtonTT_PB_SELECT( this, TTProperties::GetSvtResId( TT_PB_SELECT
) )
1711 , PushButtonTT_PB_RESTORE( this, TTProperties::GetSvtResId( TT_PB_RESTORE
) )
1714 , pTranslateWin( NULL
)
1715 , bSelecting( FALSE
)
1716 , bAvailable( FALSE
)
1720 PushButtonTT_PB_NEXT
.SetClickHdl( LINK( this, TranslateWin
, DoNext
) );
1721 PushButtonTT_PB_ACCEPT
.SetClickHdl( LINK( this, TranslateWin
, DoAccept
) );
1722 PushButtonTT_PB_SELECT
.SetClickHdl( LINK( this, TranslateWin
, DoSelect
) );
1723 PushButtonTT_PB_RESTORE
.SetClickHdl( LINK( this, TranslateWin
, DoRestore
) );
1724 EditTT_E_NEW
.SetModifyHdl( LINK( this, TranslateWin
, TranslationChanged
) );
1725 InplaceTimer
.SetTimeout( 250 );
1726 InplaceTimer
.SetTimeoutHdl( LINK( this, TranslateWin
, ShowInplace
) );
1727 EnableAlwaysOnTop();
1728 nEventHookID
= Application::AddEventHook( stub_VCLEventHookProc
, this );
1731 TranslateWin::~TranslateWin()
1733 Application::RemoveEventHook( nEventHookID
);
1736 BOOL
TranslateWin::TestChangedDataSaved()
1738 if ( ( EditTT_E_NEW
.GetText().CompareTo( FixedTextTT_FT_OLD
.GetText() ) != COMPARE_EQUAL
1739 || EditTT_E_COMMENT
.GetText().Len() )
1740 && PushButtonTT_PB_ACCEPT
.IsEnabled() )
1742 return MessBox( this, TTProperties::GetSvtResId( TT_DISCARD_CHANGED_DATA
) ).Execute() == RET_YES
;
1748 IMPL_LINK( TranslateWin
, DoAccept
, PushButton
*, EMPTYARG
)
1750 PushButtonTT_PB_SELECT
.Disable();
1751 PushButtonTT_PB_NEXT
.Disable();
1752 PushButtonTT_PB_RESTORE
.Disable();
1753 EditTT_E_NEW
.Disable();
1754 EditTT_E_COMMENT
.Disable();
1755 PushButtonTT_PB_ACCEPT
.Disable();
1760 IMPL_LINK( TranslateWin
, DoNext
, PushButton
*, EMPTYARG
)
1762 if ( TestChangedDataSaved() )
1764 PushButtonTT_PB_SELECT
.Disable();
1765 PushButtonTT_PB_NEXT
.Disable();
1766 PushButtonTT_PB_RESTORE
.Disable();
1767 EditTT_E_NEW
.Disable();
1768 EditTT_E_COMMENT
.Disable();
1769 PushButtonTT_PB_ACCEPT
.Disable();
1775 IMPL_LINK( TranslateWin
, DoSelect
, PushButton
*, EMPTYARG
)
1784 if ( TestChangedDataSaved() )
1786 PushButtonTT_PB_RESTORE
.Disable();
1794 IMPL_LINK( TranslateWin
, DoRestore
, PushButton
*, EMPTYARG
)
1796 String
sTT_E_OLD( FixedTextTT_FT_OLD
.GetText());
1797 sTT_E_OLD
.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
1798 sTT_E_OLD
.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
1800 String
sTT_E_NEW( EditTT_E_NEW
.GetText());
1801 sTT_E_NEW
.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
1802 sTT_E_NEW
.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
1804 if ( StatementList::WinPtrValid( pTranslateWin
) && pTranslateWin
->GetText().CompareTo( sTT_E_NEW
) == COMPARE_EQUAL
)
1805 { // Im ersten schritt nur in der UI zurück
1806 pTranslateWin
->SetText( sTT_E_OLD
);
1809 { // Im zweite Schritt auch den eingegebenen Text
1810 EditTT_E_NEW
.SetText( FixedTextTT_FT_OLD
.GetText() );
1811 PushButtonTT_PB_RESTORE
.Disable();
1813 if ( StatementList::WinPtrValid( pTranslateWin
) )
1814 MarkShortcutErrors( pTranslateWin
->GetWindow( WINDOW_OVERLAP
), TRUE
);
1818 IMPL_LINK( TranslateWin
, TranslationChanged
, Edit
*, pEdit
)
1820 (void) pEdit
; /* avoid warning about unused parameter */
1821 PushButtonTT_PB_RESTORE
.Enable();
1822 InplaceTimer
.Start();
1826 IMPL_LINK( TranslateWin
, ShowInplace
, Timer
*, EMPTYARG
)
1828 PushButtonTT_PB_RESTORE
.Enable();
1829 if ( StatementList::WinPtrValid( pTranslateWin
) )
1831 String
sTT_E_NEW( EditTT_E_NEW
.GetText());
1832 // alle CRs UnQuoten
1833 sTT_E_NEW
.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
1834 // alle TABSs UnQuoten
1835 sTT_E_NEW
.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
1836 pTranslateWin
->SetText( sTT_E_NEW
);
1838 MarkShortcutErrors( pTranslateWin
->GetWindow( WINDOW_OVERLAP
), TRUE
);
1843 long TranslateWin::VCLEventHook( NotifyEvent
& rEvt
)
1845 if ( EVENT_MOUSEMOVE
== rEvt
.GetType() )
1849 const MouseEvent
*pMEvt
= rEvt
.GetMouseEvent();
1851 Act
= rEvt
.GetWindow();
1857 for ( i
= 0 ; i
< Act
->GetChildCount() ; i
++ )
1859 pWin
= Act
->GetChild(i
);
1860 Rectangle
aWinPosSize( pWin
->GetPosPixel(), pWin
->GetSizePixel() );
1862 if ( ( pWin
->IsMouseTransparent() || !pWin
->IsEnabled() ) && aWinPosSize
.IsInside( pMEvt
->GetPosPixel() ) )
1870 if ( !StatementList::WinPtrValid ( Old
) )
1878 if ( Old
->IsMouseTransparent() && Old
->GET_REAL_PARENT() )
1879 pWin
= Old
->GET_REAL_PARENT();
1887 FixedTextTT_FT_OLD
.SetText( Act
->GetText() );
1890 FixedTextTT_FT_OLD
.SetText( String() );
1896 /* if ( Application::GetLastInputInterval() > 5000 ) // 5 Sekunden lang nix geschehen
1901 } //if ( bSelecting )
1906 if ( Act
->IsMouseTransparent() && Act
->GET_REAL_PARENT() )
1907 Act
= Act
->GET_REAL_PARENT();
1913 else if ( EVENT_MOUSEBUTTONUP
== rEvt
.GetType() )
1917 pTranslateWin
= Act
;
1918 if ( pTranslateWin
)
1920 MarkShortcutErrors( pTranslateWin
->GetWindow( WINDOW_OVERLAP
), TRUE
);
1921 // alle CRs quoten (NF)
1922 String
sTT_E_NEW( pTranslateWin
->GetText());
1923 sTT_E_NEW
.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") );
1924 // alle TABSs quoten ()
1925 sTT_E_NEW
.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") );
1927 FixedTextTT_FT_OLD
.SetText( sTT_E_NEW
);
1928 EditTT_E_NEW
.SetText( sTT_E_NEW
);
1929 EditTT_E_NEW
.Enable();
1930 EditTT_E_NEW
.GrabFocus();
1931 EditTT_E_COMMENT
.SetText( String() );
1932 EditTT_E_COMMENT
.Enable();
1933 PushButtonTT_PB_ACCEPT
.Enable();
1943 #define FDS_ACTION_COLLECT 1
1944 #define FDS_ACTION_MARK 2
1945 #define FDS_ACTION_UNMARK 3
1947 class FindShortcutErrors
: public Search
1949 String aShortcuts
,aDoubleShortcuts
;
1952 FindShortcutErrors();
1953 virtual BOOL
IsWinOK( Window
*pWin
);
1954 void SetAction( USHORT nA
);
1955 String
GetDoubleShortcuts() { return aDoubleShortcuts
; }
1958 FindShortcutErrors::FindShortcutErrors()
1959 : Search( SEARCH_NOOVERLAP
| SEARCH_NO_TOPLEVEL_WIN
)
1961 SetAction( FDS_ACTION_COLLECT
); // Wir fange immer mit sammeln an, ODER??
1964 void FindShortcutErrors::SetAction( USHORT nA
)
1967 if ( FDS_ACTION_COLLECT
== nAction
)
1969 aShortcuts
= UniString();
1970 aDoubleShortcuts
= UniString();
1974 BOOL
FindShortcutErrors::IsWinOK( Window
*pWin
)
1976 if ( pWin
->IsReallyVisible() )
1978 String aText
= pWin
->GetText();
1979 xub_StrLen nPos
= aText
.Search('~');
1981 BOOL bHasAccel
= FALSE
;
1982 if ( nPos
!= STRING_NOTFOUND
)
1984 aShortcut
= aText
.Copy( nPos
+1, 1 );
1985 aShortcut
.ToLowerAscii();
1986 bHasAccel
= aShortcut
.Len() == 1;
1991 case FDS_ACTION_COLLECT
:
1993 if ( aShortcuts
.Search( aShortcut
) != STRING_NOTFOUND
)
1994 aDoubleShortcuts
+= aShortcut
;
1996 aShortcuts
+= aShortcut
;
1999 case FDS_ACTION_MARK
:
2001 BOOL bMissing
= FALSE
;
2002 if ( !bHasAccel
&& aText
.Len() ) // should there be an accelarator defined
2006 pChild
= pWin
->GetWindow( WINDOW_CLIENT
);
2008 if ( (pChild
->GetType() == WINDOW_RADIOBUTTON
) ||
2009 (pChild
->GetType() == WINDOW_IMAGERADIOBUTTON
) ||
2010 (pChild
->GetType() == WINDOW_CHECKBOX
) ||
2011 (pChild
->GetType() == WINDOW_TRISTATEBOX
) ||
2012 (pChild
->GetType() == WINDOW_PUSHBUTTON
) )
2014 if ( !pChild
->GetText().EqualsAscii( "..." ) )
2018 if ( pChild
->GetType() == WINDOW_FIXEDTEXT
)
2020 Window
* pTempChild
= pWin
->GetWindow( WINDOW_NEXT
);
2022 pTempChild
= pTempChild
->GetWindow( WINDOW_CLIENT
);
2024 if ( pTempChild
&& pChild
->GetText().Len() )
2026 if ( (pTempChild
->GetType() == WINDOW_EDIT
) ||
2027 (pTempChild
->GetType() == WINDOW_MULTILINEEDIT
) ||
2028 (pTempChild
->GetType() == WINDOW_SPINFIELD
) ||
2029 (pTempChild
->GetType() == WINDOW_PATTERNFIELD
) ||
2030 (pTempChild
->GetType() == WINDOW_NUMERICFIELD
) ||
2031 (pTempChild
->GetType() == WINDOW_METRICFIELD
) ||
2032 (pTempChild
->GetType() == WINDOW_CURRENCYFIELD
) ||
2033 (pTempChild
->GetType() == WINDOW_DATEFIELD
) ||
2034 (pTempChild
->GetType() == WINDOW_TIMEFIELD
) ||
2035 (pTempChild
->GetType() == WINDOW_LISTBOX
) ||
2036 (pTempChild
->GetType() == WINDOW_MULTILISTBOX
) ||
2037 (pTempChild
->GetType() == WINDOW_COMBOBOX
) ||
2038 (pTempChild
->GetType() == WINDOW_PATTERNBOX
) ||
2039 (pTempChild
->GetType() == WINDOW_NUMERICBOX
) ||
2040 (pTempChild
->GetType() == WINDOW_METRICBOX
) ||
2041 (pTempChild
->GetType() == WINDOW_CURRENCYBOX
) ||
2042 (pTempChild
->GetType() == WINDOW_DATEBOX
) ||
2043 (pTempChild
->GetType() == WINDOW_TIMEBOX
) )
2051 if ( bHasAccel
&& aDoubleShortcuts
.Search( aShortcut
) != STRING_NOTFOUND
)
2053 if ( pWin
->GetType() == WINDOW_GROUPBOX
)
2054 pWin
->SetControlForeground( Color( COL_LIGHTRED
) );
2057 pWin
->SetControlBackground();
2058 Color
aCol(COL_GRAY
);
2059 aCol
.SetRed( 0xff );
2060 pWin
->SetControlBackground( aCol
);
2063 else if ( bMissing
)
2065 pWin
->SetControlBackground();
2066 Color
aCol(COL_GRAY
);
2067 aCol
.SetRed( 0xff );
2068 aCol
.SetGreen( 0xff );
2069 pWin
->SetControlBackground( aCol
);
2073 pWin
->SetControlForeground();
2074 pWin
->SetControlBackground();
2078 case FDS_ACTION_UNMARK
:
2080 pWin
->SetControlForeground();
2081 pWin
->SetControlBackground();
2087 if ( FDS_ACTION_MARK
== nAction
|| FDS_ACTION_UNMARK
== nAction
)
2089 pWin
->SetControlForeground();
2090 pWin
->SetControlBackground();
2096 String
TranslateWin::MarkShortcutErrors( Window
* pBase
, BOOL bMark
)
2100 FindShortcutErrors aFinder
;
2103 StatementList::SearchAllWin( pBase
, aFinder
, TRUE
); // collect Shortcuts first
2104 aFinder
.SetAction( FDS_ACTION_MARK
);
2107 aFinder
.SetAction( FDS_ACTION_UNMARK
);
2108 StatementList::SearchAllWin( pBase
, aFinder
, TRUE
);
2109 return aFinder
.GetDoubleShortcuts();
2114 void TranslateWin::EnableTranslation()
2116 PushButtonTT_PB_SELECT
.Enable();
2117 PushButtonTT_PB_NEXT
.Enable();
2122 void StatementCommand::Translate()
2124 // Es wurde eine initale UniqueId mitgegeben. Dann nur die dopelten Shortcuts liefern
2125 if( (nParams
& PARAM_ULONG_1
) && nLNr1
)
2128 Window
*pWin
= SearchTree( SmartId( nLNr1
) ,FALSE
);
2131 pWin
= pWin
->GetWindow( WINDOW_OVERLAP
);
2132 aDouble
= TranslateWin::MarkShortcutErrors( pWin
, TRUE
);
2134 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, aDouble
);
2138 if ( !GetTTSettings()->pTranslateWin
)
2140 GetTTSettings()->pTranslateWin
= new TranslateWin
;
2141 GetTTSettings()->bToTop
= TRUE
;
2144 GetTTSettings()->pTranslateWin
->Show();
2145 if ( GetTTSettings()->bToTop
)
2147 GetTTSettings()->pTranslateWin
->ToTop();
2148 GetTTSettings()->bToTop
= FALSE
;
2151 // GetTTSettings()->pTranslateWin->GetWindow( WINDOW_OVERLAP )->Enable( TRUE, TRUE );
2152 GetTTSettings()->pTranslateWin
->GetWindow( WINDOW_OVERLAP
)->EnableInput( TRUE
, TRUE
);
2154 if ( GetTTSettings()->pTranslateWin
->IsTranslationAvailable() )
2156 String aTranslation
;
2157 Window
* pTranslationWindow
= GetTTSettings()->pTranslateWin
->GetTranslationWindow();
2159 DBG_ASSERT( pTranslationWindow
, "Kein Translation Window" );
2161 if ( WinPtrValid( pTranslationWindow
) )
2163 if ( pTranslationWindow
->GetType() == WINDOW_BORDERWINDOW
&& pTranslationWindow
->GetWindow( WINDOW_CLIENT
) )
2165 Window
* pNew
= pTranslationWindow
->GetWindow( WINDOW_CLIENT
);
2166 // Bei Dockingwindoes das kanze Geraffel von Docking Floating überspringen
2167 while ( IsDialog( pNew
) && !pNew
->GetSmartUniqueOrHelpId().HasAny() && pNew
->GetChildCount() == 1 )
2168 pNew
= pNew
->GetChild( 0 );
2169 pTranslationWindow
= pNew
;
2172 aTranslation
= CUniString("0;");
2174 aTranslation
+= pTranslationWindow
->GetSmartUniqueOrHelpId().GetText();
2175 aTranslation
+= ';';
2177 aTranslation
+= TypeString( pTranslationWindow
->GetType() );
2178 aTranslation
+= ';';
2180 Window
* pParentDialog
= pTranslationWindow
;
2181 while ( pParentDialog
&& !IsDialog( pParentDialog
) )
2183 pParentDialog
= pParentDialog
->GET_REAL_PARENT();
2186 if ( pParentDialog
)
2188 aTranslation
+= pParentDialog
->GetSmartUniqueOrHelpId().GetText();
2189 aTranslation
+= ';';
2190 aTranslation
+= TypeString( pParentDialog
->GetType() );
2193 aTranslation
.AppendAscii( "0;" ); // Zahl + leerer String
2194 aTranslation
+= ';';
2196 aTranslation
+= '\"';
2197 aTranslation
+= GetTTSettings()->pTranslateWin
->GetOriginalText();
2198 aTranslation
+= '\"';
2200 aTranslation
+= ';';
2202 aTranslation
+= '\"';
2203 aTranslation
+= GetTTSettings()->pTranslateWin
->GetTranslationText();
2204 aTranslation
+= '\"';
2206 aTranslation
+= ';';
2208 aTranslation
+= '\"';
2209 aTranslation
+= GetTTSettings()->pTranslateWin
->GetComment();
2210 aTranslation
+= '\"';
2212 // alle CRs quoten (NF)
2213 aTranslation
.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") );
2214 // alle TABSs quoten ()
2215 aTranslation
.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") );
2217 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, aTranslation
);
2218 GetTTSettings()->pTranslateWin
->EnableTranslation();
2219 GetTTSettings()->bToTop
= TRUE
;
2223 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, String() );
2224 GetTTSettings()->pTranslateWin
->EnableTranslation();
2225 ErrorBox
err( GetTTSettings()->pTranslateWin
, TTProperties::GetSvtResId( TT_NO_CONTROL
));
2227 GetTTSettings()->bToTop
= TRUE
;
2231 else if ( GetTTSettings()->pTranslateWin
->IsNextDialog() )
2233 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, CUniString("1") );
2234 GetTTSettings()->pTranslateWin
->ResetNextDialog();
2235 GetTTSettings()->pTranslateWin
->LoseFocus();
2236 GetTTSettings()->bToTop
= TRUE
;
2240 GetTTSettings()->pTranslateWin
->EnableTranslation();
2241 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, String() );
2245 Window
* StatementCommand::GetNextOverlap( Window
* pBase
)
2246 { // Findet irgendwelche Overlap-Fenster, die schließbar aussehen
2247 // Eventuell muß noch die Auswahl verfeinert werden.
2249 if ( pBase
->GetType() != WINDOW_BORDERWINDOW
)
2250 pBase
= pBase
->GetWindow( WINDOW_OVERLAP
);
2252 Window
*pControl
= NULL
;
2253 if ( pBase
->GetWindow( WINDOW_FIRSTOVERLAP
) )
2255 pControl
= GetNextOverlap( pBase
->GetWindow( WINDOW_FIRSTOVERLAP
) );
2258 if ( !pControl
&& pBase
->GetWindow( WINDOW_NEXT
) )
2260 pControl
= GetNextOverlap( pBase
->GetWindow( WINDOW_NEXT
) );
2265 Window
*pTest
= pBase
->GetWindow( WINDOW_CLIENT
);
2266 if ( IsAccessable (pTest
)
2267 && pTest
->IsEnabled()
2268 && pTest
->IsVisible()
2269 && ((pTest
->GetStyle() & WB_CLOSEABLE
) || (pBase
->GetStyle() & WB_CLOSEABLE
)) )
2278 Window
* StatementCommand::GetNextRecoverWin()
2280 // über die TopLevelWindows der App iterieren
2281 Window
* pBase
= Application::GetFirstTopLevelWindow();
2282 Window
*pControl
= NULL
;
2283 Window
* pMyFirstDocFrame
= NULL
;
2286 // zuerst weitere Fenster auf dem Fenster suchen und schliessen
2287 pControl
= GetNextOverlap( pBase
);
2288 if ( pControl
&& pControl
->GetType() == WINDOW_HELPTEXTWINDOW
)
2292 if ( pControl
&& pControl
->IsVisible() && !IsFirstDocFrame( pControl
) && !IsIMEWin( pControl
) )
2294 Window
* pTB
= pControl
->GetChild( 0 );
2295 if ( pControl
->GetChildCount() == 1 && pTB
->GetType() == WINDOW_TOOLBOX
)
2297 ; // do not act on floating toolboxes #i38796
2302 // dann das Fenster selbst Schliessen
2303 // erstes DocWin überspringen
2304 // Assumption that Doc Windows are Borderwindows and ButtonDialog and such are not
2305 if ( pBase
->IsVisible() && !IsFirstDocFrame( pBase
) && pBase
->GetType() != WINDOW_BORDERWINDOW
&& !IsIMEWin( pBase
) )
2308 if ( !pMyFirstDocFrame
&& IsFirstDocFrame( pBase
) )
2309 pMyFirstDocFrame
= pBase
;
2312 pBase
= Application::GetNextTopLevelWindow( pBase
);
2314 #ifdef RESET_APPLICATION_TO_BACKING_WINDOW
2315 // close the FirstDocFrame last, It will not be closed, but the Document inside will be closed.
2316 if ( IsDocWin( pMyFirstDocFrame
) )
2317 return pMyFirstDocFrame
;
2318 #endif // def RESET_APPLICATION_TO_BACKING_WINDOW
2323 BOOL
StatementCommand::Execute()
2327 #if OSL_DEBUG_LEVEL > 1
2328 m_pDbgWin
->AddText( "Skipping Command: " );
2329 m_pDbgWin
->AddText( aSmartMethodId
.GetText() );
2330 m_pDbgWin
->AddText( "\n" );
2339 #if OSL_DEBUG_LEVEL > 1
2340 m_pDbgWin
->AddText( "Executing Command: " );
2341 m_pDbgWin
->AddText( aSmartMethodId
.GetText() );
2342 m_pDbgWin
->AddText( "\n" );
2349 #if OSL_DEBUG_LEVEL > 1
2350 #define REPORT_WIN_CLOSED(pControl, aInfo) \
2351 _REPORT_WIN_CLOSED(pControl, aInfo) \
2352 m_pDbgWin->AddText( aInfo.AppendAscii(" \"").Append( pControl->GetText() ).AppendAscii("\" geschlossen, RType = ").Append( TypeString(pControl->GetType()) ).AppendAscii(", UId = ").Append( UIdString(pControl->GetSmartUniqueOrHelpId()) ) );
2354 #define REPORT_WIN_CLOSED(pControl, aInfo) _REPORT_WIN_CLOSED(pControl, aInfo)
2357 #define REPORT_WIN_CLOSEDc(pControl, aInfo ) \
2358 REPORT_WIN_CLOSED(pControl, CUniString(aInfo) )
2360 #define _REPORT_WIN_CLOSED(pControl, aInfo) \
2361 if ( aString1.Len() ) \
2363 aString1 += aInfo; \
2364 aString1.AppendAscii(" \""); \
2365 aString1 += pControl->GetText(); \
2366 aString1.AppendAscii("\" geschlossen, RType = ");\
2367 aString1 += TypeString(pControl->GetType()); \
2368 aString1.AppendAscii(", UId = "); \
2369 aString1 += UIdString(pControl->GetSmartUniqueOrHelpId());
2372 switch ( nMethodId
)
2377 nLNr1
= Time().GetTime() + nNr1
/10;
2380 if ( Time().GetTime() < long(nLNr1
) ) // Aktuelle Zeit kleiner Endzeit
2387 case RC_ResetApplication
:
2391 nRetryCount
= 150; // das sollte reichen.
2392 bBool1
= TRUE
; // Nur beim ersten mal!
2393 nNr1
= 1; // Welcher Button ist dran?
2394 nLNr1
= 0; // Speichern des AppWin
2395 aString1
= UniString(); // Liste der geschlossenen Fenster
2397 // So daß nacher auch wieder alles auf Default steht
2400 bUsePostEvents
= TRUE
;
2402 aSubMenuId1
= SmartId();
2403 aSubMenuId2
= SmartId();
2404 aSubMenuId3
= SmartId();
2408 ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_COMPLEX
) );
2410 Window
*pControl
= GetNextRecoverWin();
2414 bBool2
= FALSE
; // flag for wait when all windows are closed
2415 pControl
->GrabFocus();
2417 if ( pControl
->GetType() != WINDOW_DOCKINGWINDOW
2418 && pControl
->GetType() != WINDOW_FLOATINGWINDOW
2419 && pControl
->GetType() != WINDOW_MODELESSDIALOG
2420 && pControl
->GetType() != WINDOW_WORKWINDOW
2421 && pControl
->GetType() != WINDOW_TOOLBOX
2422 && pControl
->GetType() != WINDOW_BORDERWINDOW
2425 short nRT
= ImpGetRType( pControl
, pControl
->GetSmartUniqueOrHelpId() );
2427 if ( nRT
== C_TabControl
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG
)
2428 { // Bei Tabcontrol den zugehörigen Tabdialog nehmen
2429 pControl
= pControl
->GET_REAL_PARENT();
2430 nRT
= ImpGetRType( pControl
, pControl
->GetSmartUniqueOrHelpId() );
2438 REPORT_WIN_CLOSEDc(pControl
, "Dialog");
2439 SET_WINP_CLOSING(pControl
);
2440 ((SystemWindow
*)pControl
)->Close();
2449 case C_ButtonDialog
:
2451 ButtonDialog
* pBD
= (ButtonDialog
*)pControl
;
2452 // nNr1 >= 10 bedeutet (Custom)-Buttons durchgehen
2453 if ( nNr1
>= 10+pBD
->GetButtonCount() ) nNr1
= 1;
2457 if ( pBD
->GetPushButton( BUTTONID_OK
) )
2459 REPORT_WIN_CLOSEDc(pControl
, "Message Box (OK)");
2460 SET_WINP_CLOSING(pControl
);
2461 pBD
->EndDialog(RET_OK
);
2463 nNr1
= 10; // Nochmal alle Buttons der Reihe nach
2466 if ( pBD
->GetPushButton( BUTTONID_CANCEL
) )
2468 REPORT_WIN_CLOSEDc(pControl
, "Message Box (Cancel)");
2469 SET_WINP_CLOSING(pControl
);
2470 pBD
->EndDialog(RET_CANCEL
);
2475 if ( pBD
->GetPushButton( BUTTONID_YES
) )
2477 REPORT_WIN_CLOSEDc(pControl
, "Message Box (Yes)");
2478 SET_WINP_CLOSING(pControl
);
2479 pBD
->EndDialog(RET_YES
);
2483 case 2: // BUG 48239
2485 if ( pBD
->GetPushButton( BUTTONID_NO
) )
2487 REPORT_WIN_CLOSEDc(pControl
, "Message Box (No)");
2488 SET_WINP_CLOSING(pControl
);
2489 pBD
->EndDialog(RET_NO
);
2495 USHORT nID
= pBD
->GetButtonId( nNr1
-10 );
2496 if ( nID
!= BUTTONID_HELP
)
2498 REPORT_WIN_CLOSED(pControl
, CUniString("Message Box (").Append( UniString::CreateFromInt32(nID
) ).AppendAscii(")"));
2499 SET_WINP_CLOSING(pControl
);
2500 pBD
->EndDialog(nID
);
2508 DBG_ERROR( "Unknown Windowtype" );
2509 REPORT_WIN_CLOSEDc(pControl
, "Unknown Windowtype");
2510 ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_UNKNOWN
), pControl
->GetType() );
2511 #if OSL_DEBUG_LEVEL > 1
2512 m_pDbgWin
->AddText( " Unbekannter Objekttyp aus UId" );
2520 if ( (pControl
->GetType() == WINDOW_DOCKINGWINDOW
|| pControl
->GetType() == WINDOW_TOOLBOX
) && nRetryCount
-- )
2522 if ( (((DockingWindow
*)pControl
)->GetStyle() | ((DockingWindow
*)pControl
)->GetFloatStyle()) & WB_CLOSEABLE
)
2524 REPORT_WIN_CLOSED(pControl
, TypeString(pControl
->GetType()));
2525 SET_WINP_CLOSING(pControl
);
2526 ((DockingWindow
*)pControl
)->Close();
2528 // Eigentlich nur bei TaskWindows! Hoffen wir mal, daß keine anderen DockingWindows dazwischen hauen.
2529 if ( (Window
*)nLNr1
!= pControl
)
2530 nNr1
= 1; // Zum durchprobieren der Buttons beim Schließen
2531 nLNr1
= (ULONG
)pControl
;
2537 && ( (pControl
->GetType() == WINDOW_FLOATINGWINDOW
)
2538 || (pControl
->GetType() == WINDOW_MODELESSDIALOG
)
2539 || (pControl
->GetType() == WINDOW_WORKWINDOW
)
2540 || (pControl
->GetType() == WINDOW_BORDERWINDOW
) ) )
2542 // if ( pControl->GetStyle() & WB_CLOSEABLE )
2544 #ifdef RESET_APPLICATION_TO_BACKING_WINDOW
2545 // Special handling for last Document; do not close the Frame, only the Document
2546 if ( GetDocWinCount() == 1 && IsDocFrame( pControl
) )
2548 if ( IsDocWin( pControl
) )
2550 if ( GetDocFrameMenuBar( pControl
) )
2552 MenuBar
* pMenu
= GetDocFrameMenuBar( pControl
);
2553 if ( pMenu
->HasCloser() )
2555 REPORT_WIN_CLOSED( pControl
, TypeString(pControl
->GetType()));
2556 SET_WINP_CLOSING(pControl
);
2558 pMenu
->GetCloserHdl().Call( pMenu
);
2560 // nur bei TaskWindows!
2561 if ( (Window
*)nLNr1
!= pControl
)
2562 nNr1
= 1; // Zum durchprobieren der Buttons beim Schließen
2563 nLNr1
= (ULONG
)pControl
;
2571 #endif // def RESET_APPLICATION_TO_BACKING_WINDOW
2573 REPORT_WIN_CLOSED( pControl
, TypeString(pControl
->GetType()));
2574 SET_WINP_CLOSING(pControl
);
2575 ((SystemWindow
*)pControl
)->Close();
2577 // Eigentlich nur bei TaskWindows!
2578 if ( (Window
*)nLNr1
!= pControl
)
2579 nNr1
= 1; // Zum durchprobieren der Buttons beim Schließen
2580 nLNr1
= (ULONG
)pControl
;
2588 // wait for some time if more windows show up
2589 // E.g.: Floating toolbars on a Task which was hidden by another Task before
2592 nLNr1
= Time().GetTime() + 100; // 100 = 1 Second
2595 if ( Time().GetTime() < long(nLNr1
) ) // Aktuelle Zeit kleiner Endzeit
2598 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, aString1
);
2603 if ( ! (nParams
& PARAM_USHORT_1
) )
2604 nNr1
= 1000; // defaults to 1000 = 1 Sec.
2607 nLNr1
= Time().GetTime() + nNr1
/10;
2611 if ( !bIsSlotInExecute
)
2612 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, comm_USHORT(CONST_WSFinished
) );
2615 if ( Time().GetTime() < long(nLNr1
) ) // Aktuelle Zeit kleiner Endzeit
2617 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, comm_USHORT(CONST_WSTimeout
) );
2627 switch ( nMethodId
)
2629 case RC_AppDelay
: // Diese Befehle werden anderswo behandelt
2631 case RC_ResetApplication
:
2634 case RC_AppAbort
: // Sofortiges Löschen aller Befehle
2638 ByteString
aAssertion( "Diese Assertion wurde vom Testtool per Befehl ausgelöst" );
2639 aAssertion
= ByteString( String( aAssertion
, RTL_TEXTENCODING_MS_1252
), RTL_TEXTENCODING_UTF8
);
2640 DBG_ASSERT( !aString1
.Len(), ByteString( aString1
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
2641 DBG_ASSERT( aString1
.Len(), aAssertion
.GetBuffer() );
2642 OSL_ENSURE( !aString1
.Len(), ByteString( aString1
, RTL_TEXTENCODING_UTF8
).GetBuffer() );
2643 OSL_ENSURE( aString1
.Len(), aAssertion
.GetBuffer() );
2646 case RC_CaptureAssertions
:
2648 if( !(nParams
& PARAM_BOOL_1
) || bBool1
)
2650 DBG_INSTOUTERROR( DBG_OUT_TESTTOOL
);
2651 osl_setDebugMessageFunc( osl_TestToolDebugPrint
);
2655 DBG_INSTOUTERROR( DBG_OUT_MSGBOX
);
2656 osl_setDebugMessageFunc( pOriginal_osl_DebugMessageFunc
);
2663 case RC_ApplicationBusy
:
2666 ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW
) );
2667 // if ( Application::GetAppWindow() )
2668 // bWait = Application::GetAppWindow()->IsWait();
2669 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, bWait
);
2672 case RC_GetClipboard
:
2674 ::rtl::OUString aTemp
;
2675 ::svt::OStringTransfer::PasteString( aTemp
, GetFirstDocFrame() );
2676 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, String( aTemp
) );
2679 case RC_SetClipboard
:
2680 ::svt::OStringTransfer::CopyString(aString1
,GetFirstDocFrame());
2683 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, Tree( NULL
, 0));
2685 #if OSL_DEBUG_LEVEL > 1
2687 m_pDbgWin
->bQuiet
= TRUE
;
2692 m_pDbgWin
->bQuiet
= FALSE
;
2697 ((TabControl
*)NULL
)->SetCurPageId( 12345 );
2699 case RC_GetNextCloseWindow
:
2701 Window
*pWin
= GetActive( WINDOW_BASE
); // WINDOW_ANYTYPE
2703 ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW
) );
2704 else if ( !IsDialog(pWin
) )
2705 ReportError( GEN_RES_STR0( S_NO_DIALOG_IN_GETACTIVE
) );
2707 pRet
->GenReturn( RET_Value
, aSmartMethodId
, static_cast<comm_ULONG
>(pWin
->GetSmartUniqueOrHelpId().GetNum())); //GetNum() ULONG != comm_ULONG on 64bit
2710 case RC_UseBindings
:
2711 if( !(nParams
& PARAM_BOOL_1
) || bBool1
)
2712 nUseBindings
= SFX_USE_BINDINGS
;
2717 // Bei folgenden Parametern passiert folgendes:
2718 // ein boolean=false Alles Profiling stoppen (Ergebnisse liefern)
2719 // ein boolean=true, 1-4 ints Einteilung der Zeiten in Kästchen
2720 // kein! boolean keine ints loggen jeden Befehls
2721 // kein! boolean 1 int loggen alle int Millisekunden
2722 // ein String wird in das Logfile übernommen(sonst passiert nichts)
2723 if( !(nParams
& PARAM_BOOL_1
) || bBool1
)
2727 pProfiler
= new TTProfiler
;
2731 if( !(nParams
& PARAM_BOOL_1
) && (nParams
& PARAM_USHORT_1
) )
2732 { // Autoprofiling: Profile nNr
2733 if ( pProfiler
->IsProfilingPerCommand() )
2735 pProfiler
->StopProfilingPerCommand();
2737 pProfiler
->StartAutoProfiling( nNr1
);
2739 // Der Header ist abhängig vom Modus
2740 pRet
->GenReturn( RET_ProfileInfo
, SmartId(), pProfiler
->GetProfileHeader() );
2742 else if ( nParams
& PARAM_USHORT_1
)
2743 { // Partitioning initialisieren: Profile true [,nNr][,nNr][,nNr][,nNr]
2744 comm_ULONG nAnzahl
=0;
2745 if ( nParams
& PARAM_USHORT_1
) { nAnzahl
++; };
2746 if ( nParams
& PARAM_USHORT_2
) { nAnzahl
++; };
2747 if ( nParams
& PARAM_USHORT_3
) { nAnzahl
++; };
2748 if ( nParams
& PARAM_USHORT_4
) { nAnzahl
++; };
2750 // Hier werden die Parameter ans Testtool zurück übertragen.
2751 // Das ist zwar etwas eigenartig, aber ansonsten müsste man im Testtool
2752 // die einfache Struktur der Remotebefehle aufbrechen.
2753 pRet
->GenReturn( RET_ProfileInfo
, SmartId( S_ProfileReset
), nAnzahl
);
2755 // Und die einzelnen Grenzen
2756 if ( nParams
& PARAM_USHORT_1
) { pRet
->GenReturn( RET_ProfileInfo
, SmartId( S_ProfileBorder1
), (comm_ULONG
)nNr1
); };
2757 if ( nParams
& PARAM_USHORT_2
) { pRet
->GenReturn( RET_ProfileInfo
, SmartId( S_ProfileBorder2
), (comm_ULONG
)nNr2
); };
2758 if ( nParams
& PARAM_USHORT_3
) { pRet
->GenReturn( RET_ProfileInfo
, SmartId( S_ProfileBorder3
), (comm_ULONG
)nNr3
); };
2759 if ( nParams
& PARAM_USHORT_4
) { pRet
->GenReturn( RET_ProfileInfo
, SmartId( S_ProfileBorder4
), (comm_ULONG
)nNr4
); };
2761 pProfiler
->StartPartitioning();
2763 else if( nParams
== PARAM_STR_1
) // Genau ein String!
2764 { // Nur einen String ins Profiling aufnehmen
2766 pRet
->GenReturn( RET_ProfileInfo
, SmartId(), aString1
);
2769 { // Normales Profiling je Kommando: profile
2770 if ( pProfiler
->IsAutoProfiling() )
2772 pRet
->GenReturn( RET_ProfileInfo
, SmartId(), pProfiler
->GetAutoProfiling() );
2773 pProfiler
->StopAutoProfiling();
2775 pProfiler
->StartProfilingPerCommand();
2777 // Der Header ist abhängig vom Modus
2778 pRet
->GenReturn( RET_ProfileInfo
, SmartId(), pProfiler
->GetProfileHeader() );
2781 else // Profiling wieder ausschalten: Profile false
2784 if ( pProfiler
->IsProfilingPerCommand() )
2785 pProfiler
->StopProfilingPerCommand();
2787 if ( pProfiler
->IsAutoProfiling() )
2789 pRet
->GenReturn( RET_ProfileInfo
, SmartId(), pProfiler
->GetAutoProfiling() );
2790 pProfiler
->StopAutoProfiling();
2793 if ( pProfiler
->IsPartitioning() )
2795 pRet
->GenReturn( RET_ProfileInfo
, SmartId( S_ProfileDump
), (comm_ULONG
)0 );
2796 pProfiler
->StopPartitioning();
2803 case RC_MenuGetItemCount
:
2804 case RC_MenuGetItemId
:
2805 case RC_MenuGetItemPos
:
2806 case RC_MenuIsSeperator
:
2807 case RC_MenuIsItemChecked
:
2808 case RC_MenuIsItemEnabled
:
2809 case RC_MenuGetItemText
:
2810 case RC_MenuGetItemCommand
:
2811 case RC_MenuHasSubMenu
:
2814 PopupMenu
*pPopup
= NULL
;
2815 MenuBar
*pMenuBar
= NULL
;
2818 USHORT nErr
= GetCurrentMenues( pPopup
, pMenuBar
, pMenu
);
2823 ReportError( GEN_RES_STR0( S_NO_POPUP
) );
2825 ReportError( GEN_RES_STR0( S_NO_SUBMENU
) );
2829 USHORT nItemCount
= 0;
2830 switch ( nMethodId
)
2832 case RC_MenuGetItemCount
:
2833 case RC_MenuGetItemId
:
2834 case RC_MenuIsSeperator
:
2836 nItemCount
= pMenu
->GetItemCount();
2837 if ( pMenu
->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES
)
2838 { // jep, we have to adjust the count
2839 BOOL bLastWasSeperator
= TRUE
; // TRUE for Separator at the top
2840 for ( USHORT i
= 0 ; i
< pMenu
->GetItemCount() ; i
++ )
2842 if ( !pMenu
->IsItemEnabled( pMenu
->GetItemId( i
) ) )
2846 if ( pMenu
->GetItemType( i
) == MENUITEM_SEPARATOR
&& bLastWasSeperator
)
2848 bLastWasSeperator
= pMenu
->GetItemType( i
) == MENUITEM_SEPARATOR
;
2851 if ( bLastWasSeperator
) // Separator at bottom
2858 // for certain methods calculate the physical index (reinserting the hidden entries)
2859 USHORT nPhysicalIndex
= 0;
2860 switch ( nMethodId
)
2862 case RC_MenuGetItemId
:
2863 case RC_MenuIsSeperator
:
2865 nPhysicalIndex
= nNr1
;
2866 if ( pMenu
->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES
)
2867 { // jep, we have to adjust the position
2868 BOOL bLastWasSeperator
= TRUE
; // TRUE for Separator at the top
2869 USHORT nVisibleCount
= 0;
2870 for ( USHORT i
= 0 ; i
< pMenu
->GetItemCount() && nVisibleCount
< nNr1
; i
++ )
2872 if ( pMenu
->IsItemEnabled( pMenu
->GetItemId( i
) )
2873 && !( pMenu
->GetItemType( i
) == MENUITEM_SEPARATOR
&& bLastWasSeperator
) )
2876 bLastWasSeperator
= pMenu
->GetItemType( i
) == MENUITEM_SEPARATOR
;
2881 DBG_ASSERT( nVisibleCount
== nNr1
, "Adaption of Index failed: nVisibleCount != nNr1" );
2889 switch ( nMethodId
)
2891 case RC_MenuGetItemCount
:
2893 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_ULONG
)nItemCount
);
2896 case RC_MenuGetItemId
:
2898 if ( ValueOK(aSmartMethodId
, RcString( nMethodId
),nNr1
,nItemCount
) )
2899 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_ULONG
)pMenu
->GetItemId(nPhysicalIndex
-1) );
2902 case RC_MenuGetItemPos
:
2904 USHORT nLogicalPos
= pMenu
->GetItemPos(nNr1
);
2905 if ( MENU_ITEM_NOTFOUND
!= nLogicalPos
&& pMenu
->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES
)
2906 { // jep, we have to adjust the position
2907 if ( !pMenu
->IsItemEnabled( nNr1
) )
2908 nLogicalPos
= MENU_ITEM_NOTFOUND
;
2911 BOOL bLastWasSeperator
= FALSE
;
2912 for ( int i
= nLogicalPos
; i
>= 0 ; i
-- )
2914 if ( !pMenu
->IsItemEnabled( pMenu
->GetItemId( sal::static_int_cast
< USHORT
>(i
) ) ) ||
2915 ( pMenu
->GetItemType( sal::static_int_cast
< USHORT
>(i
) ) == MENUITEM_SEPARATOR
&& bLastWasSeperator
) )
2917 bLastWasSeperator
= pMenu
->GetItemType( sal::static_int_cast
< USHORT
>(i
) ) == MENUITEM_SEPARATOR
;
2921 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_ULONG
)(nLogicalPos
+1) );
2924 case RC_MenuIsSeperator
:
2926 if ( ValueOK(aSmartMethodId
, RcString( nMethodId
),nNr1
,nItemCount
) )
2927 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_BOOL
)(pMenu
->GetItemType(nPhysicalIndex
-1) == MENUITEM_SEPARATOR
) );
2930 case RC_MenuIsItemChecked
:
2932 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_BOOL
)pMenu
->IsItemChecked(nNr1
) );
2935 case RC_MenuIsItemEnabled
:
2937 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_BOOL
)pMenu
->IsItemEnabled(nNr1
) );
2940 case RC_MenuGetItemText
:
2942 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (String
)pMenu
->GetItemText(nNr1
) );
2945 case RC_MenuGetItemCommand
:
2947 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (String
)pMenu
->GetItemCommand(nNr1
) );
2950 case RC_MenuHasSubMenu
:
2952 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (BOOL
)(pMenu
->GetPopupMenu(nNr1
) != NULL
) );
2957 if ( pMenu
->GetPopupMenu(nNr1
) )
2959 if ( !aSubMenuId1
.GetNum() )
2960 aSubMenuId1
= SmartId(nNr1
);
2961 else if ( !aSubMenuId2
.GetNum() )
2962 aSubMenuId2
= SmartId(nNr1
);
2963 else if ( !aSubMenuId3
.GetNum() )
2964 aSubMenuId3
= SmartId(nNr1
);
2967 pPopup
->SelectEntry(nNr1
);
2969 pMenuBar
->SelectEntry(nNr1
);
2975 pPopup
->EndExecute(nNr1
);
2976 aSubMenuId1
= SmartId();
2977 aSubMenuId2
= SmartId();
2978 aSubMenuId3
= SmartId();
2983 pMenuBar
->SelectEntry(nNr1
);
2984 aSubMenuId1
= SmartId();
2985 aSubMenuId2
= SmartId();
2986 aSubMenuId3
= SmartId();
2995 case RC_SetControlType
:
2997 DirectLog( S_QAError
, GEN_RES_STR0( S_DEPRECATED
) );
3007 case RC_FileDateTime
:
3009 long nErrorcode
= FSYS_ERR_OK
;
3010 switch ( nMethodId
)
3014 DirEntry
aFile( aString1
);
3015 nErrorcode
= aFile
.GetError();
3016 if ( FSYS_ERR_OK
== nErrorcode
&& FileStat( aFile
).IsKind( FSYS_KIND_FILE
) )
3017 nErrorcode
= aFile
.Kill();
3019 nErrorcode
= FSYS_ERR_NOTAFILE
;
3024 DirEntry
aDir( aString1
);
3025 nErrorcode
= aDir
.GetError();
3026 if ( FSYS_ERR_OK
== nErrorcode
&& FileStat( aDir
).IsKind( FSYS_KIND_DIR
) )
3027 nErrorcode
= aDir
.Kill();
3029 nErrorcode
= FSYS_ERR_NOTADIRECTORY
;
3034 DirEntry
aDir( aString1
);
3035 nErrorcode
= aDir
.GetError();
3036 if ( !nErrorcode
&& !aDir
.MakeDir() )
3037 nErrorcode
= FSYS_ERR_UNKNOWN
;
3038 // Workaround für Bug 60693
3039 // nErrorcode = aDir.GetError();
3044 nErrorcode
= DirEntry( aString1
).CopyTo( DirEntry( aString2
), FSYS_ACTION_COPYFILE
);
3049 nErrorcode
= DirEntry( aString1
).MoveTo( DirEntry( aString2
) );
3056 USHORT nDirFlags
= 0;
3057 // from basic/source/inc/runtime.hxx
3058 #define Sb_ATTR_NORMAL 0x0000
3059 #define Sb_ATTR_HIDDEN 0x0002
3060 #define Sb_ATTR_SYSTEM 0x0004
3061 #define Sb_ATTR_VOLUME 0x0008
3062 #define Sb_ATTR_DIRECTORY 0x0010
3063 #define Sb_ATTR_ARCHIVE 0x0020
3064 // copied from Basic and adapted basic/source/runtime/methods.cxx Revision 1.54
3065 if ( (nParams
& PARAM_STR_1
) )
3068 pDir
= NULL
; // wg. Sonderbehandlung Sb_ATTR_VOLUME
3069 DirEntry
aEntry( aString1
);
3070 FileStat
aStat( aEntry
);
3071 if(!aStat
.GetError() && (aStat
.GetKind() & FSYS_KIND_FILE
))
3073 // OK, only a filename
3074 // cut off path (VB4)
3075 aPath
= aEntry
.GetName();
3080 if ( (nParams
& PARAM_USHORT_1
) )
3081 nDirFlags
= nFlags
= nNr1
;
3083 nDirFlags
= nFlags
= Sb_ATTR_HIDDEN
| Sb_ATTR_SYSTEM
| Sb_ATTR_DIRECTORY
;
3085 // Nur diese Bitmaske ist unter Windows erlaubt
3087 if( nFlags
& ~0x1E )
3090 StarBASIC::Error( SbERR_BAD_ARGUMENT
);
3093 // Sb_ATTR_VOLUME wird getrennt gehandelt
3094 if( nDirFlags
& Sb_ATTR_VOLUME
)
3095 aPath
= aEntry
.GetVolume();
3098 // Die richtige Auswahl treffen
3099 USHORT nMode
= FSYS_KIND_FILE
;
3100 if( nFlags
& Sb_ATTR_DIRECTORY
)
3101 nMode
|= FSYS_KIND_DIR
;
3102 if( nFlags
== Sb_ATTR_DIRECTORY
)
3103 nMode
= FSYS_KIND_DIR
;
3104 pDir
= new Dir( aEntry
, (DirEntryKind
) nMode
);
3105 nErrorcode
= pDir
->GetError();
3115 if( nDirPos
>= pDir
->Count() )
3122 DirEntry aNextEntry
=(*(pDir
))[nDirPos
++];
3123 aPath
= aNextEntry
.GetName(); //Full();
3126 String
sFull(aNextEntry
.GetFull());
3129 if (_dos_getfileattr( sFull
.GetStr(), &nFlags
))
3130 nErrorcode
= FSYS_ERR_NOTEXISTS
;
3133 INT16 nCurFlags
= nDirFlags
;
3134 if( (nCurFlags
== Sb_ATTR_NORMAL
)
3135 && !(nFlags
& ( _A_HIDDEN
| _A_SYSTEM
| _A_VOLID
| _A_SUBDIR
) ) )
3137 else if( (nCurFlags
& Sb_ATTR_HIDDEN
) && (nFlags
& _A_HIDDEN
) )
3139 else if( (nCurFlags
& Sb_ATTR_SYSTEM
) && (nFlags
& _A_SYSTEM
) )
3141 else if( (nCurFlags
& Sb_ATTR_VOLUME
) && (nFlags
& _A_VOLID
) )
3143 else if( (nCurFlags
& Sb_ATTR_DIRECTORY
) && (nFlags
& _A_SUBDIR
) )
3153 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, aPath
);
3158 /* keep old Implementation for now
3159 // neues Verzeichnis einlesen
3160 if ( (nParams & PARAM_STR_1) )
3167 DirEntryKind aDirEntryKind = FSYS_KIND_FILE | FSYS_KIND_DIR;
3168 if ( (nParams & PARAM_USHORT_1) && nNr1 )
3171 aDirEntryKind = FSYS_KIND_DIR;
3173 ReportError( GEN_RES_STR0( S_SELECTION_BY_ATTRIBUTE_ONLY_DIRECTORIES ) );
3176 DirEntry aEntry( aString1 );
3177 nErrorcode = aEntry.GetError();
3181 FileStat aFS( aEntry );
3182 if ( !aFS.IsKind( FSYS_KIND_WILD ) && !aFS.IsKind( FSYS_KIND_DIR ) && aEntry.Exists() )
3183 { // Sonderbehandlung für genau einen Eintrag
3184 if ( !aFS.IsKind( FSYS_KIND_DIR ) && ( aDirEntryKind == FSYS_KIND_DIR ) )
3185 pRet->GenReturn ( RET_Value, aSmartMethodId, String() );
3187 pRet->GenReturn ( RET_Value, aSmartMethodId, (String)(aEntry.GetName()) );
3193 pDir = new Dir( aEntry, aDirEntryKind );
3194 nErrorcode = pDir->GetError();
3202 if ( !nErrorcode && ValueOK( aSmartMethodId, GEN_RES_STR0( S_NO_MORE_FILES ), nDirPos+1, pDir->Count()+1 ) )
3204 if ( nDirPos == pDir->Count() )
3205 pRet->GenReturn ( RET_Value, aSmartMethodId, String() );
3207 pRet->GenReturn ( RET_Value, aSmartMethodId, (String)((*pDir)[ nDirPos ].GetName()) );
3214 DirEntry
aFile( aString1
);
3215 nErrorcode
= aFile
.GetError();
3216 if ( FSYS_ERR_OK
== nErrorcode
)
3218 FileStat
aFS( aFile
);
3219 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, static_cast<comm_ULONG
>(aFS
.GetSize()) ); //GetSize() ULONG != comm_ULONG on 64bit
3220 nErrorcode
= aFS
.GetError();
3224 case RC_FileDateTime
:
3226 DirEntry
aFile( aString1
);
3227 nErrorcode
= aFile
.GetError();
3228 if ( FSYS_ERR_OK
== nErrorcode
)
3230 FileStat
aStat( aFile
);
3231 Time
aTime( aStat
.TimeModified() );
3232 Date
aDate( aStat
.DateModified() );
3233 nErrorcode
= aStat
.GetError();
3235 double fSerial
= (double)( aDate
- Date(30,12,1899) );
3236 long nSeconds
= aTime
.GetHour();
3238 nSeconds
+= aTime
.GetMin() * 60;
3239 nSeconds
+= aTime
.GetSec();
3240 double nDays
= ((double)nSeconds
) / (double)(24.0*3600.0);
3243 SbxValueRef xValue
= new SbxValue( SbxDATE
);
3244 xValue
->PutDate( fSerial
);
3246 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, *xValue
);
3251 switch ( nErrorcode
)
3255 case FSYS_ERR_MISPLACEDCHAR
:
3257 ReportError( CUniString("MISPLACEDCHAR") );
3260 case FSYS_ERR_INVALIDCHAR
:
3262 ReportError( CUniString("INVALIDCHAR") );
3265 case FSYS_ERR_NOTEXISTS
:
3267 ReportError( CUniString("NOTEXISTS") );
3270 case FSYS_ERR_ALREADYEXISTS
:
3272 ReportError( CUniString("ALREADYEXISTS") );
3275 case FSYS_ERR_NOTADIRECTORY
:
3277 ReportError( CUniString("NOTADIRECTORY") );
3280 case FSYS_ERR_NOTAFILE
:
3282 ReportError( CUniString("NOTAFILE") );
3285 case FSYS_ERR_INVALIDDEVICE
:
3287 ReportError( CUniString("INVALIDDEVICE") );
3290 case FSYS_ERR_ACCESSDENIED
:
3292 ReportError( CUniString("ACCESSDENIED") );
3295 case FSYS_ERR_LOCKVIOLATION
:
3297 ReportError( CUniString("LOCKVIOLATION") );
3300 case FSYS_ERR_VOLUMEFULL
:
3302 ReportError( CUniString("VOLUMEFULL") );
3305 case FSYS_ERR_ISWILDCARD
:
3307 ReportError( CUniString("ISWILDCARD") );
3310 case FSYS_ERR_NOTSUPPORTED
:
3312 ReportError( CUniString("NOTSUPPORTED") );
3315 case FSYS_ERR_UNKNOWN
:
3317 ReportError( CUniString("UNKNOWN") );
3322 ReportError( CUniString("Not an FSYS Error") );
3328 case RC_TypeKeysDelay
:
3330 if( (nParams
& PARAM_BOOL_1
) )
3332 bDoTypeKeysDelay
= bBool1
;
3334 else if( nParams
& PARAM_USHORT_1
)
3336 nMinTypeKeysDelay
= nNr1
;
3337 if( nParams
& PARAM_USHORT_2
)
3338 nMaxTypeKeysDelay
= nNr2
;
3340 nMaxTypeKeysDelay
= nMinTypeKeysDelay
;
3343 ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS
) );
3346 case RC_GetMouseStyle
:
3349 // if ( DragManager::GetDragManager() )
3350 // aPointer = DragManager::GetDragManager()->GetDragPointer();
3353 Window
*pActualWin
= GetMouseWin();
3355 aPointer
= pActualWin
->GetPointer();
3358 ReportError( GEN_RES_STR1( S_POINTER_OUTSIDE_APPWIN
, RcString( nMethodId
) ) );
3359 aPointer
= Pointer( POINTER_NULL
);
3362 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_ULONG
)aPointer
.GetStyle() );
3365 case RC_UnpackStorage
:
3367 if( (nParams
& PARAM_STR_1
) )
3369 String
aFileName( aString1
);
3371 if( (nParams
& PARAM_STR_2
) )
3372 aDestPath
= DirEntry( aString2
);
3375 aDestPath
= DirEntry( aFileName
);
3376 aDestPath
.SetExtension( CUniString( "plaintext" ) );
3379 #if OSL_DEBUG_LEVEL > 1
3380 USHORT nEntries
= Dir( aDestPath
, FSYS_KIND_FILE
| FSYS_KIND_DIR
).Count();
3381 (void) nEntries
; /* avoid warning about unused parameter */
3383 // The Count is only larger than 2 is the path is a directory which is not empty
3384 // the Count of 2 results from the "." and ".." directory
3385 if ( Dir( aDestPath
, FSYS_KIND_FILE
| FSYS_KIND_DIR
).Count() > 2 )
3386 DirectLog( S_QAError
, GEN_RES_STR1( S_DIRECTORY_NOT_EMPTY
, aDestPath
.GetFull() ) );
3388 SotStorageRef xStorage
= new SotStorage( aFileName
, STREAM_STD_READ
);
3389 if ( xStorage
->GetError() )
3390 ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED
, aFileName
, aDestPath
.GetFull()) );
3392 UnpackStorage( xStorage
, aDestPath
);
3395 ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS
) );
3398 case RC_CloseSysDialog
:
3399 case RC_ExistsSysDialog
:
3401 if( (nParams
& PARAM_USHORT_1
) )
3403 Reference
< XCancellable
> xPicker
;
3406 case CONST_FilePicker
:
3408 xPicker
.set( Reference
< XCancellable
>( svt::GetTopMostFilePicker(), UNO_QUERY
) );
3411 case CONST_FolderPicker
:
3413 xPicker
.set( Reference
< XCancellable
>( svt::GetTopMostFolderPicker(), UNO_QUERY
) );
3417 ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS
) );
3421 case RC_CloseSysDialog
:
3426 ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS
) );
3429 case RC_ExistsSysDialog
:
3431 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_BOOL
)xPicker
.is() );
3435 ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS
) );
3439 ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS
) );
3442 case RC_SAXCheckWellformed
:
3443 case RC_SAXReadFile
:
3445 case RC_SAXGetNodeType
:
3446 case RC_SAXGetAttributeCount
:
3447 case RC_SAXGetAttributeName
:
3448 case RC_SAXGetAttributeValue
:
3449 case RC_SAXGetChildCount
:
3450 case RC_SAXGetElementName
:
3451 case RC_SAXGetChars
:
3453 case RC_SAXSeekElement
:
3454 case RC_SAXHasElement
:
3455 case RC_SAXGetElementPath
:
3462 case RC_RecordMacro
:
3464 if ( ! (nParams
& PARAM_BOOL_1
) )
3467 MacroRecorder::GetMacroRecorder()->SetActionRecord( bBool1
);
3470 case RC_GetDocumentCount
:
3472 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_USHORT
)GetDocWinCount() );
3475 case RC_ActivateDocument
:
3477 if( nParams
& PARAM_USHORT_1
)
3479 if ( ValueOK(aSmartMethodId
, RcString( nMethodId
), nNr1
, GetDocWinCount() ) )
3481 Window
* pWin
= GetDocWin( nNr1
-1 );
3490 ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS
) );
3493 case RC_GetSystemLanguage
:
3495 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (comm_USHORT
)Application::GetSettings().GetLanguage() );
3500 if( (nParams
& PARAM_BOOL_1
) )
3514 pRet
->GenReturn ( RET_Value
, aSmartMethodId
, (BOOL
)bIsProduct
);
3517 case RC_UsePostEvents
:
3519 if( (nParams
& PARAM_BOOL_1
) )
3520 bUsePostEvents
= bBool1
;
3522 bUsePostEvents
= TRUE
;
3526 ReportError( GEN_RES_STR1( S_UNKNOWN_COMMAND
, RcString( nMethodId
) ) );
3528 SendProfile( RcString(nMethodId
) );
3534 BOOL
StatementCommand::UnpackStorage( SotStorageRef xStorage
, DirEntry
&aBaseDir
)
3536 SvStorageInfoList aList
;
3537 xStorage
->FillInfoList( &aList
);
3539 for( USHORT i
= 0; i
< aList
.Count(); i
++ )
3541 SvStorageInfo
& rInfo
= aList
.GetObject( i
);
3542 String aName
= rInfo
.GetName();
3543 DirEntry
aPath ( aBaseDir
);
3544 aPath
+= DirEntry( aName
);
3545 BOOL bIsStorage
= xStorage
->IsStorage( aName
);
3548 SotStorageRef xSubStorage
= xStorage
->OpenSotStorage( aName
, STREAM_STD_READ
);
3549 if ( xSubStorage
->GetError() )
3551 ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED
, aName
, aPath
.GetFull()) );
3554 UnpackStorage( xSubStorage
, aPath
);
3558 if ( !aPath
.MakeDir( TRUE
) )
3560 ReportError( GEN_RES_STR1(S_CANNOT_CREATE_DIRECTORY
, aPath
.GetFull()) );
3563 SotStorageStreamRef xStream
= xStorage
->OpenSotStream( aName
, STREAM_STD_READ
);
3564 SvFileStream
aDestination( aPath
.GetFull(), STREAM_STD_READWRITE
| STREAM_TRUNC
);
3565 (*xStream
) >> aDestination
;
3566 if ( aDestination
.GetError() != ERRCODE_NONE
)
3568 ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED
, aName
, aPath
.GetFull()) );
3571 aDestination
.Close();
3578 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3580 StatementControl::StatementControl( SCmdStream
*pCmdIn
, USHORT nControlIdType
)
3592 QueStatement( NULL
);
3593 if ( nControlIdType
== SIControl
)
3596 pCmdIn
->Read( nId
);
3597 aUId
= SmartId( nId
);
3599 else if ( nControlIdType
== SIStringControl
)
3602 pCmdIn
->Read( aId
);
3603 aUId
= SmartId( aId
);
3607 DBG_ERROR( "Wrong ControlType" );
3610 pCmdIn
->Read( nMethodId
);
3611 pCmdIn
->Read( nParams
);
3613 if( nParams
& PARAM_USHORT_1
) pCmdIn
->Read( nNr1
);
3614 if( nParams
& PARAM_USHORT_2
) pCmdIn
->Read( nNr2
);
3615 if( nParams
& PARAM_USHORT_3
) pCmdIn
->Read( nNr3
);
3616 if( nParams
& PARAM_USHORT_4
) pCmdIn
->Read( nNr4
);
3617 if( nParams
& PARAM_ULONG_1
) pCmdIn
->Read( nLNr1
);
3618 if( nParams
& PARAM_STR_1
) pCmdIn
->Read( aString1
);
3619 if( nParams
& PARAM_STR_2
) pCmdIn
->Read( aString2
);
3620 if( nParams
& PARAM_BOOL_1
) pCmdIn
->Read( bBool1
);
3621 if( nParams
& PARAM_BOOL_2
) pCmdIn
->Read( bBool2
);
3623 #if OSL_DEBUG_LEVEL > 1
3624 m_pDbgWin
->AddText( "Reading Control: UId: " );
3625 m_pDbgWin
->AddText( aUId
.GetText() );
3626 m_pDbgWin
->AddText( " Methode: " );
3627 m_pDbgWin
->AddText( String::CreateFromInt32( nMethodId
) );
3628 m_pDbgWin
->AddText( " Params:" );
3629 if( nParams
& PARAM_USHORT_1
) {m_pDbgWin
->AddText( " n1:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr1
) );}
3630 if( nParams
& PARAM_USHORT_2
) {m_pDbgWin
->AddText( " n2:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr2
) );}
3631 if( nParams
& PARAM_USHORT_3
) {m_pDbgWin
->AddText( " n3:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr3
) );}
3632 if( nParams
& PARAM_USHORT_4
) {m_pDbgWin
->AddText( " n4:" );m_pDbgWin
->AddText( String::CreateFromInt32( nNr4
) );}
3633 if( nParams
& PARAM_ULONG_1
) {m_pDbgWin
->AddText( " nl1:" );m_pDbgWin
->AddText( String::CreateFromInt64( nLNr1
) );}
3634 if( nParams
& PARAM_STR_1
) {m_pDbgWin
->AddText( " s1:" );m_pDbgWin
->AddText( aString1
);}
3635 if( nParams
& PARAM_STR_2
) {m_pDbgWin
->AddText( " s2:" );m_pDbgWin
->AddText( aString2
);}
3636 /* if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );
3637 if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 );*/
3638 m_pDbgWin
->AddText( "\n" );
3642 BOOL
IsDialog(Window
*pWin
)
3643 { // Alles was von SystemWindow abgeleitet ist
3647 switch (pWin
->GetType())
3649 case WINDOW_FLOATINGWINDOW
:
3650 case WINDOW_DOCKINGWINDOW
:
3651 case WINDOW_MODELESSDIALOG
:
3653 case WINDOW_MODALDIALOG
:
3654 case WINDOW_WORKWINDOW
:
3655 case WINDOW_TABDIALOG
:
3657 case WINDOW_MESSBOX
:
3658 case WINDOW_INFOBOX
:
3659 case WINDOW_WARNINGBOX
:
3660 case WINDOW_ERRORBOX
:
3661 case WINDOW_QUERYBOX
:
3662 case WINDOW_BUTTONDIALOG
:
3663 case WINDOW_FILEDIALOG
:
3664 case WINDOW_PRINTDIALOG
:
3665 case WINDOW_PRINTERSETUPDIALOG
:
3667 // ab hier nicht ansprechbar (da nicht implementiert)
3668 case WINDOW_SYSWINDOW
:
3669 case WINDOW_SYSTEMDIALOG
:
3670 case WINDOW_COLORDIALOG
:
3671 case WINDOW_FONTDIALOG
:
3672 case WINDOW_PATHDIALOG
:
3684 BOOL
IsAccessable(Window
*pWin
)
3689 return pWin
->IsEnabled() && pWin
->IsInputEnabled();
3694 // neue Hilfsfunktion
3695 static Window
*ImpGetButton( Window
*pBase
, WinBits nMask
, WinBits nWinBits
)
3697 USHORT n
= pBase
->GetChildCount();
3698 for( USHORT i
= 0 ; i
< n
; i
++ ) {
3699 Window
*pChild
= pBase
->GetChild(i
);
3700 if( pChild
->GetType() == WINDOW_OKBUTTON
3701 || pChild
->GetType() == WINDOW_CANCELBUTTON
3702 || pChild
->GetType() == WINDOW_HELPBUTTON
3703 || pChild
->GetType() == WINDOW_PUSHBUTTON
)
3704 if( !nMask
|| ( pChild
->GetStyle() & nMask
) == nWinBits
)
3710 BOOL
StatementControl::ControlOK( Window
*pControl
, const sal_Char
* cBezeichnung
)
3712 if ( pControl
&& ( ( ( IsAccessable(pControl
) || (nMethodId
& M_WITH_RETURN
) ) &&
3713 pControl
->IsVisible() ) ||
3714 aUId
.Matches( UID_ACTIVE
) ) )
3718 UniString
aBezeichnung( cBezeichnung
, RTL_TEXTENCODING_ASCII_US
);
3719 if ( aBezeichnung
.Len() > 0 )
3722 ReportError( aUId
, GEN_RES_STR1( S_WIN_NOT_FOUND
, aBezeichnung
) );
3723 else if ( !pControl
->IsVisible() )
3724 ReportError( aUId
, GEN_RES_STR1( S_WIN_INVISIBLE
, aBezeichnung
) );
3726 ReportError( aUId
, GEN_RES_STR1( S_WIN_DISABLED
, aBezeichnung
) );
3728 #if OSL_DEBUG_LEVEL > 1
3729 m_pDbgWin
->AddText( aBezeichnung
.AppendAscii(" NotFound or Disabled or Invisible") );
3737 BOOL
StatementList::ValueOK( SmartId aId
, String aBezeichnung
, ULONG nValue
, ULONG nMax
)
3740 if ( nMax
< nValue
)
3742 if ( aBezeichnung
.Len() > 0 )
3743 ReportError( aId
, GEN_RES_STR3( S_NUMBER_TOO_BIG
, aBezeichnung
, UniString::CreateFromInt32( nValue
), UniString::CreateFromInt32( nMax
) ) );
3748 if ( aBezeichnung
.Len() > 0 )
3749 ReportError( aId
, GEN_RES_STR3c3( S_NUMBER_TOO_SMALL
, aBezeichnung
, UniString::CreateFromInt32( nValue
), "1" ) );
3755 USHORT
StatementList::GetCurrentMenues( PopupMenu
*&pPopup
, MenuBar
*&pMenuBar
, Menu
*&pMenu
)
3757 if ( WinPtrValid( pMenuWindow
) )
3758 pMenuBar
= pMenuWindow
->GetMenuBar();
3760 if ( pMenuBar
) // use MenuBar as base
3762 else // use contextmenu as base
3764 pMenu
= PopupMenu::GetActivePopupMenu();
3765 pPopup
= PopupMenu::GetActivePopupMenu();
3771 if ( aSubMenuId1
.GetNum() )
3773 pPopup
= pMenu
->GetPopupMenu(
3774 sal::static_int_cast
< USHORT
>(aSubMenuId1
.GetNum()));
3778 if ( pMenu
&& aSubMenuId2
.GetNum() )
3780 pPopup
= pMenu
->GetPopupMenu(
3781 sal::static_int_cast
< USHORT
>(aSubMenuId2
.GetNum()));
3785 if ( pMenu
&& aSubMenuId3
.GetNum() )
3787 pPopup
= pMenu
->GetPopupMenu(
3788 sal::static_int_cast
< USHORT
>(aSubMenuId3
.GetNum()));
3795 void StatementControl::AnimateMouse( Window
*pControl
, TTHotSpots aWohin
)
3803 long nHeight
= pControl
->GetSizePixel().Height();
3805 aZiel
.Y() += nHeight
/ 2;
3810 Size aSize
= pControl
->GetOutputSizePixel();
3811 aZiel
.Move( aSize
.Width() / 2, aSize
.Height() / 2 );
3816 long nWidth
= pControl
->GetSizePixel().Width();
3817 aZiel
.X() += nWidth
/ 2;
3822 AnimateMouse( pControl
, aZiel
);
3826 void StatementControl::AnimateMouse( Window
*pControl
, Point aWohin
)
3828 Point aAkt
= pControl
->GetPointerPosPixel();
3829 Point aZiel
= aWohin
;
3832 Point aDiff
= aAkt
- aZiel
;
3834 if ( Abs(aDiff
.X()) < Abs(aDiff
.Y()) )
3835 nSteps
= Abs(aDiff
.Y()) / 5;
3837 nSteps
= Abs(aDiff
.X()) / 5;
3844 StatementList::bExecuting
= TRUE
; // Bah ist das ein ekliger Hack
3845 // Das verhindert, daß schon der nächste Befehl ausgeführt wird.
3847 for ( ; nSteps
; nSteps
-- )
3849 if ( Abs((aAkt
- pControl
->GetPointerPosPixel()).X()) > 5 ||
3850 Abs((aAkt
- pControl
->GetPointerPosPixel()).Y()) > 5 )
3852 aAkt
= aZiel
+ aDiff
* nSteps
/ 1000;
3853 pControl
->SetPointerPosPixel(aAkt
);
3856 pControl
->SetPointerPosPixel(aZiel
);
3857 StatementList::bExecuting
= FALSE
; // Bah ist das ein ekliger Hack
3861 BOOL
StatementControl::MaybeDoTypeKeysDelay( Window
*pTestWindow
)
3863 if ( bDoTypeKeysDelay
)
3865 ULONG nTimeWait
= nMinTypeKeysDelay
;
3866 if ( nMaxTypeKeysDelay
!= nMinTypeKeysDelay
)
3867 nTimeWait
+= Time::GetSystemTicks() % ( nMaxTypeKeysDelay
- nMinTypeKeysDelay
);
3869 aTimer
.SetTimeout( nTimeWait
);
3871 StatementList::bExecuting
= TRUE
; // Bah ist das ein ekliger Hack
3872 // Das verhindert, daß schon der nächste Befehl ausgeführt wird.
3873 while ( aTimer
.IsActive() )
3875 SafeReschedule( TRUE
);
3877 StatementList::bExecuting
= FALSE
; // Bah ist das ein ekliger Hack
3878 if ( !WinPtrValid(pTestWindow
) )
3880 ReportError( aUId
, GEN_RES_STR1( S_WINDOW_DISAPPEARED
, MethodString( nMethodId
) ) );
3887 BOOL
StatementControl::HandleVisibleControls( Window
*pControl
)
3889 if( pControl
) // Also auch bei Disabled nicht jedoch bei Invisible
3894 pRet
->GenReturn ( RET_Value
, aUId
, IsAccessable(pControl
) );
3897 pRet
->GenReturn ( RET_Value
, aUId
, pControl
->IsVisible() );
3900 if ( pControl
->GetType() == WINDOW_DOCKINGWINDOW
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW
)
3901 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für FloatingWindows
3902 if ( pControl
->GetType() == WINDOW_TABCONTROL
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG
)
3903 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für TabDialoge
3904 if ( pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW
)
3905 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für Border
3906 if ( (nParams
& PARAM_BOOL_1
) && bBool1
)
3907 pControl
= pControl
->GetWindow( WINDOW_OVERLAP
);
3909 if ( pControl
->GetType() == WINDOW_DOCKINGWINDOW
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW
)
3911 Point aPos
= pControl
->GetPosPixel();
3912 aPos
= pControl
->GET_REAL_PARENT()->OutputToScreenPixel( aPos
);
3913 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)aPos
.X() );
3916 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pControl
->GetPosPixel().X() );
3919 if ( pControl
->GetType() == WINDOW_DOCKINGWINDOW
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW
)
3920 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für FloatingWindows
3921 if ( pControl
->GetType() == WINDOW_TABCONTROL
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG
)
3922 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für TabDialoge
3923 if ( pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW
)
3924 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für Border
3925 if ( (nParams
& PARAM_BOOL_1
) && bBool1
)
3926 pControl
= pControl
->GetWindow( WINDOW_OVERLAP
);
3928 if ( pControl
->GetType() == WINDOW_DOCKINGWINDOW
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW
)
3930 Point aPos
= pControl
->GetPosPixel();
3931 aPos
= pControl
->GET_REAL_PARENT()->OutputToScreenPixel( aPos
);
3932 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)aPos
.Y() );
3935 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pControl
->GetPosPixel().Y() );
3938 if ( pControl
->GetType() == WINDOW_DOCKINGWINDOW
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW
)
3939 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für FloatingWindows
3940 if ( pControl
->GetType() == WINDOW_TABCONTROL
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG
)
3941 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für TabDialoge
3942 if ( pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW
)
3943 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für Border
3944 if ( (nParams
& PARAM_BOOL_1
) && bBool1
)
3945 pControl
= pControl
->GetWindow( WINDOW_OVERLAP
);
3947 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pControl
->GetSizePixel().Width() );
3950 if ( pControl
->GetType() == WINDOW_DOCKINGWINDOW
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW
)
3951 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für FloatingWindows
3952 if ( pControl
->GetType() == WINDOW_TABCONTROL
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG
)
3953 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für TabDialoge
3954 if ( pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW
)
3955 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für Border
3956 if ( (nParams
& PARAM_BOOL_1
) && bBool1
)
3957 pControl
= pControl
->GetWindow( WINDOW_OVERLAP
);
3959 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pControl
->GetSizePixel().Height() );
3963 if ( pControl
->GetType() == WINDOW_DOCKINGWINDOW
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW
)
3964 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für FloatingWindows
3965 if ( pControl
->GetType() == WINDOW_TABCONTROL
&& pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG
)
3966 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für TabDialoge
3967 if ( pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW
)
3968 pControl
= pControl
->GET_REAL_PARENT(); // Sonderbehandlung für Border
3969 if ( (nParams
& PARAM_BOOL_1
) && bBool1
)
3970 pControl
= pControl
->GetWindow( WINDOW_OVERLAP
);
3972 Bitmap aBmp
= pControl
->SnapShot();
3973 if ( pControl
->GetType() == WINDOW_WORKWINDOW
)
3975 Point aStart
= pControl
->GetPosPixel();
3976 if ( !(nParams
& PARAM_USHORT_4
) )
3978 nParams
|= PARAM_USHORT_1
;
3979 nParams
|= PARAM_USHORT_2
;
3980 nParams
|= PARAM_USHORT_3
;
3981 nParams
|= PARAM_USHORT_4
;
3982 nNr1
= (USHORT
)-aStart
.X();
3983 nNr2
= (USHORT
)-aStart
.Y();
3984 nNr3
= (USHORT
)pControl
->GetSizePixel().Width() + 2*(USHORT
)aStart
.X();
3985 nNr4
= (USHORT
)pControl
->GetSizePixel().Height() + 2*(USHORT
)aStart
.Y();
3987 nNr1
= std::max((USHORT
)-aStart
.X(),nNr1
);
3988 nNr2
= std::max((USHORT
)-aStart
.Y(),nNr2
);
3989 nNr3
= std::min((USHORT
)(pControl
->GetSizePixel().Width() + 2*(USHORT
)aStart
.X()),nNr3
);
3990 nNr4
= std::min((USHORT
)(pControl
->GetSizePixel().Height() + 2*(USHORT
)aStart
.Y()),nNr4
);
3992 if( nParams
& PARAM_USHORT_4
)
3994 Point
aPt(-nNr1
,-nNr2
);
3995 Size
aSz(nNr3
,nNr4
);
3996 VirtualDevice
aVDev( *pControl
);
3998 aVDev
.SetOutputSizePixel( aSz
);
3999 aVDev
.DrawBitmap( aPt
, aBmp
);
4000 aBmp
= aVDev
.GetBitmap( Point(), aSz
);
4004 fOut
.Open(aString1
,STREAM_STD_WRITE
);
4006 if ( fOut
.GetError() )
4007 ReportError( aUId
, GEN_RES_STR1( S_ERROR_SAVING_IMAGE
, UniString::CreateFromInt32( fOut
.GetError() ) ) );
4011 case M_GetFixedTextCount
:
4013 pRet
->GenReturn ( RET_Value
, aUId
, CountWinByRT( pControl
, WINDOW_FIXEDTEXT
, TRUE
) );
4016 case M_GetFixedText
:
4018 if( ( nParams
& PARAM_USHORT_1
) == 0 )
4021 FixedText
* pFixedText
= (FixedText
*)GetWinByRT( pControl
, WINDOW_FIXEDTEXT
, TRUE
, nNr1
-1 );
4023 pRet
->GenReturn ( RET_Value
, aUId
, pFixedText
->GetText() );
4025 ValueOK(aUId
, MethodString( nMethodId
),nNr1
,CountWinByRT( pControl
, WINDOW_FIXEDTEXT
, TRUE
) );
4031 SendProfile( UIdString( aUId
).Append('.').Append( MethodString( nMethodId
) ) );
4037 BOOL
StatementControl::HandleCommonMethods( Window
*pControl
)
4039 switch( nMethodId
) // Diese können an jedem Window ausgeführt werden
4041 case M_Exists
: // Oben schon Behandelt. Unterdrückt hier nur Fehler
4049 if ( pControl
->GetText().Len() == 0 && IsDocFrame( pControl
->GetWindow( WINDOW_FRAME
) ) )
4050 pRet
->GenReturn ( RET_Value
, aUId
, pControl
->GetWindow( WINDOW_FRAME
)->GetText());
4052 pRet
->GenReturn ( RET_Value
, aUId
, pControl
->GetText());
4057 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pControl
->GetType() );
4062 if( !(nParams
& PARAM_USHORT_1
) ) // Anzahl wiederholungen
4064 if( !(nParams
& PARAM_BOOL_1
) ) // Follow Focus
4065 bBool1
= FALSE
; // so bleibt das bisherige Verhalten
4067 if ( !bBool1
) // Altes Verhalten
4068 pControl
->GrabFocus();
4069 else // If focus is not inside given control we grab it once.
4071 Window
*pFocus
= GetpApp()->GetFocusWindow();
4072 if ( !pFocus
|| !pControl
->IsWindowOrChild( pFocus
, TRUE
) )
4073 pControl
->GrabFocus();
4077 // maybe this can get removed since we are using GetPreferredKeyInputWindow()
4078 if ( pControl
->GetType() == WINDOW_COMBOBOX
)
4079 { // Bei COMBOBOX an das Edit direkt liefern
4080 Window
*pTemp
= NULL
;
4081 for ( USHORT i
= 0 ; i
< pControl
->GetChildCount() && !pTemp
; i
++ )
4082 if ( pControl
->GetChild( i
)->GetType() == WINDOW_EDIT
)
4083 pTemp
= pControl
->GetChild( i
);
4088 Window
*pDeliverHere
= pControl
;
4089 for (int j
= 0; j
< nNr1
; j
++)
4090 for (xub_StrLen i
= 0; i
< aString1
.Len(); i
++)
4092 if ( StatementList::bUsePostEvents
)
4093 { // grab focus every time
4094 Window
*pFocus
= GetpApp()->GetFocusWindow();
4095 if ( !pFocus
|| !pControl
->IsWindowOrChild( pFocus
, TRUE
) )
4096 pControl
->GrabFocus();
4098 if ( bBool1
) // Jedesmal das FocusWindow finden
4100 Window
*pFocus
= GetpApp()->GetFocusWindow();
4101 if ( pFocus
&& pControl
->IsWindowOrChild( pFocus
, TRUE
) )
4102 pDeliverHere
= pFocus
;
4103 else // sonst fallback auf das Basisfenster
4104 pDeliverHere
= pControl
;
4106 pDeliverHere
= pDeliverHere
->GetPreferredKeyInputWindow();
4108 if ( ((USHORT
)aString1
.GetChar(i
)) <= 7 )
4111 switch (aString1
.GetChar(i
))
4113 case 1: nVal
= aString1
.GetChar(i
+1) + (aString1
.GetChar(i
+2) << 8);
4116 case 3: nVal
= (aString1
.GetChar(i
+1) << 8);
4119 case 5: nVal
= aString1
.GetChar(i
+1);
4126 // find out the keycode
4127 USHORT nKeygroup
= nVal
& KEYGROUP_TYPE
;
4128 USHORT nKeyCode
= nVal
& KEY_CODE
;
4133 aCh
= nKeyCode
- KEY_0
+ '0';
4135 case KEYGROUP_ALPHA
:
4136 aCh
= nKeyCode
- KEY_A
;
4137 if ( nVal
& KEY_MOD1
)
4139 else if ( nVal
& KEY_SHIFT
)
4145 { // CR ESC TAB BACK
4146 ByteString
aPrintableMisc("\x0d\x1b\x09\x08 **+-*/.,<>=",16);
4147 if ( nKeyCode
-KEY_RETURN
< aPrintableMisc
.Len()
4148 && nKeyCode
!= KEY_INSERT
&& nKeyCode
!= KEY_DELETE
)
4149 aCh
= aPrintableMisc
.GetChar( nKeyCode
-KEY_RETURN
);
4154 case KEYGROUP_CURSOR
:
4155 case KEYGROUP_FKEYS
:
4159 aEvent
= KeyEvent(aCh
,KeyCode(nVal
& 0xFFF,nVal
& 0xF000));
4164 String aPrintableMisc
= CUniString("\x0d\x1b\x09\x08 xx+-*/.,<>=");
4165 sal_Unicode aCh
= aString1
.GetChar(i
);
4166 if ( aCh
>= 'a' && aCh
<= 'z' )
4167 aEvent
= KeyEvent(aCh
, KeyCode(KEYGROUP_ALPHA
+ aCh
-'a', 0));
4168 else if ( aCh
>= 'A' && aCh
<= 'Z' )
4169 aEvent
= KeyEvent(aCh
, KeyCode(KEYGROUP_ALPHA
+ aCh
-'a', KEY_SHIFT
));
4170 else if ( aCh
>= '0' && aCh
<= '9' )
4171 aEvent
= KeyEvent(aCh
, KeyCode(KEYGROUP_NUM
+ aCh
-'0', 0));
4172 else if ( aPrintableMisc
.Search(aCh
) != STRING_NOTFOUND
)
4173 aEvent
= KeyEvent(aCh
, KeyCode(KEYGROUP_MISC
+ (USHORT
)aPrintableMisc
.Search(aCh
), 0));
4174 else // Sollte eigentlich nicht auftreten
4175 aEvent
= KeyEvent(aCh
, KeyCode());
4177 ImplKeyInput( pDeliverHere
, aEvent
);
4178 if ( !MaybeDoTypeKeysDelay( pControl
) )
4181 SafeReschedule();SafeReschedule();SafeReschedule();
4186 #define CalcMouseButton\
4187 USHORT nButton = MOUSE_LEFT;\
4188 if ( (nParams & PARAM_USHORT_3) )\
4192 case 1: nButton = MOUSE_LEFT; break;\
4193 case 2: nButton = MOUSE_MIDDLE; break;\
4194 case 3: nButton = MOUSE_RIGHT; break;\
4201 Size aS
= pControl
->GetOutputSizePixel();
4202 Point aPos
= Point(aS
.Width() * nNr1
/ 100,aS
.Height() * nNr2
/ 100);
4203 Window
*pActualWin
= pControl
->FindWindow( aPos
);
4204 // AnimateMouse( pControl, aPos );
4207 aPos
= pActualWin
->AbsoluteScreenToOutputPixel( pControl
->OutputToAbsoluteScreenPixel ( aPos
) );
4208 // aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4210 pActualWin
= pControl
;
4212 AnimateMouse( pActualWin
, aPos
);
4213 pActualWin
->GrabFocus();
4214 MouseEvent
aMEvnt(aPos
,1,MOUSE_SIMPLECLICK
|MOUSE_SELECT
,nButton
);
4215 ImplMouseButtonDown( pActualWin
, aMEvnt
);
4221 Size aS
= pControl
->GetOutputSizePixel();
4222 Point aPos
= Point(aS
.Width() * nNr1
/ 100,aS
.Height() * nNr2
/ 100);
4223 Window
*pActualWin
= pControl
->FindWindow( aPos
);
4226 aPos
= pActualWin
->AbsoluteScreenToOutputPixel( pControl
->OutputToAbsoluteScreenPixel ( aPos
) );
4227 // aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4229 pActualWin
= pControl
;
4231 AnimateMouse( pActualWin
, aPos
);
4232 // pActualWin->GrabFocus();
4233 MouseEvent
aMEvt( aPos
, 1, MOUSE_SIMPLECLICK
|MOUSE_SELECT
, nButton
);
4234 ImplMouseButtonUp( pActualWin
, aMEvt
);
4240 Size aS
= pControl
->GetOutputSizePixel();
4241 Point aPos
= Point(aS
.Width() * nNr1
/ 100,aS
.Height() * nNr2
/ 100);
4242 Window
*pActualWin
= pControl
->FindWindow( aPos
);
4246 aPos
= pActualWin
->AbsoluteScreenToOutputPixel( pControl
->OutputToAbsoluteScreenPixel ( aPos
) );
4247 // aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4250 pActualWin
= pControl
;
4252 AnimateMouse( pActualWin
, aPos
);
4253 // pActualWin->GrabFocus();
4254 MouseEvent
aMEvt( aPos
, 0, MOUSE_SIMPLEMOVE
|MOUSE_DRAGMOVE
, nButton
);
4255 ImplMouseMove( pActualWin
, aMEvt
);
4258 case M_MouseDoubleClick
:
4261 Size aS
= pControl
->GetOutputSizePixel();
4262 Point aPos
= Point(aS
.Width() * nNr1
/ 100,aS
.Height() * nNr2
/ 100);
4263 Window
*pActualWin
= pControl
->FindWindow( aPos
);
4267 aPos
= pActualWin
->AbsoluteScreenToOutputPixel( pControl
->OutputToAbsoluteScreenPixel ( aPos
) );
4268 // aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4271 pActualWin
= pControl
;
4273 AnimateMouse( pActualWin
, aPos
);
4274 pActualWin
->GrabFocus();
4276 aMEvnt
= MouseEvent(aPos
,1,MOUSE_SIMPLECLICK
|MOUSE_SELECT
,nButton
);
4277 ImplMouseButtonDown( pActualWin
, aMEvnt
);
4278 ImplMouseButtonUp ( pActualWin
, aMEvnt
);
4279 aMEvnt
= MouseEvent(aPos
,2,MOUSE_SIMPLECLICK
|MOUSE_SELECT
,nButton
);
4280 ImplMouseButtonDown( pActualWin
, aMEvnt
);
4281 ImplMouseButtonUp ( pActualWin
, aMEvnt
);
4284 case M_DisplayPercent
:
4286 ModelessDialog
*pDlg
= new ModelessDialog(NULL
);
4287 pDlg
->SetOutputSizePixel(Size(100,30));
4289 Edit
*pMyEd
= new Edit(pDlg
,WB_CENTER
| WB_BORDER
);
4290 pMyEd
->SetSizePixel(Size(100,30));
4291 pDlg
->SetText(CUniString("Schließen"));
4294 ULONG nTime
= Time().GetTime();
4296 while (pDlg
->IsVisible())
4299 for (int i
= 1 ; i
<10 ; i
++)
4301 Point Pos
= pControl
->GetPointerPosPixel();
4302 Size Siz
=pControl
->GetOutputSizePixel();
4303 if ( Time().GetTime() - nTime
> 10 )
4305 nTime
= Time().GetTime();
4306 pMyEd
->SetText(UniString::CreateFromInt32(Pos
.X()*100/Siz
.Width()).AppendAscii("%x").Append( UniString::CreateFromInt32(Pos
.Y()*100/Siz
.Height()) ).Append('%'));
4314 case M_OpenContextMenu
:
4316 aSubMenuId1
= SmartId();
4317 aSubMenuId2
= SmartId();
4318 aSubMenuId3
= SmartId();
4321 ToolBox
* pTB
= (ToolBox
*)pControl
;
4322 if ( (pControl
->GetType() == WINDOW_TOOLBOX
) && pTB
->IsMenuEnabled() )
4324 pTB
->ExecuteCustomMenu();
4325 /* Rectangle aRect = pTB->GetMenubuttonRect();
4326 AnimateMouse( pControl, aRect.Center() );
4327 MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
4328 ImplMouseButtonDown( pTB, aMEvnt );*/
4332 BOOL bAtMousePos
= ( nParams
& PARAM_BOOL_1
) && bBool1
;
4335 aPos
= pControl
->GetPointerPosPixel();
4336 Window
*pActualWin
= pControl
->FindWindow( aPos
);
4340 aPos
= pActualWin
->AbsoluteScreenToOutputPixel( pControl
->OutputToAbsoluteScreenPixel ( aPos
) );
4341 // aPos = pActualWin->ScreenToOutputPixel( pControl->OutputToScreenPixel ( aPos ) );
4342 pControl
= pActualWin
;
4345 CommandEvent
aEvent( aPos
, COMMAND_CONTEXTMENU
, bAtMousePos
);
4346 ImplCommand( pControl
, aEvent
);
4352 aSubMenuId1
= SmartId();
4353 aSubMenuId2
= SmartId();
4354 aSubMenuId3
= SmartId();
4357 while ( pControl
&& !( ( pControl
->GetType() == WINDOW_SYSWINDOW
|| pControl
->GetType() == WINDOW_WORKWINDOW
) && ControlOK( pControl
, "" ) ) )
4358 pControl
= pControl
->GET_REAL_PARENT();
4360 if ( pControl
&& ((SystemWindow
*)pControl
)->GetMenuBar() )
4361 pMenuWindow
= ((SystemWindow
*)pControl
);
4363 ReportError( GEN_RES_STR1( S_NO_MENU
, MethodString( nMethodId
) ) );
4372 WindowAlign aWindowAlign
= WINDOWALIGN_LEFT
;
4373 if ( (nParams
& PARAM_USHORT_1
) )
4377 case CONST_ALIGN_LEFT
:
4378 aWindowAlign
= WINDOWALIGN_LEFT
;
4380 case CONST_ALIGN_TOP
:
4381 aWindowAlign
= WINDOWALIGN_TOP
;
4383 case CONST_ALIGN_RIGHT
:
4384 aWindowAlign
= WINDOWALIGN_RIGHT
;
4386 case CONST_ALIGN_BOTTOM
:
4387 aWindowAlign
= WINDOWALIGN_BOTTOM
;
4390 ReportError( aUId
, GEN_RES_STR1( S_INVALID_POSITION
, MethodString( nMethodId
) ) );
4394 Window
* pTemp
= NULL
;
4395 while ( !pTemp
&& pControl
)
4397 pTemp
= GetFadeSplitWin( pControl
, aWindowAlign
);
4398 pControl
= pControl
->GET_REAL_PARENT();
4403 ReportError( aUId
, GEN_RES_STR1( S_SPLITWIN_NOT_FOUND
, MethodString( nMethodId
) ) );
4407 pControl
= pTemp
; // So daß wir unten ohne Fehler durchkommen
4408 SplitWindow
*pSW
= (SplitWindow
*) pTemp
;
4410 // Rectangle GetAutoHideRect() const;
4411 // Rectangle GetFadeInRect() const;
4412 // Rectangle GetFadeOutRect() const;
4417 if ( pSW
->IsFadeInButtonVisible() )
4421 if ( pSW
->IsFadeOutButtonVisible() )
4425 if ( ( pSW
->GetAutoHideState() && bBool1
)
4426 || ( !pSW
->GetAutoHideState() && !bBool1
) )
4429 Point
aPt( pSW
->GetAutoHideRect().Center() );
4430 aMEvnt
= MouseEvent( aPt
,1,MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
4431 ImplMouseButtonDown( pControl
, aMEvnt
, FORCE_DIRECT_CALL
);
4432 ImplMouseButtonUp ( pControl
, aMEvnt
, FORCE_DIRECT_CALL
);
4437 pRet
->GenReturn ( RET_Value
, aUId
, pSW
->IsFadeOutButtonVisible() );
4440 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)!pSW
->GetAutoHideState() );
4443 ReportError( aUId
, GEN_RES_STR1( S_INTERNAL_ERROR
, MethodString( nMethodId
) ) );
4445 SendProfile( UIdString( aUId
).Append('.').Append( MethodString( nMethodId
) ) );
4448 case M_StatusGetText
:
4449 case M_StatusIsProgress
:
4450 case M_StatusGetItemCount
:
4451 case M_StatusGetItemId
:
4453 StatusBar
*pStatus
= NULL
;
4454 while ( !pStatus
&& pControl
)
4456 pStatus
= (StatusBar
*)GetWinByRT( pControl
, WINDOW_STATUSBAR
, TRUE
);
4457 pControl
= pControl
->GET_REAL_PARENT();
4462 ReportError( aUId
, GEN_RES_STR1( S_NO_STATUSBAR
, MethodString( nMethodId
) ) );
4466 switch ( nMethodId
)
4468 case M_StatusGetText
:
4470 if ( (nParams
& PARAM_USHORT_1
) )
4472 if ( pStatus
->AreItemsVisible() )
4473 pRet
->GenReturn ( RET_Value
, aUId
, String(pStatus
->GetItemText(nNr1
)));
4475 ReportError( aUId
, GEN_RES_STR1( S_ITEMS_INVISIBLE
, MethodString( nMethodId
) ) );
4479 if ( pStatus
->AreItemsVisible() )
4481 if ( pStatus
->GetItemCount() == 1 )
4483 pRet
->GenReturn ( RET_Value
, aUId
, pStatus
->GetItemText( pStatus
->GetItemId(0) ));
4487 pRet
->GenReturn ( RET_Value
, aUId
, String() );
4491 pRet
->GenReturn ( RET_Value
, aUId
, (String
)pStatus
->GetText() );
4495 case M_StatusIsProgress
:
4497 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)pStatus
->IsProgressMode() );
4500 case M_StatusGetItemCount
:
4501 if ( pStatus
->AreItemsVisible() )
4502 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(pStatus
->GetItemCount()));
4504 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(0));
4506 case M_StatusGetItemId
:
4507 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,pStatus
->GetItemCount()) )
4508 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(pStatus
->GetItemId(nNr1
-1)));
4513 case M_HasScrollBar
:
4514 case M_IsScrollBarEnabled
:
4516 if ( (nParams
| PARAM_USHORT_1
) != PARAM_USHORT_1
) // so there are other params
4518 ReportError( aUId
, GEN_RES_STR0( S_INVALID_PARAMETERS
) );
4522 if( !(nParams
& PARAM_USHORT_1
) )
4523 nNr1
= CONST_ALIGN_RIGHT
; // default is right Scrollbar(vertical)
4525 if ( (nNr1
!= CONST_ALIGN_RIGHT
) && (nNr1
!= CONST_ALIGN_BOTTOM
) )
4527 ReportError( aUId
, GEN_RES_STR1( S_INVALID_POSITION
, MethodString( nMethodId
) ) );
4531 ScrollBar
*pScroll
= NULL
;
4534 while ( !pScroll
&& pControl
&& nSteps
-- )
4536 pScroll
= GetScrollBar( pControl
, nNr1
, TRUE
);
4537 pControl
= pControl
->GET_REAL_PARENT();
4540 switch ( nMethodId
)
4542 case M_HasScrollBar
:
4545 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)TRUE
);
4547 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)FALSE
);
4550 case M_IsScrollBarEnabled
:
4554 ReportError( aUId
, GEN_RES_STR1( S_NO_SCROLLBAR
, MethodString( nMethodId
) ) );
4557 pRet
->GenReturn ( RET_Value
, aUId
, pScroll
->IsEnabled() );
4570 BOOL
StatementControl::Execute()
4573 BOOL bStatementDone
= TRUE
;
4578 #if OSL_DEBUG_LEVEL > 1
4579 m_pDbgWin
->AddText( "Skipping Window: " );
4580 m_pDbgWin
->AddText( aUId
.GetText() );
4581 m_pDbgWin
->AddText( " Method: " );
4582 m_pDbgWin
->AddText( String::CreateFromInt32( nMethodId
) );
4583 m_pDbgWin
->AddText( "\n" );
4591 #if OSL_DEBUG_LEVEL > 1
4592 m_pDbgWin
->AddText( "Executing Window: " );
4593 m_pDbgWin
->AddText( aUId
.GetText() );
4594 m_pDbgWin
->AddText( " Method: " );
4595 m_pDbgWin
->AddText( String::CreateFromInt32( nMethodId
) );
4596 m_pDbgWin
->AddText( "\n" );
4600 if ( aUId
.Matches( UID_ACTIVE
) )
4601 pControl
= GetAnyActive();
4604 BOOL bSearchButtonOnToolbox
= (nParams
== PARAM_NONE
) && ((M_Click
== nMethodId
) || (M_TearOff
== nMethodId
) || (M_IsEnabled
== nMethodId
) || (M_OpenMenu
== nMethodId
));
4605 bSearchButtonOnToolbox
|= (nParams
== PARAM_USHORT_1
) && (M_GetState
== nMethodId
);
4606 if ( nMethodId
== M_TypeKeys
|| nMethodId
== M_MouseDown
4607 || nMethodId
== M_MouseUp
|| nMethodId
== M_MouseMove
4608 || nMethodId
== M_SnapShot
)
4611 if ( /*(nMethodId == M_SnapShot || nMethodId == M_TypeKeys) &&*/ !pControl
)
4612 pControl
= SearchTree( aUId
,bSearchButtonOnToolbox
);
4615 pControl
= SearchTree( aUId
,bSearchButtonOnToolbox
);
4619 if ( pControl
&& pControl
->GetType() == WINDOW_TOOLBOX
)
4621 if ( !aUId
.Matches( pControl
->GetSmartUniqueOrHelpId() ) )
4622 { // Also wenn wir irgendwas auf einer Toolbox gefunden haben
4623 switch ( nMethodId
)
4631 nMethodId
= _M_IsEnabled
; // Umlabeln, da die Behandlung essentiell anders ist!
4640 switch ( nMethodId
)
4645 USHORT aSeconds
= aT
.GetMin()*60+aT
.GetSec();
4646 if ( !bBool2
) // wurde im Konstruktor auf FALSE gesetzt
4650 if( !(nParams
& PARAM_USHORT_1
) )
4651 nNr1
= 0; // defaultmäßig sofort zurück
4653 if ( aSeconds
< nNr2
) // Falls die Stunde umgesprungen ist
4656 if ( /* !IsAccessable(pControl)#87019# */ !pControl
|| !pControl
->IsVisible() )
4658 if ( ((nMethodId
== M_Exists
) && pControl
) ||
4659 ((nMethodId
== M_NotExists
) && !pControl
) )
4660 { // Wenn Bedingung erfüllt
4661 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)TRUE
);
4664 if ( aSeconds
<= nNr2
+ nNr1
) // Zeit ist noch nicht abgelaufen
4667 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)FALSE
);
4678 if( pControl
) // Das Fenster Existiert irgendwo, kann aber auch hidden sein!
4680 nRT
= ImpGetRType( pControl
, aUId
); // If not Numeric pControl is used
4681 #if OSL_DEBUG_LEVEL > 1
4682 m_pDbgWin
->AddText( "Type is: " );
4683 m_pDbgWin
->AddText( String::CreateFromInt32( nRT
) );
4684 m_pDbgWin
->AddText( "\n" );
4688 if ( nRT
== C_Window
&& // Search for WorkWindow to satisfy these commands
4689 ( nMethodId
== M_Close
4690 // || nMethodId == M_Size
4691 // || nMethodId == M_Move
4692 || nMethodId
== M_IsMax
4693 || nMethodId
== M_IsMin
4694 || nMethodId
== M_IsRestore
4695 || nMethodId
== M_Minimize
4696 || nMethodId
== M_Maximize
4697 || nMethodId
== M_Restore
) )
4699 Window
* pNewControl
= pControl
;
4700 while ( pNewControl
&& pNewControl
->GetType() != WINDOW_WORKWINDOW
)
4701 pNewControl
= pNewControl
->GET_REAL_PARENT();
4705 pControl
= pNewControl
;
4711 if ( (!ControlOK( pControl
, "" )) && ( nMethodId
!= M_SnapShot
) && (nRetryCount
--))
4713 #if OSL_DEBUG_LEVEL > 1
4714 m_pDbgWin
->AddText( CUniString("Reschedule command (").Append( UniString::CreateFromInt32(nRetryCount
) ).AppendAscii(")\n") );
4719 if( ControlOK( pControl
, "" ) )
4721 if ( nMethodId
== M_OpenContextMenu
&& !bBool2
)
4723 pControl
->GrabFocus(); // to get asyncron focus on unix
4727 // TODO: handle GetFocus for all Methods and Windows like this (remove part below)
4728 // See for impact of changed focus for HandleVisibleControls() (taking Snapshots might be different, possible exclude those methods)
4729 if (( (nRT
== C_TreeListBox
) && !bBool2
)
4730 && nMethodId
!= M_TypeKeys
// TypeKeys macht das selbst, falls eigenes Focushandling gewünscht
4731 && nMethodId
!= M_MouseDown
4732 && nMethodId
!= M_MouseUp
4733 && nMethodId
!= M_MouseMove
4734 /*&& nMethodId != M_MouseDoubleClick*/ )
4736 if ( !pControl
->HasFocus() )
4738 pControl
->GrabFocus();
4740 while ( i
-- && !pControl
->HasFocus() ) // reschedule a bit
4743 if ( !WinPtrValid( pControl
) )
4746 if ( !pControl
->HasFocus() ) // to get asyncronous focus
4757 if ( HandleVisibleControls( pControl
) )
4762 if( ControlOK( pControl
, "Window/Control" ) )
4764 if (((( nRT
< C_TabPage
&& nRT
> C_TabControl
)
4765 || nRT
== C_PatternBox
4767 || nRT
== C_ValueSet
4769 || nRT
== C_TreeListBox
4771 || nMethodId
== M_OpenContextMenu
)
4772 && nMethodId
!= M_TypeKeys
// TypeKeys macht das selbst, falls eigenes Focushandling gewünscht
4773 && nMethodId
!= M_MouseDown
4774 && nMethodId
!= M_MouseUp
4775 && nMethodId
!= M_MouseMove
4776 /*&& nMethodId != M_MouseDoubleClick*/ )
4777 pControl
->GrabFocus();
4779 /* leads to problems because settext sets the text whereas typekeys adds to the text.
4780 if ( bDoTypeKeysDelay && nMethodId == M_SetText && ( nParams & PARAM_STR_1 ) )
4781 { // Hier wird das Statement auf ein TypeKeys umgebogen
4782 nMethodId = M_TypeKeys;
4783 nParams = PARAM_BOOL_1 | PARAM_STR_1;
4785 pControl->GrabFocus();
4788 if ( !HandleCommonMethods( pControl
) )
4796 if ( (nParams
& PARAM_USHORT_1
) )
4798 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((TabControl
*)pControl
)->GetPageCount() ) )
4799 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)((TabControl
*)pControl
)->GetPageId(nNr1
-1));
4802 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)((TabControl
*)pControl
)->GetCurPageId());
4804 case M_GetPageCount
:
4805 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)((TabControl
*)pControl
)->GetPageCount());
4808 if (((TabControl
*)pControl
)->GetCurPageId())
4809 ((TabControl
*)pControl
)->DeactivatePage();
4810 ((TabControl
*)pControl
)->SetCurPageId( nNr1
);
4811 ((TabControl
*)pControl
)->ActivatePage();
4814 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((TabControl
*)pControl
)->GetPageCount() ) )
4816 if (((TabControl
*)pControl
)->GetCurPageId())
4817 ((TabControl
*)pControl
)->DeactivatePage();
4818 ((TabControl
*)pControl
)->SetCurPageId( ((TabControl
*)pControl
)->GetPageId( nNr1
-1 ) );
4819 ((TabControl
*)pControl
)->ActivatePage();
4823 pRet
->GenReturn ( RET_Value
, aUId
, static_cast<comm_ULONG
>(((TabControl
*)pControl
)->GetTabPage(((TabControl
*)pControl
)->GetCurPageId())->GetSmartUniqueOrHelpId().GetNum())); //GetNum() ULONG != comm_ULONG on 64bit
4826 { // Wegen lokaler Variablen
4827 TabControl
*pTControl
= ((TabControl
*)pControl
);
4828 USHORT nActive
= pTControl
->GetCurPageId();
4831 i
= pTControl
->GetPagePos( pTControl
->GetCurPageId() );
4832 for ( anz
=0 ; anz
< pTControl
->GetPageCount() && nID
!= nLNr1
; anz
++ )
4834 pTControl
->SelectTabPage( pTControl
->GetPageId(i
) );
4835 /*if (pTControl->GetCurPageId())
4836 pTControl->DeactivatePage();
4837 pTControl->SetCurPageId( pTControl->GetPageId(i) );
4838 pTControl->ActivatePage();*/
4839 nID
= pTControl
->GetTabPage(pTControl
->GetCurPageId())->GetSmartUniqueOrHelpId().GetNum();
4841 if ( i
>= pTControl
->GetPageCount() )
4843 if ( !MaybeDoTypeKeysDelay( pTControl
) || !MaybeDoTypeKeysDelay( pTControl
) || !MaybeDoTypeKeysDelay( pTControl
) ) // 3 Mal aufrufen
4848 pTControl
->SelectTabPage( nActive
);
4849 /*if (pTControl->GetCurPageId())
4850 pTControl->DeactivatePage();
4851 pTControl->SetCurPageId( nActive );
4852 pTControl->ActivatePage();*/
4853 ReportError( SmartId( nLNr1
), GEN_RES_STR1( S_TABPAGE_NOT_FOUND
, MethodString( nMethodId
) ) );
4858 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "TabControl" ) );
4863 case C_ImageRadioButton
:
4866 case M_AnimateMouse
:
4867 AnimateMouse( pControl
, MitteLinks
);
4870 pRet
->GenReturn ( RET_Value
, aUId
, ((RadioButton
*)pControl
)->IsChecked());
4873 ((RadioButton
*)pControl
)->Check();
4874 ((RadioButton
*)pControl
)->Click();
4877 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "RadioButton" ) );
4885 case M_AnimateMouse
:
4886 AnimateMouse( pControl
, MitteLinks
);
4889 pRet
->GenReturn ( RET_Value
, aUId
, comm_BOOL( ((TriStateBox
*)pControl
)->GetState() == STATE_CHECK
) );
4892 pRet
->GenReturn ( RET_Value
, aUId
, comm_BOOL( ((TriStateBox
*)pControl
)->GetState() == STATE_DONTKNOW
) );
4895 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(((TriStateBox
*)pControl
)->GetState()));
4898 ((TriStateBox
*)pControl
)->SetState( STATE_CHECK
);
4899 ((TriStateBox
*)pControl
)->Click();
4902 ((TriStateBox
*)pControl
)->SetState( STATE_NOCHECK
);
4903 ((TriStateBox
*)pControl
)->Click();
4906 if ( ((TriStateBox
*)pControl
)->IsTriStateEnabled() )
4908 ((TriStateBox
*)pControl
)->SetState( STATE_DONTKNOW
);
4909 ((TriStateBox
*)pControl
)->Click();
4913 ReportError( aUId
, GEN_RES_STR0( S_TRISTATE_NOT_ALLOWED
) );
4918 TriStateBox
*pTB
= ((TriStateBox
*)pControl
);
4919 if ( pTB
->GetState() == STATE_NOCHECK
)
4920 pTB
->SetState( STATE_CHECK
);
4921 else if ( pTB
->GetState() == STATE_CHECK
)
4923 if ( pTB
->IsTriStateEnabled() )
4924 pTB
->SetState( STATE_DONTKNOW
);
4926 pTB
->SetState( STATE_NOCHECK
);
4929 pTB
->SetState( STATE_NOCHECK
);
4934 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "TriStateBox" ) );
4939 case C_MultiLineEdit
:
4942 case M_AnimateMouse
:
4943 AnimateMouse( pControl
, Mitte
);
4946 pRet
->GenReturn ( RET_Value
, aUId
, ((Edit
*)pControl
)->GetText());
4949 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
) !((Edit
*)pControl
)->IsReadOnly() );
4952 if ( ! ((Edit
*)pControl
)->IsReadOnly() )
4957 ((Edit
*)pControl
)->SetText( aString1
);
4958 if ( nRT
== C_MultiLineEdit
) // since SetModifyFlag is not virtual we have to do this
4959 ((MultiLineEdit
*)pControl
)->SetModifyFlag();
4961 ((Edit
*)pControl
)->SetModifyFlag();
4962 ((Edit
*)pControl
)->Modify();
4963 if ( ((Edit
*)pControl
)->GetText().CompareTo(aString1
) != COMPARE_EQUAL
)
4964 ReportError( aUId
, GEN_RES_STR1( S_ERROR_IN_SET_TEXT
, MethodString( nMethodId
) ) );
4967 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "(MultiLine)Edit" ) );
4972 ReportError( aUId
, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY
, "(MultiLine)Edit" ) );
4975 case C_MultiListBox
:
4979 case M_AnimateMouse
:
4980 AnimateMouse( pControl
, MitteOben
);
4982 case M_GetSelCount
:
4983 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(((ListBox
*)pControl
)->GetSelectEntryCount()));
4985 case M_GetSelIndex
:
4986 if ( ! (nParams
& PARAM_USHORT_1
) )
4988 if ( ((ListBox
*)pControl
)->GetSelectEntryCount() == 0 )
4990 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(0));
4995 ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((ListBox
*)pControl
)->GetSelectEntryCount());
4996 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(((ListBox
*)pControl
)->GetSelectEntryPos(nNr1
-1)) +1);
4999 if ( ! (nParams
& PARAM_USHORT_1
) )
5001 pRet
->GenReturn ( RET_Value
, aUId
, ((ListBox
*)pControl
)->GetSelectEntry(nNr1
-1));
5003 case M_GetItemCount
:
5004 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(((ListBox
*)pControl
)->GetEntryCount()));
5006 case M_GetItemText
:
5007 pRet
->GenReturn ( RET_Value
, aUId
, ((ListBox
*)pControl
)->GetEntry(nNr1
-1));
5012 BOOL bUnselectBeforeSelect
= ( nMethodId
== M_Select
);
5013 BOOL bFehler
= FALSE
;
5014 if ( ! (nParams
& PARAM_BOOL_1
) )
5017 if ( nMethodId
== M_MultiSelect
&& nRT
== C_ListBox
)
5019 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "ListBox" ) );
5023 if ( !bBool1
&& nMethodId
== M_Select
)
5025 ReportError( aUId
, GEN_RES_STR1( S_NO_SELECT_FALSE
, MethodString( nMethodId
) ) );
5031 if( nParams
& PARAM_STR_1
)
5033 ListBox
*pLB
= ((ListBox
*)pControl
);
5035 if ( (nPos
= pLB
->GetEntryPos( aString1
)) == LISTBOX_ENTRY_NOTFOUND
)
5036 ReportError( aUId
, GEN_RES_STR2( S_ENTRY_NOT_FOUND
, MethodString( nMethodId
), aString1
) );
5039 if ( bUnselectBeforeSelect
)
5040 pLB
->SetNoSelection();
5041 pLB
->SelectEntryPos( nPos
, bBool1
);
5042 if ( pLB
->IsEntryPosSelected( nPos
) ? !bBool1
: bBool1
) // XOR rein mit BOOL
5043 ReportError( aUId
, GEN_RES_STR2( S_METHOD_FAILED
, MethodString( nMethodId
), aString1
) );
5048 ListBox
*pLB
= ((ListBox
*)pControl
);
5049 pLB
= static_cast<ListBox
*>(pControl
);
5050 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,pLB
->GetEntryCount()) )
5052 if ( bUnselectBeforeSelect
)
5053 pLB
->SetNoSelection();
5054 pLB
->SelectEntryPos( nNr1
-1, bBool1
);
5055 if ( pLB
->IsEntryPosSelected( nNr1
-1 ) ? !bBool1
: bBool1
) // XOR rein mit BOOL
5056 ReportError( aUId
, GEN_RES_STR2( S_METHOD_FAILED
, MethodString( nMethodId
), UniString::CreateFromInt32( nNr1
) ) );
5059 ((ListBox
*)pControl
)->Select();
5063 case M_SetNoSelection
:
5064 ((ListBox
*)pControl
)->SetNoSelection();
5065 ((ListBox
*)pControl
)->Select();
5068 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "(Multi)ListBox" ) );
5081 case M_AnimateMouse
:
5082 AnimateMouse( pControl
, MitteOben
);
5085 pRet
->GenReturn ( RET_Value
, aUId
, ((ComboBox
*)pControl
)->GetText());
5087 case M_GetSelIndex
:
5089 USHORT nPos
= ((ComboBox
*)pControl
)->GetEntryPos(((ComboBox
*)pControl
)->GetText());
5090 if ( nPos
== COMBOBOX_ENTRY_NOTFOUND
)
5094 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
) nPos
);
5097 case M_GetItemCount
:
5098 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(((ComboBox
*)pControl
)->GetEntryCount()));
5100 case M_GetItemText
:
5101 pRet
->GenReturn ( RET_Value
, aUId
, ((ComboBox
*)pControl
)->GetEntry(nNr1
-1));
5104 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
) !((ComboBox
*)pControl
)->IsReadOnly() );
5107 if( nParams
& PARAM_USHORT_1
)
5109 if ( !ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((ComboBox
*)pControl
)->GetEntryCount()) )
5111 aString1
= ((ComboBox
*)pControl
)->GetEntry(nNr1
-1);
5115 if ( ((ComboBox
*)pControl
)->GetEntryPos( aString1
) == COMBOBOX_ENTRY_NOTFOUND
)
5117 ReportError( aUId
, GEN_RES_STR2( S_ENTRY_NOT_FOUND
, MethodString( nMethodId
), aString1
) );
5123 ((ComboBox
*)pControl
)->SetText( aString1
);
5124 ((ComboBox
*)pControl
)->SetModifyFlag();
5125 ((ComboBox
*)pControl
)->Modify();
5128 if ( ! ((ComboBox
*)pControl
)->IsReadOnly() )
5130 if ( ! (nParams
& PARAM_STR_1
) )
5131 aString1
= String();
5132 ((ComboBox
*)pControl
)->SetText( aString1
);
5133 ((ComboBox
*)pControl
)->SetModifyFlag();
5134 ((ComboBox
*)pControl
)->Modify();
5137 ReportError( aUId
, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY
, "ComboBox" ) );
5140 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "ComboBox" ) );
5146 case C_CancelButton
:
5150 case M_AnimateMouse
:
5151 AnimateMouse( pControl
, Mitte
);
5154 ((PushButton
*)pControl
)->Click();
5157 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "PushButton" ) );
5164 case M_AnimateMouse
:
5165 AnimateMouse( pControl
, Mitte
);
5168 pRet
->GenReturn ( RET_Value
, aUId
, ((MoreButton
*)pControl
)->GetState());
5171 ((MoreButton
*)pControl
)->Click();
5174 ((MoreButton
*)pControl
)->SetState(TRUE
);
5177 ((MoreButton
*)pControl
)->SetState(FALSE
);
5180 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "MoreButton" ) );
5185 case C_PatternField
:
5186 case C_NumericField
:
5188 case C_CurrencyField
:
5193 case M_AnimateMouse
:
5194 AnimateMouse( pControl
, Mitte
);
5197 pRet
->GenReturn ( RET_Value
, aUId
, ((SpinField
*)pControl
)->GetText());
5200 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
) !((SpinField
*)pControl
)->IsReadOnly() );
5203 if ( ! ((SpinField
*)pControl
)->IsReadOnly() )
5205 ((SpinField
*)pControl
)->SetText( aString1
);
5206 ((SpinField
*)pControl
)->SetModifyFlag();
5207 ((SpinField
*)pControl
)->Modify();
5210 ReportError( aUId
, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY
, "SpinField" ) );
5214 if ( !(nParams
& PARAM_USHORT_1
) )
5216 for (int i
= 1; i
<= nNr1
; i
++)
5218 ((SpinField
*)pControl
)->Up();
5219 ((SpinField
*)pControl
)->SetModifyFlag();
5220 ((SpinField
*)pControl
)->Modify();
5226 if ( !(nParams
& PARAM_USHORT_1
) )
5228 for (int i
= 1; i
<= nNr1
; i
++)
5230 ((SpinField
*)pControl
)->Down();
5231 ((SpinField
*)pControl
)->SetModifyFlag();
5232 ((SpinField
*)pControl
)->Modify();
5237 ((SpinField
*)pControl
)->First();
5238 ((SpinField
*)pControl
)->SetModifyFlag();
5239 ((SpinField
*)pControl
)->Modify();
5242 ((SpinField
*)pControl
)->Last();
5243 ((SpinField
*)pControl
)->SetModifyFlag();
5244 ((SpinField
*)pControl
)->Modify();
5247 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "SpinField" ) );
5255 case M_AnimateMouse
:
5256 AnimateMouse( pControl
, Mitte
);
5261 Point
aPt( pControl
->GetSizePixel().Width() / 2, pControl
->GetSizePixel().Height() / 2 );
5262 aMEvnt
= MouseEvent( aPt
,1,MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
5263 ImplMouseButtonDown( pControl
, aMEvnt
, FORCE_DIRECT_CALL
);
5264 ImplMouseButtonUp ( pControl
, aMEvnt
, FORCE_DIRECT_CALL
);
5271 Point
aPt( pControl
->GetSizePixel().Width() / 2, pControl
->GetSizePixel().Height() / 2 );
5272 aMEvnt
= MouseEvent( aPt
,1,MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
5273 ImplMouseButtonDown( pControl
, aMEvnt
, FORCE_DIRECT_CALL
);
5275 ULONG nStart
= Time::GetSystemTicks();
5276 ULONG nDelay
= pControl
->GetSettings().GetMouseSettings().GetActionDelay();
5277 while ( ( Time::GetSystemTicks() - nStart
) < nDelay
+ 100 )
5280 ImplMouseButtonUp ( pControl
, aMEvnt
, FORCE_DIRECT_CALL
);
5282 aSubMenuId1
= SmartId();
5283 aSubMenuId2
= SmartId();
5284 aSubMenuId3
= SmartId();
5289 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "MenuButton" ) );
5295 ToolBox
*pTB
= ((ToolBox
*)pControl
);
5296 if ( !aUId
.Matches( pTB
->GetSmartUniqueOrHelpId() ) ) // Also Button auf der ToolBox gefunden
5298 if ( (nParams
== PARAM_NONE
) || (nParams
== PARAM_USHORT_1
) )
5299 { // Wir fälschen einen Parameter
5300 if ( aUId
.HasNumeric() )
5302 nParams
= PARAM_ULONG_1
;
5303 nLNr1
= USHORT( aUId
.GetNum() );
5304 DBG_ASSERT( nLNr1
<= 0xFFFF, "ID on ToolBox > 0xFFFF" );
5308 nParams
= PARAM_STR_1
;
5309 aString1
= aUId
.GetStr();
5313 ReportError( aUId
, GEN_RES_STR1( S_INTERNAL_ERROR
, MethodString( nMethodId
) ) );
5317 USHORT nItemPos = 0;\
5318 BOOL bItemFound = FALSE;\
5321 if( nParams == PARAM_STR_1 )\
5322 aButtonId = SmartId( aString1 );\
5323 if( nParams == PARAM_ULONG_1 )\
5324 aButtonId = SmartId( nLNr1 );\
5325 for ( nItemPos = 0; nItemPos < pTB->GetItemCount() && !aButtonId.Matches(pTB->GetItemCommand(pTB->GetItemId(nItemPos))) &&\
5326 !aButtonId.Matches(pTB->GetHelpId(pTB->GetItemId(nItemPos))) ; nItemPos++ ) {}\
5327 bItemFound = aButtonId.Matches(pTB->GetItemCommand(pTB->GetItemId(nItemPos))) || aButtonId.Matches(pTB->GetHelpId(pTB->GetItemId(nItemPos)));\
5329 ReportError( aUId, GEN_RES_STR1( S_HELPID_ON_TOOLBOX_NOT_FOUND, MethodString( nMethodId ) ) );\
5332 if ( !pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) && nMethodId != _M_IsEnabled )\
5334 ReportError( aUId, GEN_RES_STR1( S_BUTTON_DISABLED_ON_TOOLBOX, MethodString( nMethodId ) ) );\
5335 bItemFound = FALSE;\
5337 else if ( !pTB->IsItemVisible( pTB->GetItemId(nItemPos) ) )\
5339 ReportError( aUId, GEN_RES_STR1( S_BUTTON_HIDDEN_ON_TOOLBOX, MethodString( nMethodId ) ) );\
5340 bItemFound = FALSE;\
5344 if ( pTB->IsMenuEnabled() )\
5345 { /* button is in Menu */\
5348 { /* Try the multi line way */\
5349 if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\
5351 USHORT nLine = pTB->GetCurLine();\
5354 pTB->ShowLine( FALSE );\
5355 for ( int i = 1 ; i < 30 ; i++ )\
5358 while ( pTB->GetCurLine() != nLine && pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() );\
5359 pTB->Invalidate( pTB->GetScrollRect() );\
5361 if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\
5363 ReportError( aUId, GEN_RES_STR1( S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX, MethodString( nMethodId ) ) );\
5364 bItemFound = FALSE;\
5373 case M_AnimateMouse
:
5374 AnimateMouse( pControl
, MitteLinks
);
5379 if ( bItemFound
) // FIND_ITEM Erfolgreich
5381 Rectangle aRect
= pTB
->GetItemRect(pTB
->GetItemId(nItemPos
));
5382 if ( aRect
.IsEmpty() )
5384 pTB
->ExecuteCustomMenu();
5385 /* aRect = pTB->GetMenubuttonRect();
5386 MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
5387 ImplMouseButtonDown( pTB, aMEvnt );*/
5389 aSubMenuId1
= SmartId();
5390 aSubMenuId2
= SmartId();
5391 aSubMenuId3
= SmartId();
5394 new StatementCommand( this, RC_MenuSelect
, PARAM_USHORT_1
, pTB
->GetItemId(nItemPos
) + TOOLBOX_MENUITEM_START
);
5398 aRect
= pTB
->GetItemRect(pTB
->GetItemId(nItemPos
));
5400 aMEvnt
= MouseEvent(aRect
.Center(),1,MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
5401 ImplMouseButtonDown( pTB
, aMEvnt
, FORCE_DIRECT_CALL
);
5402 ImplMouseButtonUp ( pTB
, aMEvnt
, FORCE_DIRECT_CALL
);
5410 if ( bItemFound
) // FIND_ITEM Erfolgreich
5412 Rectangle aRect
= pTB
->GetItemPosDropDownRect( nItemPos
);
5413 AnimateMouse( pControl
, aRect
.Center() );
5414 MouseEvent
aMEvnt(aRect
.Center(),1,MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
5415 ImplMouseButtonDown( pTB
, aMEvnt
, FORCE_DIRECT_CALL
);
5417 Window
*pWin
= NULL
;
5418 // Wait for the window to open.
5419 StatementList::bExecuting
= TRUE
; // Bah ist das ein ekliger Hack
5420 { // Das verhindert, daß schon der nächste Befehl ausgeführt wird.
5422 while ( !pWin
&& ( (pWin
= GetPopupFloatingWin()) == NULL
) && ( Time() - aDelay
).GetSec() < 15 )
5425 StatementList::bExecuting
= FALSE
; // Bah ist das ein ekliger Hack
5427 if ( pWin
&& pWin
->GetType() == WINDOW_FLOATINGWINDOW
)
5429 aMEvnt
= MouseEvent(aRect
.Center(),1,MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
5430 ImplMouseButtonUp( pTB
, aMEvnt
, FORCE_DIRECT_CALL
);
5431 ((FloatingWindow
*)pWin
)->EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF
);
5435 aMEvnt
= MouseEvent(Point(1,-10), 1, MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
5436 ImplMouseButtonUp( pTB
, aMEvnt
, FORCE_DIRECT_CALL
);
5437 ReportError( aUId
, GEN_RES_STR1( S_TEAROFF_FAILED
, MethodString( nMethodId
) ) );
5445 if ( bItemFound
) // FIND_ITEM Erfolgreich
5447 Rectangle aRect
= pTB
->GetItemPosDropDownRect( nItemPos
);
5448 AnimateMouse( pControl
, aRect
.Center() );
5449 MouseEvent
aMEvnt(aRect
.Center(),1,MOUSE_SIMPLECLICK
,MOUSE_LEFT
);
5450 ImplMouseButtonDown( pTB
, aMEvnt
);
5451 ImplMouseButtonUp( pTB
, aMEvnt
);
5453 // Das Fenster ist offen.
5454 aSubMenuId1
= SmartId();
5455 aSubMenuId2
= SmartId();
5456 aSubMenuId3
= SmartId();
5464 if ( bItemFound
) // FIND_ITEM Erfolgreich
5466 pRet
->GenReturn ( RET_Value
, aUId
, pTB
->IsItemEnabled( pTB
->GetItemId(nItemPos
) ) );
5473 if ( bItemFound
) // FIND_ITEM Erfolgreich
5478 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pTB
->GetHelpId(pTB
->GetItemId(nItemPos
)));
5481 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pTB
->GetItemType(nItemPos
));
5484 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pTB
->GetItemState(pTB
->GetItemId(nItemPos
)));
5487 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pTB
->GetItemId(nItemPos
));
5490 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(0));
5496 case M_GetItemText
:
5497 pRet
->GenReturn ( RET_Value
, aUId
, (String
)pTB
->GetItemText(nNr1
));
5500 pRet
->GenReturn ( RET_Value
, aUId
, (String
)pTB
->GetText());
5502 case M_GetItemCount
:
5503 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pTB
->GetItemCount());
5505 case M_SetNextToolBox
:
5506 if ( (nParams
& PARAM_STR_1
) )
5507 pTB
->SetNextToolBox( aString1
);
5509 pTB
->SetNextToolBox( pTB
->GetNextToolBox() );
5512 case M_GetNextToolBox
:
5513 pRet
->GenReturn ( RET_Value
, aUId
, (String
)pTB
->GetNextToolBox());
5524 case M_Help
: // Alles was unten weiterbehandelt werden soll
5527 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "ToolBox" ) );
5539 #define GET_NTH_ENTRY_LBOX( First, Next, Anzahl) \
5540 SvLBoxEntry *pThisEntry = ((SvTreeListBox*)pControl)->First(); \
5542 int niTemp = Anzahl; \
5543 while ( niTemp-- ) \
5545 pThisEntry = ((SvTreeListBox*)pControl)->Next( pThisEntry ); \
5549 case M_GetText
: // Get the first text of the given (default=1) line
5550 { // should get removed some time
5551 SvTreeListBox
*pTree
= (SvTreeListBox
*)pControl
;
5552 SvLBoxEntry
*pThisEntry
= pTree
->GetCurEntry();
5553 if ( ! (nParams
& PARAM_USHORT_1
) )
5557 SvLBoxString
* pItem
= NULL
;
5558 USHORT nValidTextItemCount
= 0;
5561 SvLBoxItem
*pMyItem
;
5562 while ( ( nValidTextItemCount
< nNr1
) && nIndex
< pThisEntry
->ItemCount() )
5564 pMyItem
= pThisEntry
->GetItem( nIndex
);
5565 if ( pMyItem
->IsA() == SV_ITEM_ID_LBOXSTRING
)
5567 pItem
= (SvLBoxString
*)pMyItem
;
5568 nValidTextItemCount
++;
5573 if ( ValueOK( aUId
, CUniString("GetText"), nNr1
, nValidTextItemCount
) )
5574 pRet
->GenReturn ( RET_Value
, aUId
, pItem
->GetText() );
5577 ReportError( aUId
, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY
, MethodString( nMethodId
), "TreeListBox" ) );
5580 case M_GetSelCount
:
5581 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(((SvLBox
*)pControl
)->GetSelectionCount()));
5583 case M_GetItemCount
:
5584 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(((SvLBox
*)pControl
)->GetVisibleCount()) );
5586 case M_GetSelIndex
:
5587 if ( ! (nParams
& PARAM_USHORT_1
) )
5589 if ( ValueOK(aUId
, CUniString("GetSelIndex"),nNr1
,((SvLBox
*)pControl
)->GetSelectionCount()) )
5592 GET_NTH_ENTRY_LBOX( FirstSelected
, NextSelected
, nNr1
);
5593 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( ((SvTreeListBox
*)pControl
)->GetVisiblePos( pThisEntry
)) +1 );
5597 if ( ! (nParams
& PARAM_BOOL_1
) )
5599 if( nParams
& PARAM_STR_1
)
5601 /* ListBox *pLB = ((ListBox*)pControl);
5602 if ( pLB->GetEntryPos( aString1 ) == LISTBOX_ENTRY_NOTFOUND )
5603 ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
5606 pLB->SelectEntry( aString1, bBool1 );
5607 if ( pLB->IsEntrySelected( aString1 ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL
5608 ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) );
5610 */ ReportError( aUId
, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED
, MethodString( nMethodId
) ) );
5614 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((SvLBox
*)pControl
)->GetVisibleCount()) )
5616 SvLBoxEntry
*pEntry
= (SvLBoxEntry
*)((SvTreeListBox
*)pControl
)->GetEntryAtVisPos( nNr1
-1 );
5617 ((SvTreeListBox
*)pControl
)->Select ( pEntry
, bBool1
);
5622 if ( ! (nParams
& PARAM_USHORT_1
) )
5624 if ( ! (nParams
& PARAM_USHORT_2
) )
5626 if ( ValueOK(aUId
, CUniString("GetSelText"),nNr1
,((SvLBox
*)pControl
)->GetSelectionCount()) )
5629 GET_NTH_ENTRY_LBOX( FirstSelected
, NextSelected
, nNr1
);
5630 if ( ValueOK( aUId
, MethodString( nMethodId
),nNr2
,pThisEntry
->ItemCount() ) )
5632 SvLBoxString
* pItem
= NULL
;
5633 if ( ! (nParams
& PARAM_USHORT_2
) )
5634 pItem
= (SvLBoxString
*)pThisEntry
->GetFirstItem( SV_ITEM_ID_LBOXSTRING
);
5637 SvLBoxItem
*pMyItem
= pThisEntry
->GetItem( nNr2
-1 );
5638 if ( pMyItem
->IsA() == SV_ITEM_ID_LBOXSTRING
)
5639 pItem
= (SvLBoxString
*)pMyItem
;
5643 pRet
->GenReturn ( RET_Value
, aUId
, pItem
->GetText() );
5645 ReportError( aUId
, GEN_RES_STR1( S_NO_LIST_BOX_STRING
, MethodString( nMethodId
) ) );
5649 case M_GetItemText
:
5650 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((SvLBox
*)pControl
)->GetVisibleCount()) )
5652 SvLBoxEntry
*pThisEntry
= (SvLBoxEntry
*)((SvTreeListBox
*)pControl
)->GetEntryAtVisPos( nNr1
-1 );
5653 if ( ! (nParams
& PARAM_USHORT_2
) )
5655 if ( ValueOK( aUId
, MethodString( nMethodId
),nNr2
,pThisEntry
->ItemCount() ) )
5657 SvLBoxString
* pItem
= NULL
;
5658 if ( ! (nParams
& PARAM_USHORT_2
) )
5659 pItem
= (SvLBoxString
*)pThisEntry
->GetFirstItem( SV_ITEM_ID_LBOXSTRING
);
5662 SvLBoxItem
*pMyItem
= pThisEntry
->GetItem( nNr2
-1 );
5663 if ( pMyItem
->IsA() == SV_ITEM_ID_LBOXSTRING
)
5664 pItem
= (SvLBoxString
*)pMyItem
;
5668 pRet
->GenReturn ( RET_Value
, aUId
, pItem
->GetText() );
5670 ReportError( aUId
, GEN_RES_STR1( S_NO_LIST_BOX_STRING
, MethodString( nMethodId
) ) );
5681 SvTreeListBox
*pTree
= (SvTreeListBox
*)pControl
;
5682 SvLBoxEntry
*pThisEntry
= NULL
;
5684 if ( ! (nParams
& PARAM_USHORT_1
) )
5686 pThisEntry
= pTree
->GetCurEntry();
5688 ReportError( aUId
, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY
, MethodString( nMethodId
), "TreeListBox" ) );
5692 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((SvLBox
*)pControl
)->GetVisibleCount()) )
5694 pThisEntry
= (SvLBoxEntry
*)pTree
->GetEntryAtVisPos( nNr1
-1 );
5698 if ( ! (nParams
& PARAM_USHORT_2
) )
5703 if ( ValueOK( aUId
, MethodString( nMethodId
),nNr2
,pThisEntry
->ItemCount() ) )
5705 SvLBoxButton
* pItem
= NULL
;
5706 if ( ! (nParams
& PARAM_USHORT_2
) )
5707 pItem
= (SvLBoxButton
*)pThisEntry
->GetFirstItem( SV_ITEM_ID_LBOXBUTTON
);
5710 SvLBoxItem
*pMyItem
= pThisEntry
->GetItem( nNr2
-1 );
5711 if ( pMyItem
->IsA() == SV_ITEM_ID_LBOXBUTTON
)
5712 pItem
= (SvLBoxButton
*)pMyItem
;
5720 pRet
->GenReturn ( RET_Value
, aUId
, comm_BOOL( pItem
->IsStateChecked() ) );
5723 pRet
->GenReturn ( RET_Value
, aUId
, comm_BOOL( pItem
->IsStateTristate() ) );
5726 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( pItem
->GetButtonFlags() & ~SV_STATE_MASK
));
5729 pItem
->SetStateChecked();
5730 pTree
->CheckButtonHdl();
5731 pTree
->InvalidateEntry( pThisEntry
);
5734 pItem
->SetStateUnchecked();
5735 pTree
->CheckButtonHdl();
5736 pTree
->InvalidateEntry( pThisEntry
);
5739 pItem
->SetStateTristate();
5740 pTree
->CheckButtonHdl();
5741 pTree
->InvalidateEntry( pThisEntry
);
5744 ReportError( aUId
, GEN_RES_STR1( S_INTERNAL_ERROR
, MethodString( nMethodId
) ) );
5749 ReportError( aUId
, GEN_RES_STR1( S_NO_LIST_BOX_BUTTON
, MethodString( nMethodId
) ) );
5754 case M_GetItemType
:
5756 SvTreeListBox
*pTree
= (SvTreeListBox
*)pControl
;
5757 SvLBoxEntry
*pThisEntry
= NULL
;
5759 if ( ! (nParams
& PARAM_USHORT_1
) )
5761 pThisEntry
= pTree
->GetCurEntry();
5763 ReportError( aUId
, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY
, MethodString( nMethodId
), "TreeListBox" ) );
5767 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,((SvLBox
*)pControl
)->GetVisibleCount()) )
5769 pThisEntry
= (SvLBoxEntry
*)pTree
->GetEntryAtVisPos( nNr1
-1 );
5775 if ( ! (nParams
& PARAM_USHORT_2
) )
5777 if ( ValueOK( aUId
, MethodString( nMethodId
),nNr2
,pThisEntry
->ItemCount() ) )
5779 SvLBoxItem
*pMyItem
= pThisEntry
->GetItem( nNr2
-1 );
5781 switch ( pMyItem
->IsA() )
5783 case SV_ITEM_ID_LBOXSTRING
: nType
= CONST_ItemTypeText
; break;
5784 case SV_ITEM_ID_LBOXBMP
: nType
= CONST_ItemTypeBMP
; break;
5785 case SV_ITEM_ID_LBOXBUTTON
: nType
= CONST_ItemTypeCheckbox
; break;
5786 case SV_ITEM_ID_LBOXCONTEXTBMP
: nType
= CONST_ItemTypeContextBMP
; break;
5787 default: nType
= CONST_ItemTypeUnknown
;
5789 pRet
->GenReturn ( RET_Value
, aUId
, nType
);
5795 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "TreeListBox" ) );
5801 USHORT nRealControlType
= 0;
5802 if ( dynamic_cast< EditBrowseBox
* >(pControl
) )
5803 nRealControlType
= CONST_CTBrowseBox
;
5804 else if ( dynamic_cast< ValueSet
* >(pControl
) )
5805 nRealControlType
= CONST_CTValueSet
;
5806 else if ( dynamic_cast< ORoadmap
* >(pControl
) )
5807 nRealControlType
= CONST_CTORoadmap
;
5808 else if ( dynamic_cast< IExtensionListBox
* >(pControl
) )
5809 nRealControlType
= CONST_CTIExtensionListBox
;
5811 nRealControlType
= CONST_CTUnknown
;
5815 case M_AnimateMouse
:
5816 AnimateMouse( pControl
, MitteOben
);
5819 switch( nRealControlType
)
5821 case CONST_CTBrowseBox
:
5823 EditBrowseBox
* pEBBox
= dynamic_cast< EditBrowseBox
* >(pControl
);
5831 BOOL MakeFieldVisible( long nRow, USHORT nColId, BOOL bComplete = FALSE );
5832 // access to dynamic values of cursor row
5833 String GetColumnTitle( USHORT nColumnId ) const;
5834 USHORT GetColumnId( USHORT nPos ) const;
5835 USHORT GetColumnPos( USHORT nColumnId ) const;
5836 // access and movement of cursor
5837 long GetCurRow() const { return nCurRow; }
5838 USHORT GetCurColumnId() const { return nCurColId; }
5839 BOOL GoToRow( long nRow );
5840 BOOL GoToRowAndDoNotModifySelection( long nRow );
5841 BOOL GoToColumnId( USHORT nColId );
5842 BOOL GoToRowColumnId( long nRow, USHORT nColId );
5844 void SetNoSelection();
5846 void SelectRow( long nRow, BOOL bSelect = TRUE, BOOL bExpand = TRUE );
5847 void SelectColumnPos( USHORT nCol, BOOL bSelect = TRUE )
5848 { SelectColumnPos( nCol, bSelect, TRUE); }
5849 void SelectColumnId( USHORT nColId, BOOL bSelect = TRUE )
5850 { SelectColumnPos( GetColumnPos(nColId), bSelect, TRUE); }
5851 long GetSelectRowCount() const;
5852 USHORT GetSelectColumnCount() const;
5853 BOOL IsRowSelected( long nRow ) const;
5854 BOOL IsColumnSelected( USHORT nColumnId ) const;
5855 long FirstSelectedRow( BOOL bInverse = FALSE );
5856 long LastSelectedRow( BOOL bInverse = FALSE );
5857 long PrevSelectedRow();
5858 long NextSelectedRow();
5859 const MultiSelection* GetSelection() const
5860 { return bMultiSelection ? uRow.pSel : 0; }
5861 void SetSelection( const MultiSelection &rSelection );
5863 virtual String GetCellText(long _nRow, USHORT _nColId) const;
5864 USHORT GetColumnCount() const { return ColCount(); }
5866 virtual long GetRowCount() const;
5871 sal_Bool IsEditing() const {return aController.Is();}
5872 void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);}
5873 void InvalidateHandleColumn();
5875 CellControllerRef Controller() const { return aController; }
5876 sal_Int32 GetBrowserFlags() const { return m_nBrowserFlags; }
5878 virtual void ActivateCell(long nRow, sal_uInt16 nCol, sal_Bool bSetCellFocus = sal_True);
5879 virtual void DeactivateCell(sal_Bool bUpdate = sal_True);
5886 pRet
->GenReturn ( RET_Value
, aUId
, pEBBox
->GetCellText( pEBBox
->GetCurrRow(), pEBBox
->GetColumnId( pEBBox
->GetCurrColumn() )));
5889 case M_GetColumnCount
:
5891 USHORT nColCount
= pEBBox
->GetColumnCount();
5892 comm_USHORT nUnfrozenColCount
= 0;
5894 for ( i
=0 ; i
< nColCount
; i
++ )
5896 if ( !pEBBox
->IsFrozen( pEBBox
->GetColumnId( i
) ) )
5897 nUnfrozenColCount
++;
5899 pRet
->GenReturn ( RET_Value
, aUId
, nUnfrozenColCount
);
5902 case M_GetRowCount
:
5904 pRet
->GenReturn ( RET_Value
, aUId
, (comm_ULONG
)pEBBox
->GetRowCount() );
5909 CellControllerRef aControler
;
5910 aControler
= pEBBox
->Controller();
5911 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)aControler
.Is() );
5916 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,pEBBox
->GetRowCount() ) )
5918 USHORT nColCount
= pEBBox
->GetColumnCount();
5919 comm_USHORT nUnfrozenColCount
= 0;
5921 for ( i
=0 ; i
< nColCount
; i
++ )
5923 if ( !pEBBox
->IsFrozen( pEBBox
->GetColumnId( i
) ) )
5924 nUnfrozenColCount
++;
5926 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr2
,nUnfrozenColCount
) )
5927 pEBBox
->GoToRowColumnId( nNr1
-1, pEBBox
->GetColumnId( nNr2
) );
5935 case M_GetSelCount :
5936 pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((SvLBox*)pControl)->GetSelectionCount()));
5938 case M_GetSelIndex :
5939 if ( ! (nParams & PARAM_USHORT_1) )
5941 if ( ValueOK(aUId, CUniString("GetSelIndex"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
5944 COUNT_LBOX( FirstSelected, NextSelected, nNr1);
5945 pRet->GenReturn ( RET_Value, aUId, comm_ULONG( ((SvTreeListBox*)pControl)->GetVisiblePos( pThisEntry )) +1 );
5949 if ( ! (nParams & PARAM_USHORT_1) )
5951 if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
5954 COUNT_LBOX( FirstSelected, NextSelected, nNr1);
5955 GetFirstValidTextItem( pThisEntry );
5956 pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
5959 case M_GetItemCount :
5960 pRet->GenReturn ( RET_Value, aUId, comm_ULONG(((SvLBox*)pControl)->GetVisibleCount()) );
5962 case M_GetItemText :
5963 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5965 SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
5966 GetFirstValidTextItem( pEntry );
5967 pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
5971 if ( ! (nParams & PARAM_BOOL_1) )
5973 if( nParams & PARAM_STR_1 )
5975 / * ListBox *pLB = ((ListBox*)pControl);
5976 if ( pLB->GetEntryPos( aString1 ) == LISTBOX_ENTRY_NOTFOUND )
5977 ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
5980 pLB->SelectEntry( aString1, bBool1 );
5981 if ( pLB->IsEntrySelected( aString1 ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL
5982 ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) );
5984 * / ReportError( aUId, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED, MethodString( nMethodId ) ) );
5988 if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
5990 SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
5991 ((SvTreeListBox*)pControl)->Select ( pEntry, bBool1 );
5996 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "EditBrowseBox" ) );
6001 case CONST_CTValueSet
:
6003 ValueSet
*pVS
= dynamic_cast< ValueSet
* >(pControl
);
6004 switch ( nMethodId
)
6006 case M_GetItemCount
:
6007 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( pVS
->GetItemCount()));
6010 if ( ValueOK( aUId
, MethodString( nMethodId
), nNr1
, pVS
->GetItemCount() ))
6011 pRet
->GenReturn ( RET_Value
, aUId
, pVS
->GetItemText( pVS
->GetItemId( nNr1
-1 ) ) );
6014 if ( ValueOK( aUId
, MethodString( nMethodId
), nNr1
, pVS
->GetItemCount() ))
6015 pVS
->SelectItem( pVS
->GetItemId( nNr1
-1 ) );
6017 case M_GetSelIndex
:
6018 if ( pVS
->IsNoSelection() )
6019 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(0));
6021 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( pVS
->GetItemPos( pVS
->GetSelectItemId() ) +1));
6024 if ( pVS
->IsNoSelection() )
6025 pRet
->GenReturn ( RET_Value
, aUId
, String() );
6027 pRet
->GenReturn ( RET_Value
, aUId
, pVS
->GetItemText( pVS
->GetSelectItemId() ) );
6029 case M_SetNoSelection
:
6030 pVS
->SetNoSelection();
6033 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "ValueSet" ) );
6038 case CONST_CTORoadmap
:
6040 ORoadmap
*pRM
= dynamic_cast< ORoadmap
* >(pControl
);
6041 switch ( nMethodId
)
6043 case M_GetItemCount
:
6044 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( pRM
->GetItemCount()));
6047 if ( ValueOK( aUId
, MethodString( nMethodId
), nNr1
, pRM
->GetItemCount() ))
6048 pRet
->GenReturn ( RET_Value
, aUId
, pRM
->GetRoadmapItemLabel( pRM
->GetItemID( nNr1
-1 ) ) );
6051 if ( ValueOK( aUId
, MethodString( nMethodId
), nNr1
, pRM
->GetItemCount() ))
6053 if ( pRM
->IsRoadmapItemEnabled( pRM
->GetItemID( nNr1
-1 ) ) )
6054 pRM
->SelectRoadmapItemByID( pRM
->GetItemID( nNr1
-1 ) );
6056 ReportError( aUId
, GEN_RES_STR1c( S_WIN_DISABLED
, "RoadmapItem" ) );
6059 case M_GetSelIndex
:
6060 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( pRM
->GetItemIndex( pRM
->GetCurrentRoadmapItemID() ) +1));
6063 pRet
->GenReturn ( RET_Value
, aUId
, pRM
->GetRoadmapItemLabel( pRM
->GetCurrentRoadmapItemID() ) );
6065 case M_IsItemEnabled
:
6066 if ( ValueOK( aUId
, MethodString( nMethodId
), nNr1
, pRM
->GetItemCount() ))
6067 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)pRM
->IsRoadmapItemEnabled( pRM
->GetItemID( nNr1
-1 ) ) );
6070 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "RoadMap" ) );
6075 case CONST_CTIExtensionListBox
:
6077 IExtensionListBox
*pELB
= dynamic_cast< IExtensionListBox
* >(pControl
);
6078 switch ( nMethodId
)
6080 case M_GetItemCount
:
6081 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( pELB
->getItemCount()));
6084 if ( ValueOK( aUId
, MethodString( nMethodId
), nNr1
, pELB
->getItemCount() ))
6088 pRet
->GenReturn ( RET_Value
, aUId
, pELB
->getItemName( nNr1
-1 ) );
6091 pRet
->GenReturn ( RET_Value
, aUId
, pELB
->getItemVersion( nNr1
-1 ) );
6094 pRet
->GenReturn ( RET_Value
, aUId
, pELB
->getItemDescription( nNr1
-1 ) );
6097 pRet
->GenReturn ( RET_Value
, aUId
, pELB
->getItemPublisher( nNr1
-1 ) );
6100 pRet
->GenReturn ( RET_Value
, aUId
, pELB
->getItemPublisherLink( nNr1
-1 ) );
6103 ValueOK( aUId
, MethodString( nMethodId
).AppendAscii(" String Number"), nNr2
, 5 );
6107 if ( (nParams
& PARAM_USHORT_1
) )
6109 if ( ValueOK( aUId
, MethodString( nMethodId
), nNr1
, pELB
->getItemCount() ))
6111 pELB
->select( nNr1
-1 );
6114 else if ( (nParams
& PARAM_STR_1
) )
6116 pELB
->select( aString1
);
6117 BOOL bSuccess
= TRUE
;
6118 if ( pELB
->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND
)
6122 if ( !aString1
.Equals( String( pELB
->getItemName( pELB
->getSelIndex() ) ) ) )
6126 ReportError( aUId
, GEN_RES_STR2( S_ENTRY_NOT_FOUND
, MethodString( nMethodId
), aString1
) );
6129 case M_GetSelCount
:
6130 if ( pELB
->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND
)
6131 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( 0 ));
6133 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( 1 ));
6135 case M_GetSelIndex
:
6136 if ( pELB
->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND
)
6137 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( 0 ));
6139 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG( pELB
->getSelIndex() +1));
6141 /* xxxcase M_SetNoSelection :
6142 ((ListBox*)pControl)->SetNoSelection();
6143 ((ListBox*)pControl)->Select();
6146 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "RoadMap" ) );
6151 case CONST_CTUnknown
:
6152 ReportError( aUId
, GEN_RES_STR2( S_UNKNOWN_TYPE
, UniString::CreateFromInt32( nRT
), MethodString(nMethodId
) ) );
6155 ReportError( aUId
, GEN_RES_STR1( S_INTERNAL_ERROR
, MethodString( nMethodId
) ) );
6164 case M_AnimateMouse
:
6165 AnimateMouse( pControl
, MitteOben
);
6168 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "Window" ) );
6177 case M_AnimateMouse
:
6178 AnimateMouse( pControl
, MitteOben
);
6181 if ( ((DockingWindow
*)pControl
)->IsFloatingMode() )
6182 ((DockingWindow
*)pControl
)->SetFloatingMode(FALSE
);
6184 ReportError( aUId
, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE
, MethodString( nMethodId
) ) );
6187 if ( !((DockingWindow
*)pControl
)->IsFloatingMode() )
6188 ((DockingWindow
*)pControl
)->SetFloatingMode(TRUE
);
6190 ReportError( aUId
, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE
, MethodString( nMethodId
) ) );
6193 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
) !((DockingWindow
*)pControl
)->IsFloatingMode());
6196 //aWindowWaitUId = aUId;
6197 DBG_ASSERT( aUId
.Matches( pControl
->GetSmartUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6198 SET_WINP_CLOSING(pControl
);
6199 ((DockingWindow
*)pControl
)->Close();
6206 if ( ((DockingWindow
*)pControl
)->IsFloatingMode() )
6208 Window
* pFloat
= ((DockingWindow
*)pControl
)->GetFloatingWindow();
6209 if ( !pFloat
&& ((DockingWindow
*)pControl
)->IsFloatingMode() )
6211 if ( pControl
->GET_REAL_PARENT() && pControl
->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW
)
6212 pFloat
= pControl
->GET_REAL_PARENT();
6215 DBG_ERROR("FloatingMode set but Parent is no FloatingWindow");
6218 if ( pFloat
&& pFloat
->GetType() == WINDOW_FLOATINGWINDOW
)
6224 ReportError( aUId
, GEN_RES_STR1( S_CANNOT_FIND_FLOATING_WIN
, MethodString( nMethodId
) ) );
6227 ReportError( aUId
, GEN_RES_STR1( S_ALLOWED_ONLY_IN_DOCKING_MODE
, MethodString( nMethodId
) ) );
6229 case M_Help
: // Alles was unten weiterbehandelt werden soll
6233 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "DockingWindow" ) );
6241 case M_AnimateMouse
:
6242 AnimateMouse( pControl
, MitteOben
);
6245 pRet
->GenReturn ( RET_Value
, aUId
, (comm_BOOL
)!((FloatingWindow
*)pControl
)->IsRollUp());
6248 ((FloatingWindow
*)pControl
)->RollUp();
6251 ((FloatingWindow
*)pControl
)->RollDown();
6255 if ( pControl
->GetStyle() & WB_SIZEABLE
)
6257 Size aMin
= ((FloatingWindow
*)pControl
)->GetMinOutputSizePixel();
6258 if ( aMin
.Width() <= nNr1
&& aMin
.Height() <= nNr2
)
6260 pControl
->SetSizePixel(Size(nNr1
,nNr2
));
6265 ReportError( aUId
, GEN_RES_STR2( S_SIZE_BELOW_MINIMUM
, String::CreateFromInt32( aMin
.Width() ), String::CreateFromInt32( aMin
.Height() ) ) );
6269 ReportError( aUId
, GEN_RES_STR1( S_SIZE_NOT_CHANGEABLE
, MethodString( nMethodId
) ) );
6273 DBG_ASSERT( aUId
.Matches( pControl
->GetSmartUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6274 SET_WINP_CLOSING(pControl
);
6275 ((FloatingWindow
*)pControl
)->Close();
6277 case M_Help
: // Alles was unten weiterbehandelt werden soll
6281 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "FloatingWin" ) );
6292 case M_AnimateMouse
:
6293 AnimateMouse( pControl
, MitteOben
);
6296 DBG_ASSERT( aUId
.Matches( pControl
->GetSmartUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6297 SET_WINP_CLOSING(pControl
);
6298 ((SystemWindow
*)pControl
)->Close();
6302 Window
*pChild
= GetWinByRT( pControl
, WINDOW_OKBUTTON
);
6303 if( ControlOK( pChild
, "OK Button" ) )
6305 DBG_ASSERT( aUId
.Matches( pControl
->GetSmartUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6306 SET_WINP_CLOSING(pControl
);
6307 ((Button
*)pChild
)->Click();
6313 Window
*pChild
= GetWinByRT( pControl
, WINDOW_CANCELBUTTON
);
6314 if( ControlOK( pChild
, "Cancel Button" ) )
6316 DBG_ASSERT( aUId
.Matches( pControl
->GetSmartUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6317 SET_WINP_CLOSING(pControl
);
6318 ((Button
*)pChild
)->Click();
6324 Window
*pChild
= GetWinByRT( pControl
, WINDOW_HELPBUTTON
);
6325 if( ControlOK( pChild
, "Help Button" ) )
6326 ((Button
*)pChild
)->Click();
6331 Window
*pChild
= ImpGetButton( pControl
, WB_DEFBUTTON
, WB_DEFBUTTON
);
6332 if( ControlOK( pChild
, "Default Button" ) )
6333 ((Button
*)pChild
)->Click();
6338 pControl
->SetPosPixel(Point(nNr1
,nNr2
));
6342 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "Dialog" ) );
6349 case M_AnimateMouse
:
6350 AnimateMouse( pControl
, MitteOben
);
6353 DBG_ASSERT( aUId
.Matches( pControl
->GetSmartUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
6354 SET_WINP_CLOSING(pControl
);
6355 ((WorkWindow
*)pControl
)->Close();
6362 pRet
->GenReturn ( RET_Value
, aUId
, ((WorkWindow
*)pControl
)->IsMaximized() );
6365 pRet
->GenReturn ( RET_Value
, aUId
, ((WorkWindow
*)pControl
)->IsMinimized() );
6368 pRet
->GenReturn ( RET_Value
, aUId
, comm_BOOL (!((WorkWindow
*)pControl
)->IsMaximized() && !((WorkWindow
*)pControl
)->IsMinimized()) );
6371 ((WorkWindow
*)pControl
)->Maximize( FALSE
);
6372 ((WorkWindow
*)pControl
)->Minimize();
6375 ((WorkWindow
*)pControl
)->Maximize();
6378 ((WorkWindow
*)pControl
)->Maximize( FALSE
);
6379 ((WorkWindow
*)pControl
)->Restore();
6381 case M_Help
: // Alles was unten weiterbehandelt werden soll
6384 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "WorkWindow" ) );
6389 ReportError( aUId
, GEN_RES_STR1( S_INTERNAL_ERROR
, MethodString( nMethodId
) ) );
6398 MessBox
* pMB
= (MessBox
*)pControl
;
6401 case M_GetCheckBoxText
:
6402 pRet
->GenReturn ( RET_Value
, aUId
, pMB
->GetCheckBoxText() );
6405 pRet
->GenReturn ( RET_Value
, aUId
, comm_BOOL( pMB
->GetCheckBoxState() == STATE_CHECK
) );
6408 pMB
->SetCheckBoxState( TRUE
);
6411 pMB
->SetCheckBoxState( FALSE
);
6414 pRet
->GenReturn ( RET_Value
, aUId
, pMB
->GetMessText());
6422 break; // break the case here else continue at C_ButtonDialog
6424 case C_ButtonDialog
:
6426 ButtonDialog
* pBD
= (ButtonDialog
*)pControl
;
6427 #if OSL_DEBUG_LEVEL > 1
6428 m_pDbgWin
->AddText( "Working MessBox: " );
6429 if (pControl
->IsVisible())
6430 m_pDbgWin
->AddText("*(Visible)\n");
6432 m_pDbgWin
->AddText("*(nicht Visible)\n");
6436 case M_AnimateMouse
:
6437 AnimateMouse( pControl
, Mitte
);
6440 #if ( BUTTONID_OK != RET_OK )
6441 #error BUTTONID_OK != RET_OK
6443 if ( pBD
->GetPushButton( BUTTONID_OK
) )
6445 SET_WINP_CLOSING(pControl
);
6446 pBD
->EndDialog(RET_OK
);
6449 ReportError( aUId
, GEN_RES_STR1( S_NO_OK_BUTTON
, MethodString( nMethodId
) ) );
6452 if ( pBD
->GetPushButton( BUTTONID_CANCEL
) )
6454 SET_WINP_CLOSING(pControl
);
6455 pBD
->EndDialog(RET_CANCEL
);
6458 ReportError( aUId
, GEN_RES_STR1( S_NO_CANCEL_BUTTON
, MethodString( nMethodId
) ) );
6461 if ( pBD
->GetPushButton( BUTTONID_YES
) )
6463 SET_WINP_CLOSING(pControl
);
6464 pBD
->EndDialog(RET_YES
);
6467 ReportError( aUId
, GEN_RES_STR1( S_NO_YES_BUTTON
, MethodString( nMethodId
) ) );
6470 if ( pBD
->GetPushButton( BUTTONID_NO
) )
6472 SET_WINP_CLOSING(pControl
);
6473 pBD
->EndDialog(RET_NO
);
6476 ReportError( aUId
, GEN_RES_STR1( S_NO_NO_BUTTON
, MethodString( nMethodId
) ) );
6479 if ( pBD
->GetPushButton( BUTTONID_RETRY
) )
6481 SET_WINP_CLOSING(pControl
);
6482 pBD
->EndDialog(RET_RETRY
);
6485 ReportError( aUId
, GEN_RES_STR1( S_NO_RETRY_BUTTON
, MethodString( nMethodId
) ) );
6488 if ( pBD
->GetPushButton( BUTTONID_HELP
) )
6490 SET_WINP_CLOSING(pControl
);
6491 pBD
->EndDialog(BUTTONID_HELP
);
6494 ReportError( aUId
, GEN_RES_STR1( S_NO_HELP_BUTTON
, MethodString( nMethodId
) ) );
6498 WinBits Style
= pControl
->GetStyle();
6499 if ( Style
& WB_DEF_OK
)
6501 SET_WINP_CLOSING(pControl
);
6502 pBD
->EndDialog(RET_OK
);
6504 else if ( Style
& WB_DEF_CANCEL
)
6506 SET_WINP_CLOSING(pControl
);
6507 pBD
->EndDialog(RET_CANCEL
);
6509 else if ( Style
& WB_DEF_YES
)
6511 SET_WINP_CLOSING(pControl
);
6512 pBD
->EndDialog(RET_YES
);
6514 else if ( Style
& WB_DEF_NO
)
6516 SET_WINP_CLOSING(pControl
);
6517 pBD
->EndDialog(RET_NO
);
6519 else if ( Style
& WB_DEF_RETRY
)
6521 SET_WINP_CLOSING(pControl
);
6522 pBD
->EndDialog(RET_RETRY
);
6525 ReportError( aUId
, GEN_RES_STR1( S_NO_DEFAULT_BUTTON
, MethodString( nMethodId
) ) );
6529 pRet
->GenReturn ( RET_Value
, aUId
, pControl
->GetText());
6532 if ( nParams
& PARAM_USHORT_1
)
6534 if ( pBD
->GetPushButton( nNr1
) )
6536 if ( nNr1
!= BUTTONID_HELP
)
6538 SET_WINP_CLOSING(pControl
);
6540 pBD
->GetPushButton( nNr1
)->Click();
6543 ReportError( aUId
, GEN_RES_STR2( S_NO_DEFAULT_BUTTON
, UniString::CreateFromInt32( nNr1
), MethodString( nMethodId
) ) );
6546 ReportError( aUId
, GEN_RES_STR1( S_BUTTONID_REQUIRED
, MethodString( nMethodId
) ) );
6548 case M_GetButtonCount
:
6549 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(pBD
->GetButtonCount()));
6551 case M_GetButtonId
:
6552 if ( ValueOK(aUId
, MethodString( nMethodId
),nNr1
,pBD
->GetButtonCount()) )
6553 pRet
->GenReturn ( RET_Value
, aUId
, comm_ULONG(pBD
->GetButtonId(nNr1
-1)));
6556 ReportError( aUId
, GEN_RES_STR2c2( S_UNKNOWN_METHOD
, MethodString(nMethodId
), "MessageBox" ) );
6562 DBG_ERROR( "Unknown Objekttype from UId or Method not suported" );
6563 ReportError( aUId
, GEN_RES_STR2( S_UNKNOWN_TYPE
, UniString::CreateFromInt32( nRT
), MethodString(nMethodId
) ) );
6564 #if OSL_DEBUG_LEVEL > 1
6565 m_pDbgWin
->AddText( " Unknown Objekttype from UId or Method not suported" );
6570 for( int i
= 0; i
< 32; i
++ )
6573 #if OSL_DEBUG_LEVEL > 1
6574 m_pDbgWin
->AddText( "\n" );
6576 if ( bStatementDone
)
6578 SendProfile( UIdString( aUId
).Append('.').Append( MethodString( nMethodId
) ) );
6583 if ( nRetryCount
-- )
6585 #if OSL_DEBUG_LEVEL > 1
6586 m_pDbgWin
->AddText( CUniString("Reschedule command (requed) (").Append( UniString::CreateFromInt32(nRetryCount
) ).AppendAscii(")\n") );
6588 QueStatement( this ); // will que at the start of the list
6592 bStatementDone
=TRUE
;
6595 return bStatementDone
;