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