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 <svl/itempool.hxx>
29 #include <svl/memberid.hrc>
30 #include <editeng/editrids.hrc>
31 #include <editeng/lspcitem.hxx>
32 #include <editeng/adjustitem.hxx>
33 #include <editeng/orphitem.hxx>
34 #include <editeng/widwitem.hxx>
35 #include <editeng/tstpitem.hxx>
36 #include <editeng/pmdlitem.hxx>
37 #include <editeng/spltitem.hxx>
38 #include <editeng/hyphenzoneitem.hxx>
39 #include <editeng/scriptspaceitem.hxx>
40 #include <editeng/hngpnctitem.hxx>
41 #include <editeng/forbiddenruleitem.hxx>
42 #include <editeng/paravertalignitem.hxx>
43 #include <editeng/pgrditem.hxx>
44 #include <rtl/ustring.hxx>
45 #include <editeng/memberids.hrc>
46 #include <editeng/editids.hrc>
47 #include <editeng/itemtype.hxx>
48 #include <editeng/eerdll.hxx>
49 #include <editeng/paperinf.hxx>
50 #include <vcl/svapp.hxx>
53 using namespace ::rtl
;
54 using namespace ::com::sun::star
;
56 // Konvertierung fuer UNO
57 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
58 #define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
59 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
60 #define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
63 // STATIC DATA -----------------------------------------------------------
66 // -----------------------------------------------------------------------
69 TYPEINIT1_FACTORY(SvxLineSpacingItem
, SfxPoolItem
, new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT
, 0));
70 TYPEINIT1_FACTORY(SvxAdjustItem
, SfxPoolItem
, new SvxAdjustItem(SVX_ADJUST_LEFT
, 0));
71 TYPEINIT1_FACTORY(SvxWidowsItem
, SfxByteItem
, new SvxWidowsItem(0, 0));
72 TYPEINIT1_FACTORY(SvxOrphansItem
, SfxByteItem
, new SvxOrphansItem(0, 0));
73 TYPEINIT1_FACTORY(SvxHyphenZoneItem
, SfxPoolItem
, new SvxHyphenZoneItem(sal_False
, 0));
74 TYPEINIT1_FACTORY(SvxTabStopItem
, SfxPoolItem
, new SvxTabStopItem(0));
75 TYPEINIT1_FACTORY(SvxFmtSplitItem
, SfxBoolItem
, new SvxFmtSplitItem(sal_False
, 0));
76 TYPEINIT1_FACTORY(SvxPageModelItem
, SfxStringItem
, new SvxPageModelItem(0));
77 TYPEINIT1_FACTORY(SvxScriptSpaceItem
, SfxBoolItem
, new SvxScriptSpaceItem(sal_False
, 0));
78 TYPEINIT1_FACTORY(SvxHangingPunctuationItem
, SfxBoolItem
, new SvxHangingPunctuationItem(sal_False
, 0));
79 TYPEINIT1_FACTORY(SvxForbiddenRuleItem
, SfxBoolItem
, new SvxForbiddenRuleItem(sal_False
, 0));
80 TYPEINIT1_FACTORY(SvxParaVertAlignItem
, SfxUInt16Item
, new SvxParaVertAlignItem(0, 0));
81 TYPEINIT1_FACTORY(SvxParaGridItem
, SfxBoolItem
, new SvxParaGridItem(sal_True
, 0));
83 // -----------------------------------------------------------------------
85 SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight
, const sal_uInt16 nId
)
86 : SfxEnumItemInterface( nId
)
90 nLineHeight
= nHeight
;
91 eLineSpace
= SVX_LINE_SPACE_AUTO
;
92 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
95 // -----------------------------------------------------------------------
97 int SvxLineSpacingItem::operator==( const SfxPoolItem
& rAttr
) const
99 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
101 const SvxLineSpacingItem
& rLineSpace
= (const SvxLineSpacingItem
&)rAttr
;
103 // Same Linespacing Rule?
104 (eLineSpace
== rLineSpace
.eLineSpace
)
105 // For maximum and minimum Linespacing be the size must coincide.
106 && (eLineSpace
== SVX_LINE_SPACE_AUTO
||
107 nLineHeight
== rLineSpace
.nLineHeight
)
108 // Same Linespacing Rule?
109 && ( eInterLineSpace
== rLineSpace
.eInterLineSpace
)
110 // Either set proportional or additive.
111 && (( eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
112 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_PROP
113 && nPropLineSpace
== rLineSpace
.nPropLineSpace
)
114 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
115 && (nInterLineSpace
== rLineSpace
.nInterLineSpace
)))) ?
119 /* Who does still know why the LineSpacingItem is so complicated?
120 We can not use it for UNO since there are only two values:
121 - ein sal_uInt16 for the mode
122 - ein sal_uInt32 for all values (distance, height, rel. detail)
124 bool SvxLineSpacingItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
126 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
127 nMemberId
&= ~CONVERT_TWIPS
;
129 style::LineSpacing aLSp
;
132 case SVX_LINE_SPACE_AUTO
:
133 if(eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
)
135 aLSp
.Mode
= style::LineSpacingMode::LEADING
;
136 aLSp
.Height
= ( bConvert
? (short)TWIP_TO_MM100(nInterLineSpace
) : nInterLineSpace
);
138 else if(eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
140 aLSp
.Mode
= style::LineSpacingMode::PROP
;
145 aLSp
.Mode
= style::LineSpacingMode::PROP
;
146 aLSp
.Height
= nPropLineSpace
;
149 case SVX_LINE_SPACE_FIX
:
150 case SVX_LINE_SPACE_MIN
:
151 aLSp
.Mode
= eLineSpace
== SVX_LINE_SPACE_FIX
? style::LineSpacingMode::FIX
: style::LineSpacingMode::MINIMUM
;
152 aLSp
.Height
= ( bConvert
? (short)TWIP_TO_MM100_UNSIGNED(nLineHeight
) : nLineHeight
);
155 ;//prevent warning about SVX_LINE_SPACE_END
160 case 0 : rVal
<<= aLSp
; break;
161 case MID_LINESPACE
: rVal
<<= aLSp
.Mode
; break;
162 case MID_HEIGHT
: rVal
<<= aLSp
.Height
; break;
163 default: OSL_FAIL("Wrong MemberId!"); break;
169 bool SvxLineSpacingItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
171 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
172 nMemberId
&= ~CONVERT_TWIPS
;
174 // fill with current data
175 style::LineSpacing aLSp
;
177 sal_Bool bRet
= QueryValue( aAny
, bConvert
? CONVERT_TWIPS
: 0 ) && ( aAny
>>= aLSp
);
182 case 0 : bRet
= (rVal
>>= aLSp
); break;
183 case MID_LINESPACE
: bRet
= (rVal
>>= aLSp
.Mode
); break;
184 case MID_HEIGHT
: bRet
= (rVal
>>= aLSp
.Height
); break;
185 default: OSL_FAIL("Wrong MemberId!"); break;
190 nLineHeight
= aLSp
.Height
;
193 case style::LineSpacingMode::LEADING
:
195 eInterLineSpace
= SVX_INTER_LINE_SPACE_FIX
;
196 eLineSpace
= SVX_LINE_SPACE_AUTO
;
197 nInterLineSpace
= aLSp
.Height
;
199 nInterLineSpace
= (short)MM100_TO_TWIP(nInterLineSpace
);
203 case style::LineSpacingMode::PROP
:
205 eLineSpace
= SVX_LINE_SPACE_AUTO
;
206 nPropLineSpace
= (sal_Int8
)std::min(aLSp
.Height
, (short)0xFF);
207 if(100 == aLSp
.Height
)
208 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
210 eInterLineSpace
= SVX_INTER_LINE_SPACE_PROP
;
213 case style::LineSpacingMode::FIX
:
214 case style::LineSpacingMode::MINIMUM
:
216 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
217 eLineSpace
= aLSp
.Mode
== style::LineSpacingMode::FIX
? SVX_LINE_SPACE_FIX
: SVX_LINE_SPACE_MIN
;
218 nLineHeight
= aLSp
.Height
;
220 nLineHeight
= (sal_uInt16
)MM100_TO_TWIP_UNSIGNED(nLineHeight
);
229 // -----------------------------------------------------------------------
231 SfxPoolItem
* SvxLineSpacingItem::Clone( SfxItemPool
* ) const
233 return new SvxLineSpacingItem( *this );
236 //------------------------------------------------------------------------
238 SfxItemPresentation
SvxLineSpacingItem::GetPresentation
240 SfxItemPresentation
/*ePres*/,
241 SfxMapUnit
/*eCoreUnit*/,
242 SfxMapUnit
/*ePresUnit*/,
243 OUString
& rText
, const IntlWrapper
*
247 rText
= "SvxLineSpacingItem";
251 return SFX_ITEM_PRESENTATION_NONE
;
254 // -----------------------------------------------------------------------
256 SfxPoolItem
* SvxLineSpacingItem::Create(SvStream
& rStrm
, sal_uInt16
) const
261 sal_Int8 nRule
, nInterRule
;
269 SvxLineSpacingItem
* pAttr
= new SvxLineSpacingItem( nHeight
, Which() );
270 pAttr
->SetInterLineSpace( nInterSpace
);
271 pAttr
->SetPropLineSpace( nPropSpace
);
272 pAttr
->GetLineSpaceRule() = (SvxLineSpace
)nRule
;
273 pAttr
->GetInterLineSpaceRule() = (SvxInterLineSpace
)nInterRule
;
277 // -----------------------------------------------------------------------
279 SvStream
& SvxLineSpacingItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
281 rStrm
<< (sal_Int8
) GetPropLineSpace()
282 << (short) GetInterLineSpace()
283 << (sal_uInt16
) GetLineHeight()
284 << (sal_Int8
) GetLineSpaceRule()
285 << (sal_Int8
) GetInterLineSpaceRule();
289 // -----------------------------------------------------------------------
291 sal_uInt16
SvxLineSpacingItem::GetValueCount() const
293 return SVX_LINESPACE_END
; // SVX_LINESPACE_TWO_LINES + 1
296 // -----------------------------------------------------------------------
298 OUString
SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos
) const
300 //! load strings from resource
304 case SVX_LINESPACE_USER
:
307 case SVX_LINESPACE_ONE_LINE
:
310 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
:
313 case SVX_LINESPACE_TWO_LINES
:
320 // -----------------------------------------------------------------------
322 sal_uInt16
SvxLineSpacingItem::GetEnumValue() const
325 switch ( nPropLineSpace
)
327 case 100: nVal
= SVX_LINESPACE_ONE_LINE
; break;
328 case 150: nVal
= SVX_LINESPACE_ONE_POINT_FIVE_LINES
; break;
329 case 200: nVal
= SVX_LINESPACE_TWO_LINES
; break;
330 default: nVal
= SVX_LINESPACE_USER
; break;
335 // -----------------------------------------------------------------------
337 void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal
)
341 case SVX_LINESPACE_ONE_LINE
: nPropLineSpace
= 100; break;
342 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
: nPropLineSpace
= 150; break;
343 case SVX_LINESPACE_TWO_LINES
: nPropLineSpace
= 200; break;
347 // class SvxAdjustItem ---------------------------------------------------
349 SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst
, const sal_uInt16 nId
)
350 : SfxEnumItemInterface( nId
),
351 bOneBlock( sal_False
), bLastCenter( sal_False
), bLastBlock( sal_False
)
356 // -----------------------------------------------------------------------
358 int SvxAdjustItem::operator==( const SfxPoolItem
& rAttr
) const
360 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
362 return( ( GetAdjust() == ((SvxAdjustItem
&)rAttr
).GetAdjust() &&
363 bOneBlock
== ((SvxAdjustItem
&)rAttr
).bOneBlock
&&
364 bLastCenter
== ((SvxAdjustItem
&)rAttr
).bLastCenter
&&
365 bLastBlock
== ((SvxAdjustItem
&)rAttr
).bLastBlock
)
369 bool SvxAdjustItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
371 nMemberId
&= ~CONVERT_TWIPS
;
374 case MID_PARA_ADJUST
: rVal
<<= (sal_Int16
)GetAdjust(); break;
375 case MID_LAST_LINE_ADJUST
: rVal
<<= (sal_Int16
)GetLastBlock(); break;
376 case MID_EXPAND_SINGLE
:
378 sal_Bool bValue
= bOneBlock
;
379 rVal
.setValue( &bValue
, ::getCppuBooleanType() );
382 default: ;//prevent warning
387 bool SvxAdjustItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
389 nMemberId
&= ~CONVERT_TWIPS
;
392 case MID_PARA_ADJUST
:
393 case MID_LAST_LINE_ADJUST
:
395 sal_Int32 eVal
= - 1;
398 eVal
= ::comphelper::getEnumAsINT32(rVal
);
401 if(eVal
>= 0 && eVal
<= 4)
403 if(MID_LAST_LINE_ADJUST
== nMemberId
&&
404 eVal
!= SVX_ADJUST_LEFT
&&
405 eVal
!= SVX_ADJUST_BLOCK
&&
406 eVal
!= SVX_ADJUST_CENTER
)
408 if(eVal
< (sal_uInt16
)SVX_ADJUST_END
)
409 nMemberId
== MID_PARA_ADJUST
?
410 SetAdjust((SvxAdjust
)eVal
) :
411 SetLastBlock((SvxAdjust
)eVal
);
415 case MID_EXPAND_SINGLE
:
416 bOneBlock
= Any2Bool(rVal
);
422 // -----------------------------------------------------------------------
424 SfxPoolItem
* SvxAdjustItem::Clone( SfxItemPool
* ) const
426 return new SvxAdjustItem( *this );
429 //------------------------------------------------------------------------
431 SfxItemPresentation
SvxAdjustItem::GetPresentation
433 SfxItemPresentation ePres
,
434 SfxMapUnit
/*eCoreUnit*/,
435 SfxMapUnit
/*ePresUnit*/,
436 OUString
& rText
, const IntlWrapper
*
441 case SFX_ITEM_PRESENTATION_NONE
:
443 return SFX_ITEM_PRESENTATION_NONE
;
444 case SFX_ITEM_PRESENTATION_NAMELESS
:
445 case SFX_ITEM_PRESENTATION_COMPLETE
:
446 rText
= GetValueTextByPos( (sal_uInt16
)GetAdjust() );
448 default: ;//prevent warning
450 return SFX_ITEM_PRESENTATION_NONE
;
453 // -----------------------------------------------------------------------
455 sal_uInt16
SvxAdjustItem::GetValueCount() const
457 return SVX_ADJUST_END
; // SVX_ADJUST_BLOCKLINE + 1
460 // -----------------------------------------------------------------------
462 OUString
SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos
) const
464 DBG_ASSERT( nPos
<= (sal_uInt16
)SVX_ADJUST_BLOCKLINE
, "enum overflow!" );
465 return EE_RESSTR(RID_SVXITEMS_ADJUST_BEGIN
+ nPos
);
468 // -----------------------------------------------------------------------
470 sal_uInt16
SvxAdjustItem::GetEnumValue() const
472 return (sal_uInt16
)GetAdjust();
475 // -----------------------------------------------------------------------
477 void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal
)
479 SetAdjust( (const SvxAdjust
)nVal
);
482 // -----------------------------------------------------------------------
484 sal_uInt16
SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion
) const
486 return (nFileVersion
== SOFFICE_FILEFORMAT_31
)
487 ? 0 : ADJUST_LASTBLOCK_VERSION
;
490 // -----------------------------------------------------------------------
492 SfxPoolItem
* SvxAdjustItem::Create(SvStream
& rStrm
, sal_uInt16 nVersion
) const
495 rStrm
>> eAdjustment
;
496 SvxAdjustItem
*pRet
= new SvxAdjustItem( (SvxAdjust
)eAdjustment
, Which() );
497 if( nVersion
>= ADJUST_LASTBLOCK_VERSION
)
501 pRet
->bOneBlock
= 0 != (nFlags
& 0x0001);
502 pRet
->bLastCenter
= 0 != (nFlags
& 0x0002);
503 pRet
->bLastBlock
= 0 != (nFlags
& 0x0004);
508 // -----------------------------------------------------------------------
510 SvStream
& SvxAdjustItem::Store( SvStream
& rStrm
, sal_uInt16 nItemVersion
) const
512 rStrm
<< (char)GetAdjust();
513 if ( nItemVersion
>= ADJUST_LASTBLOCK_VERSION
)
522 rStrm
<< (sal_Int8
) nFlags
;
527 // class SvxWidowsItem ---------------------------------------------------
529 SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL
, const sal_uInt16 nId
) :
530 SfxByteItem( nId
, nL
)
534 // -----------------------------------------------------------------------
536 SfxPoolItem
* SvxWidowsItem::Clone( SfxItemPool
* ) const
538 return new SvxWidowsItem( *this );
541 // -----------------------------------------------------------------------
543 SfxPoolItem
* SvxWidowsItem::Create(SvStream
& rStrm
, sal_uInt16
) const
547 return new SvxWidowsItem( nLines
, Which() );
550 // -----------------------------------------------------------------------
552 SvStream
& SvxWidowsItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
554 rStrm
<< (sal_Int8
)GetValue();
558 //------------------------------------------------------------------------
560 SfxItemPresentation
SvxWidowsItem::GetPresentation
562 SfxItemPresentation ePres
,
563 SfxMapUnit
/*eCoreUnit*/,
564 SfxMapUnit
/*ePresUnit*/,
565 OUString
& rText
, const IntlWrapper
*
570 case SFX_ITEM_PRESENTATION_NONE
:
576 case SFX_ITEM_PRESENTATION_NAMELESS
:
578 rText
= EE_RESSTR(RID_SVXITEMS_LINES
);
582 case SFX_ITEM_PRESENTATION_COMPLETE
:
584 rText
= EE_RESSTR(RID_SVXITEMS_WIDOWS_COMPLETE
) + " " + EE_RESSTR(RID_SVXITEMS_LINES
);
589 SAL_WARN( "editeng.items", "SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" );
593 rText
= rText
.replaceFirst( "%1", OUString::number( GetValue() ) );
597 // class SvxOrphansItem --------------------------------------------------
599 SvxOrphansItem::SvxOrphansItem(const sal_uInt8 nL
, const sal_uInt16 nId
) :
600 SfxByteItem( nId
, nL
)
604 // -----------------------------------------------------------------------
606 SfxPoolItem
* SvxOrphansItem::Clone( SfxItemPool
* ) const
608 return new SvxOrphansItem( *this );
611 // -----------------------------------------------------------------------
613 SfxPoolItem
* SvxOrphansItem::Create(SvStream
& rStrm
, sal_uInt16
) const
617 return new SvxOrphansItem( nLines
, Which() );
620 // -----------------------------------------------------------------------
622 SvStream
& SvxOrphansItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
624 rStrm
<< (sal_Int8
) GetValue();
628 //------------------------------------------------------------------------
630 SfxItemPresentation
SvxOrphansItem::GetPresentation
632 SfxItemPresentation ePres
,
633 SfxMapUnit
/*eCoreUnit*/,
634 SfxMapUnit
/*ePresUnit*/,
635 OUString
& rText
, const IntlWrapper
*
640 case SFX_ITEM_PRESENTATION_NONE
:
646 case SFX_ITEM_PRESENTATION_NAMELESS
:
648 rText
= EE_RESSTR(RID_SVXITEMS_LINES
);
652 case SFX_ITEM_PRESENTATION_COMPLETE
:
654 rText
= EE_RESSTR(RID_SVXITEMS_ORPHANS_COMPLETE
) + " " + EE_RESSTR(RID_SVXITEMS_LINES
);
659 SAL_WARN( "editeng.items", "SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" );
663 rText
= rText
.replaceFirst( "%1", OUString::number( GetValue() ) );
667 // class SvxHyphenZoneItem -----------------------------------------------
669 SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph
, const sal_uInt16 nId
) :
674 nMinLead
= nMinTrail
= 0;
678 // -----------------------------------------------------------------------
679 bool SvxHyphenZoneItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
681 nMemberId
&= ~CONVERT_TWIPS
;
685 rVal
= Bool2Any(bHyphen
);
687 case MID_HYPHEN_MIN_LEAD
:
688 rVal
<<= (sal_Int16
)nMinLead
;
690 case MID_HYPHEN_MIN_TRAIL
:
691 rVal
<<= (sal_Int16
)nMinTrail
;
693 case MID_HYPHEN_MAX_HYPHENS
:
694 rVal
<<= (sal_Int16
)nMaxHyphens
;
699 // -----------------------------------------------------------------------
700 bool SvxHyphenZoneItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
702 nMemberId
&= ~CONVERT_TWIPS
;
703 sal_Int16 nNewVal
= 0;
705 if( nMemberId
!= MID_IS_HYPHEN
)
706 if(!(rVal
>>= nNewVal
))
712 bHyphen
= Any2Bool(rVal
);
714 case MID_HYPHEN_MIN_LEAD
:
715 nMinLead
= (sal_uInt8
)nNewVal
;
717 case MID_HYPHEN_MIN_TRAIL
:
718 nMinTrail
= (sal_uInt8
)nNewVal
;
720 case MID_HYPHEN_MAX_HYPHENS
:
721 nMaxHyphens
= (sal_uInt8
)nNewVal
;
727 // -----------------------------------------------------------------------
729 int SvxHyphenZoneItem::operator==( const SfxPoolItem
& rAttr
) const
731 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
733 return ( (((SvxHyphenZoneItem
&)rAttr
).bHyphen
== bHyphen
)
734 && (((SvxHyphenZoneItem
&)rAttr
).bPageEnd
== bPageEnd
)
735 && (((SvxHyphenZoneItem
&)rAttr
).nMinLead
== nMinLead
)
736 && (((SvxHyphenZoneItem
&)rAttr
).nMinTrail
== nMinTrail
)
737 && (((SvxHyphenZoneItem
&)rAttr
).nMaxHyphens
== nMaxHyphens
) );
740 // -----------------------------------------------------------------------
742 SfxPoolItem
* SvxHyphenZoneItem::Clone( SfxItemPool
* ) const
744 return new SvxHyphenZoneItem( *this );
747 //------------------------------------------------------------------------
749 SfxItemPresentation
SvxHyphenZoneItem::GetPresentation
751 SfxItemPresentation ePres
,
752 SfxMapUnit
/*eCoreUnit*/,
753 SfxMapUnit
/*ePresUnit*/,
754 OUString
& rText
, const IntlWrapper
*
757 OUString
cpDelimTmp(cpDelim
);
760 case SFX_ITEM_PRESENTATION_NONE
:
762 return SFX_ITEM_PRESENTATION_NONE
;
763 case SFX_ITEM_PRESENTATION_NAMELESS
:
765 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
768 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
769 rText
= EE_RESSTR(nId
) + cpDelimTmp
;
770 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
773 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
774 rText
= rText
+ EE_RESSTR(nId
) + cpDelimTmp
+
775 OUString::number( nMinLead
) + cpDelimTmp
+
776 OUString::number( nMinTrail
) + cpDelimTmp
+
777 OUString::number( nMaxHyphens
);
778 return SFX_ITEM_PRESENTATION_COMPLETE
;
780 case SFX_ITEM_PRESENTATION_COMPLETE
:
782 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
785 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
786 rText
= EE_RESSTR(nId
) + cpDelimTmp
;
787 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
790 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
794 EE_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD
).replaceAll("%1", OUString::number(nMinLead
)) +
796 EE_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL
).replaceAll("%1", OUString::number(nMinTrail
)) +
798 EE_RESSTR(RID_SVXITEMS_HYPHEN_MAX
).replaceAll("%1", OUString::number(nMaxHyphens
));
799 return SFX_ITEM_PRESENTATION_COMPLETE
;
801 default: ;//prevent warning
803 return SFX_ITEM_PRESENTATION_NONE
;
806 // -----------------------------------------------------------------------
808 SfxPoolItem
* SvxHyphenZoneItem::Create(SvStream
& rStrm
, sal_uInt16
) const
810 sal_Int8 _bHyphen
, _bHyphenPageEnd
;
811 sal_Int8 _nMinLead
, _nMinTrail
, _nMaxHyphens
;
812 rStrm
>> _bHyphen
>> _bHyphenPageEnd
>> _nMinLead
>> _nMinTrail
>> _nMaxHyphens
;
813 SvxHyphenZoneItem
* pAttr
= new SvxHyphenZoneItem( sal_False
, Which() );
814 pAttr
->SetHyphen( sal_Bool( _bHyphen
!= 0 ) );
815 pAttr
->SetPageEnd( sal_Bool( _bHyphenPageEnd
!= 0 ) );
816 pAttr
->GetMinLead() = _nMinLead
;
817 pAttr
->GetMinTrail() = _nMinTrail
;
818 pAttr
->GetMaxHyphens() = _nMaxHyphens
;
822 // -----------------------------------------------------------------------
824 SvStream
& SvxHyphenZoneItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
826 rStrm
<< (sal_Int8
) IsHyphen()
827 << (sal_Int8
) IsPageEnd()
828 << (sal_Int8
) GetMinLead()
829 << (sal_Int8
) GetMinTrail()
830 << (sal_Int8
) GetMaxHyphens();
834 // class SvxTabStop ------------------------------------------------------
836 SvxTabStop::SvxTabStop()
839 eAdjustment
= SVX_TAB_ADJUST_LEFT
;
840 m_cDecimal
= cDfltDecimalChar
;
841 cFill
= cDfltFillChar
;
844 // -----------------------------------------------------------------------
846 SvxTabStop::SvxTabStop( const sal_Int32 nPos
, const SvxTabAdjust eAdjst
,
847 const sal_Unicode cDec
, const sal_Unicode cFil
)
850 eAdjustment
= eAdjst
;
854 // -----------------------------------------------------------------------------
855 void SvxTabStop::fillDecimal() const
857 if ( cDfltDecimalChar
== m_cDecimal
)
858 m_cDecimal
= SvtSysLocale().GetLocaleData().getNumDecimalSep()[0];
860 // -----------------------------------------------------------------------
862 XubString
SvxTabStop::GetValueString() const
866 aStr
+= sal_Unicode( '(' );
867 aStr
+= OUString::number(nTabPos
);
869 aStr
+= EE_RESSTR(RID_SVXITEMS_TAB_ADJUST_BEGIN
+ (sal_uInt16
)eAdjustment
);
872 aStr
+= sal_Unicode('[');
873 aStr
+= EE_RESSTR(RID_SVXITEMS_TAB_DECIMAL_CHAR
);
874 aStr
+= GetDecimal();
875 aStr
+= sal_Unicode(']');
878 aStr
+= sal_Unicode('[');
879 aStr
+= EE_RESSTR(RID_SVXITEMS_TAB_FILL_CHAR
);
881 aStr
+= sal_Unicode(']');
882 aStr
+= sal_Unicode(')');
887 // class SvxTabStopItem --------------------------------------------------
889 SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich
) :
890 SfxPoolItem( _nWhich
),
893 const sal_uInt16 nTabs
= SVX_TAB_DEFCOUNT
, nDist
= SVX_TAB_DEFDIST
;
894 const SvxTabAdjust eAdjst
= SVX_TAB_ADJUST_DEFAULT
;
896 for (sal_uInt16 i
= 0; i
< nTabs
; ++i
)
898 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
899 maTabStops
.insert( aTab
);
903 // -----------------------------------------------------------------------
905 SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs
,
906 const sal_uInt16 nDist
,
907 const SvxTabAdjust eAdjst
,
908 sal_uInt16 _nWhich
) :
909 SfxPoolItem( _nWhich
),
912 for ( sal_uInt16 i
= 0; i
< nTabs
; ++i
)
914 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
915 maTabStops
.insert( aTab
);
919 // -----------------------------------------------------------------------
921 SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem
& rTSI
) :
922 SfxPoolItem( rTSI
.Which() ),
923 maTabStops( rTSI
.maTabStops
)
927 // -----------------------------------------------------------------------
929 sal_uInt16
SvxTabStopItem::GetPos( const SvxTabStop
& rTab
) const
931 SvxTabStopArr::const_iterator it
= maTabStops
.find( rTab
);
932 return it
!= maTabStops
.end() ? it
- maTabStops
.begin() : SVX_TAB_NOTFOUND
;
935 // -----------------------------------------------------------------------
937 sal_uInt16
SvxTabStopItem::GetPos( const sal_Int32 nPos
) const
939 SvxTabStopArr::const_iterator it
= maTabStops
.find( SvxTabStop( nPos
) );
940 return it
!= maTabStops
.end() ? it
- maTabStops
.begin() : SVX_TAB_NOTFOUND
;
943 // -----------------------------------------------------------------------
945 SvxTabStopItem
& SvxTabStopItem::operator=( const SvxTabStopItem
& rTSI
)
947 maTabStops
= rTSI
.maTabStops
;
951 bool SvxTabStopItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
953 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
954 nMemberId
&= ~CONVERT_TWIPS
;
959 sal_uInt16 nCount
= Count();
960 uno::Sequence
< style::TabStop
> aSeq(nCount
);
961 style::TabStop
* pArr
= aSeq
.getArray();
962 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
964 const SvxTabStop
& rTab
= (*this)[i
];
965 pArr
[i
].Position
= bConvert
? TWIP_TO_MM100(rTab
.GetTabPos()) : rTab
.GetTabPos();
966 switch(rTab
.GetAdjustment())
968 case SVX_TAB_ADJUST_LEFT
: pArr
[i
].Alignment
= style::TabAlign_LEFT
; break;
969 case SVX_TAB_ADJUST_RIGHT
: pArr
[i
].Alignment
= style::TabAlign_RIGHT
; break;
970 case SVX_TAB_ADJUST_DECIMAL
: pArr
[i
].Alignment
= style::TabAlign_DECIMAL
; break;
971 case SVX_TAB_ADJUST_CENTER
: pArr
[i
].Alignment
= style::TabAlign_CENTER
; break;
972 default: //SVX_TAB_ADJUST_DEFAULT
973 pArr
[i
].Alignment
= style::TabAlign_DEFAULT
;
976 pArr
[i
].DecimalChar
= rTab
.GetDecimal();
977 pArr
[i
].FillChar
= rTab
.GetFill();
984 const SvxTabStop
&rTab
= maTabStops
.front();
985 rVal
<<= (static_cast<sal_Int32
>(bConvert
? TWIP_TO_MM100(rTab
.GetTabPos()) : rTab
.GetTabPos()));
992 bool SvxTabStopItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
994 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
995 nMemberId
&= ~CONVERT_TWIPS
;
1000 uno::Sequence
< style::TabStop
> aSeq
;
1001 if(!(rVal
>>= aSeq
))
1003 uno::Sequence
< uno::Sequence
< uno::Any
> > aAnySeq
;
1004 if (!(rVal
>>= aAnySeq
))
1006 sal_Int32 nLength
= aAnySeq
.getLength();
1007 aSeq
.realloc( nLength
);
1008 for ( sal_Int32 n
=0; n
<nLength
; n
++ )
1010 uno::Sequence
< uno::Any
>& rAnySeq
= aAnySeq
[n
];
1011 if ( rAnySeq
.getLength() == 4 )
1013 if (!(rAnySeq
[0] >>= aSeq
[n
].Position
)) return sal_False
;
1014 if (!(rAnySeq
[1] >>= aSeq
[n
].Alignment
))
1017 if (rAnySeq
[1] >>= nVal
)
1018 aSeq
[n
].Alignment
= (com::sun::star::style::TabAlign
) nVal
;
1022 if (!(rAnySeq
[2] >>= aSeq
[n
].DecimalChar
))
1025 if ( (rAnySeq
[2] >>= aVal
) && aVal
.getLength() == 1 )
1026 aSeq
[n
].DecimalChar
= aVal
.toChar();
1030 if (!(rAnySeq
[3] >>= aSeq
[n
].FillChar
))
1033 if ( (rAnySeq
[3] >>= aVal
) && aVal
.getLength() == 1 )
1034 aSeq
[n
].FillChar
= aVal
.toChar();
1045 const style::TabStop
* pArr
= aSeq
.getConstArray();
1046 const sal_uInt16 nCount
= (sal_uInt16
)aSeq
.getLength();
1047 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
1049 SvxTabAdjust eAdjust
= SVX_TAB_ADJUST_DEFAULT
;
1050 switch(pArr
[i
].Alignment
)
1052 case style::TabAlign_LEFT
: eAdjust
= SVX_TAB_ADJUST_LEFT
; break;
1053 case style::TabAlign_CENTER
: eAdjust
= SVX_TAB_ADJUST_CENTER
; break;
1054 case style::TabAlign_RIGHT
: eAdjust
= SVX_TAB_ADJUST_RIGHT
; break;
1055 case style::TabAlign_DECIMAL
: eAdjust
= SVX_TAB_ADJUST_DECIMAL
; break;
1056 default: ;//prevent warning
1058 sal_Unicode cFill
= pArr
[i
].FillChar
;
1059 sal_Unicode cDecimal
= pArr
[i
].DecimalChar
;
1060 SvxTabStop
aTab( bConvert
? MM100_TO_TWIP(pArr
[i
].Position
) : pArr
[i
].Position
,
1070 sal_Int32 nNewPos
= 0;
1071 if (!(rVal
>>= nNewPos
) )
1074 nNewPos
= MM100_TO_TWIP ( nNewPos
);
1077 const SvxTabStop
& rTab
= maTabStops
.front();
1078 SvxTabStop
aNewTab ( nNewPos
, rTab
.GetAdjustment(), rTab
.GetDecimal(), rTab
.GetFill() );
1086 // -----------------------------------------------------------------------
1088 int SvxTabStopItem::operator==( const SfxPoolItem
& rAttr
) const
1090 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
1092 const SvxTabStopItem
& rTSI
= (SvxTabStopItem
&)rAttr
;
1094 if ( Count() != rTSI
.Count() )
1097 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1098 if( !(*this)[i
].IsEqual( rTSI
[i
] ) )
1103 // -----------------------------------------------------------------------
1105 SfxPoolItem
* SvxTabStopItem::Clone( SfxItemPool
* ) const
1107 return new SvxTabStopItem( *this );
1110 //------------------------------------------------------------------------
1112 SfxItemPresentation
SvxTabStopItem::GetPresentation
1114 SfxItemPresentation ePres
,
1115 SfxMapUnit eCoreUnit
,
1116 SfxMapUnit ePresUnit
,
1117 OUString
& rText
, const IntlWrapper
*pIntl
1122 if ( ePres
> SFX_ITEM_PRESENTATION_NONE
)
1124 sal_Bool bComma
= sal_False
;
1126 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1128 if ( SVX_TAB_ADJUST_DEFAULT
!= ((*this)[i
]).GetAdjustment() )
1132 rText
+= GetMetricText(
1133 ((*this)[i
]).GetTabPos(), eCoreUnit
, ePresUnit
, pIntl
);
1134 if ( SFX_ITEM_PRESENTATION_COMPLETE
== ePres
)
1135 rText
+= EE_RESSTR(GetMetricId(ePresUnit
));
1143 // -----------------------------------------------------------------------
1145 SfxPoolItem
* SvxTabStopItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1149 SvxTabStopItem
* pAttr
=
1150 new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_DEFAULT
, Which() );
1152 for ( sal_Int8 i
= 0; i
< nTabs
; i
++ )
1156 unsigned char cDecimal
, cFill
;
1157 rStrm
>> nPos
>> eAdjust
>> cDecimal
>> cFill
;
1158 if( !i
|| SVX_TAB_ADJUST_DEFAULT
!= eAdjust
)
1159 pAttr
->Insert( SvxTabStop
1160 ( nPos
, (SvxTabAdjust
)eAdjust
, sal_Unicode(cDecimal
), sal_Unicode(cFill
) ) );
1165 // -----------------------------------------------------------------------
1167 SvStream
& SvxTabStopItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1169 // Default-Tabs are only expanded for the default Attribute. For complete
1170 // backward compabillity (<=304) all tabs have to be expanded, this makes
1171 // the files grow large in size. All only SWG!
1173 const SfxItemPool
*pPool
= SfxItemPool::GetStoringPool();
1174 const bool bStoreDefTabs
= pPool
1175 && pPool
->GetName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SWG"))
1176 && ::IsDefaultItem( this );
1178 const short nTabs
= Count();
1179 sal_uInt16 nCount
= 0, nDefDist
= 0;
1184 const SvxTabStopItem
& rDefTab
= (const SvxTabStopItem
&)
1185 pPool
->GetDefaultItem( pPool
->GetWhich( SID_ATTR_TABSTOP
, sal_False
) );
1186 nDefDist
= sal_uInt16( rDefTab
.maTabStops
.front().GetTabPos() );
1187 const sal_Int32 nPos
= nTabs
> 0 ? (*this)[nTabs
-1].GetTabPos() : 0;
1188 nCount
= (sal_uInt16
)(nPos
/ nDefDist
);
1189 nNew
= (nCount
+ 1) * nDefDist
;
1191 if( nNew
<= nPos
+ 50 )
1194 sal_Int32 lA3Width
= SvxPaperInfo::GetPaperSize(PAPER_A3
).Width();
1195 nCount
= (sal_uInt16
)(nNew
< lA3Width
? ( lA3Width
- nNew
) / nDefDist
+ 1 : 0);
1198 rStrm
<< (sal_Int8
) ( nTabs
+ nCount
);
1199 for ( short i
= 0; i
< nTabs
; i
++ )
1201 const SvxTabStop
& rTab
= (*this)[ i
];
1202 rStrm
<< rTab
.GetTabPos()
1203 << (sal_Int8
) rTab
.GetAdjustment()
1204 << (unsigned char) rTab
.GetDecimal()
1205 << (unsigned char) rTab
.GetFill();
1208 if ( bStoreDefTabs
)
1209 for( ; nCount
; --nCount
)
1211 SvxTabStop
aSwTabStop(nNew
, SVX_TAB_ADJUST_DEFAULT
);
1212 rStrm
<< aSwTabStop
.GetTabPos()
1213 << (sal_Int8
) aSwTabStop
.GetAdjustment()
1214 << (unsigned char) aSwTabStop
.GetDecimal()
1215 << (unsigned char) aSwTabStop
.GetFill();
1222 // -----------------------------------------------------------------------
1223 bool SvxTabStopItem::Insert( const SvxTabStop
& rTab
)
1225 sal_uInt16 nTabPos
= GetPos(rTab
);
1226 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1228 return maTabStops
.insert( rTab
).second
;
1230 // -----------------------------------------------------------------------
1231 void SvxTabStopItem::Insert( const SvxTabStopItem
* pTabs
, sal_uInt16 nStart
,
1234 for( sal_uInt16 i
= nStart
; i
< nEnd
&& i
< pTabs
->Count(); i
++ )
1236 const SvxTabStop
& rTab
= (*pTabs
)[i
];
1237 sal_uInt16 nTabPos
= GetPos(rTab
);
1238 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1241 for( sal_uInt16 i
= nStart
; i
< nEnd
&& i
< pTabs
->Count(); i
++ )
1243 maTabStops
.insert( (*pTabs
)[i
] );
1249 // class SvxFmtSplitItem -------------------------------------------------
1250 SvxFmtSplitItem::~SvxFmtSplitItem()
1253 // -----------------------------------------------------------------------
1254 SfxPoolItem
* SvxFmtSplitItem::Clone( SfxItemPool
* ) const
1256 return new SvxFmtSplitItem( *this );
1259 // -----------------------------------------------------------------------
1261 SvStream
& SvxFmtSplitItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1263 rStrm
<< (sal_Int8
)GetValue();
1267 // -----------------------------------------------------------------------
1269 SfxPoolItem
* SvxFmtSplitItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1273 return new SvxFmtSplitItem( sal_Bool( bIsSplit
!= 0 ), Which() );
1276 //------------------------------------------------------------------------
1278 SfxItemPresentation
SvxFmtSplitItem::GetPresentation
1280 SfxItemPresentation ePres
,
1281 SfxMapUnit
/*eCoreUnit*/,
1282 SfxMapUnit
/*ePresUnit*/,
1283 OUString
& rText
, const IntlWrapper
*
1288 case SFX_ITEM_PRESENTATION_NONE
:
1290 return SFX_ITEM_PRESENTATION_NONE
;
1291 case SFX_ITEM_PRESENTATION_NAMELESS
:
1292 case SFX_ITEM_PRESENTATION_COMPLETE
:
1294 sal_uInt16 nId
= RID_SVXITEMS_FMTSPLIT_FALSE
;
1297 nId
= RID_SVXITEMS_FMTSPLIT_TRUE
;
1298 rText
= EE_RESSTR(nId
);
1301 default: ;//prevent warning
1303 return SFX_ITEM_PRESENTATION_NONE
;
1306 // --------------------------------------------------------------------
1308 SfxPoolItem
* SvxPageModelItem::Clone( SfxItemPool
* ) const
1310 return new SvxPageModelItem( *this );
1313 //------------------------------------------------------------------------
1315 bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
) const
1317 nMemberId
&= ~CONVERT_TWIPS
;
1319 switch ( nMemberId
)
1321 case MID_AUTO
: rVal
<<= (sal_Bool
) bAuto
; break;
1322 case MID_NAME
: rVal
<<= OUString( GetValue() ); break;
1323 default: OSL_FAIL("Wrong MemberId!"); return sal_False
;
1329 bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
)
1331 nMemberId
&= ~CONVERT_TWIPS
;
1334 switch ( nMemberId
)
1336 case MID_AUTO
: bRet
= ( rVal
>>= bAuto
); break;
1337 case MID_NAME
: bRet
= ( rVal
>>= aStr
); if ( bRet
) SetValue(aStr
); break;
1338 default: OSL_FAIL("Wrong MemberId!"); return sal_False
;
1344 SfxItemPresentation
SvxPageModelItem::GetPresentation
1346 SfxItemPresentation ePres
,
1347 SfxMapUnit
/*eCoreUnit*/,
1348 SfxMapUnit
/*ePresUnit*/,
1349 OUString
& rText
, const IntlWrapper
*
1353 bool bSet
= !GetValue().isEmpty();
1357 case SFX_ITEM_PRESENTATION_NONE
:
1358 return SFX_ITEM_PRESENTATION_NONE
;
1360 case SFX_ITEM_PRESENTATION_NAMELESS
:
1363 return SFX_ITEM_PRESENTATION_NAMELESS
;
1365 case SFX_ITEM_PRESENTATION_COMPLETE
:
1368 rText
= EE_RESSTR(RID_SVXITEMS_PAGEMODEL_COMPLETE
) + GetValue();
1370 return SFX_ITEM_PRESENTATION_COMPLETE
;
1371 default: ;//prevent warning
1373 return SFX_ITEM_PRESENTATION_NONE
;
1376 //------------------------------------------------------------------------
1378 SvxScriptSpaceItem::SvxScriptSpaceItem( sal_Bool bOn
, const sal_uInt16 nId
)
1379 : SfxBoolItem( nId
, bOn
)
1383 SfxPoolItem
* SvxScriptSpaceItem::Clone( SfxItemPool
* ) const
1385 return new SvxScriptSpaceItem( GetValue(), Which() );
1388 SfxPoolItem
* SvxScriptSpaceItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1392 return new SvxScriptSpaceItem( bFlag
, Which() );
1395 sal_uInt16
SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer
) const
1397 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1398 SOFFICE_FILEFORMAT_40
==nFFVer
||
1399 SOFFICE_FILEFORMAT_50
==nFFVer
,
1400 "SvxTwoLinesItem: Is there a new file format? ");
1402 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1405 SfxItemPresentation
SvxScriptSpaceItem::GetPresentation(
1406 SfxItemPresentation ePres
,
1407 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1408 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1412 case SFX_ITEM_PRESENTATION_NONE
:
1415 case SFX_ITEM_PRESENTATION_NAMELESS
:
1416 case SFX_ITEM_PRESENTATION_COMPLETE
:
1418 rText
= EE_RESSTR( !GetValue()
1419 ? RID_SVXITEMS_SCRPTSPC_OFF
1420 : RID_SVXITEMS_SCRPTSPC_ON
);
1423 default: ;//prevent warning
1425 return SFX_ITEM_PRESENTATION_NONE
;
1428 //------------------------------------------------------------------------
1430 SvxHangingPunctuationItem::SvxHangingPunctuationItem(
1431 sal_Bool bOn
, const sal_uInt16 nId
)
1432 : SfxBoolItem( nId
, bOn
)
1436 SfxPoolItem
* SvxHangingPunctuationItem::Clone( SfxItemPool
* ) const
1438 return new SvxHangingPunctuationItem( GetValue(), Which() );
1441 SfxPoolItem
* SvxHangingPunctuationItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1445 return new SvxHangingPunctuationItem( nValue
, Which() );
1448 sal_uInt16
SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer
) const
1450 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1451 SOFFICE_FILEFORMAT_40
==nFFVer
||
1452 SOFFICE_FILEFORMAT_50
==nFFVer
,
1453 "SvxHangingPunctuationItem: Is there a new file format? ");
1455 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1458 SfxItemPresentation
SvxHangingPunctuationItem::GetPresentation(
1459 SfxItemPresentation ePres
,
1460 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1461 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1465 case SFX_ITEM_PRESENTATION_NONE
:
1468 case SFX_ITEM_PRESENTATION_NAMELESS
:
1469 case SFX_ITEM_PRESENTATION_COMPLETE
:
1471 rText
= EE_RESSTR( !GetValue()
1472 ? RID_SVXITEMS_HNGPNCT_OFF
1473 : RID_SVXITEMS_HNGPNCT_ON
);
1476 default: ;//prevent warning
1479 return SFX_ITEM_PRESENTATION_NONE
;
1481 //------------------------------------------------------------------------
1483 SvxForbiddenRuleItem::SvxForbiddenRuleItem(
1484 sal_Bool bOn
, const sal_uInt16 nId
)
1485 : SfxBoolItem( nId
, bOn
)
1489 SfxPoolItem
* SvxForbiddenRuleItem::Clone( SfxItemPool
* ) const
1491 return new SvxForbiddenRuleItem( GetValue(), Which() );
1494 SfxPoolItem
* SvxForbiddenRuleItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1498 return new SvxForbiddenRuleItem( nValue
, Which() );
1501 sal_uInt16
SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer
) const
1503 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1504 SOFFICE_FILEFORMAT_40
==nFFVer
||
1505 SOFFICE_FILEFORMAT_50
==nFFVer
,
1506 "SvxForbiddenRuleItem: Is there a new file format? ");
1508 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1511 SfxItemPresentation
SvxForbiddenRuleItem::GetPresentation(
1512 SfxItemPresentation ePres
,
1513 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1514 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1518 case SFX_ITEM_PRESENTATION_NONE
:
1521 case SFX_ITEM_PRESENTATION_NAMELESS
:
1522 case SFX_ITEM_PRESENTATION_COMPLETE
:
1524 rText
= EE_RESSTR( !GetValue()
1525 ? RID_SVXITEMS_FORBIDDEN_RULE_OFF
1526 : RID_SVXITEMS_FORBIDDEN_RULE_ON
);
1529 default: ;//prevent warning
1532 return SFX_ITEM_PRESENTATION_NONE
;
1535 /*************************************************************************
1536 |* class SvxParaVertAlignItem
1537 *************************************************************************/
1539 SvxParaVertAlignItem::SvxParaVertAlignItem( sal_uInt16 nValue
,
1540 const sal_uInt16 nW
)
1541 : SfxUInt16Item( nW
, nValue
)
1545 SfxPoolItem
* SvxParaVertAlignItem::Clone( SfxItemPool
* ) const
1547 return new SvxParaVertAlignItem( GetValue(), Which() );
1550 SfxPoolItem
* SvxParaVertAlignItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1554 return new SvxParaVertAlignItem( nVal
, Which() );
1557 SvStream
& SvxParaVertAlignItem::Store( SvStream
& rStrm
, sal_uInt16
) const
1559 rStrm
<< GetValue();
1563 sal_uInt16
SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer
) const
1565 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1568 SfxItemPresentation
SvxParaVertAlignItem::GetPresentation(
1569 SfxItemPresentation ePres
,
1570 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1571 OUString
&rText
, const IntlWrapper
* ) const
1575 case SFX_ITEM_PRESENTATION_NONE
:
1578 case SFX_ITEM_PRESENTATION_NAMELESS
:
1579 case SFX_ITEM_PRESENTATION_COMPLETE
:
1582 switch( GetValue() )
1584 case AUTOMATIC
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_AUTO
; break;
1585 case TOP
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_TOP
; break;
1586 case CENTER
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_CENTER
; break;
1587 case BOTTOM
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BOTTOM
; break;
1588 default: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BASELINE
; break;
1590 rText
= EE_RESSTR( nTmp
);
1593 default: ;//prevent warning
1596 return SFX_ITEM_PRESENTATION_NONE
;
1599 bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any
& rVal
,
1600 sal_uInt8
/*nMemberId*/ ) const
1602 rVal
<<= (sal_Int16
)GetValue();
1606 bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any
& rVal
,
1607 sal_uInt8
/*nMemberId*/ )
1609 sal_Int16 nVal
= sal_Int16();
1610 if((rVal
>>= nVal
) && nVal
>=0 && nVal
<= BOTTOM
)
1612 SetValue( (sal_uInt16
)nVal
);
1619 int SvxParaVertAlignItem::operator==( const SfxPoolItem
& rItem
) const
1621 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
1622 return SfxUInt16Item::operator==( rItem
);
1626 SvxParaGridItem::SvxParaGridItem( sal_Bool bOn
, const sal_uInt16 nId
)
1627 : SfxBoolItem( nId
, bOn
)
1631 SfxPoolItem
* SvxParaGridItem::Clone( SfxItemPool
* ) const
1633 return new SvxParaGridItem( GetValue(), Which() );
1636 SfxPoolItem
* SvxParaGridItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1640 return new SvxParaGridItem( bFlag
, Which() );
1643 sal_uInt16
SvxParaGridItem::GetVersion( sal_uInt16 nFFVer
) const
1645 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1646 SOFFICE_FILEFORMAT_40
==nFFVer
||
1647 SOFFICE_FILEFORMAT_50
==nFFVer
,
1648 "SvxParaGridItem: Is there a new file format? ");
1650 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1653 SfxItemPresentation
SvxParaGridItem::GetPresentation(
1654 SfxItemPresentation ePres
,
1655 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1656 OUString
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1660 case SFX_ITEM_PRESENTATION_NONE
:
1663 case SFX_ITEM_PRESENTATION_NAMELESS
:
1664 case SFX_ITEM_PRESENTATION_COMPLETE
:
1666 rText
= GetValue() ?
1667 EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_ON
) :
1668 EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_OFF
);
1672 default: ;//prevent warning
1675 return SFX_ITEM_PRESENTATION_NONE
;
1679 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */