fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sw / inc / format.hxx
blobbf565f4dde6e7c426fbf78b0d4eee42a05ca80e0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef _FORMAT_HXX
20 #define _FORMAT_HXX
22 #include <tools/solar.h>
23 #include "swdllapi.h"
24 #include <swatrset.hxx> ///< For SfxItemPool/-Set, Attr forward decl.
25 #include <calbck.hxx> ///< For SwModify.
26 #include <hintids.hxx>
28 class IDocumentSettingAccess;
29 class IDocumentDrawModelAccess;
30 class IDocumentLayoutAccess;
31 class IDocumentTimerAccess;
32 class IDocumentFieldsAccess;
33 class IDocumentChartDataProviderAccess;
34 class SwDoc;
36 /// Base class for various Writer styles.
37 class SW_DLLPUBLIC SwFmt : public SwModify
39 String aFmtName;
40 SwAttrSet aSet;
42 sal_uInt16 nWhichId;
43 sal_uInt16 nFmtId; ///< Format-ID for reading / writing.
44 sal_uInt16 nPoolFmtId; /**< Id for "automatically" created formats.
45 (is not hard attribution!!!) */
46 sal_uInt16 nPoolHelpId; ///< HelpId for this Pool-style.
47 sal_uInt8 nPoolHlpFileId; ///< FilePos to Doc to these style helps.
48 sal_Bool bWritten : 1; ///< TRUE: already written.
49 bool bAutoFmt : 1; /**< FALSE: it is a template.
50 default is true! */
51 sal_Bool bFmtInDTOR : 1; /**< TRUE: Format becomes deleted. In order to be able
52 to recognize this in FmtChg-message!! */
53 sal_Bool bAutoUpdateFmt : 1;/**< TRUE: Set attributes of a whole paragraph
54 at format (UI-side!). */
55 bool bHidden : 1;
57 protected:
58 SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
59 const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich );
60 SwFmt( SwAttrPool& rPool, const String &rFmtNm, const sal_uInt16* pWhichRanges,
61 SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich );
62 SwFmt( const SwFmt& rFmt );
63 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
65 public:
66 TYPEINFO(); ///< Already in base class Client.
68 virtual ~SwFmt();
69 SwFmt &operator=(const SwFmt&);
71 /// for Querying of Writer-functions.
72 sal_uInt16 Which() const { return nWhichId; }
75 /// Query format information.
76 virtual bool GetInfo( SfxPoolItem& ) const;
78 /// Copy attributes even among documents.
79 void CopyAttrs( const SwFmt&, sal_Bool bReplace=sal_True );
81 /// Delete all attributes that are not in rFmt.
82 void DelDiffs( const SfxItemSet& rSet );
83 void DelDiffs( const SwFmt& rFmt ) { DelDiffs( rFmt.GetAttrSet() ); }
85 /// 0 is Default.
86 sal_Bool SetDerivedFrom(SwFmt *pDerivedFrom = 0);
88 /// If bInParents is FALSE, search only in this format for attribute.
89 inline const SfxPoolItem& GetFmtAttr( sal_uInt16 nWhich,
90 sal_Bool bInParents = sal_True ) const;
91 inline SfxItemState GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent = sal_True,
92 const SfxPoolItem **ppItem = 0 ) const;
93 virtual bool SetFmtAttr( const SfxPoolItem& rAttr );
94 virtual bool SetFmtAttr( const SfxItemSet& rSet );
95 virtual bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
97 /** Takes all hints from Delta-Array,
98 @return count of deleted hints. */
99 virtual sal_uInt16 ResetAllFmtAttr();
101 inline SwFmt* DerivedFrom() const { return (SwFmt*)GetRegisteredIn(); }
102 inline sal_Bool IsDefault() const { return DerivedFrom() == 0; }
104 inline const String& GetName() const { return aFmtName; }
105 void SetName( const String& rNewName, sal_Bool bBroadcast=sal_False );
106 inline void SetName( const sal_Char* pNewName,
107 sal_Bool bBroadcast=sal_False);
109 /// For querying the attribute array.
110 inline const SwAttrSet& GetAttrSet() const { return aSet; }
112 /** Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer
113 im Zugriff. */
114 const SwDoc *GetDoc() const { return aSet.GetDoc(); }
115 SwDoc *GetDoc() { return aSet.GetDoc(); }
117 /// Provides access to the document settings interface.
118 const IDocumentSettingAccess* getIDocumentSettingAccess() const;
120 /// Provides access to the document draw model interface.
121 const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
122 IDocumentDrawModelAccess* getIDocumentDrawModelAccess();
124 /// Provides access to the document layout interface.
125 const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
126 IDocumentLayoutAccess* getIDocumentLayoutAccess();
128 /// Provides access to the document idle timer interface.
129 IDocumentTimerAccess* getIDocumentTimerAccess();
131 /// Provides access to the document idle timer interface.
132 IDocumentFieldsAccess* getIDocumentFieldsAccess();
134 /// Gives access to the chart data-provider.
135 IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess();
137 /// Get and set Pool style IDs.
138 sal_uInt16 GetPoolFmtId() const { return nPoolFmtId; }
139 void SetPoolFmtId( sal_uInt16 nId ) { nPoolFmtId = nId; }
141 /// Get and set Help-IDs for document templates.
142 sal_uInt16 GetPoolHelpId() const { return nPoolHelpId; }
143 void SetPoolHelpId( sal_uInt16 nId ) { nPoolHelpId = nId; }
144 sal_uInt8 GetPoolHlpFileId() const { return nPoolHlpFileId; }
145 void SetPoolHlpFileId( sal_uInt8 nId ) { nPoolHlpFileId = nId; }
147 /// Get attribute-description. Returns passed string.
148 void GetPresentation( SfxItemPresentation ePres,
149 SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, OUString &rText ) const
150 { aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, rText ); }
152 /// Format-ID for reading/writing:
153 void ResetWritten() { bWritten = sal_False; }
155 /// Query / set AutoFmt-flag.
156 bool IsAuto() const { return bAutoFmt; }
157 void SetAuto( bool bNew = false ) { bAutoFmt = bNew; }
159 bool IsHidden() const { return bHidden; }
160 void SetHidden( bool bValue = false ) { bHidden = bValue; }
162 /// Query / set bAutoUpdateFmt-flag.
163 sal_Bool IsAutoUpdateFmt() const { return bAutoUpdateFmt; }
164 void SetAutoUpdateFmt( sal_Bool bNew = sal_True ) { bAutoUpdateFmt = bNew; }
166 sal_Bool IsFmtInDTOR() const { return bFmtInDTOR; }
168 /** GetMethods: Bool indicates whether to search only in Set (FALSE)
169 or also in Parents.
170 If nothing is found the defaulted attribute is returned. */
172 /// Character-attributes - implemented in charatr.hxx
173 inline const SvxPostureItem &GetPosture( sal_Bool = sal_True ) const;
174 inline const SvxWeightItem &GetWeight( sal_Bool = sal_True ) const;
175 inline const SvxShadowedItem &GetShadowed( sal_Bool = sal_True ) const;
176 inline const SvxAutoKernItem &GetAutoKern( sal_Bool = sal_True ) const;
177 inline const SvxWordLineModeItem &GetWordLineMode( sal_Bool = sal_True ) const;
178 inline const SvxContourItem &GetContour( sal_Bool = sal_True ) const;
179 inline const SvxKerningItem &GetKerning( sal_Bool = sal_True ) const;
180 inline const SvxUnderlineItem &GetUnderline( sal_Bool = sal_True ) const;
181 inline const SvxOverlineItem &GetOverline( sal_Bool = sal_True ) const;
182 inline const SvxCrossedOutItem &GetCrossedOut( sal_Bool = sal_True ) const;
183 inline const SvxFontHeightItem &GetSize( sal_Bool = sal_True ) const;
184 inline const SvxPropSizeItem &GetPropSize( sal_Bool = sal_True ) const;
185 inline const SvxFontItem &GetFont( sal_Bool = sal_True ) const;
186 inline const SvxColorItem &GetColor( sal_Bool = sal_True ) const;
187 inline const SvxCharSetColorItem &GetCharSetColor( sal_Bool = sal_True ) const;
188 inline const SvxLanguageItem &GetLanguage( sal_Bool = sal_True ) const;
189 inline const SvxEscapementItem &GetEscapement( sal_Bool = sal_True ) const;
190 inline const SvxCaseMapItem &GetCaseMap( sal_Bool = sal_True ) const;
191 inline const SvxNoHyphenItem &GetNoHyphenHere( sal_Bool = sal_True ) const;
192 inline const SvxBlinkItem &GetBlink( sal_Bool = sal_True ) const;
193 inline const SvxBrushItem &GetChrBackground( sal_Bool = sal_True ) const;
195 inline const SvxFontItem &GetCJKFont( sal_Bool = sal_True ) const;
196 inline const SvxFontHeightItem &GetCJKSize( sal_Bool = sal_True ) const;
197 inline const SvxLanguageItem &GetCJKLanguage( sal_Bool = sal_True ) const;
198 inline const SvxPostureItem &GetCJKPosture( sal_Bool = sal_True ) const;
199 inline const SvxWeightItem &GetCJKWeight( sal_Bool = sal_True ) const;
200 inline const SvxFontItem &GetCTLFont( sal_Bool = sal_True ) const;
201 inline const SvxFontHeightItem &GetCTLSize( sal_Bool = sal_True ) const;
202 inline const SvxLanguageItem &GetCTLLanguage( sal_Bool = sal_True ) const;
203 inline const SvxPostureItem &GetCTLPosture( sal_Bool = sal_True ) const;
204 inline const SvxWeightItem &GetCTLWeight( sal_Bool = sal_True ) const;
205 inline const SfxBoolItem &GetWritingDirection( sal_Bool = sal_True ) const;
206 inline const SvxEmphasisMarkItem &GetEmphasisMark( sal_Bool = sal_True ) const;
207 inline const SvxTwoLinesItem &Get2Lines( sal_Bool = sal_True ) const;
208 inline const SvxCharScaleWidthItem &GetCharScaleW( sal_Bool = sal_True ) const;
209 inline const SvxCharRotateItem &GetCharRotate( sal_Bool = sal_True ) const;
210 inline const SvxCharReliefItem &GetCharRelief( sal_Bool = sal_True ) const;
211 inline const SvxCharHiddenItem &GetCharHidden( sal_Bool = sal_True ) const;
213 /// Frame-attributes - implemented in frmatr.hxx.
214 inline const SwFmtFillOrder &GetFillOrder( sal_Bool = sal_True ) const;
215 inline const SwFmtFrmSize &GetFrmSize( sal_Bool = sal_True ) const;
216 inline const SwFmtHeader &GetHeader( sal_Bool = sal_True ) const;
217 inline const SwFmtFooter &GetFooter( sal_Bool = sal_True ) const;
218 inline const SwFmtSurround &GetSurround( sal_Bool = sal_True ) const;
219 inline const SwFmtHoriOrient &GetHoriOrient( sal_Bool = sal_True ) const;
220 inline const SwFmtAnchor &GetAnchor( sal_Bool = sal_True ) const;
221 inline const SwFmtCol &GetCol( sal_Bool = sal_True ) const;
222 inline const SvxPaperBinItem &GetPaperBin( sal_Bool = sal_True ) const;
223 inline const SvxLRSpaceItem &GetLRSpace( sal_Bool = sal_True ) const;
224 inline const SvxULSpaceItem &GetULSpace( sal_Bool = sal_True ) const;
225 inline const SwFmtCntnt &GetCntnt( sal_Bool = sal_True ) const;
226 inline const SvxPrintItem &GetPrint( sal_Bool = sal_True ) const;
227 inline const SvxOpaqueItem &GetOpaque( sal_Bool = sal_True ) const;
228 inline const SvxProtectItem &GetProtect( sal_Bool = sal_True ) const;
229 inline const SwFmtVertOrient &GetVertOrient( sal_Bool = sal_True ) const;
230 inline const SvxBoxItem &GetBox( sal_Bool = sal_True ) const;
231 inline const SvxFmtKeepItem &GetKeep( sal_Bool = sal_True ) const;
232 inline const SvxBrushItem &GetBackground( sal_Bool = sal_True ) const;
233 inline const SvxShadowItem &GetShadow( sal_Bool = sal_True ) const;
234 inline const SwFmtPageDesc &GetPageDesc( sal_Bool = sal_True ) const;
235 inline const SvxFmtBreakItem &GetBreak( sal_Bool = sal_True ) const;
236 inline const SvxMacroItem &GetMacro( sal_Bool = sal_True ) const;
237 inline const SwFmtURL &GetURL( sal_Bool = sal_True ) const;
238 inline const SwFmtEditInReadonly &GetEditInReadonly( sal_Bool = sal_True ) const;
239 inline const SwFmtLayoutSplit &GetLayoutSplit( sal_Bool = sal_True ) const;
240 inline const SwFmtRowSplit &GetRowSplit( sal_Bool = sal_True ) const;
241 inline const SwFmtChain &GetChain( sal_Bool = sal_True ) const;
242 inline const SwFmtLineNumber &GetLineNumber( sal_Bool = sal_True ) const;
243 inline const SwFmtFtnAtTxtEnd &GetFtnAtTxtEnd( sal_Bool = sal_True ) const;
244 inline const SwFmtEndAtTxtEnd &GetEndAtTxtEnd( sal_Bool = sal_True ) const;
245 inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const;
246 inline const SvxFrameDirectionItem &GetFrmDir( sal_Bool = sal_True ) const;
247 inline const SwTextGridItem &GetTextGrid( sal_Bool = sal_True ) const;
248 inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
249 // #i18732#
250 inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const;
251 // #i28701#
252 inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
254 /// Graphics-attributes - implemented in grfatr.hxx
255 inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const;
256 inline const SwCropGrf &GetCropGrf( sal_Bool = sal_True ) const;
257 inline const SwRotationGrf &GetRotationGrf(sal_Bool = sal_True ) const;
258 inline const SwLuminanceGrf &GetLuminanceGrf(sal_Bool = sal_True ) const;
259 inline const SwContrastGrf &GetContrastGrf(sal_Bool = sal_True ) const;
260 inline const SwChannelRGrf &GetChannelRGrf(sal_Bool = sal_True ) const;
261 inline const SwChannelGGrf &GetChannelGGrf(sal_Bool = sal_True ) const;
262 inline const SwChannelBGrf &GetChannelBGrf(sal_Bool = sal_True ) const;
263 inline const SwGammaGrf &GetGammaGrf(sal_Bool = sal_True ) const;
264 inline const SwInvertGrf &GetInvertGrf(sal_Bool = sal_True ) const;
265 inline const SwTransparencyGrf &GetTransparencyGrf(sal_Bool = sal_True ) const;
266 inline const SwDrawModeGrf &GetDrawModeGrf(sal_Bool = sal_True ) const;
268 /// Paragraph-attributes - implemented in paratr.hxx.
269 inline const SvxLineSpacingItem &GetLineSpacing( sal_Bool = sal_True ) const;
270 inline const SvxAdjustItem &GetAdjust( sal_Bool = sal_True ) const;
271 inline const SvxFmtSplitItem &GetSplit( sal_Bool = sal_True ) const;
272 inline const SwRegisterItem &GetRegister( sal_Bool = sal_True ) const;
273 inline const SwNumRuleItem &GetNumRule( sal_Bool = sal_True ) const;
274 inline const SvxWidowsItem &GetWidows( sal_Bool = sal_True ) const;
275 inline const SvxOrphansItem &GetOrphans( sal_Bool = sal_True ) const;
276 inline const SvxTabStopItem &GetTabStops( sal_Bool = sal_True ) const;
277 inline const SvxHyphenZoneItem &GetHyphenZone( sal_Bool = sal_True ) const;
278 inline const SwFmtDrop &GetDrop( sal_Bool = sal_True ) const;
279 inline const SvxScriptSpaceItem &GetScriptSpace(sal_Bool = sal_True) const;
280 inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const;
281 inline const SvxForbiddenRuleItem &GetForbiddenRule(sal_Bool = sal_True) const;
282 inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const;
283 inline const SvxParaGridItem &GetParaGrid(sal_Bool = sal_True) const;
284 inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const;
286 /// TableBox attributes - implemented in cellatr.hxx.
287 inline const SwTblBoxNumFormat &GetTblBoxNumFmt( sal_Bool = sal_True ) const;
288 inline const SwTblBoxFormula &GetTblBoxFormula( sal_Bool = sal_True ) const;
289 inline const SwTblBoxValue &GetTblBoxValue( sal_Bool = sal_True ) const;
291 /** SwFmt::IsBackgroundTransparent
293 Virtual method to determine, if background of format is transparent.
294 Default implementation returns false. Thus, subclasses have to overload
295 method, if the specific subclass can have a transparent background.
297 @author OD
299 @return false, default implementation
301 virtual sal_Bool IsBackgroundTransparent() const;
303 /** SwFmt::IsShadowTransparent
305 Virtual method to determine, if shadow of format is transparent.
306 Default implementation returns false. Thus, subclasses have to overload
307 method, if the specific subclass can have a transparent shadow.
309 @author OD
311 @return false, default implementation
313 virtual sal_Bool IsShadowTransparent() const;
316 // --------------- inline Implementations ------------------------
318 inline const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich,
319 sal_Bool bInParents ) const
321 return aSet.Get( nWhich, bInParents );
324 inline void SwFmt::SetName( const sal_Char* pNewName,
325 sal_Bool bBroadcast )
327 SetName(OUString::createFromAscii(pNewName), bBroadcast);
330 inline SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent,
331 const SfxPoolItem **ppItem ) const
333 return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
336 #undef inline
338 #endif // _FORMAT_HXX
340 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */