1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <svl/eitem.hxx>
22 #include <svl/stritem.hxx>
24 #include <hintids.hxx>
26 #include <swatrset.hxx>
28 #include <swtypes.hxx>
29 #include <editeng/adjustitem.hxx>
34 #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
36 /** If SwFmtDrop is a Client, it is the CharFmt that describes the font for the
37 DropCaps. If it is not a Client, formating uses the CharFmt of the paragraph.
38 If the CharFmt is modified, this change is propagated to the paragraphs
39 via the Modify of SwFmtDrop. */
40 class SW_DLLPUBLIC SwFmtDrop
: public SfxPoolItem
, public SwClient
42 SwModify
* pDefinedIn
; /**< Modify-Object, that contains DropCaps.
43 Can only be TxtFmtCollection/TxtNode. */
44 sal_uInt16 nDistance
; ///< Distance to beginning of text.
45 sal_uInt16 nReadFmt
; ///< For Sw3-Reader: CharFormat-Id (load Pool!).
46 sal_uInt8 nLines
; ///< Line count.
47 sal_uInt8 nChars
; ///< Character count.
48 sal_Bool bWholeWord
; ///< First word with initials.
50 TYPEINFO(); ///< Already in base class SwClient.
55 // @@@ public copy ctor, but no copy assignment?
56 SwFmtDrop( const SwFmtDrop
& );
58 // @@@ public copy ctor, but no copy assignment?
59 SwFmtDrop
& operator= (const SwFmtDrop
&);
62 virtual void Modify( const SfxPoolItem
*, const SfxPoolItem
* );
66 /// "pure virtual methods" of SfxPoolItem
67 virtual int operator==( const SfxPoolItem
& ) const;
68 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= 0 ) const;
69 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
70 SfxMapUnit eCoreMetric
,
71 SfxMapUnit ePresMetric
,
73 const IntlWrapper
* pIntl
= 0) const;
74 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const;
75 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 );
77 inline sal_uInt8
GetLines() const { return nLines
; }
78 inline sal_uInt8
&GetLines() { return nLines
; }
80 inline sal_uInt8
GetChars() const { return nChars
; }
81 inline sal_uInt8
&GetChars() { return nChars
; }
83 inline sal_Bool
GetWholeWord() const { return bWholeWord
; }
84 inline sal_uInt8
&GetWholeWord() { return bWholeWord
; }
86 inline sal_uInt16
GetDistance() const { return nDistance
; }
87 inline sal_uInt16
&GetDistance() { return nDistance
; }
89 inline const SwCharFmt
*GetCharFmt() const { return (SwCharFmt
*)GetRegisteredIn(); }
90 inline SwCharFmt
*GetCharFmt() { return (SwCharFmt
*)GetRegisteredIn(); }
91 void SetCharFmt( SwCharFmt
*pNew
);
92 /// Get information from Client.
93 virtual bool GetInfo( SfxPoolItem
& ) const;
95 /// Get and set Modify pointer.
96 inline const SwModify
* GetDefinedIn() const { return pDefinedIn
; }
97 inline void ChgDefinedIn( const SwModify
* pNew
)
98 { pDefinedIn
= (SwModify
*)pNew
; }
101 class SwRegisterItem
: public SfxBoolItem
106 inline SwRegisterItem( const sal_Bool bRegister
= sal_False
);
108 /// @@@ public copy assignment, but no copy ctor?
109 inline SwRegisterItem
& operator=( const SwRegisterItem
& rRegister
);
111 /// "pure virtual methods" of SfxPoolItem
112 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
113 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
114 SfxMapUnit eCoreMetric
,
115 SfxMapUnit ePresMetric
,
117 const IntlWrapper
* pIntl
= 0 ) const;
120 inline SwRegisterItem::SwRegisterItem( const sal_Bool bRegister
) :
121 SfxBoolItem( RES_PARATR_REGISTER
, bRegister
)
124 inline SwRegisterItem
& SwRegisterItem::operator=(
125 const SwRegisterItem
& rRegister
)
127 SetValue( rRegister
.GetValue() );
131 class SW_DLLPUBLIC SwNumRuleItem
: public SfxStringItem
137 : SfxStringItem( RES_PARATR_NUMRULE
, aEmptyStr
) {}
139 SwNumRuleItem( const String
& rRuleName
)
140 : SfxStringItem( RES_PARATR_NUMRULE
, rRuleName
) {}
142 SwNumRuleItem( const SwNumRuleItem
& rCpy
)
143 : SfxStringItem( RES_PARATR_NUMRULE
, rCpy
.GetValue() ) {}
145 SwNumRuleItem
& operator=( const SwNumRuleItem
& rCpy
)
146 { SetValue( rCpy
.GetValue() ); return *this; }
148 /// "pure virtual methods" of SfxPoolItem
149 virtual int operator==( const SfxPoolItem
& ) const;
150 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
151 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
152 SfxMapUnit eCoreMetric
,
153 SfxMapUnit ePresMetric
,
155 const IntlWrapper
* pIntl
= 0 ) const;
157 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
) const;
158 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
);
161 class SwParaConnectBorderItem
: public SfxBoolItem
166 inline SwParaConnectBorderItem( const sal_Bool bConnect
= sal_True
);
168 /// @@@ public copy assignment, but no copy ctor?
169 inline SwParaConnectBorderItem
& operator=( const SwParaConnectBorderItem
& rConnect
);
171 /// "pure virtual methods" of SfxPoolItem
172 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
173 virtual SfxItemPresentation
GetPresentation( SfxItemPresentation ePres
,
174 SfxMapUnit eCoreMetric
,
175 SfxMapUnit ePresMetric
,
177 const IntlWrapper
* pIntl
= 0 ) const;
180 inline SwParaConnectBorderItem::SwParaConnectBorderItem( const sal_Bool bConnect
) :
181 SfxBoolItem( RES_PARATR_CONNECT_BORDER
, bConnect
)
184 inline SwParaConnectBorderItem
& SwParaConnectBorderItem::operator=(
185 const SwParaConnectBorderItem
& rConnect
)
187 SetValue( rConnect
.GetValue() );
193 /******************************************************************************
194 * Implementation of paragraph-attributes methods of SwAttrSet
195 ******************************************************************************/
197 inline const SvxLineSpacingItem
&SwAttrSet::GetLineSpacing(sal_Bool bInP
) const
198 { return (const SvxLineSpacingItem
&)Get( RES_PARATR_LINESPACING
,bInP
); }
199 inline const SvxAdjustItem
&SwAttrSet::GetAdjust(sal_Bool bInP
) const
200 { return (const SvxAdjustItem
&)Get( RES_PARATR_ADJUST
,bInP
); }
201 inline const SvxFmtSplitItem
&SwAttrSet::GetSplit(sal_Bool bInP
) const
202 { return (const SvxFmtSplitItem
&)Get( RES_PARATR_SPLIT
,bInP
); }
203 inline const SwRegisterItem
&SwAttrSet::GetRegister(sal_Bool bInP
) const
204 { return (const SwRegisterItem
&)Get( RES_PARATR_REGISTER
,bInP
); }
205 inline const SvxWidowsItem
&SwAttrSet::GetWidows(sal_Bool bInP
) const
206 { return (const SvxWidowsItem
&)Get( RES_PARATR_WIDOWS
,bInP
); }
207 inline const SvxOrphansItem
&SwAttrSet::GetOrphans(sal_Bool bInP
) const
208 { return (const SvxOrphansItem
&)Get( RES_PARATR_ORPHANS
,bInP
); }
209 inline const SvxTabStopItem
&SwAttrSet::GetTabStops(sal_Bool bInP
) const
210 { return (const SvxTabStopItem
&)Get( RES_PARATR_TABSTOP
,bInP
); }
211 inline const SvxHyphenZoneItem
&SwAttrSet::GetHyphenZone(sal_Bool bInP
) const
212 { return (const SvxHyphenZoneItem
&)Get(RES_PARATR_HYPHENZONE
,bInP
); }
213 inline const SwFmtDrop
&SwAttrSet::GetDrop(sal_Bool bInP
) const
214 { return (const SwFmtDrop
&)Get(RES_PARATR_DROP
,bInP
); }
215 inline const SwNumRuleItem
&SwAttrSet::GetNumRule(sal_Bool bInP
) const
216 { return (const SwNumRuleItem
&)Get(RES_PARATR_NUMRULE
,bInP
); }
217 inline const SvxScriptSpaceItem
& SwAttrSet::GetScriptSpace(sal_Bool bInP
) const
218 { return (const SvxScriptSpaceItem
&)Get(RES_PARATR_SCRIPTSPACE
,bInP
); }
219 inline const SvxHangingPunctuationItem
&SwAttrSet::GetHangingPunctuation(sal_Bool bInP
) const
220 { return (const SvxHangingPunctuationItem
&)Get(RES_PARATR_HANGINGPUNCTUATION
,bInP
); }
221 inline const SvxForbiddenRuleItem
&SwAttrSet::GetForbiddenRule(sal_Bool bInP
) const
222 { return (const SvxForbiddenRuleItem
&)Get(RES_PARATR_FORBIDDEN_RULES
, bInP
); }
223 inline const SvxParaVertAlignItem
&SwAttrSet::GetParaVertAlign(sal_Bool bInP
) const
224 { return (const SvxParaVertAlignItem
&)Get( RES_PARATR_VERTALIGN
, bInP
); }
225 inline const SvxParaGridItem
&SwAttrSet::GetParaGrid(sal_Bool bInP
) const
226 { return (const SvxParaGridItem
&)Get( RES_PARATR_SNAPTOGRID
, bInP
); }
227 inline const SwParaConnectBorderItem
&SwAttrSet::GetParaConnectBorder(sal_Bool bInP
) const
228 { return (const SwParaConnectBorderItem
&)Get( RES_PARATR_CONNECT_BORDER
, bInP
); }
230 /******************************************************************************
231 * Implementation of paragraph-attributes methods of SwFmt
232 ******************************************************************************/
234 inline const SvxLineSpacingItem
&SwFmt::GetLineSpacing(sal_Bool bInP
) const
235 { return aSet
.GetLineSpacing(bInP
); }
236 inline const SvxAdjustItem
&SwFmt::GetAdjust(sal_Bool bInP
) const
237 { return aSet
.GetAdjust(bInP
); }
238 inline const SvxFmtSplitItem
&SwFmt::GetSplit(sal_Bool bInP
) const
239 { return aSet
.GetSplit(bInP
); }
240 inline const SwRegisterItem
&SwFmt::GetRegister(sal_Bool bInP
) const
241 { return aSet
.GetRegister(bInP
); }
242 inline const SvxWidowsItem
&SwFmt::GetWidows(sal_Bool bInP
) const
243 { return aSet
.GetWidows(bInP
); }
244 inline const SvxOrphansItem
&SwFmt::GetOrphans(sal_Bool bInP
) const
245 { return aSet
.GetOrphans(bInP
); }
246 inline const SvxTabStopItem
&SwFmt::GetTabStops(sal_Bool bInP
) const
247 { return aSet
.GetTabStops(bInP
); }
248 inline const SvxHyphenZoneItem
&SwFmt::GetHyphenZone(sal_Bool bInP
) const
249 { return aSet
.GetHyphenZone(bInP
); }
250 inline const SwFmtDrop
&SwFmt::GetDrop(sal_Bool bInP
) const
251 { return aSet
.GetDrop(bInP
); }
252 inline const SwNumRuleItem
&SwFmt::GetNumRule(sal_Bool bInP
) const
253 { return aSet
.GetNumRule(bInP
); }
254 inline const SvxScriptSpaceItem
& SwFmt::GetScriptSpace(sal_Bool bInP
) const
255 { return aSet
.GetScriptSpace(bInP
) ; }
256 inline const SvxHangingPunctuationItem
&SwFmt::GetHangingPunctuation(sal_Bool bInP
) const
257 { return aSet
.GetHangingPunctuation(bInP
) ; }
258 inline const SvxForbiddenRuleItem
&SwFmt::GetForbiddenRule(sal_Bool bInP
) const
259 { return (const SvxForbiddenRuleItem
&)aSet
.Get(RES_PARATR_FORBIDDEN_RULES
, bInP
); }
260 inline const SvxParaVertAlignItem
&SwFmt::GetParaVertAlign(sal_Bool bInP
) const
261 { return (const SvxParaVertAlignItem
&)aSet
.Get( RES_PARATR_VERTALIGN
, bInP
); }
262 inline const SvxParaGridItem
&SwFmt::GetParaGrid(sal_Bool bInP
) const
263 { return (const SvxParaGridItem
&)aSet
.Get( RES_PARATR_SNAPTOGRID
, bInP
); }
264 inline const SwParaConnectBorderItem
&SwFmt::GetParaConnectBorder(sal_Bool bInP
) const
265 { return (const SwParaConnectBorderItem
&)aSet
.Get( RES_PARATR_CONNECT_BORDER
, bInP
); }
269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */