summaryrefslogtreecommitdiff
path: root/sw/inc/tblafmt.hxx
blob: c0decd5e754cb457a4d1d433e75976000be2ded0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/*************************************************************************
 *
 *  $RCSfile: tblafmt.hxx,v $
 *
 *  $Revision: 1.1.1.1 $
 *
 *  last change: $Author: hr $ $Date: 2000-09-18 17:14:28 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _TBLAFMT_HXX
#define _TBLAFMT_HXX

/*************************************************************************
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

JP 20.07.95:

    Die akt. Struktur der Autoformatierung darf nicht mehr veraendert werden.
    Diese wird durch unterschiedlichen Code vom StartWriter und vom StarCalc
    eingelesen/geschrieben.
    Sollte sich doch mal eine Aenderung nicht vermeiden lassen, dann auf
    jedenfall in beiden Applikationen aendern.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
**************************************************************************/

#ifndef _SVARRAY_HXX //autogen
#include <svtools/svarray.hxx>
#endif

#include "hintids.hxx"          //_immmer_ vor den solar-items!

#define ITEMID_HORJUSTIFY   0
#define ITEMID_VERJUSTIFY   0
#define ITEMID_ORIENTATION  0
#define ITEMID_MARGIN       0

#ifndef _SVX_ALGITEM_HXX //autogen
#include <svx/algitem.hxx>
#endif
#ifndef _SVX_FONTITEM_HXX //autogen
#include <svx/fontitem.hxx>
#endif
#ifndef _SVX_FHGTITEM_HXX //autogen
#include <svx/fhgtitem.hxx>
#endif
#ifndef _SVX_WGHTITEM_HXX //autogen
#include <svx/wghtitem.hxx>
#endif
#ifndef _SVX_POSTITEM_HXX //autogen
#include <svx/postitem.hxx>
#endif
#ifndef _SVX_UDLNITEM_HXX //autogen
#include <svx/udlnitem.hxx>
#endif
#ifndef _SVX_CRSDITEM_HXX //autogen
#include <svx/crsditem.hxx>
#endif
#ifndef _SVX_CNTRTITEM_HXX //autogen
#include <svx/cntritem.hxx>
#endif
#ifndef _SVX_SHDDITEM_HXX //autogen
#include <svx/shdditem.hxx>
#endif
#ifndef _SVX_COLRITEM_HXX //autogen
#include <svx/colritem.hxx>
#endif
#ifndef _SVX_BOXITEM_HXX //autogen
#include <svx/boxitem.hxx>
#endif
#ifndef _SVX_BRSHITEM_HXX //autogen
#include <svx/brshitem.hxx>
#endif
#ifndef _SVX_ADJITEM_HXX //autogen
#include <svx/adjitem.hxx>
#endif
#ifndef _SVX_ROTMODIT_HXX //autogen
#include <svx/rotmodit.hxx>
#endif
#ifndef _SFXINTITEM_HXX //autogen
#include <svtools/intitem.hxx>
#endif

struct SwAfVersions;

class SvNumberFormatter;

class SwBoxAutoFmt
{
    // gemeinsamer Teil von StarCalc und StarWriter
    SvxFontItem         aFont;

    SvxFontHeightItem   aHeight;
    SvxWeightItem       aWeight;
    SvxPostureItem      aPosture;
    SvxUnderlineItem    aUnderline;
    SvxCrossedOutItem   aCrossedOut;
    SvxContourItem      aContour;
    SvxShadowedItem     aShadowed;
    SvxColorItem        aColor;
    SvxBoxItem          aBox;
    SvxBrushItem        aBackground;

    // StarWriter spezifisches
    SvxAdjustItem       aAdjust;

    // StarCalc spezifisches
    SvxHorJustifyItem   aHorJustify;
    SvxVerJustifyItem   aVerJustify;
    SvxOrientationItem  aOrientation;
    SvxMarginItem       aMargin;
    SfxBoolItem         aLinebreak;
    SfxInt32Item        aRotateAngle;
    SvxRotateModeItem   aRotateMode;

        // und als letzes das Zahlenformat fuer die Box
    String              sNumFmtString;
    LanguageType        eSysLanguage, eNumFmtLanguage;

public:
    SwBoxAutoFmt();
    SwBoxAutoFmt( const SwBoxAutoFmt& rNew );
    ~SwBoxAutoFmt();

    int operator==( const SwBoxAutoFmt& rCmp ) const;
    SwBoxAutoFmt& operator=( const SwBoxAutoFmt& rNew );

    // die Get-Methoden
    const SvxFontItem       &GetFont() const        { return aFont; }
    const SvxFontHeightItem &GetHeight() const      { return aHeight; }
    const SvxWeightItem     &GetWeight() const      { return aWeight; }
    const SvxPostureItem    &GetPosture() const     { return aPosture; }
    const SvxUnderlineItem  &GetUnderline() const   { return aUnderline; }
    const SvxCrossedOutItem &GetCrossedOut() const  { return aCrossedOut; }
    const SvxContourItem    &GetContour() const     { return aContour; }
    const SvxShadowedItem   &GetShadowed() const    { return aShadowed; }
    const SvxColorItem      &GetColor() const       { return aColor; }
    const SvxAdjustItem     &GetAdjust() const      { return aAdjust; }
    const SvxBoxItem        &GetBox() const         { return aBox; }
    const SvxBrushItem      &GetBackground() const  { return aBackground; }
    void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const
        { rFmt = sNumFmtString; rLng = eNumFmtLanguage; rSys = eSysLanguage; }

    // die SetMethoden
    void SetFont( const SvxFontItem& rNew )             { aFont = rNew; }
    void SetHeight( const SvxFontHeightItem& rNew )     { aHeight = rNew; }
    void SetWeight( const SvxWeightItem& rNew )         { aWeight = rNew; }
    void SetPosture( const SvxPostureItem& rNew )       { aPosture = rNew; }
    void SetUnderline( const SvxUnderlineItem& rNew )   { aUnderline = rNew; }
    void SetCrossedOut( const SvxCrossedOutItem& rNew ) { aCrossedOut = rNew; }
    void SetContour( const SvxContourItem& rNew )       { aContour = rNew; }
    void SetShadowed( const SvxShadowedItem& rNew )     { aShadowed = rNew; }
    void SetColor( const SvxColorItem& rNew )           { aColor = rNew; }
    void SetAdjust( const SvxAdjustItem& rNew )
        {
            aAdjust.SetAdjust( rNew.GetAdjust() );
            aAdjust.SetOneWord( rNew.GetOneWord() );
            aAdjust.SetLastBlock( rNew.GetLastBlock() );
        }
    void SetBox( const SvxBoxItem& rNew )               { aBox = rNew; }
    void SetBackground( const SvxBrushItem& rNew )      { aBackground = rNew; }
    void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys )
        { sNumFmtString = rFmt; eNumFmtLanguage = eLng; eSysLanguage = eSys; }

    BOOL Load( SvStream& rStream, const SwAfVersions& rVersions, USHORT nVer );
    BOOL Save( SvStream& rStream ) const;
    BOOL SaveVerionNo( SvStream& rStream ) const;

#ifdef READ_OLDVERS
    // lade alte Version
    BOOL LoadOld( SvStream& rStream, USHORT aLoadVer[] );
#endif
};

class SwTableAutoFmt
{
    friend void _FinitCore();       // zum Zerstoeren des dflt. Pointers
    static SwBoxAutoFmt* pDfltBoxAutoFmt;

    String aName;
    USHORT nStrResId;
    BOOL bInclFont : 1;
    BOOL bInclJustify : 1;
    BOOL bInclFrame : 1;
    BOOL bInclBackground : 1;
    BOOL bInclValueFormat : 1;

    // StarCalc Spezifisches
    BOOL bInclWidthHeight : 1;

    SwBoxAutoFmt* aBoxAutoFmt[ 16 ];

public:
    SwTableAutoFmt( const String& rName );
    SwTableAutoFmt( const SwTableAutoFmt& rNew );
    ~SwTableAutoFmt();

    SwTableAutoFmt& operator=( const SwTableAutoFmt& rNew );

    void SetBoxFmt( const SwBoxAutoFmt& rNew, BYTE nPos );
    const SwBoxAutoFmt& GetBoxFmt( BYTE nPos ) const;

    void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
    const String& GetName() const { return aName; }

    enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
    SwBoxAutoFmt& UpdateFromSet( BYTE nPos, const SfxItemSet& rSet,
                                UpdateFlags eFlags, SvNumberFormatter* );
    void UpdateToSet( BYTE nPos, SfxItemSet& rSet, UpdateFlags eFlags,
                        SvNumberFormatter* ) const ;

    BOOL IsFont() const         { return bInclFont; }
    BOOL IsJustify() const      { return bInclJustify; }
    BOOL IsFrame() const        { return bInclFrame; }
    BOOL IsBackground() const   { return bInclBackground; }
    BOOL IsValueFormat() const  { return bInclValueFormat; }
    BOOL IsWidthHeight() const  { return bInclWidthHeight; }

    void SetFont( const BOOL bNew )         { bInclFont = bNew; }
    void SetJustify( const  BOOL bNew )     { bInclJustify = bNew; }
    void SetFrame( const BOOL bNew )        { bInclFrame = bNew; }
    void SetBackground( const BOOL bNew )   { bInclBackground = bNew; }
    void SetValueFormat( const BOOL bNew )  { bInclValueFormat = bNew; }
    void SetWidthHeight( const BOOL bNew )  { bInclWidthHeight = bNew; }

    BOOL Load( SvStream& rStream, const SwAfVersions& );
    BOOL Save( SvStream& rStream ) const;

#ifdef READ_OLDVERS
    // lade alte Version
    BOOL LoadOld( SvStream& rStream, USHORT aLoadVer[] );
#endif
};
typedef SwTableAutoFmt* SwTableAutoFmtPtr ;

SV_DECL_PTRARR_DEL( _SwTableAutoFmtTbl, SwTableAutoFmtPtr, 1, 5 )

class SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
{
    BOOL Load( SvStream& rStream );
    BOOL Save( SvStream& rStream ) const;
public:
    SwTableAutoFmtTbl();

    BOOL Load();
    BOOL Save() const;
};



/*************************************************************************

      Source Code Control System - Header

      $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/inc/tblafmt.hxx,v 1.1.1.1 2000-09-18 17:14:28 hr Exp $

      Source Code Control System - Update

      $Log: not supported by cvs2svn $
      Revision 1.22  2000/09/18 16:03:31  willem.vandorp
      OpenOffice header added.

      Revision 1.21  2000/09/08 13:24:29  willem.vandorp
      Header and footer replaced

      Revision 1.20  1999/10/11 15:23:51  jp
      TableautoFormatnames with resource ids

      Revision 1.19  1998/09/29 08:12:48  NN
      #53381# bei Zahlformat Systemsprache beim Erzeugen mitspeichern


      Rev 1.18   29 Sep 1998 10:12:48   NN
   #53381# bei Zahlformat Systemsprache beim Erzeugen mitspeichern

      Rev 1.17   15 Sep 1998 21:23:02   ER
   #47738# gedrehter Text in Tabellen-AutoFormat

      Rev 1.16   02 Jun 1998 10:35:02   JP
   TabellenAutoFormat: Load/Save ohne Stream - erzeugen diesen selbst

      Rev 1.15   14 May 1998 15:16:48   JP
   neu: Numberformat vom Boxen unterstuetzen

      Rev 1.14   12 May 1998 23:34:52   JP
   neu: Zuweisungsoperator fuer SwTableAutoFmt

      Rev 1.13   04 Sep 1997 09:02:58   MA
   includes

      Rev 1.12   09 Aug 1997 12:45:06   OS
   paraitem/frmitems/textitem aufgeteilt

      Rev 1.11   07 Aug 1997 14:43:12   OM
   Headerfile-Umstellung

      Rev 1.10   24 Jun 1996 18:35:28   MA
   includes

      Rev 1.9   13 Dec 1995 09:55:02   MA
   opt: Bessere Defaults fuer Arrays

      Rev 1.8   11 Dec 1995 13:38:48   HJS
   anpassung fuer unix

      Rev 1.7   30 Nov 1995 20:22:30   JP
   DefaultTblAutoFmt erst auf Bedarf anlegen

      Rev 1.6   31 Jul 1995 10:17:50   AMA
   International-Umstellung wg. Update 253

      Rev 1.5   20 Jul 1995 19:39:48   JP
   Aederung fuer gemeinsamen Import/Export der Tabellen-Autoformatierung von Calc/Writer

      Rev 1.4   10 Jun 1995 16:05:20   JP
   Save/Load nochmals umgestellt

      Rev 1.3   10 Jun 1995 12:51:26   JP
   SwBoxAutoFmt::Load - Load-Version mit geben

      Rev 1.2   06 Mar 1995 05:07:02   JP
   Load & Save als Dummy

      Rev 1.1   04 Mar 1995 20:42:22   JP
   Adjust nachgetragen

      Rev 1.0   04 Mar 1995 15:46:14   JP
   Initial revision.

*************************************************************************/
    // #ifndef _...
#endif