xref: /trunk/main/svtools/source/inc/sgfbram.hxx (revision 01aa44aa)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SGFBRAM_HXX
25 #define _SGFBRAM_HXX
26 
27 #include <tools/solar.h>
28 
29 #define SgfBitImag0   1 /* Bitmap                      */
30 #define SgfBitImag1   4 /* Bitmap                      */
31 #define SgfBitImag2   5 /* Bitmap                      */
32 #define SgfBitImgMo   6 /* Monochrome Bitmap           */
33 #define SgfSimpVect   2 /* Einfaches Vectorformat      */
34 #define SgfPostScrp   3 /* Postscript file             */
35 #define SgfStarDraw   7 /* StarDraw SGV-Datei          */
36 #define SgfDontKnow 255 /* Unbekannt oder kein SGF/SGV */
37 
38 // Konstanten f�r SgfHeader.SwGrCol
39 #define SgfBlckWhit 1 /* Schwarz/Wei?Bild                  Ŀ SimpVector,  */
40 #define SgfGrayscal 2 /* Bild mit Graustufen                 ?StarDraw und */
41 #define Sgf16Colors 3 /* Farbbild (16 Farben)               �� Bit Image    */
42 #define SgfVectFarb 4 /* Farben f�r Linien verwenden        Ŀ              */
43 #define SgfVectGray 5 /* Graustufen f�r Linien verwenden     ?Nur f�r      */
44 #define SgfVectWdth 6 /* Strichst�rken f�r Linien verwenden �� SimpVector   */
45 
46 
47 #define SgfHeaderSize 42
48 class SgfHeader
49 {
50 public:
51 	sal_uInt16 Magic;
52 	sal_uInt16 Version;
53 	sal_uInt16 Typ;
54 	sal_uInt16 Xsize;
55 	sal_uInt16 Ysize;
56 	sal_Int16  Xoffs;
57 	sal_Int16  Yoffs;
58 	sal_uInt16 Planes;    // Layer
59 	sal_uInt16 SwGrCol;
60 	char   Autor[10];
61 	char   Programm[10];
62 	sal_uInt16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (38 mod 4 =2) !
63 
64 	sal_uInt32 GetOffset();
65 	friend SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead);
66 	sal_Bool   ChkMagic();
67 };
68 
69 #define SgfEntrySize 22
70 class SgfEntry
71 {
72 public:
73 	sal_uInt16 Typ;
74 	sal_uInt16 iFrei;
75 	sal_uInt16 lFreiLo,lFreiHi;
76 	char   cFrei[10];
77 	sal_uInt16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (18 mod 4 =2) !
78 
79 	sal_uInt32 GetOffset();
80 	friend SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr);
81 };
82 
83 #define SgfVectorSize 10
84 class SgfVector
85 {
86 public:
87 	sal_uInt16 Flag;
88 	sal_Int16 x;
89 	sal_Int16 y;
90 	sal_uInt16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (6 mod 4 =2) !
91 
92 	friend SvStream& operator>>(SvStream& rIStream, SgfVector& rEntr);
93 };
94 
95 extern long SgfVectXofs;
96 extern long SgfVectYofs;
97 extern long SgfVectXmul;
98 extern long SgfVectYmul;
99 extern long SgfVectXdiv;
100 extern long SgfVectYdiv;
101 extern sal_Bool SgfVectScal;
102 
103 ////////////////////////////////////////////////////////////////////////////////////////////////////
104 // Windows BMP /////////////////////////////////////////////////////////////////////////////////////
105 ////////////////////////////////////////////////////////////////////////////////////////////////////
106 
107 #define BmpFileHeaderSize 14
108 class BmpFileHeader
109 {
110 public:
111 	sal_uInt16 Typ;            // = "BM"
112 	sal_uInt16 SizeLo,SizeHi;  // Filesize in Bytes
113 	sal_uInt16 Reserve1;       // Reserviert
114 	sal_uInt16 Reserve2;       // Reserviert
115 	sal_uInt16 OfsLo,OfsHi;    // Offset?
116 
117 	void   SetSize(sal_uInt32 Size);
118 	void   SetOfs(sal_uInt32 Size);
119 	sal_uInt32 GetOfs();
120 	friend SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead);
121 };
122 
123 #define BmpInfoHeaderSize 40
124 class BmpInfoHeader
125 {
126 public:
127 	sal_uInt32 Size;       // Gr��e des BmpInfoHeaders
128 	sal_Int32  Width;      // Breite in Pixel
129 	sal_Int32  Hight;      // H�he in Pixel
130 	sal_uInt16 Planes;     // Anzahl der Planes (immer 1)
131 	sal_uInt16 PixBits;    // Anzahl der Bit je Pixel (1,4,8,oder 24)
132 	sal_uInt32 Compress;   // Datenkompression
133 	sal_uInt32 ImgSize;    // Gr��e der Images in Bytes. Ohne Kompression ist auch 0 erlaubt.
134 	sal_Int32  xDpmm;      // Dot per Meter (0 ist erlaubt)
135 	sal_Int32  yDpmm;      // Dot per Meter (0 ist erlaubt)
136 	sal_uInt32 ColUsed;    // Anzahl der verwendeten Farben (0=alle)
137 	sal_uInt32 ColMust;    // Anzahl der wichtigen Farben (0=alle)
138 
139 	friend SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rHead);
140 };
141 
142 #define RGBQuadSize 4
143 class RGBQuad {
144 private:
145 	sal_uInt8 Red;
146 	sal_uInt8 Grn;
147 	sal_uInt8 Blu;
148 	sal_uInt8 Fil;
149 public:
RGBQuad(sal_uInt8 R,sal_uInt8 G,sal_uInt8 B)150 	RGBQuad(sal_uInt8 R, sal_uInt8 G, sal_uInt8 B) { Red=R; Grn=G; Blu=B; Fil=0; }
151 };
152 
153 #endif //_SGFBRAM_HXX
154