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 : :
30 : : #include <main.hxx>
31 : :
32 : : // ---------------------------------------------------------------
33 : :
34 : 0 : void CGM::ImplDoClass1()
35 : : {
36 : : long nInteger, nI0, nI1;
37 : : sal_uInt32 nUInteger;
38 : :
39 : 0 : switch ( mnElementID )
40 : : {
41 : : case 0x01 : /*Metafile Version*/
42 : 0 : pElement->nMetaFileVersion = ImplGetI( pElement->nIntegerPrecision );
43 : 0 : break;
44 : 0 : case 0x02 : /*Metafile Description */break;
45 : : case 0x03 : /*VDC Type*/
46 : : {
47 : 0 : nUInteger = ImplGetUI16();
48 : 0 : switch( nUInteger )
49 : : {
50 : 0 : case 0 : pElement->eVDCType = VDC_INTEGER; break;
51 : 0 : case 1 : pElement->eVDCType = VDC_REAL; break;
52 : 0 : default: mbStatus = sal_False; break;
53 : : }
54 : : }
55 : 0 : break;
56 : : case 0x04 : /*Integer Precision*/
57 : : {
58 : 0 : nInteger = ImplGetI( pElement->nIntegerPrecision );
59 : 0 : switch ( nInteger )
60 : : {
61 : : case 32 :
62 : : case 24 :
63 : : case 16 :
64 : 0 : case 8 : pElement->nIntegerPrecision = nInteger >> 3; break;
65 : 0 : default : mbStatus = sal_False; break;
66 : : }
67 : : }
68 : 0 : break;
69 : : case 0x05 : /*Real Precision*/
70 : : {
71 : 0 : nUInteger = ImplGetUI16( 4 );
72 : 0 : nI0 = ImplGetI( pElement->nIntegerPrecision ); // exponent
73 : 0 : nI1 = ImplGetI( pElement->nIntegerPrecision ); // mantisse
74 : 0 : switch( nUInteger )
75 : : {
76 : : case 0 :
77 : 0 : pElement->eRealPrecision = RP_FLOAT;
78 : 0 : switch ( nI0 )
79 : : {
80 : : case 9 :
81 : 0 : if ( nI1 != 23 )
82 : 0 : mbStatus = sal_False;
83 : 0 : pElement->nRealSize = 4;
84 : 0 : break;
85 : : case 12 :
86 : 0 : if ( nI1 != 52 )
87 : 0 : mbStatus =sal_False;
88 : 0 : pElement->nRealSize = 8;
89 : 0 : break;
90 : : default:
91 : 0 : mbStatus = sal_False;
92 : 0 : break;
93 : : }
94 : 0 : break;
95 : : case 1 :
96 : 0 : pElement->eRealPrecision = RP_FIXED;
97 : 0 : if ( nI0 != nI1 )
98 : 0 : mbStatus = sal_False;
99 : 0 : if ( nI0 == 16 )
100 : 0 : pElement->nRealSize = 4;
101 : 0 : else if ( nI0 == 32 )
102 : 0 : pElement->nRealSize = 8;
103 : : else
104 : 0 : mbStatus = sal_False;
105 : 0 : break;
106 : : default :
107 : 0 : mbStatus = sal_False; break;
108 : : }
109 : : }
110 : 0 : break;
111 : : case 0x06 : /*Index Precision*/
112 : : {
113 : 0 : nInteger = ImplGetI( pElement->nIntegerPrecision );
114 : 0 : switch ( nInteger )
115 : : {
116 : : case 32 :
117 : : case 24 :
118 : : case 16 :
119 : 0 : case 8 : pElement->nIndexPrecision = nInteger >> 3; break;
120 : 0 : default : mbStatus = sal_False; break;
121 : : }
122 : : }
123 : 0 : break;
124 : : case 0x07 : /*Color Precision*/
125 : : {
126 : 0 : nInteger = ImplGetI( pElement->nIntegerPrecision );
127 : 0 : switch ( nInteger )
128 : : {
129 : : case 32 :
130 : : case 24 :
131 : : case 16 :
132 : 0 : case 8 : pElement->nColorPrecision = nInteger >> 3; break;
133 : 0 : default : mbStatus = sal_False; break;
134 : : }
135 : : }
136 : 0 : break;
137 : : case 0x08 : /*Color Index Precision*/
138 : : {
139 : 0 : nInteger = ImplGetI( pElement->nIntegerPrecision );
140 : 0 : switch ( nInteger )
141 : : {
142 : : case 32 :
143 : : case 24 :
144 : : case 16 :
145 : 0 : case 8 : pElement->nColorIndexPrecision = nInteger >> 3; break;
146 : 0 : default : mbStatus = sal_False; break;
147 : : }
148 : : }
149 : 0 : break;
150 : : case 0x09 : /*Maximum Colour Index*/
151 : : {
152 : 0 : pElement->nColorMaximumIndex = ImplGetUI( pElement->nColorIndexPrecision );
153 : 0 : if ( ( pElement->nColorMaximumIndex > 256 /*255*/ ) || ( pElement->nColorMaximumIndex == 0 ) )
154 : 0 : mbStatus = sal_False;
155 : : }
156 : 0 : break;
157 : : case 0x0a : /*Color Value Extent*/
158 : : {
159 : 0 : if ( pElement->eColorModel == CM_RGB )
160 : 0 : nI1 = 6;
161 : : else
162 : : {
163 : 0 : nI1 = 8;
164 : 0 : mbStatus = sal_False; // CMYK is not supported
165 : : }
166 : 0 : for ( nI0 = 0; nI0 < nI1; nI0++ )
167 : : {
168 : 0 : pElement->nColorValueExtent[ nI0 ] = (sal_uInt8)ImplGetUI( pElement->nColorPrecision );
169 : : }
170 : : }
171 : 0 : break;
172 : 0 : case 0x0b : /*MetaFile Element List */break;
173 : : case 0x0c : /*MetaFile Default Replacement*/
174 : : {
175 : 0 : if ( mnElementSize > 1 )
176 : : {
177 : 0 : sal_uInt8* pBuf = new sal_uInt8[ mnElementSize ];
178 : 0 : if ( pBuf )
179 : : {
180 : 0 : memcpy( pBuf, mpSource, mnElementSize );
181 : 0 : maDefRepList.push_back( pBuf );
182 : 0 : maDefRepSizeList.push_back( mnElementSize );
183 : : }
184 : : }
185 : 0 : mnParaSize = mnElementSize;
186 : : }
187 : 0 : break;
188 : : case 0x0d : /*Font List*/
189 : : {
190 : 0 : while ( mnParaSize < mnElementSize )
191 : : {
192 : : sal_uInt32 nSize;
193 : 0 : nSize = ImplGetUI( 1 );
194 : 0 : pElement->aFontList.InsertName( mpSource + mnParaSize, nSize );
195 : 0 : mnParaSize += nSize;
196 : : }
197 : : }
198 : 0 : break;
199 : : case 0x0e : /*Character Set List*/
200 : : {
201 : 0 : while ( mnParaSize < mnElementSize )
202 : : {
203 : : sal_uInt32 nCharSetType;
204 : : sal_uInt32 nSize;
205 : 0 : nCharSetType = ImplGetUI16();
206 : 0 : nSize = ImplGetUI( 1 );
207 : 0 : pElement->aFontList.InsertCharSet( (CharSetType)nCharSetType, mpSource + mnParaSize, nSize );
208 : 0 : mnParaSize += nSize;
209 : : }
210 : : }
211 : 0 : break;
212 : : case 0x0f : /*Character Coding Announcer*/
213 : 0 : pElement->eCharacterCodingA = (CharacterCodingA)ImplGetUI16();
214 : 0 : break;
215 : 0 : case 0x10 : /*Name Precision */break; // NS
216 : 0 : case 0x11 : /*Maximum VDC Extent */break; // NS
217 : 0 : case 0x12 : /*Segment Priority Extent */break; // NS
218 : 0 : case 0x13 : /*Color Model */break; // NS
219 : 0 : case 0x14 : /*Color Calibration */break; // NS
220 : 0 : case 0x15 : /*Font Properties */break; // NS
221 : 0 : case 0x16 : /*Glyph Mapping */break; // NS
222 : 0 : case 0x17 : /*Symbol Library List */break; // NS
223 : 0 : case 0xfc : /*Inquire Function Support */break;
224 : 0 : case 0xfa : /*End Metafile Defaults Replacement */break;
225 : 0 : case 0xf8 : /*Set Color Value Desc Extent */break;
226 : 0 : default: break;
227 : : }
228 : 0 : };
229 : :
230 : :
231 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|