Validate.xba (3e02b54d) Validate.xba (4cb67278)
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
4 *
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
12 *
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
21 *
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validate" script:language="StarBasic">
24&apos;############################################
25&apos; VALIDATION ROUTINES
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validate" script:language="StarBasic">
24&apos;############################################
25&apos; VALIDATION ROUTINES
26&apos;
27&apos; May, 19 2004 - fpe
28&apos;############################################
29
30Dim sSwitchType As String
31Dim sCellSwitchType As String
32Dim sCaseType As String
33Dim sCellCaseType As String
34Dim sDefaultType As String
35Dim sCellDefaultType As String

--- 14 unchanged lines hidden (view full) ---

50
51Sub Validate
52
53 If not IsHelpFile Then
54 msgbox(strErr_NoHelpFile)
55 Exit Sub
56 End If
57
26&apos;############################################
27
28Dim sSwitchType As String
29Dim sCellSwitchType As String
30Dim sCaseType As String
31Dim sCellCaseType As String
32Dim sDefaultType As String
33Dim sCellDefaultType As String

--- 14 unchanged lines hidden (view full) ---

48
49Sub Validate
50
51 If not IsHelpFile Then
52 msgbox(strErr_NoHelpFile)
53 Exit Sub
54 End If
55
58 oDoc = StarDesktop.CurrentComponent
56 oDoc = StarDesktop.CurrentComponent
59 sSwitchType = &quot;&quot;
60 sCaseType = &quot;&quot;
61 sDefaultType = &quot;&quot;
62 bWarn = TRUE
63 bWarnEmptyPara = TRUE
64 bWarnParaNoID = TRUE
65
66 CheckMetaData(oDoc)
67 CheckHeading(oDoc)
57 sSwitchType = &quot;&quot;
58 sCaseType = &quot;&quot;
59 sDefaultType = &quot;&quot;
60 bWarn = TRUE
61 bWarnEmptyPara = TRUE
62 bWarnParaNoID = TRUE
63
64 CheckMetaData(oDoc)
65 CheckHeading(oDoc)
68
66
69 Enum = oDoc.Text.createEnumeration
70 Do While Enum.hasMoreElements
71
72 TextElement = Enum.nextElement
73 If TextElement.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then &apos; we are a paragraph
67 Enum = oDoc.Text.createEnumeration
68 Do While Enum.hasMoreElements
69
70 TextElement = Enum.nextElement
71 If TextElement.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then &apos; we are a paragraph
74
72
75 CheckSwitches(TextElement)
76 CheckParaID(TextElement)
77 CheckParaFormat(TextElement)
78 CheckTags(TextElement)
79 CheckInlineTags(TextElement)
80
81 ElseIf TextElement.supportsService(&quot;com.sun.star.text.TextTable&quot;) Then
82
83 If sSwitchType &lt;&gt; &quot;&quot; AND (sCaseType = &quot;&quot; AND sDefaultType = &quot;&quot;) Then &apos;&lt;------
84 Terminate(&quot;Switch must be closed or case/default must be opened before a table starts.&quot;,tmpCellElement)
85 End If
86
87 CheckCell(TextElement)
88 End If
73 CheckSwitches(TextElement)
74 CheckParaID(TextElement)
75 CheckParaFormat(TextElement)
76 CheckTags(TextElement)
77 CheckInlineTags(TextElement)
78
79 ElseIf TextElement.supportsService(&quot;com.sun.star.text.TextTable&quot;) Then
80
81 If sSwitchType &lt;&gt; &quot;&quot; AND (sCaseType = &quot;&quot; AND sDefaultType = &quot;&quot;) Then &apos;&lt;------
82 Terminate(&quot;Switch must be closed or case/default must be opened before a table starts.&quot;,tmpCellElement)
83 End If
84
85 CheckCell(TextElement)
86 End If
89 Loop
87 Loop
90
91 If sCaseType &lt;&gt; &quot;&quot; Then
92 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TextElement)
93 End If
94
95 If sDefaultType &lt;&gt; &quot;&quot; Then
96 Terminate(&quot;Previous default not closed!&quot;,TextElement)
97 End If
98
99 If sSwitchType &lt;&gt; &quot;&quot; Then
100 Terminate(&quot;Previous switch (&quot;+sSwitchType+&quot;) not closed!&quot;,TextElement)
101 End If
88
89 If sCaseType &lt;&gt; &quot;&quot; Then
90 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TextElement)
91 End If
92
93 If sDefaultType &lt;&gt; &quot;&quot; Then
94 Terminate(&quot;Previous default not closed!&quot;,TextElement)
95 End If
96
97 If sSwitchType &lt;&gt; &quot;&quot; Then
98 Terminate(&quot;Previous switch (&quot;+sSwitchType+&quot;) not closed!&quot;,TextElement)
99 End If
102
100
103 If ubound(aTagsOpen()) &gt; 0 Then
104 Terminate(&quot;Element &quot;+aTagsOpen(ubound(aTagsOpen()))+&quot; not closed&quot;,TextElement)
105 End If
101 If ubound(aTagsOpen()) &gt; 0 Then
102 Terminate(&quot;Element &quot;+aTagsOpen(ubound(aTagsOpen()))+&quot; not closed&quot;,TextElement)
103 End If
106
104
107 msgbox(&quot;Validation finished.&quot;)
105 msgbox(&quot;Validation finished.&quot;)
108
106
109End Sub
110
111&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
112&apos; CHECKCELL
113&apos; checks a table cell contents
114&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
115
116Sub CheckCell(TE As Object)
117 On Local Error Goto ERRHANDLE:
107End Sub
108
109&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
110&apos; CHECKCELL
111&apos; checks a table cell contents
112&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
113
114Sub CheckCell(TE As Object)
115 On Local Error Goto ERRHANDLE:
118
116
119 CellName = &quot;A1&quot;
120 Cell = TE.getCellByName(CellName)
121 tmpCellEnum = Cell.createEnumeration
122 tmpCellElement = tmpCellEnum.nextElement
117 CellName = &quot;A1&quot;
118 Cell = TE.getCellByName(CellName)
119 tmpCellEnum = Cell.createEnumeration
120 tmpCellElement = tmpCellEnum.nextElement
123
121
124 Rows = TE.getRows
125 Cols = TE.getColumns
126
127 ReDim aCellTagsOpen(0)
122 Rows = TE.getRows
123 Cols = TE.getColumns
124
125 ReDim aCellTagsOpen(0)
128
126
129 For RowIndex = 1 to Rows.getCount()
130
131 For ColIndex = 1 to Cols.getCount()
132
133 CellName = Chr(64 + ColIndex) &amp; RowIndex
134 Cell = TE.getCellByName(CellName)
135 CellEnum = Cell.createEnumeration
136

--- 5 unchanged lines hidden (view full) ---

142 CheckSwitchesInCell(CellElement)
143 CheckParaID(CellElement)
144 CheckParaFormat(CellElement)
145 CheckTagsInCell(CellElement)
146 CheckInlineTags(CellElement)
147 EndIf
148
149 Loop
127 For RowIndex = 1 to Rows.getCount()
128
129 For ColIndex = 1 to Cols.getCount()
130
131 CellName = Chr(64 + ColIndex) &amp; RowIndex
132 Cell = TE.getCellByName(CellName)
133 CellEnum = Cell.createEnumeration
134

--- 5 unchanged lines hidden (view full) ---

140 CheckSwitchesInCell(CellElement)
141 CheckParaID(CellElement)
142 CheckParaFormat(CellElement)
143 CheckTagsInCell(CellElement)
144 CheckInlineTags(CellElement)
145 EndIf
146
147 Loop
150
148
151 If sCellCaseType &lt;&gt; &quot;&quot; Then
152 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CellElement)
153 End If
154
155 If sCellSwitchType &lt;&gt; &quot;&quot; Then
156 Terminate(&quot;Previous switch (&quot;+sCellSwitchType+&quot;) not closed!&quot;,CellElement)
157 End If
149 If sCellCaseType &lt;&gt; &quot;&quot; Then
150 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CellElement)
151 End If
152
153 If sCellSwitchType &lt;&gt; &quot;&quot; Then
154 Terminate(&quot;Previous switch (&quot;+sCellSwitchType+&quot;) not closed!&quot;,CellElement)
155 End If
158
156
159 If ubound(aCellTagsOpen()) &gt; 0 Then
160 Terminate(&quot;Element &quot;+aCellTagsOpen(ubound(aCellTagsOpen()))+&quot; not closed&quot;,CellElement)
161 End If
157 If ubound(aCellTagsOpen()) &gt; 0 Then
158 Terminate(&quot;Element &quot;+aCellTagsOpen(ubound(aCellTagsOpen()))+&quot; not closed&quot;,CellElement)
159 End If
162
160
163 Next
164 Next
165
166 ERRHANDLE:
167 If Err &lt;&gt; 0 Then
168 msgbox &quot;Error: &quot;+chr(13)+ Error$,48,&quot;D&apos;oh!&quot;
169 End If
170End Sub
171
172&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
173&apos; CHECK PARA ID
174&apos; checks a paragraph for an ID
175&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
176
177Sub CheckParaID(TE As Object)
178
179 If Left(TE.ParaStyleName,4) = &quot;hlp_&quot; AND Not(Left(TE.ParaStyleName,8) = &quot;hlp_aux_&quot;) Then
180
181 sText = TE.GetString
161 Next
162 Next
163
164 ERRHANDLE:
165 If Err &lt;&gt; 0 Then
166 msgbox &quot;Error: &quot;+chr(13)+ Error$,48,&quot;D&apos;oh!&quot;
167 End If
168End Sub
169
170&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
171&apos; CHECK PARA ID
172&apos; checks a paragraph for an ID
173&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
174
175Sub CheckParaID(TE As Object)
176
177 If Left(TE.ParaStyleName,4) = &quot;hlp_&quot; AND Not(Left(TE.ParaStyleName,8) = &quot;hlp_aux_&quot;) Then
178
179 sText = TE.GetString
182
180
183 If sText = &quot;&quot; Then
184 If bWarnEmptyPara Then
185 Warn(&quot;Empty Paragraph&quot;,&quot;Empty paragraphs should be avoided. Do not use empty paragraphs for formatting purpose.&quot;,TE)
186 bWarnEmptyPara = FALSE
187 End If
188 Else
189
190 TP = TE.createEnumeration

--- 13 unchanged lines hidden (view full) ---

204 &apos; a page break (for whatever reason)
205 If TPE.String = &quot;&quot; Then
206 Ct = Ct-1
207 End If
208 Wend
209
210 If posID = 0 Then
211 If bWarnParaNoID Then
181 If sText = &quot;&quot; Then
182 If bWarnEmptyPara Then
183 Warn(&quot;Empty Paragraph&quot;,&quot;Empty paragraphs should be avoided. Do not use empty paragraphs for formatting purpose.&quot;,TE)
184 bWarnEmptyPara = FALSE
185 End If
186 Else
187
188 TP = TE.createEnumeration

--- 13 unchanged lines hidden (view full) ---

