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 INCLUDED_SW_INC_PARATR_HXX
20 : #define INCLUDED_SW_INC_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, formatting 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_OVERRIDE(); ///< 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* ) SAL_OVERRIDE;
63 :
64 : public:
65 :
66 : /// "pure virtual methods" of SfxPoolItem
67 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
68 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
69 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
70 : SfxMapUnit eCoreMetric,
71 : SfxMapUnit ePresMetric,
72 : OUString &rText,
73 : const IntlWrapper* pIntl = 0) const SAL_OVERRIDE;
74 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
75 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
76 :
77 0 : inline sal_uInt8 GetLines() const { return nLines; }
78 0 : inline sal_uInt8 &GetLines() { return nLines; }
79 :
80 0 : inline sal_uInt8 GetChars() const { return nChars; }
81 0 : inline sal_uInt8 &GetChars() { return nChars; }
82 :
83 0 : inline sal_Bool GetWholeWord() const { return bWholeWord; }
84 0 : inline sal_uInt8 &GetWholeWord() { return bWholeWord; }
85 :
86 0 : inline sal_uInt16 GetDistance() const { return nDistance; }
87 0 : inline sal_uInt16 &GetDistance() { return nDistance; }
88 :
89 0 : 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 SAL_OVERRIDE;
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 0 : class SwRegisterItem : public SfxBoolItem
102 : {
103 : public:
104 : TYPEINFO_OVERRIDE();
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 SAL_OVERRIDE;
113 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
114 : SfxMapUnit eCoreMetric,
115 : SfxMapUnit ePresMetric,
116 : OUString &rText,
117 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
118 : };
119 :
120 0 : inline SwRegisterItem::SwRegisterItem( const sal_Bool bRegister ) :
121 0 : SfxBoolItem( RES_PARATR_REGISTER, bRegister )
122 0 : {}
123 :
124 : inline SwRegisterItem& SwRegisterItem::operator=(
125 : const SwRegisterItem& rRegister )
126 : {
127 : SetValue( rRegister.GetValue() );
128 : return *this;
129 : }
130 :
131 0 : class SW_DLLPUBLIC SwNumRuleItem : public SfxStringItem
132 : {
133 : public:
134 : TYPEINFO_OVERRIDE();
135 :
136 0 : SwNumRuleItem()
137 0 : : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {}
138 :
139 0 : SwNumRuleItem( const OUString& rRuleName )
140 0 : : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {}
141 :
142 0 : SwNumRuleItem( const SwNumRuleItem& rCpy )
143 0 : : 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 bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
150 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
151 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
152 : SfxMapUnit eCoreMetric,
153 : SfxMapUnit ePresMetric,
154 : OUString &rText,
155 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
156 :
157 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const SAL_OVERRIDE;
158 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) SAL_OVERRIDE;
159 : };
160 :
161 0 : class SwParaConnectBorderItem : public SfxBoolItem
162 : {
163 : public:
164 : TYPEINFO_OVERRIDE();
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 SAL_OVERRIDE;
173 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
174 : SfxMapUnit eCoreMetric,
175 : SfxMapUnit ePresMetric,
176 : OUString &rText,
177 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
178 : };
179 :
180 0 : inline SwParaConnectBorderItem::SwParaConnectBorderItem( const sal_Bool bConnect ) :
181 0 : SfxBoolItem( RES_PARATR_CONNECT_BORDER, bConnect )
182 0 : {}
183 :
184 : inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=(
185 : const SwParaConnectBorderItem& rConnect )
186 : {
187 : SetValue( rConnect.GetValue() );
188 : return *this;
189 : }
190 :
191 : /******************************************************************************
192 : * Implementation of paragraph-attributes methods of SwAttrSet
193 : ******************************************************************************/
194 :
195 0 : inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(sal_Bool bInP) const
196 0 : { return (const SvxLineSpacingItem&)Get( RES_PARATR_LINESPACING,bInP); }
197 0 : inline const SvxAdjustItem &SwAttrSet::GetAdjust(sal_Bool bInP) const
198 0 : { return (const SvxAdjustItem&)Get( RES_PARATR_ADJUST,bInP); }
199 0 : inline const SvxFmtSplitItem &SwAttrSet::GetSplit(sal_Bool bInP) const
200 0 : { return (const SvxFmtSplitItem&)Get( RES_PARATR_SPLIT,bInP); }
201 0 : inline const SwRegisterItem &SwAttrSet::GetRegister(sal_Bool bInP) const
202 0 : { return (const SwRegisterItem&)Get( RES_PARATR_REGISTER,bInP); }
203 0 : inline const SvxWidowsItem &SwAttrSet::GetWidows(sal_Bool bInP) const
204 0 : { return (const SvxWidowsItem&)Get( RES_PARATR_WIDOWS,bInP); }
205 0 : inline const SvxOrphansItem &SwAttrSet::GetOrphans(sal_Bool bInP) const
206 0 : { return (const SvxOrphansItem&)Get( RES_PARATR_ORPHANS,bInP); }
207 0 : inline const SvxTabStopItem &SwAttrSet::GetTabStops(sal_Bool bInP) const
208 0 : { return (const SvxTabStopItem&)Get( RES_PARATR_TABSTOP,bInP); }
209 0 : inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(sal_Bool bInP) const
210 0 : { return (const SvxHyphenZoneItem&)Get(RES_PARATR_HYPHENZONE,bInP); }
211 0 : inline const SwFmtDrop &SwAttrSet::GetDrop(sal_Bool bInP) const
212 0 : { return (const SwFmtDrop&)Get(RES_PARATR_DROP,bInP); }
213 0 : inline const SwNumRuleItem &SwAttrSet::GetNumRule(sal_Bool bInP) const
214 0 : { return (const SwNumRuleItem&)Get(RES_PARATR_NUMRULE,bInP); }
215 0 : inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(sal_Bool bInP) const
216 0 : { return (const SvxScriptSpaceItem&)Get(RES_PARATR_SCRIPTSPACE,bInP); }
217 0 : inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(sal_Bool bInP) const
218 0 : { return (const SvxHangingPunctuationItem&)Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
219 0 : inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(sal_Bool bInP) const
220 0 : { return (const SvxForbiddenRuleItem&)Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
221 0 : inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(sal_Bool bInP) const
222 0 : { return (const SvxParaVertAlignItem&)Get( RES_PARATR_VERTALIGN, bInP ); }
223 0 : inline const SvxParaGridItem &SwAttrSet::GetParaGrid(sal_Bool bInP) const
224 0 : { return (const SvxParaGridItem&)Get( RES_PARATR_SNAPTOGRID, bInP ); }
225 0 : inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(sal_Bool bInP) const
226 0 : { return (const SwParaConnectBorderItem&)Get( RES_PARATR_CONNECT_BORDER, bInP ); }
227 :
228 : /******************************************************************************
229 : * Implementation of paragraph-attributes methods of SwFmt
230 : ******************************************************************************/
231 :
232 0 : inline const SvxLineSpacingItem &SwFmt::GetLineSpacing(sal_Bool bInP) const
233 0 : { return aSet.GetLineSpacing(bInP); }
234 : inline const SvxAdjustItem &SwFmt::GetAdjust(sal_Bool bInP) const
235 : { return aSet.GetAdjust(bInP); }
236 : inline const SvxFmtSplitItem &SwFmt::GetSplit(sal_Bool bInP) const
237 : { return aSet.GetSplit(bInP); }
238 : inline const SwRegisterItem &SwFmt::GetRegister(sal_Bool bInP) const
239 : { return aSet.GetRegister(bInP); }
240 : inline const SvxWidowsItem &SwFmt::GetWidows(sal_Bool bInP) const
241 : { return aSet.GetWidows(bInP); }
242 : inline const SvxOrphansItem &SwFmt::GetOrphans(sal_Bool bInP) const
243 : { return aSet.GetOrphans(bInP); }
244 0 : inline const SvxTabStopItem &SwFmt::GetTabStops(sal_Bool bInP) const
245 0 : { return aSet.GetTabStops(bInP); }
246 : inline const SvxHyphenZoneItem &SwFmt::GetHyphenZone(sal_Bool bInP) const
247 : { return aSet.GetHyphenZone(bInP); }
248 0 : inline const SwFmtDrop &SwFmt::GetDrop(sal_Bool bInP) const
249 0 : { return aSet.GetDrop(bInP); }
250 0 : inline const SwNumRuleItem &SwFmt::GetNumRule(sal_Bool bInP) const
251 0 : { return aSet.GetNumRule(bInP); }
252 : inline const SvxScriptSpaceItem& SwFmt::GetScriptSpace(sal_Bool bInP) const
253 : { return aSet.GetScriptSpace(bInP) ; }
254 : inline const SvxHangingPunctuationItem &SwFmt::GetHangingPunctuation(sal_Bool bInP) const
255 : { return aSet.GetHangingPunctuation(bInP) ; }
256 : inline const SvxForbiddenRuleItem &SwFmt::GetForbiddenRule(sal_Bool bInP) const
257 : { return (const SvxForbiddenRuleItem&)aSet.Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
258 : inline const SvxParaVertAlignItem &SwFmt::GetParaVertAlign(sal_Bool bInP) const
259 : { return (const SvxParaVertAlignItem&)aSet.Get( RES_PARATR_VERTALIGN, bInP ); }
260 : inline const SvxParaGridItem &SwFmt::GetParaGrid(sal_Bool bInP) const
261 : { return (const SvxParaGridItem&)aSet.Get( RES_PARATR_SNAPTOGRID, bInP ); }
262 : inline const SwParaConnectBorderItem &SwFmt::GetParaConnectBorder(sal_Bool bInP) const
263 : { return (const SwParaConnectBorderItem&)aSet.Get( RES_PARATR_CONNECT_BORDER, bInP ); }
264 :
265 : #endif
266 :
267 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|