xref: /aoo41x/main/svtools/source/inc/sgfbram.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SGFBRAM_HXX
29 #define _SGFBRAM_HXX
30 
31 #include <tools/solar.h>
32 
33 #define SgfBitImag0   1 /* Bitmap                      */
34 #define SgfBitImag1   4 /* Bitmap                      */
35 #define SgfBitImag2   5 /* Bitmap                      */
36 #define SgfBitImgMo   6 /* Monochrome Bitmap           */
37 #define SgfSimpVect   2 /* Einfaches Vectorformat      */
38 #define SgfPostScrp   3 /* Postscript file             */
39 #define SgfStarDraw   7 /* StarDraw SGV-Datei          */
40 #define SgfDontKnow 255 /* Unbekannt oder kein SGF/SGV */
41 
42 // Konstanten f�r SgfHeader.SwGrCol
43 #define SgfBlckWhit 1 /* Schwarz/Wei?Bild                  Ŀ SimpVector,  */
44 #define SgfGrayscal 2 /* Bild mit Graustufen                 ?StarDraw und */
45 #define Sgf16Colors 3 /* Farbbild (16 Farben)               �� Bit Image    */
46 #define SgfVectFarb 4 /* Farben f�r Linien verwenden        Ŀ              */
47 #define SgfVectGray 5 /* Graustufen f�r Linien verwenden     ?Nur f�r      */
48 #define SgfVectWdth 6 /* Strichst�rken f�r Linien verwenden �� SimpVector   */
49 
50 
51 #define SgfHeaderSize 42
52 class SgfHeader
53 {
54 public:
55 	sal_uInt16 Magic;
56 	sal_uInt16 Version;
57 	sal_uInt16 Typ;
58 	sal_uInt16 Xsize;
59 	sal_uInt16 Ysize;
60 	sal_Int16  Xoffs;
61 	sal_Int16  Yoffs;
62 	sal_uInt16 Planes;    // Layer
63 	sal_uInt16 SwGrCol;
64 	char   Autor[10];
65 	char   Programm[10];
66 	sal_uInt16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (38 mod 4 =2) !
67 
68 	sal_uInt32 GetOffset();
69 	friend SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead);
70 	sal_Bool   ChkMagic();
71 };
72 
73 #define SgfEntrySize 22
74 class SgfEntry
75 {
76 public:
77 	sal_uInt16 Typ;
78 	sal_uInt16 iFrei;
79 	sal_uInt16 lFreiLo,lFreiHi;
80 	char   cFrei[10];
81 	sal_uInt16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (18 mod 4 =2) !
82 
83 	sal_uInt32 GetOffset();
84 	friend SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr);
85 };
86 
87 #define SgfVectorSize 10
88 class SgfVector
89 {
90 public:
91 	sal_uInt16 Flag;
92 	sal_Int16 x;
93 	sal_Int16 y;
94 	sal_uInt16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (6 mod 4 =2) !
95 
96 	friend SvStream& operator>>(SvStream& rIStream, SgfVector& rEntr);
97 };
98 
99 extern long SgfVectXofs;
100 extern long SgfVectYofs;
101 extern long SgfVectXmul;
102 extern long SgfVectYmul;
103 extern long SgfVectXdiv;
104 extern long SgfVectYdiv;
105 extern sal_Bool SgfVectScal;
106 
107 ////////////////////////////////////////////////////////////////////////////////////////////////////
108 // Windows BMP /////////////////////////////////////////////////////////////////////////////////////
109 ////////////////////////////////////////////////////////////////////////////////////////////////////
110 
111 #define BmpFileHeaderSize 14
112 class BmpFileHeader
113 {
114 public:
115 	sal_uInt16 Typ;            // = "BM"
116 	sal_uInt16 SizeLo,SizeHi;  // Filesize in Bytes
117 	sal_uInt16 Reserve1;       // Reserviert
118 	sal_uInt16 Reserve2;       // Reserviert
119 	sal_uInt16 OfsLo,OfsHi;    // Offset?
120 
121 	void   SetSize(sal_uInt32 Size);
122 	void   SetOfs(sal_uInt32 Size);
123 	sal_uInt32 GetOfs();
124 	friend SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead);
125 };
126 
127 #define BmpInfoHeaderSize 40
128 class BmpInfoHeader
129 {
130 public:
131 	sal_uInt32 Size;       // Gr��e des BmpInfoHeaders
132 	sal_Int32  Width;      // Breite in Pixel
133 	sal_Int32  Hight;      // H�he in Pixel
134 	sal_uInt16 Planes;     // Anzahl der Planes (immer 1)
135 	sal_uInt16 PixBits;    // Anzahl der Bit je Pixel (1,4,8,oder 24)
136 	sal_uInt32 Compress;   // Datenkompression
137 	sal_uInt32 ImgSize;    // Gr��e der Images in Bytes. Ohne Kompression ist auch 0 erlaubt.
138 	sal_Int32  xDpmm;      // Dot per Meter (0 ist erlaubt)
139 	sal_Int32  yDpmm;      // Dot per Meter (0 ist erlaubt)
140 	sal_uInt32 ColUsed;    // Anzahl der verwendeten Farben (0=alle)
141 	sal_uInt32 ColMust;    // Anzahl der wichtigen Farben (0=alle)
142 
143 	friend SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rHead);
144 };
145 
146 #define RGBQuadSize 4
147 class RGBQuad {
148 private:
149 	sal_uInt8 Red;
150 	sal_uInt8 Grn;
151 	sal_uInt8 Blu;
152 	sal_uInt8 Fil;
153 public:
154 	RGBQuad(sal_uInt8 R, sal_uInt8 G, sal_uInt8 B) { Red=R; Grn=G; Blu=B; Fil=0; }
155 };
156 
157 #endif //_SGFBRAM_HXX
158