diff options
Diffstat (limited to 'sfx2/source/appl/app.cxx')
-rw-r--r-- | sfx2/source/appl/app.cxx | 142 |
1 files changed, 140 insertions, 2 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index cc9c2b36ca84..db48d3d3a639 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -2,9 +2,9 @@ * * $RCSfile: app.cxx,v $ * - * $Revision: 1.49 $ + * $Revision: 1.50 $ * - * last change: $Author: cd $ $Date: 2001-07-16 12:33:18 $ + * last change: $Author: cd $ $Date: 2001-07-19 12:31:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -169,6 +169,7 @@ #endif #include <basic/basmgr.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> #if SUPD>637 #include <rtl/logfile.hxx> @@ -240,6 +241,9 @@ #include <svtools/workingsetoptions.hxx> #include <svtools/syslocaleoptions.hxx> #include <svtools/syslocale.hxx> +#ifndef _SVTOOLS_TTPROPS_HXX // handmade +#include <svtools/ttprops.hxx> +#endif // Static member SfxApplication* SfxApplication::pApp = NULL; @@ -262,6 +266,138 @@ static SvtInternalOptions *pInternalOptions = NULL; static SvtSysLocaleOptions *pSysLocaleOptions = NULL; static SvtSysLocale *pSysLocale = NULL; +class SfxPropertyHandler : public PropertyHandler +{ + virtual void Property( ApplicationProperty& ); +}; + +static SfxPropertyHandler* pPropertyHandler = 0; + +SfxPropertyHandler* GetOrCreatePropertyHandler() +{ + if ( !pPropertyHandler ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pPropertyHandler ) + pPropertyHandler = new SfxPropertyHandler; + } + + return pPropertyHandler; +} + +void SfxPropertyHandler::Property( ApplicationProperty& rProp ) +{ +#if SUPD<613//MUSTINI + SfxApplication* pApp = SFX_APP(); + SfxIniManager* pIni = pApp->GetIniManager(); + + // AppIniManger? + SfxAppIniManagerProperty* pAppIniMgr = PTR_CAST(SfxAppIniManagerProperty, &rProp); + if ( pAppIniMgr ) + { + pAppIniMgr->SetIniManager( pIni ); + return; + } +#endif + TTProperties* pTTProperties = PTR_CAST( TTProperties, &rProp ); + if ( pTTProperties ) + { + pTTProperties->nPropertyVersion = TT_PROPERTIES_VERSION; + switch ( pTTProperties->nActualPR ) + { + case TT_PR_SLOTS: + { + pTTProperties->nSidOpenUrl = SID_OPENURL; + pTTProperties->nSidFileName = SID_FILE_NAME; + pTTProperties->nSidNewDocDirect = SID_NEWDOCDIRECT; + pTTProperties->nSidCopy = SID_COPY; + pTTProperties->nSidPaste = SID_PASTE; + pTTProperties->nSidSourceView = SID_SOURCEVIEW; + pTTProperties->nSidSelectAll = SID_SELECTALL; + pTTProperties->nSidReferer = SID_REFERER; + pTTProperties->nActualPR = 0; + } + break; + case TT_PR_DISPATCHER: + { + // interface for TestTool + SfxViewFrame* pViewFrame; + SfxDispatcher* pDispatcher; + pViewFrame = SfxViewFrame::Current(); + if ( !pViewFrame ) + pViewFrame = SfxViewFrame::GetFirst(); + if ( pViewFrame ) + pDispatcher = pViewFrame->GetDispatcher(); + else + pDispatcher = NULL; + if ( !pDispatcher ) + pTTProperties->nActualPR = TT_PR_ERR_NODISPATCHER; + else + { + pDispatcher->SetExecuteMode(EXECUTEMODE_DIALOGASYNCHRON); + if ( pTTProperties->mnSID == SID_NEWDOCDIRECT ) + { + pTTProperties->mnSID = SID_OPENDOC; + SfxPoolItem** pArgs = pTTProperties->mppArgs; + SfxAllItemSet aSet( SFX_APP()->GetPool() ); + String aFactory = String::CreateFromAscii("private:factory/"); + if ( pArgs && *pArgs ) + { + for ( SfxPoolItem **pArg = pArgs; *pArg; ++pArg ) + aSet.Put( **pArg ); + + SFX_ITEMSET_ARG( &aSet, pFactoryName, SfxStringItem, SID_NEWDOCDIRECT, FALSE ); + if ( pFactoryName ) + aFactory += pFactoryName->GetValue(); + else + aFactory += String::CreateFromAscii("swriter"); + } + else + aFactory += String::CreateFromAscii("swriter"); + + aSet.Put( SfxStringItem( SID_TARGETNAME, DEFINE_CONST_UNICODE("_blank") ) ); + aSet.Put( SfxStringItem( SID_FILE_NAME, aFactory ) ); + aSet.ClearItem( SID_NEWDOCDIRECT ); + + if ( pDispatcher->ExecuteFunction( pTTProperties->mnSID, aSet, pTTProperties->mnMode ) + == EXECUTE_NO ) + pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; + else + pTTProperties->nActualPR = 0; + } + else + { + if ( pDispatcher->ExecuteFunction( + pTTProperties->mnSID, pTTProperties->mppArgs, pTTProperties->mnMode ) + == EXECUTE_NO ) + pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; + else + pTTProperties->nActualPR = 0; + } + } + } + break; +/* + case TT_PR_IMG: + { + SvDataMemberObjectRef aDataObject = new SvDataMemberObject(); + SvData* pDataBmp = new SvData( FORMAT_BITMAP ); + pDataBmp->SetData( pTTProperties->mpBmp ); + aDataObject->Append( pDataBmp ); + aDataObject->CopyClipboard(); + pTTProperties->nActualPR = 0; + } + break; +*/ + default: + { + pTTProperties->nPropertyVersion = 0; + } + } + return; + } +} + SfxApplication* SfxApplication::GetOrCreate() { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); @@ -317,6 +453,8 @@ SfxApplication::SfxApplication() , pImageMgr( 0 ) , nInterfaces( 0 ) { + GetpApp()->SetPropertyHandler( GetOrCreatePropertyHandler() ); + #if SUPD>637 RTL_LOGFILE_CONTEXT( aLog, "SfxApplication::SfxApplication()" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "start create svtools option objects" ); |