202 &apos; a page break (for whatever reason)
203 If TPE.String = &quot;&quot; Then
204 Ct = Ct-1
205 End If
206 Wend
207
208 If posID = 0 Then
209 If bWarnParaNoID Then
212 Warn(&quot;Paragraph has no id.&quot;,&quot;IDs will be assigned on safe. You can also assign an ID using the Assign Paragraph ID menu item&quot;,TPE)
210 Warn(&quot;Paragraph has no id.&quot;,&quot;IDs will be assigned on save. You can also assign an ID using the Assign Paragraph ID menu item&quot;,TPE)
213 bWarnParaNoID = FALSE
214 InsertNewParaData
215 Else
216 oCur = TE.getText.createTextCursorByRange(TE)
217 thiscomponent.getcurrentcontroller.select(oCur)
218 InsertNewParaData
219 End If
220 ElseIf posID &gt; 1 Then

--- 37 unchanged lines hidden (view full) ---

258 Terminate(&quot;Unknown switch type &quot;&quot;&quot;+sSwitchType+&quot;&quot;&quot;&quot;,TE)
259 End If
260
261 Else
262 Terminate(&quot;Previous switch (&quot;+sSwitchType+&quot;) not closed!&quot;,TE)
263 End If
264
265 End If &apos; OPENING SWITCH
211 bWarnParaNoID = FALSE
212 InsertNewParaData
213 Else
214 oCur = TE.getText.createTextCursorByRange(TE)
215 thiscomponent.getcurrentcontroller.select(oCur)
216 InsertNewParaData
217 End If
218 ElseIf posID &gt; 1 Then

--- 37 unchanged lines hidden (view full) ---

256 Terminate(&quot;Unknown switch type &quot;&quot;&quot;+sSwitchType+&quot;&quot;&quot;&quot;,TE)
257 End If
258
259 Else
260 Terminate(&quot;Previous switch (&quot;+sSwitchType+&quot;) not closed!&quot;,TE)
261 End If
262
263 End If &apos; OPENING SWITCH
266
264
267 If Left(sText,8) = &quot;&lt;/SWITCH&quot; Then &apos; a closing switch tag
268
269 If sSwitchType = &quot;&quot; Then &apos; there was no switch open
270 Terminate(&quot;No switch open!&quot;,TE)
271 Else
272 If not(bCaseSet OR bDefaultSet) Then
273 Terminate(&quot;Empty switch&quot;,TE)
274 End If
265 If Left(sText,8) = &quot;&lt;/SWITCH&quot; Then &apos; a closing switch tag
266
267 If sSwitchType = &quot;&quot; Then &apos; there was no switch open
268 Terminate(&quot;No switch open!&quot;,TE)
269 Else
270 If not(bCaseSet OR bDefaultSet) Then
271 Terminate(&quot;Empty switch&quot;,TE)
272 End If
275
273
276 If sCaseType &lt;&gt; &quot;&quot; Then &apos; there is still a case open
277 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TE)
278 End If
279 sSwitchType = &quot;&quot;
280 bDefaultSet = FALSE
281 bCaseSet = FALSE
282 End If
274 If sCaseType &lt;&gt; &quot;&quot; Then &apos; there is still a case open
275 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TE)
276 End If
277 sSwitchType = &quot;&quot;
278 bDefaultSet = FALSE
279 bCaseSet = FALSE
280 End If
283
281
284 End If &apos; CLOSING SWITCH
282 End If &apos; CLOSING SWITCH
285
283
286 If Left(sText,6) = &quot;&lt;CASE &quot; Then &apos; an opening case tag
284 If Left(sText,6) = &quot;&lt;CASE &quot; Then &apos; an opening case tag
287
285
288 If bDefaultSet Then
289 Terminate(&quot;No case after default allowed.&quot;,TE)
290 End If
291
292 If sCaseType = &quot;&quot; Then
293 sCaseType = Right(sText,Len(sText)-14)
294 sCaseType = Left(sCaseType,InStr(sCaseType,&quot;&quot;&quot;&quot;)-1)
295 bCaseSet = TRUE
296 If sSwitchType = &quot;&quot; Then
297 Terminate(&quot;Case without switch&quot;,TE)
298 End If
299 Else
300 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TE)
301 End If
302
303 End If &apos; OPENING CASE
286 If bDefaultSet Then
287 Terminate(&quot;No case after default allowed.&quot;,TE)
288 End If
289
290 If sCaseType = &quot;&quot; Then
291 sCaseType = Right(sText,Len(sText)-14)
292 sCaseType = Left(sCaseType,InStr(sCaseType,&quot;&quot;&quot;&quot;)-1)
293 bCaseSet = TRUE
294 If sSwitchType = &quot;&quot; Then
295 Terminate(&quot;Case without switch&quot;,TE)
296 End If
297 Else
298 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TE)
299 End If
300
301 End If &apos; OPENING CASE
304
302
305 If Left(sText,6) = &quot;&lt;/CASE&quot; Then &apos; a closing case tag
306
307 If sCaseType = &quot;&quot; Then
308 Terminate(&quot;No case open!&quot;,TE)
309 Else
310 sCaseType = &quot;&quot;
311 End If
312
313 End If &apos; CLOSING CASE
303 If Left(sText,6) = &quot;&lt;/CASE&quot; Then &apos; a closing case tag
304
305 If sCaseType = &quot;&quot; Then
306 Terminate(&quot;No case open!&quot;,TE)
307 Else
308 sCaseType = &quot;&quot;
309 End If
310
311 End If &apos; CLOSING CASE
314
312
315 If Left(sText,8) = &quot;&lt;DEFAULT&quot; Then &apos; an opening default tag
316
317 If sCaseType = &quot;&quot; Then
318 If (sDefaultType &lt;&gt; &quot;&quot; OR bDefaultSet) Then
319 Terminate(&quot;Multiple default not allowed.&quot;,TE)
320 Else
321 sDefaultType = &quot;DEFAULT&quot;
313 If Left(sText,8) = &quot;&lt;DEFAULT&quot; Then &apos; an opening default tag
314
315 If sCaseType = &quot;&quot; Then
316 If (sDefaultType &lt;&gt; &quot;&quot; OR bDefaultSet) Then
317 Terminate(&quot;Multiple default not allowed.&quot;,TE)
318 Else
319 sDefaultType = &quot;DEFAULT&quot;
322
320
323 If sSwitchType = &quot;&quot; Then
324 Terminate(&quot;Default without switch&quot;,TE)
325 End If
326 End If
327 sDefaultType = &quot;DEFAULT&quot;
328 bDefaultSet = TRUE
329 Else
330 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TE)
331 End If
332
333 End If &apos; OPENING CASE
321 If sSwitchType = &quot;&quot; Then
322 Terminate(&quot;Default without switch&quot;,TE)
323 End If
324 End If
325 sDefaultType = &quot;DEFAULT&quot;
326 bDefaultSet = TRUE
327 Else
328 Terminate(&quot;Previous case (&quot;+sCaseType+&quot;) not closed!&quot;,TE)
329 End If
330
331 End If &apos; OPENING CASE
334
332
335 If Left(sText,9) = &quot;&lt;/DEFAULT&quot; Then &apos; a closing default tag
336
337 If sDefaultType &lt;&gt; &quot;DEFAULT&quot; Then
338 Terminate(&quot;No default open!&quot;,TE)
339 Else
340 sDefaultType = &quot;&quot;
341 End If
342
343 End If &apos; CLOSING CASE
344 Else &apos; We are not hlp_aux_switch
345 If (sSwitchType &lt;&gt; &quot;&quot; AND sCaseType = &quot;&quot; AND sDefaultType = &quot;&quot;) Then
346 Terminate(&quot;Nothing allowed between switch and case or default or /case or /default and /switch&quot;, TE)
347 End If
333 If Left(sText,9) = &quot;&lt;/DEFAULT&quot; Then &apos; a closing default tag
334
335 If sDefaultType &lt;&gt; &quot;DEFAULT&quot; Then
336 Terminate(&quot;No default open!&quot;,TE)
337 Else
338 sDefaultType = &quot;&quot;
339 End If
340
341 End If &apos; CLOSING CASE
342 Else &apos; We are not hlp_aux_switch
343 If (sSwitchType &lt;&gt; &quot;&quot; AND sCaseType = &quot;&quot; AND sDefaultType = &quot;&quot;) Then
344 Terminate(&quot;Nothing allowed between switch and case or default or /case or /default and /switch&quot;, TE)
345 End If
348 End If
346 End If
349
350End Sub
351
352&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
353&apos; CHECK SWITCHES IN A CELL
354&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
355Sub CheckSwitchesInCell(CE As Object)
356

--- 10 unchanged lines hidden (view full) ---

367 Terminate(&quot;Unknown switch type &quot;&quot;&quot;+sCellSwitchType+&quot;&quot;&quot;&quot;,CE)
368 End If
369
370 Else
371 Terminate(&quot;Previous switch (&quot;+sCellSwitchType+&quot;) not closed!&quot;,CE)
372 End If
373
374 End If &apos; OPENING SWITCH
347
348End Sub
349
350&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
351&apos; CHECK SWITCHES IN A CELL
352&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
353Sub CheckSwitchesInCell(CE As Object)
354

--- 10 unchanged lines hidden (view full) ---

365 Terminate(&quot;Unknown switch type &quot;&quot;&quot;+sCellSwitchType+&quot;&quot;&quot;&quot;,CE)
366 End If
367
368 Else
369 Terminate(&quot;Previous switch (&quot;+sCellSwitchType+&quot;) not closed!&quot;,CE)
370 End If
371
372 End If &apos; OPENING SWITCH
375
373
376 If Left(sText,8) = &quot;&lt;/SWITCH&quot; Then &apos; a closing switch tag
377
378 If sCellSwitchType = &quot;&quot; Then &apos; there was no switch open
379 Terminate(&quot;No switch open!&quot;,CE)
380 Else
381 If not(bCellCaseSet OR bCellDefaultSet) Then
382 Terminate(&quot;Empty switch&quot;,CE)
383 End If
374 If Left(sText,8) = &quot;&lt;/SWITCH&quot; Then &apos; a closing switch tag
375
376 If sCellSwitchType = &quot;&quot; Then &apos; there was no switch open
377 Terminate(&quot;No switch open!&quot;,CE)
378 Else
379 If not(bCellCaseSet OR bCellDefaultSet) Then
380 Terminate(&quot;Empty switch&quot;,CE)
381 End If
384
382
385 If sCellCaseType &lt;&gt; &quot;&quot; Then &apos; there is still a case open
386 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CE)
387 End If
388 sCellSwitchType = &quot;&quot;
389 bCellDefaultSet = FALSE
390 bCellCaseSet = FALSE
391 End If
383 If sCellCaseType &lt;&gt; &quot;&quot; Then &apos; there is still a case open
384 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CE)
385 End If
386 sCellSwitchType = &quot;&quot;
387 bCellDefaultSet = FALSE
388 bCellCaseSet = FALSE
389 End If
392
390
393 End If &apos; CLOSING SWITCH
391 End If &apos; CLOSING SWITCH
394
392
395 If Left(sText,6) = &quot;&lt;CASE &quot; Then &apos; an opening case tag
396
397 If bCellDefaultSet Then
398 Terminate(&quot;No case after default allowed.&quot;,CE)
399 End If
400
401 If sCellCaseType = &quot;&quot; Then
402 sCellCaseType = Right(sText,Len(sText)-14)
403 sCellCaseType = Left(sCellCaseType,InStr(sCellCaseType,&quot;&quot;&quot;&quot;)-1)
404 bCellCaseSet = TRUE
405 If sCellSwitchType = &quot;&quot; Then
406 Terminate(&quot;Case without switch&quot;,CE)
407 End If
408 Else
409 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CE)
410 End If
411
412 End If &apos; OPENING CASE
393 If Left(sText,6) = &quot;&lt;CASE &quot; Then &apos; an opening case tag
394
395 If bCellDefaultSet Then
396 Terminate(&quot;No case after default allowed.&quot;,CE)
397 End If
398
399 If sCellCaseType = &quot;&quot; Then
400 sCellCaseType = Right(sText,Len(sText)-14)
401 sCellCaseType = Left(sCellCaseType,InStr(sCellCaseType,&quot;&quot;&quot;&quot;)-1)
402 bCellCaseSet = TRUE
403 If sCellSwitchType = &quot;&quot; Then
404 Terminate(&quot;Case without switch&quot;,CE)
405 End If
406 Else
407 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CE)
408 End If
409
410 End If &apos; OPENING CASE
413
411
414 If Left(sText,6) = &quot;&lt;/CASE&quot; Then &apos; a closing case tag
415
416 If sCellCaseType = &quot;&quot; Then
417 Terminate(&quot;No case open!&quot;,CE)
418 Else
419 sCellCaseType = &quot;&quot;
420 End If
421
422 End If &apos; CLOSING CASE
412 If Left(sText,6) = &quot;&lt;/CASE&quot; Then &apos; a closing case tag
413
414 If sCellCaseType = &quot;&quot; Then
415 Terminate(&quot;No case open!&quot;,CE)
416 Else
417 sCellCaseType = &quot;&quot;
418 End If
419
420 End If &apos; CLOSING CASE
423
421
424 If Left(sText,8) = &quot;&lt;DEFAULT&quot; Then &apos; an opening default tag
425
426 If sCellCaseType = &quot;&quot; Then
427 If (sCellDefaultType &lt;&gt; &quot;&quot; OR bCellDefaultSet) Then
428 Terminate(&quot;Multiple default not allowed.&quot;,CE)
429 Else
430 sCellDefaultType = &quot;DEFAULT&quot;
422 If Left(sText,8) = &quot;&lt;DEFAULT&quot; Then &apos; an opening default tag
423
424 If sCellCaseType = &quot;&quot; Then
425 If (sCellDefaultType &lt;&gt; &quot;&quot; OR bCellDefaultSet) Then
426 Terminate(&quot;Multiple default not allowed.&quot;,CE)
427 Else
428 sCellDefaultType = &quot;DEFAULT&quot;
431
429
432 If sCellSwitchType = &quot;&quot; Then
433 Terminate(&quot;Default without switch&quot;,CE)
434 End If
435 End If
436 sCellDefaultType = &quot;DEFAULT&quot;
437 bCellDefaultSet = TRUE
438 Else
439 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CE)
440 End If
441
442 End If &apos; OPENING CASE
430 If sCellSwitchType = &quot;&quot; Then
431 Terminate(&quot;Default without switch&quot;,CE)
432 End If
433 End If
434 sCellDefaultType = &quot;DEFAULT&quot;
435 bCellDefaultSet = TRUE
436 Else
437 Terminate(&quot;Previous case (&quot;+sCellCaseType+&quot;) not closed!&quot;,CE)
438 End If
439
440 End If &apos; OPENING CASE
443
441
444 If Left(sText,9) = &quot;&lt;/DEFAULT&quot; Then &apos; a closing default tag
445
446 If sCellDefaultType &lt;&gt; &quot;DEFAULT&quot; Then
447 Terminate(&quot;No default open!&quot;,CE)
448 Else
449 sCellDefaultType = &quot;&quot;
450 End If
451
452 End If &apos; CLOSING CASE
453 Else &apos; We are not hlp_aux_switch
454 If (sCellSwitchType &lt;&gt; &quot;&quot; AND sCellCaseType = &quot;&quot; AND sCellDefaultType = &quot;&quot;) Then
455 Terminate(&quot;Nothing allowed between switch and case or default or /case or /default and /switch&quot;, CE)
456 End If
442 If Left(sText,9) = &quot;&lt;/DEFAULT&quot; Then &apos; a closing default tag
443
444 If sCellDefaultType &lt;&gt; &quot;DEFAULT&quot; Then
445 Terminate(&quot;No default open!&quot;,CE)
446 Else
447 sCellDefaultType = &quot;&quot;
448 End If
449
450 End If &apos; CLOSING CASE
451 Else &apos; We are not hlp_aux_switch
452 If (sCellSwitchType &lt;&gt; &quot;&quot; AND sCellCaseType = &quot;&quot; AND sCellDefaultType = &quot;&quot;) Then
453 Terminate(&quot;Nothing allowed between switch and case or default or /case or /default and /switch&quot;, CE)
454 End If
457 End If
455 End If
458
459
460End Sub
461
462
463&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
464&apos; TERMINATE VALIDATION WITH AN ERROR MESSAGE
465&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
466Sub Terminate(sStr As String, TE As Object)
467
468 oCur = TE.getText.createTextCursorByRange(TE)
456
457
458End Sub
459
460
461&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
462&apos; TERMINATE VALIDATION WITH AN ERROR MESSAGE
463&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
464Sub Terminate(sStr As String, TE As Object)
465
466 oCur = TE.getText.createTextCursorByRange(TE)
469 thiscomponent.getcurrentcontroller.select(oCur)
467 thiscomponent.getcurrentcontroller.select(oCur)
470 msgbox sStr,48,&quot;D&apos;oh!&quot;
471 Stop
472
473End Sub
474
475&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
476&apos; SHOW A WARNING
477&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

