1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: sxw7_01a.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-07-11 07:34:36 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : helge.delfs@sun.com
36 '* short description : XML Writer Include File
38 '\***********************************************************************************
39 Dim Isliste(250) as string
40 Dim OutputPath as string
44 printlog "-------------------------- SXW7_01a.INC ------------------------------"
46 printlog "---------------------------------------------------------------------"
52 '-------------------------------------------------------------------------
57 Dim AttributeSearch(60) as string
58 Dim AttributeValue(60) as string
59 Dim sXMLNodename(50) as string
60 Dim sPathToAttributes as string
62 printlog "+- fields.sdw"
63 '/// Opening file fields.sdw from input-directory.
64 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\fields.sdw"))
65 '/// Saving the document in OOo XML 1.0 format.
66 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields.sxw") , "StarOffice XML (Writer)") then
67 '/// Closing the document also if there is a verification dialog.
70 '/// Unpack the complete content of the file (ZIP-archieve) into a seperate directory.
71 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\fields.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\fields") )
72 '/// Checking the well formness of content.xml, styles.xml and meta.xml.
73 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\meta.xml")) = FALSE then
74 warnlog "XML-file 'meta.xml' not well formed!"
76 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\styles.xml")) = FALSE then
77 warnlog "XML-file 'styles.xml' not well formed!"
79 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\content.xml")) = FALSE then
80 warnlog "XML-file 'content.xml' not well formed!"
82 '/// Opening the exported file (GPF check).
83 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\fields.sxw"))
85 '/// Closing the document.
88 SAXReadFile(gOfficePath & ConvertPath("user\work\xml\writer\level1\fields\content.xml"))
89 printlog " ---------------------"
90 printlog " c o n t e n t . x m l"
91 printlog " ---------------------"
95 '-------------------------------------------------------------------------
96 '/// <u><b>CONTENT.XML</u></b>
97 printlog "++ Feature(s) to be searched for:"
99 '-------------------------------------------------------------------------
100 '/// Searching for: <text:sender-firstname text:fixed="false">
101 '/// Searching for: <text:sender-lastname text:fixed="false">
102 sXMLNodename(1) = "text:sender-firstname"
103 sXMLNodename(2) = "text:sender-lastname"
104 AttributeSearch(1) = "text:fixed"
105 AttributeValue(1) = "false"
106 '/// Searching for: <text:date text:date-value="2000-11-30T16:14:56"
107 '/// Searching for: <text:time text:time-value="[not null]"
108 sXMLNodename(3) = "text:date"
109 AttributeSearch(3) = "text:date-value"
110 AttributeValue(3) = "2000-11-30T16:14:56"
111 sXMLNodename(4) = "text:time"
112 AttributeSearch(4) = "text:time-value"
113 AttributeValue(4) = ""
114 '/// Searching for: <text:word-count style:num-format="1">75</text:word-count>
115 '/// Searching for: <text:character-count style:num-format="1">788</text:character-count>
116 sXMLNodename(5) = "text:word-count"
117 'TODO: JSI: Rotine needed for char XML node
119 sXMLNodename(6) = "text:character-count"
120 'TODO: JSI: Rotine needed for char XML node
122 AttributeSearch(5) = "style:num-format"
123 AttributeValue(5) = "1"
124 '/// Searching for: <text:reference-mark-start text:name="ref"/>I am a reference<text:reference-mark-end text:name="ref"/>
125 sXMLNodename(7) = "text:reference-mark-start"
126 sXMLNodename(8) = "text:reference-mark-end"
127 AttributeSearch(7) = "text:name"
128 AttributeValue(7) = "ref"
129 '/// Searching for: <text:reference-ref text:reference-format="page" text:ref-name="ref">1</text:reference-ref> Chapter: <text:reference-ref text:reference-format="chapter" text:ref-name="ref">1</text:reference-ref> Location: <text:reference-ref text:reference-format="direction" text:ref-name="ref">above</text:reference-ref>
130 sXMLNodename(9) = "text:reference-ref"
131 'TODO: JSI: Rotine needed for char XML node
134 'CharNode: above [11]
135 AttributeSearch(9) = "text:reference-format"
136 AttributeValue(9) = "page"
137 AttributeValue(10) = "chapter"
138 AttributeValue(11) = "direction"
139 'All three have this attribute and -value:
140 AttributeSearch(12) = "text:ref-name"
141 AttributeValue(12) = "ref"
142 '/// Searching for: <text:variable-set text:name="x" text:value-type="float" text:value="1" style:data-style-name="N0">1</text:variable-set>
143 sXMLNodename(13) = "text:variable-set"
144 AttributeSearch(13) = "text:name"
145 AttributeValue(13) = "x"
146 AttributeSearch(14) = "text:value-type"
147 AttributeValue(14) = "float"
148 AttributeSearch(15) = "text:value"
149 AttributeValue(15) = "1"
150 AttributeSearch(16) = "style:data-style-name"
151 AttributeValue(16) = "N0"
152 'TODO: JSI: Rotine needed for char XML node
154 '/// Searching for: <text:user-field-get text:name="I_am_a_user_field">Content of the user field</text:user-field-get>
155 sXMLNodename(17) = "text:user-field-get"
156 AttributeSearch(17) = "text:name"
157 AttributeValue(17) = "I_am_a_user_field"
158 'TODO: JSI: Rotine needed for char XML node
159 'CharNode: Content of the user field
160 '/// Searching for: <text:conditional-text text:condition="x==1" text:string-value-if-true="x = 1" text:string-value-if-false="x &lt;&gt; 1">x = 1</text:conditional-text>
161 sXMLNodename(18) = "text:conditional-text"
162 AttributeSearch(18) = "text:condition"
163 AttributeValue(18) = "x==1"
164 AttributeSearch(19) = "text:string-value-if-true"
165 AttributeValue(19) = "x = 1"
166 AttributeSearch(20) = "text:string-value-if-false"
167 AttributeValue(20) = "x <> 1"
168 'TODO: JSI: Rotine needed for char XML node
170 '/// Searching for: <text:hidden-text text:condition="x==1" text:string-value="x is not equal to 1"/>
171 sXMLNodename(21) = "text:hidden-text"
172 AttributeSearch(21) = "text:condition"
173 AttributeValue(21) = "x==1"
174 AttributeSearch(22) = "text:string-value"
175 AttributeValue(22) = "x is not equal to 1"
176 '/// Searching for: <text:hidden-paragraph text:condition="x==1" text:is-hidden="true"/>I am hidden if x=1</text:p>
177 sXMLNodename(23) = "text:hidden-paragraph"
178 AttributeSearch(23) = "text:condition"
179 AttributeValue(23) = "x==1"
180 AttributeSearch(24) = "text:is-hidden"
181 AttributeValue(24) = "true"
182 'TODO: JSI: Rotine needed for char XML node
183 'CharNode: I am hidden if x=1
184 '/// Searching for: <text:creation-date style:data-style-name="N36">15/11/2000</text:creation-date>
185 sXMLNodename(25) = "text:creation-date"
186 AttributeSearch(25) = "style:data-style-name"
187 AttributeValue(25) = "N108"
188 '/// Searching for: '<text:editing-cycles>0</text:editing-cycles>
189 'sXMLNodename(?) = text:editing-cycles
190 'TODO: JSI: Rotine needed for char XML node
192 '/// Searching for: <text:modification-date style:data-style-name="N81">6. mars 2003</text:modification-date>
193 sXMLNodename(26) = "text:modification-date"
194 AttributeSearch(26) = "style:data-style-name"
195 AttributeValue(26) = "N76"
196 'TODO: JSI: Rotine needed for char XML node
197 'CharNode: 6. mars 2003
198 '/// Searching for: <text:database-display text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" text:column-name="Author">&lt;Author&gt;</text:database-display>
199 sXMLNodename(27) = "text:database-display"
200 AttributeSearch(27) = "text:database-name"
201 AttributeValue(27) = "Bibliography"
202 AttributeSearch(28) = "text:table-name"
203 AttributeValue(28) = "biblio"
204 AttributeSearch(29) = "text:table-type"
205 AttributeValue(29) = "table"
206 AttributeSearch(30) = "text:column-name"
207 AttributeValue(30) = "Author"
208 'TODO: JSI: Rotine needed for char XML node
210 '/// Searching for: <text:database-next text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" text:condition="TRUE"/>
211 sXMLNodename(31) = "text:database-next"
212 AttributeSearch(31) = "text:database-name"
213 AttributeValue(31) = "Bibliography"
214 AttributeSearch(32) = "text:table-name"
215 AttributeValue(32) = "biblio"
216 AttributeSearch(33) = "text:table-type"
217 AttributeValue(33) = "table"
218 AttributeSearch(34) = "text:condition"
219 AttributeValue(34) = "TRUE"
220 '/// Searching for: <text:database-display text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" text:column-name="Author">&lt;Author&gt;</text:database-display>
221 sXMLNodename(35) = "text:database-display"
222 AttributeSearch(35) = "text:database-name"
223 AttributeValue(35) = "Bibliography"
224 AttributeSearch(36) = "text:table-name"
225 AttributeValue(36) = "biblio"
226 AttributeSearch(37) = "text:table-type"
227 AttributeValue(37) = "table"
228 AttributeSearch(38) = "text:column-name"
229 AttributeValue(38) = "Author"
230 'TODO: JSI: Rotine needed for char XML node
232 '/// Searching for: <text:database-row-number text:database-name="Bibliography" text:table-name="biblio" text:table-type="table" style:num-format="1" text:value="3">3</text:database-row-number>
233 sXMLNodename(39) = "text:database-row-number"
234 AttributeSearch(39) = "text:database-name"
235 AttributeValue(39) = "Bibliography"
236 AttributeSearch(40) = "text:table-name"
237 AttributeValue(40) = "biblio"
238 AttributeSearch(41) = "text:table-type"
239 AttributeValue(41) = "table"
240 AttributeSearch(42) = "style:num-format"
241 AttributeValue(42) = "1"
242 AttributeSearch(43) = "text:value"
243 AttributeValue(43) = "3"
244 'TODO: JSI: Rotine needed for char XML node
246 '/// Searching for: <text:database-name text:database-name="Bibliography" text:table-name="biblio" text:table-type="table">Bibliography.biblio</text:database-name>
247 sXMLNodename(44) = "text:database-name"
248 AttributeSearch(44) = "text:database-name"
249 AttributeValue(44) = "Bibliography"
250 AttributeSearch(45) = "text:table-name"
251 AttributeValue(45) = "biblio"
252 AttributeSearch(46) = "text:table-type"
253 AttributeValue(46) = "table"
254 'TODO: JSI: Rotine needed for char XML node
255 'CharNode: Bibliography.biblio
259 ' Two nodes have the same attributes and -values as the first one
260 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a))
261 SAXSeekElement(sPathToAttributes)
262 printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(1)
263 if SAXGetAttributeValue(AttributeSearch(1)) <> AttributeValue(1) then
264 warnlog "Field: " & AttributeSearch(1) & " is not " & AttributeValue(1) & "!"
268 ' Two nodes have the same attributes and -values as the first one
269 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a))
270 SAXSeekElement(sPathToAttributes)
271 printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(5)
272 if SAXGetAttributeValue(AttributeSearch(5)) <> AttributeValue(5) then
273 warnlog "Field: " & AttributeSearch(5) & " is not " & AttributeValue(5) & "!"
276 case 7 , 8 : ' Two nodes have the same attributes and -values as the first one
277 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a))
278 SAXSeekElement(sPathToAttributes)
279 printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(7)
280 if SAXGetAttributeValue(AttributeSearch(7)) <> AttributeValue(7) then
281 warnlog "Field: " & AttributeSearch(7) & " is not " & AttributeValue(7) & "!"
285 ' The attribute is language dependent and should NOT be NULL
286 ' The if-then-else inquiry is another than in the other inquiries!
287 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a))
288 SAXSeekElement(sPathToAttributes)
289 printlog " +- [Element: " & sXMLNodename(a) & "] Attribute: " & AttributeSearch(a)
290 if SAXGetAttributeValue(AttributeSearch(a)) = AttributeValue(a) then
291 warnlog "Field: " & AttributeSearch(a) & " is null empty!"
295 ' Three times the same element name but not the same XML node
296 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(9) , a-8)
297 SAXSeekElement(sPathToAttributes)
298 printlog " +- [Element: " & sXMLNodename(9) & "] Attribute: " & AttributeSearch(9) & "=" & AttributeValue(a)
299 if SAXGetAttributeValue(AttributeSearch(9)) <> AttributeValue(a) then
300 warnlog "Field: " & AttributeSearch(9) & " is not " & AttributeValue(a) & "!"
305 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(9) , i)
306 SAXSeekElement(sPathToAttributes)
307 printlog " +- [Element: " & sXMLNodename(9) & " (" & i & ")] Attribute: " & AttributeSearch(12) & "=" & AttributeValue(12)
308 if SAXGetAttributeValue(AttributeSearch(12)) <> AttributeValue(12) then
309 warnlog "Field: " & AttributeSearch(12) & " is not " & AttributeValue(12) & "!"
314 ' One node has two attributes
315 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(21))
316 SAXSeekElement(sPathToAttributes)
317 printlog " +- [Element: " & sXMLNodename(21) & "]" & AttributeSearch(a)
318 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
319 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
323 ' One node has two attributes
324 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(23))
325 SAXSeekElement(sPathToAttributes)
326 printlog " +- [Element: " & sXMLNodename(23) & "]" & AttributeSearch(a)
327 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
328 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
332 ' One node has three attributes
333 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(18))
334 SAXSeekElement(sPathToAttributes)
335 printlog " +- [Element: " & sXMLNodename(18) & "]" & AttributeSearch(a)
336 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
337 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
341 ' One node has three attributes
342 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(44))
343 SAXSeekElement(sPathToAttributes)
344 printlog " +- [Element: " & sXMLNodename(44) & "]" & AttributeSearch(a)
345 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
346 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
349 case 13, 14, 15, 16 :
350 ' One node has four attributes
351 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(13))
352 SAXSeekElement(sPathToAttributes)
353 printlog " +- [Element: " & sXMLNodename(13) & "]" & AttributeSearch(a)
354 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
355 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
358 case 27, 28, 29, 30 :
359 ' One node has four attributes
360 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(27))
361 SAXSeekElement(sPathToAttributes)
362 printlog " +- [Element: " & sXMLNodename(27) & "]" & AttributeSearch(a)
363 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
364 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
367 case 31, 32, 33, 34 :
368 ' One node has four attributes
369 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(31))
370 SAXSeekElement(sPathToAttributes)
371 printlog " +- [Element: " & sXMLNodename(31) & "]" & AttributeSearch(a)
372 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
373 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
376 case 35, 36, 37, 38 :
377 ' One node has four attributes
378 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(35))
379 SAXSeekElement(sPathToAttributes)
380 printlog " +- [Element: " & sXMLNodename(35) & "]" & AttributeSearch(a)
381 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
382 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
385 case 39, 40, 41, 42, 43 :
386 ' One node has five attributes
387 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(39))
388 SAXSeekElement(sPathToAttributes)
389 printlog " +- [Element: " & sXMLNodename(39) & "]" & AttributeSearch(a)
390 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
391 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
395 'skipping (evaluating different style names under different operating systems
398 sPathToAttributes = fWhereIsXMLElementInBody("office:document-content" , "office:body" , sXMLNodename(a))
399 SAXSeekElement(sPathToAttributes)
400 printlog " +- [Element: " & sXMLNodename(a) & "]" & AttributeSearch(a)
401 if SAXGetAttributeValue(AttributeSearch(a)) <> AttributeValue(a) then
402 warnlog "Field: " & AttributeSearch(a) & " is not " & AttributeValue(a) & "!"
416 '-------------------------------------------------------------------------
421 Dim AttributeSearch(60) as string
422 Dim AttributeValue(60) as string
423 Dim sXMLNodename(50) as string
424 Dim sPathToAttributes as string
426 printlog "+- footnotes.sdw"
427 '/// Opening file footnotes.sdw from input-directory.
428 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\footnotes.sdw"))
429 '/// Saving the document in OOo XML 1.0 format.
430 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes.sxw") , "StarOffice XML (Writer)") then
431 '/// Closing the document also if there is a verification dialog.
432 call hCloseDocument()
434 '/// Unpack the complete content of the file (ZIP-archieve) into a seperate directory.
435 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes") )
436 '/// Checking the well formness of content.xml, styles.xml and meta.xml.
437 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes\meta.xml")) = FALSE then
438 warnlog "XML-file 'meta.xml' not well formed!"
440 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes\styles.xml")) = FALSE then
441 warnlog "XML-file 'styles.xml' not well formed!"
443 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes\content.xml")) = FALSE then
444 warnlog "XML-file 'content.xml' not well formed!"
446 '/// Opening the exported file (GPF check).
447 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\footnotes.sxw"))
449 '/// Closing the document.