Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <main.hxx>
22 :
23 :
24 :
25 17 : void CGM::ImplDoClass2()
26 : {
27 : sal_uInt32 nUInteger;
28 17 : switch ( mnElementID )
29 : {
30 : case 0x01 : /*Scaling Mode*/
31 : {
32 0 : if ( mnElementSize ) // HACK (NASA.CGM)
33 : {
34 0 : switch( ImplGetUI16() )
35 : {
36 0 : case 0 : pElement->eScalingMode = SM_ABSTRACT; break;
37 0 : case 1 : pElement->eScalingMode = SM_METRIC; break;
38 0 : default : mbStatus = false; break;
39 : }
40 0 : pElement->nScalingFactor = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
41 0 : ImplSetMapMode();
42 : }
43 : }
44 0 : break;
45 : case 0x02 : /*Color Selection Mode*/
46 : {
47 0 : nUInteger = ImplGetUI16();
48 0 : switch( nUInteger )
49 : {
50 0 : case 0 : pElement->eColorSelectionMode = CSM_INDEXED; break;
51 0 : case 1 : pElement->eColorSelectionMode = CSM_DIRECT; break;
52 0 : default : mbStatus = false; break;
53 : }
54 : }
55 0 : break;
56 : case 0x03 : /*Line Width Specification Mode*/
57 : {
58 0 : nUInteger = ImplGetUI16();
59 0 : switch( nUInteger )
60 : {
61 0 : case 0 : pElement->eLineWidthSpecMode = SM_ABSOLUTE; break;
62 0 : case 1 : pElement->eLineWidthSpecMode = SM_SCALED; break;
63 0 : default : mbStatus = false; break;
64 : }
65 : }
66 0 : break;
67 : case 0x04 : /*Marker Size Specification Mode*/
68 : {
69 0 : nUInteger = ImplGetUI16();
70 0 : switch( nUInteger )
71 : {
72 0 : case 0 : pElement->eMarkerSizeSpecMode = SM_ABSOLUTE; break;
73 0 : case 1 : pElement->eMarkerSizeSpecMode = SM_SCALED; break;
74 0 : default : mbStatus = false; break;
75 : }
76 : }
77 0 : break;
78 : case 0x05 : /*Edge Width Specification Mode*/
79 : {
80 0 : nUInteger = ImplGetUI16();
81 0 : switch( nUInteger )
82 : {
83 0 : case 0 : pElement->eEdgeWidthSpecMode = SM_ABSOLUTE; break;
84 0 : case 1 : pElement->eEdgeWidthSpecMode = SM_SCALED; break;
85 0 : default : mbStatus = false; break;
86 : }
87 : }
88 0 : break;
89 : case 0x06 : /*VDC Extent*/
90 : {
91 17 : ImplGetRectangleNS( pElement->aVDCExtent );
92 17 : ImplSetMapMode();
93 : }
94 17 : break;
95 : case 0x07 : /*Background Color*/
96 0 : pElement->nBackGroundColor = ImplGetBitmapColor( true );
97 0 : break;
98 : case 0x08 : /*Device Viewport*/
99 : {
100 0 : if ( pElement->eVDCType == VDC_INTEGER )
101 0 : ImplGetRectangle( pElement->aDeviceViewPort );
102 0 : ImplSetMapMode();
103 : }
104 0 : break;
105 : case 0x09 : /*Device Viewport Specification Mode*/
106 : {
107 0 : nUInteger = ImplGetUI16( 8 );
108 0 : switch( nUInteger )
109 : {
110 0 : case 0 : pElement->eDeviceViewPortMode = DVPM_FRACTION; break;
111 0 : case 1 : pElement->eDeviceViewPortMode = DVPM_METRIC; break;
112 0 : case 2 : pElement->eDeviceViewPortMode = DVPM_DEVICE; break;
113 0 : default : mbStatus = false; break;
114 : }
115 0 : pElement->nDeviceViewPortScale = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
116 0 : ImplSetMapMode();
117 : }
118 0 : break;
119 : case 0x0a : /*Device Viewport Mapping*/
120 : {
121 0 : switch( ImplGetUI16() )
122 : {
123 0 : case 0 : pElement->eDeviceViewPortMap = DVPM_NOT_FORCED; break;
124 0 : case 1 : pElement->eDeviceViewPortMap = DVPM_FORCED; break;
125 0 : default : mbStatus = false; break;
126 : }
127 0 : switch( ImplGetUI16() )
128 : {
129 0 : case 0 : pElement->eDeviceViewPortMapH = DVPMH_LEFT; break;
130 0 : case 1 : pElement->eDeviceViewPortMapH = DVPMH_CENTER; break;
131 0 : case 2 : pElement->eDeviceViewPortMapH = CVPMH_RIGHT; break;
132 0 : default : mbStatus = false; break;
133 : }
134 0 : switch( ImplGetUI16() )
135 : {
136 0 : case 0 : pElement->eDeviceViewPortMapV = DVPMV_BOTTOM; break;
137 0 : case 1 : pElement->eDeviceViewPortMapV = DVPMV_CENTER; break;
138 0 : case 2 : pElement->eDeviceViewPortMapV = DVPMV_TOP; break;
139 0 : default : mbStatus = false; break;
140 : }
141 0 : ImplSetMapMode();
142 : }
143 0 : break;
144 : case 0x0b : /*Line Representation*/
145 : {
146 0 : LineBundle aTempLineBundle;
147 0 : aTempLineBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
148 0 : aTempLineBundle.eLineType = (LineType)ImplGetI( pElement->nIndexPrecision );
149 0 : aTempLineBundle.nLineWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
150 0 : aTempLineBundle.SetColor( ImplGetBitmapColor() );
151 0 : CGMElements::InsertBundle( pElement->aLineList, aTempLineBundle );
152 : }
153 0 : break;
154 : case 0x0c : /*Marker Representation*/
155 : {
156 0 : MarkerBundle aTempMarkerBundle;
157 0 : aTempMarkerBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
158 0 : aTempMarkerBundle.eMarkerType = (MarkerType)ImplGetI( pElement->nIndexPrecision );
159 0 : aTempMarkerBundle.nMarkerSize = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
160 0 : aTempMarkerBundle.SetColor( ImplGetBitmapColor() );
161 0 : CGMElements::InsertBundle( pElement->aMarkerList, aTempMarkerBundle );
162 : }
163 0 : break;
164 : case 0x0d : /*Text Representation*/
165 : {
166 0 : TextBundle aTempTextBundle;
167 0 : aTempTextBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
168 0 : aTempTextBundle.nTextFontIndex = ImplGetI( pElement->nIndexPrecision );
169 0 : aTempTextBundle.eTextPrecision = (TextPrecision)ImplGetI( pElement->nIndexPrecision );
170 0 : aTempTextBundle.nCharacterSpacing = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
171 0 : aTempTextBundle.nCharacterExpansion = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
172 0 : aTempTextBundle.SetColor( ImplGetBitmapColor() );
173 0 : CGMElements::InsertBundle( pElement->aTextList, aTempTextBundle );
174 : }
175 0 : break;
176 : case 0x0e : /*Fill Representation*/
177 : {
178 0 : FillBundle aTempFillBundle;
179 0 : aTempFillBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
180 0 : aTempFillBundle.eFillInteriorStyle = (FillInteriorStyle)ImplGetI( pElement->nIndexPrecision );
181 0 : aTempFillBundle.SetColor( ImplGetBitmapColor() );
182 0 : aTempFillBundle.nFillPatternIndex = ImplGetI( pElement->nIndexPrecision );
183 0 : aTempFillBundle.nFillHatchIndex = ImplGetI( pElement->nIndexPrecision );
184 0 : CGMElements::InsertBundle( pElement->aFillList, aTempFillBundle );
185 : }
186 0 : break;
187 : case 0x0f : /*Edge Representation*/
188 : {
189 0 : EdgeBundle aTempEdgeBundle;
190 0 : aTempEdgeBundle.SetIndex( ImplGetI( pElement->nIndexPrecision ) );
191 0 : aTempEdgeBundle.eEdgeType = (EdgeType)ImplGetI( pElement->nIndexPrecision );
192 0 : aTempEdgeBundle.nEdgeWidth = ImplGetFloat( pElement->eRealPrecision, pElement->nRealSize );
193 0 : aTempEdgeBundle.SetColor( ImplGetBitmapColor() );
194 0 : CGMElements::InsertBundle( pElement->aEdgeList, aTempEdgeBundle );
195 : }
196 0 : break;
197 0 : case 0x10 : /*Interior Style Specification Mode */break; // NS
198 0 : case 0x11 : /*Line and Edge Type Definition */break;
199 0 : case 0x12 : /*Hatch Style Definition */break; // NS
200 0 : case 0x13 : /*Geometric Pattern Definition */break; // NS
201 0 : case 0xff : /*inquire VDC EXTENT */break;
202 0 : case 0xfe : /*inquire Background Color */break;
203 0 : case 0xfd : /*inquire Device Viewport */break;
204 0 : case 0xfc : /*set Font Selection Mode */break;
205 0 : case 0xfb : /*inquire Color Selection Mode */break;
206 0 : case 0xfa : /*inquire Font Selection Mode */break;
207 : case 0xf9 : /*set Char Height Spec Mode*/
208 : {
209 0 : ImplGetUI16(); // -Wall is this really needed?
210 : }
211 0 : break;
212 0 : case 0xf8 : /*set Background Style */break;
213 0 : default: break;
214 : }
215 17 : };
216 :
217 :
218 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|