Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/fmtpdsc.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
#ifndef INCLUDED_SW_INC_FMTPDSC_HXX
20
#define INCLUDED_SW_INC_FMTPDSC_HXX
21
22
#include <svl/poolitem.hxx>
23
#include "swdllapi.h"
24
#include "hintids.hxx"
25
#include "format.hxx"
26
#include "calbck.hxx"
27
#include <optional>
28
#include "pagedesc.hxx"
29
30
/**
31
    SwFormatPageDesc ("use this page style with xyz parameters") is the wrapper
32
    around SwPageDesc ("page style"),
33
    multiple SwFormatPageDesc can refer to the same SwPageDesc.
34
 */
35
class SW_DLLPUBLIC SwFormatPageDesc final : public SfxPoolItem, public SwClient
36
{
37
    ::std::optional<sal_uInt16> m_oNumOffset;          ///< Offset page number.
38
    sw::BroadcastingModify* m_pDefinedIn;       /**< Points to the object in which the
39
                                 attribute was set (ContentNode/Format). */
40
41
    virtual void SwClientNotify( const SwModify&, const SfxHint& rHint ) override;
42
43
public:
44
    DECLARE_ITEM_TYPE_FUNCTION(SwFormatPageDesc)
45
    explicit SwFormatPageDesc( const SwPageDesc *pDesc = nullptr );
46
    SwFormatPageDesc( const SwFormatPageDesc &rCpy );
47
    SwFormatPageDesc &operator=( const SwFormatPageDesc &rCpy );
48
    virtual ~SwFormatPageDesc() override;
49
50
51
    /// "Pure virtual methods" of SfxPoolItem.
52
    virtual bool            operator==( const SfxPoolItem& ) const override;
53
0
    virtual bool            supportsHashCode() const override { return true; }
54
    virtual size_t          hashCode() const override;
55
    virtual SwFormatPageDesc* Clone( SfxItemPool* pPool = nullptr ) const override;
56
    virtual bool GetPresentation( SfxItemPresentation ePres,
57
                                  MapUnit eCoreMetric,
58
                                  MapUnit ePresMetric,
59
                                  OUString &rText,
60
                                  const IntlWrapper& rIntl ) const override;
61
    virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
62
    virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
63
64
66.1k
          SwPageDesc *GetPageDesc() { return static_cast<SwPageDesc*>(GetRegisteredIn()); }
65
1.78M
    const SwPageDesc *GetPageDesc() const { return static_cast<const SwPageDesc*>(GetRegisteredIn()); }
66
67
15.1k
    const ::std::optional<sal_uInt16>&  GetNumOffset() const        { return m_oNumOffset; }
68
15.7k
    void    SetNumOffset( const ::std::optional<sal_uInt16>& oNum ) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_oNumOffset = oNum; }
69
70
    /// Query / set where attribute is anchored.
71
272k
    const sw::BroadcastingModify* GetDefinedIn() const { return m_pDefinedIn; }
72
241k
    void ChgDefinedIn( const sw::BroadcastingModify* pNew ) { m_pDefinedIn = const_cast<sw::BroadcastingModify*>(pNew); }
73
    void RegisterToPageDesc( SwPageDesc& );
74
    bool KnowsPageDesc() const;
75
    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
76
};
77
78
inline const SwFormatPageDesc &SwAttrSet::GetPageDesc(bool bInP) const
79
78.2k
    { return Get( RES_PAGEDESC,bInP); }
80
81
inline const SwFormatPageDesc &SwFormat::GetPageDesc(bool bInP) const
82
6
    { return m_aSet.GetPageDesc(bInP); }
83
84
#endif
85
86
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */