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_03.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-07-11 07:35:14 $
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
41 Dim iSecurityBefore as integer
45 printlog "-------------------------- SXW7_03.INC ------------------------------"
46 call hEnablePrettyPrinting
48 call hEnablePrettyPrinting(1)
56 printlog "------------------------ Macros and Events --------------------------"
58 iSecurityBefore = hSetMacroSecurity(1)
60 call hSetMacroSecurity(iSecurityBefore)
63 '-------------------------------------------------------------------------
66 Dim Searchstring(9) as string
68 Dim AdditionalParameter as string
69 printlog "+- hyperlinks.sdw"
70 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\hyperlinks.sdw"))
71 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks.sxw") , "StarOffice XML (Writer)") then
72 '/// Closing the document also if there is a verification dialog.
75 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks") )
76 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\styles.xml")) = FALSE then
77 warnlog "XML-file 'styles.xml' not well formed!"
79 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\meta.xml")) = FALSE then
80 warnlog "XML-file 'meta.xml' not well formed!"
82 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\content.xml")) = FALSE then
83 warnlog "XML-file 'content.xml' not well formed!"
85 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks.sxw"))
89 ' -----------------------
90 ' T E X T - S T Y L E S
91 ' -----------------------
92 ' <text:p text:style-name="Standard"><text:a xlink:type="simple" xlink:href="http://Www.sun.com/" office:target-frame-name="_blank" xlink:show="new" text:style-name="Variable" text:visited-style-name="Quotation"><text:span text:style-name="T1">Www.sun.com</text:span></text:a></text:p>
93 '-------------------------------------------------------------------------
94 Searchstring(1) = "<text:a"
95 Searchstring(2) = "xlink:type=" & CHR$(34) & "simple" & CHR$(34)
96 Searchstring(3) = "xlink:href=" & CHR$(34) & "http://Www.sun.com/" & CHR$(34)
97 Searchstring(4) = "office:target-frame-name=" & CHR$(34) & "_blank" & CHR$(34)
98 Searchstring(5) = "xlink:show=" & CHR$(34) & "new" & CHR$(34)
99 Searchstring(6) = "text:visited-style-name=" & CHR$(34)
100 Searchstring(7) = ">Www.sun.com<"
101 Searchstring(8) = "</text:span>"
102 Searchstring(9) = "</text:a>"
103 '-------------------------------------------------------------------------
104 AdditionalParameter = GetLineInXMLBody(gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\content.xml") , "text:p" , 1)
105 printlog "Debug: " & AdditionalParameter
107 printlog " +- " & Searchstring(i)
108 if InStr (AdditionalParameter , Searchstring(i)) = 0 then
109 warnlog "Hyperlinks in text: " & Searchstring(i) & " not found!"
112 ' <text:p text:style-name="P1"><text:a xlink:type="simple" xlink:href="#targ" text:style-name="Variable" text:visited-style-name="Quotation">jump</text:a></text:p>
113 '-------------------------------------------------------------------------
114 Searchstring(1) = "<text:a"
115 Searchstring(2) = "xlink:type=" & CHR$(34) & "simple" & CHR$(34)
116 Searchstring(3) = "xlink:href=" & CHR$(34) & "#targ" & CHR$(34)
117 Searchstring(4) = "text:visited-style-name=" & CHR$(34)
118 Searchstring(5) = ">jump<"
119 Searchstring(6) = "</text:a>"
120 '-------------------------------------------------------------------------
121 AdditionalParameter = GetLineInXMLBody(gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\content.xml") , "text:p" , 3)
123 printlog " +- " & Searchstring(i)
124 if InStr (AdditionalParameter , Searchstring(i)) = 0 then
125 warnlog "Hyperlinks in text: " & Searchstring(i) & " not found!"
128 ' <text:p text:style-name="P1"><text:bookmark-start text:name="targ"/>target here<text:bookmark-end text:name="targ"/></text:p>
129 '-------------------------------------------------------------------------
130 Searchstring(1) = "<text:bookmark-start"
131 Searchstring(2) = "text:name=" & CHR$(34) & "targ" & CHR$(34)
132 Searchstring(3) = ">target here<"
133 Searchstring(4) = "<text:bookmark-end"
134 '-------------------------------------------------------------------------
135 AdditionalParameter = GetLineInXMLBody(gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\content.xml") , "text:p" , 6)
137 printlog " +- " & Searchstring(i)
138 if InStr (AdditionalParameter , Searchstring(i)) = 0 then
139 warnlog "Hyperlinks in text: " & Searchstring(i) & " not found!"
148 '-------------------------------------------------------------------------
150 testcase tindexes_alpha
151 printlog "+- indexes_alpha.sdw"
152 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\indexes_alpha.sdw"))
153 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\indexes_alpha.sxw") , "StarOffice XML (Writer)") then
154 '/// Closing the document also if there is a verification dialog.
155 call hCloseDocument()
157 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\indexes_alpha.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\indexes_alpha") )
158 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\indexes_alpha\styles.xml")) = FALSE then
159 warnlog "XML-file 'styles.xml' not well formed!"
161 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\indexes_alpha\meta.xml")) = FALSE then
162 warnlog "XML-file 'meta.xml' not well formed!"
164 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\indexes_alpha\content.xml")) = FALSE then
165 warnlog "XML-file 'content.xml' not well formed!"
167 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\indexes_alpha.sxw"))
177 '-------------------------------------------------------------------------
179 testcase tindex_biblio
180 printlog "+- index_biblio.sdw"
181 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\index_biblio.sdw"))
182 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_biblio.sxw") , "StarOffice XML (Writer)") then
183 '/// Closing the document also if there is a verification dialog.
184 call hCloseDocument()
186 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\index_biblio.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\index_biblio") )
187 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_biblio\styles.xml")) = FALSE then
188 warnlog "XML-file 'styles.xml' not well formed!"
190 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_biblio\meta.xml")) = FALSE then
191 warnlog "XML-file 'meta.xml' not well formed!"
193 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_biblio\content.xml")) = FALSE then
194 warnlog "XML-file 'content.xml' not well formed!"
196 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_biblio.sxw"))
206 '-------------------------------------------------------------------------
209 printlog "+- index_most.sdw"
210 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\index_most.sdw"))
211 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_most.sxw") , "StarOffice XML (Writer)") then
212 '/// Closing the document also if there is a verification dialog.
213 call hCloseDocument()
215 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\index_most.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\index_most") )
216 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_most\styles.xml")) = FALSE then
217 warnlog "XML-file 'styles.xml' not well formed!"
219 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_most\meta.xml")) = FALSE then
220 warnlog "XML-file 'meta.xml' not well formed!"
222 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_most\content.xml")) = FALSE then
223 warnlog "XML-file 'content.xml' not well formed!"
225 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\index_most.sxw"))
235 '-------------------------------------------------------------------------
238 printlog "+- pages.sdw"
239 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\pages.sdw"))
240 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\pages.sxw") , "StarOffice XML (Writer)") then
241 '/// Closing the document also if there is a verification dialog.
242 call hCloseDocument()
244 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\pages.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\pages") )
245 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\pages\styles.xml")) = FALSE then
246 warnlog "XML-file 'styles.xml' not well formed!"
248 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\pages\meta.xml")) = FALSE then
249 warnlog "XML-file 'meta.xml' not well formed!"
251 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\pages\content.xml")) = FALSE then
252 warnlog "XML-file 'content.xml' not well formed!"
254 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\pages.sxw"))
264 '-------------------------------------------------------------------------
266 testcase tparagraph01
267 printlog "+- paragraph01.sdw"
268 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\paragraph01.sdw"))
269 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph01.sxw") , "StarOffice XML (Writer)") then
270 '/// Closing the document also if there is a verification dialog.
271 call hCloseDocument()
273 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph01.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph01") )
274 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph01\styles.xml")) = FALSE then
275 warnlog "XML-file 'styles.xml' not well formed!"
277 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph01\meta.xml")) = FALSE then
278 warnlog "XML-file 'meta.xml' not well formed!"
280 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph01\content.xml")) = FALSE then
281 warnlog "XML-file 'content.xml' not well formed!"
283 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph01.sxw"))
293 '-------------------------------------------------------------------------
295 testcase tparagraph02
296 printlog "+- paragraph02.sdw"
297 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\paragraph02.sdw"))
298 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph02.sxw") , "StarOffice XML (Writer)") then
299 '/// Closing the document also if there is a verification dialog.
300 call hCloseDocument()
302 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph02.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph02") )
303 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph02\styles.xml")) = FALSE then
304 warnlog "XML-file 'styles.xml' not well formed!"
306 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph02\meta.xml")) = FALSE then
307 warnlog "XML-file 'meta.xml' not well formed!"
309 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph02\content.xml")) = FALSE then
310 warnlog "XML-file 'content.xml' not well formed!"
312 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\paragraph02.sxw"))
322 '-------------------------------------------------------------------------
324 testcase tsection_main
325 QAErrorLog "#i88812#-Update all links message doubled in old .sd* documents."
327 printlog "+- section_main.sdw"
328 call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\section_main.sdw") , TRUE)
329 if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\section_main.sxw") , "StarOffice XML (Writer)") then
330 '/// Closing the document also if there is a verification dialog.
331 call hCloseDocument()
333 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\section_main.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\section_main") )
334 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\section_main\styles.xml")) = FALSE then
335 warnlog "XML-file 'styles.xml' not well formed!"
337 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\section_main\meta.xml")) = FALSE then
338 warnlog "XML-file 'meta.xml' not well formed!"
340 if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\section_main\content.xml")) = FALSE then
341 warnlog "XML-file 'content.xml' not well formed!"
343 call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\section_main.sxw") , TRUE)
353 '-------------------------------------------------------------------------
355 testcase tEventsToObjects
356 '/// Goal: All macros embedded to the objects should be exported corrextly to XML fileformat.
360 Dim xXMLStyleName as string
362 Dim AttributeSearch(50) as string
363 Dim AttributeValue(50) as string
364 Dim cWhereCalled as string
366 dim sdw_file as string
367 sdw_file = gTesttoolPath & "xml\optional\input\writer\events_to_objects.sdw"
368 sdw_file = convertpath( sdw_file )
369 dim sxw_file as string
370 sxw_file = gOfficePath & "user\work\xml\writer\level1\events_to_objects.sxw"
371 sxw_file = convertpath( sxw_file )
373 printlog "+- events_to_objects.sdw"
375 cWhereCalled = "xml::level1::inc::sxw7_03.inc::tEventsToObjects: "
377 '/// Open Tools/Options -> OpenOffice.org/Security
378 '/// Click on the macro security button
379 '/// Set the <b>medium</b> security level
382 if iSecurityBefore = "" then
383 QAErrorLog cWhereCalled & "Macro security level needs to be set before to 1 (medium)!"
387 'if variable iSecurityBefore is not initialized and causes into an error
388 QAErrorLog cWhereCalled & "Macro security level needs to be set before to 1 (medium)!"
392 '/// Load (binary) document under <i>...qa/qatesttool/xml/update/input/writer/events_to_objects.sdw</i>.
393 hFileOpen( sdw_file )
394 if ( NOT hAllowMacroExecution() ) then
395 warnlog "#i80769# Macros not being loaded. Exiting test case."
399 '/// Save as StarOffice XML fileformat (.sxw).
400 if ( hFileSaveAsWithFilterKill ( sxw_file , "StarOffice XML (Writer)" ) ) then
401 '/// Closing the document also if there is a verification dialog.
402 'call hCloseDocument()
405 '/// Close window with the document.
406 UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects.sxw") , _
407 gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects") )
408 '/// Uncompressing .sxw files in directory <pre>../user/work/events_to_objects/</pre>.
409 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects\meta.xml")) = FALSE then
410 warnlog "XML-file 'meta.xml' not well formed!"
412 '///+Verify that XML files (<i>styles.xml</i>, <i>meta.xml</i> and <i>content.xml</i>) are <i>well formed</i>.
413 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects\styles.xml")) = FALSE then
414 warnlog "XML-file 'styles.xml' not well formed!"
416 if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects\content.xml")) = FALSE then
417 warnlog "XML-file 'content.xml' not well formed!"
418 '/// If <i>well formness</i> is okay, load exported document.
420 hFileOpen( sdw_file )
421 hAllowMacroExecution()
423 Kontext "DocumentWriter"
424 DocumentWriter.TypeKeys "<SHIFT F4>" , TRUE
425 '/// Select first graphic with <SHIFT><F4>
426 '///+ and a messagebox should be displayed.
427 '///+ Press <RETURN> key.
428 '///<i>four times</i>
429 '///+<ol><li>Press <TAB> key to select the next object.</li><li>and a messagebox should be displayed.</li><li>Press <RETURN> key.</li></ol>
432 if Messagebox.Exists(2) then
433 if Messagebox.GetRT = 304 then
438 warnlog "Event on Graphic failed! No Message Box occured!"
441 warnlog "Event on OLE object failed! No Message Box occured!"
444 warnlog "Event on text frame object failed! No Message Box occured!"
447 warnlog "Event on text frame object (frame style applied) failed! No Message Box occured!"
451 Kontext "DocumentWriter"
452 DocumentWriter.TypeKeys "<TAB>"
458 'TODO: Search for the events in source.