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
ImplDoClass2()31 void CGM::ImplDoClass2()
32 {
33 sal_uInt32 nUInteger;
34 switch ( mnElementID )
35 {
36 case 0x01 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Scaling Mode" )
37 {
38 if ( mnElementSize ) // HACK (NASA.CGM)
39 {
40 switch( ImplGetUI16() )
41 {
42 case 0 : pElement->eScalingMode = SM_ABSTRACT; break;
43 case 1 : pElement->eScalingMode = SM_METRIC; break;
44 default : mbStatus = sal_False; break;
45 }
46 pElement->nScalingFactor = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
47 ImplSetMapMode();
48 }
49 }
50 break;
51 case 0x02 : ComOut( CGM_LEVEL1, "Color Selection Mode" )
52 {
53 nUInteger = ImplGetUI16();
54 switch( nUInteger )
55 {
56 case 0 : pElement->eColorSelectionMode = CSM_INDEXED; break;
57 case 1 : pElement->eColorSelectionMode = CSM_DIRECT; break;
58 default : mbStatus = sal_False; break;
59 }
60 }
61 break;
62 case 0x03 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Line Width Specification Mode" )
63 {
64 nUInteger = ImplGetUI16();
65 switch( nUInteger )
66 {
67 case 0 : pElement->eLineWidthSpecMode = SM_ABSOLUTE; break;
68 case 1 : pElement->eLineWidthSpecMode = SM_SCALED; break;
69 default : mbStatus = sal_False; break;
70 }
71 }
72 break;
73 case 0x04 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Marker Size Specification Mode" )
74 {
75 nUInteger = ImplGetUI16();
76 switch( nUInteger )
77 {
78 case 0 : pElement->eMarkerSizeSpecMode = SM_ABSOLUTE; break;
79 case 1 : pElement->eMarkerSizeSpecMode = SM_SCALED; break;
80 default : mbStatus = sal_False; break;
81 }
82 }
83 break;
84 case 0x05 : ComOut( CGM_LEVEL1 | CGM_DRAWING_PLUS_CONTROL_SET, "Edge Width Specification Mode" )
85 {
86 nUInteger = ImplGetUI16();
87 switch( nUInteger )
88 {
89 case 0 : pElement->eEdgeWidthSpecMode = SM_ABSOLUTE; break;
90 case 1 : pElement->eEdgeWidthSpecMode = SM_SCALED; break;
91 default : mbStatus = sal_False; break;
92 }
93 }
94 break;
95 case 0x06 : ComOut( CGM_LEVEL1, "VDC Extent" )
96 {
97 ImplGetRectangleNS( pElement->aVDCExtent );
98 ImplSetMapMode();
99 }
100 break;
101 case 0x07 : ComOut( CGM_LEVEL1, "Background Color" )
102 pElement->nBackGroundColor = ImplGetBitmapColor( sal_True );
103 break;
104 case 0x08 : ComOut( CGM_LEVEL2, "Device Viewport" )
105 {
106 if ( pElement->eVDCType == VDC_INTEGER )
107 ImplGetRectangle( pElement->aDeviceViewPort );
108 ImplSetMapMode();
109 }
110 break;
111 case 0x09 : ComOut( CGM_LEVEL2, "Device Viewport Specification Mode" )
112 {
113 nUInteger = ImplGetUI16( 8 );
114 switch( nUInteger )
115 {
116 case 0 : pElement->eDeviceViewPortMode = DVPM_FRACTION; break;
117 case 1 : pElement->eDeviceViewPortMode = DVPM_METRIC; break;
118 case 2 : pElement->eDeviceViewPortMode = DVPM_DEVICE; break;
119 default : mbStatus = sal_False; break;
120 }
121 pElement->nDeviceViewPortScale = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
122 ImplSetMapMode();
123 }
124 break;
125 case 0x0a : ComOut( CGM_LEVEL2, "Device Viewport Mapping" )
126 {
127 switch( ImplGetUI16() )
128 {
129 case 0 : pElement->eDeviceViewPortMap = DVPM_NOT_FORCED; break;
130 case 1 : pElement->eDeviceViewPortMap = DVPM_FORCED; break;
131 default : mbStatus = sal_False; break;
132 }
133 switch( ImplGetUI16() )
134 {
135 case 0 : pElement->eDeviceViewPortMapH = DVPMH_LEFT; break;
136 case 1 : pElement->eDeviceViewPortMapH = DVPMH_CENTER; break;
137 case 2 : pElement->eDeviceViewPortMapH = CVPMH_RIGHT; break;
138 default : mbStatus = sal_False; break;
139 }
140 switch( ImplGetUI16() )
141 {
142 case 0 : pElement->eDeviceViewPortMapV = DVPMV_BOTTOM; break;
143 case 1 : pElement->eDeviceViewPortMapV = DVPMV_CENTER; break;
144 case 2 : pElement->eDeviceViewPortMapV = DVPMV_TOP; break;
145 default : mbStatus = sal_False; break;
146 }
147 ImplSetMapMode();
148 }
149 break;
150 case 0x0b : ComOut( CGM_LEVEL2, "Line Representation" )
151 {
152 LineBundle aTempLineBundle;
153 aTempLineBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
154 aTempLineBundle.eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
155 aTempLineBundle.nLineWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
156 aTempLineBundle.SetColor( ImplGetBitmapColor() );
157 pElement->InsertBundle( pElement->aLineList, aTempLineBundle );
158 }
159 break;
160 case 0x0c : ComOut( CGM_LEVEL2, "Marker Representation" )
161 {
162 MarkerBundle aTempMarkerBundle;
163 aTempMarkerBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
164 aTempMarkerBundle.eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
165 aTempMarkerBundle.nMarkerSize = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
166 aTempMarkerBundle.SetColor( ImplGetBitmapColor() );
167 pElement->InsertBundle( pElement->aMarkerList, aTempMarkerBundle );
168 }
169 break;
170 case 0x0d : ComOut( CGM_LEVEL2, "Text Representation" )
171 {
172 TextBundle aTempTextBundle;
173 aTempTextBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
174 aTempTextBundle.nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
175 aTempTextBundle.eTextPrecision = (TextPrecision)ImplGetI( pElement->nIndexPrecision );
176 aTempTextBundle.nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
177 aTempTextBundle.nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
178 aTempTextBundle.SetColor( ImplGetBitmapColor() );
179 pElement->InsertBundle( pElement->aTextList, aTempTextBundle );
180 }
181 break;
182 case 0x0e : ComOut( CGM_LEVEL2, "Fill Representation" )
183 {
184 FillBundle aTempFillBundle;
185 aTempFillBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
186 aTempFillBundle.eFillInteriorStyle = (FillInteriorStyle)ImplGetI( pElement->nIndexPrecision );
187 aTempFillBundle.SetColor( ImplGetBitmapColor() );
188 aTempFillBundle.nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
189 aTempFillBundle.nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
190 pElement->InsertBundle( pElement->aFillList, aTempFillBundle );
191 }
192 break;
193 case 0x0f : ComOut( CGM_LEVEL2, "Edge Representation" )
194 {
195 EdgeBundle aTempEdgeBundle;
196 aTempEdgeBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
197 aTempEdgeBundle.eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
198 aTempEdgeBundle.nEdgeWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
199 aTempEdgeBundle.SetColor( ImplGetBitmapColor() );
200 pElement->InsertBundle( pElement->aEdgeList, aTempEdgeBundle );
201 }
202 break;
203 case 0x10 : ComOut( CGM_LEVEL3, "Interior Style Specification Mode" ) break; // NS
204 case 0x11 : ComOut( CGM_LEVEL3, "Line and Edge Type Definition" ) break;
205 case 0x12 : ComOut( CGM_LEVEL3, "Hatch Style Definition" ) break; // NS
206 case 0x13 : ComOut( CGM_LEVEL3, "Geometric Pattern Definition" ) break; // NS
207 case 0xff : ComOut( CGM_GDSF_ONLY, "inquire VDC EXTENT" ) break;
208 case 0xfe : ComOut( CGM_GDSF_ONLY, "inquire Background Color" ) break;
209 case 0xfd : ComOut( CGM_GDSF_ONLY, "inquire Device Viewport" ) break;
210 case 0xfc : ComOut( CGM_GDSF_ONLY, "set Font Selection Mode" ) break;
211 case 0xfb : ComOut( CGM_GDSF_ONLY, "inquire Color Selection Mode" ) break;
212 case 0xfa : ComOut( CGM_GDSF_ONLY, "inquire Font Selection Mode" ) break;
213 case 0xf9 : ComOut( CGM_GDSF_ONLY, "set Char Height Spec Mode" )
214 {
215 ImplGetUI16(); // -Wall is this really needed?
216 }
217 break;
218 case 0xf8 : ComOut( CGM_GDSF_ONLY, "set Background Style" ) break;
219 default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
220 }
221 };
222
223
224