/src/libreoffice/sw/inc/fmthdft.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_FMTHDFT_HXX |
20 | | #define INCLUDED_SW_INC_FMTHDFT_HXX |
21 | | |
22 | | #include "hintids.hxx" |
23 | | #include "format.hxx" |
24 | | #include <svl/poolitem.hxx> |
25 | | #include "calbck.hxx" |
26 | | #include "frmfmt.hxx" |
27 | | |
28 | | namespace sw { |
29 | | typedef ClientBase<::SwFrameFormat> FrameFormatClient; |
30 | | } |
31 | | |
32 | | /** Header, for PageFormats |
33 | | Client of FrameFormat describing the header. */ |
34 | | |
35 | | class SW_DLLPUBLIC SwFormatHeader final : public SfxPoolItem, public sw::FrameFormatClient |
36 | | { |
37 | | bool m_bActive; ///< Only for controlling (creation of content). |
38 | | |
39 | | void ImplDestroy(); |
40 | | public: |
41 | | DECLARE_ITEM_TYPE_FUNCTION(SwFormatHeader) |
42 | | SwFormatHeader( bool bOn = false ); |
43 | | SwFormatHeader( SwFrameFormat *pHeaderFormat ); |
44 | | SwFormatHeader( const SwFormatHeader &rCpy ); |
45 | | virtual ~SwFormatHeader() override; |
46 | | SwFormatHeader& operator=( const SwFormatHeader &rCpy ); |
47 | | |
48 | | |
49 | | /// "pure virtual methods" of SfxPoolItem |
50 | | virtual bool operator==( const SfxPoolItem& ) const override; |
51 | | virtual SwFormatHeader* Clone( SfxItemPool* pPool = nullptr ) const override; |
52 | | virtual bool GetPresentation( SfxItemPresentation ePres, |
53 | | MapUnit eCoreMetric, |
54 | | MapUnit ePresMetric, |
55 | | OUString &rText, |
56 | | const IntlWrapper& rIntl ) const override; |
57 | | |
58 | 336k | const SwFrameFormat *GetHeaderFormat() const { return GetRegisteredIn(); } |
59 | 566k | SwFrameFormat *GetHeaderFormat() { return GetRegisteredIn(); } |
60 | | |
61 | | void RegisterToFormat( SwFrameFormat& rFormat ); |
62 | 1.68M | bool IsActive() const { return m_bActive; } |
63 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
64 | | }; |
65 | | |
66 | | /**Footer, for pageformats |
67 | | Client of FrameFormat describing the footer */ |
68 | | |
69 | | class SW_DLLPUBLIC SwFormatFooter final : public SfxPoolItem, public sw::FrameFormatClient |
70 | | { |
71 | | bool m_bActive; // Only for controlling (creation of content). |
72 | | |
73 | | void ImplDestroy(); |
74 | | public: |
75 | | DECLARE_ITEM_TYPE_FUNCTION(SwFormatFooter) |
76 | | SwFormatFooter( bool bOn = false ); |
77 | | SwFormatFooter( SwFrameFormat *pFooterFormat ); |
78 | | SwFormatFooter( const SwFormatFooter &rCpy ); |
79 | | virtual ~SwFormatFooter() override; |
80 | | SwFormatFooter& operator=( const SwFormatFooter &rCpy ); |
81 | | |
82 | | |
83 | | /// "pure virtual methods" of SfxPoolItem |
84 | | virtual bool operator==( const SfxPoolItem& ) const override; |
85 | | virtual SwFormatFooter* Clone( SfxItemPool* pPool = nullptr ) const override; |
86 | | virtual bool GetPresentation( SfxItemPresentation ePres, |
87 | | MapUnit eCoreMetric, |
88 | | MapUnit ePresMetric, |
89 | | OUString &rText, |
90 | | const IntlWrapper& rIntl ) const override; |
91 | | |
92 | 266k | const SwFrameFormat *GetFooterFormat() const { return GetRegisteredIn(); } |
93 | 479k | SwFrameFormat *GetFooterFormat() { return GetRegisteredIn(); } |
94 | | |
95 | | void RegisterToFormat( SwFormat& rFormat ); |
96 | 1.60M | bool IsActive() const { return m_bActive; } |
97 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
98 | | }; |
99 | | |
100 | | inline const SwFormatHeader &SwAttrSet::GetHeader(bool bInP) const |
101 | 1.41M | { return Get( RES_HEADER,bInP); } |
102 | | inline const SwFormatFooter &SwAttrSet::GetFooter(bool bInP) const |
103 | 1.39M | { return Get( RES_FOOTER,bInP); } |
104 | | |
105 | | inline const SwFormatHeader &SwFormat::GetHeader(bool bInP) const |
106 | 1.41M | { return m_aSet.GetHeader(bInP); } |
107 | | inline const SwFormatFooter &SwFormat::GetFooter(bool bInP) const |
108 | 1.39M | { return m_aSet.GetFooter(bInP); } |
109 | | |
110 | | #endif |
111 | | |
112 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |