xref: /aoo41x/main/sw/inc/fmtftntx.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 _FMTFTNTX_HXX
28 #define _FMTFTNTX_HXX
29 
30 #include <svl/eitem.hxx>
31 #include <hintids.hxx>
32 #include <format.hxx>
33 #include <numrule.hxx>
34 #include "swdllapi.h"
35 
36 enum SwFtnEndPosEnum
37 {
38 	FTNEND_ATPGORDOCEND,				// at page or document end
39 	FTNEND_ATTXTEND,					// at end of the current text end
40 	FTNEND_ATTXTEND_OWNNUMSEQ,			// -""- and with own number sequence
41 	FTNEND_ATTXTEND_OWNNUMANDFMT,		// -""- and with onw numberformat
42 	FTNEND_ATTXTEND_END
43 };
44 
45 
46 class SW_DLLPUBLIC SwFmtFtnEndAtTxtEnd : public SfxEnumItem
47 {
48 	String 		sPrefix;
49 	String 		sSuffix;
50 	SvxNumberType aFmt;
51 	sal_uInt16 	  	nOffset;
52 
53 protected:
54     SwFmtFtnEndAtTxtEnd( sal_uInt16 nWhichL, SwFtnEndPosEnum ePos )
55         : SfxEnumItem( nWhichL, sal::static_int_cast< sal_uInt16 >(ePos) ), nOffset( 0 )
56 	{}
57 	SwFmtFtnEndAtTxtEnd( const SwFmtFtnEndAtTxtEnd& rAttr )
58 		: SfxEnumItem( rAttr ), sPrefix( rAttr.sPrefix ),
59 		sSuffix( rAttr.sSuffix ), aFmt( rAttr.aFmt ),
60 		nOffset( rAttr.nOffset )
61 	{}
62 
63 public:
64 	virtual sal_uInt16 			GetValueCount() const;
65 
66 	virtual int				operator==( const SfxPoolItem& ) const;
67 
68 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
69 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
70 
71 // will be used at time??
72 //	void					FillVariable( SbxVariable &rVar,
73 //										  SfxMapUnit eCoreMetric,
74 //										  SfxMapUnit eUserMetric ) const;
75 //	virtual SfxArgumentError SetVariable( const SbxVariable &rVal,
76 //										  SfxMapUnit eCoreMetric,
77 //										  SfxMapUnit eUserMetric );
78 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
79 									SfxMapUnit eCoreMetric,
80 									SfxMapUnit ePresMetric,
81 									String &rText,
82                                     const IntlWrapper* pIntl = 0 ) const;
83 
84 	inline sal_Bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); }
85 
86 	SwFmtFtnEndAtTxtEnd & operator=( const SwFmtFtnEndAtTxtEnd & rAttr );
87 
88 	sal_Int16 GetNumType() const 		{ return aFmt.GetNumberingType(); }
89 	void SetNumType( sal_Int16 eType )	{ aFmt.SetNumberingType(eType); }
90 
91 	const SvxNumberType& GetSwNumType() const 	{ return aFmt; }
92 
93 	sal_uInt16 GetOffset() const 				{ return nOffset; }
94 	void SetOffset( sal_uInt16 nOff ) 			{ nOffset = nOff; }
95 
96 	const String& GetPrefix() const 		{ return sPrefix; }
97 	void SetPrefix(const String& rSet)		{ sPrefix = rSet; }
98 
99 	const String& GetSuffix() const 		{ return sSuffix; }
100 	void SetSuffix(const String& rSet)		{ sSuffix = rSet; }
101 };
102 
103 class SW_DLLPUBLIC SwFmtFtnAtTxtEnd : public SwFmtFtnEndAtTxtEnd
104 {
105 public:
106 	SwFmtFtnAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
107 		: SwFmtFtnEndAtTxtEnd( RES_FTN_AT_TXTEND, ePos )
108 	{}
109 
110 	virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
111 };
112 
113 class SW_DLLPUBLIC SwFmtEndAtTxtEnd : public SwFmtFtnEndAtTxtEnd
114 {
115 public:
116 	SwFmtEndAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
117 		: SwFmtFtnEndAtTxtEnd( RES_END_AT_TXTEND, ePos )
118 	{
119 		SetNumType( SVX_NUM_ROMAN_LOWER );
120 	}
121 
122 	virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
123 };
124 
125 inline const SwFmtFtnAtTxtEnd &SwAttrSet::GetFtnAtTxtEnd(sal_Bool bInP) const
126 	{ return (const SwFmtFtnAtTxtEnd&)Get( RES_FTN_AT_TXTEND, bInP); }
127 inline const SwFmtEndAtTxtEnd &SwAttrSet::GetEndAtTxtEnd(sal_Bool bInP) const
128 	{ return (const SwFmtEndAtTxtEnd&)Get( RES_END_AT_TXTEND, bInP); }
129 
130 
131 inline const SwFmtFtnAtTxtEnd &SwFmt::GetFtnAtTxtEnd(sal_Bool bInP) const
132 	{ return aSet.GetFtnAtTxtEnd(bInP); }
133 inline const SwFmtEndAtTxtEnd &SwFmt::GetEndAtTxtEnd(sal_Bool bInP) const
134 	{ return aSet.GetEndAtTxtEnd(bInP); }
135 
136 #endif
137 
138