LCOV - code coverage report
Current view: top level - sfx2/source/appl - appdde.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 49 0.0 %
Date: 2014-04-14 Functions: 0 16 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <vcl/wrkwin.hxx>
      21             : #include <svl/rectitem.hxx>
      22             : #include <svl/eitem.hxx>
      23             : #include <svl/intitem.hxx>
      24             : #include <basic/sbstar.hxx>
      25             : #include <svl/stritem.hxx>
      26             : #include <svl/svdde.hxx>
      27             : #include <sfx2/lnkbase.hxx>
      28             : #include <sfx2/linkmgr.hxx>
      29             : 
      30             : #include <tools/urlobj.hxx>
      31             : #include <tools/diagnose_ex.h>
      32             : #include <unotools/pathoptions.hxx>
      33             : 
      34             : #include <sfx2/app.hxx>
      35             : #include "appdata.hxx"
      36             : #include <sfx2/objsh.hxx>
      37             : #include <sfx2/viewfrm.hxx>
      38             : #include <sfx2/dispatch.hxx>
      39             : #include "sfxtypes.hxx"
      40             : #include <sfx2/sfxsids.hrc>
      41             : #include "helper.hxx"
      42             : #include <sfx2/docfile.hxx>
      43             : #include <comphelper/processfactory.hxx>
      44             : #include <comphelper/string.hxx>
      45             : #include <com/sun/star/ucb/IllegalIdentifierException.hpp>
      46             : 
      47             : #if defined WNT
      48             : 
      49             : OUString SfxDdeServiceName_Impl( const OUString& sIn )
      50             : {
      51             :     OUStringBuffer sReturn(sIn.getLength());
      52             : 
      53             :     for ( sal_uInt16 n = sIn.getLength(); n; --n )
      54             :     {
      55             :         sal_Unicode cChar = sIn[n-1];
      56             :         if (comphelper::string::isalnumAscii(cChar))
      57             :             sReturn.append(cChar);
      58             :     }
      59             : 
      60             :     return sReturn.makeStringAndClear();
      61             : }
      62             : 
      63             : class ImplDdeService : public DdeService
      64             : {
      65             : public:
      66             :     ImplDdeService( const OUString& rNm )
      67             :         : DdeService( rNm )
      68             :     {}
      69             :     virtual bool MakeTopic( const OUString& );
      70             : 
      71             :     virtual OUString  Topics();
      72             : 
      73             :     virtual bool SysTopicExecute( const OUString* pStr );
      74             : };
      75             : 
      76             : 
      77             : namespace
      78             : {
      79             :     sal_Bool lcl_IsDocument( const OUString& rContent )
      80             :     {
      81             :         using namespace com::sun::star;
      82             : 
      83             :         sal_Bool bRet = sal_False;
      84             :         INetURLObject aObj( rContent );
      85             :         DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
      86             : 
      87             :         try
      88             :         {
      89             :             ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
      90             :             bRet = aCnt.isDocument();
      91             :         }
      92             :         catch( const ucb::CommandAbortedException& )
      93             :         {
      94             :             DBG_WARNING( "CommandAbortedException" );
      95             :         }
      96             :         catch( const ucb::IllegalIdentifierException& )
      97             :         {
      98             :             DBG_WARNING( "IllegalIdentifierException" );
      99             :         }
     100             :         catch( const ucb::ContentCreationException& )
     101             :         {
     102             :             DBG_WARNING( "IllegalIdentifierException" );
     103             :         }
     104             :         catch( const uno::Exception& )
     105             :         {
     106             :             SAL_WARN( "sfx.appl", "Any other exception" );
     107             :         }
     108             : 
     109             :         return bRet;
     110             :     }
     111             : }
     112             : 
     113             : bool ImplDdeService::MakeTopic( const OUString& rNm )
     114             : {
     115             :     // Workaround for Event after Main() under OS/2
     116             :     // happens when exiting starts the App again
     117             :     if ( !Application::IsInExecute() )
     118             :         return false;
     119             : 
     120             :     // The Topic rNm is sought, do we have it?
     121             :     // First only loop over the ObjectShells to find those
     122             :     // with the specific name:
     123             :     sal_Bool bRet = sal_False;
     124             :     OUString sNm( rNm.toAsciiLowerCase() );
     125             :     TypeId aType( TYPE(SfxObjectShell) );
     126             :     SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType );
     127             :     while( pShell )
     128             :     {
     129             :         OUString sTmp( pShell->GetTitle(SFX_TITLE_FULLNAME) );
     130             :         if( sNm == sTmp.toAsciiLowerCase() )
     131             :         {
     132             :             SFX_APP()->AddDdeTopic( pShell );
     133             :             bRet = true;
     134             :             break;
     135             :         }
     136             :         pShell = SfxObjectShell::GetNext( *pShell, &aType );
     137             :     }
     138             : 
     139             :     if( !bRet )
     140             :     {
     141             :         INetURLObject aWorkPath( SvtPathOptions().GetWorkPath() );
     142             :         INetURLObject aFile;
     143             :         if ( aWorkPath.GetNewAbsURL( rNm, &aFile ) &&
     144             :              lcl_IsDocument( aFile.GetMainURL( INetURLObject::NO_DECODE ) ) )
     145             :         {
     146             :             // File exists? then try to load it:
     147             :             SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) );
     148             :             SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, sal_True);
     149             : 
     150             :             SfxBoolItem aSilent(SID_SILENT, sal_True);
     151             :             SfxDispatcher* pDispatcher = SFX_APP()->GetDispatcher_Impl();
     152             :             const SfxPoolItem* pRet = pDispatcher->Execute( SID_OPENDOC,
     153             :                     SFX_CALLMODE_SYNCHRON,
     154             :                     &aName, &aNewView,
     155             :                     &aSilent, 0L );
     156             : 
     157             :             if( pRet && pRet->ISA( SfxViewFrameItem ) &&
     158             :                 ((SfxViewFrameItem*)pRet)->GetFrame() &&
     159             :                 0 != ( pShell = ((SfxViewFrameItem*)pRet)
     160             :                     ->GetFrame()->GetObjectShell() ) )
     161             :             {
     162             :                 SFX_APP()->AddDdeTopic( pShell );
     163             :                 bRet = true;
     164             :             }
     165             :         }
     166             :     }
     167             :     return bRet;
     168             : }
     169             : 
     170             : OUString ImplDdeService::Topics()
     171             : {
     172             :     OUString sRet;
     173             :     if( GetSysTopic() )
     174             :         sRet += GetSysTopic()->GetName();
     175             : 
     176             :     TypeId aType( TYPE(SfxObjectShell) );
     177             :     SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType );
     178             :     while( pShell )
     179             :     {
     180             :         if( SfxViewFrame::GetFirst( pShell ) )
     181             :         {
     182             :             if( !sRet.isEmpty() )
     183             :                 sRet += "\t";
     184             :             sRet += pShell->GetTitle(SFX_TITLE_FULLNAME);
     185             :         }
     186             :         pShell = SfxObjectShell::GetNext( *pShell, &aType );
     187             :     }
     188             :     if( !sRet.isEmpty() )
     189             :         sRet += "\r\n";
     190             :     return sRet;
     191             : }
     192             : 
     193             : bool ImplDdeService::SysTopicExecute( const OUString* pStr )
     194             : {
     195             :     return SFX_APP()->DdeExecute( *pStr );
     196             : }
     197             : #endif
     198             : 
     199             : class SfxDdeTriggerTopic_Impl : public DdeTopic
     200             : {
     201             : #if defined WNT
     202             : public:
     203             :     SfxDdeTriggerTopic_Impl()
     204             :         : DdeTopic( "TRIGGER" )
     205             :         {}
     206             : 
     207             :     virtual bool Execute( const OUString* ) SAL_OVERRIDE { return true; }
     208             : #endif
     209             : };
     210             : 
     211             : class SfxDdeDocTopic_Impl : public DdeTopic
     212             : {
     213             : #if defined WNT
     214             : public:
     215             :     SfxObjectShell* pSh;
     216             :     DdeData aData;
     217             :     ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
     218             : 
     219             :     SfxDdeDocTopic_Impl( SfxObjectShell* pShell )
     220             :         : DdeTopic( pShell->GetTitle(SFX_TITLE_FULLNAME) ), pSh( pShell )
     221             :     {}
     222             : 
     223             :     virtual DdeData* Get( sal_uIntPtr ) SAL_OVERRIDE;
     224             :     virtual bool Put( const DdeData* ) SAL_OVERRIDE;
     225             :     virtual bool Execute( const OUString* ) SAL_OVERRIDE;
     226             :     virtual bool StartAdviseLoop() SAL_OVERRIDE;
     227             :     virtual bool MakeItem( const OUString& rItem ) SAL_OVERRIDE;
     228             : #endif
     229             : };
     230             : 
     231             : 
     232           0 : class SfxDdeDocTopics_Impl : public std::vector<SfxDdeDocTopic_Impl*> {};
     233             : 
     234             : #if defined( WNT )
     235             : 
     236             : namespace {
     237             : 
     238             : /*  [Description]
     239             : 
     240             :     Checks if 'rCmd' of the event 'rEvent' is (without '(') and then assemble
     241             :     this data into a <ApplicationEvent>, which is then excecuted through
     242             :     <Application::AppEvent()>. If 'rCmd' is the given event 'rEvent', then
     243             :     TRUE is returned, otherwise FALSE.
     244             : 
     245             :     [Example]
     246             : 
     247             :     rCmd = "Open(\"d:\doc\doc.sdw\")"
     248             :     rEvent = "Open"
     249             : */
     250             : sal_Bool SfxAppEvent_Impl( const OUString& rCmd, const OUString& rEvent,
     251             :                            ApplicationEvent::Type eType )
     252             : {
     253             :     OUString sEvent(rEvent + "(");
     254             :     if (rCmd.startsWithIgnoreAsciiCase(sEvent))
     255             :     {
     256             :         sal_Int32 start = sEvent.getLength();
     257             :         if ( rCmd.getLength() - start >= 2 )
     258             :         {
     259             :             // Transform into the ApplicationEvent Format
     260             :             //TODO: I /assume/ that rCmd should match the syntax of
     261             :             // <http://msdn.microsoft.com/en-us/library/ms648995.aspx>
     262             :             // "WM_DDE_EXECUTE message" but does not (handle commands enclosed
     263             :             // in [...]; handle commas separating multiple arguments; handle
     264             :             // double "", ((, )), [[, ]] in quoted arguments); see also the mail
     265             :             // thread starting at <http://lists.freedesktop.org/archives/
     266             :             // libreoffice/2013-July/054779.html> "DDE on Windows."
     267             :             std::vector<OUString> aData;
     268             :             for ( sal_Int32 n = start; n < rCmd.getLength() - 1; )
     269             :             {
     270             :                 // Resiliently read arguments either starting with " and
     271             :                 // spanning to the next " (if any; TODO: do we need to undo any
     272             :                 // escaping within the string?) or with neither " nor SPC and
     273             :                 // spanning to the next SPC (if any; TODO: is this from not
     274             :                 // wrapped in "..." relevant? it would have been parsed by the
     275             :                 // original code even if that was only by accident, so I left it
     276             :                 // in), with runs of SPCs treated like single ones:
     277             :                 switch ( rCmd[n] )
     278             :                 {
     279             :                 case '"':
     280             :                     {
     281             :                         sal_Int32 i = rCmd.indexOf('"', ++n);
     282             :                         if (i < 0 || i > rCmd.getLength() - 1) {
     283             :                             i = rCmd.getLength() - 1;
     284             :                         }
     285             :                         aData.push_back(rCmd.copy(n, i - n));
     286             :                         n = i + 1;
     287             :                         break;
     288             :                     }
     289             :                 case ' ':
     290             :                     ++n;
     291             :                     break;
     292             :                 default:
     293             :                     {
     294             :                         sal_Int32 i = rCmd.indexOf(' ', n);
     295             :                         if (i < 0 || i > rCmd.getLength() - 1) {
     296             :                             i = rCmd.getLength() - 1;
     297             :                         }
     298             :                         aData.push_back(rCmd.copy(n, i - n));
     299             :                         n = i + 1;
     300             :                         break;
     301             :                     }
     302             :                 }
     303             :             }
     304             : 
     305             :             GetpApp()->AppEvent( ApplicationEvent(eType, aData) );
     306             :             return sal_True;
     307             :         }
     308             :     }
     309             : 
     310             :     return sal_False;
     311             : }
     312             : 
     313             : }
     314             : 
     315             : /*  Description]
     316             : 
     317             :     This method can be overloaded by application developers, to receive
     318             :     DDE-commands directed to their SfxApplication subclass.
     319             : 
     320             :     The base implementation understands the API functionality of the
     321             :     relevant SfxApplication subclass in BASIC syntax. Return values can
     322             :     not be transferred, unfortunately.
     323             : */
     324             : long SfxApplication::DdeExecute( const OUString&   rCmd )  // Expressed in our BASIC-Syntax
     325             : {
     326             :     // Print or Open-Event?
     327             :     if ( !( SfxAppEvent_Impl( rCmd, "Print", ApplicationEvent::TYPE_PRINT ) ||
     328             :             SfxAppEvent_Impl( rCmd, "Open", ApplicationEvent::TYPE_OPEN ) ) )
     329             :     {
     330             :         // all others are BASIC
     331             :         StarBASIC* pBasic = GetBasic();
     332             :         DBG_ASSERT( pBasic, "Where is the Basic???" );
     333             :         SbxVariable* pRet = pBasic->Execute( rCmd );
     334             :         if( !pRet )
     335             :         {
     336             :             SbxBase::ResetError();
     337             :             return 0;
     338             :         }
     339             :     }
     340             :     return 1;
     341             : }
     342             : 
     343             : #endif
     344             : 
     345             : /*  [Description]
     346             : 
     347             :     This method can be overloaded by application developers, to receive
     348             :     DDE-commands directed to the their SfxApplication subclass.
     349             : 
     350             :     The base implementation does nothing and returns 0.
     351             : */
     352           0 : long SfxObjectShell::DdeExecute( const OUString&   rCmd )  // Expressed in our BASIC-Syntax
     353             : {
     354             : #ifdef DISABLE_SCRIPTING
     355             :     (void) rCmd;
     356             : #else
     357           0 :     StarBASIC* pBasic = GetBasic();
     358             :     DBG_ASSERT( pBasic, "Where is the Basic???" ) ;
     359           0 :     SbxVariable* pRet = pBasic->Execute( rCmd );
     360           0 :     if( !pRet )
     361             :     {
     362           0 :         SbxBase::ResetError();
     363           0 :         return 0;
     364             :     }
     365             : #endif
     366           0 :     return 1;
     367             : }
     368             : 
     369             : 
     370             : 
     371             : /*  [Description]
     372             : 
     373             :     This method can be overloaded by application developers, to receive
     374             :     DDE-data-requests directed to their SfxApplication subclass.
     375             : 
     376             :     The base implementation provides no data and returns false.
     377             : */
     378           0 : bool SfxObjectShell::DdeGetData( const OUString&,              // the Item to be addressed
     379             :                                  const OUString&,              // in: Format
     380             :                                  ::com::sun::star::uno::Any& )// out: requested data
     381             : {
     382           0 :     return false;
     383             : }
     384             : 
     385             : 
     386             : 
     387             : /*  [Description]
     388             : 
     389             :     This method can be overloaded by application developers, to receive
     390             :     DDE-data directed to their SfxApplication subclass.
     391             : 
     392             :     The base implementation is not receiving any data and returns false.
     393             : */
     394           0 : bool SfxObjectShell::DdeSetData( const OUString&,                    // the Item to be addressed
     395             :                                  const OUString&,                    // in: Format
     396             :                                  const ::com::sun::star::uno::Any& )// out: requested data
     397             : {
     398           0 :     return false;
     399             : }
     400             : 
     401             : /*  [Description]
     402             : 
     403             :     This method can be overloaded by application developers, to establish
     404             :     a DDE-hotlink to their SfxApplication subclass.
     405             : 
     406             :     The base implementation is not generate a link and returns 0.
     407             : */
     408           0 : ::sfx2::SvLinkSource* SfxObjectShell::DdeCreateLinkSource( const OUString& ) // the Item to be addressed
     409             : {
     410           0 :     return 0;
     411             : }
     412             : 
     413           0 : void SfxObjectShell::ReconnectDdeLink(SfxObjectShell& /*rServer*/)
     414             : {
     415           0 : }
     416             : 
     417           0 : void SfxObjectShell::ReconnectDdeLinks(SfxObjectShell& rServer)
     418             : {
     419           0 :     TypeId aType = TYPE(SfxObjectShell);
     420           0 :     SfxObjectShell* p = GetFirst(&aType, false);
     421           0 :     while (p)
     422             :     {
     423           0 :         if (&rServer != p)
     424           0 :             p->ReconnectDdeLink(rServer);
     425             : 
     426           0 :         p = GetNext(*p, &aType, false);
     427             :     }
     428           0 : }
     429             : 
     430             : /*  [Description]
     431             : 
     432             :     This method can be overloaded by application developers, to receive
     433             :     DDE-commands directed to the their SfxApplication subclass.
     434             : 
     435             :     The base implementation understands the API functionality of the
     436             :     relevant SfxViewFrame, which is shown and the relevant SfxViewShell
     437             :     and the relevant SfxApplication subclass in BASIC syntax. Return
     438             :     values can not be transferred, unfortunately.
     439             : */
     440           0 : long SfxViewFrame::DdeExecute( const OUString&   rCmd ) // Expressed in our BASIC-Syntax
     441             : {
     442           0 :     if ( GetObjectShell() )
     443           0 :         return GetObjectShell()->DdeExecute( rCmd );
     444             : 
     445           0 :     return 0;
     446             : }
     447             : 
     448             : /*  [Description]
     449             : 
     450             :     This method can be overloaded by application developers, to receive
     451             :     DDE-data-requests directed to their SfxApplication subclass.
     452             : 
     453             :     The base implementation provides no data and returns false.
     454             : */
     455           0 : bool SfxViewFrame::DdeGetData( const OUString&,            // the Item to be addressed
     456             :                                const OUString&,            // in: Format
     457             :                                ::com::sun::star::uno::Any& )// out: requested data
     458             : {
     459           0 :     return false;
     460             : }
     461             : 
     462             : /*  [Description]
     463             : 
     464             :     This method can be overloaded by application developers, to receive
     465             :     DDE-data directed to their SfxApplication subclass.
     466             : 
     467             :     The base implementation is not receiving any data and returns false.
     468             : */
     469           0 : bool SfxViewFrame::DdeSetData( const OUString&,                  // the Item to be addressed
     470             :                                const OUString&,                  // in: Format
     471             :                                const ::com::sun::star::uno::Any& )// out: requested data
     472             : {
     473           0 :     return false;
     474             : }
     475             : 
     476             : /*  [Description]
     477             : 
     478             :     This method can be overloaded by application developers, to establish
     479             :     a DDE-hotlink to their SfxApplication subclass.
     480             : 
     481             :     The base implementation is not generate a link and returns 0.
     482             : */
     483           0 : ::sfx2::SvLinkSource* SfxViewFrame::DdeCreateLinkSource( const OUString&  )// the Item to be addressed
     484             : {
     485           0 :     return 0;
     486             : }
     487             : 
     488           0 : bool SfxApplication::InitializeDde()
     489             : {
     490           0 :     int nError = 0;
     491             : #if defined( WNT )
     492             :     DBG_ASSERT( !pAppData_Impl->pDdeService,
     493             :                 "Dde can not be initialized multiple times" );
     494             : 
     495             :     pAppData_Impl->pDdeService = new ImplDdeService( Application::GetAppName() );
     496             :     nError = pAppData_Impl->pDdeService->GetError();
     497             :     if( !nError )
     498             :     {
     499             :         pAppData_Impl->pDocTopics = new SfxDdeDocTopics_Impl;
     500             : 
     501             :         // we certainly want to support RTF!
     502             :         pAppData_Impl->pDdeService->AddFormat( FORMAT_RTF );
     503             : 
     504             :         // Config path as a topic becauseof multiple starts
     505             :         INetURLObject aOfficeLockFile( SvtPathOptions().GetUserConfigPath() );
     506             :         aOfficeLockFile.insertName( "soffice.lck" );
     507             :         OUString aService( SfxDdeServiceName_Impl(
     508             :                     aOfficeLockFile.GetMainURL(INetURLObject::DECODE_TO_IURI) ) );
     509             :         aService = aService.toAsciiUpperCase();
     510             :         pAppData_Impl->pDdeService2 = new ImplDdeService( aService );
     511             :         pAppData_Impl->pTriggerTopic = new SfxDdeTriggerTopic_Impl;
     512             :         pAppData_Impl->pDdeService2->AddTopic( *pAppData_Impl->pTriggerTopic );
     513             :     }
     514             : #endif
     515           0 :     return !nError;
     516             : }
     517             : 
     518           0 : void SfxAppData_Impl::DeInitDDE()
     519             : {
     520           0 :     DELETEZ( pTriggerTopic );
     521           0 :     DELETEZ( pDdeService2 );
     522           0 :     DELETEZ( pDocTopics );
     523           0 :     DELETEZ( pDdeService );
     524           0 : }
     525             : 
     526             : #if defined( WNT )
     527             : void SfxApplication::AddDdeTopic( SfxObjectShell* pSh )
     528             : {
     529             :     DBG_ASSERT( pAppData_Impl->pDocTopics, "There is no Dde-Service" );
     530             :     //OV: DDE is disconnected in server mode!
     531             :     if( !pAppData_Impl->pDocTopics )
     532             :         return;
     533             : 
     534             :     // prevent double submit
     535             :     OUString sShellNm;
     536             :     sal_Bool bFnd = sal_False;
     537             :     for (size_t n = pAppData_Impl->pDocTopics->size(); n;)
     538             :     {
     539             :         if( (*pAppData_Impl->pDocTopics)[ --n ]->pSh == pSh )
     540             :         {
     541             :             // If the document is untitled, is still a new Topic is created!
     542             :             if( !bFnd )
     543             :             {
     544             :                 bFnd = sal_True;
     545             :                 sShellNm = pSh->GetTitle(SFX_TITLE_FULLNAME).toAsciiLowerCase();
     546             :             }
     547             :             OUString sNm( (*pAppData_Impl->pDocTopics)[ n ]->GetName() );
     548             :             if( sShellNm == sNm.toAsciiLowerCase() )
     549             :                 return ;
     550             :         }
     551             :     }
     552             : 
     553             :     SfxDdeDocTopic_Impl *const pTopic = new SfxDdeDocTopic_Impl(pSh);
     554             :     pAppData_Impl->pDocTopics->push_back(pTopic);
     555             :     pAppData_Impl->pDdeService->AddTopic( *pTopic );
     556             : }
     557             : #endif
     558             : 
     559           0 : void SfxApplication::RemoveDdeTopic( SfxObjectShell* pSh )
     560             : {
     561             : #if defined WNT
     562             :     DBG_ASSERT( pAppData_Impl->pDocTopics, "There is no Dde-Service" );
     563             :     //OV: DDE is disconnected in server mode!
     564             :     if( !pAppData_Impl->pDocTopics )
     565             :         return;
     566             : 
     567             :     for (size_t n = pAppData_Impl->pDocTopics->size(); n; )
     568             :     {
     569             :         SfxDdeDocTopic_Impl *const pTopic = (*pAppData_Impl->pDocTopics)[ --n ];
     570             :         if (pTopic->pSh == pSh)
     571             :         {
     572             :             pAppData_Impl->pDdeService->RemoveTopic( *pTopic );
     573             :             delete pTopic;
     574             :             pAppData_Impl->pDocTopics->erase( pAppData_Impl->pDocTopics->begin() + n );
     575             :         }
     576             :     }
     577             : #else
     578             :     (void) pSh;
     579             : #endif
     580           0 : }
     581             : 
     582           0 : const DdeService* SfxApplication::GetDdeService() const
     583             : {
     584           0 :     return pAppData_Impl->pDdeService;
     585             : }
     586             : 
     587           0 : DdeService* SfxApplication::GetDdeService()
     588             : {
     589           0 :     return pAppData_Impl->pDdeService;
     590             : }
     591             : 
     592             : #if defined WNT
     593             : 
     594             : DdeData* SfxDdeDocTopic_Impl::Get( sal_uIntPtr nFormat )
     595             : {
     596             :     OUString sMimeType( SotExchange::GetFormatMimeType( nFormat ));
     597             :     ::com::sun::star::uno::Any aValue;
     598             :     bool nRet = pSh->DdeGetData( GetCurItem(), sMimeType, aValue );
     599             :     if( nRet && aValue.hasValue() && ( aValue >>= aSeq ) )
     600             :     {
     601             :         aData = DdeData( aSeq.getConstArray(), aSeq.getLength(), nFormat );
     602             :         return &aData;
     603             :     }
     604             :     aSeq.realloc( 0 );
     605             :     return 0;
     606             : }
     607             : 
     608             : bool SfxDdeDocTopic_Impl::Put( const DdeData* pData )
     609             : {
     610             :     aSeq = ::com::sun::star::uno::Sequence< sal_Int8 >(
     611             :                             (sal_Int8*)(const void*)*pData, (long)*pData );
     612             :     bool bRet;
     613             :     if( aSeq.getLength() )
     614             :     {
     615             :         ::com::sun::star::uno::Any aValue;
     616             :         aValue <<= aSeq;
     617             :         OUString sMimeType( SotExchange::GetFormatMimeType( pData->GetFormat() ));
     618             :         bRet = pSh->DdeSetData( GetCurItem(), sMimeType, aValue );
     619             :     }
     620             :     else
     621             :         bRet = false;
     622             :     return bRet;
     623             : }
     624             : 
     625             : bool SfxDdeDocTopic_Impl::Execute( const OUString* pStr )
     626             : {
     627             :     long nRet = pStr ? pSh->DdeExecute( *pStr ) : 0;
     628             :     return 0 != nRet;
     629             : }
     630             : 
     631             : bool SfxDdeDocTopic_Impl::MakeItem( const OUString& rItem )
     632             : {
     633             :     AddItem( DdeItem( rItem ) );
     634             :     return true;
     635             : }
     636             : 
     637             : bool SfxDdeDocTopic_Impl::StartAdviseLoop()
     638             : {
     639             :     bool bRet = false;
     640             :     ::sfx2::SvLinkSource* pNewObj = pSh->DdeCreateLinkSource( GetCurItem() );
     641             :     if( pNewObj )
     642             :     {
     643             :         // then we also establish a corresponding SvBaseLink
     644             :         OUString sNm, sTmp( Application::GetAppName() );
     645             :         ::sfx2::MakeLnkName( sNm, &sTmp, pSh->GetTitle(SFX_TITLE_FULLNAME), GetCurItem() );
     646             :         new ::sfx2::SvBaseLink( sNm, OBJECT_DDE_EXTERN, pNewObj );
     647             :         bRet = true;
     648             :     }
     649             :     return bRet;
     650             : }
     651             : 
     652             : #endif
     653             : 
     654             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10