update dev300-m57
[ooovba.git] / sw / inc / tblafmt.hxx
blob100ca2d9daea3e8338b6e045ed74d00770ca4c32
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tblafmt.hxx,v $
10 * $Revision: 1.9.210.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 _TBLAFMT_HXX
31 #define _TBLAFMT_HXX
32 /*************************************************************************
33 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35 JP 20.07.95:
37 Die akt. Struktur der Autoformatierung darf nicht mehr veraendert werden.
38 Diese wird durch unterschiedlichen Code vom StartWriter und vom StarCalc
39 eingelesen/geschrieben.
40 Sollte sich doch mal eine Aenderung nicht vermeiden lassen, dann auf
41 jedenfall in beiden Applikationen aendern.
43 The structure of table auto formatting should not changed. It is used
44 by different code of Writer and Calc. If a change is necessary, the
45 source code of both applications must be changed!
47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
48 **************************************************************************/
50 #include <svtools/svarray.hxx>
51 #include "hintids.hxx" //_immmer_ vor den solar-items!
52 #include <svx/algitem.hxx>
53 #include <svx/fontitem.hxx>
54 #include <svx/fhgtitem.hxx>
55 #include <svx/wghtitem.hxx>
56 #include <svx/postitem.hxx>
57 #include <svx/udlnitem.hxx>
58 #include <svx/crsditem.hxx>
59 #ifndef _SVX_CNTRTITEM_HXX //autogen
60 #include <svx/cntritem.hxx>
61 #endif
62 #include <svx/shdditem.hxx>
63 #include <svx/colritem.hxx>
64 #include <svx/boxitem.hxx>
65 #include <svx/brshitem.hxx>
66 #include <svx/adjitem.hxx>
67 #include <svx/rotmodit.hxx>
68 #include <svtools/intitem.hxx>
69 #include <svx/bolnitem.hxx>
70 #include "swdllapi.h"
72 struct SwAfVersions;
74 class SvNumberFormatter;
76 class SwBoxAutoFmt
78 // common attributes of Calc and Writer
79 // --- from 641 on: CJK and CTL font settings
80 SvxFontItem aFont;
81 SvxFontHeightItem aHeight;
82 SvxWeightItem aWeight;
83 SvxPostureItem aPosture;
85 SvxFontItem aCJKFont;
86 SvxFontHeightItem aCJKHeight;
87 SvxWeightItem aCJKWeight;
88 SvxPostureItem aCJKPosture;
90 SvxFontItem aCTLFont;
91 SvxFontHeightItem aCTLHeight;
92 SvxWeightItem aCTLWeight;
93 SvxPostureItem aCTLPosture;
95 SvxUnderlineItem aUnderline;
96 SvxOverlineItem aOverline;
97 SvxCrossedOutItem aCrossedOut;
98 SvxContourItem aContour;
99 SvxShadowedItem aShadowed;
100 SvxColorItem aColor;
101 SvxBoxItem aBox;
102 SvxLineItem aTLBR;
103 SvxLineItem aBLTR;
104 SvxBrushItem aBackground;
106 // Writer specific
107 SvxAdjustItem aAdjust;
109 // Calc specific
110 SvxHorJustifyItem aHorJustify;
111 SvxVerJustifyItem aVerJustify;
112 SfxBoolItem aStacked;
113 SvxMarginItem aMargin;
114 SfxBoolItem aLinebreak;
115 SfxInt32Item aRotateAngle;
116 SvxRotateModeItem aRotateMode;
118 // number format
119 String sNumFmtString;
120 LanguageType eSysLanguage, eNumFmtLanguage;
122 public:
123 SwBoxAutoFmt();
124 SwBoxAutoFmt( const SwBoxAutoFmt& rNew );
125 ~SwBoxAutoFmt();
127 int operator==( const SwBoxAutoFmt& rCmp ) const;
128 SwBoxAutoFmt& operator=( const SwBoxAutoFmt& rNew );
130 // die Get-Methoden
131 const SvxFontItem &GetFont() const { return aFont; }
132 const SvxFontHeightItem &GetHeight() const { return aHeight; }
133 const SvxWeightItem &GetWeight() const { return aWeight; }
134 const SvxPostureItem &GetPosture() const { return aPosture; }
135 const SvxFontItem &GetCJKFont() const { return aCJKFont; }
136 const SvxFontHeightItem &GetCJKHeight() const { return aCJKHeight; }
137 const SvxWeightItem &GetCJKWeight() const { return aCJKWeight; }
138 const SvxPostureItem &GetCJKPosture() const { return aCJKPosture; }
139 const SvxFontItem &GetCTLFont() const { return aCTLFont; }
140 const SvxFontHeightItem &GetCTLHeight() const { return aCTLHeight; }
141 const SvxWeightItem &GetCTLWeight() const { return aCTLWeight; }
142 const SvxPostureItem &GetCTLPosture() const { return aCTLPosture; }
143 const SvxUnderlineItem &GetUnderline() const { return aUnderline; }
144 const SvxOverlineItem &GetOverline() const { return aOverline; }
145 const SvxCrossedOutItem &GetCrossedOut() const { return aCrossedOut; }
146 const SvxContourItem &GetContour() const { return aContour; }
147 const SvxShadowedItem &GetShadowed() const { return aShadowed; }
148 const SvxColorItem &GetColor() const { return aColor; }
149 const SvxAdjustItem &GetAdjust() const { return aAdjust; }
150 const SvxBoxItem &GetBox() const { return aBox; }
151 const SvxLineItem &GetTLBR() const { return aTLBR; }
152 const SvxLineItem &GetBLTR() const { return aBLTR; }
153 const SvxBrushItem &GetBackground() const { return aBackground; }
154 void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const
155 { rFmt = sNumFmtString; rLng = eNumFmtLanguage; rSys = eSysLanguage; }
157 // die SetMethoden
158 void SetFont( const SvxFontItem& rNew ) { aFont = rNew; }
159 void SetHeight( const SvxFontHeightItem& rNew ) { aHeight = rNew; }
160 void SetWeight( const SvxWeightItem& rNew ) { aWeight = rNew; }
161 void SetPosture( const SvxPostureItem& rNew ) { aPosture = rNew; }
162 void SetCJKFont( const SvxFontItem& rNew ) { aCJKFont = rNew; }
163 void SetCJKHeight( const SvxFontHeightItem& rNew ) { aCJKHeight = rNew; }
164 void SetCJKWeight( const SvxWeightItem& rNew ) { aCJKWeight = rNew; }
165 void SetCJKPosture( const SvxPostureItem& rNew ) { aCJKPosture = rNew; }
166 void SetCTLFont( const SvxFontItem& rNew ) { aCTLFont = rNew; }
167 void SetCTLHeight( const SvxFontHeightItem& rNew ) { aCTLHeight = rNew; }
168 void SetCTLWeight( const SvxWeightItem& rNew ) { aCTLWeight = rNew; }
169 void SetCTLPosture( const SvxPostureItem& rNew ) { aCTLPosture = rNew; }
170 void SetUnderline( const SvxUnderlineItem& rNew ) { aUnderline = rNew; }
171 void SetOverline( const SvxOverlineItem& rNew ) { aOverline = rNew; }
172 void SetCrossedOut( const SvxCrossedOutItem& rNew ) { aCrossedOut = rNew; }
173 void SetContour( const SvxContourItem& rNew ) { aContour = rNew; }
174 void SetShadowed( const SvxShadowedItem& rNew ) { aShadowed = rNew; }
175 void SetColor( const SvxColorItem& rNew ) { aColor = rNew; }
176 void SetAdjust( const SvxAdjustItem& rNew )
178 aAdjust.SetAdjust( rNew.GetAdjust() );
179 aAdjust.SetOneWord( rNew.GetOneWord() );
180 aAdjust.SetLastBlock( rNew.GetLastBlock() );
182 void SetBox( const SvxBoxItem& rNew ) { aBox = rNew; }
183 void SetBackground( const SvxBrushItem& rNew ) { aBackground = rNew; }
184 void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys )
185 { sNumFmtString = rFmt; eNumFmtLanguage = eLng; eSysLanguage = eSys; }
187 BOOL Load( SvStream& rStream, const SwAfVersions& rVersions, USHORT nVer );
188 BOOL Save( SvStream& rStream ) const;
189 BOOL SaveVerionNo( SvStream& rStream ) const;
191 #ifdef READ_OLDVERS
192 // lade alte Version
193 BOOL LoadOld( SvStream& rStream, USHORT aLoadVer[] );
194 #endif
197 class SW_DLLPUBLIC SwTableAutoFmt
199 friend void _FinitCore(); // zum Zerstoeren des dflt. Pointers
200 static SwBoxAutoFmt* pDfltBoxAutoFmt;
202 String aName;
203 USHORT nStrResId;
205 // common flags of Calc and Writer
206 BOOL bInclFont : 1;
207 BOOL bInclJustify : 1;
208 BOOL bInclFrame : 1;
209 BOOL bInclBackground : 1;
210 BOOL bInclValueFormat : 1;
212 // Calc specific flags
213 BOOL bInclWidthHeight : 1;
215 SwBoxAutoFmt* aBoxAutoFmt[ 16 ];
217 public:
218 SwTableAutoFmt( const String& rName );
219 SwTableAutoFmt( const SwTableAutoFmt& rNew );
220 ~SwTableAutoFmt();
222 SwTableAutoFmt& operator=( const SwTableAutoFmt& rNew );
224 void SetBoxFmt( const SwBoxAutoFmt& rNew, BYTE nPos );
225 const SwBoxAutoFmt& GetBoxFmt( BYTE nPos ) const;
227 void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
228 const String& GetName() const { return aName; }
230 enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
231 SwBoxAutoFmt& UpdateFromSet( BYTE nPos, const SfxItemSet& rSet,
232 UpdateFlags eFlags, SvNumberFormatter* );
233 void UpdateToSet( BYTE nPos, SfxItemSet& rSet, UpdateFlags eFlags,
234 SvNumberFormatter* ) const ;
236 BOOL IsFont() const { return bInclFont; }
237 BOOL IsJustify() const { return bInclJustify; }
238 BOOL IsFrame() const { return bInclFrame; }
239 BOOL IsBackground() const { return bInclBackground; }
240 BOOL IsValueFormat() const { return bInclValueFormat; }
242 void SetFont( const BOOL bNew ) { bInclFont = bNew; }
243 void SetJustify( const BOOL bNew ) { bInclJustify = bNew; }
244 void SetFrame( const BOOL bNew ) { bInclFrame = bNew; }
245 void SetBackground( const BOOL bNew ) { bInclBackground = bNew; }
246 void SetValueFormat( const BOOL bNew ) { bInclValueFormat = bNew; }
247 void SetWidthHeight( const BOOL bNew ) { bInclWidthHeight = bNew; }
249 BOOL Load( SvStream& rStream, const SwAfVersions& );
250 BOOL Save( SvStream& rStream ) const;
252 #ifdef READ_OLDVERS
253 // lade alte Version
254 BOOL LoadOld( SvStream& rStream, USHORT aLoadVer[] );
255 #endif
258 typedef SwTableAutoFmt* SwTableAutoFmtPtr ;
259 SV_DECL_PTRARR_DEL( _SwTableAutoFmtTbl, SwTableAutoFmtPtr, 1, 5 )
261 class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
263 SW_DLLPRIVATE BOOL Load( SvStream& rStream );
264 SW_DLLPRIVATE BOOL Save( SvStream& rStream ) const;
266 public:
267 SwTableAutoFmtTbl();
269 BOOL Load();
270 BOOL Save() const;
273 #endif