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