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