Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/flddat.hxx
Line
Count
Source
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
#pragma once
21
22
#include <tools/solar.h>
23
24
#include "fldbas.hxx"
25
26
class DateTime;
27
class Date;
28
namespace tools { class Time; }
29
30
enum SwDateSubFormat
31
{
32
    DATE_FIX,
33
    DATE_VAR
34
};
35
36
class SAL_DLLPUBLIC_RTTI SwDateTimeFieldType final : public SwValueFieldType
37
{
38
public:
39
        SwDateTimeFieldType(SwDoc* pDoc);
40
41
        virtual std::unique_ptr<SwFieldType> Copy() const override;
42
};
43
44
class SW_DLLPUBLIC SwDateTimeField final : public SwValueField
45
{
46
        SwDateTimeSubType          m_nSubType;
47
        tools::Long                m_nOffset;    // Offset in minutes.
48
49
        virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
50
        virtual std::unique_ptr<SwField> Copy() const override;
51
52
public:
53
        SwDateTimeField(SwDateTimeFieldType* pType, SwDateTimeSubType nSubType = SwDateTimeSubType::Date,
54
                    sal_uLong nFormat = 0, LanguageType nLng = LANGUAGE_SYSTEM);
55
56
        SwDateTimeSubType       GetSubType() const;
57
        void                    SetSubType(SwDateTimeSubType nSub);
58
59
        virtual double          GetValue() const override;
60
61
        virtual void            SetPar2(const OUString& rStr) override;
62
        virtual OUString        GetPar2() const override;
63
64
40.0k
        void             SetOffset(tools::Long nMinutes)    { m_nOffset = nMinutes; }
65
0
        tools::Long             GetOffset() const           { return m_nOffset; }
66
67
        Date                    GetDate() const;
68
        tools::Time             GetTime() const;
69
        void                    SetDateTime(const DateTime& rDT);
70
        static double           GetDateTime(SwDoc& rDoc, const DateTime& rDT);
71
72
        virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override;
73
        virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override;
74
};
75
76
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */