1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_FMTHDFT_HXX
20 #define INCLUDED_SW_INC_FMTHDFT_HXX
22 #include "hintids.hxx"
24 #include <svl/poolitem.hxx>
30 /** Header, for PageFormats
31 Client of FrameFormat describing the header. */
33 class SW_DLLPUBLIC SwFormatHeader final
: public SfxPoolItem
, public SwClient
35 bool m_bActive
; ///< Only for controlling (creation of content).
38 SwFormatHeader( bool bOn
= false );
39 SwFormatHeader( SwFrameFormat
*pHeaderFormat
);
40 SwFormatHeader( const SwFormatHeader
&rCpy
);
41 virtual ~SwFormatHeader() override
;
42 SwFormatHeader
& operator=( const SwFormatHeader
&rCpy
);
45 /// "pure virtual methods" of SfxPoolItem
46 virtual bool operator==( const SfxPoolItem
& ) const override
;
47 virtual SwFormatHeader
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
48 virtual bool GetPresentation( SfxItemPresentation ePres
,
52 const IntlWrapper
& rIntl
) const override
;
54 const SwFrameFormat
*GetHeaderFormat() const { return static_cast<const SwFrameFormat
*>(GetRegisteredIn()); }
55 SwFrameFormat
*GetHeaderFormat() { return static_cast<SwFrameFormat
*>(GetRegisteredIn()); }
57 void RegisterToFormat( SwFormat
& rFormat
);
58 bool IsActive() const { return m_bActive
; }
59 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
62 /**Footer, for pageformats
63 Client of FrameFormat describing the footer */
65 class SW_DLLPUBLIC SwFormatFooter final
: public SfxPoolItem
, public SwClient
67 bool m_bActive
; // Only for controlling (creation of content).
70 SwFormatFooter( bool bOn
= false );
71 SwFormatFooter( SwFrameFormat
*pFooterFormat
);
72 SwFormatFooter( const SwFormatFooter
&rCpy
);
73 virtual ~SwFormatFooter() override
;
74 SwFormatFooter
& operator=( const SwFormatFooter
&rCpy
);
77 /// "pure virtual methods" of SfxPoolItem
78 virtual bool operator==( const SfxPoolItem
& ) const override
;
79 virtual SwFormatFooter
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
80 virtual bool GetPresentation( SfxItemPresentation ePres
,
84 const IntlWrapper
& rIntl
) const override
;
86 const SwFrameFormat
*GetFooterFormat() const { return static_cast<const SwFrameFormat
*>(GetRegisteredIn()); }
87 SwFrameFormat
*GetFooterFormat() { return static_cast<SwFrameFormat
*>(GetRegisteredIn()); }
89 void RegisterToFormat( SwFormat
& rFormat
);
90 bool IsActive() const { return m_bActive
; }
91 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
94 inline const SwFormatHeader
&SwAttrSet::GetHeader(bool bInP
) const
95 { return Get( RES_HEADER
,bInP
); }
96 inline const SwFormatFooter
&SwAttrSet::GetFooter(bool bInP
) const
97 { return Get( RES_FOOTER
,bInP
); }
99 inline const SwFormatHeader
&SwFormat::GetHeader(bool bInP
) const
100 { return m_aSet
.GetHeader(bInP
); }
101 inline const SwFormatFooter
&SwFormat::GetFooter(bool bInP
) const
102 { return m_aSet
.GetFooter(bInP
); }
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */