update dev300-m58
[ooovba.git] / sw / inc / ddefld.hxx
blob95606216b179a2db4d16e00ab038feaccf2dabbb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ddefld.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _DDEFLD_HXX
31 #define _DDEFLD_HXX
33 #include <sfx2/lnkbase.hxx>
34 #include "swdllapi.h"
35 #include "fldbas.hxx"
37 class SwDoc;
39 /*--------------------------------------------------------------------
40 Beschreibung: FieldType fuer DDE
41 --------------------------------------------------------------------*/
43 class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType
45 String aName;
46 String aExpansion;
48 ::sfx2::SvBaseLinkRef refLink;
49 SwDoc* pDoc;
51 USHORT nRefCnt;
52 BOOL bCRLFFlag : 1;
53 BOOL bDeleted : 1;
55 SW_DLLPRIVATE void _RefCntChgd();
57 public:
58 SwDDEFieldType( const String& rName, const String& rCmd,
59 USHORT = sfx2::LINKUPDATE_ONCALL );
60 ~SwDDEFieldType();
62 const String& GetExpansion() const { return aExpansion; }
63 void SetExpansion( const String& rStr ) { aExpansion = rStr,
64 bCRLFFlag = FALSE; }
66 virtual SwFieldType* Copy() const;
67 virtual const String& GetName() const;
69 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nWhich ) const;
70 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhich );
72 String GetCmd() const;
73 void SetCmd( const String& rStr );
75 USHORT GetType() const { return refLink->GetUpdateMode(); }
76 void SetType( USHORT nType ) { refLink->SetUpdateMode( nType ); }
78 BOOL IsDeleted() const { return bDeleted; }
79 void SetDeleted( BOOL b ) { bDeleted = b; }
81 void UpdateNow() { refLink->Update(); }
82 void Disconnect() { refLink->Disconnect(); }
84 const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; }
85 ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; }
87 const SwDoc* GetDoc() const { return pDoc; }
88 SwDoc* GetDoc() { return pDoc; }
89 void SetDoc( SwDoc* pDoc );
91 void IncRefCnt() { if( !nRefCnt++ && pDoc ) _RefCntChgd(); }
92 void DecRefCnt() { if( !--nRefCnt && pDoc ) _RefCntChgd(); }
94 void SetCRLFDelFlag( BOOL bFlag = TRUE ) { bCRLFFlag = bFlag; }
97 /*--------------------------------------------------------------------
98 Beschreibung: DDE-Feld
99 --------------------------------------------------------------------*/
101 class SwDDEField : public SwField
103 public:
104 SwDDEField(SwDDEFieldType*);
105 ~SwDDEField();
107 virtual String Expand() const;
108 virtual SwField* Copy() const;
110 // ueber Typen Parameter ermitteln
111 // Name kann nicht geaendert werden
112 virtual const String& GetPar1() const;
114 // Commando
115 virtual String GetPar2() const;
116 virtual void SetPar2(const String& rStr);
120 #endif // _DDEFLD_HXX