xref: /aoo4110/main/sw/inc/tblafmt.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _TBLAFMT_HXX
24 #define _TBLAFMT_HXX
25 /*************************************************************************
26 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27 
28 JP 20.07.95:
29 
30 	Die akt. Struktur der Autoformatierung darf nicht mehr veraendert werden.
31 	Diese wird durch unterschiedlichen Code vom StartWriter und vom StarCalc
32 	eingelesen/geschrieben.
33 	Sollte sich doch mal eine Aenderung nicht vermeiden lassen, dann auf
34 	jedenfall in beiden Applikationen aendern.
35 
36     The structure of table auto formatting should not changed. It is used
37     by different code of Writer and Calc. If a change is necessary, the
38     source code of both applications must be changed!
39 
40 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41 **************************************************************************/
42 
43 #include <svl/svarray.hxx>
44 #include "hintids.hxx"			//_immmer_ vor den solar-items!
45 #include <svx/algitem.hxx>
46 #include <editeng/fontitem.hxx>
47 #include <editeng/fhgtitem.hxx>
48 #include <editeng/wghtitem.hxx>
49 #include <editeng/postitem.hxx>
50 #include <editeng/udlnitem.hxx>
51 #include <editeng/crsditem.hxx>
52 #ifndef _SVX_CNTRTITEM_HXX //autogen
53 #include <editeng/cntritem.hxx>
54 #endif
55 #include <editeng/shdditem.hxx>
56 #include <editeng/colritem.hxx>
57 #include <editeng/boxitem.hxx>
58 #include <editeng/brshitem.hxx>
59 #include <editeng/adjitem.hxx>
60 #include <svx/rotmodit.hxx>
61 #include <svl/intitem.hxx>
62 #include <editeng/bolnitem.hxx>
63 #include "swdllapi.h"
64 
65 struct SwAfVersions;
66 
67 class SvNumberFormatter;
68 
69 class SwBoxAutoFmt
70 {
71     // common attributes of Calc and Writer
72     // --- from 641 on: CJK and CTL font settings
73     SvxFontItem         aFont;
74     SvxFontHeightItem   aHeight;
75     SvxWeightItem       aWeight;
76     SvxPostureItem      aPosture;
77 
78     SvxFontItem         aCJKFont;
79     SvxFontHeightItem   aCJKHeight;
80     SvxWeightItem       aCJKWeight;
81     SvxPostureItem      aCJKPosture;
82 
83     SvxFontItem         aCTLFont;
84     SvxFontHeightItem   aCTLHeight;
85     SvxWeightItem       aCTLWeight;
86     SvxPostureItem      aCTLPosture;
87 
88 	SvxUnderlineItem	aUnderline;
89 	SvxOverlineItem		aOverline;
90 	SvxCrossedOutItem	aCrossedOut;
91 	SvxContourItem		aContour;
92 	SvxShadowedItem		aShadowed;
93 	SvxColorItem		aColor;
94 	SvxBoxItem			aBox;
95     SvxLineItem         aTLBR;
96     SvxLineItem         aBLTR;
97 	SvxBrushItem		aBackground;
98 
99     // Writer specific
100 	SvxAdjustItem		aAdjust;
101 
102     // Calc specific
103 	SvxHorJustifyItem	aHorJustify;
104 	SvxVerJustifyItem	aVerJustify;
105     SfxBoolItem         aStacked;
106 	SvxMarginItem		aMargin;
107 	SfxBoolItem			aLinebreak;
108 	SfxInt32Item		aRotateAngle;
109 	SvxRotateModeItem	aRotateMode;
110 
111     // number format
112 	String				sNumFmtString;
113 	LanguageType		eSysLanguage, eNumFmtLanguage;
114 
115 public:
116 	SwBoxAutoFmt();
117 	SwBoxAutoFmt( const SwBoxAutoFmt& rNew );
118 	~SwBoxAutoFmt();
119 
120 	int operator==( const SwBoxAutoFmt& rCmp ) const;
121 	SwBoxAutoFmt& operator=( const SwBoxAutoFmt& rNew );
122 
123 	// die Get-Methoden
GetFont() const124 	const SvxFontItem		&GetFont() const		{ return aFont; }
GetHeight() const125 	const SvxFontHeightItem	&GetHeight() const 		{ return aHeight; }
GetWeight() const126 	const SvxWeightItem		&GetWeight() const 		{ return aWeight; }
GetPosture() const127 	const SvxPostureItem	&GetPosture() const 	{ return aPosture; }
GetCJKFont() const128     const SvxFontItem       &GetCJKFont() const     { return aCJKFont; }
GetCJKHeight() const129     const SvxFontHeightItem &GetCJKHeight() const   { return aCJKHeight; }
GetCJKWeight() const130     const SvxWeightItem     &GetCJKWeight() const   { return aCJKWeight; }
GetCJKPosture() const131     const SvxPostureItem    &GetCJKPosture() const  { return aCJKPosture; }
GetCTLFont() const132     const SvxFontItem       &GetCTLFont() const     { return aCTLFont; }
GetCTLHeight() const133     const SvxFontHeightItem &GetCTLHeight() const   { return aCTLHeight; }
GetCTLWeight() const134     const SvxWeightItem     &GetCTLWeight() const   { return aCTLWeight; }
GetCTLPosture() const135     const SvxPostureItem    &GetCTLPosture() const  { return aCTLPosture; }
GetUnderline() const136 	const SvxUnderlineItem	&GetUnderline() const 	{ return aUnderline; }
GetOverline() const137 	const SvxOverlineItem	&GetOverline() const 	{ return aOverline; }
GetCrossedOut() const138 	const SvxCrossedOutItem	&GetCrossedOut() const 	{ return aCrossedOut; }
GetContour() const139 	const SvxContourItem	&GetContour() const 	{ return aContour; }
GetShadowed() const140 	const SvxShadowedItem	&GetShadowed() const 	{ return aShadowed; }
GetColor() const141 	const SvxColorItem		&GetColor() const 		{ return aColor; }
GetAdjust() const142 	const SvxAdjustItem		&GetAdjust() const		{ return aAdjust; }
GetBox() const143 	const SvxBoxItem		&GetBox() const 		{ return aBox; }
GetTLBR() const144     const SvxLineItem       &GetTLBR() const        { return aTLBR; }
GetBLTR() const145     const SvxLineItem       &GetBLTR() const        { return aBLTR; }
GetBackground() const146 	const SvxBrushItem		&GetBackground() const 	{ return aBackground; }
GetValueFormat(String & rFmt,LanguageType & rLng,LanguageType & rSys) const147 	void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const
148 		{ rFmt = sNumFmtString; rLng = eNumFmtLanguage; rSys = eSysLanguage; }
149 
150 	// die SetMethoden
SetFont(const SvxFontItem & rNew)151 	void SetFont( const SvxFontItem& rNew ) 			{ aFont = rNew; }
SetHeight(const SvxFontHeightItem & rNew)152 	void SetHeight( const SvxFontHeightItem& rNew ) 	{ aHeight = rNew; }
SetWeight(const SvxWeightItem & rNew)153 	void SetWeight( const SvxWeightItem& rNew ) 		{ aWeight = rNew; }
SetPosture(const SvxPostureItem & rNew)154 	void SetPosture( const SvxPostureItem& rNew ) 		{ aPosture = rNew; }
SetCJKFont(const SvxFontItem & rNew)155     void SetCJKFont( const SvxFontItem& rNew )          { aCJKFont = rNew; }
SetCJKHeight(const SvxFontHeightItem & rNew)156     void SetCJKHeight( const SvxFontHeightItem& rNew )  { aCJKHeight = rNew; }
SetCJKWeight(const SvxWeightItem & rNew)157     void SetCJKWeight( const SvxWeightItem& rNew )      { aCJKWeight = rNew; }
SetCJKPosture(const SvxPostureItem & rNew)158     void SetCJKPosture( const SvxPostureItem& rNew )    { aCJKPosture = rNew; }
SetCTLFont(const SvxFontItem & rNew)159     void SetCTLFont( const SvxFontItem& rNew )          { aCTLFont = rNew; }
SetCTLHeight(const SvxFontHeightItem & rNew)160     void SetCTLHeight( const SvxFontHeightItem& rNew )  { aCTLHeight = rNew; }
SetCTLWeight(const SvxWeightItem & rNew)161     void SetCTLWeight( const SvxWeightItem& rNew )      { aCTLWeight = rNew; }
SetCTLPosture(const SvxPostureItem & rNew)162     void SetCTLPosture( const SvxPostureItem& rNew )    { aCTLPosture = rNew; }
SetUnderline(const SvxUnderlineItem & rNew)163 	void SetUnderline( const SvxUnderlineItem& rNew ) 	{ aUnderline = rNew; }
SetOverline(const SvxOverlineItem & rNew)164 	void SetOverline( const SvxOverlineItem& rNew ) 	{ aOverline = rNew; }
SetCrossedOut(const SvxCrossedOutItem & rNew)165 	void SetCrossedOut( const SvxCrossedOutItem& rNew )	{ aCrossedOut = rNew; }
SetContour(const SvxContourItem & rNew)166 	void SetContour( const SvxContourItem& rNew ) 		{ aContour = rNew; }
SetShadowed(const SvxShadowedItem & rNew)167 	void SetShadowed( const SvxShadowedItem& rNew ) 	{ aShadowed = rNew; }
SetColor(const SvxColorItem & rNew)168 	void SetColor( const SvxColorItem& rNew ) 			{ aColor = rNew; }
SetAdjust(const SvxAdjustItem & rNew)169 	void SetAdjust( const SvxAdjustItem& rNew )
170 		{
171 			aAdjust.SetAdjust( rNew.GetAdjust() );
172 			aAdjust.SetOneWord( rNew.GetOneWord() );
173 			aAdjust.SetLastBlock( rNew.GetLastBlock() );
174 		}
SetBox(const SvxBoxItem & rNew)175 	void SetBox( const SvxBoxItem& rNew ) 				{ aBox = rNew; }
SetBackground(const SvxBrushItem & rNew)176     void SetBackground( const SvxBrushItem& rNew )      { aBackground = rNew; }
SetValueFormat(const String & rFmt,LanguageType eLng,LanguageType eSys)177 	void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys )
178 		{ sNumFmtString = rFmt; eNumFmtLanguage = eLng; eSysLanguage = eSys; }
179 
180 	sal_Bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer );
181 	sal_Bool Save( SvStream& rStream ) const;
182 	sal_Bool SaveVerionNo( SvStream& rStream ) const;
183 
184 #ifdef READ_OLDVERS
185 	// lade alte Version
186 	sal_Bool LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] );
187 #endif
188 };
189 
190 class SW_DLLPUBLIC SwTableAutoFmt
191 {
192 	friend void _FinitCore();		// zum Zerstoeren des dflt. Pointers
193 	static SwBoxAutoFmt* pDfltBoxAutoFmt;
194 
195 	String aName;
196 	sal_uInt16 nStrResId;
197 
198     // common flags of Calc and Writer
199 	sal_Bool bInclFont : 1;
200 	sal_Bool bInclJustify : 1;
201 	sal_Bool bInclFrame : 1;
202 	sal_Bool bInclBackground : 1;
203 	sal_Bool bInclValueFormat : 1;
204 
205     // Calc specific flags
206 	sal_Bool bInclWidthHeight : 1;
207 
208 	SwBoxAutoFmt* aBoxAutoFmt[ 16 ];
209 
210 public:
211 	SwTableAutoFmt( const String& rName );
212 	SwTableAutoFmt( const SwTableAutoFmt& rNew );
213 	~SwTableAutoFmt();
214 
215 	SwTableAutoFmt& operator=( const SwTableAutoFmt& rNew );
216 
217 	void SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos );
218 	const SwBoxAutoFmt& GetBoxFmt( sal_uInt8 nPos ) const;
219 
SetName(const String & rNew)220 	void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
GetName() const221 	const String& GetName() const { return aName; }
222 
223 	enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
224 	SwBoxAutoFmt& UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
225 								UpdateFlags eFlags, SvNumberFormatter* );
226 	void UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, UpdateFlags eFlags,
227 						SvNumberFormatter* ) const ;
228 
IsFont() const229 	sal_Bool IsFont() const 		{ return bInclFont; }
IsJustify() const230 	sal_Bool IsJustify() const 		{ return bInclJustify; }
IsFrame() const231 	sal_Bool IsFrame() const 		{ return bInclFrame; }
IsBackground() const232 	sal_Bool IsBackground() const	{ return bInclBackground; }
IsValueFormat() const233 	sal_Bool IsValueFormat() const	{ return bInclValueFormat; }
234 
SetFont(const sal_Bool bNew)235 	void SetFont( const sal_Bool bNew )			{ bInclFont = bNew; }
SetJustify(const sal_Bool bNew)236 	void SetJustify( const  sal_Bool bNew )		{ bInclJustify = bNew; }
SetFrame(const sal_Bool bNew)237 	void SetFrame( const sal_Bool bNew )		{ bInclFrame = bNew; }
SetBackground(const sal_Bool bNew)238 	void SetBackground( const sal_Bool bNew )	{ bInclBackground = bNew; }
SetValueFormat(const sal_Bool bNew)239 	void SetValueFormat( const sal_Bool bNew )	{ bInclValueFormat = bNew; }
SetWidthHeight(const sal_Bool bNew)240 	void SetWidthHeight( const sal_Bool bNew )	{ bInclWidthHeight = bNew; }
241 
242 	sal_Bool Load( SvStream& rStream, const SwAfVersions& );
243 	sal_Bool Save( SvStream& rStream ) const;
244 
245 #ifdef READ_OLDVERS
246 	// lade alte Version
247 	sal_Bool LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] );
248 #endif
249 };
250 
251 typedef SwTableAutoFmt* SwTableAutoFmtPtr ;
252 SV_DECL_PTRARR_DEL( _SwTableAutoFmtTbl, SwTableAutoFmtPtr, 1, 5 )
253 
254 class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
255 {
256 	SW_DLLPRIVATE sal_Bool Load( SvStream& rStream );
257 	SW_DLLPRIVATE sal_Bool Save( SvStream& rStream ) const;
258 
259 public:
260 	SwTableAutoFmtTbl();
261 
262 	sal_Bool Load();
263 	sal_Bool Save() const;
264 };
265 
266 #endif
267