1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tstpitem.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_TSPTITEM_HXX
31 #define _SVX_TSPTITEM_HXX
33 // include ---------------------------------------------------------------
35 #ifndef _SFXPOOLITEM_HXX //autogen
36 #include <bf_svtools/poolitem.hxx>
38 #ifndef _SVX_SVXENUM_HXX //autogen
39 #include <bf_svx/svxenum.hxx>
41 #ifndef _SVX_SVXIDS_HRC
42 #include <bf_svx/svxids.hrc>
46 // class SvxTabStop ------------------------------------------------------
48 #define SVX_TAB_DEFCOUNT 10
49 #define SVX_TAB_DEFDIST 1134 // 2cm in twips
50 #define SVX_TAB_NOTFOUND USHRT_MAX
51 #define cDfltDecimalChar (sal_Unicode(0x00)) // aus IntlWrapper besorgen
52 #define cDfltFillChar (sal_Unicode(' '))
59 SvxTabAdjust eAdjustment
;
63 friend SvStream
& operator<<( SvStream
&, SvxTabStop
& );
68 SvxTabStop( const long nPos
,
69 const SvxTabAdjust eAdjst
= SVX_TAB_ADJUST_LEFT
,
70 const sal_Unicode cDec
= cDfltDecimalChar
,
71 const sal_Unicode cFil
= cDfltFillChar
);
73 SvxTabStop::SvxTabStop( const long nPos
,
74 const SvxTabAdjust eAdjst
= SVX_TAB_ADJUST_LEFT
,
75 const sal_Unicode cDec
= cDfltDecimalChar
,
76 const sal_Unicode cFil
= cDfltFillChar
);
79 long& GetTabPos() { return nTabPos
; }
80 long GetTabPos() const { return nTabPos
; }
82 SvxTabAdjust
& GetAdjustment() { return eAdjustment
; }
83 SvxTabAdjust
GetAdjustment() const { return eAdjustment
; }
85 sal_Unicode
& GetDecimal() { return cDecimal
; }
86 sal_Unicode
GetDecimal() const { return cDecimal
; }
88 sal_Unicode
& GetFill() { return cFill
; }
89 sal_Unicode
GetFill() const { return cFill
; }
92 // das "alte" operator==()
93 BOOL
IsEqual( const SvxTabStop
& rTS
) const
95 return ( nTabPos
== rTS
.nTabPos
&&
96 eAdjustment
== rTS
.eAdjustment
&&
97 cDecimal
== rTS
.cDecimal
&&
101 // Fuer das SortedArray:
102 BOOL
operator==( const SvxTabStop
& rTS
) const
103 { return nTabPos
== rTS
.nTabPos
; }
104 BOOL
operator <( const SvxTabStop
& rTS
) const
105 { return nTabPos
< rTS
.nTabPos
; }
107 SvxTabStop
& operator=( const SvxTabStop
& rTS
)
109 nTabPos
= rTS
.nTabPos
;
110 eAdjustment
= rTS
.eAdjustment
;
111 cDecimal
= rTS
.cDecimal
;
117 // class SvxTabStopItem --------------------------------------------------
119 SV_DECL_VARARR_SORT( SvxTabStopArr
, SvxTabStop
, SVX_TAB_DEFCOUNT
, 1 )
123 Dieses Item beschreibt eine Liste von TabStops.
126 class SvxTabStopItem
: public SfxPoolItem
, private SvxTabStopArr
128 //friend class SvxTabStopObject_Impl;
133 SvxTabStopItem( USHORT nWhich
= ITEMID_TABSTOP
);
134 SvxTabStopItem( const USHORT nTabs
,
136 const SvxTabAdjust eAdjst
= SVX_TAB_ADJUST_DEFAULT
,
137 USHORT nWhich
= ITEMID_TABSTOP
);
138 SvxTabStopItem( const SvxTabStopItem
& rTSI
);
140 // Liefert Index-Position des Tabs zurueck oder TAB_NOTFOUND
141 USHORT
GetPos( const SvxTabStop
& rTab
) const;
143 // Liefert Index-Position des Tabs an nPos zurueck oder TAB_NOTFOUND
146 USHORT
Count() const { return SvxTabStopArr::Count(); }
147 BOOL
Insert( const SvxTabStop
& rTab
);
148 void Remove( SvxTabStop
& rTab
)
149 { SvxTabStopArr::Remove( rTab
); }
150 void Remove( const USHORT nPos
, const USHORT nLen
= 1 )
151 { SvxTabStopArr::Remove( nPos
, nLen
); }
153 // Zuweisungsoperator, Gleichheitsoperator (vorsicht: teuer!)
155 int operator!=( const SvxTabStopItem
& rTSI
) const
156 { return !( operator==( rTSI
) ); }
158 // SortedArrays liefern nur Stackobjekte zurueck!
159 const SvxTabStop
& operator[]( const USHORT nPos
) const
161 DBG_ASSERT( GetStart() &&
162 nPos
< Count(), "op[]" );
163 return *( GetStart() + nPos
);
165 const SvxTabStop
* GetStart() const
166 { return SvxTabStopArr::GetData(); }
168 // "pure virtual Methoden" vom SfxPoolItem
169 virtual int operator==( const SfxPoolItem
& ) const;
170 virtual sal_Bool
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 ) const;
171 virtual sal_Bool
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 );
174 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
175 virtual SfxPoolItem
* Create( SvStream
&, USHORT
) const;
176 virtual SvStream
& Store( SvStream
& , USHORT nItemVersion
) const;
179 }//end of namespace binfilter