1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _LINKSRC_HXX 24 #define _LINKSRC_HXX 25 26 #include "sal/config.h" 27 #include "sfx2/dllapi.h" 28 29 #ifndef _TOOLS_REF_HXX 30 #include <tools/ref.hxx> 31 #endif 32 #include <tools/rtti.hxx> 33 #include <com/sun/star/io/XInputStream.hpp> 34 35 #ifndef _SAL_CONFIG_H 36 #include <sal/config.h> 37 #define _SAL_CONFIG_H 38 #endif 39 40 namespace com { namespace sun { namespace star { namespace uno 41 { 42 class Any; 43 //class Type; 44 }}}} 45 class Window; 46 class String; 47 48 #ifndef ADVISEMODE_NODATA 49 // Muessen die gleichen Werte wie Ole2 ADVF_* sein 50 #define ADVISEMODE_NODATA 0x01 51 //#define ADVISEMODE_PRIMEFIRST 0x02 52 #define ADVISEMODE_ONLYONCE 0x04 53 //#define ADVISEMODE_DATAONSTOP 0x40 54 #endif 55 56 namespace sfx2 57 { 58 59 class SvBaseLink; 60 struct SvLinkSource_Impl; 61 62 class SFX2_DLLPUBLIC SvLinkSource : public SvRefBase 63 { 64 private: 65 SvLinkSource_Impl* pImpl; // compatible area 66 67 public: 68 TYPEINFO(); 69 70 SvLinkSource(); 71 virtual ~SvLinkSource(); 72 73 // SvBaseLink* GetDataBaseLink() const; 74 sal_Bool HasDataLinks( const SvBaseLink* = 0 ) const; 75 76 void Closed(); 77 78 sal_uIntPtr GetUpdateTimeout() const; 79 void SetUpdateTimeout( sal_uIntPtr nTime ); 80 // notify the sink, the mime type is not 81 // a selection criterion 82 void DataChanged( const String & rMimeType, 83 const ::com::sun::star::uno::Any & rVal ); 84 void SendDataChanged(); 85 void NotifyDataChanged(); 86 87 virtual sal_Bool Connect( SvBaseLink* ); 88 virtual sal_Bool GetData( ::com::sun::star::uno::Any & rData /*out param*/, 89 const String & rMimeType, 90 sal_Bool bSynchron = sal_False ); 91 92 // sal_True => waitinmg for data 93 virtual sal_Bool IsPending() const; 94 // sal_True => data complete loaded 95 virtual sal_Bool IsDataComplete() const; 96 97 // Link impl: DECL_LINK( MyEndEditHdl, sfx2::FileDialogHelper* ); <= param is the dialog 98 virtual void Edit( Window *, SvBaseLink *, const Link& rEndEditHdl ); 99 100 101 void AddDataAdvise( SvBaseLink *, const String & rMimeType, 102 sal_uInt16 nAdviceMode ); 103 void RemoveAllDataAdvise( SvBaseLink * ); 104 105 void AddConnectAdvise( SvBaseLink * ); 106 void RemoveConnectAdvise( SvBaseLink * ); 107 108 struct StreamToLoadFrom{ StreamToLoadFromsfx2::SvLinkSource::StreamToLoadFrom109 StreamToLoadFrom( 110 const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly ) 111 :m_xInputStreamToLoadFrom(xInputStream), 112 m_bIsReadOnly(bIsReadOnly) 113 { 114 } 115 116 com::sun::star::uno::Reference<com::sun::star::io::XInputStream> 117 m_xInputStreamToLoadFrom; 118 sal_Bool m_bIsReadOnly; 119 }; 120 121 StreamToLoadFrom getStreamToLoadFrom(); 122 void setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly ); 123 // --> OD 2008-06-18 #i88291# 124 void clearStreamToLoadFrom(); 125 // <-- 126 }; 127 128 SV_DECL_IMPL_REF(SvLinkSource); 129 130 } 131 #endif 132