update credits
[LibreOffice.git] / include / sfx2 / lnkbase.hxx
blobebd76db400d05d041ce74172ec75583d877fef16
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _LNKBASE_HXX
20 #define _LNKBASE_HXX
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>
29 namespace com { namespace sun { namespace star { namespace uno
31 class Any;
32 }}}}
34 namespace sfx2
37 struct ImplBaseLinkData;
38 class LinkManager;
39 class SvLinkSource;
40 class FileDialogHelper;
42 #ifndef OBJECT_DDE_EXTERN
43 #define OBJECT_INTERN 0x00
44 //#define OBJECT_SO_EXTERN 0x01
45 #define OBJECT_DDE_EXTERN 0x02
46 #endif
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
56 enum sfxlink {
57 // Ole2 compatibel and persistent
58 LINKUPDATE_ALWAYS = 1,
59 LINKUPDATE_ONCALL = 3,
61 LINKUPDATE_END // dummy!
64 struct BaseLink_Impl;
66 class SFX2_DLLPUBLIC SvBaseLink : public SvRefBase
68 private:
69 friend class LinkManager;
70 friend class SvLinkSource;
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;
81 DECL_LINK( EndEditHdl, String* );
83 bool ExecuteEdit( const String& _rNewName );
85 protected:
86 void SetObjType( sal_uInt16 );
88 // Set LinkSourceName without action
89 void SetName( const String & rLn );
91 ImplBaseLinkData* pImplData;
93 sal_Bool m_bIsReadOnly;
94 com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
95 m_xInputStreamToLoadFrom;
97 SvBaseLink();
98 SvBaseLink( sal_uInt16 nLinkType, sal_uIntPtr nContentType = FORMAT_STRING );
99 virtual ~SvBaseLink();
101 void _GetRealObject( sal_Bool bConnect = sal_True );
103 SvLinkSource* GetRealObject()
105 if( !xObj.Is() )
106 _GetRealObject();
107 return xObj;
110 public:
111 TYPEINFO();
113 virtual void Closed();
114 SvBaseLink( const String& rNm, sal_uInt16 nObjectType,
115 SvLinkSource* );
117 sal_uInt16 GetObjType() const { return nObjType; }
119 void SetObj( SvLinkSource * pObj );
120 SvLinkSource* GetObj() const { return xObj; }
122 void SetLinkSourceName( const String & rName );
123 String GetLinkSourceName() const;
125 enum UpdateResult {
126 SUCCESS = 0,
127 ERROR_GENERAL = 1
130 virtual UpdateResult DataChanged(
131 const String & rMimeType, const ::com::sun::star::uno::Any & rValue );
133 void SetUpdateMode( sal_uInt16 );
134 sal_uInt16 GetUpdateMode() const;
135 sal_uIntPtr GetContentType() const;
136 sal_Bool SetContentType( sal_uIntPtr nType );
138 LinkManager* GetLinkManager();
139 const LinkManager* GetLinkManager() const;
140 void SetLinkManager( LinkManager* _pMgr );
142 sal_Bool Update();
143 void Disconnect();
145 // Link impl: DECL_LINK( MyEndDialogHdl, SvBaseLink* ); <= param is this
146 virtual void Edit( Window*, const Link& rEndEditHdl );
148 // should the link appear in the dialog? (to the left in the link in the...)
149 sal_Bool IsVisible() const { return bVisible; }
150 void SetVisible( sal_Bool bFlag ) { bVisible = bFlag; }
151 // should the Link be loaded synchronous or asynchronous?
152 sal_Bool IsSynchron() const { return bSynchron; }
153 void SetSynchron( sal_Bool bFlag ) { bSynchron = bFlag; }
155 sal_Bool IsUseCache() const { return bUseCache; }
156 void SetUseCache( sal_Bool bFlag ) { bUseCache = bFlag; }
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();
166 inline sal_Bool WasLastEditOK() const { return bWasLastEditOK; }
167 FileDialogHelper & GetInsertFileDialog(const String& rFactory) const;
170 SV_DECL_IMPL_REF(SvBaseLink);
174 #endif
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */