1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
27 namespace tools
{ class Time
; }
57 DF_LMONTH
= DFF_DMMMYY
,
58 DF_LDAYMON
= DFF_DDMMMYY
,
59 DF_LDAYMONTH
= DFF_DDDMMMYY
83 class SwDateTimeFieldType
: public SwValueFieldType
86 SwDateTimeFieldType(SwDoc
* pDoc
);
88 virtual SwFieldType
* Copy() const SAL_OVERRIDE
;
91 class SW_DLLPUBLIC SwDateTimeField
: public SwValueField
94 long nOffset
; // Offset in minutes.
96 virtual OUString
Expand() const SAL_OVERRIDE
;
97 virtual SwField
* Copy() const SAL_OVERRIDE
;
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: */