#89023# splash screen optimization

This commit is contained in:
Carsten Driesner
2001-07-16 11:55:47 +00:00
parent 07f5efbf08
commit ee3351d78c
23 changed files with 3496 additions and 209 deletions

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: app.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: mba $ $Date: 2001-07-10 11:33:27 $
* last change: $Author: cd $ $Date: 2001-07-16 12:53:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,33 +62,48 @@
#ifndef _DESK_APP_HXX
#define _DESK_APP_HXX
#ifndef _OFF_APP_HXX //autogen
#include <sfx2/app.hxx>
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _TOOLS_RESMGR_HXX
#include <tools/resmgr.hxx>
#endif
/*--------------------------------------------------------------------
Beschreibung: Applikations-Klasse
Description: Application-class
--------------------------------------------------------------------*/
class IntroWindow_Impl;
class Desktop : public SfxApplicationClass
class Desktop : public Application //public SfxApplicationClass
{
public:
Desktop();
virtual void Main();
virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame );
public:
Desktop();
virtual void Main( );
virtual void Init();
virtual void DeInit();
virtual BOOL QueryExit();
virtual USHORT Exception(USHORT nError);
virtual void Property( ApplicationProperty& );
virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame );
virtual void AppEvent( const ApplicationEvent& rAppEvent );
DECL_LINK( OpenClients_Impl, void* );
DECL_LINK( OpenClients_Impl, void* );
private:
void ParseCommandLine();
void OpenStartupScreen( const char* );
void CloseStartupScreen();
static void OpenClients();
static void OpenDefault();
static void HandleAppEvent( const ApplicationEvent& rAppEvent );
static ResMgr* GetDesktopResManager();
sal_Bool m_bMinimized;
sal_Bool m_bInvisible;
USHORT m_nAppEvents;
ResMgr* m_pLabelResMgr;
IntroWindow_Impl* m_pIntro;
private:
void OpenStartupScreen( const char* );
void CloseStartupScreen();
sal_Bool m_bMinimized;
sal_Bool m_bInvisible;
USHORT m_nAppEvents;
ResMgr* m_pLabelResMgr;
IntroWindow_Impl* m_pIntro;
static ResMgr* pResMgr;
};
#endif
#endif // DESK_APP_HXX_

View File

@@ -2,9 +2,10 @@ dt desktop : sc sd sw NULL
dt desktop usr1 - all dt_mkout NULL
dt desktop\inc get - all dt_inc NULL
dt desktop\prj get - all dt_prj NULL
dt desktop\jobs get - all dt_jobs NULL
dt desktop\jobs get - all dt_jobs NULL
dt desktop\res get - all dt_res NULL
dt desktop\source\app nmake - all dt_app NULL
dt desktop\win32\source nmake - w dt_wrapper NULL
dt desktop\source\javaldx nmake - u dt_javaldx NULL
dt desktop\util nmake - all dt_util dt_app dt_wrapper.w NULL
dt desktop\source\app nmake - all dt_app NULL
dt desktop\source\offwrp nmake - all dt_offwrp NULL
dt desktop\win32\source nmake - w dt_wrapper NULL
dt desktop\source\javaldx nmake - u dt_javaldx NULL
dt desktop\util nmake - all dt_util dt_app dt_offwrp dt_wrapper.w NULL

View File

