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
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _SGVMAIN_HXX
#define _SGVMAIN_HXX
#include <vcl/font.hxx>
#include <vcl/outdev.hxx>
#include <vcl/virdev.hxx>
#define UCHAR unsigned char
struct PointType {
sal_Int16 x;
sal_Int16 y;
};
#define SgfDpmm 40
#define DtHdSize 256
class DtHdType {
public:
sal_uInt8 Reserved[256];
friend SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd);
friend void DtHdOverSeek(SvStream& rInp);
};
struct Seitenformat {
PointType Size; // 0.00mm...819.175mm (Papiergr��e)
sal_Int16 RandL; // links Rand auf
sal_Int16 RandR; // rechts dem Papier
sal_Int16 RandO; // oben Rand auf
sal_Int16 RandU; // unten dem Papier
sal_uInt8 PColor; // Future Use
sal_uInt8 PIntens; // erst recht Future use
// sal_Bool BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT)
};
#define PageSize 146
class PageType {
public:
sal_uInt32 Next; // N�chste Seite
sal_uInt32 nList; // Objektdaten, erster Record
sal_uInt32 ListEnd; // Objektdaten, letzter Record
Seitenformat Paper; // Papierdaten
sal_Bool BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT)
sal_uInt8 StdPg; // welche Standardseite einblenden ?
PointType U; // Nullpunkt
sal_Int16 HlpLnH[20]; // Hilfslinien
sal_Int16 HlpLnV[20];
sal_uInt8 LnAnzH;
sal_uInt8 LnAnzV;
UCHAR PgName[32]; // Seitenname
friend SvStream& operator>>(SvStream& rIStream, PageType& rPage);
};
enum ObjArtType {ObjStrk,ObjRect,ObjPoly,ObjCirc,ObjSpln,
ObjText,ObjGrup,ObjBmap,ObjVirt,ObjTxtX,ObjMaxi};
struct ObjLineType {
sal_uInt8 LFarbe; // [Index]
sal_uInt8 LBFarbe; // [Index]
sal_uInt8 LIntens; // [%]
sal_uInt8 LMuster; // [Index] inkl. Transparenz
sal_Int16 LMSize; // [Koeffizient/100]
sal_Int16 LDicke; // Strichst�rke
};
struct ObjAreaType {
sal_uInt8 FFarbe; // [Index]
sal_uInt8 FBFarbe; // [Index]
sal_uInt8 FIntens; // [%]
// Despite the "Dummy" in the name, and not being used anywhere in
// the code, these two fields are *essential*. These structs are
// 1:1 mappings of actual on-disk/wire file format structures...
// So don't clean the "unused dummy" fields away. (Actually it
// might well be that many other fields around here are never used
// in our code either.)
sal_uInt8 FDummy1; //
sal_Int16 FDummy2; //
sal_uInt16 FMuster; // [Index] inkl. Invers, Transparenz
};
#define ObjTextTypeSize 64
class ObjTextType {
public:
ObjLineType L; // Text-Outline (future)
ObjAreaType F; // Text innen
sal_uInt16 FontLo,FontHi;// z.B. 92500 (CG Times), zweigeteilt wegen DWordAllign in TextType.
sal_uInt16 Grad; // 0.5..32767.5 Pt - bei 1000 Pt sollte aber schlu� sein
sal_uInt16 Breite; // 1..65535% bitte nicht mehr als 500%
sal_uInt8 Justify; // 2 Bit Vert (Hi), 3 Bit Hor (Lo)
sal_uInt8 Kapit; // 1..255%
sal_uInt16 Schnitt; // 8 Flags
sal_uInt16 LnFeed; // 1..32767% vom max. Schriftgrad der Zeile
sal_uInt16 Slant; // Kursivwinkel 0.00..89.99� default 15.00� doppelt Breit angesehen)
sal_uInt8 ZAbst; // Zeichenabstand 0..255% (0=auf der Stelle; 100=normal; 200=Zeichen wird als
sal_sChar ChrVPos; // Zeichen V-Position default 0= on Baseline, 10= 5Pt drunter (-64..63�)
ObjLineType ShdL; // Schatten-Outline (neu 2.0)
ObjAreaType ShdF; // Schatten-innen (neu 2.0)
PointType ShdVers; // Schattenversatz Max.300.00%
sal_Bool ShdAbs; // True-> Schattenversatz ist absolut statt relativ zum Schriftgrad
sal_Bool NoSpc; // True-> kein Zwischenraum (f�r BackArea)
ObjAreaType BackF; // Hintergrundfl�che
sal_uInt32 GetFont();
void SetFont(sal_uInt32 FontID);
};
class Obj0Type { // SuperClass f�r Apple-VMT
public:
virtual void Draw(OutputDevice& rOut);
virtual ~Obj0Type() {}
};
#define ObjkSize 20 /* eigentlich 21. Wg. Allignment ist Flags jedoch verschoben worden*/
class ObjkType: public Obj0Type { // Grundkomponenten aller Stardraw-Objekte
public:
sal_uInt32 Last;
sal_uInt32 Next;
sal_uInt16 MemSize; // in Bytes
PointType ObjMin; // XY-Minimum des Objekts
PointType ObjMax; // XY-Maximum des Objekts
sal_uInt8 Art;
sal_uInt8 Layer;
// sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
friend SvStream& operator>>(SvStream& rIStream, ObjkType& rObjk);
friend sal_Bool ObjOverSeek(SvStream& rInp, ObjkType& rObjk);
virtual void Draw(OutputDevice& rOut);
};
#define StrkSize 38
class StrkType: public ObjkType {
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
sal_uInt8 LEnden; // Linienenden
ObjLineType L;
PointType Pos1; // Anfangspunkt
PointType Pos2; // Endpunkt
friend SvStream& operator>>(SvStream& rIStream, StrkType& rStrk);
virtual void Draw(OutputDevice& rOut);
};
#define RectSize 52
class RectType: public ObjkType {
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
sal_uInt8 Reserve;
ObjLineType L;
ObjAreaType F;
PointType Pos1; // LO-Ecke = Bezugspunkt
PointType Pos2; // R-Ecke
sal_Int16 Radius; // Eckenradius
sal_uInt16 DrehWink; // 315...<45
sal_uInt16 Slant; // >270...<90
friend SvStream& operator>>(SvStream& rIStream, RectType& rRect);
virtual void Draw(OutputDevice& rOut);
};
#define PolySize 44
class PolyType: public ObjkType { // identisch mit Spline !
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
sal_uInt8 LEnden; // nur f�r Polyline
ObjLineType L;
ObjAreaType F; // nicht f�r Polyline
sal_uInt8 nPoints;
sal_uInt8 Reserve;
sal_uInt32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw)
PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!))
friend SvStream& operator>>(SvStream& rIStream, PolyType& rPoly);
virtual void Draw(OutputDevice& rOut);
};
#define PolyClosBit 0x01 // Unterarten von Poly: 0: PolyLine 1: Polygon
#define SplnSize 44
class SplnType: public ObjkType { // identisch mit Poly !
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
sal_uInt8 LEnden; // nur f�r nSpline
ObjLineType L;
ObjAreaType F; // nicht f�r nSpline
sal_uInt8 nPoints;
sal_uInt8 Reserve;
sal_uInt32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw)
PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!))
friend SvStream& operator>>(SvStream& rIStream, SplnType& rSpln);
virtual void Draw(OutputDevice& rOut);
};
// Unterarten von Spline: siehe Poly
#define CircSize 52
class CircType: public ObjkType {
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
sal_uInt8 LEnden; // nur Bogen (Kr & El)
ObjLineType L;
ObjAreaType F; // nicht f�r Bogen (Kr & El)
PointType Center; // Mittelpunkt
PointType Radius; // Radius
sal_uInt16 DrehWink; // nur Ellipse
sal_uInt16 StartWink; // � nicht f�r Vollkreis
sal_uInt16 RelWink; // � und Vollellipse
friend SvStream& operator>>(SvStream& rIStream, CircType& rCirc);
virtual void Draw(OutputDevice& rOut);
};
#define CircFull 0x00 /* Unterarten von Kreis: 0: Kreis */
#define CircSect 0x01 /* 1: Kreissektor */
#define CircAbsn 0x02 /* 2: Kreisabschnitt */
#define CircArc 0x03 /* 3: Kreisbogen */
#define TextSize 116
class TextType: public ObjkType {
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
sal_uInt8 Reserve; // f�r Word Allign
ObjTextType T; // 64 Bytes << DWord-Allign bei FontID erforderlich
PointType Pos1; // Bezugspunkt (ObenLinks)
PointType Pos2; // (untenRechts)
sal_Int16 TopOfs; // Von Oberkante bis Textbegin (future f�r vJustify)
sal_uInt16 DrehWink; // 0...<360
sal_uInt16 BoxSlant; // >270...<90 (nur Box)
sal_uInt16 BufSize; // Gr��e von Buf f�r Load, Save, Copy und so
sal_uInt16 BufLo,BufHi;// (UCHAR*) Zeiger auf den Textbuffer << ShortArr, weil sonst DWord-Allign erforderlich
sal_uInt16 ExtLo,ExtHi;// (Ptr) Text �ber mehrere Rahmen << ShortArr, weil sonst DWord-Allign erforderlich
PointType FitSize; // Ursprungsgr��e f�r Fit2Size
sal_Int16 FitBreit; // Breite zum formatieren bei Fit2Size
UCHAR* Buffer; // Diese Variable wird nicht durch Lesen von Disk gef�llt, sondern explizit!
friend SvStream& operator>>(SvStream& rIStream, TextType& rText);
virtual void Draw(OutputDevice& rOut);
};
#define TextOutlBit 0x01 /* 1=Sourcecode f�r Outliner (wird von DrawObjekt() ignoriert) */
#define TextFitSBit 0x02 /* Bit1: 1=Text-FitToSize, auch Outliner (2.0) */
#define TextFitZBit 0x08 /* Bit3: 1=Fit2Size Zeilenweise (2.0) */
#define TextDrftBit 0x04 /* Bit2: 1=DraftDraw (2.0) */
#define TextFitBits (TextFitSBit | TextFitZBit)
enum GrafStat {NoGraf,Pic,Pcx,Hpgl,Img,Msp,Tiff,Dxf,Lot,Usr,Sgf};
#define BmapSize 132
class BmapType: public ObjkType {
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
sal_uInt8 Reserve;
ObjAreaType F; // Farbe und Muster der 1-Plane Bitmap
PointType Pos1;
PointType Pos2;
sal_uInt16 DrehWink; // 315...<45 (Future)
sal_uInt16 Slant; // >270...<90 (Future)
UCHAR Filename[80]; // Pfad
PointType PixSize; // Gr��e in Pixel (0 bei Vektor)
GrafStat Format; // siehe GpmDef.Pas
sal_uInt8 nPlanes; // Anzahl der Bitplanes (0 bei Vektor)
sal_Bool RawOut; // als Raw ausgeben ?
sal_Bool InvOut; // invertiert ausgeben ?
sal_Bool LightOut; // aufhellen? (SD20)
sal_uInt8 GrfFlg; // (SD20) 0=nSGF 1=Pcx 2=Hpgl 4=Raw $FF=Undef(f�r Fix in DrawBmp)
INetURLObject aFltPath; // F�r GraphicFilter
friend SvStream& operator>>(SvStream& rIStream, BmapType& rBmap);
virtual void Draw(OutputDevice& rOut);
void SetPaths( const INetURLObject rFltPath );
};
#define GrupSize 48
class GrupType: public ObjkType {
public:
sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
UCHAR Name[13]; // Name der Gruppe
sal_uInt16 SbLo,SbHi; // (Ptr) Gruppenliste << ShortArr, weil sonst DWord Allign erforderlich
sal_uInt16 UpLo,UpHi; // (Ptr) Vaterliste << ShortArr, weil sonst DWord Allign erforderlich
sal_uInt16 ChartSize; // Speicherbedarf der Diagrammstruktur Struktur
sal_uInt32 ChartPtr; // Diagrammstruktur
sal_uInt32 GetSubPtr(); // hier nur zum Checken, ob Sublist evtl. leer ist.
friend SvStream& operator>>(SvStream& rIStream, GrupType& rGrup);
// virtual void Draw(OutputDevice& rOut);
};
void SetLine(ObjLineType& rLine, OutputDevice& rOut);
void SetArea(ObjAreaType& rArea, OutputDevice& rOut);
Color Sgv2SvFarbe(sal_uInt8 nFrb1, sal_uInt8 nFrb2, sal_uInt8 nInts);
void RotatePoint(PointType& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs);
void RotatePoint(Point& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs);
sal_Int16 iMulDiv(sal_Int16 a, sal_Int16 Mul, sal_Int16 Div);
sal_uInt16 MulDiv(sal_uInt16 a, sal_uInt16 Mul, sal_uInt16 Div);
class SgfFontOne {
public:
SgfFontOne* Next; // Zeiger f�r Listenverkettung
sal_uInt32 IFID;
sal_Bool Bold;
sal_Bool Ital;
sal_Bool Sans;
sal_Bool Serf;
sal_Bool Fixd;
FontFamily SVFamil;
CharSet SVChSet;
String SVFName; // z.B. "Times New Roman" = 15 Chars
sal_uInt16 SVWidth; // Durchschnittliche Zeichenbreite in %
SgfFontOne();
void ReadOne(const rtl::OString& rID, rtl::OString& rDsc);
};
class SgfFontLst {
public:
String FNam; // vollst�ndiger Filename des Inifiles
SgfFontOne* pList; // Listenanfang
SgfFontOne* Last; // Listenende
sal_uInt32 LastID; // f�r schnelleren Zugriff bei Wiederholungen
SgfFontOne* LastLn; // f�r schnelleren Zugriff bei Wiederholungen
sal_Bool Tried;
SgfFontLst();
~SgfFontLst();
void AssignFN(const String& rFName);
void ReadList();
void RausList();
SgfFontOne* GetFontDesc(sal_uInt32 ID);
};
#endif //_SGVMAIN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|