1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef TESTAPP_HXX 29*cdf0e10cSrcweir #define TESTAPP_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <basic/sbmod.hxx> 32*cdf0e10cSrcweir #include <basic/testtool.hxx> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir class CommunicationLink; 35*cdf0e10cSrcweir class CommunicationManagerClientViaSocketTT; 36*cdf0e10cSrcweir class CNames; 37*cdf0e10cSrcweir class ControlItemUId; 38*cdf0e10cSrcweir class CRevNames; 39*cdf0e10cSrcweir //class SbxTransportVariableRef; 40*cdf0e10cSrcweir class ControlsRef; 41*cdf0e10cSrcweir class CmdStream; 42*cdf0e10cSrcweir class FloatingLoadConf; 43*cdf0e10cSrcweir class TestToolObj; 44*cdf0e10cSrcweir class ControlDef; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir class SbxTransportMethod; 47*cdf0e10cSrcweir class Application; 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir class SotStorage; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir class ImplTestToolObj; 52*cdf0e10cSrcweir class MyBasic; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir class ErrorEntry 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir public: 57*cdf0e10cSrcweir ErrorEntry(sal_uLong nNr, String aStr = String()) : nError(nNr),aText(aStr),nLine(0),nCol1(0),nCol2(0) {} 58*cdf0e10cSrcweir ErrorEntry(sal_uLong nNr, String aStr, xub_StrLen l, xub_StrLen c1, xub_StrLen c2 ) 59*cdf0e10cSrcweir : nError(nNr),aText(aStr),nLine(l),nCol1(c1),nCol2(c2) {} 60*cdf0e10cSrcweir sal_uLong nError; 61*cdf0e10cSrcweir String aText; 62*cdf0e10cSrcweir xub_StrLen nLine; 63*cdf0e10cSrcweir xub_StrLen nCol1; 64*cdf0e10cSrcweir xub_StrLen nCol2; 65*cdf0e10cSrcweir }; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir SV_DECL_PTRARR_DEL(CErrors, ErrorEntry*, 1, 1) 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir struct ControlDefLoad { 70*cdf0e10cSrcweir const char* Kurzname; 71*cdf0e10cSrcweir sal_uLong nUId; 72*cdf0e10cSrcweir }; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir class TestToolObj: public SbxObject 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir friend class TTBasic; 77*cdf0e10cSrcweir friend class Controls; 78*cdf0e10cSrcweir public: 79*cdf0e10cSrcweir TestToolObj( String aName, String aFilePath ); // Alle Dateien in FilePath, Kein IPC 80*cdf0e10cSrcweir TestToolObj( String aName, MyBasic* pBas ); // Pfade aus INI, IPC benutzen 81*cdf0e10cSrcweir ~TestToolObj(); 82*cdf0e10cSrcweir void LoadIniFile(); // Laden der IniEinstellungen, die durch den ConfigDialog ge�ndert werden k�nnen 83*cdf0e10cSrcweir void DebugFindNoErrors( sal_Bool bDebugFindNoErrors ); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir private: 86*cdf0e10cSrcweir sal_Bool bWasPrecompilerError; // True wenn beim letzten Precompile ein Fehler auftrat 87*cdf0e10cSrcweir sal_Bool CError( sal_uLong, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); 88*cdf0e10cSrcweir void CalcPosition( String const &aSource, xub_StrLen nPos, xub_StrLen &l, xub_StrLen &c ); 89*cdf0e10cSrcweir xub_StrLen ImplSearch( const String &aSource, const xub_StrLen nStart, const xub_StrLen nEnd, const String &aSearch, const xub_StrLen nSearchStart = 0 ); 90*cdf0e10cSrcweir xub_StrLen PreCompilePart( String &aSource, xub_StrLen nStart, xub_StrLen nEnd, String aFinalErrorLabel, sal_uInt16 &nLabelCount ); 91*cdf0e10cSrcweir void PreCompileDispatchParts( String &aSource, String aStart, String aEnd, String aFinalLable ); 92*cdf0e10cSrcweir public: 93*cdf0e10cSrcweir String GetRevision(String const &aSourceIn); // find Revision in the sourcecode 94*cdf0e10cSrcweir String PreCompile(String const &aSourceIn); // try catch; testcase endcase .. 95*cdf0e10cSrcweir sal_Bool WasPrecompilerError(); // True wenn beim letzten Precompile ein Fehler auftrat 96*cdf0e10cSrcweir void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); 97*cdf0e10cSrcweir virtual SbxVariable* Find( const String&, SbxClassType ); 98*cdf0e10cSrcweir // String aKeyPlusClasses; // Pfad f�r keycodes & classes & res_type (Aus Configdatei) 99*cdf0e10cSrcweir DECL_LINK( ReturnResultsLink, CommunicationLink* ); 100*cdf0e10cSrcweir sal_Bool ReturnResults( SvStream *pIn ); // R�cklieferung des Antwortstreams �ber IPC oder TCP/IP oder direkt 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir void SetLogHdl( const Link& rLink ) { aLogHdl = rLink; } 103*cdf0e10cSrcweir const Link& GetLogHdl() const { return aLogHdl; } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir void SetWinInfoHdl( const Link& rLink ) { aWinInfoHdl = rLink; } 106*cdf0e10cSrcweir const Link& GetWinInfoHdl() const { return aWinInfoHdl; } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir void SetModuleWinExistsHdl( const Link& rLink ) { aModuleWinExistsHdl = rLink; } 109*cdf0e10cSrcweir const Link& GetModuleWinExistsHdl() const { return aModuleWinExistsHdl; } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir void SetCErrorHdl( const Link& rLink ) { aCErrorHdl = rLink; } 112*cdf0e10cSrcweir const Link& GetCErrorHdl() const { return aCErrorHdl; } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir void SetWriteStringHdl( const Link& rLink ) { aWriteStringHdl = rLink; } 115*cdf0e10cSrcweir const Link& GetWriteStringHdl() const { return aWriteStringHdl; } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir SfxBroadcaster& GetTTBroadcaster(); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir private: 120*cdf0e10cSrcweir ImplTestToolObj *pImpl; // Alles was von der Implementation abh�ngt 121*cdf0e10cSrcweir static const CErrors* GetFehlerListe() { return pFehlerListe; } 122*cdf0e10cSrcweir sal_Bool bUseIPC; 123*cdf0e10cSrcweir Link aLogHdl; // Zum Logen der Fehlermeldungen im Testtool 124*cdf0e10cSrcweir Link aWinInfoHdl; // Anzeigen der Windows/Controls der zu testenden App 125*cdf0e10cSrcweir Link aModuleWinExistsHdl; // Pr�ft ob das Modul schon im Editor geladen ist 126*cdf0e10cSrcweir Link aCErrorHdl; // Melden von Compilererror 127*cdf0e10cSrcweir Link aWriteStringHdl; // Schreiben von text (e.g. MakroRecorder) 128*cdf0e10cSrcweir sal_Bool bReturnOK; // Bricht WaitForAnswer ab 129*cdf0e10cSrcweir CRevNames *pShortNames; // Aktuell verwendete Controls, zur gewinnung des Namens aus Fehlermeldung 130*cdf0e10cSrcweir sal_uLong nSequence; // Sequence um Antwort und Anfrage zu syncronisieren 131*cdf0e10cSrcweir rtl::OString aNextReturnId; // Id des Returnwertes i.e. UId 132*cdf0e10cSrcweir void ReplaceNumbers(String &aText); // Zahlen im String mit speziellem Format in Namen umwandeln 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir String aLastRecordedKontext;// Keeps the last kontext recorded by the Macro Recorder 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir #define FLAT sal_True 137*cdf0e10cSrcweir String ProgPath; // Dateiname der zu Testenden APP; Gesetzt �ber Start 138*cdf0e10cSrcweir String aLogFileName; // Momentaner Logfilename (Wie Programmdatei aber mit .res) 139*cdf0e10cSrcweir sal_Bool IsBlock; // Innerhalb Begin/EndBlock 140*cdf0e10cSrcweir sal_Bool SingleCommandBlock; // Implizit um jedes kommando ein Begin/EndBlock 141*cdf0e10cSrcweir CmdStream *In; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir void AddName(String &aBisher, String &aNeu ); // Name eventuell mit / anh�ngen 144*cdf0e10cSrcweir void AddToListByNr( CNames *&pControls, ControlItemUId *&pNewItem ); // 145*cdf0e10cSrcweir CNames *m_pControls; 146*cdf0e10cSrcweir CNames *m_pNameKontext; // Zeigt auf den aktuellen Namenskontext, der �ber 'Kontext' gesetzt wurde 147*cdf0e10cSrcweir CNames *m_pSIds; 148*cdf0e10cSrcweir CNames *m_pReverseSlots; // Slots mit Kurznamen nach Nummer 149*cdf0e10cSrcweir CNames *m_pReverseControls; // Controls mit Kurznamen nach Nummer 150*cdf0e10cSrcweir CNames *m_pReverseControlsSon;// Controls mit Kurznamen nach Nummer nach Fenstern (Son) 151*cdf0e10cSrcweir CNames *m_pReverseUIds; // Langnamen nach Nummer 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_uInt16 nMyVar; // Wievielte Var aus Pool ist dran 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir void InitTestToolObj(); 157*cdf0e10cSrcweir CommunicationManagerClientViaSocketTT *pCommunicationManager; 158*cdf0e10cSrcweir void SendViaSocket(); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir sal_Bool Load( String aFileName, SbModule *pMod ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir void ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, sal_Bool bIsFlat = sal_False ); 163*cdf0e10cSrcweir void ReadFlat( String Filename, CNames *&pNames, sal_Bool bSortByName ); 164*cdf0e10cSrcweir sal_Bool ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pControls ); 165*cdf0e10cSrcweir sal_Bool WriteNamesBin( String Filename, CNames *pSIds, CNames *pControls ); 166*cdf0e10cSrcweir void ReadHidLstByNumber(); 167*cdf0e10cSrcweir void SortControlsByNumber( sal_Bool bIncludeActive = sal_False ); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir String GetMethodName( sal_uLong nMethodId ); 170*cdf0e10cSrcweir String GetKeyName( sal_uInt16 nKeyCode ); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir void WaitForAnswer (); 173*cdf0e10cSrcweir DECL_LINK( IdleHdl, Application* ); 174*cdf0e10cSrcweir DECL_LINK( CallDialogHandler, Application* ); 175*cdf0e10cSrcweir String aDialogHandlerName; 176*cdf0e10cSrcweir sal_uInt16 nWindowHandlerCallLevel; 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir sal_uInt16 nIdleCount; 179*cdf0e10cSrcweir // wenn DialogHandler gesetzt wird er im IdleHandler inkrementiert und 180*cdf0e10cSrcweir // in WaitForAnswer r�ckgesetzt. �bersteigt er einen gewissen wert, gehe ich davon aus, 181*cdf0e10cSrcweir // da� WaitForAnswer still ligt und rufe die DialogHander Sub im BASIC auf. 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir void BeginBlock(); 184*cdf0e10cSrcweir void EndBlock(); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir SbTextType GetSymbolType( const String &rSymbol, sal_Bool bWasControl ); 187*cdf0e10cSrcweir static ControlDefLoad const arR_Cmds[]; 188*cdf0e10cSrcweir static CNames *pRCommands; 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir static CErrors *pFehlerListe; // Hier werden die Fehler des Testtools gespeichert 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir }; 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir #endif 195