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 "fldbas.hxx"
24 
25 class DateTime;
26 class Date;
27 namespace tools { class Time; }
28 
30 {
33 };
34 
35 class SAL_DLLPUBLIC_RTTI SwDateTimeFieldType : public SwValueFieldType
36 {
37 public:
39 
40  virtual std::unique_ptr<SwFieldType> Copy() const override;
41 };
42 
44 {
45  sal_uInt16 m_nSubType;
46  long m_nOffset; // Offset in minutes.
47 
48  virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override;
49  virtual std::unique_ptr<SwField> Copy() const override;
50 
51 public:
52  SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD,
53  sal_uLong nFormat = 0, LanguageType nLng = LANGUAGE_SYSTEM);
54 
55  virtual sal_uInt16 GetSubType() const override;
56  virtual void SetSubType(sal_uInt16 nSub) override;
57 
58  virtual double GetValue() const override;
59 
60  virtual void SetPar2(const OUString& rStr) override;
61  virtual OUString GetPar2() const override;
62 
63  void SetOffset(long nMinutes) { m_nOffset = nMinutes; }
64  long GetOffset() const { return m_nOffset; }
65 
66  Date GetDate() const;
67  tools::Time GetTime() const;
68  void SetDateTime(const DateTime& rDT);
69  static double GetDateTime(SwDoc* pDoc, const DateTime& rDT);
70 
71  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override;
72  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override;
73 };
74 
75 #endif // INCLUDED_SW_INC_FLDDAT_HXX
76 
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual std::unique_ptr< SwFieldType > Copy() const =0
sal_uIntPtr sal_uLong
Definition: doc.hxx:185
Any GetTime(const OUString &val)
DateTime GetDateTime(const css::util::DateTime &_rDT)
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
sal_uInt16 m_nSubType
Definition: flddat.hxx:45
long GetOffset() const
Definition: flddat.hxx:64
SwDateSubFormat
Definition: flddat.hxx:29
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const =0
virtual void SetPar2(const OUString &rStr)
Definition: fldbas.cxx:289
void SetOffset(long nMinutes)
Definition: flddat.hxx:63
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhichId)
Definition: fldbas.cxx:314
long m_nOffset
Definition: flddat.hxx:46
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhichId) const
Definition: fldbas.cxx:301
virtual std::unique_ptr< SwField > Copy() const =0
virtual OUString GetPar2() const
Definition: fldbas.cxx:276
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual sal_uInt16 GetSubType() const
Definition: fldbas.cxx:292
Fields containing values that have to be formatted via number formatter.
Definition: fldbas.hxx:398
virtual void SetSubType(sal_uInt16)
Definition: fldbas.cxx:297
virtual double GetValue() const
Definition: fldbas.cxx:675