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