update dev300-m57
[ooovba.git] / sw / inc / flddat.hxx
blob600b32fa8765481caba05bb97402d6ce3765f62a
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: flddat.hxx,v $
10 * $Revision: 1.7 $
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 ************************************************************************/
31 #ifndef _FLDDAT_HXX
32 #define _FLDDAT_HXX
34 #include <tools/string.hxx>
36 #include "fldbas.hxx"
38 class DateTime;
39 class Date;
40 class Time;
42 /*--------------------------------------------------------------------
43 Beschreibung: Formate
44 --------------------------------------------------------------------*/
46 enum SwDateFormat
48 DF_BEGIN,
49 //neue Formate:
50 DFF_SSYS = DF_BEGIN,
51 DFF_LSYS ,
52 DFF_DMY ,
53 DFF_DMYY ,
54 DFF_DMMY ,
55 DFF_DMMYY,
56 DFF_DMMMY ,
57 DFF_DMMMYY,
58 DFF_DDMMY ,
59 DFF_DDMMMY ,
60 DFF_DDMMMYY ,
61 DFF_DDDMMMY ,
62 DFF_DDDMMMYY ,
63 DFF_MY ,
64 DFF_MD ,
65 DFF_YMD ,
66 DFF_YYMD ,
67 DF_END ,
68 // Kompatibilitaet:
69 DF_SSYS = DFF_SSYS,
70 DF_LSYS = DFF_LSYS,
71 DF_SHORT = DFF_DMY,
72 DF_SCENT = DFF_DMYY,
73 DF_LMON = DFF_DMMYY,
74 DF_LMONTH = DFF_DMMMYY,
75 DF_LDAYMON = DFF_DDMMMYY,
76 DF_LDAYMONTH= DFF_DDDMMMYY
79 enum SwTimeFormat
81 TF_BEGIN,
82 TF_SYSTEM=TF_BEGIN,
83 TF_SSMM_24,
84 TF_SSMM_12,
85 TF_END
88 enum SwTimeSubFormat
90 TIME_FIX,
91 TIME_VAR
94 enum SwDateSubFormat
96 DATE_FIX,
97 DATE_VAR
100 /*--------------------------------------------------------------------
101 Beschreibung: Datum/Uhrzeitfeld
102 --------------------------------------------------------------------*/
104 class SwDateTimeFieldType : public SwValueFieldType
106 public:
107 SwDateTimeFieldType(SwDoc* pDoc);
109 virtual SwFieldType* Copy() const;
112 /*--------------------------------------------------------------------
113 Beschreibung: Datum/Uhrzeitfeld
114 --------------------------------------------------------------------*/
116 class SW_DLLPUBLIC SwDateTimeField : public SwValueField
118 USHORT nSubType;
119 long nOffset; // Offset in Minuten
121 public:
122 SwDateTimeField(SwDateTimeFieldType* pType, USHORT nSubType = DATEFLD,
123 ULONG nFmt = 0, USHORT nLng = 0);
125 virtual USHORT GetSubType() const;
126 virtual void SetSubType(USHORT nSub);
128 virtual double GetValue() const;
130 virtual void SetPar2(const String& rStr);
131 virtual String GetPar2() const;
133 inline BOOL IsDate() const
134 { return (nSubType & DATEFLD) != 0; }
136 inline void SetOffset(long nMinutes) { nOffset = nMinutes; }
137 inline long GetOffset() const { return nOffset; }
139 Date GetDate(BOOL bUseOffset = FALSE) const;
140 Time GetTime(BOOL bUseOffset = FALSE) const;
141 void SetDateTime(const DateTime& rDT);
142 static double GetDateTime(SwDoc* pDoc, const DateTime& rDT);
144 virtual String Expand() const;
145 virtual SwField* Copy() const;
147 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nMId ) const;
148 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nMId );
151 #endif // _FLDDAT_HXX