merge the formfield patch from ooo-build
[ooovba.git] / goodies / source / filter.vcl / icgm / class2.cxx
blob8cc9d6a2c4646c30edbec04a1ab4875fdf129580
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: class2.cxx,v $
10 * $Revision: 1.5 $
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::ImplDoClass2()
40 sal_uInt32 nUInteger;
41 switch ( mnElementID )
43 case 0x01 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Scaling Mode" )
45 if ( mnElementSize ) // HACK (NASA.CGM)
47 switch( ImplGetUI16() )
49 case 0 : pElement->eScalingMode = SM_ABSTRACT; break;
50 case 1 : pElement->eScalingMode = SM_METRIC; break;
51 default : mbStatus = sal_False; break;
53 pElement->nScalingFactor = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
54 ImplSetMapMode();
57 break;
58 case 0x02 : ComOut( CGM_LEVEL1, "Color Selection Mode" )
60 nUInteger = ImplGetUI16();
61 switch( nUInteger )
63 case 0 : pElement->eColorSelectionMode = CSM_INDEXED; break;
64 case 1 : pElement->eColorSelectionMode = CSM_DIRECT; break;
65 default : mbStatus = sal_False; break;
68 break;
69 case 0x03 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Line Width Specification Mode" )
71 nUInteger = ImplGetUI16();
72 switch( nUInteger )
74 case 0 : pElement->eLineWidthSpecMode = SM_ABSOLUTE; break;
75 case 1 : pElement->eLineWidthSpecMode = SM_SCALED; break;
76 default : mbStatus = sal_False; break;
79 break;
80 case 0x04 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Marker Size Specification Mode" )
82 nUInteger = ImplGetUI16();
83 switch( nUInteger )
85 case 0 : pElement->eMarkerSizeSpecMode = SM_ABSOLUTE; break;
86 case 1 : pElement->eMarkerSizeSpecMode = SM_SCALED; break;
87 default : mbStatus = sal_False; break;
90 break;
91 case 0x05 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Edge Width Specification Mode" )
93 nUInteger = ImplGetUI16();
94 switch( nUInteger )
96 case 0 : pElement->eEdgeWidthSpecMode = SM_ABSOLUTE; break;
97 case 1 : pElement->eEdgeWidthSpecMode = SM_SCALED; break;
98 default : mbStatus = sal_False; break;
101 break;
102 case 0x06 : ComOut( CGM_LEVEL1, "VDC Extent" )
104 ImplGetRectangleNS( pElement->aVDCExtent );
105 ImplSetMapMode();
107 break;
108 case 0x07 : ComOut( CGM_LEVEL1, "Background Color" )
109 pElement->nBackGroundColor = ImplGetBitmapColor( sal_True );
110 break;
111 case 0x08 : ComOut( CGM_LEVEL2, "Device Viewport" )
113 if ( pElement->eVDCType == VDC_INTEGER )
114 ImplGetRectangle( pElement->aDeviceViewPort );
115 ImplSetMapMode();
117 break;
118 case 0x09 : ComOut( CGM_LEVEL2, "Device Viewport Specification Mode" )
120 nUInteger = ImplGetUI16( 8 );
121 switch( nUInteger )
123 case 0 : pElement->eDeviceViewPortMode = DVPM_FRACTION; break;
124 case 1 : pElement->eDeviceViewPortMode = DVPM_METRIC; break;
125 case 2 : pElement->eDeviceViewPortMode = DVPM_DEVICE; break;
126 default : mbStatus = sal_False; break;
128 pElement->nDeviceViewPortScale = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
129 ImplSetMapMode();
131 break;
132 case 0x0a : ComOut( CGM_LEVEL2, "Device Viewport Mapping" )
134 switch( ImplGetUI16() )
136 case 0 : pElement->eDeviceViewPortMap = DVPM_NOT_FORCED; break;
137 case 1 : pElement->eDeviceViewPortMap = DVPM_FORCED; break;
138 default : mbStatus = sal_False; break;
140 switch( ImplGetUI16() )
142 case 0 : pElement->eDeviceViewPortMapH = DVPMH_LEFT; break;
143 case 1 : pElement->eDeviceViewPortMapH = DVPMH_CENTER; break;
144 case 2 : pElement->eDeviceViewPortMapH = CVPMH_RIGHT; break;
145 default : mbStatus = sal_False; break;
147 switch( ImplGetUI16() )
149 case 0 : pElement->eDeviceViewPortMapV = DVPMV_BOTTOM; break;
150 case 1 : pElement->eDeviceViewPortMapV = DVPMV_CENTER; break;
151 case 2 : pElement->eDeviceViewPortMapV = DVPMV_TOP; break;
152 default : mbStatus = sal_False; break;
154 ImplSetMapMode();
156 break;
157 case 0x0b : ComOut( CGM_LEVEL2, "Line Representation" )
159 LineBundle aTempLineBundle;
160 aTempLineBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
161 aTempLineBundle.eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
162 aTempLineBundle.nLineWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
163 aTempLineBundle.SetColor( ImplGetBitmapColor() );
164 pElement->InsertBundle( pElement->aLineList, aTempLineBundle );
166 break;
167 case 0x0c : ComOut( CGM_LEVEL2, "Marker Representation" )
169 MarkerBundle aTempMarkerBundle;
170 aTempMarkerBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
171 aTempMarkerBundle.eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
172 aTempMarkerBundle.nMarkerSize = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
173 aTempMarkerBundle.SetColor( ImplGetBitmapColor() );
174 pElement->InsertBundle( pElement->aMarkerList, aTempMarkerBundle );
176 break;
177 case 0x0d : ComOut( CGM_LEVEL2, "Text Representation" )
179 TextBundle aTempTextBundle;
180 aTempTextBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
181 aTempTextBundle.nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
182 aTempTextBundle.eTextPrecision = (TextPrecision)ImplGetI( pElement->nIndexPrecision );
183 aTempTextBundle.nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
184 aTempTextBundle.nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
185 aTempTextBundle.SetColor( ImplGetBitmapColor() );
186 pElement->InsertBundle( pElement->aTextList, aTempTextBundle );
188 break;
189 case 0x0e : ComOut( CGM_LEVEL2, "Fill Representation" )
191 FillBundle aTempFillBundle;
192 aTempFillBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
193 aTempFillBundle.eFillInteriorStyle = (FillInteriorStyle)ImplGetI( pElement->nIndexPrecision );
194 aTempFillBundle.SetColor( ImplGetBitmapColor() );
195 aTempFillBundle.nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
196 aTempFillBundle.nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
197 pElement->InsertBundle( pElement->aFillList, aTempFillBundle );
199 break;
200 case 0x0f : ComOut( CGM_LEVEL2, "Edge Representation" )
202 EdgeBundle aTempEdgeBundle;
203 aTempEdgeBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
204 aTempEdgeBundle.eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
205 aTempEdgeBundle.nEdgeWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
206 aTempEdgeBundle.SetColor( ImplGetBitmapColor() );
207 pElement->InsertBundle( pElement->aEdgeList, aTempEdgeBundle );
209 break;
210 case 0x10 : ComOut( CGM_LEVEL3, "Interior Style Specification Mode" ) break; // NS
211 case 0x11 : ComOut( CGM_LEVEL3, "Line and Edge Type Definition" ) break;
212 case 0x12 : ComOut( CGM_LEVEL3, "Hatch Style Definition" ) break; // NS
213 case 0x13 : ComOut( CGM_LEVEL3, "Geometric Pattern Definition" ) break; // NS
214 case 0xff : ComOut( CGM_GDSF_ONLY, "inquire VDC EXTENT" ) break;
215 case 0xfe : ComOut( CGM_GDSF_ONLY, "inquire Background Color" ) break;
216 case 0xfd : ComOut( CGM_GDSF_ONLY, "inquire Device Viewport" ) break;
217 case 0xfc : ComOut( CGM_GDSF_ONLY, "set Font Selection Mode" ) break;
218 case 0xfb : ComOut( CGM_GDSF_ONLY, "inquire Color Selection Mode" ) break;
219 case 0xfa : ComOut( CGM_GDSF_ONLY, "inquire Font Selection Mode" ) break;
220 case 0xf9 : ComOut( CGM_GDSF_ONLY, "set Char Height Spec Mode" )
222 ImplGetUI16(); // -Wall is this really needed?
224 break;
225 case 0xf8 : ComOut( CGM_GDSF_ONLY, "set Background Style" ) break;
226 default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;