--- 4 unchanged lines hidden (view full) ---

482 oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgWarn&quot;)
483 oTxtWarn = oDialog.GetControl(&quot;txtWarning&quot;)
484 oTxtWarn.Text = sWarn
485 oTxtSolv = oDialog.GetControl(&quot;txtSolution&quot;)
486 oTxtSolv.Text = sSolv
487
488 If not(IsMissing(TE)) Then
489 oCur = TE.getText.createTextCursorByRange(TE)
468 msgbox sStr,48,&quot;D&apos;oh!&quot;
469 Stop
470
471End Sub
472
473&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
474&apos; SHOW A WARNING
475&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

--- 4 unchanged lines hidden (view full) ---

480 oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgWarn&quot;)
481 oTxtWarn = oDialog.GetControl(&quot;txtWarning&quot;)
482 oTxtWarn.Text = sWarn
483 oTxtSolv = oDialog.GetControl(&quot;txtSolution&quot;)
484 oTxtSolv.Text = sSolv
485
486 If not(IsMissing(TE)) Then
487 oCur = TE.getText.createTextCursorByRange(TE)
490 thiscomponent.getcurrentcontroller.select(oCur)
488 thiscomponent.getcurrentcontroller.select(oCur)
491 End If
492
493 If oDialog.Execute() = 1 Then
494 oCbWarn = oDialog.GetControl(&quot;cbWarn&quot;)
495 If oCbWarn.State = 1 Then
496 bWarn = FALSE
497 End If
498 Exit Sub

--- 35 unchanged lines hidden (view full) ---

534 document.DocumentInfo.Title = strg
535 Exit Do
536 End If
537 End If
538 Loop
539 End If
540
541 sIndex = oDoc.DocumentInfo.GetUserFieldValue(0)
489 End If
490
491 If oDialog.Execute() = 1 Then
492 oCbWarn = oDialog.GetControl(&quot;cbWarn&quot;)
493 If oCbWarn.State = 1 Then
494 bWarn = FALSE
495 End If
496 Exit Sub

--- 35 unchanged lines hidden (view full) ---

532 document.DocumentInfo.Title = strg
533 Exit Do
534 End If
535 End If
536 Loop
537 End If
538
539 sIndex = oDoc.DocumentInfo.GetUserFieldValue(0)
542
540
543End Sub
544
545&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
546&apos; CHECK IF HEADING EXISTS
547&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
548Sub CheckHeading(oDoc As Object)
549
550End Sub
551
552&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
553&apos; CHECK FOR CORRECT INLINE TAGS
554&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
555Sub CheckInlineTags(TE As Object)
556
541End Sub
542
543&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
544&apos; CHECK IF HEADING EXISTS
545&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
546Sub CheckHeading(oDoc As Object)
547
548End Sub
549
550&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
551&apos; CHECK FOR CORRECT INLINE TAGS
552&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
553Sub CheckInlineTags(TE As Object)
554
557
558
555
556
559 If Left(TE.ParaStyleName,4)=&quot;hlp_&quot; AND (Left(TE.ParaStyleName,8)&lt;&gt;&quot;hlp_aux_&quot; OR TE.ParaStyleName=&quot;hlp_aux_bookmark&quot;) Then
557 If Left(TE.ParaStyleName,4)=&quot;hlp_&quot; AND (Left(TE.ParaStyleName,8)&lt;&gt;&quot;hlp_aux_&quot; OR TE.ParaStyleName=&quot;hlp_aux_bookmark&quot;) Then
560
558
561 Dim aTokens(0) As Object
562 Dim aInlineTagsOpen(0) As String
563 TP = TE.createEnumeration
564
565 While TP.hasmoreElements
566 sDim = ubound(aTokens())+1
567 ReDim Preserve aTokens(sDim) As Object
568 aTokens(sDim) = TP.nextElement
569 Wend
570
571 For i=1 to ubound(aTokens())
572 Token = aTokens(i)
559 Dim aTokens(0) As Object
560 Dim aInlineTagsOpen(0) As String
561 TP = TE.createEnumeration
562
563 While TP.hasmoreElements
564 sDim = ubound(aTokens())+1
565 ReDim Preserve aTokens(sDim) As Object
566 aTokens(sDim) = TP.nextElement
567 Wend
568
569 For i=1 to ubound(aTokens())
570 Token = aTokens(i)
573
571
574 If Token.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
575 sTag = Token.TextField.TextFieldMaster.Name
572 If Token.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
573 sTag = Token.TextField.TextFieldMaster.Name
576
574
577 If Right(sTag,1)=&quot;_&quot; Then &apos; a tag starts
575 If Right(sTag,1)=&quot;_&quot; Then &apos; a tag starts
578
576
579 sTagName = Left(sTag,Len(sTag)-1)
577 sTagName = Left(sTag,Len(sTag)-1)
580
578
581 &apos; check for forbidden tags in paragraphs
582 sTagFormat = TagFormatIsCorrect(sTagName, TE.ParaStyleName)
583 If sTagFormat &lt;&gt; &quot;&quot; Then
584 Terminate(sTagName+&quot; element has wrong paragraph style (&quot;+TE.ParaStyleName+&quot;).&quot;+chr(13)+&quot;Must be &quot;+sTagFormat,Token)
585 End If
579 &apos; check for forbidden tags in paragraphs
580 sTagFormat = TagFormatIsCorrect(sTagName, TE.ParaStyleName)
581 If sTagFormat &lt;&gt; &quot;&quot; Then
582 Terminate(sTagName+&quot; element has wrong paragraph style (&quot;+TE.ParaStyleName+&quot;).&quot;+chr(13)+&quot;Must be &quot;+sTagFormat,Token)
583 End If
586
584
587 sDim = ubound(aInlineTagsOpen())+1
588 Redim Preserve aInlineTagsOpen(sDim) as String
589 aInlineTagsOpen(sDim)=sTagName
590
591 ElseIf Left(sTag,1)=&quot;_&quot; Then &apos; a tag ends, all other cases are empty tags
585 sDim = ubound(aInlineTagsOpen())+1
586 Redim Preserve aInlineTagsOpen(sDim) as String
587 aInlineTagsOpen(sDim)=sTagName
588
589 ElseIf Left(sTag,1)=&quot;_&quot; Then &apos; a tag ends, all other cases are empty tags
592
590
593 sTagName = Right(sTag,Len(sTag)-1)
591 sTagName = Right(sTag,Len(sTag)-1)
594
592
595 &apos; check for forbidden tags in paragraphs
596 sTagFormat = TagFormatIsCorrect(sTagName, TE.ParaStyleName)
597 If sTagFormat &lt;&gt; &quot;&quot; Then
598 Terminate(sTagName+&quot; element has wrong paragraph style (&quot;+TE.ParaStyleName+&quot;).&quot;+chr(13)+&quot;Must be &quot;+sTagFormat,Token)
599 End If
593 &apos; check for forbidden tags in paragraphs
594 sTagFormat = TagFormatIsCorrect(sTagName, TE.ParaStyleName)
595 If sTagFormat &lt;&gt; &quot;&quot; Then
596 Terminate(sTagName+&quot; element has wrong paragraph style (&quot;+TE.ParaStyleName+&quot;).&quot;+chr(13)+&quot;Must be &quot;+sTagFormat,Token)
597 End If
600
598
601 If ubound(aInlineTagsOpen()) &gt; 0 Then
602 If aInlineTagsOpen(ubound(aInlineTagsOpen())) &lt;&gt; sTagName Then
599 If ubound(aInlineTagsOpen()) &gt; 0 Then
600 If aInlineTagsOpen(ubound(aInlineTagsOpen())) &lt;&gt; sTagName Then
603 Terminate(&quot;Inline Element &quot;+aInlineTagsOpen(ubound(aInlineTagsOpen()))+&quot; not closed&quot;,Token)
601 Terminate(&quot;Inline Element &quot;+aInlineTagsOpen(ubound(aInlineTagsOpen()))+&quot; not closed&quot;,Token)
604 End If
605 sDim = ubound(aInlineTagsOpen())-1
606 Else
607 Terminate(&quot;No opening tag for &quot;+sTagName,Token)
608 End If
609 Redim Preserve aInlineTagsOpen(sDim) as String
602 End If
603 sDim = ubound(aInlineTagsOpen())-1
604 Else
605 Terminate(&quot;No opening tag for &quot;+sTagName,Token)
606 End If
607 Redim Preserve aInlineTagsOpen(sDim) as String
610
608
611 Else &apos; empty tag
612 sTagName = sTag
613 sTagFormat = TagFormatIsCorrect(sTagName, TE.ParaStyleName)
614 If sTagFormat &lt;&gt; &quot;&quot; Then
615 Terminate(sTagName+&quot; element has wrong paragraph style (&quot;+TE.ParaStyleName+&quot;).&quot;+chr(13)+&quot;Must be &quot;+sTagFormat,Token)
616 End If
609 Else &apos; empty tag
610 sTagName = sTag
611 sTagFormat = TagFormatIsCorrect(sTagName, TE.ParaStyleName)
612 If sTagFormat &lt;&gt; &quot;&quot; Then
613 Terminate(sTagName+&quot; element has wrong paragraph style (&quot;+TE.ParaStyleName+&quot;).&quot;+chr(13)+&quot;Must be &quot;+sTagFormat,Token)
614 End If
617
615
618 EndIf
619 ElseIf (i &gt; 1) AND (Trim(Token.String) &lt;&gt; &quot;&quot;) Then
620 If aInlineTagsOpen(ubound(aInlineTagsOpen())) = &quot;SWITCHINLINE&quot; Then
621 Terminate(&quot;No text allowed here.&quot;,Token)
622 End If
623 End If
616 EndIf
617 ElseIf (i &gt; 1) AND (Trim(Token.String) &lt;&gt; &quot;&quot;) Then
618 If aInlineTagsOpen(ubound(aInlineTagsOpen())) = &quot;SWITCHINLINE&quot; Then
619 Terminate(&quot;No text allowed here.&quot;,Token)
620 End If
621 End If
624 Next
625
622 Next
623
626 If ubound(aInlineTagsOpen()) &gt; 0 Then
627 Terminate(&quot;Inline Element &quot;+aInlineTagsOpen(ubound(aInlineTagsOpen()))+&quot; not closed&quot;,Token)
628 End If
624 If ubound(aInlineTagsOpen()) &gt; 0 Then
625 Terminate(&quot;Inline Element &quot;+aInlineTagsOpen(ubound(aInlineTagsOpen()))+&quot; not closed&quot;,Token)
626 End If
629
627
630 End If
631End Sub
632
633&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
634&apos; CHECK FOR CORRECT TAGS
635&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
636Sub CheckTags(TE As Object)
637 If (Left(TE.ParaStyleName,8) = &quot;hlp_aux_&quot; AND TE.ParaStyleName &lt;&gt; &quot;hlp_aux_bookmark&quot;) Then
638
639 TP = TE.createEnumeration
640
641 While TP.hasmoreElements
642 TPE = TP.nextElement
643
644 If TPE.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
645 sTag = TPE.TextField.TextFieldMaster.Name
646 If Right(sTag,1)=&quot;_&quot; Then &apos; a tag starts
628 End If
629End Sub
630
631&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
632&apos; CHECK FOR CORRECT TAGS
633&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
634Sub CheckTags(TE As Object)
635 If (Left(TE.ParaStyleName,8) = &quot;hlp_aux_&quot; AND TE.ParaStyleName &lt;&gt; &quot;hlp_aux_bookmark&quot;) Then
636
637 TP = TE.createEnumeration
638
639 While TP.hasmoreElements
640 TPE = TP.nextElement
641
642 If TPE.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
643 sTag = TPE.TextField.TextFieldMaster.Name
644 If Right(sTag,1)=&quot;_&quot; Then &apos; a tag starts
647
645
648 sTagName = Left(sTag,Len(sTag)-1)
649 sDim = ubound(aTagsOpen())+1
650 Redim Preserve aTagsOpen(sDim) as String
651 aTagsOpen(sDim)=sTagName
646 sTagName = Left(sTag,Len(sTag)-1)
647 sDim = ubound(aTagsOpen())+1
648 Redim Preserve aTagsOpen(sDim) as String
649 aTagsOpen(sDim)=sTagName
652
650
653 ElseIf Left(sTag,1)=&quot;_&quot; Then &apos; a tag ends, all other cases are empty tags
651 ElseIf Left(sTag,1)=&quot;_&quot; Then &apos; a tag ends, all other cases are empty tags
654
652
655 sTagName = Right(sTag,Len(sTag)-1)
656 If ubound(aTagsOpen()) &gt; 0 Then
657 If aTagsOpen(ubound(aTagsOpen())) &lt;&gt; sTagName Then
658 Terminate(&quot;No close tag for &quot;+aTagsOpen(ubound(aTagsOpen())),TPE)
659 Else
660 sDim = ubound(aTagsOpen())-1
661 End If
662 Else
663 Terminate(&quot;No opening tag for &quot;+sTagName,TPE)
664 End If
665 Redim Preserve aTagsOpen(sDim) as String
666
667 Else &apos; empty tags
653 sTagName = Right(sTag,Len(sTag)-1)
654 If ubound(aTagsOpen()) &gt; 0 Then
655 If aTagsOpen(ubound(aTagsOpen())) &lt;&gt; sTagName Then
656 Terminate(&quot;No close tag for &quot;+aTagsOpen(ubound(aTagsOpen())),TPE)
657 Else
658 sDim = ubound(aTagsOpen())-1
659 End If
660 Else
661 Terminate(&quot;No opening tag for &quot;+sTagName,TPE)
662 End If
663 Redim Preserve aTagsOpen(sDim) as String
664
665 Else &apos; empty tags
668
666
669 EndIf
670 End If
671 Wend
672 End If
673End Sub
674
675&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
676&apos; CHECK FOR CORRECT TAGS IN A TABLE CELL

