Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _FMTHDFT_HXX
29 : : #define _FMTHDFT_HXX
30 : :
31 : : #include <hintids.hxx>
32 : : #include <format.hxx>
33 : : #include <svl/poolitem.hxx>
34 : : #include <calbck.hxx>
35 : :
36 : : class SwFrmFmt;
37 : : class IntlWrapper;
38 : : class SwFmt;
39 : :
40 : : //Header, for PageFormats
41 : : //Client of FrmFmt discribing the header.
42 : :
43 : : class SW_DLLPUBLIC SwFmtHeader: public SfxPoolItem, public SwClient
44 : : {
45 : : sal_Bool bActive; // Only for controlling (creation of content).
46 : :
47 : : public:
48 : : SwFmtHeader( sal_Bool bOn = sal_False );
49 : : SwFmtHeader( SwFrmFmt *pHeaderFmt );
50 : : SwFmtHeader( const SwFmtHeader &rCpy );
51 : : ~SwFmtHeader();
52 : : SwFmtHeader& operator=( const SwFmtHeader &rCpy );
53 : :
54 : : TYPEINFO();
55 : :
56 : : // "pure virtual methods" of SfxPoolItem
57 : : virtual int operator==( const SfxPoolItem& ) const;
58 : : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
59 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
60 : : SfxMapUnit eCoreMetric,
61 : : SfxMapUnit ePresMetric,
62 : : String &rText,
63 : : const IntlWrapper* pIntl = 0 ) const;
64 : :
65 : 348 : const SwFrmFmt *GetHeaderFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
66 : 3606 : SwFrmFmt *GetHeaderFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
67 : :
68 : : void RegisterToFormat( SwFmt& rFmt );
69 : 13768 : sal_Bool IsActive() const { return bActive; }
70 : : void SetActive( sal_Bool bNew = sal_True ) { bActive = bNew; }
71 : : };
72 : :
73 : : //Footer, for pageformats
74 : : //Client of FrmFmt describing the footer
75 : :
76 : : class SW_DLLPUBLIC SwFmtFooter: public SfxPoolItem, public SwClient
77 : : {
78 : : sal_Bool bActive; // Only for controlling (creation of content).
79 : :
80 : : public:
81 : : SwFmtFooter( sal_Bool bOn = sal_False );
82 : : SwFmtFooter( SwFrmFmt *pFooterFmt );
83 : : SwFmtFooter( const SwFmtFooter &rCpy );
84 : : ~SwFmtFooter();
85 : : SwFmtFooter& operator=( const SwFmtFooter &rCpy );
86 : :
87 : : TYPEINFO();
88 : :
89 : : // "pure virtual methods" of SfxPoolItem
90 : : virtual int operator==( const SfxPoolItem& ) const;
91 : : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
92 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
93 : : SfxMapUnit eCoreMetric,
94 : : SfxMapUnit ePresMetric,
95 : : String &rText,
96 : : const IntlWrapper* pIntl = 0 ) const;
97 : :
98 : 261 : const SwFrmFmt *GetFooterFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
99 : 3120 : SwFrmFmt *GetFooterFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
100 : :
101 : : void RegisterToFormat( SwFmt& rFmt );
102 : 13693 : sal_Bool IsActive() const { return bActive; }
103 : : void SetActive( sal_Bool bNew = sal_True ) { bActive = bNew; }
104 : : };
105 : :
106 : 9901 : inline const SwFmtHeader &SwAttrSet::GetHeader(sal_Bool bInP) const
107 : 9901 : { return (const SwFmtHeader&)Get( RES_HEADER,bInP); }
108 : 9706 : inline const SwFmtFooter &SwAttrSet::GetFooter(sal_Bool bInP) const
109 : 9706 : { return (const SwFmtFooter&)Get( RES_FOOTER,bInP); }
110 : :
111 : 9901 : inline const SwFmtHeader &SwFmt::GetHeader(sal_Bool bInP) const
112 : 9901 : { return aSet.GetHeader(bInP); }
113 : 9706 : inline const SwFmtFooter &SwFmt::GetFooter(sal_Bool bInP) const
114 : 9706 : { return aSet.GetFooter(bInP); }
115 : :
116 : : #endif
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|