LibreOffice Module sw (master)  1
swatrset.hxx
Go to the documentation of this file.
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_SWATRSET_HXX
20 #define INCLUDED_SW_INC_SWATRSET_HXX
21 
22 #include <svl/itemset.hxx>
23 #include <svl/itempool.hxx>
24 #include "swdllapi.h"
25 
26 class SwModify;
27 class SwDoc;
28 class OutputDevice;
30 class SvxPostureItem;
31 class SvxWeightItem;
32 class SvxShadowedItem;
33 class SvxAutoKernItem;
35 class SvxContourItem;
36 class SvxKerningItem;
37 class SvxUnderlineItem;
38 class SvxOverlineItem;
39 class SvxCrossedOutItem;
40 class SvxFontHeightItem;
41 class SvxFontItem;
42 class SvxColorItem;
43 class SvxLanguageItem;
44 class SvxEscapementItem;
45 class SvxCaseMapItem;
46 class SvxNoHyphenItem;
47 class SvxBlinkItem;
49 class SvxTwoLinesItem;
51 class SvxCharRotateItem;
52 class SvxCharReliefItem;
53 class SvxCharHiddenItem;
54 
55 // Frame attributes
56 class SwFormatFillOrder;
57 class SwFormatFrameSize;
58 class SvxPaperBinItem;
59 class SvxLRSpaceItem;
60 class SvxULSpaceItem;
61 class SwFormatContent;
62 class SwFormatHeader;
63 class SwFormatFooter;
64 class SvxPrintItem;
65 class SvxOpaqueItem;
66 class SvxProtectItem;
67 class SwFormatSurround;
68 class SwFormatVertOrient;
69 class SwFormatHoriOrient;
70 class SwFormatAnchor;
71 class SvxBoxItem;
72 class SvxBrushItem;
73 class SvxShadowItem;
74 class SwFormatPageDesc;
75 class SvxFormatBreakItem;
76 class SwFormatCol;
77 class SvxMacroItem;
78 class SvxFormatKeepItem;
79 class SwFormatURL;
80 class SwFormatLineNumber;
83 class SwFormatRowSplit;
84 class SwFormatChain;
93 
94 // Graphic attributes
95 class SwMirrorGrf;
96 class SwCropGrf;
97 class SwRotationGrf;
98 class SwLuminanceGrf;
99 class SwContrastGrf;
100 class SwChannelRGrf;
101 class SwChannelGGrf;
102 class SwChannelBGrf;
103 class SwGammaGrf;
104 class SwInvertGrf;
105 class SwTransparencyGrf;
106 class SwDrawModeGrf;
107 
108 // Paragraph attributes
109 class SvxLineSpacingItem;
110 class SvxAdjustItem;
111 class SvxFormatSplitItem;
112 class SwRegisterItem;
113 class SwNumRuleItem;
114 class SvxWidowsItem;
115 class SvxOrphansItem;
116 class SvxTabStopItem;
117 class SvxHyphenZoneItem;
118 class SwFormatDrop;
119 class SvxScriptSpaceItem;
123 class SvxParaGridItem;
125 
126 // TableBox attributes
127 class SwTableBoxNumFormat;
128 class SwTableBoxFormula;
129 class SwTableBoxValue;
130 
131 namespace vcl {
132  typedef OutputDevice RenderContext;
133 };
134 
135 class SAL_DLLPUBLIC_RTTI SwAttrPool : public SfxItemPool
136 {
137 private:
138  // helpers to add/rmove DrawingLayer ItemPool, used in constructor
139  // and destructor; still isolated to evtl. allow other use later, but
140  // used bz default now to have it instantly as needed for DrawingLayer
141  // FillStyle support
142  void createAndAddSecondaryPools();
143  void removeAndDeleteSecondaryPools();
144 
145  friend void InitCore(); // For creating/deleting of version maps.
146  friend void FinitCore();
147 
148  SwDoc* const m_pDoc;
149 
150 public:
151  SwAttrPool( SwDoc* pDoc );
152 protected:
153  virtual ~SwAttrPool() override;
154 public:
155 
156  SwDoc* GetDoc() { return m_pDoc; }
157  const SwDoc* GetDoc() const { return m_pDoc; }
158 
159 };
160 
162 {
163  // Pointer for Modify-System
164  SwAttrSet *m_pOldSet, *m_pNewSet;
165 
166  // Notification-Callback
167  virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew ) override;
168 
169  void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
170 public:
171  SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
172  SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
173  SwAttrSet( const SwAttrSet& );
174 
175  virtual std::unique_ptr<SfxItemSet> Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const override;
176 
177  bool Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
178  bool Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
179 
180  // Delete an item or a range.
181  sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew );
182  sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
183  SwAttrSet* pOld = nullptr, SwAttrSet* pNew = nullptr );
184 
185  int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
186 
187  void GetPresentation( SfxItemPresentation ePres,
188  MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const;
189 
190  SwAttrPool* GetPool() const { return static_cast<SwAttrPool*>(SfxItemSet::GetPool()); }
191 
192  // Copy attributes, if necessary across documents.
193  void CopyToModify( SwModify& rMod ) const;
194 
195  // Special treatment for some attributes.
196  // Set Modify-pointer (the old pDefinedIn) at the following attributes:
197  // - SwFormatDropCaps
198  // - SwFormatPageDesc
199  // (Is called at insert in formats/nodes.)
200  // Second version is for the SwAttrSet handles of SwContentNode.
201  bool SetModifyAtAttr( const SwModify* pModify );
202 
203  // Document is set at SwAttrPool. Therefore it is always accessible.
204  const SwDoc *GetDoc() const { return GetPool()->GetDoc(); }
205  SwDoc *GetDoc() { return GetPool()->GetDoc(); }
206 
207  // Get methods: bool indicates whether to search only in Set (when false)
208  // or also in parents. If nothing is found then default attribute is returned.
209  // Character attributes. Implementation in charatr.hxx.
210  inline const SvxPostureItem &GetPosture( bool = true ) const;
211  inline const SvxWeightItem &GetWeight( bool = true ) const;
212  inline const SvxShadowedItem &GetShadowed( bool = true ) const;
213  inline const SvxAutoKernItem &GetAutoKern( bool = true ) const;
214  inline const SvxWordLineModeItem &GetWordLineMode( bool = true ) const;
215  inline const SvxContourItem &GetContour( bool = true ) const;
216  inline const SvxKerningItem &GetKerning( bool = true ) const;
217  inline const SvxUnderlineItem &GetUnderline( bool = true ) const;
218  inline const SvxOverlineItem &GetOverline( bool = true ) const;
219  inline const SvxCrossedOutItem &GetCrossedOut( bool = true ) const;
220  inline const SvxFontHeightItem &GetSize( bool = true ) const;
221  inline const SvxFontItem &GetFont( bool = true ) const;
222  inline const SvxColorItem &GetColor( bool = true ) const;
223  inline const SvxLanguageItem &GetLanguage( bool = true ) const;
224  inline const SvxEscapementItem &GetEscapement( bool = true ) const;
225  inline const SvxCaseMapItem &GetCaseMap( bool = true ) const;
226  inline const SvxNoHyphenItem &GetNoHyphenHere( bool = true ) const;
227  inline const SvxBlinkItem &GetBlink( bool = true ) const;
228  inline const SvxFontItem &GetCJKFont( bool = true ) const;
229  inline const SvxFontHeightItem &GetCJKSize( bool = true ) const;
230  inline const SvxLanguageItem &GetCJKLanguage( bool = true ) const;
231  inline const SvxPostureItem &GetCJKPosture( bool = true ) const;
232  inline const SvxWeightItem &GetCJKWeight( bool = true ) const;
233  inline const SvxFontItem &GetCTLFont( bool = true ) const;
234  inline const SvxFontHeightItem &GetCTLSize( bool = true ) const;
235  inline const SvxLanguageItem &GetCTLLanguage( bool = true ) const;
236  inline const SvxPostureItem &GetCTLPosture( bool = true ) const;
237  inline const SvxWeightItem &GetCTLWeight( bool = true ) const;
238  inline const SvxEmphasisMarkItem &GetEmphasisMark( bool = true ) const;
239  inline const SvxTwoLinesItem &Get2Lines( bool = true ) const;
240  inline const SvxCharScaleWidthItem &GetCharScaleW( bool = true ) const;
241  inline const SvxCharRotateItem &GetCharRotate( bool = true ) const;
242  inline const SvxCharReliefItem &GetCharRelief( bool = true ) const;
243  inline const SvxCharHiddenItem &GetCharHidden( bool = true ) const;
244 
245  // Frame attributes. Implementation in frmatr.hxx.
246  inline const SwFormatFillOrder &GetFillOrder( bool = true ) const;
247  inline const SwFormatFrameSize &GetFrameSize( bool = true ) const;
248  inline const SvxPaperBinItem &GetPaperBin( bool = true ) const;
249  inline const SvxLRSpaceItem &GetLRSpace( bool = true ) const;
250  inline const SvxULSpaceItem &GetULSpace( bool = true ) const;
251  inline const SwFormatContent &GetContent( bool = true ) const;
252  inline const SwFormatHeader &GetHeader( bool = true ) const;
253  inline const SwFormatFooter &GetFooter( bool = true ) const;
254  inline const SvxPrintItem &GetPrint( bool = true ) const;
255  inline const SvxOpaqueItem &GetOpaque( bool = true ) const;
256  inline const SvxProtectItem &GetProtect( bool = true ) const;
257  inline const SwFormatSurround &GetSurround( bool = true ) const;
258  inline const SwFormatVertOrient &GetVertOrient( bool = true ) const;
259  inline const SwFormatHoriOrient &GetHoriOrient( bool = true ) const;
260  inline const SwFormatAnchor &GetAnchor( bool = true ) const;
261  inline const SvxBoxItem &GetBox( bool = true ) const;
262  inline const SvxFormatKeepItem &GetKeep( bool = true ) const;
263  inline const SvxBrushItem &GetBackground( bool = true ) const;
264  inline const SvxShadowItem &GetShadow( bool = true ) const;
265  inline const SwFormatPageDesc &GetPageDesc( bool = true ) const;
266  inline const SvxFormatBreakItem &GetBreak( bool = true ) const;
267  inline const SwFormatCol &GetCol( bool = true ) const;
268  inline const SvxMacroItem &GetMacro( bool = true ) const;
269  inline const SwFormatURL &GetURL( bool = true ) const;
270  inline const SwFormatEditInReadonly &GetEditInReadonly( bool = true ) const;
271  inline const SwFormatLayoutSplit &GetLayoutSplit( bool = true ) const;
272  inline const SwFormatRowSplit &GetRowSplit( bool = true ) const;
273  inline const SwFormatChain &GetChain( bool = true ) const;
274  inline const SwFormatLineNumber &GetLineNumber( bool = true ) const;
275  inline const SwFormatFootnoteAtTextEnd &GetFootnoteAtTextEnd( bool = true ) const;
276  inline const SwFormatEndAtTextEnd &GetEndAtTextEnd( bool = true ) const;
277  inline const SwFormatNoBalancedColumns &GetBalancedColumns( bool = true ) const;
278  inline const SvxFrameDirectionItem &GetFrameDir( bool = true ) const;
279  inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( bool = true ) const;
280  inline const SwFormatFollowTextFlow &GetFollowTextFlow(bool = true) const;
281  inline const SwFormatWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(bool = true) const;
282  inline const SdrTextVertAdjustItem& GetTextVertAdjust(bool = true) const;
283 
284  // Graphic attributes - implementation in grfatr.hxx
285  inline const SwMirrorGrf &GetMirrorGrf( bool = true ) const;
286  inline const SwCropGrf &GetCropGrf( bool = true ) const;
287  inline const SwRotationGrf &GetRotationGrf(bool = true ) const;
288  inline const SwLuminanceGrf &GetLuminanceGrf(bool = true ) const;
289  inline const SwContrastGrf &GetContrastGrf(bool = true ) const;
290  inline const SwChannelRGrf &GetChannelRGrf(bool = true ) const;
291  inline const SwChannelGGrf &GetChannelGGrf(bool = true ) const;
292  inline const SwChannelBGrf &GetChannelBGrf(bool = true ) const;
293  inline const SwGammaGrf &GetGammaGrf(bool = true ) const;
294  inline const SwInvertGrf &GetInvertGrf(bool = true ) const;
295  inline const SwTransparencyGrf &GetTransparencyGrf(bool = true ) const;
296  inline const SwDrawModeGrf &GetDrawModeGrf(bool = true ) const;
297 
298  // Paragraph attributes - implementation in paratr.hxx
299  inline const SvxLineSpacingItem &GetLineSpacing( bool = true ) const;
300  inline const SvxAdjustItem &GetAdjust( bool = true ) const;
301  inline const SvxFormatSplitItem &GetSplit( bool = true ) const;
302  inline const SwRegisterItem &GetRegister( bool = true ) const;
303  inline const SwNumRuleItem &GetNumRule( bool = true ) const;
304  inline const SvxWidowsItem &GetWidows( bool = true ) const;
305  inline const SvxOrphansItem &GetOrphans( bool = true ) const;
306  inline const SvxTabStopItem &GetTabStops( bool = true ) const;
307  inline const SvxHyphenZoneItem &GetHyphenZone( bool = true ) const;
308  inline const SwFormatDrop &GetDrop( bool = true ) const;
309  inline const SvxScriptSpaceItem &GetScriptSpace(bool = true) const;
310  inline const SvxHangingPunctuationItem &GetHangingPunctuation(bool = true) const;
311  inline const SvxForbiddenRuleItem &GetForbiddenRule(bool = true) const;
312  inline const SvxParaVertAlignItem &GetParaVertAlign(bool = true) const;
313  inline const SvxParaGridItem &GetParaGrid(bool = true) const;
314  inline const SwParaConnectBorderItem &GetParaConnectBorder(bool = true ) const;
315 
316  // Tablebox attributes - implementation in cellatr.hxx
317  inline const SwTableBoxNumFormat &GetTableBoxNumFormat( bool = true ) const;
318  inline const SwTableBoxFormula &GetTableBoxFormula( bool = true ) const;
319  inline const SwTableBoxValue &GetTableBoxValue( bool = true ) const;
320 };
321 
322 //Helper for filters to find true lineheight of a font
323 SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
324  const SwAttrSet &rSet,
325  const vcl::RenderContext &rOut, sal_Int16 nScript);
326 #endif
327 
328 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwDoc *const m_pDoc
Definition: swatrset.hxx:148
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:402
If text in multi-column sections should be evenly distributed.
Definition: fmtclbl.hxx:28
Definition: doc.hxx:185
SwDoc * GetDoc()
Definition: swatrset.hxx:205
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
void PutChgd(const SfxPoolItem &rI)
Definition: swatrset.hxx:169
static bool Put_BC(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SfxPoolItem &rAttr, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: node.cxx:176
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
virtual void Changed(const SfxPoolItem &rOld, const SfxPoolItem &rNew)
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
SW_DLLPUBLIC long AttrSetToLineHeight(const IDocumentSettingAccess &rIDocumentSettingAccess, const SwAttrSet &rSet, const vcl::RenderContext &rOut, sal_Int16 nScript)
Helper for filters to find true lineheight of a font.
Definition: swfont.cxx:1517
SfxItemPresentation
static sal_uInt16 ClearItem_BC(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, sal_uInt16 nWhich, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: node.cxx:228
void FinitCore()
Definition: init.cxx:665
FlyAnchors.
Definition: fmtanchr.hxx:34
Provides access to settings of a document.
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SfxItemPool * GetPool() const
void InitCore()
Definition: init.cxx:449
void PutDirect(const SfxPoolItem &rItem)
OutputDevice RenderContext
Definition: paintfrm.hxx:29
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
const SwDoc * GetDoc() const
Definition: swatrset.hxx:204
SwAttrSet * m_pOldSet
Definition: swatrset.hxx:164
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
SwDoc * GetDoc()
Definition: swatrset.hxx:156
MapUnit
const SwDoc * GetDoc() const
Definition: swatrset.hxx:157
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps...
Definition: paratr.hxx:50
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:75
sal_Int16 GetCaseMap(sal_Int32 nToken)