@@ -20,6 +20,8 @@ mkdir: %_DEST%\bin%_EXT%\remote2
..\%__SRC%\bin\sweb %_DEST%\bin%_EXT%\sweb.bin
..\%__SRC%\bin\javaldx %_DEST%\bin%_EXT%\javaldx
..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
..\res\s*.exe %_DEST%\bin%_EXT%\s*.exe
..\%__SRC%\lib\lib*static*.dylib %_DEST%\lib%_EXT%\lib*static*.dylib

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: app.cxx,v $
*
* $Revision: 1.23 $
* $Revision: 1.24 $
*
* last change: $Author: mba $ $Date: 2001-07-10 11:34:26 $
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,49 +60,129 @@
************************************************************************/
#include "app.hxx"
#include "wrapper.hxx"
#include "desktop.hrc"
#include "appinit.hxx"
#include "intro.hxx"
#include "officeipcthread.hxx"
#include "cmdlineargs.hxx"
#include "officeacceptthread.hxx"
#include "pluginacceptthread.hxx"
#include "appsys.hxx"
#include "desktopresid.hxx"
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#ifndef _COM_SUN_STAR_BRIDGE_XCONNECTIONBROKER_HPP_
#include <com/sun/star/bridge/XConnectionBroker.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
#include <com/sun/star/frame/XDesktop.hpp>
#endif
#ifndef _COM_SUN_STAR_DOCUMENT_XTYPEDETECTION_HPP_
#include <com/sun/star/document/XTypeDetection.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
#include <com/sun/star/frame/XComponentLoader.hpp>
#endif
#ifndef _COM_SUN_STAR_VIEW_XPRINTABLE_HPP_
#include <com/sun/star/view/XPrintable.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XTASKSSUPPLIER_HPP_
#include <com/sun/star/frame/XTasksSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
#include <com/sun/star/awt/XTopWindow.hpp>
#endif
#include <offmgr/app.hxx>
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/unohlp.hxx>
#endif
#ifndef _VOS_SECURITY_HXX_
#include <vos/security.hxx>
#endif
#include <comphelper/processfactory.hxx>
#include <sfx2/sfxuno.hxx>
#ifndef _UTL_CONFIGMGR_HXX_
#include <unotools/configmgr.hxx>
#endif
#ifndef _UTL_CONFIGITEM_HXX_
#include <unotools/configitem.hxx>
#endif
#ifndef _VOS_PROCESS_HXX_
#include <vos/process.hxx>
#ifndef _UNOTOOLS_UCBHELPER_HXX
#include <unotools/ucbhelper.hxx>
#endif
#ifndef _TOOLS_TEMPFILE_HXX
#include <tools/tempfile.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
#include <svtools/moduleoptions.hxx>
#endif
#ifndef SVTOOLS_TESTTOOL_HXX
#include <svtools/testtool.hxx>
#endif
#include <svtools/pathoptions.hxx>
#include <svtools/cjkoptions.hxx>
#include <svtools/internaloptions.hxx>
#include <rtl/logfile.hxx>
#include <setup2/installer.hxx>
#include <svtools/pathoptions.hxx>
#include "svtools/cjkoptions.hxx"
#include <unotools/configmgr.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/bitmap.hxx>
#include <sfx2/sfx.hrc>
#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
#include <com/sun/star/uno/Exception.hpp>
#endif
#include <ucbhelper/contentbroker.hxx>
#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII##))
#define U2S(STRING) ::rtl::OUStringToOString(STRING, RTL_TEXTENCODING_UTF8)
using namespace vos;
using namespace rtl;
using namespace desktop;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::bridge;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::view;
static SalMainPipeExchangeSignalHandler* pSignalHandler = 0;
OOfficeAcceptorThread* pOfficeAcceptThread = 0;
ResMgr* Desktop::pResMgr = 0;
// ----------------------------------------------------------------------------
ResMgr* Desktop::GetDesktopResManager()
{
if ( !Desktop::pResMgr )
{
String aMgrName = String::CreateFromAscii( "dkt" );
aMgrName += String::CreateFromInt32(SOLARUPD);
return ResMgr::CreateResMgr(U2S(aMgrName));
}
return Desktop::pResMgr;
}
CommandLineArgs* GetCommandLineArgs()
{
static CommandLineArgs* pArgs = 0;
if ( !pArgs )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if ( !pArgs )
pArgs = new CommandLineArgs( ::vos::OExtCommandLine() );
}
return pArgs;
}
void PreloadConfigTrees()
{
@@ -163,15 +243,82 @@ void ReplaceStringHookProc( UniString& rStr )
Desktop aDesktop;
/*
BOOL SVMain()
{
BOOL bInit = InitVCL( Reference < XMultiServiceFactory >() );
if( bInit )
{
GetpApp()->Main();
}
DeInitVCL();
return bInit;
}
*/
Desktop::Desktop() : m_pLabelResMgr( 0 ), m_pIntro( 0 )
{
RTL_LOGFILE_CONTEXT( aLog, "Desktop::Desktop()" );
}
void Desktop::Init()
{
Reference < XMultiServiceFactory > rSMgr = createApplicationServiceManager();
if( ! rSMgr.is() )
exit(0);
::comphelper::setProcessServiceFactory( rSMgr );
if ( !Application::IsRemoteServer() )
{
// start ipc thread only for non-remote offices
RTL_LOGFILE_CONTEXT( aLog, "OfficeIPCThread::EnableOfficeIPCThread" );
if( !OfficeIPCThread::EnableOfficeIPCThread( ) )
exit( 0 );
pSignalHandler = new SalMainPipeExchangeSignalHandler;
}
}
void Desktop::DeInit()
{
destroyApplicationServiceManager( ::comphelper::getProcessServiceFactory() );
if( !Application::IsRemoteServer() )
{
OfficeIPCThread::DisableOfficeIPCThread();
if( pSignalHandler )
DELETEZ( pSignalHandler );
}
}
BOOL Desktop::QueryExit()
{
return TRUE;
}
USHORT Desktop::Exception(USHORT nError)
{
// first test implementation!!
sal_uInt16 nOldMode = Application::GetSystemWindowMode();
Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
return Application::Exception( nError );
}
void Desktop::Property( ApplicationProperty& )
{
}
void Desktop::AppEvent( const ApplicationEvent& rAppEvent )
{
HandleAppEvent( rAppEvent );
}
void Desktop::Main()
{
RTL_LOGFILE_CONTEXT( aLog, "Desktop::Main()" );
CommandLineArgs* pCmdLineArgs = GetCommandLineArgs();
// ---- Startup screen ----
OpenStartupScreen( "iso" );
@@ -191,21 +338,10 @@ void Desktop::Main()
}
#endif
bool bTerminate = false;
int nParamCount = GetCommandLineParamCount();
sal_Bool bTerminate = pCmdLineArgs->IsTerminateAfterInit();
for( int nActParam = 0; nActParam < nParamCount ; nActParam++ )
{
String sActParam = GetCommandLineParam( nActParam );
if( sActParam.EqualsIgnoreCaseAscii("-terminate_after_init") )
{
bTerminate = true;
break;
}
}
// Read the common configuration items for optimization purpose
// do not do it if terminate flag was specified, to avoid exception
// Read the common configuration items for optimization purpose
// do not do it if terminate flag was specified, to avoid exception
if( !bTerminate )
{
try
@@ -214,15 +350,15 @@ void Desktop::Main()
}
catch(com::sun::star::uno::Exception &e)
{
bTerminate = true;
bTerminate = sal_True;
rtl::OUString sError = rtl::OUString::createFromAscii("Unable to retrieve application configuration data: ");
sError += e.Message;
Application::Abort(sError);
}
}
// The only step that should be done if terminate flag was specified
// Typically called by the plugin only
// The only step that should be done if terminate flag was specified
// Typically called by the plugin only
RTL_LOGFILE_CONTEXT_TRACE( aLog, "start Installer::InitializeInstallation()" );
Installer* pInstaller = new Installer;
pInstaller->InitializeInstallation( Application::GetAppFileName() );
@@ -231,52 +367,446 @@ void Desktop::Main()
if( !bTerminate )
{
Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "start create SvtPathOptions/SvtCJKOptions" );
SvtPathOptions* pPathOptions = new SvtPathOptions;
SvtCJKOptions* pCJKOPptions = new SvtCJKOptions(sal_True);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "end create SvtPathOptions/SvtCJKOptions" );
RegisterServices();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "start create OfficeWrapper::OfficeWrapper()" );
OfficeWrapper* pWrapper = new OfficeWrapper( ::comphelper::getProcessServiceFactory() );
RTL_LOGFILE_CONTEXT_TRACE( aLog, "end create OfficeWrapper::OfficeWrapper()" );
// Reference < XComponent > xWrapper( ::utl::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.office.OfficeWrapper" ) ), UNO_QUERY );
registerServices( xSMgr );
// Post user event to startup first application component window
Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
RTL_LOGFILE_CONTEXT_TRACE( aLog, "start call SfxApplicationClass::Main()" );
SfxApplicationClass::Main();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "end call SfxApplicationClass::Main()" );
// xWrapper->dispose();
OUString aDescription;
Sequence< Any > aSeq( 1 );
if( pWrapper!=NULL)
if ( pOfficeAcceptThread )
aDescription = pOfficeAcceptThread->GetDescriptionString();
else
pCmdLineArgs->GetPortalConnectString( aDescription );
aSeq[0] <<= aDescription;
Reference < XComponent > xWrapper( xSMgr->createInstanceWithArguments( DEFINE_CONST_UNICODE(
"com.sun.star.office.OfficeWrapper" ), aSeq ),
UNO_QUERY );
// code from SfxApplicationClass::Main copied!!
{
delete pWrapper;
pWrapper=NULL;
RTL_LOGFILE_CONTEXT( aLog, "SfxApplicationClass::Main()" );
Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
Reference< XConnectionBroker > xServiceManagerBroker;
Reference< XConnectionBroker > xPalmPilotManagerBroker;
PluginAcceptThread* pPluginAcceptThread = 0;
RemoteControl aControl;
// the shutdown icon sits in the systray and allows the user to keep
// the office instance running for quicker restart
// this will only be activated if -quickstart was specified on cmdline
Reference < XComponent > xQuickstart( xSMgr->createInstance(
DEFINE_CONST_UNICODE( "com.sun.star.office.Quickstart" )), UNO_QUERY );
if ( pCmdLineArgs->IsPlugin() )
{
OUString aAcceptString( RTL_CONSTASCII_USTRINGPARAM( "pipe,name=soffice_plugin" ));
OUString aUserIdent;
OSecurity aSecurity;
aSecurity.getUserIdent( aUserIdent );
aAcceptString += aUserIdent;
pPluginAcceptThread = new PluginAcceptThread( xSMgr,
new OInstanceProvider( xSMgr ),
aAcceptString );
// We have to acquire the plugin accept thread object to be sure
// that the instance is still alive after an exception was thrown
pPluginAcceptThread->acquire();
pPluginAcceptThread->create();
}
if ( !Application::IsRemoteServer() )
{
// Create TypeDetection service to have filter informations for quickstart feature
Reference< XTypeDetection > xTypeDetection( xSMgr->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ))),
UNO_QUERY );
}
int nAcquireCount = 0;
::vos::IMutex& rMutex = Application::GetSolarMutex();
if ( rMutex.tryToAcquire() )
nAcquireCount = Application::ReleaseSolarMutex() - 1;
Application::WaitForClientConnect();
// Post user event to startup first application component window
// We have to send this OpenClients message short before execute() to
// minimize the risk that this message overtakes type detection contruction!!
Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
RTL_LOGFILE_CONTEXT_TRACE( aLog, "call Application::Execute()" );
if ( nAcquireCount )
Application::AcquireSolarMutex( nAcquireCount );
// call Application::Execute to process messages in vcl message loop
Execute();
// remove temp directory
removeTemporaryDirectory();
if( xPalmPilotManagerBroker.is() )
xPalmPilotManagerBroker->stopAccepting();
if( xServiceManagerBroker.is() )
xServiceManagerBroker->stopAccepting();
if( pOfficeAcceptThread )
{
pOfficeAcceptThread->stopAccepting();
#ifndef LINUX
pOfficeAcceptThread->join();
delete pOfficeAcceptThread;
#endif
pOfficeAcceptThread = 0;
}
if ( pPluginAcceptThread )
{
pPluginAcceptThread->terminate();
pPluginAcceptThread->release();
}
}
xWrapper->dispose();
xWrapper = 0;
delete pCJKOPptions;
delete pPathOptions;
}
// instead of removing of the configManager jast let it commit all the changes
utl::ConfigManager::GetConfigManager()->StoreConfigItems();
::ucb::ContentBroker::deinitialize();
//utl::ConfigManager::RemoveConfigManager();
// instead of removing of the configManager just let it commit all the changes
utl::ConfigManager::GetConfigManager()->StoreConfigItems();
}
void Desktop::SystemSettingsChanging( AllSettings& rSettings, Window* pFrame )
{
OFF_APP()->SystemSettingsChanging( rSettings, pFrame );
// OFF_APP()->SystemSettingsChanging( rSettings, pFrame );
}
IMPL_LINK( Desktop, OpenClients_Impl, void*, pvoid )
{
SfxApplicationClass::OpenClients();
OpenClients();
CloseStartupScreen();
return 0;
}
void Desktop::OpenClients()
{
// check if a document has been recovered - if there is one of if a document was loaded by cmdline, no default document
// should be created
Reference < XComponent > xFirst;
BOOL bLoaded = FALSE;
CommandLineArgs* pArgs = GetCommandLineArgs();
SvtInternalOptions aInternalOptions;
if ( !pArgs->IsServer() && !aInternalOptions.IsRecoveryListEmpty() )
{
// crash recovery
sal_Bool bUserCancel = sal_False;
::rtl::OUString sURL;
::rtl::OUString sFilter;
::rtl::OUString sTempName;
Reference< XComponentLoader > xDesktop(
::comphelper::getProcessServiceFactory()->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
::com::sun::star::uno::UNO_QUERY );
// create the parameter array
Sequence < PropertyValue > aArgs( 5 );
aArgs[0].Name = ::rtl::OUString::createFromAscii("Referer");
aArgs[1].Name = ::rtl::OUString::createFromAscii("AsTemplate");
aArgs[2].Name = ::rtl::OUString::createFromAscii("FilterName");
aArgs[3].Name = ::rtl::OUString::createFromAscii("RealURL");
aArgs[4].Name = ::rtl::OUString::createFromAscii("SalvagedFile");
// mark it as a user request
aArgs[0].Value <<= ::rtl::OUString::createFromAscii("private:user");
while( !aInternalOptions.IsRecoveryListEmpty() && !bUserCancel )
{
// Read and delete top recovery item from list
aInternalOptions.PopRecoveryItem( sURL, sFilter, sTempName );
INetURLObject aURL( sURL );
sal_Bool bIsURL = aURL.GetProtocol() != INET_PROT_NOT_VALID;
String sRealFileName( sURL );
String sTempFileName( sTempName );
String aMsg( DesktopResId( STR_RECOVER_QUERY ) );
aMsg.SearchAndReplaceAscii( "$1", sRealFileName );
MessBox aBox( NULL, WB_YES_NO_CANCEL | WB_DEF_YES | WB_3DLOOK, String( DesktopResId( STR_RECOVER_TITLE ) ), aMsg );
switch( aBox.Execute() )
{
case RET_YES:
{
// recover a file
aArgs[2].Value <<= ::rtl::OUString( sFilter );
if ( bIsURL )
{
// get the original URL for the recovered document
aArgs[1].Value <<= sal_False;
aArgs[3].Value <<= ::rtl::OUString( sRealFileName );
aArgs[4].Value <<= ::rtl::OUString( sRealFileName );
}
else
{
// this was an untitled document ( open as template )
aArgs[1].Value <<= sal_True;
aArgs[3].Value <<= ::rtl::OUString();
aArgs[4].Value <<= ::rtl::OUString();
}
// load the document
Reference < XComponent > xDoc = xDesktop->loadComponentFromURL( sTempFileName, ::rtl::OUString::createFromAscii( "_blank" ), 0, aArgs );
if ( !xFirst.is() )
// remember the first successfully recovered file
xFirst = xDoc;
// remove saved copy
::utl::UCBContentHelper::Kill( sTempFileName );
break;
}
case RET_NO:
{
// skip this file
::utl::UCBContentHelper::Kill( sTempFileName );
break;
}
case RET_CANCEL:
{
// cancel recovering
::utl::UCBContentHelper::Kill( sTempFileName );
bUserCancel = sal_True;
// delete recovery list and all files
while( aInternalOptions.IsRecoveryListEmpty() == sal_False )
{
aInternalOptions.PopRecoveryItem( sURL, sFilter, sTempName );
::utl::UCBContentHelper::Kill( sTempName );
}
break;
}
}
}
}
// check for open parameters
String aEmptyStr;
::rtl::OUString aOpenList;
if ( pArgs->GetOpenList( aOpenList ) )
{
bLoaded = TRUE;
ApplicationEvent* pAppEvt = new ApplicationEvent( aEmptyStr, aEmptyStr,
APPEVENT_OPEN_STRING,
aOpenList );
HandleAppEvent( *pAppEvt );
delete pAppEvt;
}
// check for print parameters
::rtl::OUString aPrintList;
if ( pArgs->GetPrintList( aPrintList ) )
{
bLoaded = TRUE;
ApplicationEvent* pAppEvt = new ApplicationEvent( aEmptyStr, aEmptyStr,
APPEVENT_PRINT_STRING,
aPrintList );
HandleAppEvent( *pAppEvt );
delete pAppEvt;
}
// no default document if a document was loaded by recovery or by command line or if soffice is used as server
if ( bLoaded || xFirst.is() || pArgs->IsServer() )
return;
if( pArgs->IsQuickstart() ||
pArgs->IsInvisible() ||
pArgs->IsPlugin() ||
pArgs->IsBean() )
// soffice was started as tray icon
return;
{
OpenDefault();
}
}
void Desktop::OpenDefault()
{
String aName;
if ( !aName.Len() )
{
aName = String( DEFINE_CONST_UNICODE("private:factory/" ) );
SvtModuleOptions aOpt;
if ( aOpt.IsWriter() )
aName += DEFINE_CONST_UNICODE("swriter");
else if ( aOpt.IsCalc() )
aName += DEFINE_CONST_UNICODE("scalc");
else if ( aOpt.IsImpress() )
aName += DEFINE_CONST_UNICODE("simpress");
else if ( aOpt.IsDraw() )
aName += DEFINE_CONST_UNICODE("sdraw");
else
return;
}
Sequence < PropertyValue > aNoArgs;
Reference< XComponentLoader > xDesktop(
::comphelper::getProcessServiceFactory()->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
::com::sun::star::uno::UNO_QUERY );
xDesktop->loadComponentFromURL( aName, ::rtl::OUString::createFromAscii( "_blank" ), 0, aNoArgs );
}
String GetURL_Impl( const String& rName )
{
// if the filename is a physical name, it is the client file system, not the file system
// of the machine where the office is running ( if this are different machines )
// so in the remote case we can't handle relative filenames as arguments, because they
// are parsed relative to the program path
// the file system of the client is addressed through the "file:" protocol
::rtl::OUString aProgName, aTmp;
::vos::OStartupInfo aInfo;
aInfo.getExecutableFile( aProgName );
aTmp = aProgName;
INetURLObject aObj( aTmp );
bool bWasAbsolute;
INetURLObject aURL = aObj.smartRel2Abs( rName, bWasAbsolute );
return aURL.GetMainURL(INetURLObject::NO_DECODE);
}
void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
{
if ( rAppEvent.IsOpenEvent() || rAppEvent.IsPrintEvent() )
{
String aPrinterName;
Reference< XComponentLoader > xDesktop(
::comphelper::getProcessServiceFactory()->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
::com::sun::star::uno::UNO_QUERY );
// create parameter array
sal_Int32 nCount = rAppEvent.IsPrintEvent() ? 5 : 1;
Sequence < PropertyValue > aArgs( nCount );
aArgs[0].Name = ::rtl::OUString::createFromAscii("Referer");
if ( rAppEvent.IsPrintEvent() )
{
aArgs[1].Name = ::rtl::OUString::createFromAscii("ReadOnly");
aArgs[2].Name = ::rtl::OUString::createFromAscii("OpenNewView");
aArgs[3].Name = ::rtl::OUString::createFromAscii("Hidden");
aArgs[4].Name = ::rtl::OUString::createFromAscii("Silent");
}
// mark request as user interaction from outside
aArgs[0].Value <<= ::rtl::OUString::createFromAscii("private:OpenEvent");
for( sal_uInt16 i=0; i<rAppEvent.GetParamCount(); i++ )
{
// get file name
String aName( rAppEvent.GetParam(i) );
// is the parameter a printername ?
if( aName.Len()>1 && *aName.GetBuffer()=='@' )
{
aPrinterName = aName.Copy(1);
continue;
}
#ifdef WNT
FATToVFat_Impl( aName );
#endif
aName = GetURL_Impl(aName);
if ( rAppEvent.IsPrintEvent() )
{
// documents opened for printing are opened readonly because they must be opened as a new document and this
// document could be open already
aArgs[1].Value <<= sal_True;
// always open a new document for printing, because it must be disposed afterwards
aArgs[2].Value <<= sal_True;
// printing is done in a hidden view
aArgs[3].Value <<= sal_True;
// load document for printing without user interaction
aArgs[4].Value <<= sal_True;
}
// load the document
Reference < XPrintable > xDoc ( xDesktop->loadComponentFromURL( aName, ::rtl::OUString::createFromAscii( "_blank" ), 0, aArgs ), UNO_QUERY );
if ( rAppEvent.IsPrintEvent() )
{
if( aPrinterName.Len() && xDoc.is() )
{
// create the printer
Sequence < PropertyValue > aPrinterArgs( 1 );
aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Name");
aPrinterArgs[0].Value <<= ::rtl::OUString( aPrinterName );
xDoc->setPrinter( aPrinterArgs );
// print ( also without user interaction )
aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Silent");
aPrinterArgs[0].Value <<= ( sal_Bool ) sal_True;
xDoc->print( aPrinterArgs );
}
else
{
// place error message here ...
}
// remove the document
Reference < XComponent > xComp( xDoc, UNO_QUERY );
if ( xComp.is() )
xComp->dispose();
}
}
}
else if ( rAppEvent.GetEvent() == "APPEAR" )
{
// find active task - the active task is always a visible task
::com::sun::star::uno::Reference< ::com::sun::star::frame::XTasksSupplier >
xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( OUSTRING(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
::com::sun::star::uno::UNO_QUERY );
::com::sun::star::uno::Reference< ::com::sun::star::frame::XTask > xTask = xDesktop->getActiveTask();
if ( !xTask.is() )
{
// get any task if there is no active one
::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > xList = xDesktop->getTasks()->createEnumeration();
if ( xList->hasMoreElements() )
xList->nextElement() >>= xTask;
}
if ( xTask.is() )
{
Reference< com::sun::star::awt::XTopWindow > xTop( xTask->getContainerWindow(), UNO_QUERY );
xTop->toFront();
}
else
// no visible task that could be activated found
OpenDefault();
}
}
void Desktop::OpenStartupScreen( const char* pLabelPrefix )
{
RTL_LOGFILE_CONTEXT( aLog, "Desktop::OpenStartupScreen()" );
@@ -296,9 +826,10 @@ void Desktop::OpenStartupScreen( const char* pLabelPrefix )
}
// Intro nur anzeigen, wenn normaler Start (kein Print/Server etc.)
ParseCommandLine();
if ( !m_bInvisible && !m_bMinimized &&
m_nAppEvents != DISPATCH_PRINT && m_nAppEvents != DISPATCH_SERVER )
OUString aTmpString;
CommandLineArgs* pCmdLine = GetCommandLineArgs();
if ( !pCmdLine->IsInvisible() && !pCmdLine->IsQuickstart() && !pCmdLine->IsMinimized() &&
!pCmdLine->IsEmbedding() && !pCmdLine->GetPrintList( aTmpString ) )
{
const USHORT nResId = RID_DEFAULTINTRO;
ResId aIntroBmpRes( nResId, m_pLabelResMgr );
@@ -314,60 +845,3 @@ void Desktop::CloseStartupScreen()
m_pIntro = 0;
}
void Desktop::ParseCommandLine()
{
m_nAppEvents = 0;
m_bMinimized = 0;
m_bInvisible = 0;
BOOL bPrintEvent = FALSE;
BOOL bOpenEvent = TRUE;
::vos::OExtCommandLine aCmdLine;
sal_uInt32 nCount = aCmdLine.getCommandArgCount();
for( sal_uInt32 i=0; i < nCount; i++ )
{
String aArg;
::rtl::OUString aDummy;
aCmdLine.getCommandArg( i, aDummy );
aArg = aDummy;
if ( aArg.EqualsIgnoreCaseAscii("-minimized") == sal_True )
m_bMinimized = sal_True;
else if ( aArg.EqualsIgnoreCaseAscii("-invisible") == sal_True )
m_bInvisible = sal_True;
else if ( aArg.EqualsIgnoreCaseAscii("-embedding") == sal_True )
m_nAppEvents |= DISPATCH_SERVER;
else if ( aArg.EqualsIgnoreCaseAscii("-bean") == sal_True )
m_bInvisible = sal_True;
else if ( aArg.EqualsIgnoreCaseAscii("-plugin") == sal_True )
m_bInvisible = sal_True;
const xub_Unicode* pArg = aArg.GetBuffer();
// Erstmal nur mit -, da unter Unix Dateinmane auch mit Slasch anfangen koennen
if ( (*pArg == '-') /* || (*pArg == '/') */ )
{
pArg++;
// Ein Schalter
if ( (*pArg == 'p') || (*pArg == 'P') )
{
bPrintEvent = TRUE;
bOpenEvent = FALSE; // Ab hier keine OpenEvents mehr
}
}
else
{
if ( bOpenEvent )
{
// Dies wird als Dateiname interpretiert
m_nAppEvents |= DISPATCH_OPEN;
}
else if ( bPrintEvent )
{
// Print Event anhaengen
m_nAppEvents |= DISPATCH_PRINT;
}
}
}
}

View File

@@ -0,0 +1,348 @@
/*************************************************************************
*
* $RCSfile: appinit.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "appinit.hxx"
#include "cmdlineargs.hxx"
#include "officeacceptthread.hxx"
#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
#include <com/sun/star/lang/XInitialization.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
#include <cppuhelper/servicefactory.hxx>
#endif
#ifndef _CPPUHELPER_BOOTSTRAP_HXX_
#include <cppuhelper/bootstrap.hxx>
#endif
#ifndef _OSL_FILE_HXX_
#include <osl/file.hxx>
#endif
#ifndef _VOS_PROCESS_HXX_
#include <vos/process.hxx>
#endif
#ifndef _RTL_URI_HXX_
#include <rtl/uri.hxx>
#endif
#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
#endif
#ifndef _COMPHELPER_REGPATHHELPER_HXX_
#include <comphelper/regpathhelper.hxx>
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _TOOLS_TEMPFILE_HXX
#include <tools/tempfile.hxx>
#endif
#ifndef _UCBHELPER_CONFIGURATIONKEYS_HXX_
#include <ucbhelper/configurationkeys.hxx>
#endif
#include <rtl/logfile.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/ucbhelper.hxx>
#include <unotools/tempfile.hxx>
#include <ucbhelper/contentbroker.hxx>
#include <vcl/svapp.hxx>
#include <svtools/startoptions.hxx>
#include <svtools/pathoptions.hxx>
#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII))
#define DEFINE_CONST_OUSTRING(CONSTASCII) OUString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII))
#define DESKTOP_TEMPNAMEBASE_DIR "$(userpath)/temp/soffice.tmp"
using namespace rtl;
using namespace vos;
using namespace desktop;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::registry;
extern desktop::CommandLineArgs* GetCommandLineArgs();
extern desktop::OOfficeAcceptorThread* pOfficeAcceptThread;
static String aTempNameBaseDir;
static String aTempBase;
// -----------------------------------------------------------------------------
static bool configureUcb(bool bServer, rtl::OUString const & rPortalConnect)
{
Reference< XMultiServiceFactory >
xServiceFactory( comphelper::getProcessServiceFactory() );
if (!xServiceFactory.is())
{
DBG_ERROR("configureUcb(): No XMultiServiceFactory");
return false;
}
rtl::OUString aPipe;
vos::OSecurity().getUserIdent(aPipe);
rtl::OUStringBuffer aPortal;
if (rPortalConnect.getLength() != 0)
{
aPortal.append(sal_Unicode(','));
aPortal.append(rPortalConnect);
}
Sequence< Any > aArgs(6);
aArgs[0]
<<= rtl::OUString::createFromAscii(bServer ?
UCB_CONFIGURATION_KEY1_SERVER :
UCB_CONFIGURATION_KEY1_LOCAL);
aArgs[1]
<<= rtl::OUString::createFromAscii(UCB_CONFIGURATION_KEY2_OFFICE);
aArgs[2] <<= rtl::OUString::createFromAscii("PIPE");
aArgs[3] <<= aPipe;
aArgs[4] <<= rtl::OUString::createFromAscii("PORTAL");
aArgs[5] <<= aPortal.makeStringAndClear();
return ::ucb::ContentBroker::initialize( xServiceFactory, aArgs ) != false;
}
Reference< XMultiServiceFactory > createApplicationServiceManager()
{
try
{
::rtl::OUString localRegistry = ::comphelper::getPathToUserRegistry();
::rtl::OUString systemRegistry = ::comphelper::getPathToSystemRegistry();
Reference< XSimpleRegistry > xLocalRegistry( ::cppu::createSimpleRegistry() );
Reference< XSimpleRegistry > xSystemRegistry( ::cppu::createSimpleRegistry() );
if ( xLocalRegistry.is() && (localRegistry.getLength() > 0) )
{
try
{
xLocalRegistry->open( localRegistry, sal_False, sal_True);
}
catch ( InvalidRegistryException& )
{
}
if ( !xLocalRegistry->isValid() )
xLocalRegistry->open(localRegistry, sal_True, sal_True);
}
if ( xSystemRegistry.is() && (systemRegistry.getLength() > 0) )
xSystemRegistry->open( systemRegistry, sal_True, sal_False);
if ( (xLocalRegistry.is() && xLocalRegistry->isValid()) &&
(xSystemRegistry.is() && xSystemRegistry->isValid()) )
{
Reference < XSimpleRegistry > xReg( ::cppu::createNestedRegistry() );
Sequence< Any > seqAnys(2);
seqAnys[0] <<= xLocalRegistry ;
seqAnys[1] <<= xSystemRegistry ;
Reference< XInitialization > xInit( xReg, UNO_QUERY );
xInit->initialize( seqAnys );
Reference< XComponentContext > xContext( ::cppu::bootstrap_InitialComponentContext( xReg ) );
return Reference< XMultiServiceFactory >( xContext->getServiceManager(), UNO_QUERY );
}
}
catch( ::com::sun::star::uno::Exception& )
{
}
return ::cppu::createServiceFactory();
}
void destroyApplicationServiceManager( Reference< XMultiServiceFactory >& xSMgr )
{
Reference< XPropertySet > xProps( xSMgr, UNO_QUERY );
if ( xProps.is() )
{
try
{
Reference< XComponent > xComp;
if (xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComp )
{
xComp->dispose();
}
}
catch ( UnknownPropertyException& )
{
}
}
}
void registerServices( Reference< XMultiServiceFactory >& xSMgr )
{
// read command line parameters
::rtl::OUString conDcp;
::rtl::OUString aClientDisplay;
::rtl::OUString aUserDir;
::rtl::OUString aTmpString;
sal_Bool bHeadlessMode = sal_False;
// interpret command line arguments
CommandLineArgs* pCmdLine = GetCommandLineArgs();
// read accept string from configuration
if ( !Application::IsRemoteServer() )
conDcp = SvtStartOptions().GetConnectionURL();
if ( pCmdLine->GetAcceptString( aTmpString ))
conDcp = aTmpString;
pCmdLine->GetUserDir( aUserDir );
if ( Application::IsRemoteServer() )
{
bHeadlessMode = pCmdLine->IsHeadless();
pCmdLine->GetClientDisplay( aClientDisplay );
}
if ( bHeadlessMode )
Application::EnableHeadlessMode();
if ( conDcp.getLength() > 0 )
{
// accept incoming connections (scripting and one rvp)
RTL_LOGFILE_CONTEXT( aLog, "create OOfficeAcceptorThread" );
pOfficeAcceptThread = new OOfficeAcceptorThread( xSMgr, conDcp, bHeadlessMode, aClientDisplay, aUserDir );
pOfficeAcceptThread->create();
}
// improves parallel processing on Sun ONE Webtop
// servicemanager up -> copy user installation
if ( Application::IsRemoteServer() )
{
Any aAny;
Reference <XInterface> xRef = xSMgr->createInstanceWithArguments(
OUString::createFromAscii( "com.sun.star.portal.InstallUser" ),
Sequence<Any>( &aAny, 1 ) );
}
// try to start OLE registration service.
// on success (WIN32 only) this process will work
// as OLE automation server for standard UNO objects.
xSMgr->createInstance(DEFINE_CONST_UNICODE("com.sun.star.bridge.OleApplicationRegistration"));
::rtl::OUString aPortalConnect;
sal_Bool bServer = pCmdLine->IsServer();
pCmdLine->GetPortalConnectString( aPortalConnect );
if ( !configureUcb( bServer, aPortalConnect ))
{
DBG_ERROR( "Can't configure UCB" );
exit(-1);
}
// UCB_Helper::Initialize(); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
createTemporaryDirectory();
}
void createTemporaryDirectory()
{
// remove old temp dir
SvtPathOptions aOpt;
String aTemp( DEFINE_CONST_UNICODE( DESKTOP_TEMPNAMEBASE_DIR ) );
aTempNameBaseDir = aOpt.SubstituteVariable( aTemp );
String aOldTempBase( aOpt.GetTempPath() );
if ( STRING_NOTFOUND != aOldTempBase.Search( aTempNameBaseDir ) )
{
String aRet;
::utl::LocalFileHelper::ConvertPhysicalNameToURL( aOldTempBase, aRet );
::utl::UCBContentHelper::Kill( aRet );
}
// set temp base directory
::rtl::OUString aRet;
::osl::FileBase::getFileURLFromSystemPath( aTempNameBaseDir, aRet );
TempFile::SetTempNameBaseDirectory( aRet );
aTempBase = ::utl::TempFile::SetTempNameBaseDirectory( aRet );
aOpt.SetTempPath( aTempBase );
}
void removeTemporaryDirectory()
{
// remove temp directory
if ( STRING_NOTFOUND != aTempBase.Search( aTempNameBaseDir ) )
{
String aRet;
::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTempBase, aRet );
if ( ::utl::UCBContentHelper::Kill( aRet ) )
{
SvtPathOptions().SetTempPath( String() );
::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTempNameBaseDir, aRet );
::utl::UCBContentHelper::Kill( aRet );
}
}
}

View File

@@ -0,0 +1,81 @@
/*************************************************************************
*
* $RCSfile: appinit.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DESKTOP_APPINIT_HXX_
#define _DESKTOP_APPINIT_HXX_
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > createApplicationServiceManager();
void registerServices( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr );
void destroyApplicationServiceManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr );
void createTemporaryDirectory();
void removeTemporaryDirectory();
#endif

View File

@@ -0,0 +1,101 @@
/*************************************************************************
*
* $RCSfile: appsys.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "appsys.hxx"
#ifdef WNT
#include <rtl/ustring.hxx>
#include <tools/solar.h>
#include <tools/prewin.h>
#include <winreg.h>
#include <tools/postwin.h>
#include <tools/urlobj.hxx>
#pragma hdrstop
#define U2S(STRING) ::rtl::OUStringToOString(STRING, RTL_TEXTENCODING_UTF8)
namespace desktop
{
void FATToVFat_Impl( String& aName )
{
INetURLObject aObj( aName );
if ( aObj.GetProtocol() == INET_PROT_FILE )
{
WIN32_FIND_DATA aData;
HANDLE h = FindFirstFile( U2S(aName).getStr(), &aData );
if ( h )
{
// FAT-Kurzname in VFAT-Langname wandeln
aObj.removeSegment();
aObj.insertName( String::CreateFromAscii( aData.cFileName ) );
aName = aObj.PathToFileName();
FindClose( h );
}
}
}
}
#endif // WNT

View File

@@ -0,0 +1,76 @@
/*************************************************************************
*
* $RCSfile: appsys.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DESKTOP_APPSYS_HXX_
#define _DESKTOP_APPSYS_HXX_
#include <tools/string.hxx>
namespace desktop
{
#ifdef WNT
void FATToVFat_Impl( String& aName );
#endif
}
#endif // _DESKTOP_APPSYS_HXX_

View File

@@ -0,0 +1,218 @@
/*************************************************************************
*
* $RCSfile: cmdlineargs.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DESKTOP_COMMANDLINEARGS_HXX_
#include <cmdlineargs.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _RTL_URI_HXX_
#include <rtl/uri.hxx>
#endif
namespace desktop
{
CommandLineArgs::CommandLineArgs() :
m_bMinimized( sal_False ),
m_bInvisible( sal_False ),
m_bEmbedding( sal_False ),
m_bBean( sal_False ),
m_bPlugin( sal_False ),
m_bHeadless( sal_False ),
m_bServer( sal_False ),
m_bQuickstart( sal_False ),
m_bOpenList( sal_False ),
m_bPrintList( sal_False ),
m_bPortalConnectString( sal_False ),
m_bAcceptString( sal_False ),
m_bUserDir( sal_False ),
m_bClientDisplay( sal_False ),
m_bTerminateAfterInit( sal_False )
{
}
CommandLineArgs::CommandLineArgs( const ::vos::OExtCommandLine& aExtCmdLine ) :
m_bMinimized( sal_False ),
m_bInvisible( sal_False ),
m_bEmbedding( sal_False ),
m_bBean( sal_False ),
m_bPlugin( sal_False ),
m_bHeadless( sal_False ),
m_bServer( sal_False ),
m_bQuickstart( sal_False ),
m_bOpenList( sal_False ),
m_bPrintList( sal_False ),
m_bPortalConnectString( sal_False ),
m_bAcceptString( sal_False ),
m_bUserDir( sal_False ),
m_bClientDisplay( sal_False ),
m_bTerminateAfterInit( sal_False )
{
ParseCommandLine_Impl( aExtCmdLine );
}
void CommandLineArgs::ParseCommandLine_Impl( const ::vos::OExtCommandLine& aExtCmdLine )
{
BOOL bPrintEvent = FALSE;
BOOL bOpenEvent = TRUE;
::vos::OExtCommandLine aCmdLine;
sal_uInt32 nCount = aCmdLine.getCommandArgCount();
for( sal_uInt32 i=0; i < nCount; i++ )
{
::rtl::OUString aArg;
aCmdLine.getCommandArg( i, aArg );
String aArgStr = aArg;
if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-minimized" )) == sal_True )
m_bMinimized = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-invisible" )) == sal_True )
m_bInvisible = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-embedding" )) == sal_True )
m_bEmbedding = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-bean" )) == sal_True )
m_bBean = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-plugin" )) == sal_True )
m_bPlugin = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-server" )) == sal_True )
m_bServer = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-headless" )) == sal_True )
m_bHeadless = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-quickstart" )) == sal_True )
m_bQuickstart = sal_True;
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-terminate_after_init" )) == sal_True )
m_bTerminateAfterInit;
else if ( aArgStr.Copy(0, 8).EqualsIgnoreCaseAscii( "-accept=" ))
{
m_aAcceptString = aArgStr.Copy( 8 );
m_bAcceptString = sal_True;
}
else if ( aArgStr.CompareIgnoreCaseToAscii( "-portal," ,
RTL_CONSTASCII_LENGTH( "-portal," )) == COMPARE_EQUAL )
{
m_aPortalConnectString = aArgStr.Copy( RTL_CONSTASCII_LENGTH( "-portal," ));
m_bPortalConnectString = sal_True;
}
else if ( aArgStr.Copy( 0, 7 ).EqualsIgnoreCaseAscii( "-userid" ))
{
::rtl::OUString aUserId = aArgStr;
sal_Int32 nPos = aUserId.indexOf( '[' );
sal_Int32 nEndpos = aUserId.lastIndexOf( ']' );
if( nPos != -1 && nEndpos != -1 )
{
m_aUserDir = ::rtl::Uri::decode(
aUserId.copy( nPos + 1, nEndpos - nPos - 1 ),
rtl_UriDecodeWithCharset,
RTL_TEXTENCODING_UTF8 );
m_bUserDir = sal_True;
}
}
else if ( aArgStr.Copy( 0, 15).EqualsIgnoreCaseAscii( "-clientdisplay=" ))
{
m_aClientDisplay = aArgStr.Copy( 15 );
m_bClientDisplay = sal_True;
}
else
{
const xub_Unicode* pArg = aArgStr.GetBuffer();
// only with '-', because Unix uses / as root-dir!!
if ( *pArg == (sal_Unicode)'-' )
{
pArg++;
// a switch
if ( (*pArg == (sal_Unicode)'p') ||
(*pArg == (sal_Unicode)'P') )
{
bPrintEvent = TRUE;
bOpenEvent = FALSE; // no more open events
}
}
else
{
// interpreted as file name
if ( bOpenEvent )
{
// append open event
if ( m_aOpenList.getLength() > 0 )
m_aOpenList = m_aOpenList + APPEVENT_PARAM_DELIMITER;
m_aOpenList = m_aOpenList + aArgStr;
m_bOpenList = sal_True;
}
else if ( bPrintEvent )
{
// append print event
if( m_aPrintList.getLength() )
m_aPrintList = m_aPrintList + APPEVENT_PARAM_DELIMITER;
m_aPrintList = m_aPrintList + aArgStr;
m_bPrintList = sal_True;
}
}
}
}
}
} // namespace desktop

View File

@@ -0,0 +1,126 @@
/*************************************************************************
*
* $RCSfile: cmdlineargs.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DESKTOP_COMMANDLINEARGS_HXX_
#define _DESKTOP_COMMANDLINEARGS_HXX_
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
#ifndef _VOS_PROCESS_HXX_
#include <vos/process.hxx>
#endif
namespace desktop
{
class CommandLineArgs
{
private:
void ParseCommandLine_Impl( const ::vos::OExtCommandLine& );
sal_Bool m_bMinimized;
sal_Bool m_bInvisible;
sal_Bool m_bEmbedding;
sal_Bool m_bBean;
sal_Bool m_bPlugin;
sal_Bool m_bServer;
sal_Bool m_bHeadless;
sal_Bool m_bQuickstart;
sal_Bool m_bOpenList;
sal_Bool m_bPrintList;
sal_Bool m_bPortalConnectString;
sal_Bool m_bAcceptString;
sal_Bool m_bUserDir;
sal_Bool m_bClientDisplay;
sal_Bool m_bTerminateAfterInit;
::rtl::OUString m_aOpenList;
::rtl::OUString m_aPrintList;
::rtl::OUString m_aPortalConnectString;
::rtl::OUString m_aAcceptString;
::rtl::OUString m_aUserDir;
::rtl::OUString m_aClientDisplay;
public:
CommandLineArgs();
CommandLineArgs( const ::vos::OExtCommandLine& aExtCmdLine );
sal_Bool IsMinimized(){ return m_bMinimized; }
sal_Bool IsInvisible(){ return m_bInvisible; }
sal_Bool IsEmbedding(){ return m_bEmbedding; }
sal_Bool IsBean(){ return m_bBean; }
sal_Bool IsPlugin(){ return m_bPlugin; }
sal_Bool IsServer(){ return m_bServer; }
sal_Bool IsHeadless(){ return m_bHeadless; }
sal_Bool IsQuickstart(){ return m_bQuickstart; }
sal_Bool IsTerminateAfterInit() { return m_bTerminateAfterInit; }
sal_Bool GetPortalConnectString( ::rtl::OUString& rPara){ rPara = m_aPortalConnectString; return m_bPortalConnectString; }
sal_Bool GetAcceptString( ::rtl::OUString& rPara){ rPara = m_aAcceptString; return m_bAcceptString; }
sal_Bool GetUserDir( ::rtl::OUString& rPara){ rPara = m_aUserDir; return m_bUserDir; }
sal_Bool GetClientDisplay( ::rtl::OUString& rPara){ rPara = m_aClientDisplay; return m_bClientDisplay; }
sal_Bool GetOpenList( ::rtl::OUString& rPara){ rPara = m_aOpenList; return m_bOpenList; }
sal_Bool GetPrintList( ::rtl::OUString& rPara){ rPara = m_aPrintList; return m_bPrintList; }
};
}
#endif

View File

@@ -0,0 +1,75 @@
/*************************************************************************
*
* $RCSfile: desktop.hrc,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DESKTOP_HRC_
#define _DESKTOP_HRC_
#ifndef _SOLAR_HRC
#include <svtools/solar.hrc>
#endif
#define RID_DESKTOP_DIALOG_START 2000
#define RID_DESKTOP_STRING_START 10000
#define STR_RECOVER_QUERY (RID_DESKTOP_STRING_START+0)
#define STR_RECOVER_TITLE (RID_DESKTOP_STRING_START+1)
#endif // _DESKTOP_HRC_

View File

@@ -0,0 +1,120 @@
/*************************************************************************
*
* $RCSfile: desktop.src,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "desktop.hrc"
String STR_RECOVER_QUERY
{
Text = "Soll die Datei \"$1\" wiederhergestellt werden?" ;
Text [ ENGLISH ] = "Recover file $1?" ;
Text [ portuguese ] = "Deseja restaurar o ficheiro \"$1\"?" ;
Text [ english_us ] = "Should the file \"$1\" be restored?" ;
Text [ portuguese_brazilian ] = "Soll die Datei \"$1\" wiederhergestellt werden?" ;
Text [ swedish ] = "Skall filen \"$1\" <20>terst<73>llas?" ;
Text [ danish ] = "Skal filen \"$1\" gendannes?" ;
Text [ italian ] = "Volete recuperare il file \"$1\"?" ;
Text [ spanish ] = "<22>Desea restaurar el archivo \"$1\"?" ;
Text [ french ] = "Le fichier \"$1\" doit-il <20>tre restaur<75> ?" ;
Text [ dutch ] = "Wilt u dat het bestand \"$1\" hersteld wordt?" ;
Text[ chinese_simplified ] = "<22><>Ҫ<EFBFBD>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> \"$1\" <20><><EFBFBD><EFBFBD>";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> \"$1\"?";
Text[ polish ] = "Odtworzy<7A> plik \"$1\"?";
Text[ japanese ] = "̧<><CCA7> \"$1\" <20>𕜌<EFBFBD><F0959C8C><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B";
Text[ chinese_traditional ] = "<22>z<EFBFBD>n<EFBFBD>٭<EFBFBD><D9AD>ɮ<EFBFBD> $1 ?";
Text[ arabic ] = "<22><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> \"$1\"<22>";
Text[ dutch ] = "Wilt u dat het bestand \"$1\" hersteld wordt?";
Text[ chinese_simplified ] = "<22><>Ҫ<EFBFBD>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> \"$1\" <20><><EFBFBD><EFBFBD>";
Text[ greek ] = "<22><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \"$1\";";
Text[ korean ] = "<22><><EFBFBD><EFBFBD> \"$1\"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻðڽ<C3B0><DABD>ϱ<EFBFBD>?";
Text[ turkish ] = "\"$1\" dosyas<61> geri getirilsin mi?";
Text[ language_user1 ] = " ";
Text[ catalan ] = "<22>Desea restaurar el archivo \"$1\"?";
Text[ finnish ] = "Palautetaanko tiedosto $1?";
};
String STR_RECOVER_TITLE
{
Text = "Datei-Wiederherstellung" ;
Text [ ENGLISH ] = "File Recovery" ;
Text [ english_us ] = "File Recovery" ;
Text [ portuguese_brazilian ] = "Datei-Wiederherstellung" ;
Text [ swedish ] = "<22>terst<73>lla fil" ;
Text [ danish ] = "Fil-gendannelse" ;
Text [ italian ] = "Recupero file" ;
Text [ spanish ] = "Recuperar archivo" ;
Text [ french ] = "Restauration de fichier" ;
Text [ dutch ] = "Herstel bestand" ;
Text [ portuguese ] = "Restaurar ficheiro" ;
Text[ chinese_simplified ] = "<22>޸<EFBFBD><DEB8>ļ<EFBFBD>";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>";
Text[ polish ] = "Odtwarzanie plik<69>w";
Text[ japanese ] = "̧<>ق̕<D982><CC95><EFBFBD>";
Text[ chinese_traditional ] = "<22>״_<D7B4>ɮ<EFBFBD>";
Text[ arabic ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>";
Text[ dutch ] = "Herstel bestand";
Text[ chinese_simplified ] = "<22>޸<EFBFBD><DEB8>ļ<EFBFBD>";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ korean ] = "<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
Text[ turkish ] = "Dosya kurtarma";
Text[ language_user1 ] = " ";
Text[ catalan ] = "Recuperar archivo";
Text[ finnish ] = "Tiedoston palautus";
};

View File

@@ -0,0 +1,72 @@
/*************************************************************************
*
* $RCSfile: desktopresid.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#pragma hdrstop
#include "desktopresid.hxx"
#include "app.hxx"
// -----------------------------------------------------------------------
DesktopResId::DesktopResId( USHORT nId ) :
ResId( nId, Desktop::GetDesktopResManager() )
{
}

View File

@@ -0,0 +1,76 @@
/*************************************************************************
*
* $RCSfile: desktopresid.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DESKTOP_RESID_HXX_
#define _DESKTOP_RESID_HXX_
#ifndef _TOOLS_RESID_HXX
#include <tools/resid.hxx>
#endif
class DesktopResId : public ResId
{
public:
DesktopResId( USHORT nId );
};
#endif // _DESKTOP_RESID_HXX_

View File

@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.4 $
# $Revision: 1.5 $
#
# last change: $Author: cd $ $Date: 2001-07-06 15:53:41 $
# last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -63,7 +63,7 @@
PRJ=..$/..
PRJNAME=desktop
TARGET=wrp
TARGET=dkt
LIBTARGET=NO
AUTOSEG=true
ENABLE_EXCEPTIONS=TRUE
@@ -82,45 +82,21 @@ RSCUPDVER=$(RSCREVISION)(SV$(UPD)$(UPDMINOR))
# --- Files --------------------------------------------------------
OBJFILES = \
$(OBJ)$/app.obj \
$(OBJ)$/wrapper.obj \
$(OBJ)$/intro.obj
$(OBJ)$/app.obj \
$(OBJ)$/intro.obj \
$(OBJ)$/officeipcthread.obj \
$(OBJ)$/appinit.obj \
$(OBJ)$/cmdlineargs.obj \
$(OBJ)$/pluginacceptthread.obj \
$(OBJ)$/officeacceptthread.obj \
$(OBJ)$/oinstanceprovider.obj \
$(OBJ)$/opluginframefactory.obj \
$(OBJ)$/appsys.obj \
$(OBJ)$/desktopresid.obj
#SLOFILES = \
# $(SLO)$/wrapper.obj
SRC1FILES= desktop.src
SRS1NAME= desktop
#SHL1OBJS= $(SLOFILES)
#SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
#SHL1IMPLIB= iwrp
#SHL1STDLIBS= \
# $(SCHLIB) \
# $(SMLIB) \
# $(SIMLIB) \
# $(SWLIB) \
# $(SDLIB) \
# $(SCLIB) \
# $(SBALIB) \
# $(OFALIB) \
# $(SVXLIB) \
# $(SFXLIB) \
# $(TOOLSLIB) \
# $(UNOTOOLSLIB) \
# $(SVLLIB) \
# $(SVTOOLLIB) \
# $(SOTLIB) \
# $(SO2LIB) \
# $(SALLIB) \
# $(CPPULIB) \
# $(CPPUHELPERLIB) \
# $(VCLLIB)
#
#SHL1DEPN= makefile.mk
#SHL1DEF= $(MISC)$/$(SHL1TARGET).def
#
#DEF1NAME= $(SHL1TARGET)
#DEF1EXPORTFILE= exports.dxp
#
# --- Targets ------------------------------------------------------
.IF "$(depend)" != ""

View File

@@ -0,0 +1,308 @@
/*************************************************************************
*
* $RCSfile: officeipcthread.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "app.hxx"
#include "officeipcthread.hxx"
#include <stdio.h>
#ifndef _VOS_PROCESS_HXX_
#include <vos/process.hxx>
#endif
#ifndef _UTL_BOOTSTRAP_HXX
#include <unotools/bootstrap.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
using namespace vos;
using namespace rtl;
#define TERMINATION_SEQUENCE "InternalIPC::TerminateThread"
#define TERMINATION_LENGTH 28
OfficeIPCThread* OfficeIPCThread::pGlobalOfficeIPCThread = 0;
OSecurity OfficeIPCThread::maSecurity;
class ImplForeignAppEventClass
{
public:
DECL_STATIC_LINK( ImplForeignAppEventClass, CallEvent, void* pEvent );
};
void HandleAppEvent( const ApplicationEvent& rAppEvent );
IMPL_STATIC_LINK( ImplForeignAppEventClass, CallEvent, void*, pEvent )
{
Desktop::HandleAppEvent( *((ApplicationEvent*)pEvent) );
delete (ApplicationEvent*)pEvent;
return 0;
}
void ImplPostForeignAppEvent( ApplicationEvent* pEvent )
{
Application::PostUserEvent( STATIC_LINK( NULL, ImplForeignAppEventClass, CallEvent ), pEvent );
}
OSignalHandler::TSignalAction SAL_CALL SalMainPipeExchangeSignalHandler::signal(TSignalInfo *pInfo)
{
if( pInfo->Signal == osl_Signal_Terminate )
OfficeIPCThread::DisableOfficeIPCThread();
return (TAction_CallNextHandler);
}
BOOL OfficeIPCThread::EnableOfficeIPCThread()
{
if( pGlobalOfficeIPCThread )
return TRUE;
::rtl::OUString aOfficeInstallPath;
::rtl::OUString aUserInstallPath;
::rtl::OUString aLastIniFile;
::rtl::OUString aDummy;
::vos::OStartupInfo aInfo;
OfficeIPCThread* pThread = new OfficeIPCThread;
pThread->maPipeIdent = OUString( RTL_CONSTASCII_USTRINGPARAM( "SingleOfficeIPC_" ) );
::utl::BootstrapRetVal aLocateResult = ::utl::bootstrap_locateUserInstallationPath( aOfficeInstallPath, aUserInstallPath, aLastIniFile );
if ( aLocateResult == ::utl::BOOTSTRAP_OK )
{
aDummy = aUserInstallPath;
}
else
{
delete pThread;
return FALSE;
}
// look if we are the first Office: try to open the pipe
// this should prevent multiple access to the user directory !
pThread->maPipeIdent = pThread->maPipeIdent + OUString::valueOf( (sal_Int32)aDummy.hashCode() );
if( pThread->maPipe.create( pThread->maPipeIdent.getStr(), OPipe::TOption_Open, maSecurity ) )
{
pThread->maStreamPipe = pThread->maPipe;
// seems another office is running. pipe arguments to it
// and self terminate
ByteString aArguments;
ULONG nCount = aInfo.getCommandArgCount();
for( ULONG i=0; i < nCount; i++ )
{
aInfo.getCommandArg( i, aDummy );
aArguments += ByteString( String( aDummy ), osl_getThreadTextEncoding() );
aArguments += '|';
}
pThread->maStreamPipe.write( aArguments.GetBuffer(), aArguments.Len() );
delete pThread;
return FALSE;
}
// seems we are the one and only, so start listening thread
pThread->maPipe = OPipe( pThread->maPipeIdent, OPipe::TOption_Create, maSecurity );
if( pThread->maPipe.isValid() )
{
pGlobalOfficeIPCThread = pThread;
pThread->create(); // starts thread
}
return TRUE;
}
void OfficeIPCThread::DisableOfficeIPCThread()
{
if( pGlobalOfficeIPCThread )
{
// send thread a termination message
// this is done so the subsequent join will not hang
// because the thread hangs in accept of pipe
OPipe Pipe( pGlobalOfficeIPCThread->maPipeIdent, OPipe::TOption_Open, maSecurity );
Pipe.send( TERMINATION_SEQUENCE, TERMINATION_LENGTH );
Pipe.close();
// close the pipe so that the streampipe on the other
// side produces EOF
// exit gracefully
pGlobalOfficeIPCThread->join();
delete pGlobalOfficeIPCThread;
}
}
OfficeIPCThread::OfficeIPCThread()
{
}
OfficeIPCThread::~OfficeIPCThread()
{
maPipe.close();
maStreamPipe.close();
pGlobalOfficeIPCThread = 0;
}
void SAL_CALL OfficeIPCThread::run()
{
while (schedule())
{
OPipe::TPipeError
nError = maPipe.accept( maStreamPipe );
if( nError == OStreamPipe::E_None )
{
ByteString aArguments;
char pBuf[ 2049 ];
int nBytes;
do
{
nBytes = maStreamPipe.read( pBuf, 2048 );
pBuf[ nBytes ] = 0;
aArguments += pBuf;
} while( ! maStreamPipe.isEof() || nBytes > 0 );
maStreamPipe.close();
// is this a termination message ? if so, terminate
if( aArguments.CompareTo( TERMINATION_SEQUENCE,
TERMINATION_LENGTH ) == COMPARE_EQUAL )
return;
// parse command line arguments
// dispatch open and print events
int nToken = aArguments.GetTokenCount( '|' );
BOOL bPrintEvent = FALSE;
BOOL bOpenEvent = TRUE;
String aOpenList;
String aPrintList;
String aEmpty;
for( int n=0; n<nToken; n++ )
{
String aArg( aArguments.GetToken( n, '|' ), gsl_getSystemTextEncoding() );
if ( aArg.Len() > 0 )
{
if ( aArg.GetChar(0) == '-' )
{
// handle this argument as an option
if ( aArg.EqualsIgnoreCaseAscii( "-p" ))
{
bPrintEvent = TRUE;
bOpenEvent = FALSE; // Ab hier keine OpenEvents mehr
}
}
else
{
// handle this argument as a filename
if ( bOpenEvent )
{
// Open Event anhaengen
if ( aOpenList.Len() )
aOpenList += APPEVENT_PARAM_DELIMITER;
aOpenList += aArg;
}
else if ( bPrintEvent )
{
// Print Event anhaengen
if( aPrintList.Len() )
aPrintList += APPEVENT_PARAM_DELIMITER;
aPrintList += aArg;
}
}
}
}
if( aOpenList.Len() )
{
// open file(s)
ApplicationEvent* pAppEvent =
new ApplicationEvent( aEmpty, aEmpty,
APPEVENT_OPEN_STRING, aOpenList );
ImplPostForeignAppEvent( pAppEvent );
}
if ( aPrintList.Len() )
{
// print file(s)
ApplicationEvent* pAppEvent =
new ApplicationEvent( aEmpty, aEmpty,
APPEVENT_PRINT_STRING, aPrintList );
ImplPostForeignAppEvent( pAppEvent );
}
if ( aPrintList.Len() == 0 && aOpenList.Len() == 0 )
{
// no document was send, just bring Office to front
ApplicationEvent* pAppEvent =
new ApplicationEvent( aEmpty, aEmpty,
"APPEAR", aEmpty );
ImplPostForeignAppEvent( pAppEvent );
}
}
else
{
#if defined DEBUG || defined DBG_UTIL
fprintf( stderr, "Error on accept: %d\n", (int)nError );
#endif
TimeValue tval;
tval.Seconds = 1;
tval.Nanosec = 0;
sleep( tval );
}
}
};

View File

@@ -0,0 +1,110 @@
/*************************************************************************
*
* $RCSfile: officeipcthread.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DESKTOP_OFFICEIPCTHREAD_HXX_
#define _DESKTOP_OFFICEIPCTHREAD_HXX_
#ifndef _VOS_PIPE_HXX_
#include <vos/pipe.hxx>
#endif
#ifndef _VOS_SECURITY_HXX_
#include <vos/security.hxx>
#endif
#ifndef _VOS_THREAD_HXX_
#include <vos/thread.hxx>
#endif
#ifndef _VOS_SIGNAL_HXX_
#include <vos/signal.hxx>
#endif
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
class SalMainPipeExchangeSignalHandler : public vos::OSignalHandler
{
virtual TSignalAction SAL_CALL signal(TSignalInfo *pInfo);
};
class OfficeIPCThread : public vos::OThread
{
private:
static OfficeIPCThread* pGlobalOfficeIPCThread;
vos::OPipe maPipe;
vos::OStreamPipe maStreamPipe;
static vos::OSecurity maSecurity;
rtl::OUString maPipeIdent;
OfficeIPCThread();
protected:
/// Working method which should be overridden
virtual void SAL_CALL run();
public:
virtual ~OfficeIPCThread();
// return FALSE if second office
static sal_Bool EnableOfficeIPCThread();
static void DisableOfficeIPCThread();
};
#endif // _DESKTOP_OFFICEIPCTHREAD_HXX_

View File

@@ -0,0 +1,233 @@
/*************************************************************************
*
* $RCSfile: oinstanceprovider.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include "oinstanceprovider.hxx"
#include "opluginframefactory.hxx"
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#endif
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
using namespace ::osl ;
using namespace ::rtl ;
using namespace ::cppu ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::bridge ;
using namespace ::com::sun::star::container ;
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
#define INSTANCENAME_PLUGINFACTORY OUString(RTL_CONSTASCII_USTRINGPARAM("PluginFactory"))
#define INSTANCENAME_PLUGINFACTORY_SERVICEMANAGER OUString(RTL_CONSTASCII_USTRINGPARAM("ServiceManager"))
//_________________________________________________________________________________________________________________
// non exported definitions
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// declarations
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
OInstanceProvider::OInstanceProvider( const Reference< XMultiServiceFactory >& xFactory )
// Init baseclasses first
// Attention:
// Don't change order of initialization!
// OMutexMember is a struct with a mutex as member. We can't use a mutex as member directly, while
// we must garant right initialization and a valid value of this! First initialize
// baseclasses and then members. And we need the mutex for other baseclasses !!!
: OMutexMember( )
, OWeakObject ( )
// Init member
, m_xFactory ( xFactory )
{
}
//*****************************************************************************************************************
// destructor (protected!)
//*****************************************************************************************************************
OInstanceProvider::~OInstanceProvider()
{
}
//*****************************************************************************************************************
// XInterface
//*****************************************************************************************************************
void SAL_CALL OInstanceProvider::acquire() throw( RuntimeException )
{ OWeakObject::acquire(); }
void SAL_CALL OInstanceProvider::release() throw( RuntimeException )
{ OWeakObject::release(); }
Any SAL_CALL OInstanceProvider::queryInterface( const Type& aType ) throw( RuntimeException )
{
Any aReturn ( ::cppu::queryInterface( aType, static_cast< XInstanceProvider* >( this ) ) );
if ( aReturn.hasValue() == sal_False )
{
aReturn = OWeakObject::queryInterface( aType );
}
return aReturn;
}
//*****************************************************************************************************************
// XInstanceProvider
//*****************************************************************************************************************
Reference< XInterface > SAL_CALL OInstanceProvider::getInstance( const OUString& sInstanceName ) throw( NoSuchElementException ,
RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard( m_aMutex );
// Safe impossible cases
// This method is not defined for all incoming parameter.
OSL_ENSURE( impldbg_checkParameter_getInstance( sInstanceName ), "OInstanceProvider::getInstance()\nInvalid parameter detected.\n" );
// Set default return value
Reference< XInterface > xReturn;
// Attention: The created factories are helper services and not registered in registry!
// We cant' instanciate it as service; we must do it dynamicly.
// If a correct name for factory was given ...
if ( sInstanceName == INSTANCENAME_PLUGINFACTORY )
{
// ... create this searched factory and set it for return.
OPlugInFrameFactory* pPlugInFactory = new OPlugInFrameFactory( m_xFactory );
xReturn = Reference< XInterface >( (OWeakObject*)pPlugInFactory, UNO_QUERY );
// Safe impossible cases!
// This operation can't failed.
OSL_ENSURE( !(xReturn.is()==sal_False), "OInstanceProvider::getInstance()\nCreation of PlugInFactory failed!\n" );
}
else if (sInstanceName == INSTANCENAME_PLUGINFACTORY_SERVICEMANAGER)
{
xReturn = Reference< XInterface >( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
}
else
{
// If an unknown name was given, we throw an exception!
NoSuchElementException aTmpException;
throw( aTmpException );
}
// Return result of this operation.
return xReturn;
}
//_________________________________________________________________________________________________________________
// debug methods
//_________________________________________________________________________________________________________________
/*-----------------------------------------------------------------------------------------------------------------
The follow methods checks the parameter for other functions. If a parameter or his value is non valid,
we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT!
ATTENTION
If you miss a test for one of this parameters, contact the autor or add it himself !(?)
But ... look for right testing! See using of this methods!
-----------------------------------------------------------------------------------------------------------------*/
#ifdef _DEBUG
//*****************************************************************************************************************
sal_Bool OInstanceProvider::impldbg_checkParameter_getInstance( const OUString& sInstanceName )
{
// Set default return value.
sal_Bool bOK = sal_True;
// Check parameter.
if (
( &sInstanceName == NULL ) ||
(
( sInstanceName != INSTANCENAME_PLUGINFACTORY && sInstanceName != INSTANCENAME_PLUGINFACTORY_SERVICEMANAGER )
)
)
{
bOK = sal_False ;
}
// Return result of check.
return bOK ;
}
#endif // #ifdef ENABLE_ASSERTIONS

View File

@@ -0,0 +1,258 @@
/*************************************************************************
*
* $RCSfile: oinstanceprovider.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __SFX_OINSTANCEPROVIDER_HXX_
#define __SFX_OINSTANCEPROVIDER_HXX_
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include "omutexmember.hxx"
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_BRIDGE_XINSTANCEPROVIDER_HPP_
#include <com/sun/star/bridge/XInstanceProvider.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_NOSUCHELEMENTEXCEPTION_HPP_
#include <com/sun/star/container/NoSuchElementException.hpp>
#endif
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
#define XINSTANCEPROVIDER ::com::sun::star::bridge::XInstanceProvider
#define OWEAKOBJECT ::cppu::OWeakObject
#define NOSUCHELEMENTEXCEPTION ::com::sun::star::container::NoSuchElementException
#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
#define REFERENCE ::com::sun::star::uno::Reference
#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define ANY ::com::sun::star::uno::Any
#define UNOTYPE ::com::sun::star::uno::Type
#define XINTERFACE ::com::sun::star::uno::XInterface
#define OUSTRING ::rtl::OUString
//_________________________________________________________________________________________________________________
// exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// exported definitions
//_________________________________________________________________________________________________________________
/*-************************************************************************************************************//**
@short create factories corresponding to special name
@descr If you need a factory for creation of other factories (zB. neccessary for bridges) you can use
these implementation. You will give us a factory name and we will give you these factory (if it exist).
@implements XInterface
XInstanceProvider
[ XDebugging if ENABLE_SERVICEDEBUG is defined! ]
@base OMutexMember
OWeakObject
@devstatus deprecated
*//*-*************************************************************************************************************/
class OInstanceProvider : public XINSTANCEPROVIDER ,
public OMutexMember , // Order of baseclasses is important for right initialization!
public OWEAKOBJECT
{
//-------------------------------------------------------------------------------------------------------------
// public methods
//-------------------------------------------------------------------------------------------------------------
public:
//---------------------------------------------------------------------------------------------------------
// constructor / destructor
//---------------------------------------------------------------------------------------------------------
/*-****************************************************************************************************//**
@short standard ctor
@descr These initialize a new instance of ths class with needed informations for work.
@seealso using at owner
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
OInstanceProvider( const REFERENCE< XMULTISERVICEFACTORY >& xFactory );
//---------------------------------------------------------------------------------------------------------
// XInterface
//---------------------------------------------------------------------------------------------------------
virtual void SAL_CALL acquire() throw( RUNTIMEEXCEPTION );
virtual void SAL_CALL release() throw( RUNTIMEEXCEPTION );
virtual ANY SAL_CALL queryInterface( const UNOTYPE& aType ) throw( RUNTIMEEXCEPTION );
//---------------------------------------------------------------------------------------------------------
// XInstanceProvider
//---------------------------------------------------------------------------------------------------------
/*-****************************************************************************************************//**
@short return reference to a factory for specified instance
@descr These object is a selector for different factories. You will give me a factory name -
and I will give you a reference to the right factory object (if any exist!).
@seealso -
@param "sInstanceName", name of searched factory.
@return A reference to corresponding factory.
@onerror A null reference is returned.
*//*-*****************************************************************************************************/
virtual REFERENCE< XINTERFACE > SAL_CALL getInstance( const OUSTRING& sInstanceName ) throw( NOSUCHELEMENTEXCEPTION ,
RUNTIMEEXCEPTION );
//-------------------------------------------------------------------------------------------------------------
// protected methods
//-------------------------------------------------------------------------------------------------------------
protected:
/*-****************************************************************************************************//**
@short standard destructor
@descr This method destruct an instance of this class and clear some member.
This method is protected, because its not allowed to use an instance of this class as a member!
You MUST use a pointer.
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
virtual ~OInstanceProvider();
//-------------------------------------------------------------------------------------------------------------
// private methods
//-------------------------------------------------------------------------------------------------------------
private:
//-------------------------------------------------------------------------------------------------------------
// debug methods
// (should be private everyway!)
//-------------------------------------------------------------------------------------------------------------
/*-****************************************************************************************************//**
@short debug-method to check incoming parameter of some other mehods of this class
@descr The following methods are used to check parameters for other methods
of this class. The return value is used directly for an ASSERT(...).
@seealso ASSERTs in implementation!
@param references to checking variables
@return sal_False on invalid parameter<BR>
sal_True otherway
@onerror -
*//*-*****************************************************************************************************/
#ifdef _DEBUG
private:
sal_Bool impldbg_checkParameter_getInstance( const OUSTRING& sInstanceName );
#endif // #ifdef ENABLE_ASSERTIONS
//-------------------------------------------------------------------------------------------------------------
// variables
// (should be private everyway!)
//-------------------------------------------------------------------------------------------------------------
private:
REFERENCE< XMULTISERVICEFACTORY > m_xFactory ;
}; // class OInstanceProvider
#endif // #ifndef __SFX_OINSTANCEPROVIDER_HXX_

View File

@@ -0,0 +1,97 @@
/*************************************************************************
*
* $RCSfile: omutexmember.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_
#define __FRAMEWORK_OMUTEXMEMBER_HXX_
//_________________________________________________________________________________________________________________
// includes
//_________________________________________________________________________________________________________________
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// definitions
//_________________________________________________________________________________________________________________
/*-************************************************************************************************************//**
@short definition of a public mutex member
@descr You can use this struct as baseclass to get a public mutex member for right initialization.
Don't use it as member. You can't guarantee the right order of initialization of baseclasses then!
And some other helper classes share the mutex with an implementation and must have a valid one.
@seealso See implementation of constructors in derived classes for further informations!
@devstatus ready
*//*-*************************************************************************************************************/
struct OMutexMember
{
::osl::Mutex m_aMutex;
};
#endif // #ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_

View File

@@ -0,0 +1,240 @@
/*************************************************************************
*
* $RCSfile: opluginframefactory.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include "opluginframefactory.hxx"
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
#include <com/sun/star/lang/XInitialization.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
#include <com/sun/star/frame/XFrame.hpp>
#endif
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
using namespace ::osl ;
using namespace ::rtl ;
using namespace ::cppu ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::frame ;
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
#define SERVICENAME_DESKTOP OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ))
#define SERVICENAME_PLUGINFRAME OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.Plugin" ))
//_________________________________________________________________________________________________________________
// non exported definitions
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// declarations
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
OPlugInFrameFactory::OPlugInFrameFactory( const Reference< XMultiServiceFactory >& xFactory )
// Init baseclasses first
// Attention:
// Don't change order of initialization!
// OMutexMember is a struct with a mutex as member. We can't use a mutex as member directly, while
// we must garant right initialization and a valid value of this! First initialize
// baseclasses and then members. And we need the mutex for other baseclasses !!!
: OMutexMember( )
, OWeakObject ( )
// Init member
, m_xFactory ( xFactory )
{
}
//*****************************************************************************************************************
// destructor (protected!)
//*****************************************************************************************************************
OPlugInFrameFactory::~OPlugInFrameFactory()
{
}
//*****************************************************************************************************************
// XInterface
//*****************************************************************************************************************
void SAL_CALL OPlugInFrameFactory::acquire() throw( RuntimeException )
{ OWeakObject::acquire(); }
void SAL_CALL OPlugInFrameFactory::release() throw( RuntimeException )
{ OWeakObject::release(); }
Any SAL_CALL OPlugInFrameFactory::queryInterface( const Type& aType ) throw( RuntimeException )
{
Any aReturn ( ::cppu::queryInterface( aType, static_cast< XSingleServiceFactory* >( this ) ) );
if ( aReturn.hasValue() == sal_False )
{
aReturn = OWeakObject::queryInterface( aType );
}
return aReturn;
}
//*****************************************************************************************************************
// XSingleServiceFactory
//*****************************************************************************************************************
Reference< XInterface > SAL_CALL OPlugInFrameFactory::createInstance() throw( Exception ,
RuntimeException)
{
// Ready for multithreading
MutexGuard aGuard( m_aMutex );
// Create new plugin.
Reference< XInterface > xPlugIn( m_xFactory->createInstance( SERVICENAME_PLUGINFRAME ), UNO_QUERY );
// Safe impossible cases
OSL_ENSURE( !(xPlugIn.is()==sal_False), "OPlugInFrameFactory::createInstance()\nServicename of PlugIn is unknown!\n" );
// Ouer plugin need information about his parent!
// If someone dispatch anything to this plugin instance, he will create a new window and load the content.
// Then he must append himself to ouer frame tree !!! => Thats why he need a valid reference to the desktop
// as parent to do this.
// Return result.
return xPlugIn;
}
//*****************************************************************************************************************
// XSingleServiceFactory
//*****************************************************************************************************************
Reference< XInterface > SAL_CALL OPlugInFrameFactory::createInstanceWithArguments( const Sequence< Any >& seqArguments ) throw( Exception ,
RuntimeException)
{
// Ready for multithreading
MutexGuard aGuard( m_aMutex );
// Safe impossible cases
// This method is not defined for all incoming parameter.
OSL_ENSURE( impldbg_checkParameter_createInstanceWithArguments( seqArguments ), "OPlugInFrameFactory::createInstanceWithArguments()\nInvalid parameter detected.\n" );
// Create new PlugIn.
Reference< XInterface > xPlugIn = createInstance();
// Initialize it with given arguments.
if ( xPlugIn.is()==sal_True )
{
// Before we must cast to right interface.
Reference< XInitialization > xInit( xPlugIn, UNO_QUERY );
// Safe impossible cases
OSL_ENSURE( !(xInit.is()==sal_False), "OPlugInFrameFactory::createInstanceWithArguments()\nPlugIn don't support XInitialization ?!...\n" );
xInit->initialize( seqArguments );
}
// Return result.
return xPlugIn;
}
//_________________________________________________________________________________________________________________
// debug methods
//_________________________________________________________________________________________________________________
/*-----------------------------------------------------------------------------------------------------------------
The follow methods checks the parameter for other functions. If a parameter or his value is non valid,
we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT!
ATTENTION
If you miss a test for one of this parameters, contact the autor or add it himself !(?)
But ... look for right testing! See using of this methods!
-----------------------------------------------------------------------------------------------------------------*/
#ifdef _DEBUG
//*****************************************************************************************************************
sal_Bool OPlugInFrameFactory::impldbg_checkParameter_createInstanceWithArguments( const Sequence< Any >& seqArguments )
{
// Set default return value.
sal_Bool bOK = sal_True;
// Check parameter.
if (
( &seqArguments == NULL ) ||
( seqArguments.getLength() < 1 )
)
{
bOK = sal_False ;
}
// Return result of check.
return bOK ;
}
#endif // #ifdef ENABLE_ASSERTIONS

View File

@@ -0,0 +1,269 @@
/*************************************************************************
*
* $RCSfile: opluginframefactory.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: cd $ $Date: 2001-07-16 12:52:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __SFX_OPLUGINFRAMEFACTORY_HXX_
#define __SFX_OPLUGINFRAMEFACTORY_HXX_
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include "omutexmember.hxx"
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
#define XSINGLESERVICEFACTORY ::com::sun::star::lang::XSingleServiceFactory
#define OWEAKOBJECT ::cppu::OWeakObject
#define EXCEPTION ::com::sun::star::uno::Exception
#define SEQUENCE ::com::sun::star::uno::Sequence
#define XCONNECTION ::com::sun::star::connection::XConnection
#define IOEXCEPTION ::com::sun::star::io::IOException
#define XINSTANCEPROVIDER ::com::sun::star::bridge::XInstanceProvider
#define NOSUCHELEMENTEXCEPTION ::com::sun::star::container::NoSuchElementException
#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
#define REFERENCE ::com::sun::star::uno::Reference
#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define ANY ::com::sun::star::uno::Any
#define UNOTYPE ::com::sun::star::uno::Type
#define XINTERFACE ::com::sun::star::uno::XInterface
#define OUSTRING ::rtl::OUString
#define MUTEX ::osl::Mutex
//_________________________________________________________________________________________________________________
// exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// exported definitions
//_________________________________________________________________________________________________________________
/*-************************************************************************************************************//**
@short -
@descr -
@implements XInterface
XSingleServiceFactory
[ XDebugging if ENABLE_SERVICEDEBUG is defined! ]
@base OMutexMember
OWeakObject
@devstatus deprecated
*//*-*************************************************************************************************************/
class OPlugInFrameFactory : public XSINGLESERVICEFACTORY ,
public OMutexMember , // Order of baseclasses is important for right initialization!
public OWEAKOBJECT
{
//-------------------------------------------------------------------------------------------------------------
// public methods
//-------------------------------------------------------------------------------------------------------------
public:
//---------------------------------------------------------------------------------------------------------
// constructor / destructor
//---------------------------------------------------------------------------------------------------------
/*-****************************************************************************************************//**
@short standard ctor
@descr These initialize a new instance of ths class with needed informations for work.
@seealso using at owner
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
OPlugInFrameFactory( const REFERENCE< XMULTISERVICEFACTORY >& xFactory );
//---------------------------------------------------------------------------------------------------------
// XInterface
//---------------------------------------------------------------------------------------------------------
virtual void SAL_CALL acquire() throw( RUNTIMEEXCEPTION );
virtual void SAL_CALL release() throw( RUNTIMEEXCEPTION );
virtual ANY SAL_CALL queryInterface( const UNOTYPE& aType ) throw( RUNTIMEEXCEPTION );
//---------------------------------------------------------------------------------------------------------
// XSingleServiceFactory
//---------------------------------------------------------------------------------------------------------
/*-****************************************************************************************************//**
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
virtual REFERENCE< XINTERFACE > SAL_CALL createInstance() throw( EXCEPTION ,
RUNTIMEEXCEPTION );
/*-****************************************************************************************************//**
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
virtual REFERENCE< XINTERFACE > SAL_CALL createInstanceWithArguments( const SEQUENCE< ANY >& seqArguments ) throw( EXCEPTION ,
RUNTIMEEXCEPTION );
//-------------------------------------------------------------------------------------------------------------
// protected methods
//-------------------------------------------------------------------------------------------------------------
protected:
/*-****************************************************************************************************//**
@short standard destructor
@descr This method destruct an instance of this class and clear some member.
This method is protected, because its not allowed to use an instance of this class as a member!
You MUST use a pointer.
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
virtual ~OPlugInFrameFactory();
//-------------------------------------------------------------------------------------------------------------
// private methods
//-------------------------------------------------------------------------------------------------------------
private:
//-------------------------------------------------------------------------------------------------------------
// debug methods
// (should be private everyway!)
//-------------------------------------------------------------------------------------------------------------
/*-****************************************************************************************************//**
@short debug-method to check incoming parameter of some other mehods of this class
@descr The following methods are used to check parameters for other methods
of this class. The return value is used directly for an ASSERT(...).
@seealso ASSERTs in implementation!
@param references to checking variables
@return sal_False on invalid parameter<BR>
sal_True otherway
@onerror -
*//*-*****************************************************************************************************/
#ifdef _DEBUG
private:
sal_Bool impldbg_checkParameter_createInstanceWithArguments( const SEQUENCE< ANY >& seqArguments );
#endif // #ifdef ENABLE_ASSERTIONS
//-------------------------------------------------------------------------------------------------------------
// variables
// (should be private everyway!)
//-------------------------------------------------------------------------------------------------------------
private:
REFERENCE< XMULTISERVICEFACTORY > m_xFactory ;
}; // class OPlugInFrameFactory
#endif // #ifndef __FRAMEWORK_OPLUGINFRAMEFACTORY_HXX_

View File

@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.8 $
# $Revision: 1.9 $
#
# last change: $Author: cd $ $Date: 2001-07-06 15:54:11 $
# last change: $Author: cd $ $Date: 2001-07-16 12:55:47 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -96,32 +96,32 @@ APP1_STDPRE=$(SALLIB) $(VOSLIB) $(TOOLSLIB) $(UNOLIB) $(CPPULIB) \
APP1_STDPOST=
.ENDIF
RESLIB1NAME= dkt
RESLIB1SRSFILES= $(SRS)$/desktop.srs
APP1TARGET=$(TARGET)
APP1STDLIBS= \
$(APP1_STDPRE) \
$(SFX2LIB) \
$(BASICLIB) \
$(SO2LIB) \
$(SJLIB) \
$(TKLIB) \
$(SVTOOLLIB) \
$(SETUPLIB) \
$(SVLLIB) \
$(SVMEMLIB) \
$(OFALIB) \
$(ONELIB) \
$(VCLLIB) \
$(SOTLIB) \
$(APP1_STDPOST) \
$(SCHLIB) \
$(SMLIB) \
$(SWLIB) \
$(SDLIB) \
$(SCLIB) \
$(SVXLIB) \
$(UNOTOOLSLIB) \
$(COMPHELPERLIB)
APP1STDLIBS= \
$(APP1_STDPRE) \
$(AUTOMATIONLIB) \
$(SETUPLIB) \
$(SVLLIB) \
$(SVMEMLIB) \
$(ONELIB) \
$(VCLLIB) \
$(APP1_STDPOST) \
$(UNOTOOLSLIB) \
$(UCBHELPERLIB) \
$(COMPHELPERLIB) \
$(SALHELPERLIB)
# $(TKLIB) \
# $(SJLIB) \
# $(SOTLIB) \
# $(OFALIB) \
# $(SFX2LIB) \
# $(SO2LIB) \
# $(BASICLIB) \
.IF "$(OS)" == "SOLARIS"
# for Java applets
@@ -150,9 +150,20 @@ APP1DEPN= \
verinfo.rc
APP1OBJS= \
$(OBJ)$/app.obj \
$(OBJ)$/wrapper.obj \
$(OBJ)$/intro.obj
$(OBJ)$/app.obj \
$(OBJ)$/intro.obj \
$(OBJ)$/officeipcthread.obj \
$(OBJ)$/appinit.obj \
$(OBJ)$/cmdlineargs.obj \
$(OBJ)$/pluginacceptthread.obj \
$(OBJ)$/officeacceptthread.obj \
$(OBJ)$/oinstanceprovider.obj \
$(OBJ)$/opluginframefactory.obj \
$(OBJ)$/appsys.obj \
$(OBJ)$/desktopresid.obj
# $(OBJ)$/shutdownicon.obj \
# $(OBJ)$/shutdowniconw32.obj \
#APP1STACK=64000