Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SW_FLDDAT_HXX
30 : : #define SW_FLDDAT_HXX
31 : :
32 : : #include <tools/string.hxx>
33 : :
34 : : #include "fldbas.hxx"
35 : :
36 : : class DateTime;
37 : : class Date;
38 : : class Time;
39 : :
40 : :
41 : : enum SwDateFormat
42 : : {
43 : : DF_BEGIN,
44 : : // new formats
45 : : DFF_SSYS = DF_BEGIN,
46 : : DFF_LSYS ,
47 : : DFF_DMY ,
48 : : DFF_DMYY ,
49 : : DFF_DMMY ,
50 : : DFF_DMMYY,
51 : : DFF_DMMMY ,
52 : : DFF_DMMMYY,
53 : : DFF_DDMMY ,
54 : : DFF_DDMMMY ,
55 : : DFF_DDMMMYY ,
56 : : DFF_DDDMMMY ,
57 : : DFF_DDDMMMYY ,
58 : : DFF_MY ,
59 : : DFF_MD ,
60 : : DFF_YMD ,
61 : : DFF_YYMD ,
62 : : DF_END ,
63 : : // Compatibility
64 : : DF_SSYS = DFF_SSYS,
65 : : DF_LSYS = DFF_LSYS,
66 : : DF_SHORT = DFF_DMY,
67 : : DF_SCENT = DFF_DMYY,
68 : : DF_LMON = DFF_DMMYY,
69 : : DF_LMONTH = DFF_DMMMYY,
70 : : DF_LDAYMON = DFF_DDMMMYY,
71 : : DF_LDAYMONTH= DFF_DDDMMMYY
72 : : };
73 : :
74 : : enum SwTimeFormat
75 : : {
76 : : TF_BEGIN,
77 : : TF_SYSTEM=TF_BEGIN,
78 : : TF_SSMM_24,
79 : : TF_SSMM_12,
80 : : TF_END
81 : : };
82 : :
83 : : enum SwTimeSubFormat
84 : : {
85 : : TIME_FIX,
86 : : TIME_VAR
87 : : };
88 : :
89 : : enum SwDateSubFormat
90 : : {
91 : : DATE_FIX,
92 : : DATE_VAR
93 : : };
94 : :
95 : :
96 [ - + ]: 2916 : class SwDateTimeFieldType : public SwValueFieldType
97 : : {
98 : : public:
99 : : SwDateTimeFieldType(SwDoc* pDoc);
100 : :
101 : : virtual SwFieldType* Copy() const;
102 : : };
103 : :
104 : :
105 [ - + ]: 118 : class SW_DLLPUBLIC SwDateTimeField : public SwValueField
106 : : {
107 : : sal_uInt16 nSubType;
108 : : long nOffset; // Offset in minutes.
109 : :
110 : : virtual String Expand() const;
111 : : virtual SwField* Copy() const;
112 : :
113 : : public:
114 : : SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD,
115 : : sal_uLong nFmt = 0, sal_uInt16 nLng = 0);
116 : :
117 : : virtual sal_uInt16 GetSubType() const;
118 : : virtual void SetSubType(sal_uInt16 nSub);
119 : :
120 : : virtual double GetValue() const;
121 : :
122 : : virtual void SetPar2(const rtl::OUString& rStr);
123 : : virtual rtl::OUString GetPar2() const;
124 : :
125 : 0 : inline sal_Bool IsDate() const
126 : 0 : { return (nSubType & DATEFLD) != 0; }
127 : :
128 : 63 : inline void SetOffset(long nMinutes) { nOffset = nMinutes; }
129 : 0 : inline long GetOffset() const { return nOffset; }
130 : :
131 : : Date GetDate(sal_Bool bUseOffset = sal_False) const;
132 : : Time GetTime(sal_Bool bUseOffset = sal_False) const;
133 : : void SetDateTime(const DateTime& rDT);
134 : : static double GetDateTime(SwDoc* pDoc, const DateTime& rDT);
135 : :
136 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const;
137 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId );
138 : : };
139 : :
140 : : #endif // SW_FLDDAT_HXX
141 : :
142 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|