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 #include <chart.hxx>
29 #include <outact.hxx>
30 
31 // ---------------------------------------------------------------
32 
ImplDoClass7()33 void CGM::ImplDoClass7()
34 {
35 	switch ( mnElementID )
36 	{
37 		case 0x01 : ComOut( CGM_LEVEL1, "Message" ) break;
38 		case 0x02 :
39 		{
40 			sal_uInt8*  pAppData = mpSource + 12;
41 			sal_uInt16* pTemp = (sal_uInt16*)mpSource;
42 			sal_uInt16 nOpcode = pTemp[ 4 ];
43 
44 			if ( mpChart || ( nOpcode == 0 ) )
45 			{
46 				switch ( nOpcode )
47 				{
48 					case 0x000 : ComOut( CGM_LEVEL1, "AppData - Beginning of File Opcodes" )
49 					{
50 						if ( mpChart == NULL )
51 							mpChart = new CGMChart( *this );
52 						mpChart->mnCurrentFileType = pAppData[ 3 ];
53 					}
54 					break;
55 					case 0x001 : ComOut( CGM_LEVEL1, "AppData - End of File Opcodes" ) break;
56 					case 0x190 : ComOut( CGM_LEVEL1, "AppData - FDESC" ) break;
57 					case 0x192 : ComOut( CGM_LEVEL1, "AppData - FNOTES" ) break;
58 					case 0x1F4 : ComOut( CGM_LEVEL1, "AppData - BOGENFILE" ) break;
59 					case 0x1F5 : ComOut( CGM_LEVEL1, "AppData - EOGENFILE" ) break;
60 					case 0x1F8 : ComOut( CGM_LEVEL1, "AppData - BOCHTGROUP" ) break;
61 					case 0x1F9 : ComOut( CGM_LEVEL1, "AppData - EOCHTGROUP" ) break;
62 					case 0x1FC : ComOut( CGM_LEVEL1, "AppData - BOCHTDATA" ) break;
63 					case 0x1FD : ComOut( CGM_LEVEL1, "AppData - EOCHTDATA" )
64 					{
65 						mpOutAct->DrawChart();
66 					}
67 					break;
68 					case 0x200 : ComOut( CGM_LEVEL1, "AppData - BOSYMGROUP" ) break;
69 					case 0x201 : ComOut( CGM_LEVEL1, "AppData - EOSYMGROUP" ) break;
70 					case 0x204 : ComOut( CGM_LEVEL1, "AppData - BEGSYMBOL" ) break;
71 					case 0x205 : ComOut( CGM_LEVEL1, "AppData - ENDSYMBOL" ) break;
72 					case 0x208 : ComOut( CGM_LEVEL1, "AppData - BOSHWGROUP" ) break;
73 					case 0x209 : ComOut( CGM_LEVEL1, "AppData - EOSHWGROUP" ) break;
74 					case 0x260 : ComOut( CGM_LEVEL1, "AppData - BEGGROUP" ) break;
75 					case 0x262 : ComOut( CGM_LEVEL1, "AppData - ENDGROUP" ) break;
76 					case 0x264 : ComOut( CGM_LEVEL1, "AppData - DATANODE" )
77 					{
78 						mpChart->mDataNode[ 0 ] = *(DataNode*)( pAppData );
79 						sal_Int8 nZoneEnum = mpChart->mDataNode[ 0 ].nZoneEnum;
80 						if ( nZoneEnum && ( nZoneEnum <= 6 ) )
81 							mpChart->mDataNode[ nZoneEnum ] = *(DataNode*)( pAppData );
82 					}
83 					break;
84 					case 0x2BE : ComOut( CGM_LEVEL1, "AppData - SHWSLIDEREC" )
85 					{
86 						if ( mnMode & CGM_EXPORT_IMPRESS )
87 						{
88 							if ( pAppData[ 16 ] == 0 )		// a blank template ?
89 							{
90 								if ( pAppData[ 2 ] == 46 )
91 								{
92 									// this starts the document -> maybe we could insert a new document
93 								}
94 								else if ( pAppData[ 2 ] & 0x80 )
95 								{
96 									// this is a template
97 								}
98 								else
99 								{
100 									mpOutAct->InsertPage();
101 								}
102 							}
103 							mpChart->ResetAnnotation();
104 						}
105 					}
106 					break;
107 					case 0x2C0 : ComOut( CGM_LEVEL1, "AppData - SHWKEYTABLE" ) break;
108 					case 0x2C2 : ComOut( CGM_LEVEL1, "AppData - SHWBUTTONTAB" ) break;
109 					case 0x2C4 : ComOut( CGM_LEVEL1, "AppData - SHWGLOBAL" ) break;
110 					case 0x2C6 : ComOut( CGM_LEVEL1, "AppData - SHWTITLE" ) break;
111 					case 0x2CA : ComOut( CGM_LEVEL1, "AppData - SHWAPP" ) break;
112 					case 0x320 : ComOut( CGM_LEVEL1, "AppData - TEXT" )
113 					{
114 						TextEntry* pTextEntry = new TextEntry;
115 						pTextEntry->nTypeOfText = *((sal_uInt16*)( pAppData ) );
116 						pTextEntry->nRowOrLineNum = *((sal_uInt16*)( pAppData + 2 ) );
117 						pTextEntry->nColumnNum = *((sal_uInt16*)( pAppData + 4 ) );
118 						sal_uInt16 nAttributes = *( (sal_uInt16*)( pAppData + 6 ) );
119 						pTextEntry->nZoneSize = nAttributes & 0xff;
120 						pTextEntry->nLineType = ( nAttributes >> 8 ) & 0xf;
121 						nAttributes >>= 12;
122 						pTextEntry->nAttributes = nAttributes;
123 						pAppData += 8;
124 						sal_uInt32 nLen = strlen( (char*)( pAppData ) ) + 1;
125 						pTextEntry->pText = new char[ nLen ];
126 						memcpy( pTextEntry->pText, pAppData, nLen );
127 						pAppData += nLen;
128 
129 						TextAttribute* pTextOld = 0;
130 						for ( sal_uInt16 i = 0; i < nAttributes; i++ )
131 						{
132 							TextAttribute* pTextAttr = new TextAttribute;
133 
134 							*pTextAttr = *(TextAttribute*)( pAppData );
135 
136 							pTextAttr->pNextAttribute = NULL;
137 							if ( i == 0 )
138 								pTextEntry->pAttribute = pTextAttr;
139 							else
140 								pTextOld->pNextAttribute = pTextAttr;
141 
142 							pAppData += sizeof( TextAttribute ) - 4;
143 							pTextOld = pTextAttr;
144 						}
145 						mpChart->InsertTextEntry( pTextEntry );
146 					}
147 					break;
148 					case 0x321 : ComOut( CGM_LEVEL1, "AppData - IOC_TABS" ) break;
149 					case 0x322 : ComOut( CGM_LEVEL1, "AppData - CHARTZONE" )
150 					{
151 						mpChart->mChartZone = *( ChartZone* )( pAppData );
152 					}
153 					break;
154 					case 0x324 : ComOut( CGM_LEVEL1, "AppData - TITLEZONE" ) break;
155 					case 0x328 : ComOut( CGM_LEVEL1, "AppData - FOOTNOTEZONE" ) break;
156 					case 0x32A : ComOut( CGM_LEVEL1, "AppData - LEGENDZONE" ) break;
157 					case 0x330 : ComOut( CGM_LEVEL1, "AppData - PAGEORIENTDIM" )
158 					{
159 						mpChart->mPageOrientDim = *( PageOrientDim*)( pAppData );
160 					}
161 					break;
162 					case 0x334 : ComOut( CGM_LEVEL1, "AppData - CHTZONEOPTN" )
163 					{
164 						mpChart->mZoneOption = *( ZoneOption*)( pAppData );
165 					}
166 					break;
167 					case 0x336 : ComOut( CGM_LEVEL1, "AppData - CHTINTL" )
168 					{
169 						mpChart->mIntSettings = *( IntSettings*)( pAppData );
170 					}
171 					break;
172 					case 0x338 : ComOut( CGM_LEVEL1, "AppData - CHTLINESPC" ) break;
173 					case 0x384 : ComOut( CGM_LEVEL1, "AppData - ORGGRIDSTATE" ) break;
174 					case 0x386 : ComOut( CGM_LEVEL1, "AppData - ORGSCRSTATE" ) break;
175 					case 0x388 : ComOut( CGM_LEVEL1, "AppData - ORGTREESTATE" ) break;
176 					case 0x38A : ComOut( CGM_LEVEL1, "AppData - ORGTEXTOPTN" ) break;
177 					case 0x38E : ComOut( CGM_LEVEL1, "AppData - ORGBOXOPTN" ) break;
178 					case 0x390 : ComOut( CGM_LEVEL1, "AppData - ORGBOXDIM" ) break;
179 					case 0x392 : ComOut( CGM_LEVEL1, "AppData - ORGBOX" ) break;
180 					case 0x3EA : ComOut( CGM_LEVEL1, "AppData - TTLTEXTOPTN" ) break;
181 					case 0x3EE : ComOut( CGM_LEVEL1, "AppData - TTLAUTOBUILD" ) break;
182 					case 0x44E : ComOut( CGM_LEVEL1, "AppData - BULTEXTOPTN" ) break;
183 					case 0x452 : ComOut( CGM_LEVEL1, "AppData - BULLETOPTN" )
184 					{
185 						mpChart->mBulletOption = *( BulletOption*)( pAppData );
186 					}
187 					break;
188 					case 0x454 : ComOut( CGM_LEVEL1, "AppData - BULLETLINES" )
189 					{
190 						mpChart->mBulletLines = *( BulletLines*)( pAppData );
191 					}
192 					break;
193 					case 0x456 : ComOut( CGM_LEVEL1, "AppData - BULAUTOBUILD" ) break;
194 					case 0x4B2 : ComOut( CGM_LEVEL1, "AppData - TBLTEXTOPTN" ) break;
195 					case 0x4B6 : ComOut( CGM_LEVEL1, "AppData - TBLOPTN" ) break;
196 					case 0x4B8 : ComOut( CGM_LEVEL1, "AppData - TBLCOLOPTN" ) break;
197 					case 0x4BA : ComOut( CGM_LEVEL1, "AppData - TBLLEGENDOPTN" ) break;
198 					case 0x4BC : ComOut( CGM_LEVEL1, "AppData - TBLRANGEOPTN" ) break;
199 					case 0x4BE : ComOut( CGM_LEVEL1, "AppData - TBLROWOPTN" ) break;
200 					case 0x4C0 : ComOut( CGM_LEVEL1, "AppData - TBLAUTOBUILD" ) break;
201 					case 0x518 : ComOut( CGM_LEVEL1, "AppData - PIECHARTOPTN" ) break;
202 					case 0x51A : ComOut( CGM_LEVEL1, "AppData - PIELEGENDOPTN" ) break;
203 					case 0x51C : ComOut( CGM_LEVEL1, "AppData - PIETEXTOPTN" ) break;
204 					case 0x51E : ComOut( CGM_LEVEL1, "AppData - PIEOPTN" ) break;
205 					case 0x520 : ComOut( CGM_LEVEL1, "AppData - PIEPCTLABOPTN" ) break;
206 					case 0x522 : ComOut( CGM_LEVEL1, "AppData - PIEVALLABOPTN" ) break;
207 					case 0x524 : ComOut( CGM_LEVEL1, "AppData - PIESLICE" ) break;
208 					case 0x57A : ComOut( CGM_LEVEL1, "AppData - XYAXISOPTN" ) break;
209 					case 0x57C : ComOut( CGM_LEVEL1, "AppData - XYGRIDOPTN" ) break;
210 					case 0x57D : ComOut( CGM_LEVEL1, "AppData - XYGRIDSHOWFILL" ) break;
211 					case 0x57E : ComOut( CGM_LEVEL1, "AppData - XYSERIESOPTN" ) break;
212 					case 0x580 : ComOut( CGM_LEVEL1, "AppData - XYSTYLEOPTN" ) break;
213 					case 0x582 : ComOut( CGM_LEVEL1, "AppData - XYTABLEOPTN" ) break;
214 					case 0x584 : ComOut( CGM_LEVEL1, "AppData - XYTEXTOPTN" ) break;
215 					case 0x586 : ComOut( CGM_LEVEL1, "AppData - XYDATAOPTN" ) break;
216 					case 0x58A : ComOut( CGM_LEVEL1, "AppData - XYLEGENDOPN" ) break;
217 					case 0x58C : ComOut( CGM_LEVEL1, "AppData - XYCALCULATION" ) break;
218 					case 0x58E : ComOut( CGM_LEVEL1, "AppData - XYXVALUE" ) break;
219 					case 0x590 : ComOut( CGM_LEVEL1, "AppData - XYYVALUE" ) break;
220 					case 0x592 : ComOut( CGM_LEVEL1, "AppData - XYXEXTVALUE" ) break;
221 					case 0x618 : ComOut( CGM_LEVEL1, "AppData - IOC_CHTCOLRTAB" ) break;
222 					case 0x619 : ComOut( CGM_LEVEL1, "AppData - IOC_CHTFONTTAB" ) break;
223 					case 0x1fff : ComOut( CGM_LEVEL1, "AppData - 0x1fff" ) break;
224 					default : ComOut( CGM_LEVEL1, "UNKNOWN Application Data" ) break;
225 				}
226 			}
227 			mnParaSize = mnElementSize;
228 			break;
229 		}
230 		default: ComOut( CGM_UNKNOWN_COMMAND, "" ) break;
231 	}
232 };
233 
234