merge the formfield patch from ooo-build
[ooovba.git] / goodies / source / filter.vcl / icgm / class1.cxx
blobf5e27129b160e95d137d14717d47081313547975
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: class1.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
34 #include <main.hxx>
36 // ---------------------------------------------------------------
38 void CGM::ImplDoClass1()
40 long nInteger, nI0, nI1;
41 sal_uInt32 nUInteger;
43 switch ( mnElementID )
45 case 0x01 : ComOut( CGM_LEVEL1, "Metafile Version" )
46 pElement->nMetaFileVersion = ImplGetI( pElement->nIntegerPrecision );
47 break;
48 case 0x02 : ComOut( CGM_LEVEL1, "Metafile Description" ) break;
49 case 0x03 : ComOut( CGM_LEVEL1, "VDC Type" )
51 nUInteger = ImplGetUI16();
52 switch( nUInteger )
54 case 0 : pElement->eVDCType = VDC_INTEGER; break;
55 case 1 : pElement->eVDCType = VDC_REAL; break;
56 default: mbStatus = sal_False; break;
59 break;
60 case 0x04 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Integer Precision" )
62 nInteger = ImplGetI( pElement->nIntegerPrecision );
63 switch ( nInteger )
65 case 32 :
66 case 24 :
67 case 16 :
68 case 8 : pElement->nIntegerPrecision = nInteger >> 3; break;
69 default : mbStatus = sal_False; break;
72 break;
73 case 0x05 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Real Precision" )
75 nUInteger = ImplGetUI16( 4 );
76 nI0 = ImplGetI( pElement->nIntegerPrecision ); // exponent
77 nI1 = ImplGetI( pElement->nIntegerPrecision ); // mantisse
78 switch( nUInteger )
80 case 0 :
81 pElement->eRealPrecision = RP_FLOAT;
82 switch ( nI0 )
84 case 9 :
85 if ( nI1 != 23 )
86 mbStatus = sal_False;
87 pElement->nRealSize = 4;
88 break;
89 case 12 :
90 if ( nI1 != 52 )
91 mbStatus =sal_False;
92 pElement->nRealSize = 8;
93 break;
94 default:
95 mbStatus = sal_False;
96 break;
98 break;
99 case 1 :
100 pElement->eRealPrecision = RP_FIXED;
101 if ( nI0 != nI1 )
102 mbStatus = sal_False;
103 if ( nI0 == 16 )
104 pElement->nRealSize = 4;
105 else if ( nI0 == 32 )
106 pElement->nRealSize = 8;
107 else
108 mbStatus = sal_False;
109 break;
110 default :
111 mbStatus = sal_False; break;
114 break;
115 case 0x06 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Index Precision" )
117 nInteger = ImplGetI( pElement->nIntegerPrecision );
118 switch ( nInteger )
120 case 32 :
121 case 24 :
122 case 16 :
123 case 8 : pElement->nIndexPrecision = nInteger >> 3; break;
124 default : mbStatus = sal_False; break;
127 break;
128 case 0x07 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Precision" )
130 nInteger = ImplGetI( pElement->nIntegerPrecision );
131 switch ( nInteger )
133 case 32 :
134 case 24 :
135 case 16 :
136 case 8 : pElement->nColorPrecision = nInteger >> 3; break;
137 default : mbStatus = sal_False; break;
140 break;
141 case 0x08 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Index Precision" )
143 nInteger = ImplGetI( pElement->nIntegerPrecision );
144 switch ( nInteger )
146 case 32 :
147 case 24 :
148 case 16 :
149 case 8 : pElement->nColorIndexPrecision = nInteger >> 3; break;
150 default : mbStatus = sal_False; break;
153 break;
154 case 0x09 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Maximum Colour Index" )
156 pElement->nColorMaximumIndex = ImplGetUI( pElement->nColorIndexPrecision );
157 if ( ( pElement->nColorMaximumIndex > 256 /*255*/ ) || ( pElement->nColorMaximumIndex == 0 ) )
158 mbStatus = sal_False;
160 break;
161 case 0x0a : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Color Value Extent" )
163 if ( pElement->eColorModel == CM_RGB )
164 nI1 = 6;
165 else
167 nI1 = 8;
168 mbStatus = sal_False; // CMYK is not supported
170 for ( nI0 = 0; nI0 < nI1; nI0++ )
172 pElement->nColorValueExtent[ nI0 ] = (sal_uInt8)ImplGetUI( pElement->nColorPrecision );
175 break;
176 case 0x0b : ComOut( CGM_LEVEL1, "MetaFile Element List" ) break;
177 case 0x0c : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "MetaFile Default Replacement" )
179 if ( mnElementSize > 1 )
181 sal_Int8* pBuf = new sal_Int8[ mnElementSize ];
182 if ( pBuf )
184 memcpy( pBuf, mpSource, mnElementSize );
185 maDefRepList.Insert( pBuf, LIST_APPEND );
186 maDefRepSizeList.Insert( (void*)mnElementSize, LIST_APPEND );
189 mnParaSize = mnElementSize;
191 break;
192 case 0x0d : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Font List" )
194 while ( mnParaSize < mnElementSize )
196 sal_uInt32 nSize;
197 nSize = ImplGetUI( 1 );
198 pElement->aFontList.InsertName( mpSource + mnParaSize, nSize );
199 mnParaSize += nSize;
202 break;
203 case 0x0e : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Set List" )
205 while ( mnParaSize < mnElementSize )
207 sal_uInt32 nCharSetType;
208 sal_uInt32 nSize;
209 nCharSetType = ImplGetUI16();
210 nSize = ImplGetUI( 1 );
211 pElement->aFontList.InsertCharSet( (CharSetType)nCharSetType, mpSource + mnParaSize, nSize );
212 mnParaSize += nSize;
215 break;
216 case 0x0f : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Character Coding Announcer" )
217 pElement->eCharacterCodingA = (CharacterCodingA)ImplGetUI16();
218 break;
219 case 0x10 : ComOut( CGM_LEVEL2, "Name Precision" ) break; // NS
220 case 0x11 : ComOut( CGM_LEVEL2, "Maximum VDC Extent" ) break; // NS
221 case 0x12 : ComOut( CGM_LEVEL2, "Segment Priority Extent" ) break; // NS
222 case 0x13 : ComOut( CGM_LEVEL3, "Color Model" ) break; // NS
223 case 0x14 : ComOut( CGM_LEVEL3, "Color Calibration" ) break; // NS
224 case 0x15 : ComOut( CGM_LEVEL3, "Font Properties" ) break; // NS
225 case 0x16 : ComOut( CGM_LEVEL3, "Glyph Mapping" ) break; // NS
226 case 0x17 : ComOut( CGM_LEVEL3, "Symbol Library List" ) break; // NS
227 case 0xfc : ComOut( CGM_GDSF_ONLY, "Inquire Function Support" ) break;
228 case 0xfa : ComOut( CGM_GDSF_ONLY, "End Metafile Defaults Replacement" ) break;
229 case 0xf8 : ComOut( CGM_GDSF_ONLY, "Set Color Value Desc Extent" ) break;
230 default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;