LibreOffice Module sw (master)  1
fmthdft.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 #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 class IntlWrapper;
29 
34 {
35  bool const m_bActive;
36 
37 public:
38  SwFormatHeader( bool bOn = false );
39  SwFormatHeader( SwFrameFormat *pHeaderFormat );
40  SwFormatHeader( const SwFormatHeader &rCpy );
41  virtual ~SwFormatHeader() override;
42  SwFormatHeader& operator=( const SwFormatHeader &rCpy );
43 
44 
46  virtual bool operator==( const SfxPoolItem& ) const override;
47  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
48  virtual bool GetPresentation( SfxItemPresentation ePres,
49  MapUnit eCoreMetric,
50  MapUnit ePresMetric,
51  OUString &rText,
52  const IntlWrapper& rIntl ) const override;
53 
54  const SwFrameFormat *GetHeaderFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); }
56 
57  void RegisterToFormat( SwFormat& rFormat );
58  bool IsActive() const { return m_bActive; }
59 };
60 
65 {
66  bool const m_bActive; // Only for controlling (creation of content).
67 
68 public:
69  SwFormatFooter( bool bOn = false );
70  SwFormatFooter( SwFrameFormat *pFooterFormat );
71  SwFormatFooter( const SwFormatFooter &rCpy );
72  virtual ~SwFormatFooter() override;
73  SwFormatFooter& operator=( const SwFormatFooter &rCpy );
74 
75 
77  virtual bool operator==( const SfxPoolItem& ) const override;
78  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
79  virtual bool GetPresentation( SfxItemPresentation ePres,
80  MapUnit eCoreMetric,
81  MapUnit ePresMetric,
82  OUString &rText,
83  const IntlWrapper& rIntl ) const override;
84 
85  const SwFrameFormat *GetFooterFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); }
87 
88  void RegisterToFormat( SwFormat& rFormat );
89  bool IsActive() const { return m_bActive; }
90 };
91 
92 inline const SwFormatHeader &SwAttrSet::GetHeader(bool bInP) const
93  { return Get( RES_HEADER,bInP); }
94 inline const SwFormatFooter &SwAttrSet::GetFooter(bool bInP) const
95  { return Get( RES_FOOTER,bInP); }
96 
97 inline const SwFormatHeader &SwFormat::GetHeader(bool bInP) const
98  { return m_aSet.GetHeader(bInP); }
99 inline const SwFormatFooter &SwFormat::GetFooter(bool bInP) const
100  { return m_aSet.GetFooter(bInP); }
101 
102 #endif
103 
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:94
#define RES_HEADER
Definition: hintids.hxx:201
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
virtual bool operator==(const SfxPoolItem &) const =0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SfxPoolItem & operator=(const SfxPoolItem &)=delete
SwAttrSet m_aSet
Definition: format.hxx:48
bool IsActive() const
Definition: fmthdft.hxx:89
SwFrameFormat * GetFooterFormat()
Definition: fmthdft.hxx:86
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
SwFrameFormat * GetHeaderFormat()
Definition: fmthdft.hxx:55
bool const m_bActive
Only for controlling (creation of content).
Definition: fmthdft.hxx:35
Base class for various Writer styles.
Definition: format.hxx:43
Style of a layout element.
Definition: frmfmt.hxx:57
SfxItemPresentation
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
bool const m_bActive
Definition: fmthdft.hxx:66
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:92
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
#define RES_FOOTER
Definition: hintids.hxx:202
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
MapUnit
bool IsActive() const
Definition: fmthdft.hxx:58
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54