1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: class1.cxx,v $
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"
36 // ---------------------------------------------------------------
38 void CGM::ImplDoClass1()
40 long nInteger
, nI0
, nI1
;
43 switch ( mnElementID
)
45 case 0x01 : ComOut( CGM_LEVEL1
, "Metafile Version" )
46 pElement
->nMetaFileVersion
= ImplGetI( pElement
->nIntegerPrecision
);
48 case 0x02 : ComOut( CGM_LEVEL1
, "Metafile Description" ) break;
49 case 0x03 : ComOut( CGM_LEVEL1
, "VDC Type" )
51 nUInteger
= ImplGetUI16();
54 case 0 : pElement
->eVDCType
= VDC_INTEGER
; break;
55 case 1 : pElement
->eVDCType
= VDC_REAL
; break;
56 default: mbStatus
= sal_False
; break;
60 case 0x04 : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Integer Precision" )
62 nInteger
= ImplGetI( pElement
->nIntegerPrecision
);
68 case 8 : pElement
->nIntegerPrecision
= nInteger
>> 3; break;
69 default : mbStatus
= sal_False
; 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
81 pElement
->eRealPrecision
= RP_FLOAT
;
87 pElement
->nRealSize
= 4;
92 pElement
->nRealSize
= 8;
100 pElement
->eRealPrecision
= RP_FIXED
;
102 mbStatus
= sal_False
;
104 pElement
->nRealSize
= 4;
105 else if ( nI0
== 32 )
106 pElement
->nRealSize
= 8;
108 mbStatus
= sal_False
;
111 mbStatus
= sal_False
; break;
115 case 0x06 : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Index Precision" )
117 nInteger
= ImplGetI( pElement
->nIntegerPrecision
);
123 case 8 : pElement
->nIndexPrecision
= nInteger
>> 3; break;
124 default : mbStatus
= sal_False
; break;
128 case 0x07 : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Color Precision" )
130 nInteger
= ImplGetI( pElement
->nIntegerPrecision
);
136 case 8 : pElement
->nColorPrecision
= nInteger
>> 3; break;
137 default : mbStatus
= sal_False
; break;
141 case 0x08 : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Color Index Precision" )
143 nInteger
= ImplGetI( pElement
->nIntegerPrecision
);
149 case 8 : pElement
->nColorIndexPrecision
= nInteger
>> 3; break;
150 default : mbStatus
= sal_False
; 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
;
161 case 0x0a : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Color Value Extent" )
163 if ( pElement
->eColorModel
== CM_RGB
)
168 mbStatus
= sal_False
; // CMYK is not supported
170 for ( nI0
= 0; nI0
< nI1
; nI0
++ )
172 pElement
->nColorValueExtent
[ nI0
] = (sal_uInt8
)ImplGetUI( pElement
->nColorPrecision
);
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
];
184 memcpy( pBuf
, mpSource
, mnElementSize
);
185 maDefRepList
.Insert( pBuf
, LIST_APPEND
);
186 maDefRepSizeList
.Insert( (void*)mnElementSize
, LIST_APPEND
);
189 mnParaSize
= mnElementSize
;
192 case 0x0d : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Font List" )
194 while ( mnParaSize
< mnElementSize
)
197 nSize
= ImplGetUI( 1 );
198 pElement
->aFontList
.InsertName( mpSource
+ mnParaSize
, nSize
);
203 case 0x0e : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Character Set List" )
205 while ( mnParaSize
< mnElementSize
)
207 sal_uInt32 nCharSetType
;
209 nCharSetType
= ImplGetUI16();
210 nSize
= ImplGetUI( 1 );
211 pElement
->aFontList
.InsertCharSet( (CharSetType
)nCharSetType
, mpSource
+ mnParaSize
, nSize
);
216 case 0x0f : ComOut( CGM_LEVEL1
| CGM_DRAWING_PLUS_CONTROL_SET
, "Character Coding Announcer" )
217 pElement
->eCharacterCodingA
= (CharacterCodingA
)ImplGetUI16();
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;