update credits
[LibreOffice.git] / sw / inc / flddat.hxx
blobccf8885a0f009b4574b6b2cfebd6c2307d69433b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SW_FLDDAT_HXX
21 #define SW_FLDDAT_HXX
23 #include <tools/string.hxx>
25 #include "fldbas.hxx"
27 class DateTime;
28 class Date;
29 class Time;
32 enum SwDateFormat
34 DF_BEGIN,
35 // new formats
36 DFF_SSYS = DF_BEGIN,
37 DFF_LSYS ,
38 DFF_DMY ,
39 DFF_DMYY ,
40 DFF_DMMY ,
41 DFF_DMMYY,
42 DFF_DMMMY ,
43 DFF_DMMMYY,
44 DFF_DDMMY ,
45 DFF_DDMMMY ,
46 DFF_DDMMMYY ,
47 DFF_DDDMMMY ,
48 DFF_DDDMMMYY ,
49 DFF_MY ,
50 DFF_MD ,
51 DFF_YMD ,
52 DFF_YYMD ,
53 DF_END ,
54 // Compatibility
55 DF_SSYS = DFF_SSYS,
56 DF_LSYS = DFF_LSYS,
57 DF_SHORT = DFF_DMY,
58 DF_SCENT = DFF_DMYY,
59 DF_LMON = DFF_DMMYY,
60 DF_LMONTH = DFF_DMMMYY,
61 DF_LDAYMON = DFF_DDMMMYY,
62 DF_LDAYMONTH= DFF_DDDMMMYY
65 enum SwTimeFormat
67 TF_BEGIN,
68 TF_SYSTEM=TF_BEGIN,
69 TF_SSMM_24,
70 TF_SSMM_12,
71 TF_END
74 enum SwTimeSubFormat
76 TIME_FIX,
77 TIME_VAR
80 enum SwDateSubFormat
82 DATE_FIX,
83 DATE_VAR
87 class SwDateTimeFieldType : public SwValueFieldType
89 public:
90 SwDateTimeFieldType(SwDoc* pDoc);
92 virtual SwFieldType* Copy() const;
96 class SW_DLLPUBLIC SwDateTimeField : public SwValueField
98 sal_uInt16 nSubType;
99 long nOffset; // Offset in minutes.
101 virtual String Expand() const;
102 virtual SwField* Copy() const;
104 public:
105 SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD,
106 sal_uLong nFmt = 0, sal_uInt16 nLng = 0);
108 virtual sal_uInt16 GetSubType() const;
109 virtual void SetSubType(sal_uInt16 nSub);
111 virtual double GetValue() const;
113 virtual void SetPar2(const OUString& rStr);
114 virtual OUString GetPar2() const;
116 inline sal_Bool IsDate() const
117 { return (nSubType & DATEFLD) != 0; }
119 inline void SetOffset(long nMinutes) { nOffset = nMinutes; }
120 inline long GetOffset() const { return nOffset; }
122 Date GetDate(sal_Bool bUseOffset = sal_False) const;
123 Time GetTime(sal_Bool bUseOffset = sal_False) const;
124 void SetDateTime(const DateTime& rDT);
125 static double GetDateTime(SwDoc* pDoc, const DateTime& rDT);
127 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const;
128 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId );
131 #endif // SW_FLDDAT_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */