2001-05-08 05:56:39 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 04:05:01 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-05-08 05:56:39 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-05-08 05:56:39 -05:00
|
|
|
*
|
2008-04-11 04:05:01 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-05-08 05:56:39 -05:00
|
|
|
*
|
2008-04-11 04:05:01 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-05-08 05:56:39 -05:00
|
|
|
*
|
2008-04-11 04:05:01 -05:00
|
|
|
* 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.
|
2001-05-08 05:56:39 -05:00
|
|
|
*
|
2008-04-11 04:05:01 -05:00
|
|
|
* 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).
|
2001-05-08 05:56:39 -05:00
|
|
|
*
|
2008-04-11 04:05:01 -05:00
|
|
|
* 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.
|
2001-05-08 05:56:39 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2008-03-05 09:54:15 -06:00
|
|
|
#include "tools/testtoolloader.hxx"
|
2001-05-08 05:56:39 -05:00
|
|
|
|
2008-03-05 09:54:15 -06:00
|
|
|
#include "vcl/svapp.hxx"
|
|
|
|
#include "vcl/wrkwin.hxx"
|
|
|
|
#include "vcl/unowrap.hxx"
|
2005-04-22 05:36:33 -05:00
|
|
|
|
2008-03-05 09:54:15 -06:00
|
|
|
#include "padialog.hxx"
|
|
|
|
#include "helper.hxx"
|
|
|
|
#include "desktopcontext.hxx"
|
2001-05-08 05:56:39 -05:00
|
|
|
|
2008-03-05 09:54:15 -06:00
|
|
|
#include "cppuhelper/bootstrap.hxx"
|
|
|
|
#include "comphelper/processfactory.hxx"
|
|
|
|
#include "ucbhelper/contentbroker.hxx"
|
|
|
|
#include "ucbhelper/configurationkeys.hxx"
|
|
|
|
#include "unotools/configmgr.hxx"
|
2001-05-08 05:56:39 -05:00
|
|
|
|
2008-03-05 09:54:15 -06:00
|
|
|
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
|
2002-10-01 04:41:46 -05:00
|
|
|
|
2001-05-08 05:56:39 -05:00
|
|
|
using namespace padmin;
|
|
|
|
using namespace rtl;
|
|
|
|
using namespace cppu;
|
|
|
|
using namespace com::sun::star::uno;
|
|
|
|
using namespace com::sun::star::lang;
|
|
|
|
using namespace comphelper;
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class MyApp : public Application
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Main();
|
|
|
|
virtual USHORT Exception( USHORT nError );
|
2008-03-05 09:54:15 -06:00
|
|
|
|
|
|
|
static void ReadStringHook( String& );
|
2001-05-08 05:56:39 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
MyApp aMyApp;
|
|
|
|
|
2008-03-05 09:54:15 -06:00
|
|
|
void MyApp::ReadStringHook( String& rStr )
|
|
|
|
{
|
|
|
|
static String maProduct;
|
|
|
|
if( ! maProduct.Len() )
|
|
|
|
{
|
|
|
|
Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME );
|
|
|
|
OUString aProd;
|
|
|
|
aRet >>= aProd;
|
|
|
|
maProduct = String( aProd );
|
|
|
|
}
|
|
|
|
rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", maProduct );
|
|
|
|
};
|
|
|
|
|
2001-05-08 05:56:39 -05:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
USHORT MyApp::Exception( USHORT nError )
|
|
|
|
{
|
|
|
|
switch( nError & EXC_MAJORTYPE )
|
|
|
|
{
|
|
|
|
case EXC_RSCNOTLOADED:
|
|
|
|
Abort( String::CreateFromAscii( "Error: could not load language resources.\nPlease check your installation.\n" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MyApp::Main()
|
|
|
|
{
|
|
|
|
PADialog* pPADialog;
|
|
|
|
|
2004-06-17 05:48:26 -05:00
|
|
|
EnableAutoHelpId();
|
|
|
|
|
2001-05-08 05:56:39 -05:00
|
|
|
//-------------------------------------------------
|
|
|
|
// create the global service-manager
|
|
|
|
//-------------------------------------------------
|
2004-03-17 03:08:45 -06:00
|
|
|
Reference< XMultiServiceFactory > xFactory;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XComponentContext > xCtx = defaultBootstrap_InitialComponentContext();
|
|
|
|
xFactory = Reference< XMultiServiceFactory >( xCtx->getServiceManager(), UNO_QUERY );
|
|
|
|
if( xFactory.is() )
|
|
|
|
setProcessServiceFactory( xFactory );
|
|
|
|
}
|
|
|
|
catch( com::sun::star::uno::Exception& rExc)
|
|
|
|
{
|
|
|
|
}
|
2003-12-17 08:29:43 -06:00
|
|
|
|
2004-03-17 03:08:45 -06:00
|
|
|
if( ! xFactory.is() )
|
2003-12-17 08:29:43 -06:00
|
|
|
{
|
2004-03-17 03:08:45 -06:00
|
|
|
fprintf( stderr, "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
|
|
|
|
exit( 1 );
|
2003-12-17 08:29:43 -06:00
|
|
|
}
|
|
|
|
|
2005-04-22 05:36:33 -05:00
|
|
|
// Detect desktop environment - need to do this as early as possible
|
|
|
|
com::sun::star::uno::setCurrentContext(
|
|
|
|
new DesktopContext( com::sun::star::uno::getCurrentContext() ) );
|
|
|
|
|
2001-09-04 10:24:50 -05:00
|
|
|
/*
|
|
|
|
* Create UCB.
|
|
|
|
*/
|
|
|
|
Sequence< Any > aArgs( 2 );
|
|
|
|
aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
|
|
|
|
aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
|
2004-03-17 03:45:21 -06:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
sal_Bool bSuccess =
|
|
|
|
#endif
|
2007-06-05 09:01:46 -05:00
|
|
|
::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
|
2001-09-04 10:24:50 -05:00
|
|
|
|
2004-03-18 05:13:00 -06:00
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
2001-09-04 10:24:50 -05:00
|
|
|
if ( !bSuccess )
|
2004-03-17 03:08:45 -06:00
|
|
|
{
|
|
|
|
fprintf( stderr, "Error creating UCB, installation must be in disorder. Exiting.\n" );
|
|
|
|
exit( 1 );
|
|
|
|
}
|
2004-03-18 05:13:00 -06:00
|
|
|
#endif
|
2004-03-17 03:08:45 -06:00
|
|
|
|
2005-04-22 05:36:33 -05:00
|
|
|
/*
|
|
|
|
* Initialize the Java UNO AccessBridge if accessibility is turned on
|
|
|
|
*/
|
|
|
|
|
|
|
|
if( Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() )
|
|
|
|
{
|
|
|
|
BOOL bQuitApp;
|
|
|
|
if( !InitAccessBridge( true, bQuitApp ) )
|
|
|
|
if( bQuitApp )
|
|
|
|
return;
|
|
|
|
}
|
2001-09-04 10:24:50 -05:00
|
|
|
|
2004-06-17 05:48:26 -05:00
|
|
|
// initialize test-tool library (if available)
|
|
|
|
tools::InitTestToolLib();
|
|
|
|
|
2008-03-05 09:54:15 -06:00
|
|
|
ResMgr::SetReadStringHook( MyApp::ReadStringHook );
|
|
|
|
|
2001-05-08 05:56:39 -05:00
|
|
|
pPADialog = PADialog::Create( NULL , FALSE );
|
|
|
|
Application::SetDisplayName( pPADialog->GetText() );
|
2005-03-03 13:00:26 -06:00
|
|
|
pPADialog->SetIcon(501);
|
2001-05-08 05:56:39 -05:00
|
|
|
pPADialog->Execute();
|
|
|
|
delete pPADialog;
|
|
|
|
|
2004-06-17 05:48:26 -05:00
|
|
|
tools::DeInitTestToolLib();
|
|
|
|
|
2001-09-04 10:24:50 -05:00
|
|
|
/*
|
|
|
|
* clean up UCB
|
|
|
|
*/
|
2007-06-05 09:01:46 -05:00
|
|
|
::ucbhelper::ContentBroker::deinitialize();
|
2001-09-04 10:24:50 -05:00
|
|
|
|
2001-05-08 05:56:39 -05:00
|
|
|
}
|