xref: /aoo42x/main/sw/inc/paratr.hxx (revision ee093aae)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _PARATR_HXX
24 #define _PARATR_HXX
25 #include <svl/eitem.hxx>
26 #include <svl/stritem.hxx>
27 #include "swdllapi.h"
28 #include <hintids.hxx>
29 #include <calbck.hxx>
30 #include <swatrset.hxx>
31 #include <format.hxx>
32 #include <swtypes.hxx>
33 #include <editeng/adjitem.hxx>
34 
35 class SwCharFmt;
36 class IntlWrapper;
37 
38 /*************************************************************************
39 |*    class		SwFmtDrop
40 *************************************************************************/
41 
42 #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
43 
44 //Wenn ein SwFmtDrop Client ist, so ist dies das CharFmt welches den Font fuer
45 //die DropCaps beschreibt. Ist es kein Client, so wird von der Formatierung
46 //das CharFmt des Absatzes benutzt.
47 //Wird das CharFmt verandert, so wird diese Aenderung ueber das Modify des
48 //SwFmtDrop an die Absatze propagiert.
49 class SW_DLLPUBLIC SwFmtDrop: public SfxPoolItem, public SwClient
50 {
51 	SwModify* pDefinedIn;	// Modify-Object, in which DropCaps exists
52 							// can have only TxtFmtCollection/TxtNode
53 	sal_uInt16 nDistance;   // Distance from the text beginning
54 	sal_uInt16 nReadFmt;   	// for the Sw3-Reader: CharFormat-Id (Pool load!)
55 	sal_uInt8   nLines;		 // Number of lines
56 	sal_uInt8   nChars;		 // Number of characters
57 	sal_Bool   bWholeWord;	 // Erstes Wort als Initialen
58 public:
59 	TYPEINFO(); //Bereits in der Basisklasse SwClient
60 
61 	SwFmtDrop();
62 	virtual ~SwFmtDrop();
63 
64 	// @@@ public copy ctor, but no copy assignment?
65 	SwFmtDrop( const SwFmtDrop & );
66 private:
67 	// @@@ public copy ctor, but no copy assignment?
68 	SwFmtDrop & operator= (const SwFmtDrop &);
69 
70 protected:
71    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
72 
73 public:
74 
75 	// "pure virtual Methoden" vom SfxPoolItem
76 	virtual int             operator==( const SfxPoolItem& ) const;
77 	virtual SfxPoolItem*	Clone( SfxItemPool* pPool = 0 ) const;
78 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
79 									SfxMapUnit eCoreMetric,
80 									SfxMapUnit ePresMetric,
81 									String &rText,
82                                     const IntlWrapper*    pIntl = 0) const;
83 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
84 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
85 
GetLines() const86 	inline sal_uInt8 GetLines() const { return nLines; }
GetLines()87 	inline sal_uInt8 &GetLines() { return nLines; }
88 
GetChars() const89 	inline sal_uInt8 GetChars() const { return nChars; }
GetChars()90 	inline sal_uInt8 &GetChars() { return nChars; }
91 
GetWholeWord() const92 	inline sal_Bool GetWholeWord() const { return bWholeWord; }
GetWholeWord()93 	inline sal_uInt8 &GetWholeWord() { return bWholeWord; }
94 
GetDistance() const95 	inline sal_uInt16 GetDistance() const { return nDistance; }
GetDistance()96 	inline sal_uInt16 &GetDistance() { return nDistance; }
97 
GetCharFmt() const98    inline const SwCharFmt *GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
GetCharFmt()99 	inline SwCharFmt *GetCharFmt()       { return (SwCharFmt*)GetRegisteredIn(); }
100 	void SetCharFmt( SwCharFmt *pNew );
101 		// erfrage vom Client Informationen
102 	virtual sal_Bool GetInfo( SfxPoolItem& ) const;
103 
104 	// erfrage und setze den Modify-Pointer
GetDefinedIn() const105 	inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
ChgDefinedIn(const SwModify * pNew)106 	inline void ChgDefinedIn( const SwModify* pNew )
107 	{ pDefinedIn = (SwModify*)pNew; }
108 };
109 
110 class SwRegisterItem : public SfxBoolItem
111 {
112 public:
113 	TYPEINFO();
114 
115 	inline SwRegisterItem( const sal_Bool bRegister = sal_False );
116 
117 	// @@@ public copy assignment, but no copy ctor?
118 	inline SwRegisterItem& operator=( const SwRegisterItem& rRegister );
119 
120 	// "pure virtual Methoden" vom SfxPoolItem
121 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
122     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
123 									SfxMapUnit eCoreMetric,
124 									SfxMapUnit ePresMetric,
125 									String &rText,
126                                     const IntlWrapper*    pIntl = 0 ) const;
127 };
128 
SwRegisterItem(const sal_Bool bRegister)129 inline SwRegisterItem::SwRegisterItem( const sal_Bool bRegister ) :
130 	SfxBoolItem( RES_PARATR_REGISTER, bRegister )
131 {}
132 
operator =(const SwRegisterItem & rRegister)133 inline SwRegisterItem& SwRegisterItem::operator=(
134 	const SwRegisterItem& rRegister )
135 {
136 	SetValue( rRegister.GetValue() );
137 	return *this;
138 }
139 
140 class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem
141 {
142 public:
143 	TYPEINFO();
144 
145     // --> OD 2008-03-04 #refactorlists# - removed <pDefinedIn>
SwNumRuleItem()146 	SwNumRuleItem()
147         : SfxStringItem( RES_PARATR_NUMRULE, aEmptyStr ) {}
148 
SwNumRuleItem(const String & rRuleName)149 	SwNumRuleItem( const String& rRuleName )
150         : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
151 
SwNumRuleItem(const SwNumRuleItem & rCpy)152 	SwNumRuleItem( const SwNumRuleItem& rCpy )
153         : SfxStringItem( RES_PARATR_NUMRULE, rCpy.GetValue() ) {}
154 
operator =(const SwNumRuleItem & rCpy)155 	SwNumRuleItem& operator=( const SwNumRuleItem& rCpy )
156     { SetValue( rCpy.GetValue() ); return *this; }
157     // <--
158 
159 	// "pure virtual Methoden" vom SfxPoolItem
160 	virtual int             operator==( const SfxPoolItem& ) const;
161 	virtual SfxPoolItem*	Clone( SfxItemPool *pPool = 0 ) const;
162 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
163 									SfxMapUnit eCoreMetric,
164 									SfxMapUnit ePresMetric,
165 									String &rText,
166                                     const IntlWrapper*    pIntl = 0 ) const;
167 
168 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const;
169 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
170 };
171 
172 class SwParaConnectBorderItem : public SfxBoolItem
173 {
174 public:
175     TYPEINFO();
176 
177     inline SwParaConnectBorderItem( const sal_Bool bConnect = sal_True );
178 
179 	// @@@ public copy assignment, but no copy ctor?
180     inline SwParaConnectBorderItem& operator=( const SwParaConnectBorderItem& rConnect );
181 
182     // "pure virtual Methoden" vom SfxPoolItem
183     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
184     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
185                                     SfxMapUnit eCoreMetric,
186                                     SfxMapUnit ePresMetric,
187                                     String &rText,
188                                     const IntlWrapper*    pIntl = 0 ) const;
189 };
190 
SwParaConnectBorderItem(const sal_Bool bConnect)191 inline SwParaConnectBorderItem::SwParaConnectBorderItem( const sal_Bool bConnect ) :
192     SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect )
193 {}
194 
operator =(const SwParaConnectBorderItem & rConnect)195 inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=(
196     const SwParaConnectBorderItem& rConnect )
197 {
198     SetValue( rConnect.GetValue() );
199     return *this;
200 }
201 
202 
203 
204 /******************************************************************************
205  *	Implementierung der Paragraph-Attribut Methoden vom SwAttrSet
206  ******************************************************************************/
207 
GetLineSpacing(sal_Bool bInP) const208 inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(sal_Bool bInP) const
209 	{	return (const SvxLineSpacingItem&)Get( RES_PARATR_LINESPACING,bInP); }
GetAdjust(sal_Bool bInP) const210 inline const SvxAdjustItem &SwAttrSet::GetAdjust(sal_Bool bInP) const
211 	{	return (const SvxAdjustItem&)Get( RES_PARATR_ADJUST,bInP); }
GetSplit(sal_Bool bInP) const212 inline const SvxFmtSplitItem &SwAttrSet::GetSplit(sal_Bool bInP) const
213 	{	return (const SvxFmtSplitItem&)Get( RES_PARATR_SPLIT,bInP); }
GetRegister(sal_Bool bInP) const214 inline const SwRegisterItem &SwAttrSet::GetRegister(sal_Bool bInP) const
215 	{	return (const SwRegisterItem&)Get( RES_PARATR_REGISTER,bInP); }
GetWidows(sal_Bool bInP) const216 inline const SvxWidowsItem &SwAttrSet::GetWidows(sal_Bool bInP) const
217 	{	return (const SvxWidowsItem&)Get( RES_PARATR_WIDOWS,bInP); }
GetOrphans(sal_Bool bInP) const218 inline const SvxOrphansItem &SwAttrSet::GetOrphans(sal_Bool bInP) const
219 	{	return (const SvxOrphansItem&)Get( RES_PARATR_ORPHANS,bInP); }
GetTabStops(sal_Bool bInP) const220 inline const SvxTabStopItem &SwAttrSet::GetTabStops(sal_Bool bInP) const
221 	{	return (const SvxTabStopItem&)Get( RES_PARATR_TABSTOP,bInP); }
GetHyphenZone(sal_Bool bInP) const222 inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(sal_Bool bInP) const
223 	{	return (const SvxHyphenZoneItem&)Get(RES_PARATR_HYPHENZONE,bInP); }
GetDrop(sal_Bool bInP) const224 inline const SwFmtDrop &SwAttrSet::GetDrop(sal_Bool bInP) const
225 	{	return (const SwFmtDrop&)Get(RES_PARATR_DROP,bInP); }
GetNumRule(sal_Bool bInP) const226 inline const SwNumRuleItem &SwAttrSet::GetNumRule(sal_Bool bInP) const
227 	{	return (const SwNumRuleItem&)Get(RES_PARATR_NUMRULE,bInP); }
GetScriptSpace(sal_Bool bInP) const228 inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(sal_Bool bInP) const
229 	{	return (const SvxScriptSpaceItem&)Get(RES_PARATR_SCRIPTSPACE,bInP); }
GetHangingPunctuation(sal_Bool bInP) const230 inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(sal_Bool bInP) const
231 	{	return (const SvxHangingPunctuationItem&)Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
GetForbiddenRule(sal_Bool bInP) const232 inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(sal_Bool bInP) const
233 	{	return (const SvxForbiddenRuleItem&)Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
GetParaVertAlign(sal_Bool bInP) const234 inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(sal_Bool bInP) const
235 	{	return (const SvxParaVertAlignItem&)Get( RES_PARATR_VERTALIGN, bInP ); }
GetParaGrid(sal_Bool bInP) const236 inline const SvxParaGridItem &SwAttrSet::GetParaGrid(sal_Bool bInP) const
237     {   return (const SvxParaGridItem&)Get( RES_PARATR_SNAPTOGRID, bInP ); }
GetParaConnectBorder(sal_Bool bInP) const238 inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(sal_Bool bInP) const
239     {   return (const SwParaConnectBorderItem&)Get( RES_PARATR_CONNECT_BORDER, bInP ); }
240 
241 /******************************************************************************
242  *	Implementierung der Paragraph-Attribut Methoden vom SwFmt
243  ******************************************************************************/
244 
GetLineSpacing(sal_Bool bInP) const245 inline const SvxLineSpacingItem &SwFmt::GetLineSpacing(sal_Bool bInP) const
246 	{	return aSet.GetLineSpacing(bInP); }
GetAdjust(sal_Bool bInP) const247 inline const SvxAdjustItem &SwFmt::GetAdjust(sal_Bool bInP) const
248     {   return aSet.GetAdjust(bInP); }
GetSplit(sal_Bool bInP) const249 inline const SvxFmtSplitItem &SwFmt::GetSplit(sal_Bool bInP) const
250     {   return aSet.GetSplit(bInP); }
GetRegister(sal_Bool bInP) const251 inline const SwRegisterItem &SwFmt::GetRegister(sal_Bool bInP) const
252     {   return aSet.GetRegister(bInP); }
GetWidows(sal_Bool bInP) const253 inline const SvxWidowsItem &SwFmt::GetWidows(sal_Bool bInP) const
254     {   return aSet.GetWidows(bInP); }
GetOrphans(sal_Bool bInP) const255 inline const SvxOrphansItem &SwFmt::GetOrphans(sal_Bool bInP) const
256     {   return aSet.GetOrphans(bInP); }
GetTabStops(sal_Bool bInP) const257 inline const SvxTabStopItem &SwFmt::GetTabStops(sal_Bool bInP) const
258 	{	return aSet.GetTabStops(bInP); }
GetHyphenZone(sal_Bool bInP) const259 inline const SvxHyphenZoneItem &SwFmt::GetHyphenZone(sal_Bool bInP) const
260     {   return aSet.GetHyphenZone(bInP); }
GetDrop(sal_Bool bInP) const261 inline const SwFmtDrop &SwFmt::GetDrop(sal_Bool bInP) const
262 	{	return aSet.GetDrop(bInP); }
GetNumRule(sal_Bool bInP) const263 inline const SwNumRuleItem &SwFmt::GetNumRule(sal_Bool bInP) const
264 	{	return aSet.GetNumRule(bInP); }
GetScriptSpace(sal_Bool bInP) const265 inline const SvxScriptSpaceItem& SwFmt::GetScriptSpace(sal_Bool bInP) const
266     {   return aSet.GetScriptSpace(bInP) ; }
GetHangingPunctuation(sal_Bool bInP) const267 inline const SvxHangingPunctuationItem &SwFmt::GetHangingPunctuation(sal_Bool bInP) const
268     {   return aSet.GetHangingPunctuation(bInP) ; }
GetForbiddenRule(sal_Bool bInP) const269 inline const SvxForbiddenRuleItem &SwFmt::GetForbiddenRule(sal_Bool bInP) const
270     {   return (const SvxForbiddenRuleItem&)aSet.Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
GetParaVertAlign(sal_Bool bInP) const271 inline const SvxParaVertAlignItem &SwFmt::GetParaVertAlign(sal_Bool bInP) const
272     {   return (const SvxParaVertAlignItem&)aSet.Get( RES_PARATR_VERTALIGN, bInP ); }
GetParaGrid(sal_Bool bInP) const273 inline const SvxParaGridItem &SwFmt::GetParaGrid(sal_Bool bInP) const
274     {   return (const SvxParaGridItem&)aSet.Get( RES_PARATR_SNAPTOGRID, bInP ); }
GetParaConnectBorder(sal_Bool bInP) const275 inline const SwParaConnectBorderItem &SwFmt::GetParaConnectBorder(sal_Bool bInP) const
276     {   return (const SwParaConnectBorderItem&)aSet.Get( RES_PARATR_CONNECT_BORDER, bInP ); }
277 
278 #endif
279