/src/libreoffice/include/sfx2/linksrc.hxx
Line | Count | Source |
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 | | #pragma once |
20 | | |
21 | | #include <sal/config.h> |
22 | | #include <sfx2/dllapi.h> |
23 | | |
24 | | #include <tools/ref.hxx> |
25 | | #include <com/sun/star/uno/Reference.hxx> |
26 | | #include <memory> |
27 | | #include <utility> |
28 | | |
29 | | namespace com::sun::star::uno |
30 | | { |
31 | | class Any; |
32 | | } |
33 | | namespace weld { class Window; } |
34 | | |
35 | | template <typename Arg, typename Ret> class Link; |
36 | | namespace com::sun::star::io { class XInputStream; } |
37 | | |
38 | | #ifndef ADVISEMODE_NODATA |
39 | | // Must be the same value as Ole2 ADVF_* |
40 | 0 | #define ADVISEMODE_NODATA 0x01 |
41 | | #define ADVISEMODE_PRIMEFIRST 0x02 |
42 | 482 | #define ADVISEMODE_ONLYONCE 0x04 |
43 | | #define ADVISEMODE_DATAONSTOP 0x40 |
44 | | #endif |
45 | | |
46 | | namespace sfx2 |
47 | | { |
48 | | |
49 | | class SvBaseLink; |
50 | | struct SvLinkSource_Impl; |
51 | | |
52 | | class SFX2_DLLPUBLIC SvLinkSource : public SvRefBase |
53 | | { |
54 | | private: |
55 | | std::unique_ptr<SvLinkSource_Impl> pImpl; // compatible area |
56 | | |
57 | | public: |
58 | | |
59 | | SvLinkSource(); |
60 | | virtual ~SvLinkSource() override; |
61 | | |
62 | | bool HasDataLinks() const; |
63 | | |
64 | | void Closed(); |
65 | | |
66 | | sal_uInt64 GetUpdateTimeout() const; |
67 | | void SetUpdateTimeout( sal_uInt64 nTimeMs ); |
68 | | // notify the sink, the mime type is not |
69 | | // a selection criterion |
70 | | void DataChanged( const OUString & rMimeType, |
71 | | const css::uno::Any & rVal ); |
72 | | void SendDataChanged(); |
73 | | void NotifyDataChanged(); |
74 | | |
75 | | virtual bool Connect( SvBaseLink* ); |
76 | | virtual bool GetData( css::uno::Any & rData /*out param*/, |
77 | | const OUString & rMimeType, |
78 | | bool bSynchron = false ); |
79 | | |
80 | | // sal_True => waitinmg for data |
81 | | virtual bool IsPending() const; |
82 | | // sal_True => data complete loaded |
83 | | virtual bool IsDataComplete() const; |
84 | | |
85 | | virtual void Edit(weld::Window *, SvBaseLink *, const Link<const OUString&, void>& rEndEditHdl); |
86 | | |
87 | | |
88 | | void AddDataAdvise( SvBaseLink *, const OUString & rMimeType, |
89 | | sal_uInt16 nAdviceMode ); |
90 | | void RemoveAllDataAdvise( SvBaseLink const * ); |
91 | | |
92 | | void AddConnectAdvise( SvBaseLink * ); |
93 | | void RemoveConnectAdvise( SvBaseLink const * ); |
94 | | |
95 | | struct StreamToLoadFrom{ |
96 | | StreamToLoadFrom( |
97 | | css::uno::Reference<css::io::XInputStream> xInputStream, bool bIsReadOnly ) |
98 | 0 | :m_xInputStreamToLoadFrom(std::move(xInputStream)), |
99 | 0 | m_bIsReadOnly(bIsReadOnly) |
100 | 0 | { |
101 | 0 | } |
102 | | |
103 | | css::uno::Reference<css::io::XInputStream> |
104 | | m_xInputStreamToLoadFrom; |
105 | | bool m_bIsReadOnly; |
106 | | }; |
107 | | |
108 | | StreamToLoadFrom getStreamToLoadFrom(); |
109 | | void setStreamToLoadFrom(const css::uno::Reference<css::io::XInputStream>& xInputStream, bool bIsReadOnly ); |
110 | | void clearStreamToLoadFrom(); |
111 | | }; |
112 | | |
113 | | typedef tools::SvRef<SvLinkSource> SvLinkSourceRef; |
114 | | |
115 | | } |
116 | | |
117 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |