merged tag ooo/OOO330_m14
[LibreOffice.git] / sw / inc / flddat.hxx
blobd302f45a96bc96cc850236a50527f8e192d307cc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef _FLDDAT_HXX
29 #define _FLDDAT_HXX
31 #include <tools/string.hxx>
33 #include "fldbas.hxx"
35 class DateTime;
36 class Date;
37 class Time;
39 /*--------------------------------------------------------------------
40 Beschreibung: Formate
41 --------------------------------------------------------------------*/
43 enum SwDateFormat
45 DF_BEGIN,
46 //neue Formate:
47 DFF_SSYS = DF_BEGIN,
48 DFF_LSYS ,
49 DFF_DMY ,
50 DFF_DMYY ,
51 DFF_DMMY ,
52 DFF_DMMYY,
53 DFF_DMMMY ,
54 DFF_DMMMYY,
55 DFF_DDMMY ,
56 DFF_DDMMMY ,
57 DFF_DDMMMYY ,
58 DFF_DDDMMMY ,
59 DFF_DDDMMMYY ,
60 DFF_MY ,
61 DFF_MD ,
62 DFF_YMD ,
63 DFF_YYMD ,
64 DF_END ,
65 // Kompatibilitaet:
66 DF_SSYS = DFF_SSYS,
67 DF_LSYS = DFF_LSYS,
68 DF_SHORT = DFF_DMY,
69 DF_SCENT = DFF_DMYY,
70 DF_LMON = DFF_DMMYY,
71 DF_LMONTH = DFF_DMMMYY,
72 DF_LDAYMON = DFF_DDMMMYY,
73 DF_LDAYMONTH= DFF_DDDMMMYY
76 enum SwTimeFormat
78 TF_BEGIN,
79 TF_SYSTEM=TF_BEGIN,
80 TF_SSMM_24,
81 TF_SSMM_12,
82 TF_END
85 enum SwTimeSubFormat
87 TIME_FIX,
88 TIME_VAR
91 enum SwDateSubFormat
93 DATE_FIX,
94 DATE_VAR
97 /*--------------------------------------------------------------------
98 Beschreibung: Datum/Uhrzeitfeld
99 --------------------------------------------------------------------*/
101 class SwDateTimeFieldType : public SwValueFieldType
103 public:
104 SwDateTimeFieldType(SwDoc* pDoc);
106 virtual SwFieldType* Copy() const;
109 /*--------------------------------------------------------------------
110 Beschreibung: Datum/Uhrzeitfeld
111 --------------------------------------------------------------------*/
113 class SW_DLLPUBLIC SwDateTimeField : public SwValueField
115 USHORT nSubType;
116 long nOffset; // Offset in Minuten
118 public:
119 SwDateTimeField(SwDateTimeFieldType* pType, USHORT nSubType = DATEFLD,
120 ULONG nFmt = 0, USHORT nLng = 0);
122 virtual USHORT GetSubType() const;
123 virtual void SetSubType(USHORT nSub);
125 virtual double GetValue() const;
127 virtual void SetPar2(const String& rStr);
128 virtual String GetPar2() const;
130 inline BOOL IsDate() const
131 { return (nSubType & DATEFLD) != 0; }
133 inline void SetOffset(long nMinutes) { nOffset = nMinutes; }
134 inline long GetOffset() const { return nOffset; }
136 Date GetDate(BOOL bUseOffset = FALSE) const;
137 Time GetTime(BOOL bUseOffset = FALSE) const;
138 void SetDateTime(const DateTime& rDT);
139 static double GetDateTime(SwDoc* pDoc, const DateTime& rDT);
141 virtual String Expand() const;
142 virtual SwField* Copy() const;
144 virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nMId ) const;
145 virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nMId );
148 #endif // _FLDDAT_HXX