xref: /aoo41x/main/sw/inc/fmthdft.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _FMTHDFT_HXX
28 #define _FMTHDFT_HXX
29 
30 #include <hintids.hxx>
31 #include <format.hxx>
32 #include <svl/poolitem.hxx>
33 #include <calbck.hxx>
34 
35 class SwFrmFmt;
36 class IntlWrapper;
37 class SwFmt;
38 
39 //Kopfzeile, fuer Seitenformate
40 //Client von FrmFmt das den Header beschreibt.
41 
42 class SW_DLLPUBLIC SwFmtHeader: public SfxPoolItem, public SwClient
43 {
44 	sal_Bool bActive;		//Nur zur Steuerung (Erzeugung des Inhaltes)
45 
46 public:
47 	SwFmtHeader( sal_Bool bOn = sal_False );
48 	SwFmtHeader( SwFrmFmt *pHeaderFmt );
49 	SwFmtHeader( const SwFmtHeader &rCpy );
50 	~SwFmtHeader();
51 	SwFmtHeader& operator=( const SwFmtHeader &rCpy );
52 
53 	TYPEINFO();
54 
55 	// "pure virtual Methoden" vom SfxPoolItem
56 	virtual int             operator==( const SfxPoolItem& ) const;
57 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
58 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
59 									SfxMapUnit eCoreMetric,
60 									SfxMapUnit ePresMetric,
61 									String &rText,
62                                     const IntlWrapper*    pIntl = 0 ) const;
63 
64 	const SwFrmFmt *GetHeaderFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
65 		  SwFrmFmt *GetHeaderFmt()		 { return (SwFrmFmt*)GetRegisteredIn(); }
66 
67     void RegisterToFormat( SwFmt& rFmt );
68 	sal_Bool IsActive() const { return bActive; }
69 	void SetActive( sal_Bool bNew = sal_True ) { bActive = bNew; }
70 };
71 
72 
73 //Fusszeile, fuer Seitenformate
74 //Client von FrmFmt das den Footer beschreibt.
75 
76 class SW_DLLPUBLIC SwFmtFooter: public SfxPoolItem, public SwClient
77 {
78 	sal_Bool bActive;		//Nur zur Steuerung (Erzeugung des Inhaltes)
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 Methoden" vom 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 	const SwFrmFmt *GetFooterFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
99 		  SwFrmFmt *GetFooterFmt()		 { return (SwFrmFmt*)GetRegisteredIn(); }
100 
101     void RegisterToFormat( SwFmt& rFmt );
102 	sal_Bool IsActive() const { return bActive; }
103 	void SetActive( sal_Bool bNew = sal_True ) { bActive = bNew; }
104 };
105 
106 inline const SwFmtHeader &SwAttrSet::GetHeader(sal_Bool bInP) const
107 	{ return (const SwFmtHeader&)Get( RES_HEADER,bInP); }
108 inline const SwFmtFooter &SwAttrSet::GetFooter(sal_Bool bInP) const
109 	{ return (const SwFmtFooter&)Get( RES_FOOTER,bInP); }
110 
111 inline const SwFmtHeader &SwFmt::GetHeader(sal_Bool bInP) const
112 	{ return aSet.GetHeader(bInP); }
113 inline const SwFmtFooter &SwFmt::GetFooter(sal_Bool bInP) const
114 	{ return aSet.GetFooter(bInP); }
115 
116 #endif
117 
118