Update ooo320-m1
[ooovba.git] / sw / inc / format.hxx
blob9bb5b1e6b7907d4768de3722001abd86c8c56ae5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: format.hxx,v $
10 * $Revision: 1.32.140.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _FORMAT_HXX
31 #define _FORMAT_HXX
33 #include <tools/solar.h>
34 #include "swdllapi.h"
35 #include <errhdl.hxx> // fuer ASSERT
36 #include <swatrset.hxx> // fuer SfxItemPool/-Set, Attr forward decl.
37 #include <calbck.hxx> // fuer SwModify
38 #include <hintids.hxx>
40 class IDocumentSettingAccess;
41 class IDocumentDrawModelAccess;
42 class IDocumentLayoutAccess;
43 class IDocumentTimerAccess;
44 class IDocumentFieldsAccess;
45 class IDocumentChartDataProviderAccess;
46 class SwDoc;
48 class SW_DLLPUBLIC SwFmt : public SwModify
50 // friend class SwSwgReader;
51 // friend class SwSwgWriter;
53 String aFmtName;
54 SwAttrSet aSet;
56 USHORT nWhichId;
57 USHORT nFmtId; // Format-ID fuer Lesen/Schreiben
58 USHORT nPoolFmtId; // Id-fuer "automatich" erzeugte Formate
59 // (ist keine harte Attributierung !!)
60 USHORT nPoolHelpId; // HelpId fuer diese Pool-Vorlage
61 BYTE nPoolHlpFileId; // FilePos ans Doc auf die Vorlagen-Hilfen
62 BOOL bWritten : 1; // TRUE: bereits geschrieben
63 BOOL bAutoFmt : 1; // FALSE: es handelt sich um eine Vorlage
64 // ist dflt immer auf TRUE !
65 BOOL bFmtInDTOR : 1; // TRUE: das Format wird geloscht. Damit man in
66 // der FmtChg-Message das erkennen kann!!!
67 BOOL bAutoUpdateFmt : 1; // TRUE: am Format werden die Attribute
68 // eines kompletten Absatzes gesetzt (UI-seitig!)
70 protected:
71 SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
72 const USHORT* pWhichRanges, SwFmt *pDrvdFrm, USHORT nFmtWhich );
73 SwFmt( SwAttrPool& rPool, const String &rFmtNm, const USHORT* pWhichRanges,
74 SwFmt *pDrvdFrm, USHORT nFmtWhich );
75 SwFmt( const SwFmt& rFmt );
77 public:
78 TYPEINFO(); //Bereits in Basisklasse Client drin.
80 virtual ~SwFmt();
81 SwFmt &operator=(const SwFmt&);
83 // fuer die Abfrage der Writer-Funktionen
84 USHORT Which() const { return nWhichId; }
86 virtual void Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue );
87 // erfrage vom Format Informationen
88 virtual BOOL GetInfo( SfxPoolItem& ) const;
90 // kopiere Attribute; auch ueber Dokumentgrenzen hinweg
91 void CopyAttrs( const SwFmt&, BOOL bReplace=TRUE );
93 // loesche alle Attribute, die nicht in rFmt stehen
94 void DelDiffs( const SfxItemSet& rSet );
95 void DelDiffs( const SwFmt& rFmt ) { DelDiffs( rFmt.GetAttrSet() ); }
97 // Umhaengen des Formats (0 = Default)
98 BOOL SetDerivedFrom(SwFmt *pDerivedFrom = 0);
100 // Ist bInParents FALSE,
101 // wird nur in diesem Format nach dem Attribut gesucht.
102 inline const SfxPoolItem& GetFmtAttr( USHORT nWhich,
103 BOOL bInParents = TRUE ) const;
104 inline SfxItemState GetItemState( USHORT nWhich, BOOL bSrchInParent = TRUE,
105 const SfxPoolItem **ppItem = 0 ) const;
106 // --> OD 2008-03-03 #refactorlists#
107 // methods renamed and made virtual
108 virtual BOOL SetFmtAttr( const SfxPoolItem& rAttr );
109 virtual BOOL SetFmtAttr( const SfxItemSet& rSet );
110 virtual BOOL ResetFmtAttr( USHORT nWhich1, USHORT nWhich2 = 0 );
111 // <--
113 // --> OD 2007-01-24 #i73790#
114 // Method renamed and made virtual
115 // Nimmt alle Hints aus dem Delta-Array,
116 // liefert die Anzahl der geloeschten Hints
117 virtual USHORT ResetAllFmtAttr();
118 // <--
120 inline SwFmt* DerivedFrom() const { return (SwFmt*)pRegisteredIn; }
121 inline BOOL IsDefault() const { return DerivedFrom() == 0; }
123 inline const String& GetName() const { return aFmtName; }
124 void SetName( const String& rNewName, sal_Bool bBroadcast=sal_False );
125 inline void SetName( const sal_Char* pNewName,
126 sal_Bool bBroadcast=sal_False);
128 // zur Abfrage des Attribute Arrays
129 inline const SwAttrSet& GetAttrSet() const { return aSet; }
131 // Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer
132 // im Zugriff.
133 const SwDoc *GetDoc() const { return aSet.GetDoc(); }
134 SwDoc *GetDoc() { return aSet.GetDoc(); }
136 /** Provides access to the document settings interface
138 const IDocumentSettingAccess* getIDocumentSettingAccess() const;
140 /** Provides access to the document draw model interface
142 const IDocumentDrawModelAccess* getIDocumentDrawModelAccess() const;
143 IDocumentDrawModelAccess* getIDocumentDrawModelAccess();
145 /** Provides access to the document layout interface
147 const IDocumentLayoutAccess* getIDocumentLayoutAccess() const;
148 IDocumentLayoutAccess* getIDocumentLayoutAccess();
150 /** Provides access to the document idle timer interface
152 IDocumentTimerAccess* getIDocumentTimerAccess();
154 /** Provides access to the document idle timer interface
156 IDocumentFieldsAccess* getIDocumentFieldsAccess();
158 /** gives access to the chart data-provider
160 IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess();
162 // erfragen und setzen der Poolvorlagen-Id's
163 USHORT GetPoolFmtId() const { return nPoolFmtId; }
164 void SetPoolFmtId( USHORT nId ) { nPoolFmtId = nId; }
166 // erfragen und setzen der Hilfe-Id's fuer die Document-Vorlagen
167 USHORT GetPoolHelpId() const { return nPoolHelpId; }
168 void SetPoolHelpId( USHORT nId ) { nPoolHelpId = nId; }
169 BYTE GetPoolHlpFileId() const { return nPoolHlpFileId; }
170 void SetPoolHlpFileId( BYTE nId ) { nPoolHlpFileId = nId; }
171 // erfrage die Attribut-Beschreibung, returnt den reingereichten String
172 void GetPresentation( SfxItemPresentation ePres,
173 SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText ) const
174 { aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, rText ); }
175 // Das Format-ID fuer Lesen/Schreiben:
176 void ResetWritten() { bWritten = FALSE; }
178 // Abfragen/Setzen vom AutoFmt-Flag
179 BOOL IsAuto() const { return bAutoFmt; }
180 void SetAuto( BOOL bNew = FALSE ) { bAutoFmt = bNew; }
182 // Abfragen/Setzen vom bAutoUpdateFmt-Flag
183 BOOL IsAutoUpdateFmt() const { return bAutoUpdateFmt; }
184 void SetAutoUpdateFmt( BOOL bNew = TRUE ) { bAutoUpdateFmt = bNew; }
186 BOOL IsFmtInDTOR() const { return bFmtInDTOR; }
188 // GetMethoden: das Bool gibt an, ob nur im Set (FALSE) oder auch in
189 // den Parents gesucht werden soll. Wird nichts gefunden,
190 // wird das deflt. Attribut returnt.
191 // Charakter-Attribute - impl. steht im charatr.hxx
192 // AMA 12.10.94: Umstellung von SwFmt... auf Svx...
193 inline const SvxPostureItem &GetPosture( BOOL = TRUE ) const;
194 inline const SvxWeightItem &GetWeight( BOOL = TRUE ) const;
195 inline const SvxShadowedItem &GetShadowed( BOOL = TRUE ) const;
196 inline const SvxAutoKernItem &GetAutoKern( BOOL = TRUE ) const;
197 inline const SvxWordLineModeItem &GetWordLineMode( BOOL = TRUE ) const;
198 inline const SvxContourItem &GetContour( BOOL = TRUE ) const;
199 inline const SvxKerningItem &GetKerning( BOOL = TRUE ) const;
200 inline const SvxUnderlineItem &GetUnderline( BOOL = TRUE ) const;
201 inline const SvxOverlineItem &GetOverline( BOOL = TRUE ) const;
202 inline const SvxCrossedOutItem &GetCrossedOut( BOOL = TRUE ) const;
203 inline const SvxFontHeightItem &GetSize( BOOL = TRUE ) const;
204 inline const SvxPropSizeItem &GetPropSize( BOOL = TRUE ) const;
205 inline const SvxFontItem &GetFont( BOOL = TRUE ) const;
206 inline const SvxColorItem &GetColor( BOOL = TRUE ) const;
207 inline const SvxCharSetColorItem &GetCharSetColor( BOOL = TRUE ) const;
208 inline const SvxLanguageItem &GetLanguage( BOOL = TRUE ) const;
209 inline const SvxEscapementItem &GetEscapement( BOOL = TRUE ) const;
210 inline const SvxCaseMapItem &GetCaseMap( BOOL = TRUE ) const;
211 inline const SvxNoHyphenItem &GetNoHyphenHere( BOOL = TRUE ) const;
212 inline const SvxBlinkItem &GetBlink( BOOL = TRUE ) const;
213 inline const SvxBrushItem &GetChrBackground( BOOL = TRUE ) const;
215 inline const SvxFontItem &GetCJKFont( BOOL = TRUE ) const;
216 inline const SvxFontHeightItem &GetCJKSize( BOOL = TRUE ) const;
217 inline const SvxLanguageItem &GetCJKLanguage( BOOL = TRUE ) const;
218 inline const SvxPostureItem &GetCJKPosture( BOOL = TRUE ) const;
219 inline const SvxWeightItem &GetCJKWeight( BOOL = TRUE ) const;
220 inline const SvxFontItem &GetCTLFont( BOOL = TRUE ) const;
221 inline const SvxFontHeightItem &GetCTLSize( BOOL = TRUE ) const;
222 inline const SvxLanguageItem &GetCTLLanguage( BOOL = TRUE ) const;
223 inline const SvxPostureItem &GetCTLPosture( BOOL = TRUE ) const;
224 inline const SvxWeightItem &GetCTLWeight( BOOL = TRUE ) const;
225 inline const SfxBoolItem &GetWritingDirection( BOOL = TRUE ) const;
226 inline const SvxEmphasisMarkItem &GetEmphasisMark( BOOL = TRUE ) const;
227 inline const SvxTwoLinesItem &Get2Lines( BOOL = TRUE ) const;
228 inline const SvxCharScaleWidthItem &GetCharScaleW( BOOL = TRUE ) const;
229 inline const SvxCharRotateItem &GetCharRotate( BOOL = TRUE ) const;
230 inline const SvxCharReliefItem &GetCharRelief( BOOL = TRUE ) const;
231 inline const SvxCharHiddenItem &GetCharHidden( BOOL = TRUE ) const;
233 // Frame-Attribute - impl. steht im frmatr.hxx,
234 inline const SwFmtFillOrder &GetFillOrder( BOOL = TRUE ) const;
235 inline const SwFmtFrmSize &GetFrmSize( BOOL = TRUE ) const;
236 inline const SwFmtHeader &GetHeader( BOOL = TRUE ) const;
237 inline const SwFmtFooter &GetFooter( BOOL = TRUE ) const;
238 inline const SwFmtSurround &GetSurround( BOOL = TRUE ) const;
239 inline const SwFmtHoriOrient &GetHoriOrient( BOOL = TRUE ) const;
240 inline const SwFmtAnchor &GetAnchor( BOOL = TRUE ) const;
241 inline const SwFmtCol &GetCol( BOOL = TRUE ) const;
242 inline const SvxPaperBinItem &GetPaperBin( BOOL = TRUE ) const;
243 inline const SvxLRSpaceItem &GetLRSpace( BOOL = TRUE ) const;
244 inline const SvxULSpaceItem &GetULSpace( BOOL = TRUE ) const;
245 inline const SwFmtCntnt &GetCntnt( BOOL = TRUE ) const;
246 inline const SvxPrintItem &GetPrint( BOOL = TRUE ) const;
247 inline const SvxOpaqueItem &GetOpaque( BOOL = TRUE ) const;
248 inline const SvxProtectItem &GetProtect( BOOL = TRUE ) const;
249 inline const SwFmtVertOrient &GetVertOrient( BOOL = TRUE ) const;
250 inline const SvxBoxItem &GetBox( BOOL = TRUE ) const;
251 inline const SvxFmtKeepItem &GetKeep( BOOL = TRUE ) const;
252 inline const SvxBrushItem &GetBackground( BOOL = TRUE ) const;
253 inline const SvxShadowItem &GetShadow( BOOL = TRUE ) const;
254 inline const SwFmtPageDesc &GetPageDesc( BOOL = TRUE ) const;
255 inline const SvxFmtBreakItem &GetBreak( BOOL = TRUE ) const;
256 inline const SvxMacroItem &GetMacro( BOOL = TRUE ) const;
257 inline const SwFmtURL &GetURL( BOOL = TRUE ) const;
258 inline const SwFmtEditInReadonly &GetEditInReadonly( BOOL = TRUE ) const;
259 inline const SwFmtLayoutSplit &GetLayoutSplit( BOOL = TRUE ) const;
260 inline const SwFmtRowSplit &GetRowSplit( BOOL = TRUE ) const;
261 inline const SwFmtChain &GetChain( BOOL = TRUE ) const;
262 inline const SwFmtLineNumber &GetLineNumber( BOOL = TRUE ) const;
263 inline const SwFmtFtnAtTxtEnd &GetFtnAtTxtEnd( BOOL = TRUE ) const;
264 inline const SwFmtEndAtTxtEnd &GetEndAtTxtEnd( BOOL = TRUE ) const;
265 inline const SwFmtNoBalancedColumns &GetBalancedColumns( BOOL = TRUE ) const;
266 inline const SvxFrameDirectionItem &GetFrmDir( BOOL = TRUE ) const;
267 inline const SwTextGridItem &GetTextGrid( BOOL = TRUE ) const;
268 inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( BOOL = TRUE ) const;
269 // OD 18.09.2003 #i18732#
270 inline const SwFmtFollowTextFlow &GetFollowTextFlow(BOOL = TRUE) const;
271 // OD 2004-05-05 #i28701#
272 inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(BOOL = TRUE) const;
274 // Grafik-Attribute - impl. steht im grfatr.hxx
275 inline const SwMirrorGrf &GetMirrorGrf( BOOL = TRUE ) const;
276 inline const SwCropGrf &GetCropGrf( BOOL = TRUE ) const;
277 inline const SwRotationGrf &GetRotationGrf(BOOL = TRUE ) const;
278 inline const SwLuminanceGrf &GetLuminanceGrf(BOOL = TRUE ) const;
279 inline const SwContrastGrf &GetContrastGrf(BOOL = TRUE ) const;
280 inline const SwChannelRGrf &GetChannelRGrf(BOOL = TRUE ) const;
281 inline const SwChannelGGrf &GetChannelGGrf(BOOL = TRUE ) const;
282 inline const SwChannelBGrf &GetChannelBGrf(BOOL = TRUE ) const;
283 inline const SwGammaGrf &GetGammaGrf(BOOL = TRUE ) const;
284 inline const SwInvertGrf &GetInvertGrf(BOOL = TRUE ) const;
285 inline const SwTransparencyGrf &GetTransparencyGrf(BOOL = TRUE ) const;
286 inline const SwDrawModeGrf &GetDrawModeGrf(BOOL = TRUE ) const;
288 // Paragraph-Attribute - impl. steht im paratr.hxx
289 inline const SvxLineSpacingItem &GetLineSpacing( BOOL = TRUE ) const;
290 inline const SvxAdjustItem &GetAdjust( BOOL = TRUE ) const;
291 inline const SvxFmtSplitItem &GetSplit( BOOL = TRUE ) const;
292 inline const SwRegisterItem &GetRegister( BOOL = TRUE ) const;
293 inline const SwNumRuleItem &GetNumRule( BOOL = TRUE ) const;
294 inline const SvxWidowsItem &GetWidows( BOOL = TRUE ) const;
295 inline const SvxOrphansItem &GetOrphans( BOOL = TRUE ) const;
296 inline const SvxTabStopItem &GetTabStops( BOOL = TRUE ) const;
297 inline const SvxHyphenZoneItem &GetHyphenZone( BOOL = TRUE ) const;
298 inline const SwFmtDrop &GetDrop( BOOL = TRUE ) const;
299 inline const SvxScriptSpaceItem &GetScriptSpace(BOOL = TRUE) const;
300 inline const SvxHangingPunctuationItem &GetHangingPunctuation(BOOL = TRUE) const;
301 inline const SvxForbiddenRuleItem &GetForbiddenRule(BOOL = TRUE) const;
302 inline const SvxParaVertAlignItem &GetParaVertAlign(BOOL = TRUE) const;
303 inline const SvxParaGridItem &GetParaGrid(BOOL = TRUE) const;
304 inline const SwParaConnectBorderItem &GetParaConnectBorder(BOOL = TRUE ) const;
306 // TabellenBox-Attribute - impl. steht im cellatr.hxx
307 inline const SwTblBoxNumFormat &GetTblBoxNumFmt( BOOL = TRUE ) const;
308 inline const SwTblBoxFormula &GetTblBoxFormula( BOOL = TRUE ) const;
309 inline const SwTblBoxValue &GetTblBoxValue( BOOL = TRUE ) const;
311 /** SwFmt::IsBackgroundTransparent - for feature #99657#
313 OD 22.08.2002
314 Virtual method to determine, if background of format is transparent.
315 Default implementation returns false. Thus, subclasses have to overload
316 method, if the specific subclass can have a transparent background.
318 @author OD
320 @return false, default implementation
322 virtual sal_Bool IsBackgroundTransparent() const;
324 /** SwFmt::IsShadowTransparent - for feature #99657#
326 OD 22.08.2002
327 Virtual method to determine, if shadow of format is transparent.
328 Default implementation returns false. Thus, subclasses have to overload
329 method, if the specific subclass can have a transparent shadow.
331 @author OD
333 @return false, default implementation
335 virtual sal_Bool IsShadowTransparent() const;
338 // --------------- inline Implementierungen ------------------------
340 inline const SfxPoolItem& SwFmt::GetFmtAttr( USHORT nWhich,
341 BOOL bInParents ) const
343 return aSet.Get( nWhich, bInParents );
346 inline void SwFmt::SetName( const sal_Char* pNewName,
347 sal_Bool bBroadcast )
349 String aTmp( String::CreateFromAscii( pNewName ) );
350 SetName( aTmp, bBroadcast );
353 inline SfxItemState SwFmt::GetItemState( USHORT nWhich, BOOL bSrchInParent,
354 const SfxPoolItem **ppItem ) const
356 return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
359 #undef inline
361 #endif // _FORMAT_HXX