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 .
21 #include "bundles.hxx"
22 #include "elements.hxx"
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
= 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
= 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
= 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
= 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
= false; break;
89 case 0x06 : /*VDC Extent*/
91 ImplGetRectangleNS( pElement
->aVDCExtent
);
95 case 0x07 : /*Background Color*/
96 pElement
->nBackGroundColor
= ImplGetBitmapColor( 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();
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
= 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
= 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
= 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
= false; break;
144 case 0x0b : /*Line Representation*/
146 LineBundle aTempLineBundle
;
147 aTempLineBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
148 aTempLineBundle
.eLineType
= static_cast<LineType
>(ImplGetI( pElement
->nIndexPrecision
));
149 aTempLineBundle
.nLineWidth
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
150 aTempLineBundle
.SetColor( ImplGetBitmapColor() );
151 const bool bUpdateLineBundle
= aTempLineBundle
.GetIndex() == pElement
->pLineBundle
->GetIndex();
152 CGMElements::InsertBundle( pElement
->aLineList
, aTempLineBundle
);
153 if (bUpdateLineBundle
)
154 pElement
->pLineBundle
= static_cast<LineBundle
*>(CGMElements::GetBundleIndex(aTempLineBundle
.GetIndex(), pElement
->aLineList
, pElement
->aLineBundle
));
157 case 0x0c : /*Marker Representation*/
159 MarkerBundle aTempMarkerBundle
;
160 aTempMarkerBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
161 aTempMarkerBundle
.eMarkerType
= static_cast<MarkerType
>(ImplGetI( pElement
->nIndexPrecision
));
162 aTempMarkerBundle
.nMarkerSize
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
163 aTempMarkerBundle
.SetColor( ImplGetBitmapColor() );
164 const bool bUpdateMarkerBundle
= aTempMarkerBundle
.GetIndex() == pElement
->pMarkerBundle
->GetIndex();
165 CGMElements::InsertBundle( pElement
->aMarkerList
, aTempMarkerBundle
);
166 if (bUpdateMarkerBundle
)
167 pElement
->pMarkerBundle
= static_cast<MarkerBundle
*>(CGMElements::GetBundleIndex(aTempMarkerBundle
.GetIndex(), pElement
->aMarkerList
, pElement
->aMarkerBundle
));
170 case 0x0d : /*Text Representation*/
172 TextBundle aTempTextBundle
;
173 aTempTextBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
174 aTempTextBundle
.nTextFontIndex
= ImplGetI( pElement
->nIndexPrecision
);
175 aTempTextBundle
.eTextPrecision
= static_cast<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 const bool bUpdateTextBundle
= aTempTextBundle
.GetIndex() == pElement
->pTextBundle
->GetIndex();
180 CGMElements::InsertBundle( pElement
->aTextList
, aTempTextBundle
);
181 if (bUpdateTextBundle
)
182 pElement
->pTextBundle
= static_cast<TextBundle
*>(CGMElements::GetBundleIndex(aTempTextBundle
.GetIndex(), pElement
->aTextList
, pElement
->aTextBundle
));
185 case 0x0e : /*Fill Representation*/
187 FillBundle aTempFillBundle
;
188 aTempFillBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
189 aTempFillBundle
.eFillInteriorStyle
= static_cast<FillInteriorStyle
>(ImplGetI( pElement
->nIndexPrecision
));
190 aTempFillBundle
.SetColor( ImplGetBitmapColor() );
191 aTempFillBundle
.nFillPatternIndex
= ImplGetI( pElement
->nIndexPrecision
);
192 aTempFillBundle
.nFillHatchIndex
= ImplGetI( pElement
->nIndexPrecision
);
193 const bool bUpdateFillBundle
= aTempFillBundle
.GetIndex() == pElement
->pFillBundle
->GetIndex();
194 CGMElements::InsertBundle( pElement
->aFillList
, aTempFillBundle
);
195 if (bUpdateFillBundle
)
196 pElement
->pFillBundle
= static_cast<FillBundle
*>(CGMElements::GetBundleIndex(aTempFillBundle
.GetIndex(), pElement
->aFillList
, pElement
->aFillBundle
));
199 case 0x0f : /*Edge Representation*/
201 EdgeBundle aTempEdgeBundle
;
202 aTempEdgeBundle
.SetIndex( ImplGetI( pElement
->nIndexPrecision
) );
203 aTempEdgeBundle
.eEdgeType
= static_cast<EdgeType
>(ImplGetI( pElement
->nIndexPrecision
));
204 aTempEdgeBundle
.nEdgeWidth
= ImplGetFloat( pElement
->eRealPrecision
, pElement
->nRealSize
);
205 aTempEdgeBundle
.SetColor( ImplGetBitmapColor() );
206 const bool bUpdateEdgeBundle
= aTempEdgeBundle
.GetIndex() == pElement
->pEdgeBundle
->GetIndex();
207 CGMElements::InsertBundle( pElement
->aEdgeList
, aTempEdgeBundle
);
208 if (bUpdateEdgeBundle
)
209 pElement
->pEdgeBundle
= static_cast<EdgeBundle
*>(CGMElements::GetBundleIndex(aTempEdgeBundle
.GetIndex(), pElement
->aEdgeList
, pElement
->aEdgeBundle
));
212 case 0x10 : /*Interior Style Specification Mode */break; // NS
213 case 0x11 : /*Line and Edge Type Definition */break;
214 case 0x12 : /*Hatch Style Definition */break; // NS
215 case 0x13 : /*Geometric Pattern Definition */break; // NS
216 case 0xff : /*inquire VDC EXTENT */break;
217 case 0xfe : /*inquire Background Color */break;
218 case 0xfd : /*inquire Device Viewport */break;
219 case 0xfc : /*set Font Selection Mode */break;
220 case 0xfb : /*inquire Color Selection Mode */break;
221 case 0xfa : /*inquire Font Selection Mode */break;
222 case 0xf9 : /*set Char Height Spec Mode*/
224 ImplGetUI16(); // -Wall is this really needed?
227 case 0xf8 : /*set Background Style */break;
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */