Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / flddat.hxx
blobf99eb558d7ab9958dffa669c4b6ecb4d0aa37ac4
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 INCLUDED_SW_INC_FLDDAT_HXX
21 #define INCLUDED_SW_INC_FLDDAT_HXX
23 #include "fldbas.hxx"
25 class DateTime;
26 class Date;
27 namespace tools { class Time; }
29 enum SwDateFormat
31 DF_BEGIN,
32 // new formats
33 DFF_SSYS = DF_BEGIN,
34 DFF_LSYS ,
35 DFF_DMY ,
36 DFF_DMYY ,
37 DFF_DMMY ,
38 DFF_DMMYY,
39 DFF_DMMMY ,
40 DFF_DMMMYY,
41 DFF_DDMMY ,
42 DFF_DDMMMY ,
43 DFF_DDMMMYY ,
44 DFF_DDDMMMY ,
45 DFF_DDDMMMYY ,
46 DFF_MY ,
47 DFF_MD ,
48 DFF_YMD ,
49 DFF_YYMD ,
50 DF_END ,
51 // Compatibility
52 DF_SSYS = DFF_SSYS,
53 DF_LSYS = DFF_LSYS,
54 DF_SHORT = DFF_DMY,
55 DF_SCENT = DFF_DMYY,
56 DF_LMON = DFF_DMMYY,
57 DF_LMONTH = DFF_DMMMYY,
58 DF_LDAYMON = DFF_DDMMMYY,
59 DF_LDAYMONTH= DFF_DDDMMMYY
62 enum SwTimeFormat
64 TF_BEGIN,
65 TF_SYSTEM=TF_BEGIN,
66 TF_SSMM_24,
67 TF_SSMM_12,
68 TF_END
71 enum SwTimeSubFormat
73 TIME_FIX,
74 TIME_VAR
77 enum SwDateSubFormat
79 DATE_FIX,
80 DATE_VAR
83 class SwDateTimeFieldType : public SwValueFieldType
85 public:
86 SwDateTimeFieldType(SwDoc* pDoc);
88 virtual SwFieldType* Copy() const SAL_OVERRIDE;
91 class SW_DLLPUBLIC SwDateTimeField : public SwValueField
93 sal_uInt16 nSubType;
94 long nOffset; // Offset in minutes.
96 virtual OUString Expand() const SAL_OVERRIDE;
97 virtual SwField* Copy() const SAL_OVERRIDE;
99 public:
100 SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD,
101 sal_uLong nFormat = 0, sal_uInt16 nLng = 0);
103 virtual sal_uInt16 GetSubType() const SAL_OVERRIDE;
104 virtual void SetSubType(sal_uInt16 nSub) SAL_OVERRIDE;
106 virtual double GetValue() const SAL_OVERRIDE;
108 virtual void SetPar2(const OUString& rStr) SAL_OVERRIDE;
109 virtual OUString GetPar2() const SAL_OVERRIDE;
111 inline bool IsDate() const
112 { return (nSubType & DATEFLD) != 0; }
114 inline void SetOffset(long nMinutes) { nOffset = nMinutes; }
115 inline long GetOffset() const { return nOffset; }
117 Date GetDate(bool bUseOffset = false) const;
118 tools::Time GetTime(bool bUseOffset = false) const;
119 void SetDateTime(const DateTime& rDT);
120 static double GetDateTime(SwDoc* pDoc, const DateTime& rDT);
122 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const SAL_OVERRIDE;
123 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) SAL_OVERRIDE;
126 #endif // INCLUDED_SW_INC_FLDDAT_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */