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