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: flddat.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 ************************************************************************/
34 #include <tools/string.hxx>
42 /*--------------------------------------------------------------------
44 --------------------------------------------------------------------*/
74 DF_LMONTH
= DFF_DMMMYY
,
75 DF_LDAYMON
= DFF_DDMMMYY
,
76 DF_LDAYMONTH
= DFF_DDDMMMYY
100 /*--------------------------------------------------------------------
101 Beschreibung: Datum/Uhrzeitfeld
102 --------------------------------------------------------------------*/
104 class SwDateTimeFieldType
: public SwValueFieldType
107 SwDateTimeFieldType(SwDoc
* pDoc
);
109 virtual SwFieldType
* Copy() const;
112 /*--------------------------------------------------------------------
113 Beschreibung: Datum/Uhrzeitfeld
114 --------------------------------------------------------------------*/
116 class SW_DLLPUBLIC SwDateTimeField
: public SwValueField
119 long nOffset
; // Offset in Minuten
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