xref: /aoo41x/main/sfx2/inc/sfx2/lnkbase.hxx (revision 353d8f4d)
1*353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*353d8f4dSAndrew Rist  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*353d8f4dSAndrew Rist  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19*353d8f4dSAndrew Rist  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir #ifndef _LNKBASE_HXX
24cdf0e10cSrcweir #define _LNKBASE_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir #include "sfx2/dllapi.h"
29cdf0e10cSrcweir #include <sot/exchange.hxx>
30cdf0e10cSrcweir #ifndef _TOOLS_REF_HXX
31cdf0e10cSrcweir #include <tools/ref.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _LINKSOURCE_HXX
34cdf0e10cSrcweir #include <sfx2/linksrc.hxx>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace uno
38cdf0e10cSrcweir {
39cdf0e10cSrcweir 	class Any;
40cdf0e10cSrcweir 	//class Type;
41cdf0e10cSrcweir }}}}
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace sfx2
44cdf0e10cSrcweir {
45cdf0e10cSrcweir 
46cdf0e10cSrcweir struct ImplBaseLinkData;
47cdf0e10cSrcweir class LinkManager;
48cdf0e10cSrcweir class SvLinkSource;
49cdf0e10cSrcweir class FileDialogHelper;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #ifndef OBJECT_DDE_EXTERN
52cdf0e10cSrcweir #define	OBJECT_INTERN		0x00
53cdf0e10cSrcweir //#define	OBJECT_SO_EXTERN	0x01
54cdf0e10cSrcweir #define	OBJECT_DDE_EXTERN	0x02
55cdf0e10cSrcweir #endif
56cdf0e10cSrcweir 
57cdf0e10cSrcweir #define	OBJECT_CLIENT_SO			0x80 // ein Link
58cdf0e10cSrcweir #define	OBJECT_CLIENT_DDE			0x81
59cdf0e10cSrcweir //#define	OBJECT_CLIENT_OLE			0x82 // ein Ole-Link
60cdf0e10cSrcweir //#define	OBJECT_CLIENT_OLE_CACHE  	0x83 // ein Ole-Link mit SvEmbeddedObject
61cdf0e10cSrcweir #define	OBJECT_CLIENT_FILE			0x90
62cdf0e10cSrcweir #define	OBJECT_CLIENT_GRF			0x91
63cdf0e10cSrcweir #define	OBJECT_CLIENT_OLE			0x92 // embedded link
64cdf0e10cSrcweir 
65cdf0e10cSrcweir enum sfxlink {
66cdf0e10cSrcweir 	// Ole2 compatibel und persistent
67cdf0e10cSrcweir 	LINKUPDATE_ALWAYS = 1,
68cdf0e10cSrcweir 	LINKUPDATE_ONCALL = 3,
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	LINKUPDATE_END		// dummy!
71cdf0e10cSrcweir };
72cdf0e10cSrcweir 
73cdf0e10cSrcweir struct BaseLink_Impl;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir class SFX2_DLLPUBLIC SvBaseLink : public SvRefBase
76cdf0e10cSrcweir {
77cdf0e10cSrcweir private:
78cdf0e10cSrcweir 	friend class LinkManager;
79cdf0e10cSrcweir 	friend class SvLinkSource;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	SvLinkSourceRef			xObj;
82cdf0e10cSrcweir 	String					aLinkName;
83cdf0e10cSrcweir     BaseLink_Impl*          pImpl;
84cdf0e10cSrcweir 	sal_uInt16 					nObjType;
85cdf0e10cSrcweir 	sal_Bool					bVisible : 1;
86cdf0e10cSrcweir 	sal_Bool					bSynchron : 1;
87cdf0e10cSrcweir 	sal_Bool					bUseCache : 1;		// fuer GrafikLinks!
88cdf0e10cSrcweir     sal_Bool                    bWasLastEditOK : 1;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     DECL_LINK( EndEditHdl, String* );
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     bool                    ExecuteEdit( const String& _rNewName );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir protected:
95cdf0e10cSrcweir 	void			SetObjType( sal_uInt16 );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 					// setzen des LinkSourceName ohne aktion
98cdf0e10cSrcweir 	void			SetName( const String & rLn );
99cdf0e10cSrcweir 					// LinkSourceName der im SvLinkBase steht
100cdf0e10cSrcweir 	String		 	GetName() const;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	ImplBaseLinkData* pImplData;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     sal_Bool            m_bIsReadOnly;
105cdf0e10cSrcweir     com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
106cdf0e10cSrcweir                         m_xInputStreamToLoadFrom;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 					SvBaseLink();
109cdf0e10cSrcweir                     SvBaseLink( sal_uInt16 nLinkType, sal_uIntPtr nContentType = FORMAT_STRING );
110cdf0e10cSrcweir 	virtual 		~SvBaseLink();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     void            _GetRealObject( sal_Bool bConnect = sal_True );
113cdf0e10cSrcweir 
GetRealObject()114cdf0e10cSrcweir     SvLinkSource*   GetRealObject()
115cdf0e10cSrcweir 					{
116cdf0e10cSrcweir 						if( !xObj.Is() )
117cdf0e10cSrcweir                             _GetRealObject();
118cdf0e10cSrcweir 						return xObj;
119cdf0e10cSrcweir 					}
120cdf0e10cSrcweir 
121cdf0e10cSrcweir public:
122cdf0e10cSrcweir 					TYPEINFO();
123cdf0e10cSrcweir 					// ask JP
124cdf0e10cSrcweir 	virtual void    Closed();
125cdf0e10cSrcweir                     SvBaseLink( const String& rNm, sal_uInt16 nObjectType,
126cdf0e10cSrcweir                                  SvLinkSource* );
127cdf0e10cSrcweir 
GetObjType() const128cdf0e10cSrcweir 	sal_uInt16			GetObjType() const { return nObjType; }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 	void			SetObj( SvLinkSource * pObj );
GetObj() const131cdf0e10cSrcweir 	SvLinkSource*	GetObj() const	{ return xObj; }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	void    		SetLinkSourceName( const String & rName );
134cdf0e10cSrcweir 	String		 	GetLinkSourceName() const;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	virtual void 	DataChanged( const String & rMimeType,
137cdf0e10cSrcweir 								const ::com::sun::star::uno::Any & rValue );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	void			SetUpdateMode( sal_uInt16 );
140cdf0e10cSrcweir 	sal_uInt16 			GetUpdateMode() const;
141cdf0e10cSrcweir 	sal_uIntPtr  			GetContentType() const;
142cdf0e10cSrcweir 	sal_Bool 			SetContentType( sal_uIntPtr nType );
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     LinkManager*          GetLinkManager();
145cdf0e10cSrcweir     const LinkManager*    GetLinkManager() const;
146cdf0e10cSrcweir     void                    SetLinkManager( LinkManager* _pMgr );
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	sal_Bool			Update();
149cdf0e10cSrcweir 	void			Disconnect();
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     // Link impl: DECL_LINK( MyEndDialogHdl, SvBaseLink* ); <= param is this
152cdf0e10cSrcweir     virtual void    Edit( Window*, const Link& rEndEditHdl );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 		// soll der Link im Dialog angezeigt werden ? (Links im Link im ...)
IsVisible() const155cdf0e10cSrcweir 	sal_Bool 	        IsVisible() const   		{ return bVisible; }
SetVisible(sal_Bool bFlag)156cdf0e10cSrcweir 	void 	        SetVisible( sal_Bool bFlag )	{ bVisible = bFlag; }
157cdf0e10cSrcweir 		// soll der Link synchron oder asynchron geladen werden?
IsSynchron() const158cdf0e10cSrcweir 	sal_Bool 	        IsSynchron() const   		{ return bSynchron; }
SetSynchron(sal_Bool bFlag)159cdf0e10cSrcweir 	void 	        SetSynchron( sal_Bool bFlag )	{ bSynchron = bFlag; }
160cdf0e10cSrcweir 
IsUseCache() const161cdf0e10cSrcweir 	sal_Bool 	        IsUseCache() const   		{ return bUseCache; }
SetUseCache(sal_Bool bFlag)162cdf0e10cSrcweir 	void 			SetUseCache( sal_Bool bFlag )	{ bUseCache = bFlag; }
163cdf0e10cSrcweir 
setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream> & xInputStream,sal_Bool bIsReadOnly)164cdf0e10cSrcweir     void            setStreamToLoadFrom(
165cdf0e10cSrcweir                         const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,
166cdf0e10cSrcweir                         sal_Bool bIsReadOnly )
167cdf0e10cSrcweir                             { m_xInputStreamToLoadFrom = xInputStream;
168cdf0e10cSrcweir                               m_bIsReadOnly = bIsReadOnly; }
169cdf0e10cSrcweir     // --> OD 2008-06-18 #i88291#
170cdf0e10cSrcweir     void            clearStreamToLoadFrom();
171cdf0e10cSrcweir     // <--
172cdf0e10cSrcweir 
WasLastEditOK() const173cdf0e10cSrcweir     inline sal_Bool         WasLastEditOK() const       { return bWasLastEditOK; }
174cdf0e10cSrcweir     FileDialogHelper*   GetFileDialog( sal_uInt32 nFlags, const String& rFactory ) const;
175cdf0e10cSrcweir };
176cdf0e10cSrcweir 
177cdf0e10cSrcweir SV_DECL_IMPL_REF(SvBaseLink);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir #endif
182