1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_SOURCE_FILTER_SGVMAIN_HXX
21 #define INCLUDED_VCL_SOURCE_FILTER_SGVMAIN_HXX
23 #include <vcl/font.hxx>
24 #include <vcl/outdev.hxx>
25 #include <vcl/virdev.hxx>
27 #define UCHAR unsigned char
44 sal_uInt8 Reserved
[256];
45 friend void DtHdOverSeek(SvStream
& rInp
);
49 PointType Size
; // 0.00mm...819.175mm (papersize)
50 sal_Int16 RandL
; // left border on
51 sal_Int16 RandR
; // right paper
52 sal_Int16 RandO
; // upper border on
53 sal_Int16 RandU
; // lower paper
54 sal_uInt8 PColor
; // future use
55 sal_uInt8 PIntens
; // future use
61 sal_uInt32 Next
; // next page
62 sal_uInt32 nList
; // objectdata, first record
63 sal_uInt32 ListEnd
; // objectdata, last record
64 Seitenformat Paper
; // data of paper
65 bool BorderClip
; // clip objects at border (cheat due to alignment in NT)
66 sal_uInt8 StdPg
; // insert which standardpage ?
67 PointType U
; // origin
68 sal_Int16 HlpLnH
[20]; // guides
72 UCHAR PgName
[32]; // page name
73 friend SvStream
& ReadPageType(SvStream
& rIStream
, PageType
& rPage
);
77 enum ObjArtType
{ObjStrk
,ObjRect
,ObjPoly
,ObjCirc
,ObjSpln
,
78 ObjText
,ObjGrup
,ObjBmap
,ObjVirt
,ObjTxtX
,ObjMaxi
};
81 sal_uInt8 LFarbe
; // [Index]
82 sal_uInt8 LBFarbe
; // [Index]
83 sal_uInt8 LIntens
; // [%]
84 sal_uInt8 LMuster
; // [Index] including transparency
85 sal_Int16 LMSize
; // [coefficient/100]
86 sal_Int16 LDicke
; // line thickness
90 sal_uInt8 FFarbe
; // [Index]
91 sal_uInt8 FBFarbe
; // [Index]
92 sal_uInt8 FIntens
; // [%]
93 // Despite the "Dummy" in the name, and not being used anywhere in
94 // the code, these two fields are *essential*. These structs are
95 // 1:1 mappings of actual on-disk/wire file format structures...
96 // So don't clean the "unused dummy" fields away. (Actually it
97 // might well be that many other fields around here are never used
98 // in our code either.)
101 sal_uInt16 FMuster
; // [Index] incl. Invers, transparency
114 #define ObjTextTypeSize 64
117 ObjLineType L
; // text outline (future)
118 ObjAreaType F
; // inner text
119 sal_uInt16 FontLo
,FontHi
; // e.g. 92500 (CG Times), split due to DWordAllign in TextType.
120 sal_uInt16 Grad
; // 0.5..32767.5 pt - we should stop at 1000 pt
121 sal_uInt16 Breite
; // 1..65535% please not more as 500%
122 sal_uInt8 Justify
; // 2 bit vertical (Hi), 3 bit horizontal (Lo)
123 sal_uInt8 Kapit
; // 1..255%
124 sal_uInt16 Schnitt
; // 8 flags
125 sal_uInt16 LnFeed
; // 1..32767% of max font size of the line
126 sal_uInt16 Slant
; // slant angle 0.00..89.99deg default 15.00deg
127 sal_uInt8 ZAbst
; // character spacing 0..255% (0=on the line; 100=normal; 200=character is viewed as double width)
128 signed char ChrVPos
; // vertical position of char. Default 0=on baseline, 10=5Pt below (-64..63")
129 ObjLineType ShdL
; // shadow outline (new 2.0)
130 ObjAreaType ShdF
; // shadow inside (new 2.0)
131 PointType ShdVers
; // shadow offset max. 300.00%
132 bool ShdAbs
; // True-> shadow offset is absolute instead of relative to font size
133 bool NoSpc
; // True-> no space (for background area)
134 ObjAreaType BackF
; // background area
135 sal_uInt32
GetFont();
136 void SetFont(sal_uInt32 FontID
);
139 #define ObjkSize 20 /* should be 21. due to alignment we shifted the flag */
140 class ObjkType
{ // basic components of all Stardraw objects
144 sal_uInt16 MemSize
; // in bytes
145 PointType ObjMin
; // XY minimum of the object
146 PointType ObjMax
; // XY maximum of the object
157 virtual ~ObjkType() {}
158 virtual void Draw(OutputDevice
& rOut
);
162 class StrkType
: public ObjkType
{
164 sal_uInt8 Flags
; // (cheat due to alignment in NT)
165 sal_uInt8 LEnden
; // line ends
167 PointType Pos1
; // start point
168 PointType Pos2
; // end point
169 friend SvStream
& ReadStrkType(SvStream
& rIStream
, StrkType
& rStrk
);
170 virtual void Draw(OutputDevice
& rOut
) override
;
174 class RectType
: public ObjkType
{
176 sal_uInt8 Flags
; // (cheat due to alignment in NT)
180 PointType Pos1
; // lower left corner = reference point
181 PointType Pos2
; // right corner
182 sal_Int16 Radius
; // radius of corner
183 sal_uInt16 RotationAngle
; // 315...<45
184 sal_uInt16 Slant
; // >270...<90
185 friend SvStream
& ReadRectType(SvStream
& rIStream
, RectType
& rRect
);
186 virtual void Draw(OutputDevice
& rOut
) override
;
190 class PolyType
: public ObjkType
{ // identical to spline !
192 sal_uInt8 Flags
; // (cheat due to alignment in NT)
193 sal_uInt8 LEnden
; // only for polyline
195 ObjAreaType F
; // not for polyline
198 sal_uInt32 SD_EckP
; // pointer to corner point (StarDraw)
199 PointType
* EckP
; // pointer to corner points (StarView (is not read from disk!))
200 friend SvStream
& ReadPolyType(SvStream
& rIStream
, PolyType
& rPoly
);
201 virtual void Draw(OutputDevice
& rOut
) override
;
203 #define PolyClosBit 0x01 // kinds of Poly: 0: polyLine 1: polygon
206 class SplnType
: public ObjkType
{ // identical to Poly !
208 sal_uInt8 Flags
; // (cheat due to alignment in NT)
209 sal_uInt8 LEnden
; // only for nSpline
211 ObjAreaType F
; // not for nSpline
214 sal_uInt32 SD_EckP
; // pointer to corner points (StarDraw)
215 PointType
* EckP
; // pointer to corner points (StarView (is not read from disk!))
216 friend SvStream
& ReadSplnType(SvStream
& rIStream
, SplnType
& rSpln
);
217 virtual void Draw(OutputDevice
& rOut
) override
;
219 // kinds of Spline: see Poly
222 class CircType
: public ObjkType
{
224 sal_uInt8 Flags
; // (cheat due to alignment in NT)
225 sal_uInt8 LEnden
; // only arcs (circle & ellips)
227 ObjAreaType F
; // not for arcs (circle & ellips)
228 PointType Center
; // center
229 PointType Radius
; // radius
230 sal_uInt16 RotationAngle
; // only ellipses
231 sal_uInt16 StartAngle
; // and not for full circles
232 sal_uInt16 RelAngle
; // and full ellipses
233 friend SvStream
& ReadCircType(SvStream
& rIStream
, CircType
& rCirc
);
234 virtual void Draw(OutputDevice
& rOut
) override
;
236 #define CircFull 0x00 /* kinds of circle: 0: full circle */
237 #define CircSect 0x01 /* 1: circle sector */
238 #define CircAbsn 0x02 /* 2: circle segment */
239 #define CircArc 0x03 /* 3: circle arc */
242 class TextType
: public ObjkType
{
244 sal_uInt8 Flags
; // (cheat due to alignment in NT)
245 sal_uInt8 Reserve
; // for Word Align
246 ObjTextType T
; // 64 bytes << DWord-Allign needed for FontID
247 PointType Pos1
; // reference point (upper left)
248 PointType Pos2
; // (lower right)
249 sal_Int16 TopOfs
; // from upper side to start of text (future for vJustify)
250 sal_uInt16 RotationAngle
; // 0...<360
251 sal_uInt16 BoxSlant
; // >270...<90 (only Box)
252 sal_uInt16 BufSize
; // size of buffer for Load, Save, Copy etc.
253 sal_uInt16 BufLo
,BufHi
; // (UCHAR*) pointer to Textbuffer << ShortArr, otherwise DWord-Allign needed
254 sal_uInt16 ExtLo
,ExtHi
; // (Ptr) text over more frames << ShortArr, otherwise DWord-Allign needed
255 PointType FitSize
; // size of origin for Fit2Size
256 sal_Int16 FitBreit
; // width to format for Fit2Size
257 UCHAR
* Buffer
; // this variable is not set by reading from disk, but explicit!
258 friend SvStream
& ReadTextType(SvStream
& rIStream
, TextType
& rText
);
259 virtual void Draw(OutputDevice
& rOut
) override
;
261 #define TextOutlBit 0x01 /* 1=Sourcecode for outliner (ignored byDrawObjekt()) */
262 #define TextFitSBit 0x02 /* Bit1: 1=Text-Fit2Size, also outliner (2.0) */
263 #define TextFitZBit 0x08 /* Bit3: 1=Fit2Size line by line (2.0) */
264 #define TextFitBits (TextFitSBit | TextFitZBit)
266 enum GrafStat
{NoGraf
,Pic
,Pcx
,Hpgl
,Img
,Msp
,Tiff
,Dxf
,Lot
,Usr
,Sgf
};
269 class BmapType
: public ObjkType
{
271 sal_uInt8 Flags
; // (cheat due to alignment in NT)
273 ObjAreaType F
; // colour and pattern of first plane bitmap
276 sal_uInt16 RotationAngle
;// 315...<45 (future)
277 sal_uInt16 Slant
; // >270...<90 (future)
278 UCHAR Filename
[80]; // path
279 PointType PixSize
; // size in Pixel (0 for vector)
280 GrafStat Format
; // see: GpmDef.Pas
281 sal_uInt8 nPlanes
; // number of bitplanes (0 for vector)
282 bool RawOut
; // output as raw ?
283 bool InvOut
; // output inverted ?
284 bool LightOut
; // brighten? (SD20)
285 sal_uInt8 GrfFlg
; // (SD20) 0=nSGF 1=Pcx 2=HPGL 4=Raw $FF=Undef (to fix DrawBmp)
286 INetURLObject aFltPath
; // for GraphicFilter
300 memset(Filename
, 0, sizeof(Filename
));
303 friend SvStream
& ReadBmapType(SvStream
& rIStream
, BmapType
& rBmap
);
304 virtual void Draw(OutputDevice
& rOut
) override
;
308 class GrupType
: public ObjkType
{
310 sal_uInt8 Flags
; // (cheat due to alignment in NT)
311 UCHAR Name
[13]; // name of group
312 sal_uInt16 SbLo
,SbHi
; // (Ptr) group list << ShortArr, as otherwise DWord alignment needed
313 sal_uInt16 UpLo
,UpHi
; // (Ptr) parent list << ShortArr, as otherwise DWord alignment needed
314 sal_uInt16 ChartSize
; // required amount of memory for structure of diagram structure
315 sal_uInt32 ChartPtr
; // diagram structure
316 sal_uInt32
GetSubPtr(); // only to check if Sublist is empty
317 friend SvStream
& ReadGrupType(SvStream
& rIStream
, GrupType
& rGrup
);
320 void SetLine(ObjLineType
& rLine
, OutputDevice
& rOut
);
321 void SetArea(ObjAreaType
& rArea
, OutputDevice
& rOut
);
322 Color
Sgv2SvFarbe(sal_uInt8 nFrb1
, sal_uInt8 nFrb2
, sal_uInt8 nInts
);
323 void RotatePoint(PointType
& P
, sal_Int16 cx
, sal_Int16 cy
, double sn
, double cs
);
324 void RotatePoint(Point
& P
, sal_Int16 cx
, sal_Int16 cy
, double sn
, double cs
);
325 sal_Int16
iMulDiv(sal_Int16 a
, sal_Int16 Mul
, sal_Int16 Div
);
326 sal_uInt16
MulDiv(sal_uInt16 a
, sal_uInt16 Mul
, sal_uInt16 Div
);
330 SgfFontOne
* Next
; // pointer to list
338 rtl_TextEncoding SVChSet
;
339 OUString SVFName
; // e.g. "Times New Roman" = 15 chars
340 sal_uInt16 SVWidth
; // average character width in %
342 void ReadOne(const OString
& rID
, OString
& rDsc
);
347 OUString FNam
; // complete filename of the Ini-file
348 SgfFontOne
* pList
; // start of list
349 SgfFontOne
* Last
; // end of list
350 sal_uInt32 LastID
; // for faster access during repeats
351 SgfFontOne
* LastLn
; // for faster access during repeats
355 void AssignFN(const OUString
& rFName
);
358 SgfFontOne
* GetFontDesc(sal_uInt32 ID
);
361 #endif // INCLUDED_VCL_SOURCE_FILTER_SGVMAIN_HXX
363 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */