1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 // include ---------------------------------------------------------------
31 #include <com/sun/star/style/TabStop.hpp>
32 #include <com/sun/star/style/LineSpacing.hpp>
33 #include <com/sun/star/style/LineSpacingMode.hpp>
34 #include <com/sun/star/uno/Sequence.hxx>
35 #include <comphelper/processfactory.hxx>
36 #include <unotools/syslocale.hxx>
37 #include <comphelper/types.hxx>
39 using namespace ::rtl
;
40 using namespace ::com::sun::star
;
42 #include <tools/rtti.hxx>
44 #define _SVX_PARAITEM_CXX
45 #include <svl/itempool.hxx>
47 #include <svl/memberid.hrc>
48 #include <editeng/editrids.hrc>
50 #include <editeng/lspcitem.hxx>
51 #include <editeng/adjitem.hxx>
52 #include <editeng/orphitem.hxx>
53 #include <editeng/widwitem.hxx>
54 #include <editeng/tstpitem.hxx>
55 #include <editeng/pmdlitem.hxx>
56 #include <editeng/spltitem.hxx>
57 #include <editeng/hyznitem.hxx>
58 #include <editeng/scriptspaceitem.hxx>
59 #include <editeng/hngpnctitem.hxx>
60 #include <editeng/forbiddenruleitem.hxx>
61 #include <editeng/paravertalignitem.hxx>
62 #include <editeng/pgrditem.hxx>
63 #include <rtl/ustring.hxx>
64 #include <editeng/memberids.hrc>
65 #include <editeng/editids.hrc>
66 #include <editeng/itemtype.hxx>
67 #include <editeng/eerdll.hxx>
68 #include <editeng/paperinf.hxx>
69 #include <vcl/svapp.hxx>
72 using namespace ::rtl
;
73 using namespace ::com::sun::star
;
75 // Konvertierung fuer UNO
76 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
77 #define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
78 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
79 #define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
82 // STATIC DATA -----------------------------------------------------------
85 // -----------------------------------------------------------------------
88 TYPEINIT1_FACTORY(SvxLineSpacingItem
, SfxPoolItem
, new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT
, 0));
89 TYPEINIT1_FACTORY(SvxAdjustItem
, SfxPoolItem
, new SvxAdjustItem(SVX_ADJUST_LEFT
, 0));
90 TYPEINIT1_FACTORY(SvxWidowsItem
, SfxByteItem
, new SvxWidowsItem(0, 0));
91 TYPEINIT1_FACTORY(SvxOrphansItem
, SfxByteItem
, new SvxOrphansItem(0, 0));
92 TYPEINIT1_FACTORY(SvxHyphenZoneItem
, SfxPoolItem
, new SvxHyphenZoneItem(sal_False
, 0));
93 TYPEINIT1_FACTORY(SvxTabStopItem
, SfxPoolItem
, new SvxTabStopItem(0));
94 TYPEINIT1_FACTORY(SvxFmtSplitItem
, SfxBoolItem
, new SvxFmtSplitItem(sal_False
, 0));
95 TYPEINIT1_FACTORY(SvxPageModelItem
, SfxStringItem
, new SvxPageModelItem(0));
96 TYPEINIT1_FACTORY(SvxScriptSpaceItem
, SfxBoolItem
, new SvxScriptSpaceItem(sal_False
, 0));
97 TYPEINIT1_FACTORY(SvxHangingPunctuationItem
, SfxBoolItem
, new SvxHangingPunctuationItem(sal_False
, 0));
98 TYPEINIT1_FACTORY(SvxForbiddenRuleItem
, SfxBoolItem
, new SvxForbiddenRuleItem(sal_False
, 0));
99 TYPEINIT1_FACTORY(SvxParaVertAlignItem
, SfxUInt16Item
, new SvxParaVertAlignItem(0, 0));
100 TYPEINIT1_FACTORY(SvxParaGridItem
, SfxBoolItem
, new SvxParaGridItem(sal_True
, 0));
102 SV_IMPL_VARARR_SORT( SvxTabStopArr
, SvxTabStop
)
104 // -----------------------------------------------------------------------
106 SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight
, const sal_uInt16 nId
)
107 : SfxEnumItemInterface( nId
)
109 nPropLineSpace
= 100;
111 nLineHeight
= nHeight
;
112 eLineSpace
= SVX_LINE_SPACE_AUTO
;
113 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
116 // -----------------------------------------------------------------------
118 int SvxLineSpacingItem::operator==( const SfxPoolItem
& rAttr
) const
120 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
122 const SvxLineSpacingItem
& rLineSpace
= (const SvxLineSpacingItem
&)rAttr
;
124 // Same Linespacing Rule?
125 (eLineSpace
== rLineSpace
.eLineSpace
)
126 // For maximum and minimum Linespacing be the size must coincide.
127 && (eLineSpace
== SVX_LINE_SPACE_AUTO
||
128 nLineHeight
== rLineSpace
.nLineHeight
)
129 // Same Linespacing Rule?
130 && ( eInterLineSpace
== rLineSpace
.eInterLineSpace
)
131 // Either set proportional or additive.
132 && (( eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
133 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_PROP
134 && nPropLineSpace
== rLineSpace
.nPropLineSpace
)
135 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
136 && (nInterLineSpace
== rLineSpace
.nInterLineSpace
)))) ?
140 /* Who does still know why the LineSpacingItem is so complicated?
141 We can not use it for UNO since there are only two values:
142 - ein sal_uInt16 for the mode
143 - ein sal_uInt32 for all values (distance, height, rel. detail)
145 bool SvxLineSpacingItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
147 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
148 nMemberId
&= ~CONVERT_TWIPS
;
150 style::LineSpacing aLSp
;
153 case SVX_LINE_SPACE_AUTO
:
154 if(eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
)
156 aLSp
.Mode
= style::LineSpacingMode::LEADING
;
157 aLSp
.Height
= ( bConvert
? (short)TWIP_TO_MM100(nInterLineSpace
) : nInterLineSpace
);
159 else if(eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
161 aLSp
.Mode
= style::LineSpacingMode::PROP
;
166 aLSp
.Mode
= style::LineSpacingMode::PROP
;
167 aLSp
.Height
= nPropLineSpace
;
170 case SVX_LINE_SPACE_FIX
:
171 case SVX_LINE_SPACE_MIN
:
172 aLSp
.Mode
= eLineSpace
== SVX_LINE_SPACE_FIX
? style::LineSpacingMode::FIX
: style::LineSpacingMode::MINIMUM
;
173 aLSp
.Height
= ( bConvert
? (short)TWIP_TO_MM100_UNSIGNED(nLineHeight
) : nLineHeight
);
176 ;//prevent warning about SVX_LINE_SPACE_END
181 case 0 : rVal
<<= aLSp
; break;
182 case MID_LINESPACE
: rVal
<<= aLSp
.Mode
; break;
183 case MID_HEIGHT
: rVal
<<= aLSp
.Height
; break;
184 default: OSL_FAIL("Wrong MemberId!"); break;
190 bool SvxLineSpacingItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
192 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
193 nMemberId
&= ~CONVERT_TWIPS
;
195 // fill with current data
196 style::LineSpacing aLSp
;
198 sal_Bool bRet
= QueryValue( aAny
, bConvert
? CONVERT_TWIPS
: 0 ) && ( aAny
>>= aLSp
);
203 case 0 : bRet
= (rVal
>>= aLSp
); break;
204 case MID_LINESPACE
: bRet
= (rVal
>>= aLSp
.Mode
); break;
205 case MID_HEIGHT
: bRet
= (rVal
>>= aLSp
.Height
); break;
206 default: OSL_FAIL("Wrong MemberId!"); break;
211 nLineHeight
= aLSp
.Height
;
214 case style::LineSpacingMode::LEADING
:
216 eInterLineSpace
= SVX_INTER_LINE_SPACE_FIX
;
217 eLineSpace
= SVX_LINE_SPACE_AUTO
;
218 nInterLineSpace
= aLSp
.Height
;
220 nInterLineSpace
= (short)MM100_TO_TWIP(nInterLineSpace
);
224 case style::LineSpacingMode::PROP
:
226 eLineSpace
= SVX_LINE_SPACE_AUTO
;
227 nPropLineSpace
= (sal_Int8
)std::min(aLSp
.Height
, (short)0xFF);
228 if(100 == aLSp
.Height
)
229 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
231 eInterLineSpace
= SVX_INTER_LINE_SPACE_PROP
;
234 case style::LineSpacingMode::FIX
:
235 case style::LineSpacingMode::MINIMUM
:
237 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
238 eLineSpace
= aLSp
.Mode
== style::LineSpacingMode::FIX
? SVX_LINE_SPACE_FIX
: SVX_LINE_SPACE_MIN
;
239 nLineHeight
= aLSp
.Height
;
241 nLineHeight
= (sal_uInt16
)MM100_TO_TWIP_UNSIGNED(nLineHeight
);
250 // -----------------------------------------------------------------------
252 SfxPoolItem
* SvxLineSpacingItem::Clone( SfxItemPool
* ) const
254 return new SvxLineSpacingItem( *this );
257 //------------------------------------------------------------------------
259 SfxItemPresentation
SvxLineSpacingItem::GetPresentation
261 SfxItemPresentation
/*ePres*/,
262 SfxMapUnit
/*eCoreUnit*/,
263 SfxMapUnit
/*ePresUnit*/,
264 XubString
& rText
, const IntlWrapper
*
268 rText
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SvxLineSpacingItem" ));
272 return SFX_ITEM_PRESENTATION_NONE
;
275 // -----------------------------------------------------------------------
277 SfxPoolItem
* SvxLineSpacingItem::Create(SvStream
& rStrm
, sal_uInt16
) const
282 sal_Int8 nRule
, nInterRule
;
290 SvxLineSpacingItem
* pAttr
= new SvxLineSpacingItem( nHeight
, Which() );
291 pAttr
->SetInterLineSpace( nInterSpace
);
292 pAttr
->SetPropLineSpace( nPropSpace
);
293 pAttr
->GetLineSpaceRule() = (SvxLineSpace
)nRule
;
294 pAttr
->GetInterLineSpaceRule() = (SvxInterLineSpace
)nInterRule
;
298 // -----------------------------------------------------------------------
300 SvStream
& SvxLineSpacingItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
302 rStrm
<< (sal_Int8
) GetPropLineSpace()
303 << (short) GetInterLineSpace()
304 << (sal_uInt16
) GetLineHeight()
305 << (sal_Int8
) GetLineSpaceRule()
306 << (sal_Int8
) GetInterLineSpaceRule();
310 // -----------------------------------------------------------------------
312 sal_uInt16
SvxLineSpacingItem::GetValueCount() const
314 return SVX_LINESPACE_END
; // SVX_LINESPACE_TWO_LINES + 1
317 // -----------------------------------------------------------------------
319 rtl::OUString
SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos
) const
321 //! load strings from resource
325 case SVX_LINESPACE_USER
:
328 case SVX_LINESPACE_ONE_LINE
:
331 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
:
334 case SVX_LINESPACE_TWO_LINES
:
341 // -----------------------------------------------------------------------
343 sal_uInt16
SvxLineSpacingItem::GetEnumValue() const
346 switch ( nPropLineSpace
)
348 case 100: nVal
= SVX_LINESPACE_ONE_LINE
; break;
349 case 150: nVal
= SVX_LINESPACE_ONE_POINT_FIVE_LINES
; break;
350 case 200: nVal
= SVX_LINESPACE_TWO_LINES
; break;
351 default: nVal
= SVX_LINESPACE_USER
; break;
356 // -----------------------------------------------------------------------
358 void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal
)
362 case SVX_LINESPACE_ONE_LINE
: nPropLineSpace
= 100; break;
363 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
: nPropLineSpace
= 150; break;
364 case SVX_LINESPACE_TWO_LINES
: nPropLineSpace
= 200; break;
368 // class SvxAdjustItem ---------------------------------------------------
370 SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst
, const sal_uInt16 nId
)
371 : SfxEnumItemInterface( nId
),
372 bOneBlock( sal_False
), bLastCenter( sal_False
), bLastBlock( sal_False
)
377 // -----------------------------------------------------------------------
379 int SvxAdjustItem::operator==( const SfxPoolItem
& rAttr
) const
381 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
383 return( ( GetAdjust() == ((SvxAdjustItem
&)rAttr
).GetAdjust() &&
384 bOneBlock
== ((SvxAdjustItem
&)rAttr
).bOneBlock
&&
385 bLastCenter
== ((SvxAdjustItem
&)rAttr
).bLastCenter
&&
386 bLastBlock
== ((SvxAdjustItem
&)rAttr
).bLastBlock
)
390 bool SvxAdjustItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
392 nMemberId
&= ~CONVERT_TWIPS
;
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
:
399 sal_Bool bValue
= bOneBlock
;
400 rVal
.setValue( &bValue
, ::getCppuBooleanType() );
403 default: ;//prevent warning
408 bool SvxAdjustItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
410 nMemberId
&= ~CONVERT_TWIPS
;
413 case MID_PARA_ADJUST
:
414 case MID_LAST_LINE_ADJUST
:
416 sal_Int32 eVal
= - 1;
419 eVal
= ::comphelper::getEnumAsINT32(rVal
);
422 if(eVal
>= 0 && eVal
<= 4)
424 if(MID_LAST_LINE_ADJUST
== nMemberId
&&
425 eVal
!= SVX_ADJUST_LEFT
&&
426 eVal
!= SVX_ADJUST_BLOCK
&&
427 eVal
!= SVX_ADJUST_CENTER
)
429 if(eVal
< (sal_uInt16
)SVX_ADJUST_END
)
430 nMemberId
== MID_PARA_ADJUST
?
431 SetAdjust((SvxAdjust
)eVal
) :
432 SetLastBlock((SvxAdjust
)eVal
);
436 case MID_EXPAND_SINGLE
:
437 bOneBlock
= Any2Bool(rVal
);
443 // -----------------------------------------------------------------------
445 SfxPoolItem
* SvxAdjustItem::Clone( SfxItemPool
* ) const
447 return new SvxAdjustItem( *this );
450 //------------------------------------------------------------------------
452 SfxItemPresentation
SvxAdjustItem::GetPresentation
454 SfxItemPresentation ePres
,
455 SfxMapUnit
/*eCoreUnit*/,
456 SfxMapUnit
/*ePresUnit*/,
457 XubString
& rText
, const IntlWrapper
*
462 case SFX_ITEM_PRESENTATION_NONE
:
464 return SFX_ITEM_PRESENTATION_NONE
;
465 case SFX_ITEM_PRESENTATION_NAMELESS
:
466 case SFX_ITEM_PRESENTATION_COMPLETE
:
467 rText
= GetValueTextByPos( (sal_uInt16
)GetAdjust() );
469 default: ;//prevent warning
471 return SFX_ITEM_PRESENTATION_NONE
;
474 // -----------------------------------------------------------------------
476 sal_uInt16
SvxAdjustItem::GetValueCount() const
478 return SVX_ADJUST_END
; // SVX_ADJUST_BLOCKLINE + 1
481 // -----------------------------------------------------------------------
483 rtl::OUString
SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos
) const
485 DBG_ASSERT( nPos
<= (sal_uInt16
)SVX_ADJUST_BLOCKLINE
, "enum overflow!" );
486 return EE_RESSTR(RID_SVXITEMS_ADJUST_BEGIN
+ nPos
);
489 // -----------------------------------------------------------------------
491 sal_uInt16
SvxAdjustItem::GetEnumValue() const
493 return (sal_uInt16
)GetAdjust();
496 // -----------------------------------------------------------------------
498 void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal
)
500 SetAdjust( (const SvxAdjust
)nVal
);
503 // -----------------------------------------------------------------------
505 sal_uInt16
SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion
) const
507 return (nFileVersion
== SOFFICE_FILEFORMAT_31
)
508 ? 0 : ADJUST_LASTBLOCK_VERSION
;
511 // -----------------------------------------------------------------------
513 SfxPoolItem
* SvxAdjustItem::Create(SvStream
& rStrm
, sal_uInt16 nVersion
) const
516 rStrm
>> eAdjustment
;
517 SvxAdjustItem
*pRet
= new SvxAdjustItem( (SvxAdjust
)eAdjustment
, Which() );
518 if( nVersion
>= ADJUST_LASTBLOCK_VERSION
)
522 pRet
->bOneBlock
= 0 != (nFlags
& 0x0001);
523 pRet
->bLastCenter
= 0 != (nFlags
& 0x0002);
524 pRet
->bLastBlock
= 0 != (nFlags
& 0x0004);
529 // -----------------------------------------------------------------------
531 SvStream
& SvxAdjustItem::Store( SvStream
& rStrm
, sal_uInt16 nItemVersion
) const
533 rStrm
<< (char)GetAdjust();
534 if ( nItemVersion
>= ADJUST_LASTBLOCK_VERSION
)
543 rStrm
<< (sal_Int8
) nFlags
;
548 // class SvxWidowsItem ---------------------------------------------------
550 SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL
, const sal_uInt16 nId
) :
551 SfxByteItem( nId
, nL
)
555 // -----------------------------------------------------------------------
557 SfxPoolItem
* SvxWidowsItem::Clone( SfxItemPool
* ) const
559 return new SvxWidowsItem( *this );
562 // -----------------------------------------------------------------------
564 SfxPoolItem
* SvxWidowsItem::Create(SvStream
& rStrm
, sal_uInt16
) const
568 return new SvxWidowsItem( nLines
, Which() );
571 // -----------------------------------------------------------------------
573 SvStream
& SvxWidowsItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
575 rStrm
<< (sal_Int8
)GetValue();
579 //------------------------------------------------------------------------
581 SfxItemPresentation
SvxWidowsItem::GetPresentation
583 SfxItemPresentation ePres
,
584 SfxMapUnit
/*eCoreUnit*/,
585 SfxMapUnit
/*ePresUnit*/,
586 XubString
& rText
, const IntlWrapper
*
591 case SFX_ITEM_PRESENTATION_NONE
:
597 case SFX_ITEM_PRESENTATION_NAMELESS
:
599 rText
= EE_RESSTR(RID_SVXITEMS_LINES
);
603 case SFX_ITEM_PRESENTATION_COMPLETE
:
605 rText
= EE_RESSTR(RID_SVXITEMS_WIDOWS_COMPLETE
);
607 rText
+= EE_RESSTR(RID_SVXITEMS_LINES
);
612 SAL_WARN( "editeng.items", "SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" );
616 rText
.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
620 // class SvxOrphansItem --------------------------------------------------
622 SvxOrphansItem::SvxOrphansItem(const sal_uInt8 nL
, const sal_uInt16 nId
) :
623 SfxByteItem( nId
, nL
)
627 // -----------------------------------------------------------------------
629 SfxPoolItem
* SvxOrphansItem::Clone( SfxItemPool
* ) const
631 return new SvxOrphansItem( *this );
634 // -----------------------------------------------------------------------
636 SfxPoolItem
* SvxOrphansItem::Create(SvStream
& rStrm
, sal_uInt16
) const
640 return new SvxOrphansItem( nLines
, Which() );
643 // -----------------------------------------------------------------------
645 SvStream
& SvxOrphansItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
647 rStrm
<< (sal_Int8
) GetValue();
651 //------------------------------------------------------------------------
653 SfxItemPresentation
SvxOrphansItem::GetPresentation
655 SfxItemPresentation ePres
,
656 SfxMapUnit
/*eCoreUnit*/,
657 SfxMapUnit
/*ePresUnit*/,
658 XubString
& rText
, const IntlWrapper
*
663 case SFX_ITEM_PRESENTATION_NONE
:
669 case SFX_ITEM_PRESENTATION_NAMELESS
:
671 rText
= EE_RESSTR(RID_SVXITEMS_LINES
);
675 case SFX_ITEM_PRESENTATION_COMPLETE
:
677 rText
= EE_RESSTR(RID_SVXITEMS_ORPHANS_COMPLETE
);
679 rText
+= EE_RESSTR(RID_SVXITEMS_LINES
);
684 SAL_WARN( "editeng.items", "SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" );
688 rText
.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
692 // class SvxHyphenZoneItem -----------------------------------------------
694 SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph
, const sal_uInt16 nId
) :
699 nMinLead
= nMinTrail
= 0;
703 // -----------------------------------------------------------------------
704 bool SvxHyphenZoneItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
706 nMemberId
&= ~CONVERT_TWIPS
;
710 rVal
= Bool2Any(bHyphen
);
712 case MID_HYPHEN_MIN_LEAD
:
713 rVal
<<= (sal_Int16
)nMinLead
;
715 case MID_HYPHEN_MIN_TRAIL
:
716 rVal
<<= (sal_Int16
)nMinTrail
;
718 case MID_HYPHEN_MAX_HYPHENS
:
719 rVal
<<= (sal_Int16
)nMaxHyphens
;
724 // -----------------------------------------------------------------------
725 bool SvxHyphenZoneItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
727 nMemberId
&= ~CONVERT_TWIPS
;
728 sal_Int16 nNewVal
= 0;
730 if( nMemberId
!= MID_IS_HYPHEN
)
731 if(!(rVal
>>= nNewVal
))
737 bHyphen
= Any2Bool(rVal
);
739 case MID_HYPHEN_MIN_LEAD
:
740 nMinLead
= (sal_uInt8
)nNewVal
;
742 case MID_HYPHEN_MIN_TRAIL
:
743 nMinTrail
= (sal_uInt8
)nNewVal
;
745 case MID_HYPHEN_MAX_HYPHENS
:
746 nMaxHyphens
= (sal_uInt8
)nNewVal
;
752 // -----------------------------------------------------------------------
754 int SvxHyphenZoneItem::operator==( const SfxPoolItem
& rAttr
) const
756 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
758 return ( (((SvxHyphenZoneItem
&)rAttr
).bHyphen
== bHyphen
)
759 && (((SvxHyphenZoneItem
&)rAttr
).bPageEnd
== bPageEnd
)
760 && (((SvxHyphenZoneItem
&)rAttr
).nMinLead
== nMinLead
)
761 && (((SvxHyphenZoneItem
&)rAttr
).nMinTrail
== nMinTrail
)
762 && (((SvxHyphenZoneItem
&)rAttr
).nMaxHyphens
== nMaxHyphens
) );
765 // -----------------------------------------------------------------------
767 SfxPoolItem
* SvxHyphenZoneItem::Clone( SfxItemPool
* ) const
769 return new SvxHyphenZoneItem( *this );
772 //------------------------------------------------------------------------
774 SfxItemPresentation
SvxHyphenZoneItem::GetPresentation
776 SfxItemPresentation ePres
,
777 SfxMapUnit
/*eCoreUnit*/,
778 SfxMapUnit
/*ePresUnit*/,
779 XubString
& rText
, const IntlWrapper
*
784 case SFX_ITEM_PRESENTATION_NONE
:
786 return SFX_ITEM_PRESENTATION_NONE
;
787 case SFX_ITEM_PRESENTATION_NAMELESS
:
789 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
792 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
793 rText
= EE_RESSTR(nId
);
795 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
798 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
799 rText
+= EE_RESSTR(nId
);
801 rText
+= String::CreateFromInt32( nMinLead
);
803 rText
+= String::CreateFromInt32( nMinTrail
);
805 rText
+= String::CreateFromInt32( nMaxHyphens
);
806 return SFX_ITEM_PRESENTATION_COMPLETE
;
808 case SFX_ITEM_PRESENTATION_COMPLETE
:
810 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
813 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
814 rText
= EE_RESSTR(nId
);
816 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
819 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
820 rText
+= EE_RESSTR(nId
);
822 rText
+= String::CreateFromInt32(nMinLead
);
823 rText
+= EE_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD
);
825 rText
+= String::CreateFromInt32(nMinTrail
);
826 rText
+= EE_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL
);
828 rText
+= String::CreateFromInt32(nMaxHyphens
);
829 rText
+= EE_RESSTR(RID_SVXITEMS_HYPHEN_MAX
);
830 return SFX_ITEM_PRESENTATION_COMPLETE
;
832 default: ;//prevent warning
834 return SFX_ITEM_PRESENTATION_NONE
;
837 // -----------------------------------------------------------------------
839 SfxPoolItem
* SvxHyphenZoneItem::Create(SvStream
& rStrm
, sal_uInt16
) const
841 sal_Int8 _bHyphen
, _bHyphenPageEnd
;
842 sal_Int8 _nMinLead
, _nMinTrail
, _nMaxHyphens
;
843 rStrm
>> _bHyphen
>> _bHyphenPageEnd
>> _nMinLead
>> _nMinTrail
>> _nMaxHyphens
;
844 SvxHyphenZoneItem
* pAttr
= new SvxHyphenZoneItem( sal_False
, Which() );
845 pAttr
->SetHyphen( sal_Bool( _bHyphen
!= 0 ) );
846 pAttr
->SetPageEnd( sal_Bool( _bHyphenPageEnd
!= 0 ) );
847 pAttr
->GetMinLead() = _nMinLead
;
848 pAttr
->GetMinTrail() = _nMinTrail
;
849 pAttr
->GetMaxHyphens() = _nMaxHyphens
;
853 // -----------------------------------------------------------------------
855 SvStream
& SvxHyphenZoneItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
857 rStrm
<< (sal_Int8
) IsHyphen()
858 << (sal_Int8
) IsPageEnd()
859 << (sal_Int8
) GetMinLead()
860 << (sal_Int8
) GetMinTrail()
861 << (sal_Int8
) GetMaxHyphens();
865 // class SvxTabStop ------------------------------------------------------
867 SvxTabStop::SvxTabStop()
870 eAdjustment
= SVX_TAB_ADJUST_LEFT
;
871 m_cDecimal
= cDfltDecimalChar
;
872 cFill
= cDfltFillChar
;
875 // -----------------------------------------------------------------------
877 SvxTabStop::SvxTabStop( const sal_Int32 nPos
, const SvxTabAdjust eAdjst
,
878 const sal_Unicode cDec
, const sal_Unicode cFil
)
881 eAdjustment
= eAdjst
;
885 // -----------------------------------------------------------------------------
886 void SvxTabStop::fillDecimal() const
888 if ( cDfltDecimalChar
== m_cDecimal
)
889 m_cDecimal
= SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
891 // -----------------------------------------------------------------------
893 XubString
SvxTabStop::GetValueString() const
897 aStr
+= sal_Unicode( '(' );
898 aStr
+= rtl::OUString::valueOf(static_cast<sal_Int32
>(nTabPos
));
900 aStr
+= EE_RESSTR(RID_SVXITEMS_TAB_ADJUST_BEGIN
+ (sal_uInt16
)eAdjustment
);
903 aStr
+= sal_Unicode('[');
904 aStr
+= EE_RESSTR(RID_SVXITEMS_TAB_DECIMAL_CHAR
);
905 aStr
+= GetDecimal();
906 aStr
+= sal_Unicode(']');
909 aStr
+= sal_Unicode('[');
910 aStr
+= EE_RESSTR(RID_SVXITEMS_TAB_FILL_CHAR
);
912 aStr
+= sal_Unicode(']');
913 aStr
+= sal_Unicode(')');
918 // class SvxTabStopItem --------------------------------------------------
920 SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich
) :
921 SfxPoolItem( _nWhich
),
922 SvxTabStopArr( sal_Int8(SVX_TAB_DEFCOUNT
) )
924 const sal_uInt16 nTabs
= SVX_TAB_DEFCOUNT
, nDist
= SVX_TAB_DEFDIST
;
925 const SvxTabAdjust eAdjst
= SVX_TAB_ADJUST_DEFAULT
;
927 for (sal_uInt16 i
= 0; i
< nTabs
; ++i
)
929 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
930 SvxTabStopArr::Insert( aTab
);
934 // -----------------------------------------------------------------------
936 SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs
,
937 const sal_uInt16 nDist
,
938 const SvxTabAdjust eAdjst
,
939 sal_uInt16 _nWhich
) :
940 SfxPoolItem( _nWhich
),
941 SvxTabStopArr( sal_Int8(nTabs
) )
943 for ( sal_uInt16 i
= 0; i
< nTabs
; ++i
)
945 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
946 SvxTabStopArr::Insert( aTab
);
950 // -----------------------------------------------------------------------
952 SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem
& rTSI
) :
953 SfxPoolItem( rTSI
.Which() ),
954 SvxTabStopArr( (sal_Int8
)rTSI
.Count() )
956 SvxTabStopArr::Insert( &rTSI
);
959 // -----------------------------------------------------------------------
961 sal_uInt16
SvxTabStopItem::GetPos( const SvxTabStop
& rTab
) const
964 return Seek_Entry( rTab
, &nFound
) ? nFound
: SVX_TAB_NOTFOUND
;
967 // -----------------------------------------------------------------------
969 sal_uInt16
SvxTabStopItem::GetPos( const sal_Int32 nPos
) const
972 return Seek_Entry( SvxTabStop( nPos
), &nFound
) ? nFound
: SVX_TAB_NOTFOUND
;
975 // -----------------------------------------------------------------------
977 SvxTabStopItem
& SvxTabStopItem::operator=( const SvxTabStopItem
& rTSI
)
979 Remove( 0, Count() );
980 SvxTabStopArr::Insert( &rTSI
);
984 bool SvxTabStopItem::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
986 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
987 nMemberId
&= ~CONVERT_TWIPS
;
992 sal_uInt16 nCount
= Count();
993 uno::Sequence
< style::TabStop
> aSeq(nCount
);
994 style::TabStop
* pArr
= aSeq
.getArray();
995 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
997 const SvxTabStop
& rTab
= *(GetStart() + i
);
998 pArr
[i
].Position
= bConvert
? TWIP_TO_MM100(rTab
.GetTabPos()) : rTab
.GetTabPos();
999 switch(rTab
.GetAdjustment())
1001 case SVX_TAB_ADJUST_LEFT
: pArr
[i
].Alignment
= style::TabAlign_LEFT
; break;
1002 case SVX_TAB_ADJUST_RIGHT
: pArr
[i
].Alignment
= style::TabAlign_RIGHT
; break;
1003 case SVX_TAB_ADJUST_DECIMAL
: pArr
[i
].Alignment
= style::TabAlign_DECIMAL
; break;
1004 case SVX_TAB_ADJUST_CENTER
: pArr
[i
].Alignment
= style::TabAlign_CENTER
; break;
1005 default: //SVX_TAB_ADJUST_DEFAULT
1006 pArr
[i
].Alignment
= style::TabAlign_DEFAULT
;
1009 pArr
[i
].DecimalChar
= rTab
.GetDecimal();
1010 pArr
[i
].FillChar
= rTab
.GetFill();
1017 const SvxTabStop
&rTab
= *(GetStart());
1018 rVal
<<= (static_cast<sal_Int32
>(bConvert
? TWIP_TO_MM100(rTab
.GetTabPos()) : rTab
.GetTabPos()));
1025 bool SvxTabStopItem::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
1027 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
1028 nMemberId
&= ~CONVERT_TWIPS
;
1029 switch ( nMemberId
)
1033 uno::Sequence
< style::TabStop
> aSeq
;
1034 if(!(rVal
>>= aSeq
))
1036 uno::Sequence
< uno::Sequence
< uno::Any
> > aAnySeq
;
1037 if (!(rVal
>>= aAnySeq
))
1039 sal_Int32 nLength
= aAnySeq
.getLength();
1040 aSeq
.realloc( nLength
);
1041 for ( sal_Int32 n
=0; n
<nLength
; n
++ )
1043 uno::Sequence
< uno::Any
>& rAnySeq
= aAnySeq
[n
];
1044 if ( rAnySeq
.getLength() == 4 )
1046 if (!(rAnySeq
[0] >>= aSeq
[n
].Position
)) return sal_False
;
1047 if (!(rAnySeq
[1] >>= aSeq
[n
].Alignment
))
1050 if (rAnySeq
[1] >>= nVal
)
1051 aSeq
[n
].Alignment
= (com::sun::star::style::TabAlign
) nVal
;
1055 if (!(rAnySeq
[2] >>= aSeq
[n
].DecimalChar
))
1057 ::rtl::OUString aVal
;
1058 if ( (rAnySeq
[2] >>= aVal
) && aVal
.getLength() == 1 )
1059 aSeq
[n
].DecimalChar
= aVal
.toChar();
1063 if (!(rAnySeq
[3] >>= aSeq
[n
].FillChar
))
1065 ::rtl::OUString aVal
;
1066 if ( (rAnySeq
[3] >>= aVal
) && aVal
.getLength() == 1 )
1067 aSeq
[n
].FillChar
= aVal
.toChar();
1077 SvxTabStopArr::Remove( 0, Count() );
1078 const style::TabStop
* pArr
= aSeq
.getConstArray();
1079 const sal_uInt16 nCount
= (sal_uInt16
)aSeq
.getLength();
1080 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
1082 SvxTabAdjust eAdjust
= SVX_TAB_ADJUST_DEFAULT
;
1083 switch(pArr
[i
].Alignment
)
1085 case style::TabAlign_LEFT
: eAdjust
= SVX_TAB_ADJUST_LEFT
; break;
1086 case style::TabAlign_CENTER
: eAdjust
= SVX_TAB_ADJUST_CENTER
; break;
1087 case style::TabAlign_RIGHT
: eAdjust
= SVX_TAB_ADJUST_RIGHT
; break;
1088 case style::TabAlign_DECIMAL
: eAdjust
= SVX_TAB_ADJUST_DECIMAL
; break;
1089 default: ;//prevent warning
1091 sal_Unicode cFill
= pArr
[i
].FillChar
;
1092 sal_Unicode cDecimal
= pArr
[i
].DecimalChar
;
1093 SvxTabStop
aTab( bConvert
? MM100_TO_TWIP(pArr
[i
].Position
) : pArr
[i
].Position
,
1103 sal_Int32 nNewPos
= 0;
1104 if (!(rVal
>>= nNewPos
) )
1107 nNewPos
= MM100_TO_TWIP ( nNewPos
);
1110 const SvxTabStop
& rTab
= *(GetStart());
1111 SvxTabStop
aNewTab ( nNewPos
, rTab
.GetAdjustment(), rTab
.GetDecimal(), rTab
.GetFill() );
1119 // -----------------------------------------------------------------------
1121 int SvxTabStopItem::operator==( const SfxPoolItem
& rAttr
) const
1123 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
1125 const SvxTabStopItem
& rTSI
= (SvxTabStopItem
&)rAttr
;
1127 if ( Count() != rTSI
.Count() )
1130 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1131 if( !(*this)[i
].IsEqual( rTSI
[i
] ) )
1136 // -----------------------------------------------------------------------
1138 SfxPoolItem
* SvxTabStopItem::Clone( SfxItemPool
* ) const
1140 return new SvxTabStopItem( *this );
1143 //------------------------------------------------------------------------
1145 SfxItemPresentation
SvxTabStopItem::GetPresentation
1147 SfxItemPresentation ePres
,
1148 SfxMapUnit eCoreUnit
,
1149 SfxMapUnit ePresUnit
,
1150 XubString
& rText
, const IntlWrapper
*pIntl
1155 if ( ePres
> SFX_ITEM_PRESENTATION_NONE
)
1157 sal_Bool bComma
= sal_False
;
1159 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1161 if ( SVX_TAB_ADJUST_DEFAULT
!= ((*this)[i
]).GetAdjustment() )
1164 rText
+= sal_Unicode(',');
1165 rText
+= GetMetricText(
1166 ((*this)[i
]).GetTabPos(), eCoreUnit
, ePresUnit
, pIntl
);
1167 if ( SFX_ITEM_PRESENTATION_COMPLETE
== ePres
)
1168 rText
+= EE_RESSTR(GetMetricId(ePresUnit
));
1176 // -----------------------------------------------------------------------
1178 SfxPoolItem
* SvxTabStopItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1182 SvxTabStopItem
* pAttr
=
1183 new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_DEFAULT
, Which() );
1185 for ( sal_Int8 i
= 0; i
< nTabs
; i
++ )
1189 unsigned char cDecimal
, cFill
;
1190 rStrm
>> nPos
>> eAdjust
>> cDecimal
>> cFill
;
1191 if( !i
|| SVX_TAB_ADJUST_DEFAULT
!= eAdjust
)
1192 pAttr
->Insert( SvxTabStop
1193 ( nPos
, (SvxTabAdjust
)eAdjust
, sal_Unicode(cDecimal
), sal_Unicode(cFill
) ) );
1198 // -----------------------------------------------------------------------
1200 SvStream
& SvxTabStopItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1202 // Default-Tabs are only expanded for the default Attribute. For complete
1203 // backward compabillity (<=304) all tabs have to be expanded, this makes
1204 // the files grow large in size. All only SWG!
1206 const SfxItemPool
*pPool
= SfxItemPool::GetStoringPool();
1207 const bool bStoreDefTabs
= pPool
1208 && pPool
->GetName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SWG"))
1209 && ::IsDefaultItem( this );
1211 const short nTabs
= Count();
1212 sal_uInt16 nCount
= 0, nDefDist
= 0;
1217 const SvxTabStopItem
& rDefTab
= (const SvxTabStopItem
&)
1218 pPool
->GetDefaultItem( pPool
->GetWhich( SID_ATTR_TABSTOP
, sal_False
) );
1219 nDefDist
= sal_uInt16( rDefTab
.GetStart()->GetTabPos() );
1220 const sal_Int32 nPos
= nTabs
> 0 ? (*this)[nTabs
-1].GetTabPos() : 0;
1221 nCount
= (sal_uInt16
)(nPos
/ nDefDist
);
1222 nNew
= (nCount
+ 1) * nDefDist
;
1224 if( nNew
<= nPos
+ 50 )
1227 sal_Int32 lA3Width
= SvxPaperInfo::GetPaperSize(PAPER_A3
).Width();
1228 nCount
= (sal_uInt16
)(nNew
< lA3Width
? ( lA3Width
- nNew
) / nDefDist
+ 1 : 0);
1231 rStrm
<< (sal_Int8
) ( nTabs
+ nCount
);
1232 for ( short i
= 0; i
< nTabs
; i
++ )
1234 const SvxTabStop
& rTab
= (*this)[ i
];
1235 rStrm
<< rTab
.GetTabPos()
1236 << (sal_Int8
) rTab
.GetAdjustment()
1237 << (unsigned char) rTab
.GetDecimal()
1238 << (unsigned char) rTab
.GetFill();
1241 if ( bStoreDefTabs
)
1242 for( ; nCount
; --nCount
)
1244 SvxTabStop
aSwTabStop(nNew
, SVX_TAB_ADJUST_DEFAULT
);
1245 rStrm
<< aSwTabStop
.GetTabPos()
1246 << (sal_Int8
) aSwTabStop
.GetAdjustment()
1247 << (unsigned char) aSwTabStop
.GetDecimal()
1248 << (unsigned char) aSwTabStop
.GetFill();
1255 // -----------------------------------------------------------------------
1256 sal_Bool
SvxTabStopItem::Insert( const SvxTabStop
& rTab
)
1258 sal_uInt16 nTabPos
= GetPos(rTab
);
1259 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1261 return SvxTabStopArr::Insert( rTab
);
1263 // -----------------------------------------------------------------------
1264 void SvxTabStopItem::Insert( const SvxTabStopItem
* pTabs
, sal_uInt16 nStart
,
1267 for( sal_uInt16 i
= nStart
; i
< nEnd
&& i
< pTabs
->Count(); i
++ )
1269 const SvxTabStop
& rTab
= (*pTabs
)[i
];
1270 sal_uInt16 nTabPos
= GetPos(rTab
);
1271 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1274 SvxTabStopArr::Insert( pTabs
, nStart
, nEnd
);
1279 // class SvxFmtSplitItem -------------------------------------------------
1280 SvxFmtSplitItem::~SvxFmtSplitItem()
1283 // -----------------------------------------------------------------------
1284 SfxPoolItem
* SvxFmtSplitItem::Clone( SfxItemPool
* ) const
1286 return new SvxFmtSplitItem( *this );
1289 // -----------------------------------------------------------------------
1291 SvStream
& SvxFmtSplitItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1293 rStrm
<< (sal_Int8
)GetValue();
1297 // -----------------------------------------------------------------------
1299 SfxPoolItem
* SvxFmtSplitItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1303 return new SvxFmtSplitItem( sal_Bool( bIsSplit
!= 0 ), Which() );
1306 //------------------------------------------------------------------------
1308 SfxItemPresentation
SvxFmtSplitItem::GetPresentation
1310 SfxItemPresentation ePres
,
1311 SfxMapUnit
/*eCoreUnit*/,
1312 SfxMapUnit
/*ePresUnit*/,
1313 XubString
& rText
, const IntlWrapper
*
1318 case SFX_ITEM_PRESENTATION_NONE
:
1320 return SFX_ITEM_PRESENTATION_NONE
;
1321 case SFX_ITEM_PRESENTATION_NAMELESS
:
1322 case SFX_ITEM_PRESENTATION_COMPLETE
:
1324 sal_uInt16 nId
= RID_SVXITEMS_FMTSPLIT_FALSE
;
1327 nId
= RID_SVXITEMS_FMTSPLIT_TRUE
;
1328 rText
= EE_RESSTR(nId
);
1331 default: ;//prevent warning
1333 return SFX_ITEM_PRESENTATION_NONE
;
1336 // --------------------------------------------------------------------
1338 SfxPoolItem
* SvxPageModelItem::Clone( SfxItemPool
* ) const
1340 return new SvxPageModelItem( *this );
1343 //------------------------------------------------------------------------
1345 bool SvxPageModelItem::QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
) const
1347 nMemberId
&= ~CONVERT_TWIPS
;
1349 switch ( nMemberId
)
1351 case MID_AUTO
: rVal
<<= (sal_Bool
) bAuto
; break;
1352 case MID_NAME
: rVal
<<= ::rtl::OUString( GetValue() ); break;
1353 default: OSL_FAIL("Wrong MemberId!"); return sal_False
;
1359 bool SvxPageModelItem::PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
)
1361 nMemberId
&= ~CONVERT_TWIPS
;
1363 ::rtl::OUString aStr
;
1364 switch ( nMemberId
)
1366 case MID_AUTO
: bRet
= ( rVal
>>= bAuto
); break;
1367 case MID_NAME
: bRet
= ( rVal
>>= aStr
); if ( bRet
) SetValue(aStr
); break;
1368 default: OSL_FAIL("Wrong MemberId!"); return sal_False
;
1374 SfxItemPresentation
SvxPageModelItem::GetPresentation
1376 SfxItemPresentation ePres
,
1377 SfxMapUnit
/*eCoreUnit*/,
1378 SfxMapUnit
/*ePresUnit*/,
1379 XubString
& rText
, const IntlWrapper
*
1383 bool bSet
= ( GetValue().Len() > 0 );
1387 case SFX_ITEM_PRESENTATION_NONE
:
1388 return SFX_ITEM_PRESENTATION_NONE
;
1390 case SFX_ITEM_PRESENTATION_NAMELESS
:
1393 return SFX_ITEM_PRESENTATION_NAMELESS
;
1395 case SFX_ITEM_PRESENTATION_COMPLETE
:
1398 rText
= EE_RESSTR(RID_SVXITEMS_PAGEMODEL_COMPLETE
);
1399 rText
+= GetValue();
1401 return SFX_ITEM_PRESENTATION_COMPLETE
;
1402 default: ;//prevent warning
1404 return SFX_ITEM_PRESENTATION_NONE
;
1407 //------------------------------------------------------------------------
1409 SvxScriptSpaceItem::SvxScriptSpaceItem( sal_Bool bOn
, const sal_uInt16 nId
)
1410 : SfxBoolItem( nId
, bOn
)
1414 SfxPoolItem
* SvxScriptSpaceItem::Clone( SfxItemPool
* ) const
1416 return new SvxScriptSpaceItem( GetValue(), Which() );
1419 SfxPoolItem
* SvxScriptSpaceItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1423 return new SvxScriptSpaceItem( bFlag
, Which() );
1426 sal_uInt16
SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer
) const
1428 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1429 SOFFICE_FILEFORMAT_40
==nFFVer
||
1430 SOFFICE_FILEFORMAT_50
==nFFVer
,
1431 "SvxTwoLinesItem: Is there a new file format? ");
1433 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1436 SfxItemPresentation
SvxScriptSpaceItem::GetPresentation(
1437 SfxItemPresentation ePres
,
1438 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1439 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1443 case SFX_ITEM_PRESENTATION_NONE
:
1446 case SFX_ITEM_PRESENTATION_NAMELESS
:
1447 case SFX_ITEM_PRESENTATION_COMPLETE
:
1449 rText
= EE_RESSTR( !GetValue()
1450 ? RID_SVXITEMS_SCRPTSPC_OFF
1451 : RID_SVXITEMS_SCRPTSPC_ON
);
1454 default: ;//prevent warning
1456 return SFX_ITEM_PRESENTATION_NONE
;
1459 //------------------------------------------------------------------------
1461 SvxHangingPunctuationItem::SvxHangingPunctuationItem(
1462 sal_Bool bOn
, const sal_uInt16 nId
)
1463 : SfxBoolItem( nId
, bOn
)
1467 SfxPoolItem
* SvxHangingPunctuationItem::Clone( SfxItemPool
* ) const
1469 return new SvxHangingPunctuationItem( GetValue(), Which() );
1472 SfxPoolItem
* SvxHangingPunctuationItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1476 return new SvxHangingPunctuationItem( nValue
, Which() );
1479 sal_uInt16
SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer
) const
1481 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1482 SOFFICE_FILEFORMAT_40
==nFFVer
||
1483 SOFFICE_FILEFORMAT_50
==nFFVer
,
1484 "SvxHangingPunctuationItem: Is there a new file format? ");
1486 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1489 SfxItemPresentation
SvxHangingPunctuationItem::GetPresentation(
1490 SfxItemPresentation ePres
,
1491 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1492 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1496 case SFX_ITEM_PRESENTATION_NONE
:
1499 case SFX_ITEM_PRESENTATION_NAMELESS
:
1500 case SFX_ITEM_PRESENTATION_COMPLETE
:
1502 rText
= EE_RESSTR( !GetValue()
1503 ? RID_SVXITEMS_HNGPNCT_OFF
1504 : RID_SVXITEMS_HNGPNCT_ON
);
1507 default: ;//prevent warning
1510 return SFX_ITEM_PRESENTATION_NONE
;
1512 //------------------------------------------------------------------------
1514 SvxForbiddenRuleItem::SvxForbiddenRuleItem(
1515 sal_Bool bOn
, const sal_uInt16 nId
)
1516 : SfxBoolItem( nId
, bOn
)
1520 SfxPoolItem
* SvxForbiddenRuleItem::Clone( SfxItemPool
* ) const
1522 return new SvxForbiddenRuleItem( GetValue(), Which() );
1525 SfxPoolItem
* SvxForbiddenRuleItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1529 return new SvxForbiddenRuleItem( nValue
, Which() );
1532 sal_uInt16
SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer
) const
1534 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1535 SOFFICE_FILEFORMAT_40
==nFFVer
||
1536 SOFFICE_FILEFORMAT_50
==nFFVer
,
1537 "SvxForbiddenRuleItem: Is there a new file format? ");
1539 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1542 SfxItemPresentation
SvxForbiddenRuleItem::GetPresentation(
1543 SfxItemPresentation ePres
,
1544 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1545 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1549 case SFX_ITEM_PRESENTATION_NONE
:
1552 case SFX_ITEM_PRESENTATION_NAMELESS
:
1553 case SFX_ITEM_PRESENTATION_COMPLETE
:
1555 rText
= EE_RESSTR( !GetValue()
1556 ? RID_SVXITEMS_FORBIDDEN_RULE_OFF
1557 : RID_SVXITEMS_FORBIDDEN_RULE_ON
);
1560 default: ;//prevent warning
1563 return SFX_ITEM_PRESENTATION_NONE
;
1566 /*************************************************************************
1567 |* class SvxParaVertAlignItem
1568 *************************************************************************/
1570 SvxParaVertAlignItem::SvxParaVertAlignItem( sal_uInt16 nValue
,
1571 const sal_uInt16 nW
)
1572 : SfxUInt16Item( nW
, nValue
)
1576 SfxPoolItem
* SvxParaVertAlignItem::Clone( SfxItemPool
* ) const
1578 return new SvxParaVertAlignItem( GetValue(), Which() );
1581 SfxPoolItem
* SvxParaVertAlignItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1585 return new SvxParaVertAlignItem( nVal
, Which() );
1588 SvStream
& SvxParaVertAlignItem::Store( SvStream
& rStrm
, sal_uInt16
) const
1590 rStrm
<< GetValue();
1594 sal_uInt16
SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer
) const
1596 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1599 SfxItemPresentation
SvxParaVertAlignItem::GetPresentation(
1600 SfxItemPresentation ePres
,
1601 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1602 String
&rText
, const IntlWrapper
* ) const
1606 case SFX_ITEM_PRESENTATION_NONE
:
1609 case SFX_ITEM_PRESENTATION_NAMELESS
:
1610 case SFX_ITEM_PRESENTATION_COMPLETE
:
1613 switch( GetValue() )
1615 case AUTOMATIC
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_AUTO
; break;
1616 case TOP
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_TOP
; break;
1617 case CENTER
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_CENTER
; break;
1618 case BOTTOM
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BOTTOM
; break;
1619 default: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BASELINE
; break;
1621 rText
= EE_RESSTR( nTmp
);
1624 default: ;//prevent warning
1627 return SFX_ITEM_PRESENTATION_NONE
;
1630 bool SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any
& rVal
,
1631 sal_uInt8
/*nMemberId*/ ) const
1633 rVal
<<= (sal_Int16
)GetValue();
1637 bool SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any
& rVal
,
1638 sal_uInt8
/*nMemberId*/ )
1640 sal_Int16 nVal
= sal_Int16();
1641 if((rVal
>>= nVal
) && nVal
>=0 && nVal
<= BOTTOM
)
1643 SetValue( (sal_uInt16
)nVal
);
1650 int SvxParaVertAlignItem::operator==( const SfxPoolItem
& rItem
) const
1652 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
1653 return SfxUInt16Item::operator==( rItem
);
1657 SvxParaGridItem::SvxParaGridItem( sal_Bool bOn
, const sal_uInt16 nId
)
1658 : SfxBoolItem( nId
, bOn
)
1662 SfxPoolItem
* SvxParaGridItem::Clone( SfxItemPool
* ) const
1664 return new SvxParaGridItem( GetValue(), Which() );
1667 SfxPoolItem
* SvxParaGridItem::Create(SvStream
& rStrm
, sal_uInt16
) const
1671 return new SvxParaGridItem( bFlag
, Which() );
1674 sal_uInt16
SvxParaGridItem::GetVersion( sal_uInt16 nFFVer
) const
1676 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1677 SOFFICE_FILEFORMAT_40
==nFFVer
||
1678 SOFFICE_FILEFORMAT_50
==nFFVer
,
1679 "SvxParaGridItem: Is there a new file format? ");
1681 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1684 SfxItemPresentation
SvxParaGridItem::GetPresentation(
1685 SfxItemPresentation ePres
,
1686 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1687 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1691 case SFX_ITEM_PRESENTATION_NONE
:
1694 case SFX_ITEM_PRESENTATION_NAMELESS
:
1695 case SFX_ITEM_PRESENTATION_COMPLETE
:
1697 rText
= GetValue() ?
1698 EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_ON
) :
1699 EE_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_OFF
);
1703 default: ;//prevent warning
1706 return SFX_ITEM_PRESENTATION_NONE
;
1710 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */