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: paratr.hxx,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 ************************************************************************/
33 #ifndef _SFXENUMITEM_HXX //autogen
34 #include <bf_svtools/eitem.hxx>
36 #ifndef _SFXSTRITEM_HXX //autogen
37 #include <bf_svtools/stritem.hxx>
43 #include <swtypes.hxx>
51 /*************************************************************************
53 *************************************************************************/
55 #define DROP_WHOLEWORD ((USHORT)0x0001)
57 //Wenn ein SwFmtDrop Client ist, so ist dies das CharFmt welches den Font fuer
58 //die DropCaps beschreibt. Ist es kein Client, so wird von der Formatierung
59 //das CharFmt des Absatzes benutzt.
60 //Wird das CharFmt verandert, so wird diese Aenderung ueber das Modify des
61 //SwFmtDrop an die Absatze propagiert.
62 class SwFmtDrop
: public SfxPoolItem
, public SwClient
64 SwModify
* pDefinedIn
; // Modify-Object, in dem der DropCaps steht
65 // kann nur TxtFmtCollection/TxtNode sein
66 USHORT nDistance
; // Abstand zum Textbeginn
67 USHORT nReadFmt
; // fuer den Sw3-Reader: CharFormat-Id (Pool laden!)
68 BYTE nLines
; // Anzahl der Zeilen
69 BYTE nChars
; // Anzahl der Zeichen
70 BOOL bWholeWord
; // Erstes Wort als Initialen
72 TYPEINFO(); //Bereits in der Basisklasse SwClient
75 SwFmtDrop( const SwFmtDrop
& );
78 // "pure virtual Methoden" vom SfxPoolItem
79 virtual int operator==( const SfxPoolItem
& ) const;
80 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const;
81 virtual SfxPoolItem
* Create(SvStream
&, USHORT nVer
) const;
82 virtual SvStream
& Store(SvStream
&, USHORT nIVer
) const;
83 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 ) const;
84 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 );
85 virtual USHORT
GetVersion( USHORT nFFVer
) const;
87 inline BYTE
GetLines() const { return nLines
; }
88 inline BYTE
&GetLines() { return nLines
; }
90 inline BYTE
GetChars() const { return nChars
; }
91 inline BYTE
&GetChars() { return nChars
; }
93 inline BOOL
GetWholeWord() const { return bWholeWord
; }
94 inline BYTE
&GetWholeWord() { return bWholeWord
; }
96 inline USHORT
GetDistance() const { return nDistance
; }
97 inline USHORT
&GetDistance() { return nDistance
; }
99 // fuer den Sw3-Reader: CharFormat-Id (Pool laden!)
100 inline USHORT
GetReadFmt() const { return nReadFmt
; }
101 inline void SetReadFmt( USHORT n
) { nReadFmt
= n
; }
103 inline const SwCharFmt
*GetCharFmt() const { return (SwCharFmt
*)pRegisteredIn
; }
104 inline SwCharFmt
*GetCharFmt() { return (SwCharFmt
*)pRegisteredIn
; }
105 void SetCharFmt( SwCharFmt
*pNew
);
106 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
107 // erfrage vom Client Informationen
108 virtual BOOL
GetInfo( SfxPoolItem
& ) const;
110 // erfrage und setze den Modify-Pointer
111 inline const SwModify
* GetDefinedIn() const { return pDefinedIn
; }
112 inline void ChgDefinedIn( const SwModify
* pNew
)
113 { pDefinedIn
= (SwModify
*)pNew
; }
116 class SwRegisterItem
: public SfxBoolItem
121 inline SwRegisterItem( const BOOL bRegister
= FALSE
);
122 inline SwRegisterItem
& operator=( const SwRegisterItem
& rRegister
);
124 // "pure virtual Methoden" vom SfxPoolItem
125 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
126 virtual SfxPoolItem
* Create( SvStream
&, USHORT
) const;
127 virtual SvStream
& Store( SvStream
&, USHORT nIVer
) const;
128 virtual USHORT
GetVersion( USHORT nFFVer
) const;
131 inline SwRegisterItem::SwRegisterItem( const BOOL bRegister
) :
132 SfxBoolItem( RES_PARATR_REGISTER
, bRegister
)
135 inline SwRegisterItem
& SwRegisterItem::operator=(
136 const SwRegisterItem
& rRegister
)
138 SetValue( rRegister
.GetValue() );
142 class SwNumRuleItem
: public SfxStringItem
144 SwModify
* pDefinedIn
; // Modify-Object, in dem das NumRule steht
145 // kann nur TxtFmtCollection/TxtNode sein
150 : SfxStringItem( RES_PARATR_NUMRULE
, aEmptyStr
), pDefinedIn(0) {}
152 SwNumRuleItem( const String
& rRuleName
)
153 : SfxStringItem( RES_PARATR_NUMRULE
, rRuleName
), pDefinedIn(0) {}
155 SwNumRuleItem( const SwNumRuleItem
& rCpy
)
156 : SfxStringItem( RES_PARATR_NUMRULE
, rCpy
.GetValue() ), pDefinedIn(0) {}
159 SwNumRuleItem
& operator=( const SwNumRuleItem
& rCpy
)
160 { SetValue( rCpy
.GetValue() ); pDefinedIn
=0; return *this; }
162 // "pure virtual Methoden" vom SfxPoolItem
163 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
164 virtual SfxPoolItem
* Create( SvStream
&, USHORT
) const;
165 virtual SvStream
& Store( SvStream
&, USHORT nIVer
) const;
166 virtual USHORT
GetVersion( USHORT nFFVer
) const;
168 virtual BOOL
QueryValue( ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
) const;
169 virtual BOOL
PutValue( const ::com::sun::star::uno::Any
& rVal
, BYTE nMemberId
);
171 // erfrage und setze den Modify-Pointer
172 inline const SwModify
* GetDefinedIn() const { return pDefinedIn
; }
173 inline void ChgDefinedIn( const SwModify
* pNew
)
174 { pDefinedIn
= (SwModify
*)pNew
; }
176 class SwParaConnectBorderItem
: public SfxBoolItem
181 inline SwParaConnectBorderItem( const BOOL bConnect
= TRUE
);
182 inline SwParaConnectBorderItem
& operator=( const SwParaConnectBorderItem
& rConnect
);
184 // "pure virtual Methoden" vom SfxPoolItem
185 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
186 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
187 SfxMapUnit eCoreMetric
,
188 SfxMapUnit ePresMetric
,
190 const ::IntlWrapper
* pIntl
= 0 ) const;
193 inline SwParaConnectBorderItem::SwParaConnectBorderItem( const BOOL bConnect
) :
194 SfxBoolItem( RES_PARATR_CONNECT_BORDER
, bConnect
)
197 inline SwParaConnectBorderItem
& SwParaConnectBorderItem::operator=(
198 const SwParaConnectBorderItem
& rConnect
)
200 SetValue( rConnect
.GetValue() );
206 /******************************************************************************
207 * Implementierung der Paragraph-Attribut Methoden vom SwAttrSet
208 ******************************************************************************/
210 inline const SvxLineSpacingItem
&SwAttrSet::GetLineSpacing(BOOL bInP
) const
211 { return (const SvxLineSpacingItem
&)Get( RES_PARATR_LINESPACING
,bInP
); }
212 inline const SvxAdjustItem
&SwAttrSet::GetAdjust(BOOL bInP
) const
213 { return (const SvxAdjustItem
&)Get( RES_PARATR_ADJUST
,bInP
); }
214 inline const SvxFmtSplitItem
&SwAttrSet::GetSplit(BOOL bInP
) const
215 { return (const SvxFmtSplitItem
&)Get( RES_PARATR_SPLIT
,bInP
); }
216 inline const SwRegisterItem
&SwAttrSet::GetRegister(BOOL bInP
) const
217 { return (const SwRegisterItem
&)Get( RES_PARATR_REGISTER
,bInP
); }
218 inline const SvxWidowsItem
&SwAttrSet::GetWidows(BOOL bInP
) const
219 { return (const SvxWidowsItem
&)Get( RES_PARATR_WIDOWS
,bInP
); }
220 inline const SvxOrphansItem
&SwAttrSet::GetOrphans(BOOL bInP
) const
221 { return (const SvxOrphansItem
&)Get( RES_PARATR_ORPHANS
,bInP
); }
222 inline const SvxTabStopItem
&SwAttrSet::GetTabStops(BOOL bInP
) const
223 { return (const SvxTabStopItem
&)Get( RES_PARATR_TABSTOP
,bInP
); }
224 inline const SvxHyphenZoneItem
&SwAttrSet::GetHyphenZone(BOOL bInP
) const
225 { return (const SvxHyphenZoneItem
&)Get(RES_PARATR_HYPHENZONE
,bInP
); }
226 inline const SwFmtDrop
&SwAttrSet::GetDrop(BOOL bInP
) const
227 { return (const SwFmtDrop
&)Get(RES_PARATR_DROP
,bInP
); }
228 inline const SwNumRuleItem
&SwAttrSet::GetNumRule(BOOL bInP
) const
229 { return (const SwNumRuleItem
&)Get(RES_PARATR_NUMRULE
,bInP
); }
230 inline const SvxScriptSpaceItem
& SwAttrSet::GetScriptSpace(BOOL bInP
) const
231 { return (const SvxScriptSpaceItem
&)Get(RES_PARATR_SCRIPTSPACE
,bInP
); }
232 inline const SvxHangingPunctuationItem
&SwAttrSet::GetHangingPunctuation(BOOL bInP
) const
233 { return (const SvxHangingPunctuationItem
&)Get(RES_PARATR_HANGINGPUNCTUATION
,bInP
); }
234 inline const SvxForbiddenRuleItem
&SwAttrSet::GetForbiddenRule(BOOL bInP
) const
235 { return (const SvxForbiddenRuleItem
&)Get(RES_PARATR_FORBIDDEN_RULES
, bInP
); }
236 inline const SvxParaVertAlignItem
&SwAttrSet::GetParaVertAlign(BOOL bInP
) const
237 { return (const SvxParaVertAlignItem
&)Get( RES_PARATR_VERTALIGN
, bInP
); }
238 inline const SvxParaGridItem
&SwAttrSet::GetParaGrid(BOOL bInP
) const
239 { return (const SvxParaGridItem
&)Get( RES_PARATR_SNAPTOGRID
, bInP
); }
240 inline const SwParaConnectBorderItem
&SwAttrSet::GetParaConnectBorder(BOOL bInP
) const
241 { return (const SwParaConnectBorderItem
&)Get( RES_PARATR_CONNECT_BORDER
, bInP
); }
243 /******************************************************************************
244 * Implementierung der Paragraph-Attribut Methoden vom SwFmt
245 ******************************************************************************/
247 inline const SvxLineSpacingItem
&SwFmt::GetLineSpacing(BOOL bInP
) const
248 { return aSet
.GetLineSpacing(bInP
); }
249 inline const SvxAdjustItem
&SwFmt::GetAdjust(BOOL bInP
) const
250 { return aSet
.GetAdjust(bInP
); }
251 inline const SvxFmtSplitItem
&SwFmt::GetSplit(BOOL bInP
) const
252 { return aSet
.GetSplit(bInP
); }
253 inline const SwRegisterItem
&SwFmt::GetRegister(BOOL bInP
) const
254 { return aSet
.GetRegister(bInP
); }
255 inline const SvxWidowsItem
&SwFmt::GetWidows(BOOL bInP
) const
256 { return aSet
.GetWidows(bInP
); }
257 inline const SvxOrphansItem
&SwFmt::GetOrphans(BOOL bInP
) const
258 { return aSet
.GetOrphans(bInP
); }
259 inline const SvxTabStopItem
&SwFmt::GetTabStops(BOOL bInP
) const
260 { return aSet
.GetTabStops(bInP
); }
261 inline const SvxHyphenZoneItem
&SwFmt::GetHyphenZone(BOOL bInP
) const
262 { return aSet
.GetHyphenZone(bInP
); }
263 inline const SwFmtDrop
&SwFmt::GetDrop(BOOL bInP
) const
264 { return aSet
.GetDrop(bInP
); }
265 inline const SwNumRuleItem
&SwFmt::GetNumRule(BOOL bInP
) const
266 { return aSet
.GetNumRule(bInP
); }
267 inline const SvxScriptSpaceItem
& SwFmt::GetScriptSpace(BOOL bInP
) const
268 { return aSet
.GetScriptSpace(bInP
) ; }
269 inline const SvxHangingPunctuationItem
&SwFmt::GetHangingPunctuation(BOOL bInP
) const
270 { return aSet
.GetHangingPunctuation(bInP
) ; }
271 inline const SvxForbiddenRuleItem
&SwFmt::GetForbiddenRule(BOOL bInP
) const
272 { return (const SvxForbiddenRuleItem
&)aSet
.Get(RES_PARATR_FORBIDDEN_RULES
, bInP
); }
273 inline const SvxParaVertAlignItem
&SwFmt::GetParaVertAlign(BOOL bInP
) const
274 { return (const SvxParaVertAlignItem
&)aSet
.Get( RES_PARATR_VERTALIGN
, bInP
); }
275 inline const SvxParaGridItem
&SwFmt::GetParaGrid(BOOL bInP
) const
276 { return (const SvxParaGridItem
&)aSet
.Get( RES_PARATR_SNAPTOGRID
, bInP
); }
277 inline const SwParaConnectBorderItem
&SwFmt::GetParaConnectBorder(BOOL bInP
) const
278 { return (const SwParaConnectBorderItem
&)aSet
.Get( RES_PARATR_CONNECT_BORDER
, bInP
); }
280 } //namespace binfilter