xref: /trunk/main/sw/inc/fmtpdsc.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 _FMTPDSC_HXX
28 #define _FMTPDSC_HXX
29 
30 
31 #include <svl/poolitem.hxx>
32 #include "swdllapi.h"
33 #include <hintids.hxx>
34 #include <format.hxx>
35 #include <calbck.hxx>
36 
37 class SwPageDesc;
38 class SwHistory;
39 class SwPaM;
40 class IntlWrapper;
41 class SwEndNoteInfo;
42 
43 //Pagedescriptor
44 //Client vom SwPageDesc der durch das Attribut "beschrieben" wird.
45 
46 #define	IVER_FMTPAGEDESC_NOAUTO	((sal_uInt16)0x0001)
47 #define IVER_FMTPAGEDESC_LONGPAGE	((sal_uInt16)0x0002)
48 
49 class SW_DLLPUBLIC SwFmtPageDesc : public SfxPoolItem, public SwClient
50 {
51 	// diese "Doc"-Funktion ist friend, um nach dem kopieren das
52 	// Auto-Flag setzen zu koennen !!
53 	friend sal_Bool InsAttr( SwDoc*, const SwPaM &, const SfxItemSet&, sal_uInt16,
54 						SwHistory* );
55 	sal_uInt16 nNumOffset;			// Seitennummer Offset
56 	sal_uInt16 nDescNameIdx;		// SW3-Reader: Stringpool-Index des Vorlagennamens
57 	SwModify* pDefinedIn;		// Verweis auf das Objekt, in dem das
58 								// Attribut gesetzt wurde (CntntNode/Format)
59 protected:
60     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
61     virtual void SwClientNotify( const SwModify&, const SfxHint& rHint );
62 
63 public:
64 	SwFmtPageDesc( const SwPageDesc *pDesc = 0 );
65 	SwFmtPageDesc( const SwFmtPageDesc &rCpy );
66 	SwFmtPageDesc &operator=( const SwFmtPageDesc &rCpy );
67 	~SwFmtPageDesc();
68 
69 	TYPEINFO();
70 
71 	// "pure virtual Methoden" vom SfxPoolItem
72 	virtual int             operator==( const SfxPoolItem& ) const;
73 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
74 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
75 									SfxMapUnit eCoreMetric,
76 									SfxMapUnit ePresMetric,
77 									String &rText,
78                                     const IntlWrapper*    pIntl = 0 ) const;
79 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
80 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
81 
82 		  SwPageDesc *GetPageDesc() { return (SwPageDesc*)GetRegisteredIn(); }
83 	const SwPageDesc *GetPageDesc() const { return (SwPageDesc*)GetRegisteredIn(); }
84 
85 	sal_uInt16	GetNumOffset() const		{ return nNumOffset; }
86 	void	SetNumOffset( sal_uInt16 nNum ) { nNumOffset = nNum; }
87 
88 	// erfrage/setze, wo drin das Attribut verankert ist
89 	inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
90 	void ChgDefinedIn( const SwModify* pNew ) { pDefinedIn = (SwModify*)pNew; }
91     void RegisterToEndNotInfo( SwEndNoteInfo& );
92     void RegisterToPageDesc( SwPageDesc& );
93     bool KnowsPageDesc() const;
94 };
95 
96 
97 inline const SwFmtPageDesc &SwAttrSet::GetPageDesc(sal_Bool bInP) const
98 	{ return (const SwFmtPageDesc&)Get( RES_PAGEDESC,bInP); }
99 
100 inline const SwFmtPageDesc &SwFmt::GetPageDesc(sal_Bool bInP) const
101 	{ return aSet.GetPageDesc(bInP); }
102 
103 #endif
104 
105