Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef _PARATR_HXX
20 : #define _PARATR_HXX
21 : #include <svl/eitem.hxx>
22 : #include <svl/stritem.hxx>
23 : #include "swdllapi.h"
24 : #include <hintids.hxx>
25 : #include <calbck.hxx>
26 : #include <swatrset.hxx>
27 : #include <format.hxx>
28 : #include <swtypes.hxx>
29 : #include <editeng/adjustitem.hxx>
30 :
31 : class SwCharFmt;
32 : class IntlWrapper;
33 :
34 : #define DROP_WHOLEWORD ((sal_uInt16)0x0001)
35 :
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
41 : {
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.
49 : public:
50 : TYPEINFO(); ///< Already in base class SwClient.
51 :
52 : SwFmtDrop();
53 : virtual ~SwFmtDrop();
54 :
55 : // @@@ public copy ctor, but no copy assignment?
56 : SwFmtDrop( const SwFmtDrop & );
57 : private:
58 : // @@@ public copy ctor, but no copy assignment?
59 : SwFmtDrop & operator= (const SwFmtDrop &);
60 :
61 : protected:
62 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
63 :
64 : public:
65 :
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,
72 : OUString &rText,
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 );
76 :
77 25673 : inline sal_uInt8 GetLines() const { return nLines; }
78 0 : inline sal_uInt8 &GetLines() { return nLines; }
79 :
80 19989 : inline sal_uInt8 GetChars() const { return nChars; }
81 0 : inline sal_uInt8 &GetChars() { return nChars; }
82 :
83 19989 : inline sal_Bool GetWholeWord() const { return bWholeWord; }
84 0 : inline sal_uInt8 &GetWholeWord() { return bWholeWord; }
85 :
86 17915 : inline sal_uInt16 GetDistance() const { return nDistance; }
87 0 : inline sal_uInt16 &GetDistance() { return nDistance; }
88 :
89 6 : inline const SwCharFmt *GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
90 0 : inline SwCharFmt *GetCharFmt() { return (SwCharFmt*)GetRegisteredIn(); }
91 : void SetCharFmt( SwCharFmt *pNew );
92 : /// Get information from Client.
93 : virtual bool GetInfo( SfxPoolItem& ) const;
94 :
95 : /// Get and set Modify pointer.
96 0 : inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
97 0 : inline void ChgDefinedIn( const SwModify* pNew )
98 0 : { pDefinedIn = (SwModify*)pNew; }
99 : };
100 :
101 13260 : class SwRegisterItem : public SfxBoolItem
102 : {
103 : public:
104 : TYPEINFO();
105 :
106 : inline SwRegisterItem( const sal_Bool bRegister = sal_False );
107 :
108 : /// @@@ public copy assignment, but no copy ctor?
109 : inline SwRegisterItem& operator=( const SwRegisterItem& rRegister );
110 :
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,
116 : OUString &rText,
117 : const IntlWrapper* pIntl = 0 ) const;
118 : };
119 :
120 2184 : inline SwRegisterItem::SwRegisterItem( const sal_Bool bRegister ) :
121 2184 : SfxBoolItem( RES_PARATR_REGISTER, bRegister )
122 2184 : {}
123 :
124 : inline SwRegisterItem& SwRegisterItem::operator=(
125 : const SwRegisterItem& rRegister )
126 : {
127 : SetValue( rRegister.GetValue() );
128 : return *this;
129 : }
130 :
131 1798 : class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem
132 : {
133 : public:
134 : TYPEINFO();
135 :
136 29 : SwNumRuleItem()
137 29 : : SfxStringItem( RES_PARATR_NUMRULE, aEmptyStr ) {}
138 :
139 594 : SwNumRuleItem( const String& rRuleName )
140 594 : : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
141 :
142 571 : SwNumRuleItem( const SwNumRuleItem& rCpy )
143 571 : : SfxStringItem( RES_PARATR_NUMRULE, rCpy.GetValue() ) {}
144 :
145 0 : SwNumRuleItem& operator=( const SwNumRuleItem& rCpy )
146 0 : { SetValue( rCpy.GetValue() ); return *this; }
147 :
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,
154 : OUString &rText,
155 : const IntlWrapper* pIntl = 0 ) const;
156 :
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 );
159 : };
160 :
161 73 : class SwParaConnectBorderItem : public SfxBoolItem
162 : {
163 : public:
164 : TYPEINFO();
165 :
166 : inline SwParaConnectBorderItem( const sal_Bool bConnect = sal_True );
167 :
168 : /// @@@ public copy assignment, but no copy ctor?
169 : inline SwParaConnectBorderItem& operator=( const SwParaConnectBorderItem& rConnect );
170 :
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,
176 : OUString &rText,
177 : const IntlWrapper* pIntl = 0 ) const;
178 : };
179 :
180 34 : inline SwParaConnectBorderItem::SwParaConnectBorderItem( const sal_Bool bConnect ) :
181 34 : SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect )
182 34 : {}
183 :
184 : inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=(
185 : const SwParaConnectBorderItem& rConnect )
186 : {
187 : SetValue( rConnect.GetValue() );
188 : return *this;
189 : }
190 :
191 :
192 :
193 : /******************************************************************************
194 : * Implementation of paragraph-attributes methods of SwAttrSet
195 : ******************************************************************************/
196 :
197 71663 : inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(sal_Bool bInP) const
198 71663 : { return (const SvxLineSpacingItem&)Get( RES_PARATR_LINESPACING,bInP); }
199 75635 : inline const SvxAdjustItem &SwAttrSet::GetAdjust(sal_Bool bInP) const
200 75635 : { return (const SvxAdjustItem&)Get( RES_PARATR_ADJUST,bInP); }
201 5748 : inline const SvxFmtSplitItem &SwAttrSet::GetSplit(sal_Bool bInP) const
202 5748 : { return (const SvxFmtSplitItem&)Get( RES_PARATR_SPLIT,bInP); }
203 53925 : inline const SwRegisterItem &SwAttrSet::GetRegister(sal_Bool bInP) const
204 53925 : { return (const SwRegisterItem&)Get( RES_PARATR_REGISTER,bInP); }
205 806 : inline const SvxWidowsItem &SwAttrSet::GetWidows(sal_Bool bInP) const
206 806 : { return (const SvxWidowsItem&)Get( RES_PARATR_WIDOWS,bInP); }
207 5666 : inline const SvxOrphansItem &SwAttrSet::GetOrphans(sal_Bool bInP) const
208 5666 : { return (const SvxOrphansItem&)Get( RES_PARATR_ORPHANS,bInP); }
209 48573 : inline const SvxTabStopItem &SwAttrSet::GetTabStops(sal_Bool bInP) const
210 48573 : { return (const SvxTabStopItem&)Get( RES_PARATR_TABSTOP,bInP); }
211 15196 : inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(sal_Bool bInP) const
212 15196 : { return (const SvxHyphenZoneItem&)Get(RES_PARATR_HYPHENZONE,bInP); }
213 8380 : inline const SwFmtDrop &SwAttrSet::GetDrop(sal_Bool bInP) const
214 8380 : { return (const SwFmtDrop&)Get(RES_PARATR_DROP,bInP); }
215 1898 : inline const SwNumRuleItem &SwAttrSet::GetNumRule(sal_Bool bInP) const
216 1898 : { return (const SwNumRuleItem&)Get(RES_PARATR_NUMRULE,bInP); }
217 7758 : inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(sal_Bool bInP) const
218 7758 : { return (const SvxScriptSpaceItem&)Get(RES_PARATR_SCRIPTSPACE,bInP); }
219 7758 : inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(sal_Bool bInP) const
220 7758 : { return (const SvxHangingPunctuationItem&)Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
221 7758 : inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(sal_Bool bInP) const
222 7758 : { return (const SvxForbiddenRuleItem&)Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
223 48573 : inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(sal_Bool bInP) const
224 48573 : { return (const SvxParaVertAlignItem&)Get( RES_PARATR_VERTALIGN, bInP ); }
225 57846 : inline const SvxParaGridItem &SwAttrSet::GetParaGrid(sal_Bool bInP) const
226 57846 : { return (const SvxParaGridItem&)Get( RES_PARATR_SNAPTOGRID, bInP ); }
227 8305 : inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(sal_Bool bInP) const
228 8305 : { return (const SwParaConnectBorderItem&)Get( RES_PARATR_CONNECT_BORDER, bInP ); }
229 :
230 : /******************************************************************************
231 : * Implementation of paragraph-attributes methods of SwFmt
232 : ******************************************************************************/
233 :
234 0 : inline const SvxLineSpacingItem &SwFmt::GetLineSpacing(sal_Bool bInP) const
235 0 : { 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 0 : inline const SvxTabStopItem &SwFmt::GetTabStops(sal_Bool bInP) const
247 0 : { return aSet.GetTabStops(bInP); }
248 : inline const SvxHyphenZoneItem &SwFmt::GetHyphenZone(sal_Bool bInP) const
249 : { return aSet.GetHyphenZone(bInP); }
250 0 : inline const SwFmtDrop &SwFmt::GetDrop(sal_Bool bInP) const
251 0 : { return aSet.GetDrop(bInP); }
252 1898 : inline const SwNumRuleItem &SwFmt::GetNumRule(sal_Bool bInP) const
253 1898 : { 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 ); }
266 :
267 : #endif
268 :
269 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|