xref: /aoo42x/main/sw/inc/ddefld.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef SW_DDEFLD_HXX
24cdf0e10cSrcweir #define SW_DDEFLD_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <sfx2/lnkbase.hxx>
27cdf0e10cSrcweir #include "swdllapi.h"
28cdf0e10cSrcweir #include "fldbas.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class SwDoc;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir /*--------------------------------------------------------------------
33cdf0e10cSrcweir 	Beschreibung: FieldType fuer DDE
34cdf0e10cSrcweir  --------------------------------------------------------------------*/
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	String aName;
39cdf0e10cSrcweir 	String aExpansion;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir     ::sfx2::SvBaseLinkRef refLink;
42cdf0e10cSrcweir 	SwDoc* pDoc;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 	sal_uInt16 nRefCnt;
45cdf0e10cSrcweir 	sal_Bool bCRLFFlag : 1;
46cdf0e10cSrcweir 	sal_Bool bDeleted : 1;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	SW_DLLPRIVATE void _RefCntChgd();
49cdf0e10cSrcweir 
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir 	SwDDEFieldType( const String& rName, const String& rCmd,
52cdf0e10cSrcweir                     sal_uInt16 = sfx2::LINKUPDATE_ONCALL );
53cdf0e10cSrcweir 	~SwDDEFieldType();
54cdf0e10cSrcweir 
GetExpansion() const55cdf0e10cSrcweir 	const String& GetExpansion() const			{ return aExpansion; }
SetExpansion(const String & rStr)56cdf0e10cSrcweir 	void SetExpansion( const String& rStr )		{ aExpansion = rStr,
57cdf0e10cSrcweir 												  bCRLFFlag = sal_False; }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	virtual SwFieldType* Copy() const;
60cdf0e10cSrcweir 	virtual const String& GetName() const;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     virtual sal_Bool        QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
63cdf0e10cSrcweir     virtual sal_Bool        PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	String GetCmd() const;
66cdf0e10cSrcweir 	void SetCmd( const String& rStr );
67cdf0e10cSrcweir 
GetType() const68cdf0e10cSrcweir 	sal_uInt16 GetType() const 			{ return refLink->GetUpdateMode();	}
SetType(sal_uInt16 nType)69cdf0e10cSrcweir 	void SetType( sal_uInt16 nType )	{ refLink->SetUpdateMode( nType );	}
70cdf0e10cSrcweir 
IsDeleted() const71cdf0e10cSrcweir 	sal_Bool IsDeleted() const 			{ return bDeleted; }
SetDeleted(sal_Bool b)72cdf0e10cSrcweir 	void SetDeleted( sal_Bool b )		{ bDeleted = b; }
73cdf0e10cSrcweir 
UpdateNow()74cdf0e10cSrcweir     void UpdateNow()                { refLink->Update(); }
Disconnect()75cdf0e10cSrcweir 	void Disconnect()				{ refLink->Disconnect(); }
76cdf0e10cSrcweir 
GetBaseLink() const77cdf0e10cSrcweir     const ::sfx2::SvBaseLink& GetBaseLink() const    { return *refLink; }
GetBaseLink()78cdf0e10cSrcweir           ::sfx2::SvBaseLink& GetBaseLink()          { return *refLink; }
79cdf0e10cSrcweir 
GetDoc() const80cdf0e10cSrcweir 	const SwDoc* GetDoc() const 	{ return pDoc; }
GetDoc()81cdf0e10cSrcweir 		  SwDoc* GetDoc() 			{ return pDoc; }
82cdf0e10cSrcweir 	void SetDoc( SwDoc* pDoc );
83cdf0e10cSrcweir 
IncRefCnt()84cdf0e10cSrcweir 	void IncRefCnt() {	if( !nRefCnt++ && pDoc ) _RefCntChgd();	}
DecRefCnt()85cdf0e10cSrcweir 	void DecRefCnt() {	if( !--nRefCnt && pDoc ) _RefCntChgd(); }
86cdf0e10cSrcweir 
SetCRLFDelFlag(sal_Bool bFlag=sal_True)87cdf0e10cSrcweir 	void SetCRLFDelFlag( sal_Bool bFlag = sal_True )	{ bCRLFFlag = bFlag; }
88cdf0e10cSrcweir };
89cdf0e10cSrcweir 
90cdf0e10cSrcweir /*--------------------------------------------------------------------
91cdf0e10cSrcweir 	Beschreibung: DDE-Feld
92cdf0e10cSrcweir  --------------------------------------------------------------------*/
93cdf0e10cSrcweir 
94cdf0e10cSrcweir class SwDDEField : public SwField
95cdf0e10cSrcweir {
96cdf0e10cSrcweir private:
97cdf0e10cSrcweir     virtual String   Expand() const;
98cdf0e10cSrcweir     virtual SwField* Copy() const;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir public:
101cdf0e10cSrcweir 	SwDDEField(SwDDEFieldType*);
102cdf0e10cSrcweir 	~SwDDEField();
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	// ueber Typen Parameter ermitteln
105cdf0e10cSrcweir 	// Name kann nicht geaendert werden
106cdf0e10cSrcweir 	virtual const String& GetPar1() const;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	// Commando
109cdf0e10cSrcweir 	virtual String	GetPar2() const;
110cdf0e10cSrcweir 	virtual void	SetPar2(const String& rStr);
111cdf0e10cSrcweir };
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir #endif // SW_DDEFLD_HXX
115