xref: /aoo41x/main/sc/source/core/inc/ddelink.hxx (revision 38d50f7b)
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 
24 #ifndef SC_DDELINK_HXX
25 #define SC_DDELINK_HXX
26 
27 #include "address.hxx"
28 #include <sfx2/lnkbase.hxx>
29 #include <svl/broadcast.hxx>
30 #include "scmatrix.hxx"
31 
32 class ScDocument;
33 class ScMultipleReadHeader;
34 class ScMultipleWriteHeader;
35 class SvStream;
36 
37 class ScDdeLink : public ::sfx2::SvBaseLink, public SvtBroadcaster
38 {
39 private:
40 static sal_Bool	bIsInUpdate;
41 
42 	ScDocument*		pDoc;
43 
44 	String			aAppl;			// Verbindungsdaten
45 	String			aTopic;
46 	String			aItem;
47 	sal_uInt8			nMode;			// Zahlformat-Modus
48 
49 	sal_Bool			bNeedUpdate;	// wird gesetzt, wenn Update nicht moeglich war
50 
51 	ScMatrixRef		pResult;		// Ergebnis
52 
53 public:
54 	TYPEINFO();
55 
56 			ScDdeLink( ScDocument* pD,
57 						const String& rA, const String& rT, const String& rI,
58 						sal_uInt8 nM );
59 			ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& rHdr );
60 			ScDdeLink( ScDocument* pD, const ScDdeLink& rOther );
61 	virtual ~ScDdeLink();
62 
63 	void			Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
64 
65 											// von SvBaseLink ueberladen:
66 	virtual void	DataChanged( const String& rMimeType,
67 								const ::com::sun::star::uno::Any & rValue );
68 
69 											// von SvtBroadcaster ueberladen:
70 	virtual void	ListenersGone();
71 
72 											// fuer Interpreter:
73 
GetResult() const74     const ScMatrix* GetResult() const           { return pResult; }
SetResult(ScMatrix * pRes)75     void            SetResult( ScMatrix* pRes ) { pResult = pRes; }
76 
77                                             // XML and Excel import after NewData()
GetModifiableResult()78     ScMatrixRef     GetModifiableResult()   { return pResult; }
79 
GetAppl() const80 	const String&	GetAppl() const		{ return aAppl; }
GetTopic() const81 	const String&	GetTopic() const	{ return aTopic; }
GetItem() const82 	const String&	GetItem() const		{ return aItem; }
GetMode() const83 	sal_uInt8			GetMode() const		{ return nMode; }
84 
85 	void			ResetValue();			// Wert zuruecksetzen
86 	void			TryUpdate();
87 
NeedsUpdate() const88 	sal_Bool			NeedsUpdate() const { return bNeedUpdate; }
89 
IsInUpdate()90 	static sal_Bool		IsInUpdate()		{ return bIsInUpdate; }
91 };
92 
93 
94 #endif
95 
96