1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docufld.hxx,v $
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 ************************************************************************/
33 #ifndef _DATE_HXX //autogen
34 #include <tools/date.hxx>
38 #include "numrule.hxx"
54 /*--------------------------------------------------------------------
55 Beschreibung: Untertyp der Dokumentstatistik
56 --------------------------------------------------------------------*/
74 DI_TITEL
= DI_SUBTYPE_BEGIN
,
90 enum SwDocInfoExtSubType
92 DI_SUB_AUTHOR
= 0x0100,
98 enum RegInfoFormat
// Nur noch zum laden alter Dokumente!!!
106 enum SwPageNumSubType
113 enum SwExtUserSubType
115 EU_COMPANY
/*EU_FIRMA*/,
116 EU_FIRSTNAME
/*EU_VORNAME*/,
118 EU_SHORTCUT
/*EU_ABK*/,
119 EU_STREET
/*EU_STRASSE*/,
120 EU_COUNTRY
/*EU_LAND*/,
123 EU_TITLE
/*EU_TITEL*/,
124 EU_POSITION
/*EU_POS*/,
125 EU_PHONE_PRIVATE
/*EU_TELPRIV*/,
126 EU_PHONE_COMPANY
/*EU_TELFIRMA*/,
134 enum SwJumpEditFormat
143 /*--------------------------------------------------------------------
144 Beschreibung: Seitennummer
145 --------------------------------------------------------------------*/
147 class SwPageNumberFieldType
: public SwFieldType
149 sal_Int16 nNumberingType
;
154 SwPageNumberFieldType();
156 String
& Expand( sal_uInt32 nFmt
, short nOff
, const String
&, String
& rRet
) const;
157 void ChangeExpansion( SwDoc
* pDoc
, USHORT nNum
, USHORT nMax
,
158 BOOL bVirtPageNum
, const sal_Int16
* pNumFmt
= 0 );
159 inline sal_Int16
GetNumFormat() const { return nNumberingType
; }
160 virtual SwFieldType
* Copy() const;
163 /*--------------------------------------------------------------------
164 Beschreibung: Seitennummerierung
165 --------------------------------------------------------------------*/
167 class SwPageNumberField
: public SwField
174 SwPageNumberField(SwPageNumberFieldType
*, USHORT nSub
= PG_RANDOM
,
175 sal_uInt32 nFmt
= 0, short nOff
= 0);
177 virtual String
Expand() const;
178 virtual SwField
* Copy() const;
180 virtual String
GetPar2() const;
181 virtual void SetPar2(const String
& rStr
);
183 virtual USHORT
GetSubType() const;
184 // virtual void SetSubType(USHORT nSub); // OM: entfernt, da unbenoetigt und gefaehrlich
185 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
186 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
188 const String
& GetUserString() const { return sUserStr
; }
189 void SetUserString( const String
& rS
) { sUserStr
= rS
; }
192 /*--------------------------------------------------------------------
193 Beschreibung: Autoren
194 --------------------------------------------------------------------*/
196 class SwAuthorFieldType
: public SwFieldType
201 String
Expand(ULONG
) const;
202 virtual SwFieldType
* Copy() const;
205 /*--------------------------------------------------------------------
206 Beschreibung: AutorenFeld
207 --------------------------------------------------------------------*/
209 class SwAuthorField
: public SwField
214 SwAuthorField(SwAuthorFieldType
*, sal_uInt32 nFmt
= 0);
216 virtual String
Expand() const;
217 virtual SwField
* Copy() const;
219 inline void SetExpansion(const String
& rStr
) { aContent
= rStr
; }
220 inline const String
& GetContent() const { return aContent
; }
222 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
223 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
226 /*--------------------------------------------------------------------
227 Beschreibung: Filename
228 --------------------------------------------------------------------*/
230 class SwFileNameFieldType
: public SwFieldType
234 SwFileNameFieldType(SwDoc
*);
236 String
Expand(ULONG
) const;
237 virtual SwFieldType
* Copy() const;
240 /*--------------------------------------------------------------------
241 Beschreibung: FileName
242 --------------------------------------------------------------------*/
244 class SwFileNameField
: public SwField
249 SwFileNameField(SwFileNameFieldType
*, sal_uInt32 nFmt
= 0);
251 virtual String
Expand() const;
252 virtual SwField
* Copy() const;
254 inline void SetExpansion(const String
& rStr
) { aContent
= rStr
; }
255 inline const String
& GetContent() const { return aContent
; }
257 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
258 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
261 /*--------------------------------------------------------------------
262 Beschreibung: TemplName
263 --------------------------------------------------------------------*/
265 class SwTemplNameFieldType
: public SwFieldType
269 SwTemplNameFieldType(SwDoc
*);
271 String
Expand(ULONG
) const;
272 virtual SwFieldType
* Copy() const;
275 /*--------------------------------------------------------------------
276 Beschreibung: TemplName
277 --------------------------------------------------------------------*/
279 class SwTemplNameField
: public SwField
282 SwTemplNameField(SwTemplNameFieldType
*, sal_uInt32 nFmt
= 0);
284 virtual String
Expand() const;
285 virtual SwField
* Copy() const;
286 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
287 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
291 /*--------------------------------------------------------------------
292 Beschreibung: Docstatistik
293 --------------------------------------------------------------------*/
295 class SwDocStatFieldType
: public SwFieldType
298 sal_Int16 nNumberingType
;//com::sun::star::style::NumberingType
301 SwDocStatFieldType(SwDoc
*);
302 String
Expand(USHORT nSubType
, sal_uInt32 nFmt
) const;
303 virtual SwFieldType
* Copy() const;
305 inline sal_Int16
GetNumFormat() const { return nNumberingType
; }
306 inline void SetNumFormat( sal_Int16 eFmt
) { nNumberingType
= eFmt
; }
309 /*--------------------------------------------------------------------
310 Beschreibung: Dokumentstatistik
311 --------------------------------------------------------------------*/
313 class SwDocStatField
: public SwField
318 SwDocStatField( SwDocStatFieldType
*,
319 USHORT nSubType
= 0, sal_uInt32 nFmt
= 0);
321 void ChangeExpansion( const SwFrm
* pFrm
);
323 virtual String
Expand() const;
324 virtual SwField
* Copy() const;
326 virtual USHORT
GetSubType() const;
327 virtual void SetSubType(USHORT nSub
);
328 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
329 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
332 /*--------------------------------------------------------------------
333 Beschreibung: versteckter Text
334 --------------------------------------------------------------------*/
336 class SwHiddenTxtFieldType
: public SwFieldType
340 SwHiddenTxtFieldType(BOOL bSetHidden
= TRUE
);
342 virtual SwFieldType
* Copy() const;
344 inline BOOL
GetHiddenFlag() const { return bHidden
; }
347 /*--------------------------------------------------------------------
348 Beschreibung: Versteckter Text
349 --------------------------------------------------------------------*/
351 class SwHiddenTxtField
: public SwField
353 String aTRUETxt
; // Text wenn Bedingung TRUE
354 String aFALSETxt
; // Wenn Bedingung falsch
355 String aContent
; // Ausgewerteter DB-Text
357 String aCond
; // Bedingung
360 BOOL bCanToggle
: 1; // kann das Feld einzeln getoggelt werden?
361 BOOL bIsHidden
: 1; // ist es nicht sichtbar?
362 BOOL bValid
: 1; // DB-Feld evaluiert?
365 SwHiddenTxtField( SwHiddenTxtFieldType
*,
369 BOOL bHidden
= FALSE
,
370 USHORT nSubType
= TYP_HIDDENTXTFLD
);
372 SwHiddenTxtField( SwHiddenTxtFieldType
*,
375 const String
& rFalse
,
376 USHORT nSubType
= TYP_HIDDENTXTFLD
);
378 virtual String
GetCntnt(BOOL bName
= FALSE
) const;
379 virtual String
Expand() const;
380 virtual SwField
* Copy() const;
382 void Evaluate(SwDoc
*);
384 inline void SetValue(BOOL bHidden
) { bIsHidden
= bHidden
; }
385 inline BOOL
GetValue() const { return bIsHidden
; }
386 inline BOOL
IsConditional() const { return bCanToggle
; }
387 inline BOOL
IsValid() const { return bValid
; }
390 virtual void SetPar1(const String
& rStr
);
391 virtual const String
& GetPar1() const;
393 // True/False - String
394 virtual void SetPar2(const String
& rStr
);
395 virtual String
GetPar2() const;
398 virtual USHORT
GetSubType() const;
399 // virtual void SetSubType(USHORT nSub); // OM: entfernt, da unbenoetigt und gefaehrlich
400 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
401 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
404 /*--------------------------------------------------------------------
405 Beschreibung: Feld das zu einer Leerzeile (ohne Hoehe) expandiert
406 --------------------------------------------------------------------*/
408 class SwHiddenParaFieldType
: public SwFieldType
411 SwHiddenParaFieldType();
413 virtual SwFieldType
* Copy() const;
416 /*--------------------------------------------------------------------
417 Beschreibung: Versteckter Absatz
418 --------------------------------------------------------------------*/
420 class SwHiddenParaField
: public SwField
425 // Direkte Eingabe alten Wert loeschen
426 SwHiddenParaField(SwHiddenParaFieldType
*, const String
& rCond
);
428 virtual String
Expand() const;
429 virtual SwField
* Copy() const;
431 void SetHidden(BOOL bHidden
) { bIsHidden
= bHidden
; }
432 BOOL
IsHidden() const { return bIsHidden
; }
434 // Bedingung erfragen/setzen
435 virtual const String
& GetPar1() const;
436 virtual void SetPar1(const String
& rStr
);
437 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
438 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
441 /*--------------------------------------------------------------------
442 Beschreibung: Macro ausfuehren
443 --------------------------------------------------------------------*/
445 class SwMacroFieldType
: public SwFieldType
450 SwMacroFieldType(SwDoc
*);
452 virtual SwFieldType
* Copy() const;
455 /*--------------------------------------------------------------------
456 Beschreibung: Macrofeld
457 --------------------------------------------------------------------*/
459 class SwMacroField
: public SwField
465 // Direkte Eingabe alten Wert loeschen
466 SwMacroField( SwMacroFieldType
*, const String
& rLibAndName
,
469 inline const String
& GetMacro() const { return aMacro
; }
470 String
GetLibName() const;
471 String
GetMacroName() const;
473 virtual String
GetCntnt(BOOL bName
= FALSE
) const;
474 virtual String
Expand() const;
475 virtual SwField
* Copy() const;
477 // Library und FileName
478 virtual const String
& GetPar1() const;
479 virtual void SetPar1(const String
& rStr
);
482 virtual String
GetPar2() const;
483 virtual void SetPar2(const String
& rStr
);
484 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
485 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
487 static void CreateMacroString( String
& rMacro
,
488 const String
& rMacroName
,
489 const String
& rLibraryName
);
493 /*--------------------------------------------------------------------
494 Beschreibung: PostIts
495 --------------------------------------------------------------------*/
497 class SwPostItFieldType
: public SwFieldType
502 virtual SwFieldType
* Copy() const;
505 /*--------------------------------------------------------------------
507 --------------------------------------------------------------------*/
509 class SwPostItField
: public SwField
511 String sTxt
; // die Anmerkung
512 String sAuthor
; // der Author
513 Date aDate
; // Datum ??/Zeit?? der Anmerkung
516 SwPostItField( SwPostItFieldType
*,
517 const String
& rAuthor
, const String
& rTxt
, const Date
& rDate
);
519 virtual String
Expand() const;
520 virtual SwField
* Copy() const;
522 inline const Date
& GetDate() const { return aDate
; }
524 virtual const String
& GetPar1() const;
525 virtual void SetPar1(const String
& rStr
);
528 virtual String
GetPar2() const;
529 virtual void SetPar2(const String
& rStr
);
531 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
532 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
535 /*--------------------------------------------------------------------
536 Beschreibung: DokumentInfo
537 --------------------------------------------------------------------*/
539 class SwDocInfoFieldType
: public SwValueFieldType
542 SwDocInfoFieldType(SwDoc
* pDc
);
544 String
Expand(USHORT nSubType
, sal_uInt32 nFormat
, USHORT nLang
) const;
545 virtual SwFieldType
* Copy() const;
548 class SwDocInfoField
: public SwValueField
554 SwDocInfoField(SwDocInfoFieldType
*, USHORT nSub
, sal_uInt32 nFmt
=0);
556 virtual void SetSubType(USHORT
);
557 virtual USHORT
GetSubType() const;
558 virtual void SetLanguage(USHORT nLng
);
559 virtual String
Expand() const;
560 virtual String
GetCntnt(BOOL bName
= FALSE
) const;
561 virtual SwField
* Copy() const;
563 inline void SetExpansion(const String
& rStr
) { aContent
= rStr
; }
564 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
565 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
568 /*--------------------------------------------------------------------
569 Beschreibung: erweiterte Benutzereinstellung
570 --------------------------------------------------------------------*/
573 class SwExtUserFieldType
: public SwFieldType
577 SwExtUserFieldType();
579 inline const String
& GetData() const { return aData
; }
580 inline void SetData(const String
& rStr
) { aData
= rStr
; }
582 String
Expand(USHORT nSubType
, sal_uInt32 nFormat
) const;
583 virtual SwFieldType
* Copy() const;
586 class SwExtUserField
: public SwField
592 SwExtUserField(SwExtUserFieldType
*, USHORT nSub
, sal_uInt32 nFmt
=0);
594 virtual String
Expand() const;
595 virtual SwField
* Copy() const;
597 virtual USHORT
GetSubType() const;
598 virtual void SetSubType(USHORT nSub
);
600 inline void SetExpansion(const String
& rStr
) { aContent
= rStr
; }
601 inline const String
& GetContent() const { return aContent
; }
603 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
604 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
608 /*--------------------------------------------------------------------
609 Beschreibung: Relatives Seitennummern - Feld
610 --------------------------------------------------------------------*/
612 class SwRefPageSetFieldType
: public SwFieldType
615 SwRefPageSetFieldType();
617 virtual SwFieldType
* Copy() const;
618 // ueberlagert, weil es nichts zum Updaten gibt!
621 /*--------------------------------------------------------------------
622 Beschreibung: Relative Seitennummerierung
623 --------------------------------------------------------------------*/
625 class SwRefPageSetField
: public SwField
631 SwRefPageSetField( SwRefPageSetFieldType
*, short nOff
= 0,
634 virtual String
Expand() const;
635 virtual SwField
* Copy() const;
637 virtual String
GetPar2() const;
638 virtual void SetPar2(const String
& rStr
);
640 BOOL
IsOn() const { return bOn
; }
641 short GetOffset() const { return nOffset
; }
642 void SetOffset( short nOff
) { nOffset
= nOff
; }
643 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
644 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
647 /*--------------------------------------------------------------------
648 Beschreibung: relatives Seitennummern - Abfrage Feld
649 --------------------------------------------------------------------*/
651 class SwRefPageGetFieldType
: public SwFieldType
654 sal_Int16 nNumberingType
;
658 SwRefPageGetFieldType( SwDoc
* pDoc
);
659 virtual SwFieldType
* Copy() const;
661 // ueberlagert, um alle RefPageGet-Felder zu updaten
662 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
664 sal_Int16
GetNumFormat() const { return nNumberingType
; }
665 void SetNumFormat( sal_Int16 eFmt
) { nNumberingType
= eFmt
; }
666 SwDoc
* GetDoc() const { return pDoc
; }
669 /*--------------------------------------------------------------------
670 Beschreibung: Relative Seitennummerierung Abfragen
671 --------------------------------------------------------------------*/
673 class SwRefPageGetField
: public SwField
677 SwRefPageGetField( SwRefPageGetFieldType
*, sal_uInt32 nFmt
);
679 virtual String
Expand() const;
680 virtual SwField
* Copy() const;
682 void SetText( const String
& rTxt
) { sTxt
= rTxt
; }
683 const String
& GetText() const { return sTxt
; }
685 void ChangeExpansion( const SwFrm
* pFrm
, const SwTxtFld
* pFld
);
686 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
687 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
690 /*--------------------------------------------------------------------
691 Beschreibung: Feld zum Anspringen und Editieren
692 --------------------------------------------------------------------*/
694 class SwJumpEditFieldType
: public SwFieldType
700 SwJumpEditFieldType( SwDoc
* pDoc
);
701 virtual SwFieldType
* Copy() const;
703 SwDoc
* GetDoc() { return pDoc
; }
704 const SwDoc
* GetDoc() const { return pDoc
; }
706 SwCharFmt
* GetCharFmt();
709 class SwJumpEditField
: public SwField
713 SwJumpEditField( SwJumpEditFieldType
*, sal_uInt32 nFormat
,
714 const String
& sText
, const String
& sHelp
);
716 virtual String
Expand() const;
717 virtual SwField
* Copy() const;
720 virtual const String
& GetPar1() const;
721 virtual void SetPar1(const String
& rStr
);
724 virtual String
GetPar2() const;
725 virtual void SetPar2(const String
& rStr
);
727 SwCharFmt
* GetCharFmt() const
728 { return ((SwJumpEditFieldType
*)GetTyp())->GetCharFmt(); }
729 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
730 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
733 /*--------------------------------------------------------------------
734 Beschreibung: Script Fieldtype
735 --------------------------------------------------------------------*/
737 class SwScriptFieldType
: public SwFieldType
741 SwScriptFieldType( SwDoc
* pDoc
);
743 virtual SwFieldType
* Copy() const;
746 /*--------------------------------------------------------------------
747 Beschreibung: Script Field
748 --------------------------------------------------------------------*/
750 class SwScriptField
: public SwField
752 String sType
; // Type von Code (Java/VBScript/...)
753 String sCode
; // der Code als Text
754 // der Code als JavaCode ?
756 BOOL bCodeURL
; // Code enthaelt URL eines Scripts
759 SwScriptField( SwScriptFieldType
*, const String
& rType
,
760 const String
& rCode
, BOOL bURL
=FALSE
);
762 virtual String
Expand() const;
763 virtual SwField
* Copy() const;
766 virtual const String
& GetPar1() const;
767 virtual void SetPar1(const String
& rStr
);
769 virtual String
GetPar2() const;
770 virtual void SetPar2(const String
& rStr
);
771 const String
& GetCode() const { return sCode
; }
773 BOOL
IsCodeURL() const { return bCodeURL
; }
774 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
775 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
778 /*--------------------------------------------------------------------
779 Beschreibung: Combined Character Fieldtype
780 --------------------------------------------------------------------*/
782 class SwCombinedCharFieldType
: public SwFieldType
785 SwCombinedCharFieldType();
787 virtual SwFieldType
* Copy() const;
790 /*--------------------------------------------------------------------
791 Beschreibung: Script Field
792 --------------------------------------------------------------------*/
794 #define MAX_COMBINED_CHARACTERS 6
796 class SwCombinedCharField
: public SwField
798 String sCharacters
; // combine these characters
801 SwCombinedCharField( SwCombinedCharFieldType
*, const String
& rChars
);
803 virtual String
Expand() const;
804 virtual SwField
* Copy() const;
807 virtual const String
& GetPar1() const;
808 virtual void SetPar1(const String
& rStr
);
810 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMId
) const;
811 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMId
);
815 } //namespace binfilter
816 #endif // _DOCUFLD_HXX