1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/style/TabStop.hpp>
21 #include <com/sun/star/style/LineSpacing.hpp>
22 #include <com/sun/star/style/LineSpacingMode.hpp>
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <comphelper/processfactory.hxx>
25 #include <unotools/syslocale.hxx>
26 #include <comphelper/types.hxx>
27 #include <tools/rtti.hxx>
28 #include <tools/mapunit.hxx>
29 #include <svl/itempool.hxx>
30 #include <svl/memberid.hrc>
31 #include <editeng/editrids.hrc>
32 #include <editeng/lspcitem.hxx>
33 #include <editeng/adjustitem.hxx>
34 #include <editeng/orphitem.hxx>
35 #include <editeng/widwitem.hxx>
36 #include <editeng/tstpitem.hxx>
37 #include <editeng/pmdlitem.hxx>
38 #include <editeng/spltitem.hxx>
39 #include <editeng/hyphenzoneitem.hxx>
40 #include <editeng/scriptspaceitem.hxx>
41 #include <editeng/hngpnctitem.hxx>
42 #include <editeng/forbiddenruleitem.hxx>
43 #include <editeng/paravertalignitem.hxx>
44 #include <editeng/pgrditem.hxx>
45 #include <rtl/ustring.hxx>
46 #include <editeng/memberids.hrc>
47 #include <editeng/editids.hrc>
48 #include <editeng/itemtype.hxx>
49 #include <editeng/eerdll.hxx>
50 #include <editeng/paperinf.hxx>
51 #include <vcl/svapp.hxx>
54 using namespace ::com::sun::star
;
56 TYPEINIT1_FACTORY(SvxLineSpacingItem
, SfxPoolItem
, new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT
, 0));
57 TYPEINIT1_FACTORY(SvxAdjustItem
, SfxPoolItem
, new SvxAdjustItem(SVX_ADJUST_LEFT
, 0));
58 TYPEINIT1_FACTORY(SvxWidowsItem
, SfxByteItem
, new SvxWidowsItem(0, 0));
59 TYPEINIT1_FACTORY(SvxOrphansItem
, SfxByteItem
, new SvxOrphansItem(0, 0));
60 TYPEINIT1_FACTORY(SvxHyphenZoneItem
, SfxPoolItem
, new SvxHyphenZoneItem(false, 0));
61 TYPEINIT1_FACTORY(SvxTabStopItem
, SfxPoolItem
, new SvxTabStopItem(0));
62 TYPEINIT1_FACTORY(SvxFormatSplitItem
, SfxBoolItem
, new SvxFormatSplitItem(false, 0));
63 TYPEINIT1_FACTORY(SvxPageModelItem
, SfxStringItem
, new SvxPageModelItem(0));
64 TYPEINIT1_FACTORY(SvxScriptSpaceItem
, SfxBoolItem
, new SvxScriptSpaceItem(false, 0));
65 TYPEINIT1_FACTORY(SvxHangingPunctuationItem
, SfxBoolItem
, new SvxHangingPunctuationItem(false, 0));
66 TYPEINIT1_FACTORY(SvxForbiddenRuleItem
, SfxBoolItem
, new SvxForbiddenRuleItem(false, 0));
67 TYPEINIT1_FACTORY(SvxParaVertAlignItem
, SfxUInt16Item
, new SvxParaVertAlignItem(0, 0));
68 TYPEINIT1_FACTORY(SvxParaGridItem
, SfxBoolItem
, new SvxParaGridItem(true, 0));
72 SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight
, const sal_uInt16 nId
)
73 : SfxEnumItemInterface( nId
)
77 nLineHeight
= nHeight
;
78 eLineSpace
= SVX_LINE_SPACE_AUTO
;
79 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
84 bool SvxLineSpacingItem::operator==( const SfxPoolItem
& rAttr
) const
86 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
88 const SvxLineSpacingItem
& rLineSpace
= static_cast<const SvxLineSpacingItem
&>(rAttr
);
90 // Same Linespacing Rule?
91 (eLineSpace
== rLineSpace
.eLineSpace
)
92 // For maximum and minimum Linespacing be the size must coincide.
93 && (eLineSpace
== SVX_LINE_SPACE_AUTO
||
94 nLineHeight
== rLineSpace
.nLineHeight
)
95 // Same Linespacing Rule?
96 && ( eInterLineSpace
== rLineSpace
.eInterLineSpace
)
97 // Either set proportional or additive.
98 && (( eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
99 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_PROP
100 && nPropLineSpace
== rLineSpace
.nPropLineSpace
)
101 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
102 && (nInterLineSpace
== rLineSpace
.nInterLineSpace
)));
105 /* Who does still know why the LineSpacingItem is so complicated?
106 We can not use it for UNO since there are only two values:
107 - ein sal_uInt16 for the mode
108 - ein sal_uInt32 for all values (distance, height, rel. detail)
110 bool SvxLineSpacingItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
112 bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
113 nMemberId
&= ~CONVERT_TWIPS
;
115 style::LineSpacing aLSp
;
118 case SVX_LINE_SPACE_AUTO
:
119 if(eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
)
121 aLSp
.Mode
= style::LineSpacingMode::LEADING
;
122 aLSp
.Height
= ( bConvert
? (short)convertTwipToMm100(nInterLineSpace
) : nInterLineSpace
);
124 else if(eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
126 aLSp
.Mode
= style::LineSpacingMode::PROP
;
131 aLSp
.Mode
= style::LineSpacingMode::PROP
;
132 aLSp
.Height
= nPropLineSpace
;
135 case SVX_LINE_SPACE_FIX
:
136 case SVX_LINE_SPACE_MIN
:
137 aLSp
.Mode
= eLineSpace
== SVX_LINE_SPACE_FIX
? style::LineSpacingMode::FIX
: style::LineSpacingMode::MINIMUM
;
138 aLSp
.Height
= ( bConvert
? (short)convertTwipToMm100(nLineHeight
) : nLineHeight
);
141 ;//prevent warning about SVX_LINE_SPACE_END
146 case 0 : rVal
<<= aLSp
; break;
147 case MID_LINESPACE
: rVal
<<= aLSp
.Mode
; break;
148 case MID_HEIGHT
: rVal
<<= aLSp
.Height
; break;
149 default: OSL_FAIL("Wrong MemberId!"); break;
155 bool SvxLineSpacingItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
157 bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
158 nMemberId
&= ~CONVERT_TWIPS
;
160 // fill with current data
161 style::LineSpacing aLSp
;
163 bool bRet
= QueryValue( aAny
, bConvert
? CONVERT_TWIPS
: 0 ) && ( aAny
>>= aLSp
);
168 case 0 : bRet
= (rVal
>>= aLSp
); break;
169 case MID_LINESPACE
: bRet
= (rVal
>>= aLSp
.Mode
); break;
170 case MID_HEIGHT
: bRet
= (rVal
>>= aLSp
.Height
); break;
171 default: OSL_FAIL("Wrong MemberId!"); break;
176 nLineHeight
= aLSp
.Height
;
179 case style::LineSpacingMode::LEADING
:
181 eInterLineSpace
= SVX_INTER_LINE_SPACE_FIX
;
182 eLineSpace
= SVX_LINE_SPACE_AUTO
;
183 nInterLineSpace
= aLSp
.Height
;
185 nInterLineSpace
= (short)convertMm100ToTwip(nInterLineSpace
);
189 case style::LineSpacingMode::PROP
:
191 eLineSpace
= SVX_LINE_SPACE_AUTO
;
192 nPropLineSpace
= (sal_Int16
)aLSp
.Height
;
193 if(100 == aLSp
.Height
)
194 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
196 eInterLineSpace
= SVX_INTER_LINE_SPACE_PROP
;
199 case style::LineSpacingMode::FIX
:
200 case style::LineSpacingMode::MINIMUM
:
202 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
203 eLineSpace
= aLSp
.Mode
== style::LineSpacingMode::FIX
? SVX_LINE_SPACE_FIX
: SVX_LINE_SPACE_MIN
;
204 nLineHeight
= aLSp
.Height
;
206 nLineHeight
= (sal_uInt16
)convertMm100ToTwip(nLineHeight
);
217 SfxPoolItem
* SvxLineSpacingItem::Clone( SfxItemPool
* ) const
219 return new SvxLineSpacingItem( *this );
224 bool SvxLineSpacingItem::GetPresentation
226 SfxItemPresentation
/*ePres*/,
227 SfxMapUnit
/*eCoreUnit*/,
228 SfxMapUnit
/*ePresUnit*/,
229 OUString
& rText
, const IntlWrapper
*
233 rText
= "SvxLineSpacingItem";
242 SfxPoolItem
* SvxLineSpacingItem::Create(SvStream
& rStrm
, sal_uInt16
) const
247 sal_Int8 nRule
, nInterRule
;
249 rStrm
.ReadSChar( nPropSpace
)
250 .ReadInt16( nInterSpace
)
251 .ReadUInt16( nHeight
)
253 .ReadSChar( nInterRule
);
255 SvxLineSpacingItem
* pAttr
= new SvxLineSpacingItem( nHeight
, Which() );
256 pAttr
->SetInterLineSpace( nInterSpace
);
257 pAttr
->SetPropLineSpace( nPropSpace
);
258 pAttr
->GetLineSpaceRule() = (SvxLineSpace
)nRule
;
259 pAttr
->GetInterLineSpaceRule() = (SvxInterLineSpace
)nInterRule
;
265 SvStream
& SvxLineSpacingItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
267 rStrm
.WriteSChar( GetPropLineSpace() )
268 .WriteInt16( GetInterLineSpace() )
269 .WriteUInt16( GetLineHeight() )
270 .WriteSChar( GetLineSpaceRule() )
271 .WriteSChar( GetInterLineSpaceRule() );
277 sal_uInt16
SvxLineSpacingItem::GetValueCount() const
279 return SVX_LINESPACE_END
; // SVX_LINESPACE_TWO_LINES + 1
284 OUString
SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos
) const
286 //! load strings from resource
290 case SVX_LINESPACE_USER
:
293 case SVX_LINESPACE_ONE_LINE
:
296 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
:
299 case SVX_LINESPACE_TWO_LINES
:
308 sal_uInt16
SvxLineSpacingItem::GetEnumValue() const
311 switch ( nPropLineSpace
)
313 case 100: nVal
= SVX_LINESPACE_ONE_LINE
; break;
314 case 150: nVal
= SVX_LINESPACE_ONE_POINT_FIVE_LINES
; break;
315 case 200: nVal
= SVX_LINESPACE_TWO_LINES
; break;
316 default: nVal
= SVX_LINESPACE_USER
; break;
323 void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal
)
327 case SVX_LINESPACE_ONE_LINE
: nPropLineSpace
= 100; break;
328 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
: nPropLineSpace
= 150; break;
329 case SVX_LINESPACE_TWO_LINES
: nPropLineSpace
= 200; break;
333 // class SvxAdjustItem ---------------------------------------------------
335 SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst
, const sal_uInt16 nId
)
336 : SfxEnumItemInterface( nId
),
337 bOneBlock( false ), bLastCenter( false ), bLastBlock( false )
344 bool SvxAdjustItem::operator==( const SfxPoolItem
& rAttr
) const
346 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
348 const SvxAdjustItem
& rItem
= static_cast<const SvxAdjustItem
&>(rAttr
);
349 return GetAdjust() == rItem
.GetAdjust() &&
350 bOneBlock
== rItem
.bOneBlock
&&
351 bLastCenter
== rItem
.bLastCenter
&&
352 bLastBlock
== rItem
.bLastBlock
;
355 bool SvxAdjustItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
357 nMemberId
&= ~CONVERT_TWIPS
;
360 case MID_PARA_ADJUST
: rVal
<<= (sal_Int16
)GetAdjust(); break;
361 case MID_LAST_LINE_ADJUST
: rVal
<<= (sal_Int16
)GetLastBlock(); break;
362 case MID_EXPAND_SINGLE
:
364 sal_Bool bValue
= bOneBlock
;
365 rVal
.setValue( &bValue
, cppu::UnoType
<bool>::get() );
368 default: ;//prevent warning
373 bool SvxAdjustItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
375 nMemberId
&= ~CONVERT_TWIPS
;
378 case MID_PARA_ADJUST
:
379 case MID_LAST_LINE_ADJUST
:
381 sal_Int32 eVal
= - 1;
384 eVal
= ::comphelper::getEnumAsINT32(rVal
);
387 if(eVal
>= 0 && eVal
<= 4)
389 if(MID_LAST_LINE_ADJUST
== nMemberId
&&
390 eVal
!= SVX_ADJUST_LEFT
&&
391 eVal
!= SVX_ADJUST_BLOCK
&&
392 eVal
!= SVX_ADJUST_CENTER
)
394 if(eVal
< (sal_uInt16
)SVX_ADJUST_END
)
395 nMemberId
== MID_PARA_ADJUST
?
396 SetAdjust((SvxAdjust
)eVal
) :
397 SetLastBlock((SvxAdjust
)eVal
);
401 case MID_EXPAND_SINGLE
:
402 bOneBlock
= Any2Bool(rVal
);
410 SfxPoolItem
* SvxAdjustItem::Clone( SfxItemPool
* ) const
412 return new SvxAdjustItem( *this );
417 bool SvxAdjustItem::GetPresentation
419 SfxItemPresentation ePres
,
420 SfxMapUnit
/*eCoreUnit*/,
421 SfxMapUnit
/*ePresUnit*/,
422 OUString
& rText
, const IntlWrapper
*
427 case SFX_ITEM_PRESENTATION_NAMELESS
:
428 case SFX_ITEM_PRESENTATION_COMPLETE
:
429 rText
= GetValueTextByPos( (sal_uInt16
)GetAdjust() );
431 default: ;//prevent warning
438 sal_uInt16
SvxAdjustItem::GetValueCount() const
440 return SVX_ADJUST_END
; // SVX_ADJUST_BLOCKLINE + 1
445 OUString
SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos
) const
447 DBG_ASSERT( nPos
<= (sal_uInt16
)SVX_ADJUST_BLOCKLINE
, "enum overflow!" );
448 return EE_RESSTR(RID_SVXITEMS_ADJUST_BEGIN
+ nPos
);
453 sal_uInt16
SvxAdjustItem::GetEnumValue() const
455 return (sal_uInt16
)GetAdjust();
460 void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal
)
462 SetAdjust( (const SvxAdjust
)nVal
);
467 sal_uInt16
SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion
) const
469 return (nFileVersion
== SOFFICE_FILEFORMAT_31
)
470 ? 0 : ADJUST_LASTBLOCK_VERSION
;
475 SfxPoolItem
* SvxAdjustItem::Create(SvStream
& rStrm
, sal_uInt16 nVersion
) const
478 rStrm
.ReadChar( eAdjustment
);
479 SvxAdjustItem
*pRet
= new SvxAdjustItem( (SvxAdjust
)eAdjustment
, Which() );
480 if( nVersion
>= ADJUST_LASTBLOCK_VERSION
)
483 rStrm
.ReadSChar( nFlags
);
484 pRet
->bOneBlock
= 0 != (nFlags
& 0x0001);
485 pRet
->bLastCenter
= 0 != (nFlags
& 0x0002);
486 pRet
->bLastBlock
= 0 != (nFlags
& 0x0004);
493 SvStream
& SvxAdjustItem::Store( SvStream
& rStrm
, sal_uInt16 nItemVersion
) const
495 rStrm
.WriteChar( (char)GetAdjust() );
496 if ( nItemVersion
>= ADJUST_LASTBLOCK_VERSION
)
505 rStrm
.WriteSChar( nFlags
);
510 // class SvxWidowsItem ---------------------------------------------------
512 SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL
, const sal_uInt16 nId
) :
513 SfxByteItem( nId
, nL
)
519 SfxPoolItem
* SvxWidowsItem::Clone( SfxItemPool
* ) const
521 return new SvxWidowsItem( *this );
526 SfxPoolItem
* SvxWidowsItem::Create(SvStream
& rStrm
, sal_uInt16
) const
529 rStrm
.ReadSChar( nLines
);
530 return new SvxWidowsItem( nLines
, Which() );
535 SvStream
& SvxWidowsItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
537 rStrm
.WriteSChar( GetValue() );
543 bool SvxWidowsItem::GetPresentation
545 SfxItemPresentation ePres
,
546 SfxMapUnit
/*eCoreUnit*/,
547 SfxMapUnit
/*ePresUnit*/,
548 OUString
& rText
, const IntlWrapper
*
553 case SFX_ITEM_PRESENTATION_NAMELESS
:
555 rText
= EE_RESSTR(RID_SVXITEMS_LINES
);
559 case SFX_ITEM_PRESENTATION_COMPLETE
:
561 rText
= EE_RESSTR(RID_SVXITEMS_WIDOWS_COMPLETE
) + " " + EE_RESSTR(RID_SVXITEMS_LINES
);
567 SAL_WARN( "editeng.items", "SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" );
571 rText
= rText
.replaceFirst( "%1", OUString::number( GetValue() ) );
575 // class SvxOrphansItem --------------------------------------------------
577 SvxOrphansItem::SvxOrphansItem(const sal_uInt8 nL
, const sal_uInt16 nId
) :
578 SfxByteItem( nId
, nL
)
584 SfxPoolItem
* SvxOrphansItem::Clone( SfxItemPool
* ) const
586 return new SvxOrphansItem( *this );
591 SfxPoolItem
* SvxOrphansItem::Create(SvStream
& rStrm
, sal_uInt16
) const
594 rStrm
.ReadSChar( nLines
);
595 return new SvxOrphansItem( nLines
, Which() );
600 SvStream
& SvxOrphansItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
602 rStrm
.WriteSChar( GetValue() );
608 bool SvxOrphansItem::GetPresentation
610 SfxItemPresentation ePres
,
611 SfxMapUnit
/*eCoreUnit*/,
612 SfxMapUnit
/*ePresUnit*/,
613 OUString
& rText
, const IntlWrapper
*
618 case SFX_ITEM_PRESENTATION_NAMELESS
:
620 rText
= EE_RESSTR(RID_SVXITEMS_LINES
);
624 case SFX_ITEM_PRESENTATION_COMPLETE
:
626 rText
= EE_RESSTR(RID_SVXITEMS_ORPHANS_COMPLETE
) + " " + EE_RESSTR(RID_SVXITEMS_LINES
);
632 SAL_WARN( "editeng.items", "SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" );
636 rText
= rText
.replaceFirst( "%1", OUString::number( GetValue() ) );
640 // class SvxHyphenZoneItem -----------------------------------------------
642 SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph
, const sal_uInt16 nId
) :
647 nMinLead
= nMinTrail
= 0;
652 bool SvxHyphenZoneItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
654 nMemberId
&= ~CONVERT_TWIPS
;
658 rVal
= Bool2Any(bHyphen
);
660 case MID_HYPHEN_MIN_LEAD
:
661 rVal
<<= (sal_Int16
)nMinLead
;
663 case MID_HYPHEN_MIN_TRAIL
:
664 rVal
<<= (sal_Int16
)nMinTrail
;
666 case MID_HYPHEN_MAX_HYPHENS
:
667 rVal
<<= (sal_Int16
)nMaxHyphens
;
673 bool SvxHyphenZoneItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
675 nMemberId
&= ~CONVERT_TWIPS
;
676 sal_Int16 nNewVal
= 0;
678 if( nMemberId
!= MID_IS_HYPHEN
)
679 if(!(rVal
>>= nNewVal
))
685 bHyphen
= Any2Bool(rVal
);
687 case MID_HYPHEN_MIN_LEAD
:
688 nMinLead
= (sal_uInt8
)nNewVal
;
690 case MID_HYPHEN_MIN_TRAIL
:
691 nMinTrail
= (sal_uInt8
)nNewVal
;
693 case MID_HYPHEN_MAX_HYPHENS
:
694 nMaxHyphens
= (sal_uInt8
)nNewVal
;
702 bool SvxHyphenZoneItem::operator==( const SfxPoolItem
& rAttr
) const
704 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
706 const SvxHyphenZoneItem
& rItem
= static_cast<const SvxHyphenZoneItem
&>(rAttr
);
707 return ( rItem
.bHyphen
== bHyphen
708 && rItem
.bPageEnd
== bPageEnd
709 && rItem
.nMinLead
== nMinLead
710 && rItem
.nMinTrail
== nMinTrail
711 && rItem
.nMaxHyphens
== nMaxHyphens
);
716 SfxPoolItem
* SvxHyphenZoneItem::Clone( SfxItemPool
* ) const
718 return new SvxHyphenZoneItem( *this );
723 bool SvxHyphenZoneItem::GetPresentation
725 SfxItemPresentation ePres
,
726 SfxMapUnit
/*eCoreUnit*/,
727 SfxMapUnit
/*ePresUnit*/,
728 OUString
& rText
, const IntlWrapper
*
731 OUString
cpDelimTmp(cpDelim
);
734 case SFX_ITEM_PRESENTATION_NAMELESS
:
736 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
739 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
740 rText
= EE_RESSTR(nId
) + cpDelimTmp
;
741 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
744 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
745 rText
= rText
+ EE_RESSTR(nId
) + cpDelimTmp
+
746 OUString::number( nMinLead
) + cpDelimTmp
+
747 OUString::number( nMinTrail
) + cpDelimTmp
+
748 OUString::number( nMaxHyphens
);
751 case SFX_ITEM_PRESENTATION_COMPLETE
:
753 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
756 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
757 rText
= EE_RESSTR(nId
) + cpDelimTmp
;
758 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
761 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
765 EE_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD
).replaceAll("%1", OUString::number(nMinLead
)) +
767 EE_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL
).replaceAll("%1", OUString::number(nMinTrail
)) +
769 EE_RESSTR(RID_SVXITEMS_HYPHEN_MAX
).replaceAll("%1", OUString::number(nMaxHyphens
));
772 default: ;//prevent warning
779 SfxPoolItem
* SvxHyphenZoneItem::Create(SvStream
& rStrm
, sal_uInt16
) const
781 sal_Int8 _bHyphen
, _bHyphenPageEnd
;
782 sal_Int8 _nMinLead
, _nMinTrail
, _nMaxHyphens
;
783 rStrm
.ReadSChar( _bHyphen
).ReadSChar( _bHyphenPageEnd
).ReadSChar( _nMinLead
).ReadSChar( _nMinTrail
).ReadSChar( _nMaxHyphens
);
784 SvxHyphenZoneItem
* pAttr
= new SvxHyphenZoneItem( false, Which() );
785 pAttr
->SetHyphen( _bHyphen
!= 0 );
786 pAttr
->SetPageEnd( _bHyphenPageEnd
!= 0 );
787 pAttr
->GetMinLead() = _nMinLead
;
788 pAttr
->GetMinTrail() = _nMinTrail
;
789 pAttr
->GetMaxHyphens() = _nMaxHyphens
;
795 SvStream
& SvxHyphenZoneItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
797 rStrm
.WriteSChar( (sal_Int8
) IsHyphen() )
798 .WriteSChar( (sal_Int8
) IsPageEnd() )
799 .WriteSChar( GetMinLead() )
800 .WriteSChar( GetMinTrail() )
801 .WriteSChar( GetMaxHyphens() );
805 // class SvxTabStop ------------------------------------------------------
807 SvxTabStop::SvxTabStop()
810 eAdjustment
= SVX_TAB_ADJUST_LEFT
;
811 m_cDecimal
= cDfltDecimalChar
;
812 cFill
= cDfltFillChar
;
817 SvxTabStop::SvxTabStop( const sal_Int32 nPos
, const SvxTabAdjust eAdjst
,
818 const sal_Unicode cDec
, const sal_Unicode cFil
)
821 eAdjustment
= eAdjst
;
826 void SvxTabStop::fillDecimal() const
828 if ( cDfltDecimalChar
== m_cDecimal
)
829 m_cDecimal
= SvtSysLocale().GetLocaleData().getNumDecimalSep()[0];
833 OUString
SvxTabStop::GetValueString() const
836 + OUString::number(nTabPos
)
838 + EE_RESSTR(RID_SVXITEMS_TAB_ADJUST_BEGIN
+ (sal_uInt16
)eAdjustment
)
840 + EE_RESSTR(RID_SVXITEMS_TAB_DECIMAL_CHAR
)
841 + OUString(GetDecimal())
843 + EE_RESSTR(RID_SVXITEMS_TAB_FILL_CHAR
)
850 // class SvxTabStopItem --------------------------------------------------
852 SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich
) :
853 SfxPoolItem( _nWhich
),
856 const sal_uInt16 nTabs
= SVX_TAB_DEFCOUNT
, nDist
= SVX_TAB_DEFDIST
;
857 const SvxTabAdjust eAdjst
= SVX_TAB_ADJUST_DEFAULT
;
859 for (sal_uInt16 i
= 0; i
< nTabs
; ++i
)
861 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
862 maTabStops
.insert( aTab
);
868 SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs
,
869 const sal_uInt16 nDist
,
870 const SvxTabAdjust eAdjst
,
871 sal_uInt16 _nWhich
) :
872 SfxPoolItem( _nWhich
),
875 for ( sal_uInt16 i
= 0; i
< nTabs
; ++i
)
877 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
878 maTabStops
.insert( aTab
);
884 SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem
& rTSI
) :
885 SfxPoolItem( rTSI
.Which() ),
886 maTabStops( rTSI
.maTabStops
)
892 sal_uInt16
SvxTabStopItem::GetPos( const SvxTabStop
& rTab
) const
894 SvxTabStopArr::const_iterator it
= maTabStops
.find( rTab
);
895 return it
!= maTabStops
.end() ? it
- maTabStops
.begin() : SVX_TAB_NOTFOUND
;
900 sal_uInt16
SvxTabStopItem::GetPos( const sal_Int32 nPos
) const
902 SvxTabStopArr::const_iterator it
= maTabStops
.find( SvxTabStop( nPos
) );
903 return it
!= maTabStops
.end() ? it
- maTabStops
.begin() : SVX_TAB_NOTFOUND
;
908 SvxTabStopItem
& SvxTabStopItem::operator=( const SvxTabStopItem
& rTSI
)
910 maTabStops
= rTSI
.maTabStops
;
914 bool SvxTabStopItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
916 bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
917 nMemberId
&= ~CONVERT_TWIPS
;
922 sal_uInt16 nCount
= Count();
923 uno::Sequence
< style::TabStop
> aSeq(nCount
);
924 style::TabStop
* pArr
= aSeq
.getArray();
925 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
927 const SvxTabStop
& rTab
= (*this)[i
];
928 pArr
[i
].Position
= bConvert
? convertTwipToMm100(rTab
.GetTabPos()) : rTab
.GetTabPos();
929 switch(rTab
.GetAdjustment())
931 case SVX_TAB_ADJUST_LEFT
: pArr
[i
].Alignment
= style::TabAlign_LEFT
; break;
932 case SVX_TAB_ADJUST_RIGHT
: pArr
[i
].Alignment
= style::TabAlign_RIGHT
; break;
933 case SVX_TAB_ADJUST_DECIMAL
: pArr
[i
].Alignment
= style::TabAlign_DECIMAL
; break;
934 case SVX_TAB_ADJUST_CENTER
: pArr
[i
].Alignment
= style::TabAlign_CENTER
; break;
935 default: //SVX_TAB_ADJUST_DEFAULT
936 pArr
[i
].Alignment
= style::TabAlign_DEFAULT
;
939 pArr
[i
].DecimalChar
= rTab
.GetDecimal();
940 pArr
[i
].FillChar
= rTab
.GetFill();
947 const SvxTabStop
&rTab
= maTabStops
.front();
948 rVal
<<= (static_cast<sal_Int32
>(bConvert
? convertTwipToMm100(rTab
.GetTabPos()) : rTab
.GetTabPos()));
955 bool SvxTabStopItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
957 bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
958 nMemberId
&= ~CONVERT_TWIPS
;
963 uno::Sequence
< style::TabStop
> aSeq
;
966 uno::Sequence
< uno::Sequence
< uno::Any
> > aAnySeq
;
967 if (!(rVal
>>= aAnySeq
))
969 sal_Int32 nLength
= aAnySeq
.getLength();
970 aSeq
.realloc( nLength
);
971 for ( sal_Int32 n
=0; n
<nLength
; n
++ )
973 uno::Sequence
< uno::Any
>& rAnySeq
= aAnySeq
[n
];
974 if ( rAnySeq
.getLength() == 4 )
976 if (!(rAnySeq
[0] >>= aSeq
[n
].Position
)) return false;
977 if (!(rAnySeq
[1] >>= aSeq
[n
].Alignment
))
980 if (rAnySeq
[1] >>= nVal
)
981 aSeq
[n
].Alignment
= (com::sun::star::style::TabAlign
) nVal
;
985 if (!(rAnySeq
[2] >>= aSeq
[n
].DecimalChar
))
988 if ( (rAnySeq
[2] >>= aVal
) && aVal
.getLength() == 1 )
989 aSeq
[n
].DecimalChar
= aVal
.toChar();
993 if (!(rAnySeq
[3] >>= aSeq
[n
].FillChar
))
996 if ( (rAnySeq
[3] >>= aVal
) && aVal
.getLength() == 1 )
997 aSeq
[n
].FillChar
= aVal
.toChar();
1008 const style::TabStop
* pArr
= aSeq
.getConstArray();
1009 const sal_uInt16 nCount
= (sal_uInt16
)aSeq
.getLength();
1010 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
1012 SvxTabAdjust eAdjust
= SVX_TAB_ADJUST_DEFAULT
;
1013 switch(pArr
[i
].Alignment
)
1015 case style::TabAlign_LEFT
: eAdjust
= SVX_TAB_ADJUST_LEFT
; break;
1016 case style::TabAlign_CENTER
: eAdjust
= SVX_TAB_ADJUST_CENTER
; break;
1017 case style::TabAlign_RIGHT
: eAdjust
= SVX_TAB_ADJUST_RIGHT
; break;
1018 case style::TabAlign_DECIMAL
: eAdjust
= SVX_TAB_ADJUST_DECIMAL
; break;
1019 default: ;//prevent warning
1021 sal_Unicode cFill
= pArr
[i
].FillChar
;
1022 sal_Unicode cDecimal
= pArr
[i
].DecimalChar
;
1023 SvxTabStop
aTab( bConvert
? convertMm100ToTwip(pArr
[i
].Position
) : pArr
[i
].Position
,
1033 sal_Int32 nNewPos
= 0;
1034 if (!(rVal
>>= nNewPos
) )
1037 nNewPos
= convertMm100ToTwip ( nNewPos
);
1040 const SvxTabStop
& rTab
= maTabStops
.front();
1041 SvxTabStop
aNewTab ( nNewPos
, rTab
.GetAdjustment(), rTab
.GetDecimal(), rTab
.GetFill() );
1051 bool SvxTabStopItem::operator==( const SfxPoolItem
& rAttr
) const
1053 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
1055 const SvxTabStopItem
& rTSI
= static_cast<const SvxTabStopItem
&>(rAttr
);
1057 if ( Count() != rTSI
.Count() )
1060 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1061 if( !(*this)[i
].IsEqual( rTSI
[i
] ) )
1068 SfxPoolItem
* SvxTabStopItem::Clone( SfxItemPool
* ) const
1070 return new SvxTabStopItem( *this );
1075 bool SvxTabStopItem::GetPresentation
1077 SfxItemPresentation ePres
,
1078 SfxMapUnit eCoreUnit
,
1079 SfxMapUnit ePresUnit
,
1080 OUString
& rText
, const IntlWrapper
*pIntl
1085 bool bComma
= false;
1087 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1089 if ( SVX_TAB_ADJUST_DEFAULT
!= ((*this)[i
]).GetAdjustment() )
1093 rText
+= GetMetricText(
1094 ((*this)[i
]).GetTabPos(), eCoreUnit
, ePresUnit
, pIntl
);
1095 if ( SFX_ITEM_PRESENTATION_COMPLETE
== ePres
)
1097 rText
+= " " + EE_RESSTR(GetMetricId(ePresUnit
));
1107 SfxPoolItem
* SvxTabStopItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1110 rStrm
.ReadSChar( nTabs
);
1111 SvxTabStopItem
* pAttr
=
1112 new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_DEFAULT
, Which() );
1114 for ( sal_Int8 i
= 0; i
< nTabs
; i
++ )
1118 unsigned char cDecimal
, cFill
;
1119 rStrm
.ReadInt32( nPos
).ReadSChar( eAdjust
).ReadUChar( cDecimal
).ReadUChar( cFill
);
1120 if( !i
|| SVX_TAB_ADJUST_DEFAULT
!= eAdjust
)
1121 pAttr
->Insert( SvxTabStop
1122 ( nPos
, (SvxTabAdjust
)eAdjust
, sal_Unicode(cDecimal
), sal_Unicode(cFill
) ) );
1129 SvStream
& SvxTabStopItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1131 // Default-Tabs are only expanded for the default Attribute. For complete
1132 // backward compabillity (<=304) all tabs have to be expanded, this makes
1133 // the files grow large in size. All only SWG!
1135 const SfxItemPool
*pPool
= SfxItemPool::GetStoringPool();
1136 const bool bStoreDefTabs
= pPool
1137 && pPool
->GetName() == "SWG"
1138 && ::IsDefaultItem( this );
1140 const short nTabs
= Count();
1141 sal_uInt16 nCount
= 0, nDefDist
= 0;
1146 const SvxTabStopItem
& rDefTab
= static_cast<const SvxTabStopItem
&>(
1147 pPool
->GetDefaultItem( pPool
->GetWhich( SID_ATTR_TABSTOP
, false ) ) );
1148 nDefDist
= sal_uInt16( rDefTab
.maTabStops
.front().GetTabPos() );
1149 const sal_Int32 nPos
= nTabs
> 0 ? (*this)[nTabs
-1].GetTabPos() : 0;
1150 nCount
= (sal_uInt16
)(nPos
/ nDefDist
);
1151 nNew
= (nCount
+ 1) * nDefDist
;
1153 if( nNew
<= nPos
+ 50 )
1156 sal_Int32 lA3Width
= SvxPaperInfo::GetPaperSize(PAPER_A3
).Width();
1157 nCount
= (sal_uInt16
)(nNew
< lA3Width
? ( lA3Width
- nNew
) / nDefDist
+ 1 : 0);
1160 rStrm
.WriteSChar( nTabs
+ nCount
);
1161 for ( short i
= 0; i
< nTabs
; i
++ )
1163 const SvxTabStop
& rTab
= (*this)[ i
];
1164 rStrm
.WriteInt32( rTab
.GetTabPos() )
1165 .WriteSChar( rTab
.GetAdjustment() )
1166 .WriteUChar( rTab
.GetDecimal() )
1167 .WriteUChar( rTab
.GetFill() );
1170 if ( bStoreDefTabs
)
1171 for( ; nCount
; --nCount
)
1173 SvxTabStop
aSwTabStop(nNew
, SVX_TAB_ADJUST_DEFAULT
);
1174 rStrm
.WriteInt32( aSwTabStop
.GetTabPos() )
1175 .WriteSChar( aSwTabStop
.GetAdjustment() )
1176 .WriteUChar( aSwTabStop
.GetDecimal() )
1177 .WriteUChar( aSwTabStop
.GetFill() );
1185 bool SvxTabStopItem::Insert( const SvxTabStop
& rTab
)
1187 sal_uInt16 nTabPos
= GetPos(rTab
);
1188 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1190 return maTabStops
.insert( rTab
).second
;
1193 void SvxTabStopItem::Insert( const SvxTabStopItem
* pTabs
, sal_uInt16 nStart
,
1196 for( sal_uInt16 i
= nStart
; i
< nEnd
&& i
< pTabs
->Count(); i
++ )
1198 const SvxTabStop
& rTab
= (*pTabs
)[i
];
1199 sal_uInt16 nTabPos
= GetPos(rTab
);
1200 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1203 for( sal_uInt16 i
= nStart
; i
< nEnd
&& i
< pTabs
->Count(); i
++ )
1205 maTabStops
.insert( (*pTabs
)[i
] );
1211 // class SvxFormatSplitItem -------------------------------------------------
1212 SvxFormatSplitItem::~SvxFormatSplitItem()
1216 SfxPoolItem
* SvxFormatSplitItem::Clone( SfxItemPool
* ) const
1218 return new SvxFormatSplitItem( *this );
1223 SvStream
& SvxFormatSplitItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1225 rStrm
.WriteSChar( (sal_Int8
)GetValue() );
1231 SfxPoolItem
* SvxFormatSplitItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1234 rStrm
.ReadSChar( bIsSplit
);
1235 return new SvxFormatSplitItem( bIsSplit
!= 0, Which() );
1240 bool SvxFormatSplitItem::GetPresentation
1242 SfxItemPresentation
/*ePres*/,
1243 SfxMapUnit
/*eCoreUnit*/,
1244 SfxMapUnit
/*ePresUnit*/,
1245 OUString
& rText
, const IntlWrapper
*
1248 sal_uInt16 nId
= RID_SVXITEMS_FMTSPLIT_FALSE
;
1251 nId
= RID_SVXITEMS_FMTSPLIT_TRUE
;
1252 rText
= EE_RESSTR(nId
);
1258 SfxPoolItem
* SvxPageModelItem::Clone( SfxItemPool
* ) const
1260 return new SvxPageModelItem( *this );
1265 bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
) const
1267 nMemberId
&= ~CONVERT_TWIPS
;
1269 switch ( nMemberId
)
1271 case MID_AUTO
: rVal
<<= bAuto
; break;
1272 case MID_NAME
: rVal
<<= OUString( GetValue() ); break;
1273 default: OSL_FAIL("Wrong MemberId!"); return false;
1279 bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
)
1281 nMemberId
&= ~CONVERT_TWIPS
;
1284 switch ( nMemberId
)
1286 case MID_AUTO
: bRet
= ( rVal
>>= bAuto
); break;
1287 case MID_NAME
: bRet
= ( rVal
>>= aStr
); if ( bRet
) SetValue(aStr
); break;
1288 default: OSL_FAIL("Wrong MemberId!"); return false;
1294 bool SvxPageModelItem::GetPresentation
1296 SfxItemPresentation ePres
,
1297 SfxMapUnit
/*eCoreUnit*/,
1298 SfxMapUnit
/*ePresUnit*/,
1299 OUString
& rText
, const IntlWrapper
*
1303 bool bSet
= !GetValue().isEmpty();
1307 case SFX_ITEM_PRESENTATION_NAMELESS
:
1312 case SFX_ITEM_PRESENTATION_COMPLETE
:
1315 rText
= EE_RESSTR(RID_SVXITEMS_PAGEMODEL_COMPLETE
) + GetValue();
1318 default: ;//prevent warning
1325 SvxScriptSpaceItem::SvxScriptSpaceItem( bool bOn
, const sal_uInt16 nId
)
1326 : SfxBoolItem( nId
, bOn
)
1330 SfxPoolItem
* SvxScriptSpaceItem::Clone( SfxItemPool
* ) const
1332 return new SvxScriptSpaceItem( GetValue(), Which() );
1335 SfxPoolItem
* SvxScriptSpaceItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1338 rStrm
.ReadCharAsBool( bFlag
);
1339 return new SvxScriptSpaceItem( bFlag
, Which() );
1342 sal_uInt16
SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer
) const
1344 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1345 SOFFICE_FILEFORMAT_40
==nFFVer
||
1346 SOFFICE_FILEFORMAT_50
==nFFVer
,
1347 "SvxTwoLinesItem: Is there a new file format? ");
1349 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1352 bool SvxScriptSpaceItem::GetPresentation(
1353 SfxItemPresentation
/*ePres*/,
1354 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1355 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1357 rText
= EE_RESSTR( !GetValue()
1358 ? RID_SVXITEMS_SCRPTSPC_OFF
1359 : RID_SVXITEMS_SCRPTSPC_ON
);
1365 SvxHangingPunctuationItem::SvxHangingPunctuationItem(
1366 bool bOn
, const sal_uInt16 nId
)
1367 : SfxBoolItem( nId
, bOn
)
1371 SfxPoolItem
* SvxHangingPunctuationItem::Clone( SfxItemPool
* ) const
1373 return new SvxHangingPunctuationItem( GetValue(), Which() );
1376 SfxPoolItem
* SvxHangingPunctuationItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1379 rStrm
.ReadCharAsBool( nValue
);
1380 return new SvxHangingPunctuationItem( nValue
, Which() );
1383 sal_uInt16
SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer
) const
1385 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1386 SOFFICE_FILEFORMAT_40
==nFFVer
||
1387 SOFFICE_FILEFORMAT_50
==nFFVer
,
1388 "SvxHangingPunctuationItem: Is there a new file format? ");
1390 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1393 bool SvxHangingPunctuationItem::GetPresentation(
1394 SfxItemPresentation
/*ePres*/,
1395 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1396 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1398 rText
= EE_RESSTR( !GetValue()
1399 ? RID_SVXITEMS_HNGPNCT_OFF
1400 : RID_SVXITEMS_HNGPNCT_ON
);
1405 SvxForbiddenRuleItem::SvxForbiddenRuleItem(
1406 bool bOn
, const sal_uInt16 nId
)
1407 : SfxBoolItem( nId
, bOn
)
1411 SfxPoolItem
* SvxForbiddenRuleItem::Clone( SfxItemPool
* ) const
1413 return new SvxForbiddenRuleItem( GetValue(), Which() );
1416 SfxPoolItem
* SvxForbiddenRuleItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1419 rStrm
.ReadCharAsBool( nValue
);
1420 return new SvxForbiddenRuleItem( nValue
, Which() );
1423 sal_uInt16
SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer
) const
1425 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1426 SOFFICE_FILEFORMAT_40
==nFFVer
||
1427 SOFFICE_FILEFORMAT_50
==nFFVer
,
1428 "SvxForbiddenRuleItem: Is there a new file format? ");
1430 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1433 bool SvxForbiddenRuleItem::GetPresentation(
1434 SfxItemPresentation
/*ePres*/,
1435 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1436 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1438 rText
= EE_RESSTR( !GetValue()
1439 ? RID_SVXITEMS_FORBIDDEN_RULE_OFF
1440 : RID_SVXITEMS_FORBIDDEN_RULE_ON
);
1444 /*************************************************************************
1445 |* class SvxParaVertAlignItem
1446 *************************************************************************/
1448 SvxParaVertAlignItem::SvxParaVertAlignItem( sal_uInt16 nValue
,
1449 const sal_uInt16 nW
)
1450 : SfxUInt16Item( nW
, nValue
)
1454 SfxPoolItem
* SvxParaVertAlignItem::Clone( SfxItemPool
* ) const
1456 return new SvxParaVertAlignItem( GetValue(), Which() );
1459 SfxPoolItem
* SvxParaVertAlignItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1462 rStrm
.ReadUInt16( nVal
);
1463 return new SvxParaVertAlignItem( nVal
, Which() );
1466 SvStream
& SvxParaVertAlignItem::Store( SvStream
& rStrm
, sal_uInt16
) const
1468 rStrm
.WriteUInt16( GetValue() );
1472 sal_uInt16
SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer
) const
1474 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1477 bool SvxParaVertAlignItem::GetPresentation(
1478 SfxItemPresentation
/*ePres*/,
1479 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1480 OUString
&rText
, const IntlWrapper
* ) const
1483 switch( GetValue() )
1485 case AUTOMATIC
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_AUTO
; break;
1486 case TOP
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_TOP
; break;
1487 case CENTER
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_CENTER
; break;
1488 case BOTTOM
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BOTTOM
; break;
1489 default: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BASELINE
; break;
1491 rText
= EE_RESSTR( nTmp
);
1495 bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any
& rVal
,
1496 sal_uInt8
/*nMemberId*/ ) const
1498 rVal
<<= (sal_Int16
)GetValue();
1502 bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any
& rVal
,
1503 sal_uInt8
/*nMemberId*/ )
1505 sal_Int16 nVal
= sal_Int16();
1506 if((rVal
>>= nVal
) && nVal
>=0 && nVal
<= BOTTOM
)
1508 SetValue( (sal_uInt16
)nVal
);
1515 bool SvxParaVertAlignItem::operator==( const SfxPoolItem
& rItem
) const
1517 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
1518 return SfxUInt16Item::operator==( rItem
);
1522 SvxParaGridItem::SvxParaGridItem( bool bOn
, const sal_uInt16 nId
)
1523 : SfxBoolItem( nId
, bOn
)
1527 SfxPoolItem
* SvxParaGridItem::Clone( SfxItemPool
* ) const
1529 return new SvxParaGridItem( GetValue(), Which() );
1532 SfxPoolItem
* SvxParaGridItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1535 rStrm
.ReadCharAsBool( bFlag
);
1536 return new SvxParaGridItem( bFlag
, Which() );
1539 sal_uInt16
SvxParaGridItem::GetVersion( sal_uInt16 nFFVer
) const
1541 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1542 SOFFICE_FILEFORMAT_40
==nFFVer
||
1543 SOFFICE_FILEFORMAT_50
==nFFVer
,
1544 "SvxParaGridItem: Is there a new file format? ");
1546 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1549 bool SvxParaGridItem::GetPresentation(
1550 SfxItemPresentation
/*ePres*/,
1551 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1552 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1554 rText
= GetValue() ?
1555 EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_ON
) :
1556 EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_OFF
);
1562 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */