1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: paraitem.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // include ---------------------------------------------------------------
35 #include <com/sun/star/style/TabStop.hpp>
36 #include <com/sun/star/style/LineSpacing.hpp>
37 #include <com/sun/star/style/LineSpacingMode.hpp>
38 #include <com/sun/star/uno/Sequence.hxx>
39 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
40 #include <comphelper/processfactory.hxx>
42 #include <svtools/syslocale.hxx>
44 #include <comphelper/types.hxx>
46 using namespace ::rtl
;
47 using namespace ::com::sun::star
;
49 #include <tools/rtti.hxx>
50 #include <basic/sbx.hxx>
51 #define GLOBALOVERFLOW3
53 #define _SVX_PARAITEM_CXX
54 #include <svtools/itempool.hxx>
56 #include <svtools/memberid.hrc>
57 #include <svx/svxitems.hrc>
59 #include <svx/lspcitem.hxx>
60 #include <svx/adjitem.hxx>
61 #include <svx/orphitem.hxx>
62 #include <svx/widwitem.hxx>
63 #include <svx/tstpitem.hxx>
64 #include <svx/pmdlitem.hxx>
65 #include <svx/spltitem.hxx>
66 #include <svx/hyznitem.hxx>
67 #include <svx/scriptspaceitem.hxx>
68 #include <svx/hngpnctitem.hxx>
69 #include <svx/forbiddenruleitem.hxx>
70 #include <svx/paravertalignitem.hxx>
71 #include "pgrditem.hxx"
74 #include <rtl/ustring.hxx>
76 #include <svx/unomid.hxx>
78 #include <svx/itemtype.hxx>
79 #include <svx/dialmgr.hxx>
80 #include <svx/paperinf.hxx>
81 #include <vcl/svapp.hxx>
85 using namespace ::rtl
;
86 using namespace ::com::sun::star
;
88 // Konvertierung fuer UNO
89 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
90 #define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
91 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
92 #define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
95 // STATIC DATA -----------------------------------------------------------
98 // -----------------------------------------------------------------------
101 TYPEINIT1_FACTORY(SvxLineSpacingItem
, SfxPoolItem
, new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT
, 0));
102 TYPEINIT1_FACTORY(SvxAdjustItem
, SfxPoolItem
, new SvxAdjustItem(SVX_ADJUST_LEFT
, 0));
103 TYPEINIT1_FACTORY(SvxWidowsItem
, SfxByteItem
, new SvxWidowsItem(0, 0));
104 TYPEINIT1_FACTORY(SvxOrphansItem
, SfxByteItem
, new SvxOrphansItem(0, 0));
105 TYPEINIT1_FACTORY(SvxHyphenZoneItem
, SfxPoolItem
, new SvxHyphenZoneItem(sal_False
, 0));
106 TYPEINIT1_FACTORY(SvxTabStopItem
, SfxPoolItem
, new SvxTabStopItem(0));
107 TYPEINIT1_FACTORY(SvxFmtSplitItem
, SfxBoolItem
, new SvxFmtSplitItem(sal_False
, 0));
108 TYPEINIT1_FACTORY(SvxPageModelItem
, SfxStringItem
, new SvxPageModelItem(0));
109 TYPEINIT1_FACTORY(SvxScriptSpaceItem
, SfxBoolItem
, new SvxScriptSpaceItem(sal_False
, 0));
110 TYPEINIT1_FACTORY(SvxHangingPunctuationItem
, SfxBoolItem
, new SvxHangingPunctuationItem(sal_False
, 0));
111 TYPEINIT1_FACTORY(SvxForbiddenRuleItem
, SfxBoolItem
, new SvxForbiddenRuleItem(sal_False
, 0));
112 TYPEINIT1_FACTORY(SvxParaVertAlignItem
, SfxUInt16Item
, new SvxParaVertAlignItem(0, 0));
113 TYPEINIT1_FACTORY(SvxParaGridItem
, SfxBoolItem
, new SvxParaGridItem(sal_True
, 0));
115 SV_IMPL_VARARR_SORT( SvxTabStopArr
, SvxTabStop
)
117 // -----------------------------------------------------------------------
119 SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight
, const sal_uInt16 nId
)
120 : SfxEnumItemInterface( nId
)
122 nPropLineSpace
= 100;
124 nLineHeight
= nHeight
;
125 eLineSpace
= SVX_LINE_SPACE_AUTO
;
126 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
129 // -----------------------------------------------------------------------
131 int SvxLineSpacingItem::operator==( const SfxPoolItem
& rAttr
) const
133 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
135 const SvxLineSpacingItem
& rLineSpace
= (const SvxLineSpacingItem
&)rAttr
;
137 // Gleiche Linespacing Rule?
138 (eLineSpace
== rLineSpace
.eLineSpace
)
139 // Bei maximalem und minimalem Linespacing muss das Mass
141 && (eLineSpace
== SVX_LINE_SPACE_AUTO
||
142 nLineHeight
== rLineSpace
.nLineHeight
)
143 // Gleiche Interlinespacing Rule?
144 && ( eInterLineSpace
== rLineSpace
.eInterLineSpace
)
145 // Entweder proportional oder draufaddieren eingestellt.
146 && (( eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
147 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_PROP
148 && nPropLineSpace
== rLineSpace
.nPropLineSpace
)
149 || (eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
150 && (nInterLineSpace
== rLineSpace
.nInterLineSpace
)))) ?
154 /*-----------------18.03.98 16:32-------------------
155 os: wer weiss noch, wieso das LineSpacingItem so
156 kompliziert ist? Fuer UNO koennen wir das nicht
157 gebrauchen. Da gibt es nur zwei Werte:
158 - ein sal_uInt16 fuer den Modus
159 - ein sal_uInt32 fuer alle Werte (Abstand, Hoehe, rel. Angaben)
161 --------------------------------------------------*/
162 sal_Bool
SvxLineSpacingItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
164 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
165 nMemberId
&= ~CONVERT_TWIPS
;
167 style::LineSpacing aLSp
;
170 case SVX_LINE_SPACE_AUTO
:
171 if(eInterLineSpace
== SVX_INTER_LINE_SPACE_FIX
)
173 aLSp
.Mode
= style::LineSpacingMode::LEADING
;
174 aLSp
.Height
= ( bConvert
? (short)TWIP_TO_MM100(nInterLineSpace
) : nInterLineSpace
);
176 else if(eInterLineSpace
== SVX_INTER_LINE_SPACE_OFF
)
178 aLSp
.Mode
= style::LineSpacingMode::PROP
;
183 aLSp
.Mode
= style::LineSpacingMode::PROP
;
184 aLSp
.Height
= nPropLineSpace
;
187 case SVX_LINE_SPACE_FIX
:
188 case SVX_LINE_SPACE_MIN
:
189 aLSp
.Mode
= eLineSpace
== SVX_LINE_SPACE_FIX
? style::LineSpacingMode::FIX
: style::LineSpacingMode::MINIMUM
;
190 aLSp
.Height
= ( bConvert
? (short)TWIP_TO_MM100_UNSIGNED(nLineHeight
) : nLineHeight
);
193 ;//prevent warning about SVX_LINE_SPACE_END
198 case 0 : rVal
<<= aLSp
; break;
199 case MID_LINESPACE
: rVal
<<= aLSp
.Mode
; break;
200 case MID_HEIGHT
: rVal
<<= aLSp
.Height
; break;
201 default: DBG_ERROR("Wrong MemberId!"); break;
206 /*-----------------18.03.98 16:32-------------------
208 --------------------------------------------------*/
209 sal_Bool
SvxLineSpacingItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
211 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
212 nMemberId
&= ~CONVERT_TWIPS
;
214 // fill with current data
215 style::LineSpacing aLSp
;
217 sal_Bool bRet
= QueryValue( aAny
, bConvert
? CONVERT_TWIPS
: 0 ) && ( aAny
>>= aLSp
);
222 case 0 : bRet
= (rVal
>>= aLSp
); break;
223 case MID_LINESPACE
: bRet
= (rVal
>>= aLSp
.Mode
); break;
224 case MID_HEIGHT
: bRet
= (rVal
>>= aLSp
.Height
); break;
225 default: DBG_ERROR("Wrong MemberId!"); break;
230 nLineHeight
= aLSp
.Height
;
233 case style::LineSpacingMode::LEADING
:
235 eInterLineSpace
= SVX_INTER_LINE_SPACE_FIX
;
236 eLineSpace
= SVX_LINE_SPACE_AUTO
;
237 nInterLineSpace
= aLSp
.Height
;
239 nInterLineSpace
= (short)MM100_TO_TWIP(nInterLineSpace
);
243 case style::LineSpacingMode::PROP
:
245 eLineSpace
= SVX_LINE_SPACE_AUTO
;
246 nPropLineSpace
= (sal_Int8
)std::min(aLSp
.Height
, (short)0xFF);
247 if(100 == aLSp
.Height
)
248 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
250 eInterLineSpace
= SVX_INTER_LINE_SPACE_PROP
;
253 case style::LineSpacingMode::FIX
:
254 case style::LineSpacingMode::MINIMUM
:
256 eInterLineSpace
= SVX_INTER_LINE_SPACE_OFF
;
257 eLineSpace
= aLSp
.Mode
== style::LineSpacingMode::FIX
? SVX_LINE_SPACE_FIX
: SVX_LINE_SPACE_MIN
;
258 nLineHeight
= aLSp
.Height
;
260 nLineHeight
= (USHORT
)MM100_TO_TWIP_UNSIGNED(nLineHeight
);
269 // -----------------------------------------------------------------------
271 SfxPoolItem
* SvxLineSpacingItem::Clone( SfxItemPool
* ) const
273 return new SvxLineSpacingItem( *this );
276 //------------------------------------------------------------------------
278 SfxItemPresentation
SvxLineSpacingItem::GetPresentation
280 SfxItemPresentation
/*ePres*/,
281 SfxMapUnit
/*eCoreUnit*/,
282 SfxMapUnit
/*ePresUnit*/,
283 XubString
& rText
, const IntlWrapper
*
287 rText
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SvxLineSpacingItem" ));
291 return SFX_ITEM_PRESENTATION_NONE
;
294 // -----------------------------------------------------------------------
296 SfxPoolItem
* SvxLineSpacingItem::Create(SvStream
& rStrm
, sal_uInt16
) const
301 sal_Int8 nRule
, nInterRule
;
309 SvxLineSpacingItem
* pAttr
= new SvxLineSpacingItem( nHeight
, Which() );
310 pAttr
->SetInterLineSpace( nInterSpace
);
311 pAttr
->SetPropLineSpace( nPropSpace
);
312 pAttr
->GetLineSpaceRule() = (SvxLineSpace
)nRule
;
313 pAttr
->GetInterLineSpaceRule() = (SvxInterLineSpace
)nInterRule
;
317 // -----------------------------------------------------------------------
319 SvStream
& SvxLineSpacingItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
321 rStrm
<< (sal_Int8
) GetPropLineSpace()
322 << (short) GetInterLineSpace()
323 << (sal_uInt16
) GetLineHeight()
324 << (sal_Int8
) GetLineSpaceRule()
325 << (sal_Int8
) GetInterLineSpaceRule();
329 // -----------------------------------------------------------------------
331 sal_uInt16
SvxLineSpacingItem::GetValueCount() const
333 return SVX_LINESPACE_END
; // SVX_LINESPACE_TWO_LINES + 1
336 // -----------------------------------------------------------------------
338 XubString
SvxLineSpacingItem::GetValueTextByPos( sal_uInt16 nPos
) const
340 //! Strings demnaechst aus Resource laden
344 case SVX_LINESPACE_USER
: aText
.AppendAscii( "Benutzer" ); break;
345 case SVX_LINESPACE_ONE_LINE
: aText
.AppendAscii( "Einzeilig" ); break;
346 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
: aText
.AppendAscii( "1,5zeilig" ); break;
347 case SVX_LINESPACE_TWO_LINES
: aText
.AppendAscii( "Zweizeilig" ); break;
352 // -----------------------------------------------------------------------
354 sal_uInt16
SvxLineSpacingItem::GetEnumValue() const
357 switch ( nPropLineSpace
)
359 case 100: nVal
= SVX_LINESPACE_ONE_LINE
; break;
360 case 150: nVal
= SVX_LINESPACE_ONE_POINT_FIVE_LINES
; break;
361 case 200: nVal
= SVX_LINESPACE_TWO_LINES
; break;
362 default: nVal
= SVX_LINESPACE_USER
; break;
367 // -----------------------------------------------------------------------
369 void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal
)
373 case SVX_LINESPACE_ONE_LINE
: nPropLineSpace
= 100; break;
374 case SVX_LINESPACE_ONE_POINT_FIVE_LINES
: nPropLineSpace
= 150; break;
375 case SVX_LINESPACE_TWO_LINES
: nPropLineSpace
= 200; break;
379 // class SvxAdjustItem ---------------------------------------------------
381 SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst
, const sal_uInt16 nId
)
382 : SfxEnumItemInterface( nId
),
383 bOneBlock( sal_False
), bLastCenter( sal_False
), bLastBlock( sal_False
)
388 // -----------------------------------------------------------------------
390 int SvxAdjustItem::operator==( const SfxPoolItem
& rAttr
) const
392 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
394 return( ( GetAdjust() == ((SvxAdjustItem
&)rAttr
).GetAdjust() &&
395 bOneBlock
== ((SvxAdjustItem
&)rAttr
).bOneBlock
&&
396 bLastCenter
== ((SvxAdjustItem
&)rAttr
).bLastCenter
&&
397 bLastBlock
== ((SvxAdjustItem
&)rAttr
).bLastBlock
)
401 /*-----------------18.03.98 16:15-------------------
403 --------------------------------------------------*/
404 sal_Bool
SvxAdjustItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
406 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
407 nMemberId
&= ~CONVERT_TWIPS
;
410 case MID_PARA_ADJUST
: rVal
<<= (sal_Int16
)GetAdjust(); break;
411 case MID_LAST_LINE_ADJUST
: rVal
<<= (sal_Int16
)GetLastBlock(); break;
412 case MID_EXPAND_SINGLE
:
414 sal_Bool bValue
= bOneBlock
;
415 rVal
.setValue( &bValue
, ::getCppuBooleanType() );
418 default: ;//prevent warning
422 /*-----------------18.03.98 16:15-------------------
424 --------------------------------------------------*/
426 sal_Bool
SvxAdjustItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
428 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
429 nMemberId
&= ~CONVERT_TWIPS
;
432 case MID_PARA_ADJUST
:
433 case MID_LAST_LINE_ADJUST
:
435 sal_Int32 eVal
= - 1;
438 eVal
= ::comphelper::getEnumAsINT32(rVal
);
441 if(eVal
>= 0 && eVal
<= 4)
443 if(MID_LAST_LINE_ADJUST
== nMemberId
&&
444 eVal
!= SVX_ADJUST_LEFT
&&
445 eVal
!= SVX_ADJUST_BLOCK
&&
446 eVal
!= SVX_ADJUST_CENTER
)
448 if(eVal
< (sal_uInt16
)SVX_ADJUST_END
)
449 nMemberId
== MID_PARA_ADJUST
?
450 SetAdjust((SvxAdjust
)eVal
) :
451 SetLastBlock((SvxAdjust
)eVal
);
455 case MID_EXPAND_SINGLE
:
456 bOneBlock
= Any2Bool(rVal
);
462 // -----------------------------------------------------------------------
464 SfxPoolItem
* SvxAdjustItem::Clone( SfxItemPool
* ) const
466 return new SvxAdjustItem( *this );
469 //------------------------------------------------------------------------
471 SfxItemPresentation
SvxAdjustItem::GetPresentation
473 SfxItemPresentation ePres
,
474 SfxMapUnit
/*eCoreUnit*/,
475 SfxMapUnit
/*ePresUnit*/,
476 XubString
& rText
, const IntlWrapper
*
481 case SFX_ITEM_PRESENTATION_NONE
:
483 return SFX_ITEM_PRESENTATION_NONE
;
484 case SFX_ITEM_PRESENTATION_NAMELESS
:
485 case SFX_ITEM_PRESENTATION_COMPLETE
:
486 rText
= GetValueTextByPos( (sal_uInt16
)GetAdjust() );
488 default: ;//prevent warning
490 return SFX_ITEM_PRESENTATION_NONE
;
493 // -----------------------------------------------------------------------
495 sal_uInt16
SvxAdjustItem::GetValueCount() const
497 return SVX_ADJUST_END
; // SVX_ADJUST_BLOCKLINE + 1
500 // -----------------------------------------------------------------------
502 XubString
SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos
) const
504 DBG_ASSERT( nPos
<= (sal_uInt16
)SVX_ADJUST_BLOCKLINE
, "enum overflow!" );
505 return SVX_RESSTR(RID_SVXITEMS_ADJUST_BEGIN
+ nPos
);
508 // -----------------------------------------------------------------------
510 sal_uInt16
SvxAdjustItem::GetEnumValue() const
512 return (sal_uInt16
)GetAdjust();
515 // -----------------------------------------------------------------------
517 void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal
)
519 SetAdjust( (const SvxAdjust
)nVal
);
522 // -----------------------------------------------------------------------
524 sal_uInt16
SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion
) const
526 return (nFileVersion
== SOFFICE_FILEFORMAT_31
)
527 ? 0 : ADJUST_LASTBLOCK_VERSION
;
530 // -----------------------------------------------------------------------
532 SfxPoolItem
* SvxAdjustItem::Create(SvStream
& rStrm
, sal_uInt16 nVersion
) const
535 rStrm
>> eAdjustment
;
536 SvxAdjustItem
*pRet
= new SvxAdjustItem( (SvxAdjust
)eAdjustment
, Which() );
537 if( nVersion
>= ADJUST_LASTBLOCK_VERSION
)
541 pRet
->bOneBlock
= 0 != (nFlags
& 0x0001);
542 pRet
->bLastCenter
= 0 != (nFlags
& 0x0002);
543 pRet
->bLastBlock
= 0 != (nFlags
& 0x0004);
548 // -----------------------------------------------------------------------
550 SvStream
& SvxAdjustItem::Store( SvStream
& rStrm
, sal_uInt16 nItemVersion
) const
552 rStrm
<< (char)GetAdjust();
553 if ( nItemVersion
>= ADJUST_LASTBLOCK_VERSION
)
562 rStrm
<< (sal_Int8
) nFlags
;
567 // class SvxWidowsItem ---------------------------------------------------
569 SvxWidowsItem::SvxWidowsItem(const BYTE nL
, const USHORT nId
) :
570 SfxByteItem( nId
, nL
)
574 // -----------------------------------------------------------------------
576 SfxPoolItem
* SvxWidowsItem::Clone( SfxItemPool
* ) const
578 return new SvxWidowsItem( *this );
581 // -----------------------------------------------------------------------
583 SfxPoolItem
* SvxWidowsItem::Create(SvStream
& rStrm
, sal_uInt16
) const
587 return new SvxWidowsItem( nLines
, Which() );
590 // -----------------------------------------------------------------------
592 SvStream
& SvxWidowsItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
594 rStrm
<< (sal_Int8
)GetValue();
598 //------------------------------------------------------------------------
600 SfxItemPresentation
SvxWidowsItem::GetPresentation
602 SfxItemPresentation ePres
,
603 SfxMapUnit
/*eCoreUnit*/,
604 SfxMapUnit
/*ePresUnit*/,
605 XubString
& rText
, const IntlWrapper
*
610 case SFX_ITEM_PRESENTATION_NONE
:
616 case SFX_ITEM_PRESENTATION_NAMELESS
:
618 rText
= SVX_RESSTR(RID_SVXITEMS_LINES
);
622 case SFX_ITEM_PRESENTATION_COMPLETE
:
624 rText
= SVX_RESSTR(RID_SVXITEMS_WIDOWS_COMPLETE
);
626 rText
+= SVX_RESSTR(RID_SVXITEMS_LINES
);
631 DBG_ERRORFILE( "SvxWidowsItem::GetPresentation(): unknown SfxItemPresentation" );
635 rText
.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
639 // class SvxOrphansItem --------------------------------------------------
641 SvxOrphansItem::SvxOrphansItem(const BYTE nL
, const USHORT nId
) :
642 SfxByteItem( nId
, nL
)
646 // -----------------------------------------------------------------------
648 SfxPoolItem
* SvxOrphansItem::Clone( SfxItemPool
* ) const
650 return new SvxOrphansItem( *this );
653 // -----------------------------------------------------------------------
655 SfxPoolItem
* SvxOrphansItem::Create(SvStream
& rStrm
, sal_uInt16
) const
659 return new SvxOrphansItem( nLines
, Which() );
662 // -----------------------------------------------------------------------
664 SvStream
& SvxOrphansItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
666 rStrm
<< (sal_Int8
) GetValue();
670 //------------------------------------------------------------------------
672 SfxItemPresentation
SvxOrphansItem::GetPresentation
674 SfxItemPresentation ePres
,
675 SfxMapUnit
/*eCoreUnit*/,
676 SfxMapUnit
/*ePresUnit*/,
677 XubString
& rText
, const IntlWrapper
*
682 case SFX_ITEM_PRESENTATION_NONE
:
688 case SFX_ITEM_PRESENTATION_NAMELESS
:
690 rText
= SVX_RESSTR(RID_SVXITEMS_LINES
);
694 case SFX_ITEM_PRESENTATION_COMPLETE
:
696 rText
= SVX_RESSTR(RID_SVXITEMS_ORPHANS_COMPLETE
);
698 rText
+= SVX_RESSTR(RID_SVXITEMS_LINES
);
703 DBG_ERRORFILE( "SvxOrphansItem::GetPresentation(): unknown SfxItemPresentation" );
707 rText
.SearchAndReplace( String::CreateFromAscii( "%1" ), String::CreateFromInt32( GetValue() ) );
711 // class SvxHyphenZoneItem -----------------------------------------------
713 SvxHyphenZoneItem::SvxHyphenZoneItem( const sal_Bool bHyph
, const sal_uInt16 nId
) :
718 nMinLead
= nMinTrail
= 0;
722 // -----------------------------------------------------------------------
723 sal_Bool
SvxHyphenZoneItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
725 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
726 nMemberId
&= ~CONVERT_TWIPS
;
730 rVal
= Bool2Any(bHyphen
);
732 case MID_HYPHEN_MIN_LEAD
:
733 rVal
<<= (sal_Int16
)nMinLead
;
735 case MID_HYPHEN_MIN_TRAIL
:
736 rVal
<<= (sal_Int16
)nMinTrail
;
738 case MID_HYPHEN_MAX_HYPHENS
:
739 rVal
<<= (sal_Int16
)nMaxHyphens
;
744 // -----------------------------------------------------------------------
745 sal_Bool
SvxHyphenZoneItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
747 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
748 nMemberId
&= ~CONVERT_TWIPS
;
749 sal_Int16 nNewVal
= 0;
751 if( nMemberId
!= MID_IS_HYPHEN
)
752 if(!(rVal
>>= nNewVal
))
758 bHyphen
= Any2Bool(rVal
);
760 case MID_HYPHEN_MIN_LEAD
:
761 nMinLead
= (BYTE
)nNewVal
;
763 case MID_HYPHEN_MIN_TRAIL
:
764 nMinTrail
= (BYTE
)nNewVal
;
766 case MID_HYPHEN_MAX_HYPHENS
:
767 nMaxHyphens
= (BYTE
)nNewVal
;
773 // -----------------------------------------------------------------------
775 int SvxHyphenZoneItem::operator==( const SfxPoolItem
& rAttr
) const
777 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
779 return ( (((SvxHyphenZoneItem
&)rAttr
).bHyphen
== bHyphen
)
780 && (((SvxHyphenZoneItem
&)rAttr
).bPageEnd
== bPageEnd
)
781 && (((SvxHyphenZoneItem
&)rAttr
).nMinLead
== nMinLead
)
782 && (((SvxHyphenZoneItem
&)rAttr
).nMinTrail
== nMinTrail
)
783 && (((SvxHyphenZoneItem
&)rAttr
).nMaxHyphens
== nMaxHyphens
) );
786 // -----------------------------------------------------------------------
788 SfxPoolItem
* SvxHyphenZoneItem::Clone( SfxItemPool
* ) const
790 return new SvxHyphenZoneItem( *this );
793 //------------------------------------------------------------------------
795 SfxItemPresentation
SvxHyphenZoneItem::GetPresentation
797 SfxItemPresentation ePres
,
798 SfxMapUnit
/*eCoreUnit*/,
799 SfxMapUnit
/*ePresUnit*/,
800 XubString
& rText
, const IntlWrapper
*
805 case SFX_ITEM_PRESENTATION_NONE
:
807 return SFX_ITEM_PRESENTATION_NONE
;
808 case SFX_ITEM_PRESENTATION_NAMELESS
:
810 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
813 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
814 rText
= SVX_RESSTR(nId
);
816 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
819 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
820 rText
+= SVX_RESSTR(nId
);
822 rText
+= String::CreateFromInt32( nMinLead
);
824 rText
+= String::CreateFromInt32( nMinTrail
);
826 rText
+= String::CreateFromInt32( nMaxHyphens
);
827 return SFX_ITEM_PRESENTATION_COMPLETE
;
829 case SFX_ITEM_PRESENTATION_COMPLETE
:
831 sal_uInt16 nId
= RID_SVXITEMS_HYPHEN_FALSE
;
834 nId
= RID_SVXITEMS_HYPHEN_TRUE
;
835 rText
= SVX_RESSTR(nId
);
837 nId
= RID_SVXITEMS_PAGE_END_FALSE
;
840 nId
= RID_SVXITEMS_PAGE_END_TRUE
;
841 rText
+= SVX_RESSTR(nId
);
843 rText
+= String::CreateFromInt32(nMinLead
);
844 rText
+= SVX_RESSTR(RID_SVXITEMS_HYPHEN_MINLEAD
);
846 rText
+= String::CreateFromInt32(nMinTrail
);
847 rText
+= SVX_RESSTR(RID_SVXITEMS_HYPHEN_MINTRAIL
);
849 rText
+= String::CreateFromInt32(nMaxHyphens
);
850 rText
+= SVX_RESSTR(RID_SVXITEMS_HYPHEN_MAX
);
851 return SFX_ITEM_PRESENTATION_COMPLETE
;
853 default: ;//prevent warning
855 return SFX_ITEM_PRESENTATION_NONE
;
858 // -----------------------------------------------------------------------
860 SfxPoolItem
* SvxHyphenZoneItem::Create(SvStream
& rStrm
, sal_uInt16
) const
862 sal_Int8 _bHyphen
, _bHyphenPageEnd
;
863 sal_Int8 _nMinLead
, _nMinTrail
, _nMaxHyphens
;
864 rStrm
>> _bHyphen
>> _bHyphenPageEnd
>> _nMinLead
>> _nMinTrail
>> _nMaxHyphens
;
865 SvxHyphenZoneItem
* pAttr
= new SvxHyphenZoneItem( sal_False
, Which() );
866 pAttr
->SetHyphen( sal_Bool( _bHyphen
!= 0 ) );
867 pAttr
->SetPageEnd( sal_Bool( _bHyphenPageEnd
!= 0 ) );
868 pAttr
->GetMinLead() = _nMinLead
;
869 pAttr
->GetMinTrail() = _nMinTrail
;
870 pAttr
->GetMaxHyphens() = _nMaxHyphens
;
874 // -----------------------------------------------------------------------
876 SvStream
& SvxHyphenZoneItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
878 rStrm
<< (sal_Int8
) IsHyphen()
879 << (sal_Int8
) IsPageEnd()
880 << (sal_Int8
) GetMinLead()
881 << (sal_Int8
) GetMinTrail()
882 << (sal_Int8
) GetMaxHyphens();
886 // class SvxTabStop ------------------------------------------------------
888 SvxTabStop::SvxTabStop()
891 eAdjustment
= SVX_TAB_ADJUST_LEFT
;
892 m_cDecimal
= cDfltDecimalChar
;
893 cFill
= cDfltFillChar
;
896 // -----------------------------------------------------------------------
898 SvxTabStop::SvxTabStop( const long nPos
, const SvxTabAdjust eAdjst
,
899 const sal_Unicode cDec
, const sal_Unicode cFil
)
902 eAdjustment
= eAdjst
;
906 // -----------------------------------------------------------------------------
907 void SvxTabStop::fillDecimal() const
909 if ( cDfltDecimalChar
== m_cDecimal
)
910 m_cDecimal
= SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
912 // -----------------------------------------------------------------------
914 XubString
SvxTabStop::GetValueString() const
918 aStr
+= sal_Unicode( '(' );
919 aStr
+= UniString::CreateFromInt32(nTabPos
);
921 aStr
+= XubString( ResId( RID_SVXITEMS_TAB_ADJUST_BEGIN
+ (sal_uInt16
)eAdjustment
, DIALOG_MGR() ) );
924 aStr
+= sal_Unicode('[');
925 aStr
+= XubString( ResId( RID_SVXITEMS_TAB_DECIMAL_CHAR
, DIALOG_MGR() ) );
926 aStr
+= GetDecimal();
927 aStr
+= sal_Unicode(']');
930 aStr
+= sal_Unicode('[');
931 aStr
+= XubString( ResId( RID_SVXITEMS_TAB_FILL_CHAR
, DIALOG_MGR() ) );
933 aStr
+= sal_Unicode(']');
934 aStr
+= sal_Unicode(')');
939 // class SvxTabStopItem --------------------------------------------------
941 SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich
) :
942 SfxPoolItem( _nWhich
),
943 SvxTabStopArr( sal_Int8(SVX_TAB_DEFCOUNT
) )
945 const sal_uInt16 nTabs
= SVX_TAB_DEFCOUNT
, nDist
= SVX_TAB_DEFDIST
;
946 const SvxTabAdjust eAdjst
= SVX_TAB_ADJUST_DEFAULT
;
948 for (sal_uInt16 i
= 0; i
< nTabs
; ++i
)
950 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
951 SvxTabStopArr::Insert( aTab
);
955 // -----------------------------------------------------------------------
957 SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs
,
958 const sal_uInt16 nDist
,
959 const SvxTabAdjust eAdjst
,
960 sal_uInt16 _nWhich
) :
961 SfxPoolItem( _nWhich
),
962 SvxTabStopArr( sal_Int8(nTabs
) )
964 for ( sal_uInt16 i
= 0; i
< nTabs
; ++i
)
966 SvxTabStop
aTab( (i
+ 1) * nDist
, eAdjst
);
967 SvxTabStopArr::Insert( aTab
);
971 // -----------------------------------------------------------------------
973 SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem
& rTSI
) :
974 SfxPoolItem( rTSI
.Which() ),
975 SvxTabStopArr( (sal_Int8
)rTSI
.Count() )
977 SvxTabStopArr::Insert( &rTSI
);
980 // -----------------------------------------------------------------------
982 sal_uInt16
SvxTabStopItem::GetPos( const SvxTabStop
& rTab
) const
985 return Seek_Entry( rTab
, &nFound
) ? nFound
: SVX_TAB_NOTFOUND
;
988 // -----------------------------------------------------------------------
990 sal_uInt16
SvxTabStopItem::GetPos( const long nPos
) const
993 return Seek_Entry( SvxTabStop( nPos
), &nFound
) ? nFound
: SVX_TAB_NOTFOUND
;
996 // -----------------------------------------------------------------------
998 SvxTabStopItem
& SvxTabStopItem::operator=( const SvxTabStopItem
& rTSI
)
1000 Remove( 0, Count() );
1001 SvxTabStopArr::Insert( &rTSI
);
1007 enum ::com::sun::star::style::TabAlign
1015 struct ::com::sun::star::style::TabStop
1018 ::com::sun::star::style::TabAlign ::com::sun::star::drawing::Alignment;
1019 unsigned short DecimalChar;
1020 unsigned short FillChar;
1022 typedef sequence ::com::sun::star::style::TabStop> TabSTopSequence;
1025 /*-----------------19.03.98 08:50-------------------
1027 --------------------------------------------------*/
1029 sal_Bool
SvxTabStopItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1031 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
1032 nMemberId
&= ~CONVERT_TWIPS
;
1033 switch ( nMemberId
)
1037 sal_uInt16 nCount
= Count();
1038 uno::Sequence
< style::TabStop
> aSeq(nCount
);
1039 style::TabStop
* pArr
= aSeq
.getArray();
1040 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
1042 const SvxTabStop
& rTab
= *(GetStart() + i
);
1043 pArr
[i
].Position
= bConvert
? TWIP_TO_MM100(rTab
.GetTabPos()) : rTab
.GetTabPos();
1044 switch(rTab
.GetAdjustment())
1046 case SVX_TAB_ADJUST_LEFT
: pArr
[i
].Alignment
= style::TabAlign_LEFT
; break;
1047 case SVX_TAB_ADJUST_RIGHT
: pArr
[i
].Alignment
= style::TabAlign_RIGHT
; break;
1048 case SVX_TAB_ADJUST_DECIMAL
: pArr
[i
].Alignment
= style::TabAlign_DECIMAL
; break;
1049 case SVX_TAB_ADJUST_CENTER
: pArr
[i
].Alignment
= style::TabAlign_CENTER
; break;
1050 default: //SVX_TAB_ADJUST_DEFAULT
1051 pArr
[i
].Alignment
= style::TabAlign_DEFAULT
;
1054 pArr
[i
].DecimalChar
= rTab
.GetDecimal();
1055 pArr
[i
].FillChar
= rTab
.GetFill();
1062 const SvxTabStop
&rTab
= *(GetStart());
1063 rVal
<<= static_cast<sal_Int32
>(bConvert
? TWIP_TO_MM100(rTab
.GetTabPos()) : rTab
.GetTabPos());
1069 /*-----------------19.03.98 08:50-------------------
1071 --------------------------------------------------*/
1073 sal_Bool
SvxTabStopItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1075 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
1076 nMemberId
&= ~CONVERT_TWIPS
;
1077 switch ( nMemberId
)
1081 uno::Sequence
< style::TabStop
> aSeq
;
1082 if(!(rVal
>>= aSeq
))
1084 uno::Sequence
< uno::Sequence
< uno::Any
> > aAnySeq
;
1085 if (!(rVal
>>= aAnySeq
))
1087 sal_Int32 nLength
= aAnySeq
.getLength();
1088 aSeq
.realloc( nLength
);
1089 for ( sal_Int32 n
=0; n
<nLength
; n
++ )
1091 uno::Sequence
< uno::Any
>& rAnySeq
= aAnySeq
[n
];
1092 if ( rAnySeq
.getLength() == 4 )
1094 if (!(rAnySeq
[0] >>= aSeq
[n
].Position
)) return sal_False
;
1095 if (!(rAnySeq
[1] >>= aSeq
[n
].Alignment
))
1098 if (rAnySeq
[1] >>= nVal
)
1099 aSeq
[n
].Alignment
= (com::sun::star::style::TabAlign
) nVal
;
1103 if (!(rAnySeq
[2] >>= aSeq
[n
].DecimalChar
))
1105 ::rtl::OUString aVal
;
1106 if ( (rAnySeq
[2] >>= aVal
) && aVal
.getLength() == 1 )
1107 aSeq
[n
].DecimalChar
= aVal
.toChar();
1111 if (!(rAnySeq
[3] >>= aSeq
[n
].FillChar
))
1113 ::rtl::OUString aVal
;
1114 if ( (rAnySeq
[3] >>= aVal
) && aVal
.getLength() == 1 )
1115 aSeq
[n
].FillChar
= aVal
.toChar();
1125 SvxTabStopArr::Remove( 0, Count() );
1126 const style::TabStop
* pArr
= aSeq
.getConstArray();
1127 const sal_uInt16 nCount
= (sal_uInt16
)aSeq
.getLength();
1128 for(sal_uInt16 i
= 0; i
< nCount
; i
++)
1130 SvxTabAdjust eAdjust
= SVX_TAB_ADJUST_DEFAULT
;
1131 switch(pArr
[i
].Alignment
)
1133 case style::TabAlign_LEFT
: eAdjust
= SVX_TAB_ADJUST_LEFT
; break;
1134 case style::TabAlign_CENTER
: eAdjust
= SVX_TAB_ADJUST_CENTER
; break;
1135 case style::TabAlign_RIGHT
: eAdjust
= SVX_TAB_ADJUST_RIGHT
; break;
1136 case style::TabAlign_DECIMAL
: eAdjust
= SVX_TAB_ADJUST_DECIMAL
; break;
1137 default: ;//prevent warning
1139 sal_Unicode cFill
= pArr
[i
].FillChar
;
1140 sal_Unicode cDecimal
= pArr
[i
].DecimalChar
;
1141 SvxTabStop
aTab( bConvert
? MM100_TO_TWIP(pArr
[i
].Position
) : pArr
[i
].Position
,
1151 sal_Int32 nNewPos
= 0;
1152 if (!(rVal
>>= nNewPos
) )
1154 const SvxTabStop
& rTab
= *(GetStart());
1155 SvxTabStop
aNewTab ( bConvert
? MM100_TO_TWIP ( nNewPos
) : nNewPos
,
1156 rTab
.GetAdjustment(), rTab
.GetDecimal(), rTab
.GetFill() );
1164 // -----------------------------------------------------------------------
1166 int SvxTabStopItem::operator==( const SfxPoolItem
& rAttr
) const
1168 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
1170 const SvxTabStopItem
& rTSI
= (SvxTabStopItem
&)rAttr
;
1172 if ( Count() != rTSI
.Count() )
1175 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1176 if( !(*this)[i
].IsEqual( rTSI
[i
] ) )
1181 // -----------------------------------------------------------------------
1183 SfxPoolItem
* SvxTabStopItem::Clone( SfxItemPool
* ) const
1185 return new SvxTabStopItem( *this );
1188 //------------------------------------------------------------------------
1190 SfxItemPresentation
SvxTabStopItem::GetPresentation
1192 SfxItemPresentation ePres
,
1193 SfxMapUnit eCoreUnit
,
1194 SfxMapUnit ePresUnit
,
1195 XubString
& rText
, const IntlWrapper
*pIntl
1200 if ( ePres
> SFX_ITEM_PRESENTATION_NONE
)
1203 sal_Bool bComma
= sal_False
;
1205 for ( sal_uInt16 i
= 0; i
< Count(); ++i
)
1207 if ( SVX_TAB_ADJUST_DEFAULT
!= ((*this)[i
]).GetAdjustment() )
1210 rText
+= sal_Unicode(',');
1211 rText
+= GetMetricText(
1212 (long)((*this)[i
]).GetTabPos(), eCoreUnit
, ePresUnit
, pIntl
);
1213 if ( SFX_ITEM_PRESENTATION_COMPLETE
== ePres
)
1214 rText
+= SVX_RESSTR(GetMetricId(ePresUnit
));
1223 // -----------------------------------------------------------------------
1225 SfxPoolItem
* SvxTabStopItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1229 SvxTabStopItem
* pAttr
=
1230 new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_DEFAULT
, Which() );
1232 for ( sal_Int8 i
= 0; i
< nTabs
; i
++ )
1236 unsigned char cDecimal
, cFill
;
1237 rStrm
>> nPos
>> eAdjust
>> cDecimal
>> cFill
;
1238 if( !i
|| SVX_TAB_ADJUST_DEFAULT
!= eAdjust
)
1239 pAttr
->Insert( SvxTabStop
1240 ( nPos
, (SvxTabAdjust
)eAdjust
, sal_Unicode(cDecimal
), sal_Unicode(cFill
) ) );
1245 // -----------------------------------------------------------------------
1247 SvStream
& SvxTabStopItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1249 //MA 05. Sep. 96: Default-Tabs werden nur noch fuer das default-Attr
1250 //expandiert. Fuer vollstaendige Rueckwaertskompatibilitaet (<=304)
1251 //muessten alle Tabs expandiert werden, dass blaeht aber das File u.U.
1255 const SfxItemPool
*pPool
= SfxItemPool::GetStoringPool();
1256 const FASTBOOL bStoreDefTabs
= pPool
1257 && pPool
->GetName().EqualsAscii("SWG")
1258 && ::IsDefaultItem( this );
1260 const short nTabs
= Count();
1261 sal_uInt16 nCount
= 0, nDefDist
= 0;
1266 const SvxTabStopItem
& rDefTab
= (const SvxTabStopItem
&)
1267 pPool
->GetDefaultItem( pPool
->GetWhich( SID_ATTR_TABSTOP
, sal_False
) );
1268 nDefDist
= sal_uInt16( rDefTab
.GetStart()->GetTabPos() );
1269 const long nPos
= nTabs
> 0 ? (*this)[nTabs
-1].GetTabPos() : 0;
1270 nCount
= (sal_uInt16
)(nPos
/ nDefDist
);
1271 nNew
= (nCount
+ 1) * nDefDist
;
1273 if( nNew
<= nPos
+ 50 )
1276 long lA3Width
= SvxPaperInfo::GetPaperSize(PAPER_A3
).Width();
1277 nCount
= (sal_uInt16
)(nNew
< lA3Width
? ( lA3Width
- nNew
) / nDefDist
+ 1 : 0);
1280 rStrm
<< (sal_Int8
) ( nTabs
+ nCount
);
1281 for ( short i
= 0; i
< nTabs
; i
++ )
1283 const SvxTabStop
& rTab
= (*this)[ i
];
1284 rStrm
<< (long) rTab
.GetTabPos()
1285 << (sal_Int8
) rTab
.GetAdjustment()
1286 << (unsigned char) rTab
.GetDecimal()
1287 << (unsigned char) rTab
.GetFill();
1290 if ( bStoreDefTabs
)
1291 for( ; nCount
; --nCount
)
1293 SvxTabStop
aSwTabStop(nNew
, SVX_TAB_ADJUST_DEFAULT
);
1294 rStrm
<< (long) aSwTabStop
.GetTabPos()
1295 << (sal_Int8
) aSwTabStop
.GetAdjustment()
1296 << (unsigned char) aSwTabStop
.GetDecimal()
1297 << (unsigned char) aSwTabStop
.GetFill();
1304 // -----------------------------------------------------------------------
1305 sal_Bool
SvxTabStopItem::Insert( const SvxTabStop
& rTab
)
1307 sal_uInt16 nTabPos
= GetPos(rTab
);
1308 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1310 return SvxTabStopArr::Insert( rTab
);
1312 // -----------------------------------------------------------------------
1313 void SvxTabStopItem::Insert( const SvxTabStopItem
* pTabs
, sal_uInt16 nStart
,
1316 for( sal_uInt16 i
= nStart
; i
< nEnd
&& i
< pTabs
->Count(); i
++ )
1318 const SvxTabStop
& rTab
= (*pTabs
)[i
];
1319 sal_uInt16 nTabPos
= GetPos(rTab
);
1320 if(SVX_TAB_NOTFOUND
!= nTabPos
)
1323 SvxTabStopArr::Insert( pTabs
, nStart
, nEnd
);
1328 // class SvxFmtSplitItem -------------------------------------------------
1329 SvxFmtSplitItem::~SvxFmtSplitItem()
1332 // -----------------------------------------------------------------------
1333 SfxPoolItem
* SvxFmtSplitItem::Clone( SfxItemPool
* ) const
1335 return new SvxFmtSplitItem( *this );
1338 // -----------------------------------------------------------------------
1340 SvStream
& SvxFmtSplitItem::Store( SvStream
& rStrm
, sal_uInt16
/*nItemVersion*/ ) const
1342 rStrm
<< (sal_Int8
)GetValue();
1346 // -----------------------------------------------------------------------
1348 SfxPoolItem
* SvxFmtSplitItem::Create( SvStream
& rStrm
, sal_uInt16
) const
1352 return new SvxFmtSplitItem( sal_Bool( bIsSplit
!= 0 ), Which() );
1355 //------------------------------------------------------------------------
1357 SfxItemPresentation
SvxFmtSplitItem::GetPresentation
1359 SfxItemPresentation ePres
,
1360 SfxMapUnit
/*eCoreUnit*/,
1361 SfxMapUnit
/*ePresUnit*/,
1362 XubString
& rText
, const IntlWrapper
*
1367 case SFX_ITEM_PRESENTATION_NONE
:
1369 return SFX_ITEM_PRESENTATION_NONE
;
1370 case SFX_ITEM_PRESENTATION_NAMELESS
:
1371 case SFX_ITEM_PRESENTATION_COMPLETE
:
1373 sal_uInt16 nId
= RID_SVXITEMS_FMTSPLIT_FALSE
;
1376 nId
= RID_SVXITEMS_FMTSPLIT_TRUE
;
1377 rText
= SVX_RESSTR(nId
);
1380 default: ;//prevent warning
1382 return SFX_ITEM_PRESENTATION_NONE
;
1385 // --------------------------------------------------------------------
1387 SfxPoolItem
* SvxPageModelItem::Clone( SfxItemPool
* ) const
1389 return new SvxPageModelItem( *this );
1392 //------------------------------------------------------------------------
1394 sal_Bool
SvxPageModelItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE nMemberId
) const
1396 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1397 nMemberId
&= ~CONVERT_TWIPS
;
1399 switch ( nMemberId
)
1401 case MID_AUTO
: rVal
<<= (sal_Bool
) bAuto
; break;
1402 case MID_NAME
: rVal
<<= ::rtl::OUString( GetValue() ); break;
1403 default: DBG_ERROR("Wrong MemberId!"); return sal_False
;
1409 sal_Bool
SvxPageModelItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE nMemberId
)
1411 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1412 nMemberId
&= ~CONVERT_TWIPS
;
1414 ::rtl::OUString aStr
;
1415 switch ( nMemberId
)
1417 case MID_AUTO
: bRet
= ( rVal
>>= bAuto
); break;
1418 case MID_NAME
: bRet
= ( rVal
>>= aStr
); if ( bRet
) SetValue(aStr
); break;
1419 default: DBG_ERROR("Wrong MemberId!"); return sal_False
;
1425 SfxItemPresentation
SvxPageModelItem::GetPresentation
1427 SfxItemPresentation ePres
,
1428 SfxMapUnit
/*eCoreUnit*/,
1429 SfxMapUnit
/*ePresUnit*/,
1430 XubString
& rText
, const IntlWrapper
*
1434 FASTBOOL bSet
= ( GetValue().Len() > 0 );
1438 case SFX_ITEM_PRESENTATION_NONE
:
1439 return SFX_ITEM_PRESENTATION_NONE
;
1441 case SFX_ITEM_PRESENTATION_NAMELESS
:
1444 return SFX_ITEM_PRESENTATION_NAMELESS
;
1446 case SFX_ITEM_PRESENTATION_COMPLETE
:
1449 rText
= SVX_RESSTR(RID_SVXITEMS_PAGEMODEL_COMPLETE
);
1450 rText
+= GetValue();
1452 return SFX_ITEM_PRESENTATION_COMPLETE
;
1453 default: ;//prevent warning
1455 return SFX_ITEM_PRESENTATION_NONE
;
1458 //------------------------------------------------------------------------
1460 SvxScriptSpaceItem::SvxScriptSpaceItem( sal_Bool bOn
, const sal_uInt16 nId
)
1461 : SfxBoolItem( nId
, bOn
)
1465 SfxPoolItem
* SvxScriptSpaceItem::Clone( SfxItemPool
* ) const
1467 return new SvxScriptSpaceItem( GetValue(), Which() );
1470 SfxPoolItem
* SvxScriptSpaceItem::Create(SvStream
& rStrm
, USHORT
) const
1474 return new SvxScriptSpaceItem( bFlag
, Which() );
1477 USHORT
SvxScriptSpaceItem::GetVersion( USHORT nFFVer
) const
1479 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1480 SOFFICE_FILEFORMAT_40
==nFFVer
||
1481 SOFFICE_FILEFORMAT_50
==nFFVer
,
1482 "SvxTwoLinesItem: Gibt es ein neues Fileformat?" );
1484 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1487 SfxItemPresentation
SvxScriptSpaceItem::GetPresentation(
1488 SfxItemPresentation ePres
,
1489 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1490 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1494 case SFX_ITEM_PRESENTATION_NONE
:
1497 case SFX_ITEM_PRESENTATION_NAMELESS
:
1498 case SFX_ITEM_PRESENTATION_COMPLETE
:
1500 rText
= SVX_RESSTR( !GetValue()
1501 ? RID_SVXITEMS_SCRPTSPC_OFF
1502 : RID_SVXITEMS_SCRPTSPC_ON
);
1505 default: ;//prevent warning
1507 return SFX_ITEM_PRESENTATION_NONE
;
1510 //------------------------------------------------------------------------
1512 SvxHangingPunctuationItem::SvxHangingPunctuationItem(
1513 sal_Bool bOn
, const sal_uInt16 nId
)
1514 : SfxBoolItem( nId
, bOn
)
1518 SfxPoolItem
* SvxHangingPunctuationItem::Clone( SfxItemPool
* ) const
1520 return new SvxHangingPunctuationItem( GetValue(), Which() );
1523 SfxPoolItem
* SvxHangingPunctuationItem::Create(SvStream
& rStrm
, USHORT
) const
1527 return new SvxHangingPunctuationItem( nValue
, Which() );
1530 USHORT
SvxHangingPunctuationItem::GetVersion( USHORT nFFVer
) const
1532 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1533 SOFFICE_FILEFORMAT_40
==nFFVer
||
1534 SOFFICE_FILEFORMAT_50
==nFFVer
,
1535 "SvxHangingPunctuationItem: Gibt es ein neues Fileformat?" );
1537 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1540 SfxItemPresentation
SvxHangingPunctuationItem::GetPresentation(
1541 SfxItemPresentation ePres
,
1542 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1543 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1547 case SFX_ITEM_PRESENTATION_NONE
:
1550 case SFX_ITEM_PRESENTATION_NAMELESS
:
1551 case SFX_ITEM_PRESENTATION_COMPLETE
:
1553 rText
= SVX_RESSTR( !GetValue()
1554 ? RID_SVXITEMS_HNGPNCT_OFF
1555 : RID_SVXITEMS_HNGPNCT_ON
);
1558 default: ;//prevent warning
1561 return SFX_ITEM_PRESENTATION_NONE
;
1563 //------------------------------------------------------------------------
1565 SvxForbiddenRuleItem::SvxForbiddenRuleItem(
1566 sal_Bool bOn
, const sal_uInt16 nId
)
1567 : SfxBoolItem( nId
, bOn
)
1570 /* -----------------------------29.11.00 11:23--------------------------------
1572 ---------------------------------------------------------------------------*/
1573 SfxPoolItem
* SvxForbiddenRuleItem::Clone( SfxItemPool
* ) const
1575 return new SvxForbiddenRuleItem( GetValue(), Which() );
1577 /* -----------------------------29.11.00 11:23--------------------------------
1579 ---------------------------------------------------------------------------*/
1580 SfxPoolItem
* SvxForbiddenRuleItem::Create(SvStream
& rStrm
, USHORT
) const
1584 return new SvxForbiddenRuleItem( nValue
, Which() );
1586 /* -----------------------------29.11.00 11:23--------------------------------
1588 ---------------------------------------------------------------------------*/
1589 USHORT
SvxForbiddenRuleItem::GetVersion( USHORT nFFVer
) const
1591 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1592 SOFFICE_FILEFORMAT_40
==nFFVer
||
1593 SOFFICE_FILEFORMAT_50
==nFFVer
,
1594 "SvxForbiddenRuleItem: Gibt es ein neues Fileformat?" );
1596 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1598 /* -----------------------------29.11.00 11:23--------------------------------
1600 ---------------------------------------------------------------------------*/
1601 SfxItemPresentation
SvxForbiddenRuleItem::GetPresentation(
1602 SfxItemPresentation ePres
,
1603 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1604 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1608 case SFX_ITEM_PRESENTATION_NONE
:
1611 case SFX_ITEM_PRESENTATION_NAMELESS
:
1612 case SFX_ITEM_PRESENTATION_COMPLETE
:
1614 rText
= SVX_RESSTR( !GetValue()
1615 ? RID_SVXITEMS_FORBIDDEN_RULE_OFF
1616 : RID_SVXITEMS_FORBIDDEN_RULE_ON
);
1619 default: ;//prevent warning
1622 return SFX_ITEM_PRESENTATION_NONE
;
1625 /*************************************************************************
1626 |* class SvxParaVertAlignItem
1627 *************************************************************************/
1629 SvxParaVertAlignItem::SvxParaVertAlignItem( sal_uInt16 nValue
,
1630 const sal_uInt16 nW
)
1631 : SfxUInt16Item( nW
, nValue
)
1635 SfxPoolItem
* SvxParaVertAlignItem::Clone( SfxItemPool
* ) const
1637 return new SvxParaVertAlignItem( GetValue(), Which() );
1640 SfxPoolItem
* SvxParaVertAlignItem::Create( SvStream
& rStrm
, USHORT
) const
1644 return new SvxParaVertAlignItem( nVal
, Which() );
1647 SvStream
& SvxParaVertAlignItem::Store( SvStream
& rStrm
, USHORT
) const
1649 rStrm
<< GetValue();
1653 USHORT
SvxParaVertAlignItem::GetVersion( USHORT nFFVer
) const
1655 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1658 SfxItemPresentation
SvxParaVertAlignItem::GetPresentation(
1659 SfxItemPresentation ePres
,
1660 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1661 String
&rText
, const IntlWrapper
* ) const
1665 case SFX_ITEM_PRESENTATION_NONE
:
1668 case SFX_ITEM_PRESENTATION_NAMELESS
:
1669 case SFX_ITEM_PRESENTATION_COMPLETE
:
1672 switch( GetValue() )
1674 case AUTOMATIC
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_AUTO
; break;
1675 case TOP
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_TOP
; break;
1676 case CENTER
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_CENTER
; break;
1677 case BOTTOM
: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BOTTOM
; break;
1678 default: nTmp
= RID_SVXITEMS_PARAVERTALIGN_BASELINE
; break;
1680 rText
= SVX_RESSTR( nTmp
);
1683 default: ;//prevent warning
1686 return SFX_ITEM_PRESENTATION_NONE
;
1689 sal_Bool
SvxParaVertAlignItem::QueryValue( com::sun::star::uno::Any
& rVal
,
1690 BYTE
/*nMemberId*/ ) const
1692 rVal
<<= (sal_Int16
)GetValue();
1696 sal_Bool
SvxParaVertAlignItem::PutValue( const com::sun::star::uno::Any
& rVal
,
1697 BYTE
/*nMemberId*/ )
1699 sal_Int16 nVal
= sal_Int16();
1700 if((rVal
>>= nVal
) && nVal
>=0 && nVal
<= BOTTOM
)
1702 SetValue( (USHORT
)nVal
);
1709 int SvxParaVertAlignItem::operator==( const SfxPoolItem
& rItem
) const
1711 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
1712 return SfxUInt16Item::operator==( rItem
);
1716 SvxParaGridItem::SvxParaGridItem( sal_Bool bOn
, const sal_uInt16 nId
)
1717 : SfxBoolItem( nId
, bOn
)
1721 SfxPoolItem
* SvxParaGridItem::Clone( SfxItemPool
* ) const
1723 return new SvxParaGridItem( GetValue(), Which() );
1726 SfxPoolItem
* SvxParaGridItem::Create(SvStream
& rStrm
, USHORT
) const
1730 return new SvxParaGridItem( bFlag
, Which() );
1733 USHORT
SvxParaGridItem::GetVersion( USHORT nFFVer
) const
1735 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
1736 SOFFICE_FILEFORMAT_40
==nFFVer
||
1737 SOFFICE_FILEFORMAT_50
==nFFVer
,
1738 "SvxParaGridItem: Gibt es ein neues Fileformat?" );
1740 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
1743 SfxItemPresentation
SvxParaGridItem::GetPresentation(
1744 SfxItemPresentation ePres
,
1745 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
1746 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
1750 case SFX_ITEM_PRESENTATION_NONE
:
1753 case SFX_ITEM_PRESENTATION_NAMELESS
:
1754 case SFX_ITEM_PRESENTATION_COMPLETE
:
1756 rText
= GetValue() ?
1757 SVX_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_ON
) :
1758 SVX_RESSTR( RID_SVXITEMS_PARASNAPTOGRID_OFF
);
1762 default: ;//prevent warning
1765 return SFX_ITEM_PRESENTATION_NONE
;