LCOV - code coverage report
Current view: top level - sfx2/inc/sfx2 - lnkbase.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 5 80.0 %
Date: 2012-08-25 Functions: 10 11 90.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 6 66.7 %

           Branch data     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 _LNKBASE_HXX
      20                 :            : #define _LNKBASE_HXX
      21                 :            : 
      22                 :            : #include <com/sun/star/io/XInputStream.hpp>
      23                 :            : #include "sal/config.h"
      24                 :            : #include "sfx2/dllapi.h"
      25                 :            : #include <sot/exchange.hxx>
      26                 :            : #include <tools/ref.hxx>
      27                 :            : #include <sfx2/linksrc.hxx>
      28                 :            : 
      29                 :            : namespace com { namespace sun { namespace star { namespace uno
      30                 :            : {
      31                 :            :     class Any;
      32                 :            : }}}}
      33                 :            : 
      34                 :            : namespace sfx2
      35                 :            : {
      36                 :            : 
      37                 :            : struct ImplBaseLinkData;
      38                 :            : class LinkManager;
      39                 :            : class SvLinkSource;
      40                 :            : class FileDialogHelper;
      41                 :            : 
      42                 :            : #ifndef OBJECT_DDE_EXTERN
      43                 :            : #define OBJECT_INTERN       0x00
      44                 :            : //#define   OBJECT_SO_EXTERN    0x01
      45                 :            : #define OBJECT_DDE_EXTERN   0x02
      46                 :            : #endif
      47                 :            : 
      48                 :            : #define OBJECT_CLIENT_SO              0x80 // a Link
      49                 :            : #define OBJECT_CLIENT_DDE           0x81
      50                 :            : //#define   OBJECT_CLIENT_OLE         0x82 // a Ole-Link
      51                 :            : //#define   OBJECT_CLIENT_OLE_CACHE   0x83 // a Ole-Link with SvEmbeddedObject
      52                 :            : #define OBJECT_CLIENT_FILE          0x90
      53                 :            : #define OBJECT_CLIENT_GRF           0x91
      54                 :            : #define OBJECT_CLIENT_OLE           0x92 // embedded link
      55                 :            : 
      56                 :            : enum sfxlink {
      57                 :            :     // Ole2 compatibel and persistent
      58                 :            :     LINKUPDATE_ALWAYS = 1,
      59                 :            :     LINKUPDATE_ONCALL = 3,
      60                 :            : 
      61                 :            :     LINKUPDATE_END      // dummy!
      62                 :            : };
      63                 :            : 
      64                 :            : struct BaseLink_Impl;
      65                 :            : 
      66                 :            : class SFX2_DLLPUBLIC SvBaseLink : public SvRefBase
      67                 :            : {
      68                 :            : private:
      69                 :            :     friend class LinkManager;
      70                 :            :     friend class SvLinkSource;
      71                 :            : 
      72                 :            :     SvLinkSourceRef         xObj;
      73                 :            :     String                  aLinkName;
      74                 :            :     BaseLink_Impl*          pImpl;
      75                 :            :     sal_uInt16                  nObjType;
      76                 :            :     sal_Bool                    bVisible : 1;
      77                 :            :     sal_Bool                    bSynchron : 1;
      78                 :            :     sal_Bool                    bUseCache : 1;  // for Graphics Links!
      79                 :            :     sal_Bool                    bWasLastEditOK : 1;
      80                 :            : 
      81                 :            :     DECL_LINK( EndEditHdl, String* );
      82                 :            : 
      83                 :            :     bool                    ExecuteEdit( const String& _rNewName );
      84                 :            : 
      85                 :            : protected:
      86                 :            :     void            SetObjType( sal_uInt16 );
      87                 :            : 
      88                 :            :     // Set LinkSourceName without action
      89                 :            :     void            SetName( const String & rLn );
      90                 :            : 
      91                 :            :     ImplBaseLinkData* pImplData;
      92                 :            : 
      93                 :            :     sal_Bool            m_bIsReadOnly;
      94                 :            :     com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
      95                 :            :                         m_xInputStreamToLoadFrom;
      96                 :            : 
      97                 :            :                     SvBaseLink();
      98                 :            :                     SvBaseLink( sal_uInt16 nLinkType, sal_uIntPtr nContentType = FORMAT_STRING );
      99                 :            :     virtual         ~SvBaseLink();
     100                 :            : 
     101                 :            :     void            _GetRealObject( sal_Bool bConnect = sal_True );
     102                 :            : 
     103                 :            :     SvLinkSource*   GetRealObject()
     104                 :            :                     {
     105                 :            :                         if( !xObj.Is() )
     106                 :            :                             _GetRealObject();
     107                 :            :                         return xObj;
     108                 :            :                     }
     109                 :            : 
     110                 :            : public:
     111                 :            :                     TYPEINFO();
     112                 :            : 
     113                 :            :     virtual void    Closed();
     114                 :            :                     SvBaseLink( const String& rNm, sal_uInt16 nObjectType,
     115                 :            :                                  SvLinkSource* );
     116                 :            : 
     117                 :        581 :     sal_uInt16          GetObjType() const { return nObjType; }
     118                 :            : 
     119                 :            :     void            SetObj( SvLinkSource * pObj );
     120                 :          8 :     SvLinkSource*   GetObj() const  { return xObj; }
     121                 :            : 
     122                 :            :     void            SetLinkSourceName( const String & rName );
     123                 :            :     String          GetLinkSourceName() const;
     124                 :            : 
     125                 :            :     enum UpdateResult {
     126                 :            :         SUCCESS = 0,
     127                 :            :         ERROR_GENERAL = 1
     128                 :            :     };
     129                 :            : 
     130                 :            :     virtual UpdateResult DataChanged(
     131                 :            :         const String & rMimeType, const ::com::sun::star::uno::Any & rValue );
     132                 :            : 
     133                 :            :     void            SetUpdateMode( sal_uInt16 );
     134                 :            :     sal_uInt16          GetUpdateMode() const;
     135                 :            :     sal_uIntPtr             GetContentType() const;
     136                 :            :     sal_Bool            SetContentType( sal_uIntPtr nType );
     137                 :            : 
     138                 :            :     LinkManager*          GetLinkManager();
     139                 :            :     const LinkManager*    GetLinkManager() const;
     140                 :            :     void                    SetLinkManager( LinkManager* _pMgr );
     141                 :            : 
     142                 :            :     sal_Bool            Update();
     143                 :            :     void            Disconnect();
     144                 :            : 
     145                 :            :     // Link impl: DECL_LINK( MyEndDialogHdl, SvBaseLink* ); <= param is this
     146                 :            :     virtual void    Edit( Window*, const Link& rEndEditHdl );
     147                 :            : 
     148                 :            :     // should the link appear in the dialog? (to the left in the link in the...)
     149                 :          0 :     sal_Bool            IsVisible() const           { return bVisible; }
     150                 :            :     void            SetVisible( sal_Bool bFlag )    { bVisible = bFlag; }
     151                 :            :     // should the Link be loaded synchronous or asynchronous?
     152                 :         12 :     sal_Bool            IsSynchron() const          { return bSynchron; }
     153                 :            :     void            SetSynchron( sal_Bool bFlag )   { bSynchron = bFlag; }
     154                 :            : 
     155                 :            :     sal_Bool            IsUseCache() const          { return bUseCache; }
     156                 :            :     void            SetUseCache( sal_Bool bFlag )   { bUseCache = bFlag; }
     157                 :            : 
     158                 :            :     void            setStreamToLoadFrom(
     159                 :            :                         const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,
     160                 :            :                         sal_Bool bIsReadOnly )
     161                 :            :                             { m_xInputStreamToLoadFrom = xInputStream;
     162                 :            :                               m_bIsReadOnly = bIsReadOnly; }
     163                 :            :     // #i88291#
     164                 :            :     void            clearStreamToLoadFrom();
     165                 :            : 
     166                 :            :     inline sal_Bool         WasLastEditOK() const       { return bWasLastEditOK; }
     167                 :            :     FileDialogHelper & GetInsertFileDialog(const String& rFactory) const;
     168                 :            : };
     169                 :            : 
     170 [ +  + ][ +  - ]:        560 : SV_DECL_IMPL_REF(SvBaseLink);
                 [ +  - ]
     171                 :            : 
     172                 :            : }
     173                 :            : 
     174                 :            : #endif
     175                 :            : 
     176                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10