LibreOffice Module sw (master) 1
flddat.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SW_INC_FLDDAT_HXX
21#define INCLUDED_SW_INC_FLDDAT_HXX
22
23#include <tools/solar.h>
24
25#include "fldbas.hxx"
26
27class DateTime;
28class Date;
29namespace tools { class Time; }
30
32{
35};
36
37class SAL_DLLPUBLIC_RTTI SwDateTimeFieldType final : public SwValueFieldType
38{
39public:
41
42 virtual std::unique_ptr<SwFieldType> Copy() const override;
43};
44
46{
47 sal_uInt16 m_nSubType;
48 tools::Long m_nOffset; // Offset in minutes.
49
50 virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
51 virtual std::unique_ptr<SwField> Copy() const override;
52
53public:
54 SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD,
55 sal_uLong nFormat = 0, LanguageType nLng = LANGUAGE_SYSTEM);
56
57 virtual sal_uInt16 GetSubType() const override;
58 virtual void SetSubType(sal_uInt16 nSub) override;
59
60 virtual double GetValue() const override;
61
62 virtual void SetPar2(const OUString& rStr) override;
63 virtual OUString GetPar2() const override;
64
65 void SetOffset(tools::Long nMinutes) { m_nOffset = nMinutes; }
66 tools::Long GetOffset() const { return m_nOffset; }
67
68 Date GetDate() const;
69 tools::Time GetTime() const;
70 void SetDateTime(const DateTime& rDT);
71 static double GetDateTime(SwDoc& rDoc, const DateTime& rDT);
72
73 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override;
74 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override;
75};
76
77#endif // INCLUDED_SW_INC_FLDDAT_HXX
78
79/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long m_nOffset
Definition: flddat.hxx:48
tools::Long GetOffset() const
Definition: flddat.hxx:66
void SetOffset(tools::Long nMinutes)
Definition: flddat.hxx:65
sal_uInt16 m_nSubType
Definition: flddat.hxx:47
Definition: doc.hxx:197
virtual std::unique_ptr< SwFieldType > Copy() const =0
virtual void SetPar2(const OUString &rStr)
Definition: fldbas.cxx:352
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const =0
virtual sal_uInt16 GetSubType() const
Definition: fldbas.cxx:355
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:364
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:382
virtual std::unique_ptr< SwField > Copy() const =0
virtual OUString GetPar2() const
Definition: fldbas.cxx:339
virtual void SetSubType(sal_uInt16)
Definition: fldbas.cxx:360
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
Fields containing values that have to be formatted via number formatter.
Definition: fldbas.hxx:419
virtual double GetValue() const
Definition: fldbas.cxx:799
@ DATEFLD
Definition: fldbas.hxx:234
SwDateSubFormat
Definition: flddat.hxx:32
@ DATE_FIX
Definition: flddat.hxx:34
@ DATE_VAR
Definition: flddat.hxx:33
Any GetTime(const OUString &val)
long Long
DateTime GetDateTime(const css::util::DateTime &_rDT)
sal_uIntPtr sal_uLong
#define SW_DLLPUBLIC
Definition: swdllapi.h:28