1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_automation.hxx" 30*cdf0e10cSrcweir #include <osl/mutex.hxx> 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <vcl/window.hxx> 33*cdf0e10cSrcweir #include <vcl/vclevent.hxx> 34*cdf0e10cSrcweir #include <vcl/button.hxx> 35*cdf0e10cSrcweir #include <vcl/edit.hxx> 36*cdf0e10cSrcweir #include <vcl/spinfld.hxx> 37*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 38*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 39*cdf0e10cSrcweir #include <vcl/lstbox.hxx> 40*cdf0e10cSrcweir #include <vcl/sound.hxx> 41*cdf0e10cSrcweir #include <vcl/combobox.hxx> 42*cdf0e10cSrcweir #include <vcl/floatwin.hxx> 43*cdf0e10cSrcweir #include <basic/ttstrhlp.hxx> 44*cdf0e10cSrcweir #include "statemnt.hxx" 45*cdf0e10cSrcweir #include "retstrm.hxx" 46*cdf0e10cSrcweir #include "rcontrol.hxx" 47*cdf0e10cSrcweir #include "recorder.hxx" 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <comphelper/uieventslogger.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir MacroRecorder* MacroRecorder::pMacroRecorder = NULL; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir MacroRecorder::MacroRecorder() 54*cdf0e10cSrcweir : pLastWin( NULL ) 55*cdf0e10cSrcweir , pEditModify( NULL ) 56*cdf0e10cSrcweir , pActionParent( NULL ) 57*cdf0e10cSrcweir , aKeyUniqueID() 58*cdf0e10cSrcweir , pKeyWin( NULL ) 59*cdf0e10cSrcweir , bKeyFollowFocus( sal_False ) 60*cdf0e10cSrcweir , m_bRecord( sal_False ) 61*cdf0e10cSrcweir , m_bLog( sal_False ) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir aHookRefresh.SetTimeout( 500 ); 64*cdf0e10cSrcweir aHookRefresh.SetTimeoutHdl( LINK( this, MacroRecorder, HookRefreshHdl) ); 65*cdf0e10cSrcweir aHookRefresh.Start(); 66*cdf0e10cSrcweir aEventListenerHdl = LINK( this, MacroRecorder, EventListener ); 67*cdf0e10cSrcweir AddEventHooks(); 68*cdf0e10cSrcweir } 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir MacroRecorder::~MacroRecorder() 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir aHookRefresh.Stop(); 73*cdf0e10cSrcweir RemoveEventHooks(); 74*cdf0e10cSrcweir } 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir void MacroRecorder::AddEventHooks() 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir Window *pTopLevel = Application::GetFirstTopLevelWindow(); 79*cdf0e10cSrcweir while ( pTopLevel ) 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir Window *pParent = pTopLevel; 82*cdf0e10cSrcweir while ( pParent->GetParent() ) 83*cdf0e10cSrcweir pParent = pParent->GetParent(); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir pParent->RemoveChildEventListener( aEventListenerHdl ); // might be instrumented already 86*cdf0e10cSrcweir pParent->AddChildEventListener( aEventListenerHdl ); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir pTopLevel = Application::GetNextTopLevelWindow( pTopLevel ); 89*cdf0e10cSrcweir } 90*cdf0e10cSrcweir } 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir void MacroRecorder::RemoveEventHooks() 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir Window *pTopLevel = Application::GetFirstTopLevelWindow(); 95*cdf0e10cSrcweir while ( pTopLevel ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir pTopLevel->RemoveChildEventListener( aEventListenerHdl ); 98*cdf0e10cSrcweir pTopLevel = Application::GetNextTopLevelWindow( pTopLevel ); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir IMPL_LINK( MacroRecorder, HookRefreshHdl, void*, EMPTYARG ) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir AddEventHooks(); 105*cdf0e10cSrcweir return 0; 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir void MacroRecorder::LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod, sal_uInt16 nParam ) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir ::comphelper::UiEventsLogger::logVcl( Id2Str( aParentID ), nVCLWindowType, Id2Str( aID ), aMethod, nParam ); 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir void MacroRecorder::LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir ::comphelper::UiEventsLogger::logVcl( Id2Str( aParentID ), nVCLWindowType, Id2Str( aID ), aMethod ); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir Window* MacroRecorder::GetParentWithID( Window* pThis ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir Window *pOverlap = pThis->GetWindow( WINDOW_OVERLAP ); 121*cdf0e10cSrcweir while ( pOverlap != pThis && !pThis->GetUniqueOrHelpId().getLength() && pThis->GET_REAL_PARENT() ) 122*cdf0e10cSrcweir pThis = pThis->GET_REAL_PARENT(); 123*cdf0e10cSrcweir return pThis; 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir rtl::OString MacroRecorder::GetParentID( Window* pThis ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir if ( pThis->GetParent() ) 129*cdf0e10cSrcweir return pThis->GetParent()->GetUniqueOrHelpId(); 130*cdf0e10cSrcweir else 131*cdf0e10cSrcweir return rtl::OString(); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir sal_Bool bSendData = sal_False; 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir if ( pEvent->ISA( VclWindowEvent ) ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir VclWindowEvent* pWinEvent = ( VclWindowEvent* ) pEvent; 141*cdf0e10cSrcweir Window* pWin = pWinEvent->GetWindow(); 142*cdf0e10cSrcweir sal_uLong nEventID = pWinEvent->GetId(); 143*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 144*cdf0e10cSrcweir if ( nEventID >= 1001 && nEventID != VCLEVENT_WINDOW_KEYUP ) 145*cdf0e10cSrcweir nEventID = pWinEvent->GetId(); // Just something to set a breakpoint 146*cdf0e10cSrcweir else 147*cdf0e10cSrcweir return 0; 148*cdf0e10cSrcweir #endif 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // check for different action after collecting keys 151*cdf0e10cSrcweir // send if there_is_something_to_send 152*cdf0e10cSrcweir // and eather event_is_not_of_interest 153*cdf0e10cSrcweir // or ( new_window and new_window_is_interesting ) ( ignore interesting events to uninteresting window ) 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir if ( aKeyString.Len() 156*cdf0e10cSrcweir && ( ( nEventID != VCLEVENT_WINDOW_KEYINPUT 157*cdf0e10cSrcweir && nEventID != VCLEVENT_WINDOW_MOUSEMOVE 158*cdf0e10cSrcweir && nEventID != VCLEVENT_WINDOW_COMMAND 159*cdf0e10cSrcweir && nEventID != VCLEVENT_WINDOW_KEYUP ) 160*cdf0e10cSrcweir || ( pKeyWin != pWin 161*cdf0e10cSrcweir && ( pWin->GetType() == WINDOW_CONTROL || pWin->GetType() == WINDOW_WINDOW ) 162*cdf0e10cSrcweir ) 163*cdf0e10cSrcweir ) 164*cdf0e10cSrcweir ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir if ( m_bRecord ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir // we cannot access pKeyWin since it might have dissapeared 169*cdf0e10cSrcweir if ( bKeyFollowFocus ) 170*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, aKeyString, bKeyFollowFocus ); 171*cdf0e10cSrcweir else 172*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, aKeyString ); 173*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 174*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, String::CreateFromInt32( nEventID ) ); 175*cdf0e10cSrcweir #endif 176*cdf0e10cSrcweir bSendData = sal_True; 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir if ( m_bLog ) 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir // HACK Too many KeyEvents generated LogVCL( rtl::OString(), 0, aKeyUniqueID, CUniString("TypeKeys"), aKeyString.Len() ); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir // cleanup 183*cdf0e10cSrcweir aKeyString.Erase(); 184*cdf0e10cSrcweir pKeyWin = NULL; 185*cdf0e10cSrcweir bKeyFollowFocus = sal_False; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir switch ( pWin->GetType() ) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir case WINDOW_TABPAGE: 191*cdf0e10cSrcweir switch( nEventID ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir case VCLEVENT_WINDOW_ACTIVATE: 194*cdf0e10cSrcweir if ( m_bRecord ) 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, rtl::OString(), (comm_USHORT)(M_SetPage|M_RET_NUM_CONTROL), Id2Str( pWin->GetUniqueOrHelpId() ) ); 197*cdf0e10cSrcweir bSendData = sal_True; 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir if ( m_bLog ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("SetPage") ); 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir break; 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir break; 206*cdf0e10cSrcweir case WINDOW_RADIOBUTTON: 207*cdf0e10cSrcweir case WINDOW_IMAGERADIOBUTTON: 208*cdf0e10cSrcweir switch( nEventID ) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir case VCLEVENT_BUTTON_CLICK: // VCLEVENT_RADIOBUTTON_TOGGLE 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir if ( ((RadioButton*)pWin)->IsChecked() ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir if ( m_bRecord ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Check ); 217*cdf0e10cSrcweir bSendData = sal_True; 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir if ( m_bLog ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Check") ); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir break; 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir break; 228*cdf0e10cSrcweir case WINDOW_CHECKBOX: 229*cdf0e10cSrcweir case WINDOW_TRISTATEBOX: 230*cdf0e10cSrcweir switch( nEventID ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir case VCLEVENT_BUTTON_CLICK: //VCLEVENT_CHECKBOX_TOGGLE: 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir comm_USHORT nMethod; 235*cdf0e10cSrcweir String aMethod; 236*cdf0e10cSrcweir switch ( ((TriStateBox*)pWin)->GetState() ) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir case STATE_CHECK: nMethod = M_Check; aMethod = CUniString("Check"); break; 239*cdf0e10cSrcweir case STATE_NOCHECK: nMethod = M_UnCheck; aMethod = CUniString("UnCheck"); break; 240*cdf0e10cSrcweir case STATE_DONTKNOW: nMethod = M_TriState; aMethod = CUniString("TriState"); break; 241*cdf0e10cSrcweir default: nMethod = M_Check; 242*cdf0e10cSrcweir DBG_ERROR( "Unknown state in TriStateBox::GetState()" ); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir if ( m_bRecord ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), nMethod ); 247*cdf0e10cSrcweir bSendData = sal_True; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir if ( m_bLog ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir break; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir break; 257*cdf0e10cSrcweir case WINDOW_EDIT: 258*cdf0e10cSrcweir case WINDOW_MULTILINEEDIT: 259*cdf0e10cSrcweir switch( nEventID ) 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir case VCLEVENT_EDIT_MODIFY: 262*cdf0e10cSrcweir pEditModify = pWin; 263*cdf0e10cSrcweir aEditModifyString = ((Edit*)pWin)->GetText(); 264*cdf0e10cSrcweir break; 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir break; 267*cdf0e10cSrcweir case WINDOW_MULTILISTBOX: 268*cdf0e10cSrcweir switch( nEventID ) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir case VCLEVENT_LISTBOX_SELECT: 271*cdf0e10cSrcweir Sound::Beep(); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir case WINDOW_LISTBOX: 274*cdf0e10cSrcweir switch( nEventID ) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir // case VCLEVENT_LISTBOX_DOUBLECLICK: 277*cdf0e10cSrcweir case VCLEVENT_LISTBOX_SELECT: 278*cdf0e10cSrcweir if ( m_bRecord ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Select, comm_ULONG( ((ListBox*)pWin)->GetSelectEntryPos() +1 ) ); 281*cdf0e10cSrcweir bSendData = sal_True; 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir if ( m_bLog ) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Select"), ((ListBox*)pWin)->GetSelectEntryPos() ); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir break; 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir break; 290*cdf0e10cSrcweir case WINDOW_COMBOBOX: 291*cdf0e10cSrcweir case WINDOW_PATTERNBOX: 292*cdf0e10cSrcweir case WINDOW_NUMERICBOX: 293*cdf0e10cSrcweir case WINDOW_METRICBOX: 294*cdf0e10cSrcweir case WINDOW_CURRENCYBOX: 295*cdf0e10cSrcweir case WINDOW_DATEBOX: 296*cdf0e10cSrcweir case WINDOW_TIMEBOX: 297*cdf0e10cSrcweir switch( nEventID ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir case VCLEVENT_EDIT_MODIFY: 300*cdf0e10cSrcweir pEditModify = pWin; 301*cdf0e10cSrcweir aEditModifyString = ((Edit*)pWin)->GetText(); 302*cdf0e10cSrcweir break; 303*cdf0e10cSrcweir case VCLEVENT_COMBOBOX_SELECT: 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir pEditModify = NULL; 306*cdf0e10cSrcweir aEditModifyString.Erase(); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir sal_uInt16 nPos = ((ComboBox*)pWin)->GetEntryPos(((ComboBox*)pWin)->GetText()); 309*cdf0e10cSrcweir if ( m_bRecord ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir if ( nPos == COMBOBOX_ENTRY_NOTFOUND ) 312*cdf0e10cSrcweir Sound::Beep(); 313*cdf0e10cSrcweir else 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Select, (comm_ULONG) nPos+1 ); 316*cdf0e10cSrcweir bSendData = sal_True; 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir if ( m_bLog ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Select"), nPos ); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir break; 326*cdf0e10cSrcweir case WINDOW_PUSHBUTTON: 327*cdf0e10cSrcweir case WINDOW_OKBUTTON: 328*cdf0e10cSrcweir case WINDOW_CANCELBUTTON: 329*cdf0e10cSrcweir case WINDOW_IMAGEBUTTON: 330*cdf0e10cSrcweir case WINDOW_MOREBUTTON: 331*cdf0e10cSrcweir case WINDOW_HELPBUTTON: 332*cdf0e10cSrcweir switch( nEventID ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir case VCLEVENT_BUTTON_CLICK: 335*cdf0e10cSrcweir Window* pParent = pWin->GetParent(); 336*cdf0e10cSrcweir sal_Bool bDone = sal_False; 337*cdf0e10cSrcweir if ( pParent->IsDialog() && !pWin->GetUniqueOrHelpId().getLength() ) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir switch ( pParent->GetType() ) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir case WINDOW_MESSBOX: 342*cdf0e10cSrcweir case WINDOW_INFOBOX: 343*cdf0e10cSrcweir case WINDOW_WARNINGBOX: 344*cdf0e10cSrcweir case WINDOW_ERRORBOX: 345*cdf0e10cSrcweir case WINDOW_QUERYBOX: 346*cdf0e10cSrcweir case WINDOW_BUTTONDIALOG: 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir comm_USHORT nMethod; 349*cdf0e10cSrcweir String aMethod; 350*cdf0e10cSrcweir ButtonDialog* pBD = (ButtonDialog*)pParent; 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir // we have to find the current Button ID ourselves since it is not generated at this point :-( 353*cdf0e10cSrcweir sal_uInt16 nCurrentButtonId = 0xffff; // Some wild value to wak up people 354*cdf0e10cSrcweir sal_uInt16 i; 355*cdf0e10cSrcweir for ( i = 0; i < pBD->GetButtonCount() ; i++ ) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir if ( pBD->GetPushButton( pBD->GetButtonId(i) ) == pWin ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir nCurrentButtonId = pBD->GetButtonId(i); 360*cdf0e10cSrcweir break; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir switch ( nCurrentButtonId ) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir case BUTTONID_OK: nMethod = M_OK; aMethod = CUniString("OK"); break; 367*cdf0e10cSrcweir case BUTTONID_CANCEL: nMethod = M_Cancel; aMethod = CUniString("Cancel"); break; 368*cdf0e10cSrcweir case BUTTONID_YES: nMethod = M_Yes; aMethod = CUniString("Yes"); break; 369*cdf0e10cSrcweir case BUTTONID_NO: nMethod = M_No; aMethod = CUniString("No"); break; 370*cdf0e10cSrcweir case BUTTONID_RETRY: nMethod = M_Repeat; aMethod = CUniString("Repeat"); break; 371*cdf0e10cSrcweir case BUTTONID_HELP: nMethod = M_Help; aMethod = CUniString("Help"); break; 372*cdf0e10cSrcweir default: nMethod = M_Click; aMethod = CUniString("Click"); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir if ( m_bRecord ) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir if ( nMethod != M_Click ) 377*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod ); 378*cdf0e10cSrcweir else 379*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod, (comm_ULONG)nCurrentButtonId ); 380*cdf0e10cSrcweir bSendData = sal_True; 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir if ( m_bLog ) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir if ( nMethod != M_Click ) 385*cdf0e10cSrcweir LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); 386*cdf0e10cSrcweir else 387*cdf0e10cSrcweir LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod, nCurrentButtonId ); 388*cdf0e10cSrcweir bDone = sal_True; 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir break; 392*cdf0e10cSrcweir default: 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir comm_USHORT nMethod; 395*cdf0e10cSrcweir String aMethod; 396*cdf0e10cSrcweir switch ( pWin->GetType() ) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir case WINDOW_OKBUTTON: nMethod = M_OK; aMethod = CUniString("OK"); break; 399*cdf0e10cSrcweir case WINDOW_CANCELBUTTON: nMethod = M_Cancel; aMethod = CUniString("Cancel"); break; 400*cdf0e10cSrcweir case WINDOW_HELPBUTTON: nMethod = M_Help; aMethod = CUniString("Help"); break; 401*cdf0e10cSrcweir default: nMethod = M_Default;aMethod = CUniString("Unknown Button"); 402*cdf0e10cSrcweir DBG_ERROR( "Unknown Button" ); 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir if ( m_bRecord ) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pParent->GetUniqueOrHelpId(), nMethod ); 407*cdf0e10cSrcweir bSendData = sal_True; 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir if ( m_bLog ) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); 412*cdf0e10cSrcweir bDone = sal_True; 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir break; 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir if ( m_bRecord ) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir if ( !bSendData && pWin->GetUniqueOrHelpId().getLength() ) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Click ); 423*cdf0e10cSrcweir bSendData = sal_True; 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir if ( m_bLog ) 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir if ( !bDone ) 429*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Click") ); 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir break; 433*cdf0e10cSrcweir /* case C_MoreButton: 434*cdf0e10cSrcweir switch( nEventID ) 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir case M_IsOpen : 437*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, ((MoreButton*)pControl)->GetState()); 438*cdf0e10cSrcweir break; 439*cdf0e10cSrcweir case M_Click : 440*cdf0e10cSrcweir ((MoreButton*)pControl)->Click(); 441*cdf0e10cSrcweir break; 442*cdf0e10cSrcweir case M_Open : 443*cdf0e10cSrcweir ((MoreButton*)pControl)->SetState(sal_True); 444*cdf0e10cSrcweir break; 445*cdf0e10cSrcweir case M_Close : 446*cdf0e10cSrcweir ((MoreButton*)pControl)->SetState(sal_False); 447*cdf0e10cSrcweir break; 448*cdf0e10cSrcweir default: 449*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MoreButton" ) ); 450*cdf0e10cSrcweir break; 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir break;*/ 453*cdf0e10cSrcweir case WINDOW_SPINFIELD: 454*cdf0e10cSrcweir case WINDOW_PATTERNFIELD: 455*cdf0e10cSrcweir case WINDOW_NUMERICFIELD: 456*cdf0e10cSrcweir case WINDOW_METRICFIELD: 457*cdf0e10cSrcweir case WINDOW_CURRENCYFIELD: 458*cdf0e10cSrcweir case WINDOW_DATEFIELD: 459*cdf0e10cSrcweir case WINDOW_TIMEFIELD: 460*cdf0e10cSrcweir switch( nEventID ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_UP: 463*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_DOWN: 464*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_FIRST: 465*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_LAST: 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir pEditModify = NULL; 468*cdf0e10cSrcweir aEditModifyString.Erase(); 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir comm_USHORT nMethod; 471*cdf0e10cSrcweir String aMethod; 472*cdf0e10cSrcweir switch ( nEventID ) 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_UP: nMethod = M_More; aMethod = CUniString("More"); break; 475*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_DOWN: nMethod = M_Less; aMethod = CUniString("Less"); break; 476*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_FIRST: nMethod = M_ToMin; aMethod = CUniString("ToMin"); break; 477*cdf0e10cSrcweir case VCLEVENT_SPINFIELD_LAST: nMethod = M_ToMax; aMethod = CUniString("ToMax"); break; 478*cdf0e10cSrcweir default: nMethod = M_ToMin; aMethod = CUniString("Unknown"); 479*cdf0e10cSrcweir DBG_ERROR( "Unknown EventID in Spinfield" ); 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir if ( m_bRecord ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), nMethod ); 484*cdf0e10cSrcweir bSendData = sal_True; 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir if ( m_bLog ) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir break; 492*cdf0e10cSrcweir case VCLEVENT_EDIT_MODIFY: 493*cdf0e10cSrcweir pEditModify = pWin; 494*cdf0e10cSrcweir aEditModifyString = ((SpinField*)pWin)->GetText(); 495*cdf0e10cSrcweir break; 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir break; 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir case WINDOW_MENUBUTTON: 500*cdf0e10cSrcweir switch( nEventID ) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir case VCLEVENT_BUTTON_CLICK: 503*cdf0e10cSrcweir if ( m_bRecord ) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_USHORT)M_Click ); 506*cdf0e10cSrcweir bSendData = sal_True; 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir if ( m_bLog ) 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Click") ); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir break; 513*cdf0e10cSrcweir /* Keyevent or Timeout 514*cdf0e10cSrcweir case M_Open : 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir MouseEvent aMEvnt; 517*cdf0e10cSrcweir Point aPt( pControl->GetSizePixel().Width() / 2, pControl->GetSizePixel().Height() / 2 ); 518*cdf0e10cSrcweir aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT ); 519*cdf0e10cSrcweir ImplMouseButtonDown( pControl, aMEvnt ); 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir sal_uLong nStart = Time::GetSystemTicks(); 522*cdf0e10cSrcweir sal_uLong nDelay = pControl->GetSettings().GetMouseSettings().GetActionDelay(); 523*cdf0e10cSrcweir while ( ( Time::GetSystemTicks() - nStart ) < nDelay + 100 ) 524*cdf0e10cSrcweir SafeReschedule(); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir ImplMouseButtonUp ( pControl, aMEvnt ); 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir break;*/ 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir break; 531*cdf0e10cSrcweir case WINDOW_TOOLBOX: 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir ToolBox *pTB = ((ToolBox*)pWin); 534*cdf0e10cSrcweir switch( nEventID ) 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir case VCLEVENT_TOOLBOX_SELECT: 537*cdf0e10cSrcweir { // a Button has been clicked 538*cdf0e10cSrcweir // so this cannot be a tearoff or OpenMenu anymore 539*cdf0e10cSrcweir pActionParent = NULL; 540*cdf0e10cSrcweir // compare to 1 for floating ToolBoxes 541*cdf0e10cSrcweir if ( m_bRecord ) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir if ( !pWin->GetUniqueOrHelpId().getLength() /* || pWin->GetUniqueOrHelpId().Matches( 1 ) */ ) 544*cdf0e10cSrcweir // generate direct Button access 545*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, Str2Id( pTB->GetItemCommand( pTB->GetCurItemId() ) ), (comm_USHORT)(M_Click) ); 546*cdf0e10cSrcweir else 547*cdf0e10cSrcweir // access via Toolbox 548*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pTB->GetUniqueOrHelpId(), (comm_USHORT)(M_Click|M_RET_NUM_CONTROL), Id2Str( pTB->GetHelpId( pTB->GetCurItemId() ) ) ); 549*cdf0e10cSrcweir bSendData = sal_True; 550*cdf0e10cSrcweir } 551*cdf0e10cSrcweir /* not needed if ( m_bLog ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir }*/ 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir break; 556*cdf0e10cSrcweir case VCLEVENT_TOOLBOX_CLICK: /// ATTENTION this is called during initialisation of toolbox. whoever 'invented' this 557*cdf0e10cSrcweir pActionParent = pTB; 558*cdf0e10cSrcweir break; 559*cdf0e10cSrcweir // case VCLEVENT_WINDOW_SHOW: // not usable ATM. see above 560*cdf0e10cSrcweir // if ( pActionParent ) 561*cdf0e10cSrcweir // { // a new toolbox opens up, might be a tearoff 562*cdf0e10cSrcweir // if ( pActionParent != pWin ) 563*cdf0e10cSrcweir // { // it IS a tearoff not an undock 564*cdf0e10cSrcweir // // compare to 1 for floating ToolBoxes 565*cdf0e10cSrcweir // if ( m_bRecord ) 566*cdf0e10cSrcweir // { 567*cdf0e10cSrcweir // if ( !pWin->GetSmartUniqueOrHelpId().HasAny() || pWin->GetSmartUniqueOrHelpId().Matches( 1 ) ) 568*cdf0e10cSrcweir // // generate direct Button access 569*cdf0e10cSrcweir // StatementList::pRet->GenReturn( RET_MacroRecorder, rtl::OString( pActionParent->GetHelpId( pActionParent->GetCurItemId() ) ), (comm_USHORT)(M_TearOff) ); 570*cdf0e10cSrcweir // else 571*cdf0e10cSrcweir // // access via Toolbox 572*cdf0e10cSrcweir // StatementList::pRet->GenReturn( RET_MacroRecorder, pActionParent->GetSmartUniqueOrHelpId(), (comm_USHORT)(M_TearOff|M_RET_NUM_CONTROL), static_cast<comm_ULONG>(pActionParent->GetHelpId( pActionParent->GetCurItemId() )) ); // GetHelpId() sal_uLong != comm_ULONG on 64bit 573*cdf0e10cSrcweir // bSendData = sal_True; 574*cdf0e10cSrcweir // } 575*cdf0e10cSrcweir // if ( m_bLog ) 576*cdf0e10cSrcweir // { 577*cdf0e10cSrcweir // LogVCL( pActionParent->GetSmartUniqueOrHelpId(), pWin->GetType(), pActionParent->GetHelpId( pActionParent->GetCurItemId() ), CUniString("TearOff") ); 578*cdf0e10cSrcweir // } 579*cdf0e10cSrcweir // } 580*cdf0e10cSrcweir // pActionParent = NULL; 581*cdf0e10cSrcweir // } 582*cdf0e10cSrcweir // break; 583*cdf0e10cSrcweir case VCLEVENT_TOOLBOX_DEACTIVATE: 584*cdf0e10cSrcweir pActionParent = NULL; 585*cdf0e10cSrcweir break; 586*cdf0e10cSrcweir } 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir break; 589*cdf0e10cSrcweir /* ToolBox *pTB = ((ToolBox*)pControl); 590*cdf0e10cSrcweir if ( pTB->GetUniqueOrHelpId() != nUId ) // Also Button auf der ToolBox gefunden 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir if ( nParams == PARAM_NONE ) 593*cdf0e10cSrcweir { // Wir f�lschen einen Parameter 594*cdf0e10cSrcweir nParams = PARAM_USHORT_1; 595*cdf0e10cSrcweir nNr1 = nUId; 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir else 598*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir #define FIND_HELP\ 602*cdf0e10cSrcweir {\ 603*cdf0e10cSrcweir if( nParams == PARAM_USHORT_1 )\ 604*cdf0e10cSrcweir nLNr1 = nNr1;\ 605*cdf0e10cSrcweir for ( nNr1 = 0; nNr1 < pTB->GetItemCount() && nLNr1 != pTB->GetHelpId(pTB->GetItemId(nNr1)) ; nNr1++ ) {}\ 606*cdf0e10cSrcweir bBool1 = nLNr1 == pTB->GetHelpId(pTB->GetItemId(nNr1));\ 607*cdf0e10cSrcweir if ( !bBool1 )\ 608*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_HELPID_ON_TOOLBOX_NOT_FOUND, MethodString( nMethodId ) ) );\ 609*cdf0e10cSrcweir else\ 610*cdf0e10cSrcweir {\ 611*cdf0e10cSrcweir if ( !pTB->IsItemEnabled( pTB->GetItemId(nNr1) ) && nMethodId != _M_IsEnabled )\ 612*cdf0e10cSrcweir {\ 613*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_BUTTON_DISABLED_ON_TOOLBOX, MethodString( nMethodId ) ) );\ 614*cdf0e10cSrcweir bBool1 = sal_False;\ 615*cdf0e10cSrcweir }\ 616*cdf0e10cSrcweir else if ( !pTB->IsItemVisible( pTB->GetItemId(nNr1) ) )\ 617*cdf0e10cSrcweir {\ 618*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_BUTTON_HIDDEN_ON_TOOLBOX, MethodString( nMethodId ) ) );\ 619*cdf0e10cSrcweir bBool1 = sal_False;\ 620*cdf0e10cSrcweir }\ 621*cdf0e10cSrcweir else\ 622*cdf0e10cSrcweir {\ 623*cdf0e10cSrcweir if ( pTB->GetItemRect(pTB->GetItemId(nNr1)).IsEmpty() )\ 624*cdf0e10cSrcweir {\ 625*cdf0e10cSrcweir sal_uInt16 nLine = pTB->GetCurLine();\ 626*cdf0e10cSrcweir do\ 627*cdf0e10cSrcweir {\ 628*cdf0e10cSrcweir pTB->ShowLine( sal_False );\ 629*cdf0e10cSrcweir for ( int i = 1 ; i < 30 ; i++ )\ 630*cdf0e10cSrcweir SafeReschedule();\ 631*cdf0e10cSrcweir }\ 632*cdf0e10cSrcweir while ( pTB->GetCurLine() != nLine && pTB->GetItemRect(pTB->GetItemId(nNr1)).IsEmpty() );\ 633*cdf0e10cSrcweir pTB->Invalidate( pTB->GetScrollRect() );\ 634*cdf0e10cSrcweir }\ 635*cdf0e10cSrcweir if ( pTB->GetItemRect(pTB->GetItemId(nNr1)).IsEmpty() )\ 636*cdf0e10cSrcweir {\ 637*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX, MethodString( nMethodId ) ) );\ 638*cdf0e10cSrcweir bBool1 = sal_False;\ 639*cdf0e10cSrcweir }\ 640*cdf0e10cSrcweir }\ 641*cdf0e10cSrcweir }\ 642*cdf0e10cSrcweir }\ 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir switch( nEventID ) 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir case M_SetNextToolBox : 647*cdf0e10cSrcweir if ( (nParams & PARAM_STR_1) ) 648*cdf0e10cSrcweir pTB->SetNextToolBox( aString1 ); 649*cdf0e10cSrcweir else 650*cdf0e10cSrcweir pTB->SetNextToolBox( pTB->GetNextToolBox() ); 651*cdf0e10cSrcweir pTB->NextToolBox(); 652*cdf0e10cSrcweir break; 653*cdf0e10cSrcweir case M_GetNextToolBox : 654*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, (String)pTB->GetNextToolBox()); 655*cdf0e10cSrcweir break; 656*cdf0e10cSrcweir default: 657*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ToolBox" ) ); 658*cdf0e10cSrcweir break; 659*cdf0e10cSrcweir } 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir break; 662*cdf0e10cSrcweir */ 663*cdf0e10cSrcweir case WINDOW_CONTROL: 664*cdf0e10cSrcweir case WINDOW_WINDOW: 665*cdf0e10cSrcweir switch( nEventID ) 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir case VCLEVENT_WINDOW_COMMAND: 668*cdf0e10cSrcweir break; 669*cdf0e10cSrcweir case VCLEVENT_WINDOW_KEYINPUT: 670*cdf0e10cSrcweir { 671*cdf0e10cSrcweir const KeyEvent *pKeyEvent = ((KeyEvent*)pWinEvent->GetData()); 672*cdf0e10cSrcweir const KeyCode aKeyCode = pKeyEvent->GetKeyCode(); 673*cdf0e10cSrcweir if ( pKeyEvent ) 674*cdf0e10cSrcweir { 675*cdf0e10cSrcweir pKeyWin = pWin; 676*cdf0e10cSrcweir Window *pIdWin = GetParentWithID( pWin ); 677*cdf0e10cSrcweir if ( pIdWin != pWin ) 678*cdf0e10cSrcweir bKeyFollowFocus = sal_True; 679*cdf0e10cSrcweir aKeyUniqueID = pIdWin->GetUniqueOrHelpId(); 680*cdf0e10cSrcweir if ( m_bLog ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir // HACK Too many KeyEvents generated if ( aKeyString.Len() == 0 ) 683*cdf0e10cSrcweir // HACK Too many KeyEvents generated LogVCL( rtl::OString(), 0, aKeyUniqueID, CUniString("TypeKeysStart") ); 684*cdf0e10cSrcweir } 685*cdf0e10cSrcweir if ( ( !aKeyCode.IsMod1() && !aKeyCode.IsMod2() ) && 686*cdf0e10cSrcweir (( aKeyCode.GetGroup() == KEYGROUP_NUM) || 687*cdf0e10cSrcweir ( aKeyCode.GetGroup() == KEYGROUP_ALPHA) || 688*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_SPACE) || 689*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_ADD) || 690*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_SUBTRACT) || 691*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_MULTIPLY) || 692*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_DIVIDE) || 693*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_POINT) || 694*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_COMMA) || 695*cdf0e10cSrcweir ( aKeyCode.GetCode() == KEY_EQUAL) || 696*cdf0e10cSrcweir ( aKeyCode.GetCode() == 0) ) ) 697*cdf0e10cSrcweir { 698*cdf0e10cSrcweir DBG_ASSERT( pKeyEvent->GetCharCode(), "no charcode found" ); 699*cdf0e10cSrcweir aKeyString += pKeyEvent->GetCharCode(); 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir else 702*cdf0e10cSrcweir { // not a regular key, transfer KeyCode 703*cdf0e10cSrcweir aKeyString += sal_Unicode(1); // mask it 704*cdf0e10cSrcweir // extra for '>' which is coded as <SHIFT GREATER> 705*cdf0e10cSrcweir if ( pKeyEvent->GetCharCode() == '>' ) 706*cdf0e10cSrcweir aKeyString += sal_Unicode( KEY_GREATER | (aKeyCode.GetAllModifier() & ~KEY_SHIFT) ); 707*cdf0e10cSrcweir else 708*cdf0e10cSrcweir aKeyString += sal_Unicode( aKeyCode.GetCode() | aKeyCode.GetAllModifier() ); 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir break; 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir case VCLEVENT_WINDOW_MOUSEMOVE: 715*cdf0e10cSrcweir case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: 716*cdf0e10cSrcweir case VCLEVENT_WINDOW_MOUSEBUTTONUP: 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir break; 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir break; 724*cdf0e10cSrcweir case WINDOW_DOCKINGWINDOW: 725*cdf0e10cSrcweir // switch( nEventID ) 726*cdf0e10cSrcweir { 727*cdf0e10cSrcweir // case 1 .. 0xffff: 728*cdf0e10cSrcweir DBG_TRACE3( "TT_VCLMessage %u %u %X",nEventID, pWin->GetType(), pWin ); 729*cdf0e10cSrcweir // sal_Bool bx = ((DockingWindow*)pWin)->IsFloatingMode(); 730*cdf0e10cSrcweir // break; 731*cdf0e10cSrcweir /* case M_Dock : 732*cdf0e10cSrcweir if ( ((DockingWindow*)pControl)->IsFloatingMode() ) 733*cdf0e10cSrcweir ((DockingWindow*)pControl)->SetFloatingMode(sal_False); 734*cdf0e10cSrcweir else 735*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) ); 736*cdf0e10cSrcweir break; 737*cdf0e10cSrcweir case M_Undock : 738*cdf0e10cSrcweir if ( !((DockingWindow*)pControl)->IsFloatingMode() ) 739*cdf0e10cSrcweir ((DockingWindow*)pControl)->SetFloatingMode(sal_True); 740*cdf0e10cSrcweir else 741*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) ); 742*cdf0e10cSrcweir break; 743*cdf0e10cSrcweir case M_IsDocked : 744*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, (comm_BOOL) !((DockingWindow*)pControl)->IsFloatingMode()); 745*cdf0e10cSrcweir break; 746*cdf0e10cSrcweir case M_Close: 747*cdf0e10cSrcweir //nWindowWaitUId = nUId; 748*cdf0e10cSrcweir DBG_ASSERT( nUId == pControl->GetUniqueOrHelpId(), "nUID != UniqueOrHelpId"); 749*cdf0e10cSrcweir SET_WINP_CLOSING(pControl); 750*cdf0e10cSrcweir ((DockingWindow*)pControl)->Close(); 751*cdf0e10cSrcweir break; 752*cdf0e10cSrcweir case M_Size: 753*cdf0e10cSrcweir case M_Move: 754*cdf0e10cSrcweir case M_IsMax : 755*cdf0e10cSrcweir case M_Minimize : 756*cdf0e10cSrcweir case M_Maximize : 757*cdf0e10cSrcweir if ( ((DockingWindow*)pControl)->IsFloatingMode() ) 758*cdf0e10cSrcweir { 759*cdf0e10cSrcweir pControl = ((DockingWindow*)pControl)->GetFloatingWindow(); 760*cdf0e10cSrcweir goto FloatWin; 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir else 763*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_DOCKING_MODE, MethodString( nMethodId ) ) ); 764*cdf0e10cSrcweir break; 765*cdf0e10cSrcweir case M_Help: // Alles was unten weiterbehandelt werden soll 766*cdf0e10cSrcweir goto MoreDialog; 767*cdf0e10cSrcweir 768*cdf0e10cSrcweir default: 769*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "DockingWindow" ) ); 770*cdf0e10cSrcweir break;*/ 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir break; 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir case WINDOW_FLOATINGWINDOW: 780*cdf0e10cSrcweir { 781*cdf0e10cSrcweir DBG_TRACE3( "TT_VCLMessage %u %u %X",nEventID, pWin->GetType(), pWin ); 782*cdf0e10cSrcweir // FloatingWindow *pFW = ((FloatingWindow*)pWin); 783*cdf0e10cSrcweir /* switch( nEventID ) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir 786*cdf0e10cSrcweir // M_OpenMenu an einem ToolboxButton 787*cdf0e10cSrcweir case VCLEVENT_WINDOW_SHOW: 788*cdf0e10cSrcweir if ( pActionParent ) 789*cdf0e10cSrcweir { // a new FloatingWindow opens up, so we assume an OpenMenu 790*cdf0e10cSrcweir // compare to 1 for floating ToolBoxes 791*cdf0e10cSrcweir if ( ( pActionParent->GetUniqueOrHelpId() == 0 || pActionParent->GetUniqueOrHelpId() == 1 ) ) 792*cdf0e10cSrcweir // generate direct Button access 793*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pActionParent->GetHelpId( pActionParent->GetCurItemId() ), (comm_USHORT)(M_OpenMenu) ); 794*cdf0e10cSrcweir else 795*cdf0e10cSrcweir // access via Toolbox 796*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pActionParent->GetUniqueOrHelpId(), (comm_USHORT)(M_OpenMenu|M_RET_NUM_CONTROL), pActionParent->GetHelpId( pActionParent->GetCurItemId() ) ); 797*cdf0e10cSrcweir bSendData = sal_True; 798*cdf0e10cSrcweir } 799*cdf0e10cSrcweir break; 800*cdf0e10cSrcweir 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir */ } 803*cdf0e10cSrcweir break; 804*cdf0e10cSrcweir /* 805*cdf0e10cSrcweir case M_AnimateMouse : 806*cdf0e10cSrcweir AnimateMouse( pControl, MitteOben); 807*cdf0e10cSrcweir break; 808*cdf0e10cSrcweir case M_IsMax : 809*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, (comm_BOOL)!((FloatingWindow*)pControl)->IsRollUp()); 810*cdf0e10cSrcweir break; 811*cdf0e10cSrcweir case M_Minimize : 812*cdf0e10cSrcweir ((FloatingWindow*)pControl)->RollUp(); 813*cdf0e10cSrcweir break; 814*cdf0e10cSrcweir case M_Maximize : 815*cdf0e10cSrcweir ((FloatingWindow*)pControl)->RollDown(); 816*cdf0e10cSrcweir break; 817*cdf0e10cSrcweir case M_Size: 818*cdf0e10cSrcweir { 819*cdf0e10cSrcweir if ( pControl->GetStyle() & WB_SIZEABLE ) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir pControl->SetSizePixel(Size(nNr1,nNr2)); 822*cdf0e10cSrcweir pControl->Resize(); 823*cdf0e10cSrcweir } 824*cdf0e10cSrcweir else 825*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_SIZE_NOT_CHANGEABLE, MethodString( nMethodId ) ) ); 826*cdf0e10cSrcweir break; 827*cdf0e10cSrcweir } 828*cdf0e10cSrcweir case M_Close: 829*cdf0e10cSrcweir DBG_ASSERT( nUId == pControl->GetUniqueOrHelpId(), "nUID != UniqueOrHelpId"); 830*cdf0e10cSrcweir SET_WINP_CLOSING(pControl); 831*cdf0e10cSrcweir ((FloatingWindow*)pControl)->Close(); 832*cdf0e10cSrcweir break; 833*cdf0e10cSrcweir case M_Help: // Alles was unten weiterbehandelt werden soll 834*cdf0e10cSrcweir case M_Move: 835*cdf0e10cSrcweir goto MoreDialog; 836*cdf0e10cSrcweir default: 837*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "FloatingWin" ) ); 838*cdf0e10cSrcweir break; 839*cdf0e10cSrcweir } 840*cdf0e10cSrcweir break;*/ 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir /* 850*cdf0e10cSrcweir case C_ModelessDlg: 851*cdf0e10cSrcweir case C_Dlg: 852*cdf0e10cSrcweir case C_TabDlg: 853*cdf0e10cSrcweir MoreDialog: 854*cdf0e10cSrcweir switch( nEventID ) 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir 857*cdf0e10cSrcweir // (Rect GetRect) 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir case M_AnimateMouse : 860*cdf0e10cSrcweir AnimateMouse( pControl, MitteOben); 861*cdf0e10cSrcweir break; 862*cdf0e10cSrcweir case M_Close: 863*cdf0e10cSrcweir DBG_ASSERT( nUId == pControl->GetUniqueOrHelpId(), "nUID != UniqueOrHelpId"); 864*cdf0e10cSrcweir SET_WINP_CLOSING(pControl); 865*cdf0e10cSrcweir ((SystemWindow*)pControl)->Close(); 866*cdf0e10cSrcweir break; 867*cdf0e10cSrcweir case M_Move: 868*cdf0e10cSrcweir { 869*cdf0e10cSrcweir pControl->SetPosPixel(Point(nNr1,nNr2)); 870*cdf0e10cSrcweir break; 871*cdf0e10cSrcweir } 872*cdf0e10cSrcweir default: 873*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "Dialog" ) ); 874*cdf0e10cSrcweir break; 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir break;*/ 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir 882*cdf0e10cSrcweir 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir /* 891*cdf0e10cSrcweir case C_WorkWin: 892*cdf0e10cSrcweir switch( nEventID ) 893*cdf0e10cSrcweir { 894*cdf0e10cSrcweir case M_Close: 895*cdf0e10cSrcweir DBG_ASSERT( nUId == pControl->GetUniqueOrHelpId(), "nUID != UniqueOrHelpId"); 896*cdf0e10cSrcweir SET_WINP_CLOSING(pControl); 897*cdf0e10cSrcweir ((WorkWindow*)pControl)->Close(); 898*cdf0e10cSrcweir break; 899*cdf0e10cSrcweir case M_Size: 900*cdf0e10cSrcweir case M_Move: 901*cdf0e10cSrcweir goto FloatWin; 902*cdf0e10cSrcweir break; 903*cdf0e10cSrcweir case M_Help: // Alles was unten weiterbehandelt werden soll 904*cdf0e10cSrcweir goto MoreDialog; 905*cdf0e10cSrcweir default: 906*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "WorkWindow" ) ); 907*cdf0e10cSrcweir break; 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir break; 910*cdf0e10cSrcweir */ 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir /* case C_TabPage: 914*cdf0e10cSrcweir switch( nEventID ) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir } 917*cdf0e10cSrcweir break;*/ 918*cdf0e10cSrcweir 919*cdf0e10cSrcweir 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir 924*cdf0e10cSrcweir 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir 928*cdf0e10cSrcweir 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir /* 932*cdf0e10cSrcweir case C_MessBox: 933*cdf0e10cSrcweir case C_InfoBox: 934*cdf0e10cSrcweir case C_WarningBox: 935*cdf0e10cSrcweir case C_ErrorBox: 936*cdf0e10cSrcweir case C_QueryBox: 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir sal_Bool bDone = sal_True; 939*cdf0e10cSrcweir MessBox* pMB = (MessBox*)pControl; 940*cdf0e10cSrcweir switch( nEventID ) 941*cdf0e10cSrcweir { 942*cdf0e10cSrcweir case M_GetCheckBoxText: 943*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, pMB->GetCheckBoxText() ); 944*cdf0e10cSrcweir break; 945*cdf0e10cSrcweir case M_IsChecked : 946*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, comm_BOOL( pMB->GetCheckBoxState() == STATE_CHECK) ); 947*cdf0e10cSrcweir break; 948*cdf0e10cSrcweir case M_GetState : 949*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, comm_ULONG( pMB->GetCheckBoxState() )); 950*cdf0e10cSrcweir break; 951*cdf0e10cSrcweir case M_Check : 952*cdf0e10cSrcweir pMB->SetCheckBoxState( STATE_CHECK ); 953*cdf0e10cSrcweir break; 954*cdf0e10cSrcweir case M_UnCheck : 955*cdf0e10cSrcweir pMB->SetCheckBoxState( STATE_NOCHECK ); 956*cdf0e10cSrcweir break; 957*cdf0e10cSrcweir case M_GetText : 958*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, pMB->GetMessText()); 959*cdf0e10cSrcweir break; 960*cdf0e10cSrcweir 961*cdf0e10cSrcweir default: 962*cdf0e10cSrcweir bDone = sal_False; 963*cdf0e10cSrcweir break; 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir if ( bDone ) 966*cdf0e10cSrcweir break; // break the case here else continue at C_ButtonDialog 967*cdf0e10cSrcweir } 968*cdf0e10cSrcweir case C_ButtonDialog: 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir ButtonDialog* pBD = (ButtonDialog*)pControl; 971*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 972*cdf0e10cSrcweir m_pDbgWin->AddText( "Working MessBox: " ); 973*cdf0e10cSrcweir if (pControl->IsVisible()) 974*cdf0e10cSrcweir m_pDbgWin->AddText("*(Visible)\n"); 975*cdf0e10cSrcweir else 976*cdf0e10cSrcweir m_pDbgWin->AddText("*(nicht Visible)\n"); 977*cdf0e10cSrcweir #endif 978*cdf0e10cSrcweir switch( nEventID ) 979*cdf0e10cSrcweir { 980*cdf0e10cSrcweir case M_GetText : 981*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, pControl->GetText()); 982*cdf0e10cSrcweir break; 983*cdf0e10cSrcweir case M_Click: 984*cdf0e10cSrcweir if ( nParams & PARAM_USHORT_1 ) 985*cdf0e10cSrcweir { 986*cdf0e10cSrcweir if ( pBD->GetPushButton( nNr1 ) ) 987*cdf0e10cSrcweir { 988*cdf0e10cSrcweir if ( nNr1 != BUTTONID_HELP ) 989*cdf0e10cSrcweir { 990*cdf0e10cSrcweir SET_WINP_CLOSING(pControl); 991*cdf0e10cSrcweir } 992*cdf0e10cSrcweir pBD->GetPushButton( nNr1 )->Click(); 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir else 995*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2( S_NO_DEFAULT_BUTTON, UniString::CreateFromInt32( nNr1 ), MethodString( nMethodId ) ) ); 996*cdf0e10cSrcweir } 997*cdf0e10cSrcweir else 998*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR1( S_BUTTONID_REQUIRED, MethodString( nMethodId ) ) ); 999*cdf0e10cSrcweir break; 1000*cdf0e10cSrcweir case M_GetButtonCount : 1001*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, comm_ULONG(pBD->GetButtonCount())); 1002*cdf0e10cSrcweir break; 1003*cdf0e10cSrcweir case M_GetButtonId : 1004*cdf0e10cSrcweir if ( ValueOK(nUId, MethodString( nMethodId ),nNr1,pBD->GetButtonCount()) ) 1005*cdf0e10cSrcweir pRet->GenReturn ( RET_Value, nUId, comm_ULONG(pBD->GetButtonId(nNr1-1))); 1006*cdf0e10cSrcweir break; 1007*cdf0e10cSrcweir default: 1008*cdf0e10cSrcweir ReportError( nUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MessageBox" ) ); 1009*cdf0e10cSrcweir break; 1010*cdf0e10cSrcweir } 1011*cdf0e10cSrcweir break; 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir */ 1015*cdf0e10cSrcweir 1016*cdf0e10cSrcweir 1017*cdf0e10cSrcweir } 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir 1020*cdf0e10cSrcweir switch( nEventID ) 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir case VCLEVENT_CONTROL_LOSEFOCUS: 1023*cdf0e10cSrcweir if ( pEditModify == pWin ) 1024*cdf0e10cSrcweir { 1025*cdf0e10cSrcweir if ( m_bRecord ) 1026*cdf0e10cSrcweir { 1027*cdf0e10cSrcweir StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), M_SetText, aEditModifyString ); 1028*cdf0e10cSrcweir bSendData = sal_True; 1029*cdf0e10cSrcweir } 1030*cdf0e10cSrcweir if ( m_bLog ) 1031*cdf0e10cSrcweir { 1032*cdf0e10cSrcweir LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Modify") ); 1033*cdf0e10cSrcweir } 1034*cdf0e10cSrcweir pEditModify = NULL; 1035*cdf0e10cSrcweir aEditModifyString.Erase(); //could be somewhat lengthy 1036*cdf0e10cSrcweir } 1037*cdf0e10cSrcweir break; 1038*cdf0e10cSrcweir } 1039*cdf0e10cSrcweir 1040*cdf0e10cSrcweir pLastWin = pWin; 1041*cdf0e10cSrcweir 1042*cdf0e10cSrcweir } // if 1043*cdf0e10cSrcweir else if ( pEvent->ISA( VclMenuEvent ) ) 1044*cdf0e10cSrcweir { 1045*cdf0e10cSrcweir // VclMenuEvent* pMenuEvent = ( VclMenuEvent* ) pEvent; 1046*cdf0e10cSrcweir } 1047*cdf0e10cSrcweir 1048*cdf0e10cSrcweir 1049*cdf0e10cSrcweir if ( bSendData ) 1050*cdf0e10cSrcweir new StatementFlow( NULL, F_EndCommandBlock ); // Kommando zum Senden erzeugen und in que eintragen 1051*cdf0e10cSrcweir 1052*cdf0e10cSrcweir return 0; 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir 1057*cdf0e10cSrcweir static ::osl::Mutex * getRecorderMutex() 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir static ::osl::Mutex * pMutex = NULL; 1060*cdf0e10cSrcweir if(pMutex==NULL) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir ::osl::MutexGuard aGuard(::osl::Mutex::getGlobalMutex()); 1063*cdf0e10cSrcweir if(pMutex==NULL) 1064*cdf0e10cSrcweir pMutex = new ::osl::Mutex(); 1065*cdf0e10cSrcweir } 1066*cdf0e10cSrcweir return pMutex; 1067*cdf0e10cSrcweir } 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir 1070*cdf0e10cSrcweir void MacroRecorder::CheckDelete() 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getRecorderMutex() ); 1073*cdf0e10cSrcweir if ( !m_bRecord && !m_bLog ) 1074*cdf0e10cSrcweir { 1075*cdf0e10cSrcweir pMacroRecorder = NULL; 1076*cdf0e10cSrcweir delete this; 1077*cdf0e10cSrcweir } 1078*cdf0e10cSrcweir } 1079*cdf0e10cSrcweir 1080*cdf0e10cSrcweir 1081*cdf0e10cSrcweir MacroRecorder* MacroRecorder::GetMacroRecorder() 1082*cdf0e10cSrcweir { 1083*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getRecorderMutex() ); 1084*cdf0e10cSrcweir if ( !pMacroRecorder ) 1085*cdf0e10cSrcweir pMacroRecorder = new MacroRecorder; 1086*cdf0e10cSrcweir 1087*cdf0e10cSrcweir return pMacroRecorder; 1088*cdf0e10cSrcweir } 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweir sal_Bool MacroRecorder::HasMacroRecorder() 1091*cdf0e10cSrcweir { 1092*cdf0e10cSrcweir ::osl::MutexGuard aGuard( getRecorderMutex() ); 1093*cdf0e10cSrcweir return pMacroRecorder != NULL; 1094*cdf0e10cSrcweir } 1095*cdf0e10cSrcweir 1096