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