xref: /trunk/main/sw/inc/IDocumentFieldsAccess.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef IDOCUMENTFIELDSACCESS_HXX_INCLUDED
25 #define IDOCUMENTFIELDSACCESS_HXX_INCLUDED
26 
27 #include <sal/types.h>
28 #include <tools/solar.h>
29 
30 class SwFldTypes;
31 class SwFieldType;
32 class SfxPoolItem;
33 struct SwPosition;
34 class SwDocUpdtFld;
35 class SwCalc;
36 class SwTxtFld;
37 class SwField;
38 class SwMsgPoolItem;
39 class DateTime;
40 class _SetGetExpFld;
41 struct SwHash;
42 class String;
43 class SwNode;
44 
45 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
46 
47  /** Document fields related interfaces
48  */
49  class IDocumentFieldsAccess
50  {
51  public:
52     /**
53     */
54     virtual const SwFldTypes *GetFldTypes() const = 0;
55 
56     /**
57     */
58 	virtual SwFieldType *InsertFldType(const SwFieldType &) = 0;
59 
60     /**
61     */
62 	virtual SwFieldType *GetSysFldType( const sal_uInt16 eWhich ) const = 0;
63 
64     /**
65     */
66 	virtual SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName, bool bDbFieldMatching) const = 0;
67 
68     /**
69     */
70 	virtual void RemoveFldType(sal_uInt16 nFld) = 0;
71 
72     /**
73     */
74 	virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB) = 0;
75 
76     /**
77     */
78 	virtual void InsDeletedFldType(SwFieldType &) = 0;
79 
80     // #111840#
81     /**
82        Puts a value into a field at a certain position.
83 
84        A missing field at the given position leads to a failure.
85 
86        @param rPosition        position of the field
87        @param rVal             the value
88        @param nMId
89 
90        @retval sal_True            putting of value was successful
91        @retval sal_False           else
92     */
93     virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich) = 0;
94 
95     // rufe das Update der Expression Felder auf; alle Ausdruecke werden
96     // neu berechnet.
97     // #111840#
98 
99     /** Updates a field.
100 
101         @param rDstFmtFld field to update
102         @param rSrcFld field containing the new values
103         @param pMsgHnt
104         @param bUpdateTblFlds TRUE: update table fields, too.
105 
106         @retval sal_True             update was successful
107         @retval sal_False            else
108     */
109     virtual bool UpdateFld(SwTxtFld * rDstFmtFld, SwField & rSrcFld, SwMsgPoolItem * pMsgHnt, bool bUpdateTblFlds) = 0;
110 
111     /**
112     */
113 	virtual void UpdateRefFlds(SfxPoolItem* pHt) = 0;
114 
115     /**
116     */
117 	virtual void UpdateTblFlds(SfxPoolItem* pHt) = 0;
118 
119     /**
120     */
121 	virtual void UpdateExpFlds(SwTxtFld* pFld, bool bUpdateRefFlds) = 0;
122 
123     /**
124     */
125 	virtual void UpdateUsrFlds() = 0;
126 
127     /**
128     */
129 	virtual void UpdatePageFlds(SfxPoolItem*) = 0;
130 
131     /**
132     */
133 	virtual void LockExpFlds() = 0;
134 
135     /**
136     */
137 	virtual void UnlockExpFlds() = 0;
138 
139     /**
140     */
141 	virtual bool IsExpFldsLocked() const = 0;
142 
143 
144 	virtual SwDocUpdtFld& GetUpdtFlds() const = 0;
145 
146 	/*	@@@MAINTAINABILITY-HORROR@@@
147 		SwNode (see parameter pChk) is (?) part of the private
148 		data structure of SwDoc and should not be exposed
149 	*/
150 	virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen) = 0;
151 
152     /**
153     */
154 	virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime) = 0;
155 
156 	// Setze im Calculator alle SetExpresion Felder, die bis zur
157 	// angegebenen Position (Node [ + ::com::sun::star::ucb::Content]) gueltig sind. Es kann
158 	// eine erzeugte Liste aller Felder mit uebergegeben werden.
159 	// (ist die Adresse != 0, und der Pointer == 0 wird eine neue
160 	// Liste returnt.)
161 	virtual void FldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt) = 0;
162 
163     /**
164     */
165 	virtual void FldsToCalc(SwCalc& rCalc, const _SetGetExpFld& rToThisFld) = 0;
166 
167     /**
168     */
169 	virtual void FldsToExpand(SwHash**& ppTbl, sal_uInt16& rTblSize, const _SetGetExpFld& rToThisFld) = 0;
170 
171     /**
172     */
173 	virtual bool IsNewFldLst() const = 0;
174 
175     /**
176     */
177 	virtual void SetNewFldLst( bool bFlag) = 0;
178 
179     /**
180     */
181 	virtual void InsDelFldInFldLst(bool bIns, const SwTxtFld& rFld) = 0;
182 
183 protected:
~IDocumentFieldsAccess()184     virtual ~IDocumentFieldsAccess() {};
185  };
186 
187  #endif // IDOCUMENTLINKSADMINISTRATION_HXX_INCLUDED
188