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