summaryrefslogtreecommitdiff
path: root/automation/source
diff options
context:
space:
mode:
Diffstat (limited to 'automation/source')
-rw-r--r--automation/source/app/testbasi.cxx146
-rw-r--r--automation/source/app/testbasi.hxx67
-rw-r--r--automation/source/communi/communi.cxx573
-rw-r--r--automation/source/inc/cmdbasestream.hxx94
-rw-r--r--automation/source/inc/icommstream.hxx67
-rw-r--r--automation/source/inc/ittresid.hxx45
-rw-r--r--automation/source/inc/rcontrol.hxx471
-rw-r--r--automation/source/inc/svcommstream.hxx61
-rw-r--r--automation/source/inc/testapp.hxx196
-rw-r--r--automation/source/inc/testtool.hxx75
-rw-r--r--automation/source/miniapp/editwin.cxx120
-rw-r--r--automation/source/miniapp/editwin.hxx69
-rw-r--r--automation/source/miniapp/hid.lst27
-rw-r--r--automation/source/miniapp/servres.cxx54
-rw-r--r--automation/source/miniapp/servres.hrc40
-rw-r--r--automation/source/miniapp/servres.hxx58
-rw-r--r--automation/source/miniapp/servres.src233
-rw-r--r--automation/source/miniapp/servuid.hxx40
-rw-r--r--automation/source/miniapp/test.bas126
-rw-r--r--automation/source/miniapp/test.sid5
-rw-r--r--automation/source/miniapp/test.win13
-rw-r--r--automation/source/miniapp/testapp.cxx306
-rw-r--r--automation/source/miniapp/testapp.hxx108
-rw-r--r--automation/source/server/XMLParser.cxx687
-rw-r--r--automation/source/server/cmdbasestream.cxx341
-rw-r--r--automation/source/server/editwin.cxx164
-rw-r--r--automation/source/server/editwin.hxx72
-rw-r--r--automation/source/server/prof_nul.cxx93
-rw-r--r--automation/source/server/prof_usl.cxx135
-rw-r--r--automation/source/server/profiler.cxx262
-rw-r--r--automation/source/server/profiler.hxx131
-rw-r--r--automation/source/server/recorder.cxx659
-rw-r--r--automation/source/server/recorder.hxx85
-rw-r--r--automation/source/server/retstrm.cxx125
-rw-r--r--automation/source/server/retstrm.hxx86
-rw-r--r--automation/source/server/scmdstrm.cxx214
-rw-r--r--automation/source/server/scmdstrm.hxx62
-rw-r--r--automation/source/server/server.cxx887
-rw-r--r--automation/source/server/server.hxx68
-rw-r--r--automation/source/server/sta_list.cxx1188
-rw-r--r--automation/source/server/statemnt.cxx6337
-rw-r--r--automation/source/server/statemnt.hxx491
-rw-r--r--automation/source/server/svcommstream.cxx49
-rw-r--r--automation/source/server/testtool.hrc55
-rw-r--r--automation/source/simplecm/communiio.hxx68
-rw-r--r--automation/source/simplecm/packethandler.cxx333
-rw-r--r--automation/source/simplecm/packethandler.hxx72
-rw-r--r--automation/source/simplecm/simplecm.cxx539
-rw-r--r--automation/source/simplecm/tcpio.cxx72
-rw-r--r--automation/source/simplecm/tcpio.hxx64
-rw-r--r--automation/source/testtool/Makefile60
-rw-r--r--automation/source/testtool/cmdstrm.cxx453
-rw-r--r--automation/source/testtool/cmdstrm.hxx79
-rw-r--r--automation/source/testtool/comm_bas.cxx430
-rw-r--r--automation/source/testtool/comm_bas.hxx117
-rw-r--r--automation/source/testtool/cretstrm.cxx71
-rw-r--r--automation/source/testtool/cretstrm.hxx56
-rw-r--r--automation/source/testtool/filter.pl125
-rw-r--r--automation/source/testtool/httprequest.cxx218
-rw-r--r--automation/source/testtool/httprequest.hxx84
-rw-r--r--automation/source/testtool/objtest.cxx3762
-rw-r--r--automation/source/testtool/objtest.hxx394
-rw-r--r--automation/source/testtool/registry_win.cxx82
-rw-r--r--automation/source/testtool/registry_win.hxx34
-rw-r--r--automation/source/testtool/sysdir_win.cxx103
-rw-r--r--automation/source/testtool/sysdir_win.hxx34
-rw-r--r--automation/source/testtool/tcommuni.cxx201
-rw-r--r--automation/source/testtool/tcommuni.hxx64
-rw-r--r--automation/source/testtool/testtool.ini16
69 files changed, 0 insertions, 22716 deletions
diff --git a/automation/source/app/testbasi.cxx b/automation/source/app/testbasi.cxx
deleted file mode 100644
index 976d805cd469..000000000000
--- a/automation/source/app/testbasi.cxx
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <basic/sbx.hxx>
-
-#include <basic/ttstrhlp.hxx>
-#include <basic/testtool.hxx>
-#include "testbasi.hxx"
-#define P_FEHLERLISTE TestToolObj::pFehlerListe
-
-#include <testapp.hxx>
-#include <testtool.hxx>
-
-TYPEINIT1(TTBasic,MyBasic)
-
-/*class MyFactory : public SbxFactory
-{
-public:
- virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
-};
-
-static SampleObjectFac aFac1;
-static MyFactory aFac2;
-static CommunicationFactory aComManFac;
-static ProcessFactory aProcessFac;
-static short nInst = 0;
-
-SbxBase* MyFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCr )
-{
- if( nCr == SBXCR_TEST && nSbxId == SBXID_MYBASIC )
- return new MyBasic;
- else
- return NULL;
-} */
-
-TTBasic::TTBasic() : MyBasic()
-{
-// Eigenes Objekt reinbraten
- TestToolObj* pTTO = new TestToolObj( CUniString("App"), this );
- pTTO->SetLogHdl( GenLogHdl() );
- pTTO->SetWinInfoHdl( GenWinInfoHdl() );
- pTTO->SetModuleWinExistsHdl( GenModuleWinExistsHdl() );
- pTTO->SetWriteStringHdl( GenWriteStringHdl() );
- pTTO->SetCErrorHdl( LINK( this, TTBasic, CErrorImpl ) );
-
- StartListeningTT( pTTO->GetTTBroadcaster() );
-
- pTestObject = pTTO;
- pTestObject->SetFlag( SBX_EXTSEARCH );
- Insert( pTestObject );
-}
-
-MyBasic* TTBasic::CreateMyBasic()
-{
- return new TTBasic();
-}
-
-void TTBasic::LoadIniFile()
-{
- ((TestToolObj*)pTestObject)->LoadIniFile();
-}
-
-SbTextType TTBasic::GetSymbolType( const String &rSymbol, sal_Bool bWasTTControl )
-{
- return ((TestToolObj*)pTestObject)->GetSymbolType( rSymbol, bWasTTControl );
-}
-
-
-TTBasic::~TTBasic()
-{
-}
-
-IMPL_LINK( TTBasic, CErrorImpl, ErrorEntry*, pData )
-{
- return CError( pData->nError, pData->aText, pData->nLine, pData->nCol1, pData->nCol2 );
-}
-
-sal_Bool TTBasic::Compile( SbModule* p )
-{
- p->SetComment( ((TestToolObj*)pTestObject)->GetRevision(p->GetSource()) );
- SbModule* pOldModule = GetCompileModule();
- SetCompileModule( p );
- p->SetSource( ((TestToolObj*)pTestObject)->PreCompile(p->GetSource()) );
- SetCompileModule( pOldModule );
- if ( ((TestToolObj*)pTestObject)->WasPrecompilerError() )
- return sal_False;
- return MyBasic::Compile( p );
-}
-
-const String TTBasic::GetSpecialErrorText()
-{
- String nErrorText;
- if ( pTestObject && IS_ERROR() && GetErrorCode() == GET_ERROR()->nError )
- {
- nErrorText = GenRealString( GET_ERROR()->aText );
- nErrorText.AppendAscii( ": " );
- nErrorText += String::CreateFromInt64( GET_ERROR()->nError );
- }
- else
- {
- nErrorText = GetErrorText();
- }
- return nErrorText;
-}
-
-void TTBasic::ReportRuntimeError( AppBasEd *pEditWin )
-{
- SbxVariableRef aDummy = new SbxVariable;
- aDummy->SetUserData( 24 ); // ID_MaybeAddErr
- ((TestToolObj*)pTestObject)->Notify( pTestObject->GetBroadcaster(), SbxHint( SBX_HINT_DATAWANTED, aDummy ) );
- aDummy->SetUserData( 18 ); // ID_ExceptLog
- ((TestToolObj*)pTestObject)->Notify( pTestObject->GetBroadcaster(), SbxHint( SBX_HINT_DATAWANTED, aDummy ) );
- MyBasic::ReportRuntimeError( pEditWin );
-}
-
-void TTBasic::DebugFindNoErrors( sal_Bool bDebugFindNoErrors )
-{
- ((TestToolObj*)pTestObject)->DebugFindNoErrors( bDebugFindNoErrors );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/app/testbasi.hxx b/automation/source/app/testbasi.hxx
deleted file mode 100644
index 4f90d0772ea9..000000000000
--- a/automation/source/app/testbasi.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _TTBASIC_HXX
-#define _TTBASIC_HXX
-
-#include <basic/sbstar.hxx>
-#include <basic/mybasic.hxx>
-
-class ErrorEntry;
-
-#define SBXID_TTBASIC 0x5454 // TTBasic: TT
-
-#define SBXCR_TEST2 0x54534554L // TEST
-
-class TTBasic : public MyBasic
-{
-public:
- SBX_DECL_PERSIST_NODATA(SBXCR_TEST2,SBXID_TTBASIC,1);
- TYPEINFO();
- TTBasic();
- ~TTBasic();
- sal_Bool Compile( SbModule* );
- static MyBasic* CreateMyBasic();
-
- // don't surround with #ifdefs because this header file is
- // used for testtool and basic as well
- DECL_LINK( CErrorImpl, ErrorEntry* );
-// SbxObject *pTestObject; // for testtool; NULL otherwise
-
- void LoadIniFile();
- SbTextType GetSymbolType( const String &Symbol, sal_Bool bWasTTControl );
- virtual const String GetSpecialErrorText();
- virtual void ReportRuntimeError( AppBasEd *pEditWin );
- virtual void DebugFindNoErrors( sal_Bool bDebugFindNoErrors );
-};
-
-SV_DECL_IMPL_REF(TTBasic)
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/communi/communi.cxx b/automation/source/communi/communi.cxx
deleted file mode 100644
index 4eb45a4b1071..000000000000
--- a/automation/source/communi/communi.cxx
+++ /dev/null
@@ -1,573 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <stdio.h>
-#if OSL_DEBUG_LEVEL > 1
-#define DEBUGPRINTF(x) { printf(x); fflush( stdout ); }
-#else
-#define DEBUGPRINTF(x)
-#endif
-#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
-#include <osl/socket.hxx>
-#include <tools/stream.hxx>
-#include <vcl/timer.hxx>
-#include <tools/fsys.hxx>
-
-#include <automation/communi.hxx>
-
-
-/* The delete below has been removed to make the destructor protected.
- The method isn't used anyway.
-// delete *((AE*)pData+n);
-*/
-
-#undef SV_IMPL_PTRARR_SORT
-#define SV_IMPL_PTRARR_SORT( nm,AE )\
-_SV_IMPL_SORTAR_ALG( nm,AE )\
- void nm::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) { \
- if( nL ) {\
- DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );\
- for( sal_uInt16 n=nP; n < nP + nL; n++ ) \
- OSL_FAIL("Das Element der Liste wurde nicht gel�scht"); \
- SvPtrarr::Remove( nP, nL ); \
- } \
- } \
-_SV_SEEK_PTR( nm, AE )
-
-
-
-
-SV_IMPL_PTRARR_SORT( CommunicationLinkList, CommunicationLink* );
-
-osl::Mutex *pMPostUserEvent=NULL; // necessary because not threadproof
-
-CommunicationLinkViaSocket::CommunicationLinkViaSocket( CommunicationManager *pMan, osl::StreamSocket* pSocket )
-: SimpleCommunicationLinkViaSocket( pMan, pSocket )
-, nConnectionClosedEventId( 0 )
-, nDataReceivedEventId( 0 )
-, bShutdownStarted( sal_False )
-, bDestroying( sal_False )
-{
- SetPutDataReceivedHdl(LINK( this, CommunicationLinkViaSocket, PutDataReceivedHdl ));
- if ( !pMPostUserEvent )
- pMPostUserEvent = new osl::Mutex;
- // this is necassary to prevent the running thread from sending the close event
- // before the open event has been sent.
- StartCallback();
-
- create();
-}
-
-CommunicationLinkViaSocket::~CommunicationLinkViaSocket()
-{
- bDestroying = sal_True;
- StopCommunication();
- while ( nConnectionClosedEventId || nDataReceivedEventId )
- GetpApp()->Yield();
- {
- osl::MutexGuard aGuard( aMConnectionClosed );
- if ( nConnectionClosedEventId )
- {
- GetpApp()->RemoveUserEvent( nConnectionClosedEventId );
- nConnectionClosedEventId = 0;
- INFO_MSG( CByteString("Event gel�scht"),
- CByteString( "ConnectionClosedEvent aus Queue gel�scht"),
- CM_MISC, NULL );
- }
- }
- {
- osl::MutexGuard aGuard( aMDataReceived );
- if ( nDataReceivedEventId )
- {
- GetpApp()->RemoveUserEvent( nDataReceivedEventId );
- nDataReceivedEventId = 0;
- delete GetServiceData();
- INFO_MSG( CByteString("Event gel�scht"),
- CByteString( "DataReceivedEvent aus Queue gel�scht"),
- CM_MISC, NULL );
- }
- }
-}
-
-sal_Bool CommunicationLinkViaSocket::ShutdownCommunication()
-{
- if ( isRunning() )
- {
-
- terminate();
- if ( GetStreamSocket() )
- GetStreamSocket()->shutdown();
-
- if ( GetStreamSocket() )
- GetStreamSocket()->close();
-
- resume();
-
- join();
-
- osl::StreamSocket* pTempSocket = GetStreamSocket();
- SetStreamSocket( NULL );
- delete pTempSocket;
-
-// ConnectionClosed(); is being called at the end of a thread
-
- }
- else
- {
- join();
- }
-
- return sal_True;
-}
-
-sal_Bool CommunicationLinkViaSocket::StopCommunication()
-{
- if ( !bShutdownStarted )
- {
- return SimpleCommunicationLinkViaSocket::StopCommunication();
- }
- else
- {
- WaitForShutdown();
- return sal_True;
- }
-}
-
-
-IMPL_LINK( CommunicationLinkViaSocket, ShutdownLink, void*, EMPTYARG )
-{
- if ( !IsCommunicationError() )
- ShutdownCommunication();
- return 0;
-}
-
-
-void CommunicationLinkViaSocket::WaitForShutdown()
-{
- if ( !bShutdownStarted )
- {
- aShutdownTimer.SetTimeout( 30000 ); // Should be 30 Seconds
- aShutdownTimer.SetTimeoutHdl( LINK( this, CommunicationLinkViaSocket, ShutdownLink ) );
- aShutdownTimer.Start();
- bShutdownStarted = sal_True;
- }
- if ( bDestroying )
- {
- while ( pMyManager && aShutdownTimer.IsActive() )
- {
- if ( IsCommunicationError() )
- return;
- GetpApp()->Yield();
- }
- ShutdownCommunication();
- }
-}
-
-sal_Bool CommunicationLinkViaSocket::IsCommunicationError()
-{
- return !isRunning() || SimpleCommunicationLinkViaSocket::IsCommunicationError();
-}
-
-void CommunicationLinkViaSocket::run()
-{
- sal_Bool bWasError = sal_False;
- while ( schedule() && !bWasError && GetStreamSocket() )
- {
- if ( bWasError |= !DoReceiveDataStream() )
- continue;
-
- TimeValue sNochEins = {0, 1000000};
- while ( schedule() && bIsInsideCallback )
- wait( sNochEins );
- SetNewPacketAsCurrent();
- StartCallback();
- {
- osl::MutexGuard aGuard( aMDataReceived );
- osl::MutexGuard aGuard2( *pMPostUserEvent );
- mlPutDataReceived.Call(this);
- }
- }
- TimeValue sNochEins = {0, 1000000};
- while ( schedule() && bIsInsideCallback )
- wait( sNochEins );
-
- StartCallback();
- {
- osl::MutexGuard aGuard( aMConnectionClosed );
- osl::MutexGuard aGuard2( *pMPostUserEvent );
- nConnectionClosedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLinkViaSocket, ConnectionClosed ) );
- }
-}
-
-sal_Bool CommunicationLinkViaSocket::DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol )
-{
- if ( !isRunning() )
- return sal_False;
-
- return SimpleCommunicationLinkViaSocket::DoTransferDataStream( pDataStream, nProtocol );
-}
-
-/// This is a virtual link!
-long CommunicationLinkViaSocket::ConnectionClosed( void* EMPTYARG )
-{
- {
- osl::MutexGuard aGuard( aMConnectionClosed );
- nConnectionClosedEventId = 0; // Attention!! everything else must be done above.
- }
- ShutdownCommunication();
- return CommunicationLink::ConnectionClosed( );
-}
-
-/// This is a virtual link!
-long CommunicationLinkViaSocket::DataReceived( void* EMPTYARG )
-{
- {
- osl::MutexGuard aGuard( aMDataReceived );
- nDataReceivedEventId = 0; // Attention!! everything else must be done above.
- }
- return CommunicationLink::DataReceived( );
-}
-
-IMPL_LINK( CommunicationLinkViaSocket, PutDataReceivedHdl, CommunicationLinkViaSocket*, EMPTYARG )
-{
- nDataReceivedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLink, DataReceived ) );
- return 0;
-}
-
-
-
-MultiCommunicationManager::MultiCommunicationManager( sal_Bool bUseMultiChannel )
-: CommunicationManager( bUseMultiChannel )
-, bGracefullShutdown( sal_True )
-{
- ActiveLinks = new CommunicationLinkList;
- InactiveLinks = new CommunicationLinkList;
-}
-
-MultiCommunicationManager::~MultiCommunicationManager()
-{
- StopCommunication();
-
- if ( bGracefullShutdown ) // first try to collect all callbacks for closing channels
- {
- Timer aTimeout;
- aTimeout.SetTimeout( 40000 );
- aTimeout.Start();
- sal_uInt16 nLinkCount = 0;
- sal_uInt16 nNewLinkCount = 0;
- while ( aTimeout.IsActive() )
- {
- GetpApp()->Yield();
- nNewLinkCount = GetCommunicationLinkCount();
- if ( nNewLinkCount == 0 )
- aTimeout.Stop();
- if ( nNewLinkCount != nLinkCount )
- {
- aTimeout.Start();
- nLinkCount = nNewLinkCount;
- }
- }
- }
-
-
- sal_uInt16 i = ActiveLinks->Count();
- while ( i-- )
- {
- CommunicationLinkRef rTempLink = ActiveLinks->GetObject( i );
- ActiveLinks->Remove( i );
- rTempLink->InvalidateManager();
- rTempLink->ReleaseReference();
- }
- delete ActiveLinks;
-
-
- i = InactiveLinks->Count();
- while ( i-- )
- {
- CommunicationLinkRef rTempLink = InactiveLinks->GetObject( i );
- InactiveLinks->Remove( i );
- rTempLink->InvalidateManager();
- }
- delete InactiveLinks;
-}
-
-sal_Bool MultiCommunicationManager::StopCommunication()
-{
-
- sal_uInt16 i = ActiveLinks->Count();
- int nFail = 0;
- while ( i )
- {
- if ( !ActiveLinks->GetObject(i-1)->StopCommunication() )
- nFail++;
- i--;
- }
-
- return nFail == 0;
-}
-
-sal_Bool MultiCommunicationManager::IsLinkValid( CommunicationLink* pCL )
-{
- if ( ActiveLinks->Seek_Entry( pCL ) )
- return sal_True;
- else
- return sal_False;
-}
-
-sal_uInt16 MultiCommunicationManager::GetCommunicationLinkCount()
-{
- return ActiveLinks->Count();
-}
-
-CommunicationLinkRef MultiCommunicationManager::GetCommunicationLink( sal_uInt16 nNr )
-{
- return ActiveLinks->GetObject( nNr );
-}
-
-void MultiCommunicationManager::CallConnectionOpened( CommunicationLink* pCL )
-{
- CommunicationLinkRef rHold(pCL);
- ActiveLinks->C40_PTR_INSERT(CommunicationLink, pCL);
- rHold->AddRef();
-
- CommunicationManager::CallConnectionOpened( pCL );
-}
-
-void MultiCommunicationManager::CallConnectionClosed( CommunicationLink* pCL )
-{
- CommunicationLinkRef rHold(pCL);
-
- CommunicationManager::CallConnectionClosed( pCL );
-
- sal_uInt16 nPos;
- if ( ActiveLinks->Seek_Entry( pCL, &nPos ) )
- {
- InactiveLinks->C40_PTR_INSERT(CommunicationLink, pCL); // without reference
- ActiveLinks->Remove( nPos );
- }
- pCL->ReleaseReference();
-
- bIsCommunicationRunning = ActiveLinks->Count() > 0;
-// delete pCL;
-#if OSL_DEBUG_LEVEL > 1
- rHold->bFlag = sal_True;
-#endif
-}
-
-void MultiCommunicationManager::DestroyingLink( CommunicationLink *pCL )
-{
- sal_uInt16 nPos;
- if ( InactiveLinks->Seek_Entry( pCL, &nPos ) )
- InactiveLinks->Remove( nPos );
- pCL->InvalidateManager();
-}
-
-
-
-CommunicationManagerClient::CommunicationManagerClient( sal_Bool bUseMultiChannel )
-: MultiCommunicationManager( bUseMultiChannel )
-{
- ByteString aApplication("Something inside ");
- aApplication.Append( rtl::OUStringToOString( DirEntry( Application::GetAppFileName() ).GetName(), osl_getThreadTextEncoding() ) );
- SetApplication( aApplication );
-}
-
-
-
-CommunicationManagerServerViaSocket::CommunicationManagerServerViaSocket( sal_uLong nPort, sal_uInt16 nMaxCon, sal_Bool bUseMultiChannel )
-: CommunicationManagerServer( bUseMultiChannel )
-, nPortToListen( nPort )
-, nMaxConnections( nMaxCon )
-, pAcceptThread( NULL )
-{
-}
-
-CommunicationManagerServerViaSocket::~CommunicationManagerServerViaSocket()
-{
- StopCommunication();
-}
-
-sal_Bool CommunicationManagerServerViaSocket::StartCommunication()
-{
- if ( !pAcceptThread )
- pAcceptThread = new CommunicationManagerServerAcceptThread( this, nPortToListen, nMaxConnections );
- return sal_True;
-}
-
-
-sal_Bool CommunicationManagerServerViaSocket::StopCommunication()
-{
- delete pAcceptThread;
- pAcceptThread = NULL;
-
- return CommunicationManagerServer::StopCommunication();
-}
-
-
-void CommunicationManagerServerViaSocket::AddConnection( CommunicationLink *pNewConnection )
-{
- CallConnectionOpened( pNewConnection );
-}
-
-
-CommunicationManagerServerAcceptThread::CommunicationManagerServerAcceptThread( CommunicationManagerServerViaSocket* pServer, sal_uLong nPort, sal_uInt16 nMaxCon )
-: pMyServer( pServer )
-, pAcceptorSocket( NULL )
-, nPortToListen( nPort )
-, nMaxConnections( nMaxCon )
-, nAddConnectionEventId( 0 )
-, xmNewConnection( NULL )
-{
- if ( !pMPostUserEvent )
- pMPostUserEvent = new osl::Mutex;
- create();
-}
-
-
-CommunicationManagerServerAcceptThread::~CommunicationManagerServerAcceptThread()
-{
-#ifndef aUNX // because the accept can't be canceled - this way the prog's terminated at leastW
- // #62855# pl: counts for other unix systems too
- // correct solution would be of course to write something on the pipe which
- // the thread recognizes as a cancelling condition
- // or at least kill instead of join
- terminate();
- if ( pAcceptorSocket )
- pAcceptorSocket->close();
-
- join();
-
- if ( pAcceptorSocket )
- {
- delete pAcceptorSocket;
- pAcceptorSocket = NULL;
- }
-#else
- DEBUGPRINTF ("Destructor CommunicationManagerServerAcceptThread �bersprungen!!!! (wegen Solaris BUG)\n");
-#endif
- {
- osl::MutexGuard aGuard( aMAddConnection );
- if ( nAddConnectionEventId )
- {
- GetpApp()->RemoveUserEvent( nAddConnectionEventId );
- nAddConnectionEventId = 0;
- CommunicationLinkRef xNewConnection = GetNewConnection();
- INFO_MSG( CByteString("Event gel�scht"),
- CByteString( "AddConnectionEvent aus Queue gel�scht"),
- CM_MISC, xNewConnection );
- xNewConnection->InvalidateManager();
- xNewConnection.Clear();
- }
- }
-}
-
-void CommunicationManagerServerAcceptThread::run()
-{
- if ( !nPortToListen )
- return;
-
- pAcceptorSocket = new osl::AcceptorSocket();
- osl::SocketAddr Addr;
- Addr.setPort( nPortToListen );
- pAcceptorSocket->setOption( osl_Socket_OptionReuseAddr, 1 );
- if ( !pAcceptorSocket->bind( Addr ) )
- {
- return;
- }
- if ( !pAcceptorSocket->listen( nMaxConnections ) )
- {
- return;
- }
-
-
- osl::StreamSocket* pStreamSocket = NULL;
-
- while ( schedule() )
- {
- pStreamSocket = new osl::StreamSocket;
- switch ( pAcceptorSocket->acceptConnection( *pStreamSocket ) )
- {
- case osl_Socket_Ok:
- {
- pStreamSocket->setOption( osl_Socket_OptionTcpNoDelay, 1 );
-
- TimeValue sNochEins = {0, 100};
- while ( schedule() && xmNewConnection.Is() )
- wait( sNochEins );
- xmNewConnection = new CommunicationLinkViaSocket( pMyServer, pStreamSocket );
- xmNewConnection->StartCallback();
- {
- osl::MutexGuard aGuard( aMAddConnection );
- osl::MutexGuard aGuard2( *pMPostUserEvent );
- nAddConnectionEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationManagerServerAcceptThread, AddConnection ) );
- }
- }
- break;
- case osl_Socket_TimedOut:
- delete pStreamSocket;
- pStreamSocket = NULL;
- break;
- case osl_Socket_Error:
- delete pStreamSocket;
- pStreamSocket = NULL;
- break;
-
- case osl_Socket_Interrupted:
- case osl_Socket_InProgress:
- default:
- break;
- }
- }
-}
-
-
-IMPL_LINK( CommunicationManagerServerAcceptThread, AddConnection, void*, EMPTYARG )
-{
- {
- osl::MutexGuard aGuard( aMAddConnection );
- nAddConnectionEventId = 0;
- }
- pMyServer->AddConnection( xmNewConnection );
- xmNewConnection.Clear();
- return 1;
-}
-
-CommunicationManagerClientViaSocket::CommunicationManagerClientViaSocket( sal_Bool bUseMultiChannel )
-: CommunicationManagerClient( bUseMultiChannel )
-, aHostToTalk( "" )
-, nPortToTalk( 0 )
-{
-}
-
-CommunicationManagerClientViaSocket::~CommunicationManagerClientViaSocket()
-{
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/inc/cmdbasestream.hxx b/automation/source/inc/cmdbasestream.hxx
deleted file mode 100644
index 296be50fbb21..000000000000
--- a/automation/source/inc/cmdbasestream.hxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/*************************************************************************
- *
- * ATTENTION
- * This file is intended to work inside and outside the StarOffice environment.
- * Only adaption of file commtypes.hxx should be necessary. Else it is a bug!
- *
- ************************************************************************/
-
-#ifndef _CMDBASESTREAM_HXX_
-#define _CMDBASESTREAM_HXX_
-
-#include "automation/stsdllapi.h"
-
-#include <automation/commtypes.hxx>
-#include "icommstream.hxx"
-
-class STS_DLLPUBLIC CmdBaseStream
-{
-protected:
- ICommStream* pCommStream;
- CmdBaseStream();
- virtual ~CmdBaseStream();
-
-public:
-
- void GenError( rtl::OString *pUId, comm_String *pString );
-
- void GenReturn( comm_UINT16 nRet, comm_UINT32 nNr );
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr );
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_String *pString );
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_BOOL bBool );
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr, comm_String *pString, comm_BOOL bBool );
-
- void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT32 nNr );
- void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_String *pString );
- void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_BOOL bBool );
- void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT16 nNr );
-
-// MacroRecorder
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod ); // also used outside MacroRecorder
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString );
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString, comm_BOOL bBool );
- void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_UINT32 nNr );
-
- void Read ( comm_UINT16 &nNr );
- void Read ( comm_UINT32 &nNr );
- void Read (comm_UniChar* &aString, comm_UINT16 &nLenInChars );
- void Read ( comm_BOOL &bBool );
- comm_UINT16 GetNextType();
-
- void Write( comm_UINT16 nNr );
- void Write( comm_UINT32 nNr );
- void Write( const comm_UniChar* aString, comm_UINT16 nLenInChars );
- void Write( comm_BOOL bBool );
-
-// Complex Datatypes to be handled system dependent
- virtual void Read ( comm_String *&pString );
- virtual void Read ( rtl::OString* &pId );
-
- virtual void Write( comm_String *pString );
- virtual void Write( rtl::OString* pId );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/inc/icommstream.hxx b/automation/source/inc/icommstream.hxx
deleted file mode 100644
index 864293b7e38d..000000000000
--- a/automation/source/inc/icommstream.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/*************************************************************************
- *
- * ATTENTION
- * This file is intended to work inside and outside the StarOffice environment.
- * Only adaption of file commtypes.hxx should be necessary. Else it is a bug!
- *
- ************************************************************************/
-
-#ifndef _AUTOMATION_ICOMMSTREAM_HXX_
-#define _AUTOMATION_ICOMMSTREAM_HXX_
-
-#include <automation/commtypes.hxx>
-
-class ICommStream
-{
-public:
-
- ICommStream(){}
- virtual ~ICommStream(){}
-
- virtual ICommStream& operator>>( comm_UINT16& rUShort )=0;
- virtual ICommStream& operator>>( comm_UINT32& rULong )=0;
- virtual ICommStream& operator>>( comm_BOOL& rChar )=0;
-
- virtual ICommStream& operator<<( comm_UINT16 nUShort )=0;
- virtual ICommStream& operator<<( comm_UINT32 nULong )=0;
- virtual ICommStream& operator<<( comm_BOOL nChar )=0;
-
- virtual comm_UINT32 Read( void* pData, comm_UINT32 nSize )=0;
- virtual comm_UINT32 Write( const void* pData, comm_UINT32 nSize )=0;
-
- virtual comm_BOOL IsEof() const=0;
- virtual comm_UINT32 SeekRel( long nPos )=0;
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/inc/ittresid.hxx b/automation/source/inc/ittresid.hxx
deleted file mode 100644
index 1a1e321e3f0f..000000000000
--- a/automation/source/inc/ittresid.hxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _ITTRESID_HXX_
-#define _ITTRESID_HXX_
-
-#include <tools/resmgr.hxx>
-#include <tools/resid.hxx>
-
-class IttResId : public ResId
-{
- static ResMgr* getIttResMgr();
- public:
- IttResId( sal_uInt32 nId ) : ResId( nId, *getIttResMgr() ) {}
-};
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/inc/rcontrol.hxx b/automation/source/inc/rcontrol.hxx
deleted file mode 100644
index 7e240c8caacf..000000000000
--- a/automation/source/inc/rcontrol.hxx
+++ /dev/null
@@ -1,471 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/*************************************************************************
- *
- * ATTENTION
- * This file is intended to work inside and outside the StarOffice environment.
- * Only adaption of file commtypes.hxx should be necessary. Else it is a bug!
- *
- ************************************************************************/
-
-#ifndef _RCONTROL_HXX
-#define _RCONTROL_HXX
-
-#define UID_ACTIVE "UID_ACTIVE"
-
-#define SI_IPCCommandBlock 1
-#define SI_SocketCommandBlock SI_IPCCommandBlock
-#define SI_DirectCommandBlock 2
-#define SIControl 3 // remove after numeric HelpIDs are completely removed and no legacy testtool is used anymore
-#define SISlot 4
-#define SIFlow 5
-#define SICommand 6
-#define SIUnoSlot 7
-#define SIStringControl 8
-
-#define SIReturnBlock 11
-#define SIReturn 12
-#define SIReturnError 13
-
-// Typisierung im Stream
-#define BinUINT16 11
-#define BinUINT32 14
-#define BinString 12
-#define BinBool 13
-#define BinSbxValue 15
-
-// Classes
-// !!!These defines may never be changed!!!
-#define C_NoType -1
-// maximum of 32 easy controls
-#define C_TabControl 0
-#define C_RadioButton 1
-#define C_CheckBox 2
-#define C_TriStateBox 3
-#define C_Edit 4
-#define C_MultiLineEdit 5
-#define C_MultiListBox 6
-#define C_ListBox 7
-#define C_ComboBox 8
-#define C_PushButton 9
-
-#define C_SpinField 10
-#define C_PatternField 11
-#define C_NumericField 12
-#define C_MetricField 13
-#define C_CurrencyField 14
-#define C_DateField 15
-#define C_TimeField 16
-
-#define C_ImageRadioButton 17
-#define C_NumericBox 18
-#define C_MetricBox 19
-#define C_CurrencyBox 20
-#define C_DateBox 21
-#define C_TimeBox 22
-
-#define C_ImageButton 23
-#define C_MenuButton 24
-#define C_MoreButton 25
-
-// maximum of 7 containers
-#define C_TabPage 32
-#define C_ModalDlg 33
-#define C_FloatWin 34
-#define C_ModelessDlg 35
-#define C_WorkWin 36
-#define C_DockingWin 37
-
-// These defines may be changed
-#define C_MessBox 40
-#define C_InfoBox 41
-#define C_WarningBox 42
-#define C_ErrorBox 43
-#define C_QueryBox 44
-
-#define C_TabDlg 45
-#define C_SingleTabDlg 46
-
-#define C_Window 47
-
-#define C_PatternBox 60
-#define C_ToolBox 61
-#define C_ValueSet 62
-#define C_Control 63
-#define C_TreeListBox 64 // Hurray the TreeListBox finally got its own Window Type
-
-#define C_OkButton 65
-#define C_CancelButton 66
-#define C_ButtonDialog 67
-
-#define C_Dialog 68
-
-#define M_WITH_RETURN 0x0200 // the variable is saved until it gets its value
-#define M_KEY_STRING 0x0400 // key orders are converted i.e. "<return><up>"
-#define M_SOFFICE 0x0800 // Command valid for Star/Open Office
-#define M_MOZILLA 0x1000 // Command valid for Mozilla
-// for MacroRecorder
-#define M_RET_NUM_CONTROL 0x2000 // decode ULong as Control (For Tabpages, Toolboxes, ... )
-
-// Methoden
-#define M_Select 21
-#define M_SetNoSelection 22
-#define M_SetText 23
-#define M_More 24
-#define M_Less 25
-#define M_ToMin 26
-#define M_ToMax 27
-#define M_Check 28
-#define M_UnCheck 29
-#define M_TriState 30
-#define M_SetPage 31
-#define M_Click 32
-
-#define M_Close 33 // Push Buttons on Dialog (also More Button)
-#define M_Cancel 34
-#define M_OK 35
-#define M_Help 36
-#define M_Default 37 // Push defaultbutton on Dialog
-
-#define M_Yes 38
-#define M_No 39
-#define M_Repeat 40
-
-#define M_Open 41
-#define M_Pick 42
-#define M_Move 43
-#define M_Size 44
-#define M_Minimize 45
-#define M_Maximize 46
-#define M_Dock 47
-#define M_Undock 48
-
-#define M_TypeKeys ( M_KEY_STRING | 50 )
-#define M_MouseDown 51
-#define M_MouseUp 52
-#define M_MouseMove 53
-#define M_MouseDoubleClick 54
-#define M_SnapShot 55
-#define M_SetNextToolBox 56
-#define M_OpenContextMenu 57
-#define M_MultiSelect 58
-
-// Filedialog
-#define M_SetPath 60
-#define M_SetCurFilter 61
-
-// Printdialog
-#define M_SetPrinter 70
-#define M_CheckRange 71
-#define M_SetRangeText 72
-#define M_SetFirstPage 73
-#define M_SetLastPage 74
-#define M_CheckCollate 75
-#define M_SetPageId 76
-#define M_SetPageNr 77
-
-#define M_AnimateMouse 78
-#define M_TearOff 79
-
-#define M_FadeIn 80
-#define M_FadeOut 81
-#define M_Pin 82
-
-#define M_UseMenu 83 // Use the menu of the next possible parent of given Window
-#define M_OpenMenu 84 // MenuButtons and Menus in ToolBoxes
-
-#define M_Restore 85 // Window Control together with M_Maximize and M_Minimize
-
-#define M_DisplayPercent 200
-
-#define M_LAST_NO_RETURN 200
-
-#if ( M_LAST_NO_RETURN >= M_WITH_RETURN )
-#error "Bereich �berschritten"
-#endif
-
-#define M_Exists ( M_WITH_RETURN | 1 )
-#define M_NotExists ( M_WITH_RETURN | 2 )
-#define M_IsEnabled ( M_WITH_RETURN | 3 )
-#define M_IsVisible ( M_WITH_RETURN | 4 )
-#define M_IsWritable ( M_WITH_RETURN | 5 )
-
-#define M_GetPage ( M_WITH_RETURN | 6 )
-#define M_IsChecked ( M_WITH_RETURN | 7 )
-#define M_IsTristate ( M_WITH_RETURN | 8 )
-#define M_GetState ( M_WITH_RETURN | 9 )
-#define M_GetText ( M_WITH_RETURN | 10 )
-#define M_GetSelCount ( M_WITH_RETURN | 11 )
-#define M_GetSelIndex ( M_WITH_RETURN | 12 )
-#define M_GetSelText ( M_WITH_RETURN | 13 )
-#define M_GetItemCount ( M_WITH_RETURN | 14 )
-#define M_GetItemText ( M_WITH_RETURN | 15 )
-#define M_IsOpen ( M_WITH_RETURN | 16 )
-#define M_Caption ( M_WITH_RETURN | 17 )
-#define M_IsMax ( M_WITH_RETURN | 18 )
-#define M_IsDocked ( M_WITH_RETURN | 19 )
-#define M_GetRT ( M_WITH_RETURN | 20 )
-#define M_GetPageId ( M_WITH_RETURN | 21 )
-#define M_GetPageCount ( M_WITH_RETURN | 22 )
-#define M_GetPosX ( M_WITH_RETURN | 23 )
-#define M_GetPosY ( M_WITH_RETURN | 24 )
-#define M_GetSizeX ( M_WITH_RETURN | 25 )
-#define M_GetSizeY ( M_WITH_RETURN | 26 )
-#define M_GetNextToolBox ( M_WITH_RETURN | 27 )
-#define M_GetButtonCount ( M_WITH_RETURN | 28 )
-#define M_GetButtonId ( M_WITH_RETURN | 29 )
-
-#define M_IsFadeIn ( M_WITH_RETURN | 30 )
-#define M_IsPin ( M_WITH_RETURN | 31 )
-
-// Statusbar
-#define M_StatusGetText ( M_WITH_RETURN | 32 )
-#define M_StatusIsProgress ( M_WITH_RETURN | 33 )
-#define M_StatusGetItemCount ( M_WITH_RETURN | 34 )
-#define M_StatusGetItemId ( M_WITH_RETURN | 35 )
-
-#define M_GetMouseStyle ( M_WITH_RETURN | 36 )
-
-// support for Messagebox with checkbox
-#define M_GetCheckBoxText ( M_WITH_RETURN | 37 )
-
-// Scrollbars
-#define M_HasScrollBar ( M_WITH_RETURN | 38 )
-#define M_IsScrollBarEnabled ( M_WITH_RETURN | 39 )
-
-// This command is only used in the internal controller (sts library). They don't appear in the testtool!
-#define _M_IsEnabled ( M_WITH_RETURN | 50 )
-
-#define M_GetFixedTextCount ( M_WITH_RETURN | 51 )
-#define M_GetFixedText ( M_WITH_RETURN | 52 )
-
-#define M_IsMin ( M_WITH_RETURN | 53 )
-#define M_IsRestore ( M_WITH_RETURN | 54 )
-
-#define M_GetItemType ( M_WITH_RETURN | 55 )
-
-// Commands for (Edit)BrowseBox
-#define M_GetColumnCount ( M_WITH_RETURN | 56 )
-#define M_GetRowCount ( M_WITH_RETURN | 57 )
-#define M_IsEditing ( M_WITH_RETURN | 58 )
-
-#define M_IsItemEnabled ( M_WITH_RETURN | 59 )
-
-//#define M_SOFFICE 0x0800 // Command valid for Star/Open Office
-//#define M_MOZILLA 0x1000 // Command valid for Mozilla
-
-// RemoteCommands
-#define RC_AppAbort ( M_SOFFICE | M_MOZILLA | 1 )
-#define RC_SetClipboard ( M_SOFFICE | M_MOZILLA | 2 )
-#define RC_NoDebug ( M_SOFFICE | M_MOZILLA | 3 )
-#define RC_Debug ( M_SOFFICE | M_MOZILLA | 4 )
-#define RC_GPF ( M_SOFFICE | M_MOZILLA | 5 )
-#define RC_DisplayHid ( M_SOFFICE | M_MOZILLA | 6 )
-#define RC_AppDelay ( M_SOFFICE | M_MOZILLA | 7 )
-#define RC_UseBindings ( M_SOFFICE | 8 )
-#define RC_Profile ( M_SOFFICE | M_MOZILLA | 9 )
-// (Popup)Menu
-#define RC_MenuSelect ( M_SOFFICE | M_MOZILLA | 10 )
-#define RC_SetControlType ( M_SOFFICE | 11 ) // deprecated since RTTI
-// RemoteFileAccess
-#define RC_Kill ( M_SOFFICE | 12 )
-#define RC_RmDir ( M_SOFFICE | 13 )
-#define RC_MkDir ( M_SOFFICE | 14 )
-#define RC_FileCopy ( M_SOFFICE | 15 )
-#define RC_Name ( M_SOFFICE | 16 )
-
-#define RC_CaptureAssertions (M_SOFFICE | M_MOZILLA | 17 )
-#define RC_Assert ( M_SOFFICE | M_MOZILLA | 18 )
-#define RC_MenuOpen ( M_SOFFICE | M_MOZILLA | 19 )
-#define RC_TypeKeysDelay ( M_SOFFICE | M_MOZILLA | 20 )
-#define RC_ShowBar ( M_MOZILLA | 21 )
-#define RC_LoadURL ( M_MOZILLA | 22 )
-#define RC_CloseSysDialog ( M_SOFFICE | 23 )
-#define RC_SAXRelease ( M_SOFFICE | 24 )
-#define RC_RecordMacro ( M_SOFFICE | 25 )
-#define RC_ActivateDocument ( M_SOFFICE | 26 )
-#define RC_CatchGPF ( M_SOFFICE | 27 )
-
-#define _RC_LAST_NO_RETURN 27
-
-#if ( _RC_LAST_NO_RETURN >= M_WITH_RETURN )
-#error "Bereich �berschritten"
-#endif
-
-// commands with return value
-#define RC_GetClipboard ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 1 )
-#define RC_WinTree ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 2 )
-#define RC_ResetApplication ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 3 )
-#define RC_GetNextCloseWindow ( M_SOFFICE | M_WITH_RETURN | 4 )
-#define RC_ApplicationBusy ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 5 )
-// (Popup)Menu
-#define RC_MenuGetItemCount ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 6 )
-#define RC_MenuGetItemId ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 7 )
-#define RC_MenuGetItemPos ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 8 )
-#define RC_MenuIsSeperator ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 9 )
-#define RC_MenuIsItemChecked ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 10 )
-#define RC_MenuIsItemEnabled ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 11 )
-#define RC_MenuGetItemText ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 12 )
-// RemoteFileAccess
-#define RC_Dir ( M_SOFFICE | M_WITH_RETURN | 18 )
-#define RC_FileLen ( M_SOFFICE | M_WITH_RETURN | 19 )
-#define RC_FileDateTime ( M_SOFFICE | M_WITH_RETURN | 20 )
-
-#define RC_Translate ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 21 )
-#define RC_GetMouseStyle ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 22 )
-#define RC_UnpackStorage ( M_SOFFICE | M_WITH_RETURN | 23 )
-
-#define RC_IsBarVisible ( M_MOZILLA | M_WITH_RETURN | 24 )
-
-#define RC_MenuGetItemCommand ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 25 )
-
-#define RC_ExistsSysDialog ( M_SOFFICE | M_WITH_RETURN | 26 )
-
-#define RC_SAXCheckWellformed ( M_SOFFICE | M_WITH_RETURN | 27 )
-#define RC_SAXReadFile ( M_SOFFICE | M_WITH_RETURN | 28 )
-
-#define RC_SAXGetNodeType ( M_SOFFICE | M_WITH_RETURN | 29 )
-#define RC_SAXGetElementName ( M_SOFFICE | M_WITH_RETURN | 30 )
-#define RC_SAXGetChars ( M_SOFFICE | M_WITH_RETURN | 31 )
-#define RC_SAXGetChildCount ( M_SOFFICE | M_WITH_RETURN | 32 )
-#define RC_SAXGetAttributeCount ( M_SOFFICE | M_WITH_RETURN | 33 )
-#define RC_SAXGetAttributeName ( M_SOFFICE | M_WITH_RETURN | 34 )
-#define RC_SAXGetAttributeValue ( M_SOFFICE | M_WITH_RETURN | 35 )
-#define RC_SAXSeekElement ( M_SOFFICE | M_WITH_RETURN | 36 )
-#define RC_SAXHasElement ( M_SOFFICE | M_WITH_RETURN | 37 )
-#define RC_SAXGetElementPath ( M_SOFFICE | M_WITH_RETURN | 38 )
-
-#define RC_GetDocumentCount ( M_SOFFICE | M_WITH_RETURN | 39 )
-
-#define RC_GetSystemLanguage ( M_SOFFICE | M_WITH_RETURN | 40 )
-
-#define RC_IsProduct ( M_SOFFICE | M_WITH_RETURN | 41 )
-
-#define RC_MenuHasSubMenu ( M_SOFFICE | M_WITH_RETURN | 42 )
-
-#define RC_UsePostEvents ( M_SOFFICE | M_WITH_RETURN | 43 )
-
-#define RC_WaitSlot ( M_SOFFICE | M_WITH_RETURN | 44 )
-
-// Flow Control
-#define F_EndCommandBlock 101 // initializes the reply of the status
-#define F_Sequence 102 // commits Sequence number (first in each stream)
-
-// Return codes
-#define RET_Sequence 132
-#define RET_Value 133
-#define RET_WinInfo 134
-#define RET_ProfileInfo 135
-#define RET_DirectLoging 136
-#define RET_MacroRecorder 137
-
-// Subcodes which are delivered to nUId
-// for F_ProfileInfo
-#define S_ProfileReset 201 // nNr1 = number of Borders
- // Attention!! These defines must have numbers in a row!!
-#define S_ProfileBorder1 202 // nNr1 = Border1 in ms
-#define S_ProfileBorder2 203 // nNr1 = Border2 in ms
-#define S_ProfileBorder3 204 // nNr1 = Border3 in ms
-#define S_ProfileBorder4 205 // nNr1 = Border4 in ms
- // Attention end
-#define S_ProfileTime 210 // nNr1 = remote time of the command
-#define S_ProfileDump 211 // outputs the data
-
-// for F_DirectLoging
-#define S_AssertError 220
-#define S_AssertWarning 221
-#define S_AssertTrace 222
-#define S_QAError 223
-
-// Constants which are available in VCLTestTool scripts
-
-// Different types of controls recognized via RTTI
-#define CONST_CTBrowseBox 100
-#define CONST_CTValueSet 103
-#define CONST_CTORoadmap 104
-#define CONST_CTIExtensionListBox 105
-#define CONST_CTTableControl 106
-#define CONST_CTUnknown 199
-
-// constants for the ALignment of the requested splitter
-#define CONST_ALIGN_LEFT 120
-#define CONST_ALIGN_TOP 121
-#define CONST_ALIGN_RIGHT 122
-#define CONST_ALIGN_BOTTOM 123
-
-/// What dialog to use in RC_CloseSysDialog or RC_ExistsSysDialog
-#define CONST_FilePicker 301
-#define CONST_FolderPicker 302
-
-/// NodeTypes of the SAX Parser
-#define CONST_NodeTypeCharacter 555
-#define CONST_NodeTypeElement 556
-#define CONST_NodeTypeComment 557
-
-/// ItemTypes for TreeListBox and maybe others
-#define CONST_ItemTypeText 602
-#define CONST_ItemTypeBMP 601
-#define CONST_ItemTypeCheckbox 600
-#define CONST_ItemTypeContextBMP 603
-#define CONST_ItemTypeUnknown 604
-
-/// Return values for WaitSlot
-#define CONST_WSTimeout 701
-#define CONST_WSAborted 702
-#define CONST_WSFinished 703
-
-// describes the parameter types as bitfield - always sequence!
-// as listed here
-#define PARAM_NONE 0x0000
-#define PARAM_UINT16_1 0x0001
-#define PARAM_UINT16_2 0x0002
-#define PARAM_UINT16_3 0x0100 // not in the row!!
-#define PARAM_UINT16_4 0x0200 // not in the row!!
-#define PARAM_UINT32_1 0x0004
-#define PARAM_UINT32_2 0x0008
-#define PARAM_STR_1 0x0010
-#define PARAM_STR_2 0x0020
-#define PARAM_BOOL_1 0x0040
-#define PARAM_BOOL_2 0x0080
-#define PARAM_SBXVALUE_1 0x0400 // going on with 0x0400 here!!! see above!
-
-
-//#define PARAM_STR_RAW 0x8000 // the character set of the strings is not being converted (for Fareastern)
-
-#define ERR_SEND_TIMEOUT 100
-#define ERR_EXEC_TIMEOUT 101
-#define ERR_RESTART_FAIL 102
-#define ERR_RESTART 103
-#define ERR_NO_WIN 104
-#define ERR_NO_SID 105
-#define ERR_NO_FILE 106
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/inc/svcommstream.hxx b/automation/source/inc/svcommstream.hxx
deleted file mode 100644
index 0245fb98f6b7..000000000000
--- a/automation/source/inc/svcommstream.hxx
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "automation/stsdllapi.h"
-
-#include <tools/stream.hxx>
-
-#include <automation/commtypes.hxx>
-#include "icommstream.hxx"
-
-
-class STS_DLLPUBLIC SvCommStream : public ICommStream
-{
-protected:
- SvStream* pStream;
-public:
-
- SvCommStream( SvStream* pIO );
- ~SvCommStream();
-
- ICommStream& operator>>( comm_UINT16& rUShort );
- ICommStream& operator>>( comm_UINT32& rULong );
- ICommStream& operator>>( comm_BOOL& rChar );
-
- ICommStream& operator<<( comm_UINT16 nUShort );
- ICommStream& operator<<( comm_UINT32 nULong );
- ICommStream& operator<<( comm_BOOL nChar );
-
- comm_UINT32 Read( void* pData, comm_UINT32 nSize );
- comm_UINT32 Write( const void* pData, comm_UINT32 nSize );
-
- comm_BOOL IsEof() const;
- comm_UINT32 SeekRel( long nPos );
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/inc/testapp.hxx b/automation/source/inc/testapp.hxx
deleted file mode 100644
index f77fb349516a..000000000000
--- a/automation/source/inc/testapp.hxx
+++ /dev/null
@@ -1,196 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef TESTAPP_HXX
-#define TESTAPP_HXX
-
-#include <basic/sbmod.hxx>
-#include <basic/testtool.hxx>
-
-class CommunicationLink;
-class CommunicationManagerClientViaSocketTT;
-class CNames;
-class ControlItemUId;
-class CRevNames;
-//class SbxTransportVariableRef;
-class ControlsRef;
-class CmdStream;
-class FloatingLoadConf;
-class TestToolObj;
-class ControlDef;
-
-class SbxTransportMethod;
-class Application;
-
-class SotStorage;
-
-class ImplTestToolObj;
-class MyBasic;
-
-class ErrorEntry
-{
-public:
- ErrorEntry(sal_uLong nNr, String aStr = String()) : nError(nNr),aText(aStr),nLine(0),nCol1(0),nCol2(0) {}
- ErrorEntry(sal_uLong nNr, String aStr, xub_StrLen l, xub_StrLen c1, xub_StrLen c2 )
- : nError(nNr),aText(aStr),nLine(l),nCol1(c1),nCol2(c2) {}
- sal_uLong nError;
- String aText;
- xub_StrLen nLine;
- xub_StrLen nCol1;
- xub_StrLen nCol2;
-};
-
-SV_DECL_PTRARR_DEL(CErrors, ErrorEntry*, 1, 1)
-
-struct ControlDefLoad {
- const char* Kurzname;
- sal_uLong nUId;
-};
-
-class TestToolObj: public SbxObject
-{
- friend class TTBasic;
- friend class Controls;
-public:
- TestToolObj( String aName, MyBasic* pBas ); // use paths from INI, IPC
- ~TestToolObj();
- void LoadIniFile(); // IniSetup can be changed with the ConfigDialog
- void DebugFindNoErrors( sal_Bool bDebugFindNoErrors );
-
-private:
- sal_Bool bWasPrecompilerError;
- sal_Bool CError( sal_uLong, const String&, xub_StrLen, xub_StrLen, xub_StrLen );
- void CalcPosition( String const &aSource, xub_StrLen nPos, xub_StrLen &l, xub_StrLen &c );
- xub_StrLen ImplSearch( const String &aSource, const xub_StrLen nStart, const xub_StrLen nEnd, const String &aSearch, const xub_StrLen nSearchStart = 0 );
- xub_StrLen PreCompilePart( String &aSource, xub_StrLen nStart, xub_StrLen nEnd, String aFinalErrorLabel, sal_uInt16 &nLabelCount );
- void PreCompileDispatchParts( String &aSource, String aStart, String aEnd, String aFinalLable );
-public:
- String GetRevision(String const &aSourceIn); // find Revision in the sourcecode
- String PreCompile(String const &aSourceIn); // try catch; testcase endcase ..
- sal_Bool WasPrecompilerError();
- void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
- virtual SbxVariable* Find( const String&, SbxClassType );
-// String aKeyPlusClasses; // path for keycodes & classes & res_type (from Configfile)
- DECL_LINK( ReturnResultsLink, CommunicationLink* );
- sal_Bool ReturnResults( SvStream *pIn ); // return of the reply stream over IPC or TCP/IP or directly
-
- void SetLogHdl( const Link& rLink ) { aLogHdl = rLink; }
- const Link& GetLogHdl() const { return aLogHdl; }
-
- void SetWinInfoHdl( const Link& rLink ) { aWinInfoHdl = rLink; }
- const Link& GetWinInfoHdl() const { return aWinInfoHdl; }
-
- void SetModuleWinExistsHdl( const Link& rLink ) { aModuleWinExistsHdl = rLink; }
- const Link& GetModuleWinExistsHdl() const { return aModuleWinExistsHdl; }
-
- void SetCErrorHdl( const Link& rLink ) { aCErrorHdl = rLink; }
- const Link& GetCErrorHdl() const { return aCErrorHdl; }
-
- void SetWriteStringHdl( const Link& rLink ) { aWriteStringHdl = rLink; }
- const Link& GetWriteStringHdl() const { return aWriteStringHdl; }
-
- SfxBroadcaster& GetTTBroadcaster();
-
-private:
- ImplTestToolObj *pImpl;
- static const CErrors* GetFehlerListe() { return pFehlerListe; }
- sal_Bool bUseIPC;
- Link aLogHdl;
- Link aWinInfoHdl;
- Link aModuleWinExistsHdl;
- Link aCErrorHdl;
- Link aWriteStringHdl;
- sal_Bool bReturnOK;
- CRevNames *pShortNames;
- sal_uLong nSequence;
- rtl::OString aNextReturnId;
- void ReplaceNumbers(String &aText);
-
- String aLastRecordedKontext;
-
-#define FLAT sal_True
- String ProgPath;
- String aLogFileName;
- sal_Bool IsBlock;
- sal_Bool SingleCommandBlock;
- CmdStream *In;
-
- void AddName(String &aBisher, String &aNeu ); // maybe add name with /
- void AddToListByNr( CNames *&pControls, ControlItemUId *&pNewItem );
- CNames *m_pControls;
- CNames *m_pNameKontext;
- CNames *m_pSIds;
- CNames *m_pReverseSlots;
- CNames *m_pReverseControls;
- CNames *m_pReverseControlsSon;
- CNames *m_pReverseUIds;
-
-
- sal_uInt16 nMyVar;
-
- void InitTestToolObj();
- CommunicationManagerClientViaSocketTT *pCommunicationManager;
- void SendViaSocket();
-
- sal_Bool Load( String aFileName, SbModule *pMod );
-
- void ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, sal_Bool bIsFlat = sal_False );
- void ReadFlat( String Filename, CNames *&pNames, sal_Bool bSortByName );
- sal_Bool ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pControls );
- sal_Bool WriteNamesBin( String Filename, CNames *pSIds, CNames *pControls );
- void ReadHidLstByNumber();
- void SortControlsByNumber( sal_Bool bIncludeActive = sal_False );
-
- String GetMethodName( sal_uLong nMethodId );
- String GetKeyName( sal_uInt16 nKeyCode );
-
- void WaitForAnswer ();
- DECL_LINK( IdleHdl, Application* );
- DECL_LINK( CallDialogHandler, Application* );
- String aDialogHandlerName;
- sal_uInt16 nWindowHandlerCallLevel;
-
- sal_uInt16 nIdleCount;
- // If DialogHandler has been reset it is incremented in the IdleHandler and
- // is reset in WaitForAnswer. If it exceed a certain value, I expect WaitFor Answer to
- // stand still and call the DialogHander Sub in BASIC.
-
- void BeginBlock();
- void EndBlock();
-
- SbTextType GetSymbolType( const String &rSymbol, sal_Bool bWasControl );
- static ControlDefLoad const arR_Cmds[];
- static CNames *pRCommands;
-
- static CErrors *pFehlerListe; // the errors from the testtool are stored here
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/inc/testtool.hxx b/automation/source/inc/testtool.hxx
deleted file mode 100644
index 30543fcedeb5..000000000000
--- a/automation/source/inc/testtool.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef SVTOOLS_TESTTOOL_HXX
-#define SVTOOLS_TESTTOOL_HXX
-
-#include <tools/solar.h>
-#include <tools/link.hxx>
-#include <vcl/timer.hxx>
-
-class Application;
-class SvStream;
-
-class StatementFlow;
-class CommunicationManager;
-class CommunicationLink;
-#if OSL_DEBUG_LEVEL > 1
-class EditWindow;
-#endif
-class ImplRC;
-
-class ImplRemoteControl
-{
- friend class StatementFlow;
-
- sal_Bool m_bIdleInserted;
- AutoTimer m_aIdleTimer;
- sal_Bool m_bInsideExecutionLoop;
-#if OSL_DEBUG_LEVEL > 1
- EditWindow *m_pDbgWin;
-#endif
-
-public:
- ImplRemoteControl();
- ~ImplRemoteControl();
- sal_Bool QueCommands( sal_uLong nServiceId, SvStream *pIn );
- SvStream* GetReturnStream();
-
- DECL_LINK( IdleHdl, Application* );
- DECL_LINK( CommandHdl, Application* );
-
- DECL_LINK( QueCommandsEvent, CommunicationLink* );
-
-protected:
- CommunicationManager *pServiceMgr;
- SvStream *pRetStream;
-};
-
-#endif // SVTOOLS_TESTTOOL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/editwin.cxx b/automation/source/miniapp/editwin.cxx
deleted file mode 100644
index 1e810f5a31ce..000000000000
--- a/automation/source/miniapp/editwin.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "editwin.hxx"
-#include <tools/stream.hxx>
-#include <vcl/msgbox.hxx>
-
-
-sal_Bool GHEditWindow::Close()
-{
- if (aInhalt.IsModified())
- {
- }
- delete(this);
- return sal_True;
-}
-
-void GHEditWindow::Resize()
-{
- aInhalt.SetPosSizePixel(Point(1,1),GetOutputSizePixel());
-}
-
-GHEditWindow::GHEditWindow(Window * pParent, String aName, WinBits iWstyle)
-: FloatingWindow(pParent)
-, aInhalt(this,iWstyle)
-{
- SetOutputSizePixel( Size( 120,80 ) );
- Show();
- Resize();
- aInhalt.Show();
- SetText(aName);
-}
-
-void GHEditWindow::AddText( String aNew, sal_Bool bMoveToEnd)
-{
- String aOld = aInhalt.GetText();
-
- aOld += aNew;
- aOld.ConvertLineEnd();
- aInhalt.SetText(aOld);
- if (bMoveToEnd)
- aInhalt.SetSelection(Selection(SELECTION_MAX,SELECTION_MAX));
-}
-
-
-EditFileWindow::EditFileWindow(Window * pParent, String aName, WinBits iWstyle)
-: GHEditWindow(pParent, aName, iWstyle)
-, aFileName(aName)
-{
- LoadFile();
-}
-
-void EditFileWindow::LoadFile()
-{
-
- SvFileStream Stream;
- String All,Line;
-
- Stream.Open(aFileName, STREAM_STD_READ);
-
- if (!Stream.IsOpen())
- {
- AddText(CUniString("could not open ").Append(aFileName).AppendAscii("\n"));
- aFileName.Erase();
- return;
- }
-
- while (!Stream.IsEof())
- {
-
- Stream.ReadByteStringLine( Line, RTL_TEXTENCODING_UTF8 );
-
- All += Line;
- All += '\n';
-
- }
-
- All.ConvertLineEnd();
-
- AddText(All,sal_False);
-
-}
-
-sal_Bool EditFileWindow::Close()
-{
-
- if (aInhalt.IsModified() && QueryBox(this,WB_DEF_YES | WB_YES_NO_CANCEL, String(aFileName).AppendAscii("\nhas been changed.\n\nSave file?")).Execute())
- {
-
- }
- return GHEditWindow::Close();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/editwin.hxx b/automation/source/miniapp/editwin.hxx
deleted file mode 100644
index 3181efaefea3..000000000000
--- a/automation/source/miniapp/editwin.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _editwin
-#define _editwin
-
-#include <basic/ttstrhlp.hxx>
-#include <vcl/floatwin.hxx>
-#include <svtools/svmedit.hxx>
-
-class GHEditWindow : public FloatingWindow
-{
-
-protected:
-
- MultiLineEdit aInhalt;
-
- virtual sal_Bool Close(); // derived
- void Resize();
-
-public:
-
- GHEditWindow();
- GHEditWindow(Window * pParent, String aName = CUniString("Neues Fenster"), WinBits iWstyle = WB_STDWORK);
-
- void AddText( String aNew, sal_Bool bMoveToEnd = sal_True);
-};
-
-
-
-class EditFileWindow : public GHEditWindow
-{
-
- String aFileName;
- virtual sal_Bool Close(); // derived
- void LoadFile();
-
-public:
- EditFileWindow(Window * pParent, String aName = CUniString("Neue Datei"), WinBits iWstyle = WB_STDWORK);
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/hid.lst b/automation/source/miniapp/hid.lst
deleted file mode 100644
index 99964dba02e8..000000000000
--- a/automation/source/miniapp/hid.lst
+++ /dev/null
@@ -1,27 +0,0 @@
-MENU_CLIENT 256
-IDM_FILE 1
-IDM_FILE_OPEN_TEST 2
-IDM_FILE_EXIT 3
-IDM_FILE_EXIT_HELP 0
-IDM_FILE_OPEN_TEST_HELP 1
-IDM_FILE_HELP 3
-GROSSER_TEST_DLG 256
-IDM_TEST 5
-IDM_TEST_GROSS 6
-IDM_SYS_DLG 7
-IDM_TEST_WINTREE 8
-
-
-
-UID_GROSSER_TEST_DLG 101
-UID_CheckBox 202
-UID_TriStateBox 303
-UID_OKButton 404
-UID_TimeField 505
-UID_MultiLineEdit 606
-UID_RadioButton1 707
-UID_RadioButton2 708
-UID_MultiListBox 809
-UID_ComboBox 910
-UID_DateBox 1011
-
diff --git a/automation/source/miniapp/servres.cxx b/automation/source/miniapp/servres.cxx
deleted file mode 100644
index 8ef241083734..000000000000
--- a/automation/source/miniapp/servres.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <string.h>
-
-#include "servres.hrc"
-#include "servuid.hxx"
-#include "servres.hxx"
-
-
-ModalDialogGROSSER_TEST_DLG::ModalDialogGROSSER_TEST_DLG( Window * pParent, const ResId & rResId, sal_Bool bFreeRes )
- : ModalDialog( pParent, rResId ),
- aCheckBox1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aTriStateBox1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aOKButton1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aTimeField1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aMultiLineEdit1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aGroupBox1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aRadioButton1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aRadioButton2( this, ResId( 2, *rResId.GetResMgr() ) ),
- aMultiListBox1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aComboBox1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aDateBox1( this, ResId( 1, *rResId.GetResMgr() ) ),
- aFixedText1( this, ResId( 1, *rResId.GetResMgr() ) )
-{
- if( bFreeRes ) FreeResource();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/servres.hrc b/automation/source/miniapp/servres.hrc
deleted file mode 100644
index 6efd2ce57460..000000000000
--- a/automation/source/miniapp/servres.hrc
+++ /dev/null
@@ -1,40 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-/* StarView ressource header file */
-#define MENU_CLIENT 256
-#define IDM_FILE 1
-#define IDM_FILE_OPEN_TEST 2
-#define IDM_FILE_EXIT 3
-#define IDM_FILE_EXIT_HELP "AUTOMATION_IDM_FILE_EXIT_HELP"
-#define IDM_FILE_OPEN_TEST_HELP "AUTOMATION_IDM_FILE_OPEN_TEST_HELP"
-#define IDM_FILE_HELP "AUTOMATION_IDM_FILE_HELP"
-#define GROSSER_TEST_DLG 256
-#define IDM_TEST 5
-#define IDM_TEST_GROSS 6
-#define IDM_SYS_DLG 7
-#define IDM_TEST_WINTREE 8
-
diff --git a/automation/source/miniapp/servres.hxx b/automation/source/miniapp/servres.hxx
deleted file mode 100644
index 2b0459585ea2..000000000000
--- a/automation/source/miniapp/servres.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include <svtools/svmedit.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/field.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/group.hxx>
-#include <vcl/combobox.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/lstbox.hxx>
-
-class ModalDialogGROSSER_TEST_DLG : public ModalDialog
-{
-protected:
- CheckBox aCheckBox1;
- TriStateBox aTriStateBox1;
- OKButton aOKButton1;
- TimeField aTimeField1;
- MultiLineEdit aMultiLineEdit1;
- GroupBox aGroupBox1;
- RadioButton aRadioButton1;
- RadioButton aRadioButton2;
- MultiListBox aMultiListBox1;
- ComboBox aComboBox1;
- DateBox aDateBox1;
- FixedText aFixedText1;
-public:
- ModalDialogGROSSER_TEST_DLG( Window * pParent, const ResId & rResId, sal_Bool bFreeRes = sal_True );
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/servres.src b/automation/source/miniapp/servres.src
deleted file mode 100644
index c1af1caa775a..000000000000
--- a/automation/source/miniapp/servres.src
+++ /dev/null
@@ -1,233 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include "servres.hrc"
-#include "servuid.hxx"
-ModalDialog GROSSER_TEST_DLG
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- HelpID = UID_GROSSER_TEST_DLG ;
- Pos = MAP_APPFONT ( 14 , 7 ) ;
- Size = MAP_APPFONT ( 273 , 110 ) ;
- Text = "Großer Testdialog" ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- CheckBox 1
- {
- HelpID = UID_CheckBox ;
- Pos = MAP_APPFONT ( 9 , 17 ) ;
- Size = MAP_APPFONT ( 55 , 12 ) ;
- Text = "CheckBox" ;
- TabStop = TRUE ;
- };
- TriStateBox 1
- {
- HelpID = UID_TriStateBox ;
- Pos = MAP_APPFONT ( 9 , 29 ) ;
- Size = MAP_APPFONT ( 62 , 12 ) ;
- Text = "TriStateBox" ;
- TabStop = TRUE ;
- };
- OKButton 1
- {
- HelpID = "hid1" ;
- Pos = MAP_APPFONT ( 132 , 92 ) ;
- Size = MAP_APPFONT ( 64 , 12 ) ;
- TabStop = TRUE ;
- };
- TimeField 1
- {
- Border = TRUE ;
- HelpID = UID_TimeField ;
- Pos = MAP_APPFONT ( 9 , 92 ) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
- TabStop = TRUE ;
- Spin = TRUE ;
- };
- MultiLineEdit 1
- {
- Border = TRUE ;
- HelpID = UID_MultiLineEdit ;
- Pos = MAP_APPFONT ( 172 , 6 ) ;
- Size = MAP_APPFONT ( 94 , 48 ) ;
- Text = "MultiLineEdit" ;
- TabStop = TRUE ;
- VScroll = TRUE ;
- };
- GroupBox 1
- {
- Pos = MAP_APPFONT ( 9 , 42 ) ;
- Size = MAP_APPFONT ( 58 , 44 ) ;
- Text = "GroupBox" ;
- Group = TRUE ;
- };
- RadioButton 2
- {
- HelpID = UID_RadioButton2 ;
- Pos = MAP_APPFONT ( 16 , 68 ) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
- Text = "Radio2" ;
- TabStop = TRUE ;
- };
- RadioButton 1
- {
- HelpID = UID_RadioButton1 ;
- Pos = MAP_APPFONT ( 16 , 54 ) ;
- Size = MAP_APPFONT ( 42 , 12 ) ;
- Text = "Radio1" ;
- TabStop = TRUE ;
- };
- MultiListBox 1
- {
- Border = TRUE ;
- HelpID = UID_MultiListBox ;
- Pos = MAP_APPFONT ( 76 , 6 ) ;
- Size = MAP_APPFONT ( 86 , 48 ) ;
- TabStop = TRUE ;
- StringList =
- {
- < "MultiListBox" ; Default ; > ;
- < "Zeile 2" ; Default ; > ;
- < "Zeile 3" ; Default ; > ;
- < "Zeile 4" ; Default ; > ;
- < "Zeile 5" ; Default ; > ;
- < "Zeile 6" ; Default ; > ;
- < "Zeile 7" ; Default ; > ;
- < "Zeile 8" ; Default ; > ;
- < "Zeile 9" ; Default ; > ;
- < "Zeile 10" ; Default ; > ;
- };
- };
- ComboBox 1
- {
- HelpID = UID_ComboBox ;
- Pos = MAP_APPFONT ( 76 , 58 ) ;
- Size = MAP_APPFONT ( 86 , 55 ) ;
- Text = "ComboBox" ;
- TabStop = TRUE ;
- DropDown = TRUE ;
- AutoHScroll = TRUE ;
- StringList =
- {
- "ComboBox" ;
- "Erster" ;
- "Zweiter" ;
- "Dritter" ;
- };
- };
- DateBox 1
- {
- HelpID = UID_DateBox ;
- Pos = MAP_APPFONT ( 76 , 72 ) ;
- Size = MAP_APPFONT ( 86 , 54 ) ;
- TabStop = TRUE ;
- DropDown = TRUE ;
- AutoHScroll = TRUE ;
- StringList =
- {
- "1.1.91" ;
- "2.2.92" ;
- "3.3.93" ;
- };
- };
- FixedText 1
- {
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 19 , 6 ) ;
- Size = MAP_APPFONT ( 39 , 9 ) ;
- Text = "FixedText" ;
- Center = TRUE ;
- };
- CancelButton 1
- {
- Pos = MAP_APPFONT ( 202 , 92 ) ;
- Size = MAP_APPFONT ( 64 , 12 ) ;
- TabStop = TRUE ;
- };
-};
-Menu MENU_CLIENT
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = IDM_FILE ;
- HelpID = IDM_FILE_HELP ;
- Text = "~File" ;
- SubMenu = Menu
- {
- ItemList =
- {
- MenuItem
- {
- Identifier = IDM_FILE_OPEN_TEST ;
- HelpID = IDM_FILE_OPEN_TEST_HELP ;
- Text = "~Open Test Window" ;
- };
- MenuItem
- {
- Identifier = 4 ;
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = IDM_FILE_EXIT ;
- HelpID = IDM_FILE_EXIT_HELP ;
- Text = "~Beenden" ;
- AccelKey = KeyCode
- {
- Code = KEY_F4 ;
- Modifier2 = TRUE ;
- };
- };
- };
- };
- };
- MenuItem
- {
- Identifier = IDM_TEST ;
- Text = "~Test" ;
- SubMenu = Menu
- {
- ItemList =
- {
- MenuItem
- {
- Identifier = IDM_TEST_GROSS ;
- Text = "~Großer Testdialog" ;
- };
- MenuItem
- {
- Identifier = IDM_SYS_DLG ;
- Text = "~Sysdialoge" ;
- };
- };
- };
- };
- };
-};
-
diff --git a/automation/source/miniapp/servuid.hxx b/automation/source/miniapp/servuid.hxx
deleted file mode 100644
index 019479cc65a3..000000000000
--- a/automation/source/miniapp/servuid.hxx
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#define UID_GROSSER_TEST_DLG "AUTOMATION_UID_GROSSER_TEST_DLG"
-#define UID_CheckBox "AUTOMATION_UID_CheckBox"
-#define UID_TriStateBox "AUTOMATION_UID_TriStateBox"
-#define UID_OKButton "AUTOMATION_UID_OKButton"
-#define UID_TimeField "AUTOMATION_UID_TimeField"
-#define UID_MultiLineEdit "AUTOMATION_UID_MultiLineEdit"
-#define UID_RadioButton1 "AUTOMATION_UID_RadioButton1"
-#define UID_RadioButton2 "AUTOMATION_UID_RadioButton2"
-#define UID_MultiListBox "AUTOMATION_UID_MultiListBox"
-#define UID_ComboBox "AUTOMATION_UID_ComboBox"
-#define UID_DateBox "AUTOMATION_UID_DateBox"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/test.bas b/automation/source/miniapp/test.bas
deleted file mode 100644
index 6d00e892fcb3..000000000000
--- a/automation/source/miniapp/test.bas
+++ /dev/null
@@ -1,126 +0,0 @@
-'encoding UTF-8 Do not remove or change this line!
-sub main
-' cMassentest
-' DisplayHid
- cTestdialog
- cSysDlgTest
- cFileOpenTest
- SidWintree
-
- FileExit
-end sub
-
-testcase cMassentest
-
-DisplayHid
-resetapplication
-FileDialog
-kontext "GrosserTestDlg"
-dim c,t,lang,i
-c = 0
-lang = "0123456789abcdef"
-lang = lang + lang
-lang = lang + lang
-lang = lang + lang
-lang = lang + lang
-lang = lang + lang
-lang = lang + lang
-
-lang = lang + lang
-lang = lang + lang
-nodebug
-while 1
- c = c + 1
- t = str(c)
- MultiLineEdit.SetText t
- CheckBox.check lang
- CheckBox.uncheck lang
- for i = 1 to 200 : next
- beep
-wend
-
-endcase
-
-
-testcase cFileOpenTest
-
- FileOpenTest
- setclipboard wintree
- kontext
- active.cancel
-
-endcase
-
-
-testcase cSysDlgTest
-
- SysDialogs
- setclipboard wintree
- kontext
- active.yes
- setclipboard wintree
- active.ok
- active.Cancel
-
- SysDialogs
- active.Cancel
- active.ok
-
-endcase
-
-testcase cTestdialog
-
- FileDialog
-
- kontext "GrosserTestDlg"
- CheckBox.uncheck
- TriStateBox.tristate
- 'OKButton
-' TimeField.settext("fhsdjk")
- MultiLineEdit.SetText "Das war der Text: '"+MultiLineEdit.GetText+"'"
- RadioButton1.check
- RadioButton2.check
-' MultiListBox.select 2
- ComboBox.select("Dritter")
- DateBox.select("1.1.91")
-
- GrosserTestDlg.ok
-
-endcase
-
-
-sub LoadIncludeFiles
-
- start "miniapp.exe", "-enableautomation"
-
- use "test.win"
- use "test.sid"
-
- testexit
-
-end sub
-
-sub testenter
-end sub
-
-sub testexit
-
- dim xx
- xx = resetapplication
- if xx > "" then warnlog xx
-
-end sub
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/automation/source/miniapp/test.sid b/automation/source/miniapp/test.sid
deleted file mode 100644
index 3af8966aa06b..000000000000
--- a/automation/source/miniapp/test.sid
+++ /dev/null
@@ -1,5 +0,0 @@
-FileOpenTest IDM_FILE_OPEN_TEST
-FileExit IDM_FILE_EXIT
-FileDialog IDM_TEST_GROSS
-SidWintree IDM_TEST_WINTREE
-SysDialogs IDM_SYS_DLG
diff --git a/automation/source/miniapp/test.win b/automation/source/miniapp/test.win
deleted file mode 100644
index 224ca5ad2d44..000000000000
--- a/automation/source/miniapp/test.win
+++ /dev/null
@@ -1,13 +0,0 @@
-*active
-*GrosserTestDlg UID_GROSSER_TEST_DLG
-CheckBox UID_CheckBox
-TriStateBox UID_TriStateBox
-OKButton UID_OKButton
-TimeField UID_TimeField
-MultiLineEdit UID_MultiLineEdit
-RadioButton1 UID_RadioButton1
-RadioButton2 UID_RadioButton2
-MultiListBox UID_MultiListBox
-ComboBox UID_ComboBox
-DateBox UID_DateBox
-
diff --git a/automation/source/miniapp/testapp.cxx b/automation/source/miniapp/testapp.cxx
deleted file mode 100644
index 5ee27cb815a0..000000000000
--- a/automation/source/miniapp/testapp.cxx
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <svtools/filedlg.hxx>
-#include <stdio.h>
-#include <vcl/msgbox.hxx>
-#include <tools/debug.hxx>
-#include <svtools/testtool.hxx>
-#include <svtools/ttprops.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <osl/process.h>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/configurationkeys.hxx>
-#include <comphelper/regpathhelper.hxx>
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <com/sun/star/registry/XImplementationRegistration.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
-
-#include "servres.hrc"
-#include "servres.hxx"
-#include "testapp.hxx"
-
-using namespace comphelper;
-using namespace cppu;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::registry;
-using namespace com::sun::star::ucb;
-
-using ::rtl::OUString;
-
-static ResMgr* pAppMgr = NULL;
-
-MainWindow::MainWindow(MyApp *pAppl)
-: WorkWindow(NULL, WB_STDWORK)
-, pApp(pAppl)
-{}
-
-IMPL_LINK(MainWindow,MenuSelectHdl,MenuBar*,aMenu)
-{
-
- return pApp->GetDispatcher()->ExecuteFunction(aMenu->GetCurItemId());
-
-}
-
-void MainWindow::FileOpen()
-{
- FileDialog Dlg(this, 0);
-
- Dlg.AddFilter(CUniString("Alle Dateien"), CUniString("*.*"));
- Dlg.SetCurFilter (CUniString("*.*"));
-
- if (Dlg.Execute() == RET_OK)
- {
- new EditFileWindow(this,Dlg.GetPath());
- }
-}
-
-
-void MainWindow::TestGross()
-{
- ModalDialogGROSSER_TEST_DLG Dlg(this,ResId(GROSSER_TEST_DLG, *pAppMgr));
-
- if (Dlg.Execute() == RET_OK)
- {
- }
-}
-
-
-sal_Bool MainWindow::Close()
-{
- WorkWindow::Close();
- FileExit();
- return sal_True;
-}
-
-void MainWindow::FileExit()
-{
- pApp->Quit();
-}
-
-
-void MainWindow::Tree(GHEditWindow *aEditWin, Window *pBase, sal_uInt16 Indent)
-{
- String sIndent,aText;
- sIndent.Expand(5*Indent);
-
- aText = pBase->GetText();
- aText.SearchAndReplaceAllAscii("\n",CUniString("\\n"));
-
- aEditWin->AddText(String(sIndent).AppendAscii("Text: ").Append(aText).AppendAscii("\n"));
- // FIXME: HELPID
- aEditWin->AddText(String(sIndent).AppendAscii("Help: ").Append(String(rtl::OStringToOUString(pBase->GetHelpId(), RTL_TEXTENCODING_UTF8))).AppendAscii(":").Append(pBase->GetQuickHelpText()).AppendAscii(":").Append(pBase->GetHelpText()).AppendAscii("\n"));
-
- sal_uInt16 i;
- for (i = 0 ; i < pBase->GetChildCount() ; i++)
- {
- Tree(aEditWin,pBase->GetChild(i),Indent+1);
- }
-}
-
-void MainWindow::WinTree()
-{
-
- GHEditWindow * aEditWin = new GHEditWindow(this,CUniString("Window Tree"));
- Tree(aEditWin,this,0);
-
-}
-
-void MainWindow::SysDlg()
-{
- switch (QueryBox(this,WB_YES_NO_CANCEL | WB_DEF_YES, CUniString("Want to open another Dialog?")).Execute())
- {
- case RET_YES:
- while ( WarningBox(this,WB_OK_CANCEL | WB_DEF_OK,CUniString("Well this is the last box now!")).Execute() == RET_OK ) ;
- break;
- case RET_NO:
- break;
- case RET_CANCEL:InfoBox(this,CUniString("Oh well..")).Execute();
- break;
- }
-
-}
-
-MyApp aApp;
-
-MyApp::MyApp()
-{
- pMainWin = NULL;
- pMyDispatcher = NULL;
-}
-
-void MyApp::Property( ApplicationProperty& rProp )
-{
- TTProperties* pTTProperties = PTR_CAST( TTProperties, &rProp );
- if ( pTTProperties )
- {
- pTTProperties->nPropertyVersion = TT_PROPERTIES_VERSION;
- switch ( pTTProperties->nActualPR )
- {
- case TT_PR_DISPATCHER:
- {
- PlugInDispatcher* pDispatcher = GetDispatcher();
- if ( !pDispatcher )
- pTTProperties->nActualPR = TT_PR_ERR_NODISPATCHER;
- else
- {
- pDispatcher->SetExecuteMode(EXECUTEMODE_DIALOGASYNCHRON);
- if ( pDispatcher->ExecuteFunction(
- pTTProperties->mnSID, pTTProperties->mppArgs, pTTProperties->mnMode )
- == EXECUTE_NO )
- pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE;
- else
- pTTProperties->nActualPR = 0;
- }
- }
- break;
- default:
- {
- pTTProperties->nPropertyVersion = 0;
- }
- }
- return;
- }
-}
-
-
-sal_uInt16 MyDispatcher::ExecuteFunction( sal_uInt16 nSID, SfxPoolItem** ppArgs, sal_uInt16 nMode)
-{
- (void) ppArgs; // avoid warning about unused parameter
- (void) nMode; // avoid warning about unused parameter
-
- switch (nSID)
- {
- case IDM_FILE_EXIT: pMainWin->FileExit(); break;
- case IDM_FILE_OPEN_TEST: pMainWin->FileOpen(); break;
- case IDM_TEST_GROSS: pMainWin->TestGross(); break;
- case IDM_TEST_WINTREE: pMainWin->WinTree(); break;
- case IDM_SYS_DLG: pMainWin->SysDlg(); break;
- default:
- {
- OSL_TRACE("Dispatcher kennt Funktion nicht %s", rtl::OString::valueOf(static_cast<sal_Int64>(nSID)).getStr());
- return EXECUTE_NO;
- }
-
- }
- return EXECUTE_YES;
-}
-
-PlugInDispatcher* MyApp::GetDispatcher()
-{
- return pMyDispatcher;
-}
-
-Reference< XContentProviderManager > InitializeUCB( void )
-{
- OUString path;
- if( osl_Process_E_None != osl_getExecutableFile( (rtl_uString**)&path ) )
- {
- InfoBox( NULL, String::CreateFromAscii( "Couldn't retrieve directory of executable" ) ).Execute();
- exit( 1 );
- }
- OSL_ASSERT( path.lastIndexOf( '/' ) >= 0 );
-
-
- ::rtl::OUStringBuffer bufServices( path.copy( 0, path.lastIndexOf( '/' )+1 ) );
- bufServices.appendAscii("services.rdb");
- OUString services = bufServices.makeStringAndClear();
-
- ::rtl::OUStringBuffer bufTypes( path.copy( 0, path.lastIndexOf( '/' )+1 ) );
- bufTypes.appendAscii("types.rdb");
- OUString types = bufTypes.makeStringAndClear();
-
-
- Reference< XMultiServiceFactory > xSMgr;
- try
- {
- xSMgr = createRegistryServiceFactory( types, services, sal_True );
- }
- catch( com::sun::star::uno::Exception & exc )
- {
- fprintf( stderr, "Couldn't bootstrap uno servicemanager for reason : %s\n" ,
- OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
- InfoBox( NULL, String( exc.Message ) ).Execute();
- throw ;
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // set global factory
- setProcessServiceFactory( xSMgr );
-
-// Create unconfigured Ucb:
- Sequence< Any > aArgs;
- ucbhelper::ContentBroker::initialize( xSMgr, aArgs );
- Reference< XContentProviderManager > xUcb =
- ucbhelper::ContentBroker::get()->getContentProviderManagerInterface();
-
- Reference< XContentProvider > xFileProvider
- ( xSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.FileContentProvider" )) ), UNO_QUERY );
- xUcb->registerContentProvider( xFileProvider, OUString( RTL_CONSTASCII_USTRINGPARAM( "file" )), sal_True );
-
- return xUcb;
-}
-
-int MyApp::Main()
-{
- Reference< XContentProviderManager > xUcb = InitializeUCB();
- LanguageType aRequestedLanguage;
- aRequestedLanguage = LanguageType( LANGUAGE_GERMAN );
-
- AllSettings aSettings = GetSettings();
- aSettings.SetUILanguage( aRequestedLanguage );
- aSettings.SetLanguage( aRequestedLanguage );
- SetSettings( aSettings );
- pAppMgr = CREATEVERSIONRESMGR( tma );
-
- MainWindow MainWin(this);
- pMainWin = &MainWin;
-
- MenuBar aMenu(ResId(MENU_CLIENT,*pAppMgr));
- MainWin.SetMenuBar( &aMenu );
- aMenu.GetPopupMenu( IDM_FILE )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl));
- aMenu.GetPopupMenu( IDM_TEST )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl));
-
- MyDispatcher MyDsp(pMainWin);
- pMyDispatcher = &MyDsp;
-
- MainWin.SetText(CUniString("Star Division Test Tool Client Window"));
- MainWin.Show();
-
- RemoteControl aRC;
-
- Execute();
- return EXIT_SUCCESS;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/miniapp/testapp.hxx b/automation/source/miniapp/testapp.hxx
deleted file mode 100644
index 883ccaf04088..000000000000
--- a/automation/source/miniapp/testapp.hxx
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _TESTAPP_HXX
-#define _TESTAPP_HXX
-
-#include <vcl/svapp.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/field.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/group.hxx>
-#include <vcl/combobox.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/wrkwin.hxx>
-#include <svl/poolitem.hxx>
-
-
-#include "editwin.hxx"
-
-
-#define EXECUTE_NO 0
-#define EXECUTE_POSSIBLE 1
-#define EXECUTE_YES 2
-#define EXECUTEMODE_ASYNCHRON 1
-#define EXECUTEMODE_DIALOGASYNCHRON 2
-
-
-class MyApp;
-class MainWindow : public WorkWindow
-{
- MyApp *pApp;
-
-public:
- MainWindow(MyApp *pAppl);
- virtual sal_Bool Close(); // derived
-
- void FileExit();
- void FileOpen();
- void TestGross();
- void Tree(GHEditWindow *aEditWin, Window *pBase, sal_uInt16 Indent);
- void WinTree();
- void SysDlg();
- DECL_LINK(MenuSelectHdl,MenuBar*);
-
-};
-#define PlugInDispatcher MyDispatcher
-class MyDispatcher
-{
- MainWindow *pMainWin;
-
-public:
- MyDispatcher(MainWindow *MainWin) : pMainWin(MainWin) {};
- virtual ~MyDispatcher() {};
- virtual sal_uInt16 ExecuteFunction( sal_uInt16 nSID, SfxPoolItem** ppArgs = 0, sal_uInt16 nMode = 0);
- virtual void SetExecuteMode( sal_uInt16 nMode )
- {
- (void) nMode; /* avoid warning about unused parameter */
- };
-};
-
-class MyApp : public Application
-{
- Timer aCommandTimer;
- PlugInDispatcher *pMyDispatcher;
-
-public:
- MyApp();
- int Main();
-
- virtual void Property( ApplicationProperty& );
- virtual PlugInDispatcher* GetDispatcher();
-
- MainWindow *pMainWin;
-};
-
-// -----------------------------------------------------------------------
-
-extern MyApp aApp;
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/XMLParser.cxx b/automation/source/server/XMLParser.cxx
deleted file mode 100644
index 308f7c4c56d0..000000000000
--- a/automation/source/server/XMLParser.cxx
+++ /dev/null
@@ -1,687 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <tools/stream.hxx>
-#include "statemnt.hxx"
-#include "rcontrol.hxx"
-#include "retstrm.hxx"
-#include <basic/svtmsg.hrc>
-
-#include <basic/ttstrhlp.hxx>
-
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/SAXException.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/util/XCloneable.hpp>
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/xml/sax/SAXParseException.hpp>
-
-using namespace com::sun::star::xml::sax;
-using namespace com::sun::star::io;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::util;
-
-using ::rtl::OUString;
-
-class SVInputStream : public cppu::WeakImplHelper1< XInputStream >
-{
- SvStream* pStream;
-public:
- SVInputStream( SvStream* pSt ):pStream( pSt ){};
- ~SVInputStream(){ delete pStream; pStream=NULL; }
-
- // Methods XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-};
-
-
-sal_Int32 SAL_CALL SVInputStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- aData.realloc( nBytesToRead );
- sal_Int32 nRead = pStream->Read( aData.getArray(), nBytesToRead );
- aData.realloc( nRead );
- return nRead;
-}
-
-sal_Int32 SAL_CALL SVInputStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- return readBytes( aData, nMaxBytesToRead );
-}
-
-void SAL_CALL SVInputStream::skipBytes( sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- if ( nBytesToSkip > 0 )
- pStream->SeekRel( nBytesToSkip );
-}
-
-sal_Int32 SAL_CALL SVInputStream::available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
- sal_uLong nCurrent = pStream->Tell();
- sal_uLong nSize = pStream->Seek( STREAM_SEEK_TO_END );
- sal_uLong nAvailable = nSize - nCurrent;
- pStream->Seek( nCurrent );
- return nAvailable;
-}
-
-void SAL_CALL SVInputStream::closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
-{
-// pStream->Close(); // automatically done in destructor
- delete pStream;
- pStream = NULL;
-}
-
-class Node;
-SV_DECL_REF(Node)
-
-enum NodeType { NODE_CHARACTER = CONST_NodeTypeCharacter,
- NODE_ELEMENT = CONST_NodeTypeElement,
- NODE_COMMENT = CONST_NodeTypeComment };
-
-class Node : public SvRefBase
-{
- NodeType aNodeType;
- Node* pParent; // Use pointer to prevent cyclic references resulting in undeleted objects
-
-protected:
- Node( NodeType aType ): aNodeType( aType ), pParent( NULL ){};
- virtual ~Node();
-
-public:
- NodeType GetNodeType() { return aNodeType; }
- void SetParent( NodeRef xNewParent );
- NodeRef GetParent();
-};
-
-SV_IMPL_REF(Node)
-// generate NodeRefMemberList
-SV_DECL_IMPL_REF_LIST( NodeRef, Node* )
-
-Node::~Node()
-{
-}
-
-void Node::SetParent( NodeRef xNewParent )
-{
- pParent = &xNewParent;
-}
-
-NodeRef Node::GetParent()
-{
- return NodeRef( pParent );
-}
-
-class CharacterNode : public Node
-{
- String aCharacters;
-public:
- CharacterNode( const String& aChars ): Node( NODE_CHARACTER ), aCharacters( aChars ){};
-
- String GetCharacters() { return aCharacters; }
-};
-
-class ElementNode : public Node
-{
- String aNodeName;
- Reference < XAttributeList > xAttributeList;
- NodeRefMemberList aDocumentNodeList;
-public:
- ElementNode( const String& aName, Reference < XAttributeList > xAttributes );
- void AppendNode( NodeRef xNewNode );
- sal_uLong GetChildCount(){ return aDocumentNodeList.Count(); }
- NodeRef GetChild( sal_uInt16 nIndex ){ return aDocumentNodeList.GetObject( nIndex ); }
- Reference < XAttributeList > GetAttributes(){ return xAttributeList; }
-
- String GetNodeName() { return aNodeName; }
-};
-
-ElementNode::ElementNode( const String& aName, Reference < XAttributeList > xAttributes )
-: Node( NODE_ELEMENT )
-, aNodeName( aName )
-{
- if ( xAttributes.is() )
- {
- Reference < XCloneable > xAttributeCloner( xAttributes, UNO_QUERY );
- if ( xAttributeCloner.is() )
- xAttributeList = Reference < XAttributeList > ( xAttributeCloner->createClone() , UNO_QUERY );
- else
- {
- OSL_FAIL("Unable to clone AttributeList");
- }
- }
-};
-
-void ElementNode::AppendNode( NodeRef xNewNode )
-{
- aDocumentNodeList.Insert ( xNewNode, LIST_APPEND );
- xNewNode->SetParent( this );
-}
-
-// XIndexAccess
-
-
-
-
-
-enum ParseAction { COLLECT_DATA, COLLECT_DATA_IGNORE_WHITESPACE, PARSE_ONLY };
-
-class SAXParser : public cppu::WeakImplHelper2< XErrorHandler, XDocumentHandler >
-{
- String aFilename;
- Reference < XParser > xParser;
-
- // XErrorHandler
- void AddToList( const sal_Char* cuType, const ::com::sun::star::uno::Any& aSAXParseException );
- String aErrors;
-
- NodeRef xTreeRoot;
- NodeRef xCurrentNode;
- sal_uLong nTimestamp;
- ParseAction aAction;
-
-public:
- SAXParser( const String &rFilename );
- ~SAXParser();
-
- // Access Methods
- NodeRef GetCurrentNode(){ return xCurrentNode; }
- void SetCurrentNode( NodeRef xCurrent ){ xCurrentNode = xCurrent; }
- NodeRef GetRootNode(){ return xTreeRoot; }
- sal_uLong GetTimestamp(){ return nTimestamp; }
- void Touch(){ nTimestamp = Time::GetSystemTicks(); }
-
- // Methods SAXParser
- sal_Bool Parse( ParseAction aAct );
- String GetErrors(){ return aErrors; }
-
- // Methods XErrorHandler
- virtual void SAL_CALL error( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL fatalError( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL warning( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-
- // Methods XDocumentHandler
- virtual void SAL_CALL startDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-};
-
-
-SAXParser::SAXParser( const String &rFilename )
-: aFilename( rFilename )
-{
- Touch();
-}
-
-SAXParser::~SAXParser()
-{
- xParser.clear();
-}
-
-sal_Bool SAXParser::Parse( ParseAction aAct )
-{
- aAction = aAct;
- Touch();
- SvStream* pStream = new SvFileStream( aFilename, STREAM_STD_READ );
- if ( pStream->GetError() )
- return sal_False;
-
- InputSource sSource;
- sSource.aInputStream = new SVInputStream( pStream ); // is refcounted and hence deletet appropriately
- sSource.sPublicId = OUString( aFilename );
-
- xParser = Reference < XParser > ( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.xml.sax.Parser") ), UNO_QUERY );
- if ( xParser.is() )
- {
- xParser->setErrorHandler( ( XErrorHandler*) this );
- if ( aAction == COLLECT_DATA || aAction == COLLECT_DATA_IGNORE_WHITESPACE )
- xParser->setDocumentHandler( ( XDocumentHandler*) this );
-
- try
- {
- xParser->parseStream ( sSource );
- }
- catch( class SAXParseException & )
- {
- // TODO
- }
- catch( class Exception & )
- {
- // TODO
- }
- xParser->setErrorHandler( NULL ); // otherwile Object holds itself
- if ( aAction == COLLECT_DATA || aAction == COLLECT_DATA_IGNORE_WHITESPACE )
- xParser->setDocumentHandler( NULL ); // otherwile Object holds itself
- }
- else
- return sal_False;
- return sal_True;
-}
-
-
-// Helper Methods XErrorHandler
-void SAXParser::AddToList( const sal_Char* cuType, const ::com::sun::star::uno::Any& aSAXParseException )
-{
- SAXParseException aException;
- aSAXParseException >>= aException;
-
- aErrors.Append( String( aException.PublicId ) );
- aErrors.AppendAscii( "(" );
- aErrors.Append( String::CreateFromInt64( aException.LineNumber ) );
- aErrors.AppendAscii( ":" );
- aErrors.Append( String::CreateFromInt64( aException.ColumnNumber ) );
- aErrors.AppendAscii( ") : " );
- aErrors.AppendAscii( cuType );
- aErrors.AppendAscii( ": " );
- aErrors.Append( String( aException.Message ) );
- aErrors.AppendAscii( "\n" );
-}
-
-// Methods XErrorHandler
-void SAL_CALL SAXParser::error( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- AddToList( "error", aSAXParseException );
-}
-
-void SAL_CALL SAXParser::fatalError( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- AddToList( "fatal error", aSAXParseException );
-}
-
-void SAL_CALL SAXParser::warning( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- AddToList( "warning", aSAXParseException );
-}
-
-
-// Methods XDocumentHandler
-void SAXParser::startDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- xTreeRoot = new ElementNode( CUniString("/"), Reference < XAttributeList > (NULL) );
- xCurrentNode = xTreeRoot;
- Touch();
-}
-
-void SAXParser::endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
-}
-
-void SAXParser::startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- NodeRef xNewNode = new ElementNode ( String(aName), xAttribs );
- ((ElementNode*)(&xCurrentNode))->AppendNode( xNewNode );
- xCurrentNode = xNewNode;
-}
-
-void SAXParser::endElement( const ::rtl::OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- (void) aName; /* avoid warning about unused parameter */
- xCurrentNode = xCurrentNode->GetParent();
-}
-
-void SAXParser::characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- if ( aAction == COLLECT_DATA_IGNORE_WHITESPACE )
- { // check for whitespace
- sal_Bool bAllWhitespace = sal_True;
- for ( int i = 0 ; bAllWhitespace && i < aChars.getLength() ; i++ )
- if ( aChars[i] != 10 // LF
- && aChars[i] != 13 // CR
- && aChars[i] != ' ' // Blank
- && aChars[i] != '\t' ) // Tab
- bAllWhitespace = sal_False;
- if ( bAllWhitespace )
- return;
- }
- NodeRef xNewNode = new CharacterNode ( String(aChars) );
- ((ElementNode*)(&xCurrentNode))->AppendNode( xNewNode );
-}
-
-void SAXParser::ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- (void) aWhitespaces; /* avoid warning about unused parameter */
-}
-
-void SAXParser::processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- (void) aTarget; /* avoid warning about unused parameter */
- (void) aData; /* avoid warning about unused parameter */
-}
-
-void SAXParser::setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
-{
- (void) xLocator; /* avoid warning about unused parameter */
-#if OSL_DEBUG_LEVEL > 1
- ::rtl::OUString aTester;
- aTester = xLocator->getPublicId();
- aTester = xLocator->getSystemId();
-#endif
-}
-
-
-
-
-void StatementCommand::HandleSAXParser()
-{
- static Reference < XReference > xParserKeepaliveReference; // this is to keep the Object alive only
- static SAXParser* pSAXParser;
-
- // We need spechial prerequisites for these!
-
- ElementNode* pElementNode = NULL;
- switch ( nMethodId )
- {
- case RC_SAXGetNodeType:
- case RC_SAXGetAttributeCount:
- case RC_SAXGetAttributeName:
- case RC_SAXGetAttributeValue:
- case RC_SAXGetChildCount:
- case RC_SAXGetElementName:
- case RC_SAXGetChars:
-
- case RC_SAXSeekElement:
- case RC_SAXHasElement:
- case RC_SAXGetElementPath:
- {
- if ( xParserKeepaliveReference.is() && pSAXParser->GetCurrentNode().Is() )
- {
- if ( pSAXParser->GetCurrentNode()->GetNodeType() == NODE_ELEMENT )
- {
- NodeRef xNode=pSAXParser->GetCurrentNode();
- pElementNode = (ElementNode*)(&xNode);
- }
- }
- else
- {
- ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) );
- return;
- }
-
- }
- }
-
- switch ( nMethodId )
- {
- case RC_SAXCheckWellformed:
- {
- if( (nParams & PARAM_STR_1) )
- {
- xParserKeepaliveReference.clear();
- pSAXParser = new SAXParser( aString1 );
- xParserKeepaliveReference = ( XReference* )pSAXParser;
- if ( !xParserKeepaliveReference.is() )
- ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) );
- else
- {
- if ( !pSAXParser->Parse( PARSE_ONLY ) )
- ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) );
- pRet->GenReturn ( RET_Value, nMethodId, pSAXParser->GetErrors() );
- }
-
- xParserKeepaliveReference.clear();
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
-
- case RC_SAXReadFile:
- {
- if( (nParams & PARAM_STR_1) )
- {
- ParseAction aAction;
- if( (nParams & PARAM_BOOL_1) && bBool1 )
- aAction = COLLECT_DATA;
- else
- aAction = COLLECT_DATA_IGNORE_WHITESPACE;
-
- xParserKeepaliveReference.clear();
- pSAXParser = new SAXParser( aString1 );
- xParserKeepaliveReference = ( XReference* )pSAXParser;
- if ( !xParserKeepaliveReference.is() )
- ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) );
- else
- {
-
- if ( !pSAXParser->Parse( aAction ) )
- ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) );
- pRet->GenReturn ( RET_Value, nMethodId, pSAXParser->GetErrors() );
- }
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_SAXGetNodeType:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)pSAXParser->GetCurrentNode()->GetNodeType() );
- }
- break;
- case RC_SAXGetAttributeCount:
- case RC_SAXGetAttributeName:
- case RC_SAXGetAttributeValue:
- case RC_SAXGetChildCount:
- case RC_SAXGetElementName:
- {
- if ( pElementNode )
- {
- Reference < XAttributeList > xAttributeList = pElementNode->GetAttributes();
- switch ( nMethodId )
- {
- case RC_SAXGetElementName:
- pRet->GenReturn ( RET_Value, nMethodId, pElementNode->GetNodeName() );
- break;
- case RC_SAXGetChildCount:
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)pElementNode->GetChildCount() );
- break;
- case RC_SAXGetAttributeCount:
- if ( xAttributeList.is() )
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)xAttributeList->getLength() );
- else
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)0 );
- break;
- case RC_SAXGetAttributeName:
- {
- if( (nParams & PARAM_UINT16_1) && ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, xAttributeList.is()?xAttributeList->getLength():0 ) )
- {
- String aRet( xAttributeList->getNameByIndex( nNr1-1 ) );
- pRet->GenReturn ( RET_Value, nMethodId, aRet );
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_SAXGetAttributeValue:
- // Number or String
- {
- if( (nParams & PARAM_UINT16_1) && ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, xAttributeList.is()?xAttributeList->getLength():0 ) )
- {
- String aRet( xAttributeList->getValueByIndex( nNr1-1 ) );
- pRet->GenReturn ( RET_Value, nMethodId, aRet );
- }
- else if( (nParams & PARAM_STR_1) && xAttributeList.is() )
- {
- String aRet( xAttributeList->getValueByName( aString1 ) );
- pRet->GenReturn ( RET_Value, nMethodId, aRet );
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
-
- default:
- ReportError( GEN_RES_STR1( S_INTERNAL_ERROR, RcString( nMethodId ) ) );
- }
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_SAXGetChars:
- {
- if ( pSAXParser->GetCurrentNode()->GetNodeType() == NODE_CHARACTER )
- {
- NodeRef xNode=pSAXParser->GetCurrentNode();
- CharacterNode* aCharacterNode = (CharacterNode*)(&xNode);
- pRet->GenReturn ( RET_Value, nMethodId, aCharacterNode->GetCharacters() );
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
-
- case RC_SAXSeekElement:
- case RC_SAXHasElement:
- // Number or String
- {
- sal_Bool bCheckOnly = nMethodId == RC_SAXHasElement;
-
- if( (nParams & PARAM_UINT16_1) && !(nParams & PARAM_STR_1) )
- {
- if ( nNr1 == 0 )
- {
- if ( bCheckOnly )
- pRet->GenReturn ( RET_Value, nMethodId, pSAXParser->GetCurrentNode()->GetParent().Is() );
- else if ( pSAXParser->GetCurrentNode()->GetParent().Is() )
- pSAXParser->SetCurrentNode( pSAXParser->GetCurrentNode()->GetParent() );
- }
- else if ( !pElementNode )
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- else if ( bCheckOnly )
- pRet->GenReturn ( RET_Value, nMethodId, ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, pElementNode->GetChildCount() ) );
- else if ( ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, pElementNode->GetChildCount() ) )
- pSAXParser->SetCurrentNode( pElementNode->GetChild( nNr1-1 ) );
- }
- else if( (nParams & PARAM_STR_1) )
- {
- if ( aString1.EqualsAscii( "/" ) )
- {
- if ( bCheckOnly )
- pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)sal_True );
- else
- pSAXParser->SetCurrentNode( pSAXParser->GetRootNode() );
- }
- else if ( aString1.Copy(0,2).EqualsAscii( "*:" ) )
- {
- sal_uLong nTimestamp = (sal_uLong)aString1.GetToken( 1, ':' ).ToInt64();
- sal_uLong nPointer = (sal_uLong)aString1.GetToken( 2, ':' ).ToInt64();
- if ( bCheckOnly )
- pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)(pSAXParser->GetTimestamp() == nTimestamp) );
- else
- if ( pSAXParser->GetTimestamp() == nTimestamp )
- {
- {
- Node* pNode = (Node*)nPointer;
- pSAXParser->SetCurrentNode( NodeRef( pNode ) );
- }
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- else if ( pElementNode )
- {
- sal_uInt16 nNthOccurrence;
- if( (nParams & PARAM_UINT16_1) )
- nNthOccurrence = nNr1;
- else
- nNthOccurrence = 1;
-
- sal_uInt16 i;
- NodeRef xNew;
- for ( i = 0 ; i < pElementNode->GetChildCount() && !xNew.Is() ; i++ )
- {
- xNew = pElementNode->GetChild( i );
- if ( xNew->GetNodeType() == NODE_ELEMENT )
- {
- ElementNode* pNewElement = (ElementNode*)(&xNew);
- if ( aString1.Equals( pNewElement->GetNodeName() ) )
- {
- if ( nNthOccurrence > 1 )
- {
- xNew.Clear();
- nNthOccurrence--;
- }
- }
- else
- xNew.Clear();
- }
- else
- xNew.Clear();
- }
- if ( bCheckOnly )
- pRet->GenReturn ( RET_Value, nMethodId, xNew.Is() );
- else
- if ( xNew.Is() )
- pSAXParser->SetCurrentNode( xNew );
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- else
- if ( bCheckOnly )
- pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)sal_False );
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_SAXGetElementPath:
- {
- DBG_ASSERT( sizeof( sal_uIntPtr ) == sizeof ( void* ), "Pointertype has different size than sal_uIntPtr");
- String aPath;
- aPath.AppendAscii( "*:" );
- aPath.Append( String::CreateFromInt64( pSAXParser->GetTimestamp() ) );
- aPath.AppendAscii( ":" );
- NodeRef xNode=pSAXParser->GetCurrentNode();
- Node* pNode = (Node*)(&xNode);
- aPath.Append( String::CreateFromInt64( (sal_uIntPtr)pNode ) );
- pRet->GenReturn ( RET_Value, nMethodId, aPath );
- }
- break;
-
- case RC_SAXRelease:
- {
- xParserKeepaliveReference.clear();
- }
- break;
- default:
- ReportError( GEN_RES_STR1( S_INTERNAL_ERROR, RcString( nMethodId ) ) );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/cmdbasestream.cxx b/automation/source/server/cmdbasestream.cxx
deleted file mode 100644
index 8586b4688910..000000000000
--- a/automation/source/server/cmdbasestream.cxx
+++ /dev/null
@@ -1,341 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-/*************************************************************************
- *
- * ATTENTION
- * This file is intended to work inside and outside the StarOffice environment.
- * Only adaption of file commtypes.hxx should be necessary. Else it is a bug!
- *
- ************************************************************************/
-#include <osl/endian.h>
-#include <osl/diagnose.h>
-
-#include "cmdbasestream.hxx"
-#include "rcontrol.hxx"
-
-CmdBaseStream::CmdBaseStream()
-: pCommStream( NULL )
-{
-}
-
-CmdBaseStream::~CmdBaseStream()
-{
-}
-
-void CmdBaseStream::GenError (rtl::OString *pUId, comm_String *pString )
-{
- Write(comm_UINT16(SIReturnError));
- Write(pUId);
- Write(pString);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT32 nUId )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write(nUId);
- Write(comm_UINT16(PARAM_NONE));
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
- Write(comm_UINT32(0));
- else
- Write(pUId);
- Write(comm_UINT16(PARAM_UINT32_1));
- Write(nNr);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_String *pString )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
- Write(comm_UINT32(0));
- else
- Write(pUId);
- Write(comm_UINT16(PARAM_STR_1));
- Write(pString);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_BOOL bBool )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
- Write(comm_UINT32(0));
- else
- Write(pUId);
- Write(comm_UINT16(PARAM_BOOL_1));
- Write(bBool);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr, comm_String *pString, comm_BOOL bBool )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE")))
- Write(comm_UINT32(0));
- else
- Write(pUId);
- Write(comm_UINT16(PARAM_UINT32_1|PARAM_STR_1|PARAM_BOOL_1));
- Write(nNr);
- Write(pString);
- Write(bBool);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT32 nNr )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_UINT16(PARAM_UINT32_1));
- Write(nNr);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_String *pString )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_UINT16(PARAM_STR_1));
- Write(pString);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_BOOL bBool )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_UINT16(PARAM_BOOL_1));
- Write(bBool);
-}
-
-void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT16 nNr )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(comm_UINT16(PARAM_UINT16_1));
- Write(nNr);
-}
-
-
-// MacroRecorder
-void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write(pUId);
- Write(comm_UINT16(PARAM_UINT16_1));
- Write(nMethod);
-}
-
-void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write(pUId);
- Write(comm_UINT16(PARAM_UINT16_1|PARAM_STR_1));
- Write(nMethod);
- Write(pString);
-}
-
-void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString, comm_BOOL bBool )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write(pUId);
- Write(comm_UINT16(PARAM_UINT16_1|PARAM_STR_1|PARAM_BOOL_1));
- Write(nMethod);
- Write(pString);
- Write(bBool);
-}
-
-void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_UINT32 nNr )
-{
- Write(comm_UINT16(SIReturn));
- Write(nRet);
- Write(pUId);
- Write(comm_UINT16(PARAM_UINT16_1|PARAM_UINT32_1));
- Write(nMethod);
- Write(nNr);
-}
-
-
-
-void CmdBaseStream::Read (comm_UINT16 &nNr)
-{
- comm_UINT16 nId;
- *pCommStream >> nId;
- if (pCommStream->IsEof()) return;
-#if OSL_DEBUG_LEVEL > 1
- if (nId != BinUINT16) OSL_TRACE( "Falscher Typ im Stream: Erwartet USHORT, gefunden :%hu", nId );
-#endif
- *pCommStream >> nNr;
-}
-
-void CmdBaseStream::Read (comm_UINT32 &nNr)
-{
- comm_UINT16 nId;
- *pCommStream >> nId;
- if (pCommStream->IsEof()) return;
-#if OSL_DEBUG_LEVEL > 1
- if (nId != BinUINT32) OSL_TRACE( "Falscher Typ im Stream: Erwartet ULONG, gefunden :%hu", nId );
-#endif
- *pCommStream >> nNr;
-}
-
-void CmdBaseStream::Read (comm_UniChar* &aString, comm_UINT16 &nLenInChars )
-{
- comm_UINT16 nId;
- *pCommStream >> nId;
-#if OSL_DEBUG_LEVEL > 1
- if (nId != BinString) OSL_TRACE( "Falscher Typ im Stream: Erwartet String, gefunden :%hu", nId );
-#endif
-
- *pCommStream >> nLenInChars;
-
- aString = new comm_UniChar [nLenInChars];
- pCommStream->Read( aString, ((comm_UINT32)nLenInChars) * sizeof( comm_UniChar ) );
-#ifdef OSL_BIGENDIAN
- // we have to change the byteorder
- comm_UINT16 n;
- for ( n = 0 ; n < nLenInChars ; n++ )
- aString[ n ] = aString[ n ] >> 8 | aString[ n ] << 8;
-#endif
-}
-
-void CmdBaseStream::Read (comm_BOOL &bBool)
-{
- comm_UINT16 nId;
- *pCommStream >> nId;
-#if OSL_DEBUG_LEVEL > 1
- if (nId != BinBool) OSL_TRACE( "Falscher Typ im Stream: Erwartet BOOL, gefunden :%hu", nId );
-#endif
- *pCommStream >> bBool;
-}
-
-comm_UINT16 CmdBaseStream::GetNextType()
-{
- comm_UINT16 nId;
- *pCommStream >> nId;
- pCommStream->SeekRel(-2);
- return nId;
-}
-
-
-void CmdBaseStream::Write( comm_UINT16 nNr )
-{
- *pCommStream << comm_UINT16( BinUINT16 );
- *pCommStream << nNr;
-}
-
-void CmdBaseStream::Write( comm_UINT32 nNr )
-{
- *pCommStream << comm_UINT16( BinUINT32 );
- *pCommStream << nNr;
-}
-
-void CmdBaseStream::Write( const comm_UniChar* aString, comm_UINT16 nLenInChars )
-{
- *pCommStream << comm_UINT16(BinString);
-
- comm_UINT16 n;
-
- // remove BiDi and zero-width-markers 0x200B - 0x200F
- // remove BiDi and paragraph-markers 0x2028 - 0x202E
-
- comm_UniChar* aNoBiDiString;
- aNoBiDiString = new comm_UniChar [nLenInChars];
- comm_UINT16 nNewLenInChars = 0;
- for ( n = 0 ; n < nLenInChars ; n++ )
- {
- comm_UniChar c = aString[ n ];
- if ( ((c >= 0x200B) && (c <= 0x200F))
- ||((c >= 0x2028) && (c <= 0x202E)) )
- { //Ignore character
- }
- else
- {
- aNoBiDiString[ nNewLenInChars ] = c;
- nNewLenInChars++;
- }
- }
-
- *pCommStream << nNewLenInChars;
-
-#ifdef OSL_BIGENDIAN
- // we have to change the byteorder
- comm_UniChar* aNewString;
- aNewString = new comm_UniChar [nNewLenInChars];
- for ( n = 0 ; n < nNewLenInChars ; n++ )
- aNewString[ n ] = aNoBiDiString[ n ] >> 8 | aNoBiDiString[ n ] << 8;
- pCommStream->Write( aNewString, ((comm_UINT32)nNewLenInChars) * sizeof( comm_UniChar ) );
- delete [] aNewString;
-#else
- pCommStream->Write( aNoBiDiString, ((comm_UINT32)nNewLenInChars) * sizeof( comm_UniChar ) );
-#endif
-
- delete [] aNoBiDiString;
-}
-
-void CmdBaseStream::Write( comm_BOOL bBool )
-{
- *pCommStream << comm_UINT16( BinBool );
- *pCommStream << bBool;
-}
-
-void CmdBaseStream::Read ( comm_String* &pString )
-{
- (void) pString; /* avoid warning about unused parameter */
- OSL_FAIL("Read ( comm_String* &pString ) Not Implemented");
-}
-void CmdBaseStream::Read ( rtl::OString* &pId )
-{
- (void) pId; /* avoid warning about unused parameter */
- OSL_FAIL("Read ( rtl::OString* &pId ) Not Implemented");
-}
-
-void CmdBaseStream::Write( comm_String *pString )
-{
- (void) pString; /* avoid warning about unused parameter */
- OSL_FAIL("Write( comm_String *pString ) Not Implemented");
-}
-void CmdBaseStream::Write( rtl::OString* pId )
-{
- (void) pId; /* avoid warning about unused parameter */
- OSL_FAIL("Write( rtl::OString* pId ) Not Implemented");
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/editwin.cxx b/automation/source/server/editwin.cxx
deleted file mode 100644
index b46cc8c5db9f..000000000000
--- a/automation/source/server/editwin.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#if OSL_DEBUG_LEVEL > 1
-#include <vcl/svapp.hxx>
-#include "editwin.hxx"
-
-
-class ImpWorkWindow : public WorkWindow
-{
-public:
- MultiLineEdit m_aInhalt;
- ImpWorkWindow( WorkWindow *pParent, const UniString &rName, WinBits );
- ~ImpWorkWindow();
- void Resize();
-};
-
-ImpWorkWindow::ImpWorkWindow( WorkWindow *pParent, const String &rName, WinBits iWstyle )
-: WorkWindow( pParent , WB_SIZEMOVE )
-, m_aInhalt( this, iWstyle )
-{
- m_aInhalt.Show();
- SetText(rName);
- SetPosSizePixel( Point( 1,40 ), Size(500,150) );
- Resize();
-}
-
-ImpWorkWindow::~ImpWorkWindow()
-{
- Hide();
-}
-
-void ImpWorkWindow::Resize()
-{
- m_aInhalt.SetPosSizePixel( Point(), GetOutputSizePixel() );
-}
-
-sal_Bool EditWindow::Close()
-{
- if ( pImpWorkWindow )
- {
- delete pImpWorkWindow;
- pImpWorkWindow = NULL;
- }
- return sal_True;
-}
-
-void EditWindow::Show()
-{
- if ( Check() )
- pImpWorkWindow->Show();
- else
- bShowWin = sal_True;
-}
-
-void EditWindow::Hide()
-{
- if ( Check() )
- pImpWorkWindow->Hide();
- else
- bShowWin = sal_False;
-}
-
-EditWindow::EditWindow( WorkWindow *pParent, const String &rName, WinBits iWstyle )
-: pImpWorkWindow(NULL)
-, pMemParent(pParent)
-, aMemName(rName)
-, iMemWstyle(iWstyle)
-, nTextLen(0)
-, bQuiet(sal_False)
-{
-}
-
-EditWindow::~EditWindow()
-{
- Close();
-}
-
-sal_Bool EditWindow::Check()
-{
- if ( ! pImpWorkWindow && Application::IsInExecute() )
- {
- pImpWorkWindow = new ImpWorkWindow( pMemParent, aMemName, iMemWstyle );
- pImpWorkWindow->m_aInhalt.SetText( aMemPreWinText );
- nTextLen = aMemPreWinText.Len();
- aMemPreWinText.Erase();
- if ( bShowWin )
- pImpWorkWindow->Show();
- return sal_True;
- }
- return pImpWorkWindow != NULL;
-}
-
-void EditWindow::Clear()
-{
- if ( Check() )
- {
- pImpWorkWindow->m_aInhalt.SetText( String() );
- nTextLen = 0;
- }
- aMemPreWinText.Erase();
-}
-
-void EditWindow::AddText( const sal_Char* rNew )
-{
- AddText( UniString::CreateFromAscii( rNew ) );
-}
-
-void EditWindow::AddText( const String &rNew )
-{
- if ( bQuiet ) return;
-
- String aText = rNew;
- aText.ConvertLineEnd();
-
- if ( Check() )
- {
- if ( nTextLen > 5000 )
- {
- pImpWorkWindow->m_aInhalt.SetText( pImpWorkWindow->m_aInhalt.GetText().Erase(0,1000) );
- nTextLen = pImpWorkWindow->m_aInhalt.GetText().Len();
- }
-
-
- pImpWorkWindow->m_aInhalt.SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) );
- pImpWorkWindow->m_aInhalt.ReplaceSelected( aText );
- nTextLen = nTextLen + aText.Len();
- pImpWorkWindow->m_aInhalt.SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) );
- }
- else
- {
- aMemPreWinText += aText;
- }
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/editwin.hxx b/automation/source/server/editwin.hxx
deleted file mode 100644
index b3a169fbd8fc..000000000000
--- a/automation/source/server/editwin.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _EDITWIN_HXX
-#define _EDITWIN_HXX
-
-#if OSL_DEBUG_LEVEL > 1
-
-#include <vcl/wrkwin.hxx>
-
-#include <svtools/svmedit.hxx>
-
-class ImpWorkWindow;
-
-class EditWindow
-{
-protected:
- ImpWorkWindow *pImpWorkWindow;
- sal_Bool check();
-
- WorkWindow *pMemParent;
- String aMemName;
- WinBits iMemWstyle;
-
- String aMemPreWinText;
- sal_Bool bShowWin;
-
- xub_StrLen nTextLen;
-
-public:
- EditWindow( WorkWindow *pParent, const UniString &rName = UniString( RTL_CONSTASCII_USTRINGPARAM ( "Debug" ) ), WinBits iWstyle = WB_HSCROLL | WB_VSCROLL );
- virtual ~EditWindow();
-
- void Clear();
- void Show();
- void Hide();
- void AddText( const String &rNew );
- void AddText( const sal_Char* rNew );
-
- virtual sal_Bool Close(); // derived
- sal_Bool bQuiet;
- sal_Bool Check();
-};
-
-#endif
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/prof_nul.cxx b/automation/source/server/prof_nul.cxx
deleted file mode 100644
index aa985a062473..000000000000
--- a/automation/source/server/prof_nul.cxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-
-#include "profiler.hxx"
-#include "rcontrol.hxx"
-#include <basic/ttstrhlp.hxx>
-
-struct SysdepProfileSnapshot
-{
- // fields for saving a snapshot
-};
-
-
-struct SysdepStaticData
-{
- // everything that is always needed during profiling
-};
-
-
-void TTProfiler::InitSysdepProfiler()
-{
- if ( !pSysDepStatic ) // Should always be like this!!
- pSysDepStatic = new SysdepStaticData;
- // initialize here
-
-};
-
-void TTProfiler::DeinitSysdepProfiler()
-{
- if ( pSysDepStatic ) // Should always be like this!!
- {
- // tidy up here and free storage if applicable
-
- delete pSysDepStatic;
- }
-};
-
-SysdepProfileSnapshot *TTProfiler::NewSysdepSnapshotData()
-{
- return new SysdepProfileSnapshot;
-};
-
-void TTProfiler::DeleteSysdepSnapshotData( SysdepProfileSnapshot *pSysdepProfileSnapshot )
-{
- delete pSysdepProfileSnapshot;
-};
-
-
-String TTProfiler::GetSysdepProfileHeader()
-{
- return String(CUniString("(noch) keine weiteren Daten Implementiert"));
-};
-
-
-void TTProfiler::GetSysdepProfileSnapshot( SysdepProfileSnapshot *, sal_uInt16 )
-{};
-
-
-String TTProfiler::GetSysdepProfileLine( SysdepProfileSnapshot *, SysdepProfileSnapshot * )
-{
- return String();
-};
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/prof_usl.cxx b/automation/source/server/prof_usl.cxx
deleted file mode 100644
index becf8b2925d0..000000000000
--- a/automation/source/server/prof_usl.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-
-#include <procfs.h>
-#include <tools/stream.hxx>
-#include "profiler.hxx"
-
-
-struct SysdepProfileSnapshot
-{
- pstatus mpstatus;
- psinfo mpsinfo;
- prusage mprusage;
-};
-
-
-struct SysdepStaticData
-{
- // everything that is always needed during the profile
-};
-
-
-void TTProfiler::InitSysdepProfiler()
-{
- if ( !pSysDepStatic ) // Should always be like this!!
- pSysDepStatic = new SysdepStaticData;
- // initialize here
-
-};
-
-void TTProfiler::DeinitSysdepProfiler()
-{
- if ( pSysDepStatic ) // Should always be like this!!
- {
- // tidy up here and free storage if applicable
-
- delete pSysDepStatic;
- }
-};
-
-SysdepProfileSnapshot *TTProfiler::NewSysdepSnapshotData()
-{
- return new SysdepProfileSnapshot;
-};
-
-void TTProfiler::DeleteSysdepSnapshotData( SysdepProfileSnapshot *pSysdepProfileSnapshot )
-{
- delete pSysdepProfileSnapshot;
-};
-
-
-String TTProfiler::GetSysdepProfileHeader()
-{
- return String::CreateFromAscii(" Size(Kb) ResidentSZ rtime ktime utime total");
-};
-
-
-
-void TTProfiler::GetSysdepProfileSnapshot( SysdepProfileSnapshot *pSysdepProfileSnapshot, sal_uInt16 )
-{
- SvFileStream aStream( String::CreateFromAscii("/proc/self/psinfo"), STREAM_READ ); // explicit path for UNXSOL!
- if ( aStream.IsOpen() )
- {
- aStream.Read( &(pSysdepProfileSnapshot->mpsinfo), sizeof( psinfo ) );
- aStream.Close();
- }
- SvFileStream anotherStream( String::CreateFromAscii("/proc/self/status"), STREAM_READ ); // explicit path for UNXSOL!
- if ( anotherStream.IsOpen() )
- {
- anotherStream.Read( &(pSysdepProfileSnapshot->mpstatus), sizeof( pstatus ) );
- anotherStream.Close();
- }
- SvFileStream YetAnotherStream( String::CreateFromAscii("/proc/self/usage"), STREAM_READ ); // explicit path for UNXSOL!
- if ( YetAnotherStream.IsOpen() )
- {
- YetAnotherStream.Read( &(pSysdepProfileSnapshot->mprusage), sizeof( prusage ) );
- YetAnotherStream.Close();
- }
-};
-
-#define DIFF2( aFirst, aSecond, Membername ) ( aSecond.Membername - aFirst.Membername )
-#define CALC_MS( nSec, nNSec ) ( nSec * 1000 + (nNSec+500000) / 1000000 )
-#define DIFF_MS( pStart, pEnd, Member ) ( CALC_MS( pEnd->Member.tv_sec, pEnd->Member.tv_nsec ) - CALC_MS( pStart->Member.tv_sec, pStart->Member.tv_nsec ) )
-
-String TTProfiler::GetSysdepProfileLine( SysdepProfileSnapshot *pStart, SysdepProfileSnapshot *pStop )
-{
- String aProfile;
-
- aProfile += Pad( String::CreateFromInt64(pStop->mpsinfo.pr_size), 9);
- aProfile += Pad( String::CreateFromInt64(pStop->mpsinfo.pr_rssize), 11);
-
-
- aProfile += Pad( String::CreateFromInt64(DIFF_MS( pStart, pStop, mprusage.pr_rtime ) / AVER( pStart, pStop, mprusage.pr_count )), 7 );
-
-
- sal_uLong d_utime = DIFF_MS( pStart, pStop, mpstatus.pr_utime ) + DIFF_MS( pStart, pStop, mpstatus.pr_cutime );
- sal_uLong d_stime = DIFF_MS( pStart, pStop, mpstatus.pr_stime ) + DIFF_MS( pStart, pStop, mpstatus.pr_cstime );
-
- aProfile += Pad( String::CreateFromInt64(d_utime), 7 );
- aProfile += Pad( String::CreateFromInt64(d_stime), 7 );
- aProfile += Pad( String::CreateFromInt64(d_utime + d_stime), 7 );
-
- return aProfile;
-};
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/profiler.cxx b/automation/source/server/profiler.cxx
deleted file mode 100644
index 52d0a8fd4c67..000000000000
--- a/automation/source/server/profiler.cxx
+++ /dev/null
@@ -1,262 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-
-#include <tools/time.hxx>
-#include <tools/string.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <vcl/svapp.hxx>
-#include <basic/ttstrhlp.hxx>
-
-
-#include "profiler.hxx"
-
-
-TTProfiler::TTProfiler()
-: mpStart( NULL )
-, mpEnd( NULL )
-, bIsProfileIntervalStarted( sal_False )
-, bIsProfilingPerCommand( sal_False )
-, bIsPartitioning( sal_False )
-, bIsAutoProfiling( sal_False )
-, pSysDepStatic( NULL )
-{
- InitSysdepProfiler();
- mpStart = new ProfileSnapshot;
- mpStart->pSysdepProfileSnapshot = NewSysdepSnapshotData();
- mpEnd = new ProfileSnapshot;
- mpEnd->pSysdepProfileSnapshot = NewSysdepSnapshotData();
- StartProfileInterval();
-}
-
-TTProfiler::~TTProfiler()
-{
- if ( IsAutoProfiling() )
- StopAutoProfiling();
- if ( mpStart )
- {
- if ( mpStart->pSysdepProfileSnapshot )
- DeleteSysdepSnapshotData( mpStart->pSysdepProfileSnapshot );
- delete mpStart;
- mpStart = NULL;
- }
- if ( mpEnd )
- {
- if ( mpEnd->pSysdepProfileSnapshot )
- DeleteSysdepSnapshotData( mpEnd->pSysdepProfileSnapshot );
- delete mpEnd;
- mpEnd = NULL;
- }
- DeinitSysdepProfiler();
-}
-
-
-String TTProfiler::GetProfileHeader()
-{
- UniString aReturn;
- aReturn += '\n';
- if ( !IsAutoProfiling() )
- aReturn.AppendAscii("Befehl").Append(TabString(36));
-
- aReturn.AppendAscii(" Zeitdauer");
- aReturn.AppendAscii(" Ticks in %");
- aReturn.Append( GetSysdepProfileHeader() );
- aReturn.AppendAscii("\n");
- return aReturn;
-}
-
-
-void TTProfiler::StartProfileInterval( sal_Bool bReadAnyway )
-{
- if ( !bIsProfileIntervalStarted || bReadAnyway )
- {
- GetProfileSnapshot( mpStart );
- GetSysdepProfileSnapshot( mpStart->pSysdepProfileSnapshot, PROFILE_START );
- bIsProfileIntervalStarted = sal_True;
- }
-}
-
-String TTProfiler::GetProfileLine( ProfileSnapshot *pStart, ProfileSnapshot *pEnd )
-{
- String aProfileString;
-
- aProfileString += Pad(GetpApp()->GetAppLocaleDataWrapper().getDuration( DIFF( pStart, pEnd, aTime) , sal_True, sal_True ), 12);
-
- sal_uLong nProcessTicks = DIFF( pStart, pEnd, nProcessTicks );
- sal_uLong nSystemTicks = DIFF( pStart, pEnd, nSystemTicks );
- if ( nSystemTicks )
- {
- aProfileString += Pad(UniString::CreateFromInt32( (100 * nProcessTicks) / nSystemTicks ), 11);
- aProfileString += '%';
- }
- else
- aProfileString += Pad(CUniString("?? "), 12);
-
- return aProfileString;
-}
-
-
-String TTProfiler::GetProfileLine( String &aPrefix )
-{
- String aProfileString;
- if ( IsProfilingPerCommand() || IsAutoProfiling() )
- {
- aProfileString = aPrefix;
- aProfileString += TabString(35);
-
-
- aProfileString += GetProfileLine( mpStart, mpEnd );
- aProfileString += GetSysdepProfileLine( mpStart->pSysdepProfileSnapshot, mpEnd->pSysdepProfileSnapshot );
- aProfileString += '\n';
- }
-
- return aProfileString;
-}
-
-
-void TTProfiler::EndProfileInterval()
-{
- GetProfileSnapshot( mpEnd );
- GetSysdepProfileSnapshot( mpEnd->pSysdepProfileSnapshot, PROFILE_END );
- bIsProfileIntervalStarted = sal_False;
-}
-
-
-void TTProfiler::GetProfileSnapshot( ProfileSnapshot *pProfileSnapshot )
-{
- pProfileSnapshot->aTime = Time( Time::SYSTEM );
- pProfileSnapshot->nProcessTicks = Time::GetProcessTicks();
- pProfileSnapshot->nSystemTicks = Time::GetSystemTicks();
-}
-
-
-void TTProfiler::StartProfilingPerCommand()
-{
- bIsProfilingPerCommand = sal_True;
-}
-
-void TTProfiler::StopProfilingPerCommand()
-{
- bIsProfilingPerCommand = sal_False;
-}
-
-void TTProfiler::StartPartitioning()
-{
- bIsPartitioning = sal_True;
-}
-
-void TTProfiler::StopPartitioning()
-{
- bIsPartitioning = sal_True;
-}
-
-sal_uLong TTProfiler::GetPartitioningTime()
-{
- return DIFF( mpStart, mpEnd, nSystemTicks );
-}
-
-
-
-void TTProfiler::StartAutoProfiling( sal_uLong nMSec )
-{
- if ( !bIsAutoProfiling )
- {
- pAutoStart = new ProfileSnapshot;
- pAutoStart->pSysdepProfileSnapshot = NewSysdepSnapshotData();
- pAutoEnd = new ProfileSnapshot;
- pAutoEnd->pSysdepProfileSnapshot = NewSysdepSnapshotData();
- GetProfileSnapshot( pAutoStart );
- GetSysdepProfileSnapshot( pAutoStart->pSysdepProfileSnapshot, PROFILE_START );
- SetTimeout( nMSec );
- bIsAutoProfiling = sal_True;
- Start();
- }
-
-}
-
-void TTProfiler::Timeout()
-{
- GetProfileSnapshot( pAutoEnd );
- GetSysdepProfileSnapshot( pAutoEnd->pSysdepProfileSnapshot, PROFILE_END );
- String aLine;
-
- aLine += GetProfileLine( pAutoStart, pAutoEnd );
- aLine += GetSysdepProfileLine( pAutoStart->pSysdepProfileSnapshot, pAutoEnd->pSysdepProfileSnapshot );
- aLine += '\n';
-
- aAutoProfileBuffer += aLine;
-
- ProfileSnapshot *pTemp = pAutoStart; // swap so that current end becomes the next start
- pAutoStart = pAutoEnd;
- pAutoEnd = pTemp;
-
- Start(); // restart timer
-}
-
-String TTProfiler::GetAutoProfiling()
-{
- String aTemp(aAutoProfileBuffer);
- aAutoProfileBuffer.Erase();
- return aTemp;
-}
-
-void TTProfiler::StopAutoProfiling()
-{
- if ( bIsAutoProfiling )
- {
- Stop();
- bIsAutoProfiling = sal_False;
- }
-}
-
-
-
-//String TTProfiler::Hex( sal_uLong nNr )
-String TTProfiler::Dec( sal_uLong nNr )
-{
- String aRet(UniString::CreateFromInt32(nNr));
- if ( nNr < 100 )
- {
- aRet = Pad( aRet, 3);
- aRet.SearchAndReplaceAll(' ','0');
- }
- aRet.Insert( ',', aRet.Len() - 2 );
- return aRet;
-}
-
-String TTProfiler::Pad( const String &aS, xub_StrLen nLen )
-{
- if ( nLen > aS.Len() )
- return UniString().Fill( nLen - aS.Len() ).Append( aS );
- else
- return CUniString(" ").Append( aS );
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/profiler.hxx b/automation/source/server/profiler.hxx
deleted file mode 100644
index 1aef4fbead63..000000000000
--- a/automation/source/server/profiler.hxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-
-#define AVER( pFirst, pSecond, Membername ) (( pFirst->Membername + pSecond->Membername ) / 2 )
-#define DIFF( pFirst, pSecond, Membername ) ( pSecond->Membername - pFirst->Membername )
-#define S_SAFEDIV( a,b ) ((b)==0?CUniString("#DIV"):UniString::CreateFromInt32( (ULONG) ((a)/(b))))
-#define S_SAFEDIV_DEC( a,b ) ((b)==0?CUniString("#DIV"):Dec((ULONG) ((a)/(b))))
-
-#include <tools/time.hxx>
-#include <tools/string.hxx>
-#include <vcl/timer.hxx>
-
-#define PROFILE_START 0x01
-#define PROFILE_END 0x02
-
-
-struct SysdepProfileSnapshot;
-struct SysdepStaticData; // not really static but static over several snapshots
-
-struct ProfileSnapshot
-{
- Time aTime;
- SysdepProfileSnapshot *pSysdepProfileSnapshot;
- sal_uLong nProcessTicks;
- sal_uLong nSystemTicks;
-
- ProfileSnapshot() : aTime( Time::EMPTY ) {}
-};
-
-
-class TTProfiler : private Timer
-{
-public:
- TTProfiler();
- ~TTProfiler();
-
- String GetProfileHeader(); // headline for logfile
- void StartProfileInterval( sal_Bool bReadAnyway = sal_False ); // memorize condition
- void EndProfileInterval(); // construct information line
- String GetProfileLine( String &aPrefix );
-
-
- void StartProfilingPerCommand();
- void StopProfilingPerCommand();
- sal_Bool IsProfilingPerCommand() { return bIsProfilingPerCommand; }
-
- void StartPartitioning();
- void StopPartitioning();
- sal_Bool IsPartitioning() { return bIsPartitioning; }
- sal_uLong GetPartitioningTime();
-
- void StartAutoProfiling( sal_uLong nMSec ); // sample automatically every nMSec milliseconds
- String GetAutoProfiling(); // get current 'collection'
- void StopAutoProfiling();
- sal_Bool IsAutoProfiling() { return bIsAutoProfiling; }
-
-private:
-
- void GetProfileSnapshot( ProfileSnapshot *pProfileSnapshot );
-
-
- String GetProfileLine( ProfileSnapshot *pStart, ProfileSnapshot *pStop );
-
-
- ProfileSnapshot *mpStart;
- ProfileSnapshot *mpEnd;
- sal_Bool bIsProfileIntervalStarted;
- sal_Bool bIsProfilingPerCommand;
- sal_Bool bIsPartitioning;
-
-
- ProfileSnapshot *pAutoStart;
- ProfileSnapshot *pAutoEnd;
- sal_Bool bIsAutoProfiling;
- String aAutoProfileBuffer;
-
- virtual void Timeout();
-
-
-
- String Dec( sal_uLong nNr ); // result = nNr / 100 with 2 decimals
- String Pad( const String &aS, xub_StrLen nLen ); // adds blanks links to the string
-
-/* from now on the methods are implemented system dependent in the respective cxx
- they are called by the methods above
-*/
-
- SysdepStaticData *pSysDepStatic;
-
- void InitSysdepProfiler();
- void DeinitSysdepProfiler();
-
- SysdepProfileSnapshot *NewSysdepSnapshotData();
- void DeleteSysdepSnapshotData( SysdepProfileSnapshot *pSysdepProfileSnapshot );
-
-
- String GetSysdepProfileHeader();
-
- void GetSysdepProfileSnapshot( SysdepProfileSnapshot *pSysdepProfileSnapshot, sal_uInt16 nMode = PROFILE_START | PROFILE_END );
-
- String GetSysdepProfileLine( SysdepProfileSnapshot *pStart, SysdepProfileSnapshot *pStop );
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/recorder.cxx b/automation/source/server/recorder.cxx
deleted file mode 100644
index 679e6e26bcbf..000000000000
--- a/automation/source/server/recorder.cxx
+++ /dev/null
@@ -1,659 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <osl/mutex.hxx>
-
-#include <vcl/window.hxx>
-#include <vcl/vclevent.hxx>
-#include <vcl/button.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/spinfld.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/toolbox.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/sound.hxx>
-#include <vcl/combobox.hxx>
-#include <vcl/floatwin.hxx>
-#include <basic/ttstrhlp.hxx>
-#include "statemnt.hxx"
-#include "retstrm.hxx"
-#include "rcontrol.hxx"
-#include "recorder.hxx"
-
-#include <comphelper/uieventslogger.hxx>
-
-MacroRecorder* MacroRecorder::pMacroRecorder = NULL;
-
-MacroRecorder::MacroRecorder()
-: pLastWin( NULL )
-, pEditModify( NULL )
-, pActionParent( NULL )
-, aKeyUniqueID()
-, pKeyWin( NULL )
-, bKeyFollowFocus( sal_False )
-, m_bRecord( sal_False )
-, m_bLog( sal_False )
-{
- aHookRefresh.SetTimeout( 500 );
- aHookRefresh.SetTimeoutHdl( LINK( this, MacroRecorder, HookRefreshHdl) );
- aHookRefresh.Start();
- aEventListenerHdl = LINK( this, MacroRecorder, EventListener );
- AddEventHooks();
-}
-
-MacroRecorder::~MacroRecorder()
-{
- aHookRefresh.Stop();
- RemoveEventHooks();
-}
-
-void MacroRecorder::AddEventHooks()
-{
- Window *pTopLevel = Application::GetFirstTopLevelWindow();
- while ( pTopLevel )
- {
- Window *pParent = pTopLevel;
- while ( pParent->GetParent() )
- pParent = pParent->GetParent();
-
- pParent->RemoveChildEventListener( aEventListenerHdl ); // might be instrumented already
- pParent->AddChildEventListener( aEventListenerHdl );
-
- pTopLevel = Application::GetNextTopLevelWindow( pTopLevel );
- }
-}
-
-void MacroRecorder::RemoveEventHooks()
-{
- Window *pTopLevel = Application::GetFirstTopLevelWindow();
- while ( pTopLevel )
- {
- pTopLevel->RemoveChildEventListener( aEventListenerHdl );
- pTopLevel = Application::GetNextTopLevelWindow( pTopLevel );
- }
-}
-
-IMPL_LINK( MacroRecorder, HookRefreshHdl, void*, EMPTYARG )
-{
- AddEventHooks();
- return 0;
-}
-
-void MacroRecorder::LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod, sal_uInt16 nParam )
-{
- ::comphelper::UiEventsLogger::logVcl( Id2Str( aParentID ), nVCLWindowType, Id2Str( aID ), aMethod, nParam );
-}
-
-void MacroRecorder::LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod )
-{
- ::comphelper::UiEventsLogger::logVcl( Id2Str( aParentID ), nVCLWindowType, Id2Str( aID ), aMethod );
-}
-
-Window* MacroRecorder::GetParentWithID( Window* pThis )
-{
- Window *pOverlap = pThis->GetWindow( WINDOW_OVERLAP );
- while ( pOverlap != pThis && !pThis->GetUniqueOrHelpId().getLength() && pThis->GET_REAL_PARENT() )
- pThis = pThis->GET_REAL_PARENT();
- return pThis;
-}
-
-rtl::OString MacroRecorder::GetParentID( Window* pThis )
-{
- if ( pThis->GetParent() )
- return pThis->GetParent()->GetUniqueOrHelpId();
- else
- return rtl::OString();
-}
-
-IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent )
-{
- sal_Bool bSendData = sal_False;
-
- if ( pEvent->ISA( VclWindowEvent ) )
- {
- VclWindowEvent* pWinEvent = ( VclWindowEvent* ) pEvent;
- Window* pWin = pWinEvent->GetWindow();
- sal_uLong nEventID = pWinEvent->GetId();
-#if OSL_DEBUG_LEVEL > 1
- if ( nEventID >= 1001 && nEventID != VCLEVENT_WINDOW_KEYUP )
- nEventID = pWinEvent->GetId(); // Just something to set a breakpoint
- else
- return 0;
-#endif
-
-// check for different action after collecting keys
- // send if there_is_something_to_send
- // and eather event_is_not_of_interest
- // or ( new_window and new_window_is_interesting ) ( ignore interesting events to uninteresting window )
-
- if ( aKeyString.Len()
- && ( ( nEventID != VCLEVENT_WINDOW_KEYINPUT
- && nEventID != VCLEVENT_WINDOW_MOUSEMOVE
- && nEventID != VCLEVENT_WINDOW_COMMAND
- && nEventID != VCLEVENT_WINDOW_KEYUP )
- || ( pKeyWin != pWin
- && ( pWin->GetType() == WINDOW_CONTROL || pWin->GetType() == WINDOW_WINDOW )
- )
- )
- )
- {
- if ( m_bRecord )
- {
- // we cannot access pKeyWin since it might have dissapeared
- if ( bKeyFollowFocus )
- StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, aKeyString, bKeyFollowFocus );
- else
- StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, aKeyString );
-#if OSL_DEBUG_LEVEL > 1
- StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, String::CreateFromInt32( nEventID ) );
-#endif
- bSendData = sal_True;
- }
- // cleanup
- aKeyString.Erase();
- pKeyWin = NULL;
- bKeyFollowFocus = sal_False;
- }
-
- switch ( pWin->GetType() )
- {
- case WINDOW_TABPAGE:
- switch( nEventID )
- {
- case VCLEVENT_WINDOW_ACTIVATE:
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, rtl::OString(), (comm_UINT16)(M_SetPage|M_RET_NUM_CONTROL), Id2Str( pWin->GetUniqueOrHelpId() ) );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("SetPage") );
- }
- break;
- }
- break;
- case WINDOW_RADIOBUTTON:
- case WINDOW_IMAGERADIOBUTTON:
- switch( nEventID )
- {
- case VCLEVENT_BUTTON_CLICK: // VCLEVENT_RADIOBUTTON_TOGGLE
- {
- if ( ((RadioButton*)pWin)->IsChecked() )
- {
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Check );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Check") );
- }
- }
- }
- break;
- }
- break;
- case WINDOW_CHECKBOX:
- case WINDOW_TRISTATEBOX:
- switch( nEventID )
- {
- case VCLEVENT_BUTTON_CLICK: //VCLEVENT_CHECKBOX_TOGGLE:
- {
- comm_UINT16 nMethod;
- String aMethod;
- switch ( ((TriStateBox*)pWin)->GetState() )
- {
- case STATE_CHECK: nMethod = M_Check; aMethod = CUniString("Check"); break;
- case STATE_NOCHECK: nMethod = M_UnCheck; aMethod = CUniString("UnCheck"); break;
- case STATE_DONTKNOW: nMethod = M_TriState; aMethod = CUniString("TriState"); break;
- default: nMethod = M_Check;
- OSL_FAIL( "Unknown state in TriStateBox::GetState()" );
- }
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), nMethod );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod );
- }
- }
- break;
- }
- break;
- case WINDOW_EDIT:
- case WINDOW_MULTILINEEDIT:
- switch( nEventID )
- {
- case VCLEVENT_EDIT_MODIFY:
- pEditModify = pWin;
- aEditModifyString = ((Edit*)pWin)->GetText();
- break;
- }
- break;
- case WINDOW_MULTILISTBOX:
- switch( nEventID )
- {
- case VCLEVENT_LISTBOX_SELECT:
- Sound::Beep();
- }
- case WINDOW_LISTBOX:
- switch( nEventID )
- {
- case VCLEVENT_LISTBOX_SELECT:
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Select, comm_UINT32( ((ListBox*)pWin)->GetSelectEntryPos() +1 ) );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Select"), ((ListBox*)pWin)->GetSelectEntryPos() );
- }
- break;
- }
- break;
- case WINDOW_COMBOBOX:
- case WINDOW_PATTERNBOX:
- case WINDOW_NUMERICBOX:
- case WINDOW_METRICBOX:
- case WINDOW_CURRENCYBOX:
- case WINDOW_DATEBOX:
- case WINDOW_TIMEBOX:
- switch( nEventID )
- {
- case VCLEVENT_EDIT_MODIFY:
- pEditModify = pWin;
- aEditModifyString = ((Edit*)pWin)->GetText();
- break;
- case VCLEVENT_COMBOBOX_SELECT:
- {
- pEditModify = NULL;
- aEditModifyString.Erase();
-
- sal_uInt16 nPos = ((ComboBox*)pWin)->GetEntryPos(((ComboBox*)pWin)->GetText());
- if ( m_bRecord )
- {
- if ( nPos == COMBOBOX_ENTRY_NOTFOUND )
- Sound::Beep();
- else
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Select, (comm_UINT32) nPos+1 );
- bSendData = sal_True;
- }
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Select"), nPos );
- }
- }
- }
- break;
- case WINDOW_PUSHBUTTON:
- case WINDOW_OKBUTTON:
- case WINDOW_CANCELBUTTON:
- case WINDOW_IMAGEBUTTON:
- case WINDOW_MOREBUTTON:
- case WINDOW_HELPBUTTON:
- switch( nEventID )
- {
- case VCLEVENT_BUTTON_CLICK:
- Window* pParent = pWin->GetParent();
- sal_Bool bDone = sal_False;
- if ( pParent->IsDialog() && !pWin->GetUniqueOrHelpId().getLength() )
- {
- switch ( pParent->GetType() )
- {
- case WINDOW_MESSBOX:
- case WINDOW_INFOBOX:
- case WINDOW_WARNINGBOX:
- case WINDOW_ERRORBOX:
- case WINDOW_QUERYBOX:
- case WINDOW_BUTTONDIALOG:
- {
- comm_UINT16 nMethod;
- String aMethod;
- ButtonDialog* pBD = (ButtonDialog*)pParent;
-
- // we have to find the current Button ID ourselves since it is not generated at this point :-(
- sal_uInt16 nCurrentButtonId = 0xffff; // Some wild value to wak up people
- sal_uInt16 i;
- for ( i = 0; i < pBD->GetButtonCount() ; i++ )
- {
- if ( pBD->GetPushButton( pBD->GetButtonId(i) ) == pWin )
- {
- nCurrentButtonId = pBD->GetButtonId(i);
- break;
- }
- }
-
- switch ( nCurrentButtonId )
- {
- case BUTTONID_OK: nMethod = M_OK; aMethod = CUniString("OK"); break;
- case BUTTONID_CANCEL: nMethod = M_Cancel; aMethod = CUniString("Cancel"); break;
- case BUTTONID_YES: nMethod = M_Yes; aMethod = CUniString("Yes"); break;
- case BUTTONID_NO: nMethod = M_No; aMethod = CUniString("No"); break;
- case BUTTONID_RETRY: nMethod = M_Repeat; aMethod = CUniString("Repeat"); break;
- case BUTTONID_HELP: nMethod = M_Help; aMethod = CUniString("Help"); break;
- default: nMethod = M_Click; aMethod = CUniString("Click");
- }
- if ( m_bRecord )
- {
- if ( nMethod != M_Click )
- StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod );
- else
- StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod, (comm_UINT32)nCurrentButtonId );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- if ( nMethod != M_Click )
- LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod );
- else
- LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod, nCurrentButtonId );
- bDone = sal_True;
- }
- }
- break;
- default:
- {
- comm_UINT16 nMethod;
- String aMethod;
- switch ( pWin->GetType() )
- {
- case WINDOW_OKBUTTON: nMethod = M_OK; aMethod = CUniString("OK"); break;
- case WINDOW_CANCELBUTTON: nMethod = M_Cancel; aMethod = CUniString("Cancel"); break;
- case WINDOW_HELPBUTTON: nMethod = M_Help; aMethod = CUniString("Help"); break;
- default: nMethod = M_Default;aMethod = CUniString("Unknown Button");
- OSL_FAIL( "Unknown Button" );
- }
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pParent->GetUniqueOrHelpId(), nMethod );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod );
- bDone = sal_True;
- }
- }
- break;
- }
- }
- if ( m_bRecord )
- {
- if ( !bSendData && pWin->GetUniqueOrHelpId().getLength() )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Click );
- bSendData = sal_True;
- }
- }
- if ( m_bLog )
- {
- if ( !bDone )
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Click") );
- }
- }
- break;
- case WINDOW_SPINFIELD:
- case WINDOW_PATTERNFIELD:
- case WINDOW_NUMERICFIELD:
- case WINDOW_METRICFIELD:
- case WINDOW_CURRENCYFIELD:
- case WINDOW_DATEFIELD:
- case WINDOW_TIMEFIELD:
- switch( nEventID )
- {
- case VCLEVENT_SPINFIELD_UP:
- case VCLEVENT_SPINFIELD_DOWN:
- case VCLEVENT_SPINFIELD_FIRST:
- case VCLEVENT_SPINFIELD_LAST:
- {
- pEditModify = NULL;
- aEditModifyString.Erase();
-
- comm_UINT16 nMethod;
- String aMethod;
- switch ( nEventID )
- {
- case VCLEVENT_SPINFIELD_UP: nMethod = M_More; aMethod = CUniString("More"); break;
- case VCLEVENT_SPINFIELD_DOWN: nMethod = M_Less; aMethod = CUniString("Less"); break;
- case VCLEVENT_SPINFIELD_FIRST: nMethod = M_ToMin; aMethod = CUniString("ToMin"); break;
- case VCLEVENT_SPINFIELD_LAST: nMethod = M_ToMax; aMethod = CUniString("ToMax"); break;
- default: nMethod = M_ToMin; aMethod = CUniString("Unknown");
- OSL_FAIL( "Unknown EventID in Spinfield" );
- }
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), nMethod );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod );
- }
- }
- break;
- case VCLEVENT_EDIT_MODIFY:
- pEditModify = pWin;
- aEditModifyString = ((SpinField*)pWin)->GetText();
- break;
- }
- break;
-
- case WINDOW_MENUBUTTON:
- switch( nEventID )
- {
- case VCLEVENT_BUTTON_CLICK:
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Click );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Click") );
- }
- break;
- }
- break;
- case WINDOW_TOOLBOX:
- {
- ToolBox *pTB = ((ToolBox*)pWin);
- switch( nEventID )
- {
- case VCLEVENT_TOOLBOX_SELECT:
- { // a Button has been clicked
- // so this cannot be a tearoff or OpenMenu anymore
- pActionParent = NULL;
- // compare to 1 for floating ToolBoxes
- if ( m_bRecord )
- {
- if ( !pWin->GetUniqueOrHelpId().getLength() /* || pWin->GetUniqueOrHelpId().Matches( 1 ) */ )
- // generate direct Button access
- StatementList::pRet->GenReturn( RET_MacroRecorder, Str2Id( pTB->GetItemCommand( pTB->GetCurItemId() ) ), (comm_UINT16)(M_Click) );
- else
- // access via Toolbox
- StatementList::pRet->GenReturn( RET_MacroRecorder, pTB->GetUniqueOrHelpId(), (comm_UINT16)(M_Click|M_RET_NUM_CONTROL), Id2Str( pTB->GetHelpId( pTB->GetCurItemId() ) ) );
- bSendData = sal_True;
- }
- }
- break;
- case VCLEVENT_TOOLBOX_CLICK: /// ATTENTION this is called during initialisation of toolbox. whoever 'invented' this
- pActionParent = pTB;
- break;
- case VCLEVENT_TOOLBOX_DEACTIVATE:
- pActionParent = NULL;
- break;
- }
- }
- break;
- case WINDOW_CONTROL:
- case WINDOW_WINDOW:
- switch( nEventID )
- {
- case VCLEVENT_WINDOW_COMMAND:
- break;
- case VCLEVENT_WINDOW_KEYINPUT:
- {
- const KeyEvent *pKeyEvent = ((KeyEvent*)pWinEvent->GetData());
- const KeyCode aKeyCode = pKeyEvent->GetKeyCode();
- if ( pKeyEvent )
- {
- pKeyWin = pWin;
- Window *pIdWin = GetParentWithID( pWin );
- if ( pIdWin != pWin )
- bKeyFollowFocus = sal_True;
- aKeyUniqueID = pIdWin->GetUniqueOrHelpId();
- if ( ( !aKeyCode.IsMod1() && !aKeyCode.IsMod2() ) &&
- (( aKeyCode.GetGroup() == KEYGROUP_NUM) ||
- ( aKeyCode.GetGroup() == KEYGROUP_ALPHA) ||
- ( aKeyCode.GetCode() == KEY_SPACE) ||
- ( aKeyCode.GetCode() == KEY_ADD) ||
- ( aKeyCode.GetCode() == KEY_SUBTRACT) ||
- ( aKeyCode.GetCode() == KEY_MULTIPLY) ||
- ( aKeyCode.GetCode() == KEY_DIVIDE) ||
- ( aKeyCode.GetCode() == KEY_POINT) ||
- ( aKeyCode.GetCode() == KEY_COMMA) ||
- ( aKeyCode.GetCode() == KEY_EQUAL) ||
- ( aKeyCode.GetCode() == 0) ) )
- {
- DBG_ASSERT( pKeyEvent->GetCharCode(), "no charcode found" );
- aKeyString += pKeyEvent->GetCharCode();
- }
- else
- { // not a regular key, transfer KeyCode
- aKeyString += sal_Unicode(1); // mask it
- // extra for '>' which is coded as <SHIFT GREATER>
- if ( pKeyEvent->GetCharCode() == '>' )
- aKeyString += sal_Unicode( KEY_GREATER | (aKeyCode.GetAllModifier() & ~KEY_SHIFT) );
- else
- aKeyString += sal_Unicode( aKeyCode.GetCode() | aKeyCode.GetAllModifier() );
- }
- }
- }
- break;
-
- case VCLEVENT_WINDOW_MOUSEMOVE:
- case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
- case VCLEVENT_WINDOW_MOUSEBUTTONUP:
- {
- }
- break;
-
-
- }
- break;
- case WINDOW_DOCKINGWINDOW:
- {
-// case 1 .. 0xffff:
- OSL_TRACE( "TT_VCLMessage %u %u %X",nEventID, pWin->GetType(), pWin );
- }
- break;
- case WINDOW_FLOATINGWINDOW:
- {
- OSL_TRACE( "TT_VCLMessage %u %u %X",nEventID, pWin->GetType(), pWin );
- }
- break;
- }
-
- switch( nEventID )
- {
- case VCLEVENT_CONTROL_LOSEFOCUS:
- if ( pEditModify == pWin )
- {
- if ( m_bRecord )
- {
- StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), M_SetText, aEditModifyString );
- bSendData = sal_True;
- }
- if ( m_bLog )
- {
- LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Modify") );
- }
- pEditModify = NULL;
- aEditModifyString.Erase(); //could be somewhat lengthy
- }
- break;
- }
-
- pLastWin = pWin;
- } // if
-
- if ( bSendData )
- new StatementFlow( NULL, F_EndCommandBlock ); // create command for sending and entry in que
-
- return 0;
-}
-
-
-
-static ::osl::Mutex * getRecorderMutex()
-{
- static ::osl::Mutex * pMutex = NULL;
- if(pMutex==NULL)
- {
- ::osl::MutexGuard aGuard(::osl::Mutex::getGlobalMutex());
- if(pMutex==NULL)
- pMutex = new ::osl::Mutex();
- }
- return pMutex;
-}
-
-
-void MacroRecorder::CheckDelete()
-{
- ::osl::MutexGuard aGuard( getRecorderMutex() );
- if ( !m_bRecord && !m_bLog )
- {
- pMacroRecorder = NULL;
- delete this;
- }
-}
-
-
-MacroRecorder* MacroRecorder::GetMacroRecorder()
-{
- ::osl::MutexGuard aGuard( getRecorderMutex() );
- if ( !pMacroRecorder )
- pMacroRecorder = new MacroRecorder;
-
- return pMacroRecorder;
-}
-
-sal_Bool MacroRecorder::HasMacroRecorder()
-{
- ::osl::MutexGuard aGuard( getRecorderMutex() );
- return pMacroRecorder != NULL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/recorder.hxx b/automation/source/server/recorder.hxx
deleted file mode 100644
index cde7b91e31c5..000000000000
--- a/automation/source/server/recorder.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <tools/string.hxx>
-#include <tools/link.hxx>
-#include <vcl/timer.hxx>
-
-class ToolBox;
-class Window;
-class VclSimpleEvent;
-
-class MacroRecorder
-{
-private:
- Window* GetParentWithID( Window* pThis );
- rtl::OString GetParentID( Window* pThis );
-
- Link aEventListenerHdl;
- DECL_LINK( EventListener, VclSimpleEvent* );
-
- Window* pLastWin;
- Window* pEditModify;
- String aEditModifyString;
-
- ToolBox *pActionParent; // toolbox from which a tearoff or OpenMenu might happen
-
- // record keys
- String aKeyString;
- rtl::OString aKeyUniqueID; // has to be remembered seperately since Window might be gone when needed
- Window* pKeyWin;
- sal_Bool bKeyFollowFocus;
-
- AutoTimer aHookRefresh;
- void AddEventHooks();
- void RemoveEventHooks();
- DECL_LINK( HookRefreshHdl, void* );
-
- void LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod, sal_uInt16 aParam );
- void LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod );
-
- static MacroRecorder *pMacroRecorder;
-
- MacroRecorder();
- ~MacroRecorder();
- void CheckDelete();
-
- // Actions to perform
- sal_Bool m_bRecord;
- sal_Bool m_bLog;
-
-public:
-
- void SetActionRecord( sal_Bool bRecord = sal_True ) { m_bRecord = bRecord; CheckDelete(); };
- void SetActionLog( sal_Bool bLog = sal_True ) { m_bLog = bLog; CheckDelete(); };
-
- static MacroRecorder* GetMacroRecorder();
- static sal_Bool HasMacroRecorder();
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/retstrm.cxx b/automation/source/server/retstrm.cxx
deleted file mode 100644
index 0ed77e9a26eb..000000000000
--- a/automation/source/server/retstrm.cxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <tools/stream.hxx>
-#include <basic/ttstrhlp.hxx>
-
-#include "retstrm.hxx"
-#include "rcontrol.hxx"
-#include "svcommstream.hxx"
-
-
-RetStream::RetStream()
-{
- pSammel = new SvMemoryStream();
- pCommStream = new SvCommStream( pSammel );
-}
-
-RetStream::~RetStream()
-{
- delete pCommStream;
- delete pSammel;
-}
-
-void RetStream::GenError ( rtl::OString aUId, String aString )
-{
- CmdBaseStream::GenError ( &aUId, &aString );
-}
-
-void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, String aString )
-{
- CmdBaseStream::GenReturn ( nRet, &aUId, &aString );
-}
-
-void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, comm_UINT32 nNr, String aString, sal_Bool bBool )
-{
- CmdBaseStream::GenReturn ( nRet, &aUId, nNr, &aString, bBool );
-}
-
-// MacroRecorder
-void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString )
-{
- CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString );
-}
-
-void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString, sal_Bool bBool )
-{
- CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString, bBool );
-}
-
-
-void RetStream::GenReturn ( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValue )
-{
- Write(sal_uInt16(SIReturn));
- Write(nRet);
- Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed)
- Write(sal_uInt16(PARAM_SBXVALUE_1)); // type of the following parameters
- Write(aValue);
-}
-
-void RetStream::GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, String aString )
-{
- CmdBaseStream::GenReturn ( nRet, nMethod, &aString );
-}
-
-
-
-
-void RetStream::Write( String *pString )
-{
- CmdBaseStream::Write( pString->GetBuffer(), pString->Len() );
-}
-
-void RetStream::Write( SbxValue &aValue )
-{
- *pSammel << sal_uInt16( BinSbxValue );
- aValue.Store( *pSammel );
-}
-
-void RetStream::Write( rtl::OString* pId )
-{
- //HELPID BACKWARD (should use ByteString or OString)
- String aTmp( Id2Str( *pId ) );
- Write( &aTmp );
-}
-
-
-SvStream* RetStream::GetStream()
-{
- return pSammel;
-}
-
-void RetStream::Reset ()
-{
- delete pCommStream;
- delete pSammel;
- pSammel = new SvMemoryStream();
- pCommStream = new SvCommStream( pSammel );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/retstrm.hxx b/automation/source/server/retstrm.hxx
deleted file mode 100644
index b61911afdae8..000000000000
--- a/automation/source/server/retstrm.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _RETSTRM_HXX
-#define _RETSTRM_HXX
-
-#include <basic/sbxvar.hxx>
-#include "cmdbasestream.hxx"
-
-class SvStream;
-
-class RetStream: public CmdBaseStream
-{
-
-public:
- RetStream();
- ~RetStream();
-
- using CmdBaseStream::GenError;
- void GenError( rtl::OString aUId, String aString );
-
- using CmdBaseStream::GenReturn;
- void GenReturn( comm_UINT16 nRet, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, nNr );}
- void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, &aUId, nNr );}
- void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_BOOL bBool ){CmdBaseStream::GenReturn( nRet, &aUId, bBool );}
-
-// MacroRecorder
- void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT16 nMethod ){CmdBaseStream::GenReturn( nRet, &aUId, nMethod );} // also used outside MacroRecorder
- void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT16 nMethod, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, &aUId, nMethod, nNr );}
-
- void GenReturn( sal_uInt16 nRet, rtl::OString aUId, String aString );
- void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT32 nNr, String aString, sal_Bool bBool );
-
-// needed for RemoteCommand and Profiling
- void GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValue );
- void GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, String aString );
-
-// MacroRecorder
- void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString );
- void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString, sal_Bool bBool );
-
- void Reset();
- SvStream* GetStream();
-
-
-
- using CmdBaseStream::Write;
- void Write( comm_UINT16 nNr ){CmdBaseStream::Write( nNr );}
- void Write( comm_UINT32 nNr ){CmdBaseStream::Write( nNr );}
- void Write( comm_BOOL bBool ){CmdBaseStream::Write( bBool );}
- void Write( SbxValue &aValue );
-
-// Complex Datatypes to be handled system dependent
- virtual void Write( rtl::OString* pId );
- virtual void Write( String *pString );
-
- SvStream *pSammel;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/scmdstrm.cxx b/automation/source/server/scmdstrm.cxx
deleted file mode 100644
index e96b552999f6..000000000000
--- a/automation/source/server/scmdstrm.cxx
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <svl/intitem.hxx>
-#include <svl/stritem.hxx>
-#include <svl/eitem.hxx>
-#include "scmdstrm.hxx"
-#include "svcommstream.hxx"
-#include "rcontrol.hxx"
-
-#if OSL_DEBUG_LEVEL > 1
-#include "editwin.hxx"
-#include "statemnt.hxx"
-#endif
-
-SCmdStream::SCmdStream(SvStream *pIn)
-{
- pSammel = pIn;
- pCommStream = new SvCommStream( pSammel );
-}
-
-SCmdStream::~SCmdStream()
-{
- delete pCommStream;
-}
-
-void SCmdStream::Read (String* &pString)
-{
- if ( !pString )
- pString = new String();
- comm_UniChar* pStr;
- sal_uInt16 nLenInChars;
- CmdBaseStream::Read( pStr, nLenInChars );
-
- *pString = String( pStr, nLenInChars );
- delete [] pStr;
-}
-
-void SCmdStream::Read (String &aString)
-{
- comm_UniChar* pStr;
- sal_uInt16 nLenInChars;
- CmdBaseStream::Read( pStr, nLenInChars );
-
- aString = String( pStr, nLenInChars );
- delete [] pStr;
-}
-
-void SCmdStream::Read ( SfxPoolItem *&pItem )
-{
- sal_uInt16 nType;
- sal_uInt16 nId;
- Read(nId);
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "Parameter: " );
- StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nId ) );
- StatementList::m_pDbgWin->AddText( " " );
-#endif
- Read( nType );
- switch (nType)
- {
- case BinUINT16:
- {
- comm_UINT16 nNr;
- Read (nNr );
- pItem = new SfxUInt16Item(nId,nNr);
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "UINT16" );
- StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) );
-#endif
- }
- break;
- case BinUINT32:
- {
- comm_UINT32 nNr;
- Read (nNr );
- pItem = new SfxUInt32Item(nId,nNr);
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "UINT32" );
- StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) );
-#endif
- }
- break;
- case BinString:
- {
- String aString;
- Read (aString);
-
- pItem = new SfxStringItem(nId,aString);
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "String:" );
- StatementList::m_pDbgWin->AddText( aString );
-#endif
- }
- break;
- case BinBool:
- {
- comm_BOOL bBool;
- Read (bBool);
- pItem = new SfxBoolItem(nId,bBool);
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "BOOL:" );
- StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" );
-#endif
- }
- break;
- default:
- OSL_TRACE( "Ungültiger Typ im Stream:%hu", nType );
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "Ungültiger Typ !!!! " );
-#endif
- break;
- }
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "\n" );
-#endif
-}
-
-void SCmdStream::Read ( ::com::sun::star::beans::PropertyValue &rItem )
-{
- sal_uInt16 nType;
- String aId;
- Read(aId);
- rItem.Name = rtl::OUString( aId );
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "Parameter: " );
- StatementList::m_pDbgWin->AddText( aId );
- StatementList::m_pDbgWin->AddText( " " );
-#endif
- nType = GetNextType();
- switch (nType)
- {
- case BinUINT16:
- {
- comm_UINT16 nNr;
- Read (nNr );
- rItem.Value <<= nNr;
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "UINT16" );
- StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) );
-#endif
- }
- break;
- case BinUINT32:
- {
- comm_UINT32 nNr;
- Read (nNr );
- rItem.Value <<= nNr;
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "UINT32" );
- StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) );
-#endif
- }
- break;
- case BinString:
- {
- String aString;
- Read (aString);
- rItem.Value <<= ::rtl::OUString( aString );
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "String:" );
- StatementList::m_pDbgWin->AddText( aString );
-#endif
- }
- break;
- case BinBool:
- {
- comm_BOOL bBool;
- Read (bBool);
- rItem.Value <<= bBool;
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "BOOL:" );
- StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" );
-#endif
- }
- break;
- default:
- OSL_TRACE( "Ungültiger Typ im Stream:%hu", nType );
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "Ungültiger Typ !!!! " );
-#endif
- break;
- }
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "\n" );
-#endif
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/scmdstrm.hxx b/automation/source/server/scmdstrm.hxx
deleted file mode 100644
index 5962e3942459..000000000000
--- a/automation/source/server/scmdstrm.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SCMDSTRM_HXX
-#define _SCMDSTRM_HXX
-
-#include <tools/solar.h>
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-#include "cmdbasestream.hxx"
-
-class SvStream;
-class SfxPoolItem;
-class String;
-class ICommStream;
-
-class SCmdStream: public CmdBaseStream
-{
- SvStream *pSammel;
-
-public:
- SCmdStream( SvStream *pIn );
- ~SCmdStream();
-
- using CmdBaseStream::Read;
- void Read ( comm_UINT16 &nNr ){CmdBaseStream::Read ( nNr );}
- void Read ( comm_UINT32 &nNr ){CmdBaseStream::Read ( nNr );}
- void Read ( comm_BOOL &bBool ){CmdBaseStream::Read ( bBool );}
- void Read ( String &aString );
- void Read ( SfxPoolItem *&pItem );
- void Read ( ::com::sun::star::beans::PropertyValue &rItem );
-
- virtual void Read (String* &pString);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/server.cxx b/automation/source/server/server.cxx
deleted file mode 100644
index 7418e88b8ac5..000000000000
--- a/automation/source/server/server.cxx
+++ /dev/null
@@ -1,887 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// do not use Application Idle but AutoTimer instead
-#define TIMERIDLE
-
-#include <vcl/timer.hxx>
-#include <vcl/wrkwin.hxx>
-#include <osl/diagnose.h>
-#include <osl/mutex.hxx>
-#include <osl/socket.hxx>
-
-#include <vcl/dialog.hxx>
-#include <tools/stream.hxx>
-#include <tools/config.hxx>
-
-#include <svtools/ttprops.hxx>
-#include <basic/ttstrhlp.hxx>
-#include <svl/stritem.hxx>
-#include <svtools/stringtransfer.hxx>
-#include <vcl/sound.hxx>
-#include "testtool.hrc"
-#include <vcl/bitmap.hxx>
-// has got no include guard
-#include <svtools/svtdata.hxx>
-#include <rtl/textenc.h>
-#include <rtl/uri.h>
-#include <rtl/uri.hxx>
-#include "statemnt.hxx"
-#include "scmdstrm.hxx"
-#include "rcontrol.hxx"
-#include "server.hxx"
-#include "testtool.hxx"
-#include "automation/automation.hxx"
-#include "recorder.hxx"
-
-#include "basic/svtmsg.hrc"
-
-#ifdef DBG_UTIL
-void TestToolDebugPrint( const sal_Char *pString )
-{
- if ( !DbgFilterMessage( pString ) )
- StatementList::DirectLog( S_AssertError, UniString( pString, RTL_TEXTENCODING_UTF8 ) );
-}
-void SAL_CALL osl_TestToolDebugPrint( const sal_Char *pString )
-{
- TestToolDebugPrint( pString );
-}
-#endif
-
-
-sal_uLong RemoteControlCommunicationManager::nPortIs = TT_PORT_NOT_INITIALIZED;
-sal_uInt16 RemoteControlCommunicationManager::nComm = 0;
-sal_Bool RemoteControlCommunicationManager::bQuiet = sal_False;
-
-#if OSL_DEBUG_LEVEL > 1
-RemoteControlCommunicationManager::RemoteControlCommunicationManager( EditWindow * pDbgWin )
-#else
-RemoteControlCommunicationManager::RemoteControlCommunicationManager()
-#endif
-: CommunicationManagerServerViaSocket( GetPort(), 1, sal_True )
-#if OSL_DEBUG_LEVEL > 1
-, m_pDbgWin( pDbgWin )
-#endif
-, pTimer( NULL )
-{
- bIsPortValid = ( GetPort() != 0 );
- if ( bQuiet )
- {
- SetInfoType( CM_NO_TEXT );
- }
- else
- {
- SetInfoType( CM_SHORT_TEXT | CM_ALL );
- ByteString aByteString;
- InfoMsg( InfoString( aByteString, CM_ALL ) );
- }
-}
-
-RemoteControlCommunicationManager::~RemoteControlCommunicationManager()
-{
- if ( pTimer )
- delete pTimer;
- DoQuickShutdown();
-}
-
-void RemoteControlCommunicationManager::ConnectionOpened( CommunicationLink* pCL )
-{
- StatementFlow::pCommLink = pCL;
- CommunicationManagerServerViaSocket::ConnectionOpened( pCL );
-}
-
-
-void RemoteControlCommunicationManager::ConnectionClosed( CommunicationLink* pCL )
-{
- StatementFlow::pCommLink = NULL;
- CommunicationManagerServerViaSocket::ConnectionClosed( pCL );
-}
-
-
-IMPL_LINK( RemoteControlCommunicationManager, SetWinCaption, Timer*, EMPTYARG )
-{
- if ( pTimer )
- {
- delete pTimer;
- pTimer = NULL;
- }
-
- if ( StatementList::GetFirstDocFrame() )
- {
- if ( !aOriginalWinCaption.Len() )
- aOriginalWinCaption = StatementList::GetFirstDocFrame()->GetText();
- StatementList::GetFirstDocFrame()->SetText(String(aOriginalWinCaption).AppendAscii(" TT").Append(aAdditionalWinCaption).AppendAscii("[").Append(UniString::CreateFromInt32(nPortToListen)).AppendAscii("]"));
- }
- else
- {
- pTimer = new Timer(); // will be deleted in link
- pTimer->SetTimeout( 1000 );
- pTimer->SetTimeoutHdl( LINK( this, RemoteControlCommunicationManager, SetWinCaption ) );
- pTimer->Start();
- }
- return 0;
-}
-
-void RemoteControlCommunicationManager::InfoMsg( InfoString aMsg )
-{
- if ( !bIsPortValid )
- return;
- aAdditionalWinCaption = UniString( aMsg, RTL_TEXTENCODING_ASCII_US );
- SetWinCaption();
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( UniString( (ByteString)aMsg, RTL_TEXTENCODING_ASCII_US ) );
- m_pDbgWin->AddText( "\n" );
-#endif
-}
-
-sal_uLong RemoteControlCommunicationManager::GetPort()
-{
- if ( TT_PORT_NOT_INITIALIZED == nPortIs )
- { // Read Config
-
- sal_uInt16 i;
- // are we to be automated at all?
- sal_Bool bAutomate = sal_False;
- for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
- {
- if ( Application::GetCommandLineParam( i ).EqualsIgnoreCaseAscii("/enableautomation")
- || Application::GetCommandLineParam( i ).EqualsIgnoreCaseAscii("-enableautomation"))
- {
- bAutomate = sal_True;
- break;
- }
- }
-
-// if started within Portal determin location of testtool.ini/rc by analysing the commandline
-// /userid:demo1[/export/home/user/demo1]
-// -userid:demo1[/export/home/user/demo1]
- String aIniFileDir;
- for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
- {
- if ( Application::GetCommandLineParam( i ).Copy(0,8).EqualsIgnoreCaseAscii("/userid:")
- || Application::GetCommandLineParam( i ).Copy(0,8).EqualsIgnoreCaseAscii("-userid:") )
- {
- rtl::OUString aEncHome
- = Application::GetCommandLineParam(i).GetBuffer();
-
- rtl::OUString aDecHome = rtl::Uri::decode(aEncHome,
- rtl_UriDecodeWithCharset,
- RTL_TEXTENCODING_UTF8);
-
- aIniFileDir = aDecHome;
- aIniFileDir.Erase( 0, aIniFileDir.Search('[')+1 );
- aIniFileDir.Erase( aIniFileDir.Search(']') );
- }
- }
-
- if ( ! aIniFileDir.Len() )
- aIniFileDir = Config::GetDefDirectory();
-
- Config aConf(Config::GetConfigName( aIniFileDir, CUniString("testtool") ));
- aConf.SetGroup("Communication");
-
- rtl::OString aNoTesttoolKey( ByteString("Exclude_").Append( rtl::OUStringToOString(Application::GetAppFileName(), RTL_TEXTENCODING_UTF8) ) );
-// -notesttool
- for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
- {
- if ( Application::GetCommandLineParam( i ).CompareIgnoreCaseToAscii("-notesttool") == COMPARE_EQUAL )
- aConf.WriteKey( aNoTesttoolKey, "something" );
- }
-
- nPortIs = aConf.ReadKey("TTPort","0").toInt32();
-
-
- if ( !bAutomate || aConf.ReadKey( aNoTesttoolKey, "" ) != "" )
- nPortIs = 0;
-
- nComm = (sal_uInt16)aConf.ReadKey("Comm","0").toInt32();
- if ( nComm )
- aConf.DeleteKey("Comm");
-
- bQuiet = aConf.ReadKey("Quiet","no").equalsIgnoreAsciiCase("yes");
- }
- return nPortIs;
-}
-
-#if OSL_DEBUG_LEVEL > 1
-#define MIN_IDLE 10000
-#else
-#define MIN_IDLE 60000
-#endif
-
-class ExtraIdle : public AutoTimer
-{
- virtual void Timeout();
-
- sal_uInt16 nStep;
- ImplRemoteControl *pRemoteControl;
-public:
- ExtraIdle( ImplRemoteControl *pRC );
-};
-
-
-ExtraIdle::ExtraIdle( ImplRemoteControl *pRC )
-: nStep( 0 )
-, pRemoteControl (pRC )
-{
- SetTimeout( 120000 );
-#if OSL_DEBUG_LEVEL > 1
- SetTimeout( 40000 );
-#endif
- Start();
-}
-
-void ExtraIdle::Timeout()
-{
- if ( !StatementList::pTTProperties )
- StatementList::pTTProperties = new TTProperties();
-
- if ( !StatementList::pTTProperties->GetSlots() )
- {
- delete this;
- return;
- }
-
-
-#if OSL_DEBUG_LEVEL > 1
- sal_uLong nLastInputInterval = Application::GetLastInputInterval();
- sal_Bool bIsInModalMode = Application::IsInModalMode();
- if ( bIsInModalMode || nLastInputInterval < MIN_IDLE )
-#else
- if ( Application::IsInModalMode() || Application::GetLastInputInterval() < MIN_IDLE )
-#endif
- {
- if ( nStep )
- {
- if ( nStep < 15 )
- {
- Sound::Beep();
- Sound::Beep();
- }
-#if OSL_DEBUG_LEVEL < 2
- delete this;
-#endif
- }
-#if OSL_DEBUG_LEVEL > 1
- if ( nStep < 15 )
- {
- Sound::Beep();
- Sound::Beep();
- }
-#endif
- return;
- }
-
- if ( StatementList::pFirst ) // reset handling
- {
- GetpApp()->PostUserEvent( LINK( pRemoteControl, ImplRemoteControl, CommandHdl ) );
- return;
- }
-
-
- switch ( nStep++ ) // test whether there's still something to do
- {
- case 0:
- {
- SfxPoolItem *pItem = new SfxStringItem((sal_uInt16)StatementList::pTTProperties->nSidNewDocDirect, CUniString("swriter/web") );
- new StatementSlot( StatementList::pTTProperties->nSidNewDocDirect, pItem );
- SetTimeout(30000);
- return;
- }
- case 1:
- {
- new StatementSlot( StatementList::pTTProperties->nSidSourceView );
-#if OSL_DEBUG_LEVEL > 1
- SetTimeout(7000);
-#else
- SetTimeout(1500);
-#endif
- return;
- }
- case 2:
- {
- new StatementSlot( StatementList::pTTProperties->nSidSelectAll );
- return;
- }
- case 3:
- {
-
-#ifdef TT_NO_DECRYPT
- String aStr =
- ""
- ;
-
-#else
- ByteString aStr =
- "\n"
- "VRQJ`ob\n"
- "YEZO\n"
- "ob\n"
- "UmRo`\n"
- "5J~O2o5+90~5,6xW$+5:c9o0UXRm`Y UQ~JP~X]`Y\\|%Y`Yo]~O||2[pP0Y1J,|V),,7:,+|JS+U*[/O|K\n"
- "|KaLYNV~]]2W/]*Y9|`*Y,P=[5P|U\n"
- "]}mqbw`zZU\\L\n"
- "LZdYWo9\n"
- "/J\n"
- "U~[QoZ\n"
- "Rqd~V\n"
- ",)1~00\n"
- "\n"
- ")0~*2=\n"
- "++2\\5&K|~5n9r~9/*9<*~051*Q|0~0rY|~./97~Q*7,Z9<|KY0:=K*<=w~qY`IbOKzLwN,`7b,V~]E`]b\\ORE~\n"
- "\n"
- "Vq~bR`W;a+Y\\J=LKJa+W*I/PbR~JLUX[|b~`Z2P/R*[9a~W=9~/9p8=a*P=J0OZ~7L`JbL=P<WbaLQbPO]JYKbD\n"
- "aY`J5J:b~7=2~+9)9W1,50b9X3P0`YbYVJ`Jb \\`Z]`Vb\n"
- "VRQJ`b"
- ;
-#endif
-
- for ( sal_uInt16 i = 0 ; i < aStr.Len() ; i++ )
- {
- if ( aStr.GetChar(i) < 32 || aStr.GetChar(i) > 126 )
- {
- // do nothing
- }
- else
- {
- aStr.SetChar( i, aStr.GetChar(i) - 32 );
- aStr.SetChar( i, 126 - aStr.GetChar(i) );
- }
-
- if ( i > (aStr.Len() / 2) && (i&1) )
- {
- sal_Char c = aStr.GetChar(i);
- aStr.SetChar( i, aStr.GetChar(aStr.Len()-i-1) );
- aStr.SetChar( aStr.Len()-i-1, c );
- }
- }
-
- ::svt::OStringTransfer::CopyString( UniString( aStr, RTL_TEXTENCODING_ASCII_US ), StatementList::GetFirstDocFrame() );
-
- new StatementSlot( StatementList::pTTProperties->nSidPaste );
- return;
- }
- case 4:
- {
- new StatementSlot( StatementList::pTTProperties->nSidSourceView );
- return;
- }
- case 5:
- {
- new StatementSlot( StatementList::pTTProperties->nSidSelectAll );
- new StatementSlot( StatementList::pTTProperties->nSidCopy );
- new StatementSlot( StatementList::pTTProperties->nSidPaste );
- return;
- }
- case 6:
- {
- ByteString aTr("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-");
- ByteString aData =
-"P-S-0U04Fihixh00l0004b0b300-PS0g30428333y243q334j44426a6a65576c8k97aJecf7feccedg2inj3ghlshde5krk+lno"
-"PpqpBfjsgusp1unp-po-PS0gm044x465e6b6L6boygeg-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo"
-"-ooo-ooo-oo-1M04020Y30J0o080B040R040M-N0M700l010l000k000000000006000N011I112r222M-N0gJ40D000U001R011"
-"0110500vr0001014p148mcg1R4koV18s95cwkAE2V8gImM5kgQY9WcosCw22I556p669I99aoaadrddd6eeeNghhIhhiriik6lll"
-"NlmmImoprppp6qqqNsttItturuuw6xxxNxyyHyAA6BBBNBCCHCEE6FFFNFGGHGII6JJJNJKKHKMM6NNNNNOOHOQQ6RRRNRSSCSUU"
-"NUVVIVVWpWWYIYYZrZZZ6+++M-N0Q700R000l000l000g00000006000N011I112r222M-N0kJ40C0003110d1110110r00t6000"
-"Q041l18cF14gtk1ous48Acw295gAlEIMv28cxkY5FosQE2595dU9sY56q669N9aaCaddNdeeIeghrhhh6iiiNkllIllmrmmo6ppp"
-"NpqqIqstrttt6uuuIwwxrxxx6yyyIAABrBBB6CCCIEEFrFFF6GGGIIIJrJJJ6KKKIMMNrNNN6OOOIQQRrRRR6SSSIUUVrVVV6WWW"
-"IYYZrZZZ6+++U-S0d3009004Q040Of0TPU5QGjFCdPoji85WiqEopkCag321kP8dW4yO4KRlNi9iwzeTKup+Yk0lrdcicCEeLtVQ"
-"z1IFeROmSJBa7VYMYY-0EWGkJWH6LpAVdrUepM7ScEpkTBkenX3YGuoFVU0IGk+dSzPpv0N6U07eTPFgid-YtvOD2ws5C96qDgIL"
-"vhsoWmBPAozc+KgPjiVuW0TJnrt6PqF63p2VJEJ6A+l33JqESWh0G4yn1JkcaaEBnw17xmaf0q4BGkVy40Jj+FAyioG3KEukCtP1"
-"OAdOe4ASVCPuUrQDFsqBoRWN6jqxOBfH-30WbgyZy+HtyI6xNVvt3M0lnfscjA8rBUeoRXifTPCceY6t46AR9ooG2jVzdmo+PQ6R"
-"cAEDd7VE3GvUyDJzn2e0yyzypEdnCzUZorT029pk4LHJYsRQmR5smaW9EuCbt2A2s2Nd9ZKAkcJSWoTGPV5p6d1PZCiYt6kVETBB"
-"K7zNWhRK7kMBCag7zELQ2e6HWHM+BwO4nJA-30uF2a2WgcgndWuk6gPbha0D5WFPq902KmjNwyg5xkVQvgd9W9SCfiFd95Ndh9yj"
-"Odd7k38da3xWqtwcHPOEb7AvIPqAdRbz3XNNEYFu7bS9Iz-0UVQJc-gtgPCQ7cledmoGTULsGpjeu0TzkJi2tusMDnR4cisDw2rz"
-"Vhs36hPC0oSH7V-UMAjVIC3dRFwNoc20a0+Culnm3q9QQJsgt00IeEoRXCh3jUg3eO8yGBOpFwYap5OrpoAfMeR6Q8L0sUIgI7B3"
-"Oy9q5WMBAxg5PYnBSxZlywhwDlb45Il6Y+F-NaH62MEoByaq02d2aaEz5Bwx45DqfEC4ACqd4FYjI9IbAgqH7uFopm+JQRSHrSNd"
-"ct0dwNo+FAUaD926b3wtUoRIPJ-MTLLiQcC92bTBue9RkDqqYRcXxn06S9Jm6Qhpk9IjH8JLyIinJj3EAF7bTH9jkf170OvzuO2j"
-"I2jenHhQvnKoDSHSmWenEhfEHkVgekpfIOhkBhqLVaEvb83EyfD2Awrbk5+lwyvOne6yBA36rdrmna4xFOsvqGxRcgcJy-lXnjCn"
-"eeWhGvqAbmSf7LcDwqykK9jqADpRqkXSq7MB7ZOHSgJhNitiw3i6y9LYjRNlq4Lc-00zCNL3CThC65Ajjlw8550bAbqa0d0Jz3BT"
-"kH6EDgQhRUhjtyK9y9CjraNEw9ERUq6MmYa989nsRqsPxo+zi2IbOfxy9q3lFL-QSWn5qwp7nTFUwVe-XaDxnGfWOIYXXfIkILs-"
-"lWPSm51tjj967w11u-YylxUO++EfuLsmr1c3jLdgcDYmK9roIAmz1t1vAalje3oyXDp335xkQ24rS1JhdokOn5cWpizqiE5bsbg4"
-"4gWkfJ2IEVnSoWmj8eNeAFuoT0wzWWm9UgmDKRH2INGJy6OHTwn7zawsiPo796yQd6OsPORlTrUR-bEMLPj8nZdMwyX-Jb8npd2-"
-"zV9JMRdNarUy1aF0tiihB0o+kQh5iy9r9BMqhPjf+WckJ9WWqmSQTEqAl+zwgw-+vH5WomSNVjbDLchO9Ae-ggdQGPcb+7Dq0X-d"
-"XsFHj76-a0eUqKlN6cgHMKgKSmv8xcMVnCIPAnqR0SsThTWe8GSgo3pTGWTgBrtb1X2OfHMHsi8D3gkpPwKvoxoEuSJcTmD2kiAS"
-"Pk3wl5C5NZDe9OrZMdDg6VQpDybXJ7EWLCdwsPoTGqhcGOGvrJ2WgFuuem+wP1ZGhkpee9rU7CTad9q9DxVgNzGWk+lGid6rKswa"
-"1+Uc57RmFASpo3qbaGvuMReTLCWXsocM6lvXmSZHAhhaaV7EHH9sJglnrUlniII4I0gVZHFLys8VKKb2yKbAYHeSY3VlmgRywmqd"
-"UXugq90wSsh0poya0qEAF9CjjadQumckue1unyK1sdcUwyxQOcARlHjLWYd3lS2ozCTQ48zZXesU66bAUfTdoXoOInm7MpPgwiDp"
-"XDqJrEMEChxb747KzIHfxSdi++EwdRNK7RHEmgVhqiZkW1WqBEnjst6Oz08ztIPVknfPjq8NDB4h9g1sD+l1xQNzHNg+Jb1Vmii6"
-"1dP-57LPdOhlWSTKYaCmzwAhGqyOlPrY9zXZodpZuoL2kjTBLBxaeGcM+NONZcN7GqIqFcNlhVgMXKHsd-WEBBR957ZZn7hk-mbb"
-"FGxWLzaiHE6t48mXupNDlxi6d1w-yaPlmczA0gTsEhqRrsEbj48ProNvyivlaY06bdYSvGN7IOBc1ezBJiFd5OTz+RbzIsqJpCsJ"
-"BOTSLjAdwXCzq-XExGbygb3X2oURVXxTB4q0e6euBRnXkIJuTM7SfQfQkdEEjN7J56t3oxP6B0cA4lgSDhURzsDzrkk0ECxfwaU3"
-"ovagJuvzx07aksPdxkQ8aqEy618F-4wjCr3hZq8gq3gu7RJ4ovXa86R7ZskSYJC01o2OpfvJh0WqpYiIuE0zBqpI3kTJQZ0Or5ku"
-"9RzhbzbV1AU0BzJ5vPTOBRIOIAiJiBiOdI8fR3dcWle3xCder+W6QELyr6NaldJipQCeAMwRr5mpzZESGAhuU3BDdkCh5ENgMUE-"
-"sWotoCfnOwT7tJlXLHODk8K7Z4zYCG9Dh2fQazDE0JqBDruomfatotGADn25BCDpk6GI6SSftpUd71Qr1JBrgOr33aWswl983Uk7"
-"cq9Em7vGtACekHlvOOVJfbdh76nNHzuQ1Z1oBvuU9l-dAg+-QWWFQ18D8U+zmYn1jypyarIXSrcIb67wLDTFXWm8F9XPmFWRBD3d"
-"WukVJwhGNV5ZHVE1wCudY07ZIEAd1kgzgPcRSxFhRhFpXsnESjJhUNCA3DlrARwzz+llg0xpVHrJiddYT36P453qxpOmIE9e6-qJ"
-"h4ipfTTt8f2Kq4mdWniErPtI+wrN-edvCQFtPdrL+tpV6EpPRXgmHnjRhV0eWWzqxdRZacX98CME3pvwDYWkO8TOUlcNQSKTU1iF"
-"FC9WIBA8PulsCFVNH1qJwZxYYcaX6CGNnR7vHiIBDsTE51J4b4fYucNYFG9V5mCUdrJT57tHk9eghSOfgeHZDxuvQt8619pwKma7"
-"3Nl00EFklZOk+APRmKviL+iyiG1sWfA3E0xUPznlQgvsHJRzD9u0TzHsB6tIMKLmOxvVHG9knpHerjAXNqIp7jwZzvYXIyW8kw8g"
-"3ycECFaB2Y2U0l00NE7l2Aca2y5uhk+QJygN0857SQMVSEXjy+Q84nQjkTh1GAtFACtdHRhwQ6FhQMLjFu6zyxuFycbQA7qNSsiy"
-"90wlAaUBBtFhxMV0TPd8DbVScjJoMSAYMh6GhAHnKOZsbdqvwtHKdZWZ9HQbdmVOt0xnnK5Ju9KfwhuHMZIoPt73BqspII6qBobB"
-"5kfcwm183j4fwapcs50EoGgz2UZGuK88agfskePeYt9DOQD3qxxfuJ5lZUFHa8aqFJIT6MG2Kwtwuu0zBqTz8x5DYM7PDh29F9FU"
-"1ge-wqqIMqmXlpbO65sila1be1yRGABAbw2njF5txZEAaqEyEo9FUPqnKQ4y1NQqSXkCpsqpO06UUCyBBzaDjawwoHkKOT1-zqpz"
-"FU7JNudONE3fuYk83U9thALoAIeG6FKizOLgU4AcDcszCmGZgylUI-Edd9mAKL9nJe+YdiYxl7uX4mATdO30KcuDrRoTxBbiHbuA"
-"qlorQn1D0opRuIhzVLm8+z8QRFlNA0683M1QYE+Lhka+kaIDvE8RHQHel4bOsMFp6lmV6D3cNhQvpG1sECm02a5tgF52reEBaYEw"
-"OhD+RQiFedTm3OQg5iq2c04kidOoDgaPNGs1VitbrhIvAuzStaWksap3jp9UrAN1O-0nAECIfSP0QHVkGWtduz6XSmJ7MsLPmPJ3"
-"hRjY7DtZXWjvtHcj9ooAXcPsI+3YgG951n7urnyB1kbQV+ZdlAbI11Y3orBMB+le8goi66fWyEX9FHpFEL32jNqSghzvyEC1227-"
-"p5t8vx19mYHbOghy5K7voWUAXsjX2gwzicmKiNJR9OrHppAbVEVzVjOuYWmwCpGWFW1DlaoOc03PWkgqvVeezQY8IiM9Rptnniwf"
-"Xa1XnMPo6ES0MHE5nwC8tT65VVw3C2peCu720i6oVvevcoMGeP3PVgvBkudifs0GNH7AaOGVFhrbE68B8sq6AH8BFvXhZfzdhb1f"
-"Y1p-GVyr3qECy393zFEq0wHg2Vls4OiVD-J0d7JFKsuhUPgdykTCWhbqkdvwUUyg7qXPvdeC09AUAszRcVsk5iihIr1+N-0ATkGU"
-"i6GPwTlzw-dALNmjbVjHOSAsWaihe303RxAmD4akSPWkjgtot17BTZfaSgaNH+ESoUGJ3GgPJqD8UBsAShIF-X0wwyFpDkTwESHg"
-"jNwUF9EpszCwj1myzqZG9hIp76G1ymz7BuZF0T5pdA1GMG8AGuRbXEtJMkHsDJoztG06Jqm-khFPydXg-VB1k+l9AMwzzvtCDacK"
-"k22WU1fByYcDpmW0Y9YF-zeZDDcQJVF8tT8cNNjt9GdIF3103ZFP8oulWCfnXETCKz3YQFsm3qOUu6GJ-lb2foo1WJqGpcCbyPmy"
-"Ib95rQLJnk56YC1KmN5zMJ831cVsERyvdPOSW8kg-2uk8m3J4zgAWAhvvBOofIjFb5yNf0shVv-JJ9f49ZFcQ+LKDFKX3iNV1E-G"
-"MxeEwbi-uGP8BGO4vGgV0IFbgswumfhk14OF3q+1qwRFpq4hr1s6zQEAgoVAW3QE4tsQpYW3JkcqDcnSOjbePZeFrFMor-o3UG2F"
-"jmw8667eXk3UiM9vq5EpyrbQxexsJ3tKy7w6lGsumfMWIlcSglkLUzicysuPgqT5Wuzn8MkGvTYve2UyunErUnD-+Qwr0rDo1tOG"
-"bbtcNNeFInx5rDK3DHahjTON3d3oTpePxioVK3sRLDh185yKMzTQv812ADCFcwvFHbetPF41f7kot00O2OMUkw4OPvuTRkhdAhgd"
-"il2SM9bunNaNHqh9Ov8Qv3SKEl1O-BwzjYF0VWjkxycswQFqQotUPw+Q-6FrCPFWvaF2CP2F319stMfD-8bHsd87KZfQ9ChereG4"
-"Z8XP8dNMipn-evkOVVFqfgN16dO8Ya9nqGFIpIW1Ljv7wOAzdZFsm5C1EuQoKzwyXDO0BDjceBsyTt40H0upG8D1N1ZP66OPIeQy"
-"oXQwI63e+NnuYA0687-d6N6rDscj+VHn2R0RUXQFZ2+EANqcqvan4y0Erpl01fAfmLaI8pmOgsRUDvuF5e9YnWNhxtSzS4fsjj1J"
-"1EIGpcw0WfiaOul1s19ZIECoLBx-#S";
-
-
- SvMemoryStream aStream;
- xub_StrLen c;
- xub_StrLen cRest = 0;
-
- xub_StrLen nIndex;
- for ( nIndex = 0 ; nIndex < aData.Len() ; nIndex++ )
- {
- if ( ( nIndex & 3 ) == 0 )
- {
- cRest = aData.GetChar( nIndex );
- cRest = aTr.Search( (sal_Char)cRest );
- }
- else
- {
- c = aData.GetChar( nIndex );
- c = aTr.Search( (sal_Char)c );
-
- c <<= 2;
- c |= ( ( cRest & 0x30 ) >> 4 );
- cRest <<= 2;
-
- aStream << sal_Char(c);
- }
- }
-
- aStream.Seek(0);
- {
- ::svt::OStringTransfer::CopyString( CUniString("\nSorry! no bitmap"), StatementList::GetFirstDocFrame() );
- }
-
- new StatementSlot( StatementList::pTTProperties->nSidPaste );
- return;
- }
- case 7:
- {
- new StatementSlot( 20384 ); // FN_TOOL_ANCHOR_CHAR from SW?
- return;
- }
- }
-
-
-
-#if OSL_DEBUG_LEVEL < 2
- delete this;
-#endif
-}
-
-IMPL_LINK( ImplRemoteControl, IdleHdl, Application*, EMPTYARG )
-{
- if( StatementList::pFirst )
- {
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "* " );
- #endif
- GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) );
- }
- return 0;
-}
-
-
-
-IMPL_LINK( ImplRemoteControl, CommandHdl, Application*, EMPTYARG )
-{
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Entering CommandHdl\n" );
-#endif
-
- if ( StatementList::MaybeResetSafeReschedule() )
- {
- StatementList::bExecuting = sal_False; // will be reset in SafeReschedule later
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "SafeReschedule has been reset\n" );
-#endif
- }
-
- if ( ( StatementList::bReadingCommands && !StatementList::bDying ) ||
- ( StatementList::bExecuting ) ||
- ( StatementList::IsInReschedule() ) )
- {
-#if OSL_DEBUG_LEVEL > 1
- if ( StatementList::bReadingCommands )
- m_pDbgWin->AddText( "Reading Commands " );
- if ( StatementList::bExecuting )
- m_pDbgWin->AddText( "In Execute " );
- if ( StatementList::IsInReschedule() )
- {
- m_pDbgWin->AddText( "In Reschedule FocusWindow: 0x" );
- m_pDbgWin->AddText(
- String::CreateFromInt64(
- sal::static_int_cast< sal_Int64 >(
- reinterpret_cast< sal_IntPtr >(GetpApp()->GetFocusWindow())),
- 16 ));
- m_pDbgWin->AddText( " " );
- }
- m_pDbgWin->AddText( "Leaving CommandHdl\n" );
-#endif
- return 0;
- }
-
- while( StatementList::pFirst && ( !StatementList::bReadingCommands || StatementList::bDying ) )
- // loops until command is not coming back,
- // is then called recursively via IdleHdl and PostUserEvent
- {
- m_bInsideExecutionLoop = sal_True;
-#ifdef TIMERIDLE
- m_aIdleTimer.Stop();
- m_aIdleTimer.Start();
-#endif
- StatementList *pC = StatementList::pFirst;
-
- if ( !StatementList::bCatchGPF )
- {
- if (!pC->CheckWindowWait() || !pC->Execute())
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Leaving CommandHdl\n" );
-#endif
- return 0;
- }
- }
- else
- {
- try
- {
- if (!pC->CheckWindowWait() || !pC->Execute())
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Leaving CommandHdl\n" );
-#endif
- return 0;
- }
- }
- catch( ... )
- {
- if ( !StatementFlow::bUseIPC )
- throw;
-
- try
- {
- ModelessDialog *pDlg = new ModelessDialog(NULL);
- pDlg->SetOutputSizePixel(Size(150,0));
- pDlg->SetText( String ( TTProperties::GetSvtResId( TT_GPF ) ) );
- pDlg->Show();
- OSL_FAIL("GPF");
- pC->ReportError( GEN_RES_STR0( S_GPF_ABORT ) );
- StatementList::bDying = sal_True;
- while ( StatementList::pFirst ) // commands are skipped
- StatementList::NormalReschedule();
- delete pDlg;
- }
- catch ( ... )
- {
- Application::Quit();
- }
- Application::Quit();
- }
- }
-
- m_bInsideExecutionLoop = sal_False;
- }
-
- StatementList::aWindowWaitUId = rtl::OString();
-
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Leaving CommandHdl\n" );
-#endif
- return 0;
-}
-
-IMPL_LINK( ImplRemoteControl, QueCommandsEvent, CommunicationLink*, pCL )
-{
- SvStream *pTemp = pCL->GetServiceData();
- QueCommands( SI_IPCCommandBlock, pTemp );
- delete pTemp;
- return 0;
-}
-
-sal_Bool ImplRemoteControl::QueCommands( sal_uLong nServiceId, SvStream *pIn )
-{
- sal_uInt16 nId;
-
- if( !m_bIdleInserted )
- {
-#ifdef TIMERIDLE
- m_aIdleTimer.SetTimeoutHdl( LINK( this, ImplRemoteControl, IdleHdl ) );
- m_aIdleTimer.SetTimeout( 500 );
- m_aIdleTimer.Start();
-#else
- GetpApp()->InsertIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ), 1 );
-#endif
- m_bIdleInserted = sal_True;
- }
-
-
- StatementList::bReadingCommands = sal_True;
-
-#if OSL_DEBUG_LEVEL > 1
- if (!m_pDbgWin->bQuiet)
- m_pDbgWin->Show();
- m_pDbgWin->AddText( "Reading " );
- m_pDbgWin->AddText( String::CreateFromInt64( nServiceId ) );
- m_pDbgWin->AddText( " :\n" );
-#endif
-
- if( nServiceId != SI_IPCCommandBlock && nServiceId != SI_DirectCommandBlock )
- {
- OSL_TRACE( "Ungültiger Request :%i", (int)nServiceId );
- return sal_False;
- }
-
- SCmdStream *pCmdStream = new SCmdStream(pIn);
-
- pCmdStream->Read( nId );
- while( !pIn->IsEof() )
- {
- switch( nId )
- {
- case SICommand:
- {
- new StatementCommand( pCmdStream );
- break;
- }
- case SIControl:
- case SIStringControl:
- {
- new StatementControl( pCmdStream, nId );
- break;
- }
- case SISlot:
- {
- new StatementSlot( pCmdStream );
- break;
- }
- case SIUnoSlot:
- {
- new StatementUnoSlot( pCmdStream );
- break;
- }
- case SIFlow:
- {
- new StatementFlow( nServiceId, pCmdStream, this );
- break;
- }
- default:
- OSL_TRACE( "Unbekannter Request Nr:%i", nId );
- break;
- }
- if( !pIn->IsEof() )
- pCmdStream->Read( nId );
- else {
- OSL_FAIL( "truncated input stream" );
- }
- }
-
- StatementList::bReadingCommands = sal_False;
-
- delete pCmdStream;
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Done Reading " );
- m_pDbgWin->AddText( String::CreateFromInt64( nServiceId ) );
- m_pDbgWin->AddText( " :\n" );
-#endif
- if ( !m_bInsideExecutionLoop )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Posting Event for CommandHdl.\n" );
-#endif
-
- GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) );
- }
- return sal_True;
-}
-
-
-SvStream* ImplRemoteControl::GetReturnStream()
-{
- SvStream* pTemp = pRetStream;
- pRetStream = NULL;
- return pTemp;
-}
-
-ImplRemoteControl::ImplRemoteControl()
-: m_bIdleInserted( sal_False )
-, m_bInsideExecutionLoop( sal_False )
-#if OSL_DEBUG_LEVEL > 1
-, m_pDbgWin(NULL)
-#endif
-, pRetStream(NULL)
-{
-#if OSL_DEBUG_LEVEL > 1
- if ( RemoteControlCommunicationManager::GetPort() != TT_NO_PORT_DEFINED || RemoteControlCommunicationManager::nComm )
- {
- m_pDbgWin = new EditWindow( NULL, CUniString("Debug Window"), WB_VSCROLL );
- m_pDbgWin->bQuiet = sal_True;
- m_pDbgWin->Hide();
- m_pDbgWin->bQuiet = sal_False;
- m_pDbgWin->Show();
-
- StatementList::m_pDbgWin = m_pDbgWin;
- }
-#endif
- if ( RemoteControlCommunicationManager::GetPort() == TT_NO_PORT_DEFINED )
- pServiceMgr = NULL;
- else
- {
-#if OSL_DEBUG_LEVEL > 1
- pServiceMgr = new RemoteControlCommunicationManager( m_pDbgWin );
-#else
- pServiceMgr = new RemoteControlCommunicationManager();
-#endif
- pServiceMgr->SetDataReceivedHdl( LINK( this, ImplRemoteControl, QueCommandsEvent ) );
- pServiceMgr->StartCommunication();
-
-#ifdef DBG_UTIL
- DbgSetPrintTestTool( TestToolDebugPrint );
- // first change it, so we get the original Pointer
- StatementCommand::pOriginal_osl_DebugMessageFunc = osl_setDebugMessageFunc( osl_TestToolDebugPrint );
- if ( DbgGetErrorOut() != DBG_OUT_TESTTOOL )
- osl_setDebugMessageFunc( StatementCommand::pOriginal_osl_DebugMessageFunc );
-#endif
- }
- if ( RemoteControlCommunicationManager::nComm )
- new ExtraIdle( this ); // resumes editing
-}
-
-ImplRemoteControl::~ImplRemoteControl()
-{
- if ( MacroRecorder::HasMacroRecorder() )
- MacroRecorder::GetMacroRecorder()->SetActionRecord( sal_False ); // Will delete MacroRecorder if necessary
-
-
- StatementList::bDying = sal_True;
-#if OSL_DEBUG_LEVEL > 1
- if ( m_pDbgWin )
- m_pDbgWin->bQuiet = sal_True; // no more output in the debugwindow
-#endif
-
-#ifdef DBG_UTIL
- // reset so that the following assertions are not lost
- DbgSetPrintTestTool( NULL );
- osl_setDebugMessageFunc( StatementCommand::pOriginal_osl_DebugMessageFunc );
-#endif
-
- if ( StatementList::pFirst )
- {
- StatementList::pFirst->ReportError( GEN_RES_STR0( S_APP_SHUTDOWN ) );
- while ( StatementList::pFirst )
- StatementList::NormalReschedule();
- }
-
- if ( pServiceMgr )
- pServiceMgr->StopCommunication();
-
- if ( GetTTSettings()->pDisplayHidWin )
- {
- delete (Window*)(GetTTSettings()->pDisplayHidWin);
- GetTTSettings()->pDisplayHidWin = NULL;
- }
- if ( GetTTSettings()->pTranslateWin )
- {
- delete (Window*)(GetTTSettings()->pTranslateWin);
- GetTTSettings()->pTranslateWin = NULL;
- }
-#if OSL_DEBUG_LEVEL > 1
- delete m_pDbgWin;
-#endif
- if( m_bIdleInserted )
- {
-#ifdef TIMERIDLE
- m_aIdleTimer.Stop();
-#else
- GetpApp()->RemoveIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ) );
-#endif
- m_bIdleInserted = sal_False;
- }
- delete pServiceMgr;
-}
-
-RemoteControl::RemoteControl()
-{
- pImpl = new ImplRemoteControl;
-}
-
-RemoteControl::~RemoteControl()
-{
- delete pImpl;
-}
-
-static ::osl::Mutex aMutex;
-static RemoteControl* pRemoteControl = 0;
-extern "C" void CreateRemoteControl()
-{
- if ( !pRemoteControl )
- {
- ::osl::MutexGuard aGuard( aMutex );
- if ( !pRemoteControl )
- pRemoteControl = new RemoteControl();
- }
-}
-
-extern "C" void DestroyRemoteControl()
-{
- ::osl::MutexGuard aGuard( aMutex );
- delete pRemoteControl;
- pRemoteControl = 0;
-}
-
-extern "C" void CreateEventLogger()
-{
- MacroRecorder::GetMacroRecorder()->SetActionLog();
-}
-
-extern "C" void DestroyEventLogger()
-{
- MacroRecorder::GetMacroRecorder()->SetActionLog( sal_False ); // Will delete MacroRecorder if necessary
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/server.hxx b/automation/source/server/server.hxx
deleted file mode 100644
index fcadf8dfcd49..000000000000
--- a/automation/source/server/server.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SERVER_HXX
-#define _SERVER_HXX
-
-#include "editwin.hxx"
-#include <automation/communi.hxx>
-
-#define TT_PORT_NOT_INITIALIZED sal_uLong(0xFFFFFFFF)
-#define TT_NO_PORT_DEFINED 0
-
-class RemoteControlCommunicationManager : public CommunicationManagerServerViaSocket
-{
-#if OSL_DEBUG_LEVEL > 1
- EditWindow *m_pDbgWin;
-#endif
- String aOriginalWinCaption;
- String aAdditionalWinCaption;
- sal_Bool bIsPortValid;
- DECL_LINK( SetWinCaption, Timer* = NULL);
- Timer* pTimer;
- virtual void InfoMsg( InfoString aMsg );
- static sal_uLong nPortIs;
- static sal_Bool bQuiet;
-
-public:
-#if OSL_DEBUG_LEVEL > 1
- RemoteControlCommunicationManager( EditWindow * pDbgWin );
-#else
- RemoteControlCommunicationManager();
-#endif
- ~RemoteControlCommunicationManager();
-
- virtual void ConnectionOpened( CommunicationLink* pCL );
- virtual void ConnectionClosed( CommunicationLink* pCL );
-
- static sal_uLong GetPort();
- static sal_uInt16 nComm;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/sta_list.cxx b/automation/source/server/sta_list.cxx
deleted file mode 100644
index 25799294b43c..000000000000
--- a/automation/source/server/sta_list.cxx
+++ /dev/null
@@ -1,1188 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <tools/time.hxx>
-#include <vcl/splitwin.hxx>
-#include <vcl/wrkwin.hxx>
-#include <basic/ttstrhlp.hxx>
-#include "statemnt.hxx"
-
-#include "retstrm.hxx"
-#include "rcontrol.hxx"
-
-#if OSL_DEBUG_LEVEL > 1
-#include "editwin.hxx"
-#endif
-
-#include "profiler.hxx"
-#include <vcl/floatwin.hxx>
-#include <vcl/toolbox.hxx>
-
-// only needed for dynamic_cast in wintree
-#include <svtools/editbrowsebox.hxx>
-#include <svtools/valueset.hxx>
-#include <svtools/roadmap.hxx>
-#include <svtools/extensionlistbox.hxx>
-#include <svtools/table/tablecontrol.hxx>
-
-#define WINDOW_ANYTYPE WINDOW_BASE
-
-
-TTProfiler *StatementList::pProfiler = NULL;
-StatementList *StatementList::pFirst = NULL;
-sal_Bool StatementList::bReadingCommands = sal_False;
-sal_Bool StatementList::bIsInReschedule = sal_False;
-sal_uInt16 StatementList::nModalCount = 0;
-Window *StatementList::pLastFocusWindow = NULL;
-sal_Bool StatementList::bWasDragManager = sal_False;
-sal_Bool StatementList::bWasPopupMenu = sal_False;
-sal_Bool StatementList::bBasicWasRunning = sal_False;
-RetStream *StatementList::pRet = NULL;
-sal_Bool StatementList::IsError = sal_False;
-sal_Bool StatementList::bDying = sal_False;
-sal_Bool StatementList::bExecuting = sal_False;
-StatementList *StatementList::pCurrentProfileStatement = NULL;
-sal_Bool StatementList::bUsePostEvents = sal_True;
-#if OSL_DEBUG_LEVEL > 1
-EditWindow *StatementList::m_pDbgWin;
-#endif
-
-
-rtl::OString StatementList::aWindowWaitUId = rtl::OString();
-Window *StatementList::pWindowWaitPointer = NULL;
-rtl::OString StatementList::aWindowWaitOldHelpId = rtl::OString();
-rtl::OString StatementList::aWindowWaitOldUniqueId = rtl::OString();
-sal_uInt16 StatementList::nUseBindings = 0;
-
-sal_uInt16 StatementList::aSubMenuId1 = 0;
-sal_uInt16 StatementList::aSubMenuId2 = 0;
-sal_uInt16 StatementList::aSubMenuId3 = 0;
-SystemWindow *StatementList::pMenuWindow = NULL;
-TTProperties *StatementList::pTTProperties = NULL;
-
-sal_uInt16 StatementList::nMinTypeKeysDelay = 0;
-sal_uInt16 StatementList::nMaxTypeKeysDelay = 0;
-sal_Bool StatementList::bDoTypeKeysDelay = sal_False;
-
-Window* StatementList::pFirstDocFrame = NULL;
-
-sal_Bool StatementList::bIsSlotInExecute = sal_False;
-
-sal_Bool StatementList::bCatchGPF = sal_True;
-
-static TTSettings* pTTSettings = NULL;
-
-TTSettings* GetTTSettings()
-{
- if ( !pTTSettings )
- {
- pTTSettings = new TTSettings;
-
- // DisplayHID
- pTTSettings->pDisplayInstance = NULL;
- pTTSettings->pDisplayHidWin = NULL;
- pTTSettings->Old = NULL;
- pTTSettings->Act = NULL;
- pTTSettings->aOriginalCaption.Erase();
-
- // Translate
- pTTSettings->pTranslateWin = NULL;
- pTTSettings->bToTop = sal_True;
- }
-
- return pTTSettings;
-}
-
-// FIXME: HELPID
-#define IS_WINP_CLOSING(pWin) \
- (pWin->GetHelpId().equalsL(RTL_CONSTASCII_STRINGPARAM("TT_Win_is_closing_HID")) && \
- pWin->GetUniqueId().equalsL(RTL_CONSTASCII_STRINGPARAM("TT_Win_is_closing_UID")))
-
-StatementList::StatementList()
-: nRetryCount(MAX_RETRIES)
-, bStatementInQue(sal_False)
-{
- if (!pRet)
- pRet = new RetStream; // as late as possible but still central and at any rate early enough because pRet is private
-}
-
-void StatementList::InitProfile()
-{
- if ( pProfiler )
- {
- if ( pProfiler->IsProfilingPerCommand() || pProfiler->IsPartitioning() )
- pProfiler->StartProfileInterval( pCurrentProfileStatement != this );
-
-#if OSL_DEBUG_LEVEL > 1
- if ( pCurrentProfileStatement != NULL && pCurrentProfileStatement != this )
- pRet->GenReturn( RET_ProfileInfo, 0, CUniString("InitProfile von anderem Statement gerufen ohne SendProfile\n") );
-#endif
- pCurrentProfileStatement = this;
- }
-}
-
-void StatementList::SendProfile( String aText )
-{
- if ( pProfiler )
- {
- if ( pCurrentProfileStatement == this )
- {
- if ( pProfiler->IsProfilingPerCommand() || pProfiler->IsPartitioning() )
- pProfiler->EndProfileInterval();
-
- if ( pProfiler->IsProfilingPerCommand() )
- pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileLine( aText ) );
-
- if ( pProfiler->IsPartitioning() )
- // FIXME: HELPID
- pRet->GenReturn( RET_ProfileInfo, S_ProfileTime, static_cast<comm_UINT32>(pProfiler->GetPartitioningTime()) ); // GetPartitioningTime() sal_uLong != comm_UINT32 on 64bit
- }
-
- if ( pProfiler->IsAutoProfiling() )
- pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() );
-
-#if OSL_DEBUG_LEVEL > 1
- if ( pCurrentProfileStatement == NULL )
- pRet->GenReturn( RET_ProfileInfo, 0, CUniString("SendProfile ohne InitProfile\n") );
-#endif
- pCurrentProfileStatement = NULL;
- }
-}
-
-void StatementList::QueStatement(StatementList *pAfterThis)
-{
- DBG_ASSERT(!bStatementInQue,"QueStatement f�r bereits eingetragenes Statement -> Abgebrochen");
- if ( bStatementInQue )
- return;
-
- bStatementInQue = sal_True;
- if ( pAfterThis )
- {
- if ( pAfterThis->bStatementInQue )
- {
- pNext = pAfterThis->pNext;
- pAfterThis->pNext = this;
- }
- else
- { // pAfterThis not in que -> already dequed -> add to front of list
- pNext = pFirst;
- pFirst = this;
- }
- }
- else // insert at the end
- {
- pNext = NULL;
- if( !pFirst )
- pFirst = this;
- else
- {
- StatementList *pList;
- pList = pFirst;
- while( pList->pNext )
- pList = pList->pNext;
- pList->pNext = this;
- }
- }
-}
-
-void StatementList::Advance()
-{ // pFirst ist static!
- pFirst = pNext;
- bStatementInQue = sal_False;
- pNext = NULL;
-}
-
-
-StatementList::~StatementList()
-{
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Deleting \n" );
-#endif
- DBG_ASSERT(!bReadingCommands,"Deleting commands while reading them!");
-}
-
-Window* StatementList::GetDocWin( sal_uInt16 nNr )
-{
- Window* pBase = Application::GetFirstTopLevelWindow();
-
- while ( pBase )
- {
- if ( IsDocWin( pBase ) )
- {
- if ( !nNr )
- return pBase;
- nNr--;
- }
- pBase = Application::GetNextTopLevelWindow( pBase );
- }
- return NULL;
-}
-
-sal_uInt16 StatementList::GetDocFrameCount()
-{
- Window* pBase = Application::GetFirstTopLevelWindow();
- sal_uInt16 nCount = 0;
-
- while ( pBase )
- {
- if ( IsDocFrame( pBase ) )
- nCount++;
- pBase = Application::GetNextTopLevelWindow( pBase );
- }
- return nCount;
-}
-
-sal_uInt16 StatementList::GetDocWinCount()
-{
- Window* pBase = Application::GetFirstTopLevelWindow();
- sal_uInt16 nCount = 0;
-
- while ( pBase )
- {
- if ( IsDocWin( pBase ) )
- nCount++;
- pBase = Application::GetNextTopLevelWindow( pBase );
- }
- return nCount;
-}
-
-Window* StatementList::SearchAllWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase )
-{
-
- if ( !pBase && !aSearch.HasSearchFlag( SEARCH_NO_TOPLEVEL_WIN ) )
- {
- sal_Bool bSearchFocusFirst = aSearch.HasSearchFlag( SEARCH_FOCUS_FIRST );
-
- Window *pControl = NULL;
- if ( bSearchFocusFirst )
- {
- // first test Parent of Focus Window
- pBase = Application::GetFocusWindow();
- if ( pBase )
- {
- DBG_ASSERT( WinPtrValid( pBase ), "GetFocusWindow is no valid WindowPointer" );
- Window *pPParent = pBase;
- while ( pPParent->GET_REAL_PARENT() )
- pPParent = pPParent->GET_REAL_PARENT();
-
- // get overlap window. Will be dialog else document itself
- pBase = pBase->GetWindow( WINDOW_OVERLAP );
-
- // set flag to find disabled elements.
- // This is better than an enabled one on another Window
- aSearch.AddSearchFlags( SEARCH_FIND_DISABLED );
-
- // search on current Dialog first
- pControl = SearchAllWin( pBase, aSearch );
-
- // search on current Document
- if ( !pControl && pBase != pPParent )
- pControl = SearchAllWin( pPParent, aSearch );
-
- aSearch.RemoveSearchFlags( SEARCH_FIND_DISABLED );
-
- if ( pControl )
- return pControl;
- }
- }
-
- pBase = Application::GetFirstTopLevelWindow();
-
- while ( pBase )
- {
- pControl = SearchAllWin( pBase, aSearch );
- if ( pControl )
- return pControl;
-
- pBase = Application::GetNextTopLevelWindow( pBase );
- }
- return NULL;
- }
-
-
- Window *pResult = NULL;
- pResult = SearchClientWin( pBase, aSearch, MaybeBase );
- if ( pResult )
- return pResult;
-
- if ( !aSearch.HasSearchFlag( SEARCH_NOOVERLAP ) )
- {
- if ( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) )
- pResult = SearchAllWin( pBase->GetWindow( WINDOW_FIRSTOVERLAP ), aSearch );
-
- if ( !pResult && pBase->GetWindow( WINDOW_NEXT ) )
- pResult = SearchAllWin( pBase->GetWindow( WINDOW_NEXT ), aSearch );
- }
-
- return pResult;
-}
-
-
-Window* StatementList::SearchClientWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase )
-{
- if ( !pBase )
- return NULL;
-
- if ( MaybeBase && aSearch.IsWinOK( pBase ) )
- return pBase;
-
- Window *pResult = NULL;
-
- sal_uInt16 i;
- for( i = 0 ; i < pBase->GetChildCount() && !pResult; i++ )
- pResult = SearchClientWin( pBase->GetChild(i), aSearch );
-
- return pResult;
-}
-
-
-sal_Bool SearchUID::IsWinOK( Window *pWin )
-{
- if ( aUId.equals( pWin->GetUniqueOrHelpId() ) )
- {
- if ( ( pWin->IsEnabled() || HasSearchFlag( SEARCH_FIND_DISABLED ) ) && pWin->IsVisible() )
- return sal_True;
- else
- {
- if ( !pMaybeResult )
- pMaybeResult = pWin;
- return sal_False;
- }
- }
- else if ( pWin->GetType() == WINDOW_TOOLBOX ) // Buttons and Controls on ToolBox.
- {
- ToolBox *pTB = ((ToolBox*)pWin);
- sal_uInt16 i;
- for ( i = 0; i < pTB->GetItemCount() ; i++ )
- {
- if ( aUId.equals( Str2Id( pTB->GetItemCommand(pTB->GetItemId( i )) ) ) || aUId.equals( pTB->GetHelpId(pTB->GetItemId( i )) ) )
- { // ID matches.
- Window *pItemWin;
- pItemWin = pTB->GetItemWindow( pTB->GetItemId( i ) );
-
- if ( bSearchButtonOnToolbox && pTB->GetItemType( i ) == TOOLBOXITEM_BUTTON && !pItemWin )
- { // We got a Control, see if its valid also.
- // Same as above.
- if ( ( pTB->IsEnabled() || HasSearchFlag( SEARCH_FIND_DISABLED ) ) && pTB->IsVisible() )
- { // We got a Button, see if its valid also.
- if ( ( pTB->IsItemEnabled(pTB->GetItemId(i)) || HasSearchFlag( SEARCH_FIND_DISABLED ) )
- && pTB->IsItemVisible(pTB->GetItemId(i)) )
- return sal_True; // We got a Button.
- else
- { // better a disabled Button on a valid ToolBox than an invalid ToolBox as below
- pMaybeResult = pTB;
- return sal_False;
- }
- }
- else if ( !pMaybeResult )
- { // invalid ToolBox
- pMaybeResult = pTB;
- return sal_False;
- }
- }
- if ( pItemWin )
- { // We got a Control, see if its valid also.
- // Same as above.
- if ( ( pItemWin->IsEnabled() || HasSearchFlag( SEARCH_FIND_DISABLED ) ) && pItemWin->IsVisible() )
- {
- if ( !pAlternateResult ) // only take the first found ItemWindow #i35365
- pAlternateResult = pItemWin; // since we cannot return a Window here
- return sal_False; // continue searching to prefer a window with the right ID #i32292
- }
- else if ( !pMaybeResult )
- {
- pMaybeResult = pItemWin;
- return sal_False;
- }
- }
- }
- }
- return sal_False;
- }
- else
- return sal_False;
-}
-
-Window* StatementList::SearchTree( rtl::OString aUId ,sal_Bool bSearchButtonOnToolbox )
-{
- SearchUID aSearch(aUId,bSearchButtonOnToolbox);
-
- Window *pResult = SearchAllWin( NULL, aSearch );
- if ( pResult )
- return pResult;
- else if ( aSearch.GetAlternateResultWin() )
- return aSearch.GetAlternateResultWin();
- else
- return aSearch.GetMaybeWin();
-}
-
-
-sal_Bool SearchWinPtr::IsWinOK( Window *pWin )
-{
- return pWin == pTest;
-}
-
-sal_Bool StatementList::WinPtrValid(Window *pTest)
-{
- SearchWinPtr aSearch( pTest );
- return SearchAllWin( NULL, aSearch ) != NULL;
-}
-
-
-sal_Bool SearchRT::IsWinOK( Window *pWin )
-{
- if ( pWin->IsVisible() && pWin->GetType() == mnRT )
- {
- mnCount++;
- if ( mnSkip )
- {
- mnSkip--;
- return sal_False;
- }
- else
- return sal_True;
- }
- return sal_False;
-}
-
-Window* StatementList::GetWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase, sal_uInt16 nSkip, sal_Bool bSearchAll )
-{
- SearchRT aSearch( nRT, 0, nSkip );
- if ( bSearchAll )
- aSearch.AddSearchFlags( SEARCH_FOCUS_FIRST | SEARCH_FIND_DISABLED );
- else
- aSearch.AddSearchFlags( SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN );
-
- return SearchAllWin( pBase, aSearch, MaybeBase );
-}
-
-sal_uInt16 StatementList::CountWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase )
-{
- SearchRT aSearch( nRT, SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN, 0xFFFF );
-
- SearchAllWin( pBase, aSearch, MaybeBase );
- return aSearch.GetCount();
-}
-
-sal_Bool SearchScroll::IsWinOK( Window *pWin )
-{
- if ( SearchRT::IsWinOK( pWin ) )
- {
- DBG_ASSERT( pWin->GetStyle() & ( WB_HORZ | WB_VERT ), "Nither WB_HORZ nor WB_VERT set on ScrollBar");
- return (( pWin->GetStyle() & WB_HORZ ) && ( nDirection == CONST_ALIGN_BOTTOM ))
- || (( pWin->GetStyle() & WB_VERT ) && ( nDirection == CONST_ALIGN_RIGHT ));
- }
- return sal_False;
-}
-
-ScrollBar* StatementList::GetScrollBar( Window *pBase, sal_uInt16 nDirection, sal_Bool MaybeBase )
-{
- SearchScroll aSearch( nDirection, SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN );
-
- return (ScrollBar*)SearchAllWin( pBase, aSearch, MaybeBase );
-}
-
-
-sal_Bool SearchPopupFloatingWin::IsWinOK( Window *pWin )
-{
- return pWin->IsVisible() && pWin->GetType() == WINDOW_FLOATINGWINDOW && ((FloatingWindow*)pWin)->IsInPopupMode();
-}
-
-Window* StatementList::GetPopupFloatingWin( sal_Bool MaybeBase )
-{
- SearchPopupFloatingWin aSearch;
-
- return SearchAllWin( NULL, aSearch, MaybeBase );
-}
-
-
-Menu* StatementList::GetMatchingMenu( Window* pWin, Menu* pBaseMenu )
-{
- if ( pBaseMenu )
- {
- if ( pBaseMenu->GetWindow() == pWin )
- return pBaseMenu;
-
- sal_uInt16 i;
- i = 0;
- while ( i < pBaseMenu->GetItemCount() )
- {
- PopupMenu* pPopup = pBaseMenu->GetPopupMenu( pBaseMenu->GetItemId( i ) );
- if ( pPopup && pPopup->GetWindow() )
- {
- if ( pPopup->GetWindow() == pWin )
- return pPopup;
- else
- {
- pBaseMenu = pPopup;
- i = 0;
- }
- }
- else
- i++;
- }
- }
- else
- {
- if ( PopupMenu::GetActivePopupMenu() )
- {
- Menu* pMenu = GetMatchingMenu( pWin, PopupMenu::GetActivePopupMenu() );
- if ( pMenu )
- return pMenu;
- }
-
- sal_uInt16 nSkip = 0;
- Window* pMenuBarWin = NULL;
- while ( (pMenuBarWin = GetWinByRT( NULL, WINDOW_MENUBARWINDOW, sal_True, nSkip++, sal_True )) != NULL )
- {
- Window* pParent = pMenuBarWin->GET_REAL_PARENT();
- if ( pParent && pParent->GetType() == WINDOW_BORDERWINDOW && pParent->IsVisible() )
- {
- Menu* pMenu = NULL;
- // find Menu of MenuBarWindow
- sal_uInt16 nCount;
- for ( nCount = 0 ; nCount < pParent->GetChildCount() ; nCount++ )
- {
- if ( pParent->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW )
- pMenu = ((WorkWindow*)(pParent->GetChild( nCount )))->GetMenuBar();
- }
- if ( pMenu )
- {
- // check for menu bar in Task Window
- if ( pMenuBarWin == pWin )
- return pMenu;
-
- // search submenues
- pMenu = GetMatchingMenu( pWin, pMenu );
- if ( pMenu )
- return pMenu;
- }
- }
- }
- }
- return NULL;
-}
-
-
-sal_Bool SearchActive::IsWinOK( Window *pWin )
-{
- // only matches ResID due to problems with UNIX Window Managers
- return pWin->IsVisible() && ( (nRT == WINDOW_ANYTYPE && IsDialog(pWin) ) || pWin->GetType() == nRT );
-}
-
-Window* StatementList::GetActive( WindowType nRT, sal_Bool MaybeBase )
-{
- SearchActive aSearch( nRT );
-
- return SearchAllWin( NULL, aSearch, MaybeBase );
-}
-
-sal_Bool SearchFadeSplitWin::IsWinOK( Window *pWin )
-{
-#if OSL_DEBUG_LEVEL > 1
- if ( pWin->GetType() == WINDOW_SPLITWINDOW )
- {
- sal_Bool bResult;
- WindowAlign aAlign;
- bResult = pWin->IsVisible();
- bResult = ((SplitWindow*)pWin)->IsFadeInButtonVisible();
- bResult = ((SplitWindow*)pWin)->IsFadeOutButtonVisible();
- bResult = ((SplitWindow*)pWin)->IsAutoHideButtonVisible();
- aAlign = ((SplitWindow*)pWin)->GetAlign();
- }
-#endif
- return pWin->IsVisible() && ( pWin->GetType() == WINDOW_SPLITWINDOW )
- && (((SplitWindow*)pWin)->IsFadeInButtonVisible() || ((SplitWindow*)pWin)->IsFadeOutButtonVisible() )
- /*&& ((SplitWindow*)pWin)->IsAutoHideButtonVisible()*/ && ((SplitWindow*)pWin)->GetAlign() == nAlign;
-}
-
-Window* StatementList::GetFadeSplitWin( Window *pBase, WindowAlign nAlign, sal_Bool MaybeBase )
-{
- SearchFadeSplitWin aSearch( nAlign );
-
- if ( GetpApp()->GetAppWindow() == pBase && pBase->GetType() != WINDOW_BORDERWINDOW )
- pBase = pBase->GetWindow( WINDOW_OVERLAP );
-
- return SearchAllWin( pBase, aSearch, MaybeBase );
-}
-
-Window* StatementList::GetMouseWin()
-{
- Window *pBase = Application::GetFirstTopLevelWindow();
- Window *pControl = NULL;
- while ( pBase )
- {
- Window *pBaseFrame = pBase->GetWindow( WINDOW_OVERLAP );
-
- Point aP = pBaseFrame->GetPointerPosPixel();
- pControl = pBaseFrame->FindWindow( aP );
- if ( pControl )
- return pControl;
-
- pBase = Application::GetNextTopLevelWindow( pBase );
- }
- return NULL;
-}
-
-Window* StatementList::GetFocus( WindowType nRT, sal_Bool MaybeBase )
-{
-
- if ( nRT == WINDOW_TABCONTROL )
- {
- Window *pResult = GetActive( WINDOW_TABDIALOG, MaybeBase);
- for( sal_uInt16 i = 0 ; pResult && i < pResult->GetChildCount(); i++ )
- if ( pResult->GetChild(i)->GetType() == nRT )
- return pResult->GetChild(i);
- }
-
- return NULL;
-}
-
-Window* StatementList::GetAnyActive( sal_Bool MaybeBase )
-{
- Window *pControl;
-
- pControl = GetActive( WINDOW_MESSBOX, MaybeBase);
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_INFOBOX, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_WARNINGBOX, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_ERRORBOX, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_QUERYBOX, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_BUTTONDIALOG, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_FILEDIALOG, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_PATHDIALOG, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_PRINTDIALOG, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_PRINTERSETUPDIALOG, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetActive( WINDOW_COLORDIALOG, MaybeBase);
- }
- if ( !pControl )
- {
- pControl = GetFocus( WINDOW_TABCONTROL, MaybeBase);
- }
-
- return pControl;
-}
-
-void StatementList::SetFirstDocFrame( Window* pWin )
-{
- DBG_ASSERT( IsDocFrame( pWin ), "Non Document Frame set as first Document Frame" );
- pFirstDocFrame = pWin;
-}
-
-Window* StatementList::GetFirstDocFrame()
-{
-
- if ( pFirstDocFrame && !WinPtrValid( pFirstDocFrame ) )
- pFirstDocFrame = NULL;
- if ( pFirstDocFrame && !pFirstDocFrame->IsVisible() )
- pFirstDocFrame = NULL;
- if ( pFirstDocFrame && !IsDocFrame( pFirstDocFrame ) )
- pFirstDocFrame = NULL;
- if ( !pFirstDocFrame )
- {
- Window* pBase = Application::GetFirstTopLevelWindow();
- while ( pBase && !IsDocFrame( pBase ) )
- pBase = Application::GetNextTopLevelWindow( pBase );
-
- if ( pBase )
- SetFirstDocFrame( pBase );
-
- if ( !pBase ) // find just something
- {
- pBase = Application::GetFirstTopLevelWindow();
- while ( pBase && !pBase->IsVisible() )
- pBase = Application::GetNextTopLevelWindow( pBase );
-
- return pBase; // just for now, later we will hopefully have a Window
- }
- }
- return pFirstDocFrame;
-}
-
-sal_Bool StatementList::IsFirstDocFrame( Window* pWin )
-{
- return pWin && ( pWin == GetFirstDocFrame() || ( GetFirstDocFrame() && pWin == GetFirstDocFrame()->GetWindow( WINDOW_CLIENT ) ) ) && ( GetFirstDocFrame() && IsDocFrame( GetFirstDocFrame() ) );
-}
-
-MenuBar* StatementList::GetDocFrameMenuBar( Window* pWin )
-{
- if ( pWin && pWin->IsVisible() && pWin->GetType() == WINDOW_BORDERWINDOW )
- {
- sal_uInt16 nCount;
- for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ )
- {
- if ( pWin->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW )
- return ((WorkWindow*)(pWin->GetChild( nCount )))->GetMenuBar();
- }
- }
- return NULL;
-}
-
-// a Doc Frame is a Document or the Backing Window
-sal_Bool StatementList::IsDocFrame( Window* pWin )
-{
- if ( pWin && pWin->IsVisible() && pWin->GetType() == WINDOW_BORDERWINDOW )
- {
- sal_uInt16 nCount;
- sal_Bool bHasWorkWindow = sal_False;
- sal_Bool bHasMenuBar = sal_False;
- // #91724# it is now necessary to sort out the IME WIndow in Solaris as well.
- // so now we check for existence of WINDOW_WORKWINDOW and newly for
- // WINDOW_MENUBARWINDOW which contains the Menu and the close/min/max buttons
- for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ )
- {
- if ( pWin->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW )
- bHasWorkWindow = sal_True;
- if ( pWin->GetChild( nCount )->GetType() == WINDOW_MENUBARWINDOW )
- bHasMenuBar = sal_True;
- }
- return bHasWorkWindow && bHasMenuBar;
- }
- return sal_False;
-}
-
-// a Doc Win is a real document (not the Backing Window)
-sal_Bool StatementList::IsDocWin( Window* pWin )
-{
- if ( pWin && IsDocFrame( pWin ) )
- {
- if ( GetDocFrameCount() != 1 )
- return sal_True;
- else
- {
- // check for the close button to see if we are the last one or only the backing Window
- if ( GetDocFrameMenuBar( pWin ) )
- return GetDocFrameMenuBar( pWin )->HasCloser();
- }
- }
- return sal_False;
-}
-
-sal_Bool StatementList::IsIMEWin( Window* pWin ) // Input Window for CJK under Solaris
-{
- if ( pWin && pWin->IsVisible() && pWin->GetType() == WINDOW_BORDERWINDOW )
- {
- sal_uInt16 nCount;
- sal_Bool bHasWorkWindow = sal_False;
- sal_Bool bHasWindow = sal_False;
- // #91724# it is now necessary to sort out the IME WIndow in Solaris as well.
- // so now we check for existence of WINDOW_WORKWINDOW and newly for
- // WINDOW_WINDOW which contains the Menu and the close/min/max buttons
- for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ )
- if ( pWin->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW )
- bHasWorkWindow = sal_True;
- for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ )
- if ( pWin->GetChild( nCount )->GetType() == WINDOW_WINDOW )
- bHasWindow = sal_True;
- return bHasWorkWindow && !bHasWindow;
- }
- return sal_False;
-}
-
-UniString StatementList::Tree(Window *pBase, int Indent)
-{
-
- String aReturn, aSep;
- if ( !pBase )
- {
- aSep.AssignAscii("============================\n");
- aSep.ConvertLineEnd();
- pBase = Application::GetFirstTopLevelWindow();
- while ( pBase )
- {
- Window *pBaseFrame = pBase->GetWindow( WINDOW_OVERLAP );
-
- aReturn += aSep;
- aReturn += Tree( pBaseFrame, Indent+1 );
-
- pBase = Application::GetNextTopLevelWindow( pBase );
- }
- return aReturn;
- }
-
-
- aSep.AssignAscii("----------------------------\n");
- aSep.ConvertLineEnd();
-
- aReturn += ClientTree( pBase, Indent );
-
- if ( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) )
- {
- aReturn += aSep;
- aReturn += Tree( pBase->GetWindow( WINDOW_FIRSTOVERLAP ), Indent+1 );
- }
-
- if ( pBase->GetWindow( WINDOW_NEXT ) )
- {
- aReturn += aSep;
- aReturn += Tree( pBase->GetWindow( WINDOW_NEXT ), Indent );
- }
-
- return aReturn;
-}
-
-String StatementList::ClientTree(Window *pBase, int Indent)
-{
-#if OSL_DEBUG_LEVEL > 1
-#define WRITE(Text) { m_pDbgWin->AddText(Text); aReturn += Text; }
-#define WRITEc(Text) { m_pDbgWin->AddText(Text); aReturn.AppendAscii(Text); }
-#else
-#define WRITE(Text) { aReturn += Text; }
-#define WRITEc(Text) { aReturn.AppendAscii(Text); }
-#endif
-
- String sIndent,aText,aReturn;
- sIndent.Expand(sal::static_int_cast< xub_StrLen >(2*Indent));
-
- aText = pBase->GetText();
-
-
- UniString t1,t2;t1 = CUniString("\n"); t2 = CUniString("\\n");
- aText.SearchAndReplaceAll(t1,t2 );
-
- WRITE(sIndent);
-
- if (pBase->IsDialog())
- {
- WRITEc("*(Dialog(TH))");
- }
- if (IsDialog( pBase ))
- {
- WRITEc("*(Dialog(GH))");
- }
- if (pBase->HasFocus())
- {
- WRITEc("*(Focus)");
- }
- if (!pBase->IsEnabled())
- {
- WRITEc("*(Disab)");
- }
- if (pBase->IsVisible())
- {
- WRITEc("*(Visible)");
- }
- if ( IsDialog(pBase) && ((SystemWindow*)pBase)->IsActive() )
- {
- WRITEc("*(Active)");
- }
- if ( pBase->GetStyle() & WB_CLOSEABLE )
- {
- WRITEc("*(Closable)");
- }
- if ( pBase->GetType() == WINDOW_DOCKINGWINDOW &&
- ((((DockingWindow*)pBase)->GetFloatStyle()) & WB_CLOSEABLE) )
- {
- WRITEc("*(Closable Docking in Floatingstyle)");
- }
- if ( pBase->GetStyle() & WB_DOCKABLE )
- {
- WRITEc("*(Dockable)");
- }
- if ( pBase->GetType() == WINDOW_SPLITWINDOW &&
- (((SplitWindow*)pBase)->IsFadeInButtonVisible() || ((SplitWindow*)pBase)->IsFadeOutButtonVisible()) )
- {
- WRITEc("*(FadeIn/Out)");
- }
- WRITEc("Text: ");
- WRITE(aText);
- WRITEc("\n");
-
- WRITE(sIndent);
- WRITEc("UId : ");
- WRITE(Id2Str(pBase->GetUniqueOrHelpId()));
- WRITEc(":0x");
- WRITE(
- String::CreateFromInt64(
- sal::static_int_cast< sal_Int64 >(
- reinterpret_cast< sal_IntPtr >(pBase)),
- 16 ));
- WRITEc(":");
- WRITE(pBase->GetQuickHelpText());
- WRITEc(":");
- WRITE(pBase->GetHelpText());
- WRITEc("\n");
-
- WRITE(sIndent);
- WRITEc("RTyp: ");
- WRITE(MakeStringNumber(TypeKenn,pBase->GetType()));
- if ( pBase->GetType() == WINDOW_CONTROL )
- {
- if ( dynamic_cast< svt::EditBrowseBox* >(pBase) )
- WRITEc("/BrowseBox")
- else if ( dynamic_cast< ValueSet* >(pBase) )
- WRITEc("/ValueSet")
- else if ( dynamic_cast< svt::ORoadmap* >(pBase) )
- WRITEc("/RoadMap")
- else if ( dynamic_cast< svt::IExtensionListBox* >(pBase) )
- WRITEc("/ExtensionListBox")
- else if ( dynamic_cast< svt::table::TableControl* >(pBase) )
- WRITEc("/TableControl")
- else
- WRITEc("/Unknown")
- }
- WRITEc("\n");
-
- aReturn.ConvertLineEnd();
- sal_uInt16 i;
- for (i = 0 ; i < pBase->GetChildCount() ; i++)
- {
- aReturn += ClientTree(pBase->GetChild(i),Indent+1);
- }
- return aReturn;
-}
-
-
-sal_Bool StatementList::CheckWindowWait()
-{
- static Time StartTime = Time(0L); // cancel if window doesn't want to close at all
- if ( StartTime == Time(0L) )
- StartTime = Time( Time::SYSTEM );
-
- if ( pWindowWaitPointer )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Waiting for Window to close ... " );
-#endif
- if ( WinPtrValid(pWindowWaitPointer) && IS_WINP_CLOSING(pWindowWaitPointer) )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( Id2Str(aWindowWaitUId).AppendAscii(" Still Open. RType=") );
- m_pDbgWin->AddText( String::CreateFromInt32( pWindowWaitPointer->GetType() ).AppendAscii("\n") );
-#endif
-
-
- if ( StartTime + Time(0,0,10) < Time( Time::SYSTEM ) )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Close timed out. Going on!! " );
-#endif
- pWindowWaitPointer->SetHelpId(aWindowWaitOldHelpId);
- pWindowWaitPointer->SetUniqueId(aWindowWaitOldUniqueId);
-
- aWindowWaitUId = rtl::OString();
- pWindowWaitPointer = NULL;
- StartTime = Time(0L);
- return sal_True;
- }
-
- return sal_False;
- }
- pWindowWaitPointer = NULL;
- aWindowWaitUId = rtl::OString();
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Closed, Going on.\n" );
-#endif
- }
- StartTime = Time(0L);
- return sal_True;
-}
-
-void StatementList::ReportError(String aMessage)
-{
- ReportError ( rtl::OString(), aMessage );
-}
-
-void StatementList::ReportError(rtl::OString aUId, String aMessage)
-{
- pRet->GenError ( aUId, aMessage );
- IsError = sal_True;
-}
-
-void StatementList::ReportError(String aMessage, sal_uLong nWhatever)
-{
- ReportError ( aMessage.AppendAscii(" ").Append(UniString::CreateFromInt32(nWhatever)));
-}
-
-void StatementList::DirectLog( sal_uLong nType, String aMessage )
-{
- if ( pRet )
- pRet->GenReturn( RET_DirectLoging, (sal_uInt16) nType, aMessage );
-}
-
-
-#define CALL_EVENT_WITH_NOTIFY( EventType, Event, WinP, Method ) \
-{ \
- if ( StatementList::WinPtrValid( WinP ) ) \
- { \
- NotifyEvent aNEvt( EventType, WinP, &Event ); \
- if ( !WinP->PreNotify( aNEvt ) ) \
- WinP->Method( Event ); \
- } \
-}
-
-void ImplKeyInput( Window* pWin, KeyEvent &aKEvnt, sal_Bool bForceDirect )
-{
-
- if ( StatementList::bUsePostEvents && !bForceDirect )
- {
- if ( StatementList::WinPtrValid( pWin ) )
- {
- sal_uLong nID1;
- sal_uLong nID2;
- nID1 = Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, pWin, &aKEvnt );
- nID2 = Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, pWin, &aKEvnt );
- // wait after posting both events so deleting pWin will remove the second event also
- ImplEventWait( nID1 );
- ImplEventWait( nID2 );
- }
- }
- else
- {
- if ( !Application::CallAccel( aKEvnt.GetKeyCode() ) )
- {
- CALL_EVENT_WITH_NOTIFY( EVENT_KEYINPUT, aKEvnt, pWin, KeyInput )
-
- KeyCode aCode = aKEvnt.GetKeyCode();
- if ( (aCode.GetCode() == KEY_CONTEXTMENU) || ((aCode.GetCode() == KEY_F10) && aCode.IsShift()) )
- {
- if ( StatementList::WinPtrValid( pWin ) )
- {
- Point aPos;
- // simulate mouseposition at center of window
- Size aSize = pWin->GetOutputSize();
- aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
-
- CommandEvent aEvent( aPos, COMMAND_CONTEXTMENU, sal_False );
- ImplCommand( pWin, aEvent );
- }
- }
- }
-
- CALL_EVENT_WITH_NOTIFY( EVENT_KEYUP, aKEvnt, pWin, KeyUp )
- }
-};
-
-void ImplMouseMove( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect )
-{
- if ( StatementList::bUsePostEvents && !bForceDirect )
- {
- if ( StatementList::WinPtrValid( pWin ) )
- {
- sal_uLong nID;
- nID = Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, pWin, &aMEvnt );
- ImplEventWait( nID );
- }
- }
- else
- {
- if ( pWin->IsTracking() )
- {
- TrackingEvent aTEvt( aMEvnt );
- pWin->Tracking( aTEvt );
- }
- else
- CALL_EVENT_WITH_NOTIFY( EVENT_MOUSEMOVE, aMEvnt, pWin, MouseMove )
- }
-};
-
-void ImplMouseButtonDown( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect )
-{
- if ( StatementList::bUsePostEvents && !bForceDirect )
- {
- if ( StatementList::WinPtrValid( pWin ) )
- {
- sal_uLong nID;
- nID = Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pWin, &aMEvnt );
- ImplEventWait( nID );
- }
- }
- else
- {
- CALL_EVENT_WITH_NOTIFY( EVENT_MOUSEBUTTONDOWN, aMEvnt, pWin, MouseButtonDown )
- }
-};
-
-void ImplMouseButtonUp( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect )
-{
- if ( StatementList::bUsePostEvents && !bForceDirect )
- {
- if ( StatementList::WinPtrValid( pWin ) )
- {
- sal_uLong nID;
- nID = Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, pWin, &aMEvnt );
- ImplEventWait( nID );
- }
- }
- else
- {
- if ( pWin->IsTracking() )
- {
- // look at #64693 the position is relevant to the toolboxes
- // #60020 hopefully no more GPF now
- // stop tracking at first without event
- pWin->EndTracking( ENDTRACK_DONTCALLHDL );
- // then send own event with correct mouse event
- TrackingEvent aTEvt( aMEvnt, ENDTRACK_END );
- pWin->Tracking( aTEvt );
- }
- else
- CALL_EVENT_WITH_NOTIFY( EVENT_MOUSEBUTTONUP, aMEvnt, pWin, MouseButtonUp )
- }
-};
-
-void ImplEventWait( sal_uLong nID )
-{
- while ( !Application::IsProcessedMouseOrKeyEvent( nID ) )
- Application::Yield();
-}
-
-void ImplCommand( Window* pWin, CommandEvent &aCmdEvnt )
-{
- CALL_EVENT_WITH_NOTIFY( EVENT_COMMAND, aCmdEvnt, pWin, Command )
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx
deleted file mode 100644
index 8eb6ba368fb1..000000000000
--- a/automation/source/server/statemnt.cxx
+++ /dev/null
@@ -1,6337 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
-#include <comphelper/uieventslogger.hxx>
-
-#include <tools/wintypes.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/menubtn.hxx>
-#include <svtools/svtreebx.hxx>
-#include <svtools/brwbox.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/dockwin.hxx>
-#include <vcl/floatwin.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/combobox.hxx>
-#include <vcl/morebtn.hxx>
-#include <vcl/field.hxx>
-#include <vcl/toolbox.hxx>
-#include <vcl/tabctrl.hxx>
-#include <vcl/tabpage.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/status.hxx>
-#include <svtools/prgsbar.hxx>
-#include <svtools/editbrowsebox.hxx>
-#include <vcl/splitwin.hxx>
-#include <vcl/group.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/wrkwin.hxx>
-#include <osl/diagnose.h>
-#include <svtools/valueset.hxx>
-#include <svtools/roadmap.hxx>
-#include <svtools/table/tablecontrol.hxx>
-#include <svtools/table/tablecontrolinterface.hxx>
-#include <svl/poolitem.hxx>
-#include <svtools/extensionlistbox.hxx>
-// has got no include guard
-#include <svtools/svtdata.hxx>
-#include <tools/time.hxx>
-#include <svtools/stringtransfer.hxx>
-#include <tools/stream.hxx>
-#include <tools/fsys.hxx>
-#include <svl/stritem.hxx>
-#include <svtools/ttprops.hxx>
-#include <basic/ttstrhlp.hxx>
-#include <basic/dispdefs.hxx>
-#include <basic/sbuno.hxx>
-#include <svl/pickerhistory.hxx>
-#include <com/sun/star/util/XCancellable.hpp>
-
-#include <sot/storage.hxx>
-#include <sot/storinfo.hxx>
-#include "statemnt.hxx"
-#include "scmdstrm.hxx"
-
-#include "retstrm.hxx"
-
-#if OSL_DEBUG_LEVEL > 1
-# include "editwin.hxx"
-#endif
-
-#include "rcontrol.hxx"
-#include <automation/communi.hxx>
-#include "testtool.hxx"
-
-#include "profiler.hxx"
-
-#include "recorder.hxx"
-
-#include "testtool.hrc"
-#include <basic/svtmsg.hrc>
-
-#include <algorithm>
-
-
-using namespace com::sun::star::frame;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace svt;
-
-
-#ifndef SBX_VALUE_DECL_DEFINED
-#define SBX_VALUE_DECL_DEFINED
-SV_DECL_REF(SbxValue)
-#endif
-SV_IMPL_REF(SbxValue)
-
-CommunicationLink *StatementFlow::pCommLink = NULL;
-sal_Bool StatementFlow::bUseIPC = sal_True;
-sal_Bool StatementFlow::bSending = sal_False;
-ImplRemoteControl *StatementFlow::pRemoteControl = NULL;
-
-sal_uInt16 StatementCommand::nDirPos = 0;
-Dir *StatementCommand::pDir = NULL;
-pfunc_osl_printDebugMessage StatementCommand::pOriginal_osl_DebugMessageFunc = NULL;
-
-
-#define SET_WINP_CLOSING(pWin) \
- pWindowWaitPointer = pWin; \
- aWindowWaitUId = pControl->GetUniqueOrHelpId(); \
- aWindowWaitOldHelpId = pWin->GetHelpId(); \
- aWindowWaitOldUniqueId = pWin->GetUniqueId(); \
- pWin->SetHelpId( rtl::OString("TT_Win_is_closing_HID") ); \
- pWin->SetUniqueId( rtl::OString("TT_Win_is_closing_UID") );
-
-
-StatementFlow::StatementFlow( StatementList *pAfterThis, sal_uInt16 nArtP )
-: nArt(nArtP)
-, nParams(0)
-, nSNr1(0)
-, nLNr1(0)
-, aString1()
-, bBool1(sal_False)
-{
- QueStatement( pAfterThis );
-}
-
-StatementFlow::StatementFlow( sal_uLong nServiceId, SCmdStream *pCmdIn, ImplRemoteControl *pRC )
-: nArt(0)
-, nParams(0)
-, nSNr1(0)
-, nLNr1(0)
-, aString1()
-, bBool1(sal_False)
-{
- QueStatement( NULL );
- bUseIPC = (nServiceId == SI_IPCCommandBlock);
- pRemoteControl = pRC;
- pCmdIn->Read( nArt );
- pCmdIn->Read( nParams );
-
- if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nSNr1 );
- if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1 );
- if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 );
- if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );// Should NEVER happen
-
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Reading FlowControl: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nArt ) );
- m_pDbgWin->AddText( " Params:" );
- if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nSNr1 ) );}
- if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " l1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
- if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
- if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
- m_pDbgWin->AddText( "\n" );
-#endif
-}
-
-void StatementFlow::SendViaSocket()
-{
- if ( bSending )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "SendViaSocket called recursively. Aborted!!!\n" );
-#endif
- OSL_FAIL("SendViaSocket called recursively. Aborted!!!");
- return;
- }
- bSending = sal_True;
- if ( pCommLink )
- {
- if ( !pCommLink->TransferDataStream( pRet->GetStream() ) ) // if there's an error, it's deleted immediately
- pCommLink = NULL;
- }
- else
- {
- // never mind, if the basic is not there it doesn't matter anyway
- OSL_FAIL("Cannot send results to TestTool");
- }
-
- pRet->Reset();
- bSending = sal_False;
- IsError = sal_False;
-}
-
-sal_Bool StatementFlow::Execute()
-{
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Executing Flow: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nArt ) );
- m_pDbgWin->AddText( "\n" );
-#endif
- switch ( nArt )
- {
- case F_EndCommandBlock:
- {
-
- if ( !bUseIPC )
- {
- // bBool1 has been initialized in CTOR to sal_False
- if ( !bBool1 ) // means first run
- {
- pRemoteControl->pRetStream = pRet->GetStream();
- bBool1 = sal_True;
- nRetryCount = nRetryCount * 4;
- }
- if ( pRemoteControl->pRetStream && (nRetryCount--) )
- {
- return sal_False;
- }
- }
-
- }
- break;
- }
-
- Advance();
- switch ( nArt )
- {
- case F_EndCommandBlock:
- if ( !bUseIPC )
- { // is handled above
- pRet->Reset();
- IsError = sal_False;
- }
- else
- SendViaSocket();
-
- break;
-
- case F_Sequence:
-
- pRet->GenReturn(RET_Sequence,nLNr1);
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Sending Sequence Nr: " );
- m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );
- m_pDbgWin->AddText( "\n" );
- #endif
-
- break;
- default:
- OSL_FAIL( "Unknown Flowcontrol" );
- break;
- }
-
- delete this;
- return sal_True;
-}
-
-
-// new help function that should be enhanced constantly
-static short ImpGetRType( Window *pWin )
-{
- short nRT = C_NoType;
- WindowType eRT = pWin->GetType();
- switch( eRT ) {
- case WINDOW_WINDOW: nRT = C_Window ; break;
-
- case WINDOW_TABCONTROL: nRT = C_TabControl ; break;
- case WINDOW_RADIOBUTTON: nRT = C_RadioButton ; break;
- case WINDOW_CHECKBOX: nRT = C_CheckBox ; break;
- case WINDOW_TRISTATEBOX: nRT = C_TriStateBox ; break;
- case WINDOW_EDIT: nRT = C_Edit ; break;
- case WINDOW_MULTILINEEDIT: nRT = C_MultiLineEdit ; break;
- case WINDOW_MULTILISTBOX: nRT = C_MultiListBox ; break;
- case WINDOW_LISTBOX: nRT = C_ListBox ; break;
- case WINDOW_COMBOBOX: nRT = C_ComboBox ; break;
- case WINDOW_PUSHBUTTON: nRT = C_PushButton ; break;
- case WINDOW_SPINFIELD: nRT = C_SpinField ; break;
- case WINDOW_PATTERNFIELD: nRT = C_PatternField ; break;
- case WINDOW_NUMERICFIELD: nRT = C_NumericField ; break;
- case WINDOW_METRICFIELD: nRT = C_MetricField ; break;
- case WINDOW_CURRENCYFIELD: nRT = C_CurrencyField ; break;
- case WINDOW_DATEFIELD: nRT = C_DateField ; break;
- case WINDOW_TIMEFIELD: nRT = C_TimeField ; break;
- case WINDOW_IMAGERADIOBUTTON: nRT = C_ImageRadioButton ; break;
- case WINDOW_NUMERICBOX: nRT = C_NumericBox ; break;
- case WINDOW_METRICBOX: nRT = C_MetricBox ; break;
- case WINDOW_CURRENCYBOX: nRT = C_CurrencyBox ; break;
- case WINDOW_DATEBOX: nRT = C_DateBox ; break;
- case WINDOW_TIMEBOX: nRT = C_TimeBox ; break;
- case WINDOW_IMAGEBUTTON: nRT = C_ImageButton ; break;
- case WINDOW_MENUBUTTON: nRT = C_MenuButton ; break;
- case WINDOW_MOREBUTTON: nRT = C_MoreButton ; break;
-
-
- case WINDOW_TABPAGE: nRT = C_TabPage; break;
- case WINDOW_MODALDIALOG: nRT = C_ModalDlg; break;
- case WINDOW_FLOATINGWINDOW: nRT = C_FloatWin; break;
- case WINDOW_MODELESSDIALOG: nRT = C_ModelessDlg; break;
- case WINDOW_WORKWINDOW: nRT = C_WorkWin; break;
- case WINDOW_DOCKINGWINDOW: nRT = C_DockingWin; break;
-
- case WINDOW_MESSBOX: nRT = C_MessBox; break;
- case WINDOW_INFOBOX: nRT = C_InfoBox; break;
- case WINDOW_WARNINGBOX: nRT = C_WarningBox; break;
- case WINDOW_ERRORBOX: nRT = C_ErrorBox; break;
- case WINDOW_QUERYBOX: nRT = C_QueryBox; break;
- case WINDOW_TABDIALOG: nRT = C_TabDlg; break;
-
- case WINDOW_PATTERNBOX: nRT = C_PatternBox; break;
- case WINDOW_TOOLBOX: nRT = C_ToolBox; break;
- case WINDOW_CONTROL: nRT = C_Control; break;
- case WINDOW_OKBUTTON: nRT = C_OkButton; break;
- case WINDOW_CANCELBUTTON: nRT = C_CancelButton; break;
- case WINDOW_BUTTONDIALOG: nRT = C_ButtonDialog; break;
- case WINDOW_TREELISTBOX: nRT = C_TreeListBox; break;
-
- case WINDOW_DIALOG: nRT = C_Dialog; break;
- }
- return nRT;
-}
-
-
-StatementSlot::StatementSlot( SCmdStream *pCmdIn )
-: pItemArr(NULL)
-{
- QueStatement( NULL );
- pCmdIn->Read( nFunctionId );
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Reading Slot: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
- m_pDbgWin->AddText( "\n" );
-#endif
- pCmdIn->Read( nAnzahl );
- if ( nAnzahl )
- {
- switch ( pCmdIn->GetNextType() )
- {
- case BinUINT16: // use old calling method
- {
- nAnzahl++;
- pItemArr = new SfxPoolItem*[nAnzahl];
- for (sal_uInt16 i = 0 ; i+1 < nAnzahl ; i++)
- pCmdIn->Read( pItemArr[i] );
- pItemArr[nAnzahl-1] = NULL;
- }
- break;
- case BinString: // new Method
- {
- aArgs.realloc(nAnzahl);
- PropertyValue* pArg = aArgs.getArray();
- for (sal_uInt16 i = 0 ; i < nAnzahl ; i++)
- pCmdIn->Read( pArg[i] );
- }
- break;
- }
- }
-}
-
-// Constructor for UnoSlot
-StatementSlot::StatementSlot()
-: nAnzahl( 0 )
-, pItemArr(NULL)
-, nFunctionId( 0 )
-, bMenuClosed(sal_False)
-{}
-
-StatementSlot::StatementSlot( sal_uLong nSlot, SfxPoolItem* pItem )
-: pItemArr(NULL)
-, bMenuClosed(sal_False)
-{
- QueStatement( NULL );
- nFunctionId = sal_uInt16(nSlot);
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Reading Slot: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
- m_pDbgWin->AddText( "\n" );
-#endif
- if ( pItem )
- {
- nAnzahl = 2;
- pItemArr = new SfxPoolItem*[2];
- pItemArr[0] = pItem;
- pItemArr[1] = NULL;
- }
- else
- nAnzahl = 0;
-}
-
-StatementSlot::~StatementSlot()
-{
- if (nAnzahl)
- {
- if ( pItemArr )
- {
- for (sal_uInt16 i = 0 ; i+1 < nAnzahl ; i++)
- delete pItemArr[i];
- delete[] pItemArr;
- }
-
- aArgs.realloc( 0 );
- }
-}
-
-void StatementSlot::AddReferer()
-{
- HACK( "only to test!" );
-// because slot 6102 /*SID_VERB_START*/ crashes when called with Property Referer
-// We return to the previous behavior (which was a bug realy) of not adding this Property to calls which have no properties at all
-// according to MBA most likely this Property can be removed at all and is maybe only needed for Slots with URLs
- if ( !nAnzahl )
- return;
-
- PropertyValue* pArg;
-
- nAnzahl++;
- aArgs.realloc(nAnzahl);
- pArg = aArgs.getArray();
- pArg[nAnzahl-1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
- pArg[nAnzahl-1].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:user" ));
-
- nAnzahl++;
- aArgs.realloc(nAnzahl);
- pArg = aArgs.getArray();
- pArg[nAnzahl-1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SynchronMode" ));
- pArg[nAnzahl-1].Value <<= sal_Bool( sal_True );
-}
-
-class SlotStatusListener : public cppu::WeakImplHelper1< XStatusListener >
-{
-public:
- SlotStatusListener();
-
- // XStatusListener
- virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- // local Members
- sal_Bool bDisposed;
- sal_Bool bEnabled;
-};
-
-SlotStatusListener::SlotStatusListener()
-: bDisposed( sal_False )
-, bEnabled( sal_True )
-{}
-
-// XStatusListener
-void SAL_CALL SlotStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
-{
- bEnabled = Event.IsEnabled;
-}
-
-// XEventListener
-void SAL_CALL SlotStatusListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
-{
- bDisposed = sal_True;
-}
-
-sal_Bool StatementSlot::Execute()
-{
- if ( IsError )
- {
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Skipping Slot: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
- m_pDbgWin->AddText( "\n" );
- #endif
-
- Advance();
- delete this;
- return sal_True;
- }
-
- InitProfile();
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Executing Slot: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) );
- m_pDbgWin->AddText( "\n" );
-#endif
-
- PopupMenu *pPopup = NULL;
- MenuBar *pMenuBar = NULL;
- Menu *pMenu;
-
- GetCurrentMenues( pPopup, pMenuBar, pMenu );
- if ( pPopup )
- {
- if ( !bMenuClosed )
- {
- pPopup->EndExecute(0);
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
- bMenuClosed = sal_True;
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Closed contextmenu\n" );
-#endif
- return sal_False;
- }
- else if ( nRetryCount-- )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Waiting for contextmenu to close\n" );
-#endif
- return sal_False;
- }
- else
- ReportError( GEN_RES_STR0( S_MENU_NOT_CLOSING ) );
- }
-
- Advance();
-
- if ( !IsError )
- {
- if ( ( nAnzahl == 0 && !getenv("OLDSLOTHANDLING") ) || aArgs.hasElements() )
- { // trying to call slots via uno
- AddReferer();
- if ( !aUnoUrl.Len() )
- aUnoUrl = CUniString("slot:").Append( String::CreateFromInt32( nFunctionId ) );
- ::com::sun::star::util::URL aTargetURL;
- aTargetURL.Complete = aUnoUrl;
- Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.frame.Desktop") ), UNO_QUERY );
- Reference < XFrame > xFrame;
-
- if ( xDesktop.is() )
- {
- xFrame = xDesktop->getActiveFrame();
- if ( !xFrame.is() )
- {
- Reference < XFrames > xFrames;
- xFrames = xDesktop->getFrames();
- if ( xFrames.is() && xFrames->getCount() > 0 )
- {
- Any aFrame = xFrames->getByIndex( xFrames->getCount() -1 );
- aFrame >>= xFrame;
- }
- }
- if ( !xFrame.is() )
- {
- if ( GetFirstDocFrame() )
- GetFirstDocFrame()->ToTop();
- xFrame = xDesktop->getActiveFrame();
- }
- }
-
- if ( xFrame.is() )
- xDesktop = Reference < XFramesSupplier >( xFrame, UNO_QUERY );
- else
- xDesktop.clear();
-
- while ( xDesktop.is() && xDesktop->getActiveFrame().is() )
- {
- xFrame = xDesktop->getActiveFrame();
-#if OSL_DEBUG_LEVEL > 1
- ::rtl::OUString aName;
- if ( xFrame.is() )
- aName = xFrame->getName();
-#endif
- xDesktop = Reference < XFramesSupplier >( xFrame, UNO_QUERY );
- }
-
- if ( !xFrame.is() )
- ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_FRAME, aTargetURL.Complete ) );
- else
- {
- Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY );
- xTrans->parseStrict( aTargetURL );
-
- Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
- Reference < XDispatch > xDisp;
- while ( xProv.is() && !xDisp.is() )
- {
- xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
- if ( !xDisp.is() )
- {
- xFrame = Reference < XFrame > ( xFrame->getCreator(), UNO_QUERY );
- xProv = Reference < XDispatchProvider > ( xFrame, UNO_QUERY );
- }
- }
-
- if ( xDisp.is() )
- {
- Reference < XStatusListener > xListener = ( XStatusListener* )new SlotStatusListener;
- xDisp->addStatusListener( xListener, aTargetURL );
- if ( static_cast< SlotStatusListener* >(xListener.get())->bEnabled )
- {
- if ( bIsSlotInExecute )
- ReportError( GEN_RES_STR0( S_SLOT_IN_EXECUTE ) );
- else
- {
- bIsSlotInExecute = sal_True;
- xDisp->dispatch( aTargetURL, aArgs );
- bIsSlotInExecute = sal_False;
- }
- }
- else
- ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_DISABLED, aTargetURL.Complete ) );
- xDisp->removeStatusListener( xListener, aTargetURL );
- }
- else
- ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_DISPATCHER, aTargetURL.Complete ) );
- }
- }
- else
- {
- DirectLog( S_QAError, GEN_RES_STR0( S_DEPRECATED ) );
- if ( !pTTProperties )
- pTTProperties = new TTProperties();
-
- switch ( pTTProperties->ExecuteFunction( nFunctionId, pItemArr, EXECUTEMODE_DIALOGASYNCHRON | nUseBindings ) )
- {
- case TT_PR_ERR_NODISPATCHER:
- {
- ReportError( rtl::OString::valueOf((sal_Int32)nFunctionId), GEN_RES_STR0( S_SID_EXECUTE_FAILED_NO_DISPATCHER ) );
- }
- break;
- case TT_PR_ERR_NOEXECUTE:
- {
- ReportError( rtl::OString::valueOf((sal_Int32)nFunctionId), GEN_RES_STR0( S_SID_EXECUTE_FAILED ) );
- }
- break;
- }
- }
- }
-
-
-/* new principle from 334!
- new method to make dialogues be called asynchronously
- and real return value that shows whether slot was successfull
- and to test whether slot can be called by the UI at all */
-
-
- SendProfile( SlotString( nFunctionId ) );
- delete this;
- return sal_True;
-}
-
-
-StatementUnoSlot::StatementUnoSlot(SCmdStream *pIn)
-{
- QueStatement( NULL );
-
- pIn->Read( aUnoUrl );
-
-#if OSL_DEBUG_LEVEL > 1
- StatementList::m_pDbgWin->AddText( "UnoUrl:" );
- StatementList::m_pDbgWin->AddText( aUnoUrl );
- StatementList::m_pDbgWin->AddText( "\n" );
-#endif
-
-}
-
-
-StatementCommand::StatementCommand( StatementList *pAfterThis, sal_uInt16 MethodId, sal_uInt16 Params, sal_uInt16 Nr1 )
-: nMethodId( MethodId )
-, nParams(Params)
-, nNr1(Nr1)
-, nNr2(0)
-, nNr3(0)
-, nNr4(0)
-, aString1()
-, aString2()
-, bBool1(sal_False)
-, bBool2(sal_False)
-{
- nLNr1_and_Pointer.pWindow = 0;
-
- QueStatement( pAfterThis );
-
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Directly adding Conmmand:" );
- m_pDbgWin->AddText( " Methode: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
- m_pDbgWin->AddText( " Params:" );
- if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
- if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
- if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
- if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
- if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1_and_Pointer.nLNr1 ) );}
- if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
- if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
- if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
- if( nParams & PARAM_BOOL_2 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );}
- m_pDbgWin->AddText( "\n" );
-#endif
-}
-
-
-StatementCommand::StatementCommand( SCmdStream *pCmdIn )
-: nMethodId(0)
-, nParams(0)
-, nNr1(0)
-, nNr2(0)
-, nNr3(0)
-, nNr4(0)
-, aString1()
-, aString2()
-, bBool1(sal_False)
-, bBool2(sal_False)
-{
- nLNr1_and_Pointer.pWindow = 0;
-
- QueStatement( NULL );
- pCmdIn->Read( nMethodId );
- pCmdIn->Read( nParams );
-
- if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 );
- if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 );
- if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 );
- if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 );
- if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1_and_Pointer.nLNr1 );
- if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 );
- if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 );
- if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );
- if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 );
-
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Reading Conmmand:" );
- m_pDbgWin->AddText( " Methode: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
- m_pDbgWin->AddText( " Params:" );
- if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
- if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
- if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
- if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
- if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1_and_Pointer.nLNr1 ) );}
- if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
- if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
- if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );}
- if( nParams & PARAM_BOOL_2 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );}
- m_pDbgWin->AddText( "\n" );
-#endif
-
- if ( nMethodId == RC_AppAbort )
- {
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "*Deleting all Commands:\n" );
- #endif
- bReadingCommands = sal_False;
- while ( StatementList::pFirst != this ) // delete everything apart from myself
- {
- StatementList *pDeQue = StatementList::pFirst;
- pDeQue->Advance();
- delete pDeQue;
- }
- bReadingCommands = sal_True;
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "*Done deleting all Commands:\n" );
- #endif
- }
-
-}
-
-void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Bool bFirst )
-{
-
- if ( IsDialog(pBase) && !bFirst )
- return;
-
- if ( bFirst )
- pRet->GenReturn ( RET_WinInfo, rtl::OString(), (comm_UINT32)nConf | DH_MODE_DATA_VALID, UniString(), sal_True );
-
- if ( bFirst )
- {
- if ( pBase->GetType() == WINDOW_WINDOW && pBase->GetParent() && pBase->GetParent()->GetType() == WINDOW_CONTROL &&
- dynamic_cast< svt::table::TableControl* > ( pBase->GetParent() ) )
- pBase = pBase->GetParent();
- }
-
- { // bracketing to prevent the string from persisting during the recursion
- String aName;
- sal_Bool bSkip = sal_False;
-
- switch ( pBase->GetType() )
- {
- case WINDOW_RADIOBUTTON:
- case WINDOW_CHECKBOX:
- case WINDOW_TRISTATEBOX:
- case WINDOW_PUSHBUTTON:
- case WINDOW_OKBUTTON:
- case WINDOW_CANCELBUTTON:
- case WINDOW_IMAGERADIOBUTTON:
- case WINDOW_IMAGEBUTTON:
- case WINDOW_MENUBUTTON:
- case WINDOW_MOREBUTTON:
- case WINDOW_TABPAGE:
- case WINDOW_MODALDIALOG:
- case WINDOW_FLOATINGWINDOW:
- case WINDOW_MODELESSDIALOG:
- case WINDOW_WORKWINDOW:
- case WINDOW_DOCKINGWINDOW:
- case WINDOW_CONTROL:
-
- case WINDOW_FILEDIALOG:
- case WINDOW_PATHDIALOG:
- case WINDOW_PRINTDIALOG:
- case WINDOW_PRINTERSETUPDIALOG:
- case WINDOW_COLORDIALOG:
- case WINDOW_TABDIALOG:
-
- case WINDOW_BUTTONDIALOG:
-
- case WINDOW_MENUBARWINDOW:
- aName = comphelper::string::remove(pBase->GetText(), '~');
- break;
-
- case WINDOW_EDIT:
- case WINDOW_MULTILINEEDIT:
- case WINDOW_MULTILISTBOX:
- case WINDOW_LISTBOX:
- case WINDOW_COMBOBOX:
- case WINDOW_SPINFIELD:
- case WINDOW_PATTERNFIELD:
- case WINDOW_NUMERICFIELD:
- case WINDOW_METRICFIELD:
- case WINDOW_CURRENCYFIELD:
- case WINDOW_DATEFIELD:
- case WINDOW_TIMEFIELD:
- case WINDOW_NUMERICBOX:
- case WINDOW_METRICBOX:
- case WINDOW_CURRENCYBOX:
- case WINDOW_DATEBOX:
- case WINDOW_TIMEBOX:
- case WINDOW_PATTERNBOX:
- case WINDOW_TOOLBOX:
- aName = pBase->GetQuickHelpText();
- break;
-
- case WINDOW_MESSBOX:
- case WINDOW_INFOBOX:
- case WINDOW_WARNINGBOX:
- case WINDOW_ERRORBOX:
- case WINDOW_QUERYBOX:
- aName = ((MessBox*)pBase)->GetMessText();
- break;
-
- default:
- if ( ( pBase->GetUniqueOrHelpId().getLength() == 0 ) && !( nConf & DH_MODE_ALLWIN ) )
- bSkip = sal_True;
- break;
- }
-
- if ( !bSkip )
- {
- if ( aName.Len() == 0 )
- aName = pBase->GetQuickHelpText();
- if ( aName.Len() == 0 )
- aName = pBase->GetHelpText();
- if ( aName.Len() == 0 )
- aName = pBase->GetText();
-
-
- String aTypeSuffix;
- if ( pBase->GetType() == WINDOW_CONTROL )
- {
- if ( dynamic_cast< EditBrowseBox* >(pBase) )
- aTypeSuffix.AppendAscii( "/BrowseBox", 10 );
- else if ( dynamic_cast< ValueSet* >(pBase) )
- aTypeSuffix.AppendAscii( "/ValueSet", 9 );
- else if ( dynamic_cast< ORoadmap* >(pBase) )
- aTypeSuffix.AppendAscii( "/RoadMap", 8 );
- else if ( dynamic_cast< IExtensionListBox* >(pBase) )
- aTypeSuffix.AppendAscii( "/ExtensionListBox" );
- else if ( dynamic_cast< svt::table::TableControl* >(pBase) )
- aTypeSuffix.AppendAscii( "/TableControl" );
- else
- aTypeSuffix.AppendAscii( "/Unknown", 8 );
- }
-
- rtl::OString aId = pBase->GetUniqueOrHelpId();
- pRet->GenReturn ( RET_WinInfo, aId, (comm_UINT32)pBase->GetType(),
- TypeString(pBase->GetType()).Append(aTypeSuffix).AppendAscii(": ").Append(aName), sal_False );
-
-
- if ( pBase->GetType() == WINDOW_TOOLBOX )
- {
- ToolBox *pTB = ((ToolBox*)pBase);
- sal_uInt16 i;
- for ( i = 0; i < pTB->GetItemCount() ; i++ )
- {
- aName = String();
- if ( aName.Len() == 0 )
- aName = pTB->GetHelpText( pTB->GetItemId( i ) );
- if ( aName.Len() == 0 )
- aName = pTB->GetItemText( pTB->GetItemId( i ) );
-
- Window *pItemWin;
- pItemWin = pTB->GetItemWindow( pTB->GetItemId( i ) );
- if ( pTB->GetItemType( i ) == TOOLBOXITEM_BUTTON && ( !pItemWin || !pItemWin->IsVisible() ) )
- {
- if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, Str2Id(pTB->GetItemCommand(pTB->GetItemId( i ))), (comm_UINT32)WINDOW_BUTTON,
- TypeString(WINDOW_BUTTON).AppendAscii(": ").Append(aName), sal_False );
- if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_UINT32)WINDOW_BUTTON,
- TypeString(WINDOW_BUTTON).AppendAscii(": ").Append(aName), sal_False );
- }
- else
- {
- if ( pItemWin )
- {
- if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, Str2Id(pTB->GetItemCommand(pTB->GetItemId( i ))), (comm_UINT32)pItemWin->GetType(),
- TypeString(pItemWin->GetType()).AppendAscii(": ").Append(aName), sal_False );
- if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_UINT32)pItemWin->GetType(),
- TypeString(pItemWin->GetType()).AppendAscii(": ").Append(aName), sal_False );
- sal_uInt16 ii;
- for( ii = 0 ; ii < pItemWin->GetChildCount(); ii++ )
- WriteControlData( pItemWin->GetChild(ii), nConf, sal_False );
- }
- else
- {
- if ( nConf & DH_MODE_ALLWIN )
- {
- String aToolBoxItemType;
- switch ( pTB->GetItemType( i ) )
- {
- case TOOLBOXITEM_DONTKNOW:
- aToolBoxItemType.AssignAscii("TOOLBOXITEM_DONTKNOW");
- break;
- case TOOLBOXITEM_BUTTON:
- aToolBoxItemType.AssignAscii("TOOLBOXITEM_BUTTON");
- break;
- case TOOLBOXITEM_SPACE:
- aToolBoxItemType.AssignAscii("TOOLBOXITEM_SPACE");
- break;
- case TOOLBOXITEM_SEPARATOR:
- aToolBoxItemType.AssignAscii("TOOLBOXITEM_SEPARATOR");
- break;
- case TOOLBOXITEM_BREAK:
- aToolBoxItemType.AssignAscii("TOOLBOXITEM_BREAK");
- break;
- default:
- OSL_TRACE( "Unknown TOOLBOXITEM %i", pTB->GetItemType( i ) );
- }
- if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, Str2Id( pTB->GetItemCommand(pTB->GetItemId( i )) ), (comm_UINT32)WINDOW_BASE,
- aToolBoxItemType.AppendAscii(": ").Append(aName), sal_False );
- if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_UINT32)WINDOW_BASE,
- aToolBoxItemType.AppendAscii(": ").Append(aName), sal_False );
- }
- }
- }
- }
-
- return;
- }
-
-
- if ( pBase->GetType() == WINDOW_BUTTONDIALOG
- || pBase->GetType() == WINDOW_MESSBOX
- || pBase->GetType() == WINDOW_INFOBOX
- || pBase->GetType() == WINDOW_WARNINGBOX
- || pBase->GetType() == WINDOW_ERRORBOX
- || pBase->GetType() == WINDOW_QUERYBOX )
- {
- ButtonDialog *pBD = ((ButtonDialog*)pBase);
- sal_uInt16 i;
- for ( i = 0; i < pBD->GetButtonCount() ; i++ )
- {
- aName = String();
- if ( aName.Len() == 0 )
- aName = pBD->GetPushButton( pBD->GetButtonId(i) )->GetText();
- ByteString aID;
- switch ( pBD->GetButtonId(i) )
- {
- case BUTTONID_OK:
- aID.Assign("Ok");
- break;
- case BUTTONID_CANCEL:
- aID.Assign("Cancel");
- break;
- case BUTTONID_YES:
- aID.Assign("Yes");
- break;
- case BUTTONID_NO:
- aID.Assign("No");
- break;
- case BUTTONID_RETRY:
- aID.Assign("Retry");
- break;
- case BUTTONID_HELP:
- aID.Assign("Help");
- break;
- default:
- aID = rtl::OString::valueOf(
- static_cast<sal_Int32>(pBD->GetButtonId(i)));
- break;
- }
-
- pRet->GenReturn ( RET_WinInfo, aID, (comm_UINT32)pBD->GetPushButton( pBD->GetButtonId(i) )->GetType(), // so that text is displayed!
- TypeString(pBD->GetPushButton( pBD->GetButtonId(i) )->GetType()).AppendAscii(": ").Append(aName)
- .AppendAscii(" ButtonId = ").AppendAscii( aID.GetBuffer() ), sal_False );
- }
-
- return;
- }
-
-
- Menu* pMenu = GetMatchingMenu( pBase );
-
- if ( pMenu ) // Menus
- {
- sal_uInt16 i;
- for ( i = 0; i < pMenu->GetItemCount() ; i++ )
- {
- sal_uInt16 nID = pMenu->GetItemId( i );
-
- aName = String();
- if ( aName.Len() == 0 )
- aName = pMenu->GetHelpText( nID );
- if ( aName.Len() == 0 )
- aName = pMenu->GetItemText( nID );
-
-
- if ( pMenu->GetItemType( i ) == MENUITEM_STRING || pMenu->GetItemType( i ) == MENUITEM_IMAGE || pMenu->GetItemType( i ) == MENUITEM_STRINGIMAGE || (nConf & DH_MODE_ALLWIN) )
- {
- String aMenuItemType;
- switch ( pMenu->GetItemType( i ) )
- {
- case MENUITEM_STRING:
- aMenuItemType.AssignAscii("MENUITEM_STRING");
- break;
- case MENUITEM_STRINGIMAGE:
- aMenuItemType.AssignAscii("MENUITEM_STRINGIMAGE");
- break;
- case MENUITEM_IMAGE:
- aMenuItemType.AssignAscii("MENUITEM_IMAGE");
- break;
- case MENUITEM_SEPARATOR:
- aMenuItemType.AssignAscii("MENUITEM_SEPARATOR");
- break;
- case MENUITEM_DONTKNOW:
- aMenuItemType.AssignAscii("MENUITEM_DONTKNOW");
- break;
- default:
- OSL_TRACE( "Unknown MENUITEM %i", pMenu->GetItemType( i ) );
- }
- if ( pMenu->GetItemCommand(nID).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, Str2Id( pMenu->GetItemCommand(nID) ), (comm_UINT32)0,
- aMenuItemType.AppendAscii(": ").Append(aName), sal_False );
- if ( !pMenu->GetItemCommand(nID).Len() || ( nConf & DH_MODE_ALLWIN ) )
- pRet->GenReturn ( RET_WinInfo, rtl::OString::valueOf( (sal_Int32)nID ), (comm_UINT32)0,
- aMenuItemType.AppendAscii(": ").Append(aName), sal_False );
- }
- }
-
- return;
- }
- }
- }
-
- for( sal_uInt16 i = 0 ; i < pBase->GetChildCount(); i++ )
- WriteControlData( pBase->GetChild(i), nConf, sal_False );
-}
-
-class SysWinContainer : public WorkWindow
-{
-private:
- ToolBox *pClientWin;
- DockingWindow *pDock;
-public:
- SysWinContainer( ToolBox *pClient );
- ~SysWinContainer();
- virtual void Resize();
- virtual void Resizing( Size& rSize );
-};
-
-SysWinContainer::SysWinContainer( ToolBox *pClient )
-: WorkWindow( NULL, WB_BORDER | WB_SIZEMOVE | WB_CLOSEABLE )
-, pClientWin( pClient )
-{
- pDock = new DockingWindow( this );
- pClientWin->SetParent( pDock );
- pClientWin->SetFloatingMode( sal_False );
- SetText( pClient->GetText() );
- SetPosPixel( Point( 1,40 ) );
- Resize();
- pDock->Show();
- EnableAlwaysOnTop();
- Show();
-}
-
-SysWinContainer::~SysWinContainer()
-{
- delete pDock;
-}
-
-void SysWinContainer::Resize()
-{
- Size aSize( GetOutputSizePixel() );
- Resizing( aSize );
-
- if ( aSize != GetSizePixel() )
- {
- SetOutputSizePixel( aSize );
- pDock->SetSizePixel( aSize );
- pClientWin->SetSizePixel( aSize );
- }
-}
-
-void SysWinContainer::Resizing( Size& rSize )
-{
- Size aSize;
- Size aBestSize;
- sal_uInt16 i;
- sal_Bool bHasValue = sal_False;
- sal_uLong nBestValue = 0;
- sal_uLong nThisValue;
- for ( i=1 ; i<=1 ; i++ )
- {
- aSize = pClientWin->CalcWindowSizePixel( i );
- nThisValue = Abs( aSize.Width() - rSize.Width() ) + Abs( aSize.Height() - rSize.Height() );
- if ( !bHasValue || ( nThisValue < nBestValue ) )
- {
- nBestValue = nThisValue;
- aBestSize = aSize;
- bHasValue = sal_True;
- }
- }
- rSize = aBestSize;
-}
-
-
-class DisplayHidWin : public ToolBox
-{
- Edit *pEdit;
- Size aMinEditSize;
- sal_uInt16 nLastItemID;
- sal_Bool bIsDraging;
- sal_Bool bIsPermanentDraging;
- void SetDraging( sal_Bool bNewDraging );
- Image *pShow, *pShow2;
- sal_Bool bConfigChanged;
- void EnableButtons( sal_uLong nConf );
-
- sal_uLong nEventHookID;
- static long stub_VCLEventHookProc( NotifyEvent& rEvt, void* pData )
- {
- return ((DisplayHidWin*)pData)->VCLEventHook( rEvt );
- }
-
- long VCLEventHook( NotifyEvent& rEvt );
- Window *pLastMouseMoveWin;
-
- SysWinContainer *pContainer;
-
- // aborting by pressing shist twice
- sal_Bool bOldShift;
- Time aLatest;
- sal_uInt16 nShiftCount;
-
-public:
- DisplayHidWin();
- ~DisplayHidWin();
-
- virtual void Tracking( const TrackingEvent& rTEvt );
- virtual void Click();
- virtual void Select();
- virtual void SetText( const XubString& rStr );
-
- void SetDisplayText( const String &aNewText ){ pEdit->SetText(aNewText); }
- String GetDisplayText() const { return pEdit->GetText(); }
- sal_Bool IsDisplayTextModified() const { return pEdit->IsModified(); }
- void ClearDisplayTextModified() const { pEdit->ClearModifyFlag(); }
-
- void SetConfig( sal_uLong nConf );
- sal_uLong GetConfig();
-
- sal_Bool IsConfigChanged() { return bConfigChanged; }
- void ConfigSent() { bConfigChanged = sal_False; }
-
- sal_Bool IsSendData() { return GetItemState( TT_SEND_DATA ) == STATE_CHECK; }
-
- sal_Bool IsDraging() { return bIsDraging; }
-
- Window* LastMouseMoveWin() { return pLastMouseMoveWin; }
-};
-
-DisplayHidWin::DisplayHidWin()
-: ToolBox( StatementList::GetFirstDocFrame(), TTProperties::GetSvtResId(DisplayHidToolBox) )
-, bIsDraging( sal_False )
-, bIsPermanentDraging( sal_False )
-, pShow( NULL )
-, pShow2( NULL )
-, pLastMouseMoveWin( NULL )
-, bOldShift( 0 )
-, aLatest( Time::SYSTEM )
-, nShiftCount( 0 )
-{
- SetOutStyle( TOOLBOX_STYLE_HANDPOINTER | TOOLBOX_STYLE_FLAT );
- pEdit = new Edit( this, WB_CENTER | WB_BORDER );
- aMinEditSize = GetItemRect( TT_OUTPUT ).GetSize();
-/**/ aMinEditSize=Size(20,20);
- aMinEditSize.Width() *= 12;
- pEdit->SetSizePixel( aMinEditSize );
- pEdit->Show();
- SetItemWindow( TT_OUTPUT, pEdit );
- Resize();
- pContainer = new SysWinContainer( this );
- nEventHookID = Application::AddEventHook( stub_VCLEventHookProc, this );
-}
-
-DisplayHidWin::~DisplayHidWin()
-{
- Application::RemoveEventHook( nEventHookID );
- Hide(); // so GetFirstDocFrame won't return ourselves (needed for SOPlayer)
- SetParent( StatementList::GetFirstDocFrame() );
- delete pContainer;
- delete pEdit;
-}
-
-void DisplayHidWin::SetDraging( sal_Bool bNewDraging )
-{
- if ( !pShow )
- pShow = new Image( GetItemImage( TT_SHOW ) );
- if ( !pShow2 )
- pShow2 = new Image( Bitmap( TTProperties::GetSvtResId( TT_SHOW2 ) ) );
-
- if ( bNewDraging )
- SetItemImage( TT_SHOW, *pShow2 );
- else
- SetItemImage( TT_SHOW, *pShow );
-
- bIsDraging = bNewDraging;
-}
-
-void DisplayHidWin::EnableButtons( sal_uLong nConf )
-{
- sal_Bool bSend = sal_Bool(nConf & DH_MODE_SEND_DATA);
- EnableItem( TT_ALLWIN, bSend );
- EnableItem( TT_KURZNAME, bSend );
- EnableItem( TT_LANGNAME, bSend );
-}
-
-void DisplayHidWin::Tracking( const TrackingEvent& rTEvt )
-{
- if ( nLastItemID == TT_SHOW && GetItemState( TT_SHOW ) == STATE_NOCHECK )
- EndTracking( ENDTRACK_CANCEL );
- ToolBox::Tracking( rTEvt);
-}
-
-void DisplayHidWin::Click()
-{
- nLastItemID = GetCurItemId();
- if ( nLastItemID == TT_SHOW )
- {
- SetDraging( sal_True );
- }
- ToolBox::Click();
-}
-
-void DisplayHidWin::Select()
-{
- if ( GetItemState( GetCurItemId() ) == STATE_NOCHECK )
- {
- SetItemState( GetCurItemId(), STATE_CHECK );
- if ( GetCurItemId() == TT_SHOW )
- {
- bIsPermanentDraging = sal_True;
- SetDraging( sal_True );
- }
- }
- else
- {
- SetItemState( GetCurItemId(), STATE_NOCHECK );
- if ( GetCurItemId() == TT_SHOW )
- {
- bIsPermanentDraging = sal_False;
- SetDraging( sal_False );
- }
- }
- if ( GetCurItemId() == TT_SEND_DATA )
- {
- EnableButtons( GetConfig() );
- }
-}
-
-void DisplayHidWin::SetConfig( sal_uLong nConf )
-{
- SetItemState( TT_KURZNAME, ( nConf & DH_MODE_KURZNAME ) ? STATE_CHECK : STATE_NOCHECK );
- SetItemState( TT_LANGNAME, ( nConf & DH_MODE_LANGNAME ) ? STATE_CHECK : STATE_NOCHECK );
- SetItemState( TT_ALLWIN, ( nConf & DH_MODE_ALLWIN ) ? STATE_CHECK : STATE_NOCHECK );
- SetItemState( TT_SEND_DATA, ( nConf & DH_MODE_SEND_DATA ) ? STATE_CHECK : STATE_NOCHECK );
- EnableButtons( nConf );
-}
-
-sal_uLong DisplayHidWin::GetConfig()
-{
- sal_uLong nConf = 0;
- if ( GetItemState( TT_KURZNAME ) == STATE_CHECK )
- nConf |= DH_MODE_KURZNAME;
- if ( GetItemState( TT_LANGNAME ) == STATE_CHECK )
- nConf |= DH_MODE_LANGNAME;
- if ( GetItemState( TT_ALLWIN ) == STATE_CHECK )
- nConf |= DH_MODE_ALLWIN;
- if ( IsSendData() )
- nConf |= DH_MODE_SEND_DATA;
-
- return nConf;
-}
-
-void DisplayHidWin::SetText( const XubString& rStr )
-{
- pContainer->SetText( rStr );
-}
-
-long DisplayHidWin::VCLEventHook( NotifyEvent& rEvt )
-{
- if ( EVENT_MOUSEMOVE == rEvt.GetType() )
- {
- pLastMouseMoveWin = rEvt.GetWindow();
-
- // check if abort with pressing shift twice
- MouseEvent* pMEvt = (MouseEvent*)rEvt.GetMouseEvent();
-
- if ( ( pMEvt->IsShift() && !bOldShift ) ) // Shift pressed
- {
- if ( aLatest < Time( Time::SYSTEM ) )
- {
- nShiftCount = 0;
- aLatest = Time( Time::SYSTEM )+Time( 0, 0, 0, 50 );
- }
- nShiftCount++;
- }
- if ( ( !pMEvt->IsShift() && bOldShift ) ) // Shift released
- {
- nShiftCount++;
- if ( nShiftCount == 4 && aLatest > Time( Time::SYSTEM ) )
- {
- bIsPermanentDraging = sal_False;
- SetDraging( sal_False );
- SetItemState( TT_SHOW, STATE_NOCHECK );
- }
- }
- bOldShift = pMEvt->IsShift();
- }
- if ( ( ( EVENT_MOUSEBUTTONUP == rEvt.GetType() && rEvt.GetMouseEvent()->GetButtons() == MOUSE_LEFT) || ( EVENT_MOUSEMOVE == rEvt.GetType() && !rEvt.GetMouseEvent()->GetButtons() ) )
- && IsDraging() && !bIsPermanentDraging )
- SetDraging( sal_False );
- return 0;
-}
-
-
-sal_Bool StatementCommand::DisplayHID()
-{
- // Return sal_True -> reexecute command
-
- if ( !bBool2 ) // is initialized with sal_False
- {
- bBool2 = sal_True;
- GetTTSettings()->pDisplayInstance = this; // and have the power (all others quit themselves)
-
- if ( !(nParams & PARAM_UINT32_1) )
- {
- if( GetTTSettings()->pDisplayHidWin ) // don't change anything
- nLNr1_and_Pointer.nLNr1 = GetTTSettings()->pDisplayHidWin->GetConfig();
- else
- nLNr1_and_Pointer.nLNr1 = DH_MODE_KURZNAME | DH_MODE_LANGNAME;
-
- if( ((nParams & PARAM_BOOL_1) && bBool1) )
- nLNr1_and_Pointer.nLNr1 |= DH_MODE_SEND_DATA;
- else
- nLNr1_and_Pointer.nLNr1 &= ( ~DH_MODE_SEND_DATA );
- }
-
- if ( GetTTSettings()->pDisplayHidWin )
- GetTTSettings()->pDisplayHidWin->SetConfig( nLNr1_and_Pointer.nLNr1 );
- }
-
- if ( GetTTSettings()->pDisplayInstance && GetTTSettings()->pDisplayInstance != this )
- {
- DBG_WARNING("Mehrere DisplayHID am laufen");
- return sal_False; // another instance is doing the same!
- }
-
- if ( !GetTTSettings()->pDisplayHidWin )
- {
- GetTTSettings()->pDisplayHidWin = new DisplayHidWin();
- GetTTSettings()->aOriginalCaption = GetTTSettings()->pDisplayHidWin->GetText();
- GetTTSettings()->pDisplayHidWin->Show();
- if ( bBool1 )
- nLNr1_and_Pointer.nLNr1 |= DH_MODE_SEND_DATA;
- GetTTSettings()->pDisplayHidWin->SetConfig( nLNr1_and_Pointer.nLNr1 );
-
- GetTTSettings()->Old = NULL;
- GetTTSettings()->Act = NULL;
- GetTTSettings()->pDisplayInstance = this;
- }
- else
- {
- GetTTSettings()->pDisplayHidWin->GetWindow( WINDOW_OVERLAP )->Enable( sal_True, sal_True );
- GetTTSettings()->pDisplayHidWin->GetWindow( WINDOW_OVERLAP )->EnableInput( sal_True, sal_True );
- }
-
-
- if ( GetTTSettings()->pDisplayHidWin->IsVisible() && !bDying )
- {
-
- if ( GetTTSettings()->pDisplayHidWin->IsDraging() )
- {
-
-
-#define HIGHLIGHT_WIN( WinPtr ) \
- { \
- Color aLineColMem = WinPtr->GetLineColor(); \
- WinPtr->SetLineColor( Color( COL_WHITE ) ); \
- Color aFillColMem = WinPtr->GetFillColor(); \
- WinPtr->SetFillColor( Color( COL_LIGHTRED ) ); \
- RasterOp aROp = WinPtr->GetRasterOp(); \
- WinPtr->SetRasterOp( ROP_XOR ); \
- Size aSz = WinPtr->PixelToLogic( WinPtr->GetSizePixel() );\
- sal_uLong nMaxCornerRadius = WinPtr->PixelToLogic( Point( 80, 0 ) ).X();\
- 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))));\
- WinPtr->DrawRect(Rectangle(Point(),aSz), iCorner, iCorner);\
- WinPtr->SetLineColor( aLineColMem ); \
- WinPtr->SetFillColor( aFillColMem ); \
- WinPtr->SetRasterOp( aROp ); \
- }
-
-
-#define SET_WIN( WinPtr ) \
- if ( StatementList::WinPtrValid(WinPtr) ) \
- { \
- HIGHLIGHT_WIN ( WinPtr ); \
- }
-
-#define RESET_WIN( WinPtr ) \
- if ( StatementList::WinPtrValid(WinPtr) ) \
- { \
- WinPtr->Invalidate( INVALIDATE_NOTRANSPARENT ); \
- WinPtr->Update(); \
- }
-
-
- GetTTSettings()->Old = GetTTSettings()->Act;
- GetTTSettings()->Act = GetTTSettings()->pDisplayHidWin->LastMouseMoveWin();
-
- if ( !StatementList::WinPtrValid ( GetTTSettings()->Old ) )
- GetTTSettings()->Old = NULL;
- if ( !StatementList::WinPtrValid ( GetTTSettings()->Act ) )
- GetTTSettings()->Act = NULL;
-
- if ( GetTTSettings()->Act && GetTTSettings()->Act->GetType() == WINDOW_BORDERWINDOW )
- GetTTSettings()->Act = GetTTSettings()->Act->GetWindow( WINDOW_CLIENT );
-
- if ( GetTTSettings()->Act != GetTTSettings()->Old )
- {
- if ( GetTTSettings()->Old )
- {
- RESET_WIN(GetTTSettings()->Old);
- }
- if ( GetTTSettings()->Act )
- {
- SET_WIN(GetTTSettings()->Act);
- GetTTSettings()->pDisplayHidWin->SetDisplayText( Id2Str(GetTTSettings()->Act->GetUniqueOrHelpId()).AppendAscii(" WinType: ")
- .Append(UniString::CreateFromInt64(GetTTSettings()->Act->GetType())).AppendAscii(" ").Append(GetTTSettings()->Act->GetText()));
- if ( GetTTSettings()->Act && !GetTTSettings()->Act->GetUniqueId().equals( GetTTSettings()->Act->GetHelpId() ) )
- GetTTSettings()->pDisplayHidWin->SetText(UniString( TTProperties::GetSvtResId( TT_ALTERNATE_CAPTION ) ).AppendAscii(GetTTSettings()->Act->GetHelpId().getStr()));
- else
- GetTTSettings()->pDisplayHidWin->SetText( GetTTSettings()->aOriginalCaption );
- }
- else
- GetTTSettings()->pDisplayHidWin->SetDisplayText(CUniString("Kein Window/Control gefunden"));
- }
- else if ( GetTTSettings()->Act )
- {
- // allow setting a HelpID manually (just enter the ID in the displayHID Window and terminate it by |
- if ( GetTTSettings()->pDisplayHidWin->IsDisplayTextModified() && GetTTSettings()->pDisplayHidWin->GetDisplayText().GetTokenCount( '|' ) > 1 )
- {
- GetTTSettings()->Act->SetUniqueId( Str2Id( GetTTSettings()->pDisplayHidWin->GetDisplayText().GetToken( '|' ) ) );
- GetTTSettings()->pDisplayHidWin->ClearDisplayTextModified();
- }
- }
-
- if ( GetTTSettings()->pDisplayHidWin->IsSendData() && GetTTSettings()->Act )
- {
- if ( !StatementFlow::bSending )
- { // usually synchronization over the protocol. But it's asynchronous here!!!
- WriteControlData( GetTTSettings()->Act, GetTTSettings()->pDisplayHidWin->GetConfig() );
- new StatementFlow( this, F_EndCommandBlock ); // create command for sending and enter it on que
- }
- }
- }
- else
- {
- if ( GetTTSettings()->Act )
- {
- RESET_WIN(GetTTSettings()->Act);
- GetTTSettings()->Act = NULL;
- }
- }
-
- if ( pFirst == this )
- if ( pNext )
- {
- Advance();
- QueStatement( NULL );
- }
- }
- else
- {
- delete GetTTSettings()->pDisplayHidWin;
- GetTTSettings()->pDisplayHidWin = NULL;
- GetTTSettings()->pDisplayInstance = NULL;
- }
-
- return GetTTSettings()->pDisplayHidWin != NULL;
-}
-
-class TranslateWin : public WorkWindow
-{
-private:
- DECL_LINK( DoAccept, PushButton* );
- DECL_LINK( DoNext, PushButton* );
- DECL_LINK( DoSelect, PushButton* );
- DECL_LINK( DoRestore, PushButton* );
- DECL_LINK( TranslationChanged, Edit* );
- DECL_LINK( ShowInplace, Timer* );
-
- Timer InplaceTimer;
-
- PushButton PushButtonTT_PB_NEXT;
- GroupBox GroupBoxTT_GB_TRANSLATION;
- Edit EditTT_E_NEW;
- GroupBox GroupBoxTT_GB_COMMENT;
- Edit EditTT_E_COMMENT;
- PushButton PushButtonTT_PB_ACCEPT;
- FixedText FixedTextTT_FT_OLD;
- PushButton PushButtonTT_PB_SELECT;
- PushButton PushButtonTT_PB_RESTORE;
-
- Window *Old;
- Window *Act;
- Window *pTranslateWin;
- sal_Bool bSelecting;
-
- sal_Bool bAvailable;
- sal_Bool bNext;
-
- sal_Bool TestChangedDataSaved();
-
-
- sal_uLong nEventHookID;
- static long stub_VCLEventHookProc( NotifyEvent& rEvt, void* pData )
- {
- return ((TranslateWin*)pData)->VCLEventHook( rEvt );
- }
-
- long VCLEventHook( NotifyEvent& rEvt );
-
-public:
- TranslateWin();
- ~TranslateWin();
-
- static String MarkShortcutErrors( Window* pBase, sal_Bool bMark );
-
- sal_Bool IsTranslationAvailable(){ return bAvailable; }
- sal_Bool IsNextDialog(){ return bNext; }
- void ResetNextDialog(){ bNext = sal_False; }
-
- Window* GetTranslationWindow(){ return pTranslateWin; }
- String GetOriginalText(){ return FixedTextTT_FT_OLD.GetText(); }
- String GetTranslationText(){ return EditTT_E_NEW.GetText(); }
- String GetComment(){ return EditTT_E_COMMENT.GetText(); }
-
- void EnableTranslation();
-};
-
-TranslateWin::TranslateWin()
-: WorkWindow( NULL, TTProperties::GetSvtResId( TT_INLINE_TRANSLATION ) )
-, PushButtonTT_PB_NEXT( this, TTProperties::GetSvtResId( TT_PB_NEXT ) )
-, GroupBoxTT_GB_TRANSLATION( this, TTProperties::GetSvtResId( TT_GB_TRANSLATION ) )
-, EditTT_E_NEW( this, TTProperties::GetSvtResId( TT_E_NEW ) )
-, GroupBoxTT_GB_COMMENT( this, TTProperties::GetSvtResId( TT_GB_COMMENT ) )
-, EditTT_E_COMMENT( this, TTProperties::GetSvtResId( TT_E_COMMENT ) )
-, PushButtonTT_PB_ACCEPT( this, TTProperties::GetSvtResId( TT_PB_ACCEPT ) )
-, FixedTextTT_FT_OLD( this, TTProperties::GetSvtResId( TT_FT_OLD ) )
-, PushButtonTT_PB_SELECT( this, TTProperties::GetSvtResId( TT_PB_SELECT ) )
-, PushButtonTT_PB_RESTORE( this, TTProperties::GetSvtResId( TT_PB_RESTORE ) )
-, Old( NULL )
-, Act( NULL )
-, pTranslateWin( NULL )
-, bSelecting( sal_False )
-, bAvailable( sal_False )
-, bNext( sal_False )
-{
- FreeResource();
- PushButtonTT_PB_NEXT.SetClickHdl( LINK( this, TranslateWin, DoNext ) );
- PushButtonTT_PB_ACCEPT.SetClickHdl( LINK( this, TranslateWin, DoAccept ) );
- PushButtonTT_PB_SELECT.SetClickHdl( LINK( this, TranslateWin, DoSelect ) );
- PushButtonTT_PB_RESTORE.SetClickHdl( LINK( this, TranslateWin, DoRestore ) );
- EditTT_E_NEW.SetModifyHdl( LINK( this, TranslateWin, TranslationChanged ) );
- InplaceTimer.SetTimeout( 250 );
- InplaceTimer.SetTimeoutHdl( LINK( this, TranslateWin, ShowInplace ) );
- EnableAlwaysOnTop();
- nEventHookID = Application::AddEventHook( stub_VCLEventHookProc, this );
-}
-
-TranslateWin::~TranslateWin()
-{
- Application::RemoveEventHook( nEventHookID );
-}
-
-sal_Bool TranslateWin::TestChangedDataSaved()
-{
- if ( ( EditTT_E_NEW.GetText().CompareTo( FixedTextTT_FT_OLD.GetText() ) != COMPARE_EQUAL
- || EditTT_E_COMMENT.GetText().Len() )
- && PushButtonTT_PB_ACCEPT.IsEnabled() )
- {
- return MessBox( this, TTProperties::GetSvtResId( TT_DISCARD_CHANGED_DATA ) ).Execute() == RET_YES;
- }
- else
- return sal_True;
-}
-
-IMPL_LINK( TranslateWin, DoAccept, PushButton*, EMPTYARG )
-{
- PushButtonTT_PB_SELECT.Disable();
- PushButtonTT_PB_NEXT.Disable();
- PushButtonTT_PB_RESTORE.Disable();
- EditTT_E_NEW.Disable();
- EditTT_E_COMMENT.Disable();
- PushButtonTT_PB_ACCEPT.Disable();
- bAvailable = sal_True;
- return 0;
-}
-
-IMPL_LINK( TranslateWin, DoNext, PushButton*, EMPTYARG )
-{
- if ( TestChangedDataSaved() )
- {
- PushButtonTT_PB_SELECT.Disable();
- PushButtonTT_PB_NEXT.Disable();
- PushButtonTT_PB_RESTORE.Disable();
- EditTT_E_NEW.Disable();
- EditTT_E_COMMENT.Disable();
- PushButtonTT_PB_ACCEPT.Disable();
- bNext = sal_True;
- }
- return 0;
-}
-
-IMPL_LINK( TranslateWin, DoSelect, PushButton*, EMPTYARG )
-{
- if ( bSelecting )
- {
- bSelecting = sal_False;
- }
- else
- {
- if ( TestChangedDataSaved() )
- {
- PushButtonTT_PB_RESTORE.Disable();
- bSelecting = sal_True;
- }
- }
- return 0;
-}
-
-IMPL_LINK( TranslateWin, DoRestore, PushButton*, EMPTYARG )
-{
- String sTT_E_OLD( FixedTextTT_FT_OLD.GetText());
- sTT_E_OLD.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
- sTT_E_OLD.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
-
- String sTT_E_NEW( EditTT_E_NEW.GetText());
- sTT_E_NEW.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
- sTT_E_NEW.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
-
- if ( StatementList::WinPtrValid( pTranslateWin ) && pTranslateWin->GetText().CompareTo( sTT_E_NEW ) == COMPARE_EQUAL )
- {
- pTranslateWin->SetText( sTT_E_OLD );
- }
- else
- {
- EditTT_E_NEW.SetText( FixedTextTT_FT_OLD.GetText() );
- PushButtonTT_PB_RESTORE.Disable();
- }
- if ( StatementList::WinPtrValid( pTranslateWin ) )
- MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True );
- return 0;
-}
-
-IMPL_LINK( TranslateWin, TranslationChanged, Edit*, pEdit )
-{
- (void) pEdit; /* avoid warning about unused parameter */
- PushButtonTT_PB_RESTORE.Enable();
- InplaceTimer.Start();
- return 0;
-}
-
-IMPL_LINK( TranslateWin, ShowInplace, Timer*, EMPTYARG )
-{
- PushButtonTT_PB_RESTORE.Enable();
- if ( StatementList::WinPtrValid( pTranslateWin ) )
- {
- String sTT_E_NEW( EditTT_E_NEW.GetText());
- // alle CRs UnQuoten
- sTT_E_NEW.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") );
- // alle TABSs UnQuoten
- sTT_E_NEW.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") );
- pTranslateWin->SetText( sTT_E_NEW );
-
- MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True );
- }
- return 0;
-}
-
-long TranslateWin::VCLEventHook( NotifyEvent& rEvt )
-{
- if ( EVENT_MOUSEMOVE == rEvt.GetType() )
- {
- if ( bSelecting )
- {
- const MouseEvent *pMEvt = rEvt.GetMouseEvent();
- Old = Act;
- Act = rEvt.GetWindow();
-
- if ( Act )
- {
- Window *pWin = Act;
- sal_uInt16 i;
- for ( i = 0 ; i < Act->GetChildCount() ; i++ )
- {
- pWin = Act->GetChild(i);
- Rectangle aWinPosSize( pWin->GetPosPixel(), pWin->GetSizePixel() );
-
- if ( ( pWin->IsMouseTransparent() || !pWin->IsEnabled() ) && aWinPosSize.IsInside( pMEvt->GetPosPixel() ) )
- {
- Act = pWin;
- break;
- }
- }
- }
-
- if ( !StatementList::WinPtrValid ( Old ) )
- Old = NULL;
-
- if ( Act != Old )
- {
- if ( Old )
- {
- Window *pWin;
- if ( Old->IsMouseTransparent() && Old->GET_REAL_PARENT() )
- pWin = Old->GET_REAL_PARENT();
- else
- pWin = Old;
- RESET_WIN(pWin);
- }
- if ( Act )
- {
- SET_WIN(Act);
- FixedTextTT_FT_OLD.SetText( Act->GetText() );
- }
- else
- FixedTextTT_FT_OLD.SetText( String() );
- }
- else if ( Act )
- {
- }
- }
- else
- {
- if ( Act )
- {
- if ( Act->IsMouseTransparent() && Act->GET_REAL_PARENT() )
- Act = Act->GET_REAL_PARENT();
- RESET_WIN(Act);
- Act = NULL;
- }
- }
- }
- else if ( EVENT_MOUSEBUTTONUP == rEvt.GetType() )
- {
- if ( bSelecting )
- {
- pTranslateWin = Act;
- if ( pTranslateWin )
- {
- MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True );
- // quote all CRs (NF)
- String sTT_E_NEW( pTranslateWin->GetText());
- sTT_E_NEW.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") );
- // quote all TABSs ()
- sTT_E_NEW.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") );
-
- FixedTextTT_FT_OLD.SetText( sTT_E_NEW );
- EditTT_E_NEW.SetText( sTT_E_NEW );
- EditTT_E_NEW.Enable();
- EditTT_E_NEW.GrabFocus();
- EditTT_E_COMMENT.SetText( String() );
- EditTT_E_COMMENT.Enable();
- PushButtonTT_PB_ACCEPT.Enable();
- }
- bSelecting = sal_False;
- }
- }
-
- return 0;
-}
-
-#define FDS_ACTION_COLLECT 1
-#define FDS_ACTION_MARK 2
-#define FDS_ACTION_UNMARK 3
-
-class FindShortcutErrors: public Search
-{
- String aShortcuts,aDoubleShortcuts;
- sal_uInt16 nAction;
-public:
- FindShortcutErrors();
- virtual sal_Bool IsWinOK( Window *pWin );
- void SetAction( sal_uInt16 nA );
- String GetDoubleShortcuts() { return aDoubleShortcuts; }
-};
-
-FindShortcutErrors::FindShortcutErrors()
-: Search( SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN )
-{
- SetAction( FDS_ACTION_COLLECT );
-}
-
-void FindShortcutErrors::SetAction( sal_uInt16 nA )
-{
- nAction = nA;
- if ( FDS_ACTION_COLLECT == nAction )
- {
- aShortcuts = UniString();
- aDoubleShortcuts = UniString();
- }
-}
-
-sal_Bool FindShortcutErrors::IsWinOK( Window *pWin )
-{
- if ( pWin->IsReallyVisible() )
- {
- String aText = pWin->GetText();
- xub_StrLen nPos = aText.Search('~');
- String aShortcut;
- sal_Bool bHasAccel = sal_False;
- if ( nPos != STRING_NOTFOUND )
- {
- aShortcut = aText.Copy( nPos+1, 1 );
- aShortcut.ToLowerAscii();
- bHasAccel = aShortcut.Len() == 1;
- }
-
- switch ( nAction )
- {
- case FDS_ACTION_COLLECT:
- {
- if ( aShortcuts.Search( aShortcut ) != STRING_NOTFOUND )
- aDoubleShortcuts += aShortcut;
- else
- aShortcuts += aShortcut;
- }
- break;
- case FDS_ACTION_MARK:
- {
- sal_Bool bMissing = sal_False;
- if ( !bHasAccel && aText.Len() ) // should there be an accelarator defined
- {
-
- Window* pChild;
- pChild = pWin->GetWindow( WINDOW_CLIENT );
-
- if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
- (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
- (pChild->GetType() == WINDOW_CHECKBOX) ||
- (pChild->GetType() == WINDOW_TRISTATEBOX) ||
- (pChild->GetType() == WINDOW_PUSHBUTTON) )
- {
- if ( !pChild->GetText().EqualsAscii( "..." ) )
- bMissing = sal_True;
- }
-
- if ( pChild->GetType() == WINDOW_FIXEDTEXT )
- {
- Window* pTempChild = pWin->GetWindow( WINDOW_NEXT );
- if ( pTempChild )
- pTempChild = pTempChild->GetWindow( WINDOW_CLIENT );
-
- if ( pTempChild && pChild->GetText().Len() )
- {
- if ( (pTempChild->GetType() == WINDOW_EDIT) ||
- (pTempChild->GetType() == WINDOW_MULTILINEEDIT) ||
- (pTempChild->GetType() == WINDOW_SPINFIELD) ||
- (pTempChild->GetType() == WINDOW_PATTERNFIELD) ||
- (pTempChild->GetType() == WINDOW_NUMERICFIELD) ||
- (pTempChild->GetType() == WINDOW_METRICFIELD) ||
- (pTempChild->GetType() == WINDOW_CURRENCYFIELD) ||
- (pTempChild->GetType() == WINDOW_DATEFIELD) ||
- (pTempChild->GetType() == WINDOW_TIMEFIELD) ||
- (pTempChild->GetType() == WINDOW_LISTBOX) ||
- (pTempChild->GetType() == WINDOW_MULTILISTBOX) ||
- (pTempChild->GetType() == WINDOW_COMBOBOX) ||
- (pTempChild->GetType() == WINDOW_PATTERNBOX) ||
- (pTempChild->GetType() == WINDOW_NUMERICBOX) ||
- (pTempChild->GetType() == WINDOW_METRICBOX) ||
- (pTempChild->GetType() == WINDOW_CURRENCYBOX) ||
- (pTempChild->GetType() == WINDOW_DATEBOX) ||
- (pTempChild->GetType() == WINDOW_TIMEBOX) )
- {
- bMissing = sal_True;
- }
- }
- }
- }
-
- if ( bHasAccel && aDoubleShortcuts.Search( aShortcut ) != STRING_NOTFOUND )
- {
- if ( pWin->GetType() == WINDOW_GROUPBOX )
- pWin->SetControlForeground( Color( COL_LIGHTRED ) );
- else
- {
- pWin->SetControlBackground();
- Color aCol(COL_GRAY);
- aCol.SetRed( 0xff );
- pWin->SetControlBackground( aCol );
- }
- }
- else if ( bMissing )
- {
- pWin->SetControlBackground();
- Color aCol(COL_GRAY);
- aCol.SetRed( 0xff );
- aCol.SetGreen( 0xff );
- pWin->SetControlBackground( aCol );
- }
- else
- {
- pWin->SetControlForeground();
- pWin->SetControlBackground();
- }
- }
- break;
- case FDS_ACTION_UNMARK:
- {
- pWin->SetControlForeground();
- pWin->SetControlBackground();
- }
- break;
- }
- }
- else
- if ( FDS_ACTION_MARK == nAction || FDS_ACTION_UNMARK == nAction )
- {
- pWin->SetControlForeground();
- pWin->SetControlBackground();
- }
-
- return sal_False;
-}
-
-String TranslateWin::MarkShortcutErrors( Window* pBase, sal_Bool bMark )
-{
- if ( pBase )
- {
- FindShortcutErrors aFinder;
- if ( bMark )
- {
- StatementList::SearchAllWin( pBase, aFinder, sal_True ); // collect Shortcuts first
- aFinder.SetAction( FDS_ACTION_MARK );
- }
- else
- aFinder.SetAction( FDS_ACTION_UNMARK );
- StatementList::SearchAllWin( pBase, aFinder, sal_True );
- return aFinder.GetDoubleShortcuts();
- }
- return UniString();
-}
-
-void TranslateWin::EnableTranslation()
-{
- PushButtonTT_PB_SELECT.Enable();
- PushButtonTT_PB_NEXT.Enable();
- bAvailable = sal_False;
- bNext = sal_False;
-}
-
-void StatementCommand::Translate()
-{
- // there's an initial UniqueId so only deliver the doubled shortcuts
- if( (nParams & PARAM_STR_1) && nLNr1_and_Pointer.nLNr1 )
- {
- String aDouble;
- Window *pWin = SearchTree( Str2Id( aString1 ) ,sal_False );
- if ( pWin )
- {
- pWin = pWin->GetWindow( WINDOW_OVERLAP );
- aDouble = TranslateWin::MarkShortcutErrors( pWin, sal_True );
- }
- pRet->GenReturn ( RET_Value, nMethodId, aDouble );
- return;
- }
-
- if ( !GetTTSettings()->pTranslateWin )
- {
- GetTTSettings()->pTranslateWin = new TranslateWin;
- GetTTSettings()->bToTop = sal_True;
- }
-
- GetTTSettings()->pTranslateWin->Show();
- if ( GetTTSettings()->bToTop )
- {
- GetTTSettings()->pTranslateWin->ToTop();
- GetTTSettings()->bToTop = sal_False;
- }
-
- GetTTSettings()->pTranslateWin->GetWindow( WINDOW_OVERLAP )->EnableInput( sal_True, sal_True );
-
- if ( GetTTSettings()->pTranslateWin->IsTranslationAvailable() )
- {
- String aTranslation;
- Window* pTranslationWindow = GetTTSettings()->pTranslateWin->GetTranslationWindow();
-
- DBG_ASSERT( pTranslationWindow, "Kein Translation Window" );
-
- if ( WinPtrValid( pTranslationWindow ) )
- {
- if ( pTranslationWindow->GetType() == WINDOW_BORDERWINDOW && pTranslationWindow->GetWindow( WINDOW_CLIENT ) )
- {
- Window* pNew = pTranslationWindow->GetWindow( WINDOW_CLIENT );
-
- while ( IsDialog( pNew ) && !pNew->GetUniqueOrHelpId().getLength() && pNew->GetChildCount() == 1 )
- pNew = pNew->GetChild( 0 );
- pTranslationWindow = pNew;
- }
-
- aTranslation = CUniString("0;");
-
- aTranslation += Id2Str( pTranslationWindow->GetUniqueOrHelpId() );
- aTranslation += ';';
-
- aTranslation += TypeString( pTranslationWindow->GetType() );
- aTranslation += ';';
-
- Window* pParentDialog = pTranslationWindow;
- while ( pParentDialog && !IsDialog( pParentDialog ) )
- {
- pParentDialog = pParentDialog->GET_REAL_PARENT();
- }
-
- if ( pParentDialog )
- {
- aTranslation += Id2Str(pParentDialog->GetUniqueOrHelpId());
- aTranslation += ';';
- aTranslation += TypeString( pParentDialog->GetType() );
- }
- else
- aTranslation.AppendAscii( "0;" );
- aTranslation += ';';
-
- aTranslation += '\"';
- aTranslation += GetTTSettings()->pTranslateWin->GetOriginalText();
- aTranslation += '\"';
-
- aTranslation += ';';
-
- aTranslation += '\"';
- aTranslation += GetTTSettings()->pTranslateWin->GetTranslationText();
- aTranslation += '\"';
-
- aTranslation += ';';
-
- aTranslation += '\"';
- aTranslation += GetTTSettings()->pTranslateWin->GetComment();
- aTranslation += '\"';
-
- // quote all CRs (NF)
- aTranslation.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") );
- // quote all TABSs ()
- aTranslation.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") );
-
- pRet->GenReturn ( RET_Value, nMethodId, aTranslation );
- GetTTSettings()->pTranslateWin->EnableTranslation();
- GetTTSettings()->bToTop = sal_True;
- }
- else
- {
- pRet->GenReturn ( RET_Value, nMethodId, String() );
- GetTTSettings()->pTranslateWin->EnableTranslation();
- ErrorBox err( GetTTSettings()->pTranslateWin, TTProperties::GetSvtResId( TT_NO_CONTROL ));
- err.Execute();
- GetTTSettings()->bToTop = sal_True;
- }
-
- }
- else if ( GetTTSettings()->pTranslateWin->IsNextDialog() )
- {
- pRet->GenReturn ( RET_Value, nMethodId, CUniString("1") );
- GetTTSettings()->pTranslateWin->ResetNextDialog();
- GetTTSettings()->pTranslateWin->LoseFocus();
- GetTTSettings()->bToTop = sal_True;
- }
- else
- {
- GetTTSettings()->pTranslateWin->EnableTranslation();
- pRet->GenReturn ( RET_Value, nMethodId, String() );
- }
-}
-
-Window* StatementCommand::GetNextOverlap( Window* pBase )
-{ // finds some overlap windows that look closable
- // maybe the choice must be improved
-
- if ( pBase->GetType() != WINDOW_BORDERWINDOW )
- pBase = pBase->GetWindow( WINDOW_OVERLAP );
-
- Window *pControl = NULL;
- if ( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) )
- {
- pControl = GetNextOverlap( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) );
- }
-
- if ( !pControl && pBase->GetWindow( WINDOW_NEXT ) )
- {
- pControl = GetNextOverlap( pBase->GetWindow( WINDOW_NEXT ) );
- }
-
- if ( !pControl )
- {
- Window *pTest = pBase->GetWindow( WINDOW_CLIENT );
- if ( IsAccessable (pTest)
- && pTest->IsEnabled()
- && pTest->IsVisible()
- && ((pTest->GetStyle() & WB_CLOSEABLE ) || (pBase->GetStyle() & WB_CLOSEABLE )) )
- return pTest;
- else
- return NULL;
- }
- else
- return pControl;
-}
-
-Window* StatementCommand::GetNextRecoverWin()
-{
-
- Window* pBase = Application::GetFirstTopLevelWindow();
- Window *pControl = NULL;
- Window* pMyFirstDocFrame = NULL;
- while ( pBase )
- {
-
- pControl = GetNextOverlap( pBase );
- if ( pControl && pControl->GetType() == WINDOW_HELPTEXTWINDOW )
- {} // skip it
- else
- {
- if ( pControl && pControl->IsVisible() && !IsFirstDocFrame( pControl ) && !IsIMEWin( pControl ) )
- {
- Window* pTB = pControl->GetChild( 0 );
- if ( pControl->GetChildCount() == 1 && pTB->GetType() == WINDOW_TOOLBOX )
- ; // do not act on floating toolboxes #i38796
- else
- return pControl;
- }
-
- // then close the window itself
- // skip first DocWin
- // Assumption that Doc Windows are Borderwindows and ButtonDialog and such are not
- if ( pBase->IsVisible() && !IsFirstDocFrame( pBase ) && pBase->GetType() != WINDOW_BORDERWINDOW && !IsIMEWin( pBase ) )
- return pBase;
-
- if ( !pMyFirstDocFrame && IsFirstDocFrame( pBase ) )
- pMyFirstDocFrame = pBase;
- }
-
- pBase = Application::GetNextTopLevelWindow( pBase );
- }
- // close the FirstDocFrame last, It will not be closed, but the Document inside will be closed.
- if ( IsDocWin( pMyFirstDocFrame ) )
- return pMyFirstDocFrame;
-
- return NULL;
-}
-
-sal_Bool StatementCommand::Execute()
-{
- if ( IsError )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Skipping Command: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
- m_pDbgWin->AddText( "\n" );
- #endif
-
- Advance();
- delete this;
- return sal_True;
- }
-
- InitProfile();
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Executing Command: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
- m_pDbgWin->AddText( "\n" );
-#endif
-
-
-
-
-
-#if OSL_DEBUG_LEVEL > 1
-#define REPORT_WIN_CLOSED(pControl, aInfo) \
- _REPORT_WIN_CLOSED(pControl, aInfo) \
- m_pDbgWin->AddText( aInfo.AppendAscii(" \"").Append( pControl->GetText() ).AppendAscii("\" geschlossen, RType = ").Append( TypeString(pControl->GetType()) ).AppendAscii(", UId = ").Append( UIdString( pControl->GetUniqueOrHelpId() ) ) );
-#else
-#define REPORT_WIN_CLOSED(pControl, aInfo) _REPORT_WIN_CLOSED(pControl, aInfo)
-#endif
-
-#define REPORT_WIN_CLOSEDc(pControl, aInfo ) \
- REPORT_WIN_CLOSED(pControl, CUniString(aInfo) )
-
-#define _REPORT_WIN_CLOSED(pControl, aInfo) \
- if ( aString1.Len() ) \
- aString1 += '\n'; \
- aString1 += aInfo; \
- aString1.AppendAscii(" \""); \
- aString1 += pControl->GetText(); \
- aString1.AppendAscii("\" geschlossen, RType = ");\
- aString1 += TypeString(pControl->GetType()); \
- aString1.AppendAscii(", UId = "); \
- aString1 += UIdString(pControl->GetUniqueOrHelpId());
-
-
- switch ( nMethodId )
- {
- case RC_AppDelay:
- if ( !bBool1 )
- {
- nLNr1_and_Pointer.nLNr1 = Time( Time::SYSTEM ).GetTime() + nNr1/10;
- bBool1 = sal_True;
- }
- if ( Time( Time::SYSTEM ).GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) )
- return sal_False;
- break;
- case RC_DisplayHid:
- if ( DisplayHID() )
- return sal_False;
- break;
- case RC_ResetApplication:
- {
- if ( !bBool1 )
- {
- nRetryCount = 150;
- bBool1 = sal_True;
- nNr1 = 1;
- nLNr1_and_Pointer.pWindow = 0; // save the AppWin
- aString1 = UniString(); // list of closed windows
-
- nUseBindings = 0;
- bCatchGPF = sal_True;
- bUsePostEvents = sal_True;
-
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
- }
- if ( !nRetryCount )
- ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_COMPLEX ) );
-
- Window *pControl = GetNextRecoverWin();
-
- if ( pControl )
- {
- bBool2 = sal_False; // flag for wait when all windows are closed
- pControl->GrabFocus();
-
- if ( pControl->GetType() != WINDOW_DOCKINGWINDOW
- && pControl->GetType() != WINDOW_FLOATINGWINDOW
- && pControl->GetType() != WINDOW_MODELESSDIALOG
- && pControl->GetType() != WINDOW_WORKWINDOW
- && pControl->GetType() != WINDOW_TOOLBOX
- && pControl->GetType() != WINDOW_BORDERWINDOW
- && nRetryCount-- )
- {
- short nRT = ImpGetRType( pControl );
-
- if ( nRT == C_TabControl && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- { // take belonging tab if tabcontrol
- pControl = pControl->GET_REAL_PARENT();
- nRT = ImpGetRType( pControl );
- }
-
- switch( nRT )
- {
- case C_ModalDlg:
- case C_Dialog:
- case C_TabDlg:
- REPORT_WIN_CLOSEDc(pControl, "Dialog");
- SET_WINP_CLOSING(pControl);
- ((SystemWindow*)pControl)->Close();
- break;
- case C_WorkWin:
- break;
- case C_MessBox:
- case C_InfoBox:
- case C_WarningBox:
- case C_ErrorBox:
- case C_QueryBox:
- case C_ButtonDialog:
- {
- ButtonDialog* pBD = (ButtonDialog*)pControl;
- // nNr1 >= 10 means go through (Custom)-Buttons
- if ( nNr1 >= 10+pBD->GetButtonCount() ) nNr1 = 1;
- switch( nNr1 )
- {
- case 5:
- if ( pBD->GetPushButton( BUTTONID_OK ) )
- {
- REPORT_WIN_CLOSEDc(pControl, "Message Box (OK)");
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_OK);
- }
- nNr1 = 10;
- break;
- case 4:
- if ( pBD->GetPushButton( BUTTONID_CANCEL ) )
- {
- REPORT_WIN_CLOSEDc(pControl, "Message Box (Cancel)");
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_CANCEL);
- }
- nNr1++;
- break;
- case 3:
- if ( pBD->GetPushButton( BUTTONID_YES ) )
- {
- REPORT_WIN_CLOSEDc(pControl, "Message Box (Yes)");
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_YES);
- }
- nNr1++;
- break;
- case 2:
- case 1:
- if ( pBD->GetPushButton( BUTTONID_NO ) )
- {
- REPORT_WIN_CLOSEDc(pControl, "Message Box (No)");
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_NO);
- }
- nNr1++;
- break;
- default:
- {
- sal_uInt16 nID = pBD->GetButtonId( nNr1-10 );
- if ( nID != BUTTONID_HELP )
- {
- REPORT_WIN_CLOSED(pControl, CUniString("Message Box (").Append( UniString::CreateFromInt32(nID) ).AppendAscii(")"));
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(nID);
- }
- nNr1++;
- }
- }
- break;
- }
- default:
- OSL_FAIL( "Unknown Windowtype" );
- REPORT_WIN_CLOSEDc(pControl, "Unknown Windowtype");
- ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_UNKNOWN ), pControl->GetType() );
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( " Unbekannter Objekttyp aus UId" );
- #endif
- break;
- }
- return sal_False;
- }
- else
- {
- if ( (pControl->GetType() == WINDOW_DOCKINGWINDOW || pControl->GetType() == WINDOW_TOOLBOX) && nRetryCount-- )
- {
- if ( (((DockingWindow*)pControl)->GetStyle() | ((DockingWindow*)pControl)->GetFloatStyle()) & WB_CLOSEABLE )
- {
- REPORT_WIN_CLOSED(pControl, TypeString(pControl->GetType()));
- SET_WINP_CLOSING(pControl);
- ((DockingWindow*)pControl)->Close();
-
- // actually only for TaskWindows! let's hope there are no DockingWindows messing it up
- if ( nLNr1_and_Pointer.pWindow != pControl )
- nNr1 = 1; // to try buttons during closing
- nLNr1_and_Pointer.pWindow = pControl;
-
- return sal_False;
- }
- }
- if ( nRetryCount--
- && ( (pControl->GetType() == WINDOW_FLOATINGWINDOW)
- || (pControl->GetType() == WINDOW_MODELESSDIALOG)
- || (pControl->GetType() == WINDOW_WORKWINDOW)
- || (pControl->GetType() == WINDOW_BORDERWINDOW) ) )
- {
- // Special handling for last Document; do not close the Frame, only the Document
- if ( GetDocWinCount() == 1 && IsDocFrame( pControl ) )
- {
- if ( IsDocWin( pControl ) )
- {
- if ( GetDocFrameMenuBar( pControl ) )
- {
- MenuBar* pMenu = GetDocFrameMenuBar( pControl );
- if ( pMenu->HasCloser() )
- {
- REPORT_WIN_CLOSED( pControl, TypeString(pControl->GetType()));
- SET_WINP_CLOSING(pControl);
-
- pMenu->GetCloserHdl().Call( pMenu );
-
- // only for TaskWindows!
- if ( nLNr1_and_Pointer.pWindow != pControl )
- nNr1 = 1;
- nLNr1_and_Pointer.pWindow = pControl;
-
- return sal_False;
- }
- }
- }
- }
- else
- {
- REPORT_WIN_CLOSED( pControl, TypeString(pControl->GetType()));
- SET_WINP_CLOSING(pControl);
- ((SystemWindow*)pControl)->Close();
-
- // actually only for TaskWindows!
- if ( nLNr1_and_Pointer.pWindow != pControl )
- nNr1 = 1;
- nLNr1_and_Pointer.pWindow = pControl;
-
- return sal_False;
- }
- }
- }
- }
- // wait for some time if more windows show up
- // E.g.: Floating toolbars on a Task which was hidden by another Task before
- if ( !bBool2 )
- {
- nLNr1_and_Pointer.nLNr1 = Time( Time::SYSTEM ).GetTime() + 100; // 100 = 1 Second
- bBool2 = sal_True;
- }
- if ( Time( Time::SYSTEM ).GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) )
- return sal_False;
- else
- pRet->GenReturn ( RET_Value, nMethodId, aString1);
- }
- break;
- case RC_WaitSlot:
- {
- if ( ! (nParams & PARAM_UINT16_1) )
- nNr1 = 1000; // defaults to 1000 = 1 Sec.
- if ( !bBool1 )
- {
- nLNr1_and_Pointer.nLNr1 = Time( Time::SYSTEM ).GetTime() + nNr1/10;
- bBool1 = sal_True;
- }
-
- if ( !bIsSlotInExecute )
- pRet->GenReturn ( RET_Value, nMethodId, comm_UINT16(CONST_WSFinished) );
- else
- {
- if ( Time( Time::SYSTEM ).GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) )
- return sal_False;
- pRet->GenReturn ( RET_Value, nMethodId, comm_UINT16(CONST_WSTimeout) );
- }
- }
- break;
- }
-
-
- Advance();
-
-
- switch ( nMethodId )
- {
- case RC_AppDelay: // these commands are handled elsewhere
- case RC_DisplayHid:
- case RC_ResetApplication:
- case RC_WaitSlot:
-
- case RC_AppAbort: // delete all commands immediately
- break;
- case RC_Assert:
- {
- ByteString aAssertion( "Diese Assertion wurde vom Testtool per Befehl ausgel�st" );
- aAssertion = rtl::OUStringToOString(String(aAssertion, RTL_TEXTENCODING_MS_1252), RTL_TEXTENCODING_UTF8 );
- DBG_ASSERT( !aString1.Len(), rtl::OUStringToOString( aString1, RTL_TEXTENCODING_UTF8 ).getStr() );
- DBG_ASSERT( aString1.Len(), aAssertion.GetBuffer() );
- OSL_ENSURE( !aString1.Len(), rtl::OUStringToOString( aString1, RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_ENSURE( aString1.Len(), aAssertion.GetBuffer() );
- }
- break;
- case RC_CaptureAssertions:
-#ifdef DBG_UTIL
- if( !(nParams & PARAM_BOOL_1) || bBool1 )
- {
- DBG_INSTOUTERROR( DBG_OUT_TESTTOOL );
- osl_setDebugMessageFunc( osl_TestToolDebugPrint );
- }
- else
- {
- DBG_INSTOUTERROR( DBG_OUT_MSGBOX );
- osl_setDebugMessageFunc( pOriginal_osl_DebugMessageFunc );
- }
-#endif
- break;
- case RC_Translate:
- Translate();
- break;
- case RC_ApplicationBusy:
- {
- sal_Bool bWait = sal_False;
- ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW ) );
- pRet->GenReturn ( RET_Value, nMethodId, bWait );
- break;
- }
- case RC_GetClipboard:
- {
- ::rtl::OUString aTemp;
- ::svt::OStringTransfer::PasteString( aTemp, GetFirstDocFrame() );
- pRet->GenReturn ( RET_Value, nMethodId, String( aTemp ) );
- }
- break;
- case RC_SetClipboard:
- ::svt::OStringTransfer::CopyString(aString1,GetFirstDocFrame());
- break;
- case RC_WinTree:
- pRet->GenReturn ( RET_Value, nMethodId, Tree( NULL, 0));
- break;
- #if OSL_DEBUG_LEVEL > 1
- case RC_NoDebug:
- m_pDbgWin->bQuiet = sal_True;
- m_pDbgWin->Hide();
- m_pDbgWin->Clear();
- break;
- case RC_Debug:
- m_pDbgWin->bQuiet = sal_False;
- m_pDbgWin->Show();
- break;
- #endif
- case RC_GPF:
- ((TabControl*)NULL)->SetCurPageId( 12345 );
- break;
- case RC_GetNextCloseWindow:
- {
- Window *pWin = GetActive( WINDOW_BASE ); // WINDOW_ANYTYPE
- if ( !pWin )
- ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW ) );
- else if ( !IsDialog(pWin) )
- ReportError( GEN_RES_STR0( S_NO_DIALOG_IN_GETACTIVE ) );
- else
- {
- pRet->GenReturn( RET_Value, nMethodId, Id2Str(pWin->GetUniqueOrHelpId()) );
- }
- }
- break;
- case RC_UseBindings:
- if( !(nParams & PARAM_BOOL_1) || bBool1 )
- nUseBindings = SFX_USE_BINDINGS;
- else
- nUseBindings = 0;
- break;
- case RC_Profile:
- // list of what happens when parameters have these values:
- // one boolean=false stop all profiling (give results)
- // one boolean=true, 1-4 ints put the times into boxes
- // no! boolean no ints logging every command
- // no! boolean 1 int logging every int milliseconds
- // one String is put into the logfile (nothing else happens)
- if( !(nParams & PARAM_BOOL_1) || bBool1 )
- {
- if ( !pProfiler )
- {
- pProfiler = new TTProfiler;
- InitProfile();
- }
-
- if( !(nParams & PARAM_BOOL_1) && (nParams & PARAM_UINT16_1) )
- { // Autoprofiling: Profile nNr
- if ( pProfiler->IsProfilingPerCommand() )
- {
- pProfiler->StopProfilingPerCommand();
- }
- pProfiler->StartAutoProfiling( nNr1 );
-
- // the header is not dependent from the mode
- pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() );
- }
- else if ( nParams & PARAM_UINT16_1 )
- { // initialize Partitioning: Profile true [,nNr][,nNr][,nNr][,nNr]
- comm_UINT32 nAnzahl=0;
- if ( nParams & PARAM_UINT16_1 ) { nAnzahl++; };
- if ( nParams & PARAM_UINT16_2 ) { nAnzahl++; };
- if ( nParams & PARAM_UINT16_3 ) { nAnzahl++; };
- if ( nParams & PARAM_UINT16_4 ) { nAnzahl++; };
-
- // Here are the parameters transferred back to the testtool.
- // That's a little strange but you'd have to give up the easy
- // structure of remote commands in the testtool otherwise.
- pRet->GenReturn( RET_ProfileInfo, S_ProfileReset, nAnzahl );
-
- if ( nParams & PARAM_UINT16_1 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder1, (comm_UINT32)nNr1 ); };
- if ( nParams & PARAM_UINT16_2 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder2, (comm_UINT32)nNr2 ); };
- if ( nParams & PARAM_UINT16_3 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder3, (comm_UINT32)nNr3 ); };
- if ( nParams & PARAM_UINT16_4 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder4, (comm_UINT32)nNr4 ); };
-
- pProfiler->StartPartitioning();
- }
- else if( nParams == PARAM_STR_1 )
- {
- aString1 += '\n';
- pRet->GenReturn( RET_ProfileInfo, 0, aString1 );
- }
- else
- {
- if ( pProfiler->IsAutoProfiling() )
- {
- pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() );
- pProfiler->StopAutoProfiling();
- }
- pProfiler->StartProfilingPerCommand();
-
- // header is dependent from mode
- pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() );
- }
- }
- else
- if ( pProfiler )
- {
- if ( pProfiler->IsProfilingPerCommand() )
- pProfiler->StopProfilingPerCommand();
-
- if ( pProfiler->IsAutoProfiling() )
- {
- pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() );
- pProfiler->StopAutoProfiling();
- }
-
- if ( pProfiler->IsPartitioning() )
- {
- pRet->GenReturn( RET_ProfileInfo, S_ProfileDump, (comm_UINT32)0 );
- pProfiler->StopPartitioning();
- }
-
- delete pProfiler;
- pProfiler = NULL;
- }
- break;
- case RC_MenuGetItemCount:
- case RC_MenuGetItemId:
- case RC_MenuGetItemPos:
- case RC_MenuIsSeperator:
- case RC_MenuIsItemChecked:
- case RC_MenuIsItemEnabled:
- case RC_MenuGetItemText:
- case RC_MenuGetItemCommand:
- case RC_MenuHasSubMenu:
- case RC_MenuSelect:
- {
- PopupMenu *pPopup = NULL;
- MenuBar *pMenuBar = NULL;
- Menu *pMenu;
-
- sal_uInt16 nErr = GetCurrentMenues( pPopup, pMenuBar, pMenu );
-
- if ( !pMenu )
- {
- if ( nErr == 1 )
- ReportError( GEN_RES_STR0( S_NO_POPUP ) );
- else
- ReportError( GEN_RES_STR0( S_NO_SUBMENU ) );
- break;
- }
-
- sal_uInt16 nItemCount = 0;
- switch ( nMethodId )
- {
- case RC_MenuGetItemCount:
- case RC_MenuGetItemId:
- case RC_MenuIsSeperator:
- {
- nItemCount = pMenu->GetItemCount();
- if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
- { // jep, we have to adjust the count
- sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top
- for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() ; i++ )
- {
- if ( !pMenu->IsItemEnabled( pMenu->GetItemId( i ) ) )
- nItemCount--;
- else
- {
- if ( pMenu->GetItemType( i ) == MENUITEM_SEPARATOR && bLastWasSeperator )
- nItemCount--;
- bLastWasSeperator = pMenu->GetItemType( i ) == MENUITEM_SEPARATOR;
- }
- }
- if ( bLastWasSeperator ) // Separator at bottom
- nItemCount--;
- }
- }
- break;
- }
-
- // for certain methods calculate the physical index (reinserting the hidden entries)
- sal_uInt16 nPhysicalIndex = 0;
- switch ( nMethodId )
- {
- case RC_MenuGetItemId:
- case RC_MenuIsSeperator:
- {
- nPhysicalIndex = nNr1;
- if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
- { // jep, we have to adjust the position
- sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top
- sal_uInt16 nVisibleCount = 0;
- for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() && nVisibleCount < nNr1 ; i++ )
- {
- if ( pMenu->IsItemEnabled( pMenu->GetItemId( i ) )
- && !( pMenu->GetItemType( i ) == MENUITEM_SEPARATOR && bLastWasSeperator ) )
- {
- nVisibleCount++;
- bLastWasSeperator = pMenu->GetItemType( i ) == MENUITEM_SEPARATOR;
- }
- else
- nPhysicalIndex++;
- }
- DBG_ASSERT( nVisibleCount == nNr1, "Adaption of Index failed: nVisibleCount != nNr1" );
- }
- }
- break;
- }
-
-
-
- switch ( nMethodId )
- {
- case RC_MenuGetItemCount:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)nItemCount );
- }
- break;
- case RC_MenuGetItemId:
- {
- if ( ValueOK( rtl::OString(), RcString( nMethodId ),nNr1,nItemCount) )
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)pMenu->GetItemId(nPhysicalIndex-1) );
- }
- break;
- case RC_MenuGetItemPos:
- {
- sal_uInt16 nLogicalPos = pMenu->GetItemPos(nNr1);
- if ( MENU_ITEM_NOTFOUND != nLogicalPos && pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES )
- { // jep, we have to adjust the position
- if ( !pMenu->IsItemEnabled( nNr1 ) )
- nLogicalPos = MENU_ITEM_NOTFOUND;
- else
- {
- sal_Bool bLastWasSeperator = sal_False;
- for ( int i = nLogicalPos ; i >= 0 ; i-- )
- {
- if ( !pMenu->IsItemEnabled( pMenu->GetItemId( sal::static_int_cast< sal_uInt16 >(i) ) ) ||
- ( pMenu->GetItemType( sal::static_int_cast< sal_uInt16 >(i) ) == MENUITEM_SEPARATOR && bLastWasSeperator ) )
- nLogicalPos--;
- bLastWasSeperator = pMenu->GetItemType( sal::static_int_cast< sal_uInt16 >(i) ) == MENUITEM_SEPARATOR;
- }
- }
- }
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)(nLogicalPos+1) );
- }
- break;
- case RC_MenuIsSeperator:
- {
- if ( ValueOK( rtl::OString(), RcString( nMethodId ),nNr1,nItemCount) )
- pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)(pMenu->GetItemType(nPhysicalIndex-1) == MENUITEM_SEPARATOR) );
- }
- break;
- case RC_MenuIsItemChecked:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)pMenu->IsItemChecked(nNr1) );
- }
- break;
- case RC_MenuIsItemEnabled:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)pMenu->IsItemEnabled(nNr1) );
- }
- break;
- case RC_MenuGetItemText:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (String)pMenu->GetItemText(nNr1) );
- }
- break;
- case RC_MenuGetItemCommand:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (String)pMenu->GetItemCommand(nNr1) );
- }
- break;
- case RC_MenuHasSubMenu:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (sal_Bool)(pMenu->GetPopupMenu(nNr1) != NULL) );
- }
- break;
- case RC_MenuSelect:
- {
- if ( pMenu->GetPopupMenu(nNr1) )
- {
- if ( !aSubMenuId1 )
- aSubMenuId1 = nNr1;
- else if ( !aSubMenuId2 )
- aSubMenuId2 = nNr1;
- else if ( !aSubMenuId3 )
- aSubMenuId3 = nNr1;
-
- if ( pPopup )
- pPopup->SelectEntry(nNr1);
- else
- pMenuBar->SelectEntry(nNr1);
- }
- else
- {
- if ( pPopup )
- {
- pPopup->EndExecute(nNr1);
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
- }
- else
- {
- pMenuBar->SelectEntry(nNr1);
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
- }
- }
- }
- break;
- }
- }
- break;
- case RC_SetControlType:
- {
- DirectLog( S_QAError, GEN_RES_STR0( S_DEPRECATED ) );
- }
- break;
- case RC_Kill:
- case RC_RmDir:
- case RC_MkDir:
- case RC_FileCopy:
- case RC_Name:
- case RC_Dir:
- case RC_FileLen:
- case RC_FileDateTime:
- {
- long nErrorcode = FSYS_ERR_OK;
- switch ( nMethodId )
- {
- case RC_Kill:
- {
- DirEntry aFile( aString1 );
- nErrorcode = aFile.GetError();
- if ( FSYS_ERR_OK == nErrorcode && FileStat( aFile ).IsKind( FSYS_KIND_FILE ) )
- nErrorcode = aFile.Kill();
- else
- nErrorcode = FSYS_ERR_NOTAFILE;
- }
- break;
- case RC_RmDir:
- {
- DirEntry aDir( aString1 );
- nErrorcode = aDir.GetError();
- if ( FSYS_ERR_OK == nErrorcode && FileStat( aDir ).IsKind( FSYS_KIND_DIR ) )
- nErrorcode = aDir.Kill();
- else
- nErrorcode = FSYS_ERR_NOTADIRECTORY;
- }
- break;
- case RC_MkDir:
- {
- DirEntry aDir( aString1 );
- nErrorcode = aDir.GetError();
- if ( !nErrorcode && !aDir.MakeDir() )
- nErrorcode = FSYS_ERR_UNKNOWN;
- }
- break;
- case RC_FileCopy:
- {
- nErrorcode = DirEntry( aString1 ).CopyTo( DirEntry( aString2 ), FSYS_ACTION_COPYFILE );
- }
- break;
- case RC_Name:
- {
- nErrorcode = DirEntry( aString1 ).MoveTo( DirEntry( aString2 ) );
- }
- break;
- case RC_Dir:
- {
-
- String aPath;
-// from basic/source/inc/runtime.hxx
-#define Sb_ATTR_NORMAL 0x0000
-#define Sb_ATTR_HIDDEN 0x0002
-#define Sb_ATTR_SYSTEM 0x0004
-#define Sb_ATTR_VOLUME 0x0008
-#define Sb_ATTR_DIRECTORY 0x0010
-#define Sb_ATTR_ARCHIVE 0x0020
- // copied from Basic and adapted basic/source/runtime/methods.cxx Revision 1.54
- if ( (nParams & PARAM_STR_1) )
- {
- delete pDir;
- pDir = NULL; // because of special treatment Sb_ATTR_VOLUME
- DirEntry aEntry( aString1 );
- FileStat aStat( aEntry );
- if(!aStat.GetError() && (aStat.GetKind() & FSYS_KIND_FILE))
- {
- // OK, only a filename
- // cut off path (VB4)
- aPath = aEntry.GetName();
- }
- else
- {
- sal_uInt16 nDirFlags = 0;
- sal_uInt16 nFlags = 0;
- if ( (nParams & PARAM_UINT16_1) )
- nDirFlags = nFlags = nNr1;
- else
- nDirFlags = nFlags = Sb_ATTR_HIDDEN | Sb_ATTR_SYSTEM | Sb_ATTR_DIRECTORY;
-
- // only this bitmask is allowed by ms windows
- // Sb_ATTR_VOLUME is handled seperately
- if( nDirFlags & Sb_ATTR_VOLUME )
- aPath = aEntry.GetVolume();
- else
- {
- sal_uInt16 nMode = FSYS_KIND_FILE;
- if( nFlags & Sb_ATTR_DIRECTORY )
- nMode |= FSYS_KIND_DIR;
- if( nFlags == Sb_ATTR_DIRECTORY )
- nMode = FSYS_KIND_DIR;
- pDir = new Dir( aEntry, (DirEntryKind) nMode );
- nErrorcode = pDir->GetError();
- nDirPos = 0;
- }
- }
- }
-
- if( pDir )
- {
- for( ;; )
- {
- if( nDirPos >= pDir->Count() )
- {
- delete pDir;
- pDir = NULL;
- aPath.Erase();
- break;
- }
- DirEntry aNextEntry=(*(pDir))[nDirPos++];
- aPath = aNextEntry.GetName();
- break;
- }
- }
- if ( !nErrorcode )
- {
- pRet->GenReturn ( RET_Value, nMethodId, aPath );
- }
-
- }
- break;
- case RC_FileLen:
- {
- DirEntry aFile( aString1 );
- nErrorcode = aFile.GetError();
- if ( FSYS_ERR_OK == nErrorcode )
- {
- FileStat aFS( aFile );
- pRet->GenReturn ( RET_Value, nMethodId, static_cast<comm_UINT32>(aFS.GetSize()) ); //GetSize() sal_uLong != comm_UINT32 on 64bit
- nErrorcode = aFS.GetError();
- }
- }
- break;
- case RC_FileDateTime:
- {
- DirEntry aFile( aString1 );
- nErrorcode = aFile.GetError();
- if ( FSYS_ERR_OK == nErrorcode )
- {
- FileStat aStat( aFile );
- Time aTime( aStat.TimeModified() );
- Date aDate( aStat.DateModified() );
- nErrorcode = aStat.GetError();
-
- double fSerial = (double)( aDate - Date(30,12,1899) );
- long nSeconds = aTime.GetHour();
- nSeconds *= 3600;
- nSeconds += aTime.GetMin() * 60;
- nSeconds += aTime.GetSec();
- double nDays = ((double)nSeconds) / (double)(24.0*3600.0);
- fSerial += nDays;
-
- SbxValueRef xValue = new SbxValue( SbxDATE );
- xValue->PutDate( fSerial );
-
- pRet->GenReturn ( RET_Value, nMethodId, *xValue );
- }
- }
- break;
- }
- switch ( nErrorcode )
- {
- case FSYS_ERR_OK:
- break;
- case FSYS_ERR_MISPLACEDCHAR:
- {
- ReportError( CUniString("MISPLACEDCHAR") );
- }
- break;
- case FSYS_ERR_INVALIDCHAR:
- {
- ReportError( CUniString("INVALIDCHAR") );
- }
- break;
- case FSYS_ERR_NOTEXISTS:
- {
- ReportError( CUniString("NOTEXISTS") );
- }
- break;
- case FSYS_ERR_ALREADYEXISTS:
- {
- ReportError( CUniString("ALREADYEXISTS") );
- }
- break;
- case FSYS_ERR_NOTADIRECTORY:
- {
- ReportError( CUniString("NOTADIRECTORY") );
- }
- break;
- case FSYS_ERR_NOTAFILE:
- {
- ReportError( CUniString("NOTAFILE") );
- }
- break;
- case FSYS_ERR_INVALIDDEVICE:
- {
- ReportError( CUniString("INVALIDDEVICE") );
- }
- break;
- case FSYS_ERR_ACCESSDENIED:
- {
- ReportError( CUniString("ACCESSDENIED") );
- }
- break;
- case FSYS_ERR_LOCKVIOLATION:
- {
- ReportError( CUniString("LOCKVIOLATION") );
- }
- break;
- case FSYS_ERR_VOLUMEFULL:
- {
- ReportError( CUniString("VOLUMEFULL") );
- }
- break;
- case FSYS_ERR_ISWILDCARD:
- {
- ReportError( CUniString("ISWILDCARD") );
- }
- break;
- case FSYS_ERR_NOTSUPPORTED:
- {
- ReportError( CUniString("NOTSUPPORTED") );
- }
- break;
- case FSYS_ERR_UNKNOWN:
- {
- ReportError( CUniString("UNKNOWN") );
- }
- break;
- default:
- {
- ReportError( CUniString("Not an FSYS Error") );
- }
- }
-
- }
- break;
- case RC_TypeKeysDelay:
- {
- if( (nParams & PARAM_BOOL_1) )
- {
- bDoTypeKeysDelay = bBool1;
- }
- else if( nParams & PARAM_UINT16_1 )
- {
- nMinTypeKeysDelay = nNr1;
- if( nParams & PARAM_UINT16_2 )
- nMaxTypeKeysDelay = nNr2;
- else
- nMaxTypeKeysDelay = nMinTypeKeysDelay;
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_GetMouseStyle:
- {
- Pointer aPointer;
- Window *pActualWin = GetMouseWin();
- if ( pActualWin )
- aPointer = pActualWin->GetPointer();
- else
- {
- ReportError( GEN_RES_STR1( S_POINTER_OUTSIDE_APPWIN, RcString( nMethodId ) ) );
- aPointer = Pointer( POINTER_NULL );
- }
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)aPointer.GetStyle() );
- }
- break;
- case RC_UnpackStorage:
- {
- if( (nParams & PARAM_STR_1) )
- {
- String aFileName( aString1 );
- DirEntry aDestPath;
- if( (nParams & PARAM_STR_2) )
- aDestPath = DirEntry( aString2 );
- else
- {
- aDestPath = DirEntry( aFileName );
- aDestPath.SetExtension( CUniString( "plaintext" ) );
- }
-
-#if OSL_DEBUG_LEVEL > 1
- sal_uInt16 nEntries = Dir( aDestPath, FSYS_KIND_FILE | FSYS_KIND_DIR ).Count();
- (void) nEntries; /* avoid warning about unused parameter */
-#endif
- // The Count is only larger than 2 is the path is a directory which is not empty
- // the Count of 2 results from the "." and ".." directory
- if ( Dir( aDestPath, FSYS_KIND_FILE | FSYS_KIND_DIR ).Count() > 2 )
- DirectLog( S_QAError, GEN_RES_STR1( S_DIRECTORY_NOT_EMPTY, aDestPath.GetFull() ) );
-
- SotStorageRef xStorage = new SotStorage( aFileName, STREAM_STD_READ );
- if ( xStorage->GetError() )
- ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aFileName, aDestPath.GetFull()) );
- else
- UnpackStorage( xStorage, aDestPath );
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_CloseSysDialog:
- case RC_ExistsSysDialog:
- {
- if( (nParams & PARAM_UINT16_1) )
- {
- Reference < ::com::sun::star::util::XCancellable > xPicker;
- switch( nNr1 )
- {
- case CONST_FilePicker:
- {
- xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) );
- }
- break;
- case CONST_FolderPicker:
- {
- xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) );
- }
- break;
- default:
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- switch( nMethodId )
- {
- case RC_CloseSysDialog:
- {
- if ( xPicker.is() )
- xPicker->cancel();
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_ExistsSysDialog:
- {
- pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)xPicker.is() );
- }
- break;
- default:
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_SAXCheckWellformed:
- case RC_SAXReadFile:
-
- case RC_SAXGetNodeType:
- case RC_SAXGetAttributeCount:
- case RC_SAXGetAttributeName:
- case RC_SAXGetAttributeValue:
- case RC_SAXGetChildCount:
- case RC_SAXGetElementName:
- case RC_SAXGetChars:
-
- case RC_SAXSeekElement:
- case RC_SAXHasElement:
- case RC_SAXGetElementPath:
-
- case RC_SAXRelease:
- {
- HandleSAXParser();
- }
- break;
- case RC_RecordMacro:
- {
- if ( ! (nParams & PARAM_BOOL_1) )
- bBool1 = sal_True;
-
- MacroRecorder::GetMacroRecorder()->SetActionRecord( bBool1 );
- }
- break;
- case RC_GetDocumentCount :
- {
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT16)GetDocWinCount() );
- }
- break;
- case RC_ActivateDocument :
- {
- if( nParams & PARAM_UINT16_1 )
- {
- if ( ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, GetDocWinCount() ) )
- {
- Window* pWin = GetDocWin( nNr1-1 );
- if ( pWin )
- {
- pWin->ToTop();
- pWin->GrabFocus();
- }
- }
- }
- else
- ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- }
- break;
- case RC_GetSystemLanguage :
- {
- pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT16)Application::GetSettings().GetLanguage() );
- }
- break;
- case RC_CatchGPF :
- {
- if( (nParams & PARAM_BOOL_1) )
- bCatchGPF = bBool1;
- else
- bCatchGPF = sal_True;
- }
- break;
- case RC_IsProduct :
- {
- sal_Bool bIsProduct;
- #ifdef DBG_UTIL
- bIsProduct = sal_False;
- #else
- bIsProduct = sal_True;
- #endif
- pRet->GenReturn ( RET_Value, nMethodId, (sal_Bool)bIsProduct );
- }
- break;
- case RC_UsePostEvents :
- {
- if( (nParams & PARAM_BOOL_1) )
- bUsePostEvents = bBool1;
- else
- bUsePostEvents = sal_True;
- }
- break;
- default:
- ReportError( GEN_RES_STR1( S_UNKNOWN_COMMAND, RcString( nMethodId ) ) );
- }
- SendProfile( RcString(nMethodId) );
- delete this;
- return sal_True;
-}
-
-
-sal_Bool StatementCommand::UnpackStorage( SotStorageRef xStorage, DirEntry &aBaseDir )
-{
- SvStorageInfoList aList;
- xStorage->FillInfoList( &aList );
-
- for( size_t i = 0; i < aList.size(); i++ )
- {
- SvStorageInfo& rInfo = aList[ i ];
- String aName = rInfo.GetName();
- DirEntry aPath ( aBaseDir );
- aPath += DirEntry( aName );
- sal_Bool bIsStorage = xStorage->IsStorage( aName );
- if ( bIsStorage )
- {
- SotStorageRef xSubStorage = xStorage->OpenSotStorage( aName, STREAM_STD_READ );
- if ( xSubStorage->GetError() )
- {
- ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aName, aPath.GetFull()) );
- return sal_False;
- }
- UnpackStorage( xSubStorage, aPath );
- }
- else
- {
- if ( !aPath.MakeDir( sal_True ) )
- {
- ReportError( GEN_RES_STR1(S_CANNOT_CREATE_DIRECTORY, aPath.GetFull()) );
- return sal_False;
- }
- SotStorageStreamRef xStream = xStorage->OpenSotStream( aName, STREAM_STD_READ );
- SvFileStream aDestination( aPath.GetFull(), STREAM_STD_READWRITE | STREAM_TRUNC );
- (*xStream) >> aDestination;
- if ( aDestination.GetError() != ERRCODE_NONE )
- {
- ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aName, aPath.GetFull()) );
- return sal_False;
- }
- aDestination.Close();
- }
- }
- return sal_True;
-}
-
-
-StatementControl::StatementControl( SCmdStream *pCmdIn, sal_uInt16 nControlIdType )
-: StatementList()
-, nNr1( 0 )
-, nNr2( 0 )
-, nNr3( 0 )
-, nNr4( 0 )
-, nLNr1( 0 )
-, aString1()
-, aString2()
-, bBool1(sal_False)
-, bBool2(sal_False)
-{
- QueStatement( NULL );
- //HELPID BACKWARD (SIControl is no longer needed)
- if ( nControlIdType == SIControl )
- {
- comm_UINT32 nId;
- pCmdIn->Read( nId );
- aUId = rtl::OString( nId );
- if ( nId == 0 )
- aUId = UID_ACTIVE;
- else
- ReportError( aUId, GEN_RES_STR1c( S_INTERNAL_ERROR, "using numeric HelpID from old Testtool" ) );
- }
- else if ( nControlIdType == SIStringControl )
- {
- String aId;
- pCmdIn->Read( aId );
- aUId = Str2Id( aId );
- }
- else
- {
- OSL_FAIL( "Wrong ControlType" );
- }
-
- pCmdIn->Read( nMethodId );
- pCmdIn->Read( nParams );
-
- if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 );
- if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 );
- if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 );
- if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 );
- if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1 );
- if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 );
- if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 );
- if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );
- if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 );
-
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Reading Control: UId: " );
- m_pDbgWin->AddText( Id2Str( aUId ) );
- m_pDbgWin->AddText( " Methode: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
- m_pDbgWin->AddText( " Params:" );
- if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );}
- if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );}
- if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );}
- if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );}
- if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );}
- if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );}
- if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );}
- m_pDbgWin->AddText( "\n" );
-#endif
-}
-
-sal_Bool IsDialog(Window *pWin)
-{ // everything derived from SystemWindow
- if ( !pWin )
- return sal_False;
-
- switch (pWin->GetType())
- {
- case WINDOW_FLOATINGWINDOW:
- case WINDOW_DOCKINGWINDOW:
- case WINDOW_MODELESSDIALOG:
- case WINDOW_DIALOG:
- case WINDOW_MODALDIALOG:
- case WINDOW_WORKWINDOW:
- case WINDOW_TABDIALOG:
-
- case WINDOW_MESSBOX:
- case WINDOW_INFOBOX:
- case WINDOW_WARNINGBOX:
- case WINDOW_ERRORBOX:
- case WINDOW_QUERYBOX:
- case WINDOW_BUTTONDIALOG:
- case WINDOW_FILEDIALOG:
- case WINDOW_PRINTDIALOG:
- case WINDOW_PRINTERSETUPDIALOG:
-
-// from here on not callable anymore (because not implemented)
- case WINDOW_SYSWINDOW:
- case WINDOW_SYSTEMDIALOG:
- case WINDOW_COLORDIALOG:
- case WINDOW_FONTDIALOG:
- case WINDOW_PATHDIALOG:
-
-
- return sal_True;
- default:
- return sal_False;
- }
-}
-
-
-sal_Bool IsAccessable(Window *pWin)
-{
- if ( pWin == NULL )
- return sal_False;
-
- return pWin->IsEnabled() && pWin->IsInputEnabled();
-}
-
-
-
-// new help function
-static Window*ImpGetButton( Window *pBase, WinBits nMask, WinBits nWinBits )
-{
- sal_uInt16 n = pBase->GetChildCount();
- for( sal_uInt16 i = 0 ; i < n; i++ ) {
- Window *pChild = pBase->GetChild(i);
- if( pChild->GetType() == WINDOW_OKBUTTON
- || pChild->GetType() == WINDOW_CANCELBUTTON
- || pChild->GetType() == WINDOW_HELPBUTTON
- || pChild->GetType() == WINDOW_PUSHBUTTON )
- if( !nMask || ( pChild->GetStyle() & nMask ) == nWinBits )
- return pChild;
- }
- return NULL;
-}
-
-sal_Bool StatementControl::ControlOK( Window *pControl, const sal_Char* cBezeichnung )
-{
- if ( pControl && ( ( ( IsAccessable(pControl) || (nMethodId & M_WITH_RETURN) ) &&
- pControl->IsVisible() ) ||
- aUId.equals( UID_ACTIVE ) ) )
- return sal_True;
- else
- {
- UniString aBezeichnung( cBezeichnung, RTL_TEXTENCODING_ASCII_US );
- if ( aBezeichnung.Len() > 0 )
- {
- if (!pControl)
- ReportError( aUId, GEN_RES_STR1( S_WIN_NOT_FOUND, aBezeichnung ) );
- else if ( !pControl->IsVisible() )
- ReportError( aUId, GEN_RES_STR1( S_WIN_INVISIBLE, aBezeichnung ) );
- else
- ReportError( aUId, GEN_RES_STR1( S_WIN_DISABLED, aBezeichnung ) );
- }
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( aBezeichnung.AppendAscii(" NotFound or Disabled or Invisible") );
- #endif
-
- return sal_False;
- }
-}
-
-
-sal_Bool StatementList::ValueOK( rtl::OString aId, String aBezeichnung, sal_uLong nValue, sal_uLong nMax )
-{
-
- if ( nMax < nValue )
- {
- if ( aBezeichnung.Len() > 0 )
- ReportError( aId, GEN_RES_STR3( S_NUMBER_TOO_BIG, aBezeichnung, UniString::CreateFromInt32( nValue ), UniString::CreateFromInt32( nMax ) ) );
- return sal_False;
- }
- if ( nValue < 1 )
- {
- if ( aBezeichnung.Len() > 0 )
- ReportError( aId, GEN_RES_STR3c3( S_NUMBER_TOO_SMALL, aBezeichnung, UniString::CreateFromInt32( nValue ), "1" ) );
- return sal_False;
- }
- return sal_True;
-}
-
-sal_uInt16 StatementList::GetCurrentMenues( PopupMenu *&pPopup, MenuBar *&pMenuBar, Menu *&pMenu )
-{
- if ( WinPtrValid( pMenuWindow ) )
- pMenuBar = pMenuWindow->GetMenuBar();
-
- if ( pMenuBar ) // use MenuBar as base
- pMenu = pMenuBar;
- else // use contextmenu as base
- {
- pMenu = PopupMenu::GetActivePopupMenu();
- pPopup = PopupMenu::GetActivePopupMenu();
- }
-
- if ( !pMenu )
- return 1;
-
- if ( aSubMenuId1 )
- {
- pPopup = pMenu->GetPopupMenu( aSubMenuId1 );
- pMenu = pPopup;
- }
-
- if ( pMenu && aSubMenuId2 )
- {
- pPopup = pMenu->GetPopupMenu( aSubMenuId2 );
- pMenu = pPopup;
- }
-
- if ( pMenu && aSubMenuId3 )
- {
- pPopup = pMenu->GetPopupMenu( aSubMenuId3 );
- pMenu = pPopup;
- }
-
- return 0;
-}
-
-void StatementControl::AnimateMouse( Window *pControl, TTHotSpots aWohin )
-{
- Point aZiel;
-
- switch (aWohin)
- {
- case MitteLinks:
- {
- long nHeight = pControl->GetSizePixel().Height();
- aZiel.X() += 5;
- aZiel.Y() += nHeight / 2;
- }
- break;
- case Mitte:
- {
- Size aSize = pControl->GetOutputSizePixel();
- aZiel.Move( aSize.Width() / 2, aSize.Height() / 2 );
- }
- break;
- case MitteOben:
- {
- long nWidth = pControl->GetSizePixel().Width();
- aZiel.X() += nWidth / 2;
- aZiel.Y() += 5;
- }
- break;
- }
- AnimateMouse( pControl, aZiel );
-}
-
-
-void StatementControl::AnimateMouse( Window *pControl, Point aWohin )
-{
- Point aAkt = pControl->GetPointerPosPixel();
- Point aZiel = aWohin;
-
- long nSteps;
- Point aDiff = aAkt - aZiel;
-
- if ( Abs(aDiff.X()) < Abs(aDiff.Y()) )
- nSteps = Abs(aDiff.Y()) / 5;
- else
- nSteps = Abs(aDiff.X()) / 5;
- if ( nSteps == 0 )
- return;
-
- aDiff *= 1000;
- aDiff /= nSteps;
-
- StatementList::bExecuting = sal_True;
-
- for ( ; nSteps ; nSteps-- )
- {
- if ( Abs((aAkt - pControl->GetPointerPosPixel()).X()) > 5 ||
- Abs((aAkt - pControl->GetPointerPosPixel()).Y()) > 5 )
- nSteps = 1;
- aAkt = aZiel + aDiff * nSteps / 1000;
- pControl->SetPointerPosPixel(aAkt);
- SafeReschedule();
- }
- pControl->SetPointerPosPixel(aZiel);
- StatementList::bExecuting = sal_False;
-}
-
-
-sal_Bool StatementControl::MaybeDoTypeKeysDelay( Window *pTestWindow )
-{
- if ( bDoTypeKeysDelay )
- {
- sal_uLong nTimeWait = nMinTypeKeysDelay;
- if ( nMaxTypeKeysDelay != nMinTypeKeysDelay )
- nTimeWait += Time::GetSystemTicks() % ( nMaxTypeKeysDelay - nMinTypeKeysDelay );
- Timer aTimer;
- aTimer.SetTimeout( nTimeWait );
- aTimer.Start();
- StatementList::bExecuting = sal_True;
-
- while ( aTimer.IsActive() )
- {
- SafeReschedule( sal_True );
- }
- StatementList::bExecuting = sal_False;
- if ( !WinPtrValid(pTestWindow ) )
- {
- ReportError( aUId, GEN_RES_STR1( S_WINDOW_DISAPPEARED, MethodString( nMethodId ) ) );
- return sal_False;
- }
- }
- return sal_True;
-}
-
-sal_Bool StatementControl::HandleVisibleControls( Window *pControl )
-{
- if( pControl ) // therefore also if disabled but not if invisible
- {
- switch( nMethodId )
- {
- case M_IsEnabled:
- pRet->GenReturn ( RET_Value, aUId, IsAccessable(pControl) );
- break;
- case M_IsVisible:
- pRet->GenReturn ( RET_Value, aUId, pControl->IsVisible() );
- break;
- case M_GetPosX:
- if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // special treatment for FloatingWindows
- if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT(); // special treatment for TabDialoge
- if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT(); // special treatment for Border
- if ( (nParams & PARAM_BOOL_1) && bBool1 )
- pControl = pControl->GetWindow( WINDOW_OVERLAP );
-
- if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW )
- {
- Point aPos = pControl->GetPosPixel();
- aPos = pControl->GET_REAL_PARENT()->OutputToScreenPixel( aPos );
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)aPos.X() );
- }
- else
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetPosPixel().X() );
- break;
- case M_GetPosY:
- if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( (nParams & PARAM_BOOL_1) && bBool1 )
- pControl = pControl->GetWindow( WINDOW_OVERLAP );
-
- if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW )
- {
- Point aPos = pControl->GetPosPixel();
- aPos = pControl->GET_REAL_PARENT()->OutputToScreenPixel( aPos );
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)aPos.Y() );
- }
- else
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetPosPixel().Y() );
- break;
- case M_GetSizeX:
- if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( (nParams & PARAM_BOOL_1) && bBool1 )
- pControl = pControl->GetWindow( WINDOW_OVERLAP );
-
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetSizePixel().Width() );
- break;
- case M_GetSizeY:
- if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( (nParams & PARAM_BOOL_1) && bBool1 )
- pControl = pControl->GetWindow( WINDOW_OVERLAP );
-
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetSizePixel().Height() );
- break;
- case M_SnapShot:
- {
- if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG )
- pControl = pControl->GET_REAL_PARENT();
- if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW )
- pControl = pControl->GET_REAL_PARENT();
- if ( (nParams & PARAM_BOOL_1) && bBool1 )
- pControl = pControl->GetWindow( WINDOW_OVERLAP );
-
- Bitmap aBmp = pControl->SnapShot();
- if ( pControl->GetType() == WINDOW_WORKWINDOW )
- {
- Point aStart = pControl->GetPosPixel();
- if ( !(nParams & PARAM_UINT16_4) )
- {
- nParams |= PARAM_UINT16_1;
- nParams |= PARAM_UINT16_2;
- nParams |= PARAM_UINT16_3;
- nParams |= PARAM_UINT16_4;
- nNr1 = (sal_uInt16)-aStart.X();
- nNr2 = (sal_uInt16)-aStart.Y();
- nNr3 = (sal_uInt16)pControl->GetSizePixel().Width() + 2*(sal_uInt16)aStart.X();
- nNr4 = (sal_uInt16)pControl->GetSizePixel().Height() + 2*(sal_uInt16)aStart.Y();
- }
- nNr1 = std::max((sal_uInt16)-aStart.X(),nNr1);
- nNr2 = std::max((sal_uInt16)-aStart.Y(),nNr2);
- nNr3 = std::min((sal_uInt16)(pControl->GetSizePixel().Width() + 2*(sal_uInt16)aStart.X()),nNr3);
- nNr4 = std::min((sal_uInt16)(pControl->GetSizePixel().Height() + 2*(sal_uInt16)aStart.Y()),nNr4);
- }
- if( nParams & PARAM_UINT16_4 )
- { // cutting
- Point aPt(-nNr1,-nNr2);
- Size aSz(nNr3,nNr4);
- VirtualDevice aVDev( *pControl );
-
- aVDev.SetOutputSizePixel( aSz );
- aVDev.DrawBitmap( aPt, aBmp );
- aBmp = aVDev.GetBitmap( Point(), aSz );
- }
-
- SvFileStream fOut;
- fOut.Open(aString1,STREAM_STD_WRITE);
- aBmp.Write(fOut);
- if ( fOut.GetError() )
- ReportError( aUId, GEN_RES_STR1( S_ERROR_SAVING_IMAGE, UniString::CreateFromInt32( fOut.GetError() ) ) );
- fOut.Close();
- }
- break;
- case M_GetFixedTextCount:
- {
- pRet->GenReturn ( RET_Value, aUId, CountWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True ) );
- }
- break;
- case M_GetFixedText:
- {
- if( ( nParams & PARAM_UINT16_1 ) == 0 )
- nNr1 = 1;
-
- FixedText* pFixedText = (FixedText*)GetWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True, nNr1-1 );
- if ( pFixedText )
- pRet->GenReturn ( RET_Value, aUId, pFixedText->GetText() );
- else
- ValueOK(aUId, MethodString( nMethodId ),nNr1,CountWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True ) );
- }
- break;
- default:
- return sal_False;
- }
- SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) );
- return sal_True;
- }
- return sal_False;
-}
-
-sal_Bool StatementControl::HandleCommonMethods( Window *pControl )
-{
- switch( nMethodId ) // can be done with every window
- {
- case M_Exists: // already handled above, prevents errors only here
- case M_NotExists:
- case M_IsEnabled:
- case M_IsVisible:
- case M_SnapShot:
- break;
- case M_Caption :
- {
- if ( pControl->GetText().Len() == 0 && IsDocFrame( pControl->GetWindow( WINDOW_FRAME ) ) )
- pRet->GenReturn ( RET_Value, aUId, pControl->GetWindow( WINDOW_FRAME )->GetText());
- else
- pRet->GenReturn ( RET_Value, aUId, pControl->GetText());
- }
- break;
- case M_GetRT:
- {
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetType() );
- }
- break;
- case M_TypeKeys:
- {
- if( !(nParams & PARAM_UINT16_1) ) // number of repititions
- nNr1 = 1;
- if( !(nParams & PARAM_BOOL_1) ) // Follow Focus
- bBool1 = sal_False; // that way behaviour stays like before
-
- if ( !bBool1 ) // old behaviour
- pControl->GrabFocus();
- else // If focus is not inside given control we grab it once.
- {
- Window *pFocus = GetpApp()->GetFocusWindow();
- if ( !pFocus || !pControl->IsWindowOrChild( pFocus, sal_True ) )
- pControl->GrabFocus();
- }
-
-
- // maybe this can get removed since we are using GetPreferredKeyInputWindow()
- if ( pControl->GetType() == WINDOW_COMBOBOX )
- {
- Window *pTemp = NULL;
- for ( sal_uInt16 i = 0 ; i < pControl->GetChildCount() && !pTemp ; i++ )
- if ( pControl->GetChild( i )->GetType() == WINDOW_EDIT )
- pTemp = pControl->GetChild( i );
- if ( pTemp )
- pControl = pTemp;
- }
-
- Window *pDeliverHere = pControl;
- for (int j = 0; j < nNr1; j++)
- for (xub_StrLen i = 0; i < aString1.Len(); i++)
- {
- if ( StatementList::bUsePostEvents )
- { // grab focus every time
- Window *pFocus = GetpApp()->GetFocusWindow();
- if ( !pFocus || !pControl->IsWindowOrChild( pFocus, sal_True ) )
- pControl->GrabFocus();
- }
- if ( bBool1 ) // finde FocusWindow every time
- {
- Window *pFocus = GetpApp()->GetFocusWindow();
- if ( pFocus && pControl->IsWindowOrChild( pFocus, sal_True ) )
- pDeliverHere = pFocus;
- else // fallback to base window
- pDeliverHere = pControl;
- }
- pDeliverHere = pDeliverHere->GetPreferredKeyInputWindow();
- KeyEvent aEvent;
- if ( ((sal_uInt16)aString1.GetChar(i)) <= 7 )
- {
- sal_uInt16 nVal = 0;
- switch (aString1.GetChar(i))
- {
- case 1: nVal = aString1.GetChar(i+1) + (aString1.GetChar(i+2) << 8);
- i += 2;
- break;
- case 3: nVal = (aString1.GetChar(i+1) << 8);
- i++;
- break;
- case 5: nVal = aString1.GetChar(i+1);
- i++;
- break;
- case 7: nVal = 0;
- break;
- }
- // #105672#
- // find out the keycode
- sal_uInt16 nKeygroup = nVal & KEYGROUP_TYPE;
- sal_uInt16 nKeyCode = nVal & KEY_CODE;
- sal_Unicode aCh;
- switch (nKeygroup)
- {
- case KEYGROUP_NUM:
- aCh = nKeyCode - KEY_0 + '0';
- break;
- case KEYGROUP_ALPHA:
- aCh = nKeyCode - KEY_A;
- if ( nVal & KEY_MOD1 )
- {}
- else if ( nVal & KEY_SHIFT )
- aCh += 'A';
- else
- aCh += 'a';
- break;
- case KEYGROUP_MISC:
- { // CR ESC TAB BACK
- ByteString aPrintableMisc("\x0d\x1b\x09\x08 **+-*/.,<>=",16);
- if ( nKeyCode-KEY_RETURN < aPrintableMisc.Len()
- && nKeyCode != KEY_INSERT && nKeyCode != KEY_DELETE )
- aCh = aPrintableMisc.GetChar( nKeyCode-KEY_RETURN );
- else
- aCh = 0;
- }
- break;
- case KEYGROUP_CURSOR:
- case KEYGROUP_FKEYS:
- default:
- aCh = 0;
- }
- aEvent = KeyEvent(aCh,KeyCode(nVal & 0xFFF,nVal & 0xF000));
- }
- else
- {
- // CR ESC TAB BACK
- String aPrintableMisc = CUniString("\x0d\x1b\x09\x08 xx+-*/.,<>=");
- sal_Unicode aCh = aString1.GetChar(i);
- if ( aCh >= 'a' && aCh <= 'z' )
- aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_ALPHA + aCh-'a', 0));
- else if ( aCh >= 'A' && aCh <= 'Z' )
- aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_ALPHA + aCh-'a', KEY_SHIFT));
- else if ( aCh >= '0' && aCh <= '9' )
- aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_NUM + aCh-'0', 0));
- else if ( aPrintableMisc.Search(aCh) != STRING_NOTFOUND )
- aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_MISC + (sal_uInt16)aPrintableMisc.Search(aCh), 0));
- else // Should not happen actually
- aEvent = KeyEvent(aCh, KeyCode());
- }
- ImplKeyInput( pDeliverHere, aEvent );
- if ( !MaybeDoTypeKeysDelay( pControl ) )
- break;
- else
- SafeReschedule();SafeReschedule();SafeReschedule();
- }
- }
- break;
-
-#define CalcMouseButton\
- sal_uInt16 nButton = MOUSE_LEFT;\
- if ( (nParams & PARAM_UINT16_3) )\
- {\
- switch ( nNr3 )\
- {\
- case 1: nButton = MOUSE_LEFT; break;\
- case 2: nButton = MOUSE_MIDDLE; break;\
- case 3: nButton = MOUSE_RIGHT; break;\
- }\
- }\
-
- case M_MouseDown:
- {
- CalcMouseButton;
- Size aS = pControl->GetOutputSizePixel();
- Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
- Window *pActualWin = pControl->FindWindow( aPos );
-
- if ( pActualWin )
- aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
- else
- pActualWin = pControl;
-
- AnimateMouse( pActualWin, aPos );
- pActualWin->GrabFocus();
- MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton);
- ImplMouseButtonDown( pActualWin, aMEvnt );
- }
- break;
- case M_MouseUp:
- {
- CalcMouseButton;
- Size aS = pControl->GetOutputSizePixel();
- Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
- Window *pActualWin = pControl->FindWindow( aPos );
-
- if ( pActualWin )
- aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
- else
- pActualWin = pControl;
-
- AnimateMouse( pActualWin, aPos );
- MouseEvent aMEvt( aPos, 1, MOUSE_SIMPLECLICK|MOUSE_SELECT, nButton );
- ImplMouseButtonUp( pActualWin, aMEvt );
- }
- break;
- case M_MouseMove:
- {
- CalcMouseButton;
- Size aS = pControl->GetOutputSizePixel();
- Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
- Window *pActualWin = pControl->FindWindow( aPos );
-
- if ( pActualWin )
- {
- aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
- }
- else
- pActualWin = pControl;
-
- AnimateMouse( pActualWin, aPos );
- MouseEvent aMEvt( aPos, 0, MOUSE_SIMPLEMOVE|MOUSE_DRAGMOVE, nButton );
- ImplMouseMove( pActualWin, aMEvt );
- }
- break;
- case M_MouseDoubleClick:
- {
- CalcMouseButton;
- Size aS = pControl->GetOutputSizePixel();
- Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100);
- Window *pActualWin = pControl->FindWindow( aPos );
-
- if ( pActualWin )
- {
- aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
- }
- else
- pActualWin = pControl;
-
- AnimateMouse( pActualWin, aPos );
- pActualWin->GrabFocus();
- MouseEvent aMEvnt;
- aMEvnt = MouseEvent(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton);
- ImplMouseButtonDown( pActualWin, aMEvnt );
- ImplMouseButtonUp ( pActualWin, aMEvnt );
- aMEvnt = MouseEvent(aPos,2,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton);
- ImplMouseButtonDown( pActualWin, aMEvnt );
- ImplMouseButtonUp ( pActualWin, aMEvnt );
- }
- break;
- case M_DisplayPercent:
- {
- ModelessDialog *pDlg = new ModelessDialog(NULL);
- pDlg->SetOutputSizePixel(Size(100,30));
-
- Edit *pMyEd = new Edit(pDlg,WB_CENTER | WB_BORDER );
- pMyEd->SetSizePixel(Size(100,30));
- pDlg->SetText(UniString("Schlie�en", RTL_TEXTENCODING_ISO_8859_1));
- pDlg->Show();
- pMyEd->Show();
- sal_uLong nTime = Time( Time::SYSTEM ).GetTime();
-
- while (pDlg->IsVisible())
- {
- pDlg->ToTop();
- for (int i = 1 ; i<10 ; i++)
- SafeReschedule();
- Point Pos = pControl->GetPointerPosPixel();
- Size Siz=pControl->GetOutputSizePixel();
- Time aSysTime( Time::SYSTEM );
- if ( aSysTime.GetTime() - nTime > 10 )
- {
- nTime = aSysTime.GetTime();
- pMyEd->SetText(UniString::CreateFromInt32(Pos.X()*100/Siz.Width()).AppendAscii("%x").Append( UniString::CreateFromInt32(Pos.Y()*100/Siz.Height()) ).Append('%'));
- }
- }
-
- delete pMyEd;
- delete pDlg;
- }
- break;
- case M_OpenContextMenu:
- {
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
- Point aPos;
- ToolBox* pTB = (ToolBox*)pControl;
- if ( (pControl->GetType() == WINDOW_TOOLBOX) && pTB->IsMenuEnabled() )
- {
- pTB->ExecuteCustomMenu();
- }
- else
- {
- sal_Bool bAtMousePos = ( nParams & PARAM_BOOL_1 ) && bBool1;
- if ( bAtMousePos )
- {
- aPos = pControl->GetPointerPosPixel();
- Window *pActualWin = pControl->FindWindow( aPos );
-
- if ( pActualWin )
- {
- aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) );
- pControl = pActualWin;
- }
- }
- CommandEvent aEvent( aPos, COMMAND_CONTEXTMENU, bAtMousePos );
- ImplCommand( pControl, aEvent );
- }
- }
- break;
- case M_UseMenu:
- {
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
-
- while ( pControl && !( ( pControl->GetType() == WINDOW_SYSWINDOW || pControl->GetType() == WINDOW_WORKWINDOW ) && ControlOK( pControl, "" ) ) )
- pControl = pControl->GET_REAL_PARENT();
-
- if ( pControl && ((SystemWindow*)pControl)->GetMenuBar() )
- pMenuWindow = ((SystemWindow*)pControl);
- else
- ReportError( GEN_RES_STR1( S_NO_MENU, MethodString( nMethodId ) ) );
- }
- break;
- case M_FadeIn:
- case M_FadeOut:
- case M_Pin:
- case M_IsFadeIn:
- case M_IsPin:
- {
- WindowAlign aWindowAlign = WINDOWALIGN_LEFT;
- if ( (nParams & PARAM_UINT16_1) )
- {
- switch ( nNr1 )
- {
- case CONST_ALIGN_LEFT:
- aWindowAlign = WINDOWALIGN_LEFT;
- break;
- case CONST_ALIGN_TOP:
- aWindowAlign = WINDOWALIGN_TOP;
- break;
- case CONST_ALIGN_RIGHT:
- aWindowAlign = WINDOWALIGN_RIGHT;
- break;
- case CONST_ALIGN_BOTTOM:
- aWindowAlign = WINDOWALIGN_BOTTOM;
- break;
- default:
- ReportError( aUId, GEN_RES_STR1( S_INVALID_POSITION, MethodString( nMethodId ) ) );
- }
- }
-
- Window* pTemp = NULL;
- while ( !pTemp && pControl )
- {
- pTemp = GetFadeSplitWin( pControl, aWindowAlign );
- pControl = pControl->GET_REAL_PARENT();
- }
-
- if ( !pTemp )
- {
- ReportError( aUId, GEN_RES_STR1( S_SPLITWIN_NOT_FOUND, MethodString( nMethodId ) ) );
- break;
- }
-
- pControl = pTemp;
- SplitWindow *pSW = (SplitWindow*) pTemp;
-
- switch( nMethodId )
- {
- case M_FadeIn:
- if ( pSW->IsFadeInButtonVisible() )
- pSW->FadeIn();
- break;
- case M_FadeOut:
- if ( pSW->IsFadeOutButtonVisible() )
- pSW->FadeOut();
- break;
- case M_Pin:
- if ( ( pSW->GetAutoHideState() && bBool1 )
- || ( !pSW->GetAutoHideState() && !bBool1 ) )
- {
- MouseEvent aMEvnt;
- Point aPt( pSW->GetAutoHideRect().Center() );
- aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT );
- ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL );
- ImplMouseButtonUp ( pControl, aMEvnt, FORCE_DIRECT_CALL );
- }
- break;
- case M_IsFadeIn:
- pRet->GenReturn ( RET_Value, aUId, pSW->IsFadeOutButtonVisible() );
- break;
- case M_IsPin:
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)!pSW->GetAutoHideState() );
- break;
- default:
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
- }
- SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) );
- }
- break;
- case M_StatusGetText:
- case M_StatusIsProgress:
- case M_StatusGetItemCount:
- case M_StatusGetItemId:
- {
- StatusBar *pStatus = NULL;
- while ( !pStatus && pControl )
- {
- pStatus = (StatusBar*)GetWinByRT( pControl, WINDOW_STATUSBAR, sal_True );
- pControl = pControl->GET_REAL_PARENT();
- }
-
- if ( !pStatus )
- {
- ReportError( aUId, GEN_RES_STR1( S_NO_STATUSBAR, MethodString( nMethodId ) ) );
- break;
- }
-
- switch ( nMethodId )
- {
- case M_StatusGetText:
- {
- if ( (nParams & PARAM_UINT16_1) )
- {
- if ( pStatus->AreItemsVisible() )
- pRet->GenReturn ( RET_Value, aUId, String(pStatus->GetItemText(nNr1)));
- else
- ReportError( aUId, GEN_RES_STR1( S_ITEMS_INVISIBLE, MethodString( nMethodId ) ) );
- }
- else
- {
- if ( pStatus->AreItemsVisible() )
- {
- if ( pStatus->GetItemCount() == 1 )
- {
- pRet->GenReturn ( RET_Value, aUId, pStatus->GetItemText( pStatus->GetItemId(0) ));
- }
- else
- {
- pRet->GenReturn ( RET_Value, aUId, String() );
- }
- }
- else
- pRet->GenReturn ( RET_Value, aUId, (String)pStatus->GetText() );
- }
- }
- break;
- case M_StatusIsProgress:
- {
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)pStatus->IsProgressMode() );
- }
- break;
- case M_StatusGetItemCount:
- if ( pStatus->AreItemsVisible() )
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pStatus->GetItemCount()));
- else
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0));
- break;
- case M_StatusGetItemId:
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pStatus->GetItemCount()) )
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pStatus->GetItemId(nNr1-1)));
- break;
- }
- }
- break;
- case M_HasScrollBar:
- case M_IsScrollBarEnabled:
- {
- if ( (nParams | PARAM_UINT16_1) != PARAM_UINT16_1 ) // so there are other params
- {
- ReportError( aUId, GEN_RES_STR0( S_INVALID_PARAMETERS ) );
- break;
- }
-
- if( !(nParams & PARAM_UINT16_1) )
- nNr1 = CONST_ALIGN_RIGHT; // default is right Scrollbar(vertical)
-
- if ( (nNr1 != CONST_ALIGN_RIGHT) && (nNr1 != CONST_ALIGN_BOTTOM) )
- {
- ReportError( aUId, GEN_RES_STR1( S_INVALID_POSITION, MethodString( nMethodId ) ) );
- break;
- }
-
- ScrollBar *pScroll = NULL;
-
- sal_uInt16 nSteps = 2;
- while ( !pScroll && pControl && nSteps-- )
- {
- pScroll = GetScrollBar( pControl, nNr1, sal_True );
- pControl = pControl->GET_REAL_PARENT();
- }
-
- switch ( nMethodId )
- {
- case M_HasScrollBar:
- {
- if ( pScroll )
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_True );
- else
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_False );
- }
- break;
- case M_IsScrollBarEnabled:
- {
- if ( !pScroll )
- {
- ReportError( aUId, GEN_RES_STR1( S_NO_SCROLLBAR, MethodString( nMethodId ) ) );
- break;
- }
- pRet->GenReturn ( RET_Value, aUId, pScroll->IsEnabled() );
- }
- break;
- }
- }
- break;
- default:
- return sal_False;
- }
- return sal_True;
-}
-
-
-sal_Bool StatementControl::Execute()
-{
- Window *pControl;
- sal_Bool bStatementDone = sal_True;
-
-
- if ( IsError )
- {
- #if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Skipping Window: " );
- m_pDbgWin->AddText( Id2Str( aUId ) );
- m_pDbgWin->AddText( " Method: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
- m_pDbgWin->AddText( "\n" );
- #endif
- Advance();
- delete this;
- return sal_True;
- }
-
- InitProfile();
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Executing Window: " );
- m_pDbgWin->AddText( Id2Str( aUId ) );
- m_pDbgWin->AddText( " Method: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) );
- m_pDbgWin->AddText( "\n" );
-#endif
-
-
- if ( aUId.equals( UID_ACTIVE ) )
- pControl = GetAnyActive();
- else
- {
- sal_Bool bSearchButtonOnToolbox = (nParams == PARAM_NONE) && ((M_Click == nMethodId) || (M_TearOff == nMethodId) || (M_IsEnabled == nMethodId) || (M_OpenMenu == nMethodId));
- bSearchButtonOnToolbox |= (nParams == PARAM_UINT16_1) && (M_GetState == nMethodId);
- if ( nMethodId == M_TypeKeys || nMethodId == M_MouseDown
- || nMethodId == M_MouseUp || nMethodId == M_MouseMove
- || nMethodId == M_SnapShot )
- {
- pControl = NULL;
- if ( /*(nMethodId == M_SnapShot || nMethodId == M_TypeKeys) &&*/ !pControl )
- pControl = SearchTree( aUId ,bSearchButtonOnToolbox );
- }
- else
- pControl = SearchTree( aUId ,bSearchButtonOnToolbox );
- }
-
-
- if ( pControl && pControl->GetType() == WINDOW_TOOLBOX )
- {
- if ( !aUId.equals( pControl->GetUniqueOrHelpId() ) )
- {
- switch ( nMethodId )
- {
- case M_Click:
- case M_TearOff:
- case M_OpenMenu:
- case M_GetState:
- break;
- case M_IsEnabled:
- nMethodId = _M_IsEnabled; // change label because treatment is essentially different
- break;
- default:
- pControl = NULL;
- }
- }
- }
-
-
- switch ( nMethodId )
- {
- case M_Exists:
- case M_NotExists:
- Time aT( Time::SYSTEM );
- sal_uInt16 aSeconds = aT.GetMin()*60+aT.GetSec();
- if ( !bBool2 ) // has been set to sal_False in the constructor
- {
- bBool2 = sal_True;
- nNr2 = aSeconds;
- if( !(nParams & PARAM_UINT16_1) )
- nNr1 = 0;
- }
- if ( aSeconds < nNr2 )
- aSeconds += 60*60;
-
- if ( !pControl || !pControl->IsVisible() )
- pControl = NULL;
- if ( ((nMethodId == M_Exists) && pControl) ||
- ((nMethodId == M_NotExists) && !pControl) )
- {
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_True );
- }
- else
- if ( aSeconds <= nNr2 + nNr1 )
- return sal_False;
- else
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_False );
-
- Advance();
- delete this;
- return sal_True;
- }
-
-
- short nRT = 0;
-
- if( pControl ) // the window does exist somewhere but may be hidden
- {
- nRT = ImpGetRType( pControl );
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Type is: " );
- m_pDbgWin->AddText( String::CreateFromInt32( nRT ) );
- m_pDbgWin->AddText( "\n" );
-#endif
- }
-
- if ( nRT == C_Window && // Search for WorkWindow to satisfy these commands
- ( nMethodId == M_Close
- || nMethodId == M_IsMax
- || nMethodId == M_IsMin
- || nMethodId == M_IsRestore
- || nMethodId == M_Minimize
- || nMethodId == M_Maximize
- || nMethodId == M_Restore ) )
- {
- Window* pNewControl = pControl;
- while ( pNewControl && pNewControl->GetType() != WINDOW_WORKWINDOW )
- pNewControl = pNewControl->GET_REAL_PARENT();
-
- if ( pNewControl )
- {
- pControl = pNewControl;
- nRT = C_WorkWin;
- }
- }
-
-
- if ( (!ControlOK( pControl, "" )) && ( nMethodId != M_SnapShot ) && (nRetryCount--))
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( CUniString("Reschedule command (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") );
-#endif
- return sal_False;
- }
-
- if( ControlOK( pControl, "" ) )
- {
- if ( nMethodId == M_OpenContextMenu && !bBool2 )
- {
- pControl->GrabFocus(); // to get asyncron focus on unix
- bBool2 = sal_True;
- return sal_False;
- }
- // TODO: handle GetFocus for all Methods and Windows like this (remove part below)
- // See for impact of changed focus for HandleVisibleControls() (taking Snapshots might be different, possible exclude those methods)
- if (( (nRT == C_TreeListBox) && !bBool2 )
- && nMethodId != M_TypeKeys
- && nMethodId != M_MouseDown
- && nMethodId != M_MouseUp
- && nMethodId != M_MouseMove )
- {
- if ( !pControl->HasFocus() )
- {
- pControl->GrabFocus();
- int i = 10;
- while ( i-- && !pControl->HasFocus() ) // reschedule a bit
- {
- SafeReschedule();
- if ( !WinPtrValid( pControl ) )
- return sal_False;
- }
- if ( !pControl->HasFocus() ) // to get asyncronous focus
- {
- bBool2 = sal_True;
- return sal_False;
- }
- }
- }
- }
-
- Advance();
-
- if ( HandleVisibleControls( pControl ) )
- {
- delete this;
- return sal_True;
- }
- if( ControlOK( pControl, "Window/Control" ) )
- {
- if (((( nRT < C_TabPage && nRT > C_TabControl )
- || nRT == C_PatternBox
- || nRT == C_ToolBox
- || nRT == C_ValueSet
- || nRT == C_Control
- || nRT == C_TreeListBox
- )
- || nMethodId == M_OpenContextMenu )
- && nMethodId != M_TypeKeys
- && nMethodId != M_MouseDown
- && nMethodId != M_MouseUp
- && nMethodId != M_MouseMove )
- pControl->GrabFocus();
-
- if ( !HandleCommonMethods( pControl ) )
- {
- switch( nRT )
- {
- case C_TabControl:
- switch( nMethodId )
- {
- case M_GetPageId:
- if ( (nParams & PARAM_UINT16_1) )
- {
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((TabControl*)pControl)->GetPageCount() ) )
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)((TabControl*)pControl)->GetPageId(nNr1-1));
- }
- else
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)((TabControl*)pControl)->GetCurPageId());
- break;
- case M_GetPageCount:
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)((TabControl*)pControl)->GetPageCount());
- break;
- case M_SetPageId:
- if (((TabControl*)pControl)->GetCurPageId())
- ((TabControl*)pControl)->DeactivatePage();
- ((TabControl*)pControl)->SetCurPageId( nNr1 );
- ((TabControl*)pControl)->ActivatePage();
- break;
- case M_SetPageNr:
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((TabControl*)pControl)->GetPageCount() ) )
- {
- if (((TabControl*)pControl)->GetCurPageId())
- ((TabControl*)pControl)->DeactivatePage();
- ((TabControl*)pControl)->SetCurPageId( ((TabControl*)pControl)->GetPageId( nNr1-1 ) );
- ((TabControl*)pControl)->ActivatePage();
- }
- break;
- case M_GetPage:
- pRet->GenReturn ( RET_Value, aUId, Id2Str( ((TabControl*)pControl)->GetTabPage(((TabControl*)pControl)->GetCurPageId())->GetUniqueOrHelpId() ) );
- break;
- case M_SetPage :
- { // because of local variables
- TabControl *pTControl = ((TabControl*)pControl);
- sal_uInt16 nActive = pTControl->GetCurPageId();
- sal_uInt16 i,anz;
- rtl::OString aID;
- rtl::OString aWantedID;
- //HELPID BACKWARD (No numbers please (remove PARAM_UINT32_1 part)
- if ( (nParams & PARAM_UINT32_1) )
- {
- ReportError( aUId, GEN_RES_STR1c( S_INTERNAL_ERROR, "using numeric HelpID from old Testtool" ) );
- }
- else if ( (nParams & PARAM_STR_1) )
- {
- aWantedID = Str2Id( aString1 );
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
-
- i = pTControl->GetPagePos( pTControl->GetCurPageId() );
- for ( anz=0 ; anz < pTControl->GetPageCount() && !aID.equals( aWantedID ) ; anz++ )
- {
- pTControl->SelectTabPage( pTControl->GetPageId(i) );
- aID = pTControl->GetTabPage(pTControl->GetCurPageId())->GetUniqueOrHelpId();
- i++;
- if ( i >= pTControl->GetPageCount() )
- i = 0;
- if ( !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) )
-
- break;
- }
- if ( !aID.equals( aWantedID ) )
- {
- pTControl->SelectTabPage( nActive );
- ReportError( aWantedID, GEN_RES_STR1( S_TABPAGE_NOT_FOUND, MethodString( nMethodId ) ) );
- }
- }
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TabControl" ) );
- break;
- }
- break;
- case C_RadioButton:
- case C_ImageRadioButton:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteLinks);
- break;
- case M_IsChecked :
- pRet->GenReturn ( RET_Value, aUId, ((RadioButton*)pControl)->IsChecked());
- break;
- case M_Check :
- ((RadioButton*)pControl)->Check();
- ((RadioButton*)pControl)->Click();
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RadioButton" ) );
- break;
- }
- break;
- case C_CheckBox:
- case C_TriStateBox:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteLinks);
- break;
- case M_IsChecked :
- pRet->GenReturn ( RET_Value, aUId, comm_BOOL( ((TriStateBox*)pControl)->GetState() == STATE_CHECK) );
- break;
- case M_IsTristate :
- pRet->GenReturn ( RET_Value, aUId, comm_BOOL( ((TriStateBox*)pControl)->GetState() == STATE_DONTKNOW) );
- break;
- case M_GetState :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((TriStateBox*)pControl)->GetState()));
- break;
- case M_Check :
- ((TriStateBox*)pControl)->SetState( STATE_CHECK );
- ((TriStateBox*)pControl)->Click();
- break;
- case M_UnCheck :
- ((TriStateBox*)pControl)->SetState( STATE_NOCHECK );
- ((TriStateBox*)pControl)->Click();
- break;
- case M_TriState :
- if ( ((TriStateBox*)pControl)->IsTriStateEnabled() )
- {
- ((TriStateBox*)pControl)->SetState( STATE_DONTKNOW );
- ((TriStateBox*)pControl)->Click();
- }
- else
- {
- ReportError( aUId, GEN_RES_STR0( S_TRISTATE_NOT_ALLOWED ) );
- }
- break;
- case M_Click :
- {
- TriStateBox *pTB = ((TriStateBox*)pControl);
- if ( pTB->GetState() == STATE_NOCHECK )
- pTB->SetState( STATE_CHECK );
- else if ( pTB->GetState() == STATE_CHECK )
- {
- if ( pTB->IsTriStateEnabled() )
- pTB->SetState( STATE_DONTKNOW );
- else
- pTB->SetState( STATE_NOCHECK );
- }
- else
- pTB->SetState( STATE_NOCHECK );
- pTB->Click();
- }
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TriStateBox" ) );
- break;
- }
- break;
- case C_Edit:
- case C_MultiLineEdit:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, Mitte);
- break;
- case M_GetText :
- pRet->GenReturn ( RET_Value, aUId, ((Edit*)pControl)->GetText());
- break;
- case M_IsWritable:
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((Edit*)pControl)->IsReadOnly() );
- break;
- default:
- if ( ! ((Edit*)pControl)->IsReadOnly() )
- {
- switch( nMethodId )
- {
- case M_SetText :
- ((Edit*)pControl)->SetText( aString1 );
- if ( nRT == C_MultiLineEdit ) // since SetModifyFlag is not virtual we have to do this
- ((MultiLineEdit*)pControl)->SetModifyFlag();
- else
- ((Edit*)pControl)->SetModifyFlag();
- ((Edit*)pControl)->Modify();
- if ( ((Edit*)pControl)->GetText().CompareTo(aString1) != COMPARE_EQUAL )
- ReportError( aUId, GEN_RES_STR1( S_ERROR_IN_SET_TEXT, MethodString( nMethodId ) ) );
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "(MultiLine)Edit" ) );
- break;
- }
- }
- else
- ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "(MultiLine)Edit" ) );
- }
- break;
- case C_MultiListBox:
- case C_ListBox:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- case M_GetSelCount :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ListBox*)pControl)->GetSelectEntryCount()));
- break;
- case M_GetSelIndex :
- if ( ! (nParams & PARAM_UINT16_1) )
- {
- if ( ((ListBox*)pControl)->GetSelectEntryCount() == 0 )
- {
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0));
- break;
- }
- nNr1 = 1;
- }
- ValueOK(aUId, MethodString( nMethodId ),nNr1,((ListBox*)pControl)->GetSelectEntryCount());
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ListBox*)pControl)->GetSelectEntryPos(nNr1-1)) +1);
- break;
- case M_GetSelText :
- if ( ! (nParams & PARAM_UINT16_1) )
- nNr1 = 1;
- pRet->GenReturn ( RET_Value, aUId, ((ListBox*)pControl)->GetSelectEntry(nNr1-1));
- break;
- case M_GetItemCount :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ListBox*)pControl)->GetEntryCount()));
- break;
- case M_GetItemText :
- pRet->GenReturn ( RET_Value, aUId, ((ListBox*)pControl)->GetEntry(nNr1-1));
- break;
- case M_Select:
- case M_MultiSelect:
- {
- sal_Bool bUnselectBeforeSelect = ( nMethodId == M_Select );
- sal_Bool bFehler = sal_False;
- if ( ! (nParams & PARAM_BOOL_1) )
- bBool1 = sal_True;
-
- if ( nMethodId == M_MultiSelect && nRT == C_ListBox )
- {
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ListBox" ) );
- bFehler = sal_True;
- }
-
- if ( !bBool1 && nMethodId == M_Select )
- {
- ReportError( aUId, GEN_RES_STR1( S_NO_SELECT_FALSE, MethodString( nMethodId ) ) );
- bFehler = sal_True;
- }
-
- if ( !bFehler )
- {
- if( nParams & PARAM_STR_1 )
- {
- ListBox *pLB = ((ListBox*)pControl);
- sal_uInt16 nPos;
- if ( (nPos = pLB->GetEntryPos( aString1 )) == LISTBOX_ENTRY_NOTFOUND )
- ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
- else
- {
- if ( bUnselectBeforeSelect )
- pLB->SetNoSelection();
- pLB->SelectEntryPos( nPos, bBool1 );
- if ( pLB->IsEntryPosSelected( nPos ) ? !bBool1 : bBool1 ) // XOR in with BOOL
- ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) );
- }
- }
- else
- {
- ListBox *pLB = ((ListBox*)pControl);
- pLB = static_cast<ListBox*>(pControl);
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pLB->GetEntryCount()) )
- {
- if ( bUnselectBeforeSelect )
- pLB->SetNoSelection();
- pLB->SelectEntryPos( nNr1-1, bBool1 );
- if ( pLB->IsEntryPosSelected( nNr1-1 ) ? !bBool1 : bBool1 ) // XOR in with BOOL
- ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), UniString::CreateFromInt32( nNr1 ) ) );
- }
- }
- ((ListBox*)pControl)->Select();
- }
- }
- break;
- case M_SetNoSelection :
- ((ListBox*)pControl)->SetNoSelection();
- ((ListBox*)pControl)->Select();
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "(Multi)ListBox" ) );
- break;
- }
- break;
- case C_ComboBox:
- case C_PatternBox:
- case C_NumericBox:
- case C_MetricBox:
- case C_CurrencyBox:
- case C_DateBox:
- case C_TimeBox:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- case M_GetSelText :
- pRet->GenReturn ( RET_Value, aUId, ((ComboBox*)pControl)->GetText());
- break;
- case M_GetSelIndex :
- {
- sal_uInt16 nPos = ((ComboBox*)pControl)->GetEntryPos(((ComboBox*)pControl)->GetText());
- if ( nPos == COMBOBOX_ENTRY_NOTFOUND )
- nPos = 0;
- else
- nPos++;
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32) nPos);
- }
- break;
- case M_GetItemCount :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ComboBox*)pControl)->GetEntryCount()));
- break;
- case M_GetItemText :
- pRet->GenReturn ( RET_Value, aUId, ((ComboBox*)pControl)->GetEntry(nNr1-1));
- break;
- case M_IsWritable:
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((ComboBox*)pControl)->IsReadOnly() );
- break;
- case M_Select :
- if( nParams & PARAM_UINT16_1 )
- {
- if ( !ValueOK(aUId, MethodString( nMethodId ),nNr1,((ComboBox*)pControl)->GetEntryCount()) )
- break;
- aString1 = ((ComboBox*)pControl)->GetEntry(nNr1-1);
- }
- else
- {
- if ( ((ComboBox*)pControl)->GetEntryPos( aString1 ) == COMBOBOX_ENTRY_NOTFOUND )
- {
- ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
- break;
- }
- }
-
-
- ((ComboBox*)pControl)->SetText( aString1 );
- ((ComboBox*)pControl)->SetModifyFlag();
- ((ComboBox*)pControl)->Modify();
- break;
- case M_SetText :
- if ( ! ((ComboBox*)pControl)->IsReadOnly() )
- {
- if ( ! (nParams & PARAM_STR_1) )
- aString1 = String();
- ((ComboBox*)pControl)->SetText( aString1 );
- ((ComboBox*)pControl)->SetModifyFlag();
- ((ComboBox*)pControl)->Modify();
- }
- else
- ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "ComboBox" ) );
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ComboBox" ) );
- break;
- }
- break;
- case C_PushButton:
- case C_OkButton:
- case C_CancelButton:
- case C_ImageButton:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, Mitte);
- break;
- case M_Click :
- ((PushButton*)pControl)->Click();
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "PushButton" ) );
- break;
- }
- break;
- case C_MoreButton:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, Mitte);
- break;
- case M_IsOpen :
- pRet->GenReturn ( RET_Value, aUId, ((MoreButton*)pControl)->GetState());
- break;
- case M_Click :
- ((MoreButton*)pControl)->Click();
- break;
- case M_Open :
- ((MoreButton*)pControl)->SetState(sal_True);
- break;
- case M_Close :
- ((MoreButton*)pControl)->SetState(sal_False);
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MoreButton" ) );
- break;
- }
- break;
- case C_SpinField:
- case C_PatternField:
- case C_NumericField:
- case C_MetricField:
- case C_CurrencyField:
- case C_DateField:
- case C_TimeField:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, Mitte);
- break;
- case M_GetText :
- pRet->GenReturn ( RET_Value, aUId, ((SpinField*)pControl)->GetText());
- break;
- case M_IsWritable:
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((SpinField*)pControl)->IsReadOnly() );
- break;
- case M_SetText :
- if ( ! ((SpinField*)pControl)->IsReadOnly() )
- {
- ((SpinField*)pControl)->SetText( aString1 );
- ((SpinField*)pControl)->SetModifyFlag();
- ((SpinField*)pControl)->Modify();
- }
- else
- ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "SpinField" ) );
- break;
- case M_More :
- {
- if ( !(nParams & PARAM_UINT16_1) )
- nNr1 = 1;
- for (int i = 1; i<= nNr1; i++)
- {
- ((SpinField*)pControl)->Up();
- ((SpinField*)pControl)->SetModifyFlag();
- ((SpinField*)pControl)->Modify();
- }
- }
- break;
- case M_Less :
- {
- if ( !(nParams & PARAM_UINT16_1) )
- nNr1 = 1;
- for (int i = 1; i<= nNr1; i++)
- {
- ((SpinField*)pControl)->Down();
- ((SpinField*)pControl)->SetModifyFlag();
- ((SpinField*)pControl)->Modify();
- }
- }
- break;
- case M_ToMin :
- ((SpinField*)pControl)->First();
- ((SpinField*)pControl)->SetModifyFlag();
- ((SpinField*)pControl)->Modify();
- break;
- case M_ToMax :
- ((SpinField*)pControl)->Last();
- ((SpinField*)pControl)->SetModifyFlag();
- ((SpinField*)pControl)->Modify();
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "SpinField" ) );
- break;
- }
- break;
-
- case C_MenuButton:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, Mitte);
- break;
- case M_Click :
- {
- MouseEvent aMEvnt;
- Point aPt( pControl->GetSizePixel().Width() / 2, pControl->GetSizePixel().Height() / 2 );
- aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT );
- ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL );
- ImplMouseButtonUp ( pControl, aMEvnt, FORCE_DIRECT_CALL );
- }
- break;
- case M_Open :
- case M_OpenMenu :
- {
- MouseEvent aMEvnt;
- Point aPt( pControl->GetSizePixel().Width() / 2, pControl->GetSizePixel().Height() / 2 );
- aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT );
- ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL );
-
- sal_uLong nStart = Time::GetSystemTicks();
- sal_uLong nDelay = pControl->GetSettings().GetMouseSettings().GetActionDelay();
- while ( ( Time::GetSystemTicks() - nStart ) < nDelay + 100 )
- SafeReschedule();
-
- ImplMouseButtonUp ( pControl, aMEvnt, FORCE_DIRECT_CALL );
-
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
- }
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MenuButton" ) );
- break;
- }
- break;
- case C_ToolBox:
- {
- ToolBox *pTB = ((ToolBox*)pControl);
- if ( !aUId.equals( pTB->GetUniqueOrHelpId() ) ) // So we found a Button on the ToolBox
- {
- if ( (nParams == PARAM_NONE) || (nParams == PARAM_UINT16_1) )
- { // we fake a Parameter
- nParams |= PARAM_STR_1;
- aString1 = Id2Str( aUId );
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
- }
-
-#define FIND_ITEM\
- sal_uInt16 nItemPos = 0;\
- sal_Bool bItemFound = sal_False;\
- {\
- rtl::OString aButtonId;\
- if( nParams & PARAM_STR_1 )\
- aButtonId = Str2Id( aString1 );\
- else\
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );\
- for ( nItemPos = 0; nItemPos < pTB->GetItemCount() && !aButtonId.equals(Str2Id( pTB->GetItemCommand(pTB->GetItemId(nItemPos)) )) &&\
- !aButtonId.equals(pTB->GetHelpId(pTB->GetItemId(nItemPos))) ; nItemPos++ ) {}\
- bItemFound = aButtonId.equals(Str2Id( pTB->GetItemCommand(pTB->GetItemId(nItemPos)) )) || aButtonId.equals(pTB->GetHelpId(pTB->GetItemId(nItemPos)));\
- if ( !bItemFound )\
- ReportError( aUId, GEN_RES_STR1( S_HELPID_ON_TOOLBOX_NOT_FOUND, MethodString( nMethodId ) ) );\
- else\
- {\
- if ( !pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) && nMethodId != _M_IsEnabled && nMethodId != M_GetState )\
- {\
- ReportError( aUId, GEN_RES_STR1( S_BUTTON_DISABLED_ON_TOOLBOX, MethodString( nMethodId ) ) );\
- bItemFound = sal_False;\
- }\
- else if ( !pTB->IsItemVisible( pTB->GetItemId(nItemPos) ) && nMethodId != M_GetState )\
- {\
- ReportError( aUId, GEN_RES_STR1( S_BUTTON_HIDDEN_ON_TOOLBOX, MethodString( nMethodId ) ) );\
- bItemFound = sal_False;\
- }\
- else\
- {\
- if ( pTB->IsMenuEnabled() )\
- { /* button is in Menu */\
- }\
- else\
- { /* Try the multi line way */\
- if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\
- {\
- sal_uInt16 nLine = pTB->GetCurLine();\
- do\
- {\
- pTB->ShowLine( sal_False );\
- for ( int i = 1 ; i < 30 ; i++ )\
- SafeReschedule();\
- }\
- while ( pTB->GetCurLine() != nLine && pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() );\
- pTB->Invalidate( pTB->GetScrollRect() );\
- }\
- if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\
- {\
- ReportError( aUId, GEN_RES_STR1( S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX, MethodString( nMethodId ) ) );\
- bItemFound = sal_False;\
- }\
- }\
- }\
- }\
- }
-
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteLinks);
- break;
- case M_Click :
- {
- FIND_ITEM;
- if ( bItemFound )
- {
- Rectangle aRect = pTB->GetItemRect(pTB->GetItemId(nItemPos));
- if ( aRect.IsEmpty() )
- {
- pTB->ExecuteCustomMenu();
-
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
-
- new StatementCommand( this, RC_MenuSelect, PARAM_UINT16_1, pTB->GetItemId(nItemPos) + TOOLBOX_MENUITEM_START );
- }
- else
- {
- aRect = pTB->GetItemRect(pTB->GetItemId(nItemPos));
- MouseEvent aMEvnt;
- aMEvnt = MouseEvent(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
- ImplMouseButtonDown( pTB, aMEvnt, FORCE_DIRECT_CALL );
- ImplMouseButtonUp ( pTB, aMEvnt, FORCE_DIRECT_CALL );
- }
- }
- }
- break;
- case M_TearOff :
- {
- FIND_ITEM;
- if ( bItemFound )
- {
- Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos );
- AnimateMouse( pControl, aRect.Center() );
- MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
- ImplMouseButtonDown( pTB, aMEvnt, FORCE_DIRECT_CALL );
-
- Window *pWin = NULL;
- // Wait for the window to open.
- StatementList::bExecuting = sal_True;
- {
- Time aDelay( Time::SYSTEM );
- while ( !pWin && ( (pWin = GetPopupFloatingWin()) == NULL ) && ( Time( Time::SYSTEM ) - aDelay ).GetSec() < 15 )
- SafeReschedule();
- }
- StatementList::bExecuting = sal_False;
-
- if ( pWin && pWin->GetType() == WINDOW_FLOATINGWINDOW )
- {
- aMEvnt = MouseEvent(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
- ImplMouseButtonUp( pTB, aMEvnt, FORCE_DIRECT_CALL );
- ((FloatingWindow*)pWin)->EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF );
- }
- else
- {
- aMEvnt = MouseEvent(Point(1,-10), 1, MOUSE_SIMPLECLICK,MOUSE_LEFT);
- ImplMouseButtonUp( pTB, aMEvnt, FORCE_DIRECT_CALL );
- ReportError( aUId, GEN_RES_STR1( S_TEAROFF_FAILED, MethodString( nMethodId ) ) );
- }
- }
- }
- break;
- case M_OpenMenu :
- {
- FIND_ITEM;
- if ( bItemFound )
- {
- Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos );
- AnimateMouse( pControl, aRect.Center() );
- MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT);
- ImplMouseButtonDown( pTB, aMEvnt);
- ImplMouseButtonUp( pTB, aMEvnt);
-
- // window is opened
- aSubMenuId1 = 0;
- aSubMenuId2 = 0;
- aSubMenuId3 = 0;
- pMenuWindow = NULL;
- }
- }
- break;
- case _M_IsEnabled:
- {
- FIND_ITEM;
- if ( bItemFound )
- {
- pRet->GenReturn ( RET_Value, aUId, pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) );
- }
- }
- break;
- case M_GetState :
- {
- FIND_ITEM;
- if ( bItemFound )
- {
- if ( ValueOK( aUId, CUniString("GetState"), nNr1, 4 ) )
- switch (nNr1)
- {
- case 0:
- pRet->GenReturn ( RET_Value, aUId, Id2Str( pTB->GetHelpId(pTB->GetItemId(nItemPos)) ) );
- break;
- case 1:
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemType(nItemPos));
- break;
- case 2:
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemState(pTB->GetItemId(nItemPos)));
- break;
- case 3:
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemId(nItemPos));
- break;
- default:
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0));
- break;
- }
- }
- }
- break;
- case M_GetItemText :
- pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetItemText(nNr1));
- break;
- case M_GetText :
- pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetText());
- break;
- case M_GetItemCount :
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemCount());
- break;
- case M_SetNextToolBox :
- if ( (nParams & PARAM_STR_1) )
- pTB->SetNextToolBox( aString1 );
- else
- pTB->SetNextToolBox( pTB->GetNextToolBox() );
- pTB->NextToolBox();
- break;
- case M_GetNextToolBox :
- pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetNextToolBox());
- break;
- case M_Dock :
- case M_Undock :
- case M_IsDocked :
- case M_Close:
- case M_Size:
- case M_Move:
- case M_IsMax:
- case M_Minimize:
- case M_Maximize:
- case M_Help: // everything that shall be handled below
- goto DockingWin;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ToolBox" ) );
- break;
- }
- }
- break;
-
- case C_TreeListBox:
- switch( nMethodId )
- {
-
-
-
-#define GET_NTH_ENTRY_LBOX( First, Next, Anzahl) \
- SvLBoxEntry *pThisEntry = ((SvTreeListBox*)pControl)->First(); \
- { \
- int niTemp = Anzahl; \
- while ( niTemp-- ) \
- { \
- pThisEntry = ((SvTreeListBox*)pControl)->Next( pThisEntry ); \
- } \
- }
-
- case M_GetText : // Get the first text of the given (default=1) line
- { // should get removed some time
- SvTreeListBox *pTree = (SvTreeListBox*)pControl;
- SvLBoxEntry *pThisEntry = pTree->GetCurEntry();
- if ( ! (nParams & PARAM_UINT16_1) )
- nNr1 = 1;
- if ( pThisEntry )
- {
- SvLBoxString* pItem = NULL;
- sal_uInt16 nValidTextItemCount = 0;
- {
- sal_uInt16 nIndex = 0;
- SvLBoxItem *pMyItem;
- while ( ( nValidTextItemCount < nNr1 ) && nIndex < pThisEntry->ItemCount() )
- {
- pMyItem = pThisEntry->GetItem( nIndex );
- if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING )
- {
- pItem = (SvLBoxString*)pMyItem;
- nValidTextItemCount++;
- }
- nIndex++;
- }
- }
- if ( ValueOK( aUId, CUniString("GetText"), nNr1, nValidTextItemCount ) )
- pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
- }
- else
- ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) );
- }
- break;
- case M_GetSelCount :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((SvLBox*)pControl)->GetSelectionCount()));
- break;
- case M_GetItemCount :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((SvLBox*)pControl)->GetVisibleCount()) );
- break;
- case M_GetSelIndex :
- if ( ! (nParams & PARAM_UINT16_1) )
- nNr1 = 1;
- if ( ValueOK(aUId, CUniString("GetSelIndex"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
- {
- nNr1--;
- GET_NTH_ENTRY_LBOX( FirstSelected, NextSelected, nNr1);
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( ((SvTreeListBox*)pControl)->GetVisiblePos( pThisEntry )) +1 );
- }
- break;
- case M_Select :
- if ( ! (nParams & PARAM_BOOL_1) )
- bBool1 = sal_True;
- if( nParams & PARAM_STR_1 )
- {
- ReportError( aUId, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED, MethodString( nMethodId ) ) );
- }
- else
- {
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
- {
- SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
- ((SvTreeListBox*)pControl)->Select ( pEntry, bBool1 );
- }
- }
- break;
- case M_GetSelText :
- if ( ! (nParams & PARAM_UINT16_1) )
- nNr1 = 1;
- if ( ! (nParams & PARAM_UINT16_2) )
- nNr2 = 1;
- if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) )
- {
- nNr1--;
- GET_NTH_ENTRY_LBOX( FirstSelected, NextSelected, nNr1);
- if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
- {
- SvLBoxString* pItem = NULL;
- if ( ! (nParams & PARAM_UINT16_2) )
- pItem = (SvLBoxString*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING );
- else
- {
- SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
- if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING )
- pItem = (SvLBoxString*)pMyItem;
- }
-
- if ( pItem )
- pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_STRING, MethodString( nMethodId ) ) );
- }
- }
- break;
- case M_GetItemText :
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
- {
- SvLBoxEntry *pThisEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 );
- if ( ! (nParams & PARAM_UINT16_2) )
- nNr2 = 1;
- if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
- {
- SvLBoxString* pItem = NULL;
- if ( ! (nParams & PARAM_UINT16_2) )
- pItem = (SvLBoxString*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING );
- else
- {
- SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
- if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING )
- pItem = (SvLBoxString*)pMyItem;
- }
-
- if ( pItem )
- pRet->GenReturn ( RET_Value, aUId, pItem->GetText() );
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_STRING, MethodString( nMethodId ) ) );
- }
- }
- break;
- case M_IsChecked :
- case M_IsTristate :
- case M_GetState :
- case M_Check :
- case M_UnCheck :
- case M_TriState :
- {
- SvTreeListBox *pTree = (SvTreeListBox*)pControl;
- SvLBoxEntry *pThisEntry = NULL;
-
- if ( ! (nParams & PARAM_UINT16_1) )
- {
- pThisEntry = pTree->GetCurEntry();
- if ( !pThisEntry )
- ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) );
- }
- else
- {
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
- {
- pThisEntry = (SvLBoxEntry*)pTree->GetEntryAtVisPos( nNr1-1 );
- }
- }
-
- if ( ! (nParams & PARAM_UINT16_2) )
- nNr2 = 1;
-
- if ( pThisEntry )
- {
- if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
- {
- SvLBoxButton* pItem = NULL;
- if ( ! (nParams & PARAM_UINT16_2) )
- pItem = (SvLBoxButton*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXBUTTON );
- else
- {
- SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
- if ( pMyItem->IsA() == SV_ITEM_ID_LBOXBUTTON )
- pItem = (SvLBoxButton*)pMyItem;
- }
-
- if ( pItem )
- {
- switch( nMethodId )
- {
- case M_IsChecked :
- pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pItem->IsStateChecked() ) );
- break;
- case M_IsTristate :
- pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pItem->IsStateTristate() ) );
- break;
- case M_GetState :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pItem->GetButtonFlags() & ~SV_STATE_MASK ));
- break;
- case M_Check :
- if ( !pItem->IsStateChecked() )
- {
- pItem->SetStateChecked();
- pTree->CheckButtonHdl();
- pTree->InvalidateEntry( pThisEntry );
- }
- break;
- case M_UnCheck :
- if ( pItem->IsStateChecked() || pItem->IsStateTristate() )
- {
- pItem->SetStateUnchecked();
- pTree->CheckButtonHdl();
- pTree->InvalidateEntry( pThisEntry );
- }
- break;
- case M_TriState :
- if ( !pItem->IsStateTristate() )
- {
- pItem->SetStateTristate();
- pTree->CheckButtonHdl();
- pTree->InvalidateEntry( pThisEntry );
- }
- break;
- default:
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
- break;
- }
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_BUTTON, MethodString( nMethodId ) ) );
- }
- }
- }
- break;
- case M_GetItemType :
- {
- SvTreeListBox *pTree = (SvTreeListBox*)pControl;
- SvLBoxEntry *pThisEntry = NULL;
-
- if ( ! (nParams & PARAM_UINT16_1) )
- {
- pThisEntry = pTree->GetCurEntry();
- if ( !pThisEntry )
- ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) );
- }
- else
- {
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) )
- {
- pThisEntry = (SvLBoxEntry*)pTree->GetEntryAtVisPos( nNr1-1 );
- }
- }
-
- if ( pThisEntry )
- {
- if ( ! (nParams & PARAM_UINT16_2) )
- nNr2 = 1;
- if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) )
- {
- SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 );
- comm_UINT16 nType;
- switch ( pMyItem->IsA() )
- {
- case SV_ITEM_ID_LBOXSTRING: nType = CONST_ItemTypeText ; break;
- case SV_ITEM_ID_LBOXBMP: nType = CONST_ItemTypeBMP ; break;
- case SV_ITEM_ID_LBOXBUTTON: nType = CONST_ItemTypeCheckbox ; break;
- case SV_ITEM_ID_LBOXCONTEXTBMP: nType = CONST_ItemTypeContextBMP ; break;
- default: nType = CONST_ItemTypeUnknown;
- }
- pRet->GenReturn ( RET_Value, aUId, nType );
- }
- }
- }
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TreeListBox" ) );
- break;
- }
- break;
- case C_Control:
- {
- sal_uInt16 nRealControlType = 0;
- if ( dynamic_cast< EditBrowseBox* >(pControl) )
- nRealControlType = CONST_CTBrowseBox;
- else if ( dynamic_cast< ValueSet* >(pControl) )
- nRealControlType = CONST_CTValueSet;
- else if ( dynamic_cast< ORoadmap* >(pControl) )
- nRealControlType = CONST_CTORoadmap;
- else if ( dynamic_cast< IExtensionListBox* >(pControl) )
- nRealControlType = CONST_CTIExtensionListBox;
- else if ( dynamic_cast< ::svt::table::TableControl* >(pControl) )
- nRealControlType = CONST_CTTableControl;
- else
- nRealControlType = CONST_CTUnknown;
-
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- default:
- switch( nRealControlType )
- {
- case CONST_CTBrowseBox:
- {
- EditBrowseBox* pEBBox = dynamic_cast< EditBrowseBox* >(pControl);
- switch( nMethodId )
- {
- case M_GetSelText :
- {
- pRet->GenReturn ( RET_Value, aUId, pEBBox->GetCellText( pEBBox->GetCurrRow(), pEBBox->GetColumnId( pEBBox->GetCurrColumn() )));
- }
- break;
- case M_GetColumnCount :
- {
- sal_uInt16 nColCount = pEBBox->GetColumnCount();
- comm_UINT16 nUnfrozenColCount = 0;
- sal_uInt16 i;
- for ( i=0 ; i < nColCount ; i++ )
- {
- if ( !pEBBox->IsFrozen( pEBBox->GetColumnId( i ) ) )
- nUnfrozenColCount++;
- }
- pRet->GenReturn ( RET_Value, aUId, nUnfrozenColCount );
- }
- break;
- case M_GetRowCount :
- {
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pEBBox->GetRowCount() );
- }
- break;
- case M_IsEditing :
- {
- CellControllerRef aControler;
- aControler = pEBBox->Controller();
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)aControler.Is() );
- }
- break;
- case M_Select :
- {
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pEBBox->GetRowCount() ) )
- {
- sal_uInt16 nColCount = pEBBox->GetColumnCount();
- comm_UINT16 nUnfrozenColCount = 0;
- sal_uInt16 i;
- for ( i=0 ; i < nColCount ; i++ )
- {
- if ( !pEBBox->IsFrozen( pEBBox->GetColumnId( i ) ) )
- nUnfrozenColCount++;
- }
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr2,nUnfrozenColCount ) )
- pEBBox->GoToRowColumnId( nNr1-1, pEBBox->GetColumnId( nNr2 ) );
- }
- }
- break;
-
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "EditBrowseBox" ) );
- break;
- }
- }
- break;
- case CONST_CTValueSet:
- {
- ValueSet *pVS = dynamic_cast< ValueSet* >(pControl);
- switch ( nMethodId )
- {
- case M_GetItemCount:
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pVS->GetItemCount()));
- break;
- case M_GetItemText:
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pVS->GetItemCount() ))
- pRet->GenReturn ( RET_Value, aUId, pVS->GetItemText( pVS->GetItemId( nNr1-1 ) ) );
- break;
- case M_Select:
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pVS->GetItemCount() ))
- pVS->SelectItem( pVS->GetItemId( nNr1-1 ) );
- break;
- case M_GetSelIndex :
- if ( pVS->IsNoSelection() )
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0));
- else
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pVS->GetItemPos( pVS->GetSelectItemId() ) +1));
- break;
- case M_GetSelText :
- if ( pVS->IsNoSelection() )
- pRet->GenReturn ( RET_Value, aUId, String() );
- else
- pRet->GenReturn ( RET_Value, aUId, pVS->GetItemText( pVS->GetSelectItemId() ) );
- break;
- case M_SetNoSelection :
- pVS->SetNoSelection();
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ValueSet" ) );
- break;
- }
- }
- break;
- case CONST_CTORoadmap:
- {
- ORoadmap *pRM = dynamic_cast< ORoadmap* >(pControl);
- switch ( nMethodId )
- {
- case M_GetItemCount:
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pRM->GetItemCount()));
- break;
- case M_GetItemText:
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() ))
- pRet->GenReturn ( RET_Value, aUId, pRM->GetRoadmapItemLabel( pRM->GetItemID( nNr1-1 ) ) );
- break;
- case M_Select:
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() ))
- {
- if ( pRM->IsRoadmapItemEnabled( pRM->GetItemID( nNr1-1 ) ) )
- pRM->SelectRoadmapItemByID( pRM->GetItemID( nNr1-1 ) );
- else
- ReportError( aUId, GEN_RES_STR1c( S_WIN_DISABLED, "RoadmapItem" ) );
- }
- break;
- case M_GetSelIndex :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pRM->GetItemIndex( pRM->GetCurrentRoadmapItemID() ) +1));
- break;
- case M_GetSelText :
- pRet->GenReturn ( RET_Value, aUId, pRM->GetRoadmapItemLabel( pRM->GetCurrentRoadmapItemID() ) );
- break;
- case M_IsItemEnabled :
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() ))
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)pRM->IsRoadmapItemEnabled( pRM->GetItemID( nNr1-1 ) ) );
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RoadMap" ) );
- break;
- }
- }
- break;
- case CONST_CTIExtensionListBox:
- {
- IExtensionListBox *pELB = dynamic_cast< IExtensionListBox* >(pControl);
- switch ( nMethodId )
- {
- case M_GetItemCount:
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pELB->getItemCount()));
- break;
- case M_GetItemText:
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pELB->getItemCount() ))
- switch ( nNr2 )
- {
- case 1:
- pRet->GenReturn ( RET_Value, aUId, pELB->getItemName( nNr1 -1 ) );
- break;
- case 2:
- pRet->GenReturn ( RET_Value, aUId, pELB->getItemVersion( nNr1 -1 ) );
- break;
- case 3:
- pRet->GenReturn ( RET_Value, aUId, pELB->getItemDescription( nNr1 -1 ) );
- break;
- case 4:
- pRet->GenReturn ( RET_Value, aUId, pELB->getItemPublisher( nNr1 -1 ) );
- break;
- case 5:
- pRet->GenReturn ( RET_Value, aUId, pELB->getItemPublisherLink( nNr1 -1 ) );
- break;
- default:
- ValueOK( aUId, MethodString( nMethodId ).AppendAscii(" String Number"), nNr2, 5 );
- }
- break;
- case M_Select:
- if ( (nParams & PARAM_UINT16_1) )
- {
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pELB->getItemCount() ))
- {
- pELB->select( nNr1-1 );
- }
- }
- else if ( (nParams & PARAM_STR_1) )
- {
- pELB->select( aString1 );
- sal_Bool bSuccess = sal_True;
- if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
- bSuccess = sal_False;
- else
- {
- if ( !aString1.Equals( String( pELB->getItemName( pELB->getSelIndex() ) ) ) )
- bSuccess = sal_False;
- }
- if ( !bSuccess )
- ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) );
- }
- break;
- case M_GetSelCount :
- if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( 0 ));
- else
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( 1 ));
- break;
- case M_GetSelIndex :
- if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( 0 ));
- else
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pELB->getSelIndex() +1));
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RoadMap" ) );
- break;
- }
- }
- break;
-
- case CONST_CTTableControl:
- {
- ::svt::table::TableControl *pTC = dynamic_cast< ::svt::table::TableControl* >(pControl);
- switch ( nMethodId )
- {
- case M_GetItemType :
- {
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
- ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
- {
- ::svt::table::PTableModel pModel = pTC->GetModel();
- Any aCell;
- pModel->getCellContent( nNr1-1, nNr2-1, aCell );
- pRet->GenReturn ( RET_Value, aUId, String( aCell.getValueTypeName() ));
- }
- }
- break;
- case M_GetItemText :
- {
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) &&
- ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
- {
- ::svt::table::PTableModel pModel = pTC->GetModel();
- Any aCell;
- pModel->getCellContent( nNr1-1, nNr2-1, aCell );
-
- Type aType = aCell.getValueType();
- TypeClass eTypeClass = aType.getTypeClass();
- switch( eTypeClass )
- {
- case TypeClass_BOOLEAN:
- pRet->GenReturn ( RET_Value, aUId, *(sal_Bool*)aCell.getValue() );
- break;
- case TypeClass_CHAR:
- {
- ::rtl::OUString aContent( *(sal_Unicode*)aCell.getValue() );
- pRet->GenReturn ( RET_Value, aUId, aContent );
- }
- break;
- case TypeClass_STRING:
- {
- ::rtl::OUString aContent;
- aCell >>= aContent;
- pRet->GenReturn ( RET_Value, aUId, aContent );
- }
- break;
- case TypeClass_BYTE:
- case TypeClass_SHORT:
- case TypeClass_LONG:
- case TypeClass_HYPER:
- case TypeClass_UNSIGNED_LONG:
- case TypeClass_UNSIGNED_HYPER:
- {
- comm_UINT32 val = 0;
- aCell >>= val;
- pRet->GenReturn ( RET_Value, aUId, val );
- }
- break;
- case TypeClass_UNSIGNED_SHORT:
- {
- comm_UINT16 val = 0;
- aCell >>= val;
- pRet->GenReturn ( RET_Value, aUId, val );
- }
- break;
- default:
- pRet->GenReturn ( RET_Value, aUId, comm_UINT16(0) );
- break;
- }
- }
- }
- break;
- case M_GetColumnCount :
- {
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTC->GetColumnCount() );
- }
- break;
- case M_GetRowCount :
- {
- pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTC->GetRowCount() );
- }
- break;
- case M_Select :
- {
- if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetRowCount() ))
- {
- if ( pTC->GoToRow( ::svt::table::RowPos( nNr1-1 ) ) )
- {
- Size aSize( pTC->GetSizePixel() );
- Point aPos( aSize.Width() / 2, aSize.Height() / 2 );
- long nStep = aSize.Height() / 4;
- ::svt::table::RowPos nLastPos;
- while ( ( nLastPos = pTC->getTableControlInterface().hitTest( aPos ).nRow ) != nNr1-1 && nStep > 0 )
- {
- if ( nLastPos > nNr1-1 || nLastPos == ROW_INVALID )
- aPos.Y() -= nStep;
- else
- aPos.Y() += nStep;
- nStep /= 2;
- }
- if ( pTC->getTableControlInterface().hitTest( aPos ).nRow == nNr1-1 )
- {
- MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,MOUSE_LEFT,KEY_MOD1);
- pTC->getSelEngine()->SelMouseButtonDown( aMEvnt );
- pTC->getSelEngine()->SelMouseButtonUp( aMEvnt );
- if ( pTC->IsRowSelected( nNr1-1 ) )
- pTC->Select();
- }
- else
- ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "find pos" ) );
- }
- else
- ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "GoTo" ) );
- }
- }
- break;
- case M_GetSelCount :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT16( pTC->GetSelectedRowCount() ));
- break;
- case M_GetSelIndex :
- if ( ! (nParams & PARAM_UINT16_1) )
- nNr1 = 1;
- if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRowCount() ) )
- pRet->GenReturn ( RET_Value, aUId, comm_UINT16( pTC->GetSelectedRowIndex( nNr1-1 ) +1 ) );
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TableControl" ) );
- break;
- }
- }
- break;
-
- case CONST_CTUnknown:
- ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) );
- break;
- default:
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
- break;
- }
- }
- break;
- }
- case C_Window:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "Window" ) );
- break;
- }
- break;
-
- case C_DockingWin:
- DockingWin:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- case M_Dock :
- if ( ((DockingWindow*)pControl)->IsFloatingMode() )
- ((DockingWindow*)pControl)->SetFloatingMode(sal_False);
- else
- ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) );
- break;
- case M_Undock :
- if ( !((DockingWindow*)pControl)->IsFloatingMode() )
- ((DockingWindow*)pControl)->SetFloatingMode(sal_True);
- else
- ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) );
- break;
- case M_IsDocked :
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((DockingWindow*)pControl)->IsFloatingMode());
- break;
- case M_Close:
- DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
- SET_WINP_CLOSING(pControl);
- ((DockingWindow*)pControl)->Close();
- break;
- case M_Size:
- case M_Move:
- case M_IsMax:
- case M_Minimize:
- case M_Maximize:
- if ( ((DockingWindow*)pControl)->IsFloatingMode() )
- {
- Window* pFloat = ((DockingWindow*)pControl)->GetFloatingWindow();
- if ( !pFloat && ((DockingWindow*)pControl)->IsFloatingMode() )
- {
- if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW )
- pFloat = pControl->GET_REAL_PARENT();
- else
- {
- OSL_FAIL("FloatingMode set but Parent is no FloatingWindow");
- }
- }
- if ( pFloat && pFloat->GetType() == WINDOW_FLOATINGWINDOW )
- {
- pControl = pFloat;
- goto FloatWin;
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_CANNOT_FIND_FLOATING_WIN, MethodString( nMethodId ) ) );
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_DOCKING_MODE, MethodString( nMethodId ) ) );
- break;
- case M_Help:
- goto MoreDialog;
-
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "DockingWindow" ) );
- break;
- }
- break;
- case C_FloatWin:
- FloatWin:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- case M_IsMax :
- pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)!((FloatingWindow*)pControl)->IsRollUp());
- break;
- case M_Minimize :
- ((FloatingWindow*)pControl)->RollUp();
- break;
- case M_Maximize :
- ((FloatingWindow*)pControl)->RollDown();
- break;
- case M_Size:
- {
- if ( pControl->GetStyle() & WB_SIZEABLE )
- {
- Size aMin = ((FloatingWindow*)pControl)->GetMinOutputSizePixel();
- if ( aMin.Width() <= nNr1 && aMin.Height() <= nNr2 )
- {
- pControl->SetSizePixel(Size(nNr1,nNr2));
- pControl->Resize();
- }
- else
- {
- ReportError( aUId, GEN_RES_STR2( S_SIZE_BELOW_MINIMUM, String::CreateFromInt32( aMin.Width() ), String::CreateFromInt32( aMin.Height() ) ) );
- }
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_SIZE_NOT_CHANGEABLE, MethodString( nMethodId ) ) );
- break;
- }
- case M_Close:
- DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
- SET_WINP_CLOSING(pControl);
- ((FloatingWindow*)pControl)->Close();
- break;
- case M_Help:
- case M_Move:
- goto MoreDialog;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "FloatingWin" ) );
- break;
- }
- break;
- case C_ModelessDlg:
- case C_ModalDlg:
- case C_Dialog:
- case C_TabDlg:
- MoreDialog:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- case M_Close:
- DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
- SET_WINP_CLOSING(pControl);
- ((SystemWindow*)pControl)->Close();
- break;
- case M_OK:
- {
- Window *pChild = GetWinByRT( pControl, WINDOW_OKBUTTON );
- if( ControlOK( pChild, "OK Button" ) )
- {
- DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
- SET_WINP_CLOSING(pControl);
- ((Button*)pChild)->Click();
- }
- break;
- }
- case M_Cancel:
- {
- Window *pChild = GetWinByRT( pControl, WINDOW_CANCELBUTTON );
- if( ControlOK( pChild, "Cancel Button" ) )
- {
- DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
- SET_WINP_CLOSING(pControl);
- ((Button*)pChild)->Click();
- }
- break;
- }
- case M_Help:
- {
- Window *pChild = GetWinByRT( pControl, WINDOW_HELPBUTTON );
- if( ControlOK( pChild, "Help Button" ) )
- ((Button*)pChild)->Click();
- break;
- }
- case M_Default:
- {
- Window *pChild = ImpGetButton( pControl, WB_DEFBUTTON, WB_DEFBUTTON );
- if( ControlOK( pChild, "Default Button" ) )
- ((Button*)pChild)->Click();
- break;
- }
- case M_Move:
- {
- pControl->SetPosPixel(Point(nNr1,nNr2));
- break;
- }
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "Dialog" ) );
- break;
- }
- break;
- case C_WorkWin:
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, MitteOben);
- break;
- case M_Close:
- DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId");
- SET_WINP_CLOSING(pControl);
- ((WorkWindow*)pControl)->Close();
- break;
- case M_Size:
- case M_Move:
- goto FloatWin;
- case M_IsMax :
- pRet->GenReturn ( RET_Value, aUId, ((WorkWindow*)pControl)->IsMaximized() );
- break;
- case M_IsMin :
- pRet->GenReturn ( RET_Value, aUId, ((WorkWindow*)pControl)->IsMinimized() );
- break;
- case M_IsRestore :
- pRet->GenReturn ( RET_Value, aUId, comm_BOOL (!((WorkWindow*)pControl)->IsMaximized() && !((WorkWindow*)pControl)->IsMinimized()) );
- break;
- case M_Minimize :
- ((WorkWindow*)pControl)->Maximize( sal_False );
- ((WorkWindow*)pControl)->Minimize();
- break;
- case M_Maximize :
- ((WorkWindow*)pControl)->Maximize();
- break;
- case M_Restore :
- ((WorkWindow*)pControl)->Maximize( sal_False );
- ((WorkWindow*)pControl)->Restore();
- break;
- case M_Help:
- goto MoreDialog;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "WorkWindow" ) );
- break;
- }
- break;
- case C_TabPage:
- ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );
- break;
- case C_MessBox:
- case C_InfoBox:
- case C_WarningBox:
- case C_ErrorBox:
- case C_QueryBox:
- {
- sal_Bool bDone = sal_True;
- MessBox* pMB = (MessBox*)pControl;
- switch( nMethodId )
- {
- case M_GetCheckBoxText:
- pRet->GenReturn ( RET_Value, aUId, pMB->GetCheckBoxText() );
- break;
- case M_IsChecked :
- pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pMB->GetCheckBoxState() == STATE_CHECK) );
- break;
- case M_Check :
- pMB->SetCheckBoxState( sal_True );
- break;
- case M_UnCheck :
- pMB->SetCheckBoxState( sal_False );
- break;
- case M_GetText :
- pRet->GenReturn ( RET_Value, aUId, pMB->GetMessText());
- break;
-
- default:
- bDone = sal_False;
- break;
- }
- if ( bDone )
- break; // break the case here else continue at C_ButtonDialog
- }
- case C_ButtonDialog:
- {
- ButtonDialog* pBD = (ButtonDialog*)pControl;
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "Working MessBox: " );
- if (pControl->IsVisible())
- m_pDbgWin->AddText("*(Visible)\n");
- else
- m_pDbgWin->AddText("*(nicht Visible)\n");
-#endif
- switch( nMethodId )
- {
- case M_AnimateMouse :
- AnimateMouse( pControl, Mitte);
- break;
- case M_OK:
- if ( pBD->GetPushButton( BUTTONID_OK ) )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_OK);
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_OK_BUTTON, MethodString( nMethodId ) ) );
- break;
- case M_Cancel:
- if ( pBD->GetPushButton( BUTTONID_CANCEL ) )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_CANCEL);
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_CANCEL_BUTTON, MethodString( nMethodId ) ) );
- break;
- case M_Yes:
- if ( pBD->GetPushButton( BUTTONID_YES ) )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_YES);
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_YES_BUTTON, MethodString( nMethodId ) ) );
- break;
- case M_No:
- if ( pBD->GetPushButton( BUTTONID_NO ) )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_NO);
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_NO_BUTTON, MethodString( nMethodId ) ) );
- break;
- case M_Repeat:
- if ( pBD->GetPushButton( BUTTONID_RETRY ) )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_RETRY);
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_RETRY_BUTTON, MethodString( nMethodId ) ) );
- break;
- case M_Help:
- if ( pBD->GetPushButton( BUTTONID_HELP ) )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(BUTTONID_HELP);
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_HELP_BUTTON, MethodString( nMethodId ) ) );
- break;
- case M_Default:
- {
- WinBits Style = pControl->GetStyle();
- if ( Style & WB_DEF_OK )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_OK);
- }
- else if ( Style & WB_DEF_CANCEL )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_CANCEL);
- }
- else if ( Style & WB_DEF_YES )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_YES);
- }
- else if ( Style & WB_DEF_NO )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_NO);
- }
- else if ( Style & WB_DEF_RETRY )
- {
- SET_WINP_CLOSING(pControl);
- pBD->EndDialog(RET_RETRY);
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_NO_DEFAULT_BUTTON, MethodString( nMethodId ) ) );
- }
- break;
- case M_GetText :
- pRet->GenReturn ( RET_Value, aUId, pControl->GetText());
- break;
- case M_Click:
- if ( nParams & PARAM_UINT16_1 )
- {
- if ( pBD->GetPushButton( nNr1 ) )
- {
- if ( nNr1 != BUTTONID_HELP )
- {
- SET_WINP_CLOSING(pControl);
- }
- pBD->GetPushButton( nNr1 )->Click();
- }
- else
- ReportError( aUId, GEN_RES_STR2( S_NO_DEFAULT_BUTTON, UniString::CreateFromInt32( nNr1 ), MethodString( nMethodId ) ) );
- }
- else
- ReportError( aUId, GEN_RES_STR1( S_BUTTONID_REQUIRED, MethodString( nMethodId ) ) );
- break;
- case M_GetButtonCount :
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pBD->GetButtonCount()));
- break;
- case M_GetButtonId :
- if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pBD->GetButtonCount()) )
- pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pBD->GetButtonId(nNr1-1)));
- break;
- default:
- ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MessageBox" ) );
- break;
- }
- break;
- }
- default:
- OSL_FAIL( "Unknown Objekttype from UId or Method not suported" );
- ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) );
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( " Unknown Objekttype from UId or Method not suported" );
-#endif
- break;
- }
- }
- for( int i = 0; i < 32; i++ )
- SafeReschedule();
- }
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( "\n" );
-#endif
- if ( bStatementDone )
- {
- SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) );
- delete this;
- }
- else
- {
- if ( nRetryCount-- )
- {
-#if OSL_DEBUG_LEVEL > 1
- m_pDbgWin->AddText( CUniString("Reschedule command (requed) (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") );
-#endif
- QueStatement( this ); // will que at the start of the list
- }
- else
- {
- bStatementDone=sal_True;
- }
- }
- return bStatementDone;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/statemnt.hxx b/automation/source/server/statemnt.hxx
deleted file mode 100644
index af79ec97b9f0..000000000000
--- a/automation/source/server/statemnt.hxx
+++ /dev/null
@@ -1,491 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-/***************************************************************************
-**
-** All statements are derived from StatementList.
-** There is never more than one statementlist with a pointer on it.
-** The beginning of the chain can always be requested.
-**
-***************************************************************************/
-#ifndef _STATEMNT_HXX
-#define _STATEMNT_HXX
-
-#include <tools/wintypes.hxx>
-#include <tools/string.hxx>
-#include <tools/debug.hxx>
-#include <tools/time.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/svapp.hxx>
-#include <tools/fsys.hxx>
-#include <sot/storage.hxx>
-#include <basic/sbstar.hxx>
-#include <vcl/event.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <automation/commtypes.hxx>
-
-class Window;
-class SystemWindow;
-class Point;
-class SfxPoolItem;
-
-class ScrollBar;
-
-class SCmdStream;
-class RetStream;
-class ImplRemoteControl;
-
-class TTProfiler;
-class TTProperties;
-
-class Dir;
-
-class CommunicationLink;
-
-#if OSL_DEBUG_LEVEL > 1
-class EditWindow;
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
- void SAL_CALL osl_TestToolDebugPrint( const sal_Char *pString );
-#ifdef __cplusplus
-}
-#endif
-
-
-#define IsVisible IsReallyVisible
-#define GET_REAL_PARENT() GetWindow( WINDOW_REALPARENT )
-
-// switch behaviour of ImplMouse* and ImplKeyInput
-#define FORCE_DIRECT_CALL sal_True
-
-typedef sal_uInt16 SearchFlags;
-#define SEARCH_NOOVERLAP ((SearchFlags) 0x0001)
-#define SEARCH_NO_TOPLEVEL_WIN ((SearchFlags) 0x0002)
-#define SEARCH_FOCUS_FIRST ((SearchFlags) 0x0004)
-#define SEARCH_FIND_DISABLED ((SearchFlags) 0x0008)
-
-class Search
-{
- SearchFlags nmSearchFlags;
-public:
- Search( SearchFlags nSearchFlags = 0): nmSearchFlags(nSearchFlags) {}
- virtual ~Search() {}
-
- virtual sal_Bool IsWinOK( Window *pWin ) = 0;
- SearchFlags GetSearchFlags() { return nmSearchFlags; }
- void AddSearchFlags( SearchFlags aNewFlags ) { nmSearchFlags |= aNewFlags; }
- void RemoveSearchFlags( SearchFlags aRemoveFlags ) { nmSearchFlags &= ( ~aRemoveFlags ); }
- sal_Bool HasSearchFlag( SearchFlags aQueryFlag ) { return (nmSearchFlags & aQueryFlag) == aQueryFlag; }
-};
-
-sal_Bool IsDialog(Window *pWin); // is *pWin derived from SystemWindow? (can it be active?)
-sal_Bool IsAccessable(Window *pWin); // is *pWin accessible (tested with IsEnabled and parents)
-
-
-class SafePointer
-{
- SafePointer *pSelf;
-public:
- SafePointer() { pSelf = this; }
- virtual ~SafePointer() { DBG_ASSERT(pSelf==this,"Destructor von Nicht existierendem Objekt aufgerufen");
- pSelf = NULL; }
-};
-
-
-class DisplayHidWin;
-class StatementCommand;
-class TranslateWin;
-
-struct TTSettings
-{
- // DisplayHID
- StatementCommand *pDisplayInstance;
- DisplayHidWin *pDisplayHidWin;
- Window *Old;
- Window *Act;
- String aOriginalCaption;
-
- // Translate
- TranslateWin *pTranslateWin;
- sal_Bool bToTop;
-};
-
-
-TTSettings* GetTTSettings();
-
-
-#define MAX_RETRIES 9
-class StatementList : public SafePointer
-{
-private:
- StatementList(const StatementList&);
- StatementList & operator=(const StatementList&);
-
-protected:
- StatementList();
- sal_uInt16 nRetryCount;
- void QueStatement(StatementList *pAfterThis);
- sal_Bool bStatementInQue;
- static sal_uInt16 nUseBindings;
-
- static TTProfiler *pProfiler;
- void InitProfile();
- void SendProfile( String aText );
- static StatementList *pCurrentProfileStatement;
-
- static sal_Bool bIsInReschedule;
- static sal_uInt16 nModalCount;
- static Window *pLastFocusWindow; // Safe Reschedule will be cancelled if this changes
- static sal_Bool bWasDragManager; // Safe Reschedule will be cancelled if this changes
- static sal_Bool bWasPopupMenu; // Safe Reschedule will be cancelled if this changes
- static sal_Bool bBasicWasRunning;
-
- static sal_uInt16 nMinTypeKeysDelay;
- static sal_uInt16 nMaxTypeKeysDelay;
- static sal_Bool bDoTypeKeysDelay;
-
- static Window* pFirstDocFrame;
-
- static sal_Bool bIsSlotInExecute;
-
-public:
- static sal_Bool IsInReschedule() { return bIsInReschedule; }
- void SafeReschedule( sal_Bool bYield = sal_False ) // sets flag so that the next command is not executed yet
- {
- nModalCount = Application::GetModalModeCount();
- bIsInReschedule = sal_True;
- pLastFocusWindow = GetpApp()->GetFocusWindow();
- bWasDragManager = false /*!= DragManager::GetDragManager()*/;
- bWasPopupMenu = NULL != PopupMenu::GetActivePopupMenu();
- bBasicWasRunning = StarBASIC::IsRunning();
- bWasExecuting = bExecuting;
- if ( bYield )
- GetpApp()->Yield();
- else
- GetpApp()->Reschedule();
- bExecuting = bWasExecuting;
- bBasicWasRunning = sal_False;
- bWasPopupMenu = sal_False;
- bWasDragManager = sal_False;
- pLastFocusWindow = NULL;
- bIsInReschedule = sal_False;
- nModalCount = 0;
- }
- static sal_Bool MaybeResetSafeReschedule()
- {
- if ( !bIsInReschedule )
- return sal_False;
-
- if ( pLastFocusWindow != GetpApp()->GetFocusWindow()
- || ( Application::GetModalModeCount() > nModalCount )
- || ( PopupMenu::GetActivePopupMenu() && !bWasPopupMenu )
- || ( StarBASIC::IsRunning() && !bBasicWasRunning ) )
- {
- bIsInReschedule = sal_False;
- pLastFocusWindow = NULL;
- return sal_True;
- }
- else
- return sal_False;
- }
- static void NormalReschedule() // does not set the flag
- {
- GetpApp()->Reschedule();
- }
-#define Reschedule RescheduleNichtBenutzen_StattdessenSafeRescheduleAnStatementList
-
- static Window* GetMouseWin();
- static sal_Bool WinPtrValid(Window *pTest);
- static Window* SearchAllWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase = sal_True );
-protected:
- static Window* SearchClientWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase = sal_True );
-
- Window* SearchTree( rtl::OString aUId, sal_Bool bSearchButtonOnToolbox = sal_False );
- Window* GetActive( WindowType nRT, sal_Bool MaybeBase = sal_True );
- Window* GetFocus( WindowType nRT, sal_Bool MaybeBase = sal_True );
- Window* GetAnyActive( sal_Bool MaybeBase = sal_True );
- ScrollBar* GetScrollBar( Window *pBase, sal_uInt16 nDirection, sal_Bool MaybeBase = sal_True );
- Window* GetPopupFloatingWin( sal_Bool MaybeBase = sal_True );
- Menu* GetMatchingMenu( Window* pWin, Menu* pBaseMenu = NULL );
- Window* GetWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase = sal_True, sal_uInt16 nSkip = 0, sal_Bool bSearchAll = sal_False );
- sal_uInt16 CountWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase = sal_True );
- Window* GetDocWin( sal_uInt16 nNr );
- sal_uInt16 GetDocWinCount();
- Window* GetFadeSplitWin( Window *pBase, WindowAlign nAlign, sal_Bool MaybeBase = sal_True );
- sal_Bool ValueOK(rtl::OString nId, String aBezeichnung, sal_uLong nValue, sal_uLong nMax);
-
- sal_uInt16 GetCurrentMenues( PopupMenu *&pPopup, MenuBar *&pMenuBar, Menu *&pMenu );
-
-public:
- virtual ~StatementList();
- void Advance();
- virtual sal_Bool Execute() = 0;
-/***************************************************************************
-** Gets the next command first, sets current and executes then.
-** Return value tells whether the command shall be executed again.
-** Then the UserEvent must be left to allow the application for
-** normal work (close dialog).
-** sal_True means that everything's OK
-** sal_False means again please
-***************************************************************************/
-
- void ReportError(String aMessage);
- void ReportError(rtl::OString aUId, String aMessage);
- void ReportError(String aMessage, sal_uLong nWhatever);
-
- static void DirectLog( sal_uLong nType, String aString );
-
- String Tree(Window *pBase, int Indent);
- String ClientTree(Window *pBase, int Indent);
-
- StatementList *pNext;
- static StatementList /**pCurrent,*/ *pFirst;
- static sal_Bool bReadingCommands;
- static rtl::OString aWindowWaitUId;
- static Window *pWindowWaitPointer;
- static rtl::OString aWindowWaitOldHelpId;
- static rtl::OString aWindowWaitOldUniqueId;
- static RetStream *pRet;
- static sal_Bool IsError;
- static sal_Bool bDying;
- static sal_Bool bExecuting; // is set when a command reschedules without allowing a new command
- sal_Bool bWasExecuting; // if it has been resetted during a MaybeResetSafeReschedule, the same condition is restored after
- static sal_uInt16 aSubMenuId1; // submenus in PopUpMenus
- static sal_uInt16 aSubMenuId2; // 2 levels at first
- static sal_uInt16 aSubMenuId3; // and now even 3 levels #i31512#
- static SystemWindow *pMenuWindow; // when using MenuBar as base for MenuCommands
- static TTProperties *pTTProperties; // here are the SlotIDs from the SFX
-
- sal_Bool CheckWindowWait(); // true means that the window still exists,
- // false that it does not
- static void SetFirstDocFrame( Window* pWin );
- static Window* GetFirstDocFrame();
- static sal_Bool IsFirstDocFrame( Window* pWin );
- static sal_Bool IsDocWin( Window* pWin );
- static sal_Bool IsIMEWin( Window* pWin ); // Input Window for CJK under Solaris
- static sal_Bool IsDocFrame( Window* pWin );
- static MenuBar* GetDocFrameMenuBar( Window* pWin );
- static sal_uInt16 GetDocFrameCount();
-
- static sal_Bool bCatchGPF;
-
- static sal_Bool bUsePostEvents; // use Application::Post*Event or own impl to handle key and mouseevents
-
-#if OSL_DEBUG_LEVEL > 1
- static EditWindow *m_pDbgWin;
-#endif
-};
-
-class StatementSlot : public StatementList // call slots
-{
-protected:
- sal_uInt16 nAnzahl;
- SfxPoolItem **pItemArr;
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aArgs;
- sal_uInt16 nFunctionId; // can get removed when the old (numeric) slothandling is removed
- String aUnoUrl;
- sal_Bool bMenuClosed;
-
- StatementSlot();
- void AddReferer();
-public:
- StatementSlot( SCmdStream *pIn );
- StatementSlot( sal_uLong nSlot, SfxPoolItem* pItem = NULL );
- virtual ~StatementSlot();
- virtual sal_Bool Execute();
-};
-
-class StatementUnoSlot : public StatementSlot // call uno slots
-{
-public:
- StatementUnoSlot(SCmdStream *pIn);
-};
-
-union munge
-{
- comm_UINT32 nLNr1;
- Window *pWindow;
-};
-
-class StatementCommand : public StatementList // execute command (wintree, resetaplication ...)
-{
- friend class ImplRemoteControl;
-protected:
- sal_uInt16 nMethodId;
- sal_uInt16 nParams;
- comm_UINT16 nNr1,nNr2,nNr3,nNr4;
- munge nLNr1_and_Pointer;
- String aString1,aString2;
- sal_Bool bBool1,bBool2;
-
- Window* GetNextOverlap( Window* pBase );
- Window* GetNextRecoverWin();
-
- static sal_uInt16 nDirPos;
- static Dir *pDir;
- static pfunc_osl_printDebugMessage pOriginal_osl_DebugMessageFunc;
-
-
- sal_Bool UnpackStorage( SotStorageRef xStorage, DirEntry &aBaseDir );
-
- void HandleSAXParser();
-
-public:
- StatementCommand( SCmdStream *pIn );
- StatementCommand( StatementList *pAfterThis, sal_uInt16 MethodId, sal_uInt16 Params, sal_uInt16 Nr1 );
- virtual sal_Bool Execute();
- sal_Bool DisplayHID();
- void Translate();
- void WriteControlData( Window *pBase, sal_uLong nConf, sal_Bool bFirst = sal_True );
-
-};
-
-
-enum TTHotSpots { MitteLinks, Mitte, MitteOben };
-
-class StatementControl : public StatementList
-{
-protected:
- rtl::OString aUId;
- sal_uInt16 nMethodId;
- sal_uInt16 nParams;
- comm_UINT16 nNr1,nNr2,nNr3,nNr4;
- comm_UINT32 nLNr1;
- String aString1,aString2;
- sal_Bool bBool1,bBool2;
- sal_Bool ControlOK( Window *pControl, const sal_Char* aBezeichnung );
- void AnimateMouse( Window *pControl, TTHotSpots aWohin );
- void AnimateMouse( Window *pControl, Point aWohin );
-
- sal_Bool MaybeDoTypeKeysDelay( Window *pTestWindow );
-
- sal_Bool HandleVisibleControls( Window *pControl );
- sal_Bool HandleCommonMethods( Window *pControl );
-
-public:
- StatementControl( SCmdStream *pIn, sal_uInt16 nControlType );
- virtual sal_Bool Execute();
-
-};
-
-class StatementFlow : public StatementList // communication with sequence
-{
- sal_uInt16 nArt;
-
- sal_uInt16 nParams;
- comm_UINT16 nSNr1;
- comm_UINT32 nLNr1;
- String aString1;
- sal_Bool bBool1;
-
-
-public:
- StatementFlow (sal_uLong nServiceId, SCmdStream *pIn, ImplRemoteControl *pRC );
- StatementFlow( StatementList *pAfterThis, sal_uInt16 nArtP );
- virtual sal_Bool Execute();
- static CommunicationLink *pCommLink;
- static sal_Bool bSending;
-
- static sal_Bool bUseIPC;
- static ImplRemoteControl *pRemoteControl; // static for second constructor
-
-private:
- void SendViaSocket();
-};
-
-class SearchUID : public Search
-{
- Window *pMaybeResult;
- Window *pAlternateResult;
- rtl::OString aUId;
- sal_Bool bSearchButtonOnToolbox;
-public:
- SearchUID( rtl::OString aUIdP, sal_Bool bSearchButtonOnToolboxP ): Search( SEARCH_FOCUS_FIRST ), pMaybeResult(NULL), pAlternateResult(NULL), aUId(aUIdP), bSearchButtonOnToolbox(bSearchButtonOnToolboxP) {}
- virtual sal_Bool IsWinOK( Window *pWin );
- Window* GetMaybeWin() { return pMaybeResult; }
- Window* GetAlternateResultWin() { return pAlternateResult; }
-};
-class SearchActive : public Search
-{
- WindowType nRT;
-public:
- SearchActive( WindowType nRTP ): nRT(nRTP) {}
- virtual sal_Bool IsWinOK( Window *pWin );
-};
-class SearchPopupFloatingWin : public Search
-{
-public:
- SearchPopupFloatingWin(): Search( SEARCH_FOCUS_FIRST ) {}
- virtual sal_Bool IsWinOK( Window *pWin );
-};
-class SearchRT : public Search
-{
- WindowType mnRT;
- sal_uInt16 mnSkip;
- sal_uInt16 mnCount;
-public:
- SearchRT( WindowType nRTP, SearchFlags nSearchFlags, sal_uInt16 nSkip = 0 ): Search(nSearchFlags), mnRT(nRTP), mnSkip( nSkip ), mnCount( 0 ) {}
- virtual sal_Bool IsWinOK( Window *pWin );
- sal_uInt16 GetCount(){ return mnCount; }
-};
-class SearchScroll : public SearchRT
-{
- sal_uInt16 nDirection;
-public:
- SearchScroll( sal_uInt16 nDir, SearchFlags nSearchFlags ): SearchRT(WINDOW_SCROLLBAR, nSearchFlags), nDirection(nDir) {}
- virtual sal_Bool IsWinOK( Window *pWin );
-};
-class SearchWinPtr : public Search
-{
- Window *pTest;
-public:
- SearchWinPtr( Window *pTestP ): pTest(pTestP) {}
- virtual sal_Bool IsWinOK( Window *pWin );
-};
-class SearchFadeSplitWin : public Search
-{
- WindowAlign nAlign;
-public:
- SearchFadeSplitWin( WindowAlign nAlignP ): nAlign(nAlignP) {}
- virtual sal_Bool IsWinOK( Window *pWin );
-};
-
-
-void ImplKeyInput( Window* pWin, KeyEvent &aKEvnt, sal_Bool bForceDirect=sal_False );
-void ImplMouseMove( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect=sal_False );
-void ImplMouseButtonDown( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect=sal_False );
-void ImplMouseButtonUp( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect=sal_False );
-void ImplCommand( Window* pWin, CommandEvent &aCmdEvnt );
-void ImplEventWait( sal_uLong nID );
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/svcommstream.cxx b/automation/source/server/svcommstream.cxx
deleted file mode 100644
index bf53122342c6..000000000000
--- a/automation/source/server/svcommstream.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "svcommstream.hxx"
-
-SvCommStream::SvCommStream( SvStream* pIO ) { pStream = pIO; }
-SvCommStream::~SvCommStream() {}
-
-ICommStream& SvCommStream::operator>>( comm_UINT16& rUShort ) { *pStream >> rUShort; return *this; }
-ICommStream& SvCommStream::operator>>( comm_UINT32& rULong ) { *pStream >> rULong; return *this; }
-ICommStream& SvCommStream::operator>>( comm_BOOL& rChar ) { *pStream >> rChar; return *this; }
-
-ICommStream& SvCommStream::operator<<( comm_UINT16 nUShort ) { *pStream << nUShort; return *this; }
-ICommStream& SvCommStream::operator<<( comm_UINT32 nULong ) { *pStream << nULong; return *this; }
-ICommStream& SvCommStream::operator<<( comm_BOOL nChar ) { *pStream << nChar; return *this; }
-
-comm_UINT32 SvCommStream::Read( void* pData, comm_UINT32 nSize ) { return pStream->Read( pData, nSize ); }
-comm_UINT32 SvCommStream::Write( const void* pData, comm_UINT32 nSize ) { return pStream->Write( pData, nSize ); }
-
-comm_BOOL SvCommStream::IsEof() const { return pStream->IsEof(); }
-comm_UINT32 SvCommStream::SeekRel( long nPos ) { return pStream->SeekRel( nPos ); }
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/server/testtool.hrc b/automation/source/server/testtool.hrc
deleted file mode 100644
index d6a234b74236..000000000000
--- a/automation/source/server/testtool.hrc
+++ /dev/null
@@ -1,55 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#define TTSTART 12345
-
-#define DisplayHidToolBox ( TTSTART + 0 )
-#define TT_SHOW 1
-#define TT_SHOW2 ( TTSTART + 1 )
-#define TT_OUTPUT 3
-#define TT_SEND_DATA 4
-#define TT_ALLWIN 5
-#define TT_KURZNAME 6
-#define TT_LANGNAME 7
-#define TT_ALTERNATE_CAPTION ( TTSTART + 2 )
-
-#define TT_INLINE_TRANSLATION ( TTSTART + 3)
-#define TT_GB_TRANSLATION 1
-#define TT_E_NEW 2
-#define TT_FT_OLD 3
-#define TT_GB_COMMENT 4
-#define TT_E_COMMENT 5
-
-#define TT_PB_SELECT 6
-#define TT_PB_RESTORE 7
-#define TT_PB_ACCEPT 8
-#define TT_PB_NEXT 9
-
-#define TT_DISCARD_CHANGED_DATA ( TTSTART + 4 )
-#define TT_NO_CONTROL ( TTSTART + 5 )
-
-
-#define TT_GPF ( TTSTART + 6 )
diff --git a/automation/source/simplecm/communiio.hxx b/automation/source/simplecm/communiio.hxx
deleted file mode 100644
index 97b5aa414231..000000000000
--- a/automation/source/simplecm/communiio.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/*************************************************************************
- *
- * ATTENTION
- * This file is intended to work inside and outside the StarOffice environment.
- * Only adaption of file commtypes.hxx should be necessary. Else it is a bug!
- *
- ************************************************************************/
-
-#include <automation/commtypes.hxx>
-
-#define C_ERROR_NONE 0x0001
-#define C_ERROR_PERMANENT 0x0002
-#define C_ERROR_RETRY 0x0003
-#define C_ERROR_TIMEOUT 0x0004
-
-class ITransmiter
-{
-protected:
- comm_UINT32 nLastSent;
-public:
- ITransmiter() :nLastSent( 0 ){}
- virtual ~ITransmiter() {}
- virtual comm_UINT16 TransferBytes( const void* pBuffer, comm_UINT32 nLen ) = 0;
-
- comm_UINT32 GetLastSent() const { return nLastSent; }
-};
-
-class IReceiver
-{
-protected:
- comm_UINT32 nLastReceived;
-public:
- IReceiver() :nLastReceived( 0 ){}
- virtual ~IReceiver() {;}
- virtual comm_UINT16 ReceiveBytes( void* pBuffer, comm_UINT32 nLen ) = 0;
-
- comm_UINT32 GetLastReceived() const { return nLastReceived; }
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/simplecm/packethandler.cxx b/automation/source/simplecm/packethandler.cxx
deleted file mode 100644
index c4233b2d8a60..000000000000
--- a/automation/source/simplecm/packethandler.cxx
+++ /dev/null
@@ -1,333 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-/*************************************************************************
- *
- * ATTENTION
- * This file is intended to work inside and outside the StarOffice environment.
- * Only adaption of file commtypes.hxx should be necessary. Else it is a bug!
- *
- ************************************************************************/
-
-#include "packethandler.hxx"
-#include <automation/commtypes.hxx>
-#include <automation/commdefines.hxx>
-#include "communiio.hxx"
-#include <osl/diagnose.h>
-
-/**
-Forces switch to multichannel headers even for old communication Method
-**/
-#define FORCE_MULTI_CHANNEL_HEADERS
-
-
-PacketHandler::PacketHandler( ITransmiter* pTransmitter_, IReceiver* pReceiver_, comm_BOOL bMC )
-: pTransmitter( pTransmitter_ )
-, pReceiver( pReceiver_ )
-, bMultiChannel( bMC )
-{
-}
-
-unsigned char PacketHandler::CalcCheckByte( comm_UINT32 nBytes )
-{
- comm_UINT16 nRes = 0;
- nRes += HIBYTE( HIWORD( nBytes ) ) ^ 0xf0;
- nRes += LOBYTE( HIWORD( nBytes ) ) ^ 0x0f;
- nRes += HIBYTE( LOWORD( nBytes ) ) ^ 0xf0;
- nRes += LOBYTE( LOWORD( nBytes ) ) ^ 0x0f;
-
- nRes ^= HIBYTE( nRes );
-
- return LOBYTE( nRes );
-}
-
-
-#define READ_SOCKET( pBuffer, nLength )\
- if ( !bWasError )\
- {\
- bWasError |= pReceiver->ReceiveBytes( pBuffer, nLength ) != C_ERROR_NONE;\
- }
-
-#define READ_SOCKET_LEN( pBuffer, nLength, nTotal )\
- READ_SOCKET( pBuffer, nLength );\
- if ( !bWasError )\
- {nTotal += nLength;}
-
-comm_BOOL PacketHandler::ReceiveData( void* &pData, comm_UINT32 &nLen )
-{
- DBG_ASSERT( !pData, "pData should be NULL -> memory leak" );
-
- nLen = 0;
- pData = NULL;
- comm_BOOL bWasError = sal_False;
- comm_BOOL bForceMultiChannelThisPacket = sal_False;
- if ( pReceiver )
- {
- comm_UINT32 nBytes = 0;
- nReceiveProtocol = CM_PROTOCOL_OLDSTYLE;
- nReceiveHeaderType = CH_NoHeader;
-
- READ_SOCKET( &nBytes, sizeof(nBytes) )
- if ( bWasError )
- return sal_False;
-
- if ( 0xFFFFFFFF == nBytes ) // explicit request for this data package to switch to MultiChannel
- {
- READ_SOCKET( &nBytes, sizeof(nBytes) )
- if ( bWasError )
- return sal_False;
- bForceMultiChannelThisPacket = sal_True;
- }
-
- nBytes = NETDWORD( nBytes );
-
- if ( bMultiChannel || bForceMultiChannelThisPacket )
- {
- comm_UINT32 nReadSoFar = 0;
- comm_UINT32 nHeaderReadSoFar = 0;
-
- unsigned char nLenCheck = 0;
- READ_SOCKET_LEN( &nLenCheck, 1, nReadSoFar );
- bWasError |= nLenCheck != CalcCheckByte( nBytes );
-
-
- comm_UINT16 nHeaderBytes;
- READ_SOCKET_LEN( &nHeaderBytes, 2, nReadSoFar );
- nHeaderBytes = NETWORD( nHeaderBytes );
- bWasError |= !(nBytes >= nReadSoFar + nHeaderBytes);
-
- READ_SOCKET_LEN( &nReceiveHeaderType, 2, nHeaderReadSoFar );
- nReceiveHeaderType = NETWORD( nReceiveHeaderType );
-
- switch ( nReceiveHeaderType )
- {
- case CH_SimpleMultiChannel:
- {
- READ_SOCKET_LEN( &nReceiveProtocol, 2, nHeaderReadSoFar );
- nReceiveProtocol = NETWORD( nReceiveProtocol );
- }
- break;
- case CH_Handshake:
- {
- }
- break;
- default:
- {
- OSL_FAIL("Unbekannter Headertyp in der Kommunikation");
- bWasError = sal_True;
- }
-
- }
-
- if ( bWasError )
- return sal_False;
-
-
- while ( nHeaderBytes > nHeaderReadSoFar )
- {
- unsigned char nDummy;
- READ_SOCKET_LEN( &nDummy, 1, nHeaderReadSoFar );
- }
-
- nReadSoFar += nHeaderReadSoFar;
- nBytes -= nReadSoFar;
-
- }
-
- /* @@@ Notes @@@
- *
- * 1) a 'void*' allocated via 'new char[]' is always deallocated
- * via plain 'delete()', not via array 'delete[]()'; it's just
- * raw memory.
- *
- * 2) as the caller of this routine later-on changes ownership
- * of 'pData' via 'SvMemoryStream::SetBuffer()' (in 'simplecm.cxx',
- * 'SimpleCommunicationLinkViaSocket::DoReceiveDataStream()'),
- * the allocator used here for 'void* pData' must match the
- * deallocator used in 'SvMemoryStream::FreeMemory()', i.e.
- * '::operator delete()'.
- */
- pData = ::operator new(nBytes);
- READ_SOCKET( pData, nBytes )
- if ( bWasError )
- {
- ::operator delete(pData), pData = 0;
- return sal_False;
- }
- nLen = nBytes;
- }
- else
- bWasError = sal_True;
-
- return !bWasError;
-}
-
-/*#define WRITE_SOCKET( pBuffer, nLength )\
- if ( !bWasError )\
- bWasError |= !pStreamSocket || (pStreamSocket->write( pBuffer, nLength ) != nLength)*/
-
-#define WRITE_SOCKET( pBuffer, nLength )\
- if ( !bWasError )\
- {bWasError |= pTransmitter->TransferBytes( pBuffer, nLength ) != C_ERROR_NONE;}
-
-
-
-comm_BOOL PacketHandler::TransferData( const void* pData, comm_UINT32 nLen, CMProtocol nProtocol )
-{
- comm_UINT32 nBuffer = nLen;
- comm_BOOL bWasError = sal_False;
-
-#ifndef FORCE_MULTI_CHANNEL_HEADERS
- if ( bMultiChannel )
-#endif
- nBuffer += 1+2+2+2; // for a CH_SimpleMultiChannel
-
-#ifdef FORCE_MULTI_CHANNEL_HEADERS
- if ( !bMultiChannel )
- {
- comm_UINT32 n32;
- n32 = 0xffffffff; // switch to MultiChannel
- n32 = NETDWORD( n32 );
- WRITE_SOCKET( &n32, 4 );
- }
-#endif
-
-
- comm_UINT32 nNetworkBuffer = NETDWORD( nBuffer );
- WRITE_SOCKET( &nNetworkBuffer, sizeof(nNetworkBuffer) );
-
-
-#ifndef FORCE_MULTI_CHANNEL_HEADERS
- if ( bMultiChannel )
-#endif
- {
- comm_UINT16 n16;
- unsigned char c;
-
- c = CalcCheckByte( nBuffer );
- WRITE_SOCKET( &c, 1 );
-
- n16 = 4; // header length for a CH_SimpleMultiChannel
- n16 = NETWORD( n16 );
- WRITE_SOCKET( &n16, 2 );
-
- n16 = CH_SimpleMultiChannel; // header type
- n16 = NETWORD( n16 );
- WRITE_SOCKET( &n16, 2 );
-
- nProtocol = NETWORD( nProtocol );
- WRITE_SOCKET( &nProtocol, 2 );
- }
-
- WRITE_SOCKET( pData, nLen );
- return !bWasError;
-}
-
-comm_BOOL PacketHandler::SendHandshake( HandshakeType aHandshakeType, const void* pData, comm_UINT32 nLen )
-{
- comm_BOOL bWasError = sal_False;
-
- comm_UINT32 nBuffer = 0;
-
-// if ( pMyManager->IsMultiChannel() ) we always send FFFFFFFF before -> always MultiChannel (or GPF for older ones)
- nBuffer += 1+2+2; // for a CH_Handshake
-
- nBuffer += 2; // for the Handshake's type
-
- switch ( aHandshakeType )
- {
- case CH_REQUEST_HandshakeAlive:
- nBuffer += 0; // no extra data
- break;
- case CH_RESPONSE_HandshakeAlive:
- nBuffer += 0; // no extra data
- break;
- case CH_REQUEST_ShutdownLink:
- nBuffer += 0; // no extra data
- break;
- case CH_ShutdownLink:
- nBuffer += 0; // no extra data
- break;
- case CH_SUPPORT_OPTIONS:
- nBuffer += 2 ; // one word extradata for options
- break;
- case CH_SetApplication:
- nBuffer += 0 ; // one word extradata for options
- break;
- default:
- OSL_FAIL("Unknown HandshakeType");
- }
-
- if ( pData )
- nBuffer += nLen; // Extra data in Buffer
-
- comm_UINT32 n32;
- n32 = 0xffffffff; // switch to MultiChannel
- n32 = NETDWORD( n32 );
- WRITE_SOCKET( &n32, 4 );
-
- comm_UINT32 nNetworkBuffer = NETDWORD( nBuffer );
- WRITE_SOCKET( &nNetworkBuffer, sizeof(nNetworkBuffer) );
-
-
- comm_UINT16 n16;
- unsigned char c;
-
- c = CalcCheckByte( nBuffer );
- WRITE_SOCKET( &c, 1 );
-
- n16 = 2; // header's length for a CH_Handshake
- n16 = NETWORD( n16 );
- WRITE_SOCKET( &n16, 2 );
-
- n16 = CH_Handshake; // the header's type
- n16 = NETWORD( n16 );
- WRITE_SOCKET( &n16, 2 );
-
- n16 = aHandshakeType; // the header's type
- n16 = NETWORD( n16 );
- WRITE_SOCKET( &n16, 2 );
-
-
- switch ( aHandshakeType )
- {
- case CH_SUPPORT_OPTIONS:
- n16 = OPT_USE_SHUTDOWN_PROTOCOL;
- n16 = NETWORD( n16 );
- WRITE_SOCKET( &n16, 2 );
- break;
- }
-
- if ( pData )
- WRITE_SOCKET( pData, nLen );
-
- return !bWasError;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/simplecm/packethandler.hxx b/automation/source/simplecm/packethandler.hxx
deleted file mode 100644
index 8ea04d96f043..000000000000
--- a/automation/source/simplecm/packethandler.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/*************************************************************************
- *
- * ATTENTION
- * This file is intended to work inside and outside the StarOffice environment.
- * Only adaption of file commtypes.hxx should be necessary. Else it is a bug!
- *
- ************************************************************************/
-
-#ifndef _TOOLS_PACKETHANDLER_HXX_
-#define _TOOLS_PACKETHANDLER_HXX_
-
-#include <automation/commtypes.hxx>
-#include <automation/commdefines.hxx>
-
-class ITransmiter;
-class IReceiver;
-
-class PacketHandler
-{
-private:
- unsigned char CalcCheckByte( comm_UINT32 nBytes );
- ITransmiter* pTransmitter;
- IReceiver* pReceiver;
-
- comm_BOOL bMultiChannel;
-
-protected:
- comm_UINT16 nReceiveProtocol;
- comm_UINT16 nReceiveHeaderType;
-
-public:
- PacketHandler( ITransmiter* pTransmitter_, IReceiver* pReceiver_, comm_BOOL bMC = sal_False );
-
- comm_UINT16 GetReceiveProtocol() const { return nReceiveProtocol; }
- comm_UINT16 GetReceiveHeaderType() const { return nReceiveHeaderType; }
-
- comm_BOOL ReceiveData( void* &pData, comm_UINT32 &nLen ); /// Recieve DataPacket from Socket
- virtual comm_BOOL SendHandshake( HandshakeType aHandshakeType, const void* pData = NULL, comm_UINT32 nLen = 0 );
- virtual comm_BOOL TransferData( const void* pData, comm_UINT32 nLen, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/simplecm/simplecm.cxx b/automation/source/simplecm/simplecm.cxx
deleted file mode 100644
index b0d9ee20559a..000000000000
--- a/automation/source/simplecm/simplecm.cxx
+++ /dev/null
@@ -1,539 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include <tools/solar.h>
-#include <automation/simplecm.hxx>
-#include <osl/diagnose.h>
-
-#include <automation/commdefines.hxx>
-#include "packethandler.hxx"
-#include "tcpio.hxx"
-
-#if OSL_DEBUG_LEVEL > 1
-#include <stdio.h>
-void debug_printf( const char *chars )
-{
- static bool bPrint = (getenv("DEBUG") != NULL);
- if ( bPrint )
- {
- printf( "%s\n", chars );
- fflush( stdout );
- }
-}
-#endif
-
-CommunicationLink::CommunicationLink( CommunicationManager *pMan )
-: pMyManager(pMan)
-, pServiceData(NULL)
-, nServiceProtocol( 0 )
-, bIsInsideCallback( sal_False )
-, aStart( DateTime::EMPTY )
-, nTotalBytes( 0 )
-, aLastAccess( DateTime::EMPTY )
-, maApplication("Undefined")
-#if OSL_DEBUG_LEVEL > 1
-, bFlag( sal_False )
-, nSomething( 0 )
-#endif
-{
-}
-
-CommunicationLink::~CommunicationLink()
-{
-#if OSL_DEBUG_LEVEL > 1
- if ( !bFlag ) // bFlag will be set if deletion is expected else we can set a breakpoint
- bFlag = sal_False;
-#endif
- if ( pMyManager )
- pMyManager->DestroyingLink( this );
-}
-
-void CommunicationLink::CallInfoMsg( InfoString aMsg )
-{
- if ( pMyManager )
- pMyManager->InfoMsg( aMsg );
-};
-
-CM_InfoType CommunicationLink::GetInfoType()
-{
- if ( pMyManager )
- return pMyManager->GetInfoType();
- else
- return CM_NO_TEXT;
-}
-
-IMPL_LINK( CommunicationLink, ConnectionClosed, void*, EMPTYARG )
-{
- if ( pMyManager )
- pMyManager->CallConnectionClosed( this );
- return 1;
-}
-
-IMPL_LINK( CommunicationLink, DataReceived, void*, EMPTYARG )
-{
- if ( pMyManager )
- pMyManager->CallDataReceived( this );
- return 1;
-}
-
-sal_Bool CommunicationLink::DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol )
-{
- INFO_MSG( CByteString("S :").Append( GetCommunicationPartner( CM_FQDN ) ),
- CByteString("Daten Senden:").Append( GetCommunicationPartner( CM_FQDN ) ),
- CM_SEND, this );
- sal_Bool bWasError = sal_False;
-
- sal_uInt32 nBuffer;
- nBuffer = pDataStream->SeekRel(0) +1;
- bWasError = pPacketHandler->TransferData( ((SvMemoryStream*)pDataStream)->GetData(), nBuffer, nProtocol ) != C_ERROR_NONE;
-
- if ( bWasError )
- {
- INFO_MSG( CByteString("Send Failed:").Append( GetCommunicationPartner( CM_FQDN ) ),
- CByteString( "Socket wird wegen Fehlers beim Senden geschlossen: ").Append( GetCommunicationPartner( CM_FQDN ) ),
- CM_ERROR, this );
- ShutdownCommunication();
- }
- return !bWasError;
-}
-
-sal_Bool CommunicationLink::TransferDataStream( SvStream *pDataStream, CMProtocol nProtocol )
-{
- aLastAccess = DateTime( DateTime::SYSTEM );
- nTotalBytes += pDataStream->Seek( STREAM_SEEK_TO_END );
- return DoTransferDataStream( pDataStream, nProtocol );
-}
-
-void CommunicationLink::SetApplication( const ByteString& aApp )
-{
- maApplication = aApp;
-}
-
-
-SimpleCommunicationLinkViaSocket::SimpleCommunicationLinkViaSocket( CommunicationManager *pMan, osl::StreamSocket* pSocket )
-: CommunicationLink( pMan )
-, aCommunicationPartner()
-, aMyName()
-, pStreamSocket( pSocket )
-, pReceiveStream( NULL )
-, bIsRequestShutdownPending( sal_False )
-{
- pTCPIO = new TCPIO( pStreamSocket );
- pPacketHandler = new PacketHandler( (ITransmiter*) pTCPIO, pTCPIO, pMyManager->IsMultiChannel() );
-}
-
-SimpleCommunicationLinkViaSocket::~SimpleCommunicationLinkViaSocket()
-{
- delete pPacketHandler;
- pPacketHandler = NULL;
- delete pTCPIO;
- pTCPIO = NULL;
- delete pStreamSocket;
- pStreamSocket = NULL;
-}
-
-void SimpleCommunicationLinkViaSocket::SetStreamSocket( osl::StreamSocket* pSocket )
-{
- if ( pTCPIO )
- pTCPIO->SetStreamSocket( pSocket );
- pStreamSocket = pSocket;
-}
-
-sal_Bool SimpleCommunicationLinkViaSocket::StopCommunication()
-{
- CommunicationLinkRef rHold(this); // avoid deleting this link before the end of the method
- if ( !IsCommunicationError() ) // Meaning that the Communication is still runnung
- {
-#if OSL_DEBUG_LEVEL > 1
- debug_printf("Sending REQUEST_ShutdownLink\n");
-#endif
- SendHandshake( CH_REQUEST_ShutdownLink );
- }
- WaitForShutdown();
- return sal_True;
-}
-
-sal_Bool SimpleCommunicationLinkViaSocket::IsCommunicationError()
-{
- return !pStreamSocket;
-}
-
-ByteString SimpleCommunicationLinkViaSocket::GetCommunicationPartner( CM_NameType eType )
-{
- if ( pStreamSocket )
- {
- switch ( eType )
- {
- case CM_DOTTED:
- {
- rtl::OUString aDotted;
- osl::SocketAddr* pPeerAdr = new osl::SocketAddr;
- pStreamSocket->getPeerAddr( *pPeerAdr );
- osl_getDottedInetAddrOfSocketAddr( pPeerAdr->getHandle(), &aDotted.pData);
- delete pPeerAdr;
- return rtl::OUStringToOString(aDotted, RTL_TEXTENCODING_UTF8);
- }
- //break;
- case CM_FQDN:
- {
- if ( !aCommunicationPartner.Len() )
- {
- rtl::OUString aFQDN( pStreamSocket->getPeerHost());
- aCommunicationPartner = rtl::OUStringToOString(aFQDN, RTL_TEXTENCODING_UTF8);
- }
- return aCommunicationPartner;
- }
- //break;
- }
- }
- return CByteString( "Unknown" );
-}
-
-ByteString SimpleCommunicationLinkViaSocket::GetMyName( CM_NameType eType )
-{
- if ( pStreamSocket )
- {
- switch ( eType )
- {
- case CM_DOTTED:
- {
- rtl::OUString aDotted;
- osl::SocketAddr* pPeerAdr = new osl::SocketAddr;
- pStreamSocket->getPeerAddr( *pPeerAdr );
- osl_getDottedInetAddrOfSocketAddr( pPeerAdr->getHandle(), &aDotted.pData);
- delete pPeerAdr;
- return rtl::OUStringToOString(aDotted, RTL_TEXTENCODING_UTF8);
- }
- //break;
- case CM_FQDN:
- {
- if ( !aMyName.Len() )
- {
- rtl::OUString aFQDN(pStreamSocket->getLocalHost());
- aMyName = rtl::OUStringToOString(aFQDN, RTL_TEXTENCODING_UTF8);
- }
- return aMyName;
- }
- //break;
- }
- }
- return CByteString( "Error" );
-}
-
-SvStream* SimpleCommunicationLinkViaSocket::GetBestCommunicationStream()
-{
- SvStream* pStream = new SvMemoryStream;
-// pStream->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
- return pStream;
-}
-
-#define READ_SOCKET( pBuffer, nLength )\
- if ( !bWasError )\
- {bWasError |= pTCPIO->ReceiveBytes( pBuffer, nLength ) != C_ERROR_NONE;}
-
-#define READ_SOCKET_LEN( pBuffer, nLength, nTotal )\
- READ_SOCKET( pBuffer, nLength );\
- if ( !bWasError )\
- {nTotal += nLength;}
-
-sal_Bool SimpleCommunicationLinkViaSocket::DoReceiveDataStream()
-{
- sal_Bool bWasError = sal_False;
- void* pBuffer = NULL;
- comm_UINT32 nLen;
- bWasError = pPacketHandler->ReceiveData( pBuffer, nLen ) != C_ERROR_NONE;
- if ( !bWasError )
- {
- pReceiveStream = GetBestCommunicationStream();
- DBG_ASSERT( pReceiveStream->IsA() == ID_MEMORYSTREAM, "CommunicationStream is not an SvMemoryStream. Communication has to be reimplemented here!");
- if ( pReceiveStream->IsA() == ID_MEMORYSTREAM )
- ((SvMemoryStream*)pReceiveStream)->SetBuffer( pBuffer, nLen, sal_True, nLen );
- DBG_ASSERT( pReceiveStream, "Datastream is NULL");
- }
-
- return !bWasError;
-}
-
-void SimpleCommunicationLinkViaSocket::SetApplication( const ByteString& aApp )
-{
- CommunicationLink::SetApplication( aApp );
- SvStream* pData = GetBestCommunicationStream();
- pData->WriteByteString(aApp);
- SendHandshake( CH_SetApplication, pData );
- delete pData;
-}
-
-void SimpleCommunicationLinkViaSocket::SetNewPacketAsCurrent()
-{
- pServiceData = pReceiveStream;
- nServiceProtocol = pPacketHandler->GetReceiveProtocol();
- nServiceHeaderType = pPacketHandler->GetReceiveHeaderType();
-}
-
-sal_Bool SimpleCommunicationLinkViaSocket::SendHandshake( HandshakeType aHandshakeType, SvStream* pData )
-{
- sal_Bool bWasError;
-
- if ( pData )
- {
- sal_uInt32 nBuffer;
- nBuffer = pData->Seek( STREAM_SEEK_TO_END );
- bWasError = !pPacketHandler->SendHandshake( aHandshakeType, ((SvMemoryStream*)pData)->GetData(), nBuffer );
- }
- else
- bWasError = !pPacketHandler->SendHandshake( aHandshakeType );
-
-
- if ( bWasError )
- {
- INFO_MSG( CByteString("Send Failed:").Append( GetCommunicationPartner( CM_FQDN ) ),
- CByteString( "Socket wird wegen Fehlers beim Senden geschlossen: ").Append( GetCommunicationPartner( CM_FQDN ) ),
- CM_ERROR, this );
- ShutdownCommunication();
- }
- else
- { // set new status
- switch ( aHandshakeType )
- {
- case CH_REQUEST_HandshakeAlive:
- break;
- case CH_RESPONSE_HandshakeAlive:
- break;
- case CH_REQUEST_ShutdownLink:
- bIsRequestShutdownPending = sal_True;
- break;
- case CH_ShutdownLink:
- break;
- case CH_SUPPORT_OPTIONS:
- break;
- case CH_SetApplication:
- break;
- default:
- OSL_FAIL("Unknown HandshakeType");
- }
- }
- return !bWasError;
-}
-
-CommunicationManager::CommunicationManager( sal_Bool bUseMultiChannel )
-: nInfoType( CM_NONE )
-, bIsCommunicationRunning( sal_False )
-, maApplication("Unknown")
-, bIsMultiChannel( bUseMultiChannel )
-{
-}
-
-CommunicationManager::~CommunicationManager()
-{
- xLastNewLink.Clear();
-}
-
-sal_Bool CommunicationManager::StartCommunication( String aApp, String aParams )
-{
- (void) aApp; /* avoid warning about unused parameter */
- (void) aParams; /* avoid warning about unused parameter */
- return sal_False;
-}
-
-sal_Bool CommunicationManager::StartCommunication( ByteString aHost, sal_uLong nPort )
-{
- (void) aHost; /* avoid warning about unused parameter */
- (void) nPort; /* avoid warning about unused parameter */
- return sal_False;
-}
-
-ByteString CommunicationManager::GetMyName( CM_NameType )
-{
- rtl::OUString aHostname(osl::SocketAddr::getLocalHostname());
- return rtl::OUStringToOString(aHostname, RTL_TEXTENCODING_UTF8);
-}
-
-void CommunicationManager::CallConnectionOpened( CommunicationLink* pCL )
-{
- pCL->StartCallback(); // This should already have been called.
- pCL->aStart = DateTime( DateTime::SYSTEM );
- pCL->aLastAccess = pCL->aStart;
- bIsCommunicationRunning = sal_True;
- pCL->SetApplication( GetApplication() );
-
- xLastNewLink = pCL;
-
- INFO_MSG( CByteString("C+:").Append( pCL->GetCommunicationPartner( CM_FQDN ) ),
- CByteString("Connection established: ").Append( pCL->GetCommunicationPartner( CM_FQDN ) ),
- CM_OPEN, pCL );
- ConnectionOpened( pCL );
- pCL->FinishCallback();
-}
-
-void CommunicationManager::CallConnectionClosed( CommunicationLink* pCL )
-{
- pCL->StartCallback(); // This should already have been called.
- pCL->aLastAccess = DateTime( DateTime::SYSTEM );
-
- INFO_MSG( CByteString("C-:").Append( pCL->GetCommunicationPartner( CM_FQDN ) ),
- CByteString("Connection broken: ").Append( pCL->GetCommunicationPartner( CM_FQDN ) ),
- CM_CLOSE, pCL );
- ConnectionClosed( pCL );
-
- if ( xLastNewLink == pCL )
- xLastNewLink.Clear();
-
- pCL->FinishCallback();
-// delete pCL;
-}
-
-void CommunicationManager::CallDataReceived( CommunicationLink* pCL )
-{
- pCL->StartCallback(); // Should have already been called
- pCL->aLastAccess = DateTime( DateTime::SYSTEM );
- CommunicationLinkRef rHold(pCL); // Keep the pointer for a bit.
-
- // should be impossible but happens for mysterious reasons
- if ( !pCL->pServiceData )
- {
- OSL_FAIL( "Datastream is NULL" );
- pCL->FinishCallback();
- return;
- }
-
-
- if ( CH_Handshake == pCL->nServiceHeaderType )
- {
- SvStream *pData = pCL->GetServiceData();
- sal_uInt16 nType;
- pData->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); // Unfortulately it is written this way :((
- *pData >> nType;
- pData->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
- switch ( nType )
- {
- case CH_REQUEST_HandshakeAlive:
- {
- pCL->SendHandshake( CH_RESPONSE_HandshakeAlive );
- }
- break;
- case CH_REQUEST_ShutdownLink:
- {
-#if OSL_DEBUG_LEVEL > 1
- debug_printf("Sending ShutdownLink\n");
-#endif
- pCL->SendHandshake( CH_ShutdownLink );
- }
- break;
- case CH_ShutdownLink:
- {
-#if OSL_DEBUG_LEVEL > 1
- debug_printf("Executing ShutdownLink\n");
-#endif
- pCL->ShutdownCommunication();
- }
- break;
- case CH_SetApplication:
- {
- ByteString aApplication;
- pData->ReadByteString(aApplication);
- pCL->CommunicationLink::SetApplication( aApplication );
-#if OSL_DEBUG_LEVEL > 1
- debug_printf( "Setting Application to " );
- debug_printf( aApplication.GetBuffer() );
- debug_printf( "\n" );
-#endif
- }
- break;
-
-#if OSL_DEBUG_LEVEL > 1
- default:
- {
- debug_printf("Unknown Handshake received\n");
- }
-#endif
- }
- delete pData;
- }
- else
- {
- if ( pCL->pServiceData )
- {
- pCL->nTotalBytes += pCL->pServiceData->Seek( STREAM_SEEK_TO_END );
- pCL->pServiceData->Seek( STREAM_SEEK_TO_BEGIN );
- }
-
- INFO_MSG( CByteString("D :").Append( pCL->GetCommunicationPartner( CM_FQDN ) ),
- CByteString("Daten Empfangen:").Append( pCL->GetCommunicationPartner( CM_FQDN ) ),
- CM_RECEIVE, pCL );
- DataReceived( pCL );
- }
- delete pCL->GetServiceData();
- pCL->FinishCallback();
-}
-
-void CommunicationManager::CallInfoMsg( InfoString aMsg )
-{
- // Probably no housekeeping here.
- InfoMsg( aMsg );
-}
-
-void CommunicationManager::SetApplication( const ByteString& aApp, sal_Bool bRunningLinks )
-{
- maApplication = aApp;
- if ( bRunningLinks )
- {
- sal_uInt16 i;
- for ( i = 0 ; i < GetCommunicationLinkCount() ; i++ )
- GetCommunicationLink( i )->SetApplication( aApp );
- }
-}
-
-sal_Bool CommonSocketFunctions::DoStartCommunication( CommunicationManager *pCM, ICommunicationManagerClient *pCMC, ByteString aHost, sal_uLong nPort )
-{
- osl::SocketAddr Addr( rtl::OUString( UniString( aHost, RTL_TEXTENCODING_UTF8 ) ), nPort );
- osl::ConnectorSocket *pConnSocket;
-
-
- TimeValue aTV;
- aTV.Seconds = 10; // Warte 10 Sekunden
- aTV.Nanosec = 0;
- do
- {
- pConnSocket = new osl::ConnectorSocket();
- pConnSocket->setOption( osl_Socket_OptionTcpNoDelay, 1 );
- if ( pConnSocket->connect( Addr, &aTV ) == osl_Socket_Ok )
- {
- pConnSocket->setOption( osl_Socket_OptionTcpNoDelay, 1 );
- pCM->CallConnectionOpened( CreateCommunicationLink( pCM, pConnSocket ) );
- return sal_True;
- }
- else
- delete pConnSocket;
-
- } while ( pCMC->RetryConnect() );
-
- return sal_False;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/simplecm/tcpio.cxx b/automation/source/simplecm/tcpio.cxx
deleted file mode 100644
index 098be2482da8..000000000000
--- a/automation/source/simplecm/tcpio.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "tcpio.hxx"
-
-/// implement ITransmiter
-comm_UINT16 TCPIO::TransferBytes( const void* pBuffer, comm_UINT32 nLen )
-{
- osl::MutexGuard aGuard( aMSocketWriteAccess );
- if ( !pStreamSocket )
- {
- nLastSent = 0;
- return C_ERROR_PERMANENT;
- }
- nLastSent = pStreamSocket->write( pBuffer, nLen );
- if ( nLastSent == nLen )
- return C_ERROR_NONE;
- return C_ERROR_PERMANENT;
-}
-
-
-/// implement IReceiver
-comm_UINT16 TCPIO::ReceiveBytes( void* pBuffer, comm_UINT32 nLen )
-{
- osl::MutexGuard aGuard( aMSocketReadAccess );
- if ( !pStreamSocket )
- {
- nLastReceived = 0;
- return C_ERROR_PERMANENT;
- }
- nLastReceived = pStreamSocket->read( pBuffer, nLen );
- if ( nLastReceived == nLen )
- return C_ERROR_NONE;
- return C_ERROR_PERMANENT;
-}
-
-
-// helper
-void TCPIO::SetStreamSocket( osl::StreamSocket* pSocket )
-{
- osl::MutexGuard aRGuard( aMSocketReadAccess );
- osl::MutexGuard aWGuard( aMSocketWriteAccess );
- pStreamSocket = pSocket;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/simplecm/tcpio.hxx b/automation/source/simplecm/tcpio.hxx
deleted file mode 100644
index 3240a8156d60..000000000000
--- a/automation/source/simplecm/tcpio.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef TCPIO_HXX
-#define TCPIO_HXX
-
-#include <osl/socket.hxx>
-#include <osl/mutex.hxx>
-
-#include "communiio.hxx"
-
-class TCPIO : public ITransmiter, public IReceiver
-{
-private:
- osl::StreamSocket* pStreamSocket;
- osl::Mutex aMSocketReadAccess;
- osl::Mutex aMSocketWriteAccess;
-
-public:
-
- ///
- TCPIO( osl::StreamSocket* pSocket ):pStreamSocket( pSocket ){}
- virtual ~TCPIO(){}
-
-
- /// implement ITransmiter
- virtual comm_UINT16 TransferBytes( const void* pBuffer, comm_UINT32 nLen );
-
- /// implement IReceiver
- virtual comm_UINT16 ReceiveBytes( void* pBuffer, comm_UINT32 nLen );
-
- // helper
- void SetStreamSocket( osl::StreamSocket* pSocket );
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/Makefile b/automation/source/testtool/Makefile
deleted file mode 100644
index c07c6c8cf22e..000000000000
--- a/automation/source/testtool/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2011 Red Hat, Inc., David Tardon <dtardon@redhat.com>
-# (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-gb_PARTIALBUILD:=T
-include $(GBUILDDIR)/gbuild_simple.mk
-
-BASEDIR := $(dir $(firstword $(MAKEFILE_LIST)))
-
-define filter_header
-$(1).hxx : $(3)/$(2)
- $(PERL) $(BASEDIR)/filter.pl $(3) $(2) $(1) $(4)
-
-endef
-
-$(eval $(call filter_header,classes,rcontrol.hxx,$(realpath $(BASEDIR)/../inc),M_))
-$(eval $(call filter_header,keycodes,vcl/keycodes.hxx,$(OUTDIR)/inc,KEY_))
-$(eval $(call filter_header,r_cmds,rcontrol.hxx,$(realpath $(BASEDIR)/../inc),RC_))
-$(eval $(call filter_header,res_type,tools/wintypes.hxx,$(OUTDIR)/inc,WINDOW_))
-
-$(CURDIR)/testtool.ini : $(BASEDIR)/testtool.ini
-ifeq ($(GUI),UNX)
- sed -e s/!INIFILESUFFIX!/rc/ -e s/!BRANDPATH!// $< > $@
-else ifeq ($(GUI),WNT)
- sed -e s/!INIFILESUFFIX!/.ini/ -e s/!BRANDPATH!/../ $< > $@
-endif
-
-.DEFAULT_GOAL := all
-.PHONY : all
-all : \
- classes.hxx \
- keycodes.hxx \
- r_cmds.hxx \
- res_type.hxx \
- $(CURDIR)/testtool.ini
-
-# vim: set ts=4 sw=4 noet:
diff --git a/automation/source/testtool/cmdstrm.cxx b/automation/source/testtool/cmdstrm.cxx
deleted file mode 100644
index e51d63d6ce12..000000000000
--- a/automation/source/testtool/cmdstrm.cxx
+++ /dev/null
@@ -1,453 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <vcl/keycod.hxx>
-#include <basic/sbx.hxx>
-#include <tools/stream.hxx>
-
-#include "cmdstrm.hxx"
-#include "rcontrol.hxx"
-#include "objtest.hxx"
-#include "ittresid.hxx"
-#include "svcommstream.hxx"
-#include <basic/testtool.hrc>
-
-ControlDefLoad const CmdStream::arKeyCodes [] =
-#include <keycodes.hxx>
-CNames *CmdStream::pKeyCodes = NULL;
-
-ResMgr* IttResId::getIttResMgr()
-{
- static ResMgr* pMgr = NULL;
- if( ! pMgr )
- pMgr = CREATEVERSIONRESMGR( stt );
- return pMgr;
-}
-
-CmdStream::CmdStream()
-{
- pSammel = new SvMemoryStream();
- pCommStream = new SvCommStream( pSammel );
-}
-
-CmdStream::~CmdStream()
-{
- delete pCommStream;
- delete pSammel;
-}
-
-
-#define PUT_CHAR(ch) \
- sal_uInt16 nMCode = nModify + ch; \
- sal_uInt16 _Code = 1; \
- if ( (nMCode & 0xFF) == 0 ) \
- _Code |= 2; \
- if ( (nMCode >> 8) == 0 ) \
- _Code |= 4; \
- Result += (char) _Code; \
- Result += (char) ( nMCode & 0xFF ); \
- Result += (char) ( nMCode >> 8 )
-
-
-String CmdStream::WandleKeyEventString( String aKeys )
-{
- if ( !pKeyCodes )
- ReadFlatArray(arKeyCodes,pKeyCodes);
- if ( !pKeyCodes )
- return aKeys;
-
- xub_StrLen nPos1 = 0;
- while ( (nPos1 = aKeys.Search('<',nPos1)) != STRING_NOTFOUND)
- {
- xub_StrLen nPos2 = aKeys.Search('>',nPos1);
- if ( nPos2 != STRING_NOTFOUND )
- {
- String Work = aKeys.Copy(nPos1+1,nPos2-nPos1+1-2);
- aKeys.Erase(nPos1,nPos2-nPos1+1); // includes removing <>'s
- String Result, Token;
- sal_uInt16 nModify = 0;
- while ( Work.Len() > 0 )
- {
- Token = Work.GetToken(0,' ');
- Work.Erase(0,Token.Len()+1);
- ControlDef WhatName(Token,rtl::OString());
- sal_uInt16 nElement;
- if (pKeyCodes->Seek_Entry(&WhatName,&nElement))
- {
- // FIXME: HELPID
- sal_uInt16 nCode = 0;//(sal_uInt16) pKeyCodes->GetObject(nElement)->pData->aUId.GetNum();
- if ( nCode >= KEY_SHIFT )
- nModify ^= nCode;
- else
- {
- if ( ( nModify == 0 ) &&
- (((nCode & 0xFF00) == KEYGROUP_NUM) ||
- ((nCode & 0xFF00) == KEYGROUP_ALPHA) ||
- ( nCode == KEY_SPACE) ||
- ( nCode == KEY_ADD) ||
- ( nCode == KEY_SUBTRACT) ||
- ( nCode == KEY_MULTIPLY) ||
- ( nCode == KEY_DIVIDE) ||
- ( nCode == KEY_POINT) ||
- ( nCode == KEY_COMMA) ||
- ( nCode == KEY_LESS) ||
- ( nCode == KEY_GREATER) ||
- ( nCode == KEY_EQUAL) ) )
- {
- switch ( nCode )
- {
- case KEY_SPACE: Token = ' '; break;
- case KEY_ADD: Token = '+'; break;
- case KEY_SUBTRACT: Token = '-'; break;
- case KEY_MULTIPLY: Token = '*'; break;
- case KEY_DIVIDE: Token = '/'; break;
- case KEY_POINT: Token = '.'; break;
- case KEY_COMMA: Token = ','; break;
- case KEY_LESS: Token = '<'; break;
- case KEY_GREATER: Token = '>'; break;
- case KEY_EQUAL: Token = '='; break;
- default:
-// if ( nModify == 0 )
-// Token.ToLower();
-// else
-// Token.ToUpper();
- ;
- }
- Result += Token;
- }
- else
- {
- PUT_CHAR (nCode);
- }
- }
- }
- else
- {
- Result += '<';
- Result += Token;
- Result += ' ';
- Result += String( IttResId( S_INVALID_KEYCODE ) );
- Result += '>';
- }
- }
- aKeys.Insert(Result,nPos1);
- nPos1 = nPos1 + Result.Len();
- }
- else
- nPos1 = aKeys.Len() + 1;
- }
-
- return aKeys;
-}
-
-
-void CmdStream::WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString )
-{
- sal_uInt16 nParams = PARAM_NONE;
- sal_uInt16 nNr1=0,nNr2=0,nNr3=0,nNr4=0;
- comm_UINT32 nLNr1=0;
- String aString1,aString2;
- sal_Bool bBool1=sal_False,bBool2=sal_False;
-
- if ( rPar )
- {
- for ( sal_uInt16 i = 1; i < rPar->Count() ; i++)
- {
- switch (rPar->Get( i )->GetType())
- {
- case SbxLONG: // always pass everything as Short
- case SbxULONG:
- case SbxSALINT64:
- case SbxSALUINT64:
- case SbxDOUBLE:
- case SbxINTEGER:
- case SbxBYTE:
- case SbxUSHORT:
- case SbxINT:
- case SbxUINT:
- case SbxSINGLE:
- if ( (nParams & PARAM_UINT16_1) == 0 )
- {
- nParams |= PARAM_UINT16_1;
- nNr1 = rPar->Get( i )->GetUShort();
- }
- else if ( (nParams & PARAM_UINT16_2) == 0 )
- {
- nParams |= PARAM_UINT16_2;
- nNr2 = rPar->Get( i )->GetUShort();
- }
- else if ( (nParams & PARAM_UINT16_3) == 0 )
- {
- nParams |= PARAM_UINT16_3;
- nNr3 = rPar->Get( i )->GetUShort();
- }
- else if ( (nParams & PARAM_UINT16_4) == 0 )
- {
- nParams |= PARAM_UINT16_4;
- nNr4 = rPar->Get( i )->GetUShort();
- }
- else
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- break;
- case SbxOBJECT: // whenever a control is passed. TabPage, MenuBar
- {
- SbxProperty *pMember = NULL;
- if ( rPar->Get( i )->ISA( SbxObject ) )
- pMember = ((SbxObject*)rPar->Get( i ))->GetDfltProperty();
- if ( pMember != NULL )
- {
- if ( pMember->GetType() == SbxSTRING )
- {
- if ( nParams & PARAM_STR_1 )
- if ( nParams & PARAM_STR_2 )
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- else
- {
- nParams |= PARAM_STR_2;
- aString2 = pMember->GetString();
- }
- else
- {
- nParams |= PARAM_STR_1;
- aString1 = pMember->GetString();
- }
- break;
- }
- else if ( pMember->GetType() == SbxULONG )
- {
- if ( nParams & PARAM_UINT32_1 )
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- else
- {
- nParams |= PARAM_UINT32_1;
- nLNr1 = pMember->GetULong();
- }
- }
- else
- SbxBase::SetError( SbxERR_NAMED_NOT_FOUND );
- }
- else
- {
- SbxBase::SetError( SbxERR_NAMED_NOT_FOUND );
- }
- }
- break;
- case SbxSTRING:
- case SbxCHAR:
- if ( nParams & PARAM_STR_1 )
- if ( nParams & PARAM_STR_2 )
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- else
- {
- nParams |= PARAM_STR_2;
- aString2 = rPar->Get( i )->GetString();
- }
- else
- {
- nParams |= PARAM_STR_1;
- aString1 = rPar->Get( i )->GetString();
- }
- break;
- case SbxBOOL:
- if ( nParams & PARAM_BOOL_1 )
- if ( nParams & PARAM_BOOL_2 )
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- else
- {
- nParams |= PARAM_BOOL_2;
- bBool2 = rPar->Get( i )->GetBool();
- }
- else
- {
- nParams |= PARAM_BOOL_1;
- bBool1 = rPar->Get( i )->GetBool();
- }
- break;
- default:
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- break;
- }
- }
- }
- Write (nParams);
- if( nParams & PARAM_UINT16_1 ) Write( nNr1 );
- if( nParams & PARAM_UINT16_2 ) Write( nNr2 );
- if( nParams & PARAM_UINT16_3 ) Write( nNr3 );
- if( nParams & PARAM_UINT16_4 ) Write( nNr4 );
- if( nParams & PARAM_UINT32_1 ) Write( nLNr1 );
- if( nParams & PARAM_STR_1 ) Write( aString1, IsKeyString );
- if( nParams & PARAM_STR_2 ) Write( aString2, IsKeyString );
- if( nParams & PARAM_BOOL_1 ) Write( bBool1 );
- if( nParams & PARAM_BOOL_2 ) Write( bBool2 );
-}
-
-void CmdStream::GenCmdCommand( sal_uInt16 nNr, SbxArray* rPar )
-{
- Write(sal_uInt16(SICommand));
- Write(nNr);
- WriteSortedParams(rPar, (nNr & M_KEY_STRING) != 0 );
-}
-
-void CmdStream::GenCmdSlot( sal_uInt16 nNr, SbxArray* rPar )
-{
- Write(sal_uInt16(SISlot));
- Write(nNr);
- if (rPar)
- {
- sal_uInt16 nAnz = (rPar->Count()-1) >> 1;
- Write(nAnz);
- sal_Bool bWriteUnoSlot = rPar->Get( 1 )->GetType() == SbxSTRING;
-
- for (sal_uInt16 n = 1 ; n <= nAnz ; n++)
- {
- /// #59513# not necessary anymore
-// sal_uLong nUserData = rPar->Get( 2*n-1 )->GetUserData();
-// rPar->Get( 2*n-1 )->SetUserData(ID_DoNothing); // prevents execution of the slots that are passed as parameters
-
- if ( bWriteUnoSlot )
- Write(rPar->Get( 2*n-1 )->GetString());
- else
- Write(rPar->Get( 2*n-1 )->GetUShort());
- switch (rPar->Get( 2*n )->GetType())
- {
- case SbxINTEGER:
- case SbxBYTE:
- case SbxUSHORT:
- case SbxINT:
- case SbxUINT:
- case SbxSINGLE:
- if ( !bWriteUnoSlot )
- Write( (sal_uInt16)BinUINT16 );
- Write(rPar->Get( 2*n )->GetUShort());
- break;
- case SbxLONG:
- case SbxULONG:
- case SbxSALINT64:
- case SbxSALUINT64:
- case SbxDOUBLE:
- if ( !bWriteUnoSlot )
- Write( (sal_uInt16)BinUINT32 );
- Write(rPar->Get( 2*n )->GetULong());
- break;
- case SbxSTRING:
- case SbxCHAR:
- if ( !bWriteUnoSlot )
- Write( (sal_uInt16)BinString);
- Write((String)rPar->Get( 2*n )->GetString()); // Cast for OS/2
- break;
- case SbxBOOL:
- if ( !bWriteUnoSlot )
- Write( (sal_uInt16)BinBool);
- Write(rPar->Get( 2*n )->GetBool());
- break;
- default:
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- break;
- }
-
- /// #59513# //don't need this anymore (see prior comment?)
-// rPar->Get( 2*n-1 )->SetUserData(nUserData); // Set it back, so everything's clean.
- }
- }
- else
- Write(sal_uInt16(0));
-}
-
-void CmdStream::GenCmdUNOSlot( const String &aURL )
-{
- Write( sal_uInt16(SIUnoSlot) );
-/* Write( sal_uInt16(0) ); // The SID_OPENURL is entered here.
- // That must be wired hard in the Office and not here of course
- // as the ID might change
-
- // Because the ID must also be taken for the PoolItem from the Office, it is not
- // necessary to send a PoolItem here.
-
- Write( sal_uInt16(0) ); // number of PoolItems
-
- // instead there's an extra string sent by the Office which is changed to an
- // SfxStringItem with the respective ID
- Write( aURL ); // String for the PoolItem*/
-
- Write( aURL ); // UNO URL
-}
-
-void CmdStream::GenCmdControl( comm_UINT32 nUId, sal_uInt16 nMethodId, SbxArray* rPar )
-{
- Write(sal_uInt16(SIControl));
- Write(nUId);
- Write(nMethodId);
- WriteSortedParams(rPar, (nMethodId & M_KEY_STRING) != 0 );
-}
-
-void CmdStream::GenCmdControl( String aUId, sal_uInt16 nMethodId, SbxArray* rPar )
-{
- Write(sal_uInt16(SIStringControl));
- Write(aUId);
- Write(nMethodId);
- WriteSortedParams(rPar, (nMethodId & M_KEY_STRING) != 0 );
-}
-
-void CmdStream::GenCmdFlow( sal_uInt16 nArt )
-{
- Write(sal_uInt16(SIFlow));
- Write(nArt);
- Write(sal_uInt16(PARAM_NONE)); // type of the following parameters
-}
-
-void CmdStream::GenCmdFlow( sal_uInt16 nArt, comm_UINT32 nNr1 )
-{
- Write(sal_uInt16(SIFlow));
- Write(nArt);
- Write(sal_uInt16(PARAM_UINT32_1)); // type of the following parameters
- Write(nNr1);
-}
-
-void CmdStream::Write( String aString, sal_Bool IsKeyString )
-{
- if ( IsKeyString )
- Write( WandleKeyEventString( aString ), sal_False );
- else
- Write( aString.GetBuffer(), aString.Len() );
-}
-
-SvMemoryStream* CmdStream::GetStream()
-{
- return pSammel;
-}
-
-void CmdStream::Reset( comm_UINT32 nSequence )
-{
- delete pCommStream;
- delete pSammel;
- pSammel = new SvMemoryStream();
- pCommStream = new SvCommStream( pSammel );
- GenCmdFlow (F_Sequence,nSequence);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/cmdstrm.hxx b/automation/source/testtool/cmdstrm.hxx
deleted file mode 100644
index 7b8afef71f53..000000000000
--- a/automation/source/testtool/cmdstrm.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CMDSTRM_HXX
-#define _CMDSTRM_HXX
-
-#include <objtest.hxx>
-#include <testapp.hxx>
-#include "cmdbasestream.hxx"
-
-class CmdStream : public CmdBaseStream
-{
-public:
- CmdStream();
- ~CmdStream();
-
- void WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString = sal_False );
-
- void GenCmdCommand( sal_uInt16 nNr, SbxArray* rPar );
-
- void GenCmdSlot( sal_uInt16 nNr, SbxArray* rPar );
-
- void GenCmdUNOSlot( const String &aURL );
-
- void GenCmdControl( comm_UINT32 nUId, sal_uInt16 nMethodId, SbxArray* rPar );
- void GenCmdControl( String aUId, sal_uInt16 nMethodId, SbxArray* rPar );
-
-
- void GenCmdFlow( sal_uInt16 nArt );
- void GenCmdFlow( sal_uInt16 nArt, comm_UINT32 nNr1 );
-
- void Reset(comm_UINT32 nSequence);
-
- SvMemoryStream* GetStream();
-
- static CNames *pKeyCodes; // names of special keys MOD1, F1, LEFT ...
- static ControlDefLoad const arKeyCodes [];
-
-private:
- String WandleKeyEventString( String aKeys ); // uses pKeyCodes. <RETURN> <SHIFT LEFT LEFT>
-
- using CmdBaseStream::Write;
- void Write( comm_UINT16 nNr ){CmdBaseStream::Write( nNr );}
- void Write( comm_UINT32 nNr ){CmdBaseStream::Write( nNr );}
- void Write( const comm_UniChar* aString, comm_UINT16 nLenInChars ){CmdBaseStream::Write( aString, nLenInChars );}
- void Write( comm_BOOL bBool ){CmdBaseStream::Write( bBool );}
-// new
- void Write( String aString, sal_Bool IsKeyString = sal_False );
-
- SvMemoryStream *pSammel;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/comm_bas.cxx b/automation/source/testtool/comm_bas.cxx
deleted file mode 100644
index 5279a49b2d4c..000000000000
--- a/automation/source/testtool/comm_bas.cxx
+++ /dev/null
@@ -1,430 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "comm_bas.hxx"
-#include <tools/errcode.hxx>
-#include <basic/sbxobj.hxx>
-#include <basic/sbx.hxx>
-#include <basic/sbxvar.hxx>
-#include <vcl/svapp.hxx>
-#include <automation/communi.hxx>
-#include <basic/ttstrhlp.hxx>
-
-// The CommunicationManager consists of the following elements:
-// 1) Properties:
-// none
-// 2) Methods:
-// CommunicationLink StartCommunication( Host, Port )
-// StopAllCommunication
-// sal_Bool IsCommunicationRunning
-// String GetMyName
-// sal_Bool IsLinkValid( CommunicationLink )
-// SetCommunicationEventHandler( String )
-
-// The CommunicationLink consists of the following elements:
-// 1) Properties:
-// none
-// 2) Methods:
-// StopCommunication
-// String GetMyName
-// String GetHostName
-// Send( String )
-// String GetString
-
-
-// This implementation is an example for a table-controlled
-// version that can contain a lot of elements. The elements are
-// taken from the table to the object when needed.
-
-// The nArgs-field of a table entry is encrypted as follows:
-
-#define _ARGSMASK 0x00FF // up to 255 arguments
-#define _RWMASK 0x0F00 // mask for R/W-Bits
-#define _TYPEMASK 0xF000 // mask for the entry type
-
-#define _READ 0x0100 // can be read
-#define _BWRITE 0x0200 // can be used as Lvalue
-#define _LVALUE _BWRITE // can be used as Lvalue
-#define _READWRITE 0x0300 // both
-#define _OPT 0x0400 // TRUE: optional parameter
-#define _METHOD 0x1000 // mask bit for a method
-#define _PROPERTY 0x2000 // mask bit for a property
-#define _COLL 0x4000 // mask bit for a collection
- // combination of bits above:
-#define _FUNCTION 0x1100 // mask for a function
-#define _LFUNCTION 0x1300 // mask for a function, that works as Lvalue too
-#define _ROPROP 0x2100 // mask Read Only-Property
-#define _WOPROP 0x2200 // mask Write Only-Property
-#define _RWPROP 0x2300 // mask Read/Write-Property
-#define _COLLPROP 0x4100 // mask Read-Collection-Element
-
-
-CommunicationWrapper::Methods CommunicationWrapper::aManagerMethods[] = {
-
-{ "StartCommunication", SbxEMPTY, &CommunicationWrapper::MStartCommunication, 2 | _FUNCTION },
-
- { "Host", SbxSTRING, NULL, 0 },
- { "Port", SbxLONG, NULL, 0 },
-
-{ "StopAllCommunication", SbxEMPTY, &CommunicationWrapper::MStopAllCommunication, 0 | _FUNCTION },
-
-{ "IsCommunicationRunning", SbxBOOL, &CommunicationWrapper::MIsCommunicationRunning, 0 | _FUNCTION },
-// as FQDN
-{ "GetMyName", SbxSTRING, &CommunicationWrapper::MGetMyName, 0 | _FUNCTION },
-
-{ "IsLinkValid", SbxBOOL, &CommunicationWrapper::MIsLinkValid, 1 | _FUNCTION },
-
- { "Link", SbxOBJECT, NULL, 0 },
-
-{ "SetCommunicationEventHandler", SbxEMPTY, &CommunicationWrapper::MSetCommunicationEventHandler, 1 | _FUNCTION },
-
- { "FuncName", SbxSTRING, NULL, 0 },
-
-{ NULL, SbxNULL, NULL, -1 }}; // end of the table
-
-
-
-
-
-
-CommunicationWrapper::Methods CommunicationWrapper::aLinkMethods[] = {
-
-{ "StopCommunication", SbxEMPTY, &CommunicationWrapper::LStopCommunication, 0 | _FUNCTION },
-
-{ "GetMyName", SbxSTRING, &CommunicationWrapper::LGetMyName, 0 | _FUNCTION },
-
-{ "GetHostName", SbxSTRING, &CommunicationWrapper::LGetHostName, 0 | _FUNCTION },
-
-{ "Send", SbxEMPTY, &CommunicationWrapper::LSend, 1 | _FUNCTION },
-
- { "SendString", SbxSTRING, NULL, 0 },
-
-{ "GetString", SbxSTRING, &CommunicationWrapper::LGetString, 0 | _FUNCTION },
-
-{ NULL, SbxNULL, NULL, -1 }}; // end of the table
-
-
-
-
-
-// constructor for the manager
-CommunicationWrapper::CommunicationWrapper( const String& rClass ) : SbxObject( rClass )
-, m_pLink( NULL )
-, m_bIsManager( sal_True )
-, m_bCatchOpen( sal_False )
-, m_pNewLink( NULL )
-{
- m_pMethods = &aManagerMethods[0];
- m_pManager = new CommunicationManagerClientViaSocket;
- m_pManager->SetConnectionOpenedHdl( LINK( this, CommunicationWrapper, Open ) );
- m_pManager->SetConnectionClosedHdl( LINK( this, CommunicationWrapper, Close ) );
- m_pManager->SetDataReceivedHdl( LINK( this, CommunicationWrapper, Data ) );
-}
-
-// constructor for the link
-CommunicationWrapper::CommunicationWrapper( CommunicationLink *pThisLink ) : SbxObject( CUniString("Link") )
-, m_pLink( pThisLink )
-, m_bIsManager( sal_False )
-, m_bCatchOpen( sal_False )
-, m_pNewLink( NULL )
-{
- m_pMethods = &aLinkMethods[0];
- m_pManager = (CommunicationManagerClientViaSocket*)pThisLink->GetCommunicationManager();
-}
-
-// deconstructor
-CommunicationWrapper::~CommunicationWrapper()
-{
- if ( m_bIsManager )
- delete m_pManager;
-}
-
-
-// Search for an element:
-// Here it goes through the method table until an appropriate one
-// has been found.
-// If the method/property has not been found, get back only NULL
-// without error code because that way a whole chain of objects
-// can be asked for the method/property.
-
-SbxVariable* CommunicationWrapper::Find( const String& rName, SbxClassType t )
-{
- // Does the element exist already?
- SbxVariable* pRes = SbxObject::Find( rName, t );
- if( !pRes && t != SbxCLASS_OBJECT )
- {
- // look for it if not
- Methods* p = m_pMethods;
- short nIndex = 0;
- sal_Bool bFound = sal_False;
- while( p->nArgs != -1 )
- {
- if( rName.CompareIgnoreCaseToAscii( p->pName ) == COMPARE_EQUAL )
- {
- bFound = sal_True; break;
- }
- nIndex += ( p->nArgs & _ARGSMASK ) + 1;
- p = m_pMethods + nIndex;
- }
- if( bFound )
- {
- // isolate args-fields:
- short nAccess = ( p->nArgs & _RWMASK ) >> 8;
- short nType = ( p->nArgs & _TYPEMASK );
- String aName( p->pName, RTL_TEXTENCODING_ASCII_US );
- SbxClassType eCT = SbxCLASS_OBJECT;
- if( nType & _PROPERTY )
- eCT = SbxCLASS_PROPERTY;
- else if( nType & _METHOD )
- eCT = SbxCLASS_METHOD;
- pRes = Make( aName, eCT, p->eType );
- // We set the array-index + 1, because there are still
- // other standard properties existing, which have to be activated.
- pRes->SetUserData( nIndex + 1 );
- pRes->SetFlags( nAccess );
- }
- }
- return pRes;
-}
-
-// activation of an element or asking for an infoblock
-
-void CommunicationWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT,
- const SfxHint& rHint, const TypeId& rHT )
-{
- const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
- if( pHint )
- {
- SbxVariable* pVar = pHint->GetVar();
- SbxArray* pPar = pVar->GetParameters();
- sal_uInt16 nIndex = (sal_uInt16) pVar->GetUserData();
- // no index: hand on!
- if( nIndex )
- {
- sal_uLong t = pHint->GetId();
- if( t == SBX_HINT_INFOWANTED )
- pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) );
- else
- {
- sal_Bool bWrite = sal_False;
- if( t == SBX_HINT_DATACHANGED )
- bWrite = sal_True;
- if( t == SBX_HINT_DATAWANTED || bWrite )
- {
- // parameter test for methods:
- sal_uInt16 nPar = m_pMethods[ --nIndex ].nArgs & 0x00FF;
- // element 0 is the return value
- if( ( !pPar && nPar )
- || ( pPar && pPar->Count() != nPar+1 ) )
- SetError( SbxERR_WRONG_ARGS );
-
- else
- {
- (this->*(m_pMethods[ nIndex ].pFunc))( pVar, pPar, bWrite );
- }
- }
- }
- }
- SbxObject::SFX_NOTIFY( rBC, rBCT, rHint, rHT );
- }
-}
-
-// construction of the info-structure for single elements
-
-SbxInfo* CommunicationWrapper::GetInfo( short nIdx )
-{
- Methods* p = &m_pMethods[ nIdx ];
- // if there's a help-file some time:
- // SbxInfo* pInfo = new SbxInfo( helpfilename, p->nHelpId );
- SbxInfo* pRetInfo = new SbxInfo;
- short nPar = p->nArgs & _ARGSMASK;
- for( short i = 0; i < nPar; i++ )
- {
- p++;
- String aName( p->pName, RTL_TEXTENCODING_ASCII_US );
- sal_uInt16 nIFlags = ( p->nArgs >> 8 ) & 0x03;
- if( p->nArgs & _OPT )
- nIFlags |= SBX_OPTIONAL;
- pRetInfo->AddParam( aName, p->eType, nIFlags );
- }
- return pRetInfo;
-}
-
-
-////////////////////////////////////////////////////////////////////////////
-
-// help methods for the manager
-
-IMPL_LINK( CommunicationWrapper, Open, CommunicationLink*, pLink )
-{
- if ( m_bCatchOpen )
- m_pNewLink = pLink;
- else
- Events( CUniString("Open"), pLink );
- return 1;
-}
-
-IMPL_LINK( CommunicationWrapper, Close, CommunicationLink*, pLink )
-{
- Events( CUniString("Close"), pLink );
- return 1;
-}
-
-IMPL_LINK( CommunicationWrapper, Data, CommunicationLink*, pLink )
-{
- Events( CUniString("Data"), pLink );
- return 1;
-}
-
-void CommunicationWrapper::Events( String aType, CommunicationLink* pLink )
-{
- if ( m_aEventHandlerName.Len() )
- {
- SbxArrayRef pPar = new SbxArray( SbxVARIANT );
- pPar->Put( new SbxVariable( SbxSTRING ), 1 );
- pPar->Get( 1 )->PutString( aType );
-
- pPar->Put( new SbxVariable( SbxOBJECT ), 2 );
- pPar->Get( 2 )->PutObject( new CommunicationWrapper( pLink ) );
-
- Call( m_aEventHandlerName, pPar );
- }
- else
- delete pLink->GetServiceData(); // give away the stream to prevent blocking
-}
-
-
-////////////////////////////////////////////////////////////////////////////
-
-// Properties and methods put down the return value for Get (bPut = sal_False) at
-// element 0 of the Argv; for Put (bPut = sal_True) the value from element 0 is saved.
-
-// the methods:
-
-// manager
-void CommunicationWrapper::MStartCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool /*bWrite*/ )
-{ // CommunicationLink StartCommunication( Host, Port )
- m_bCatchOpen = sal_True;
- if ( m_pManager->StartCommunication( rtl::OUStringToOString( pPar->Get( 1 )->GetString(), RTL_TEXTENCODING_UTF8 ), pPar->Get( 2 )->GetULong() ) )
- {
- while ( !m_pNewLink )
- GetpApp()->Reschedule();
- m_bCatchOpen = sal_False;
- CommunicationWrapper *pNewLinkWrapper = new CommunicationWrapper( m_pNewLink );
- m_pNewLink = NULL;
- pVar->PutObject( pNewLinkWrapper );
- }
-
-}
-
-void CommunicationWrapper::MStopAllCommunication( SbxVariable* /*pVar*/, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ )
-{ // StopAllCommunication
- m_pManager->StopCommunication();
-}
-
-void CommunicationWrapper::MIsCommunicationRunning( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ )
-{ // sal_Bool IsCommunicationRunning
- pVar->PutBool( m_pManager->IsCommunicationRunning() );
-}
-
-void CommunicationWrapper::MGetMyName( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ )
-{ // String GetMyName
- pVar->PutString( UniString( m_pManager->GetMyName( CM_FQDN ), RTL_TEXTENCODING_UTF8 ) );
-}
-
-void CommunicationWrapper::MIsLinkValid( SbxVariable* pVar, SbxArray* pPar, sal_Bool /*bWrite*/ )
-{ // sal_Bool IsLinkValid( CommunicationLink )
- CommunicationWrapper *pWrapper = (CommunicationWrapper*)(pPar->Get( 1 )->GetObject());
- pVar->PutBool( m_pManager->IsLinkValid( pWrapper->GetCommunicationLink() ) );
-}
-
-void CommunicationWrapper::MSetCommunicationEventHandler( SbxVariable* /*pVar*/, SbxArray* pPar, sal_Bool /*bWrite*/ )
-{ // SetCommunicationEventHandler( String )
- m_aEventHandlerName = pPar->Get( 1 )->GetString();
-}
-
-
-
-
-
-// Link
-void CommunicationWrapper::LStopCommunication( SbxVariable* /*pVar*/, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ )
-{ // StopCommunication
- m_pLink->StopCommunication();
-}
-
-void CommunicationWrapper::LGetMyName( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ )
-{ // String GetMyName
- pVar->PutString( UniString( m_pLink->GetMyName( CM_FQDN ), RTL_TEXTENCODING_UTF8 ) );
-}
-
-void CommunicationWrapper::LGetHostName( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ )
-{ // String GetHostName
- pVar->PutString( UniString( m_pLink->GetCommunicationPartner( CM_FQDN ), RTL_TEXTENCODING_UTF8 ) );
-}
-
-void CommunicationWrapper::LSend( SbxVariable* /*pVar*/, SbxArray* pPar, sal_Bool /*bWrite*/ )
-{ // Send(String )
- SvStream *pSendStream = m_pLink->GetBestCommunicationStream();
- String aSendString = pPar->Get( 1 )->GetString();
- pSendStream->WriteByteString( aSendString, RTL_TEXTENCODING_UTF8 );
- m_pLink->TransferDataStream( pSendStream );
- delete pSendStream;
-}
-
-void CommunicationWrapper::LGetString( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ )
-{ // String GetString
- SvStream *pReceiveStream = m_pLink->GetServiceData();
- if ( pReceiveStream )
- {
- sal_uLong nLength = pReceiveStream->Seek( STREAM_SEEK_TO_END );
- pReceiveStream->Seek( STREAM_SEEK_TO_BEGIN );
- char *pBuffer = new char[nLength];
- pReceiveStream->Read( pBuffer, nLength );
- String aReceive(
- pBuffer, sal::static_int_cast< xub_StrLen >( nLength ),
- RTL_TEXTENCODING_UTF8 );
- delete [] pBuffer;
- pVar->PutString( aReceive );
- delete pReceiveStream;
- }
- else
- pVar->PutString( UniString() );
-}
-
-
-
-SbxObject* CommunicationFactory::CreateObject( const String& rClass )
-{
- if( rClass.CompareIgnoreCaseToAscii( "CommunicationManager" ) == COMPARE_EQUAL )
- return new CommunicationWrapper( rClass );
- return NULL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/comm_bas.hxx b/automation/source/testtool/comm_bas.hxx
deleted file mode 100644
index 4b1af375235b..000000000000
--- a/automation/source/testtool/comm_bas.hxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _COMM_BAS_HXX
-#define _COMM_BAS_HXX
-
-#include <basic/sbxfac.hxx>
-#include <basic/sbxvar.hxx>
-#include <basic/sbxobj.hxx>
-
-class CommunicationManagerClientViaSocket;
-class CommunicationLink;
-
-class CommunicationWrapper : public SbxObject // one for manager(s) and links
-{
- // definition of a table entry. That's done here because the
- // methods and properties can be declared private that way.
-#if defined ( ICC ) || defined ( C50 )
-public:
-#endif
- typedef void( CommunicationWrapper::*pMeth )
- ( SbxVariable* pThis, SbxArray* pArgs, sal_Bool bWrite );
-#if defined ( ICC )
-private:
-#endif
-
- struct Methods {
- const char* pName;
- SbxDataType eType;
- pMeth pFunc;
- short nArgs;
- };
- static Methods aManagerMethods[]; // method table
- static Methods aLinkMethods[]; // method table
- Methods *m_pMethods; // current method table
-
- // methods
- // manager
- void MStartCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void MStopAllCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void MIsCommunicationRunning( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void MGetMyName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void MIsLinkValid( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void MSetCommunicationEventHandler( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
-
- // link
- void LStopCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void LGetMyName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void LGetHostName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void LSend( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
- void LGetString( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
-
- // internal members and methods
- CommunicationManagerClientViaSocket *m_pManager;
- CommunicationLink *m_pLink;
- sal_Bool m_bIsManager;
-
- DECL_LINK( Open, CommunicationLink* );
- DECL_LINK( Close, CommunicationLink* );
- DECL_LINK( Data, CommunicationLink* );
- void Events( String aType, CommunicationLink* pLink );
- sal_Bool m_bCatchOpen;
- CommunicationLink *m_pNewLink;
- String m_aEventHandlerName;
-
- using SbxVariable::GetInfo;
- SbxInfo* GetInfo( short nIdx );
-
- // Broadcaster Notification
- virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- const SfxHint& rHint, const TypeId& rHintType );
-public:
- CommunicationWrapper( const String& );
- CommunicationWrapper( CommunicationLink *pThisLink );
- ~CommunicationWrapper();
-
- virtual SbxVariable* Find( const String&, SbxClassType );
-
- CommunicationLink* GetCommunicationLink() { return m_pLink; }
-};
-
-
-
-class CommunicationFactory : public SbxFactory
-{
-public:
- virtual SbxObject* CreateObject( const String& );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/cretstrm.cxx b/automation/source/testtool/cretstrm.cxx
deleted file mode 100644
index 64e217cedcee..000000000000
--- a/automation/source/testtool/cretstrm.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "cretstrm.hxx"
-#include <tools/debug.hxx>
-#include "rcontrol.hxx"
-#include "svcommstream.hxx"
-
-
-SV_IMPL_REF(SbxBase)
-
-CRetStream::CRetStream(SvStream *pIn)
-{
- pSammel = pIn;
- delete pCommStream;
- pCommStream = new SvCommStream( pSammel );
-}
-
-CRetStream::~CRetStream()
-{
- delete pCommStream;
-}
-
-void CRetStream::Read ( String &aString )
-{
- comm_UniChar* pStr;
- sal_uInt16 nLenInChars;
- CmdBaseStream::Read( pStr, nLenInChars );
-
- aString = String( pStr, nLenInChars );
- delete [] pStr;
-}
-
-void CRetStream::Read( SbxValue &aValue )
-{
- *pSammel >> nId;
- if (nId != BinSbxValue)
- {
- OSL_TRACE( "Falscher Typ im Stream: Erwartet SbxValue, gefunden :%hu", nId );
- }
- SbxBaseRef xBase = SbxBase::Load( *pSammel );
- if ( IS_TYPE( SbxValue, xBase ) )
- aValue = *PTR_CAST( SbxValue, &xBase );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/cretstrm.hxx b/automation/source/testtool/cretstrm.hxx
deleted file mode 100644
index 9f1385dae540..000000000000
--- a/automation/source/testtool/cretstrm.hxx
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _CRETSTRM_HXX
-#define _CRETSTRM_HXX
-
-#include <tools/stream.hxx>
-#include <basic/sbxvar.hxx>
-
-#include "cmdbasestream.hxx"
-
-class CRetStream : public CmdBaseStream
-{
- SvStream *pSammel;
- sal_uInt16 nId;
-
-public:
- CRetStream( SvStream *pIn );
- ~CRetStream();
-
- using CmdBaseStream::Read;
- void Read ( comm_UINT16 &nNr ){CmdBaseStream::Read ( nNr );}
- void Read ( comm_UINT32 &nNr ){CmdBaseStream::Read ( nNr );}
- virtual void Read ( rtl::OString* &pId ){CmdBaseStream::Read ( pId );}
- void Read ( comm_BOOL &bBool ){CmdBaseStream::Read ( bBool );}
- void Read( String &aString );
- void Read( SbxValue &aValue );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/filter.pl b/automation/source/testtool/filter.pl
deleted file mode 100644
index 825c379440d0..000000000000
--- a/automation/source/testtool/filter.pl
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/perl
-#*************************************************************************
-#*
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#************************************************************************/
-
-$debug = "";
-$ctrue = 1;
-$cfalse = 0;
-# reads a block
-# Parameter: FileHandle
-# list of Regular Expressions which terminate the block.
-# for '#ifdef' block would then be ("^#else\$", "^#endif\$")
-
-sub read_block {
-
- local($file) = @_;
- print "reading block '$file' ",scalar(@_),"\n" if $debug;
- while ( <$file> ) {
- chop;
- s/\s*$//; # remove trailing whitespaces
- s/^\s*//; # remove leading whitespaces
- print "Input : \"$_\"\n" if $debug;
- s/\/\/.*//; # Remove line comment
- s/\/\*.*?\*\///g; # remove comments within one line
- s/\s+/ /g; # Change all whitespace into a single blank
- s/ *$//; # Remove whitespace at end
- s/^# /#/; # Change # <command> to #<command>
-
-
- @line = split(/ /,$_,3);
-
- $_ = $line[0];
- if ( $_ && /^#/ ) { # Line starts with '#' -> preprocessor command
- print "proccessing line: @line\n" if $debug;
- if (/#define/)
- {
- if ( $line[1] =~ /^$namefilter/ )
- {
- $mykey = $line[1];
- $mykey =~ s/^$namefilter//;
- $count += 1;
- print OUT "$mykey ", $line[2], "\n";
- print OUT2 "\t{ \"$mykey\", ", $line[2] ," },\n";
- }
- }
- }
- }
- print "Leaving read_block at the end\n" if $debug;
-}
-
-# Read a file.
-# first parameter ist the filename
-sub read_file {
-
- local ($filename,$file) = @_;
- $file++; # String increment
- local $TempFileName = $basename."/".$filename;
- print "reading file $TempFileName as $file\n" if $debug;
- open($file, $TempFileName) || die "error: Could not open file $TempFileName. ";
-
- &read_block($file); # read data
- close($file);
- print "done reading $filename\n" if $debug;
-}
-
-# main starts here
-
-$basename = ".";
-$basename = $ARGV[0] if defined($ARGV[0]);
-
-$filename = "app.hrc";
-$filename = $ARGV[1] if defined($ARGV[1]);
-
-
-$outfilebase = $filename;
-$outfilebase =~ s/\.[^.]+$//; # cut off suffix
-$outfilebase = $ARGV[2] if defined($ARGV[2]);
-
-
-$namefilter = $ARGV[3] if defined($ARGV[3]);
-
-
-print "Generating $outfilebase:\n" if $debug;
-
-$count = 0;
-
-open(OUT,">$outfilebase");
-open(OUT2,">$outfilebase.hxx");
-print OUT2 "\{\n";
-
-&read_file ($filename,"f00");
-
-print OUT2 "\t{ \"\" ,0 }\n\};\n";
-
-close(OUT);
-close(OUT2);
-
-if ( $count == 0 )
-{
- die "Error: No Entries Found generating \"$outfilebase.hxx\". Testtool will not work!"
-}
-
diff --git a/automation/source/testtool/httprequest.cxx b/automation/source/testtool/httprequest.cxx
deleted file mode 100644
index e52be94ff6c9..000000000000
--- a/automation/source/testtool/httprequest.cxx
+++ /dev/null
@@ -1,218 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include <stdio.h>
-#include "httprequest.hxx"
-#include <osl/socket.hxx>
-#include <tools/debug.hxx>
-
-
-void HttpRequest::Init()
-{
- nResultId = 0;
- aHeader = rtl::OString();
- aContentType = rtl::OString();
- delete pStream;
- pStream = NULL;
-}
-
-HttpRequest::HttpRequest()
- : nStatus(HTTP_INIT), pOutSocket(NULL),
- nResultId(0), pStream(NULL)
-{
-}
-
-HttpRequest::~HttpRequest()
-{
- delete pStream;
- delete pOutSocket;
-}
-
-void HttpRequest::SetRequest( rtl::OString aHost, rtl::OString aPath, sal_uInt16 nPort )
-{
- nStatus = HTTP_REQUEST_SET;
- Init();
- aRequestHost = aHost;
- aRequestPath = aPath;
- nRequestPort = nPort;
-}
-
-void HttpRequest::SetProxy( rtl::OString aHost, sal_uInt16 nPort )
-{
- nStatus = HTTP_REQUEST_SET;
- Init();
- aProxyHost = aHost;
- nProxyPort = nPort;
-}
-
-sal_Bool HttpRequest::Execute()
-{
- nStatus = HTTP_REQUEST_PENDING;
- Init();
-
- // Open channel to standard redir host
- osl::SocketAddr aConnectAddr;
-
- if ( aProxyHost.getLength() )
- {
- aConnectAddr = osl::SocketAddr( rtl::OStringToOUString( aProxyHost, RTL_TEXTENCODING_UTF8 ), nProxyPort );
- }
- else
- {
- aConnectAddr = osl::SocketAddr( rtl::OStringToOUString( aRequestHost, RTL_TEXTENCODING_UTF8 ), nRequestPort );
- }
-
- TimeValue aTV;
- aTV.Seconds = 10; // wait for 10 seconds
- aTV.Nanosec = 0;
-
- pOutSocket = new osl::ConnectorSocket();
- if ( pOutSocket->connect( aConnectAddr, &aTV ) != osl_Socket_Ok )
- {
- delete pOutSocket;
- pOutSocket = NULL;
- nStatus = HTTP_REQUEST_ERROR;
- return sal_False;
- }
-
- SendString( pOutSocket, "GET " );
- if ( aProxyHost.getLength() )
- {
- //GET http://staroffice-doc.germany.sun.com/cgi-bin/htdig/binarycopy.sh?CopyIt=++CopyIt++ HTTP/1.0
- SendString( pOutSocket, "http://" );
- SendString( pOutSocket, aRequestHost );
- SendString( pOutSocket, ":" );
- SendString( pOutSocket, rtl::OString::valueOf( (sal_Int32) nRequestPort ) );
- SendString( pOutSocket, aRequestPath );
- SendString( pOutSocket, " HTTP/1.0\n" );
-
- SendString( pOutSocket, "Proxy-Connection: Keep-Alive\n" );
- }
- else
- {
- //GET /cgi-bin/htdig/binarycopy.sh?CopyIt=++CopyIt++ HTTP/1.0
- SendString( pOutSocket, aRequestPath );
- SendString( pOutSocket, " HTTP/1.0\n" );
-
- SendString( pOutSocket, "Connection: Keep-Alive\n" );
- }
-
- SendString( pOutSocket, "User-Agent: Mozilla/4.7 [de] (Linux; I)" );
- SendString( pOutSocket, "Host: " );
- SendString( pOutSocket, aRequestHost );
- // Terminate with empty line
- SendString( pOutSocket, "\n\n" );
-
-
-
-#define BUFFRE_SIZE 0x10000 // 64K Buffer
- char* pBuffer = new char[ BUFFRE_SIZE ];
-
- sal_Bool bWasError = ( nStatus != HTTP_REQUEST_PENDING );
-
- sal_uLong nDataRead;
- pStream = new SvMemoryStream( 0x10000, 0x10000 );
- while ( !bWasError )
- {
- bWasError |= ( BUFFRE_SIZE != ( nDataRead = pOutSocket->read( pBuffer, BUFFRE_SIZE ) ) );
-
- pStream->Write( pBuffer, nDataRead );
- }
-
- delete [] pBuffer;
- pOutSocket->shutdown();
- pOutSocket->close();
-
- pStream->Seek( 0 );
-
- rtl::OString aLine;
- sal_Bool bInsideHeader = sal_True;
- sal_Int32 nIndex;
- while ( bInsideHeader )
- {
- pStream->ReadLine( aLine );
- if ( !aLine.getLength() )
- bInsideHeader = sal_False;
- else
- {
- if ( IsItem( "HTTP/", aLine ) ) {
- nIndex = 0;
- nResultId = (sal_uInt16)aLine.getToken( (sal_Int32)1, ' ', nIndex ).toInt32();
- }
- if ( IsItem( "Content-Type:", aLine ) )
- {
- aContentType = aLine.copy( 13 );
- aContentType.trim();
- }
- aHeader += aLine;
- aHeader += "\n";
- }
- }
-
- if ( nStatus == HTTP_REQUEST_PENDING )
- {
- nStatus = HTTP_REQUEST_DONE;
- return sal_True;
- }
- else
- {
- nStatus = HTTP_REQUEST_ERROR;
- return sal_False;
- }
-}
-/*
-HTTP/1.1 200 OK
-Date: Tue, 22 Jan 2002 14:16:20 GMT
-Server: Apache/1.3.14 (Unix) (SuSE/Linux) mod_throttle/3.0 mod_layout/1.0 mod_f
-astcgi/2.2.2 mod_jk
-Set-Cookie2: JSESSIONID=ffkpgb7tm1;Version=1;Discard;Path="/bugtracker"
-Set-Cookie: JSESSIONID=ffkpgb7tm1;Path=/bugtracker
-Servlet-Engine: Tomcat Web Server/3.2.1 (JSP 1.1; Servlet 2.2; Java 1.3.0; Linux
- 2.4.0-4GB i386; java.vendor=Sun Microsystems Inc.)
-Connection: close
-Content-Type: text/xml; charset=ISO-8859-1
- */
-void HttpRequest::SendString( osl::StreamSocket* pSocket , rtl::OString aText )
-{
- if ( nStatus == HTTP_REQUEST_PENDING )
- pSocket->write( aText.getStr(), aText.getLength() );
-}
-
-sal_Bool HttpRequest::IsItem( rtl::OString aItem, rtl::OString aLine )
-{
- return aItem.match( aLine );
-}
-
-
-SvMemoryStream* HttpRequest::GetBody()
-{
- return pStream;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/httprequest.hxx b/automation/source/testtool/httprequest.hxx
deleted file mode 100644
index a8f333718db5..000000000000
--- a/automation/source/testtool/httprequest.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _HTTPREQUEST_HXX_
-#define _HTTPREQUEST_HXX_
-
-#define HTTP_INIT 0
-#define HTTP_REQUEST_SET 1
-#define HTTP_REQUEST_PENDING 2
-#define HTTP_REQUEST_DONE 3
-#define HTTP_REQUEST_ERROR 4
-
-#include <tools/stream.hxx>
-#include <rtl/string.hxx>
-
-namespace osl
-{
- class StreamSocket;
- class ConnectorSocket;
-}
-
-class HttpRequest
-{
- rtl::OString aRequestPath;
- rtl::OString aRequestHost;
- sal_uInt16 nRequestPort;
- rtl::OString aProxyHost;
- sal_uInt16 nProxyPort;
-
- sal_uInt16 nStatus;
- osl::ConnectorSocket *pOutSocket;
-
- rtl::OString aHeader;
- sal_uInt16 nResultId;
- rtl::OString aContentType;
- SvMemoryStream* pStream;
-
- void SendString( osl::StreamSocket* pSocket, ::rtl::OString aText );
- sal_Bool IsItem( rtl::OString aItem, rtl::OString aLine );
- void Init();
-public:
- HttpRequest();
- ~HttpRequest();
-
- void SetRequest( rtl::OString aHost, rtl::OString aPath, sal_uInt16 nPort );
- void SetProxy( rtl::OString aHost, sal_uInt16 nPort );
-
- sal_Bool Execute();
-
- rtl::OString GetHeader() const { return aHeader; }
- SvMemoryStream* GetBody();
-
- rtl::OString GetContentType() const { return aContentType; }
- sal_uInt16 GetResultId() const { return nResultId; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/objtest.cxx b/automation/source/testtool/objtest.cxx
deleted file mode 100644
index ff8745d6ab71..000000000000
--- a/automation/source/testtool/objtest.cxx
+++ /dev/null
@@ -1,3762 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "sysdir_win.hxx"
-#include "registry_win.hxx"
-#include "ittresid.hxx"
-#include <osl/file.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/sound.hxx>
-#include <tools/config.hxx>
-#include <vcl/svapp.hxx>
-#include <svtools/stringtransfer.hxx>
-#include <svl/brdcst.hxx>
-#include <basic/sbx.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
-#include <com/sun/star/bridge/XBridgeFactory.hpp>
-#include <com/sun/star/connection/XConnector.hpp>
-#include <com/sun/star/connection/XConnection.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
-
-#include <cppuhelper/servicefactory.hxx>
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::frame;
-using namespace com::sun::star::bridge;
-using namespace com::sun::star::connection;
-
-using ::rtl::OUString;
-
-#include <svtools/svmedit.hxx>
-
-#ifdef UNX
-#include <unistd.h> // readlink
-#include <errno.h>
-#endif
-
-#include <basic/sbuno.hxx>
-
-#include <basic/basicrt.hxx>
-#include <basic/ttstrhlp.hxx>
-#include "tcommuni.hxx"
-#include "comm_bas.hxx"
-#include <cretstrm.hxx>
-
-#include "objtest.hxx"
-#include "rcontrol.hxx"
-
-#include <basic/testtool.hrc>
-#include <basic/ttmsg.hrc>
-
-#include <basic/mybasic.hxx>
-#include <basic/testtool.hxx>
-#include <basic/sbstar.hxx>
-
-#include <algorithm>
-
-#ifndef SBX_VALUE_DECL_DEFINED
-#define SBX_VALUE_DECL_DEFINED
-SV_DECL_REF(SbxValue)
-#endif
-SV_IMPL_REF(SbxValue)
-
-static CommunicationFactory aComManFac;
-
-#define cMyDelim ' '
-#define P_FEHLERLISTE pFehlerListe
-#define KEEP_SEQUENCES 100 // Keep Names of last 100 Calls
-
-
-ControlDefLoad const Controls::arClasses [] =
-#include "classes.hxx"
-CNames *Controls::pClasses = NULL;
-
-ControlDefLoad const TestToolObj::arR_Cmds [] =
-#include "r_cmds.hxx"
-CNames *TestToolObj::pRCommands = NULL;
-CErrors *TestToolObj::pFehlerListe = NULL; // the errors from the testtool are stored here
-
-
-DBG_NAME( ControlItem )
-DBG_NAME( ControlDef )
-
-ControlItem::ControlItem( const sal_Char *Name, rtl::OString aUIdP )
-{
-DBG_CTOR(ControlItem,0);
- InitData();
- pData->Kurzname.AssignAscii( Name );
- pData->aUId = aUIdP;
-}
-
-ControlItem::ControlItem( const String &Name, rtl::OString aUIdP )
-{
-DBG_CTOR(ControlItem,0);
- InitData();
- pData->Kurzname = Name;
- pData->aUId = aUIdP;
-}
-
-ControlSon::~ControlSon()
-{
- if (pSons)
- {
- delete pSons;
- pSons = NULL;
- }
-}
-
-ControlItemSon::ControlItemSon(const String &Name, rtl::OString aUIdP )
-: ControlItem( Name, aUIdP )
-{}
-
-sal_Bool ControlDef::operator < (const ControlItem &rPar)
-{
- return pData->Kurzname.CompareIgnoreCaseToAscii(rPar.pData->Kurzname) == COMPARE_LESS;
-}
-
-sal_Bool ControlDef::operator == (const ControlItem &rPar)
-{
- return pData->Kurzname.CompareIgnoreCaseToAscii(rPar.pData->Kurzname) == COMPARE_EQUAL;
-}
-
-void ControlDef::Write( SvStream &aStream )
-{
- // FIXME: HELPID
- (void)aStream;
-}
-
-ControlDef::ControlDef(const String &Name, rtl::OString aUIdP )
-: ControlItemSon( Name, aUIdP)
-{
- DBG_CTOR(ControlDef,0);
-}
-
-ControlDef::ControlDef(const String &aOldName, const String &aNewName, ControlDef *pOriginal, sal_Bool bWithSons )
-: ControlItemSon("", pOriginal->pData->aUId)
-{
- DBG_CTOR(ControlDef,0);
- if ( pOriginal->pData->Kurzname == aOldName )
- pData->Kurzname = aNewName;
- else
- pData->Kurzname = pOriginal->pData->Kurzname;
-
- if ( bWithSons && pOriginal->pSons )
- {
- pSons = new CNames();
- for ( sal_uInt16 i = 0; i < pOriginal->pSons->Count() ; i++)
- {
- ControlDef *pNewDef;
- pNewDef = new ControlDef( aOldName, aNewName, pOriginal->SonGetObject(i) ,sal_True );
- if (! SonInsert(pNewDef))
- {
- OSL_FAIL("Name Doppelt im CopyConstructor. Neuer Name = Controlname!!");
- delete pNewDef;
- }
- }
-
- }
- else
- pSons = NULL;
-}
-
-sal_Bool ControlItemUId::operator < (const ControlItem &rPar)
-{
- return pData->aUId < rPar.pData->aUId;
-}
-
-sal_Bool ControlItemUId::operator == (const ControlItem &rPar)
-{
- return pData->aUId == rPar.pData->aUId;
-}
-
-SV_IMPL_OP_PTRARR_SORT( CNames, ControlItem* )
-
-void CRevNames::Insert( String aName, rtl::OString aUId, sal_uLong nSeq )
-{
- ControlItem *pRN = new ReverseName(aName,aUId,nSeq);
- sal_uInt16 nPos;
- if ( Seek_Entry(pRN,&nPos) )
- DeleteAndDestroy(nPos);
-
- if ( !CNames::C40_PTR_INSERT( ControlItem, pRN) )
- {
- OSL_FAIL("Interner Fehler beim Speichern der Lokalen KurzNamen");
- delete pRN;
- }
-
-}
-
-String CRevNames::GetName( rtl::OString aUId )
-{
- ReverseName *pRN = new ReverseName(UniString(),aUId,0);
- sal_uInt16 nPos;
- sal_Bool bSeekOK = Seek_Entry(pRN,&nPos);
-
- delete pRN;
- if ( bSeekOK )
- return GetObject(nPos)->pData->Kurzname;
- else
- {
- // FIXME: HELPID
- return String();
- }
-}
-
-void CRevNames::Invalidate ( sal_uLong nSeq )
-{
- sal_uInt16 i;
- for (i = 0; i < Count() ;)
- {
- if (((ReverseName*)GetObject(i))->LastSequence < nSeq)
- DeleteAndDestroy(i);
- else
- i++;
- }
-}
-
-
-SV_IMPL_PTRARR(CErrors, ErrorEntry*)
-
-
-SbxTransportMethod::SbxTransportMethod( SbxDataType DT )
-: SbxMethod(CUniString("Dummy"),DT)
-{
- nValue = 0;
-}
-
-
-TestToolObj::TestToolObj( String aName, MyBasic* pBas ) // call in the testtool
-: SbxObject( aName )
-, bUseIPC(sal_True)
-, bReturnOK(sal_True)
-, nSequence(KEEP_SEQUENCES)
-, ProgPath()
-, IsBlock(sal_False)
-, SingleCommandBlock(sal_True)
-, m_pControls(NULL)
-, m_pNameKontext(NULL)
-, m_pSIds(NULL)
-, m_pReverseSlots(NULL)
-, m_pReverseControls(NULL)
-, m_pReverseControlsSon(NULL)
-, m_pReverseUIds(NULL)
-, pCommunicationManager(NULL)
-, aDialogHandlerName()
-, nWindowHandlerCallLevel(0)
-, nIdleCount(0)
-{
- pImpl = new ImplTestToolObj;
- pImpl->ProgParam = String();
- pImpl->bIsStart = sal_False;
- pImpl->pMyBasic = pBas;
-
- LoadIniFile();
- InitTestToolObj();
-
- pCommunicationManager = new CommunicationManagerClientViaSocketTT();
- pCommunicationManager->SetDataReceivedHdl( LINK( this, TestToolObj, ReturnResultsLink ));
-}
-
-void TestToolObj::LoadIniFile()
-{
-#define GETSET(aVar, KeyName, Dafault) \
- { \
- ByteString __##aVar##__; \
- __##aVar##__ = aConf.ReadKey(KeyName); \
- if ( !__##aVar##__.Len() ) \
- { \
- __##aVar##__ = Dafault; \
- aConf.WriteKey(KeyName, __##aVar##__); \
- } \
- aVar = UniString( __##aVar##__, RTL_TEXTENCODING_UTF8 );\
- }
-
-#define NEWOLD( NewKey, OldKey ) \
- { \
- rtl::OString aValue; \
- if ( ( (aValue = aConf.ReadKey( OldKey )).getLength() ) && !aConf.ReadKey( NewKey ).getLength() ) \
- aConf.WriteKey( NewKey, aValue ); \
- }
-
-
- Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
- aConf.SetGroup("Misc");
- ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" );
- aConf.SetGroup( aCurrentProfile );
-
- NEWOLD( "BaseDir", "Basisverzeichnis" )
- String aFB;
- GETSET( aFB, "BaseDir", "" );
- pImpl->aFileBase = DirEntry(aFB);
-
- // remove old keys
- if ( aConf.ReadKey("KeyCodes + Classes").getLength() != 0 ||
- aConf.ReadKey("KeyCodes + Classes + Res_Type").getLength() != 0 )
- {
- aConf.DeleteKey("KeyCodes + Classes + Res_Type");
- aConf.DeleteKey("KeyCodes + Classes");
- }
-
- NEWOLD( "LogBaseDir", "LogBasisverzeichnis" )
- String aLFB;
- GETSET( aLFB, "LogBaseDir", rtl::OUStringToOString(aFB, RTL_TEXTENCODING_UTF8) );
- pImpl->aLogFileBase = DirEntry(aLFB);
-
- NEWOLD( "HIDDir", "HIDVerzeichnis" )
- String aHID;
- GETSET( aHID, "HIDDir", "" );
- pImpl->aHIDDir = DirEntry(aHID);
-
-
- aConf.SetGroup("Misc");
-
- String aST;
- GETSET( aST, "ServerTimeout", rtl::OString::valueOf(Time(0,0,45).GetTime()) ); // 45 seconds initial
- pImpl->aServerTimeout = Time(sal_uLong(aST.ToInt64()));
-
- String aSOSE;
- aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Misc" );
- aConf.SetGroup( aCurrentProfile );
- GETSET( aSOSE, "StopOnSyntaxError", "0" );
- pImpl->bStopOnSyntaxError = aSOSE.EqualsAscii("1");
-
-
- aConf.SetGroup("GUI Platform");
-
-// #i68804# Write default Communication section to testtoolrc/.ini
-// this is not fastest but too keep defaultsettings in one place in the code
- GetHostConfig();
- GetTTPortConfig();
- GetUnoPortConfig();
-
- aConf.SetGroup("Crashreporter");
-
- String aUP;
- GETSET( aUP, "UseProxy", "false" );
- String aPS;
- GETSET( aPS, "ProxyServer", "" );
- String aPP;
- GETSET( aPP, "ProxyPort", "" );
- String aAC;
- GETSET( aAC, "AllowContact", "false" );
- String aRA;
- GETSET( aRA, "ReturnAddress", "" );
-
- OUString sPath;
- if( osl_getExecutableFile( (rtl_uString**)&sPath ) == osl_Process_E_None)
- {
- sPath = sPath.copy(7); // strip file://
-
- int i = sPath.lastIndexOf('/');
- if (i >= 0)
- i = sPath.lastIndexOf('/', i-1 );
-
- if (i >= 0)
- {
- sPath = sPath.copy(0, i);
- ByteString bsPath( rtl::OUStringToOString(sPath,
- RTL_TEXTENCODING_UTF8) );
-
- aConf.SetGroup( "OOoProgramDir" );
- String aOPD;
- // testtool is installed in Basis3.x/program/ dir nowadays
- bsPath += "/../program";
- GETSET( aOPD, "Current", bsPath);
-
- ByteString aSrcRoot(getenv("SRC_ROOT"));
- aConf.SetGroup( "_profile_Default" );
- if (aSrcRoot.Len())
- {
- String aPBD;
- aSrcRoot += "/testautomation";
- GETSET( aPBD, "BaseDir", aSrcRoot );
-
- String aPHD;
- aSrcRoot += "/global/hid";
- GETSET( aPHD, "HIDDir", aSrcRoot );
- }
- else
- {
- String aPBD;
- bsPath += "/qatesttool";
- GETSET( aPBD, "BaseDir", bsPath );
-
- String aPHD;
- bsPath += "/global/hid";
- GETSET( aPHD, "HIDDir", bsPath );
- }
-
- String aLD;
- GETSET( aLD, "LogBaseDir", ByteString( "/tmp" ) );
- }
- }
-}
-
-#define MAKE_TT_KEYWORD( cName, aType, aResultType, nID ) \
-{ \
- SbxVariableRef pMeth; \
- pMeth = Make( CUniString(cName), aType, aResultType ); \
- pMeth->SetUserData( nID ); \
-}
-
-// SetUserData must be something, it will be filtered out later otherwise!!!
-#define MAKE_USHORT_CONSTANT(cName, nValue) \
- { \
- SbxProperty *pVal = new SbxProperty( CUniString( cName) , SbxINTEGER ); \
- pVal->PutInteger( nValue ) ; \
- pVal->SetUserData( 32000 ); \
- Insert( pVal ); \
- }
-
-#define RTLNAME "@SBRTL" // copied from basic/source/classes/sb.cxx
-
-void TestToolObj::InitTestToolObj()
-{
- pImpl->nNumBorders = 0; // for profiling with boxes
-
- pImpl->nMinRemoteCommandDelay = 0;
- pImpl->nMaxRemoteCommandDelay = 0;
- pImpl->bDoRemoteCommandDelay = sal_False;
-
- pImpl->bLnaguageExtensionLoaded= sal_False;
- pImpl->pTTSfxBroadcaster = NULL;
-
- pImpl->nErrorCount = 0;
- pImpl->nWarningCount = 0;
- pImpl->nQAErrorCount = 0;
- pImpl->nIncludeFileWarningCount = 0;
-
- pImpl->xErrorList = new SbxDimArray( SbxSTRING );
- pImpl->xWarningList = new SbxDimArray( SbxSTRING );
- pImpl->xQAErrorList = new SbxDimArray( SbxSTRING );
- pImpl->xIncludeFileWarningList = new SbxDimArray( SbxSTRING );
-
- pImpl->nTestCaseLineNr = 0;
-
- pImpl->bEnableQaErrors = sal_True;
- pImpl->bDebugFindNoErrors = sal_False;
-
- pImpl->pChildEnv = new Environment;
-
- if (!pFehlerListe)
- pFehlerListe = new CErrors;
-
- In = new CmdStream();
-
- pShortNames = new CRevNames;
-
- pImpl->pHttpRequest = NULL;
-
-// overwrite standard "wait" method, cause we can do better than that!!
-// Insert Object into SbiStdObject but change listening.
- SbxVariable* pRTL = pImpl->pMyBasic->Find( CUniString(RTLNAME), SbxCLASS_DONTCARE );
- SbxObject* pRTLObject = PTR_CAST( SbxObject, pRTL );
- if ( pRTLObject )
- {
- SbxVariableRef pWait;
- pWait = pRTLObject->Make( CUniString("Wait"), SbxCLASS_METHOD, SbxNULL );
- pWait->SetUserData( ID_Wait );
- // change listener here
- pRTLObject->EndListening( pWait->GetBroadcaster(), sal_True );
- StartListening( pWait->GetBroadcaster(), sal_True );
- }
- else
- {
- OSL_FAIL("Testtool: Could not replace Wait method");
- }
-
- MAKE_TT_KEYWORD( "Kontext", SbxCLASS_METHOD, SbxNULL, ID_Kontext );
- MAKE_TT_KEYWORD( "GetNextError", SbxCLASS_VARIABLE, SbxVARIANT, ID_GetError );
- MAKE_TT_KEYWORD( "Start", SbxCLASS_METHOD, SbxSTRING, ID_Start );
- MAKE_TT_KEYWORD( "Use", SbxCLASS_METHOD, SbxNULL, ID_Use );
- MAKE_TT_KEYWORD( "StartUse", SbxCLASS_METHOD, SbxNULL, ID_StartUse );
- MAKE_TT_KEYWORD( "FinishUse", SbxCLASS_METHOD, SbxNULL, ID_FinishUse );
-
- MAKE_TT_KEYWORD( "CaseLog", SbxCLASS_METHOD, SbxNULL, ID_CaseLog );
- MAKE_TT_KEYWORD( "ExceptLog", SbxCLASS_METHOD, SbxNULL, ID_ExceptLog );
- MAKE_TT_KEYWORD( "PrintLog", SbxCLASS_METHOD, SbxNULL, ID_PrintLog );
- MAKE_TT_KEYWORD( "WarnLog", SbxCLASS_METHOD, SbxNULL, ID_WarnLog );
- MAKE_TT_KEYWORD( "ErrorLog", SbxCLASS_METHOD, SbxNULL, ID_ErrorLog );
- MAKE_TT_KEYWORD( "QAErrorLog", SbxCLASS_METHOD, SbxNULL, ID_QAErrorLog );
- MAKE_TT_KEYWORD( "EnableQaErrors", SbxCLASS_PROPERTY, SbxBOOL, ID_EnableQaErrors );
- MAKE_TT_KEYWORD( "MaybeAddErr", SbxCLASS_METHOD, SbxNULL, ID_MaybeAddErr );
- MAKE_TT_KEYWORD( "ClearError", SbxCLASS_METHOD, SbxNULL, ID_ClearError );
- MAKE_TT_KEYWORD( "SaveIDs", SbxCLASS_METHOD, SbxBOOL, ID_SaveIDs );
- MAKE_TT_KEYWORD( "AutoExecute", SbxCLASS_PROPERTY, SbxBOOL, ID_AutoExecute ); // Attention! PROPERTY therefore a variable
- MAKE_TT_KEYWORD( "Execute", SbxCLASS_METHOD, SbxNULL, ID_Execute );
- MAKE_TT_KEYWORD( "StopOnSyntaxError", SbxCLASS_PROPERTY, SbxBOOL, ID_StopOnSyntaxError );
-
-/* Dialog Handler are needed for dialogues in the internal testtool.
- remote commands the IdleHandler is activated. It tests whether the
- reschedule returns to WaitForAnswer. If this is not the case, the
- RemoteHandler is resetted and then the Handler-Sub is called in the
- basic (uncoupled by PostUserEvent).
-
- In returndaten_verarbeiten flag after flag is resetted for the execution
- of the next remote command. The Handler is devalued too then.
- So it counts for the next remote command only.
-*/
- MAKE_TT_KEYWORD( "DialogHandler", SbxCLASS_METHOD, SbxNULL, ID_DialogHandler );
-
- MAKE_TT_KEYWORD( "GetUnoApp", SbxCLASS_METHOD, SbxOBJECT, ID_GetUnoApp );
- MAKE_TT_KEYWORD( "GetIServer", SbxCLASS_METHOD, SbxOBJECT, ID_GetIServer );
-
- MAKE_TT_KEYWORD( "RemoteCommandDelay", SbxCLASS_METHOD, SbxNULL, ID_RemoteCommandDelay );
-
- MAKE_TT_KEYWORD( "GetApplicationPath", SbxCLASS_METHOD, SbxSTRING, ID_GetApplicationPath );
- MAKE_TT_KEYWORD( "GetCommonApplicationPath", SbxCLASS_METHOD, SbxSTRING, ID_GetCommonApplicationPath );
- MAKE_TT_KEYWORD( "MakeIniFileName", SbxCLASS_METHOD, SbxSTRING, ID_MakeIniFileName );
-
-/// active constants returning error and warning count
- MAKE_TT_KEYWORD( "GetErrorCount", SbxCLASS_METHOD, SbxULONG, ID_GetErrorCount );
- MAKE_TT_KEYWORD( "GetWarningCount", SbxCLASS_METHOD, SbxULONG, ID_GetWarningCount );
- MAKE_TT_KEYWORD( "GetQAErrorCount", SbxCLASS_METHOD, SbxULONG, ID_GetQAErrorCount );
- MAKE_TT_KEYWORD( "GetUseFileWarningCount", SbxCLASS_METHOD, SbxULONG, ID_GetUseFileWarningCount );
-
- MAKE_TT_KEYWORD( "GetErrorList", SbxCLASS_METHOD, SbxOBJECT, ID_GetErrorList );
- MAKE_TT_KEYWORD( "GetWarningList", SbxCLASS_METHOD, SbxOBJECT, ID_GetWarningList );
- MAKE_TT_KEYWORD( "GetQAErrorList", SbxCLASS_METHOD, SbxOBJECT, ID_GetQAErrorList );
- MAKE_TT_KEYWORD( "GetUseFileWarningList", SbxCLASS_METHOD, SbxOBJECT, ID_GetUseFileWarningList );
-
- MAKE_TT_KEYWORD( "GetTestCaseName", SbxCLASS_METHOD, SbxSTRING, ID_GetTestCaseName );
- MAKE_TT_KEYWORD( "GetTestCaseFileName", SbxCLASS_METHOD, SbxSTRING, ID_GetTestCaseFileName );
- MAKE_TT_KEYWORD( "GetTestCaseLineNr", SbxCLASS_METHOD, SbxUSHORT, ID_GetTestCaseLineNr );
-
- MAKE_TT_KEYWORD( "SetChildEnv", SbxCLASS_METHOD, SbxNULL, ID_SetChildEnv );
- MAKE_TT_KEYWORD( "GetChildEnv", SbxCLASS_METHOD, SbxSTRING, ID_GetChildEnv );
-
- MAKE_TT_KEYWORD( "GetLinkDestination", SbxCLASS_METHOD, SbxSTRING, ID_GetLinkDestination );
- MAKE_TT_KEYWORD( "GetRegistryValue", SbxCLASS_METHOD, SbxSTRING, ID_GetRegistryValue );
-
- MAKE_TT_KEYWORD( "KillApp", SbxCLASS_METHOD, SbxNULL, ID_KillApp );
-
- MAKE_TT_KEYWORD( "HTTPSend", SbxCLASS_METHOD, SbxUSHORT, ID_HTTPSend );
- MAKE_TT_KEYWORD( "HTTPSetProxy", SbxCLASS_METHOD, SbxNULL, ID_HTTPSetProxy );
-
- // Load the Remote Commands from list
- if ( !pRCommands ) // is static and called only once therefore
- ReadFlatArray( arR_Cmds, pRCommands );
- sal_uInt16 i;
- for ( i = 0 ; i < pRCommands->Count() ; i++ )
- {
- SbxTransportMethod *pMeth = new SbxTransportMethod( SbxVARIANT );
- pMeth->SetName( pRCommands->GetObject( i )->pData->Kurzname );
- pMeth->SetUserData( ID_RemoteCommand );
- // FIXME: HELPID
- pMeth->nValue = 0;
- Insert( pMeth );
- StartListening( pMeth->GetBroadcaster(), sal_True );
- }
-
-// constants for SetControlType
- MAKE_USHORT_CONSTANT("CTBrowseBox",CONST_CTBrowseBox);
- MAKE_USHORT_CONSTANT("CTValueSet",CONST_CTValueSet);
-
-// constants for the alignment of the requested splitter
- MAKE_USHORT_CONSTANT("AlignLeft",CONST_ALIGN_LEFT);
- MAKE_USHORT_CONSTANT("AlignTop",CONST_ALIGN_TOP);
- MAKE_USHORT_CONSTANT("AlignRight",CONST_ALIGN_RIGHT);
- MAKE_USHORT_CONSTANT("AlignBottom",CONST_ALIGN_BOTTOM);
-
-/// What dialog to use in RC_CloseSysDialog or RC_ExistsSysDialog
- MAKE_USHORT_CONSTANT("FilePicker",CONST_FilePicker);
- MAKE_USHORT_CONSTANT("FolderPicker",CONST_FolderPicker);
-
-/// NodeTypes of the SAX Parser
- MAKE_USHORT_CONSTANT("NodeTypeCharacter",CONST_NodeTypeCharacter);
- MAKE_USHORT_CONSTANT("NodeTypeElement",CONST_NodeTypeElement);
- MAKE_USHORT_CONSTANT("NodeTypeComment",CONST_NodeTypeComment);
-
-
-/// ItemTypes for TreeListBox and maybe others
- MAKE_USHORT_CONSTANT("ItemTypeText",CONST_ItemTypeText);
- MAKE_USHORT_CONSTANT("ItemTypeBMP",CONST_ItemTypeBMP);
- MAKE_USHORT_CONSTANT("ItemTypeCheckbox",CONST_ItemTypeCheckbox);
- MAKE_USHORT_CONSTANT("ItemTypeContextBMP",CONST_ItemTypeContextBMP);
- MAKE_USHORT_CONSTANT("ItemTypeUnknown",CONST_ItemTypeUnknown);
-
-
-/// Return values for WaitSlot
- MAKE_USHORT_CONSTANT("WSTimeout",CONST_WSTimeout);
- MAKE_USHORT_CONSTANT("WSAborted",CONST_WSAborted);
- MAKE_USHORT_CONSTANT("WSFinished",CONST_WSFinished);
-
-
- pImpl->pControlsObj = new Controls( CUniString("GetNextCloseWindow") );
- pImpl->pControlsObj->SetType( SbxVARIANT );
- Insert( pImpl->pControlsObj );
- pImpl->pControlsObj->SetUserData( ID_GetNextCloseWindow );
- pImpl->pControlsObj->ChangeListener( this );
-
- for ( i=0;i<VAR_POOL_SIZE;i++)
- {
- pImpl->pMyVars[i] = new SbxTransportMethod( SbxVARIANT );
- pImpl->pMyVars[i]->SetName( CUniString("VarDummy").Append(String::CreateFromInt32(i) ) );
-
- Insert( pImpl->pMyVars[i] );
- }
-
- m_pControls = new CNames();
- m_pSIds = new CNames();
- m_pNameKontext = m_pControls;
-
- nMyVar = 0;
-
- pImpl->pMyBasic->AddFactory( &aComManFac );
-}
-
-
-TestToolObj::~TestToolObj()
-{
- pImpl->pMyBasic->RemoveFactory( &aComManFac );
- EndListening( ((StarBASIC*)GetParent())->GetBroadcaster() );
- pImpl->pNextReturn.Clear();
-
- pImpl->pControlsObj.Clear();
-
- for ( int i = 0 ; i < VAR_POOL_SIZE ; i++ )
- {
- pImpl->pMyVars[i].Clear();
- }
-
- delete m_pControls;
- delete m_pReverseSlots;
- delete m_pReverseControls;
- delete m_pReverseControlsSon;
- delete m_pReverseUIds;
- delete m_pSIds;
-
- if (pFehlerListe)
- {
- delete pFehlerListe;
- pFehlerListe = NULL; // because pFehlerListe is static!!
- }
-
- if ( pCommunicationManager )
- {
- pCommunicationManager->StopCommunication();
- delete pCommunicationManager;
- }
-
- delete In;
- delete pImpl->pTTSfxBroadcaster;
- delete pImpl->pHttpRequest;
- delete pImpl->pChildEnv;
-
- pImpl->xErrorList.Clear();
- pImpl->xWarningList.Clear();
- pImpl->xQAErrorList.Clear();
- pImpl->xIncludeFileWarningList.Clear();
-
- delete pImpl;
-
- delete pShortNames;
-}
-
-SfxBroadcaster& TestToolObj::GetTTBroadcaster()
-{
- if ( !pImpl->pTTSfxBroadcaster )
- pImpl->pTTSfxBroadcaster = new SfxBroadcaster;
- return *pImpl->pTTSfxBroadcaster;
-}
-
-void TestToolObj::ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, sal_Bool bIsFlat )
-{
-/*******************************************************************************
-**
-** the following file extensions are available:
-**
-** hid.lst long name UId
-** *.sid Slot Ids short name long name file is flat
-** *.win Controlname long name file with *name and +name notation
-**
-**
-*******************************************************************************/
-
-
- SvFileStream Stream;
- String aLine,aShortname,aLongname;
- rtl::OString aUId;
- xub_StrLen nLineNr;
- sal_uInt16 nElement;
- ControlDef *pNewDef, *pNewDef2;
- ControlDef *pFatherDef = NULL;
-
- nLineNr = 0;
-
- if (! pUIds)
- {
- String aFileName = (pImpl->aHIDDir + DirEntry(CUniString("hid.lst"))).GetFull();
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_LONGNAMES)), aFileName );
- GetTTBroadcaster().Broadcast( aHint );
- }
- ReadFlat( aFileName ,pUIds, sal_True );
- if ( !pUIds )
- return;
- pNewDef = new ControlDef("Active",rtl::OString());
- const ControlItem *pItem = pNewDef;
- if (! pUIds->Insert(pItem))
- {
- ADD_WARNING_LOG2( GEN_RES_STR1c( S_DOUBLE_NAME, "Active" ), Filename, nLineNr );
- delete pNewDef;
- }
-
- }
-
- ADD_MESSAGE_LOG( Filename );
-
- Stream.Open(Filename, STREAM_STD_READ);
- if (!Stream.IsOpen())
- {
- ADD_ERROR(ERR_NO_FILE,GEN_RES_STR1(S_CANNOT_OPEN_FILE, Filename));
- return;
- }
-
- if ( bIsFlat && !pNames )
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_SLOT_IDS)), Filename );
- GetTTBroadcaster().Broadcast( aHint );
- }
- else
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_CONTROLS)), Filename );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- if ( !pNames )
- pNames = new CNames();
-
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_ENTERWAIT );
- GetTTBroadcaster().Broadcast( aHint );
- }
- while (!Stream.IsEof())
- {
- nLineNr++;
-
- Stream.ReadByteStringLine(aLine, RTL_TEXTENCODING_IBM_850);
- aLine.EraseLeadingChars();
- aLine.EraseTrailingChars();
- while ( aLine.SearchAscii(" ") != STRING_NOTFOUND )
- aLine.SearchAndReplaceAllAscii(" ",UniString(' '));
- if (aLine.Len() == 0) continue;
- if (aLine.Copy(0,4).CompareIgnoreCaseToAscii("Rem ") == COMPARE_EQUAL) continue;
- if (aLine.Copy(0,1).CompareToAscii("'") == COMPARE_EQUAL) continue;
-
- if ( (aLine.GetTokenCount(cMyDelim) < 2 || aLine.GetTokenCount(cMyDelim) > 3) && aLine.CompareIgnoreCaseToAscii("*Active") != COMPARE_EQUAL )
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_INVALID_LINE, aLine ), Filename, nLineNr );
- continue;
- }
-
- aShortname = aLine.GetToken(0,cMyDelim);
- aLongname = aLine.GetToken(1,cMyDelim);
-
- String aFirstAllowedExtra, aAllowed;
- aFirstAllowedExtra.AssignAscii("+*");
- aAllowed.AssignAscii("_");
- xub_StrLen nIndex = 0;
- sal_Bool bOK = sal_True;
-
- while ( bOK && nIndex < aShortname.Len() )
- {
- sal_Unicode aChar = aShortname.GetChar( nIndex );
- sal_Bool bOKThis = sal_False;
- bOKThis |= ( aAllowed.Search( aChar ) != STRING_NOTFOUND );
- if ( !nIndex )
- bOKThis |= ( aFirstAllowedExtra.Search( aChar ) != STRING_NOTFOUND );
- bOKThis |= ( aChar >= 'A' && aChar <= 'Z' );
- bOKThis |= ( aChar >= 'a' && aChar <= 'z' );
- bOKThis |= ( aChar >= '0' && aChar <= '9' );
-
- bOK &= bOKThis;
- nIndex++;
- }
- if ( !bOK )
- {
- ADD_WARNING_LOG2( CUniString("Zeile \"").Append(aLine).AppendAscii("\" enth�lt ung�ltige Zeichen."), Filename, nLineNr );
- continue;
- }
-
- sal_Bool bUnoName = ( aLongname.Copy( 0, 5 ).EqualsIgnoreCaseAscii( ".uno:" )
- || aLongname.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "http" )
- || aLongname.Copy( 0, 15 ).EqualsIgnoreCaseAscii( "private:factory" )
- || aLongname.Copy( 0, 8 ).EqualsIgnoreCaseAscii( "service:" )
- || aLongname.Copy( 0, 6 ).EqualsIgnoreCaseAscii( "macro:" )
- || aLongname.Copy( 0, 8 ).EqualsIgnoreCaseAscii( ".HelpId:" ) );
- // generic method to mark longnames as symbolic
- if ( aLongname.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "sym:" ) )
- {
- bUnoName = sal_True;
- aLongname.Erase( 0, 4 );
- }
- sal_Bool bMozillaName = ( !bIsFlat && aLongname.Copy( 0, 4 ).EqualsIgnoreCaseAscii( ".moz" ) );
-
- if ( aShortname.GetChar(0) == '+' ) // copy complete entry
- {
- aShortname.Erase(0,1);
- ControlDef WhatName(aLongname,rtl::OString());
- ControlDef *OldTree;
- if (pNames->Seek_Entry(&WhatName,&nElement))
- {
- OldTree = (ControlDef*)pNames->GetObject(nElement);
- pNewDef = new ControlDef(aLongname,aShortname,OldTree,sal_True);
-
- const ControlItem *pItem = pNewDef;
- if (! pNames->Insert(pItem))
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr );
- delete pNewDef;
- pFatherDef = NULL;
- }
- else
- {
- pFatherDef = pNewDef;
- }
- }
- else
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_SHORTNAME_UNKNOWN, aLine ), Filename, nLineNr );
- continue;
- }
-
- }
- else
- {
- // FIXME: HELPID
- if ( !bUnoName && !bMozillaName )
- { // get the ID from the Hid.Lst
- ControlDef WhatName(aLongname,rtl::OString());
- if (pUIds->Seek_Entry(&WhatName,&nElement))
- aUId = pUIds->GetObject(nElement)->pData->aUId;
- else
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_LONGNAME_UNKNOWN, aLine ), Filename, nLineNr );
- continue;
- }
- }
- else
- {
- // FIXME: HELPID
- }
- if (aShortname.GetChar(0) == '*' || bIsFlat) // global short name (dialogue name or SId)
- {
- if (!bIsFlat)
- aShortname.Erase(0,1);
- pNewDef = new ControlDef(aShortname,aUId);
- if (!bIsFlat)
- {
- pNewDef->Sons( new CNames() );
- pNewDef2 = new ControlDef(aShortname,aUId);
- if (!pNewDef->SonInsert( pNewDef2 )) // enter dialogue into its own namespace
- {
- delete pNewDef2;
- OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen in leere Liste!");
- }
- }
- const ControlItem *pItem = pNewDef;
- if (! pNames->Insert(pItem))
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr );
- delete pNewDef;
- pFatherDef = NULL;
- }
- else
- {
- pFatherDef = pNewDef;
- }
- }
- else
- {
- if (!pFatherDef)
- {
- ADD_WARNING_LOG2( GEN_RES_STR0( S_FIRST_SHORTNAME_REQ_ASTRX ), Filename, nLineNr );
- }
- else
- {
- pNewDef = new ControlDef(aShortname,aUId);
- if (! pFatherDef->SonInsert(pNewDef))
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr );
- delete pNewDef;
- }
- }
- }
- }
- GetpApp()->Reschedule();
- }
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_LEAVEWAIT );
- GetTTBroadcaster().Broadcast( aHint );
- }
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- Stream.Close();
-}
-
-void TestToolObj::AddName(String &aBisher, String &aNeu )
-{
- String aSl( '/' );
- if ( UniString(aSl).Append(aBisher).Append(aSl).ToUpperAscii().Search( UniString(aSl).Append(aNeu).Append(aSl).ToUpperAscii() ) == STRING_NOTFOUND )
- {
- aBisher += aSl;
- aBisher += aNeu;
- }
-}
-
-void TestToolObj::ReadFlat( String Filename, CNames *&pNames, sal_Bool bSortByName )
-// if bSortByName == sal_False, sort by UId (ControlItemUId instead of ControlDef)
-{
- SvFileStream Stream;
- String aLine,aLongname;
- rtl::OString aUId;
- xub_StrLen nLineNr;
- ControlItem *pNewItem;
- sal_uInt16 nDoubleCount = 0;
-
- Stream.Open(Filename, STREAM_STD_READ);
-
- if (!Stream.IsOpen())
- {
- ADD_ERROR(ERR_NO_FILE,GEN_RES_STR1(S_CANNOT_OPEN_FILE, Filename));
- return;
- }
-
- nLineNr = 0;
-
- if ( !pNames )
- pNames = new CNames();
-
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_ENTERWAIT );
- GetTTBroadcaster().Broadcast( aHint );
- }
- ADD_MESSAGE_LOG( Filename );
- while (!Stream.IsEof())
- {
- nLineNr++;
- Stream.ReadByteStringLine(aLine, RTL_TEXTENCODING_IBM_850);
- aLine.EraseLeadingChars();
- aLine.EraseTrailingChars();
- while ( aLine.SearchAscii(" ") != STRING_NOTFOUND )
- aLine.SearchAndReplaceAllAscii(" ",UniString(' '));
- if (aLine.Len() == 0)
- continue;
-
- if ( (aLine.GetTokenCount(cMyDelim) < 2 || aLine.GetTokenCount(cMyDelim) > 3) && aLine.CompareIgnoreCaseToAscii("*Active") != COMPARE_EQUAL )
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_INVALID_LINE, aLine ), Filename, nLineNr );
- continue;
- }
-
- aLongname = aLine.GetToken(0,cMyDelim);
- // FIXME: HELPID
- aUId = rtl::OUStringToOString( aLine.GetToken(1,cMyDelim), RTL_TEXTENCODING_UTF8 );
-
- if ( bSortByName )
- pNewItem = new ControlDef( aLongname, aUId );
- else
- pNewItem = new ControlItemUId( aLongname, aUId );
- if ( !pNames->C40_PTR_INSERT( ControlItem, pNewItem ) )
- {
- if ( bSortByName )
- {
- if ( nDoubleCount++ < 10 )
- {
- ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr );
- }
- }
- else
- {
- sal_uInt16 nNr;
- pNames->Seek_Entry( pNewItem, &nNr );
- AddName( pNames->GetObject(nNr)->pData->Kurzname, pNewItem->pData->Kurzname );
- }
- delete pNewItem;
- }
- GetpApp()->Reschedule();
- }
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_LEAVEWAIT );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- Stream.Close();
-}
-
-void ReadFlatArray( const ControlDefLoad arWas [], CNames *&pNames )
-{
- sal_uInt16 nIndex = 0;
-
- if ( !pNames )
- pNames = new CNames();
-
- while ( String::CreateFromAscii(arWas[nIndex].Kurzname).Len() > 0 )
- {
- // FIXME: HELPID
- rtl::OString aUId;// (arWas[nIndex].nUId);
- const ControlItem *pX = new ControlDef( arWas[nIndex].Kurzname, aUId);
- pNames->C40_PTR_INSERT(ControlItem, pX);
- nIndex++;
- }
-}
-
-void TestToolObj::WaitForAnswer ()
-{
- if ( bUseIPC )
- {
- sal_Bool bWasRealWait = !bReturnOK;
- BasicRuntime aRun( NULL );
- if ( BasicRuntimeAccess::HasRuntime() )
- aRun = BasicRuntimeAccess::GetRuntime();
-
- // this timer to terminate Yield below
- Timer aTimer;
- aTimer.SetTimeout( pImpl->aServerTimeout.GetMSFromTime() );
- aTimer.Start();
- while ( !bReturnOK && aTimer.IsActive() && pCommunicationManager->IsCommunicationRunning()
- && aRun.IsValid() && aRun.IsRun() )
- {
- GetpApp()->Yield();
- if ( BasicRuntimeAccess::HasRuntime() )
- aRun = BasicRuntimeAccess::GetRuntime();
- else
- aRun = BasicRuntime( NULL );
- }
- if ( bWasRealWait && aDialogHandlerName.Len() > 0 )
- CallDialogHandler(GetpApp());
- }
- else
- {
- Time Ende( Time::SYSTEM );
-
- Ende += pImpl->aServerTimeout;
- SvStream *pTemp = NULL;
-
- while ( !bReturnOK && Ende > Time( Time::SYSTEM ) )
- {
- if ( pTemp )
- {
- ReturnResults( pTemp );
- bReturnOK = sal_True;
- }
- else
- {
- GetpApp()->Reschedule();
- }
- nIdleCount = 0;
- }
- }
-
- if ( !bReturnOK )
- {
- ADD_ERROR(ERR_EXEC_TIMEOUT,GEN_RES_STR1(S_TIMOUT_WAITING, String::CreateFromInt64(nSequence)));
- bReturnOK = sal_True;
- nSequence++;
- }
-}
-
-
-IMPL_LINK( TestToolObj, IdleHdl, Application*, EMPTYARG )
-{
- if ( !bReturnOK )
- nIdleCount++;
- if ( nIdleCount > 10 ) // means been here for 10 times already and none of these in WaitForAnswer
- {
- GetpApp()->RemoveIdleHdl( LINK( this, TestToolObj, IdleHdl ) );
- GetpApp()->PostUserEvent( LINK( this, TestToolObj, CallDialogHandler ) );
- }
- return 0;
-}
-
-IMPL_LINK( TestToolObj, CallDialogHandler, Application*, EMPTYARG )
-{
- nWindowHandlerCallLevel++;
- String aHandlerName(aDialogHandlerName);
- aDialogHandlerName.Erase();
-
- sal_uLong nRememberSequence = nSequence;
- ((StarBASIC*)GetParent())->Call( aHandlerName );
- nSequence = nRememberSequence;
-
- nWindowHandlerCallLevel--;
- return 0;
-}
-
-
-void TestToolObj::BeginBlock()
-{
- WaitForAnswer();
- if ( IsError() )
- return;
-
- DBG_ASSERT(!IsBlock,"BeginBlock innerhalb eines Blockes");
- In->Reset(nSequence);
- IsBlock = sal_True;
-}
-
-
-void TestToolObj::SendViaSocket()
-{
- if ( !pCommunicationManager )
- {
- OSL_FAIL("Kein CommunicationManager vorhanden!!");
- return;
- }
-
- if ( !pCommunicationManager->IsCommunicationRunning() )
- {
- // first try to run basic sub "startTheOffice" see i86540
- SbxVariable* pMeth = pImpl->pMyBasic->Find( CUniString( "startTheOffice" ), SbxCLASS_DONTCARE);
- if( !pImpl->bIsStart && pMeth && pMeth->ISA(SbxMethod) )
- {
- pImpl->pMyBasic->Call( CUniString( "startTheOffice" ) );
- }
- else
- {
- pImpl->pMyBasic->ResetError(); // reset error produced by failed Find above
- if ( !pCommunicationManager->StartCommunication( ProgPath, pImpl->ProgParam, pImpl->pChildEnv ) )
- {
- ADD_ERROR(ERR_RESTART_FAIL,GEN_RES_STR1(S_APPLICATION_START_FAILED, ProgPath));
- }
- else
- {
- if ( !pImpl->bIsStart )
- {
- ADD_ERROR(ERR_RESTART,GEN_RES_STR0(S_APPLICATION_RESTARTED));
- }
- }
- }
- }
-
- bReturnOK = sal_False;
- if ( pCommunicationManager->GetLastNewLink() )
- {
- if ( !pCommunicationManager->GetLastNewLink()->TransferDataStream( In->GetStream() ) )
- {
- ADD_ERROR(ERR_SEND_TIMEOUT,GEN_RES_STR1(S_TIMOUT_SENDING, String::CreateFromInt64(nSequence)));
- nSequence++;
- bReturnOK = sal_True; // no return to be expected
- }
- }
- else
- {
- ADD_ERROR(ERR_SEND_TIMEOUT,GEN_RES_STR1(S_NO_CONNECTION, String::CreateFromInt64(nSequence)));
- nSequence++;
- bReturnOK = sal_True;
- }
-
-}
-
-void TestToolObj::EndBlock()
-{
- if (IsBlock)
- {
- pImpl->LocalStarttime = Time::GetSystemTicks(); // setting the initial time for performance measuring
-
- In->GenCmdFlow (F_EndCommandBlock);
-
- if ( pImpl->bDoRemoteCommandDelay )
- {
- sal_uLong nTimeWait = pImpl->nMinRemoteCommandDelay;
- if ( pImpl->nMaxRemoteCommandDelay != pImpl->nMinRemoteCommandDelay )
- nTimeWait += Time::GetSystemTicks() % ( pImpl->nMaxRemoteCommandDelay - pImpl->nMinRemoteCommandDelay );
- Timer aTimer;
- aTimer.SetTimeout( nTimeWait );
- aTimer.Start();
- while ( aTimer.IsActive() && pCommunicationManager->IsCommunicationRunning() )
- {
- GetpApp()->Yield();
- }
- }
-
- if ( bUseIPC )
- SendViaSocket();
- else
- {
- bReturnOK = sal_False;
- if ( aDialogHandlerName.Len() > 0 )
- GetpApp()->InsertIdleHdl( LINK( this, TestToolObj, IdleHdl ), 1 );
- }
- IsBlock = sal_False;
- }
- else
- {
- OSL_FAIL("EndBlock au�erhalb eines Blockes");
- }
-}
-
-
-sal_Bool TestToolObj::Load( String aFileName, SbModule *pMod )
-{
- sal_Bool bOk = sal_True;
- SvFileStream aStrm( aFileName, STREAM_STD_READ );
- if( aStrm.IsOpen() )
- {
- String aText, aLine;
- sal_Bool bIsFirstLine = sal_True;
- rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850;
- while( !aStrm.IsEof() && bOk )
- {
- aStrm.ReadByteStringLine( aLine, aFileEncoding );
- if ( bIsFirstLine && IsTTSignatureForUnicodeTextfile( aLine ) )
- aFileEncoding = RTL_TEXTENCODING_UTF8;
- else
- {
- if ( !bIsFirstLine )
- aText += '\n';
- aText += aLine;
- bIsFirstLine = sal_False;
- }
- if( aStrm.GetError() != SVSTREAM_OK )
- bOk = sal_False;
- }
- aText.ConvertLineEnd();
- pMod->SetName(CUniString("--").Append(aFileName));
-
- pMod->SetComment( GetRevision( aText ) );
-
- SbModule* pOldModule = MyBasic::GetCompileModule();
- MyBasic::SetCompileModule( pMod );
-
- pMod->SetSource( PreCompile( aText ) );
-
- MyBasic::SetCompileModule( pOldModule );
- if ( WasPrecompilerError() )
- bOk = sal_False;
-
- }
- else
- bOk = sal_False;
- return bOk;
-}
-
-
-sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pControls )
-{
- SvFileStream aStream;
- String aName,aURL;
- rtl::OString aUId;
- ControlDef *pNewDef, *pNewDef2;
- ControlDef *pFatherDef = NULL;
-
-
- aStream.Open(Filename, STREAM_STD_READ);
- if (!aStream.IsOpen())
- {
- ADD_ERROR(ERR_NO_FILE,GEN_RES_STR1(S_CANNOT_OPEN_FILE, Filename));
- return sal_False;
- }
-
- if ( !pSIds )
- pSIds = new CNames();
- if ( !pControls )
- pControls = new CNames();
-
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_ENTERWAIT );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- sal_uInt16 nAnz;
- aStream >> nAnz;
- CNames *pNames = pSIds; // first read all the slots
- sal_Bool bIsFlat = sal_True; // Slots do not have children
-
- while ( nAnz && !aStream.IsEof() )
- {
-
- aStream.ReadByteString( aName, RTL_TEXTENCODING_UTF8 );
-
- sal_uInt16 nType;
- aStream >> nType;
- if ( !nType /* HasNumeric() */)
- {
- String aStrId;
- aStream.ReadByteString( aStrId, RTL_TEXTENCODING_UTF8 );
- // FIXME: HELPID
- }
- else
- {
- comm_UINT32 nUId;
- aStream >> nUId;
- aUId = rtl::OString();// nUId;
- }
-
- if (aName.GetChar(0) == '*' || bIsFlat ) // global short name (dialogue name or SId)
- {
- if (!bIsFlat)
- aName.Erase(0,1);
- pNewDef = new ControlDef(aName,aUId);
-
- if (!bIsFlat)
- {
- pNewDef->Sons(new CNames());
- pNewDef2 = new ControlDef(aName,aUId);
- if (!pNewDef->SonInsert(pNewDef2)) // enter dialogue into its own namespace
- {
- delete pNewDef2;
- OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen in leere Liste!");
- }
- }
-
- const ControlItem *pItem = pNewDef;
- if (! pNames->Insert(pItem))
- {
- OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen eines namens!");
- delete pNewDef;
- pFatherDef = NULL;
- }
- else
- {
- pFatherDef = pNewDef;
- }
- }
- else
- {
- if (!pFatherDef)
- {
- OSL_FAIL( "Internal Error: Erster Kurzname mu� mit * beginnen. �berspringe." );
- }
- else
- {
- pNewDef = new ControlDef(aName,aUId);
- if (! pFatherDef->SonInsert(pNewDef))
- {
- delete pNewDef;
- OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen eines namens!");
- }
- }
- }
- nAnz--;
- if ( !nAnz && bIsFlat ) // We have read all slots
- {
- aStream >> nAnz;
- pNames = pControls; // Now read the controls
- bIsFlat = sal_False; // Controls *do* have children
- }
- GetpApp()->Reschedule();
- }
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_LEAVEWAIT );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- aStream.Close();
- return sal_True;
-}
-
-
-sal_Bool TestToolObj::WriteNamesBin( String Filename, CNames *pSIds, CNames *pControls )
-{
- sal_Bool bOk = sal_True;
- SvFileStream aStrm( String(Filename).AppendAscii(".bin"), STREAM_STD_WRITE );
- if( aStrm.IsOpen() )
- {
- sal_uInt16 i;
- if ( pSIds )
- {
- aStrm << pSIds->Count();
- for ( i = 0 ; pSIds->Count() > i && bOk ; i++ )
- {
- ((ControlDef*)(*pSIds)[i])->Write(aStrm);
- if( aStrm.GetError() != SVSTREAM_OK )
- bOk = sal_False;
- }
- }
- else
- aStrm << sal_uInt16( 0 );
-
- if ( pControls )
- {
- aStrm << pControls->Count();
- for ( i = 0 ; pControls->Count() > i && bOk ; i++ )
- {
- ((ControlDef*)(*pControls)[i])->Write(aStrm);
- if( aStrm.GetError() != SVSTREAM_OK )
- bOk = sal_False;
- }
- }
- else
- aStrm << sal_uInt16( 0 );
- }
- else
- bOk = sal_False;
- return bOk;
-}
-
-
-void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
- const SfxHint& rHint, const TypeId& )
-{
- static CNames *pUIds = NULL; // hold the hid.lst
-
- const SbxHint* p = PTR_CAST(SbxHint,&rHint);
- if( p )
- {
- SbxVariable* pVar = p->GetVar();
- SbxArray* rPar = pVar->GetParameters();
-
- sal_uLong nHintId = p->GetId();
- sal_uLong nHintUserData = pVar->GetUserData();
- if( nHintId == SBX_HINT_DATAWANTED )
- {
- nMyVar = 0;
- switch( nHintUserData )
- {
- case ID_Kontext:
- if ( !rPar )
- {
- m_pNameKontext = m_pControls;
-
-
- for (sal_uInt16 i=0;i<VAR_POOL_SIZE;i++)
- {
- pImpl->pMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) );
- }
- }
- else if ( rPar && rPar->Count() == 2 )
- {
- sal_uInt16 nElement;
- SbxVariableRef pArg = rPar->Get( 1 );
- String aKontext = pArg->GetString();
- ControlDef WhatName(aKontext,rtl::OString());
- if (m_pControls && m_pControls->Seek_Entry(&WhatName,&nElement))
- {
- m_pNameKontext = ((ControlDef*)m_pControls->GetObject(nElement))->GetSons();
-
-
- for (sal_uInt16 i=0;i<VAR_POOL_SIZE;i++)
- {
- pImpl->pMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) );
- }
- }
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_Start:
- if ( rPar && rPar->Count() >= 2 )
- {
- SbxVariableRef pArg = rPar->Get( 1 );
- ProgPath = pArg->GetString();
- if ( rPar && rPar->Count() >= 3 )
- {
- pArg = rPar->Get( 2 );
- pImpl->ProgParam = pArg->GetString();
- }
- else
- pImpl->ProgParam.Erase();
-
- String aTmpStr(ProgPath);
- aTmpStr += ' ';
- aTmpStr += pImpl->ProgParam;
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_STARTING_APPLICATION)), aTmpStr );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- pImpl->bIsStart = sal_True;
- BeginBlock();
- EndBlock();
- pImpl->bIsStart = sal_False;
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION );
- GetTTBroadcaster().Broadcast( aHint );
- }
- }
- break;
- case ID_KillApp:
- pCommunicationManager->KillApplication();
- break;
- case ID_SaveIDs:
- if ( rPar && rPar->Count() >= 2 ) // one parameter excactly
- {
- SbxVariableRef pArg = rPar->Get( 1 );
- #if defined(WNT)
- DirEntry FilePath = pImpl->aFileBase + DirEntry(pArg->GetString(),FSYS_STYLE_NTFS);
- #else
- DirEntry FilePath = pImpl->aFileBase + DirEntry(pArg->GetString(),FSYS_STYLE_UNX);
- #endif
- WriteNamesBin( FilePath.GetFull(), m_pSIds, m_pControls );
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_AutoExecute:
- if ( !rPar ) // rPar = NULL <=> no parameters
- {
- pVar->PutBool(SingleCommandBlock);
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_Execute:
- if ( !rPar )
- {
- EndBlock();
- BeginBlock();
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_DialogHandler:
- if ( rPar && rPar->Count() >= 2 )
- {
- SbxVariableRef pArg = rPar->Get( 1 );
- aDialogHandlerName = pArg->GetString();
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_GetError:
- if ( !rPar )
- {
- WaitForAnswer();
- if ( IS_ERROR() )
- {
- pVar->PutString( GET_ERROR()->aText );
- POP_ERROR();
- }
- else
- {
- pVar->PutString( String() );
- }
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_StartUse:
- if ( !rPar )
- {
- {
- BasicRuntime aRun = BasicRuntimeAccess::GetRuntime();
- aLogFileName = DirEntry(aRun.GetModuleName(SbxNAME_NONE)).GetBase().AppendAscii(".res");
- }
-
- ADD_RUN_LOG();
- ADD_CASE_LOG(GEN_RES_STR0(S_READING_FILE));
-
- pCommunicationManager->StopCommunication();
- // Wait for asynchronous events to be processed, so communication will be restarted properly
- while ( pCommunicationManager->IsCommunicationRunning() )
- Application::Reschedule();
-
- SingleCommandBlock = sal_True;
- IsBlock = sal_False;
-
- for (sal_uInt16 i=0;i<VAR_POOL_SIZE;i++)
- {
- pImpl->pMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) );
- }
- nMyVar = 0;
-
- if (m_pControls)
- {
- delete m_pControls;
- m_pControls = NULL;
- }
- if (m_pReverseSlots)
- {
- delete m_pReverseSlots;
- m_pReverseSlots = NULL;
- }
- if (m_pReverseControls)
- {
- delete m_pReverseControls;
- m_pReverseControls = NULL;
- }
- if (m_pReverseControlsSon)
- {
- delete m_pReverseControlsSon;
- m_pReverseControlsSon = NULL;
- }
- if (m_pSIds)
- {
- delete m_pSIds;
- m_pSIds = NULL;
- }
- if (pUIds)
- {
- delete pUIds;
- pUIds = NULL;
- }
- if (m_pReverseUIds)
- {
- delete m_pReverseUIds;
- m_pReverseUIds = NULL;
- }
- m_pNameKontext = m_pControls;
- pImpl->bLnaguageExtensionLoaded = sal_False;
- SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED );
- GetTTBroadcaster().Broadcast( aHint );
-
- pImpl->nMinRemoteCommandDelay = 0;
- pImpl->nMaxRemoteCommandDelay = 0;
- pImpl->bDoRemoteCommandDelay = sal_False;
- pImpl->aTestCaseName.Erase();
- pImpl->aTestCaseFileName.Erase();
- pImpl->nTestCaseLineNr = 0;
-
- pImpl->bEnableQaErrors = sal_True;
- pImpl->bDebugFindNoErrors = sal_False;
-
- pImpl->pChildEnv->clear();
-
- String aName( CUniString( "StopOnSyntaxError" ) );
- SbxVariableRef xStopOnSyntaxError = SbxObject::Find( aName, SbxCLASS_PROPERTY );
- if ( xStopOnSyntaxError.Is() )
- xStopOnSyntaxError->PutBool( pImpl->bStopOnSyntaxError );
- else
- SetError( SbxERR_BAD_ACTION );
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_Use:
- if ( rPar && rPar->Count() >= 2 )
- {
- SbxVariableRef pArg = rPar->Get( 1 );
- #if defined(WNT)
- DirEntry FilePath(pArg->GetString(),FSYS_STYLE_NTFS);
- #else
- DirEntry FilePath(pArg->GetString(),FSYS_STYLE_UNX);
- #endif
- if ( !FilePath.IsAbs() )
- FilePath = pImpl->aFileBase + FilePath;
- String Ext = FilePath.GetExtension();
- if ( Ext.CompareIgnoreCaseToAscii("Win") == COMPARE_EQUAL )
- {
- ReadNames( FilePath.GetFull(),m_pControls,pUIds);
- pImpl->bLnaguageExtensionLoaded = sal_True;
- SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED );
- GetTTBroadcaster().Broadcast( aHint );
- }
- else if ( Ext.CompareIgnoreCaseToAscii("Sid") == COMPARE_EQUAL )
- {
- ReadNames( FilePath.GetFull(),m_pSIds,pUIds,FLAT);
- pImpl->bLnaguageExtensionLoaded = sal_True;
- SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED );
- GetTTBroadcaster().Broadcast( aHint );
- }
- else if ( Ext.CompareIgnoreCaseToAscii("Bin") == COMPARE_EQUAL )
- {
- ReadNamesBin( FilePath.GetFull(), m_pSIds, m_pControls );
- pImpl->bLnaguageExtensionLoaded = sal_True;
- SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED );
- GetTTBroadcaster().Broadcast( aHint );
- }
- else if ( Ext.CompareIgnoreCaseToAscii("Inc") == COMPARE_EQUAL )
- {
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_BASIC_MODULE)), FilePath.GetFull() );
- GetTTBroadcaster().Broadcast( aHint );
- }
- String aFullPathname = FilePath.GetFull();
- StarBASIC *pBasic = (StarBASIC*)GetParent();
- if ( !aModuleWinExistsHdl.Call( &aFullPathname ) &&
- !pBasic->FindModule( CUniString( "--" ).Append(aFullPathname) ) )
- {
- SbModule *pMod;
- pMod = pBasic->MakeModule( CUniString("--"), String() );
- pMod->Clear();
- if ( Load( aFullPathname, pMod ) )
- {
- if ( !IS_ERROR() )
- {
- pBasic->Compile( pMod );
- pMod->RunInit();
- }
- }
- else
- {
- ADD_ERROR( SbxERR_CANNOT_LOAD, FilePath.GetFull() );
- }
- }
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION );
- GetTTBroadcaster().Broadcast( aHint );
- }
- }
- else
- {
- ADD_ERROR(SbxERR_CANNOT_LOAD,FilePath.GetFull());
- }
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_FinishUse:
- if ( !rPar )
- {
- ADD_CASE_LOG( String() ); // close case
- if (!m_pControls)
- m_pControls = new CNames();
-
- if (!m_pSIds)
- m_pSIds = new CNames();
-
- if (pUIds)
- { // save some memory
- delete pUIds;
- pUIds = NULL;
- }
-
- m_pNameKontext = m_pControls;
-
- if ( pImpl->bLnaguageExtensionLoaded )
- {
- SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- pImpl->nIncludeFileWarningCount = pImpl->nWarningCount;
- pImpl->nWarningCount = 0;
-
- *pImpl->xIncludeFileWarningList = *pImpl->xWarningList;
- pImpl->xWarningList->SbxArray::Clear();
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_CaseLog:
- if ( rPar ) // rPar != NULL <=> there are parameters
- {
- sal_uInt16 n;
- String aX;
- for ( n = 1; n < rPar->Count(); n++ )
- {
- SbxVariableRef pArg = rPar->Get( n );
- aX += pArg->GetString();
- }
- pImpl->aTestCaseName = aX;
- if ( pImpl->aTestCaseName.Len() && BasicRuntimeAccess::HasRuntime() )
- {
- BasicRuntime aRun = BasicRuntimeAccess::GetRuntime();
- pImpl->aTestCaseFileName = aRun.GetModuleName(SbxNAME_SHORT_TYPES);
- if ( pImpl->aTestCaseFileName.Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL )
- pImpl->aTestCaseFileName.Erase(0,2);
- pImpl->nTestCaseLineNr = aRun.GetLine();
- }
- else
- {
- pImpl->aTestCaseFileName.Erase();
- pImpl->nTestCaseLineNr = 0;
- }
- ADD_CASE_LOG( aX );
- }
- break;
- case ID_ExceptLog:
- if ( IS_ERROR() )
- {
- BasicRuntime aRun = BasicRuntimeAccess::GetRuntime();
- sal_Bool bWasNewError = sal_False;
-
- if ( BasicRuntimeAccess::HasStack() )
- {
- for ( sal_uInt16 i = 0 ; i < BasicRuntimeAccess::GetStackEntryCount() -1 ; i++ )
- {
- BasicErrorStackEntry aThisEntry = BasicRuntimeAccess::GetStackEntry(i);
- if ( !bWasNewError )
- {
- bWasNewError = sal_True;
- ADD_ERROR_LOG( GET_ERROR()->aText, aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES),
- aThisEntry.GetLine(), aThisEntry.GetCol1(), aThisEntry.GetCol2(), aThisEntry.GetSourceRevision() );
- }
- ADD_CALL_STACK_LOG( String(aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES))
- .AppendAscii(": ").Append(aThisEntry.GetMethodName(SbxNAME_SHORT_TYPES)),
- aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES),
- aThisEntry.GetLine(), aThisEntry.GetCol1(), aThisEntry.GetCol2() );
-
- }
- BasicRuntimeAccess::DeleteStack();
- }
-
- sal_Bool bIsFirst = sal_True;
- while ( aRun.IsValid() )
- {
- xub_StrLen nErrLn;
- xub_StrLen nCol1;
- xub_StrLen nCol2;
- if ( bIsFirst )
- {
- bIsFirst = sal_False;
- nErrLn = GET_ERROR()->nLine;
- nCol1 = GET_ERROR()->nCol1;
- nCol2 = GET_ERROR()->nCol2;
- }
- else
- {
- nErrLn = aRun.GetLine();
- nCol1 = aRun.GetCol1();
- nCol2 = aRun.GetCol2();
- }
-
- if ( !bWasNewError )
- {
- bWasNewError = sal_True;
- ADD_ERROR_LOG( GET_ERROR()->aText, aRun.GetModuleName(SbxNAME_SHORT_TYPES),
- nErrLn, nCol1, nCol2, aRun.GetSourceRevision() );
- }
- ADD_CALL_STACK_LOG( String(aRun.GetModuleName(SbxNAME_SHORT_TYPES))
- .AppendAscii(": ").Append(aRun.GetMethodName(SbxNAME_SHORT_TYPES)),
- aRun.GetModuleName(SbxNAME_SHORT_TYPES),
- nErrLn, nCol1, nCol2 );
- aRun = aRun.GetNextRuntime();
- }
- }
- break;
- case ID_ErrorLog:
- if ( IS_ERROR() )
- {
- BasicRuntime aRun = BasicRuntimeAccess::GetRuntime();
- if ( BasicRuntimeAccess::HasStack() )
- {
- BasicErrorStackEntry aThisEntry = BasicRuntimeAccess::GetStackEntry( 0 );
- ADD_ERROR_LOG( GET_ERROR()->aText, aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES),
- aThisEntry.GetLine(), aThisEntry.GetCol1(), aThisEntry.GetCol2(), aThisEntry.GetSourceRevision() );
- BasicRuntimeAccess::DeleteStack();
- }
- else
- {
- ADD_ERROR_LOG( GET_ERROR()->aText, aRun.GetModuleName(SbxNAME_SHORT_TYPES),
- StarBASIC::GetErl(), aRun.GetCol1(), aRun.GetCol2(), aRun.GetSourceRevision() );
- }
- }
- break;
- case ID_QAErrorLog:
- if ( rPar )
- {
- sal_uInt16 n;
- String aSammel;
- for ( n = 1; n < rPar->Count(); n++ )
- {
- SbxVariableRef pArg = rPar->Get( n );
- aSammel += pArg->GetString();
- }
- ADD_QA_ERROR_LOG( aSammel );
- }
- break;
- case ID_PrintLog:
- if ( rPar )
- {
- sal_uInt16 n;
- String aSammel;
- for ( n = 1; n < rPar->Count(); n++ )
- {
- SbxVariableRef pArg = rPar->Get( n );
- aSammel += pArg->GetString();
- }
- ADD_MESSAGE_LOG( aSammel );
- }
- break;
- case ID_WarnLog:
- if ( rPar )
- {
- sal_uInt16 n;
- String aSammel;
- for ( n = 1; n < rPar->Count(); n++ )
- {
- SbxVariableRef pArg = rPar->Get( n );
- aSammel += pArg->GetString();
- }
- ADD_WARNING_LOG( aSammel );
-
- }
- break;
- case ID_ClearError:
- while ( IS_ERROR() )
- {
- POP_ERROR();
- }
- break;
- case ID_MaybeAddErr:
- if ( ((StarBASIC*)GetParent())->GetErrBasic() && ( !IS_ERROR() ||
- pFehlerListe->GetObject(pFehlerListe->Count()-1)->nError != ((StarBASIC*)GetParent())->GetErrBasic() ) )
- {
- ((StarBASIC*)GetParent())->MakeErrorText(((StarBASIC*)GetParent())->GetErrBasic(),String());
- ADD_ERROR_QUIET(((StarBASIC*)GetParent())->GetErrBasic() , ((StarBASIC*)GetParent())->GetErrorText())
- }
- break;
- case ID_GetNextCloseWindow:
- if ( !rPar )
- {
- SetError( SbxERR_NOTIMP );
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_RemoteCommand:
- {
- if ( SingleCommandBlock )
- BeginBlock();
- else
- if ( ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN )
- {
- SetError( SbxERR_NOTIMP );
- }
- if ( !IsError() )
- In->GenCmdCommand ((sal_uInt16)(((SbxTransportMethod*)pVar)->nValue),rPar);
- if ( !IsError() && ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN )
- {
- pImpl->pNextReturn = ((SbxTransportMethod*)pVar);
- // FIXME: HELPID
- aNextReturnId = rtl::OString();
- }
- if ( SingleCommandBlock )
- EndBlock();
- if ( !IsError() && (sal_uInt16)((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN )
- {
- WaitForAnswer();
- }
-
- switch ( ((SbxTransportMethod*)pVar)->nValue )
- {
- case RC_WinTree:
- break;
- }
-
- }
- break;
- case ID_Dispatch:
- if ( !rPar || (rPar->Count() % 2) == 1 )
- {
- if ( SingleCommandBlock )
- BeginBlock();
- if ( !IsError() )
- In->GenCmdSlot ( (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar );
- pVar->PutInteger( (sal_uInt16)((SbxTransportMethod*)pVar)->nValue );
- if ( SingleCommandBlock )
- EndBlock();
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_UNODispatch:
- if ( !rPar )
- {
- if ( SingleCommandBlock )
- BeginBlock();
- if ( !IsError() )
- In->GenCmdUNOSlot ( ((SbxTransportMethod*)pVar)->aUnoSlot );
- pVar->PutString( ((SbxTransportMethod*)pVar)->aUnoSlot );
- if ( SingleCommandBlock )
- EndBlock();
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_Control:
- case ID_StringControl:
- // if only the object is given in the script we don't have to do anything (object stands for itself)
- if ( !pVar->ISA( SbxObject ) )
- {
- if ( SingleCommandBlock )
- BeginBlock();
- else
- if ( ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN )
- {
- SetError( SbxERR_NOTIMP );
- }
- if ( !IsError() )
- {
- SbxVariable *pMember = NULL;
- if ( pVar->GetParent() )
- pMember = pVar->GetParent()->Find(CUniString("ID"),SbxCLASS_DONTCARE);
- if ( pMember == NULL )
- {
- SetError( SbxERR_NAMED_NOT_FOUND );
- }
- else
- {
- if ( nHintUserData == ID_Control )
- {
- In->GenCmdControl (pMember->GetULong(),
- (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar);
- // FIXME: HELPID
- aNextReturnId = rtl::OString();
- }
- else
- {
- In->GenCmdControl (pMember->GetString(),
- (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar);
- // FIXME: HELPID
- }
- }
-
- if ( !IsError() && ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN )
- {
- pImpl->pNextReturn = ((SbxTransportMethod*)pVar);
- }
- else
- {
- pImpl->pNextReturn = NULL;
- aNextReturnId = rtl::OString();
- }
-
- }
- if ( SingleCommandBlock )
- EndBlock();
- if ( !IsError() && (sal_uInt16)((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN )
- {
- WaitForAnswer();
- }
- }
-
- break;
- case ID_GetUnoApp:
- {
- // the remote UNO stuff is started here
- // entry into the configuration at
- // org.openoffice.Office.Common/Start/Connection
- // socket,host=0,port=12345;iiop;XBla
- // or
- // socket,host=0,port=12345;urp;;XBla
-
- String aString;
- aString.AppendAscii( "socket,host=" );
- aString += GetHostConfig();
- aString.AppendAscii( ",port=" );
- aString += String::CreateFromInt32( GetUnoPortConfig() );
-
- Reference< XMultiServiceFactory > smgr_xMultiserviceFactory;
- try
- {
- Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory();
-
- OUString aURL( aString );
- Reference< XConnector > xConnector( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector") ) ), UNO_QUERY );
- Reference< XConnection > xConnection( xConnector->connect( aURL ) );
-
- Reference< XBridgeFactory > xBridgeFactory( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory") ) ), UNO_QUERY );
- Reference< XBridge > xBridge( xBridgeFactory->createBridge(
- OUString(), OUString( RTL_CONSTASCII_USTRINGPARAM("urp") ),
- xConnection, Reference< XInstanceProvider >() ) );
-
- Reference< XInterface > xRet( xBridge->getInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice.ServiceManager")) ) );
-
- smgr_xMultiserviceFactory = Reference< XMultiServiceFactory >(xRet, UNO_QUERY);
- // ask MBA!!
- }
- catch( class Exception & rEx)
- {
- ADD_ERROR(SbxERR_BAD_ACTION, String( rEx.Message ) );
- }
- catch( ... )
- {
- ADD_ERROR(SbxERR_BAD_ACTION, CUniString( "Unknown Error" ) );
- }
-
- if( smgr_xMultiserviceFactory.is() )
- {
- Any aAny;
- aAny <<= smgr_xMultiserviceFactory;
-
- SbxObjectRef xMySbxObj = GetSbUnoObject( CUniString("RemoteUnoAppFuerTesttool"), aAny );
- if ( xMySbxObj.Is() )
- pVar->PutObject( xMySbxObj );
- }
- }
- break;
- case ID_GetIServer:
- {
- // remote UNO stuff is started here
-
- String aString;
-
- Reference< XMultiServiceFactory > xSMgr;
- {
- xSMgr = ::cppu::createRegistryServiceFactory(OUString(RTL_CONSTASCII_USTRINGPARAM("g:\\iserverproxy.rdb")), sal_True);
- }
-
- OUString aURL( aString );
- Reference< XConnector > xConnector( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector") ) ), UNO_QUERY );
- Reference< XConnection > xConnection( xConnector->connect( OUString( RTL_CONSTASCII_USTRINGPARAM("socket,host=grande,port=7453")) ) );
-
- Reference< XBridgeFactory > xBridgeFactory( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory") ) ), UNO_QUERY );
- Reference< XBridge > xBridge( xBridgeFactory->createBridge(
- OUString(), OUString( RTL_CONSTASCII_USTRINGPARAM("urp") ),
- xConnection, Reference< XInstanceProvider >() ) );
-
- Reference< XInterface > xRet( xBridge->getInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("XIServerProxy")) ) );
-
-
- if( xRet.is() )
- {
- Any aAny;
- aAny <<= xRet;
-
- SbxObjectRef xMySbxObj = GetSbUnoObject( CUniString("IServerProxy"), aAny );
- if ( xMySbxObj.Is() )
- pVar->PutObject( xMySbxObj );
- }
- // In Basic:
- // msgbox dbg_SupportedInterfaces
- // msgbox dbg_Properties
- // msgbox dbg_Methods
- }
- break;
- case ID_RemoteCommandDelay:
- if ( rPar && rPar->Count() >= 2 && rPar->Count() <=3 )
- {
- switch (rPar->Get( 1 )->GetType())
- {
- case SbxLONG: // pass always everything as Short
- case SbxULONG:
- case SbxSALINT64:
- case SbxSALUINT64:
- case SbxDOUBLE:
- case SbxINTEGER:
- case SbxBYTE:
- case SbxUSHORT:
- case SbxINT:
- case SbxUINT:
- case SbxSINGLE:
- pImpl->nMinRemoteCommandDelay = rPar->Get( 1 )->GetULong();
- if ( rPar->Count() == 3 )
- pImpl->nMaxRemoteCommandDelay = rPar->Get( 2 )->GetULong();
- else
- pImpl->nMaxRemoteCommandDelay = pImpl->nMinRemoteCommandDelay;
- break;
- case SbxBOOL:
- pImpl->bDoRemoteCommandDelay = rPar->Get( 1 )->GetBool();
- break;
- default:
- SbxBase::SetError( SbxERR_WRONG_ARGS );
- break;
- }
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_GetApplicationPath:
- if ( !rPar )
- {
- OUString aUrl = Config::GetDefDirectory();
- OUString aPath;
- osl::FileBase::getSystemPathFromFileURL( aUrl, aPath );
- pVar->PutString( String( aPath ) );
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_GetCommonApplicationPath:
- if ( !rPar )
- {
-#ifdef WNT
- //////// adapted this from setup2\win\source\system\winos.cxx
- String aSysPath;
- aSysPath = _SHGetSpecialFolder_COMMON_APPDATA();
- if ( aSysPath.Len() )
- {
- pVar->PutString( aSysPath );
- }
- else // default to ID_GetApplicationPath (same as in setup)
- {
- OUString aUrl = Config::GetDefDirectory();
- OUString aPath;
- osl::FileBase::getSystemPathFromFileURL( aUrl, aPath );
- pVar->PutString( String( aPath ) );
- }
-#else
-#if UNX
- pVar->PutString( CUniString( "/etc" ) );
-#else
-#error not implemented
-#endif
-#endif
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_MakeIniFileName:
- if ( rPar && rPar->Count() == 2 )
- {
- OUString aUrl = Config::GetConfigName( String(), rPar->Get( 1 )->GetString() );
- OUString aPath;
- osl::FileBase::getSystemPathFromFileURL( aUrl, aPath );
- pVar->PutString( String( aPath ) );
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_Wait:
- {
- if( rPar && rPar->Count() == 2 )
- {
- long nWait = rPar->Get(1)->GetLong();
- if( nWait >= 0 )
- {
-#ifdef DEBUG
- Time aStart;
-#endif
- Timer aTimer;
- aTimer.SetTimeout( nWait );
- aTimer.Start();
- while ( aTimer.IsActive() )
- Application::Yield();
-#ifdef DEBUG
- Time aEnd;
- Time aDiff = aEnd - aStart;
- long aMS = long( aDiff.GetMSFromTime() );
- if ( Abs( aMS - nWait ) > 100 )
- {
- OSL_TRACE("Wait was off limit by %i", aDiff.GetMSFromTime() - nWait );
- }
-#endif
- }
- }
- else
- SetError( SbERR_BAD_NUMBER_OF_ARGS );
- }
- break;
- case ID_GetErrorCount:
- {
- pVar->PutULong( pImpl->nErrorCount );
- }
- break;
- case ID_GetWarningCount:
- {
- pVar->PutULong( pImpl->nWarningCount );
- }
- break;
- case ID_GetQAErrorCount:
- {
- pVar->PutULong( pImpl->nQAErrorCount );
- }
- break;
- case ID_GetUseFileWarningCount:
- {
- pVar->PutULong( pImpl->nIncludeFileWarningCount );
- }
- break;
- case ID_GetErrorList:
- {
- if ( ! pImpl->xErrorList->GetDims() )
- pImpl->xErrorList->AddDim( 1, 32000 );
- pVar->PutObject( pImpl->xErrorList );
- }
- break;
- case ID_GetWarningList:
- {
- if ( ! pImpl->xWarningList->GetDims() )
- pImpl->xWarningList->AddDim( 1, 32000 );
- pVar->PutObject( pImpl->xWarningList );
- }
- break;
- case ID_GetQAErrorList:
- {
- if ( ! pImpl->xQAErrorList->GetDims() )
- pImpl->xQAErrorList->AddDim( 1, 32000 );
- pVar->PutObject( pImpl->xQAErrorList );
- }
- break;
- case ID_GetUseFileWarningList:
- {
- if ( ! pImpl->xIncludeFileWarningList->GetDims() )
- pImpl->xIncludeFileWarningList->AddDim( 1, 32000 );
- pVar->PutObject( pImpl->xIncludeFileWarningList );
- }
- break;
- case ID_GetTestCaseName:
- {
- pVar->PutString( pImpl->aTestCaseName );
- }
- break;
- case ID_GetTestCaseFileName:
- {
- pVar->PutString( pImpl->aTestCaseFileName );
- }
- break;
- case ID_GetTestCaseLineNr:
- {
- pVar->PutUShort( pImpl->nTestCaseLineNr );
- }
- break;
- case ID_SetChildEnv:
- {
- if( rPar && rPar->Count() == 3 )
- {
- pImpl->pChildEnv->erase( rPar->Get(1)->GetString() );
- pImpl->pChildEnv->insert( EnvironmentVariable( rPar->Get(1)->GetString(), rPar->Get(2)->GetString() ) );
- }
- else
- SetError( SbERR_BAD_NUMBER_OF_ARGS );
- }
- break;
- case ID_GetChildEnv:
- {
- if( rPar && rPar->Count() == 2 )
- {
- Environment::const_iterator aIter = pImpl->pChildEnv->find( rPar->Get(1)->GetString() );
- if ( aIter != pImpl->pChildEnv->end() )
- pVar->PutString( (*aIter).second );
- else
- pVar->PutString( String() );
- }
- else
- SetError( SbERR_BAD_NUMBER_OF_ARGS );
- }
- break;
- case ID_GetLinkDestination:
- {
- if( rPar && rPar->Count() == 2 )
- {
- String aSource,aDest;
- aSource = rPar->Get(1)->GetString();
-#ifdef UNX
- rtl::OString aByteSource(rtl::OUStringToOString(aSource, osl_getThreadTextEncoding()));
- char cDest[1024];
- int nLen = 0;
- if ( ( nLen = readlink( aByteSource.getStr(), cDest, sizeof(cDest) ) ) >= 0 )
- {
- aDest = String( cDest, nLen, osl_getThreadTextEncoding() );
- }
- else
- {
- int nErr = errno;
- switch ( nErr )
- {
- case EINVAL: aDest = aSource;
- break;
- default:
- SetError( SbERR_ACCESS_ERROR );
- }
- }
-#else
- aDest = aSource;
-#endif
- pVar->PutString( aDest );
- }
- else
- SetError( SbERR_BAD_NUMBER_OF_ARGS );
- }
- break;
- case ID_GetRegistryValue:
- {
- if( rPar && rPar->Count() == 3 )
- {
- String aValue;
-#ifdef WNT
- aValue = ReadRegistry( rPar->Get(1)->GetString(), rPar->Get(2)->GetString() );
-#endif
- pVar->PutString( aValue );
- }
- else
- SetError( SbERR_BAD_NUMBER_OF_ARGS );
- }
- break;
- case ID_HTTPSend:
- {
- if( rPar && ( rPar->Count() == 4 || rPar->Count() == 5 ) )
- {
- if ( !pImpl->pHttpRequest )
- pImpl->pHttpRequest = new HttpRequest;
- pImpl->pHttpRequest->SetRequest( rtl::OUStringToOString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), rtl::OUStringToOString( rPar->Get(2)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(3)->GetUShort() );
-
- if ( pImpl->pHttpRequest->Execute() )
- {
- if ( rPar->Count() == 5 )
- { // filename is given
- SvFileStream aDestination( rPar->Get(4)->GetString(), STREAM_STD_READWRITE | STREAM_TRUNC );
- (*(pImpl->pHttpRequest->GetBody())) >> aDestination;
- if ( aDestination.GetError() != ERRCODE_NONE )
- SetError( SbERR_ACCESS_ERROR );
- aDestination.Close();
- }
- pVar->PutUShort( pImpl->pHttpRequest->GetResultId() );
- }
- else
- SetError( SbERR_ACCESS_ERROR );
- }
- else
- SetError( SbERR_BAD_NUMBER_OF_ARGS );
- }
- break;
- case ID_HTTPSetProxy:
- {
- if( rPar && rPar->Count() == 3 )
- {
- if ( !pImpl->pHttpRequest )
- pImpl->pHttpRequest = new HttpRequest;
- pImpl->pHttpRequest->SetProxy( rtl::OUStringToOString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(2)->GetUShort() );
- }
- else
- SetError( SbERR_BAD_NUMBER_OF_ARGS );
- }
- break;
- } // switch( nHintUserData )
- } // if( nHintId == SBX_HINT_DATAWANTED )
- else if( nHintId == SBX_HINT_DATACHANGED )
- {
- switch( nHintUserData )
- {
- case ID_AutoExecute:
- if ( !rPar )
- {
- SingleCommandBlock = pVar->GetBool();
- if ( SingleCommandBlock )
- EndBlock();
- else
- BeginBlock();
- }
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- case ID_EnableQaErrors:
- if ( !rPar )
- pImpl->bEnableQaErrors = pVar->GetBool();
- else
- SetError( SbxERR_WRONG_ARGS );
- break;
- }
- } // if( nHintId == SBX_HINT_DATACHANGED )
- else if( nHintId == SBX_HINT_BASICSTART )
- {
- pImpl->nErrorCount = 0;
- pImpl->nWarningCount = 0;
- pImpl->nQAErrorCount = 0;
- pImpl->nIncludeFileWarningCount = 0;
-
- pImpl->xErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
- pImpl->xWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
- pImpl->xQAErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
- pImpl->xIncludeFileWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
-
- if (pFehlerListe)
- delete pFehlerListe;
- pFehlerListe = new CErrors;
-
- for (sal_uInt16 i=0;i<VAR_POOL_SIZE;i++)
- {
- pImpl->pMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) );
- }
- nMyVar = 0;
-
- } // if( nHintId == SBX_HINT_BASICSTART )
- else if( nHintId == SBX_HINT_BASICSTOP )
- {
- // Log summary to journal
- ADD_CASE_LOG( String() ); // close case
- ADD_MESSAGE_LOG( CUniString("***************************************************") );
- if ( pImpl->nErrorCount )
- {
- ADD_WARNING_LOG( GEN_RES_STR1( S_ERRORS_DETECTED, String::CreateFromInt32( pImpl->nErrorCount ) ) );
- pImpl->nWarningCount--; // adjust because this warning shall not be in the statistics
- }
- else
- ADD_MESSAGE_LOG( GEN_RES_STR0( S_NO_ERRORS_DETECTED ) );
-
- if ( pImpl->nWarningCount )
- ADD_WARNING_LOG( GEN_RES_STR1( S_WARNINGS_DETECTED, String::CreateFromInt32( pImpl->nWarningCount ) ) )
- else
- ADD_MESSAGE_LOG( GEN_RES_STR0( S_NO_WARNINGS_DETECTED ) );
-
- if ( pImpl->nIncludeFileWarningCount )
- ADD_WARNING_LOG( GEN_RES_STR1( S_INCLUDE_FILE_WARNINGS_DETECTED, String::CreateFromInt32( pImpl->nIncludeFileWarningCount ) ) )
- else
- ADD_MESSAGE_LOG( GEN_RES_STR0( S_NO_INCLUDE_FILE_WARNINGS_DETECTED ) );
- ADD_MESSAGE_LOG( CUniString("***************************************************") );
-
- pImpl->nErrorCount = 0;
- pImpl->nWarningCount = 0;
- pImpl->nQAErrorCount = 0;
- pImpl->nIncludeFileWarningCount = 0;
-
- pImpl->xErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
- pImpl->xWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
- pImpl->xQAErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
- pImpl->xIncludeFileWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content
- } // if( nHintId == SBX_HINT_BASICSTOP )
- WaitForAnswer();
- if ( IsError() && ( !IS_ERROR() || GET_ERROR()->nError != GetError() ) )
- {
- ((StarBASIC*)GetParent())->MakeErrorText(GetError(),String());
- ADD_ERROR_QUIET(GetError(),String(pVar->GetName()).AppendAscii(": ").
- Append(((StarBASIC*)GetParent())->GetErrorText()));
- }
- }
-}
-
-void TestToolObj::DebugFindNoErrors( sal_Bool bDebugFindNoErrors )
-{
- pImpl->bDebugFindNoErrors = bDebugFindNoErrors;
-}
-
-SbxVariable* TestToolObj::Find( const String& aStr, SbxClassType aType)
-{
- if ( BasicRuntimeAccess::IsRunInit()
- || ( aStr == String( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ) ) ) // because of find in the "global" command of the basic
- return NULL;
-
- SbxVariableRef Old = SbxObject::Find(aStr, aType );
- // do not return any objects from pMyVars[]
- if (Old && Old->GetUserData() != ID_Dispatch
- && Old->GetUserData() != ID_UNODispatch
- && Old->GetUserData() != ID_ErrorDummy
- && Old->GetUserData() != 0 )
- return Old;
- else if ( aStr.SearchAscii(":") != STRING_NOTFOUND )
- { // ignore qualified names e.g. main:FormWizard If this was removed an error would be generated
- }
- else
- {
-
- sal_uInt16 nElement;
- ControlDef *pWhatName = new ControlDef(aStr,rtl::OString());
-
- /// look for controls
- if (m_pNameKontext && m_pNameKontext->Seek_Entry(pWhatName,&nElement))
- {
- delete pWhatName;
- pWhatName = ((ControlDef*)m_pNameKontext->GetObject(nElement));
-
-//// new Controls Object every time
- pImpl->pControlsObj = new Controls( pWhatName->pData->Kurzname );
- pImpl->pControlsObj->SetType( SbxOBJECT );
- pImpl->pControlsObj->ChangeListener( this );
-
-
- // Will be set on method-child further down
- // FIXME: HELPID
- pImpl->pControlsObj->SetUserData( ID_StringControl );
-
- pShortNames->Insert(pWhatName->pData->Kurzname,pWhatName->pData->aUId,nSequence);
-
- SbxVariable *pMember = pImpl->pControlsObj->Find(CUniString("ID"),SbxCLASS_DONTCARE);
- if ( pMember == NULL )
- {
- SbxProperty* pID = new SbxProperty(CUniString("ID"),SbxVARIANT);
- pImpl->pControlsObj->Insert(pID);
- pImpl->pControlsObj->SetDfltProperty(pID);
- pMember = pID;
- }
- // FIXME: HELPID
- pMember = pImpl->pControlsObj->Find(CUniString("name"),SbxCLASS_DONTCARE);
- if ( pMember != NULL )
- pMember->PutString(pWhatName->pData->Kurzname);
-
- return pImpl->pControlsObj;
- }
-
- /// look for slots
- if (m_pSIds && m_pSIds->Seek_Entry(pWhatName,&nElement))
- {
- SbxTransportMethodRef pMyVar;
- pMyVar = pImpl->pMyVars[nMyVar++];
- if ( nMyVar >= VAR_POOL_SIZE )
- nMyVar = 0;
- delete pWhatName;
- pWhatName = ( (ControlDef*)m_pSIds->GetObject( nElement ) );
- pMyVar->SetName( pWhatName->pData->Kurzname );
-
- // FIXME: HELPID
- return pMyVar;
- }
-
- /// it might be a SlotID that is asked numerically instead of being executed
- if ( aStr.Copy( aStr.Len()-3, 3 ).CompareIgnoreCaseToAscii("_ID") == COMPARE_EQUAL && m_pSIds )
- {
- delete pWhatName;
- pWhatName = new ControlDef( aStr.Copy( 0, aStr.Len()-3 ), rtl::OString() );
- if ( m_pSIds->Seek_Entry( pWhatName, &nElement ) )
- { // look for slots
- SbxVariable *pReturn = new SbxVariable;
- delete pWhatName;
- pWhatName = ( (ControlDef*)m_pSIds->GetObject( nElement ) );
- pReturn->SetName( pWhatName->pData->Kurzname );
-
- // FIXME: HELPID
- return pReturn;
- }
- }
- if ( !pImpl->bDebugFindNoErrors )
- {
- ADD_ERROR(SbxERR_PROC_UNDEFINED,GEN_RES_STR1(S_UNKNOWN_SLOT_CONTROL, aStr) );
- }
-
- delete pWhatName;
- }
- return NULL;
-}
-
-String TestToolObj::GetRevision( String const &aSourceIn )
-{
- // search $Revision: 1.40 $
- xub_StrLen nPos;
- if ( ( nPos = aSourceIn.SearchAscii( "$Revision:" ) ) != STRING_NOTFOUND )
- return aSourceIn.Copy( nPos+ 10, aSourceIn.SearchAscii( "$", nPos+10 ) -nPos-10);
- else
- return String::CreateFromAscii("No Revision found");
-}
-
-sal_Bool TestToolObj::CError( sal_uLong code, const String& rMsg, xub_StrLen l, xub_StrLen c1, xub_StrLen c2 )
-{
- bWasPrecompilerError = sal_True;
- if ( aCErrorHdl.IsSet() )
- {
- ErrorEntry aErrorEntry( code, rMsg, l, c1, c2 );
- return (sal_Bool)aCErrorHdl.Call( &aErrorEntry );
- }
- else
- {
- ADD_ERROR( code, rMsg )
- return sal_True;
- }
-}
-
-void TestToolObj::CalcPosition( String const &aSource, xub_StrLen nPos, xub_StrLen &l, xub_StrLen &c )
-{
- l = 1;
- xub_StrLen nAkt = 0;
- xub_StrLen nNext;
- while ( (nNext = aSource.Search( '\n', nAkt )) != STRING_NOTFOUND && nNext < nPos )
- {
- l++;
- nAkt = nNext+1;
- }
- c = nPos - nAkt;
-}
-
-
-#define CATCH_LABEL CUniString( "ctch" )
-#define CATCHRES_LABEL CUniString( "ctchres" )
-#define ENDCATCH_LABEL CUniString( "endctch" )
-
-sal_Bool IsAlphaChar( sal_Unicode cChar )
-{
- return ( cChar >= 'a' && cChar <= 'z' ) ||
- ( cChar >= 'A' && cChar <= 'Z' );
-}
-
-sal_Bool IsInsideString( const String& aSource, const xub_StrLen nStart )
-{
- sal_Bool bInside = sal_False;
- xub_StrLen nPos = nStart-1;
-
- while ( nPos && aSource.GetChar(nPos) != _CR && aSource.GetChar(nPos) != _LF )
- {
- if ( aSource.GetChar(nPos) == '"' )
- bInside = !bInside;
- nPos--;
- }
- return bInside;
-}
-
-sal_Bool IsValidHit( const String& aSource, const xub_StrLen nStart, const xub_StrLen nEnd )
-{
- return !IsAlphaChar( aSource.GetChar(nStart-1) ) && !IsAlphaChar( aSource.GetChar(nEnd+1))
- && !IsInsideString( aSource, nStart );
-}
-
-
-xub_StrLen TestToolObj::ImplSearch( const String &aSource, const xub_StrLen nStart, const xub_StrLen nEnd, const String &aSearch, const xub_StrLen nSearchStart )
-{
- xub_StrLen nPos = aSource.Search( aSearch, std::max( nSearchStart, nStart ) );
- if ( nPos > nEnd - aSearch.Len() || nPos == STRING_NOTFOUND )
- return STRING_NOTFOUND;
- else
- {
- if ( IsValidHit( aSource, nPos, nPos+aSearch.Len()-1 ) )
- return nPos;
- else
- return ImplSearch( aSource, nStart, nEnd, aSearch, nPos+aSearch.Len() );
- }
-}
-
-xub_StrLen TestToolObj::PreCompilePart( String &aSource, xub_StrLen nStart, xub_StrLen nEnd, String aFinalErrorLabel, sal_uInt16 &nLabelCount )
-{
- xub_StrLen nTry,nCatch,nEndcatch;
- if( (nTry = ImplSearch( aSource, nStart, nEnd, CUniString("try"), nStart )) == STRING_NOTFOUND )
- return nEnd;
- if ( (nCatch = ImplSearch( aSource, nStart, nEnd, CUniString("catch"), nTry )) == STRING_NOTFOUND )
- {
- xub_StrLen l,c;
- CalcPosition( aSource, nTry, l, c );
- CError( SbERR_BAD_BLOCK, CUniString("catch"), l, c, c+2 );
- return nEnd;
- }
- if ( (nEndcatch = ImplSearch( aSource, nStart, nEnd, CUniString("endcatch"), nCatch )) == STRING_NOTFOUND )
- {
- xub_StrLen l,c;
- CalcPosition( aSource, nCatch, l, c );
- CError( SbERR_BAD_BLOCK, CUniString("endcatch"), l, c, c+4 );
- return nEnd;
- }
-
- nLabelCount++;
- String aStr = String::CreateFromInt32( nLabelCount );
- String aCatchLabel(CATCH_LABEL);
- aCatchLabel += aStr;
- String aCatchresLabel(CATCHRES_LABEL);
- aCatchresLabel += aStr;
- String aEndcatchLabel( ENDCATCH_LABEL);
- aEndcatchLabel += aStr;
-
- xub_StrLen nTry2 = 0;
- while ( !WasPrecompilerError() && (nTry2 = ImplSearch( aSource, nStart, nEnd, CUniString("try"), nTry+1 )) != STRING_NOTFOUND )
- {
- if ( nTry2 < nCatch )
- nEnd += PreCompilePart( aSource, nTry2, nEndcatch+8, aCatchLabel, nLabelCount ) - nEndcatch-8;
- else
- nEnd = PreCompilePart( aSource, nTry2, nEnd, aFinalErrorLabel, nLabelCount );
-
- if ( (nCatch = ImplSearch( aSource, nStart, nEnd, CUniString("catch"), nTry )) == STRING_NOTFOUND )
- {
- xub_StrLen l,c;
- CalcPosition( aSource, nTry, l, c );
- CError( SbERR_BAD_BLOCK, CUniString("catch"), l, c, c+2 );
- return nEnd;
- }
- if ( (nEndcatch = ImplSearch( aSource, nStart, nEnd, CUniString("endcatch"), nCatch )) == STRING_NOTFOUND )
- {
- xub_StrLen l,c;
- CalcPosition( aSource, nCatch, l, c );
- CError( SbERR_BAD_BLOCK, CUniString("endcatch"), l, c, c+4 );
- return nEnd;
- }
- }
-
- String aReplacement;
- int nTotalLength = -3 -5 -8; // try, catch and endcatch are separated out
-
- aReplacement.AppendAscii( "on error goto " );
- aReplacement += aCatchLabel;
- aSource.SearchAndReplaceAscii( "try", aReplacement, nTry );
- nTotalLength += aReplacement.Len();
-
- aReplacement.Erase();
- aReplacement.AppendAscii( "on error goto " );
- aReplacement += aFinalErrorLabel;
- aReplacement.AppendAscii( " : goto " );
- aReplacement += aEndcatchLabel;
- aReplacement.AppendAscii( " : " );
- aReplacement += aCatchLabel;
- aReplacement.AppendAscii( ": if err = 35 or err = 18 then : on error goto 0 : resume : endif" );
- aReplacement.AppendAscii( " : MaybeAddErr : on error goto " );
- aReplacement += aFinalErrorLabel;
- aReplacement.AppendAscii( " : resume " );
- aReplacement += aCatchresLabel;
- aReplacement.AppendAscii( " : " );
- aReplacement += aCatchresLabel;
- aReplacement.AppendAscii( ": " );
- aSource.SearchAndReplaceAscii( "catch", aReplacement, nCatch );
- nTotalLength += aReplacement.Len();
-
-
- aReplacement.Erase();
- aReplacement.AppendAscii("ClearError : ");
- aReplacement += aEndcatchLabel;
- aReplacement.AppendAscii(": ");
- aSource.SearchAndReplaceAscii( "endcatch", aReplacement, nEndcatch );
- nTotalLength += aReplacement.Len();
-
- if ( aSource.Len() >= STRING_MAXLEN )
- {
- xub_StrLen l,c;
- CalcPosition( aSource, nEndcatch, l, c );
- CError( SbERR_PROG_TOO_LARGE, CUniString("endcatch"), l, c, c+2 );
- }
-
- return xub_StrLen( nEnd + nTotalLength );
-}
-
-
-void TestToolObj::PreCompileDispatchParts( String &aSource, String aStart, String aEnd, String aFinalLable )
-{
- sal_uInt16 nLabelCount = 0;
- xub_StrLen nPartPos = 0;
-
- while ( !WasPrecompilerError() && (nPartPos = ImplSearch( aSource, nPartPos, aSource.Len(), aStart )) != STRING_NOTFOUND )
- {
- xub_StrLen nEndPart = ImplSearch( aSource, nPartPos, aSource.Len(), aEnd );
- if ( nEndPart == STRING_NOTFOUND )
- return;
- nPartPos = PreCompilePart( aSource, nPartPos, nEndPart, aFinalLable, nLabelCount );
- nPartPos = nPartPos + aEnd.Len();
- }
-}
-
-
-sal_Bool TestToolObj::WasPrecompilerError()
-{
- return bWasPrecompilerError;
-}
-
-String TestToolObj::PreCompile( String const &aSourceIn )
-{
-
- StartListening( ((StarBASIC*)GetParent())->GetBroadcaster(), sal_True );
-
- xub_StrLen nTestCase;
- xub_StrLen nEndCase;
- xub_StrLen nStartPos = 0;
- String aSource(aSourceIn);
- bWasPrecompilerError = sal_False;
-
-HACK("Ich gestehe alles: Ich war zu faul das richtig zu machen.")
- aSource = String(' ').Append( aSource );
-
-
-
- xub_StrLen nComment;
- while ( (nComment = aSource.SearchAscii("'",nStartPos)) != STRING_NOTFOUND )
- {
- sal_uInt16 nStringEndCount = 0;
- xub_StrLen nIndex = nComment;
- while ( nIndex && aSource.GetChar(nIndex) != '\n' )
- {
- if ( aSource.GetChar(nIndex) == '"' )
- nStringEndCount++;
- nIndex--;
- }
- if ( (nStringEndCount & 1) == 0 )
- {
- xub_StrLen nComEnd = aSource.SearchAscii("\n",nComment);
-
- while ( aSource.GetChar(nComEnd) == _CR || aSource.GetChar(nComEnd) == _LF )
- nComEnd--;
-
- nComEnd++;
-
- aSource.Erase(nComment,nComEnd-nComment);
- }
- else
- nComment++;
- nStartPos = nComment;
- }
-
-
- PreCompileDispatchParts( aSource, CUniString("sub"), CUniString("end sub"), CUniString("0") );
- PreCompileDispatchParts( aSource, CUniString("function"), CUniString("end function"), CUniString("0") );
- PreCompileDispatchParts( aSource, CUniString("testcase"), CUniString("endcase"), CUniString("endcse") );
-
-
- xub_StrLen nMainPos = ImplSearch( aSource, 0, aSource.Len(), CUniString("sub main") );
- aSource.SearchAndReplaceAscii("sub main",CUniString("Sub Main StartUse : LoadIncludeFiles : FinishUse "), nMainPos );
- if ( aSource.Len() >= STRING_MAXLEN )
- {
- xub_StrLen l,c;
- CalcPosition( aSource, nMainPos, l, c );
- CError( SbERR_PROG_TOO_LARGE, CUniString("endcatch"), l, c, c+2 );
- }
-
- while ( (nTestCase = ImplSearch( aSource, 0, aSource.Len(), CUniString("testcase") ) ) != STRING_NOTFOUND )
- {
- xub_StrLen nTcEnd = aSource.SearchAscii("\n",nTestCase);
-
- while ( aSource.GetChar(nTcEnd) == _CR || aSource.GetChar(nTcEnd) == _LF )
- nTcEnd--;
-
- nTcEnd++;
-
- if ( aSource.SearchAscii(":",nTestCase) < nTcEnd )
- nTcEnd = aSource.SearchAscii(":",nTestCase) -1;
- String aSuffix = aSource.Copy(nTestCase+8,nTcEnd-nTestCase-8);
- sal_uInt16 nOldLen;
- do
- {
- nOldLen = aSuffix.Len();
- aSuffix = comphelper::string::strip(aSuffix, ' ');
- aSuffix = comphelper::string::strip(aSuffix, 0x09);
- } while ( nOldLen != aSuffix.Len() );
- aSource.Erase(nTestCase,nTcEnd-nTestCase);
- aSource.Insert(CUniString("Sub ").Append(aSuffix).AppendAscii(" CaseLog \"").Append(aSuffix).AppendAscii("\" : on error goto endcse : TestEnter "),nTestCase);
- }
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Attention!!! The lable endsub is officially used to exit a sub instead of using 'exit sub' or 'return'
- /////////////////////////////////////////////////////////////////////////////////////////////////////////
- while ( (nEndCase = ImplSearch( aSource, 0, aSource.Len(), CUniString("endcase") ) ) != STRING_NOTFOUND )
- aSource.SearchAndReplaceAscii("endcase",CUniString("goto endsub : endcse: if ( err = 35 and StopOnSyntaxError ) or err = 18 then : on error goto 0 : resume : endif : MaybeAddErr : ExceptLog : resume endcse_res : endcse_res: on error goto 0 : endsub: TestExit : ClearError : CaseLog \"\" : end sub "), nEndCase );
-
- if ( aSource.Len() >= STRING_MAXLEN )
- {
- xub_StrLen l,c;
- CalcPosition( aSource, 0, l, c );
- CError( SbERR_PROG_TOO_LARGE, CUniString("endcatch"), l, c, c+2 );
- }
- return aSource;
-}
-
-void TestToolObj::AddToListByNr( CNames *&pControls, ControlItemUId *&pNewItem )
-{
- sal_uInt16 nNr;
- if ( pControls->Seek_Entry( pNewItem, &nNr ) )
- {
- AddName( pControls->GetObject(nNr)->pData->Kurzname, pNewItem->pData->Kurzname );
- delete pNewItem;
- pNewItem = (ControlItemUId*)pControls->GetObject(nNr);
- }
- else
- {
- ControlItem* pNI = pNewItem;
- pControls->C40_PTR_INSERT(ControlItem,pNI);
- }
-}
-
-IMPL_LINK( TestToolObj, ReturnResultsLink, CommunicationLink*, pCommLink )
-{
- return ReturnResults( pCommLink->GetServiceData() );
-}
-
-void TestToolObj::ReadHidLstByNumber()
-{
-
- if ( !m_pReverseUIds )
- {
- String aName = (pImpl->aHIDDir + DirEntry(CUniString("hid.lst"))).GetFull();
-
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_LONGNAMES)), aName );
- GetTTBroadcaster().Broadcast( aHint );
- }
-
- ReadFlat( aName, m_pReverseUIds, sal_False );
-
- {
- TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION );
- GetTTBroadcaster().Broadcast( aHint );
- }
- }
-}
-
-void TestToolObj::SortControlsByNumber( sal_Bool bIncludeActive )
-{
-
- if ( !m_pReverseControls && !m_pReverseControlsSon && m_pControls )
- {
- m_pReverseControls = new CNames;
- m_pReverseControlsSon = new CNames;
- sal_uInt16 nWin,nCont;
- const String aSl('/');
- for ( nWin = 0 ; nWin < m_pControls->Count() ; nWin++ )
- {
- String aFatherName( m_pControls->GetObject(nWin)->pData->Kurzname );
- ControlItemUId *pNewFather = new ControlItemUIdSon(aFatherName,m_pControls->GetObject(nWin)->pData->aUId);
- AddToListByNr( m_pReverseControlsSon, pNewFather );
- if (! ((ControlItemUIdSon*)pNewFather)->GetSons() )
- ((ControlItemUIdSon*)pNewFather)->Sons( new CNames );
-
-
- CNames *pControlList = ((ControlItemSon*)m_pControls->GetObject(nWin))->GetSons();
- if ( pControlList )
- for ( nCont = 0 ; nCont < pControlList->Count() ; nCont++ )
- {
- ControlItemUId *pNewItem;
-
- String aCombinedName( aFatherName );
- aCombinedName.AppendAscii( ":" );
- aCombinedName.Append( pControlList->GetObject(nCont)->pData->Kurzname );
- pNewItem = new ControlItemUId( aCombinedName, pControlList->GetObject(nCont)->pData->aUId );
- AddToListByNr( m_pReverseControls, pNewItem );
-
- pNewItem = new ControlItemUId( pControlList->GetObject(nCont)->pData->Kurzname, pControlList->GetObject(nCont)->pData->aUId );
- AddToListByNr( ((ControlItemUIdSon*)pNewFather)->GetSons(), pNewItem );
- }
- }
- if ( !bIncludeActive )
- {
- // FIXME: HELPID
- ControlItem *pZeroItem = new ControlItemUId( UniString(), rtl::OString() );
- sal_uInt16 nNr;
- if ( m_pReverseControls->Seek_Entry( pZeroItem, &nNr ) )
- {
- m_pReverseControls->DeleteAndDestroy( nNr );
-// to prevent VorlagenLaden/UntergeordneteIniDatei/SpeichernDlg/OrdnerDlg/OeffnenDlg/MessageBox/LetzteVersion/GrafikEinfuegenDlg/FarbeDlg/ExportierenDlg/DruckerEinrichten/DruckenDlg/DateiEinfuegenDlg/Active
- }
- delete pZeroItem;
- }
- }
-}
-
-
-sal_Bool TestToolObj::ReturnResults( SvStream *pIn )
-{
-
- sal_uInt16 nId;
- sal_Bool bSequenceOK = sal_True;
- CNames *pReverseControlsKontext = NULL;
-
- CRetStream *pRetStream = new CRetStream(pIn);
-
- pRetStream->Read( nId );
- while( !pIn->IsEof() )
- {
- switch( nId )
- {
- case SIReturn:
- {
- sal_uInt16 nRet,nParams;
- rtl::OString aUId;
- pRetStream->Read(nRet);
- if ( pRetStream->GetNextType() == BinString )
- {
- String aUStrId; // UniqueStringID Used for Mozilla Integration
- pRetStream->Read( aUStrId );
- // FIXME: HELPID
- }
- else
- {
- comm_UINT32 nUId;
- pRetStream->Read( nUId );
- // FIXME: HELPID
- }
- pRetStream->Read(nParams);
-
- sal_uInt16 nNr1 = 0;
- comm_UINT32 nLNr1 = 0;
- String aString1;
- sal_Bool bBool1 = sal_False;
- SbxValueRef xValue1 = new SbxValue;
-
- if( nParams & PARAM_UINT16_1 )
- pRetStream->Read( nNr1 );
- if( nParams & PARAM_UINT32_1 )
- pRetStream->Read( nLNr1 );
- if( nParams & PARAM_STR_1 )
- {
- pRetStream->Read( aString1 );
- ReplaceNumbers ( aString1 );
- }
- else
- aString1.Erase();
- if( nParams & PARAM_BOOL_1 )
- pRetStream->Read( bBool1 );
- if( nParams & PARAM_SBXVALUE_1 )
- pRetStream->Read( *xValue1 );
- switch (nRet)
- {
- case RET_Sequence:
- {
- // FIXME: HELPID
- }
- break;
- case RET_Value:
- if ( pImpl->pNextReturn )
- {
- if ( aNextReturnId.equals( aUId ) )
- {
- if( nParams & PARAM_UINT32_1 ) // FIXME this is to allow negative numbers, hoping that no large numbers are interpreted wrong. should have new PARAM_LONG_1 instead
- {
- if ( nLNr1 > 0x7fffffff )
- pImpl->pNextReturn->PutLong( long(nLNr1 - 0xffffffff) -1 );
- else
- pImpl->pNextReturn->PutULong( nLNr1 );
- }
- if( nParams & PARAM_UINT16_1 ) pImpl->pNextReturn->PutUShort( nNr1 );
- if( nParams & PARAM_STR_1 ) pImpl->pNextReturn->PutString( aString1 );
- if( nParams & PARAM_BOOL_1 ) pImpl->pNextReturn->PutBool( bBool1 );
- if( nParams & PARAM_SBXVALUE_1 ) // FIXME: allow generic datatype
- {
- SbxValues aValues( SbxDATE );
- xValue1->Get( aValues );
- pImpl->pNextReturn->Put( aValues );
- }
- }
- else
- {
- ADD_ERROR(SbxERR_BAD_ACTION, GEN_RES_STR0(S_RETURNED_VALUE_ID_MISSMATCH) )
- }
- pImpl->pNextReturn = NULL;
- }
- else
- {
- ADD_ERROR(SbxERR_BAD_ACTION, GEN_RES_STR0(S_RETURNED_VALUE_NO_RECEIVER) )
- }
- break;
- case RET_WinInfo:
- {
- if ( !m_pReverseControls && !m_pReverseControlsSon )
- pReverseControlsKontext = NULL;
-
- ReadHidLstByNumber();
- SortControlsByNumber();
-
-
- if ( !m_pReverseSlots && m_pSIds )
- {
- m_pReverseSlots = new CNames;
- sal_uInt16 nWin;
- const String aSl('/');
- for ( nWin = 0 ; nWin < m_pSIds->Count() ; nWin++ )
- {
- ControlItemUId *pNewItem = new ControlItemUId(m_pSIds->GetObject(nWin)->pData->Kurzname,m_pSIds->GetObject(nWin)->pData->aUId);
- AddToListByNr( m_pReverseSlots, pNewItem );
- }
- }
-
- WinInfoRec *pWinInfo = new WinInfoRec;
- // FIXME: HELPID
- pWinInfo->nRType = (sal_uInt16)nLNr1; // just sal_uLong for Transport, data is always USHORT
- pWinInfo->aRName = aString1;
- pWinInfo->bIsReset = bBool1;
- pWinInfo->aKurzname.Erase();
- pWinInfo->aSlotname.Erase();
-
- // detect context maybe - happens only at the first entry after reset
- if ( !pReverseControlsKontext && m_pReverseControlsSon )
- {
- sal_uInt16 nNr;
- ControlItem *pNewItem = new ControlItemUId( String(), aUId );
- if ( m_pReverseControlsSon->Seek_Entry(pNewItem,&nNr) )
- {
- pReverseControlsKontext = ((ControlItemUIdSon*)m_pReverseControlsSon->GetObject(nNr))->GetSons();
- pWinInfo->aKurzname = CUniString("*");
- }
- else
- pReverseControlsKontext = m_pReverseControls;
-
- delete pNewItem;
- }
-
- // Reset. Must be done after determining the context because the context is set the
- // wrong way with the reset record otherwise.
- if ( pWinInfo->bIsReset )
- pReverseControlsKontext = NULL; // order important!
-
-
- // get short name
- if ( pReverseControlsKontext )
- {
- sal_uInt16 nNr;
- ControlItem *pNewItem = new ControlItemUId( String(), aUId );
- if ( pReverseControlsKontext->Seek_Entry(pNewItem,&nNr) )
- {
- pWinInfo->aKurzname += pReverseControlsKontext->GetObject(nNr)->pData->Kurzname;
- }
- delete pNewItem;
- }
-
-
- if ( m_pReverseSlots )
- {
- sal_uInt16 nNr;
- ControlItem *pNewItem = new ControlItemUId( String(), aUId );
- if ( m_pReverseSlots->Seek_Entry(pNewItem,&nNr) )
- pWinInfo->aSlotname = m_pReverseSlots->GetObject(nNr)->pData->Kurzname;
- delete pNewItem;
- }
-
-
- // FIXME: HELPID
- aWinInfoHdl.Call( pWinInfo );
- delete pWinInfo;
- }
- break;
- case RET_ProfileInfo:
- {
- // FIXME: HELPID
- }
- break;
- case RET_DirectLoging:
- {
- // FIXME: HELPID
- }
- break;
- case RET_MacroRecorder:
- {
- SortControlsByNumber( sal_True );
- String aCommand,aControls,aControl,aULongNames,aULongName;
- sal_Bool bWriteNewKontext = sal_False;
-
- aControls.Erase();
-
- if ( m_pReverseControls )
- {
- sal_uInt16 nNr;
- ControlItem *pNewItem = new ControlItemUId( String(), aUId );
- if ( m_pReverseControls->Seek_Entry(pNewItem,&nNr) )
- aControls = m_pReverseControls->GetObject(nNr)->pData->Kurzname;
- delete pNewItem;
- }
- if ( !aControls.Len() )
- {
- aControls = String::CreateFromAscii("UnknownControl:UnknownControl");
- Sound::Beep( SOUND_WARNING );
- }
-
- aULongNames.Erase();
- if( (nParams & PARAM_UINT32_1) && (nNr1 & M_RET_NUM_CONTROL) )
- {
- if ( m_pReverseControls )
- {
- sal_uInt16 nNr;
- // FIXME: HELPID
- ControlItem *pNewItem = new ControlItemUId( String(), rtl::OString( /*nLNr1*/ ) );
- if ( m_pReverseControls->Seek_Entry(pNewItem,&nNr) )
- aULongNames = m_pReverseControls->GetObject(nNr)->pData->Kurzname;
- delete pNewItem;
- }
- if ( !aULongNames.Len() )
- {
- aULongNames = String::CreateFromAscii("Unknown:Unknown");
- Sound::Beep( SOUND_WARNING );
- }
-
- // now determine the best common kontext
- sal_uInt16 i,j;
- sal_Bool bFoundUlongName = sal_False, bFoundControl = sal_False;
- // check for current kontext
- for ( i = 0 ; !bFoundUlongName && i < aULongNames.GetTokenCount('/') ; i++ )
- bFoundUlongName = aLastRecordedKontext.Equals( aULongNames.GetToken(i,'/').GetToken( 0,':') );
-
- for ( j = 0 ; !bFoundControl && j < aControls.GetTokenCount('/') ; j++ )
- bFoundControl = aLastRecordedKontext.Equals( aControls.GetToken(j,'/').GetToken( 0,':') );
-
- if ( bFoundUlongName && bFoundControl )
- {
- aULongName = aULongNames.GetToken(i-1,'/').GetToken( 1,':');
- aControl = aControls.GetToken(j-1,'/').GetToken( 1,':');
- }
- else
- { // see if we can find common kontext
- sal_Bool bFound = sal_False;
-
- String aCurrentKontext;
- for ( i = 0 ; !bFound && i < aULongNames.GetTokenCount('/') ; i++ )
- {
- aCurrentKontext = aULongNames.GetToken(i,'/').GetToken( 0,':');
-
- for ( j = 0 ; !bFound && j < aControls.GetTokenCount('/') ; j++ )
- {
- if ( aCurrentKontext.Equals( aControls.GetToken(j,'/').GetToken( 0,':') ) )
- {
- bFound = sal_True;
- aULongName = aULongNames.GetToken(i,'/').GetToken( 1,':');
- aControl = aControls.GetToken(j,'/').GetToken( 1,':');
- aLastRecordedKontext = aCurrentKontext;
- bWriteNewKontext = sal_True;
- }
- }
- }
- if ( !bFound )
- {
- // check if both contain toplevel
- bFoundUlongName = sal_False;
- bFoundControl = sal_False;
- for ( i = 0 ; !bFoundUlongName && i < aULongNames.GetTokenCount('/') ; i++ )
- bFoundUlongName = aULongNames.GetToken(i,'/').GetToken( 0,':').Equals( aULongNames.GetToken(i,'/').GetToken( 1,':') );
-
- for ( j = 0 ; !bFoundControl && j < aControls.GetTokenCount('/') ; j++ )
- bFoundControl = aControls.GetToken(j,'/').GetToken( 0,':').Equals( aControls.GetToken(j,'/').GetToken( 1,':') );
-
- if ( bFoundUlongName && bFoundControl )
- {
- aULongName = aULongNames.GetToken(i-1,'/').GetToken( 1,':');
- aControl = aControls.GetToken(j-1,'/').GetToken( 1,':');
- if ( aLastRecordedKontext.Len() )
- {
- aLastRecordedKontext.Erase();
- bWriteNewKontext = sal_True;
- }
- }
- else
- {
- String aComment;
- aComment = CUniString( "'could not Determin common kontext\n" );
- Sound::Beep( SOUND_WARNING );
- aWriteStringHdl.Call( &aComment );
- aULongName = aULongNames.GetToken(i,'/');
- aControl = aControls.GetToken(j,'/');
- }
- }
- }
-
- }
- else
- { // we only have a Control
- sal_uInt16 i;
- sal_Bool bFoundControl = sal_False;
- // check for current kontext
- for ( i = 0 ; !bFoundControl && i < aControls.GetTokenCount('/') ; i++ )
- bFoundControl = aLastRecordedKontext.Equals( aControls.GetToken(i,'/').GetToken( 0,':') );
- if ( bFoundControl )
- aControl = aControls.GetToken(i-1,'/').GetToken( 1,':');
- else
- {
- aLastRecordedKontext = aControls.GetToken(0,'/').GetToken( 0,':');
- bWriteNewKontext = sal_True;
- aControl = aControls.GetToken(0,'/').GetToken( 1,':');
- }
-
- }
-
-
- if ( bWriteNewKontext )
- {
- String aKontextCommand = CUniString( "Kontext" );
- if ( aLastRecordedKontext.Len() )
- {
- aKontextCommand.AppendAscii ( " \"" );
- aKontextCommand += aLastRecordedKontext;
- aKontextCommand.AppendAscii ( "\"" );
- }
- aKontextCommand.AppendAscii( "\n" );
- aWriteStringHdl.Call( &aKontextCommand );
- }
-
- aCommand = aControl;
-
- // Add Method name
- String aMethod = GetMethodName( nNr1 & ~M_RET_NUM_CONTROL );
- aCommand += '.';
- aCommand += aMethod;
-
- sal_Bool bWasParam = sal_False;
-
- if( nParams & PARAM_STR_1 )
- {
- bWasParam = sal_True;
- aCommand.AppendAscii( " \"" );
- if ( nNr1 & M_KEY_STRING )
- {
- sal_uInt16 nModify = 0;
- sal_Bool bIsProsa = sal_False;
- xub_StrLen i;
- for ( i = 0; i < aString1.Len(); i++ )
- {
- if ( ((sal_uInt16)aString1.GetChar(i)) == 1 ) // we have a special char
- {
- i++;
- if ( !bIsProsa )
- {
- aCommand.AppendAscii( "<" );
- bIsProsa = sal_True;
- }
- else
- aCommand.AppendAscii( " " );
-
- sal_uInt16 nKeyCode = (sal_uInt16)aString1.GetChar(i) & KEY_CODE;
- sal_uInt16 nNewModify = (sal_uInt16)aString1.GetChar(i) & KEY_MODTYPE;
- if ( nNewModify != nModify )
- { // generate modifiers
- sal_uInt16 nChanged = ( nNewModify ^ nModify );
- if ( nChanged & KEY_SHIFT )
- {
- aCommand += GetKeyName( KEY_SHIFT );
- aCommand.AppendAscii( " " );
- }
- if ( nChanged & KEY_MOD1 )
- {
- aCommand += GetKeyName( KEY_MOD1 );
- aCommand.AppendAscii( " " );
- }
- if ( nChanged & KEY_MOD2 )
- {
- aCommand += GetKeyName( KEY_MOD2 );
- aCommand.AppendAscii( " " );
- }
- }
- aCommand += GetKeyName( nKeyCode );
- nModify = nNewModify;
- }
- else
- {
- if ( bIsProsa )
- {
- aCommand.AppendAscii( ">" );
- bIsProsa = sal_False;
- }
- aCommand += aString1.GetChar(i);
- nModify = 0;
- }
- }
- if ( bIsProsa )
- {
- aCommand.AppendAscii( ">" );
- bIsProsa = sal_False;
- }
- }
- else
- {
- aCommand += aString1;
- }
- aCommand.AppendAscii( "\"" );
- }
- if( nParams & PARAM_UINT32_1 )
- {
- if ( bWasParam )
- aCommand.AppendAscii( ", " );
- else
- aCommand.AppendAscii( " " );
- bWasParam = sal_True;
- if ( nNr1 & M_RET_NUM_CONTROL )
- {
- aCommand.Append( aULongName );
- }
- else
- {
- aCommand.Append( String::CreateFromInt64( nLNr1 ) );
- }
- }
- if( nParams & PARAM_BOOL_1 )
- {
- if ( bWasParam )
- aCommand.AppendAscii( ", " );
- else
- aCommand.AppendAscii( " " );
- bWasParam = sal_True;
- if ( bBool1 )
- aCommand.AppendAscii( "true" );
- else
- aCommand.AppendAscii( "false" );
- }
-
- aCommand.AppendAscii( "\n" );
-
- aWriteStringHdl.Call( &aCommand );
- }
- break;
- default:
- OSL_TRACE( "Unbekannter Return Code: %iu", nRet );
- break;
- }
-
- break;
- }
- case SIReturnError:
- {
- String aString;
- rtl::OString aUId;
- if ( pRetStream->GetNextType() == BinString )
- {
- String aUStrId; // UniqueStringID Used for Mozilla Integration
- pRetStream->Read( aUStrId );
- // FIXME: HELPID
- }
- else
- {
- comm_UINT32 nUId;
- pRetStream->Read( nUId );
- // FIXME: HELPID
- }
- pRetStream->Read( aString );
- ReplaceNumbers (aString);
-
- String aShortName;
- aShortName = pShortNames->GetName(aUId);
- aShortName.AppendAscii( " : " );
-
- String aTmpStr(aShortName);
- aTmpStr += aString;
- ADD_ERROR(SbxERR_BAD_ACTION, aTmpStr/*, nNr*/);
- break;
- }
- default:
- OSL_TRACE( "Unbekannter Request im Return Stream Nr: %iu", nId );
- break;
- }
- if( !pIn->IsEof() )
- pRetStream->Read( nId );
- else
- {
- OSL_FAIL( "truncated input stream" );
- }
-
- }
-
- delete pRetStream;
- if ( bSequenceOK )
- {
- sal_uLong nClearSequence = 0; // before a lot of code was deleted, this was a funct. global var.
- nSequence++;
- pShortNames->Invalidate( nClearSequence - KEEP_SEQUENCES );
- }
-
- bReturnOK = sal_True;
-
- return sal_True;
-} // RetService::Request()
-
-String TestToolObj::GetMethodName( sal_uLong nMethodId )
-{
- sal_uInt16 nElement;
- if ( !Controls::pClasses )
- ReadFlatArray( Controls::arClasses, Controls::pClasses );
- if ( Controls::pClasses )
- {
- // FIXME: HELPID
- (void)nElement;
- (void)nMethodId;
- }
- return String();
-}
-
-String TestToolObj::GetKeyName( sal_uInt16 nKeyCode )
-{
- sal_uInt16 nElement;
- if ( !CmdStream::pKeyCodes )
- ReadFlatArray( CmdStream::arKeyCodes, CmdStream::pKeyCodes );
- if ( CmdStream::pKeyCodes )
- {
- // FIXME: HELPID
- (void)nElement;
- (void)nKeyCode;
- }
- return CUniString( "UnknownKeyCode" );
-}
-
-void TestToolObj::ReplaceNumbers(String &aText)
-{
-static ControlDefLoad const arRes_Type [] =
-#include "res_type.hxx"
-
- static CNames *pRTypes = NULL;
- xub_StrLen nStart = STRING_NOTFOUND;
- xub_StrLen nGleich = STRING_NOTFOUND;
- xub_StrLen nEnd = STRING_NOTFOUND;
- xub_StrLen nStartPos = 0;
- sal_uLong nNumber;
- String aType;
- String aResult;
- sal_Bool bFound;
-
- while ( (nStart = aText.Search(StartKenn,nStartPos)) != STRING_NOTFOUND &&
- (nGleich = aText.SearchAscii("=",nStart+StartKenn.Len())) != STRING_NOTFOUND &&
- (nEnd = aText.Search(EndKenn,nGleich+1)) != STRING_NOTFOUND)
- {
- aType = aText.Copy(nStart,nGleich-nStart);
- nNumber = (sal_uLong)aText.Copy(nGleich+1,nEnd-nGleich-1).ToInt64();
- bFound = sal_False;
- if ( aType.CompareTo(UIdKenn) == COMPARE_EQUAL )
- {
- // FIXME: HELPID
- aResult = pShortNames->GetName(rtl::OString(/*nNumber*/));
- bFound = sal_True;
- }
- if ( aType.CompareTo(MethodKenn ) == COMPARE_EQUAL )
- {
- bFound = sal_True;
- aResult = GetMethodName( nNumber );
- }
- if ( aType.CompareTo(RcKenn ) == COMPARE_EQUAL )
- {
- bFound = sal_True;
- if ( !pRCommands )
- ReadFlatArray( arR_Cmds, pRCommands );
-
- sal_uInt16 nElement;
- if ( pRCommands )
- {
- // FIXME: HELPID
- (void)nElement;
- }
- }
- if ( aType.CompareTo(TypeKenn ) == COMPARE_EQUAL )
- {
- bFound = sal_True;
- if ( !pRTypes )
- ReadFlatArray( arRes_Type, pRTypes );
-
- sal_uInt16 nElement;
- if ( pRTypes )
- {
- // FIXME: HELPID
- (void)nElement;
- }
- }
- if ( aType.CompareTo(SlotKenn ) == COMPARE_EQUAL )
- {
- // FIXME: HELPID
- aResult = pShortNames->GetName(rtl::OString(/*nNumber*/));
- bFound = sal_True;
- }
- if ( aType.CompareTo(TabKenn ) == COMPARE_EQUAL )
- {
- if ( nNumber > nStart )
- aResult.Fill( (sal_uInt16)nNumber - nStart +1 );
- else
- aResult = CUniString(" ");
- bFound = sal_True;
- }
-
- nStartPos = nStart;
- if ( bFound )
- {
- aText.Erase(nStart,nEnd+EndKenn.Len()-nStart);
- aText.Insert(aResult,nStart);
- nStartPos = nStartPos + aResult.Len();
- }
- else
- nStartPos = nStartPos + StartKenn.Len();
- }
-}
-
-
-SbTextType TestToolObj::GetSymbolType( const String &rSymbol, sal_Bool bWasControl )
-{
- if ( rSymbol.CompareToAscii( "try" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "catch" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "endcatch" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "testcase" ) == COMPARE_EQUAL
- || rSymbol.CompareToAscii( "endcase" ) == COMPARE_EQUAL )
- {
- return TT_KEYWORD;
- }
-
-
- ControlDef WhatName( rSymbol, rtl::OString() );
-
- if ( bWasControl )
- {
- if ( !Controls::pClasses )
- ReadFlatArray( Controls::arClasses, Controls::pClasses );
-
- if ( (Controls::pClasses && Controls::pClasses->Seek_Entry( &WhatName ))
- || rSymbol.EqualsIgnoreCaseAscii( "ID" )
- || rSymbol.EqualsIgnoreCaseAscii( "Name" ) )
- return TT_METHOD;
- else
- return TT_NOMETHOD;
- }
-
-
- if ( m_pControls )
- {
- sal_uInt16 nWin;
-
- for ( nWin = 0 ; nWin < m_pControls->Count() ; nWin++ )
- {
- if ( ((ControlDef*)m_pControls->GetObject( nWin ))->SonSeek_Entry( &WhatName ) )
- return TT_CONTROL;
- }
- }
-
-
- if ( m_pSIds && m_pSIds->Seek_Entry( &WhatName ) )
- return TT_SLOT;
-
-
- if ( !pRCommands )
- ReadFlatArray( arR_Cmds, pRCommands );
- if ( pRCommands && pRCommands->Seek_Entry( &WhatName ) )
- return TT_REMOTECMD;
-
-
- SbxVariable *pVar = SbxObject::Find( rSymbol, SbxCLASS_DONTCARE );
- if ( pVar && ( pVar->ISA(SbxMethod) || pVar->ISA(SbxProperty) ) )
- {
- return TT_LOCALCMD;
- }
-
- return SB_SYMBOL;
-}
-
-
-#undef P_FEHLERLISTE
-#define P_FEHLERLISTE TestToolObj::pFehlerListe
-
-Controls::Controls( String aCName )
-: SbxObject( aCName)
-{
- pMethodVar = new SbxTransportMethod( SbxVARIANT );
- pMethodVar->SetName( CUniString("Dummy") );
- Insert( pMethodVar );
-}
-
-
-Controls::~Controls()
-{}
-
-
-void Controls::ChangeListener( SbxObject* parent )
-{
- EndListening( pMethodVar->GetBroadcaster(), sal_True );
- parent->StartListening( pMethodVar->GetBroadcaster(), sal_True );
-}
-
-void Controls::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
- const SfxHint&, const TypeId& )
-{}
-
-
-
-SbxVariable* Controls::Find( const String& aStr, SbxClassType aType)
-{
- if ( !pClasses )
- ReadFlatArray( arClasses, pClasses );
-
- if ( GetUserData() == ID_ErrorDummy )
- {
- pMethodVar->SetName(UniString(GetName()).AppendAscii(".").Append(aStr));
- pMethodVar->SetUserData( ID_ErrorDummy );
- return pMethodVar;
- }
-
-
- sal_uInt16 nElement;
- ControlDef WhatName(aStr,rtl::OString());
- if (pClasses && pClasses->Seek_Entry(&WhatName,&nElement))
- {
- pMethodVar->SetName(aStr);
- // FIXME: HELPID
- sal_uLong nUId = 0;
- pMethodVar->nValue = nUId;
-
- pMethodVar->SetUserData( GetUserData() );
- return pMethodVar;
- }
- else
- { // mainly for ID and name
- SbxVariableRef Old = SbxObject::Find(aStr, aType );
- if (Old)
- return Old;
- else if ( aStr.EqualsIgnoreCaseAscii("ID") )
- return NULL; // suppress generation of error in this case
- }
- ADD_ERROR(SbxERR_BAD_METHOD,GEN_RES_STR2(S_UNKNOWN_METHOD, GetName(), aStr));
- return NULL;
-}
-
-
-String TTFormat::ms2s( sal_uLong nMilliSeconds )
-{
- if ( nMilliSeconds < 100000 )
- return String::CreateFromInt64( nMilliSeconds );
- if ( nMilliSeconds < 100000*60 )
- return String::CreateFromInt32( nMilliSeconds / 1000 ).AppendAscii("Sec");
- return String::CreateFromInt32( nMilliSeconds / 1000 / 60 ).AppendAscii("Min");
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/objtest.hxx b/automation/source/testtool/objtest.hxx
deleted file mode 100644
index 3c7ab881b4ad..000000000000
--- a/automation/source/testtool/objtest.hxx
+++ /dev/null
@@ -1,394 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _OBJTEST_HXX
-#define _OBJTEST_HXX
-
-#include <tools/fsys.hxx>
-
-
-#include <testapp.hxx>
-#include <testtool.hxx>
-#include "cmdstrm.hxx"
-#include <basic/basicrt.hxx>
-#include "httprequest.hxx"
-
-#include <map>
-
-// #define ID_BeginBlock 1
-// #define ID_EndBlock 2
-#define ID_Kontext 3
-#define ID_GetError 4
-#define ID_ErrorDummy 5 // internal for handling of missing controls and methods
-#define ID_RecordError 6
-#define ID_Start 7
-//#define ID_Kill 8
-//#define ID_Reset 9
-// #define ID_AppAbort 10
-#define ID_Dispatch 11
-#define ID_UNODispatch 12
-#define ID_Control 13
-#define ID_StartUse 14
-#define ID_Use 15
-#define ID_FinishUse 16
-#define ID_CaseLog 17
-#define ID_ExceptLog 18
-#define ID_PrintLog 19
-#define ID_WarnLog 20
-#define ID_ErrorLog 21
-#define ID_EnableQaErrors 22
-#define ID_QAErrorLog 23
-#define ID_MaybeAddErr 24
-#define ID_ClearError 25
-#define ID_GetNextCloseWindow 26
-#define ID_RemoteCommand 27
-#define ID_SaveIDs 28
-#define ID_AutoExecute 29
-#define ID_Execute 30
-#define ID_DialogHandler 31
-#define ID_GetUnoApp 32
-#define ID_GetIServer 33
-#define ID_RemoteCommandDelay 34
-#define ID_GetApplicationPath 35
-#define ID_GetCommonApplicationPath 36
-#define ID_MakeIniFileName 37
-#define ID_StringControl 38
-#define ID_Wait 39
-#define ID_GetErrorCount 40
-#define ID_GetWarningCount 41
-#define ID_GetQAErrorCount 42
-#define ID_GetUseFileWarningCount 43
-#define ID_GetErrorList 44
-#define ID_GetWarningList 45
-#define ID_GetQAErrorList 46
-#define ID_GetUseFileWarningList 47
-#define ID_GetTestCaseName 48
-#define ID_GetTestCaseFileName 49
-#define ID_GetTestCaseLineNr 50
-#define ID_StopOnSyntaxError 51
-#define ID_SetChildEnv 52
-#define ID_GetChildEnv 53
-#define ID_GetLinkDestination 54
-#define ID_GetRegistryValue 55
-#define ID_KillApp 56
-#define ID_HTTPSend 57
-#define ID_HTTPSetProxy 58
-#define ID_DoNothing 99
-
-void ReadFlatArray( const ControlDefLoad arWas [], CNames *&pNames );
-
-class ControlData
-{
-public:
- String Kurzname;
- rtl::OString aUId;
-};
-
-DBG_NAMEEX( ControlItem )
-DBG_NAMEEX( ControlDef )
-class ControlItem
-{
-private:
- void InitData() { pData = new ControlData; }
-public:
- ControlData *pData;
-
- ControlItem( const char *Name, rtl::OString aUIdP );
- ControlItem( const String &Name, rtl::OString aUIdP );
- virtual ~ControlItem() {
-DBG_DTOR(ControlItem,0);
- delete pData;
- }
- virtual sal_Bool operator < (const ControlItem &rPar)=0;
- virtual sal_Bool operator == (const ControlItem &rPar)=0;
-};
-
-SV_DECL_PTRARR_SORT_DEL(CNames, ControlItem*, 50, 10)
-
-#define MK_SON_ACCESS( ClassName )\
- sal_Bool SonInsert( const ClassName *pNewEntry ) { const ControlItem *pItem = pNewEntry; return pSons->Insert( pItem ); }\
- sal_Bool SonSeek_Entry( const ClassName *pSearchEntry, sal_uInt16 *nRes = NULL) { return pSons->Seek_Entry( pSearchEntry, nRes ); }\
- ClassName* SonGetObject( sal_uInt16 nNr ) { return (ClassName*)pSons->GetObject( nNr ); }
-
-class ControlSon
-{
-protected:
- CNames *pSons;
-
-public:
- ControlSon() : pSons( NULL ) {};
- ~ControlSon();
-
- sal_uInt16 Son_Count() { return pSons->Count(); }
- void Sons( CNames *pNewSons ) { pSons = pNewSons; }
- CNames*& GetSons() { return pSons; }
-};
-
-class ControlItemSon : public ControlItem, public ControlSon
-{
-public:
- ControlItemSon(const char *Name, rtl::OString aUIdP )
- : ControlItem( Name, aUIdP ) {}
- ControlItemSon(const String &Name, rtl::OString aUIdP );
-};
-
-class ControlDef : public ControlItemSon
-{
-public:
- ControlDef(const char *Name, rtl::OString aUIdP )
- : ControlItemSon( Name, aUIdP ) {DBG_CTOR(ControlDef,0);}
- ControlDef(const String &Name, rtl::OString aUIdP );
- ControlDef(const String &aOldName, const String &aNewName, ControlDef *pOriginal, sal_Bool bWithSons = sal_False );
- ~ControlDef() {DBG_DTOR(ControlDef,0);}
- virtual sal_Bool operator < (const ControlItem &rPar);
- virtual sal_Bool operator == (const ControlItem &rPar);
- void Write( SvStream &aStream );
- MK_SON_ACCESS( ControlDef )
-};
-
-class ControlItemUId : public ControlItem
-{
-public:
- ControlItemUId(String Name, rtl::OString aUIdP)
- : ControlItem( Name, aUIdP){}
- virtual sal_Bool operator < (const ControlItem &rPar);
- virtual sal_Bool operator == (const ControlItem &rPar);
-};
-
-class ControlItemUIdSon : public ControlItemUId, public ControlSon
-{
-public:
- ControlItemUIdSon(String Name, rtl::OString aUIdP) : ControlItemUId( Name, aUIdP) {}
- MK_SON_ACCESS( ControlItemUId )
-};
-
-class ReverseName : public ControlItemUId
-{
-public:
- sal_uLong LastSequence;
-
- ReverseName(String Name, rtl::OString aUIdP, sal_uLong nSeq) : ControlItemUId( Name, aUIdP), LastSequence(nSeq) {}
-};
-
-class CRevNames: public CNames
-{
-public:
- void Insert( String aName, rtl::OString aUId, sal_uLong nSeq );
- String GetName( rtl::OString aUId );
- void Invalidate ( sal_uLong nSeq );
-};
-
-
-class SbxTransportMethod: public SbxMethod
-{
-public:
- SbxTransportMethod( SbxDataType );
- sal_uLong nValue;
- String aUnoSlot;
-};
-SV_DECL_IMPL_REF(SbxTransportMethod);
-
-class Controls: public SbxObject
-{
-public:
- Controls( String aCName );
- ~Controls();
- void ChangeListener( SbxObject* pParent );
-
- void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
- virtual SbxVariable* Find( const String&, SbxClassType );
- SbxTransportMethodRef pMethodVar; // for transport from Find to Notify
- static CNames *pClasses;
- static ControlDefLoad const arClasses [];
-};
-SV_DECL_IMPL_REF(Controls);
-
-typedef std::map< String, String > Environment;
-
-class ImplTestToolObj
-{
-public:
- String ProgParam; // parameters of the APP to be tested; set over Start
-
- DirEntry aFileBase; // base path for the *.sid and *.win files (from the configfile)
- DirEntry aLogFileBase; // base path for the *.res files (from the configfile)
- DirEntry aHIDDir; // directory in which the hid.lst is searched for
-
- SbxTransportMethodRef pNextReturn;
-
- ControlsRef pControlsObj;
-
-
-#define VAR_POOL_SIZE 8
- SbxTransportMethodRef pMyVars[VAR_POOL_SIZE];
-
- Time aServerTimeout;
-
-
-// profiling data fields
- sal_uLong LocalStarttime;
- sal_uInt16 nNumBorders;
- sal_uLong naValBorders[4];
- sal_uLong naNumEntries[5];
- sal_uLong naRemoteTime[5];
- sal_uLong naLocalTime[5];
-
- sal_uLong nMinRemoteCommandDelay;
- sal_uLong nMaxRemoteCommandDelay;
- sal_Bool bDoRemoteCommandDelay;
-
- sal_Bool bLnaguageExtensionLoaded; // something loaded via 'use'? for syntax highlighting
- SfxBroadcaster *pTTSfxBroadcaster;
-
- sal_uLong nErrorCount;
- sal_uLong nWarningCount;
- sal_uLong nQAErrorCount;
- sal_uLong nIncludeFileWarningCount;
-
- SbxDimArrayRef xErrorList;
- SbxDimArrayRef xWarningList;
- SbxDimArrayRef xQAErrorList;
- SbxDimArrayRef xIncludeFileWarningList;
-
- sal_Bool bIsStart; // set tu sal_True while command Start is initiating the communication
-
- MyBasic* pMyBasic;
-
- String aTestCaseName; // holds name of current TestCase
- String aTestCaseFileName; // holds FileName of current TestCase
- sal_uInt16 nTestCaseLineNr; // holds Line of current TestCase
-
- sal_Bool bEnableQaErrors; // include QA errors in report
- sal_Bool bDebugFindNoErrors; // suppress generating errors when find of variables is called for variable viewing purposes
-
- sal_Bool bStopOnSyntaxError; // catch syntax errors in testcases or not
-
- Environment *pChildEnv; // Environment Variables for child Process
-
- HttpRequest *pHttpRequest; // used for sending HTTP requests
-
- ImplTestToolObj() : aServerTimeout( Time::EMPTY ) {}
-};
-
-
-class TTFormat
-{
-public:
- static String ms2s( sal_uLong nMilliSeconds );
-};
-
-
-#define ADD_TO_LOG( aLogTypep, aMsgp, aFilenamep, nLinep, nCol1p, nCol2p, aRevisionp, pLogList )\
-{ \
- TTLogMsg *pLogMsg = new TTLogMsg(); \
- pLogMsg->aDebugData.aMsg = aMsgp; \
- pLogMsg->aLogFileName = (pImpl->aLogFileBase + DirEntry(aLogFileName)).GetFull(); \
- pLogMsg->aDebugData.aFilename = aFilenamep; \
- pLogMsg->aDebugData.nLine = nLinep; \
- pLogMsg->aDebugData.nCol1 = nCol1p; \
- pLogMsg->aDebugData.nCol2 = nCol2p; \
- pLogMsg->aDebugData.aLogType = aLogTypep; \
- aLogHdl.Call( pLogMsg ); \
- void* pDummyForWarningAboutNULL = pLogList; \
- if( pDummyForWarningAboutNULL ) \
- { \
- SbxDimArray* pLogArray = (SbxDimArray*)pLogList; \
- SbxVariable* pLogLine = new SbxVariable( SbxSTRING ); \
- String aCollect; \
- aCollect.Append( pLogMsg->aDebugData.aFilename ); \
- aCollect.AppendAscii( ";" ); \
- aCollect.Append( String::CreateFromInt32( nLinep ) ); \
- aCollect.AppendAscii( ";" ); \
- aCollect.Append( aRevisionp ); \
- aCollect.AppendAscii( ";" ); \
- aCollect.Append( pLogMsg->aDebugData.aMsg ); \
- pLogLine->PutString( aCollect ); \
- pLogArray->Insert( pLogLine, pLogArray->Count() ); \
- } \
- delete pLogMsg; \
-} \
-
-
-#define ADD_RUN_LOG() \
- ADD_TO_LOG(LOG_RUN, String(), String(), 0, 0, 0, String(), NULL) \
-
-#define ADD_ERROR_LOG(aMsg, aFilename, nLine, nCol1, nCol2, aRevision) \
-{ \
- ADD_TO_LOG(LOG_ERROR, aMsg, aFilename, nLine, nCol1, nCol2, aRevision, &pImpl->xErrorList) \
- pImpl->nErrorCount++; \
-}
-
-#define ADD_CALL_STACK_LOG(aMsg, aFilename, nLine, nCol1, nCol2) \
- ADD_TO_LOG(LOG_CALL_STACK, aMsg, aFilename, nLine, nCol1, nCol2, String(), NULL) \
-
-
-#define ADD_AUTO_LOG(aLogType, aMsg, pLogList) \
-{ \
- if ( BasicRuntimeAccess::HasRuntime() ) \
- { \
- BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); \
- ADD_TO_LOG(aLogType, aMsg, aRun.GetModuleName(SbxNAME_SHORT_TYPES), \
- aRun.GetLine(), aRun.GetCol1(), aRun.GetCol2(), aRun.GetSourceRevision(), pLogList) \
- } \
- else \
- { \
- ADD_TO_LOG(aLogType, aMsg, UniString(), 0, 0, STRING_LEN, String(), pLogList) \
- } \
-} \
-
-#define ADD_CASE_LOG(aMsg) \
- ADD_AUTO_LOG(LOG_TEST_CASE, aMsg, NULL) \
-
-#define ADD_MESSAGE_LOG(aMsg) \
- ADD_AUTO_LOG(LOG_MESSAGE, aMsg, NULL) \
-
-#define ADD_WARNING_LOG(aMsg) \
-{ \
- ADD_AUTO_LOG(LOG_WARNING, aMsg, &pImpl->xWarningList) \
- pImpl->nWarningCount++; \
-}
-
-#define ADD_WARNING_LOG2(aMsg, aFilename, nLine ) \
-{ \
- ADD_TO_LOG(LOG_WARNING, aMsg, aFilename, nLine, 0, STRING_LEN, String(), &pImpl->xWarningList) \
- pImpl->nWarningCount++; \
-}
-
-#define ADD_ASSERTION_LOG(aMsg) \
- ADD_AUTO_LOG(LOG_ASSERTION, aMsg, NULL) \
-
-#define ADD_QA_ERROR_LOG(aMsg) \
- if ( pImpl->bEnableQaErrors ) \
- { \
- ADD_AUTO_LOG(LOG_QA_ERROR, aMsg, &pImpl->xQAErrorList) \
- pImpl->nQAErrorCount++; \
- }
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/registry_win.cxx b/automation/source/testtool/registry_win.cxx
deleted file mode 100644
index ea2b27ac8320..000000000000
--- a/automation/source/testtool/registry_win.cxx
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-////////////////////////////////////////////////////////////////////////////
-////
-//// Windows ONLY
-////
-////////////////////////////////////////////////////////////////////////////
-
-
-#include "registry_win.hxx"
-#include <osl/thread.h>
-#include <sal/macros.h>
-#include <windows.h>
-
-
-String ReadRegistry( String aKey, String aValueName )
-{
- String aRet;
- HKEY hBaseKey;
- if ( aKey.GetToken( 0, '\\' ).EqualsIgnoreCaseAscii( "HKEY_CURRENT_USER" ) )
- hBaseKey = HKEY_CURRENT_USER;
- else if ( aKey.GetToken( 0, '\\' ).EqualsIgnoreCaseAscii( "HKEY_LOCAL_MACHINE" ) )
- hBaseKey = HKEY_LOCAL_MACHINE;
- else
- {
- return aRet;
- }
-
- aKey.Erase( 0, aKey.Search( '\\' )+1 );
-
- HKEY hRegKey;
-
- if ( RegOpenKeyW( hBaseKey,
- reinterpret_cast<LPCWSTR>(aKey.GetBuffer()),
- &hRegKey ) == ERROR_SUCCESS )
- {
- LONG lRet;
- sal_Unicode PathW[_MAX_PATH ];
- DWORD lSize = SAL_N_ELEMENTS(PathW);
- DWORD Type = REG_SZ;
-
- lRet = RegQueryValueExW(hRegKey, reinterpret_cast<LPCWSTR>(aValueName.GetBuffer()), NULL, &Type, (LPBYTE)PathW, &lSize);
-
- if ((lRet == ERROR_SUCCESS) && (Type == REG_SZ))
- {
- aRet = String( PathW );
- }
-
- RegCloseKey(hRegKey);
- }
- return aRet;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/registry_win.hxx b/automation/source/testtool/registry_win.hxx
deleted file mode 100644
index 4a9492d80d2b..000000000000
--- a/automation/source/testtool/registry_win.hxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include <tools/string.hxx>
-
-String ReadRegistry( String aKey, String aValueName );
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/sysdir_win.cxx b/automation/source/testtool/sysdir_win.cxx
deleted file mode 100644
index b8ecb8752929..000000000000
--- a/automation/source/testtool/sysdir_win.cxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-////////////////////////////////////////////////////////////////////////////
-////
-//// Windows ONLY
-////
-////////////////////////////////////////////////////////////////////////////
-
-
-#ifndef _SHOBJ_H
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#pragma warning(disable: 4917)
-#endif
-#include <shlobj.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-#endif
-// as we define it ourselves further down the line we remove it here
-#ifdef IS_ERROR
- #undef IS_ERROR
-#endif
-
-#include <tchar.h>
-#include "sysdir_win.hxx"
-
-
-//////// copied this from setup2\win\source\system\winos.cxx
-
-void _SHFree( void *pv )
-{
- IMalloc *pMalloc;
- if( NOERROR == SHGetMalloc(&pMalloc) )
- {
- pMalloc->Free( pv );
- pMalloc->Release();
- }
-}
-
-#define ALLOC(type, n) ((type *) HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n ))
-#define FREE(p) HeapFree(GetProcessHeap(), 0, p)
-
-UniString _SHGetSpecialFolder( int nFolderID )
-{
-
- LPITEMIDLIST pidl;
- HRESULT hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl );
- UniString aFolder;
-
- if( hHdl == NOERROR )
- {
- WCHAR *lpFolderW;
- lpFolderW = ALLOC( WCHAR, 16000 );
-
- SHGetPathFromIDListW( pidl, lpFolderW );
- aFolder = UniString( reinterpret_cast<const sal_Unicode*>(lpFolderW) );
-
- FREE( lpFolderW );
- _SHFree( pidl );
- }
- return aFolder;
-}
-
-
-/////////////// end of copy
-
-
-
-String _SHGetSpecialFolder_COMMON_APPDATA()
-{
- return _SHGetSpecialFolder( CSIDL_COMMON_APPDATA );
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/sysdir_win.hxx b/automation/source/testtool/sysdir_win.hxx
deleted file mode 100644
index c27e3e434e75..000000000000
--- a/automation/source/testtool/sysdir_win.hxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include <tools/string.hxx>
-
-String _SHGetSpecialFolder_COMMON_APPDATA();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/tcommuni.cxx b/automation/source/testtool/tcommuni.cxx
deleted file mode 100644
index 44dc5f2fec18..000000000000
--- a/automation/source/testtool/tcommuni.cxx
+++ /dev/null
@@ -1,201 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-
-#include <tools/config.hxx>
-#include <vcl/svapp.hxx>
-#include <tools/time.hxx>
-#include <tools/debug.hxx>
-#include <vcl/timer.hxx>
-
-#include <basic/ttstrhlp.hxx>
-
-#include "rcontrol.hxx"
-#include "tcommuni.hxx"
-#include <basic/testtool.hxx>
-
-CommunicationManagerClientViaSocketTT::CommunicationManagerClientViaSocketTT()
-: CommunicationManagerClientViaSocket( sal_True )
-, aFirstRetryCall( Time::EMPTY )
-, aAppPath()
-, aAppParams()
-, pProcess( NULL )
-{
-}
-
-
-sal_Bool CommunicationManagerClientViaSocketTT::StartCommunication()
-{
- bApplicationStarted = sal_False;
- return CommunicationManagerClientViaSocket::StartCommunication( rtl::OUStringToOString( GetHostConfig(), RTL_TEXTENCODING_UTF8 ), GetTTPortConfig() );
-}
-
-
-sal_Bool CommunicationManagerClientViaSocketTT::StartCommunication( String aApp, String aParams, Environment *pChildEnv )
-{
- aAppPath = aApp;
- aAppParams = aParams;
- aAppEnv = (*pChildEnv);
- return StartCommunication();
-}
-
-
-sal_Bool CommunicationManagerClientViaSocketTT::RetryConnect()
-{
- if ( !bApplicationStarted )
- {
-
- if ( aAppPath.Len() )
- {
- delete pProcess;
-
- pProcess = new Process();
- pProcess->SetImage( aAppPath, aAppParams, &aAppEnv );
-
- sal_Bool bSucc = pProcess->Start();
- bApplicationStarted = sal_True;
-
- if ( bSucc )
- {
- aFirstRetryCall = Time( Time::SYSTEM ) + Time( 0, 1 );
- for ( int i = 10 ; i-- ; )
- GetpApp()->Reschedule();
- }
- return bSucc;
- }
- return sal_False;
- }
- else
- {
- if ( aFirstRetryCall > Time( Time::SYSTEM ) )
- {
- Timer aWait;
- aWait.SetTimeout( 500 );
- aWait.Start();
- while ( aWait.IsActive() )
- GetpApp()->Yield();
- return sal_True;
- }
- else
- return sal_False;
- }
-}
-
-sal_Bool CommunicationManagerClientViaSocketTT::KillApplication()
-{
- if ( pProcess )
- return pProcess->Terminate();
- return sal_True;
-}
-
-#define GETSET(aVar, KeyName, Dafault) \
- aVar = aConf.ReadKey(KeyName,"No Entry"); \
- if (aVar.equalsL(RTL_CONSTASCII_STRINGPARAM("No Entry"))) \
- { \
- aVar = Dafault; \
- aConf.WriteKey(KeyName, aVar); \
- }
-
-String GetHostConfig()
-{
- String aHostToTalk;
-
- for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
- {
- if ( Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("-host=") == COMPARE_EQUAL
-#ifndef UNX
- || Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("/host=") == COMPARE_EQUAL
-#endif
- )
- return Application::GetCommandLineParam( i ).Copy(6);
- }
-
- rtl::OString abHostToTalk;
- Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
- aConf.SetGroup("Communication");
-
- GETSET( abHostToTalk, "Host", DEFAULT_HOST );
- return rtl::OStringToOUString(abHostToTalk, RTL_TEXTENCODING_UTF8);
-}
-
-
-sal_uLong GetTTPortConfig()
-{
- String aPortToTalk;
-
- for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
- {
- if ( Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("-port=") == COMPARE_EQUAL
-#ifndef UNX
- || Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("/port=") == COMPARE_EQUAL
-#endif
- )
- {
- aPortToTalk = Application::GetCommandLineParam( i ).Copy(6);
- return (sal_uLong)aPortToTalk.ToInt64();
- }
- }
-
- rtl::OString abPortToTalk;
- Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
- aConf.SetGroup("Communication");
-
- GETSET( abPortToTalk, "TTPort",
- rtl::OString::valueOf(static_cast<sal_Int32>(TESTTOOL_DEFAULT_PORT)) );
- return (sal_uLong)abPortToTalk.toInt32();
-}
-
-
-sal_uLong GetUnoPortConfig()
-{
- String aPortToTalk;
-
- for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ )
- {
- if ( Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("-unoport=") == COMPARE_EQUAL
-#ifndef UNX
- || Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("/unoport=") == COMPARE_EQUAL
-#endif
- )
- {
- aPortToTalk = Application::GetCommandLineParam( i ).Copy(6);
- return (sal_uLong)aPortToTalk.ToInt64();
- }
- }
-
- rtl::OString abPortToTalk;
- Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
- aConf.SetGroup("Communication");
-
- GETSET( abPortToTalk, "UnoPort",
- rtl::OString::valueOf(static_cast<sal_Int32>(UNO_DEFAULT_PORT)) );
- return (sal_uLong)abPortToTalk.toInt32();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/tcommuni.hxx b/automation/source/testtool/tcommuni.hxx
deleted file mode 100644
index 6d3f9af6ed5f..000000000000
--- a/automation/source/testtool/tcommuni.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <automation/communi.hxx>
-#include <tools/link.hxx>
-#include <svl/svarray.hxx>
-
-#include <osl/thread.hxx>
-#include <basic/process.hxx>
-
-class Process;
-
-class CommunicationManagerClientViaSocketTT : public CommunicationManagerClientViaSocket
-{
-public:
- CommunicationManagerClientViaSocketTT();
-
- using CommunicationManagerClientViaSocket::StartCommunication;
- virtual sal_Bool StartCommunication();
- virtual sal_Bool StartCommunication( String aApp, String aParams, Environment *pChildEnv );
-
- sal_Bool KillApplication();
-
-protected:
- virtual sal_Bool RetryConnect();
- sal_Bool bApplicationStarted;
- Time aFirstRetryCall;
- String aAppPath;
- String aAppParams;
- Environment aAppEnv;
- Process *pProcess;
-};
-
-
-String GetHostConfig();
-sal_uLong GetTTPortConfig();
-sal_uLong GetUnoPortConfig();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/automation/source/testtool/testtool.ini b/automation/source/testtool/testtool.ini
deleted file mode 100644
index 86db21b09b52..000000000000
--- a/automation/source/testtool/testtool.ini
+++ /dev/null
@@ -1,16 +0,0 @@
-[Bootstrap]
-URE_BOOTSTRAP=${ORIGIN}/fundamental!INIFILESUFFIX!
-UserInstallation=${SYSUSERCONFIG}/.oootesttool
-
-[Misc]
-CurrentProfile=_profile_Default
-
-[OOoProgramDir]
-Type=Path
-
-[Crashreporter]
-UseProxy=false
-ProxyServer=none
-ProxyPort=8080
-AllowContact=false
-ReturnAddress=