--- 4 unchanged lines hidden (view full) ---

681 CP = CE.createEnumeration
682
683 While CP.hasmoreElements
684 CPE = CP.nextElement
685
686 If CPE.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
687 sTag = CPE.TextField.TextFieldMaster.Name
688 If Right(sTag,1)=&quot;_&quot; Then &apos; a tag starts
667 EndIf
668 End If
669 Wend
670 End If
671End Sub
672
673&apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
674&apos; CHECK FOR CORRECT TAGS IN A TABLE CELL

--- 4 unchanged lines hidden (view full) ---

679 CP = CE.createEnumeration
680
681 While CP.hasmoreElements
682 CPE = CP.nextElement
683
684 If CPE.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
685 sTag = CPE.TextField.TextFieldMaster.Name
686 If Right(sTag,1)=&quot;_&quot; Then &apos; a tag starts
689
687
690 sTagName = Left(sTag,Len(sTag)-1)
691 sDim = ubound(aCellTagsOpen())+1
692 Redim Preserve aCellTagsOpen(sDim) as String
693 aCellTagsOpen(sDim)=sTagName
688 sTagName = Left(sTag,Len(sTag)-1)
689 sDim = ubound(aCellTagsOpen())+1
690 Redim Preserve aCellTagsOpen(sDim) as String
691 aCellTagsOpen(sDim)=sTagName
694
692
695 ElseIf Left(sTag,1)=&quot;_&quot; Then &apos; a tag ends, all other cases are empty tags
693 ElseIf Left(sTag,1)=&quot;_&quot; Then &apos; a tag ends, all other cases are empty tags
696
694
697 sTagName = Right(sTag,Len(sTag)-1)
698 If ubound(aCellTagsOpen()) &gt; 0 Then
699 If aCellTagsOpen(ubound(aCellTagsOpen())) &lt;&gt; sTagName Then
700 Terminate(&quot;No close tag for &quot;+aCellTagsOpen(ubound(aCellTagsOpen())),CPE)
701 Else
702 sDim = ubound(aCellTagsOpen())-1
703 End If
704 Else
705 Terminate(&quot;No opening tag for &quot;+sTagName,CPE)
706 End If
707 Redim Preserve aCellTagsOpen(sDim) as String
708
709 EndIf
710 End If
711 Wend
712 End If
713End Sub
714
715</script:module>
695 sTagName = Right(sTag,Len(sTag)-1)
696 If ubound(aCellTagsOpen()) &gt; 0 Then
697 If aCellTagsOpen(ubound(aCellTagsOpen())) &lt;&gt; sTagName Then
698 Terminate(&quot;No close tag for &quot;+aCellTagsOpen(ubound(aCellTagsOpen())),CPE)
699 Else
700 sDim = ubound(aCellTagsOpen())-1
701 End If
702 Else
703 Terminate(&quot;No opening tag for &quot;+sTagName,CPE)
704 End If
705 Redim Preserve aCellTagsOpen(sDim) as String
706
707 EndIf
708 End If
709 Wend
710 End If
711End Sub
712
713</script:module>