xref: /aoo41x/main/sc/source/core/inc/ddelink.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_DDELINK_HXX
29 #define SC_DDELINK_HXX
30 
31 #include "address.hxx"
32 #include <sfx2/lnkbase.hxx>
33 #include <svl/broadcast.hxx>
34 #include "scmatrix.hxx"
35 
36 class ScDocument;
37 class ScMultipleReadHeader;
38 class ScMultipleWriteHeader;
39 class SvStream;
40 
41 class ScDdeLink : public ::sfx2::SvBaseLink, public SvtBroadcaster
42 {
43 private:
44 static sal_Bool	bIsInUpdate;
45 
46 	ScDocument*		pDoc;
47 
48 	String			aAppl;			// Verbindungsdaten
49 	String			aTopic;
50 	String			aItem;
51 	sal_uInt8			nMode;			// Zahlformat-Modus
52 
53 	sal_Bool			bNeedUpdate;	// wird gesetzt, wenn Update nicht moeglich war
54 
55 	ScMatrixRef		pResult;		// Ergebnis
56 
57 public:
58 	TYPEINFO();
59 
60 			ScDdeLink( ScDocument* pD,
61 						const String& rA, const String& rT, const String& rI,
62 						sal_uInt8 nM );
63 			ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& rHdr );
64 			ScDdeLink( ScDocument* pD, const ScDdeLink& rOther );
65 	virtual ~ScDdeLink();
66 
67 	void			Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
68 
69 											// von SvBaseLink ueberladen:
70 	virtual void	DataChanged( const String& rMimeType,
71 								const ::com::sun::star::uno::Any & rValue );
72 
73 											// von SvtBroadcaster ueberladen:
74 	virtual void	ListenersGone();
75 
76 											// fuer Interpreter:
77 
78     const ScMatrix* GetResult() const           { return pResult; }
79     void            SetResult( ScMatrix* pRes ) { pResult = pRes; }
80 
81                                             // XML and Excel import after NewData()
82     ScMatrixRef     GetModifiableResult()   { return pResult; }
83 
84 	const String&	GetAppl() const		{ return aAppl; }
85 	const String&	GetTopic() const	{ return aTopic; }
86 	const String&	GetItem() const		{ return aItem; }
87 	sal_uInt8			GetMode() const		{ return nMode; }
88 
89 	void			ResetValue();			// Wert zuruecksetzen
90 	void			TryUpdate();
91 
92 	sal_Bool			NeedsUpdate() const { return bNeedUpdate; }
93 
94 	static sal_Bool		IsInUpdate()		{ return bIsInUpdate; }
95 };
96 
97 
98 #endif
99 
100