xref: /aoo4110/main/sw/inc/fmtftntx.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _FMTFTNTX_HXX
24 #define _FMTFTNTX_HXX
25 
26 #include <svl/eitem.hxx>
27 #include <hintids.hxx>
28 #include <format.hxx>
29 #include <numrule.hxx>
30 #include "swdllapi.h"
31 
32 enum SwFtnEndPosEnum
33 {
34 	FTNEND_ATPGORDOCEND,				// at page or document end
35 	FTNEND_ATTXTEND,					// at end of the current text end
36 	FTNEND_ATTXTEND_OWNNUMSEQ,			// -""- and with own number sequence
37 	FTNEND_ATTXTEND_OWNNUMANDFMT,		// -""- and with onw numberformat
38 	FTNEND_ATTXTEND_END
39 };
40 
41 
42 class SW_DLLPUBLIC SwFmtFtnEndAtTxtEnd : public SfxEnumItem
43 {
44 	String 		sPrefix;
45 	String 		sSuffix;
46 	SvxNumberType aFmt;
47 	sal_uInt16 	  	nOffset;
48 
49 protected:
SwFmtFtnEndAtTxtEnd(sal_uInt16 nWhichL,SwFtnEndPosEnum ePos)50     SwFmtFtnEndAtTxtEnd( sal_uInt16 nWhichL, SwFtnEndPosEnum ePos )
51         : SfxEnumItem( nWhichL, sal::static_int_cast< sal_uInt16 >(ePos) ), nOffset( 0 )
52 	{}
SwFmtFtnEndAtTxtEnd(const SwFmtFtnEndAtTxtEnd & rAttr)53 	SwFmtFtnEndAtTxtEnd( const SwFmtFtnEndAtTxtEnd& rAttr )
54 		: SfxEnumItem( rAttr ), sPrefix( rAttr.sPrefix ),
55 		sSuffix( rAttr.sSuffix ), aFmt( rAttr.aFmt ),
56 		nOffset( rAttr.nOffset )
57 	{}
58 
59 public:
60 	virtual sal_uInt16 			GetValueCount() const;
61 
62 	virtual int				operator==( const SfxPoolItem& ) const;
63 
64 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
65 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
66 
67 // will be used at time??
68 //	void					FillVariable( SbxVariable &rVar,
69 //										  SfxMapUnit eCoreMetric,
70 //										  SfxMapUnit eUserMetric ) const;
71 //	virtual SfxArgumentError SetVariable( const SbxVariable &rVal,
72 //										  SfxMapUnit eCoreMetric,
73 //										  SfxMapUnit eUserMetric );
74 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
75 									SfxMapUnit eCoreMetric,
76 									SfxMapUnit ePresMetric,
77 									String &rText,
78                                     const IntlWrapper* pIntl = 0 ) const;
79 
IsAtEnd() const80 	inline sal_Bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); }
81 
82 	SwFmtFtnEndAtTxtEnd & operator=( const SwFmtFtnEndAtTxtEnd & rAttr );
83 
GetNumType() const84 	sal_Int16 GetNumType() const 		{ return aFmt.GetNumberingType(); }
SetNumType(sal_Int16 eType)85 	void SetNumType( sal_Int16 eType )	{ aFmt.SetNumberingType(eType); }
86 
GetSwNumType() const87 	const SvxNumberType& GetSwNumType() const 	{ return aFmt; }
88 
GetOffset() const89 	sal_uInt16 GetOffset() const 				{ return nOffset; }
SetOffset(sal_uInt16 nOff)90 	void SetOffset( sal_uInt16 nOff ) 			{ nOffset = nOff; }
91 
GetPrefix() const92 	const String& GetPrefix() const 		{ return sPrefix; }
SetPrefix(const String & rSet)93 	void SetPrefix(const String& rSet)		{ sPrefix = rSet; }
94 
GetSuffix() const95 	const String& GetSuffix() const 		{ return sSuffix; }
SetSuffix(const String & rSet)96 	void SetSuffix(const String& rSet)		{ sSuffix = rSet; }
97 };
98 
99 class SW_DLLPUBLIC SwFmtFtnAtTxtEnd : public SwFmtFtnEndAtTxtEnd
100 {
101 public:
SwFmtFtnAtTxtEnd(SwFtnEndPosEnum ePos=FTNEND_ATPGORDOCEND)102 	SwFmtFtnAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
103 		: SwFmtFtnEndAtTxtEnd( RES_FTN_AT_TXTEND, ePos )
104 	{}
105 
106 	virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
107 };
108 
109 class SW_DLLPUBLIC SwFmtEndAtTxtEnd : public SwFmtFtnEndAtTxtEnd
110 {
111 public:
SwFmtEndAtTxtEnd(SwFtnEndPosEnum ePos=FTNEND_ATPGORDOCEND)112 	SwFmtEndAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
113 		: SwFmtFtnEndAtTxtEnd( RES_END_AT_TXTEND, ePos )
114 	{
115 		SetNumType( SVX_NUM_ROMAN_LOWER );
116 	}
117 
118 	virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
119 };
120 
GetFtnAtTxtEnd(sal_Bool bInP) const121 inline const SwFmtFtnAtTxtEnd &SwAttrSet::GetFtnAtTxtEnd(sal_Bool bInP) const
122 	{ return (const SwFmtFtnAtTxtEnd&)Get( RES_FTN_AT_TXTEND, bInP); }
GetEndAtTxtEnd(sal_Bool bInP) const123 inline const SwFmtEndAtTxtEnd &SwAttrSet::GetEndAtTxtEnd(sal_Bool bInP) const
124 	{ return (const SwFmtEndAtTxtEnd&)Get( RES_END_AT_TXTEND, bInP); }
125 
126 
GetFtnAtTxtEnd(sal_Bool bInP) const127 inline const SwFmtFtnAtTxtEnd &SwFmt::GetFtnAtTxtEnd(sal_Bool bInP) const
128 	{ return aSet.GetFtnAtTxtEnd(bInP); }
GetEndAtTxtEnd(sal_Bool bInP) const129 inline const SwFmtEndAtTxtEnd &SwFmt::GetEndAtTxtEnd(sal_Bool bInP) const
130 	{ return aSet.GetEndAtTxtEnd(bInP); }
131 
132 #endif
133 
134