Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SGVMAIN_HXX
30 : : #define _SGVMAIN_HXX
31 : :
32 : : #include <vcl/font.hxx>
33 : : #include <vcl/outdev.hxx>
34 : : #include <vcl/virdev.hxx>
35 : :
36 : :
37 : : #define UCHAR unsigned char
38 : :
39 : : struct PointType {
40 : : sal_Int16 x;
41 : : sal_Int16 y;
42 : : };
43 : :
44 : : #define SgfDpmm 40
45 : :
46 : : #define DtHdSize 256
47 : : class DtHdType {
48 : : public:
49 : : sal_uInt8 Reserved[256];
50 : : friend SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd);
51 : : friend void DtHdOverSeek(SvStream& rInp);
52 : : };
53 : :
54 : :
55 : : struct Seitenformat {
56 : : PointType Size; // 0.00mm...819.175mm (Papiergr��e)
57 : : sal_Int16 RandL; // links Rand auf
58 : : sal_Int16 RandR; // rechts dem Papier
59 : : sal_Int16 RandO; // oben Rand auf
60 : : sal_Int16 RandU; // unten dem Papier
61 : : sal_uInt8 PColor; // Future Use
62 : : sal_uInt8 PIntens; // erst recht Future use
63 : : // sal_Bool BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT)
64 : : };
65 : :
66 : :
67 : : #define PageSize 146
68 : : class PageType {
69 : : public:
70 : : sal_uInt32 Next; // N�chste Seite
71 : : sal_uInt32 nList; // Objektdaten, erster Record
72 : : sal_uInt32 ListEnd; // Objektdaten, letzter Record
73 : : Seitenformat Paper; // Papierdaten
74 : : sal_Bool BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT)
75 : : sal_uInt8 StdPg; // welche Standardseite einblenden ?
76 : : PointType U; // Nullpunkt
77 : : sal_Int16 HlpLnH[20]; // Hilfslinien
78 : : sal_Int16 HlpLnV[20];
79 : : sal_uInt8 LnAnzH;
80 : : sal_uInt8 LnAnzV;
81 : : UCHAR PgName[32]; // Seitenname
82 : : friend SvStream& operator>>(SvStream& rIStream, PageType& rPage);
83 : : };
84 : :
85 : :
86 : : enum ObjArtType {ObjStrk,ObjRect,ObjPoly,ObjCirc,ObjSpln,
87 : : ObjText,ObjGrup,ObjBmap,ObjVirt,ObjTxtX,ObjMaxi};
88 : :
89 : : struct ObjLineType {
90 : : sal_uInt8 LFarbe; // [Index]
91 : : sal_uInt8 LBFarbe; // [Index]
92 : : sal_uInt8 LIntens; // [%]
93 : : sal_uInt8 LMuster; // [Index] inkl. Transparenz
94 : : sal_Int16 LMSize; // [Koeffizient/100]
95 : : sal_Int16 LDicke; // Strichst�rke
96 : : };
97 : :
98 : : struct ObjAreaType {
99 : : sal_uInt8 FFarbe; // [Index]
100 : : sal_uInt8 FBFarbe; // [Index]
101 : : sal_uInt8 FIntens; // [%]
102 : : sal_uInt8 FDummy1; //
103 : : sal_Int16 FDummy2; //
104 : : sal_uInt16 FMuster; // [Index] inkl. Invers, Transparenz
105 : : };
106 : :
107 : : #define ObjTextTypeSize 64
108 : : class ObjTextType {
109 : : public:
110 : : ObjLineType L; // Text-Outline (future)
111 : : ObjAreaType F; // Text innen
112 : : sal_uInt16 FontLo,FontHi;// z.B. 92500 (CG Times), zweigeteilt wegen DWordAllign in TextType.
113 : : sal_uInt16 Grad; // 0.5..32767.5 Pt - bei 1000 Pt sollte aber schlu� sein
114 : : sal_uInt16 Breite; // 1..65535% bitte nicht mehr als 500%
115 : : sal_uInt8 Justify; // 2 Bit Vert (Hi), 3 Bit Hor (Lo)
116 : : sal_uInt8 Kapit; // 1..255%
117 : : sal_uInt16 Schnitt; // 8 Flags
118 : : sal_uInt16 LnFeed; // 1..32767% vom max. Schriftgrad der Zeile
119 : : sal_uInt16 Slant; // Kursivwinkel 0.00..89.99� default 15.00� doppelt Breit angesehen)
120 : : sal_uInt8 ZAbst; // Zeichenabstand 0..255% (0=auf der Stelle; 100=normal; 200=Zeichen wird als
121 : : sal_sChar ChrVPos; // Zeichen V-Position default 0= on Baseline, 10= 5Pt drunter (-64..63�)
122 : : ObjLineType ShdL; // Schatten-Outline (neu 2.0)
123 : : ObjAreaType ShdF; // Schatten-innen (neu 2.0)
124 : : PointType ShdVers; // Schattenversatz Max.300.00%
125 : : sal_Bool ShdAbs; // True-> Schattenversatz ist absolut statt relativ zum Schriftgrad
126 : : sal_Bool NoSpc; // True-> kein Zwischenraum (f�r BackArea)
127 : : ObjAreaType BackF; // Hintergrundfl�che
128 : : sal_uInt32 GetFont();
129 : : void SetFont(sal_uInt32 FontID);
130 : : };
131 : :
132 : 30 : class Obj0Type { // SuperClass f�r Apple-VMT
133 : : public:
134 : : virtual void Draw(OutputDevice& rOut);
135 [ - + ]: 30 : virtual ~Obj0Type() {}
136 : : };
137 : :
138 : : #define ObjkSize 20 /* eigentlich 21. Wg. Allignment ist Flags jedoch verschoben worden*/
139 [ - + ]: 60 : class ObjkType: public Obj0Type { // Grundkomponenten aller Stardraw-Objekte
140 : : public:
141 : : sal_uInt32 Last;
142 : : sal_uInt32 Next;
143 : : sal_uInt16 MemSize; // in Bytes
144 : : PointType ObjMin; // XY-Minimum des Objekts
145 : : PointType ObjMax; // XY-Maximum des Objekts
146 : : sal_uInt8 Art;
147 : : sal_uInt8 Layer;
148 : : // sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
149 : : friend SvStream& operator>>(SvStream& rIStream, ObjkType& rObjk);
150 : : friend sal_Bool ObjOverSeek(SvStream& rInp, ObjkType& rObjk);
151 : : virtual void Draw(OutputDevice& rOut);
152 : : };
153 : :
154 : :
155 : : #define StrkSize 38
156 [ # # ]: 0 : class StrkType: public ObjkType {
157 : : public:
158 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
159 : : sal_uInt8 LEnden; // Linienenden
160 : : ObjLineType L;
161 : : PointType Pos1; // Anfangspunkt
162 : : PointType Pos2; // Endpunkt
163 : : friend SvStream& operator>>(SvStream& rIStream, StrkType& rStrk);
164 : : virtual void Draw(OutputDevice& rOut);
165 : : };
166 : :
167 : :
168 : : #define RectSize 52
169 [ # # ]: 0 : class RectType: public ObjkType {
170 : : public:
171 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
172 : : sal_uInt8 Reserve;
173 : : ObjLineType L;
174 : : ObjAreaType F;
175 : : PointType Pos1; // LO-Ecke = Bezugspunkt
176 : : PointType Pos2; // R-Ecke
177 : : sal_Int16 Radius; // Eckenradius
178 : : sal_uInt16 DrehWink; // 315...<45
179 : : sal_uInt16 Slant; // >270...<90
180 : : friend SvStream& operator>>(SvStream& rIStream, RectType& rRect);
181 : : virtual void Draw(OutputDevice& rOut);
182 : : };
183 : :
184 : :
185 : : #define PolySize 44
186 [ - + ]: 18 : class PolyType: public ObjkType { // identisch mit Spline !
187 : : public:
188 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
189 : : sal_uInt8 LEnden; // nur f�r Polyline
190 : : ObjLineType L;
191 : : ObjAreaType F; // nicht f�r Polyline
192 : : sal_uInt8 nPoints;
193 : : sal_uInt8 Reserve;
194 : : sal_uInt32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw)
195 : : PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!))
196 : : friend SvStream& operator>>(SvStream& rIStream, PolyType& rPoly);
197 : : virtual void Draw(OutputDevice& rOut);
198 : : };
199 : : #define PolyClosBit 0x01 // Unterarten von Poly: 0: PolyLine 1: Polygon
200 : :
201 : :
202 : : #define SplnSize 44
203 [ - + ]: 18 : class SplnType: public ObjkType { // identisch mit Poly !
204 : : public:
205 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
206 : : sal_uInt8 LEnden; // nur f�r nSpline
207 : : ObjLineType L;
208 : : ObjAreaType F; // nicht f�r nSpline
209 : : sal_uInt8 nPoints;
210 : : sal_uInt8 Reserve;
211 : : sal_uInt32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw)
212 : : PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!))
213 : : friend SvStream& operator>>(SvStream& rIStream, SplnType& rSpln);
214 : : virtual void Draw(OutputDevice& rOut);
215 : : };
216 : : // Unterarten von Spline: siehe Poly
217 : :
218 : :
219 : : #define CircSize 52
220 [ - + ]: 6 : class CircType: public ObjkType {
221 : : public:
222 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
223 : : sal_uInt8 LEnden; // nur Bogen (Kr & El)
224 : : ObjLineType L;
225 : : ObjAreaType F; // nicht f�r Bogen (Kr & El)
226 : : PointType Center; // Mittelpunkt
227 : : PointType Radius; // Radius
228 : : sal_uInt16 DrehWink; // nur Ellipse
229 : : sal_uInt16 StartWink; // � nicht f�r Vollkreis
230 : : sal_uInt16 RelWink; // � und Vollellipse
231 : : friend SvStream& operator>>(SvStream& rIStream, CircType& rCirc);
232 : : virtual void Draw(OutputDevice& rOut);
233 : : };
234 : : #define CircFull 0x00 /* Unterarten von Kreis: 0: Kreis */
235 : : #define CircSect 0x01 /* 1: Kreissektor */
236 : : #define CircAbsn 0x02 /* 2: Kreisabschnitt */
237 : : #define CircArc 0x03 /* 3: Kreisbogen */
238 : :
239 : :
240 : : #define TextSize 116
241 [ # # ]: 0 : class TextType: public ObjkType {
242 : : public:
243 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
244 : : sal_uInt8 Reserve; // f�r Word Allign
245 : : ObjTextType T; // 64 Bytes << DWord-Allign bei FontID erforderlich
246 : : PointType Pos1; // Bezugspunkt (ObenLinks)
247 : : PointType Pos2; // (untenRechts)
248 : : sal_Int16 TopOfs; // Von Oberkante bis Textbegin (future f�r vJustify)
249 : : sal_uInt16 DrehWink; // 0...<360
250 : : sal_uInt16 BoxSlant; // >270...<90 (nur Box)
251 : : sal_uInt16 BufSize; // Gr��e von Buf f�r Load, Save, Copy und so
252 : : sal_uInt16 BufLo,BufHi;// (UCHAR*) Zeiger auf den Textbuffer << ShortArr, weil sonst DWord-Allign erforderlich
253 : : sal_uInt16 ExtLo,ExtHi;// (Ptr) Text �ber mehrere Rahmen << ShortArr, weil sonst DWord-Allign erforderlich
254 : : PointType FitSize; // Ursprungsgr��e f�r Fit2Size
255 : : sal_Int16 FitBreit; // Breite zum formatieren bei Fit2Size
256 : : UCHAR* Buffer; // Diese Variable wird nicht durch Lesen von Disk gef�llt, sondern explizit!
257 : : friend SvStream& operator>>(SvStream& rIStream, TextType& rText);
258 : : virtual void Draw(OutputDevice& rOut);
259 : : };
260 : : #define TextOutlBit 0x01 /* 1=Sourcecode f�r Outliner (wird von DrawObjekt() ignoriert) */
261 : : #define TextFitSBit 0x02 /* Bit1: 1=Text-FitToSize, auch Outliner (2.0) */
262 : : #define TextFitZBit 0x08 /* Bit3: 1=Fit2Size Zeilenweise (2.0) */
263 : : #define TextDrftBit 0x04 /* Bit2: 1=DraftDraw (2.0) */
264 : : #define TextFitBits (TextFitSBit | TextFitZBit)
265 : :
266 : :
267 : : enum GrafStat {NoGraf,Pic,Pcx,Hpgl,Img,Msp,Tiff,Dxf,Lot,Usr,Sgf};
268 : :
269 : : #define BmapSize 132
270 [ # # ][ # # ]: 0 : class BmapType: public ObjkType {
[ # # ]
271 : : public:
272 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
273 : : sal_uInt8 Reserve;
274 : : ObjAreaType F; // Farbe und Muster der 1-Plane Bitmap
275 : : PointType Pos1;
276 : : PointType Pos2;
277 : : sal_uInt16 DrehWink; // 315...<45 (Future)
278 : : sal_uInt16 Slant; // >270...<90 (Future)
279 : : UCHAR Filename[80]; // Pfad
280 : : PointType PixSize; // Gr��e in Pixel (0 bei Vektor)
281 : : GrafStat Format; // siehe GpmDef.Pas
282 : : sal_uInt8 nPlanes; // Anzahl der Bitplanes (0 bei Vektor)
283 : : sal_Bool RawOut; // als Raw ausgeben ?
284 : : sal_Bool InvOut; // invertiert ausgeben ?
285 : : sal_Bool LightOut; // aufhellen? (SD20)
286 : : sal_uInt8 GrfFlg; // (SD20) 0=nSGF 1=Pcx 2=Hpgl 4=Raw $FF=Undef(f�r Fix in DrawBmp)
287 : :
288 : : INetURLObject aFltPath; // F�r GraphicFilter
289 : : friend SvStream& operator>>(SvStream& rIStream, BmapType& rBmap);
290 : : virtual void Draw(OutputDevice& rOut);
291 : : void SetPaths( const INetURLObject rFltPath );
292 : : };
293 : :
294 : :
295 : : #define GrupSize 48
296 [ - + ]: 6 : class GrupType: public ObjkType {
297 : : public:
298 : : sal_uInt8 Flags; // (Schummel f�r Allignment unter NT)
299 : : UCHAR Name[13]; // Name der Gruppe
300 : : sal_uInt16 SbLo,SbHi; // (Ptr) Gruppenliste << ShortArr, weil sonst DWord Allign erforderlich
301 : : sal_uInt16 UpLo,UpHi; // (Ptr) Vaterliste << ShortArr, weil sonst DWord Allign erforderlich
302 : : sal_uInt16 ChartSize; // Speicherbedarf der Diagrammstruktur Struktur
303 : : sal_uInt32 ChartPtr; // Diagrammstruktur
304 : : sal_uInt32 GetSubPtr(); // hier nur zum Checken, ob Sublist evtl. leer ist.
305 : : friend SvStream& operator>>(SvStream& rIStream, GrupType& rGrup);
306 : : // virtual void Draw(OutputDevice& rOut);
307 : : };
308 : :
309 : :
310 : : void SetLine(ObjLineType& rLine, OutputDevice& rOut);
311 : : void SetArea(ObjAreaType& rArea, OutputDevice& rOut);
312 : : Color Sgv2SvFarbe(sal_uInt8 nFrb1, sal_uInt8 nFrb2, sal_uInt8 nInts);
313 : : void RotatePoint(PointType& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs);
314 : : void RotatePoint(Point& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs);
315 : : sal_Int16 iMulDiv(sal_Int16 a, sal_Int16 Mul, sal_Int16 Div);
316 : : sal_uInt16 MulDiv(sal_uInt16 a, sal_uInt16 Mul, sal_uInt16 Div);
317 : :
318 : :
319 : 0 : class SgfFontOne {
320 : : public:
321 : : SgfFontOne* Next; // Zeiger f�r Listenverkettung
322 : : sal_uInt32 IFID;
323 : : sal_Bool Bold;
324 : : sal_Bool Ital;
325 : : sal_Bool Sans;
326 : : sal_Bool Serf;
327 : : sal_Bool Fixd;
328 : : FontFamily SVFamil;
329 : : CharSet SVChSet;
330 : : String SVFName; // z.B. "Times New Roman" = 15 Chars
331 : : sal_uInt16 SVWidth; // Durchschnittliche Zeichenbreite in %
332 : : SgfFontOne();
333 : : void ReadOne(const rtl::OString& rID, rtl::OString& rDsc);
334 : : };
335 : :
336 : : class SgfFontLst {
337 : : public:
338 : : String FNam; // vollst�ndiger Filename des Inifiles
339 : : SgfFontOne* pList; // Listenanfang
340 : : SgfFontOne* Last; // Listenende
341 : : sal_uInt32 LastID; // f�r schnelleren Zugriff bei Wiederholungen
342 : : SgfFontOne* LastLn; // f�r schnelleren Zugriff bei Wiederholungen
343 : : sal_Bool Tried;
344 : : SgfFontLst();
345 : : ~SgfFontLst();
346 : : void AssignFN(const String& rFName);
347 : : void ReadList();
348 : : void RausList();
349 : : SgfFontOne* GetFontDesc(sal_uInt32 ID);
350 : : };
351 : :
352 : : #endif //_SGVMAIN_HXX
353 : :
354 : :
355 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|