diff options
author | Carsten Driesner <cd@openoffice.org> | 2001-07-19 11:33:51 +0000 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2001-07-19 11:33:51 +0000 |
commit | 5afef4af17d8e0ba819baf006717a682d81d22b6 (patch) | |
tree | 166849bde564af9b0c16b031c94e89407ab8595b | |
parent | a6a2ba0593d6ed2932d05e087095c05a71d79229 (diff) |
#89883# Application::Property now works again
-rw-r--r-- | desktop/inc/app.hxx | 5 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/appl/app.cxx | 142 | ||||
-rw-r--r-- | sfx2/source/appl/appcfg.cxx | 117 |
4 files changed, 146 insertions, 126 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index c6b3add09de8..71fa8278fc0b 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -2,9 +2,9 @@ * * $RCSfile: app.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: cd $ $Date: 2001-07-16 12:53:12 $ + * last change: $Author: cd $ $Date: 2001-07-19 12:33:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,7 +82,6 @@ class Desktop : public Application //public SfxApplicationClass 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 ); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 3c9acf87d793..b48419b6189b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2,9 +2,9 @@ * * $RCSfile: app.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: mba $ $Date: 2001-07-17 08:34:12 $ + * last change: $Author: cd $ $Date: 2001-07-19 12:33:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -483,10 +483,6 @@ USHORT Desktop::Exception(USHORT nError) // return Application::Exception( nError ); } -void Desktop::Property( ApplicationProperty& ) -{ -} - void Desktop::AppEvent( const ApplicationEvent& rAppEvent ) { HandleAppEvent( rAppEvent ); 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" ); diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index 059058430c19..a154c728cbab 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: appcfg.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: pb $ $Date: 2001-07-06 05:13:22 $ + * last change: $Author: cd $ $Date: 2001-07-19 12:31:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1244,119 +1244,6 @@ static void CorrectUpdateNumber_Impl(String& rName) } */ -void SfxApplicationClass::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; - } -} - IMPL_OBJHINT( SfxStringHint, String ) SfxMiscCfg* SfxApplication::GetMiscConfig() |