'encoding UTF-8 Do not remove or change this line! '************************************************************************** '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. '* '* Copyright 2008 by Sun Microsystems, Inc. '* '* OpenOffice.org - a multi-platform office productivity suite '* '* $RCSfile: sxw7_03.inc,v $ '* '* $Revision: 1.2 $ '* '* last change: $Author: rt $ $Date: 2008-07-11 07:35:14 $ '* '* This file is part of OpenOffice.org. '* '* OpenOffice.org is free software: you can redistribute it and/or modify '* it under the terms of the GNU Lesser General Public License version 3 '* only, as published by the Free Software Foundation. '* '* OpenOffice.org is distributed in the hope that it will be useful, '* but WITHOUT ANY WARRANTY; without even the implied warranty of '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the '* GNU Lesser General Public License version 3 for more details '* (a copy is included in the LICENSE file that accompanied this code). '* '* You should have received a copy of the GNU Lesser General Public License '* version 3 along with OpenOffice.org. If not, see '* '* for a copy of the LGPLv3 License. '* '/************************************************************************ '* '* owner : fredrik.haegg@sun.com '* '* short description : XML Writer Include File '* '\*********************************************************************************** Dim Isliste(250) as string Dim OutputPath as string Dim iSecurityBefore as integer sub sxw7_03 printlog "-------------------------- SXW7_03.INC ------------------------------" call hEnablePrettyPrinting call thyperlinks call hEnablePrettyPrinting(1) call tindexes_alpha call tindex_biblio call tindex_most call tpages call tparagraph01 call tparagraph02 call tsection_main printlog "------------------------ Macros and Events --------------------------" iSecurityBefore = "" iSecurityBefore = hSetMacroSecurity(1) call tEventsToObjects call hSetMacroSecurity(iSecurityBefore) end sub '------------------------------------------------------------------------- testcase thyperlinks Dim Searchstring(9) as string Dim i as integer Dim AdditionalParameter as string printlog "+- hyperlinks.sdw" call hFileOpen (gTesttoolPath & ConvertPath("xml\optional\input\writer\hyperlinks.sdw")) if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks.sxw") , "StarOffice XML (Writer)") then '/// Closing the document also if there is a verification dialog. call hCloseAndLooseDocument sleep(3) UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks") ) if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\styles.xml")) = FALSE then warnlog "XML-file 'styles.xml' not well formed!" end if if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\meta.xml")) = FALSE then warnlog "XML-file 'meta.xml' not well formed!" end if if XMLWellFormed (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks\content.xml")) = FALSE then warnlog "XML-file 'content.xml' not well formed!" else call hFileOpen (gOfficePath & ConvertPath("user\work\xml\writer\level1\hyperlinks.sxw")) sleep(2) call hCloseDocument sleep(2) ' ----------------------- ' T E X T - S T Y L E S ' ----------------------- ' Www.sun.com '------------------------------------------------------------------------- Searchstring(1) = "jump '------------------------------------------------------------------------- Searchstring(1) = "target here '------------------------------------------------------------------------- Searchstring(1) = " OpenOffice.org/Security '/// Click on the macro security button '/// Set the medium security level try if iSecurityBefore = "" then QAErrorLog cWhereCalled & "Macro security level needs to be set before to 1 (medium)!" goto endsub end if catch 'if variable iSecurityBefore is not initialized and causes into an error QAErrorLog cWhereCalled & "Macro security level needs to be set before to 1 (medium)!" goto endsub endcatch '/// Load (binary) document under ...qa/qatesttool/xml/update/input/writer/events_to_objects.sdw. if hOpenFileAndIgnoreMacroWarning (gTesttoolPath & ConvertPath("xml\optional\input\writer\events_to_objects.sdw") , 1) = FALSE then warnlog "#i80769# Macros not being loaded. Exiting test case." call hCloseDocument goto endsub end if '/// Save as StarOffice XML fileformat (.sxw). if hFileSaveAsWithFilterKill (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects.sxw") , "StarOffice XML (Writer)") then '/// Closing the document also if there is a verification dialog. call hCloseAndLooseDocument sleep(3) '/// Close window with the document. UnpackStorage( gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects.sxw") , gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects") ) '/// Uncompressing .sxw files in directory
../user/work/events_to_objects/
. if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects\meta.xml")) = FALSE then warnlog "XML-file 'meta.xml' not well formed!" end if '///+Verify that XML files (styles.xml, meta.xml and content.xml) are well formed. if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects\styles.xml")) = FALSE then warnlog "XML-file 'styles.xml' not well formed!" end if if XMLWellformed (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects\content.xml")) = FALSE then warnlog "XML-file 'content.xml' not well formed!" '/// If well formness is okay, load exported document. else call hOpenFileAndIgnoreMacroWarning (gOfficePath & ConvertPath("user\work\xml\writer\level1\events_to_objects.sxw") , 1) sleep(2) Kontext "DocumentWriter" DocumentWriter.TypeKeys "" , TRUE '/// Select first graphic with <SHIFT><F4> '///+ and a messagebox should be displayed. '///+ Press <RETURN> key. '///four times '///+
  1. Press <TAB> key to select the next object.
  2. and a messagebox should be displayed.
  3. Press <RETURN> key.
for l = 1 to 4 Kontext "Messagebox" if Messagebox.Exists(2) then if Messagebox.GetRT = 304 then Messagebox.OK end if else if l = 1 then warnlog "Event on Graphic failed! No Message Box occured!" end if if l = 2 then warnlog "Event on OLE object failed! No Message Box occured!" end if if l = 3 then warnlog "Event on text frame object failed! No Message Box occured!" end if if l = 4 then warnlog "Event on text frame object (frame style applied) failed! No Message Box occured!" end if end if if l <> 4 then Kontext "DocumentWriter" DocumentWriter.TypeKeys "" end if next l '/// Close document. call hCloseDocument sleep(2) 'TODO: Search for the events in source. end if else call hCloseDocument end if endcase