xref: /AOO41X/main/editeng/source/items/paraitem.cxx (revision ae2dc0fa19335fe713e6dbbf20d81f8e1d5c6ee5)
1190118d0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3190118d0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4190118d0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5190118d0SAndrew Rist  * distributed with this work for additional information
6190118d0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7190118d0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8190118d0SAndrew Rist  * "License"); you may not use this file except in compliance
9190118d0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11190118d0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13190118d0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14190118d0SAndrew Rist  * software distributed under the License is distributed on an
15190118d0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16190118d0SAndrew Rist  * KIND, either express or implied.  See the License for the
17190118d0SAndrew Rist  * specific language governing permissions and limitations
18190118d0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20190118d0SAndrew Rist  *************************************************************/
21190118d0SAndrew Rist 
22190118d0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_editeng.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <com/sun/star/style/TabStop.hpp>
29cdf0e10cSrcweir #include <com/sun/star/style/LineSpacing.hpp>
30cdf0e10cSrcweir #include <com/sun/star/style/LineSpacingMode.hpp>
31cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
32cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
33cdf0e10cSrcweir #include <unotools/syslocale.hxx>
34cdf0e10cSrcweir #include <comphelper/types.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir using namespace ::rtl;
37cdf0e10cSrcweir using namespace ::com::sun::star;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <tools/rtti.hxx>
40cdf0e10cSrcweir #define GLOBALOVERFLOW3
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #define _SVX_PARAITEM_CXX
43cdf0e10cSrcweir #include <svl/itempool.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include <svl/memberid.hrc>
46cdf0e10cSrcweir #include <editeng/editrids.hrc>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
49cdf0e10cSrcweir #include <editeng/adjitem.hxx>
50cdf0e10cSrcweir #include <editeng/orphitem.hxx>
51cdf0e10cSrcweir #include <editeng/widwitem.hxx>
52cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
53cdf0e10cSrcweir #include <editeng/pmdlitem.hxx>
54cdf0e10cSrcweir #include <editeng/spltitem.hxx>
55cdf0e10cSrcweir #include <editeng/hyznitem.hxx>
56cdf0e10cSrcweir #include <editeng/scriptspaceitem.hxx>
57cdf0e10cSrcweir #include <editeng/hngpnctitem.hxx>
58cdf0e10cSrcweir #include <editeng/forbiddenruleitem.hxx>
59cdf0e10cSrcweir #include <editeng/paravertalignitem.hxx>
60cdf0e10cSrcweir #include <editeng/pgrditem.hxx>
61cdf0e10cSrcweir #include <rtl/ustring.hxx>
62cdf0e10cSrcweir #include <editeng/memberids.hrc>
63cdf0e10cSrcweir #include <editeng/editids.hrc>
64cdf0e10cSrcweir #include <editeng/itemtype.hxx>
65cdf0e10cSrcweir #include <editeng/eerdll.hxx>
66cdf0e10cSrcweir #include <editeng/paperinf.hxx>
67cdf0e10cSrcweir #include <vcl/svapp.hxx>
68cdf0e10cSrcweir #include <algorithm>
69cdf0e10cSrcweir 
70cdf0e10cSrcweir using namespace ::rtl;
71cdf0e10cSrcweir using namespace ::com::sun::star;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir // Konvertierung fuer UNO
74cdf0e10cSrcweir #define TWIP_TO_MM100(TWIP) 	((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
75cdf0e10cSrcweir #define TWIP_TO_MM100_UNSIGNED(TWIP)     ((((TWIP)*127L+36L)/72L))
76cdf0e10cSrcweir #define MM100_TO_TWIP(MM100)    ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
77cdf0e10cSrcweir #define MM100_TO_TWIP_UNSIGNED(MM100)    ((((MM100)*72L+63L)/127L))
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // STATIC DATA -----------------------------------------------------------
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
83cdf0e10cSrcweir // -----------------------------------------------------------------------
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxLineSpacingItem, SfxPoolItem , new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT, 0));
87cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxAdjustItem, SfxPoolItem, new SvxAdjustItem(SVX_ADJUST_LEFT, 0));
88cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxWidowsItem, SfxByteItem, new SvxWidowsItem(0, 0));
89cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxOrphansItem, SfxByteItem, new SvxOrphansItem(0, 0));
90cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxHyphenZoneItem, SfxPoolItem, new SvxHyphenZoneItem(sal_False, 0));
91cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxTabStopItem, SfxPoolItem, new SvxTabStopItem(0));
92cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxFmtSplitItem, SfxBoolItem, new SvxFmtSplitItem(sal_False, 0));
93cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxPageModelItem, SfxStringItem, new SvxPageModelItem(0));
94cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxScriptSpaceItem, SfxBoolItem, new SvxScriptSpaceItem(sal_False, 0));
95cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxHangingPunctuationItem, SfxBoolItem, new SvxHangingPunctuationItem(sal_False, 0));
96cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxForbiddenRuleItem, SfxBoolItem, new SvxForbiddenRuleItem(sal_False, 0));
97cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxParaVertAlignItem, SfxUInt16Item, new SvxParaVertAlignItem(0, 0));
98cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxParaGridItem, SfxBoolItem, new SvxParaGridItem(sal_True, 0));
99cdf0e10cSrcweir 
SV_IMPL_VARARR_SORT(SvxTabStopArr,SvxTabStop)100cdf0e10cSrcweir SV_IMPL_VARARR_SORT( SvxTabStopArr, SvxTabStop )
101cdf0e10cSrcweir 
102cdf0e10cSrcweir // -----------------------------------------------------------------------
103cdf0e10cSrcweir 
104cdf0e10cSrcweir SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight, const sal_uInt16 nId )
105cdf0e10cSrcweir 	: SfxEnumItemInterface( nId )
106cdf0e10cSrcweir {
107cdf0e10cSrcweir 	nPropLineSpace = 100;
108cdf0e10cSrcweir 	nInterLineSpace = 0;
109cdf0e10cSrcweir 	nLineHeight = nHeight;
110cdf0e10cSrcweir 	eLineSpace = SVX_LINE_SPACE_AUTO;
111cdf0e10cSrcweir 	eInterLineSpace = SVX_INTER_LINE_SPACE_OFF;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir // -----------------------------------------------------------------------
115cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rAttr) const116cdf0e10cSrcweir int SvxLineSpacingItem::operator==( const SfxPoolItem& rAttr ) const
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	const SvxLineSpacingItem& rLineSpace = (const SvxLineSpacingItem&)rAttr;
121cdf0e10cSrcweir 	return (
122cdf0e10cSrcweir 		// Gleiche Linespacing Rule?
123cdf0e10cSrcweir 		(eLineSpace == rLineSpace.eLineSpace)
124cdf0e10cSrcweir 		// Bei maximalem und minimalem Linespacing muss das Mass
125cdf0e10cSrcweir 		// uebereinstimmen.
126cdf0e10cSrcweir 		&& (eLineSpace == SVX_LINE_SPACE_AUTO ||
127cdf0e10cSrcweir 			nLineHeight == rLineSpace.nLineHeight)
128cdf0e10cSrcweir 		// Gleiche Interlinespacing Rule?
129cdf0e10cSrcweir 		&& ( eInterLineSpace == rLineSpace.eInterLineSpace )
130cdf0e10cSrcweir 		// Entweder proportional oder draufaddieren eingestellt.
131cdf0e10cSrcweir 		&& (( eInterLineSpace == SVX_INTER_LINE_SPACE_OFF)
132cdf0e10cSrcweir 			|| (eInterLineSpace == SVX_INTER_LINE_SPACE_PROP
133cdf0e10cSrcweir 				&& nPropLineSpace == rLineSpace.nPropLineSpace)
134cdf0e10cSrcweir 			|| (eInterLineSpace == SVX_INTER_LINE_SPACE_FIX
135cdf0e10cSrcweir 				&& (nInterLineSpace == rLineSpace.nInterLineSpace)))) ?
136cdf0e10cSrcweir 				1 : 0;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir /*-----------------18.03.98 16:32-------------------
140cdf0e10cSrcweir 	os: wer weiss noch, wieso das LineSpacingItem so
141cdf0e10cSrcweir 	kompliziert ist? Fuer UNO koennen wir das nicht
142cdf0e10cSrcweir 	gebrauchen. Da gibt es nur zwei Werte:
143cdf0e10cSrcweir 		- ein sal_uInt16 fuer den Modus
144cdf0e10cSrcweir 		- ein sal_uInt32 fuer alle Werte (Abstand, Hoehe, rel. Angaben)
145cdf0e10cSrcweir 
146cdf0e10cSrcweir --------------------------------------------------*/
QueryValue(uno::Any & rVal,sal_uInt8 nMemberId) const147cdf0e10cSrcweir sal_Bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
148cdf0e10cSrcweir {
149cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
150cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	style::LineSpacing aLSp;
153cdf0e10cSrcweir 	switch( eLineSpace )
154cdf0e10cSrcweir 	{
155cdf0e10cSrcweir 		case SVX_LINE_SPACE_AUTO:
156cdf0e10cSrcweir 			if(eInterLineSpace == SVX_INTER_LINE_SPACE_FIX)
157cdf0e10cSrcweir 			{
158cdf0e10cSrcweir 				aLSp.Mode = style::LineSpacingMode::LEADING;
159cdf0e10cSrcweir                 aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100(nInterLineSpace) : nInterLineSpace);
160cdf0e10cSrcweir 			}
161cdf0e10cSrcweir 			else if(eInterLineSpace == SVX_INTER_LINE_SPACE_OFF)
162cdf0e10cSrcweir 			{
163cdf0e10cSrcweir 				aLSp.Mode = style::LineSpacingMode::PROP;
164cdf0e10cSrcweir 				aLSp.Height = 100;
165cdf0e10cSrcweir 			}
166cdf0e10cSrcweir 			else
167cdf0e10cSrcweir 			{
168cdf0e10cSrcweir 				aLSp.Mode = style::LineSpacingMode::PROP;
169cdf0e10cSrcweir 				aLSp.Height = nPropLineSpace;
170cdf0e10cSrcweir 			}
171cdf0e10cSrcweir 		break;
172cdf0e10cSrcweir 		case SVX_LINE_SPACE_FIX :
173cdf0e10cSrcweir 		case SVX_LINE_SPACE_MIN :
174cdf0e10cSrcweir 			aLSp.Mode = eLineSpace == SVX_LINE_SPACE_FIX ? style::LineSpacingMode::FIX : style::LineSpacingMode::MINIMUM;
175cdf0e10cSrcweir             aLSp.Height = ( bConvert ? (short)TWIP_TO_MM100_UNSIGNED(nLineHeight) : nLineHeight );
176cdf0e10cSrcweir 		break;
177cdf0e10cSrcweir         default:
178cdf0e10cSrcweir             ;//prevent warning about SVX_LINE_SPACE_END
179cdf0e10cSrcweir 	}
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     switch ( nMemberId )
182cdf0e10cSrcweir     {
183cdf0e10cSrcweir         case 0 :                rVal <<= aLSp; break;
184cdf0e10cSrcweir         case MID_LINESPACE :    rVal <<= aLSp.Mode; break;
185cdf0e10cSrcweir         case MID_HEIGHT :       rVal <<= aLSp.Height; break;
186cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); break;
187cdf0e10cSrcweir     }
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	return sal_True;
190cdf0e10cSrcweir }
191cdf0e10cSrcweir /*-----------------18.03.98 16:32-------------------
192cdf0e10cSrcweir 
193cdf0e10cSrcweir --------------------------------------------------*/
PutValue(const uno::Any & rVal,sal_uInt8 nMemberId)194cdf0e10cSrcweir sal_Bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
195cdf0e10cSrcweir {
196cdf0e10cSrcweir 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
197cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     // fill with current data
200cdf0e10cSrcweir 	style::LineSpacing aLSp;
201cdf0e10cSrcweir     uno::Any aAny;
202cdf0e10cSrcweir     sal_Bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aLSp );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir     // get new data
205cdf0e10cSrcweir     switch ( nMemberId )
206cdf0e10cSrcweir     {
207cdf0e10cSrcweir         case 0 :                bRet = (rVal >>= aLSp); break;
208cdf0e10cSrcweir         case MID_LINESPACE :    bRet = (rVal >>= aLSp.Mode); break;
209cdf0e10cSrcweir         case MID_HEIGHT :       bRet = (rVal >>= aLSp.Height); break;
210cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); break;
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     if( bRet )
214cdf0e10cSrcweir     {
215cdf0e10cSrcweir         nLineHeight = aLSp.Height;
216cdf0e10cSrcweir         switch( aLSp.Mode )
217cdf0e10cSrcweir         {
218cdf0e10cSrcweir             case style::LineSpacingMode::LEADING:
219cdf0e10cSrcweir             {
220cdf0e10cSrcweir                 eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
221cdf0e10cSrcweir                 eLineSpace = SVX_LINE_SPACE_AUTO;
222cdf0e10cSrcweir                 nInterLineSpace = aLSp.Height;
223cdf0e10cSrcweir                 if(bConvert)
224cdf0e10cSrcweir                     nInterLineSpace = (short)MM100_TO_TWIP(nInterLineSpace);
225cdf0e10cSrcweir 
226cdf0e10cSrcweir             }
227cdf0e10cSrcweir             break;
228cdf0e10cSrcweir             case style::LineSpacingMode::PROP:
229cdf0e10cSrcweir             {
230cdf0e10cSrcweir                 eLineSpace = SVX_LINE_SPACE_AUTO;
231cdf0e10cSrcweir                 nPropLineSpace = (sal_Int8)std::min(aLSp.Height, (short)0xFF);
232cdf0e10cSrcweir                 if(100 == aLSp.Height)
233cdf0e10cSrcweir                     eInterLineSpace = SVX_INTER_LINE_SPACE_OFF;
234cdf0e10cSrcweir                 else
235cdf0e10cSrcweir                     eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
236cdf0e10cSrcweir             }
237cdf0e10cSrcweir             break;
238cdf0e10cSrcweir             case style::LineSpacingMode::FIX:
239cdf0e10cSrcweir             case style::LineSpacingMode::MINIMUM:
240cdf0e10cSrcweir             {
241cdf0e10cSrcweir                 eInterLineSpace =  SVX_INTER_LINE_SPACE_OFF;
242cdf0e10cSrcweir                 eLineSpace = aLSp.Mode == style::LineSpacingMode::FIX ? SVX_LINE_SPACE_FIX : SVX_LINE_SPACE_MIN;
243cdf0e10cSrcweir                 nLineHeight = aLSp.Height;
244cdf0e10cSrcweir                 if(bConvert)
245cdf0e10cSrcweir                     nLineHeight = (sal_uInt16)MM100_TO_TWIP_UNSIGNED(nLineHeight);
246cdf0e10cSrcweir             }
247cdf0e10cSrcweir             break;
248cdf0e10cSrcweir         }
249cdf0e10cSrcweir     }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     return bRet;
252cdf0e10cSrcweir }
253cdf0e10cSrcweir 
254cdf0e10cSrcweir // -----------------------------------------------------------------------
255cdf0e10cSrcweir 
Clone(SfxItemPool *) const256cdf0e10cSrcweir SfxPoolItem* SvxLineSpacingItem::Clone( SfxItemPool * ) const
257cdf0e10cSrcweir {
258cdf0e10cSrcweir 	return new SvxLineSpacingItem( *this );
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir //------------------------------------------------------------------------
262cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const263cdf0e10cSrcweir SfxItemPresentation SvxLineSpacingItem::GetPresentation
264cdf0e10cSrcweir (
265cdf0e10cSrcweir     SfxItemPresentation /*ePres*/,
266cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
267cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
268cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
269cdf0e10cSrcweir )	const
270cdf0e10cSrcweir {
271cdf0e10cSrcweir #ifdef DBG_UTIL
272cdf0e10cSrcweir 	rText.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SvxLineSpacingItem" ));
273cdf0e10cSrcweir #else
274cdf0e10cSrcweir 	rText.Erase();
275cdf0e10cSrcweir #endif
276cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
277cdf0e10cSrcweir }
278cdf0e10cSrcweir 
279cdf0e10cSrcweir // -----------------------------------------------------------------------
280cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const281cdf0e10cSrcweir SfxPoolItem* SvxLineSpacingItem::Create(SvStream& rStrm, sal_uInt16) const
282cdf0e10cSrcweir {
283cdf0e10cSrcweir 	sal_Int8	nPropSpace;
284cdf0e10cSrcweir 	short	nInterSpace;
285cdf0e10cSrcweir 	sal_uInt16	nHeight;
286cdf0e10cSrcweir 	sal_Int8	nRule, nInterRule;
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 	rStrm >> nPropSpace
289cdf0e10cSrcweir 		  >> nInterSpace
290cdf0e10cSrcweir 		  >> nHeight
291cdf0e10cSrcweir 		  >> nRule
292cdf0e10cSrcweir 		  >> nInterRule;
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	SvxLineSpacingItem* pAttr = new SvxLineSpacingItem( nHeight, Which() );
295cdf0e10cSrcweir 	pAttr->SetInterLineSpace( nInterSpace );
296cdf0e10cSrcweir 	pAttr->SetPropLineSpace( nPropSpace );
297cdf0e10cSrcweir 	pAttr->GetLineSpaceRule() = (SvxLineSpace)nRule;
298cdf0e10cSrcweir 	pAttr->GetInterLineSpaceRule() = (SvxInterLineSpace)nInterRule;
299cdf0e10cSrcweir 	return pAttr;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir // -----------------------------------------------------------------------
303cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const304cdf0e10cSrcweir SvStream& SvxLineSpacingItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
305cdf0e10cSrcweir {
306cdf0e10cSrcweir 	rStrm << (sal_Int8)  GetPropLineSpace()
307cdf0e10cSrcweir 		  << (short)  GetInterLineSpace()
308cdf0e10cSrcweir 		  << (sal_uInt16) GetLineHeight()
309cdf0e10cSrcweir 		  << (sal_Int8)   GetLineSpaceRule()
310cdf0e10cSrcweir 		  << (sal_Int8)   GetInterLineSpaceRule();
311cdf0e10cSrcweir 	return rStrm;
312cdf0e10cSrcweir }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir // -----------------------------------------------------------------------
315cdf0e10cSrcweir 
GetValueCount() const316cdf0e10cSrcweir sal_uInt16 SvxLineSpacingItem::GetValueCount() const
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	return SVX_LINESPACE_END;	// SVX_LINESPACE_TWO_LINES + 1
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir // -----------------------------------------------------------------------
322cdf0e10cSrcweir 
GetValueTextByPos(sal_uInt16 nPos) const323cdf0e10cSrcweir XubString SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos ) const
324cdf0e10cSrcweir {
325cdf0e10cSrcweir 	//! Strings demnaechst aus Resource laden
326cdf0e10cSrcweir 	XubString aText;
327cdf0e10cSrcweir 	switch ( nPos )
328cdf0e10cSrcweir 	{
329cdf0e10cSrcweir 		case SVX_LINESPACE_USER					: aText.AppendAscii( "Benutzer" );	break;
330cdf0e10cSrcweir 		case SVX_LINESPACE_ONE_LINE				: aText.AppendAscii( "Einzeilig" );	break;
331cdf0e10cSrcweir 		case SVX_LINESPACE_ONE_POINT_FIVE_LINES	: aText.AppendAscii( "1,5zeilig" );	break;
332cdf0e10cSrcweir 		case SVX_LINESPACE_TWO_LINES			: aText.AppendAscii( "Zweizeilig" );	break;
333cdf0e10cSrcweir 	}
334cdf0e10cSrcweir 	return aText;
335cdf0e10cSrcweir }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir // -----------------------------------------------------------------------
338cdf0e10cSrcweir 
GetEnumValue() const339cdf0e10cSrcweir sal_uInt16 SvxLineSpacingItem::GetEnumValue() const
340cdf0e10cSrcweir {
341cdf0e10cSrcweir 	sal_uInt16 nVal;
342cdf0e10cSrcweir 	switch ( nPropLineSpace )
343cdf0e10cSrcweir 	{
344cdf0e10cSrcweir 		case 100:	nVal = SVX_LINESPACE_ONE_LINE; 				break;
345cdf0e10cSrcweir 		case 150:	nVal = SVX_LINESPACE_ONE_POINT_FIVE_LINES;	break;
346cdf0e10cSrcweir 		case 200:	nVal = SVX_LINESPACE_TWO_LINES;				break;
347cdf0e10cSrcweir 		default:	nVal = SVX_LINESPACE_USER;					break;
348cdf0e10cSrcweir 	}
349cdf0e10cSrcweir 	return nVal;
350cdf0e10cSrcweir }
351cdf0e10cSrcweir 
352cdf0e10cSrcweir // -----------------------------------------------------------------------
353cdf0e10cSrcweir 
SetEnumValue(sal_uInt16 nVal)354cdf0e10cSrcweir void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal )
355cdf0e10cSrcweir {
356cdf0e10cSrcweir 	switch ( nVal )
357cdf0e10cSrcweir 	{
358cdf0e10cSrcweir 		case SVX_LINESPACE_ONE_LINE:			 nPropLineSpace = 100; break;
359cdf0e10cSrcweir 		case SVX_LINESPACE_ONE_POINT_FIVE_LINES: nPropLineSpace = 150; break;
360cdf0e10cSrcweir 		case SVX_LINESPACE_TWO_LINES:			 nPropLineSpace = 200; break;
361cdf0e10cSrcweir 	}
362cdf0e10cSrcweir }
363cdf0e10cSrcweir 
364cdf0e10cSrcweir // class SvxAdjustItem ---------------------------------------------------
365cdf0e10cSrcweir 
SvxAdjustItem(const SvxAdjust eAdjst,const sal_uInt16 nId)366cdf0e10cSrcweir SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId )
367cdf0e10cSrcweir 	: SfxEnumItemInterface( nId ),
368cdf0e10cSrcweir 	bOneBlock( sal_False ), bLastCenter( sal_False ), bLastBlock( sal_False )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir 	SetAdjust( eAdjst );
371cdf0e10cSrcweir }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir // -----------------------------------------------------------------------
374cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rAttr) const375cdf0e10cSrcweir int SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const
376cdf0e10cSrcweir {
377cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 	return( ( GetAdjust() == ((SvxAdjustItem&)rAttr).GetAdjust() &&
380cdf0e10cSrcweir 		bOneBlock == ((SvxAdjustItem&)rAttr).bOneBlock &&
381cdf0e10cSrcweir 		bLastCenter == ((SvxAdjustItem&)rAttr).bLastCenter &&
382cdf0e10cSrcweir 		bLastBlock == ((SvxAdjustItem&)rAttr).bLastBlock )
383cdf0e10cSrcweir 		? 1 : 0 );
384cdf0e10cSrcweir }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir /*-----------------18.03.98 16:15-------------------
387cdf0e10cSrcweir 
388cdf0e10cSrcweir --------------------------------------------------*/
QueryValue(uno::Any & rVal,sal_uInt8 nMemberId) const389cdf0e10cSrcweir sal_Bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
390cdf0e10cSrcweir {
391cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
392cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
393cdf0e10cSrcweir 	switch( nMemberId )
394cdf0e10cSrcweir 	{
395cdf0e10cSrcweir 		case MID_PARA_ADJUST	  :	rVal <<= (sal_Int16)GetAdjust(); break;
396cdf0e10cSrcweir 		case MID_LAST_LINE_ADJUST : rVal <<= (sal_Int16)GetLastBlock(); break;
397cdf0e10cSrcweir 		case MID_EXPAND_SINGLE    :
398cdf0e10cSrcweir 		{
399cdf0e10cSrcweir 			sal_Bool bValue = bOneBlock;
400cdf0e10cSrcweir 			rVal.setValue( &bValue, ::getCppuBooleanType() );
401cdf0e10cSrcweir 			break;
402cdf0e10cSrcweir 		}
403cdf0e10cSrcweir         default: ;//prevent warning
404cdf0e10cSrcweir     }
405cdf0e10cSrcweir 	return sal_True;
406cdf0e10cSrcweir }
407cdf0e10cSrcweir /*-----------------18.03.98 16:15-------------------
408cdf0e10cSrcweir 
409cdf0e10cSrcweir --------------------------------------------------*/
410cdf0e10cSrcweir 
PutValue(const uno::Any & rVal,sal_uInt8 nMemberId)411cdf0e10cSrcweir sal_Bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId  )
412cdf0e10cSrcweir {
413cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
414cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
415cdf0e10cSrcweir 	switch( nMemberId )
416cdf0e10cSrcweir 	{
417cdf0e10cSrcweir 		case MID_PARA_ADJUST			  :
418cdf0e10cSrcweir 		case MID_LAST_LINE_ADJUST :
419cdf0e10cSrcweir 		{
420cdf0e10cSrcweir 			sal_Int32 eVal = - 1;
421cdf0e10cSrcweir 			try
422cdf0e10cSrcweir 			{
423cdf0e10cSrcweir 				eVal = ::comphelper::getEnumAsINT32(rVal);
424cdf0e10cSrcweir 			}
425cdf0e10cSrcweir 			catch(...) {}
426cdf0e10cSrcweir 			if(eVal >= 0 && eVal <= 4)
427cdf0e10cSrcweir 			{
428cdf0e10cSrcweir 				if(MID_LAST_LINE_ADJUST == nMemberId &&
429cdf0e10cSrcweir 					eVal != SVX_ADJUST_LEFT &&
430cdf0e10cSrcweir 					eVal != SVX_ADJUST_BLOCK &&
431cdf0e10cSrcweir 					eVal != SVX_ADJUST_CENTER)
432cdf0e10cSrcweir 						return sal_False;
433cdf0e10cSrcweir 				if(eVal < (sal_uInt16)SVX_ADJUST_END)
434cdf0e10cSrcweir 					nMemberId == MID_PARA_ADJUST ?
435cdf0e10cSrcweir 						SetAdjust((SvxAdjust)eVal) :
436cdf0e10cSrcweir 							SetLastBlock((SvxAdjust)eVal);
437cdf0e10cSrcweir 			}
438cdf0e10cSrcweir 		}
439cdf0e10cSrcweir 		break;
440cdf0e10cSrcweir 		case MID_EXPAND_SINGLE :
441cdf0e10cSrcweir 			bOneBlock = Any2Bool(rVal);
442cdf0e10cSrcweir 			break;
443cdf0e10cSrcweir 	}
444cdf0e10cSrcweir 	return sal_True;
445cdf0e10cSrcweir }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir // -----------------------------------------------------------------------
448cdf0e10cSrcweir 
Clone(SfxItemPool *) const449cdf0e10cSrcweir SfxPoolItem* SvxAdjustItem::Clone( SfxItemPool * ) const
450cdf0e10cSrcweir {
451cdf0e10cSrcweir 	return new SvxAdjustItem( *this );
452cdf0e10cSrcweir }
453cdf0e10cSrcweir 
454cdf0e10cSrcweir //------------------------------------------------------------------------
455cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const456cdf0e10cSrcweir SfxItemPresentation SvxAdjustItem::GetPresentation
457cdf0e10cSrcweir (
458cdf0e10cSrcweir 	SfxItemPresentation ePres,
459cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
460cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
461cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
462cdf0e10cSrcweir )	const
463cdf0e10cSrcweir {
464cdf0e10cSrcweir 	switch ( ePres )
465cdf0e10cSrcweir 	{
466cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
467cdf0e10cSrcweir 			rText.Erase();
468cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
469cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
470cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
471cdf0e10cSrcweir 			rText = GetValueTextByPos( (sal_uInt16)GetAdjust() );
472cdf0e10cSrcweir 			return ePres;
473cdf0e10cSrcweir         default: ;//prevent warning
474cdf0e10cSrcweir 	}
475cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
476cdf0e10cSrcweir }
477cdf0e10cSrcweir 
478cdf0e10cSrcweir // -----------------------------------------------------------------------
479cdf0e10cSrcweir 
GetValueCount() const480cdf0e10cSrcweir sal_uInt16 SvxAdjustItem::GetValueCount() const
481cdf0e10cSrcweir {
482cdf0e10cSrcweir 	return SVX_ADJUST_END;	// SVX_ADJUST_BLOCKLINE + 1
483cdf0e10cSrcweir }
484cdf0e10cSrcweir 
485cdf0e10cSrcweir // -----------------------------------------------------------------------
486cdf0e10cSrcweir 
GetValueTextByPos(sal_uInt16 nPos) const487cdf0e10cSrcweir XubString SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos ) const
488cdf0e10cSrcweir {
489cdf0e10cSrcweir 	DBG_ASSERT( nPos <= (sal_uInt16)SVX_ADJUST_BLOCKLINE, "enum overflow!" );
490cdf0e10cSrcweir 	return EE_RESSTR(RID_SVXITEMS_ADJUST_BEGIN + nPos);
491cdf0e10cSrcweir }
492cdf0e10cSrcweir 
493cdf0e10cSrcweir // -----------------------------------------------------------------------
494cdf0e10cSrcweir 
GetEnumValue() const495cdf0e10cSrcweir sal_uInt16 SvxAdjustItem::GetEnumValue() const
496cdf0e10cSrcweir {
497cdf0e10cSrcweir 	return (sal_uInt16)GetAdjust();
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir // -----------------------------------------------------------------------
501cdf0e10cSrcweir 
SetEnumValue(sal_uInt16 nVal)502cdf0e10cSrcweir void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal )
503cdf0e10cSrcweir {
504cdf0e10cSrcweir 	SetAdjust( (const SvxAdjust)nVal );
505cdf0e10cSrcweir }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir // -----------------------------------------------------------------------
508cdf0e10cSrcweir 
GetVersion(sal_uInt16 nFileVersion) const509cdf0e10cSrcweir sal_uInt16 SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion ) const
510cdf0e10cSrcweir {
511cdf0e10cSrcweir 	return (nFileVersion == SOFFICE_FILEFORMAT_31)
512cdf0e10cSrcweir 			   ? 0 : ADJUST_LASTBLOCK_VERSION;
513cdf0e10cSrcweir }
514cdf0e10cSrcweir 
515cdf0e10cSrcweir // -----------------------------------------------------------------------
516cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16 nVersion) const517cdf0e10cSrcweir SfxPoolItem* SvxAdjustItem::Create(SvStream& rStrm, sal_uInt16 nVersion) const
518cdf0e10cSrcweir {
519cdf0e10cSrcweir 	char eAdjustment;
520cdf0e10cSrcweir 	rStrm >> eAdjustment;
521cdf0e10cSrcweir 	SvxAdjustItem *pRet = new SvxAdjustItem( (SvxAdjust)eAdjustment, Which() );
522cdf0e10cSrcweir 	if( nVersion >= ADJUST_LASTBLOCK_VERSION )
523cdf0e10cSrcweir 	{
524cdf0e10cSrcweir 		sal_Int8 nFlags;
525cdf0e10cSrcweir 		rStrm >> nFlags;
526cdf0e10cSrcweir 		pRet->bOneBlock = 0 != (nFlags & 0x0001);
527cdf0e10cSrcweir 		pRet->bLastCenter = 0 != (nFlags & 0x0002);
528cdf0e10cSrcweir 		pRet->bLastBlock = 0 != (nFlags & 0x0004);
529cdf0e10cSrcweir 	}
530cdf0e10cSrcweir 	return pRet;
531cdf0e10cSrcweir }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir // -----------------------------------------------------------------------
534cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16 nItemVersion) const535cdf0e10cSrcweir SvStream& SvxAdjustItem::Store( SvStream& rStrm, sal_uInt16 nItemVersion ) const
536cdf0e10cSrcweir {
537cdf0e10cSrcweir 	rStrm << (char)GetAdjust();
538cdf0e10cSrcweir 	if ( nItemVersion >= ADJUST_LASTBLOCK_VERSION )
539cdf0e10cSrcweir 	{
540cdf0e10cSrcweir 		sal_Int8 nFlags = 0;
541cdf0e10cSrcweir 		if ( bOneBlock )
542cdf0e10cSrcweir 			nFlags |= 0x0001;
543cdf0e10cSrcweir 		if ( bLastCenter )
544cdf0e10cSrcweir 			nFlags |= 0x0002;
545cdf0e10cSrcweir 		if ( bLastBlock )
546cdf0e10cSrcweir 			nFlags |= 0x0004;
547cdf0e10cSrcweir 		rStrm << (sal_Int8) nFlags;
548cdf0e10cSrcweir 	}
549cdf0e10cSrcweir 	return rStrm;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir 
552cdf0e10cSrcweir // class SvxWidowsItem ---------------------------------------------------
553cdf0e10cSrcweir 
SvxWidowsItem(const sal_uInt8 nL,const sal_uInt16 nId)554cdf0e10cSrcweir SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL, const sal_uInt16 nId ) :
555cdf0e10cSrcweir 	SfxByteItem( nId, nL )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir }
558cdf0e10cSrcweir 
559cdf0e10cSrcweir // -----------------------------------------------------------------------
560cdf0e10cSrcweir 
Clone(SfxItemPool *) const561cdf0e10cSrcweir SfxPoolItem* SvxWidowsItem::Clone( SfxItemPool * ) const
562cdf0e10cSrcweir {
563cdf0e10cSrcweir 	return new SvxWidowsItem( *this );
564cdf0e10cSrcweir }
565cdf0e10cSrcweir 
566cdf0e10cSrcweir // -----------------------------------------------------------------------
567cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const568cdf0e10cSrcweir SfxPoolItem* SvxWidowsItem::Create(SvStream& rStrm, sal_uInt16) const
569cdf0e10cSrcweir {
570cdf0e10cSrcweir 	sal_Int8 nLines;
571cdf0e10cSrcweir 	rStrm >> nLines;
572cdf0e10cSrcweir 	return new SvxWidowsItem( nLines, Which() );
573cdf0e10cSrcweir }
574cdf0e10cSrcweir 
575cdf0e10cSrcweir // -----------------------------------------------------------------------
576cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const577cdf0e10cSrcweir SvStream& SvxWidowsItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
578cdf0e10cSrcweir {
579cdf0e10cSrcweir 	rStrm << (sal_Int8)GetValue();
580cdf0e10cSrcweir 	return rStrm;
581cdf0e10cSrcweir }
582cdf0e10cSrcweir 
583cdf0e10cSrcweir //------------------------------------------------------------------------
584cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const585cdf0e10cSrcweir SfxItemPresentation SvxWidowsItem::GetPresentation
586cdf0e10cSrcweir (
587cdf0e10cSrcweir 	SfxItemPresentation ePres,
588cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
589cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
590cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
591cdf0e10cSrcweir )	const
592cdf0e10cSrcweir {
593cdf0e10cSrcweir 	switch ( ePres )
594cdf0e10cSrcweir 	{
595cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
596cdf0e10cSrcweir         {
597cdf0e10cSrcweir 			rText.Erase();
598cdf0e10cSrcweir             break;
599cdf0e10cSrcweir         }
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
602cdf0e10cSrcweir         {
603cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_LINES);
604cdf0e10cSrcweir             break;
605cdf0e10cSrcweir         }
606cdf0e10cSrcweir 
607cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
608cdf0e10cSrcweir         {
609cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_WIDOWS_COMPLETE);
610cdf0e10cSrcweir 			rText += ' ';
611cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_LINES);
612cdf0e10cSrcweir         }
613cdf0e10cSrcweir 
614cdf0e10cSrcweir         default:
615cdf0e10cSrcweir         {
616cdf0e10cSrcweir             DBG_ERRORFILE( "SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" );
617cdf0e10cSrcweir         }
618cdf0e10cSrcweir     }
619cdf0e10cSrcweir 
620cdf0e10cSrcweir     rText.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
621cdf0e10cSrcweir     return ePres;
622cdf0e10cSrcweir }
623cdf0e10cSrcweir 
624cdf0e10cSrcweir // class SvxOrphansItem --------------------------------------------------
625cdf0e10cSrcweir 
SvxOrphansItem(const sal_uInt8 nL,const sal_uInt16 nId)626cdf0e10cSrcweir SvxOrphansItem::SvxOrphansItem(const sal_uInt8 nL, const sal_uInt16 nId ) :
627cdf0e10cSrcweir 	SfxByteItem( nId, nL )
628cdf0e10cSrcweir {
629cdf0e10cSrcweir }
630cdf0e10cSrcweir 
631cdf0e10cSrcweir // -----------------------------------------------------------------------
632cdf0e10cSrcweir 
Clone(SfxItemPool *) const633cdf0e10cSrcweir SfxPoolItem* SvxOrphansItem::Clone( SfxItemPool * ) const
634cdf0e10cSrcweir {
635cdf0e10cSrcweir 	return new SvxOrphansItem( *this );
636cdf0e10cSrcweir }
637cdf0e10cSrcweir 
638cdf0e10cSrcweir // -----------------------------------------------------------------------
639cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const640cdf0e10cSrcweir SfxPoolItem* SvxOrphansItem::Create(SvStream& rStrm, sal_uInt16) const
641cdf0e10cSrcweir {
642cdf0e10cSrcweir 	sal_Int8 nLines;
643cdf0e10cSrcweir 	rStrm >> nLines;
644cdf0e10cSrcweir 	return new SvxOrphansItem( nLines, Which() );
645cdf0e10cSrcweir }
646cdf0e10cSrcweir 
647cdf0e10cSrcweir // -----------------------------------------------------------------------
648cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const649cdf0e10cSrcweir SvStream& SvxOrphansItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
650cdf0e10cSrcweir {
651cdf0e10cSrcweir 	rStrm << (sal_Int8) GetValue();
652cdf0e10cSrcweir 	return rStrm;
653cdf0e10cSrcweir }
654cdf0e10cSrcweir 
655cdf0e10cSrcweir //------------------------------------------------------------------------
656cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const657cdf0e10cSrcweir SfxItemPresentation SvxOrphansItem::GetPresentation
658cdf0e10cSrcweir (
659cdf0e10cSrcweir 	SfxItemPresentation ePres,
660cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
661cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
662cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
663cdf0e10cSrcweir )	const
664cdf0e10cSrcweir {
665cdf0e10cSrcweir 	switch ( ePres )
666cdf0e10cSrcweir 	{
667cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
668cdf0e10cSrcweir         {
669cdf0e10cSrcweir 			rText.Erase();
670cdf0e10cSrcweir             break;
671cdf0e10cSrcweir         }
672cdf0e10cSrcweir 
673cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
674cdf0e10cSrcweir         {
675cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_LINES);
676cdf0e10cSrcweir             break;
677cdf0e10cSrcweir         }
678cdf0e10cSrcweir 
679cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
680cdf0e10cSrcweir         {
681cdf0e10cSrcweir 			rText = EE_RESSTR(RID_SVXITEMS_ORPHANS_COMPLETE);
682cdf0e10cSrcweir 			rText += ' ';
683cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_LINES);
684cdf0e10cSrcweir         }
685cdf0e10cSrcweir 
686cdf0e10cSrcweir         default:
687cdf0e10cSrcweir         {
688cdf0e10cSrcweir             DBG_ERRORFILE( "SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" );
689cdf0e10cSrcweir         }
690cdf0e10cSrcweir     }
691cdf0e10cSrcweir 
692cdf0e10cSrcweir     rText.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
693cdf0e10cSrcweir     return ePres;
694cdf0e10cSrcweir }
695cdf0e10cSrcweir 
696cdf0e10cSrcweir // class SvxHyphenZoneItem -----------------------------------------------
697cdf0e10cSrcweir 
SvxHyphenZoneItem(const sal_Bool bHyph,const sal_uInt16 nId)698cdf0e10cSrcweir SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph, const sal_uInt16 nId ) :
699cdf0e10cSrcweir 	SfxPoolItem( nId )
700cdf0e10cSrcweir {
701cdf0e10cSrcweir 	bHyphen = bHyph;
702cdf0e10cSrcweir 	bPageEnd = sal_True;
703cdf0e10cSrcweir 	nMinLead = nMinTrail = 0;
704cdf0e10cSrcweir 	nMaxHyphens = 255;
705cdf0e10cSrcweir }
706cdf0e10cSrcweir 
707cdf0e10cSrcweir // -----------------------------------------------------------------------
QueryValue(uno::Any & rVal,sal_uInt8 nMemberId) const708cdf0e10cSrcweir sal_Bool	SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
709cdf0e10cSrcweir {
710cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
711cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
712cdf0e10cSrcweir 	switch(nMemberId)
713cdf0e10cSrcweir 	{
714cdf0e10cSrcweir 		case  MID_IS_HYPHEN:
715cdf0e10cSrcweir 			rVal = Bool2Any(bHyphen);
716cdf0e10cSrcweir 		break;
717cdf0e10cSrcweir 		case MID_HYPHEN_MIN_LEAD:
718cdf0e10cSrcweir 			rVal <<= (sal_Int16)nMinLead;
719cdf0e10cSrcweir 		break;
720cdf0e10cSrcweir 		case MID_HYPHEN_MIN_TRAIL:
721cdf0e10cSrcweir 			rVal <<= (sal_Int16)nMinTrail;
722cdf0e10cSrcweir 		break;
723cdf0e10cSrcweir 		case MID_HYPHEN_MAX_HYPHENS:
724cdf0e10cSrcweir 			rVal <<= (sal_Int16)nMaxHyphens;
725cdf0e10cSrcweir 		break;
726cdf0e10cSrcweir 	}
727cdf0e10cSrcweir 	return sal_True;
728cdf0e10cSrcweir }
729cdf0e10cSrcweir // -----------------------------------------------------------------------
PutValue(const uno::Any & rVal,sal_uInt8 nMemberId)730cdf0e10cSrcweir sal_Bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
731cdf0e10cSrcweir {
732cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
733cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
734cdf0e10cSrcweir 	sal_Int16 nNewVal = 0;
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 	if( nMemberId != MID_IS_HYPHEN )
737cdf0e10cSrcweir 		if(!(rVal >>= nNewVal))
738cdf0e10cSrcweir 			return sal_False;
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 	switch(nMemberId)
741cdf0e10cSrcweir 	{
742cdf0e10cSrcweir 		case  MID_IS_HYPHEN:
743cdf0e10cSrcweir 			bHyphen = Any2Bool(rVal);
744cdf0e10cSrcweir 		break;
745cdf0e10cSrcweir 		case MID_HYPHEN_MIN_LEAD:
746cdf0e10cSrcweir 			nMinLead = (sal_uInt8)nNewVal;
747cdf0e10cSrcweir 		break;
748cdf0e10cSrcweir 		case MID_HYPHEN_MIN_TRAIL:
749cdf0e10cSrcweir 			nMinTrail = (sal_uInt8)nNewVal;
750cdf0e10cSrcweir 		break;
751cdf0e10cSrcweir 		case MID_HYPHEN_MAX_HYPHENS:
752cdf0e10cSrcweir 			nMaxHyphens = (sal_uInt8)nNewVal;
753cdf0e10cSrcweir 		break;
754cdf0e10cSrcweir 	}
755cdf0e10cSrcweir 	return sal_True;
756cdf0e10cSrcweir }
757cdf0e10cSrcweir 
758cdf0e10cSrcweir // -----------------------------------------------------------------------
759cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rAttr) const760cdf0e10cSrcweir int SvxHyphenZoneItem::operator==( const SfxPoolItem& rAttr ) const
761cdf0e10cSrcweir {
762cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 	return ( (((SvxHyphenZoneItem&)rAttr).bHyphen == bHyphen)
765cdf0e10cSrcweir 			&& (((SvxHyphenZoneItem&)rAttr).bPageEnd == bPageEnd)
766cdf0e10cSrcweir 			&& (((SvxHyphenZoneItem&)rAttr).nMinLead == nMinLead)
767cdf0e10cSrcweir 			&& (((SvxHyphenZoneItem&)rAttr).nMinTrail == nMinTrail)
768cdf0e10cSrcweir 			&& (((SvxHyphenZoneItem&)rAttr).nMaxHyphens == nMaxHyphens) );
769cdf0e10cSrcweir }
770cdf0e10cSrcweir 
771cdf0e10cSrcweir // -----------------------------------------------------------------------
772cdf0e10cSrcweir 
Clone(SfxItemPool *) const773cdf0e10cSrcweir SfxPoolItem* SvxHyphenZoneItem::Clone( SfxItemPool * ) const
774cdf0e10cSrcweir {
775cdf0e10cSrcweir 	return new SvxHyphenZoneItem( *this );
776cdf0e10cSrcweir }
777cdf0e10cSrcweir 
778cdf0e10cSrcweir //------------------------------------------------------------------------
779cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const780cdf0e10cSrcweir SfxItemPresentation SvxHyphenZoneItem::GetPresentation
781cdf0e10cSrcweir (
782cdf0e10cSrcweir 	SfxItemPresentation ePres,
783cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
784cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
785cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
786cdf0e10cSrcweir )	const
787cdf0e10cSrcweir {
788cdf0e10cSrcweir 	switch ( ePres )
789cdf0e10cSrcweir 	{
790cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
791cdf0e10cSrcweir 			rText.Erase();
792cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
793cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
794cdf0e10cSrcweir 		{
795cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_HYPHEN_FALSE;
796cdf0e10cSrcweir 
797cdf0e10cSrcweir 			if ( bHyphen )
798cdf0e10cSrcweir 				nId = RID_SVXITEMS_HYPHEN_TRUE;
799cdf0e10cSrcweir 			rText = EE_RESSTR(nId);
800cdf0e10cSrcweir 			rText += cpDelim;
801cdf0e10cSrcweir 			nId = RID_SVXITEMS_PAGE_END_FALSE;
802cdf0e10cSrcweir 
803cdf0e10cSrcweir 			if ( bPageEnd )
804cdf0e10cSrcweir 				nId = RID_SVXITEMS_PAGE_END_TRUE;
805cdf0e10cSrcweir 			rText += EE_RESSTR(nId);
806cdf0e10cSrcweir 			rText += cpDelim;
807cdf0e10cSrcweir 			rText += String::CreateFromInt32( nMinLead );
808cdf0e10cSrcweir 			rText += cpDelim;
809cdf0e10cSrcweir 			rText += String::CreateFromInt32( nMinTrail );
810cdf0e10cSrcweir 			rText += cpDelim;
811cdf0e10cSrcweir 			rText += String::CreateFromInt32( nMaxHyphens );
812cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
813cdf0e10cSrcweir 		}
814cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
815cdf0e10cSrcweir 		{
816cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_HYPHEN_FALSE;
817cdf0e10cSrcweir 
818cdf0e10cSrcweir 			if ( bHyphen )
819cdf0e10cSrcweir 				nId = RID_SVXITEMS_HYPHEN_TRUE;
820cdf0e10cSrcweir 			rText = EE_RESSTR(nId);
821cdf0e10cSrcweir 			rText += cpDelim;
822cdf0e10cSrcweir 			nId = RID_SVXITEMS_PAGE_END_FALSE;
823cdf0e10cSrcweir 
824cdf0e10cSrcweir 			if ( bPageEnd )
825cdf0e10cSrcweir 				nId = RID_SVXITEMS_PAGE_END_TRUE;
826cdf0e10cSrcweir 			rText += EE_RESSTR(nId);
827cdf0e10cSrcweir 			rText += cpDelim;
828cdf0e10cSrcweir 			rText += String::CreateFromInt32(nMinLead);
829cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD);
830cdf0e10cSrcweir 			rText += cpDelim;
831cdf0e10cSrcweir 			rText += String::CreateFromInt32(nMinTrail);
832cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL);
833cdf0e10cSrcweir 			rText += cpDelim;
834cdf0e10cSrcweir 			rText += String::CreateFromInt32(nMaxHyphens);
835cdf0e10cSrcweir 			rText += EE_RESSTR(RID_SVXITEMS_HYPHEN_MAX);
836cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
837cdf0e10cSrcweir 		}
838cdf0e10cSrcweir         default: ;//prevent warning
839cdf0e10cSrcweir     }
840cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
841cdf0e10cSrcweir }
842cdf0e10cSrcweir 
843cdf0e10cSrcweir // -----------------------------------------------------------------------
844cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const845cdf0e10cSrcweir SfxPoolItem* SvxHyphenZoneItem::Create(SvStream& rStrm, sal_uInt16) const
846cdf0e10cSrcweir {
847cdf0e10cSrcweir     sal_Int8 _bHyphen, _bHyphenPageEnd;
848cdf0e10cSrcweir     sal_Int8 _nMinLead, _nMinTrail, _nMaxHyphens;
849cdf0e10cSrcweir     rStrm >> _bHyphen >> _bHyphenPageEnd >> _nMinLead >> _nMinTrail >> _nMaxHyphens;
850cdf0e10cSrcweir 	SvxHyphenZoneItem* pAttr = new SvxHyphenZoneItem( sal_False, Which() );
851cdf0e10cSrcweir     pAttr->SetHyphen( sal_Bool( _bHyphen != 0 ) );
852cdf0e10cSrcweir     pAttr->SetPageEnd( sal_Bool( _bHyphenPageEnd != 0 ) );
853cdf0e10cSrcweir     pAttr->GetMinLead() = _nMinLead;
854cdf0e10cSrcweir     pAttr->GetMinTrail() = _nMinTrail;
855cdf0e10cSrcweir     pAttr->GetMaxHyphens() = _nMaxHyphens;
856cdf0e10cSrcweir 	return pAttr;
857cdf0e10cSrcweir }
858cdf0e10cSrcweir 
859cdf0e10cSrcweir // -----------------------------------------------------------------------
860cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const861cdf0e10cSrcweir SvStream& SvxHyphenZoneItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
862cdf0e10cSrcweir {
863cdf0e10cSrcweir 	rStrm << (sal_Int8) IsHyphen()
864cdf0e10cSrcweir 		  << (sal_Int8) IsPageEnd()
865cdf0e10cSrcweir 		  << (sal_Int8) GetMinLead()
866cdf0e10cSrcweir 		  << (sal_Int8) GetMinTrail()
867cdf0e10cSrcweir 		  << (sal_Int8) GetMaxHyphens();
868cdf0e10cSrcweir 	return rStrm;
869cdf0e10cSrcweir }
870cdf0e10cSrcweir 
871cdf0e10cSrcweir // class SvxTabStop ------------------------------------------------------
872cdf0e10cSrcweir 
SvxTabStop()873cdf0e10cSrcweir SvxTabStop::SvxTabStop()
874cdf0e10cSrcweir {
875cdf0e10cSrcweir 	nTabPos = 0;
876cdf0e10cSrcweir 	eAdjustment = SVX_TAB_ADJUST_LEFT;
877cdf0e10cSrcweir 	m_cDecimal = cDfltDecimalChar;
878cdf0e10cSrcweir 	cFill = cDfltFillChar;
879cdf0e10cSrcweir }
880cdf0e10cSrcweir 
881cdf0e10cSrcweir // -----------------------------------------------------------------------
882cdf0e10cSrcweir 
SvxTabStop(const long nPos,const SvxTabAdjust eAdjst,const sal_Unicode cDec,const sal_Unicode cFil)883cdf0e10cSrcweir SvxTabStop::SvxTabStop( const long nPos, const SvxTabAdjust eAdjst,
884cdf0e10cSrcweir 						const sal_Unicode cDec, const sal_Unicode cFil )
885cdf0e10cSrcweir {
886cdf0e10cSrcweir 	nTabPos = nPos;
887cdf0e10cSrcweir 	eAdjustment = eAdjst;
888cdf0e10cSrcweir 	m_cDecimal = cDec;
889cdf0e10cSrcweir 	cFill = cFil;
890cdf0e10cSrcweir }
891cdf0e10cSrcweir // -----------------------------------------------------------------------------
fillDecimal() const892cdf0e10cSrcweir void SvxTabStop::fillDecimal() const
893cdf0e10cSrcweir {
894cdf0e10cSrcweir     if ( cDfltDecimalChar == m_cDecimal )
895cdf0e10cSrcweir         m_cDecimal = SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
896cdf0e10cSrcweir }
897cdf0e10cSrcweir // -----------------------------------------------------------------------
898cdf0e10cSrcweir 
GetValueString() const899cdf0e10cSrcweir XubString SvxTabStop::GetValueString() const
900cdf0e10cSrcweir {
901cdf0e10cSrcweir 	XubString aStr;
902cdf0e10cSrcweir 
903cdf0e10cSrcweir 	aStr += sal_Unicode( '(' );
904cdf0e10cSrcweir 	aStr += UniString::CreateFromInt32(nTabPos);
905cdf0e10cSrcweir 	aStr += cpDelim;
906cdf0e10cSrcweir 	aStr += XubString( EditResId( RID_SVXITEMS_TAB_ADJUST_BEGIN + (sal_uInt16)eAdjustment ) );
907cdf0e10cSrcweir 
908cdf0e10cSrcweir 	aStr += cpDelim;
909cdf0e10cSrcweir 	aStr += sal_Unicode('[');
910cdf0e10cSrcweir 	aStr += XubString( EditResId( RID_SVXITEMS_TAB_DECIMAL_CHAR ) );
911cdf0e10cSrcweir 	aStr += GetDecimal();
912cdf0e10cSrcweir 	aStr += sal_Unicode(']');
913cdf0e10cSrcweir 	aStr += cpDelim;
914cdf0e10cSrcweir 	aStr += cpDelim;
915cdf0e10cSrcweir 	aStr += sal_Unicode('[');
916cdf0e10cSrcweir 	aStr += XubString( EditResId( RID_SVXITEMS_TAB_FILL_CHAR ) );
917cdf0e10cSrcweir 	aStr += cFill;
918cdf0e10cSrcweir 	aStr += sal_Unicode(']');
919cdf0e10cSrcweir 	aStr += sal_Unicode(')');
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 	return aStr;
922cdf0e10cSrcweir }
923cdf0e10cSrcweir 
924cdf0e10cSrcweir // class SvxTabStopItem --------------------------------------------------
925cdf0e10cSrcweir 
SvxTabStopItem(sal_uInt16 _nWhich)926cdf0e10cSrcweir SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich ) :
927cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
928cdf0e10cSrcweir 	SvxTabStopArr( sal_Int8(SVX_TAB_DEFCOUNT) )
929cdf0e10cSrcweir {
930cdf0e10cSrcweir 	const sal_uInt16 nTabs = SVX_TAB_DEFCOUNT, nDist = SVX_TAB_DEFDIST;
931cdf0e10cSrcweir 	const SvxTabAdjust eAdjst= SVX_TAB_ADJUST_DEFAULT;
932cdf0e10cSrcweir 
933cdf0e10cSrcweir 	for (sal_uInt16 i = 0; i < nTabs; ++i)
934cdf0e10cSrcweir 	{
935cdf0e10cSrcweir 		SvxTabStop aTab( (i + 1) * nDist, eAdjst );
936cdf0e10cSrcweir 		SvxTabStopArr::Insert( aTab );
937cdf0e10cSrcweir 	}
938cdf0e10cSrcweir }
939cdf0e10cSrcweir 
940cdf0e10cSrcweir // -----------------------------------------------------------------------
941cdf0e10cSrcweir 
SvxTabStopItem(const sal_uInt16 nTabs,const sal_uInt16 nDist,const SvxTabAdjust eAdjst,sal_uInt16 _nWhich)942cdf0e10cSrcweir SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs,
943cdf0e10cSrcweir 								const sal_uInt16 nDist,
944cdf0e10cSrcweir 								const SvxTabAdjust eAdjst,
945cdf0e10cSrcweir                                 sal_uInt16 _nWhich ) :
946cdf0e10cSrcweir     SfxPoolItem( _nWhich ),
947cdf0e10cSrcweir 	SvxTabStopArr( sal_Int8(nTabs) )
948cdf0e10cSrcweir {
949cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < nTabs; ++i )
950cdf0e10cSrcweir 	{
951cdf0e10cSrcweir 		SvxTabStop aTab( (i + 1) * nDist, eAdjst );
952cdf0e10cSrcweir 		SvxTabStopArr::Insert( aTab );
953cdf0e10cSrcweir 	}
954cdf0e10cSrcweir }
955cdf0e10cSrcweir 
956cdf0e10cSrcweir // -----------------------------------------------------------------------
957cdf0e10cSrcweir 
SvxTabStopItem(const SvxTabStopItem & rTSI)958cdf0e10cSrcweir SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem& rTSI ) :
959cdf0e10cSrcweir 	SfxPoolItem( rTSI.Which() ),
960cdf0e10cSrcweir 	SvxTabStopArr( (sal_Int8)rTSI.Count() )
961cdf0e10cSrcweir {
962cdf0e10cSrcweir 	SvxTabStopArr::Insert( &rTSI );
963cdf0e10cSrcweir }
964cdf0e10cSrcweir 
965cdf0e10cSrcweir // -----------------------------------------------------------------------
966cdf0e10cSrcweir 
GetPos(const SvxTabStop & rTab) const967cdf0e10cSrcweir sal_uInt16 SvxTabStopItem::GetPos( const SvxTabStop& rTab ) const
968cdf0e10cSrcweir {
969cdf0e10cSrcweir 	sal_uInt16 nFound;
970cdf0e10cSrcweir 	return Seek_Entry( rTab, &nFound ) ? nFound : SVX_TAB_NOTFOUND;
971cdf0e10cSrcweir }
972cdf0e10cSrcweir 
973cdf0e10cSrcweir // -----------------------------------------------------------------------
974cdf0e10cSrcweir 
GetPos(const long nPos) const975cdf0e10cSrcweir sal_uInt16 SvxTabStopItem::GetPos( const long nPos ) const
976cdf0e10cSrcweir {
977cdf0e10cSrcweir 	sal_uInt16 nFound;
978cdf0e10cSrcweir 	return Seek_Entry( SvxTabStop( nPos ), &nFound ) ? nFound : SVX_TAB_NOTFOUND;
979cdf0e10cSrcweir }
980cdf0e10cSrcweir 
981cdf0e10cSrcweir // -----------------------------------------------------------------------
982cdf0e10cSrcweir 
operator =(const SvxTabStopItem & rTSI)983cdf0e10cSrcweir SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI )
984cdf0e10cSrcweir {
985cdf0e10cSrcweir 	Remove( 0, Count() );
986cdf0e10cSrcweir 	SvxTabStopArr::Insert( &rTSI );
987cdf0e10cSrcweir 	return *this;
988cdf0e10cSrcweir }
989cdf0e10cSrcweir 
990cdf0e10cSrcweir 
991cdf0e10cSrcweir /*
992cdf0e10cSrcweir  enum ::com::sun::star::style::TabAlign
993cdf0e10cSrcweir {
994cdf0e10cSrcweir 	TABALIGN_LEFT,
995cdf0e10cSrcweir 	TABALIGN_CENTER,
996cdf0e10cSrcweir 	TABALIGN_RIGHT,
997cdf0e10cSrcweir 	TABALIGN_DECIMAL
998cdf0e10cSrcweir };
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir struct	 ::com::sun::star::style::TabStop
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir 	long			Position;
1003cdf0e10cSrcweir  ::com::sun::star::style::TabAlign 	 ::com::sun::star::drawing::Alignment;
1004cdf0e10cSrcweir 	unsigned short 	DecimalChar;
1005cdf0e10cSrcweir 	unsigned short 	FillChar;
1006cdf0e10cSrcweir };
1007cdf0e10cSrcweir typedef sequence ::com::sun::star::style::TabStop> TabSTopSequence;
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir  */
1010cdf0e10cSrcweir /*-----------------19.03.98 08:50-------------------
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir --------------------------------------------------*/
1013cdf0e10cSrcweir 
QueryValue(uno::Any & rVal,sal_uInt8 nMemberId) const1014cdf0e10cSrcweir sal_Bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir     sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1017cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
1018cdf0e10cSrcweir     switch ( nMemberId )
1019cdf0e10cSrcweir     {
1020cdf0e10cSrcweir         case MID_TABSTOPS:
1021cdf0e10cSrcweir         {
1022cdf0e10cSrcweir             sal_uInt16 nCount = Count();
1023cdf0e10cSrcweir             uno::Sequence< style::TabStop> aSeq(nCount);
1024cdf0e10cSrcweir             style::TabStop* pArr = aSeq.getArray();
1025cdf0e10cSrcweir             for(sal_uInt16 i = 0; i < nCount; i++)
1026cdf0e10cSrcweir             {
1027cdf0e10cSrcweir                 const SvxTabStop& rTab = *(GetStart() + i);
1028cdf0e10cSrcweir                 pArr[i].Position        = bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos();
1029cdf0e10cSrcweir                 switch(rTab.GetAdjustment())
1030cdf0e10cSrcweir                 {
1031cdf0e10cSrcweir                 case  SVX_TAB_ADJUST_LEFT   : pArr[i].Alignment = style::TabAlign_LEFT; break;
1032cdf0e10cSrcweir                 case  SVX_TAB_ADJUST_RIGHT  : pArr[i].Alignment = style::TabAlign_RIGHT; break;
1033cdf0e10cSrcweir                 case  SVX_TAB_ADJUST_DECIMAL: pArr[i].Alignment = style::TabAlign_DECIMAL; break;
1034cdf0e10cSrcweir                 case  SVX_TAB_ADJUST_CENTER : pArr[i].Alignment = style::TabAlign_CENTER; break;
1035cdf0e10cSrcweir                     default: //SVX_TAB_ADJUST_DEFAULT
1036cdf0e10cSrcweir                         pArr[i].Alignment = style::TabAlign_DEFAULT;
1037cdf0e10cSrcweir 
1038cdf0e10cSrcweir                 }
1039cdf0e10cSrcweir                 pArr[i].DecimalChar		= rTab.GetDecimal();
1040cdf0e10cSrcweir                 pArr[i].FillChar		= rTab.GetFill();
1041cdf0e10cSrcweir             }
1042cdf0e10cSrcweir 	        rVal <<= aSeq;
1043cdf0e10cSrcweir             break;
1044cdf0e10cSrcweir         }
1045cdf0e10cSrcweir         case MID_STD_TAB:
1046cdf0e10cSrcweir         {
1047cdf0e10cSrcweir             const SvxTabStop &rTab = *(GetStart());
1048cdf0e10cSrcweir             rVal <<= static_cast<sal_Int32>(bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos());
1049cdf0e10cSrcweir             break;
1050cdf0e10cSrcweir         }
1051cdf0e10cSrcweir 	}
1052cdf0e10cSrcweir 	return sal_True;
1053cdf0e10cSrcweir }
1054cdf0e10cSrcweir /*-----------------19.03.98 08:50-------------------
1055cdf0e10cSrcweir 
1056cdf0e10cSrcweir --------------------------------------------------*/
1057cdf0e10cSrcweir 
PutValue(const uno::Any & rVal,sal_uInt8 nMemberId)1058cdf0e10cSrcweir sal_Bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir     sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1061cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
1062cdf0e10cSrcweir     switch ( nMemberId )
1063cdf0e10cSrcweir     {
1064cdf0e10cSrcweir         case MID_TABSTOPS:
1065cdf0e10cSrcweir         {
1066cdf0e10cSrcweir             uno::Sequence< style::TabStop> aSeq;
1067cdf0e10cSrcweir             if(!(rVal >>= aSeq))
1068cdf0e10cSrcweir             {
1069cdf0e10cSrcweir                 uno::Sequence < uno::Sequence < uno::Any >  > aAnySeq;
1070cdf0e10cSrcweir                 if (!(rVal >>= aAnySeq))
1071cdf0e10cSrcweir                     return sal_False;
1072cdf0e10cSrcweir                 sal_Int32 nLength = aAnySeq.getLength();
1073cdf0e10cSrcweir                 aSeq.realloc( nLength );
1074cdf0e10cSrcweir                 for ( sal_Int32 n=0; n<nLength; n++ )
1075cdf0e10cSrcweir                 {
1076cdf0e10cSrcweir                     uno::Sequence < uno::Any >& rAnySeq = aAnySeq[n];
1077cdf0e10cSrcweir                     if ( rAnySeq.getLength() == 4 )
1078cdf0e10cSrcweir                     {
1079cdf0e10cSrcweir                         if (!(rAnySeq[0] >>= aSeq[n].Position)) return sal_False;
1080cdf0e10cSrcweir                         if (!(rAnySeq[1] >>= aSeq[n].Alignment))
1081cdf0e10cSrcweir                         {
1082cdf0e10cSrcweir                             sal_Int32 nVal = 0;
1083cdf0e10cSrcweir                             if (rAnySeq[1] >>= nVal)
1084cdf0e10cSrcweir                                 aSeq[n].Alignment = (com::sun::star::style::TabAlign) nVal;
1085cdf0e10cSrcweir                             else
1086cdf0e10cSrcweir                                 return sal_False;
1087cdf0e10cSrcweir                         }
1088cdf0e10cSrcweir                         if (!(rAnySeq[2] >>= aSeq[n].DecimalChar))
1089cdf0e10cSrcweir                         {
1090cdf0e10cSrcweir                             ::rtl::OUString aVal;
1091cdf0e10cSrcweir                             if ( (rAnySeq[2] >>= aVal) && aVal.getLength() == 1 )
1092cdf0e10cSrcweir                                 aSeq[n].DecimalChar = aVal.toChar();
1093cdf0e10cSrcweir                             else
1094cdf0e10cSrcweir                                 return sal_False;
1095cdf0e10cSrcweir                         }
1096cdf0e10cSrcweir                         if (!(rAnySeq[3] >>= aSeq[n].FillChar))
1097cdf0e10cSrcweir                         {
1098cdf0e10cSrcweir                             ::rtl::OUString aVal;
1099cdf0e10cSrcweir                             if ( (rAnySeq[3] >>= aVal) && aVal.getLength() == 1 )
1100cdf0e10cSrcweir                                 aSeq[n].FillChar = aVal.toChar();
1101cdf0e10cSrcweir                             else
1102cdf0e10cSrcweir                                 return sal_False;
1103cdf0e10cSrcweir                         }
1104cdf0e10cSrcweir                     }
1105cdf0e10cSrcweir                     else
1106cdf0e10cSrcweir                         return sal_False;
1107cdf0e10cSrcweir                 }
1108cdf0e10cSrcweir             }
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir             SvxTabStopArr::Remove( 0, Count() );
1111cdf0e10cSrcweir             const style::TabStop* pArr = aSeq.getConstArray();
1112cdf0e10cSrcweir             const sal_uInt16 nCount = (sal_uInt16)aSeq.getLength();
1113cdf0e10cSrcweir             for(sal_uInt16 i = 0; i < nCount ; i++)
1114cdf0e10cSrcweir             {
1115cdf0e10cSrcweir                 SvxTabAdjust eAdjust = SVX_TAB_ADJUST_DEFAULT;
1116cdf0e10cSrcweir                 switch(pArr[i].Alignment)
1117cdf0e10cSrcweir                 {
1118cdf0e10cSrcweir                 case style::TabAlign_LEFT   : eAdjust = SVX_TAB_ADJUST_LEFT; break;
1119cdf0e10cSrcweir                 case style::TabAlign_CENTER : eAdjust = SVX_TAB_ADJUST_CENTER; break;
1120cdf0e10cSrcweir                 case style::TabAlign_RIGHT  : eAdjust = SVX_TAB_ADJUST_RIGHT; break;
1121cdf0e10cSrcweir                 case style::TabAlign_DECIMAL: eAdjust = SVX_TAB_ADJUST_DECIMAL; break;
1122cdf0e10cSrcweir                 default: ;//prevent warning
1123cdf0e10cSrcweir                 }
1124cdf0e10cSrcweir                 sal_Unicode cFill = pArr[i].FillChar;
1125cdf0e10cSrcweir                 sal_Unicode cDecimal = pArr[i].DecimalChar;
1126cdf0e10cSrcweir                 SvxTabStop aTab( bConvert ? MM100_TO_TWIP(pArr[i].Position) : pArr[i].Position,
1127cdf0e10cSrcweir                                     eAdjust,
1128cdf0e10cSrcweir                                     cDecimal,
1129cdf0e10cSrcweir                                     cFill );
1130cdf0e10cSrcweir                 Insert(aTab);
1131cdf0e10cSrcweir             }
1132cdf0e10cSrcweir             break;
1133cdf0e10cSrcweir         }
1134cdf0e10cSrcweir         case MID_STD_TAB:
1135cdf0e10cSrcweir         {
1136cdf0e10cSrcweir             sal_Int32 nNewPos = 0;
1137cdf0e10cSrcweir             if (!(rVal >>= nNewPos) )
1138cdf0e10cSrcweir                 return sal_False;
1139cdf0e10cSrcweir             const SvxTabStop& rTab = *(GetStart());
1140cdf0e10cSrcweir             SvxTabStop aNewTab ( bConvert ? MM100_TO_TWIP ( nNewPos ) : nNewPos,
1141cdf0e10cSrcweir                                  rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() );
1142cdf0e10cSrcweir             Remove ( 0 );
1143cdf0e10cSrcweir 	        Insert( aNewTab );
1144cdf0e10cSrcweir             break;
1145cdf0e10cSrcweir         }
1146cdf0e10cSrcweir     }
1147cdf0e10cSrcweir 	return sal_True;
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir // -----------------------------------------------------------------------
1150cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rAttr) const1151cdf0e10cSrcweir int SvxTabStopItem::operator==( const SfxPoolItem& rAttr ) const
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir 	const SvxTabStopItem& rTSI = (SvxTabStopItem&)rAttr;
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir 	if ( Count() != rTSI.Count() )
1158cdf0e10cSrcweir 		return 0;
1159cdf0e10cSrcweir 
1160cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < Count(); ++i )
1161cdf0e10cSrcweir 		if( !(*this)[i].IsEqual( rTSI[i] ) )
1162cdf0e10cSrcweir 			return 0;
1163cdf0e10cSrcweir 	return 1;
1164cdf0e10cSrcweir }
1165cdf0e10cSrcweir 
1166cdf0e10cSrcweir // -----------------------------------------------------------------------
1167cdf0e10cSrcweir 
Clone(SfxItemPool *) const1168cdf0e10cSrcweir SfxPoolItem* SvxTabStopItem::Clone( SfxItemPool * ) const
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir 	return new SvxTabStopItem( *this );
1171cdf0e10cSrcweir }
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir //------------------------------------------------------------------------
1174cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit eCoreUnit,SfxMapUnit ePresUnit,XubString & rText,const IntlWrapper * pIntl) const1175cdf0e10cSrcweir SfxItemPresentation SvxTabStopItem::GetPresentation
1176cdf0e10cSrcweir (
1177cdf0e10cSrcweir 	SfxItemPresentation ePres,
1178cdf0e10cSrcweir 	SfxMapUnit			eCoreUnit,
1179cdf0e10cSrcweir 	SfxMapUnit			ePresUnit,
1180cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *pIntl
1181cdf0e10cSrcweir )	const
1182cdf0e10cSrcweir {
1183cdf0e10cSrcweir 	rText.Erase();
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir 	if ( ePres > SFX_ITEM_PRESENTATION_NONE )
1186cdf0e10cSrcweir 	{
1187cdf0e10cSrcweir #ifndef SVX_LIGHT
1188cdf0e10cSrcweir 		sal_Bool bComma = sal_False;
1189cdf0e10cSrcweir 
1190cdf0e10cSrcweir 		for ( sal_uInt16 i = 0; i < Count(); ++i )
1191cdf0e10cSrcweir 		{
1192cdf0e10cSrcweir 			if ( SVX_TAB_ADJUST_DEFAULT != ((*this)[i]).GetAdjustment() )
1193cdf0e10cSrcweir 			{
1194cdf0e10cSrcweir 				if ( bComma )
1195cdf0e10cSrcweir 					rText += sal_Unicode(',');
1196cdf0e10cSrcweir 				rText += GetMetricText(
1197cdf0e10cSrcweir                     (long)((*this)[i]).GetTabPos(), eCoreUnit, ePresUnit, pIntl );
1198cdf0e10cSrcweir 				if ( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
1199*ae2dc0faSTsutomu Uchino 				{
1200*ae2dc0faSTsutomu Uchino 					rText += sal_Unicode(' ');
1201cdf0e10cSrcweir 					rText += EE_RESSTR(GetMetricId(ePresUnit));
1202*ae2dc0faSTsutomu Uchino 				}
1203cdf0e10cSrcweir 				bComma = sal_True;
1204cdf0e10cSrcweir 			}
1205cdf0e10cSrcweir 		}
1206cdf0e10cSrcweir #endif
1207cdf0e10cSrcweir 	}
1208cdf0e10cSrcweir 	return ePres;
1209cdf0e10cSrcweir }
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir // -----------------------------------------------------------------------
1212cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const1213cdf0e10cSrcweir SfxPoolItem* SvxTabStopItem::Create( SvStream& rStrm, sal_uInt16 ) const
1214cdf0e10cSrcweir {
1215cdf0e10cSrcweir 	sal_Int8 nTabs;
1216cdf0e10cSrcweir 	rStrm >> nTabs;
1217cdf0e10cSrcweir 	SvxTabStopItem* pAttr =
1218cdf0e10cSrcweir 		new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_DEFAULT, Which() );
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir 	for ( sal_Int8 i = 0; i < nTabs; i++ )
1221cdf0e10cSrcweir 	{
1222cdf0e10cSrcweir 		long nPos;
1223cdf0e10cSrcweir 		sal_Int8 eAdjust;
1224cdf0e10cSrcweir 		unsigned char cDecimal, cFill;
1225cdf0e10cSrcweir 		rStrm >> nPos >> eAdjust >> cDecimal >> cFill;
1226cdf0e10cSrcweir 		if( !i || SVX_TAB_ADJUST_DEFAULT != eAdjust )
1227cdf0e10cSrcweir 			pAttr->Insert( SvxTabStop
1228cdf0e10cSrcweir 				( nPos, (SvxTabAdjust)eAdjust, sal_Unicode(cDecimal), sal_Unicode(cFill) ) );
1229cdf0e10cSrcweir 	}
1230cdf0e10cSrcweir 	return pAttr;
1231cdf0e10cSrcweir }
1232cdf0e10cSrcweir 
1233cdf0e10cSrcweir // -----------------------------------------------------------------------
1234cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const1235cdf0e10cSrcweir SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
1236cdf0e10cSrcweir {
1237cdf0e10cSrcweir 	//MA 05. Sep. 96: Default-Tabs werden nur noch fuer das default-Attr
1238cdf0e10cSrcweir 	//expandiert. Fuer vollstaendige Rueckwaertskompatibilitaet (<=304)
1239cdf0e10cSrcweir 	//muessten alle Tabs expandiert werden, dass blaeht aber das File u.U.
1240cdf0e10cSrcweir 	//enorm auf.
1241cdf0e10cSrcweir 	//Alles nur SWG!
1242cdf0e10cSrcweir 
1243cdf0e10cSrcweir 	const SfxItemPool *pPool = SfxItemPool::GetStoringPool();
1244cdf0e10cSrcweir 	const FASTBOOL bStoreDefTabs = pPool
1245cdf0e10cSrcweir 		&& pPool->GetName().EqualsAscii("SWG")
1246cdf0e10cSrcweir 		&& ::IsDefaultItem( this );
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir 	const short nTabs = Count();
1249cdf0e10cSrcweir 	sal_uInt16 	nCount = 0, nDefDist = 0;
1250cdf0e10cSrcweir 	long nNew = 0;
1251cdf0e10cSrcweir 
1252cdf0e10cSrcweir 	if( bStoreDefTabs )
1253cdf0e10cSrcweir 	{
1254cdf0e10cSrcweir 		const SvxTabStopItem& rDefTab = (const SvxTabStopItem &)
1255cdf0e10cSrcweir 			pPool->GetDefaultItem( pPool->GetWhich(	SID_ATTR_TABSTOP, sal_False ) );
1256cdf0e10cSrcweir 		nDefDist = sal_uInt16( rDefTab.GetStart()->GetTabPos() );
1257cdf0e10cSrcweir 		const long nPos = nTabs > 0 ? (*this)[nTabs-1].GetTabPos() : 0;
1258cdf0e10cSrcweir 		nCount 	= (sal_uInt16)(nPos / nDefDist);
1259cdf0e10cSrcweir 		nNew	= (nCount + 1) * nDefDist;
1260cdf0e10cSrcweir 
1261cdf0e10cSrcweir 		if( nNew <= nPos + 50 )
1262cdf0e10cSrcweir 			nNew += nDefDist;
1263cdf0e10cSrcweir 
1264cdf0e10cSrcweir 		long lA3Width = SvxPaperInfo::GetPaperSize(PAPER_A3).Width();
1265cdf0e10cSrcweir 		nCount = (sal_uInt16)(nNew < lA3Width ? ( lA3Width - nNew ) / nDefDist + 1 : 0);
1266cdf0e10cSrcweir 	}
1267cdf0e10cSrcweir 
1268cdf0e10cSrcweir 	rStrm << (sal_Int8) ( nTabs + nCount );
1269cdf0e10cSrcweir 	for ( short i = 0; i < nTabs; i++ )
1270cdf0e10cSrcweir 	{
1271cdf0e10cSrcweir 		const SvxTabStop& rTab = (*this)[ i ];
1272cdf0e10cSrcweir 		rStrm << (long) rTab.GetTabPos()
1273cdf0e10cSrcweir 			  << (sal_Int8) rTab.GetAdjustment()
1274cdf0e10cSrcweir 			  << (unsigned char) rTab.GetDecimal()
1275cdf0e10cSrcweir 			  << (unsigned char) rTab.GetFill();
1276cdf0e10cSrcweir 	}
1277cdf0e10cSrcweir 
1278cdf0e10cSrcweir 	if ( bStoreDefTabs )
1279cdf0e10cSrcweir 		for( ; nCount; --nCount )
1280cdf0e10cSrcweir 		{
1281cdf0e10cSrcweir 			SvxTabStop aSwTabStop(nNew, SVX_TAB_ADJUST_DEFAULT);
1282cdf0e10cSrcweir 			rStrm << (long) aSwTabStop.GetTabPos()
1283cdf0e10cSrcweir 				  << (sal_Int8) aSwTabStop.GetAdjustment()
1284cdf0e10cSrcweir 				  << (unsigned char) aSwTabStop.GetDecimal()
1285cdf0e10cSrcweir 				  << (unsigned char) aSwTabStop.GetFill();
1286cdf0e10cSrcweir 			nNew += nDefDist;
1287cdf0e10cSrcweir 		}
1288cdf0e10cSrcweir 
1289cdf0e10cSrcweir 	return rStrm;
1290cdf0e10cSrcweir }
1291cdf0e10cSrcweir 
1292cdf0e10cSrcweir // -----------------------------------------------------------------------
Insert(const SvxTabStop & rTab)1293cdf0e10cSrcweir sal_Bool SvxTabStopItem::Insert( const SvxTabStop& rTab )
1294cdf0e10cSrcweir {
1295cdf0e10cSrcweir 	sal_uInt16 nTabPos = GetPos(rTab);
1296cdf0e10cSrcweir 	if(SVX_TAB_NOTFOUND != nTabPos )
1297cdf0e10cSrcweir 		Remove(nTabPos);
1298cdf0e10cSrcweir 	return SvxTabStopArr::Insert( rTab );
1299cdf0e10cSrcweir }
1300cdf0e10cSrcweir // -----------------------------------------------------------------------
Insert(const SvxTabStopItem * pTabs,sal_uInt16 nStart,sal_uInt16 nEnd)1301cdf0e10cSrcweir void SvxTabStopItem::Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart,
1302cdf0e10cSrcweir 							sal_uInt16 nEnd )
1303cdf0e10cSrcweir {
1304cdf0e10cSrcweir 	for( sal_uInt16 i = nStart; i < nEnd && i < pTabs->Count(); i++ )
1305cdf0e10cSrcweir 	{
1306cdf0e10cSrcweir 		const SvxTabStop& rTab = (*pTabs)[i];
1307cdf0e10cSrcweir 		sal_uInt16 nTabPos = GetPos(rTab);
1308cdf0e10cSrcweir 		if(SVX_TAB_NOTFOUND != nTabPos)
1309cdf0e10cSrcweir 			Remove(nTabPos);
1310cdf0e10cSrcweir 	}
1311cdf0e10cSrcweir 	SvxTabStopArr::Insert( pTabs, nStart, nEnd );
1312cdf0e10cSrcweir }
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir 
1315cdf0e10cSrcweir 
1316cdf0e10cSrcweir // class SvxFmtSplitItem -------------------------------------------------
~SvxFmtSplitItem()1317cdf0e10cSrcweir SvxFmtSplitItem::~SvxFmtSplitItem()
1318cdf0e10cSrcweir {
1319cdf0e10cSrcweir }
1320cdf0e10cSrcweir // -----------------------------------------------------------------------
Clone(SfxItemPool *) const1321cdf0e10cSrcweir SfxPoolItem* SvxFmtSplitItem::Clone( SfxItemPool * ) const
1322cdf0e10cSrcweir {
1323cdf0e10cSrcweir 	return new SvxFmtSplitItem( *this );
1324cdf0e10cSrcweir }
1325cdf0e10cSrcweir 
1326cdf0e10cSrcweir // -----------------------------------------------------------------------
1327cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const1328cdf0e10cSrcweir SvStream& SvxFmtSplitItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
1329cdf0e10cSrcweir {
1330cdf0e10cSrcweir 	rStrm << (sal_Int8)GetValue();
1331cdf0e10cSrcweir 	return rStrm;
1332cdf0e10cSrcweir }
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir // -----------------------------------------------------------------------
1335cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const1336cdf0e10cSrcweir SfxPoolItem* SvxFmtSplitItem::Create( SvStream& rStrm, sal_uInt16 ) const
1337cdf0e10cSrcweir {
1338cdf0e10cSrcweir 	sal_Int8 bIsSplit;
1339cdf0e10cSrcweir 	rStrm >> bIsSplit;
1340cdf0e10cSrcweir 	return new SvxFmtSplitItem( sal_Bool( bIsSplit != 0 ), Which() );
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir 
1343cdf0e10cSrcweir //------------------------------------------------------------------------
1344cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const1345cdf0e10cSrcweir SfxItemPresentation SvxFmtSplitItem::GetPresentation
1346cdf0e10cSrcweir (
1347cdf0e10cSrcweir 	SfxItemPresentation ePres,
1348cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
1349cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
1350cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
1351cdf0e10cSrcweir )	const
1352cdf0e10cSrcweir {
1353cdf0e10cSrcweir 	switch ( ePres )
1354cdf0e10cSrcweir 	{
1355cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
1356cdf0e10cSrcweir 			rText.Erase();
1357cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
1358cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
1359cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
1360cdf0e10cSrcweir 		{
1361cdf0e10cSrcweir 			sal_uInt16 nId = RID_SVXITEMS_FMTSPLIT_FALSE;
1362cdf0e10cSrcweir 
1363cdf0e10cSrcweir 			if ( GetValue() )
1364cdf0e10cSrcweir 				nId = RID_SVXITEMS_FMTSPLIT_TRUE;
1365cdf0e10cSrcweir 			rText = EE_RESSTR(nId);
1366cdf0e10cSrcweir 			return ePres;
1367cdf0e10cSrcweir 		}
1368cdf0e10cSrcweir         default: ;//prevent warning
1369cdf0e10cSrcweir     }
1370cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1371cdf0e10cSrcweir }
1372cdf0e10cSrcweir 
1373cdf0e10cSrcweir // --------------------------------------------------------------------
1374cdf0e10cSrcweir 
Clone(SfxItemPool *) const1375cdf0e10cSrcweir SfxPoolItem* SvxPageModelItem::Clone( SfxItemPool* ) const
1376cdf0e10cSrcweir {
1377cdf0e10cSrcweir 	return new SvxPageModelItem( *this );
1378cdf0e10cSrcweir }
1379cdf0e10cSrcweir 
1380cdf0e10cSrcweir //------------------------------------------------------------------------
1381cdf0e10cSrcweir 
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const1382cdf0e10cSrcweir sal_Bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1383cdf0e10cSrcweir {
1384cdf0e10cSrcweir //  sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1385cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1386cdf0e10cSrcweir 
1387cdf0e10cSrcweir     switch ( nMemberId )
1388cdf0e10cSrcweir     {
1389cdf0e10cSrcweir         case MID_AUTO: rVal <<= (sal_Bool) bAuto; break;
1390cdf0e10cSrcweir         case MID_NAME: rVal <<= ::rtl::OUString( GetValue() ); break;
1391cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
1392cdf0e10cSrcweir     }
1393cdf0e10cSrcweir 
1394cdf0e10cSrcweir     return sal_True;
1395cdf0e10cSrcweir }
1396cdf0e10cSrcweir 
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)1397cdf0e10cSrcweir sal_Bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1398cdf0e10cSrcweir {
1399cdf0e10cSrcweir //  sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1400cdf0e10cSrcweir 	nMemberId &= ~CONVERT_TWIPS;
1401cdf0e10cSrcweir     sal_Bool bRet;
1402cdf0e10cSrcweir     ::rtl::OUString aStr;
1403cdf0e10cSrcweir     switch ( nMemberId )
1404cdf0e10cSrcweir     {
1405cdf0e10cSrcweir         case MID_AUTO: bRet = ( rVal >>= bAuto ); break;
1406cdf0e10cSrcweir         case MID_NAME: bRet = ( rVal >>= aStr ); if ( bRet ) SetValue(aStr); break;
1407cdf0e10cSrcweir         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
1408cdf0e10cSrcweir     }
1409cdf0e10cSrcweir 
1410cdf0e10cSrcweir     return bRet;
1411cdf0e10cSrcweir }
1412cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const1413cdf0e10cSrcweir SfxItemPresentation SvxPageModelItem::GetPresentation
1414cdf0e10cSrcweir (
1415cdf0e10cSrcweir 	SfxItemPresentation ePres,
1416cdf0e10cSrcweir     SfxMapUnit          /*eCoreUnit*/,
1417cdf0e10cSrcweir     SfxMapUnit          /*ePresUnit*/,
1418cdf0e10cSrcweir     XubString&          rText, const IntlWrapper *
1419cdf0e10cSrcweir )	const
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir 	rText.Erase();
1422cdf0e10cSrcweir 	FASTBOOL bSet = ( GetValue().Len() > 0 );
1423cdf0e10cSrcweir 
1424cdf0e10cSrcweir 	switch ( ePres )
1425cdf0e10cSrcweir 	{
1426cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NONE:
1427cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NONE;
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_NAMELESS:
1430cdf0e10cSrcweir 			if ( bSet )
1431cdf0e10cSrcweir 				rText = GetValue();
1432cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_NAMELESS;
1433cdf0e10cSrcweir 
1434cdf0e10cSrcweir 		case SFX_ITEM_PRESENTATION_COMPLETE:
1435cdf0e10cSrcweir 			if ( bSet )
1436cdf0e10cSrcweir 			{
1437cdf0e10cSrcweir 				rText = EE_RESSTR(RID_SVXITEMS_PAGEMODEL_COMPLETE);
1438cdf0e10cSrcweir 				rText += GetValue();
1439cdf0e10cSrcweir 			}
1440cdf0e10cSrcweir 			return SFX_ITEM_PRESENTATION_COMPLETE;
1441cdf0e10cSrcweir         default: ;//prevent warning
1442cdf0e10cSrcweir     }
1443cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1444cdf0e10cSrcweir }
1445cdf0e10cSrcweir 
1446cdf0e10cSrcweir //------------------------------------------------------------------------
1447cdf0e10cSrcweir 
SvxScriptSpaceItem(sal_Bool bOn,const sal_uInt16 nId)1448cdf0e10cSrcweir SvxScriptSpaceItem::SvxScriptSpaceItem( sal_Bool bOn, const sal_uInt16 nId )
1449cdf0e10cSrcweir 	: SfxBoolItem( nId, bOn )
1450cdf0e10cSrcweir {
1451cdf0e10cSrcweir }
1452cdf0e10cSrcweir 
Clone(SfxItemPool *) const1453cdf0e10cSrcweir SfxPoolItem* SvxScriptSpaceItem::Clone( SfxItemPool * ) const
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir 	return new SvxScriptSpaceItem( GetValue(), Which() );
1456cdf0e10cSrcweir }
1457cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const1458cdf0e10cSrcweir SfxPoolItem* SvxScriptSpaceItem::Create(SvStream & rStrm, sal_uInt16) const
1459cdf0e10cSrcweir {
1460cdf0e10cSrcweir 	sal_Bool bFlag;
1461cdf0e10cSrcweir 	rStrm >> bFlag;
1462cdf0e10cSrcweir 	return new SvxScriptSpaceItem( bFlag, Which() );
1463cdf0e10cSrcweir }
1464cdf0e10cSrcweir 
GetVersion(sal_uInt16 nFFVer) const1465cdf0e10cSrcweir sal_uInt16	SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer ) const
1466cdf0e10cSrcweir {
1467cdf0e10cSrcweir 	DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
1468cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_40==nFFVer ||
1469cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_50==nFFVer,
1470cdf0e10cSrcweir 			"SvxTwoLinesItem: Gibt es ein neues Fileformat?" );
1471cdf0e10cSrcweir 
1472cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
1473cdf0e10cSrcweir }
1474cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,String & rText,const IntlWrapper *) const1475cdf0e10cSrcweir SfxItemPresentation SvxScriptSpaceItem::GetPresentation(
1476cdf0e10cSrcweir 		SfxItemPresentation ePres,
1477cdf0e10cSrcweir         SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
1478cdf0e10cSrcweir         String &rText, const IntlWrapper* /*pIntl*/ ) const
1479cdf0e10cSrcweir {
1480cdf0e10cSrcweir 	switch( ePres )
1481cdf0e10cSrcweir 	{
1482cdf0e10cSrcweir 	case SFX_ITEM_PRESENTATION_NONE:
1483cdf0e10cSrcweir 		rText.Erase();
1484cdf0e10cSrcweir 		break;
1485cdf0e10cSrcweir 	case SFX_ITEM_PRESENTATION_NAMELESS:
1486cdf0e10cSrcweir 	case SFX_ITEM_PRESENTATION_COMPLETE:
1487cdf0e10cSrcweir 		{
1488cdf0e10cSrcweir 			rText = EE_RESSTR( !GetValue()
1489cdf0e10cSrcweir 									? RID_SVXITEMS_SCRPTSPC_OFF
1490cdf0e10cSrcweir 									: RID_SVXITEMS_SCRPTSPC_ON );
1491cdf0e10cSrcweir 			return ePres;
1492cdf0e10cSrcweir 		}
1493cdf0e10cSrcweir     default: ;//prevent warning
1494cdf0e10cSrcweir     }
1495cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1496cdf0e10cSrcweir }
1497cdf0e10cSrcweir 
1498cdf0e10cSrcweir //------------------------------------------------------------------------
1499cdf0e10cSrcweir 
SvxHangingPunctuationItem(sal_Bool bOn,const sal_uInt16 nId)1500cdf0e10cSrcweir SvxHangingPunctuationItem::SvxHangingPunctuationItem(
1501cdf0e10cSrcweir 									sal_Bool bOn, const sal_uInt16 nId )
1502cdf0e10cSrcweir 	: SfxBoolItem( nId, bOn )
1503cdf0e10cSrcweir {
1504cdf0e10cSrcweir }
1505cdf0e10cSrcweir 
Clone(SfxItemPool *) const1506cdf0e10cSrcweir SfxPoolItem* SvxHangingPunctuationItem::Clone( SfxItemPool * ) const
1507cdf0e10cSrcweir {
1508cdf0e10cSrcweir 	return new SvxHangingPunctuationItem( GetValue(), Which() );
1509cdf0e10cSrcweir }
1510cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const1511cdf0e10cSrcweir SfxPoolItem* SvxHangingPunctuationItem::Create(SvStream & rStrm, sal_uInt16) const
1512cdf0e10cSrcweir {
1513cdf0e10cSrcweir 	sal_Bool nValue;
1514cdf0e10cSrcweir 	rStrm >> nValue;
1515cdf0e10cSrcweir 	return new SvxHangingPunctuationItem( nValue, Which() );
1516cdf0e10cSrcweir }
1517cdf0e10cSrcweir 
GetVersion(sal_uInt16 nFFVer) const1518cdf0e10cSrcweir sal_uInt16 SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer ) const
1519cdf0e10cSrcweir {
1520cdf0e10cSrcweir 	DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
1521cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_40==nFFVer ||
1522cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_50==nFFVer,
1523cdf0e10cSrcweir 			"SvxHangingPunctuationItem: Gibt es ein neues Fileformat?" );
1524cdf0e10cSrcweir 
1525cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,String & rText,const IntlWrapper *) const1528cdf0e10cSrcweir SfxItemPresentation SvxHangingPunctuationItem::GetPresentation(
1529cdf0e10cSrcweir 		SfxItemPresentation ePres,
1530cdf0e10cSrcweir         SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
1531cdf0e10cSrcweir         String &rText, const IntlWrapper* /*pIntl*/ ) const
1532cdf0e10cSrcweir {
1533cdf0e10cSrcweir 	switch( ePres )
1534cdf0e10cSrcweir 	{
1535cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NONE:
1536cdf0e10cSrcweir             rText.Erase();
1537cdf0e10cSrcweir             break;
1538cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NAMELESS:
1539cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_COMPLETE:
1540cdf0e10cSrcweir             {
1541cdf0e10cSrcweir                 rText = EE_RESSTR( !GetValue()
1542cdf0e10cSrcweir                                         ? RID_SVXITEMS_HNGPNCT_OFF
1543cdf0e10cSrcweir                                         : RID_SVXITEMS_HNGPNCT_ON );
1544cdf0e10cSrcweir                 return ePres;
1545cdf0e10cSrcweir             }
1546cdf0e10cSrcweir         default: ;//prevent warning
1547cdf0e10cSrcweir 			break;
1548cdf0e10cSrcweir     }
1549cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1550cdf0e10cSrcweir }
1551cdf0e10cSrcweir //------------------------------------------------------------------------
1552cdf0e10cSrcweir 
SvxForbiddenRuleItem(sal_Bool bOn,const sal_uInt16 nId)1553cdf0e10cSrcweir SvxForbiddenRuleItem::SvxForbiddenRuleItem(
1554cdf0e10cSrcweir 									sal_Bool bOn, const sal_uInt16 nId )
1555cdf0e10cSrcweir 	: SfxBoolItem( nId, bOn )
1556cdf0e10cSrcweir {
1557cdf0e10cSrcweir }
1558cdf0e10cSrcweir /* -----------------------------29.11.00 11:23--------------------------------
1559cdf0e10cSrcweir 
1560cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
Clone(SfxItemPool *) const1561cdf0e10cSrcweir SfxPoolItem* SvxForbiddenRuleItem::Clone( SfxItemPool * ) const
1562cdf0e10cSrcweir {
1563cdf0e10cSrcweir 	return new SvxForbiddenRuleItem( GetValue(), Which() );
1564cdf0e10cSrcweir }
1565cdf0e10cSrcweir /* -----------------------------29.11.00 11:23--------------------------------
1566cdf0e10cSrcweir 
1567cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
Create(SvStream & rStrm,sal_uInt16) const1568cdf0e10cSrcweir SfxPoolItem* SvxForbiddenRuleItem::Create(SvStream & rStrm, sal_uInt16) const
1569cdf0e10cSrcweir {
1570cdf0e10cSrcweir 	sal_Bool nValue;
1571cdf0e10cSrcweir 	rStrm >> nValue;
1572cdf0e10cSrcweir 	return new SvxForbiddenRuleItem( nValue, Which() );
1573cdf0e10cSrcweir }
1574cdf0e10cSrcweir /* -----------------------------29.11.00 11:23--------------------------------
1575cdf0e10cSrcweir 
1576cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetVersion(sal_uInt16 nFFVer) const1577cdf0e10cSrcweir sal_uInt16 SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer ) const
1578cdf0e10cSrcweir {
1579cdf0e10cSrcweir 	DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
1580cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_40==nFFVer ||
1581cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_50==nFFVer,
1582cdf0e10cSrcweir 			"SvxForbiddenRuleItem: Gibt es ein neues Fileformat?" );
1583cdf0e10cSrcweir 
1584cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
1585cdf0e10cSrcweir }
1586cdf0e10cSrcweir /* -----------------------------29.11.00 11:23--------------------------------
1587cdf0e10cSrcweir 
1588cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,String & rText,const IntlWrapper *) const1589cdf0e10cSrcweir SfxItemPresentation SvxForbiddenRuleItem::GetPresentation(
1590cdf0e10cSrcweir 		SfxItemPresentation ePres,
1591cdf0e10cSrcweir         SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
1592cdf0e10cSrcweir         String &rText, const IntlWrapper* /*pIntl*/ ) const
1593cdf0e10cSrcweir {
1594cdf0e10cSrcweir 	switch( ePres )
1595cdf0e10cSrcweir 	{
1596cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NONE:
1597cdf0e10cSrcweir             rText.Erase();
1598cdf0e10cSrcweir             break;
1599cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NAMELESS:
1600cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_COMPLETE:
1601cdf0e10cSrcweir             {
1602cdf0e10cSrcweir                 rText = EE_RESSTR( !GetValue()
1603cdf0e10cSrcweir                                         ? RID_SVXITEMS_FORBIDDEN_RULE_OFF
1604cdf0e10cSrcweir                                         : RID_SVXITEMS_FORBIDDEN_RULE_ON );
1605cdf0e10cSrcweir                 return ePres;
1606cdf0e10cSrcweir             }
1607cdf0e10cSrcweir         default: ;//prevent warning
1608cdf0e10cSrcweir 			break;
1609cdf0e10cSrcweir     }
1610cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1611cdf0e10cSrcweir }
1612cdf0e10cSrcweir 
1613cdf0e10cSrcweir /*************************************************************************
1614cdf0e10cSrcweir |*    class SvxParaVertAlignItem
1615cdf0e10cSrcweir *************************************************************************/
1616cdf0e10cSrcweir 
SvxParaVertAlignItem(sal_uInt16 nValue,const sal_uInt16 nW)1617cdf0e10cSrcweir SvxParaVertAlignItem::SvxParaVertAlignItem( sal_uInt16 nValue,
1618cdf0e10cSrcweir 	const sal_uInt16 nW )
1619cdf0e10cSrcweir 	: SfxUInt16Item( nW, nValue )
1620cdf0e10cSrcweir {
1621cdf0e10cSrcweir }
1622cdf0e10cSrcweir 
Clone(SfxItemPool *) const1623cdf0e10cSrcweir SfxPoolItem* SvxParaVertAlignItem::Clone( SfxItemPool* ) const
1624cdf0e10cSrcweir {
1625cdf0e10cSrcweir 	return new SvxParaVertAlignItem( GetValue(), Which() );
1626cdf0e10cSrcweir }
1627cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const1628cdf0e10cSrcweir SfxPoolItem* SvxParaVertAlignItem::Create( SvStream& rStrm, sal_uInt16 ) const
1629cdf0e10cSrcweir {
1630cdf0e10cSrcweir 	sal_uInt16 nVal;
1631cdf0e10cSrcweir 	rStrm >> nVal;
1632cdf0e10cSrcweir 	return new SvxParaVertAlignItem( nVal, Which() );
1633cdf0e10cSrcweir }
1634cdf0e10cSrcweir 
Store(SvStream & rStrm,sal_uInt16) const1635cdf0e10cSrcweir SvStream& SvxParaVertAlignItem::Store( SvStream & rStrm, sal_uInt16 ) const
1636cdf0e10cSrcweir {
1637cdf0e10cSrcweir 	rStrm << GetValue();
1638cdf0e10cSrcweir 	return rStrm;
1639cdf0e10cSrcweir }
1640cdf0e10cSrcweir 
GetVersion(sal_uInt16 nFFVer) const1641cdf0e10cSrcweir sal_uInt16 SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer ) const
1642cdf0e10cSrcweir {
1643cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
1644cdf0e10cSrcweir }
1645cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,String & rText,const IntlWrapper *) const1646cdf0e10cSrcweir SfxItemPresentation SvxParaVertAlignItem::GetPresentation(
1647cdf0e10cSrcweir 		SfxItemPresentation ePres,
1648cdf0e10cSrcweir         SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
1649cdf0e10cSrcweir         String &rText, const IntlWrapper*  ) const
1650cdf0e10cSrcweir {
1651cdf0e10cSrcweir 	switch( ePres )
1652cdf0e10cSrcweir 	{
1653cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NONE:
1654cdf0e10cSrcweir             rText.Erase();
1655cdf0e10cSrcweir             break;
1656cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NAMELESS:
1657cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_COMPLETE:
1658cdf0e10cSrcweir             {
1659cdf0e10cSrcweir                 sal_uInt16 nTmp;
1660cdf0e10cSrcweir                 switch( GetValue() )
1661cdf0e10cSrcweir                 {
1662cdf0e10cSrcweir                     case AUTOMATIC: nTmp = RID_SVXITEMS_PARAVERTALIGN_AUTO; break;
1663cdf0e10cSrcweir                     case TOP:       nTmp = RID_SVXITEMS_PARAVERTALIGN_TOP; break;
1664cdf0e10cSrcweir                     case CENTER:    nTmp = RID_SVXITEMS_PARAVERTALIGN_CENTER; break;
1665cdf0e10cSrcweir                     case BOTTOM:    nTmp = RID_SVXITEMS_PARAVERTALIGN_BOTTOM; break;
1666cdf0e10cSrcweir                     default:    nTmp = RID_SVXITEMS_PARAVERTALIGN_BASELINE; break;
1667cdf0e10cSrcweir                 }
1668cdf0e10cSrcweir                 rText = EE_RESSTR( nTmp );
1669cdf0e10cSrcweir                 return ePres;
1670cdf0e10cSrcweir             }
1671cdf0e10cSrcweir         default: ;//prevent warning
1672cdf0e10cSrcweir 			break;
1673cdf0e10cSrcweir     }
1674cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1675cdf0e10cSrcweir }
1676cdf0e10cSrcweir 
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const1677cdf0e10cSrcweir sal_Bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any& rVal,
1678cdf0e10cSrcweir                                            sal_uInt8 /*nMemberId*/ ) const
1679cdf0e10cSrcweir {
1680cdf0e10cSrcweir 	rVal <<= (sal_Int16)GetValue();
1681cdf0e10cSrcweir 	return sal_True;
1682cdf0e10cSrcweir }
1683cdf0e10cSrcweir 
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)1684cdf0e10cSrcweir sal_Bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any& rVal,
1685cdf0e10cSrcweir                                          sal_uInt8 /*nMemberId*/ )
1686cdf0e10cSrcweir {
1687cdf0e10cSrcweir 	sal_Int16 nVal = sal_Int16();
1688cdf0e10cSrcweir     if((rVal >>= nVal) && nVal >=0 && nVal <= BOTTOM )
1689cdf0e10cSrcweir     {
1690cdf0e10cSrcweir         SetValue( (sal_uInt16)nVal );
1691cdf0e10cSrcweir         return sal_True;
1692cdf0e10cSrcweir     }
1693cdf0e10cSrcweir     else
1694cdf0e10cSrcweir         return sal_False;
1695cdf0e10cSrcweir }
1696cdf0e10cSrcweir 
operator ==(const SfxPoolItem & rItem) const1697cdf0e10cSrcweir int SvxParaVertAlignItem::operator==( const SfxPoolItem& rItem ) const
1698cdf0e10cSrcweir {
1699cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
1700cdf0e10cSrcweir 	return SfxUInt16Item::operator==( rItem );
1701cdf0e10cSrcweir }
1702cdf0e10cSrcweir 
1703cdf0e10cSrcweir 
SvxParaGridItem(sal_Bool bOn,const sal_uInt16 nId)1704cdf0e10cSrcweir SvxParaGridItem::SvxParaGridItem( sal_Bool bOn, const sal_uInt16 nId )
1705cdf0e10cSrcweir 	: SfxBoolItem( nId, bOn )
1706cdf0e10cSrcweir {
1707cdf0e10cSrcweir }
1708cdf0e10cSrcweir 
Clone(SfxItemPool *) const1709cdf0e10cSrcweir SfxPoolItem* SvxParaGridItem::Clone( SfxItemPool * ) const
1710cdf0e10cSrcweir {
1711cdf0e10cSrcweir     return new SvxParaGridItem( GetValue(), Which() );
1712cdf0e10cSrcweir }
1713cdf0e10cSrcweir 
Create(SvStream & rStrm,sal_uInt16) const1714cdf0e10cSrcweir SfxPoolItem* SvxParaGridItem::Create(SvStream & rStrm, sal_uInt16) const
1715cdf0e10cSrcweir {
1716cdf0e10cSrcweir 	sal_Bool bFlag;
1717cdf0e10cSrcweir 	rStrm >> bFlag;
1718cdf0e10cSrcweir     return new SvxParaGridItem( bFlag, Which() );
1719cdf0e10cSrcweir }
1720cdf0e10cSrcweir 
GetVersion(sal_uInt16 nFFVer) const1721cdf0e10cSrcweir sal_uInt16  SvxParaGridItem::GetVersion( sal_uInt16 nFFVer ) const
1722cdf0e10cSrcweir {
1723cdf0e10cSrcweir 	DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
1724cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_40==nFFVer ||
1725cdf0e10cSrcweir 			SOFFICE_FILEFORMAT_50==nFFVer,
1726cdf0e10cSrcweir             "SvxParaGridItem: Gibt es ein neues Fileformat?" );
1727cdf0e10cSrcweir 
1728cdf0e10cSrcweir 	return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
1729cdf0e10cSrcweir }
1730cdf0e10cSrcweir 
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,String & rText,const IntlWrapper *) const1731cdf0e10cSrcweir SfxItemPresentation SvxParaGridItem::GetPresentation(
1732cdf0e10cSrcweir 		SfxItemPresentation ePres,
1733cdf0e10cSrcweir         SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
1734cdf0e10cSrcweir         String &rText, const IntlWrapper* /*pIntl*/ ) const
1735cdf0e10cSrcweir {
1736cdf0e10cSrcweir 	switch( ePres )
1737cdf0e10cSrcweir 	{
1738cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NONE:
1739cdf0e10cSrcweir             rText.Erase();
1740cdf0e10cSrcweir             break;
1741cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_NAMELESS:
1742cdf0e10cSrcweir         case SFX_ITEM_PRESENTATION_COMPLETE:
1743cdf0e10cSrcweir             {
1744cdf0e10cSrcweir                 rText = GetValue() ?
1745cdf0e10cSrcweir                         EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_ON ) :
1746cdf0e10cSrcweir                         EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_OFF );
1747cdf0e10cSrcweir 
1748cdf0e10cSrcweir                 return ePres;
1749cdf0e10cSrcweir             }
1750cdf0e10cSrcweir         default: ;//prevent warning
1751cdf0e10cSrcweir 			break;
1752cdf0e10cSrcweir     }
1753cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NONE;
1754cdf0e10cSrcweir }
1755cdf0e10cSrcweir 
1756cdf0e10cSrcweir 
1757