Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sw / expfld.hxx
blobbe06da157785d8932f00b08dbc7bce2533209aa9
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: expfld.hxx,v $
10 * $Revision: 1.8 $
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 _EXPFLD_HXX
31 #define _EXPFLD_HXX
33 #ifndef _SVARRAY_HXX //autogen
34 #include <bf_svtools/svarray.hxx>
35 #endif
37 #ifndef _FLDBAS_HXX
38 #include <fldbas.hxx>
39 #endif
40 #ifndef _CELLFML_HXX
41 #include <cellfml.hxx>
42 #endif
43 namespace binfilter {
45 class SfxPoolItem;
46 class SwTxtNode;
47 class SwCalc;
48 class SwFrm;
49 struct SwPosition;
50 class SwTxtFld;
51 class SwTableSortBoxes;
52 class SwDoc;
53 class SwTable;
54 class SwFmtFld;
56 // Vorwaertsdeklaration: besorge den "Body-TextNode", fuer Exp.Fld in Fly's
57 // Header/Footers/Footnodes
58 const SwTxtNode* GetBodyTxtNode( const SwDoc& pDoc, SwPosition& rPos,
59 const SwFrm& rFrm );
60 // Wandlung Address -> Adressen
61 void ReplacePoint(String& sTmpName, BOOL bWithCommandType = FALSE);
63 struct _SeqFldLstElem
65 String sDlgEntry;
66 USHORT nSeqNo;
68 _SeqFldLstElem( const String& rStr, USHORT nNo )
69 : sDlgEntry( rStr ), nSeqNo( nNo )
72 SV_DECL_PTRARR_DEL( _SwSeqFldList, _SeqFldLstElem*, 10, 10 )
74 class SwSeqFldList : public _SwSeqFldList
76 public:
77 SwSeqFldList() : _SwSeqFldList( 10, 10 ) {}
79 BOOL InsertSort( _SeqFldLstElem* );
80 BOOL SeekEntry( const _SeqFldLstElem& , USHORT* pPos = 0 );
83 /*--------------------------------------------------------------------
84 Beschreibung: Ausdruck
85 --------------------------------------------------------------------*/
87 class SwGetExpFieldType : public SwValueFieldType
89 public:
90 SwGetExpFieldType(SwDoc* pDoc);
91 virtual SwFieldType* Copy() const;
93 // ueberlagert, weil das Get-Field nicht veraendert werden kann
94 // und dann auch nicht aktualisiert werden muss. Aktualisierung
95 // erfolgt beim Aendern von Set-Werten !
97 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
100 /*--------------------------------------------------------------------
101 Beschreibung: GetExperession
102 --------------------------------------------------------------------*/
104 class SwGetExpField : public SwFormulaField
106 String sExpand;
107 BOOL bIsInBodyTxt;
108 USHORT nSubType;
110 public:
111 SwGetExpField( SwGetExpFieldType*, const String& rFormel,
112 USHORT nSubType = GSE_EXPR, ULONG nFmt = 0);
114 virtual void SetValue( const double& rVal );
115 virtual void SetLanguage(USHORT nLng);
117 virtual String Expand() const;
118 virtual SwField* Copy() const;
120 inline const String& GetExpStr() const;
121 inline void ChgExpStr(const String& rExpand);
123 // wird von der Formatierung abgefragt
124 inline BOOL IsInBodyTxt() const;
125 // wird von UpdateExpFlds gesetzt (dort ist die Node-Position bekannt)
126 inline void ChgBodyTxtFlag( BOOL bIsInBody );
127 // fuer Felder in Header/Footer/Footnotes/Flys:
128 // (wird nur von der Formatierung aufgerufen!!)
130 virtual String GetCntnt(BOOL bName = FALSE) const;
132 // Die Formel aendern
133 virtual String GetPar2() const;
134 virtual void SetPar2(const String& rStr);
136 virtual USHORT GetSubType() const;
137 virtual void SetSubType(USHORT nType);
138 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMId ) const;
139 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMId );
141 static USHORT GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc);
144 inline void SwGetExpField::ChgExpStr(const String& rExpand)
145 { sExpand = rExpand;}
147 inline const String& SwGetExpField::GetExpStr() const
148 { return sExpand; }
150 // wird von der Formatierung abgefragt
151 inline BOOL SwGetExpField::IsInBodyTxt() const
152 { return bIsInBodyTxt; }
154 // wird von UpdateExpFlds gesetzt (dort ist die Node-Position bekannt)
155 inline void SwGetExpField::ChgBodyTxtFlag( BOOL bIsInBody )
156 { bIsInBodyTxt = bIsInBody; }
159 /*--------------------------------------------------------------------
160 Beschreibung: Ausdruck setzen
161 --------------------------------------------------------------------*/
163 class SwSetExpField;
165 class SwSetExpFieldType : public SwValueFieldType
167 String sName;
168 const SwNode* pOutlChgNd;
169 sal_Unicode cDelim;
170 USHORT nType;
171 BYTE nLevel;
172 BOOL bDeleted;
174 public:
175 SwSetExpFieldType( SwDoc* pDoc, const String& rName,
176 USHORT nType = GSE_EXPR );
177 virtual SwFieldType* Copy() const;
178 virtual const String& GetName() const;
180 inline void SetType(USHORT nTyp);
181 inline USHORT GetType() const;
183 void SetSeqFormat(ULONG nFormat);
184 ULONG GetSeqFormat();
186 BOOL IsDeleted() const { return bDeleted; }
187 void SetDeleted( BOOL b ) { bDeleted = b; }
189 // ueberlagert, weil das Set-Field selbst dafuer sorgt, das
190 // es aktualisiert wird.
191 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
192 inline const String& GetSetRefName() const;
194 USHORT SetSeqRefNo( SwSetExpField& rFld );
196 USHORT GetSeqFldList( SwSeqFldList& rList );
197 String MakeSeqName( USHORT nSeqNo );
199 // Seqencefelder ggfs. Kapitelweise numerieren
200 sal_Unicode GetDelimiter() const { return cDelim; }
201 void SetDelimiter( sal_Unicode c ) { cDelim = c; }
202 BYTE GetOutlineLvl() const { return nLevel; }
203 void SetOutlineLvl( BYTE n ) { nLevel = n; }
204 // Member nur fuers SwDoc::UpdateExpFld - wird nur waehrend der Laufzeit
205 // von SequencefeldTypen benoetigt!!!
206 const SwNode* GetOutlineChgNd() const { return pOutlChgNd; }
207 void SetOutlineChgNd( const SwNode* p ) { pOutlChgNd = p; }
209 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMId ) const;
210 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMId );
213 inline void SwSetExpFieldType::SetType( USHORT nTyp )
215 nType = nTyp;
216 EnableFormat( !(nType & (GSE_SEQ|GSE_STRING)));
219 inline USHORT SwSetExpFieldType::GetType() const
220 { return nType; }
222 inline const String& SwSetExpFieldType::GetSetRefName() const
223 { return sName; }
226 /*--------------------------------------------------------------------
227 Beschreibung: Ausdruck
228 --------------------------------------------------------------------*/
230 class SwSetExpField : public SwFormulaField
232 String sExpand;
233 String aPText;
234 String aSeqText;
235 BOOL bInput;
236 USHORT nSeqNo;
237 USHORT nSubType;
239 public:
240 SwSetExpField(SwSetExpFieldType*, const String& rFormel, ULONG nFmt = 0);
242 virtual void SetValue( const double& rVal );
244 virtual String Expand() const;
245 virtual SwField* Copy() const;
247 inline const String& GetExpStr() const;
249 inline void ChgExpStr( const String& rExpand );
251 inline void SetPromptText(const String& rStr);
252 inline const String& GetPromptText() const;
254 inline void SetInputFlag(BOOL bInp);
255 inline BOOL GetInputFlag() const;
257 inline void SetSeqText(const String& rStr);
258 inline const String& GetSeqText() const;
260 virtual String GetCntnt(BOOL bName = FALSE) const;
261 virtual USHORT GetSubType() const;
262 virtual void SetSubType(USHORT nType);
264 inline BOOL IsSequenceFld() const;
266 // fuer SequenceFelder - logische Nummer
267 inline void SetSeqNumber( USHORT n ) { nSeqNo = n; }
268 inline USHORT GetSeqNumber() const { return nSeqNo; }
270 // Der Name nur erfragen
271 virtual const String& GetPar1() const;
273 // Die Formel
274 virtual String GetPar2() const;
275 virtual void SetPar2(const String& rStr);
276 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMId ) const;
277 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMId );
280 inline const String& SwSetExpField::GetExpStr() const
281 { return sExpand; }
283 inline void SwSetExpField::ChgExpStr( const String& rExpand )
284 { sExpand = rExpand; }
286 inline void SwSetExpField::SetPromptText(const String& rStr)
287 { aPText = rStr; }
289 inline const String& SwSetExpField::GetPromptText() const
290 { return aPText; }
292 inline void SwSetExpField::SetSeqText(const String& rStr)
293 { aSeqText = rStr; }
295 inline const String& SwSetExpField::GetSeqText() const
296 { return aSeqText; }
298 inline void SwSetExpField::SetInputFlag(BOOL bInp)
299 { bInput = bInp; }
301 inline BOOL SwSetExpField::GetInputFlag() const
302 { return bInput; }
304 inline BOOL SwSetExpField::IsSequenceFld() const
305 { return 0 != (GSE_SEQ & ((SwSetExpFieldType*)GetTyp())->GetType()); }
307 /*--------------------------------------------------------------------
308 Beschreibung: Eingabe im Text/Variable setzen
309 --------------------------------------------------------------------*/
311 class SwInputFieldType : public SwFieldType
313 SwDoc* pDoc;
314 public:
315 SwInputFieldType( SwDoc* pDoc );
317 virtual SwFieldType* Copy() const;
319 SwDoc* GetDoc() const { return pDoc; }
322 /*--------------------------------------------------------------------
323 Beschreibung: Eingabefeld
324 --------------------------------------------------------------------*/
326 class SwInputField : public SwField
328 String aContent;
329 String aPText;
330 USHORT nSubType;
331 public:
332 // Direkte Eingabe ueber Dialog alten Wert loeschen
333 SwInputField(SwInputFieldType*, const String& rContent ,
334 const String& rPrompt, USHORT nSubType = 0,
335 ULONG nFmt = 0);
337 virtual String GetCntnt(BOOL bName = FALSE) const;
338 virtual String Expand() const;
339 virtual SwField* Copy() const;
341 // Content
342 virtual const String& GetPar1() const;
343 virtual void SetPar1(const String& rStr);
345 // aPromptText
346 virtual String GetPar2() const;
347 virtual void SetPar2(const String& rStr);
349 virtual USHORT GetSubType() const;
350 virtual void SetSubType(USHORT nSub);
351 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMId ) const;
352 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMId );
355 /*--------------------------------------------------------------------
356 Description: Sorted list of input fields and DropDown fields
357 --------------------------------------------------------------------*/
362 // vergleiche TmpLst mit akt Feldern. Alle neue kommen in die SortLst
363 // damit sie geupdatet werden koennen. Returnt die Anzahl.
364 // (Fuer Textbausteine: nur seine Input-Felder aktualisieren)
366 // Alle unselektierten Felder aus Liste entfernen
369 /*--------------------------------------------------------------------
370 Beschreibung: Tabellen-Formelfeld
371 (Implementierung steht in tblcalc.cxx)
372 --------------------------------------------------------------------*/
374 class SwTblFieldType : public SwValueFieldType
376 public:
377 SwTblFieldType(SwDoc* pDocPtr);
378 virtual SwFieldType* Copy() const;
382 // MSC will den hier nicht
383 //typedef void (SwField:: *FnScanFormel)( const SwTable&, String&,
384 // String&, String* = 0, void* = 0 );
387 class SwTblField : public SwValueField, public SwTableFormula
389 String sExpand;
390 USHORT nSubType;
392 // suche den TextNode, in dem das Feld steht
393 virtual const SwNode* GetNodeOfFormula() const;
395 public:
396 SwTblField( SwTblFieldType*, const String& rFormel,
397 USHORT nSubType = 0, ULONG nFmt = 0);
399 virtual void SetValue( const double& rVal );
400 virtual USHORT GetSubType() const;
401 virtual void SetSubType(USHORT nType);
402 virtual String Expand() const;
403 virtual SwField* Copy() const;
405 const String& GetExpStr() const { return sExpand; }
406 void ChgExpStr(const String& rStr) { sExpand = rStr; }
408 // berechne sich selbst
409 void CalcField( SwTblCalcPara& rCalcPara );
411 virtual String GetCntnt(BOOL bName = FALSE) const;
412 // Die Formel
413 virtual String GetPar2() const;
414 virtual void SetPar2(const String& rStr);
415 virtual BOOL QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMId ) const;
416 virtual BOOL PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMId );
420 } //namespace binfilter
421 #endif // _EXPFLD_HXX