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