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 IDOCUMENTFIELDSACCESS_HXX_INCLUDED
29 #define IDOCUMENTFIELDSACCESS_HXX_INCLUDED
30 
31 #include <sal/types.h>
32 #include <tools/solar.h>
33 
34 class SwFldTypes;
35 class SwFieldType;
36 class SfxPoolItem;
37 struct SwPosition;
38 class SwDocUpdtFld;
39 class SwCalc;
40 class SwTxtFld;
41 class SwField;
42 class SwMsgPoolItem;
43 class DateTime;
44 class _SetGetExpFld;
45 struct SwHash;
46 class String;
47 class SwNode;
48 
49 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
50 
51  /** Document fields related interfaces
52  */
53  class IDocumentFieldsAccess
54  {
55  public:
56     /**
57     */
58     virtual const SwFldTypes *GetFldTypes() const = 0;
59 
60     /**
61     */
62 	virtual SwFieldType *InsertFldType(const SwFieldType &) = 0;
63 
64     /**
65     */
66 	virtual SwFieldType *GetSysFldType( const sal_uInt16 eWhich ) const = 0;
67 
68     /**
69     */
70 	virtual SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName, bool bDbFieldMatching) const = 0;
71 
72     /**
73     */
74 	virtual void RemoveFldType(sal_uInt16 nFld) = 0;
75 
76     /**
77     */
78 	virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB) = 0;
79 
80     /**
81     */
82 	virtual void InsDeletedFldType(SwFieldType &) = 0;
83 
84     // #111840#
85     /**
86        Puts a value into a field at a certain position.
87 
88        A missing field at the given position leads to a failure.
89 
90        @param rPosition        position of the field
91        @param rVal             the value
92        @param nMId
93 
94        @retval sal_True            putting of value was successful
95        @retval sal_False           else
96     */
97     virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich) = 0;
98 
99     // rufe das Update der Expression Felder auf; alle Ausdruecke werden
100     // neu berechnet.
101     // #111840#
102 
103     /** Updates a field.
104 
105         @param rDstFmtFld field to update
106         @param rSrcFld field containing the new values
107         @param pMsgHnt
108         @param bUpdateTblFlds TRUE: update table fields, too.
109 
110         @retval sal_True             update was successful
111         @retval sal_False            else
112     */
113     virtual bool UpdateFld(SwTxtFld * rDstFmtFld, SwField & rSrcFld, SwMsgPoolItem * pMsgHnt, bool bUpdateTblFlds) = 0;
114 
115     /**
116     */
117 	virtual void UpdateRefFlds(SfxPoolItem* pHt) = 0;
118 
119     /**
120     */
121 	virtual void UpdateTblFlds(SfxPoolItem* pHt) = 0;
122 
123     /**
124     */
125 	virtual void UpdateExpFlds(SwTxtFld* pFld, bool bUpdateRefFlds) = 0;
126 
127     /**
128     */
129 	virtual void UpdateUsrFlds() = 0;
130 
131     /**
132     */
133 	virtual void UpdatePageFlds(SfxPoolItem*) = 0;
134 
135     /**
136     */
137 	virtual void LockExpFlds() = 0;
138 
139     /**
140     */
141 	virtual void UnlockExpFlds() = 0;
142 
143     /**
144     */
145 	virtual bool IsExpFldsLocked() const = 0;
146 
147 
148 	virtual SwDocUpdtFld& GetUpdtFlds() const = 0;
149 
150 	/*	@@@MAINTAINABILITY-HORROR@@@
151 		SwNode (see parameter pChk) is (?) part of the private
152 		data structure of SwDoc and should not be exposed
153 	*/
154 	virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0;
155 
156     /**
157     */
158 	virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime) = 0;
159 
160 	// Setze im Calculator alle SetExpresion Felder, die bis zur
161 	// angegebenen Position (Node [ + ::com::sun::star::ucb::Content]) gueltig sind. Es kann
162 	// eine erzeugte Liste aller Felder mit uebergegeben werden.
163 	// (ist die Adresse != 0, und der Pointer == 0 wird eine neue
164 	// Liste returnt.)
165 	virtual void FldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt) = 0;
166 
167     /**
168     */
169 	virtual void FldsToCalc(SwCalc& rCalc, const _SetGetExpFld& rToThisFld) = 0;
170 
171     /**
172     */
173 	virtual void FldsToExpand(SwHash**& ppTbl, sal_uInt16& rTblSize, const _SetGetExpFld& rToThisFld) = 0;
174 
175     /**
176     */
177 	virtual bool IsNewFldLst() const = 0;
178 
179     /**
180     */
181 	virtual void SetNewFldLst( bool bFlag) = 0;
182 
183     /**
184     */
185 	virtual void InsDelFldInFldLst(bool bIns, const SwTxtFld& rFld) = 0;
186 
187 protected:
188     virtual ~IDocumentFieldsAccess() {};
189  };
190 
191  #endif // IDOCUMENTLINKSADMINISTRATION_HXX_INCLUDED
192