Line data Source code
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 : class SwFormat;
30 :
31 : /** Header, for PageFormats
32 : Client of FrameFormat describing the header. */
33 :
34 : class SW_DLLPUBLIC SwFormatHeader: public SfxPoolItem, public SwClient
35 : {
36 : bool bActive; ///< Only for controlling (creation of content).
37 :
38 : public:
39 : SwFormatHeader( bool bOn = false );
40 : SwFormatHeader( SwFrameFormat *pHeaderFormat );
41 : SwFormatHeader( const SwFormatHeader &rCpy );
42 : virtual ~SwFormatHeader();
43 : SwFormatHeader& operator=( const SwFormatHeader &rCpy );
44 :
45 : TYPEINFO_OVERRIDE();
46 :
47 : /// "pure virtual methods" of SfxPoolItem
48 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
49 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
50 : virtual bool GetPresentation( SfxItemPresentation ePres,
51 : SfxMapUnit eCoreMetric,
52 : SfxMapUnit ePresMetric,
53 : OUString &rText,
54 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
55 :
56 25346 : const SwFrameFormat *GetHeaderFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); }
57 34650 : SwFrameFormat *GetHeaderFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); }
58 :
59 : void RegisterToFormat( SwFormat& rFormat );
60 121555 : bool IsActive() const { return bActive; }
61 : void SetActive( bool bNew = true ) { bActive = bNew; }
62 : };
63 :
64 : /**Footer, for pageformats
65 : Client of FrameFormat describing the footer */
66 :
67 : class SW_DLLPUBLIC SwFormatFooter: public SfxPoolItem, public SwClient
68 : {
69 : bool bActive; // Only for controlling (creation of content).
70 :
71 : public:
72 : SwFormatFooter( bool bOn = false );
73 : SwFormatFooter( SwFrameFormat *pFooterFormat );
74 : SwFormatFooter( const SwFormatFooter &rCpy );
75 : virtual ~SwFormatFooter();
76 : SwFormatFooter& operator=( const SwFormatFooter &rCpy );
77 :
78 : TYPEINFO_OVERRIDE();
79 :
80 : /// "pure virtual methods" of SfxPoolItem
81 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
82 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
83 : virtual bool GetPresentation( SfxItemPresentation ePres,
84 : SfxMapUnit eCoreMetric,
85 : SfxMapUnit ePresMetric,
86 : OUString &rText,
87 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
88 :
89 18660 : const SwFrameFormat *GetFooterFormat() const { return static_cast<const SwFrameFormat*>(GetRegisteredIn()); }
90 28769 : SwFrameFormat *GetFooterFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); }
91 :
92 : void RegisterToFormat( SwFormat& rFormat );
93 121642 : bool IsActive() const { return bActive; }
94 : void SetActive( bool bNew = true ) { bActive = bNew; }
95 : };
96 :
97 94813 : inline const SwFormatHeader &SwAttrSet::GetHeader(bool bInP) const
98 94813 : { return static_cast<const SwFormatHeader&>(Get( RES_HEADER,bInP)); }
99 91586 : inline const SwFormatFooter &SwAttrSet::GetFooter(bool bInP) const
100 91586 : { return static_cast<const SwFormatFooter&>(Get( RES_FOOTER,bInP)); }
101 :
102 94813 : inline const SwFormatHeader &SwFormat::GetHeader(bool bInP) const
103 94813 : { return m_aSet.GetHeader(bInP); }
104 91586 : inline const SwFormatFooter &SwFormat::GetFooter(bool bInP) const
105 91586 : { return m_aSet.GetFooter(bInP); }
106 :
107 : #endif
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|