diff options
Diffstat (limited to 'sfx2/source/appl/appdde.cxx')
-rw-r--r-- | sfx2/source/appl/appdde.cxx | 244 |
1 files changed, 119 insertions, 125 deletions
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 26e4fecf3864..c3fb0e9dfc92 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,8 +41,6 @@ #include <tools/urlobj.hxx> #include <tools/diagnose_ex.h> #include <unotools/pathoptions.hxx> -#ifndef GCC -#endif #include <sfx2/app.hxx> #include "appdata.hxx" @@ -78,9 +77,6 @@ public: virtual sal_Bool MakeTopic( const String& ); virtual String Topics(); -// virtual String Formats(); -// virtual String SysItems(); -// virtual String Status(); virtual sal_Bool SysTopicExecute( const String* pStr ); }; @@ -111,12 +107,6 @@ public: virtual sal_Bool Execute( const String* ); virtual sal_Bool StartAdviseLoop(); virtual sal_Bool MakeItem( const String& rItem ); - -// wird benoetigt? -// virtual void Connect( long n ); -// virtual void Disconnect( long n ); -// virtual void StopAdviseLoop(); - }; @@ -128,15 +118,14 @@ SV_IMPL_PTRARR( SfxDdeDocTopics_Impl, SfxDdeDocTopic_Impl *) sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, const String &rCmd, const String &rEvent ) -/* [Beschreibung] +/* [Description] - Pr"uft, ob 'rCmd' das Event 'rEvent' ist (ohne '(') und baut - aus diesem dann ein <ApplicationEvent> zusammen, das per - <Application::AppEvent()> ausgef"uhrt werden kann. Ist 'rCmd' das - angegegeben Event 'rEvent', dann wird TRUE zur"uckgegeben, sonst FALSE. + Checks if 'rCmd' of the event 'rEvent' is (without '(') and then assemble + this data into a <ApplicationEvent>, which can be excecuted through + <Application::AppEvent()>. If 'rCmd' is the given event 'rEvent', then + TRUE is returned, otherwise FALSE. - - [Beispiel] + [Example] rCmd = "Open(\"d:\doc\doc.sdw\")" rEvent = "Open" @@ -151,7 +140,7 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, aData.Erase( 0, aEvent.Len() ); if ( aData.Len() > 2 ) { - // in das ApplicationEvent-Format wandeln + // Transform into the ApplicationEvent Format aData.Erase( aData.Len()-1, 1 ); for ( sal_uInt16 n = 0; n < aData.Len(); ++n ) { @@ -175,31 +164,30 @@ sal_Bool SfxAppEvent_Impl( ApplicationEvent &rAppEvent, long SfxApplication::DdeExecute ( - const String& rCmd // in unserer BASIC-Syntax formuliert + const String& rCmd // Expressed in our BASIC-Syntax ) -/* [Beschreibung] +/* Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxApplication-Subklasse gerichtete DDE-Kommandos - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-commands directed to thier SfxApplication subclass. - Die Basisimplementierung versteht die API-Funktionalit"at der - betreffenden SfxApplication-Subklasse in BASIC-Syntax. R"uckgabewerte - k"onnen dabei leider nicht "ubertragen werden. + The base implementation understands the API functionality of the + relevant SfxApplication subclass in BASIC syntax. Return values can + not be transferred, unfortunately. */ { - // Print oder Open-Event? + // Print or Open-Event? ApplicationEvent aAppEvent; if ( SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Print") ) || SfxAppEvent_Impl( aAppEvent, rCmd, DEFINE_CONST_UNICODE("Open") ) ) GetpApp()->AppEvent( aAppEvent ); else { - // alle anderen per BASIC + // all others are BASIC StarBASIC* pBasic = GetBasic(); - ENSURE_OR_RETURN( pBasic, "where's my basic?", 0 ); + DBG_ASSERT( pBasic, "Where is the Basic???" ); SbxVariable* pRet = pBasic->Execute( rCmd ); if( !pRet ) { @@ -214,18 +202,17 @@ long SfxApplication::DdeExecute long SfxApplication::DdeGetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - ::com::sun::star::uno::Any& // out: angeforderte Daten + ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxApplication-Subklasse gerichtete DDE-Daten-Anforderungen - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data-requests directed to thier SfxApplication subclass. - Die Basisimplementierung liefert keine Daten und gibt 0 zur"uck. + The base implementation provides no data and returns 0. */ { @@ -236,18 +223,17 @@ long SfxApplication::DdeGetData long SfxApplication::DdeSetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - const ::com::sun::star::uno::Any& // out: angeforderte Daten + const ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxApplication-Subklasse gerichtete DDE-Daten - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data directed to thier SfxApplication subclass. - Die Basisimplementierung nimmt keine Daten entgegen und liefert 0 zur"uck. + The base implementation is not receiving any data and returns 0. */ { @@ -258,15 +244,15 @@ long SfxApplication::DdeSetData ::sfx2::SvLinkSource* SfxApplication::DdeCreateLinkSource ( - const String& // das zu erzeugende Item + const String& // the Item to be addressed ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seiner SfxApplication-Subklasse einen DDE-Hotlink einzurichten + This method can be overloaded by application developers, to establish + a DDE-hotlink to thier SfxApplication subclass. - Die Basisimplementierung erzeugt keinen und liefert 0 zur"uck. + The base implementation is not generate a link and returns 0. */ { @@ -277,21 +263,20 @@ long SfxApplication::DdeSetData long SfxObjectShell::DdeExecute ( - const String& rCmd // in unserer BASIC-Syntax formuliert + const String& rCmd // Expressed in our BASIC-Syntax ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxObjectShell-Subklasse gerichtete DDE-Kommandos - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-commands directed to the thier SfxApplication subclass. - Die Basisimplementierung f"uhrt nichts aus und liefert 0 zur"uck. + The base implementation does nothing and returns 0. */ { StarBASIC* pBasic = GetBasic(); - DBG_ASSERT( pBasic, "Wo ist mein Basic???" ) ; + DBG_ASSERT( pBasic, "Where is the Basic???" ) ; SbxVariable* pRet = pBasic->Execute( rCmd ); if( !pRet ) { @@ -306,18 +291,17 @@ long SfxObjectShell::DdeExecute long SfxObjectShell::DdeGetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - ::com::sun::star::uno::Any& // out: angeforderte Daten + ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxObjectShell-Subklasse gerichtete DDE-Daten-Anforderungen - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data-requests directed to thier SfxApplication subclass. - Die Basisimplementierung liefert keine Daten und gibt 0 zur"uck. + The base implementation provides no data and returns 0. */ { @@ -328,18 +312,17 @@ long SfxObjectShell::DdeGetData long SfxObjectShell::DdeSetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - const ::com::sun::star::uno::Any& // out: angeforderte Daten + const ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxObjectShell-Subklasse gerichtete DDE-Daten - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data directed to thier SfxApplication subclass. - Die Basisimplementierung nimmt keine Daten entgegen und liefert 0 zur"uck. + The base implementation is not receiving any data and returns 0. */ { @@ -349,38 +332,54 @@ long SfxObjectShell::DdeSetData //-------------------------------------------------------------------- ::sfx2::SvLinkSource* SfxObjectShell::DdeCreateLinkSource ( - const String& // das zu erzeugende Item + const String& // the Item to be addressed ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seiner SfxObjectShell-Subklasse einen DDE-Hotlink einzurichten + This method can be overloaded by application developers, to establish + a DDE-hotlink to thier SfxApplication subclass. - Die Basisimplementierung erzeugt keinen und liefert 0 zur"uck. + The base implementation is not generate a link and returns 0. */ { return 0; } +void SfxObjectShell::ReconnectDdeLink(SfxObjectShell& /*rServer*/) +{ +} + +void SfxObjectShell::ReconnectDdeLinks(SfxObjectShell& rServer) +{ + TypeId aType = TYPE(SfxObjectShell); + SfxObjectShell* p = GetFirst(&aType, false); + while (p) + { + if (&rServer != p) + p->ReconnectDdeLink(rServer); + + p = GetNext(*p, &aType, false); + } +} + //======================================================================== long SfxViewFrame::DdeExecute ( - const String& rCmd // in unserer BASIC-Syntax formuliert + const String& rCmd // Expressed in our BASIC-Syntax ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxViewFrame-Subklasse gerichtete DDE-Kommandos - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-commands directed to the thier SfxApplication subclass. - Die Basisimplementierung versteht die API-Funktionalit"at des - betreffenden SfxViewFrame, der darin dargestellten SfxViewShell und - der betreffenden SfxObjectShell-Subklasse in BASIC-Syntax. - R"uckgabewerte k"onnen dabei leider nicht "ubertragen werden. + The base implementation understands the API functionality of the + relevant SfxViewFrame, which is shown and the relevant SfxViewShell + and the relevant SfxApplication subclass in BASIC syntax. Return + values can not be transferred, unfortunately. */ { @@ -394,18 +393,17 @@ long SfxViewFrame::DdeExecute long SfxViewFrame::DdeGetData ( - const String&, // das anzusprechende Item + const String&, // the Item to be addressed const String&, // in: Format - ::com::sun::star::uno::Any& // out: angeforderte Daten + ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxViewFrame-Subklasse gerichtete DDE-Daten-Anforderungen - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data-requests directed to thier SfxApplication subclass. - Die Basisimplementierung liefert keine Daten und gibt 0 zur"uck. + The base implementation provides no data and returns 0. */ { @@ -416,18 +414,17 @@ long SfxViewFrame::DdeGetData long SfxViewFrame::DdeSetData ( - const String& , // das anzusprechende Item - const String& , // in: Format - const ::com::sun::star::uno::Any& // out: angeforderte Daten + const String&, // the Item to be addressed + const String&, // in: Format + const ::com::sun::star::uno::Any& // out: requested data ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seine SfxViewFrame-Subklasse gerichtete DDE-Daten - zu empfangen. + This method can be overloaded by application developers, to receive + DDE-data directed to thier SfxApplication subclass. - Die Basisimplementierung nimmt keine Daten entgegen und liefert 0 zur"uck. + The base implementation is not receiving any data and returns 0. */ { @@ -438,15 +435,15 @@ long SfxViewFrame::DdeSetData ::sfx2::SvLinkSource* SfxViewFrame::DdeCreateLinkSource ( - const String& // das zu erzeugende Item + const String& // the Item to be addressed ) -/* [Beschreibung] +/* [Description] - Diese Methode kann vom Applikationsentwickler "uberladen werden, - um an seiner SfxViewFrame-Subklasse einen DDE-Hotlink einzurichten + This method can be overloaded by application developers, to establish + a DDE-hotlink to thier SfxApplication subclass. - Die Basisimplementierung erzeugt keinen und liefert 0 zur"uck. + The base implementation is not generate a link and returns 0. */ { @@ -458,7 +455,7 @@ long SfxViewFrame::DdeSetData sal_Bool SfxApplication::InitializeDde() { DBG_ASSERT( !pAppData_Impl->pDdeService, - "Dde kann nicht mehrfach initialisiert werden" ); + "Dde can not be initialized multiple times" ); pAppData_Impl->pDdeService = new ImplDdeService( Application::GetAppName() ); int nError = pAppData_Impl->pDdeService->GetError(); @@ -466,10 +463,10 @@ sal_Bool SfxApplication::InitializeDde() { pAppData_Impl->pDocTopics = new SfxDdeDocTopics_Impl; - // wir wollen auf jedenfall RTF unterstuetzen! + // we certainly want to support RTF! pAppData_Impl->pDdeService->AddFormat( FORMAT_RTF ); - // Config-Pfad als Topic wegen Mehrfachstart + // Config path as a topic becauseof multiple starts INetURLObject aOfficeLockFile( SvtPathOptions().GetUserConfigPath() ); aOfficeLockFile.insertName( DEFINE_CONST_UNICODE( "soffice.lck" ) ); String aService( SfxDdeServiceName_Impl( @@ -494,20 +491,18 @@ void SfxAppData_Impl::DeInitDDE() void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) { - DBG_ASSERT( pAppData_Impl->pDocTopics, "es gibt gar keinen Dde-Service" ); - //OV: Im Serverbetrieb ist DDE abgeklemmt! + DBG_ASSERT( pAppData_Impl->pDocTopics, "There is no Dde-Service" ); + //OV: DDE is disconnected in server mode! if( !pAppData_Impl->pDocTopics ) return; - // doppeltes Eintragen verhindern + // prevent double submit String sShellNm; sal_Bool bFnd = sal_False; for( sal_uInt16 n = pAppData_Impl->pDocTopics->Count(); n; ) if( (*pAppData_Impl->pDocTopics)[ --n ]->pSh == pSh ) { - // JP 18.03.96 - Bug 26470 - // falls das Document unbenannt wurde, ist trotzdem ein - // neues Topics anzulegen! + // If the document is untitled, is still a new Topic is created! if( !bFnd ) { bFnd = sal_True; @@ -526,8 +521,8 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) void SfxApplication::RemoveDdeTopic( SfxObjectShell* pSh ) { - DBG_ASSERT( pAppData_Impl->pDocTopics, "es gibt gar keinen Dde-Service" ); - //OV: Im Serverbetrieb ist DDE abgeklemmt! + DBG_ASSERT( pAppData_Impl->pDocTopics, "There is no Dde-Service" ); + //OV: DDE is disconnected in server mode! if( !pAppData_Impl->pDocTopics ) return; @@ -554,14 +549,14 @@ DdeService* SfxApplication::GetDdeService() sal_Bool ImplDdeService::MakeTopic( const String& rNm ) { - // Workaround gegen Event nach unserem Main() unter OS/2 - // passierte wenn man beim Beenden aus dem OffMgr die App neu startet + // Workaround for Event after Main() under OS/2 + // happens when exiting starts the App again if ( !Application::IsInExecute() ) return sal_False; - // das Topic rNm wird gesucht, haben wir es ? - // erstmal nur ueber die ObjectShells laufen und die mit dem - // Namen heraussuchen: + // The Topic rNm is sought, do we have it? + // First only loop over the ObjectShells to find those + // with the specific name: sal_Bool bRet = sal_False; String sNm( rNm ); sNm.ToLowerAscii(); @@ -571,7 +566,7 @@ sal_Bool ImplDdeService::MakeTopic( const String& rNm ) { String sTmp( pShell->GetTitle(SFX_TITLE_FULLNAME) ); sTmp.ToLowerAscii(); - if( sTmp == sNm ) // die wollen wir haben + if( sTmp == sNm ) { SFX_APP()->AddDdeTopic( pShell ); bRet = sal_True; @@ -587,9 +582,7 @@ sal_Bool ImplDdeService::MakeTopic( const String& rNm ) if ( aWorkPath.GetNewAbsURL( rNm, &aFile ) && SfxContentHelper::IsDocument( aFile.GetMainURL( INetURLObject::NO_DECODE ) ) ) { - // File vorhanden - - // dann versuche die Datei zu laden: + // File exists? then try to load it: SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) ); SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, sal_True); @@ -698,7 +691,7 @@ sal_Bool SfxDdeDocTopic_Impl::StartAdviseLoop() ::sfx2::SvLinkSource* pNewObj = pSh->DdeCreateLinkSource( GetCurItem() ); if( pNewObj ) { - // dann richten wir auch einen entsprechenden SvBaseLink ein + // then we also establish a corresponding SvBaseLink String sNm, sTmp( Application::GetAppName() ); ::sfx2::MakeLnkName( sNm, &sTmp, pSh->GetTitle(SFX_TITLE_FULLNAME), GetCurItem() ); new ::sfx2::SvBaseLink( sNm, OBJECT_DDE_EXTERN, pNewObj ); @@ -707,3 +700,4 @@ sal_Bool SfxDdeDocTopic_Impl::StartAdviseLoop() return bRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |