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 ************************************************************************/
32 #include <svtools/eitem.hxx>
33 #include <svtools/stritem.hxx>
35 #include <hintids.hxx>
37 #include <swatrset.hxx>
39 #include <swtypes.hxx>
44 /*************************************************************************
46 *************************************************************************/
48 #define DROP_WHOLEWORD ((USHORT)0x0001)
50 //Wenn ein SwFmtDrop Client ist, so ist dies das CharFmt welches den Font fuer
51 //die DropCaps beschreibt. Ist es kein Client, so wird von der Formatierung
52 //das CharFmt des Absatzes benutzt.
53 //Wird das CharFmt verandert, so wird diese Aenderung ueber das Modify des
54 //SwFmtDrop an die Absatze propagiert.
55 class SW_DLLPUBLIC SwFmtDrop
: public SfxPoolItem
, public SwClient
57 SwModify
* pDefinedIn
; // Modify-Object, in dem der DropCaps steht
58 // kann nur TxtFmtCollection/TxtNode sein
59 USHORT nDistance
; // Abstand zum Textbeginn
60 USHORT nReadFmt
; // fuer den Sw3-Reader: CharFormat-Id (Pool laden!)
61 BYTE nLines
; // Anzahl der Zeilen
62 BYTE nChars
; // Anzahl der Zeichen
63 BOOL bWholeWord
; // Erstes Wort als Initialen
65 TYPEINFO(); //Bereits in der Basisklasse SwClient
70 // @@@ public copy ctor, but no copy assignment?
71 SwFmtDrop( const SwFmtDrop
& );
73 // @@@ public copy ctor, but no copy assignment?
74 SwFmtDrop
& operator= (const SwFmtDrop
&);
77 // "pure virtual Methoden" vom SfxPoolItem
78 virtual int operator==( const SfxPoolItem
& ) const;
79 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const;
80 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
81 SfxMapUnit eCoreMetric
,
82 SfxMapUnit ePresMetric
,
84 const IntlWrapper
* pIntl
= 0) const;
85 virtual BOOL
QueryValue( com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 ) const;
86 virtual BOOL
PutValue( const com::sun::star::uno::Any
& rVal
, BYTE nMemberId
= 0 );
88 inline BYTE
GetLines() const { return nLines
; }
89 inline BYTE
&GetLines() { return nLines
; }
91 inline BYTE
GetChars() const { return nChars
; }
92 inline BYTE
&GetChars() { return nChars
; }
94 inline BOOL
GetWholeWord() const { return bWholeWord
; }
95 inline BYTE
&GetWholeWord() { return bWholeWord
; }
97 inline USHORT
GetDistance() const { return nDistance
; }
98 inline USHORT
&GetDistance() { return nDistance
; }
100 inline const SwCharFmt
*GetCharFmt() const { return (SwCharFmt
*)pRegisteredIn
; }
101 inline SwCharFmt
*GetCharFmt() { return (SwCharFmt
*)pRegisteredIn
; }
102 void SetCharFmt( SwCharFmt
*pNew
);
103 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
104 // erfrage vom Client Informationen
105 virtual BOOL
GetInfo( SfxPoolItem
& ) const;
107 // erfrage und setze den Modify-Pointer
108 inline const SwModify
* GetDefinedIn() const { return pDefinedIn
; }
109 inline void ChgDefinedIn( const SwModify
* pNew
)
110 { pDefinedIn
= (SwModify
*)pNew
; }
113 class SwRegisterItem
: public SfxBoolItem
118 inline SwRegisterItem( const BOOL bRegister
= FALSE
);
120 // @@@ public copy assignment, but no copy ctor?
121 inline SwRegisterItem
& operator=( const SwRegisterItem
& rRegister
);
123 // "pure virtual Methoden" vom SfxPoolItem
124 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
125 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
126 SfxMapUnit eCoreMetric
,
127 SfxMapUnit ePresMetric
,
129 const IntlWrapper
* pIntl
= 0 ) const;
132 inline SwRegisterItem::SwRegisterItem( const BOOL bRegister
) :
133 SfxBoolItem( RES_PARATR_REGISTER
, bRegister
)
136 inline SwRegisterItem
& SwRegisterItem::operator=(
137 const SwRegisterItem
& rRegister
)
139 SetValue( rRegister
.GetValue() );
143 class SW_DLLPUBLIC SwNumRuleItem
: public SfxStringItem
148 // --> OD 2008-03-04 #refactorlists# - removed <pDefinedIn>
150 : SfxStringItem( RES_PARATR_NUMRULE
, aEmptyStr
) {}
152 SwNumRuleItem( const String
& rRuleName
)
153 : SfxStringItem( RES_PARATR_NUMRULE
, rRuleName
) {}
155 SwNumRuleItem( const SwNumRuleItem
& rCpy
)
156 : SfxStringItem( RES_PARATR_NUMRULE
, rCpy
.GetValue() ) {}
158 SwNumRuleItem
& operator=( const SwNumRuleItem
& rCpy
)
159 { SetValue( rCpy
.GetValue() ); return *this; }
162 // "pure virtual Methoden" vom SfxPoolItem
163 virtual int operator==( const SfxPoolItem
& ) const;
164 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
165 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
166 SfxMapUnit eCoreMetric
,
167 SfxMapUnit ePresMetric
,
169 const IntlWrapper
* pIntl
= 0 ) const;
171 virtual BOOL
QueryValue( com::sun::star::uno::Any
& rVal
, BYTE nMemberId
) const;
172 virtual BOOL
PutValue( const com::sun::star::uno::Any
& rVal
, BYTE nMemberId
);
175 class SwParaConnectBorderItem
: public SfxBoolItem
180 inline SwParaConnectBorderItem( const BOOL bConnect
= TRUE
);
182 // @@@ public copy assignment, but no copy ctor?
183 inline SwParaConnectBorderItem
& operator=( const SwParaConnectBorderItem
& rConnect
);
185 // "pure virtual Methoden" vom SfxPoolItem
186 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
187 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
188 SfxMapUnit eCoreMetric
,
189 SfxMapUnit ePresMetric
,
191 const IntlWrapper
* pIntl
= 0 ) const;
194 inline SwParaConnectBorderItem::SwParaConnectBorderItem( const BOOL bConnect
) :
195 SfxBoolItem( RES_PARATR_CONNECT_BORDER
, bConnect
)
198 inline SwParaConnectBorderItem
& SwParaConnectBorderItem::operator=(
199 const SwParaConnectBorderItem
& rConnect
)
201 SetValue( rConnect
.GetValue() );
207 /******************************************************************************
208 * Implementierung der Paragraph-Attribut Methoden vom SwAttrSet
209 ******************************************************************************/
211 inline const SvxLineSpacingItem
&SwAttrSet::GetLineSpacing(BOOL bInP
) const
212 { return (const SvxLineSpacingItem
&)Get( RES_PARATR_LINESPACING
,bInP
); }
213 inline const SvxAdjustItem
&SwAttrSet::GetAdjust(BOOL bInP
) const
214 { return (const SvxAdjustItem
&)Get( RES_PARATR_ADJUST
,bInP
); }
215 inline const SvxFmtSplitItem
&SwAttrSet::GetSplit(BOOL bInP
) const
216 { return (const SvxFmtSplitItem
&)Get( RES_PARATR_SPLIT
,bInP
); }
217 inline const SwRegisterItem
&SwAttrSet::GetRegister(BOOL bInP
) const
218 { return (const SwRegisterItem
&)Get( RES_PARATR_REGISTER
,bInP
); }
219 inline const SvxWidowsItem
&SwAttrSet::GetWidows(BOOL bInP
) const
220 { return (const SvxWidowsItem
&)Get( RES_PARATR_WIDOWS
,bInP
); }
221 inline const SvxOrphansItem
&SwAttrSet::GetOrphans(BOOL bInP
) const
222 { return (const SvxOrphansItem
&)Get( RES_PARATR_ORPHANS
,bInP
); }
223 inline const SvxTabStopItem
&SwAttrSet::GetTabStops(BOOL bInP
) const
224 { return (const SvxTabStopItem
&)Get( RES_PARATR_TABSTOP
,bInP
); }
225 inline const SvxHyphenZoneItem
&SwAttrSet::GetHyphenZone(BOOL bInP
) const
226 { return (const SvxHyphenZoneItem
&)Get(RES_PARATR_HYPHENZONE
,bInP
); }
227 inline const SwFmtDrop
&SwAttrSet::GetDrop(BOOL bInP
) const
228 { return (const SwFmtDrop
&)Get(RES_PARATR_DROP
,bInP
); }
229 inline const SwNumRuleItem
&SwAttrSet::GetNumRule(BOOL bInP
) const
230 { return (const SwNumRuleItem
&)Get(RES_PARATR_NUMRULE
,bInP
); }
231 inline const SvxScriptSpaceItem
& SwAttrSet::GetScriptSpace(BOOL bInP
) const
232 { return (const SvxScriptSpaceItem
&)Get(RES_PARATR_SCRIPTSPACE
,bInP
); }
233 inline const SvxHangingPunctuationItem
&SwAttrSet::GetHangingPunctuation(BOOL bInP
) const
234 { return (const SvxHangingPunctuationItem
&)Get(RES_PARATR_HANGINGPUNCTUATION
,bInP
); }
235 inline const SvxForbiddenRuleItem
&SwAttrSet::GetForbiddenRule(BOOL bInP
) const
236 { return (const SvxForbiddenRuleItem
&)Get(RES_PARATR_FORBIDDEN_RULES
, bInP
); }
237 inline const SvxParaVertAlignItem
&SwAttrSet::GetParaVertAlign(BOOL bInP
) const
238 { return (const SvxParaVertAlignItem
&)Get( RES_PARATR_VERTALIGN
, bInP
); }
239 inline const SvxParaGridItem
&SwAttrSet::GetParaGrid(BOOL bInP
) const
240 { return (const SvxParaGridItem
&)Get( RES_PARATR_SNAPTOGRID
, bInP
); }
241 inline const SwParaConnectBorderItem
&SwAttrSet::GetParaConnectBorder(BOOL bInP
) const
242 { return (const SwParaConnectBorderItem
&)Get( RES_PARATR_CONNECT_BORDER
, bInP
); }
244 /******************************************************************************
245 * Implementierung der Paragraph-Attribut Methoden vom SwFmt
246 ******************************************************************************/
248 inline const SvxLineSpacingItem
&SwFmt::GetLineSpacing(BOOL bInP
) const
249 { return aSet
.GetLineSpacing(bInP
); }
250 inline const SvxAdjustItem
&SwFmt::GetAdjust(BOOL bInP
) const
251 { return aSet
.GetAdjust(bInP
); }
252 inline const SvxFmtSplitItem
&SwFmt::GetSplit(BOOL bInP
) const
253 { return aSet
.GetSplit(bInP
); }
254 inline const SwRegisterItem
&SwFmt::GetRegister(BOOL bInP
) const
255 { return aSet
.GetRegister(bInP
); }
256 inline const SvxWidowsItem
&SwFmt::GetWidows(BOOL bInP
) const
257 { return aSet
.GetWidows(bInP
); }
258 inline const SvxOrphansItem
&SwFmt::GetOrphans(BOOL bInP
) const
259 { return aSet
.GetOrphans(bInP
); }
260 inline const SvxTabStopItem
&SwFmt::GetTabStops(BOOL bInP
) const
261 { return aSet
.GetTabStops(bInP
); }
262 inline const SvxHyphenZoneItem
&SwFmt::GetHyphenZone(BOOL bInP
) const
263 { return aSet
.GetHyphenZone(bInP
); }
264 inline const SwFmtDrop
&SwFmt::GetDrop(BOOL bInP
) const
265 { return aSet
.GetDrop(bInP
); }
266 inline const SwNumRuleItem
&SwFmt::GetNumRule(BOOL bInP
) const
267 { return aSet
.GetNumRule(bInP
); }
268 inline const SvxScriptSpaceItem
& SwFmt::GetScriptSpace(BOOL bInP
) const
269 { return aSet
.GetScriptSpace(bInP
) ; }
270 inline const SvxHangingPunctuationItem
&SwFmt::GetHangingPunctuation(BOOL bInP
) const
271 { return aSet
.GetHangingPunctuation(bInP
) ; }
272 inline const SvxForbiddenRuleItem
&SwFmt::GetForbiddenRule(BOOL bInP
) const
273 { return (const SvxForbiddenRuleItem
&)aSet
.Get(RES_PARATR_FORBIDDEN_RULES
, bInP
); }
274 inline const SvxParaVertAlignItem
&SwFmt::GetParaVertAlign(BOOL bInP
) const
275 { return (const SvxParaVertAlignItem
&)aSet
.Get( RES_PARATR_VERTALIGN
, bInP
); }
276 inline const SvxParaGridItem
&SwFmt::GetParaGrid(BOOL bInP
) const
277 { return (const SvxParaGridItem
&)aSet
.Get( RES_PARATR_SNAPTOGRID
, bInP
); }
278 inline const SwParaConnectBorderItem
&SwFmt::GetParaConnectBorder(BOOL bInP
) const
279 { return (const SwParaConnectBorderItem
&)aSet
.Get( RES_PARATR_CONNECT_BORDER
, bInP
); }