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