LibreOffice Module sfx2 (master) 1
lnkbase.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <rtl/ustring.hxx>
23#include <sal/config.h>
24#include <sfx2/dllapi.h>
25#include <sfx2/linksrc.hxx>
26#include <sot/formats.hxx>
27#include <tools/ref.hxx>
28#include <tools/link.hxx>
29#include <memory>
30
31namespace com::sun::star::uno
32{
33 class Any;
34}
35
36namespace com::sun::star::io { class XInputStream; }
37
39 NONE = 0,
40 // Ole2 compatible and persistent
41 ALWAYS = 1,
42 ONCALL = 3
43};
44
45namespace sfx2
46{
47
48struct ImplBaseLinkData;
49class LinkManager;
50class FileDialogHelper;
51
53 Internal = 0x00,
54 DdeExternal = 0x02,
55 ClientSo = 0x80, // a Link
56 ClientDde = 0x81,
57 ClientFile = 0x90,
58 ClientGraphic = 0x91,
59 ClientOle = 0x92 // embedded link
60};
61
63{
64 return static_cast<int>(t) & static_cast<int>(SvBaseLinkObjectType::ClientSo);
65}
67{
68 auto check = static_cast<int>(SvBaseLinkObjectType::ClientFile);
69 return (static_cast<int>(t) & check) == check;
70}
71
73{
74private:
75 friend class LinkManager;
76 friend class SvLinkSource;
77
81 std::unique_ptr<FileDialogHelper>
84 OUString aLinkName;
85 std::unique_ptr<ImplBaseLinkData> pImplData;
87 bool bVisible : 1;
88 bool bSynchron : 1;
90 bool m_bIsConnect : 1;
92 css::uno::Reference<css::io::XInputStream>
94
95 DECL_DLLPRIVATE_LINK( EndEditHdl, const OUString&, void );
96
97 bool ExecuteEdit( const OUString& _rNewName );
98
99protected:
100 void SetObjType( SvBaseLinkObjectType );
101
102 // Set LinkSourceName without action
103 void SetName( const OUString & rLn );
104
105 SvBaseLink();
106 SvBaseLink( SfxLinkUpdateMode nLinkType, SotClipboardFormatId nContentType );
107 virtual ~SvBaseLink() override;
108
109 void GetRealObject_( bool bConnect = true );
110
112 {
113 if( !xObj.is() )
114 GetRealObject_();
115 return xObj.get();
116 }
117
118public:
119
120 virtual void Closed();
121
122#if defined(_WIN32)
123 SvBaseLink( const OUString& rNm, SvBaseLinkObjectType nObjectType,
124 SvLinkSource* );
125#endif
126
127 SvBaseLinkObjectType GetObjType() const { return mnObjType; }
128
129 void SetObj( SvLinkSource * pObj );
130 SvLinkSource* GetObj() const { return xObj.get(); }
131
132 void SetLinkSourceName( const OUString & rName );
133 const OUString& GetLinkSourceName() const { return aLinkName;}
134
137 ERROR_GENERAL = 1
138 };
139
140 virtual UpdateResult DataChanged(
141 const OUString & rMimeType, const css::uno::Any & rValue );
142
143 void SetUpdateMode( SfxLinkUpdateMode );
144 SfxLinkUpdateMode GetUpdateMode() const;
145 SotClipboardFormatId GetContentType() const;
146 void SetContentType( SotClipboardFormatId nType );
147
148 LinkManager* GetLinkManager();
149 const LinkManager* GetLinkManager() const;
150 void SetLinkManager( LinkManager* _pMgr );
151
152 bool Update();
153 void Disconnect();
154
155 virtual void Edit(weld::Window*, const Link<SvBaseLink&,void>& rEndEditHdl);
156
157 // should the link appear in the dialog? (to the left in the link in the...)
158 bool IsVisible() const { return bVisible; }
159 void SetVisible( bool bFlag ) { bVisible = bFlag; }
160 // should the Link be loaded synchronous or asynchronous?
161 bool IsSynchron() const { return bSynchron; }
162 void SetSynchron( bool bFlag ) { bSynchron = bFlag; }
163
165 const css::uno::Reference<css::io::XInputStream>& xInputStream,
166 bool bIsReadOnly )
167 { m_xInputStreamToLoadFrom = xInputStream;
168 m_bIsReadOnly = bIsReadOnly; }
169 // #i88291#
170 void clearStreamToLoadFrom();
171
172 bool WasLastEditOK() const { return bWasLastEditOK; }
173 FileDialogHelper & GetInsertFileDialog(const OUString& rFactory);
174};
175
176}
177
178/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
T * get() const
bool is() const
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
SotClipboardFormatId
SfxLinkUpdateMode
Definition: lnkbase.hxx:38
NONE
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > check(dp_misc::DescriptionInfoset const &infoset)
SvBaseLinkObjectType
Definition: lnkbase.hxx:52
constexpr bool isClientFileType(SvBaseLinkObjectType t)
Definition: lnkbase.hxx:66
constexpr bool isClientType(SvBaseLinkObjectType t)
Definition: lnkbase.hxx:62
bool bVisible