Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SW_DDEFLD_HXX
29 : : #define SW_DDEFLD_HXX
30 : :
31 : : #include <sfx2/lnkbase.hxx>
32 : : #include "swdllapi.h"
33 : : #include "fldbas.hxx"
34 : :
35 : : class SwDoc;
36 : :
37 : : /*--------------------------------------------------------------------
38 : : FieldType for DDE
39 : : --------------------------------------------------------------------*/
40 : :
41 : : class SW_DLLPUBLIC SwDDEFieldType : public SwFieldType
42 : : {
43 : : rtl::OUString aName;
44 : : String aExpansion;
45 : :
46 : : ::sfx2::SvBaseLinkRef refLink;
47 : : SwDoc* pDoc;
48 : :
49 : : sal_uInt16 nRefCnt;
50 : : sal_Bool bCRLFFlag : 1;
51 : : sal_Bool bDeleted : 1;
52 : :
53 : : SW_DLLPRIVATE void _RefCntChgd();
54 : :
55 : : public:
56 : : SwDDEFieldType( const String& rName, const String& rCmd,
57 : : sal_uInt16 = sfx2::LINKUPDATE_ONCALL );
58 : : ~SwDDEFieldType();
59 : :
60 : 0 : const String& GetExpansion() const { return aExpansion; }
61 : 0 : void SetExpansion( const String& rStr ) { aExpansion = rStr,
62 : 0 : bCRLFFlag = sal_False; }
63 : :
64 : : virtual SwFieldType* Copy() const;
65 : : virtual const rtl::OUString& GetName() const;
66 : :
67 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
68 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
69 : :
70 : : String GetCmd() const;
71 : : void SetCmd( const String& rStr );
72 : :
73 : 0 : sal_uInt16 GetType() const { return refLink->GetUpdateMode(); }
74 : 0 : void SetType( sal_uInt16 nType ) { refLink->SetUpdateMode( nType ); }
75 : :
76 : 0 : sal_Bool IsDeleted() const { return bDeleted; }
77 : 0 : void SetDeleted( sal_Bool b ) { bDeleted = b; }
78 : :
79 : 0 : void UpdateNow() { refLink->Update(); }
80 : 0 : void Disconnect() { refLink->Disconnect(); }
81 : :
82 : : const ::sfx2::SvBaseLink& GetBaseLink() const { return *refLink; }
83 : 0 : ::sfx2::SvBaseLink& GetBaseLink() { return *refLink; }
84 : :
85 : : const SwDoc* GetDoc() const { return pDoc; }
86 : 0 : SwDoc* GetDoc() { return pDoc; }
87 : : void SetDoc( SwDoc* pDoc );
88 : :
89 [ # # ][ # # ]: 0 : void IncRefCnt() { if( !nRefCnt++ && pDoc ) _RefCntChgd(); }
[ # # ]
90 [ # # ][ # # ]: 0 : void DecRefCnt() { if( !--nRefCnt && pDoc ) _RefCntChgd(); }
[ # # ]
91 : :
92 : 0 : void SetCRLFDelFlag( sal_Bool bFlag = sal_True ) { bCRLFFlag = bFlag; }
93 : : };
94 : :
95 : : /*--------------------------------------------------------------------
96 : : DDE-field
97 : : --------------------------------------------------------------------*/
98 : :
99 : : class SwDDEField : public SwField
100 : : {
101 : : private:
102 : : virtual String Expand() const;
103 : : virtual SwField* Copy() const;
104 : :
105 : : public:
106 : : SwDDEField(SwDDEFieldType*);
107 : : ~SwDDEField();
108 : :
109 : : /** Get parameter via types.
110 : : Name cannot be changed. */
111 : : virtual const rtl::OUString& GetPar1() const;
112 : :
113 : : // Command
114 : : virtual rtl::OUString GetPar2() const;
115 : : virtual void SetPar2(const rtl::OUString& rStr);
116 : : };
117 : :
118 : :
119 : : #endif // SW_DDEFLD_HXX
120 : :
121 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|