Don't search for old (<= 2.0) .NET SDK anymore
[LibreOffice.git] / include / sfx2 / lnkbase.hxx
blob09f14b3a1723482da84506f5fb14e0c932809dc0
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 INCLUDED_SFX2_LNKBASE_HXX
20 #define INCLUDED_SFX2_LNKBASE_HXX
22 #include <com/sun/star/io/XInputStream.hpp>
23 #include <rtl/ustring.hxx>
24 #include <sal/config.h>
25 #include <sfx2/dllapi.h>
26 #include <sfx2/linksrc.hxx>
27 #include <sot/exchange.hxx>
28 #include <tools/ref.hxx>
29 #include <memory>
31 namespace com { namespace sun { namespace star { namespace uno
33 class Any;
34 }}}}
36 enum class SfxLinkUpdateMode {
37 NONE = 0,
38 // Ole2 compatible and persistent
39 ALWAYS = 1,
40 ONCALL = 3
43 namespace sfx2
46 struct ImplBaseLinkData;
47 class LinkManager;
48 class SvLinkSource;
49 class FileDialogHelper;
51 #ifndef OBJECT_DDE_EXTERN
52 #define OBJECT_INTERN 0x00
53 //#define OBJECT_SO_EXTERN 0x01
54 #define OBJECT_DDE_EXTERN 0x02
55 #endif
57 #define OBJECT_CLIENT_SO 0x80 // a Link
58 #define OBJECT_CLIENT_DDE 0x81
59 //#define OBJECT_CLIENT_OLE 0x82 // a Ole-Link
60 //#define OBJECT_CLIENT_OLE_CACHE 0x83 // a Ole-Link with SvEmbeddedObject
61 #define OBJECT_CLIENT_FILE 0x90
62 #define OBJECT_CLIENT_GRF 0x91
63 #define OBJECT_CLIENT_OLE 0x92 // embedded link
65 struct BaseLink_Impl;
67 class SFX2_DLLPUBLIC SvBaseLink : public SvRefBase
69 private:
70 friend class LinkManager;
71 friend class SvLinkSource;
73 SvLinkSourceRef xObj;
74 OUString aLinkName;
75 std::unique_ptr<BaseLink_Impl> pImpl;
76 sal_uInt16 nObjType;
77 bool bVisible : 1;
78 bool bSynchron : 1;
79 bool bWasLastEditOK : 1;
81 DECL_LINK( EndEditHdl, const OUString&, void );
83 bool ExecuteEdit( const OUString& _rNewName );
85 protected:
86 void SetObjType( sal_uInt16 );
88 // Set LinkSourceName without action
89 void SetName( const OUString & rLn );
91 std::unique_ptr<ImplBaseLinkData> pImplData;
93 bool m_bIsReadOnly;
94 css::uno::Reference<css::io::XInputStream>
95 m_xInputStreamToLoadFrom;
97 SvBaseLink();
98 SvBaseLink( SfxLinkUpdateMode nLinkType, SotClipboardFormatId nContentType );
99 virtual ~SvBaseLink() override;
101 void GetRealObject_( bool bConnect = true );
103 SvLinkSource* GetRealObject()
105 if( !xObj.is() )
106 GetRealObject_();
107 return xObj.get();
110 public:
112 virtual void Closed();
114 #if defined(_WIN32)
115 SvBaseLink( const OUString& rNm, sal_uInt16 nObjectType,
116 SvLinkSource* );
117 #endif
119 sal_uInt16 GetObjType() const { return nObjType; }
121 void SetObj( SvLinkSource * pObj );
122 SvLinkSource* GetObj() const { return xObj.get(); }
124 void SetLinkSourceName( const OUString & rName );
125 const OUString& GetLinkSourceName() const { return aLinkName;}
127 enum UpdateResult {
128 SUCCESS = 0,
129 ERROR_GENERAL = 1
132 virtual UpdateResult DataChanged(
133 const OUString & rMimeType, const css::uno::Any & rValue );
135 void SetUpdateMode( SfxLinkUpdateMode );
136 SfxLinkUpdateMode GetUpdateMode() const;
137 SotClipboardFormatId GetContentType() const;
138 void SetContentType( SotClipboardFormatId nType );
140 LinkManager* GetLinkManager();
141 const LinkManager* GetLinkManager() const;
142 void SetLinkManager( LinkManager* _pMgr );
144 bool Update();
145 void Disconnect();
147 virtual void Edit(weld::Window*, const Link<SvBaseLink&,void>& rEndEditHdl);
149 // should the link appear in the dialog? (to the left in the link in the...)
150 bool IsVisible() const { return bVisible; }
151 void SetVisible( bool bFlag ) { bVisible = bFlag; }
152 // should the Link be loaded synchronous or asynchronous?
153 bool IsSynchron() const { return bSynchron; }
154 void SetSynchron( bool bFlag ) { bSynchron = bFlag; }
156 void setStreamToLoadFrom(
157 const css::uno::Reference<css::io::XInputStream>& xInputStream,
158 bool bIsReadOnly )
159 { m_xInputStreamToLoadFrom = xInputStream;
160 m_bIsReadOnly = bIsReadOnly; }
161 // #i88291#
162 void clearStreamToLoadFrom();
164 bool WasLastEditOK() const { return bWasLastEditOK; }
165 FileDialogHelper & GetInsertFileDialog(const OUString& rFactory) const;
170 #endif
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */