1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 // ---------------------------------------------------------------
25 void CGM::ImplDoClass2()
28 switch ( mnElementID
)
30 case 0x01 : /*Scaling Mode*/
32 if ( mnElementSize
) // HACK (NASA.CGM)
34 switch( ImplGetUI16() )
36 case 0 : pElement
->eScalingMode
= SM_ABSTRACT
; break;
37 case 1 : pElement
->eScalingMode
= SM_METRIC
; break;
38 default : mbStatus
= sal_False
; break;
40 pElement
->nScalingFactor
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
45 case 0x02 : /*Color Selection Mode*/
47 nUInteger
= ImplGetUI16();
50 case 0 : pElement
->eColorSelectionMode
= CSM_INDEXED
; break;
51 case 1 : pElement
->eColorSelectionMode
= CSM_DIRECT
; break;
52 default : mbStatus
= sal_False
; break;
56 case 0x03 : /*Line Width Specification Mode*/
58 nUInteger
= ImplGetUI16();
61 case 0 : pElement
->eLineWidthSpecMode
= SM_ABSOLUTE
; break;
62 case 1 : pElement
->eLineWidthSpecMode
= SM_SCALED
; break;
63 default : mbStatus
= sal_False
; break;
67 case 0x04 : /*Marker Size Specification Mode*/
69 nUInteger
= ImplGetUI16();
72 case 0 : pElement
->eMarkerSizeSpecMode
= SM_ABSOLUTE
; break;
73 case 1 : pElement
->eMarkerSizeSpecMode
= SM_SCALED
; break;
74 default : mbStatus
= sal_False
; break;
78 case 0x05 : /*Edge Width Specification Mode*/
80 nUInteger
= ImplGetUI16();
83 case 0 : pElement
->eEdgeWidthSpecMode
= SM_ABSOLUTE
; break;
84 case 1 : pElement
->eEdgeWidthSpecMode
= SM_SCALED
; break;
85 default : mbStatus
= sal_False
; break;
89 case 0x06 : /*VDC Extent*/
91 ImplGetRectangleNS( pElement
->aVDCExtent
);
95 case 0x07 : /*Background Color*/
96 pElement
->nBackGroundColor
= ImplGetBitmapColor( sal_True
);
98 case 0x08 : /*Device Viewport*/
100 if ( pElement
->eVDCType
== VDC_INTEGER
)
101 ImplGetRectangle( pElement
->aDeviceViewPort
);
105 case 0x09 : /*Device Viewport Specification Mode*/
107 nUInteger
= ImplGetUI16( 8 );
110 case 0 : pElement
->eDeviceViewPortMode
= DVPM_FRACTION
; break;
111 case 1 : pElement
->eDeviceViewPortMode
= DVPM_METRIC
; break;
112 case 2 : pElement
->eDeviceViewPortMode
= DVPM_DEVICE
; break;
113 default : mbStatus
= sal_False
; break;
115 pElement
->nDeviceViewPortScale
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
119 case 0x0a : /*Device Viewport Mapping*/
121 switch( ImplGetUI16() )
123 case 0 : pElement
->eDeviceViewPortMap
= DVPM_NOT_FORCED
; break;
124 case 1 : pElement
->eDeviceViewPortMap
= DVPM_FORCED
; break;
125 default : mbStatus
= sal_False
; break;
127 switch( ImplGetUI16() )
129 case 0 : pElement
->eDeviceViewPortMapH
= DVPMH_LEFT
; break;
130 case 1 : pElement
->eDeviceViewPortMapH
= DVPMH_CENTER
; break;
131 case 2 : pElement
->eDeviceViewPortMapH
= CVPMH_RIGHT
; break;
132 default : mbStatus
= sal_False
; break;
134 switch( ImplGetUI16() )
136 case 0 : pElement
->eDeviceViewPortMapV
= DVPMV_BOTTOM
; break;
137 case 1 : pElement
->eDeviceViewPortMapV
= DVPMV_CENTER
; break;
138 case 2 : pElement
->eDeviceViewPortMapV
= DVPMV_TOP
; break;
139 default : mbStatus
= sal_False
; break;
144 case 0x0b : /*Line Representation*/
146 LineBundle aTempLineBundle
;
147 aTempLineBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
148 aTempLineBundle
.eLineType
= (LineType
)ImplGetI( pElement
->nIndexPrecision
);
149 aTempLineBundle
.nLineWidth
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
150 aTempLineBundle
.SetColor( ImplGetBitmapColor() );
151 pElement
->InsertBundle( pElement
->aLineList
, aTempLineBundle
);
154 case 0x0c : /*Marker Representation*/
156 MarkerBundle aTempMarkerBundle
;
157 aTempMarkerBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
158 aTempMarkerBundle
.eMarkerType
= (MarkerType
)ImplGetI( pElement
->nIndexPrecision
);
159 aTempMarkerBundle
.nMarkerSize
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
160 aTempMarkerBundle
.SetColor( ImplGetBitmapColor() );
161 pElement
->InsertBundle( pElement
->aMarkerList
, aTempMarkerBundle
);
164 case 0x0d : /*Text Representation*/
166 TextBundle aTempTextBundle
;
167 aTempTextBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
168 aTempTextBundle
.nTextFontIndex
= ImplGetI( pElement
->nIndexPrecision
);
169 aTempTextBundle
.eTextPrecision
= (TextPrecision
)ImplGetI( pElement
->nIndexPrecision
);
170 aTempTextBundle
.nCharacterSpacing
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
171 aTempTextBundle
.nCharacterExpansion
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
172 aTempTextBundle
.SetColor( ImplGetBitmapColor() );
173 pElement
->InsertBundle( pElement
->aTextList
, aTempTextBundle
);
176 case 0x0e : /*Fill Representation*/
178 FillBundle aTempFillBundle
;
179 aTempFillBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
180 aTempFillBundle
.eFillInteriorStyle
= (FillInteriorStyle
)ImplGetI( pElement
->nIndexPrecision
);
181 aTempFillBundle
.SetColor( ImplGetBitmapColor() );
182 aTempFillBundle
.nFillPatternIndex
= ImplGetI( pElement
->nIndexPrecision
);
183 aTempFillBundle
.nFillHatchIndex
= ImplGetI( pElement
->nIndexPrecision
);
184 pElement
->InsertBundle( pElement
->aFillList
, aTempFillBundle
);
187 case 0x0f : /*Edge Representation*/
189 EdgeBundle aTempEdgeBundle
;
190 aTempEdgeBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
191 aTempEdgeBundle
.eEdgeType
= (EdgeType
)ImplGetI( pElement
->nIndexPrecision
);
192 aTempEdgeBundle
.nEdgeWidth
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
193 aTempEdgeBundle
.SetColor( ImplGetBitmapColor() );
194 pElement
->InsertBundle( pElement
->aEdgeList
, aTempEdgeBundle
);
197 case 0x10 : /*Interior Style Specification Mode */break; // NS
198 case 0x11 : /*Line and Edge Type Definition */break;
199 case 0x12 : /*Hatch Style Definition */break; // NS
200 case 0x13 : /*Geometric Pattern Definition */break; // NS
201 case 0xff : /*inquire VDC EXTENT */break;
202 case 0xfe : /*inquire Background Color */break;
203 case 0xfd : /*inquire Device Viewport */break;
204 case 0xfc : /*set Font Selection Mode */break;
205 case 0xfb : /*inquire Color Selection Mode */break;
206 case 0xfa : /*inquire Font Selection Mode */break;
207 case 0xf9 : /*set Char Height Spec Mode*/
209 ImplGetUI16(); // -Wall is this really needed?
212 case 0xf8 : /*set Background Style */break;
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */