diff options
author | Gregor Hartmann <gh@openoffice.org> | 2002-11-20 10:28:44 +0000 |
---|---|---|
committer | Gregor Hartmann <gh@openoffice.org> | 2002-11-20 10:28:44 +0000 |
commit | 2253d1ac51944beae54e662b46c0dd75959eaa32 (patch) | |
tree | 8eb598621d7963fe2e9501310d69f473fb592599 /automation | |
parent | create resources for miniapp (diff) | |
download | core-2253d1ac51944beae54e662b46c0dd75959eaa32.tar.gz core-2253d1ac51944beae54e662b46c0dd75959eaa32.zip |
get miniapp to work again
Diffstat (limited to 'automation')
-rw-r--r-- | automation/source/miniapp/editwin.cxx | 7 | ||||
-rw-r--r-- | automation/source/miniapp/test.bas | 23 | ||||
-rw-r--r-- | automation/source/miniapp/testapp.cxx | 119 |
3 files changed, 113 insertions, 36 deletions
diff --git a/automation/source/miniapp/editwin.cxx b/automation/source/miniapp/editwin.cxx index 50a333a20a92..a495d5140440 100644 --- a/automation/source/miniapp/editwin.cxx +++ b/automation/source/miniapp/editwin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: editwin.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mh $ $Date: 2002-11-18 11:17:26 $ + * last change: $Author: gh $ $Date: 2002-11-20 11:28:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,7 @@ GHEditWindow::GHEditWindow(Window * pParent, String aName, WinBits iWstyle) : FloatingWindow(pParent) , aInhalt(this,iWstyle) { + SetOutputSizePixel( Size( 120,80 ) ); Show(); Resize(); aInhalt.Show(); @@ -150,7 +151,7 @@ void EditFileWindow::LoadFile() BOOL EditFileWindow::Close() { - if (aInhalt.IsModified() && QueryBox(this,WB_DEF_YES | WB_YES_NO_CANCEL, String(aFileName).AppendAscii("\nwurde verändert.\n\nDatei Speichern?")).Execute()) + if (aInhalt.IsModified() && QueryBox(this,WB_DEF_YES | WB_YES_NO_CANCEL, String(aFileName).AppendAscii("\nhas been changed.\n\nSave file?")).Execute()) { } diff --git a/automation/source/miniapp/test.bas b/automation/source/miniapp/test.bas index f454807cf2a8..6d00e892fcb3 100644 --- a/automation/source/miniapp/test.bas +++ b/automation/source/miniapp/test.bas @@ -1,7 +1,7 @@ +'encoding UTF-8 Do not remove or change this line! sub main - -wintree ' cMassentest +' DisplayHid cTestdialog cSysDlgTest cFileOpenTest @@ -11,6 +11,7 @@ wintree end sub testcase cMassentest + DisplayHid resetapplication FileDialog @@ -27,10 +28,6 @@ lang = lang + lang lang = lang + lang lang = lang + lang -'lang = lang + lang -'lang = lang + lang -'lang = lang + lang -'print len(lang) nodebug while 1 c = c + 1 @@ -48,7 +45,7 @@ endcase testcase cFileOpenTest FileOpenTest - wintree + setclipboard wintree kontext active.cancel @@ -58,10 +55,10 @@ endcase testcase cSysDlgTest SysDialogs - wintree + setclipboard wintree kontext active.yes - wintree + setclipboard wintree active.ok active.Cancel @@ -93,9 +90,8 @@ endcase sub LoadIncludeFiles -' start "d:\prj\actual\basic\source\testtool\server\debug\server.exe" - start "d:\office40.vcl\miniapp.exe" + start "miniapp.exe", "-enableautomation" use "test.win" use "test.sid" @@ -108,13 +104,8 @@ sub testenter end sub sub testexit -' if GrosserTestDlg.exists (1) then -' GrosserTestDlg.ok -' endif dim xx - xx = GetNextError - if xx > "" then print xx xx = resetapplication if xx > "" then warnlog xx diff --git a/automation/source/miniapp/testapp.cxx b/automation/source/miniapp/testapp.cxx index ce1e7d58ab72..89df1dbac6d2 100644 --- a/automation/source/miniapp/testapp.cxx +++ b/automation/source/miniapp/testapp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: testapp.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mh $ $Date: 2002-11-18 11:18:30 $ + * last change: $Author: gh $ $Date: 2002-11-20 11:28:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,14 +75,42 @@ #ifndef _SVTOOLS_TTPROPS_HXX // handmade #include <svtools/ttprops.hxx> #endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif +#ifndef _OSL_PROCESS_H_ +#include <osl/process.h> +#endif +#include <ucbhelper/contentbroker.hxx> +#include <ucbhelper/configurationkeys.hxx> +#ifndef _COMPHELPER_REGPATHHELPER_HXX_ +#include <comphelper/regpathhelper.hxx> +#endif +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif +#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 rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; +using namespace com::sun::star::ucb; MainWindow::MainWindow(MyApp *pAppl) -: WorkWindow(NULL, WB_APP | WB_STDWORK) +: WorkWindow(NULL, WB_STDWORK) , pApp(pAppl) {} @@ -163,17 +191,16 @@ void MainWindow::WinTree() void MainWindow::SysDlg() { - - switch (QueryBox(this,WB_YES_NO_CANCEL | WB_DEF_YES, CUniString("Soll noch ein Dialog geöffnet werden?")).Execute()) - { - case RET_YES: - while ( WarningBox(this,WB_OK_CANCEL | WB_DEF_OK,CUniString("Das ist jetzt aber die letzte Box")).Execute() == RET_OK ); - break; - case RET_NO: - break; - case RET_CANCEL:InfoBox(this,CUniString("Schade")).Execute(); - break; - } + 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; + } /* @@ -287,18 +314,76 @@ 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; + ucb::ContentBroker::initialize( xSMgr, aArgs ); + Reference< XContentProviderManager > xUcb = + ucb::ContentBroker::get()->getContentProviderManagerInterface(); + + Reference< XContentProvider > xFileProvider + ( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ) ), UNO_QUERY ); + xUcb->registerContentProvider( xFileProvider, OUString::createFromAscii( "file" ), sal_True ); + + return xUcb; +} void MyApp::Main() { - ResMgr *pRes = new ResMgr( CUniString("miniapp.res") ); - Resource::SetResManager( pRes ); + Reference< XContentProviderManager > xUcb = InitializeUCB(); + LanguageType aRequestedLanguage; + aRequestedLanguage = LanguageType( LANGUAGE_GERMAN ); + + AllSettings aSettings = GetSettings(); + aSettings.SetUILanguage( aRequestedLanguage ); + aSettings.SetLanguage( aRequestedLanguage ); + SetSettings( aSettings ); + Resource::SetResManager( CREATEVERSIONRESMGR( tma ) ); MainWindow MainWin(this); pMainWin = &MainWin; MenuBar aMenu(ResId(MENU_CLIENT)); MainWin.SetMenuBar( &aMenu ); - aMenu.SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl)); + aMenu.GetPopupMenu( IDM_FILE )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl)); + aMenu.GetPopupMenu( IDM_TEST )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl)); MyDispatcher MyDsp(pMainWin); pMyDispatcher = &MyDsp; |