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 ************************************************************************/
31 #include <tools/string.hxx>
39 /*--------------------------------------------------------------------
41 --------------------------------------------------------------------*/
71 DF_LMONTH
= DFF_DMMMYY
,
72 DF_LDAYMON
= DFF_DDMMMYY
,
73 DF_LDAYMONTH
= DFF_DDDMMMYY
97 /*--------------------------------------------------------------------
98 Beschreibung: Datum/Uhrzeitfeld
99 --------------------------------------------------------------------*/
101 class SwDateTimeFieldType
: public SwValueFieldType
104 SwDateTimeFieldType(SwDoc
* pDoc
);
106 virtual SwFieldType
* Copy() const;
109 /*--------------------------------------------------------------------
110 Beschreibung: Datum/Uhrzeitfeld
111 --------------------------------------------------------------------*/
113 class SW_DLLPUBLIC SwDateTimeField
: public SwValueField
116 long nOffset
; // Offset in Minuten
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