LCOV - code coverage report
Current view: top level - include/sfx2 - linkmgr.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 4 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             : #ifndef INCLUDED_SFX2_LINKMGR_HXX
      20             : #define INCLUDED_SFX2_LINKMGR_HXX
      21             : 
      22             : #include <rtl/ustring.hxx>
      23             : #include <sal/config.h>
      24             : #include <sfx2/dllapi.h>
      25             : #include <sfx2/linksrc.hxx>
      26             : #include <sfx2/lnkbase.hxx>
      27             : #include <set>
      28             : #include <vector>
      29             : 
      30             : class SfxObjectShell;
      31             : class Graphic;
      32             : class Size;
      33             : 
      34             : namespace com { namespace sun { namespace star {
      35             :     namespace lang {
      36             :         class XComponent;
      37             :     }
      38             : }}}
      39             : 
      40             : namespace sfx2
      41             : {
      42             :     // For the link to receive information about the status of graphics that
      43             :     // will be loaded the FileObject sends a SvData, which contains the
      44             :     // FormatID "RegisterStatusInfoId" and a string as the data container.
      45             :     // This contains the following enum.
      46             : 
      47             : typedef std::vector<SvBaseLinkRef*> SvBaseLinks;
      48             : 
      49             : typedef std::set<SvLinkSource*> SvLinkSources;
      50             : 
      51             : class SFX2_DLLPUBLIC LinkManager
      52             : {
      53             :     typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > >
      54             :         CompVector;
      55             :     CompVector maCachedComps;
      56             : 
      57             :     SvBaseLinks     aLinkTbl;
      58             :     SvLinkSources aServerTbl;
      59             : 
      60             :     SfxObjectShell *pPersist; // LinkMgr must be release before SfxObjectShell
      61             : protected:
      62             :     bool        InsertLink( SvBaseLink* pLink, sal_uInt16 nObjType, sal_uInt16 nUpdateType,
      63             :                             const OUString* pName = 0 );
      64             : public:
      65             : 
      66             :     enum LinkState
      67             :     {
      68             :         STATE_LOAD_OK,
      69             :         STATE_LOAD_ERROR,
      70             :         STATE_LOAD_ABORT
      71             :     };
      72             : 
      73             :                 LinkManager( SfxObjectShell * pCacheCont );
      74             :                 ~LinkManager();
      75             : 
      76             :     /**
      77             :      * Insert a component loaded during link update, which needs to be closed
      78             :      * when the update is complete.
      79             :      *
      80             :      * @param xComp component loaded during link update.
      81             :      */
      82             :     void        InsertCachedComp(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp);
      83             : 
      84             :     void        CloseCachedComps();
      85             : 
      86           0 :     SfxObjectShell*    GetPersist() const              { return pPersist; }
      87           0 :     void        SetPersist( SfxObjectShell * p )   { pPersist = p; }
      88             : 
      89             :     void        Remove( SvBaseLink *pLink );
      90             :     void        Remove( size_t nPos, size_t nCnt = 1 );
      91             :     bool        Insert( SvBaseLink* pLink );
      92             : 
      93             :     // the links connect to a SvLinkSource and adds to the list
      94             :     bool        InsertDDELink( SvBaseLink*,
      95             :                         const OUString& rServer,
      96             :                         const OUString& rTopic,
      97             :                         const OUString& rItem );
      98             : 
      99             :     // if everything is already set at the link!
     100             :     bool        InsertDDELink( SvBaseLink* );
     101             : 
     102             :     // Connect the links to a pseudo-object and add to the list
     103             :     bool InsertFileLink( sfx2::SvBaseLink&,
     104             :                         sal_uInt16 nFileType,
     105             :                         const OUString& rFileNm,
     106             :                         const OUString* pFilterNm = NULL,
     107             :                         const OUString* pRange = NULL );
     108             : 
     109             :     void ReconnectDdeLink(SfxObjectShell& rServer);
     110             : 
     111             :     /**
     112             :      * Reconnect the server document shell to a DDE link object.
     113             :      *
     114             :      * @param rPath path to the server document
     115             :      * @param rServer server document shell instance
     116             :      * @param rLink link object of the client document
     117             :      */
     118             :     void LinkServerShell(const OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink) const;
     119             : 
     120             :     // Obtain the string for the dialog
     121             :     bool GetDisplayNames( const SvBaseLink *,
     122             :                                     OUString* pType,
     123             :                                     OUString* pFile = NULL,
     124             :                                     OUString* pLink = NULL,
     125             :                                     OUString* pFilter = NULL ) const;
     126             : 
     127             :     SvLinkSourceRef CreateObj( SvBaseLink* );
     128             : 
     129             :     void        UpdateAllLinks( bool bAskUpdate = true,
     130             :                                 bool bCallErrHdl = true,
     131             :                                 bool bUpdateGrfLinks = false,
     132             :                                 Window* pParentWin = 0 );
     133             : 
     134             :     // Call for list of links (eg for link-dialog)
     135           0 :     const       SvBaseLinks& GetLinks() const { return aLinkTbl; }
     136             : 
     137             :     // ----------------- Server-side management --------------------
     138             : 
     139             :     // Call with list of links to server
     140           0 :     const SvLinkSources& GetServers() const { return aServerTbl; }
     141             :     // Link register/delete
     142             :     bool            InsertServer( SvLinkSource* rObj );
     143             :     void            RemoveServer( SvLinkSource* rObj );
     144             : 
     145             :     // A transfer is aborted, so cancel all download media
     146             :     // (for the time beeing this is only of interest for the FileLinks!)
     147             :     void CancelTransfers();
     148             : 
     149             :     // To send status information from the FileObject to the Baselink,
     150             :     // for this there exist a separate ClipBoardId. The SvData-object has
     151             :     // got the appropriate information as a string.
     152             :     // Is now required for FileObject in conjunction with JavaScript
     153             :     // this needs information about Load/Abort/Error
     154             :     static sal_uIntPtr RegisterStatusInfoId();
     155             : 
     156             :     // if the mimetype says graphic/bitmap/gdimetafile then get the
     157             :     // graphic from the Any. Return says no errors
     158             :     static bool GetGraphicFromAny( const OUString& rMimeType,
     159             :                                 const ::com::sun::star::uno::Any & rValue,
     160             :                                 Graphic& rGrf );
     161             : 
     162             : private:
     163             :                 LinkManager( const LinkManager& );
     164             :                 LinkManager& operator=( const LinkManager& );
     165             : };
     166             : 
     167             : // Separator in the link name for the DDE-/File-/Graphics- links
     168             : // (only those who need to construct a SvLinkName)
     169             : const sal_Unicode cTokenSeparator = 0xFFFF;
     170             : 
     171             : // create a string for the SvLinkName. For:
     172             : // - DDE the first 3 Strings, (Server, Topic, Item)
     173             : // - File-/Graphics-LinkNames the last 3 Strings (FileName, Region, Filter)
     174             : SFX2_DLLPUBLIC void MakeLnkName( OUString& rName,
     175             :                  const OUString* pType,       // Can also be null!!
     176             :                  const OUString& rFile,
     177             :                  const OUString& rLink,
     178             :                  const OUString* pFilter = 0 );
     179             : 
     180             : }
     181             : 
     182             : #endif
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10