summaryrefslogtreecommitdiff
path: root/testautomation/global/tools/includes/optional
diff options
context:
space:
mode:
Diffstat (limited to 'testautomation/global/tools/includes/optional')
-rw-r--r--testautomation/global/tools/includes/optional/t_accels.inc124
-rw-r--r--testautomation/global/tools/includes/optional/t_basic_ide_tools.inc816
-rw-r--r--testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc356
-rw-r--r--testautomation/global/tools/includes/optional/t_control_objects.inc611
-rw-r--r--testautomation/global/tools/includes/optional/t_docfuncs.inc475
-rw-r--r--testautomation/global/tools/includes/optional/t_extension_manager_tools.inc780
-rw-r--r--testautomation/global/tools/includes/optional/t_filetools.inc319
-rw-r--r--testautomation/global/tools/includes/optional/t_key_tools.inc563
-rw-r--r--testautomation/global/tools/includes/optional/t_listfuncs.inc464
-rw-r--r--testautomation/global/tools/includes/optional/t_locale_strings1.inc569
-rw-r--r--testautomation/global/tools/includes/optional/t_locale_tools.inc92
-rw-r--r--testautomation/global/tools/includes/optional/t_macro_tools.inc215
-rw-r--r--testautomation/global/tools/includes/optional/t_ole.inc163
-rw-r--r--testautomation/global/tools/includes/optional/t_security_tools.inc668
-rw-r--r--testautomation/global/tools/includes/optional/t_set_standard_controls.inc646
-rw-r--r--testautomation/global/tools/includes/optional/t_spreadsheet_tools1.inc84
-rw-r--r--testautomation/global/tools/includes/optional/t_stringtools.inc355
-rw-r--r--testautomation/global/tools/includes/optional/t_toolbar_tools1.inc418
-rw-r--r--testautomation/global/tools/includes/optional/t_toolbar_writer.inc766
-rw-r--r--testautomation/global/tools/includes/optional/t_treelist_tools.inc485
-rw-r--r--testautomation/global/tools/includes/optional/t_ui_filters.inc131
-rw-r--r--testautomation/global/tools/includes/optional/t_user_info.inc56
-rw-r--r--testautomation/global/tools/includes/optional/t_xml1.inc652
-rw-r--r--testautomation/global/tools/includes/optional/t_xml2.inc492
-rw-r--r--testautomation/global/tools/includes/optional/t_xml_filter1.inc822
25 files changed, 11122 insertions, 0 deletions
diff --git a/testautomation/global/tools/includes/optional/t_accels.inc b/testautomation/global/tools/includes/optional/t_accels.inc
new file mode 100644
index 000000000000..c700d887b8d5
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_accels.inc
@@ -0,0 +1,124 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : handle accelerators
+'*
+'*******************************************************************************
+'**
+' #1 hGetAccel ' function to retrieve a language specific accelerator
+'**
+'\******************************************************************************
+
+function hGetAccel( cCommand as string ) as string
+
+ '///<h3>Retrieve a keyboard accelerator for a specific function</h3>
+ '///<i>Uses: global/input/accelerators.txt</i><br>
+ '///<i>NOTE: Accelerator is language dependent</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of the action to be executed (string). Valid options are:</li>
+ '///<ul>
+ '///+<li>&quot;FileOpen&quot;</li>
+ '///+<li>&quot;FileSave&quot;</li>
+ '///+<li>&quot;Print&quot;</li>
+ '///+<li>&quot;SelectAll&quot;</li>
+ '///+<li>&quot;Copy&quot;</li>
+ '///+<li>&quot;DocumentConverter_ShowLog&quot;</li>
+ '///+<li>&quot;IDE_SWITCH_TAB+&quot;</li>
+ '///+<li>&quot;IDE_SWITCH_TAB-&quot;</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Accelerator (string)</li>
+ '///<ul>
+ '///+<li>A string ready to use by .typeKeys(...) method</li>
+ '///+<li>&quot;Error&quot; if the requested Accelerator is unknown</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+ const CFN = "hGetAccel::"
+ const DEFAULT_LANGUAGE = "en-us"
+
+ dim cAccel as string
+ dim lsAccelerators( 1000 ) as string
+ dim cFile as string
+ cFile = gTesttoolpath & "global/input/accelerators.txt"
+ cFile = convertpath( cFile )
+
+ dim cProximityLocale as string
+
+ dim iLang as integer
+
+ printlog( CFN & "Enter with option: " & cCommand )
+ 'printlog( CFN & "Current Language.: <" & gISOLang & ">" )
+
+ '///+<li>Get the section from the accelerators file</li>
+ hGetDatafileSection( cFile , lsAccelerators() , cCommand , "" , "" )
+
+ '///+<li>Find the matching string for the current language</li>
+ cAccel = hGetValueForKeyAsString( lsAccelerators() , gISOLang )
+
+ '///+<li>In case of a miss we retry with a modified string</li>
+ '///<ul>
+ if ( instr( cAccel , "Error" ) <> 0 ) then
+
+ iLang = len( gISOLang )
+
+ select case iLang
+ case 2 :
+ '///+<li>Try xx-XX</li>
+ cProximityLocale = gISOLang & "-" & ucase( gISOLang )
+ printlog( CFN & "Trying alternative locale: " & cProximityLocale )
+ cAccel = hGetValueForKeyAsString( lsAccelerators() , cProximityLocale )
+ case 5 :
+ '///+<li>Try xx</li>
+ cProximityLocale = mid( cUpperCaseLocale , 1, 2 )
+ printlog( CFN & "Trying alternative locale: " & cProximityLocale )
+ cAccel = hGetValueForKeyAsString( lsAccelerators() , cProximityLocale )
+ case else :
+ '///+<li>Try en-US</li>
+ cProximityLocale = "en-US"
+ printlog( CFN & "Trying default locale: " & cProximityLocale )
+ cAccel = hGetValueForKeyAsString( lsAccelerators() , DEFAULT_LANGUAGE )
+ end select
+
+ endif
+ '///</ul>
+
+ '///+<li>Build the complete accelerator-string so it can be used by "TypeKeys"</li>
+ '///+<li>Print it to the log and return the string to the calling function</li>
+
+ cAccel = "<" & cAccel & ">"
+ printlog( CFN & "Requested accelerator: " & cAccel & " for language: " & gISOLang )
+ hGetAccel() = cAccel
+ '///</ul>
+
+end function
diff --git a/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc b/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc
new file mode 100644
index 000000000000..536ffb99dda6
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_basic_ide_tools.inc
@@ -0,0 +1,816 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+' **
+' ** owner : gregor.hartmann@oracle.com
+' **
+' ** short description : tools for the property-browser test
+' **
+'\******************************************************************************
+
+function hShowMacroControls() as boolean
+
+ '///<h3>Tear off the ToolsCollectionBar from the MacroBar</h3>
+ '///<i>Starting point: Basic dialog editor is open and has the focus</i>
+ '///<ul>
+ const CFN = "hShowMacroControls::"
+
+ const MAX_WAIT = 5
+ const SHORT_WAIT = 1
+
+ const VERTICALLY_CENTERED = 50
+ const HORIZONTALLY_CENTERED = 50
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ '///+<li>Test whether the ToolsCollectionBar is already open. If yes, exit directly</li>
+ kontext "ToolsCollectionBar"
+ if ( ToolsCollectionBar.exists( SHORT_WAIT ) ) then
+ printlog( CFN & "ToolsCollectionBar is already open." )
+ hShowMacroControls() = true
+ exit function
+ endif
+
+ '///+<li>Verify that the Dialog Bar is available</li>
+ Kontext "DialogBar"
+ if ( DialogBar.exists( MAX_WAIT ) ) then
+
+ '///+<li>Verify that the controls-button is enabled</li>
+ try
+ '///+<li>Click on the controls-button to open the ToolsCollectionBar</li>
+ controls.click()
+
+ '///+<li>Tear off the ToolsCollectionBar from the DialogBar</li>
+ controls.tearOff()
+
+ '///+<li>Verify that the ToolsCollectionBar is visible and can be accessed</li>
+ kontext "ToolsCollectionBar"
+ if ( ToolsCollectionBar.exists( MAX_WAIT ) ) then
+
+ '///+<li>Move it to the upper left corner at pos 50/50</li>
+ ToolsCollectionBar.Move ( HORIZONTALLY_CENTERED , VERTICALLY_CENTERED )
+ printlog( CFN & "ToolsCollectionBar is open and has been placed" )
+ hShowMacroControls() = true
+ else
+ printlog( CFN & "ToolsCollectionBar is not available. Aborting." )
+ hShowMacroControls() = false
+ endif
+ catch
+ printlog( CFN & "The Controls-Button is not enabled. Aborting." )
+ hShowMacroControls() = false
+ endcatch
+ else
+ printlog( CFN & "The Dialog Bar is not available. Aborting." )
+ hShowMacroControls() = false
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetBasicWorkFile( cMajorID as string ) as string
+
+ '///<h3>Retrieve a filename, depending on gApplication and Build-ID</h3>
+ '///<i>Structure: work-directory/basic[.suffix]</i>
+ const CFN = "hGetBasicWorkFile::"
+ dim sFile as string : sFile = hGetWorkPath() & "basic" & hGetSuffix( cMajorId )
+ printlog( CFN & sFile & " for " & gApplication & " (" & cMajorID & ")" )
+ hGetBasicWorkFile() = sFile
+
+end function
+
+'*******************************************************************************
+
+function hOpenBasicIDE() as boolean
+
+ '///<h3>Open the Basic IDE for the last module listed in the Macro Organizer</h3>
+ '///<i>Starting point: Basic Macro Organizer has focus</i>
+
+ const CFN = "hOpenBasicIDE::"
+ const BUTTON_TIMEOUT = -1
+ const MAX_WAIT = 2
+
+ if ( hSelectTheLastModule( true ) ) then
+
+ if ( hClickButton( Bearbeiten) <> BUTTON_TIMEOUT ) then
+
+ kontext "BASICIDE"
+ if ( BasicIDE.exists( MAX_WAIT ) ) then
+ printlog( "Basic IDE is open" )
+ BasicIDE.maximize()
+ hOpenBasicIDE() = true
+ else
+ warnlog( CFN & "Failed to open BASIC IDE" )
+ hOpenBasicIDE() = false
+ endif
+ else
+ warnlog( CFN & "Edit button is not enabled, cannot open BASIC IDE"
+ hOpenBasicIDE() = false
+ endif
+ else
+ warnlog( CFN & "Unable to select the last module" )
+ hOpenBasicIDE() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hCloseBasicIDE() as boolean
+
+ '///<h3>Close the BASIC-IDE</h3>
+ hCloseCollectionBar()
+ kontext "BasicIDE"
+ hCloseBasicIDE() = hDestroyDocument()
+
+end function
+
+'*******************************************************************************
+
+function hReOpenBasicDialog() as boolean
+
+ '///<h3>Open BASIC-IDE after loading a workfile with documentbound macro</h3>
+ '///<i>Starting point: Focus on document containing at least one macro</i><br>
+ const CFN = "hReopenBasicDialog: "
+ const BUTTON_TIMEOUT = -1
+
+ if ( hSelectTheLastModule( true ) ) then
+
+ if ( hClickButton( Bearbeiten ) <> BUTTON_TIMEOUT ) then
+
+ kontext "BasicIDE"
+ BasicIde.maximize()
+
+ if ( hFindFirstDialog() ) then
+ printlog( "BASIC IDE is open." )
+ hReOpenBasicDialog() = true
+ else
+ warnlog( CFN & "Could not find any dialog" )
+ hReOpenBasicDialog() = false
+ endif
+ else
+ warnlog( CFN & "Unable to click Edit button, BASIC IDE not open" )
+ hReOpenBasicDialog() = false
+ endif
+ else
+ warnlog( CFN & "Could not open the last module for editing." )
+ hReOpenBasicDialog() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hFindFirstDialog() as boolean
+
+ '///<h3>Find the first dialog in the BASIC-IDE</h3>
+ '///<i>Starting point: Basic IDE must be open and has the focus</i>
+ '///<ul>
+
+ const CFN = "hFindFirstDialog::"
+ const REPEAT_COUNT = 5 ' number of times to send a keystroke to BASIC IDE
+ const MAX_NUMBER_OF_RETRIES = 20
+ const SELECT_TAB_RIGHT = "<MOD1 PAGEUP>"
+ const SCROLL_UP_LEFT = "<UP><LEFT>"
+
+ dim iPosOverTabbar as integer
+ hFindFirstDialog() = false
+
+ '///+<li>Set focus to Basic IDE, maximize it</li>
+ kontext "BasicIDE"
+ BasicIde.maximize()
+
+
+ '///+<li>move pointer over the tabbar and click until a dialog opens (hopefully)</li>
+ for iPosOverTabbar = 1 to MAX_NUMBER_OF_RETRIES
+
+ BASICIDE.typeKeys( SELECT_TAB_RIGHT )
+
+ if ( DialogWindow.Exists() ) then
+ printlog( "BASIC Dialog window found" )
+ hFindFirstDialog() = true
+ DialogWindow.typeKeys( SCROLL_UP_LEFT , REPEAT_COUNT )
+ exit for
+ endif
+
+ next iPosOverTabbar
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hSelectDialogPane() as boolean
+
+ '///<h3>Select the dialog pane in the Basic dialog editor</h3>
+ '///<i>Starting point: Basic dialog editor is open and has the focus</i>
+ const CFN = "hSelectDialogPane::"
+ const UP_LEFT = 10
+ const DOWN_RIGHT = 90
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ kontext "BasicIDE"
+ DialogWindow.mouseDown( DOWN_RIGHT , DOWN_RIGHT )
+ DialogWindow.mouseMove( UP_LEFT , UP_LEFT )
+ DialogWindow.mouseUp ( UP_LEFT , UP_LEFT )
+
+ printlog( CFN & "Selected dialog pane (not verified)" )
+ hSelectDialogPane() = true
+
+end function
+
+'*******************************************************************************
+
+function hCloseCollectionBar() as boolean
+
+ const CFN = "hCloseCollectionBar(): "
+
+ kontext "ToolsCollectionBar"
+ if ( ToolsCollectionBar.exists() ) then
+
+ if ( hCloseDialog( ToolsCollectionBar, "close" ) ) then
+ printlog( "Closed Macro Controls Float" )
+ hCloseCollectionBar() = true
+ else
+ warnlog( CFN & "Failed to close Macro Controls Float" )
+ hCloseCollectionBar() = false
+ endif
+ else
+ printlog( "Macro Controls Float not open" )
+ hCloseCollectionBar() = true
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hDeleteMacro() as boolean
+
+ '///<h3>Delete all text in the Basic IDE editor</h3>
+ const CFN = "hDeleteMacro(): "
+
+ kontext "BasicIDE"
+ if ( BasicIDE.exists() ) then
+ WaitSlot() : Wait( 100 ) : EditWindow.typeKeys( "<MOD1 HOME>" )
+ WaitSlot() : Wait( 100 ) : EditWindow.typeKeys( "<MOD1 SHIFT END>" )
+ WaitSlot() : Wait( 100 ) : EditWindow.typeKeys( "<DELETE>" )
+ hDeleteMacro() = hIsEditWindowEmpty()
+ else
+ warnlog( CFN & "Basic IDE is not open" )
+ hDeleteMacro() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hIsEditWindowEmpty() as boolean
+
+ '///<h3>Test if the Basic-EditWindow is empty</h3>
+ '///<i>Starting point: Basic IDE editor is open and has the focus</i>
+ const CFN = "hIsEditWindowEmpty(): "
+
+ kontext "BasicIDE"
+ if ( BasicIDE.exists() ) then
+ SetClipboard( "" )
+ WaitSlot() : EditWindow.typeKeys( "<MOD1 HOME>" )
+ WaitSlot() : EditWindow.typeKeys( "<MOD1 SHIFT END>" )
+ hUseAsyncSlot( "EditCopy" )
+
+ if ( GetClipBoardText() = "" ) then
+ hIsEditWindowEmpty() = true
+ else
+ warnlog( CFN & "Edit window is not empty" )
+ hIsEditWindowEmpty() = false
+ endif
+ else
+ warnlog( CFN & "BasicIDE is not open" )
+ hIsEditWindowEmpty() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hRenameTab( cTabName as string ) as integer
+
+ const CFN = "hRenameTab(): "
+
+ const MENUITEM_RENAME = 3
+ const MAX_WAIT = 1000
+
+ const RETVAL_SUCCESS = 0
+ const RETVAL_NO_IDE = 1
+ const RETVAL_NO_ACCESS = 2
+ const RETVAL_NO_MENU = 3
+
+ dim sFullString as string : sFullString = "<HOME><SHIFT END>" & cTabName & "<RETURN>"
+
+ kontext "BasicIDE"
+ if ( BasicIDE.exists() ) then
+ try
+ hRenameTab() = RETVAL_NO_MENU
+ Tabbar.openContextMenu()
+ hMenuSelectNr( MENUITEM_RENAME )
+ Wait( MAX_WAIT )
+
+ ' At this point the string on the tab should be selected, print the
+ ' string to the log and overwrite it with the new name
+ hRenameTab() = RETVAL_NO_ACCESS
+
+ Tabbar.typeKeys( sFullString , true )
+ hRenameTab() = RETVAL_SUCCESS
+ catch
+ warnlog( CFN & "Failed to rename the current module" )
+ endcatch
+ else
+ warnlog( CFN & "BASIC IDE is not open" )
+ hRenameTab() = RETVAL_NO_IDE
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hGetTabNameFromOrganizer() as string
+
+ '///<h3>Retrieve the name of a tab from the Basic Library Organizer</h3>
+ '///<i>Starting point: Basic IDE is open and has the focus</i>
+ '///<ul>
+
+ const CFN = "hGetTabNameFromOrganizer::"
+ dim cReturnString as string
+
+ '///+<li>Open the Basic Library Organizer</li>
+ '///+<li>Go to the Module-Tab</li>
+ '///+<li>Get the name of the currently selected item from the Module-list</li>
+ '///+<li>Close the Macro Library Organizer</li>
+ if ( hOpenBasicObjectOrganizer( 1 ) ) then
+ cReturnString = Modulliste.GetSelText()
+ TabModule.Close()
+ printlog( CFN & "Returning Tab-Name: " & cReturnString )
+ else
+ cReturnString = "Failure: Macro Organizer not open"
+ warnlog( CFN & cReturnString )
+
+ endif
+
+ '///+<li>Return the name from the Module-list</li>
+ hGetTabNameFromOrganizer() = cReturnString
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hNewDialog() as boolean
+
+ '///<h3>Create a new BASIC dialog</h3>
+ '///<i>Starting point: Basic IDE is open</i>
+ '///<ul>
+
+ const CFN = "hNewDialog::"
+ const MAX_WAIT = 2000
+
+ '///+<li>Open the context menu for the tabbar</li>
+ kontext "basicide"
+ Tabbar.OpenContextMenu
+
+ '///+<li>Select the first item (insert)</li>
+ hMenuSelectNr( 1 )
+ WaitSlot( MAX_WAIT ) ' sleep( 1 )
+
+ '///+<li>Select the second item (new dialog)</li>
+ hMenuSelectNr( 2 )
+ WaitSlot( MAX_WAIT ) ' sleep( 2 )
+
+ '///+<li>Verify that a new dialog is opened and has the focus</li>
+ if ( DialogWindow.Exists() ) then
+ printlog( CFN & "New dialog is open" )
+ hNewDialog() = true
+ if ( DialogWindow.IsMax() = false ) then
+ DialogWindow.Maximize()
+ Wait( MAX_WAIT )
+ end if
+ else
+ warnlog( CFN & "New dialog is not open" )
+ hNewDialog() = false
+ endif
+ '///+<li>Return TRUE on success, FALSE on failure</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hNewModule() as boolean
+
+ '///<h3>Create a new BASIC module</h3>
+ '///<i>Starting point: Basic IDE is open</i>
+ '///<ul>
+
+ const CFN = "hNewModule::"
+ const MAX_WAIT = 2000
+
+ '///+<li>Open the context menu for the tabbar</li>
+ kontext "basicide"
+ Tabbar.OpenContextMenu
+
+ '///+<li>Select the first item (insert)</li>
+ hMenuSelectNr( 1 )
+ WaitSlot( MAX_WAIT ) ' sleep( 1 )
+
+ '///+<li>Select the first item (new module)</li>
+ hMenuSelectNr( 1 )
+ WaitSlot( MAX_WAIT ) ' sleep( 2 )
+
+ '///+<li>Verify that a new module is opened and has the focus</li>
+ if ( EditWindow.Exists() ) then
+ printlog( CFN & "New module is open" )
+ hNewModule() = true
+ else
+ warnlog( CFN & "New module is not open" )
+ hNewModule() = false
+ endif
+ '///+<li>Return TRUE on success, FALSE on failure</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hHideModule() as boolean
+
+ '///<h3>Hide a Basic Module from the IDE</h3>
+ '///<i>Starting point: Basic IDE is open and has the focus</i>
+ '///<ul>
+
+ const CFN = "hHideModule::"
+ const MENUENTRY_HIDE = 4
+
+ kontext "basicide"
+
+ '///+<li>Open the context menu of the tabbar</li>
+ try
+ tabbar.openContextMenu
+
+ '///+<li>Select the fourth entry (Hide)</li>
+ hMenuSelectNr( MENUENTRY_HIDE )
+ sleep( 1 )
+ hHideModule() = true
+ printlog( CFN & "Success" )
+ catch
+ hHideModule() = false
+ warnlog( CFN & "Failure" )
+ endcatch
+ '///+<li>Return TRUE on success, FALSE on any other condition (not verified)</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hInitFormControls( cModule as string ) as boolean
+
+ '///<h3>Get from a new document to the Macro Controls Float in one go</h3>
+ '///<i>Starting point: Plain document</i><br>
+ '///This function performs following steps:
+ '///<ol>
+ '///+<li>Open the Basic Organizer</li>
+ '///+<li>Create a new module for the current document</li>
+ '///+<li>Open a new basic dialog</li>
+ '///+<li>Open the Macro controls float</li>
+ '///</ol>
+ '///Description:
+ '///<ul>
+
+ const CFN = "hInitFormControls::"
+ hInitFormControls() = false
+ '///+<li>Create and edit a new module for the current document</li>
+
+ if ( not hInitBasicIde( cModule ) ) then
+ warnlog( "Could not create new module" )
+ hCloseBasicIde()
+ exit function
+ endif
+
+ kontext "BasicIde"
+ BasicIde.maximize()
+
+ '///+<li>Create a new dialog.</li>
+ if ( not hNewDialog() ) then
+ warnlog( "Could not create Basic-Dialog" )
+ hCloseBasicIde()
+ exit function
+ endif
+
+ '///+<li>Open the macro controls float.</li>
+ if ( not hShowMacroControls() ) then
+ warnlog( CFN & "Could not tear off the macro controls float" )
+ hCloseBasicIde()
+ exit function
+ endif
+
+ '///+<li>Return TRUE if all went well, FALSE on any other error</li>
+ hInitFormControls() = true
+ '///</ul>
+ '///NOTE: The function will try to cleanup after itself in case of failure
+
+end function
+
+'*******************************************************************************
+
+function hInitBasicIde( cModule as string ) as boolean
+
+ '///<h3>Get from a new document to the Basic IDE in one go</h3>
+ '///<i>Starting point: New, plain document</i>
+
+ const CFN = "hInitBasicIde::"
+
+ ToolsMacro_uno
+
+ kontext "Makro"
+ if ( Makro.exists( 2 ) ) then
+
+ if ( hCreateModuleForDoc( cModule ) ) then
+
+ kontext "BasicIDE"
+ if ( BasicIDE.exists( 2 ) ) then
+ BasicIDE.maximize()
+ hInitBasicIde() = true
+ else
+ warnlog( CFN & "Failed to open BASIC IDE" )
+ hInitBasicIde() = false
+ endif
+ else
+ warnlog( CFN & "Failed to create a module for the current document" )
+ hInitBasicIde() = false
+ endif
+ else
+ warnlog( CFN & "Failed to open macro organizer" )
+ hInitBasicIde() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hInsertMacro( _id as integer ) as boolean
+
+ '///<h3>Insert a macro into the Basic-IDE edit window by Index</h3>
+ '///<i>Starting point: Basic IDE is open, has the focus</i>
+ '///<ul>
+
+ const CFN = "hInsertMacro::"
+ kontext "basicide"
+
+ printlog( CFN & "This function is deprecated" )
+
+ '///+<li>Delete the content of the edit window</li>
+ if ( not hDeleteMacro() ) then
+ warnlog( CFN & "Content of Basic-IDE was not deleted" )
+ hInsertMacro() = false
+ exit function
+ endif
+
+ '///+<li>Insert a macro by index (passed as function parameter)</li>
+ select case _id
+ case 1 :
+ ' this is a working macro that contains no errors
+ EditWindow.TypeKeys( "'# TTMacro1: This is a short testscript for automated testing!<return><return>" )
+ EditWindow.TypeKeys( "sub main<return><return>" )
+ EditWindow.TypeKeys( "print " & Chr (34) + "hallo" & Chr (34) )
+ EditWindow.TypeKeys( "<Return><Return>" )
+ EditWindow.TypeKeys( "<Home>end sub<return>" )
+ hInsertMacro() = true
+ printlog( CFN & "Inserted: " & _id )
+ case 2 :
+ EditWindow.TypeKeys( "'# TTMacro2: a second module for automated testing!" )
+ EditWindow.TypeKeys( "<Return><Return>" )
+ hInsertMacro() = true
+ printlog( CFN & "Inserted: " & _id )
+ case 3 :
+ EditWindow.TypeKeys( "'# TTMacro3: Bring up a messagebox<return><return>" )
+ EditWindow.TypeKeys( "sub main<return><return>" )
+ EditWindow.TypeKeys( " msgbox " & Chr (34) + "TTMacro3" & Chr (34) )
+ EditWindow.TypeKeys( "<Return><Return>" )
+ EditWindow.TypeKeys( "<Home>end sub<return>" )
+ hInsertMacro() = true
+ printlog( CFN & "Inserted: " & _id )
+ end select
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hTestMacro( _id as integer ) as integer
+
+ '///<h3>Verify that the correct macro is visible in the IDE edit Window</h3>
+ '///<i>Starting point: Basic IDE is open and has focus</i>
+ '///<ul>
+
+ const CFN = "hTestMacro::"
+ qaerrorlog( CFN & "This function is deprecated, remove me!" )
+
+ kontext "basicide"
+
+ '///+<li>Copy the first line in the editwindow to clipboard</li>
+ EditWindow.TypeKeys( "<Mod1 Home>" )
+ EditWindow.TypeKeys( "<Home><Shift End>" )
+ EditCopy
+
+ '///+<li>Compare the string to a unique substring for the macro</li>
+ select case _id
+ case 1 :
+ if ( Instr ( GetClipboardText, "TTMacro1" ) <> 0 ) then
+ printlog( CFN & "The correct macro is displayed in the editwindow" )
+ htestMacro() = 1
+ exit function
+ endif
+ case 2 :
+ if ( Instr ( GetClipboardText, "TTMacro2" ) <> 0 ) then
+ printlog( CFN & "The correct macro is displayed in the editwindow" )
+ htestMacro() = 2
+ exit function
+ endif
+ case 3 :
+ if ( Instr ( GetClipboardText, "TTMacro3" ) <> 0 ) then
+ printlog( CFN & "The correct macro is displayed in the editwindow" )
+ htestMacro() = 3
+ exit function
+ endif
+ end select
+
+ hTestMacro() = 0
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hCreateBasicWorkFiles() as string
+
+ '///<H3>Create a macro, attach it to a file, save the file</H3>
+ '///<i>Starting point: Any plain document or the backing window</i>
+ '///<ul>
+ const CFN = "hCreateBasicWorkFiles::"
+ const CMACRO = "TestMacro"
+
+ dim sFile as string : sFile = hGetBasicWorkFile( "CURRENT" )
+
+ '///+<li>Open a new document</li>
+ hCreateDocument()
+
+ '///+<li>Change the document (to save it)</li>
+ printlog( CFN & hChangeDoc() )
+
+ '///+<li>Open Basic-Organizer, select the document and create a module</li>
+ if ( not hInitBasicIde( CMACRO ) ) then
+ printlog( CFN & "Unable to create a module, aborting" )
+ hDestroyDocument()
+ hCreateBasicWorkFiles() = ""
+ exit function
+ endif
+
+ '///+<li>Insert a macro that triggers a messagebox</li>
+ if ( not hInsertMacro( 3 ) ) then
+ printlog( CFN & "Unable to insert macro, aborting" )
+ hCloseBasicIde()
+ hDestroyDocument()
+ hCreateBasicWorkFiles() = ""
+ exit function
+ endif
+
+ '///+<li>Close the Basic-IDE</li>
+ hCloseBasicIde()
+
+ '///+<li>Save the file without autoextension, overwrite existing</li>
+ if ( not hFileSaveAsKill( sFile ) ) then
+ printlog( CFN & "Unknown error while saving the file. Resetting" )
+ ExitRestartTheOffice
+ hCreateBasicWorkFiles() = ""
+ exit function
+ endif
+
+ '///+<li>Close the document</li>
+ hDestroyDocument()
+
+ '///</ul>
+
+end function
+
+
+'*******************************************************************************
+
+function hIDESelectTabByIndex( iIndex as integer ) as string
+
+ '///<h3>Select a tab within the BASIC-IDE by index</h3>
+ '///<i>The BASIC-IDE has to be open and has the focus. This function
+ '///+ selects the tab by sending CTRL+PAGEUP or CTRL+PAGEDOWN to the IDE using
+ '///+ the .typeKeys method. It is assumed that - when opening the IDE - the
+ '///+ first tab is active. When the specified index has been reached we
+ '///+ retrieve the name of the current tab by opening the context menu on the
+ '///+ tab and selecting &quot;Rename&quot;. The name (which should be
+ '///+ highlighted by default) is then copied to the clipboard and returned
+ '///+ to the calling function.</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>Index of the requested Tab (Integer)</li>
+ '///<ul>
+ '///+<li>Index must not be negative</li>
+ '///+<li>0 does nothing (returning the name of the current tab)</li>
+ '///+<li>Index must be &le; present number of tabs</li>
+ '///+<li>If Index &gt; number of tabs, the last tab is selected</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Name of the selected tab (string)</li>
+ '///<ul>
+ '///+<li>Always evaluate the returnvalue</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hIDESelectTabByIndex::"
+ printlog( CFN & "Enter with option: " & iIndex )
+ dim brc as boolean 'a multi purpose boolean returnvalue
+
+ dim cTabName as string
+ dim iCurrentTab as integer
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Set context to BASIC IDE</li>
+ kontext "BasicIDE"
+
+ '///+<li>Retrieve the accelerator to switch tabs</li>
+ '///+<li>Switch tabs</li>
+ select case iIndex
+ case 1 :
+ for iTab = 1 to 20
+ BasicIDE.typeKeys( "<MOD1 PAGEDOWN>" )
+ next iTab
+ case else:
+ for iTab = 1 to iIndex
+ BasicIDE.typeKeys( "<MOD1 PAGEUP>" )
+ next iTab
+ end select
+
+ '///+<li>Select the Tabbar</li>
+ Kontext "Tabbar"
+
+ '///+<li>Open the context menu</li>
+ hUseMenu()
+
+ '///+<li>Select &quot;Rename&quot;</li>
+ hSelectMenuNr( 3 )
+
+ '///+<li>Copy the selected string to the clipboard</li>
+ hUseAsyncSlot( "EditCopy" )
+
+ '///+<li>Send ESC to the tabbar to deselect the tab</li>
+ Kontext "Tabbar"
+ Tabbar.typeKeys( "<ESCAPE>" )
+
+ '///+<li>Copy the string from clipboard to a local variable</li>
+ cTabName = getClipboardText
+
+ '///+<li>Print exit message, set return value</li>
+ if ( GVERBOSE ) then printlog( CFN & "Exit with result: " & cTabName )
+ hIDESelectTabByIndex() = cTabName
+ '///</ul>
+
+end function
+
diff --git a/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc b/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc
new file mode 100644
index 000000000000..83c037b83f0e
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_basic_organizer_tools.inc
@@ -0,0 +1,356 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+' **
+' ** owner : gregor.hartmann@oracle.com
+' **
+' ** short description : tools for tools/macro test
+' **
+'\******************************************************************************
+
+function hSelectTheLastModule( bEditEnabled as Boolean ) as string
+
+ '///<h3>Select the last (editable) module in the macro seletor treelist</li>
+
+ use "global\tools\includes\optional\t_treelist_tools.inc"
+
+ const CFN = "hSelectTheLastModule()::"
+
+ dim bCloseDialog as boolean : bCloseDialog = FALSE
+ dim iNodeCount as integer
+ dim iCurrentNode as integer
+
+ hSelectTheLastModule() = ""
+
+ kontext "Makro"
+ if ( not Makro.exists() ) then ToolsMacro_uno : bCloseDialog = TRUE
+
+ kontext "Makro"
+ iNodeCount = hSelectTheLastNode( MakroAus )
+
+ if ( bEditEnabled ) then
+ for iCurrentNode = iNodeCount to 1 step -1
+ if ( Bearbeiten.isEnabled() ) then
+ printlog( CFN & "Editable module found at pos: " & iCurrentNode )
+ exit for
+ endif
+ next iCurrentNode
+ else
+ printlog( CFN & "Module selected at pos: " & iNodeCount )
+ endif
+
+ if ( iCurrentNode > 1 ) then hSelectTheLastModule = MakroAus.getSelText()
+
+end function
+
+'*******************************************************************************
+
+function hCreateModuleForDoc( optional cName as string ) as boolean
+
+ '///<h3>Create a new Basic module for the current document</h3>
+ '///<i>Starting point: Basic Macro Organizer is visible and has focus</i>
+ const CFN = "hCreateModuleForDoc::"
+ const DEFAULT_WAIT = 2
+ const RETVAL_FAILURE = 0
+
+ if ( isMissing( cName ) ) then cName = "TTModule"
+
+ kontext "Makro"
+ if ( Makro.exists() ) then
+ if ( hSelectTheLastNode( MakroAus ) > RETVAL_FAILURE ) then
+
+ kontext "Makro"
+ if ( hClickButton( Neu ) ) then
+
+ Kontext "NeuesModul"
+ if ( NeuesModul.exists( DEFAULT_WAIT ) ) then
+ Modulname.SetText( cName )
+ hCloseDialog( NeuesModul, "ok" )
+
+ kontext "BasicIDE"
+ if ( BasicIde.exists( DEFAULT_WAIT ) ) then
+ hCreateModuleForDoc() = true
+ else
+ printlog( CFN & "BASIC IDE is not open" )
+ hCreateModuleForDoc() = false
+ endif
+ else
+ warnlog( CFN & "Dialog <NeuesModul> did not open" )
+ hCreateModuleForDoc() = false
+ endif
+ else
+ warnlog( CFN & "Failed to click <Neu> button" )
+ hCreateModuleForDoc() = false
+ endif
+ else
+ warnlog( CFN & "Failed to select the last node" )
+ hCreateModuleForDoc() = false
+ endif
+ else
+ warnlog( CFN & "Macro organizer is not open" )
+ hCreateModuleForDoc() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hOpenBasicObjectOrganizer( iTabPage as integer ) as boolean
+
+ '///<h3>Open the Basic Library/Module/Dialog Organizer</h3>
+ '///<i>Starting point: Basic IDE is open and has focus</i>
+ '///<ul>
+
+ const CFN = "hOpenBasicObjectOrganizer::"
+
+ ' This function opens a specified tab on the BASIC Organizer from the
+ ' BASIC-IDE
+ ' NOTE: This is the organizer for libraries, modules and dialogs,
+ ' not the one to run or assign macros!
+ '///+<li>Open the context menu of the tabbar</li>
+ kontext "basicide"
+ Tabbar.OpenContextMenu()
+
+ '///+<li>Select the last entry of the context menu (dynamic menu!)</li>
+ if ( hMenuItemGetCount() = 2 ) then
+ printlog( " * short context menu (no edit-window)" )
+ hMenuSelectNr( 2 )
+ else
+ printlog( " * long context menu (edit-window/dialog visible)" )
+ hMenuSelectNr( 5 )
+ endif
+
+ WaitSlot()
+
+ '///+<li>On the basic object organizer switch to the Modules tab</li>
+ if ( hSelectBasicObjectOrganizerTab( 1 ) ) then
+ printlog( CFN & "Requested page is open" )
+ hOpenBasicObjectOrganizer() = true
+ else
+ warnlog( CFN & "Failed to open requested Tabpage" )
+ hOpenBasicObjectOrganizer() = false
+ endif
+ '///+<li>Return TRUE on success, FALSE on failure</li>
+ '///</ul>
+
+
+end function
+
+'*******************************************************************************
+
+function hSelectBasicObjectOrganizerTab( iTabPage as integer ) as boolean
+
+ const CFN = "hSelectBasicObjectOrganizerTab::"
+
+ '///<h3>Switch between tab pages in the Basic Object Organizer</h3>
+ '///<i>Starting point: Masic Object Organizer is visible and has focus</i>
+ '///<ol>
+ '///+<li>1 = Modules</li>
+ '///+<li>2 = Dialogs</li>
+ '///+<li>3 = Libraries</li>
+ '///</ol>
+ '///Description:
+ '///<ul>
+
+ '///+<li>Switch between tabpages 1, 2 or 3</li>
+ select case iTabPage
+ case 1 :
+ kontext
+ Active.SetPage TabModule
+ kontext "tabmodule"
+ if ( TabModule.exists() ) then
+ printlog( CFN & "Modules-Tab is open"
+ hSelectBasicObjectOrganizerTab() = true
+ exit function
+ endif
+
+ case 2 :
+ kontext
+ Active.setPage TabDialogs
+ kontext "tabdialogs"
+ if ( TabDialogs.exists() ) then
+ printlog( CFN & "Dialogs-Tab is open"
+ hSelectBasicObjectOrganizerTab() = true
+ exit function
+ endif
+ case 3 :
+ kontext
+ Active.setPage TabBibliotheken
+ kontext "tabbibliotheken"
+ if ( TabBibliotheken.exists() ) then
+ printlog( CFN & "Libraries-Tab is open"
+ hSelectBasicObjectOrganizerTab() = true
+ exit function
+ endif
+ end select
+
+ '///+<li>Return TRUE on success, FALSE on failure</li>
+ '///</ul>
+ hSelectBasicObjectOrganizerTab() = false
+
+end function
+
+'*******************************************************************************
+
+function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean
+
+ '///<h3>Delete a library by name via Macro Object Organizer</h3>
+ '///<i>Starting point: Plain document</i>
+ '///<ul>
+
+ const CFN = "hDeleteLibrary::"
+ const ITABPOS = 3
+
+ dim iObjectCount as integer
+ dim iCurrentObject as integer
+ dim cCurrentObjectName as string
+
+ '///+<li>Open Macro Organizer</li>
+ ToolsMacro_uno
+
+ '///+<li>Click Manage-button</li>
+ Kontext "Makro"
+ hClickButton( Verwalten )
+
+ '///+<li>Go to the Libraries Tab on the Macro Object Organizer</li>
+ hSelectBasicObjectOrganizerTab( ITABPOS )
+
+ '///+<li>Select the root node in the libraries treelist</li>
+ ' Needs to be specified to avoid touching the wrong library (e.g. a protected one)
+ kontext "TabBibliotheken"
+ Bibliothek.select( iLocation )
+ iObjectCount = Bibliotheksliste.getItemCount()
+
+ '///+<li>Find the requested item in the treelist</li>
+ for iCurrentObject = 1 to iObjectCount
+
+ Bibliotheksliste.select( iCurrentObject )
+ cCurrentObjectName = Bibliotheksliste.getSelText()
+ if ( cCurrentObjectName = cLibName ) then
+
+ '///+<li>Click Delete</li>
+ hClickButton( Loeschen )
+ exit for
+ endif
+
+ next iCurrentObject
+
+ '///+<li>Confirm to delete library</li>
+ Kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ active.yes()
+ else
+ warnlog( CFN & "No confirmation for delete" )
+ endif
+
+ '///+<li>Verify that there is one item less in the treelist (object has been deleted)</li>
+ kontext "TabBibliotheken"
+ if ( Bibliotheksliste.getItemCount() = ( iObjectCount - 1 ) ) then
+ printlog( CFN & "Library has been deleted" )
+ hDeleteLibrary() = true
+ else
+ printlog( CFN & "Library has not been deleted" )
+ hDeleteLibrary() = false
+ endif
+
+ '///+<li>Cancel Macro Object Organizer</li>
+ hCloseDialog( TabBibliotheken, "cancel" )
+
+ '///+<li>Cancel Basic Macro Organizer</li>
+ Kontext "Makro"
+ hCloseDialog( Makro, "cancel" )
+ '///+<li>Return TRUE on success, FALSE on failure</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hNameBasicModule( cName as string ) as boolean
+
+ '///<h3>Name a Basic Module</h3>
+ '///<i>Starting point: Clicked &quot;New...&quot; button in Basic Macro organizer.<br>
+ '///+ On success the kontext will be on the Basic IDE. In case of
+ '///+ failure we remain on the naming dialog so that the function can be
+ '///+ triggered again.</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name of the module (string)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (Boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if name is valid, module has been created</li>
+ '///+<li>FALSE if name is invalid or naming dialog does not exist</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hNameBasicModule::"
+
+ '///+<li>Verify that the naming dialog is open</li>
+ kontext "NeuesModul"
+ if ( not NeuesModul.exists() ) then
+ hNameBasicModule() = false
+ exit function
+ endif
+
+ '///+<li>Insert the name into the EntryField</li>
+ Modulname.SetText( cName )
+
+ '///+<li>Accept the name with OK</li>
+ hCloseDialog( NeuesModul, "ok" )
+
+ '///+<li>If there is no warning, the name should be valid.</li>
+ kontext "BasicIDE"
+ if ( BasicIde.exists( 2 ) ) then
+ hNameBasicModule() = true
+ printlog( CFN & "Name accepted, Basic-Ide is open" )
+ else
+ hNameBasicModule() = false
+ '///+<li>Look for invalid name warning, close it</li>
+ kontext "active"
+ if ( active.exists() ) then
+ printlog( CFN & "Msgbox: " & active.exists() )
+ hCloseDialog( active, "ok" )
+ endif
+
+ '///+<li>If the name is invalid, get back to the naming-dialog</li>
+ kontext "NeuesModul"
+ if ( NeuesModul.exists() ) then
+ printlog( CFN & "Name not accepted, focus on naming-dialog" )
+ else
+ warnlog( CFN & "Naming failed but we are not on the naming dialog" )
+ endif
+ endif
+ '///</ul>
+
+end function
+
+
+
diff --git a/testautomation/global/tools/includes/optional/t_control_objects.inc b/testautomation/global/tools/includes/optional/t_control_objects.inc
new file mode 100644
index 000000000000..266243d93bb1
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_control_objects.inc
@@ -0,0 +1,611 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Functions to manipulate controls by accessing them as objects
+'*
+'\******************************************************************************
+
+private const MSG1 = "Incorrect default setting: "
+
+'*******************************************************************************
+
+function cb_test( oControl as object, def_state as string, issueid as string ) as boolean
+
+ ' Small helper that prints a warnlog if a checkbox does not have the correct
+ ' default setting (checked -> def_state = TRUE). You can supply an issue id
+ ' which will be printed to the log. no parameter is optional, issueid can
+ ' be an empty string.
+
+ ' oControl: The checkbox itself
+ ' def_state: Default state (checked or unchecked)
+ ' issueid: Issue id as string "#i123456#" for QUASTe
+
+ dim con_state as boolean : con_state = oControl.isChecked()
+ dim con_name as string : con_name = oControl.name()
+
+ printlog( con_name & " (Checkbox)" )
+ cb_test() = true
+
+ if ( def_state ) then
+
+ if ( NOT con_state ) then
+ warnlog( issueid & " " & MSG1 & con_name & " should be checked" )
+ cb_test() = false
+ endif
+
+ oControl.unCheck()
+ oControl.check()
+
+ else
+
+ if ( con_state ) then
+ warnlog( issueid & " " & MSG1 & con_name & " should be unchecked" )
+ cb_test() = false
+ endif
+
+ oControl.check()
+ oControl.unCheck()
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function lb_test( oControl as object, items as integer, preset as integer, issueid as string ) as boolean
+
+ ' Do some basic testing on listboxes
+ ' - verify that the number of entries is correct
+ ' - verify that the default selection is correct
+ ' - select each item and restore default
+
+ ' oControl: The Listbox as object
+ ' items: Number of items in the list
+ ' preset: Item which is selected by default (usually 1), skip with 0
+ ' issueid: Issue id as string "#i123456#" for QUASTe
+
+ dim con_name as string : con_name = oControl.name()
+ dim con_items as integer : con_items = oControl.getItemCount()
+ dim con_preset as integer : con_preset = oControl.getSelIndex()
+ dim con_iterator as integer
+
+ printlog( con_name & " (Listbox)" )
+ if ( oControl.isEnabled() ) then
+ lb_test() = true
+
+ if ( con_items <> items ) then
+ warnlog( issueid & " Incorrect itemcount in listbox: " & con_name )
+ printlog( "Expected: " & items )
+ printlog( "Found...: " & con_items )
+ lb_test() = false
+ endif
+
+ if ( preset > 0 ) then
+ if ( con_preset <> preset ) then
+ warnlog( issueid & " Incorrect default setting (index): " & con_name )
+ printlog( "Expected: " & preset )
+ printlog( "Found...: " & con_preset )
+ lb_test() = false
+ endif
+ endif
+
+ for con_iterator = 1 to con_items
+ oControl.select( con_iterator )
+ next con_iterator
+
+ if ( preset > 0 ) then oControl.select( preset )
+ else
+ printlog( "The control is disabled" & con_name )
+ lb_test() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function checkRadioButton( _file as string , sKey as string , control as object ) as boolean
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ ' a wrapper. The routine is identical to checkCheckBox.
+
+ checkRadioButton = checkCheckBox( _file , sKey , control )
+
+end function
+
+'*******************************************************************************
+
+function checkCheckBox( _file as string , sKey as string , control as object , optional cBugID as string ) as boolean
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim bIsChecked as boolean
+ dim sIsChecked as string
+ dim _sIsChecked as string
+
+ if ( ismissing( cBugID ) ) then
+ cBugID = "WriteMe!"
+ endif
+ if ( sKey = "*" ) then
+ sKey = control.name()
+ endif
+
+ sKey = lcase( sKey )
+ _sIsChecked = lcase( hGetFileData( _file , sKey ) )
+
+ if ( _sIsChecked <> "disabled" ) then
+
+ ' look if the control is present on the current dialog
+ if ( control.exists() and _
+ control.IsVisible() and _
+ control.IsEnabled() ) then
+
+ ' find out whether it is checked or not, create strings for errormessage
+ bIsChecked = control.isChecked()
+ if ( bIsChecked = true ) then
+ sIsChecked = "checked"
+ else
+ sIsChecked = "unchecked"
+ endif
+
+ ' compare
+ keycompare( sIsChecked , _sIsChecked , sKey , cBugID )
+ checkCheckBox() = control.isChecked()
+
+ else
+
+ warnlog( "Control <" & sKey & "> could not be accessed." )
+
+ endif
+
+ else
+
+ if ( control.IsEnabled() ) then
+ warnlog( "The control should be disabled but it is not: " & sKey )
+ endif
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function setCheckBox( _file as string , sKey as string , control as object , optional bverbose as boolean ) as boolean
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim sIsChecked as string
+ dim _sIsChecked as string
+
+ if ( sKey = "*" ) then
+ sKey = control.name()
+ endif
+ if ( ismissing( bverbose ) ) then
+ bverbose = true
+ endif
+
+ sKey = lcase( sKey )
+ _sIsChecked = lcase( hGetFileData( _file , sKey ) )
+
+ if ( _sIsChecked <> "disabled" ) then
+
+ if ( control.exists() and _
+ control.IsVisible() and _
+ control.IsEnabled() ) then
+
+ select case _sIsChecked
+
+ case "checked"
+ control.check()
+ setCheckBox() = true
+ case "unchecked"
+ control.uncheck()
+ setCheckBox() = false
+ case else
+ warnlog( "what?" )
+
+ end select
+
+ if ( bverbose ) then
+ printlog( " * " & sKey )
+ endif
+
+ else
+
+ ' warn if the control could not be used (only works in rare cases)
+ warnlog( "Control <" & sKey & "> is not accessible." )
+
+ endif
+
+ else
+
+ if ( control.IsEnabled() ) then
+ warnlog( "The control should be disabled but it is not: " & sKey )
+ endif
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function checkComboBox( _file as string , sKey as string , control as object ) as boolean
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim controltext as string ' current state
+ dim _controltext as string ' reference
+
+ if ( sKey = "*" ) then
+ sKey = control.name()
+ endif
+
+ sKey = lcase( sKey )
+
+ if ( control.exists() = true and control.IsVisible = true ) then
+
+ _controltext = lcase( hGetFileData( _file , skey ) )
+ controltext = control.getSelText()
+ keycompare( controltext , _controltext , sKey )
+ checkComboBox() = control.isEnabled()
+
+ else
+
+ warnlog( "Control <" & sKey & "> could not be accessed." )
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function setComboBox( _file as string , sKey as string , control as object , optional bverbose as boolean ) as integer
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim _controltext as string ' reference string retrieved from _file
+
+ if ( ismissing( bverbose ) ) then
+ bverbose = true
+ endif
+ if ( sKey = "*" ) then
+ sKey = control.name()
+ endif
+
+ sKey = lcase( sKey )
+
+ if ( control.exists() = true and control.IsVisible = true ) then
+
+ _controltext = hGetFileData( _file , sKey )
+ control.settext( _controltext )
+ setComboBox() = _controltext
+ if ( bverbose = true ) then
+ printlog( " * " & sKey )
+ endif
+
+ else
+
+ warnlog( "Control <" & sKey & "> is not accessible." )
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function checkEntryField( _file as string , sKey as string , control as object , optional cBugID as string ) as boolean
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim controltext as string ' current state
+ dim _controltext as string ' reference
+
+ if ( ismissing( cBugID ) ) then
+ cBugID = "WriteMe!"
+ endif
+ if ( sKey = "*" ) then
+ sKey = control.name()
+ endif
+
+ ' lowercase the name (or alias) of the control which will be tested
+ sKey = lcase( sKey )
+
+ ' get the expected setting for the control from the reference file
+ _controltext = lcase( hGetFileData( _file , skey ) )
+
+ ' if the reference file specifies that the control should be disabled
+ ' the routine tries to access it - expecting to fail. In this case we write
+ ' a string into the EF
+ if ( _controltext <> "disabled" ) then
+
+ if ( control.exists() and _
+ control.IsVisible() and _
+ control.IsEnabled() ) then
+
+ controltext = lcase( control.getText() )
+ keycompare( controltext , _controltext , sKey , cBugID )
+ checkEntryField() = control.isEnabled()
+
+ else
+
+ warnlog( "Control <" & sKey & "> could not be accessed." )
+
+ endif
+
+ else
+
+ if ( control.IsEnabled() ) then
+ warnlog( "The control should be disabled but it is not: " & sKey )
+ endif
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function setEntryField( _file as string , sKey as string , control as object , optional bverbose as boolean ) as string
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ ' this is the text that will be written into the entryfield
+ dim _controltext as string
+
+ if ( ismissing( bverbose ) ) then
+ bverbose = true
+ endif
+ if ( sKey = "*" ) then
+ sKey = lcase( control.name() )
+ endif
+
+ ' get the string from the reference file
+ _controltext = lcase( hGetFileData( _file , sKey ) )
+
+ if ( _controltext <> "disabled" ) then
+
+ ' we can only access the control if it is present + visible
+ if ( control.exists() and _
+ control.IsVisible() and _
+ control.IsEnabled() ) then
+
+ control.setText( lcase( _controltext ) )
+ setEntryField() = _controltext
+
+ if ( bverbose ) then
+ printlog( " * " & sKey )
+ endif
+
+ else
+
+ warnlog( "Control <" & sKey & "> is not accessible." )
+
+ endif
+
+ else
+
+ if ( control.IsEnabled() ) then
+ warnlog( "The control should be disabled but it is not: " & sKey )
+ endif
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function checkListBox( _file as string , sKey as string , control as object ) as boolean
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim controltext as string ' current state
+ dim _controltext as string ' reference
+
+ if ( sKey = "*" ) then
+ sKey = control.name()
+ endif
+
+ sKey = lcase( sKey )
+
+ if ( control.exists() = true and control.IsVisible = true ) then
+
+ _controltext = lcase( hGetFileData( _file , skey ) )
+ controltext = control.getSelIndex()
+ keycompare( controltext , _controltext , sKey )
+ checkListBox() = control.isEnabled()
+
+ else
+
+ warnlog( "Control <" & sKey & "> could not be accessed." )
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function setListBox( _file as string , sKey as string , control as object , optional bverbose as boolean ) as integer
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim _controltext as string ' reference
+
+ ' if name of the control is '*' get the name from the control itself
+ if ( ismissing( bverbose ) ) then
+ bverbose = true
+ endif
+ if ( sKey = "*" ) then
+ sKey = control.name()
+ endif
+
+ ' change the key to lowercase
+ sKey = lcase( sKey )
+
+ if ( control.exists() = true and control.IsVisible = true ) then
+
+ _controltext = hGetFileData( _file , sKey )
+ control.select( val( _controltext ) )
+ setListBox() = control.getselindex()
+ if ( bverbose = true ) then
+ printlog( " * " & sKey )
+ endif
+
+ else
+
+ warnlog( "Control <" & sKey & "> is not accessible." )
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function checkListItem( _file as string , _iIndex as integer , sKey as string , control as object ) as boolean
+
+ '///<h3>EXPERIMENTAL: Get/Set function for some control types</h3>
+ '///<i>This is a function that allows to change the state/content of a
+ '///+ control via a configuration file. This function is experimental
+ '///+ and should not be used.<br>
+
+ dim controltext as string ' current state
+ dim _controltext as string ' reference
+
+ sKey = lcase( sKey )
+
+
+ if ( control.exists() = true and control.IsVisible() = true ) then
+
+ control.select( _iIndex )
+ controltext = control.getSelText()
+ _controltext = hGetFileData( _file , skey )
+
+
+ keycompare( controltext , _controltext , sKey )
+
+ checkListItem() = control.isEnabled()
+
+ else
+
+ printlog( "Control <" & sKey & "> could not be found." )
+
+ endif
+
+
+end function
+
+'*******************************************************************************
+
+function hSetControlValue( oObject as object, cValue as string ) as integer
+
+ '///<h3>Enter some text into a EntryField/TextField</h3>
+ '///<i>This extends .setText() to provide a returnvalue</i><br>
+ '///<i>The function runs silent as long as no errors occur</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Control Object (Object)</li>
+ '///<ul>
+ '///+<li>The object must exist</li>
+ '///+<li>The object must be enabled</li>
+ '///+<li>The object must be visible</li>
+ '///</ul>
+ '///+<li>String (string)</li>
+ '///<ul>
+ '///+<li>Any string, including empty strings (=delete)</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Status of the control (integer)</li>
+ '///<ul>
+ '///+<li>0 = EntryField was updated correctly</li>
+ '///+<li>1 = Object does not exist</li>
+ '///+<li>2 = Object it not visible</li>
+ '///+<li>3 = Object is disabled</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+ dim irc as integer
+ const CFN = "hSetControlValue::"
+
+ '///+<li>Verify that the control exists</li>
+ if ( oObject.exists() ) then
+
+ '///+<li>Verify that the object is visible</li>
+ if ( oObject.isVisible() ) then
+
+ '///+<li>Verify that the control is enabled</li>
+ if ( oObject.isEnabled() ) then
+ oObject.setText( cValue )
+ irc = 0
+ else
+ irc = 3 ' control disabled
+ printlog( CFN & "Control is disabled: ID: " & oObject )
+ endif
+ else
+ irc = 2 ' control not visible
+ printlog( CFN & "Control is not visible: ID: " & oObject )
+ endif
+ else
+ irc = 1 ' control does not exist
+ printlog( CFN & "Control does not exist: ID: " & oObject )
+ endif
+
+ hSetControlValue() = irc
+ '///</ul>
+
+end function
+
+
diff --git a/testautomation/global/tools/includes/optional/t_docfuncs.inc b/testautomation/global/tools/includes/optional/t_docfuncs.inc
new file mode 100644
index 000000000000..5e3e76028e6b
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_docfuncs.inc
@@ -0,0 +1,475 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : misc functions to handle documents
+'*
+'\******************************************************************************
+
+function hUseImpressAutopilot( bEnable as boolean ) as boolean
+
+ '///<h3>Enable/disable the Impress Autopilot in Tools/Options</h3>
+ '///<i>Starting point: Any plain document</i>
+ '///<ul>
+ const CFN = "global::tools::includes::optional::t_docfuncs.inc::hUseImpressAutopilot::"
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ '///+<li>Create a new IMPRESS document</li>
+ gApplication = "IMPRESS"
+ hCreateDocument()
+
+ '///+<li>Open Tools/Options, go to Presentataion/General page</li>
+ ToolsOptions
+ hToolsOptions( gApplication , "General" )
+
+ '///+<li>Check or uncheck to start with autopilot</li>
+ Kontext "TabSonstigesDraw"
+ if ( mitAutopilotStarten.exists( 2 ) ) then
+
+ if ( bEnable ) then
+ mitAutopilotStarten.check()
+ if ( GVERBOSE ) then printlog( CFN & "Enable Impress Autopilot" )
+ else
+ mitAutopilotStarten.uncheck()
+ if ( GVERBOSE ) then printlog( CFN & "Disable Impress Autopilot" )
+ endif
+
+ '///+<li>Return Status of Checkbox (checked=TRUE)</li>
+ hUseImpressAutopilot() = mitAutopilotStarten.isChecked()
+
+ else
+
+ warnlog( CFN & "Cannot find Autopilot Checkbox" )
+
+ endif
+
+ '///+<li>Close Tools/Options</li>
+ Kontext "OptionenDlg"
+ hCloseDialog( OptionenDlg, "ok" )
+
+ '///+<li>Close IMPRESS document</li>
+ hDestroyDocument()
+
+ '///+<li>Returncode is undefined</li>
+ if ( GVERBOSE ) then printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hNumericDocType( doctype as integer ) as string
+
+ '///<h3>Convert a numeric expression to a gApplication</h3>
+ '///<i>BEWARE: This is a core function used by many testcases!</i><br>
+ '///<u>Using file: global/input/applications.txt as reference</u>
+ '///<ul>
+
+ const CFN = "global::tools::includes::optional::t_docfuncs.inc::hNumericDocType::"
+
+ dim sFile as string
+ sFile = gTesttoolPath & "global\input\applications.txt"
+ sFile = convertpath( sFile )
+
+ dim sList( 100 ) as string
+ dim iDocTypes as integer
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ '///+<li>Retrieve matching list from file</li>
+ hGetDataFileSection( sFile , sList() , "application" , "" , "" )
+ iDocTypes = val( sList( 0 ) )
+
+ '///+<li>Verify that the functionparameter (documenttype) is valid</li>
+ if ( ( doctype < 0 ) or ( doctype > iDocTypes ) ) then
+ warnlog( CFN & "Undefined numeric doctype: " & doctype )
+ hNumericDocType() = ""
+ exit function
+ endif
+
+ '///+<li>Set gApplication to the requested document type</li>
+ gApplication = hGetValueForKeyAsString( sList() , doctype )
+
+ '///+<li>Set a plain text name as returnvalue for the function</li>
+ hGetDataFileSection( sFile , sList() , "application_names" , "" , "" )
+ hNumericDocType() = hGetValueForKeyAsString( sList() , gApplication )
+ if ( GVERBOSE ) then printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hChangeDoc() as string
+
+ '///<h3>Function to modify all documenttypes to set the "changed" flag</h3>
+ '///<i>Starting point: Any plain document</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>String, ready to use in printlog</li>
+ '///<ul>
+ '///+<li>&quot;Changed &lt;Documenttype&gt;&quot;</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ sleep()
+
+ select case gApplication
+
+ '///+<li>WRITER: Type some text</li>
+ case "WRITER", "HTML", "MASTERDOCUMENT"
+ Kontext "DocumentWriter"
+ DocumentWriter.TypeKeys "<Return>This doc is changed!"
+ hChangeDoc() = "Changed WRITER/HTML/MASTERDOC"
+
+ '///+<li>CALC: Write some text into the current location (usually A1)</li>
+ case "CALC" : Kontext "DocumentCalc"
+ DocumentCalc.TypeKeys "<Down>This doc is changed!<Return>"
+ hChangeDoc() = "Changed CALC"
+
+ '///+<li>DRAW: Draw a rectangle</li>
+ case "DRAW" : Kontext "DocumentDraw"
+ hRechteckErstellen ( 20, 20, 25, 25 )
+ gMouseClick ( 1, 1 )
+ hChangeDoc() = "Changed DRAW"
+
+ '///+<li>IMPRESS: Draw a rectangle</li>
+ case "IMPRESS": Kontext "DocumentImpress"
+ hRechteckErstellen ( 20, 20, 25, 25 )
+ gMouseClick ( 1, 1 )
+ hChangeDoc() = "Changed IMPRESS"
+
+ '///+<li>MATH: Create a simple formaula</li>
+ case "MATH" : SchreibenInMathdok( "b over c" )
+ kontext "DocumentMath"
+ hChangeDoc() = "Changed MATH"
+ gMouseClick( 50 , 50 )
+
+ end select
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hIdentifyWriterDoc( cString as string, bWarn as boolean ) as boolean
+
+ '///<h3>Function to validate that the expected WRITER doc has the focus</h3>
+ '///<i>Starting point: Any WRITER document containing some text</i>
+ '///<ul>
+
+ use "global\tools\includes\optional\t_stringtools.inc"
+
+ const CFN = "global::tools::includes::optional::t_docfuncs.inc::hIdentifyWriterDoc::"
+ dim cIdentifier as string
+ dim irc as integer ' some temporary returnvalue
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ '///+<li>Test the function parameter</li>
+ if ( cString = "" ) then
+ qaerrorlog( CFN & "Function parameter is empty string. Aborting" )
+ hIdentifyWriterDoc() = false
+ exit function
+ endif
+
+ '///+<li>Verify function prerequisites</li>
+ kontext "DocumentWriter"
+ if ( not DocumentWriter.exists() ) then
+ printlog( CFN & "There is no Writer document. Aborting" )
+ hIdentifyWriterDoc() = false
+ exit function
+ endif
+
+ hIdentifyWriterDoc() = true
+
+ '///+<li>Go to the very beginning of the current writer document</li>
+ kontext "DocumentWriter"
+ DocumentWriter.typeKeys( "<MOD1 HOME>" )
+
+ '///+<li>Select the entire line</li>
+ DocumentWriter.typeKeys( "<SHIFT END>" )
+
+ '///+<li>copy the string to the clipboard and store it into a variable</li>
+ hUseAsyncSlot( "EditCopy" )
+ cIdentifier = getClipboardText()
+
+ '///+<li>compare the string to the reference (given as parameter)</li>
+ irc = hCompareSubstrings( cIdentifier, cString )
+
+ '///+<li>Write the result to the printlog if desired</li>
+ if ( irc = 0 ) then
+
+ if ( GVERBOSE ) then printlog( CFN & "The focus is not on the expected document" )
+ if ( bWarn ) then warnlog ( CFN & "The focus is not on the expected document" )
+
+ printlog( CFN & "Expected: " & cString )
+ printlog( CFN & "Found...: " & cIdentifier )
+ hIdentifyWriterDoc() = false
+
+ else
+ printlog( CFN & "OK: The document contains the requested string" )
+ endif
+ '///+<li>Return TRUE only if the current document is the expected one</li>
+
+ if ( GVERBOSE ) then printlog( CFN & "Exit" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hCreateDocument() as boolean
+
+ '///<h3>Create anew document, extends hNewDocument() by providing a returnvalue</h3>
+ ' TRUE = New document created, FALSE = Failed to create a new document '
+ const CFN = "global::tools::includes::optional::t_docfuncs.inc::hCreateDocument::"
+
+ dim iDocCountBefore as integer
+ dim iDocCountAfter as integer
+
+ iDocCountBefore = getDocumentCount
+ if ( GVERBOSE ) then printlog( CFN & "Number of open documents before: " & iDocCountBefore )
+
+ if ( gApplication = "BACKGROUND" ) then
+ hFileCloseAll()
+ hCreateDocument() = true
+ else
+
+ call hNewDocument()
+ iDocCountAfter = getDocumentCount()
+ if ( iDocCountAfter = ( iDocCountBefore + 1 ) ) then
+ hCreateDocument() = true
+ else
+ hCreateDocument() = false
+ endif
+ endif
+ if ( GVERBOSE ) then printlog( CFN & "New document created. Open: " & iDocCountAfter )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hDocumentTypeKeys( cString as string ) as boolean
+
+ '///<h3>Type a string to a document</h3>
+ '///<i>The documenttype is determined by gApplication.<br>
+ '///See hNumericDocType for details and number/gApplication matching</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Keystrokes to be sent to the document (string), e.g.</li>
+ '///<ul>
+ '///+<li>&quot;&lt;SHIFT HOME&gt;&quot;</li>
+ '///+<li>&quot;&lt;MOD1 A&gt;&quot;</li>
+ '///+<li>&quot;&lt;MOD2 Q&gt;&quot;</li>
+ '///+<li>&quot;Hello&quot;</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorstatus (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if all went well</li>
+ '///+<li>FALSE on any error</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "global::tools::includes::optional::t_docfuncs.inc::hDocumentTypeKeys::"
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+ hDocumentTypeKeys() = true
+
+ '///+<li>Set focus to the current documenttype determined by gApplication</li>
+ '///+<li>Type the string passed as function parameter</li>
+ select case gApplication
+ case "WRITER" : kontext "DocumentWriter"
+ DocumentWriter.typeKeys( cString )
+ case "CALC" : kontext "DocumentCalc"
+ DocumentCalc.typeKeys( cString )
+ case "IMPRESS" : kontext "DocumentImpress"
+ DocumentImpress.typeKeys( cString )
+ case "DRAW" : kontext "DocumentDraw"
+ DocumentDraw.typeKeys( cString )
+ case "MATH" : kontext "DocumentMath"
+ DocumentMath.typeKeys( cString )
+ case "MASTERDOCUMENT": kontext "DocumentWriter"
+ DocumentWriter.typeKeys( cString )
+ case "HTML" : kontext "DocumentWriter"
+ DocumentWriter.typeKeys( cString )
+ case else
+ warnlog( CFN & "Exit: Unknown gApplication: " & gApplication )
+ hDocumentTypeKeys() = false
+ exit function
+ end select
+
+ '///+<li>Print some message to the log on success</li>
+ printlog( CFN & "Exit: Sent keystroke to " & gApplication )
+ '///</ul>
+
+end function
+
+
+'*******************************************************************************
+
+function hDestroyDocument() as boolean
+
+ const CFN = "global::tools::includes::optional::t_docfuncs.inc::hDestroyDocument: "
+ dim iDocCount as integer : iDocCount = getDocumentCount()
+ hDestroyDocument() = false
+
+ dim method( 3 ) as string
+ method( 1 ) = "no,optional"
+ method( 2 ) = "202,optional"
+ method( 3 ) = "ok,optional" ' This could be a File I/O error
+
+ dim iCurrentMethod as integer
+ dim bDialogClosed as boolean
+
+ if ( iDocCount = 0 ) then exit function
+ if ( GVERBOSE ) then printlog( CFN & "In.: Open: " & iDocCount )
+
+ hUseAsyncSlot( "FileClose" )
+
+ for iCurrentMethod = 1 to 3
+
+ bDialogClosed = false
+
+ Kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ printlog( CFN & "Msgbox: " & Active.getText() )
+ if ( GVERBOSE ) then printlog( CFN & "Method: " & method( iCurrentMethod ) )
+ bDialogClosed = hCloseDialog( Active, method( iCurrentMethod ) )
+ else
+ exit for
+ endif
+
+ if ( iCurrentMethod = 3 and bDialogClosed ) then
+ warnlog( "Unexpected messagebox was handled" )
+ endif
+
+ next iCurrentMethod
+
+ if ( getDocumentCount() = iDocCount ) then hCloseDocument()
+ if ( getDocumentCount() = iDocCount - 1 ) then hDestroyDocument() = true
+ if ( GVERBOSE ) then printlog( CFN & "Out: Open: " & getDocumentCount() )
+
+end function
+
+'*******************************************************************************
+
+function hInitSingleDoc() as boolean
+
+ hFileCloseAll()
+ hCreateDocument()
+
+ if ( GVERBOSE ) then printlog( "hInitSingleDoc(): Opening document: " & gApplication )
+
+ if ( getDocumentCount = 1 ) then
+ hInitSingleDoc() = true
+ else
+ hInitSingleDoc() = false
+ endif
+
+end function
+
+'*******************************************************************************'*******************************************************************************
+
+function hInitWriteDocIdentifier( cString as string ) as boolean
+
+
+ '///<h3>Write a specific string to an open writer document</h3>
+ '///<i>This function verifies that exactly one document is open, that this is a
+ '///+ Writer document and writes the string to the document</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>A free form string (String) which serves as identifier for the document</li>
+ '///<ul>
+ '///+<li>The first character should be uppercase</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Errorcondition (Boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: The string was written correctly</li>
+ '///+<li>FALSE: Too many open documents</li>
+ '///+<li>FALSE: Not a Writer document</li>
+ '///+<li>FALSE: Any other error</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "global::tools::includes::optional::t_docfuncs.inc::hInitWriteDocIdentifier::"
+ const RC_TIMEOUT = -1
+
+ if ( getDocumentCount = 1 and gApplication = "WRITER" ) then
+
+ kontext "DocumentWriter"
+ DocumentWriter.typeKeys( "<MOD1 END>" )
+ DocumentWriter.typeKeys( "<MOD1 SHIFT HOME>" )
+ DocumentWriter.typeKeys( "<DELETE>" )
+ DocumentWriter.typekeys( cString )
+
+ DocumentWriter.typeKeys( "<MOD1 END>" )
+ DocumentWriter.typeKeys( "<MOD1 SHIFT HOME>" )
+
+ if ( hUseAsyncSlot( "EditCopy" ) <> RC_TIMEOUT ) then
+
+ if ( getClipboardText = cString ) then
+ printlog( CFN & "Writer document has been successfully modified." )
+ hInitWriteDocIdentifier() = true
+ else
+ warnlog( CFN & "Could not verify document identification string" )
+ hInitWriteDocIdentifier() = false
+ endif
+ else
+ warnlog( CFN & "Unable to copy text to clipboard using <EditCopy>" )
+ hInitWriteDocIdentifier() = false
+ endif
+ else
+ warnlog ( CFN & "Only one single writer document may be open" )
+ printlog( CFN & "Number of documents: " & getDocumentCount )
+ printlog( CFN & "Application........: " & gApplication )
+ hInitWriteDocIdentifier() = false
+ endif
+
+end function
diff --git a/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc b/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc
new file mode 100644
index 000000000000..4b7c481ffe8f
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_extension_manager_tools.inc
@@ -0,0 +1,780 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/******************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Tools to ease working with the extension manager
+'*
+'\******************************************************************************
+
+function hExtensionAddGUI( _path as string, _flags as string ) as integer
+
+ '///<h3>Install an extension using the OpenOffice.org Extension Manager UI</h3>
+ '///<p>This function is intended for use with the new Extension Manager UI
+ '///+ and replaces an older function with the same name. Please note that
+ '///+ the interface has changed significantly. <br>This has become necessary
+ '///+ because the Extension Manager can turn up with a really huge number
+ '///+ of different dialogs, warnings, errormessages etc. <br>
+ '///+ As this function is designed to handle the most common installation
+ '///+ scenarios it needs quite a number of differnt options.<br>
+ '///+ Please have a look at the usage sample:<br><br></p>
+ '///+ <p align="center"><i>hExtensionAddGUI( sMyExtension,
+ '///+ &quot;InstallForAll,BrokenDeps,DenyUpdate&quot; )</i<p><br>
+
+
+ '///<u>Input:</u><br>
+ '///<ol>
+ '///+<li>Path to extension (String)</li>
+ '///<ul>
+ '///+<li>The path has to be fully qualified</li>
+ '///+<li>The path may be platform specific</li>
+ '///</ul>
+
+ '///+<li>Flags (String), defaults underlined</li>
+ '///<ul>
+ '///+<li>The string is non optional but may be empty. Allowed flags are:</li>
+ '///<ul>
+ '///+<li>InstallForAll | <u>InstallForUser</u><br>Used when running office with administrator rights</li>
+ '///+<li>AllowUpdate | DenyUpdate | <u>NoUpdate</u><br>Reinstall already installed extension/update</li>
+ '///+<li>AcceptLicense | DenyLicense | <u>NoLicense</u><br>How to handle possible license dialog</li>
+ '///+<li>BrokenDeps<br>Close exactly one broken dependencies warning</li>
+ '///+<li>UseSlot<br>Use the File Open slot to load the extension (faster)</li>
+ '///</ul>
+ '///+<li>It is recommended to use the comma as delimiter between flags</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Return Value:</u><br>
+ '///<ol>
+ '///+<li>Installation status (Integer)</li>
+ '///<ul>
+ '///+<li>&gt; 0 = Installation completed with no errors, number of installed extensions</li>
+ '///+<li>-1 = The requested extension does not exist</li>
+ '///+<li>-2 = The Add-button could not be accessed</li>
+ '///+<li>-3 = The Extension Manager did not open</li>
+ '///+<li>-4 = Unknown messagebox before the file Open dialog exists</li>
+ '///+<li>-5 = Broken dependency warning displayed</li>
+ '///+<li>-6 = The File Open dialog did not pop up</li>
+ '///+<li>-7 = Unknown and unhandled messagebox. function exit</li>
+ '///</ul>
+ '///</ol>
+
+ dim flags as string : flags = lcase( _flags )
+ dim path as string : path = convertpath( _path )
+ dim bLogs as boolean : bLogs = FALSE
+
+ const CFN = "hExtensionAddGUI()::"
+
+ '///<u>Description</u>
+ '///<ul>
+
+ ' set defaults if string is empty
+ if ( flags = "" ) then flags = "installforuser,noupdate,nolicense"
+ if ( instr( flags , "verbose" ) <> 0 ) then bLogs = TRUE
+
+ if ( bLogs ) then printlog( CFN & "Flags: " & flags )
+
+ '///+<li>Verify that the requested extension exists (filesystem level)</li>
+ if ( not FileExists( path ) ) then
+ printlog( CFN & "Requested extension does not exist" )
+ printlog( CFN & path )
+ hExtensionAddGUI() = -1
+ exit function
+ endif
+
+
+ if ( bLogs ) then
+ printlog( "" )
+ printlog( "********** Installing extension begin **********" )
+ endif
+
+ '///+<li>Open the Extension Manager - optionally using the slot (CWS oxtsysint01)</li>
+ if ( instr( flags , "useslot" ) <> 0 ) then
+ hFileOpen( path )
+ else
+ ToolsPackageManager
+ kontext "PackageManager"
+
+ if ( PackageManager.exists( 2 ) ) then
+
+ '///+<li>Verify that the &quot;Add..&quot; button is available</li>
+ if ( add.exists() and add.isEnabled() ) then
+
+ '///+<li>Click the &quot;Add...&quot; button</li>
+ add.click()
+ else
+ printlog( CFN & "Add button is missing or disabled" )
+ hExtensionAddGUI() = -2
+ exit function
+ endif
+
+ '///+<li>Test for the dreaded &quot;The office workdirectory does not exist&quot; warning, close it</li>
+ kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ if ( Active.getButtonCount() = 1 ) then
+ if ( bLogs ) then printlog( Active.getText() )
+ active.ok()
+ else
+ printlog( CFN & "Unexpected/unknown messagebox" )
+ printlog( Active.getText() )
+ hExtensionAddGUI() = -4
+ exit function
+ endif
+ endif
+
+ '///+<li>Enter the extension name into the file picker, open the file</lI>
+ kontext "OeffnenDlg"
+ if ( OeffnenDlg.exists( 2 ) ) then
+ DateiName.setText( path )
+ Oeffnen.click()
+ else
+ printlog( CFN & "The File Open dialog did not open" )
+ hExtensionAddGUI() = -6
+ exit function
+ endif
+
+ else
+ printlog( CFN & "Extension Manager is not open" )
+ hExtensionAddGUI() = -3
+ exit function
+ endif
+ endif
+
+ '///+<li>Test for the installation target dialog that comes up as soon as the
+ '///+ user has administrator rights or works on a userspace installation.
+ '///+ Handle the dialog as specified by the function flags</li>
+ if ( instr( flags, "installfor" ) <> 0 ) then
+ kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ if ( Active.getButtonCount() = 3 ) then
+
+ if ( bLogs ) then
+ printlog( CFN & "Installation target dialog found" )
+ printlog( Active.getText() )
+ endif
+
+ if ( instr( flags , "installforall" ) <> 0 ) then
+ printlog( CFN & "Installing for all users" )
+ Active.no()
+ else
+ printlog( CFN & "Installing for user only" )
+ Active.yes()
+ endif
+ else
+ if ( bLogs ) then
+ printlog( CFN & "Unexpected/unknown dialog" )
+ printlog( Active.getText() )
+ endif
+ endif
+ else
+ if ( bLogs ) then printlog( CFN & "Skipping handling of installation target" )
+ endif
+ else
+ if ( bLogs ) then printlog( CFN & "Not handling userspace installations" )
+ endif
+
+ '///+<li>Test for the broken dependencies exception, close it with ok.</li>
+ if ( instr( flags , "brokendeps" ) <> 0 ) then
+ if ( bLogs ) then printlog( CFN & "Testing for dependencies messagebox" )
+ kontext "UnsatisfiedDependencies"
+ if ( UnsatisfiedDependencies.exists( 1 ) ) then
+ printlog( CFN & "Closing Unsatisfied Dependencies dialog." )
+ UnsatisfiedDependencies.ok()
+ hExtensionAddGUI() = -5
+ else
+ printlog( CFN & "No unsatisfied dependencies dialog" )
+ endif
+ else
+ if ( bLogs ) then printlog( CFN & "Skipping handling of broken dependencies dialog" )
+ endif
+
+ '///+<li>Test for the extension update dialog which pops up if an extension
+ '///+ is already installed. Handle as specified by flags</li>
+ if ( instr( flags, "update" ) ) then
+ if ( bLogs ) then printlog( CFN & "Testing for version message/update" )
+ kontext "Active"
+ if ( Active.exists( 1 ) ) then
+
+ if ( bLogs ) then
+ printlog( CFN & "Found update dialog" )
+ printlog( Active.getText() )
+ endif
+
+ if ( Active.getButtonCount() = 2 ) then
+ if ( instr( flags, "denyupdate" ) <> 0 ) then
+ printlog( CFN & "Denying update" )
+ Active.cancel()
+ else
+ printlog( CFN & "Allowing update" )
+ Active.ok()
+ endif
+ else
+ printlog( CFN & "Unexpected/unknown dialog displayed" )
+ printlog( Active.getText() )
+ hExtensionAddGUI() = -7
+ exit function
+ endif
+ else
+ if ( instr( flags , "noupdate" ) <> 0 ) then
+ printlog( CFN & "No update dialog present. Good" )
+ else
+ printlog( CFN & "Update messagebox is missing" )
+ endif
+ endif
+ else
+ if ( bLogs ) then printlog( CFN & "Skipping handling of update dialog" )
+ endif
+
+ '///+<li>Test for the Software License Agreement dialog. Handle as specified by
+ '///+ flags</li>
+ if ( instr( flags, "license" ) <> 0 ) then
+ if ( bLogs ) then printlog( CFN & "Testing software license dialog" )
+ kontext "ExtensionSoftwareLicenseAgreement"
+ if ( ExtensionSoftwareLicenseAgreement.exists( 5 ) ) then
+ if ( bLogs ) then printlog( CFN & "Software license dialog found" )
+ if ( instr( flags , "denylicense" ) <> 0 ) then
+ printlog( CFN & "Cancelling software license dialog" )
+ ExtensionSoftwareLicenseAgreement.cancel()
+ else
+ printlog( CFN & "Accepting software license" )
+ do while ( not accept.isEnabled() )
+ ScrollDown.click()
+ WaitSlot()
+ loop
+ accept.click()
+ endif
+ else
+ if ( instr( flags , "nolicense" ) <> 0 ) then
+ printlog( CFN & "No license dialog displayed. Good." )
+ else
+ warnlog( CFN & "Expected license dialog is missing" )
+ endif
+ endif
+ else
+ if ( bLogs ) then printlog( CFN & "Skipping handling of license dialog" )
+ endif
+
+ '///+<li>Retrieve the number of installed extensions</li>
+ kontext "PackageManager"
+ wait( 500 )
+ hExtensionAddGUI() = BrowsePackages.getItemCount()
+
+ '///+<li>Close the Extension Manager</li>
+ hCloseDialog( PackageManager , "close" )
+
+ if ( bLogs ) then
+ printlog( "********** Installing extension end **********" )
+ printlog( "" )
+ endif
+ '///</ul>
+
+end function
+
+
+'*******************************************************************************
+
+function hExtensionRemoveGUI( cExtensionName as string ) as integer
+
+
+ '///<h3>Remove an extension via Extension Manager </h3>
+
+ '///<u>Input value(s):</u><br>
+ '///<ol>
+ '///+<li>UI Name of the extension (string)</li>
+ '///</ol>
+
+
+ '///<u>Return Value:</u><br>
+
+ '///<ol>
+ '///+<li>Errorcode (integer)</li>
+ '///<ul>
+ '///+<li>0 = No errors, extension was removed</li>
+ '///+<li>1 = Failure to open Extension Manager (fatal)</li>
+ '///+<li>2 = Cannot delete found extension, remove-button is disabled (fatal)</li>
+ '///+<li>3 = The extension was not found (non-fatal)</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hExtensionRemoveGUI(): "
+
+ printlog( "Removing extension by name: " & cExtensionName )
+
+ ToolsPackageManager
+ kontext "PackageManager"
+ if ( PackageManager.exists( 2 ) ) then
+ try
+ BrowsePackages.select( cExtensionName )
+ if ( Remove.exists() ) then
+ if ( Remove.isEnabled() ) then
+ Remove.click()
+
+ kontext "Active"
+ if ( Active.exists( 3 ) ) then
+ printlog( Active.getText() )
+ Active.OK()
+ WaitSlot()
+ else
+ warnlog( CFN & "Expected confirmation dialog is missing" )
+ endif
+ hExtensionRemoveGUI() = 0
+ else
+ hExtensionRemoveGUI() = 2
+ endif
+ else
+ hExtensionRemoveGUI() = 4
+ endif
+ catch
+ hExtensionRemoveGUI() = 3
+ endcatch
+
+ kontext "PackageManager"
+ hCloseDialog( PackageManager , "close" )
+ else
+ hExtensionRemoveGUI() = 1
+ endif
+
+end function
+
+'*******************************************************************************
+
+function sExtensionCLI(sCommand as string, sExtensionName as string, optional sExtensionPath as string) as string
+ '/// Add/remove an extension with the command line tool 'unopkg'///'
+ '/// INPUT: sCommand: string of command from "add remove list reinstall" ///'
+ '/// INPUT: sExtensionName: name of the extension ///'
+ '/// INPUT: optional sExtensionPath: path to the extension ///'
+ '/// RETURN: currently nothing ///'
+ dim sLokalExtensionPath as string
+ dim sCommands as string
+ dim sUnoPkg as string
+ dim i, a, b as integer
+ dim args as string
+ Dim sFile as string
+ Dim sEnv as string
+ Dim sContent(5) as string
+ Dim sPlatformProgramPath as string
+
+ if isMissing(sExtensionPath) then
+ sLokalExtensionPath = ""
+ else
+ sLokalExtensionPath = sExtensionPath
+ endif
+
+ sCommands = "add remove list reinstall"
+
+ a = len(sAppExe)
+ if a > 12 then
+ b = inStr(a-12, sAppExe, "soffice")
+ sUnoPkg = left(sAppExe, b-1) + "unopkg" + mid(sAppExe, b+len("soffice"))
+ 'printlog sUnoPkg
+ 'sUnoPkg = convertToUrl(sUnoPkg)
+ else
+ qaErrorLog ("Need to think about another solution..." + sAppExe)
+ endif
+ args = sCommand+" "+sLokalExtensionPath + sExtensionName
+ printlog "Executing: "+sUnopkg+" "+args
+ if gPlatGroup <> "unx" then
+ shell(sUnoPkg,2,args)
+ else
+ sFile = ConvertPath (gOfficePath + "user/work/uno.sh")
+ if gPlatform = lcase("osx") then
+ sPlatformProgramPath = "MacOS"
+ else
+ sPlatformProgramPath = "program"
+ end if
+ sEnv = convertToURL(convertPath(gNetzOfficePath + sPlatformProgramPath + "/fundamentalrc")
+ listAppend(sContent(), "export URE_BOOTSTRAP=" + sEnv)
+ listAppend(sContent(), sUnoPkg + " " + args)
+ listWrite(sContent(), sFile)
+ shell("bash",1,sFile)
+ endif
+end function
+
+'*******************************************************************************
+
+function hExtensionGetItemList( cItemList() as string ) as integer
+
+ '///<h3>Get the list of all items in the extensions list</h3>
+ '///<i>The array contains the list of all items in the extension manager GUI,
+ '///+ including all components of the extensions. Consider this when defining
+ '///+ the size of the array to be passed to this function as problems here are
+ '///+ hard to debug.<br>
+ '///+ Starting point is any document, the function will return to the
+ '///+ calling document on completion</i><br><br>
+
+ '///<u>Input:</u>
+ '///<ol>
+ '///+<li>Array for the list items (string)</li>
+ '///</ol>
+
+
+ '///<u>Return Value:</u><br>
+ '///<ol>
+ '///+<li>Number of items (integer)</li>
+ '///<ul>
+ '///+<li>0 on any error</li>
+ '///+<li>2 if no extensions exist (My Macros/OpenOffice.org macros nodes present</li>
+ '///+<li>&gt; 2 if any changes to the default exist</li>
+ '///</ul>
+ '///</ol>
+
+ dim iItemCount as integer
+ dim iCurrentExtension as integer
+
+ printlog( "Retrieving extension list" )
+
+ ToolsPackageManager
+ kontext "PackageManager"
+ if ( PackageManager.exists( 2 ) ) then
+
+ iItemCount = BrowsePackages.getItemCount()
+
+ for iCurrentExtension = 1 to iItemCount
+ cItemList( iCurrentExtension ) = BrowsePackages.getItemText( iCurrentExtension , 1 )
+ printlog( " * " & cItemList( iCurrentExtension )
+ next iCurrentExtension
+
+ hExtensionGetItemList() = iItemCount
+ cItemList( 0 ) = iItemCount
+ hCloseDialog( PackageManager , "close" )
+
+ else
+
+ hExtensionGetItemList() = 0
+
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hSelectExtensionID( iPos as integer ) as string
+
+ '///<h3>Select an item by index in the list of available extensions</h3>
+ '///<i>This function needs the Extension Manager to be open. It will only
+ '///+ select extensions but not their components.</i><br><br>
+
+ '///<u>Input:</u>
+ '///<ol>
+ '///+<li>Absolute position of the extension to be selected (Integer)</li>
+ '///</ol>
+
+ '///<u>Return Value:</u><br>
+ '///<ol>
+ '///+<li>Name of the selected extension (String)</li>
+ '///+<li>Empty string on index out of range or Extension Manager not open</li>
+ '///</ol>
+
+ printlog( "Selecting extension at pos. " & iPos )
+
+ ToolsPackageManager
+ kontext "PackageManager"
+ if ( PackageManager.exists( 2 ) ) then
+ try
+ BrowsePackages.select( iPos )
+ hSelectExtensionID() = BrowsePackages.getItemText( iPos , 1 )
+ catch
+ hSelectExtensionID() = ""
+ endcatch
+ hCloseDialog( PackageManager , "close" )
+ else
+ hSelectExtensionID() = ""
+ endif
+
+
+end function
+
+'*******************************************************************************
+
+function hSelectExtensionName( cName as string ) as integer
+
+ '///<h3>Select an item by name in the list of available extensions</h3>
+ '///<i>This function needs the Extension Manager to be open. It will only
+ '///+ select extensions but not their components.</i><br><br>
+
+ '///<u>Input:</u>
+ '///<ol>
+ '///+<li>Name of the extension (String)</li>
+ '///<ul>
+ '///+<li>Name of any item in the treelist, even those of top nodes</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Return Value:</u><br>
+ '///<ol>
+ '///+<li>Absolute position of the selected extension (Integer)</li>
+ '///<ul>
+ '///+<li>0 = Extension was not found</li>
+ '///+<li>&gt; 0 = Absolute position of the extension/node</li>
+ '///+<li>-1 = Extension Manager did not open</li>
+ '///</ul>
+ '///</ol>
+
+ printlog( "Selecting extension by display name: " & cName )
+
+ ToolsPackageManager
+ kontext "PackageManager"
+ if ( PackageManager.exists( 2 ) ) then
+ try
+ BrowsePackages.select( cName )
+ hSelectExtensionName() = BrowsePackages.getSelIndex()
+ catch
+ hSelectExtensionName() = 0
+ endcatch
+ hCloseDialog( PackageManager , "close" )
+ else
+ hSelectExtensionName() = -1
+ endif
+
+
+end function
+
+
+'*******************************************************************************
+
+function hSelectOptionsItem( cName as string, iIndex as integer ) as integer
+
+ '///<h3>Select an item in Tools/Options and verify</h3>
+ '///<i>You need to open the Tools/Options dialog before using this function,
+ '///+ it will not close the dialog either. No warnlogs are printed so evaluation
+ '///+ of the return value is mandatory</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>Name of the extension node (string)</li>
+ '///<ul>
+ '///+<li>Name of the module</li>
+ '///+<li>Name of the leaf</li>
+ '///+<li>Node must be valid</li>
+ '///</ul>
+
+ '///+<li>Position of the node (absolute) (integer)</li>
+ '///<ul>
+ '///+<li>All nodes are expanded</li>
+ '///+<li>Position must be valid (&gt; 0 and &le; number of nodes in list)</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Errorcondition (integer)</li>
+ '///<ul>
+ '///+<li>0 = Success</li>
+ '///+<li>1 = Partial success - node is at wrong position</li>
+ '///+<li>2 = Node does not exist</li>
+ '///+<li>3 = Dialog not open</li>
+ '///+<li>4 = Index out of range (incorrect call to function)</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hSelectOptionsItem::"
+ printlog( CFN & "Enter with option (Name).: " & cName )
+ printlog( CFN & "Enter with option (Index): " & iIndex )
+
+ dim brc as boolean ' a multi purpose boolean returnvalue
+ dim irc as integer ' a multi purpose integer returnvalue
+ dim crc as string ' a multi purpose string returnvalue
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Make sure we are on the Tools/Options dialog</li>
+ kontext "OptionenDlg"
+ if ( not OptionenDlg.exists( 2 ) ) then
+ warnlog( CFN & "Tools/Options is not open, aborting" )
+ hSelectOptionsItem() = 3
+ exit function
+ endif
+
+ '///+<li>Expand all nodes on &quot;OptionsListe&quot;</li>
+ irc = hExpandAllNodes( OptionsListe )
+ if ( irc < iIndex ) then
+ warnlog( CFN & "Index out of range, quitting" )
+ hSelectOptionsItem() = 4
+ exit function
+ endif
+
+ '///+<li>Search for the node at the given index, handle errors, exit function</li>
+ crc = hSelectNode( OptionsListe , iIndex )
+
+ ' if the name of the node at given position is ok ...
+ if ( crc = cName ) then
+ printlog( CFN & "Exit: The node was found: " & crc )
+ hSelectOptionsItem() = 0
+ exit function
+
+ ' if the name is not ok, try to find the node by name
+ else
+ printlog( CFN & "Node not found at expected position, retrying" )
+ irc = hSelectNodeByName( OptionsListe , cName )
+
+ ' if the node is found it is just at the wrong position - bad but not deadly
+ if ( irc > 0 ) then
+ qaerrorlog( CFN & "Exit: Node <" & cName & "> found at pos: " & irc )
+ hSelectOptionsItem() = 1
+ exit function
+
+ ' if the node was not found at all this is really bad.
+ else
+ warnlog( CFN & "Exit: Node does not exist: " & cName )
+ hSelectOptionsItem() = 3
+ exit function
+ endif
+ endif
+
+ '///</ul>
+
+end function
+
+
+'*******************************************************************************
+
+function hIsExtensionAlreadyInstalled( cName as string ) as boolean
+
+ '///<h3>Check if an extension is already installed</h3>
+ '///<i>The function opents the Extension Manager, finds (or not) the extension
+ '///+ and returns an appropriate return value. The Extension Manager is
+ '///+ closed again at the end.</i><br><br>
+
+ '///<u>Input:</u>
+ '///<ol>
+ '///+<li>Name of the extension (String)</li>
+ '///</ol>
+
+ '///<u>Return Value:</u><br>
+ '///<ol>
+ '///+<li>is the extension allredy installed (boolean)</li>
+ '///<ul>
+ '///+<li>FALSE = Extension is not installed</li>
+ '///+<li>FALSE = Extension Manager did not open</li>
+ '///+<li>TRUE = Extension is installed</li>
+ '///</ul>
+ '///</ol>
+
+ printlog( "Checking if extension is already installed: " & cname )
+
+ dim iCountExtensions as integer
+ dim i as integer
+
+ hIsExtensionAlreadyInstalled() = FALSE
+
+ ToolsPackageManager
+ kontext "PackageManager"
+
+ iCountExtensions = BrowsePackages.getItemCount()
+
+ for i = 1 to iCountExtensions
+ if(Instr(BrowsePackages.getItemText(i,1),cname) <> 0) then
+ hIsExtensionAlreadyInstalled() = TRUE
+ endif
+ next
+
+ hCloseDialog( PackageManager , "close" )
+
+end function
+
+
+'*******************************************************************************
+
+function hDisableUserExtensionGUI( extension_name as string ) as integer
+
+ '///<h3>Disable a userspace extension by name via GUI</h3>
+ '///<i>This function tries to disable an Extension specified by name. There
+ '///+ are several reasons why this might fail so it is required to evaluate the
+ '///+ returnvalue as the function will not print any warnings. If the function
+ '///+ fails this is most likely caused by a) the extension already being
+ '///+ disabled or b) the extension belonging to the shared layer.<br>
+ '///+ The Extension Manager needs to be open when function is called.</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>Name of the extension to be disabled (string)</li>
+ '///<ul>
+ '///+<li>Only extensions from the user layer can be disabled</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Errorcondition (integer)</li>
+ '///<ul>
+ '///+<li>0 = Extension was found and disabled</li>
+ '///+<li>1 = Extension does not exist</li>
+ '///+<li>2 = Extension could not be disabled</li>
+ '///+<li>3 = Extension Manager did not open</li>
+ '///</ul>
+
+ printlog( "Disabling user extension" )
+
+ ToolsPackageManager
+ kontext "PackageManager"
+ if ( PackageManager.exists( 2 ) ) then
+ try
+ BrowsePackages.select( extension_name )
+ if ( Disable.exists() and Disable.isEnabled() ) then
+ hDisableUserExtensionGUI() = 0
+ else
+ hDisableUserExtensionGUI() = 2
+ endif
+ hCloseDialog( PackageManager , "close" )
+ catch
+ hDisableUserExtensionGUI() = 1
+ endcatch
+ else
+ hDisableUserExtensionGUI() = 3
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hGetExtensionCount() as integer
+
+ printlog( "Getting number of installed extensions." )
+
+ ToolsPackageManager
+ kontext "PackageManager"
+ if ( PackageManager.exists( 2 ) ) then
+ try
+ hGetExtensionCount() = BrowsePackages.getItemCount()
+ hCloseDialog( PackageManager , "close" )
+ catch
+ hGetExtensionCount() = -2
+ endcatch
+ else
+ hGetExtensionCount() = -1
+ endif
+
+
+end function
+
+
diff --git a/testautomation/global/tools/includes/optional/t_filetools.inc b/testautomation/global/tools/includes/optional/t_filetools.inc
new file mode 100644
index 000000000000..dd8a9affc1be
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_filetools.inc
@@ -0,0 +1,319 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Functions that work with files like deleting, loading...
+'*
+'\******************************************************************************
+
+function hHandleActivesOnLoad( iTries as integer , iAdd as integer ) as boolean
+
+ '///<h3>Handle any dialogs that might pop up when loading a file</h3>
+ '///<i>Beware: This function gives only limited control over the dialogs closed,
+ '///+ it just closes anything it can.</i><br>
+ '///<i>Please refer to the inline documentation for further details</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Number of dialogs to be closed (integer)</li>
+ '///<ul>
+ '///+<li>Number of dialogs not limited though more than 3 is not useful</li>
+ '///</ul>
+ '///+<li>Additional dialogs (integer).</li>
+ '///<ul>
+ '///+<li>Number of dialogs to handle in case of unexpected behavior. If unsure set it to 2</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: The expected number of dialogs were closed</li>
+ '///+<li>FALSE: On any other condition</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+ '///+<li>OK to create a new document based on a template</li>
+ '///+<li>YES to update links</li>
+ '///+<li>YES to execute macros</li>
+ '///</ul>
+
+ use "global/tools/includes/optional/t_stringtools.inc"
+
+ const CFN = "hHandleActivesOnLoad::"
+
+ dim iTry as integer
+ dim iActives as integer
+ dim cMessage as string
+ dim bSkip as boolean
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ ' not good but apparently required - else hDestroyDocument will handle the
+ ' dialogs and warn about them.
+
+ ' think positive: preset the returnvalue with "true"
+ hHandleActivesOnLoad() = true
+
+ for iTry = 1 to iTries + iAdd
+
+ ' handle three possible dialogs:
+ ' 1. The warning that the user should create a new document based
+ ' on this Sample/Template (the document is write protected)
+ ' 2. The question to update links to the internet. Note: If you
+ ' use proxies, they must be set correctly otherwise the result
+ ' is undefined.
+ ' 3. Some weird usage information dialog which is an active with just
+ ' one OK button.
+
+ ' Although this works quite well, there is a flaw that we will not
+ ' get information about an "active" dialog that cannot be closed by
+ ' .yes() or .ok(). If this happens, we probably run into an error
+ kontext "Active"
+ try
+ if ( active.exists( 1 ) ) then
+
+ iActives = iActives + 1
+ cMessage = hRemoveLineBreaks( active.getText() )
+ printlog( CFN & "MSG (" & iActives & "): " & cMessage )
+ printlog( CFN & "Ressource type is: " & Active.getRT() )
+ printlog( CFN & "Buttoncount is: " & Active.getButtonCount() )
+ bSkip = false
+
+ ' ok to create a new document
+ try
+ active.cancel()
+ printlog( CFN & "MSG (" & iActives & "): closed with Cancel" )
+ bSkip = true
+ catch
+ printlog( CFN & "Missed - this dialog has no Cancel button (create new document)" )
+ active.ok()
+ endcatch
+
+ if ( not bSkip ) then
+ if ( Active.getRT() = 304 ) then
+ if ( Active.getButtonCount() = 1 ) then
+ active.ok()
+ printlog( CFN & "MSG (" & iActives & "): closed with OK" )
+ bSkip = true
+ endif
+ else
+ endif
+ endif
+
+ if ( not bSkip ) then
+ ' no to update links
+ try
+ active.no()
+ printlog( CFN & "MSG (" & iActives & "): closed with NO" )
+ catch
+ printlog( CFN & "Missed - this dialog has no NO button (update links)" )
+ endcatch
+ endif
+
+ endif
+ catch
+ kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ if ( Active.getButtonCount() = 2 ) then
+ printlog( CFN & "<Update links dialog> or <File corruption warning>" )
+ active.yes()
+ hFileWait( FALSE )
+ kontext "Active"
+ if ( Active.exists( 2 ) ) then
+ qaerrorlog( "#105670# - File corruption warning, the template is broken" )
+ qaerrorlog( CFN & "Trying to recover." )
+ Active.ok()
+ hHandleActivesOnLoad() = FALSE
+ exit function
+ endif
+ endif
+ endif
+
+ qaerrorlog( "Problem while trying to handle messageboxes" )
+ hHandleActivesOnLoad() = false
+ endcatch
+
+ next iTry
+
+ ' now see how many dialogs were allowed and how many have been closed
+ ' this does not change the return value of the function
+ if ( iActives > iTries ) then
+ printlog( CFN & "Exit: The test closed more dialogs than expected" )
+ hHandleActivesOnLoad() = false
+ else
+ if ( GVERBOSE ) then printlog( CFN & "Exit" )
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hHandleInitialDialogs() as integer
+
+ const CFN = "hHandleInitialDialogs::"
+
+ '///<h3>Handle dialogs while opening samples/templates etc.</h3>
+ '///<i>The returnvalue is of limited use</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Id of the dialog (integer)</li>
+ '///<ul>
+ '///+<li>0: No dialog was found</li>
+ '///+<li>1: UseOfThisTemplate</li>
+ '///+<li>2: StarOfficeCalendar1</li>
+ '///+<li>3: NewsletterLayout</li>
+ '///+<li>4: PortfolioCurrency</li>
+ '///+<li>5: StarOfficeCalendar2</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+
+ ' NOTE: The ID of the dialog will be returned but is of limited use
+ ' Function returns 0 if no dialogs have been encountered
+
+ dim incident as integer
+ incident = 0
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+ try
+
+ '///+<li>Test for UseOfThisTemplate-dialog</li>
+ Kontext "UseOfThisTemplate"
+ if ( UseOfThisTemplate.Exists() ) then
+ printlog( CFN & "Closing UseOfThisTemplate-dialog" )
+ incident = 1
+ CancelButton.Click()
+ endif
+
+ '///+<li>Test for StarOfficeCalendar1-dialog</li>
+ Kontext "StarOfficeCalendar1"
+ if ( StarOfficeCalendar1.Exists() ) then
+ printlog( CFN & "Closing StarOfficeCalendar1-dialog" )
+ incident = 2
+ Cancel.Click()
+ endif
+
+ '///+<li>Test for StarOfficeCalendar2-dialog (This should be idential to StarofficeCalendar1)</li>
+ Kontext "StarOfficeCalendar2"
+ if ( StarOfficeCalendar2.Exists() ) then
+ printlog( CFN & "Closing StarOfficeCalendar2-dialog" )
+ incident = 5
+ Cancel.Click()
+ endif
+
+ '///+<li>Test for NewsletterLayout-dialog</li>
+ Kontext "NewsletterLayout"
+ if ( NewsletterLayout.Exists() ) then
+ printlog( CFN & "Closing NewsletterLayout-dialog" )
+ incident = 3
+ OkButton.Click()
+ endif
+
+ '///+<li>Test for PortfolioCurrency-dialog</li>
+ Kontext "PortfolioCurrency"
+ if ( PortfolioCurrency.Exists() ) then
+ printlog( CFN & "Closing PortfolioCurrency-dialog" )
+ incident = 4
+ OKButton.Click()
+ endif
+ catch
+ endcatch
+
+ hHandleInitialDialogs() = incident
+ if ( GVERBOSE ) then printlog( CFN & "Exit" )
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+
+'*******************************************************************************
+
+function hGetFileSizeAsLong( cFileName as string ) as long
+
+ '///<h3>Get the size (long) of a file</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Filename (string)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Size of file (long)</li>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hGetFileSizeAsLong::"
+
+ ' This function returns the size of a specified file. If it is a directory,
+ ' the size will default to -1 (A filesize can never be <0 - hopefully)
+
+ dim iAttrib as integer
+
+ '///+<li>Verify that the given file exists</li>
+ if ( app.dir( cFileName ) <> "" ) then
+
+ try
+ iAttrib = getattr( cFileName )
+
+ '///+<li>Return the size for a file or -1 for a directory</li>
+ if ( iAttrib <> 16 and iAttrib <> 17 ) then
+ hGetFileSizeAsLong() = filelen( cFileName )
+ else
+ hGetFileSizeAsLong() = -1
+ endif
+ catch
+ qaerrorlog( CFN & "File was not handled correctly: " & cFileName )
+ hGetFileSizeAsLong() = 0
+ endcatch
+
+ else
+
+ '///+<li>Return a size of 0 if the file was not found</li>
+ hGetFileSizeAsLong() = 0
+ warnlog( CFN & "File does not exist: " & cFileName )
+
+ endif
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+
+
diff --git a/testautomation/global/tools/includes/optional/t_key_tools.inc b/testautomation/global/tools/includes/optional/t_key_tools.inc
new file mode 100644
index 000000000000..f32984f963e3
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_key_tools.inc
@@ -0,0 +1,563 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : tools for evaluation of key=value datalists
+'*
+'*******************************************************************************
+' **
+' #1 hGetDataPairAsString ' retrieve key=value from a list
+' #1 hGetValueForPairAsString ' retrieve value from a key=value as string
+' #1 hGetValueForPairAsLong ' retrieve value from a key=value as long integer
+' #1 hGetValueForKeyAsInt ' retrieve value for a specified key as integer
+' #1 hGetValueForKeyAsLong ' retrieve value for a specified key as long integer
+' #1 hGetKeyForPairAsString ' retrieve key from key=value as string
+' #1 hGetKeyForValueAsString ' retrieve key for a specified value as string
+' #1 hGetKeyForValueAsInt ' retrieve key for a specified value as int
+' #1 hGetIndexForKeyAsInt ' retrieve the index for a key in a list
+' #1 KeyCompare ' compare two keys
+' **
+'\******************************************************************************
+
+' Some variables explained:
+'
+' cComp is the KEY belonging to the VALUE above for reverse test
+'
+' NOTE: Other related functions can be found in global/tools/inc/t_filters.inc
+
+'*******************************************************************************
+
+function hGetDataPairAsString( sKey as string, sVal as long ) as string
+
+ '///<h3>Concatenate two strings and insert an = sign</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>KEY (string)</li>
+ '///<ul>
+ '///+<li>Anything but should not contain # or '</li>
+ '///</ul>
+
+ '///+<li>VALUE (string)</li>
+ '///<ul>
+ '///+<li>Anything but should not contain # or '</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>KEY=VALUE pair (string)</li>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ '///+<li>Returns string1=string2</li>
+ hGetDataPairAsString() = sKey & "=" & sVal
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetValueForPairAsString( cLine as string ) as string
+
+ '///<h3>Retrieve value from a key=value string</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>KEY=VALUE pair (string)</li>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>VALUE (string)</li>
+ '///<ul>
+ '///+<li>Anything after the = character</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iCharPos as integer
+
+ '///+<li>Locate the equal sign</li>
+ iCharPos = instr( cLine , "=" )
+ iCharPos = len( cLine ) - iCharPos
+
+ '///+<li>Isolate everything to the right of the equal sign</li>
+ '///+<li>Return the value as string</li>
+ hGetValueForPairAsString() = right( cLine , iCharPos )
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetValueForPairAsLong( cLine as string ) as long
+
+ '///<h3>Retrieve the value from a key=value pair as long</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>KEY=VALUE pair (string)</li>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>VALUE (long)</li>
+ '///<ul>
+ '///+<li>Anything after the = character as long integer value</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iCharPos as integer
+
+ '///+<li>Locate the equal sign</li>
+ iCharPos = instr( cLine , "=" )
+ iCharPos = len( cLine ) - iCharPos
+
+ '///+<li>Isolate and return the Value as long datatype</li>
+ hGetValueForPairAsLong = val( right( cLine , iCharPos ))
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetValueForKeyAsInt( lsList() as string, sKey as string ) as integer
+
+ '///<h3>Retrieve the value of a key=value pair as integer</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+ '///<i>Prerequisite: Array compatible to listfuncs, known, valid key</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>List of KEY=VALUE pairs (string)</li>
+ '///<ul>
+ '///+<li>List must be compatible to listfunctions (see t_listfuncs.inc)</li>
+ '///</ul>
+ '///+<li>Key to be searched for within the list (string)</li>
+ '///<ul>
+ '///+<li>Key must be valid</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>VALUE (integer)</li>
+ '///<ul>
+ '///+<li>The value for a given key</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iItem as integer
+ dim cString as string
+ dim cComp as string
+
+ hGetValueForKeyAsInt() = 0
+
+ ' Scan through the list and look for sKey. If found, return the Value
+ ' (everything to the right of the '=')
+ '///+<li>Search the list for the key</li>
+ for iItem = 1 to listcount( lsList() )
+ if( instr( lsList( iItem ) , sKey ) <> 0 ) then
+
+ '///+<li>Verify that this is really the correct key by reverse-checking</li>
+ cComp = hGetKeyforPairAsString( lsList( iItem ) )
+
+ '///+<li>Retrieve the value for the key as string</li>
+ if( sKey = cComp ) then
+ cString = hGetValueForPairAsString( lsList( iItem ) )
+ iItem = listcount( lsList() ) + 1
+ endif
+
+ endif
+ next iItem
+
+ '///+<li>Convert the stringvalue to integer and return it</li>
+ hGetValueForKeyAsInt() = val( cString )
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetValueForKeyAsLong( lsList() as string, sKey as string ) as long
+
+ '///<h3>Retrieve the value of a key=value pair as integer</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+ '///<i>Prerequisite: Array compatible to listfuncs, known, valid key</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>List of KEY=VALUE pairs (string)</li>
+ '///<ul>
+ '///+<li>List must be compatible to listfunctions (see t_listfuncs.inc)</li>
+ '///</ul>
+ '///+<li>Key to be searched for within the list (string)</li>
+ '///<ul>
+ '///+<li>Key must be valid</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>VALUE (long integer)</li>
+ '///<ul>
+ '///+<li>The value for a given key</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iItem as integer
+ dim cString as string
+ dim cComp as string
+
+ hGetValueForKeyAsInt() = 0
+
+ ' Scan through the list and look for sKey. If found, return the Value
+ ' (everything to the right of the '=')
+ '///+<li>Search the list for the key</li>
+ for iItem = 1 to listcount( lsList() )
+ if( instr( lsList( iItem ) , sKey ) <> 0 ) then
+
+ '///+<li>Verify that this is really the correct key by reverse-checking</li>
+ cComp = hGetKeyforPairAsString( lsList( iItem ) )
+
+ '///+<li>Retrieve the value for the key as string</li>
+ if( sKey = cComp ) then
+ cString = hGetValueForPairAsString( lsList( iItem ) )
+ iItem = listcount( lsList() ) + 1
+ endif
+
+ endif
+ next iItem
+
+ '///+<li>Convert the stringvalue to long integer and return it</li>
+ hGetValueForKeyAsInt() = val( cString )
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetKeyForPairAsString( cLine as string ) as string
+
+ '///<h3>Retrieve the KEY from a key=value pair</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>KEY=VALUE pair (string)</li>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>KEY (string)</li>
+ '///<ul>
+ '///+<li>Anything before the = character</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iCharPos as integer
+
+ iCharPos = instr( cLine , "=" )
+
+ '///+<li>get the string to the left of the = char</li>
+ if ( iCharPos > 0 ) then
+ hGetKeyForPairAsString() = left( cLine , iCharPos -1 )
+ else
+ warnlog( "Invalid string passed to hGetKeyForPairAsString" )
+ printlog( "It was: " & cLine )
+ endif
+ '///+<li>Return the key</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetKeyForValueAsString( lsList() as string, sVal as string ) as string
+
+ '///<h3>Retrieve the KEY for a known VALUE from a key=value pair</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+ '///<i>Prerequisite: List compatible to listfuncs, known VALUE for pair</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>List of KEY=VALUE pairs (string)</li>
+ '///<ul>
+ '///+<li></li>
+ '///</ul>
+
+ '///+<li>VALUE (string)</li>
+ '///<ul>
+ '///+<li>Absolute match required.</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>KEY (string)</li>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ ' This function returns the value of a key as string.
+ ' The form of the input strings is 'key=value', the list is parsed
+ ' The key for the first occurrence of sVal is returned
+
+ dim iCurrentValue as integer
+ dim iListItems as integer
+ iListItems = listcount( lsList() )
+ dim cLine as string
+
+ ' preset a default return string
+ hGetKeyForValueAsString() = "Error: No matching KEY found for VALUE"
+
+ '///+<li>scan through a list to find an entry that matches sKey. Return the Key.</li>
+ for iCurrentValue = 1 to iListItems
+
+ cLine = lsList( iCurrentValue )
+
+ if( instr( cLine , sVal ) <> 0 ) then
+ hGetKeyForValueAsString() = hGetKeyForPairAsString( cLine )
+ iCurrentValue = iListItems + 1
+ end if
+
+ next iCurrentValue
+ '///+<li>Return the key from the first matching value</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetKeyForValueAsInt( lsList() as string, sVal as string ) as integer
+
+ '///<h3>Retrieve the KEY for a known VALUE from a key=value pair</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+ '///<i>Prerequisite: List compatible to listfuncs, known VALUE for pair</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>List of KEY=VALUE pairs (string)</li>
+
+ '///+<li>VALUE (string)</li>
+ '///<ul>
+ '///+<li>Absolute match required.</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>KEY (integer)</li>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ '///+<li>Use hgetKeyForValueAsString, convert result to integer, return it.</li>
+ hGetKeyForValueAsInt() = val( hGetKeyForValueAsString( lsList() , sVal ) )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hGetIndexForKeyAsInt( lsList() as string, sKey as string ) as integer
+
+ '///<h3>Search a list of key=value pairs for a key and return its index</h3>
+ '///<i>About &quot;KEY&quot;-functions: <br>
+ '///These functions are used whenever
+ '///+ data is to be processed that is stored in a key=value format.<br>
+ '///+ They handle a single string or a list of strings
+ '///+ to e.g. isolate a key, a value or to just retrieve the pair.</i><br><br>
+ '///<i>Prerequisite: List compatible to listfuncs, known VALUE for pair</i><br><br>
+
+ '///<u>Input</u>:
+ '///<ol>
+
+ '///+<li>List of KEY=VALUE pairs (string)</li>
+
+ '///+<li>KEY to search for (string)</li>
+
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+
+ '///+<li>Index of the KEY in the list (integer)</li>
+ '///<ul>
+ '///+<li>0 if not found</li>
+ '///+<li>Any number &gt; 0 and &le; listcount( List() )</li>
+ '///</ul>
+
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ dim iItem as integer
+ dim cComp as string
+
+ hGetIndexForNamedKeyAsInt() = 0
+
+ ' Scan through the list and look for sKey. If found, return the Value
+ ' (everything to the right of the '=')
+ '///+<li>Scan through the list for the KEY</li>
+ for iItem = 1 to listcount( lsList() )
+ if( instr( lsList( iItem ) , sKey ) <> 0 ) then
+
+ '///+<li>if found, perform reverse checking</li>
+ cComp = hGetKeyforValueAsString( lsList( iItem ) )
+
+ '///+<li>get the index of the item</li>
+ if( sKey = cComp ) then
+ hGetIndexForKeyAsInt() = iItem
+ iItem = listcount( lsList() ) + 1
+ endif
+
+ endif
+ next iItem
+ '///+<li>Return the index</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function keycompare( found as string, expected as string, sKey as string, optional cBugID as string) as boolean
+
+ '///<h3>Function to compare two keys with each other</h3>
+ '///<u>Deprecated, do not use</u>
+
+ if ( isMissing( cBugID ) ) then
+ cBugID = ""
+ endif
+
+ if ( lcase(found) = lcase(expected) ) then
+ printlog( " * '" & sKey & "': ok" )
+ keycompare = true
+ else
+ warnlog( "#" + cBugID + "# Control has incorrect value: '" & sKey & "'")
+ printlog( " > Found...: '" & found & "'" )
+ printlog( " > Expected: '" & expected & "'" )
+ keycompare = false
+ endif
+
+end function
+
+
+
diff --git a/testautomation/global/tools/includes/optional/t_listfuncs.inc b/testautomation/global/tools/includes/optional/t_listfuncs.inc
new file mode 100644
index 000000000000..cb020d343662
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_listfuncs.inc
@@ -0,0 +1,464 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/******************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Replacements for routines in t_lists.inc adds some
+'*
+'\******************************************************************************
+
+function hListDelete( aList() as string, iItemToDelete as integer ) as boolean
+
+ '///<h3>Delete one item from a list specified by index</h3>
+ '///<i>Prerequisite: Array compatible with those from t_lists.inc</i><br>
+ '///<i>About listfunctions: All listfunctions rely on a special type of
+ '///+ array. This can be string arrays and - in some cases - numeric
+ '///+ arrays. What makes the arrays unique is that the first item which
+ '///+ has the index 0 contains the number of items in the list to be used,
+ '///+ anything that is stored beyond this number is ignored. This has three
+ '///+ consequences: 1) all listfunctions that alter an array must update
+ '///+ the index stored in array(0) and 2) it is possible that the index
+ '///+ point beyond ubound of the array which will most likely cause a
+ '///+ runtime error. 3) Means that arrays may only have an upper boundary
+ '///+ declared, all loops must start with index array(1) and must end with
+ '///+ index array(val( array(0))</i><br>
+
+ const CFN = "hListDelete::"
+ const INDEX_CORRECTION = 1
+ dim iCurrentItem as integer ' Increment-Variable
+
+ if ( GVERBOSE ) then
+ printlog( CFN & "Removing: " & aList( iItemToDelete ) & " at pos " & iItemToDelete )
+ endif
+
+ ' Move all items down by one in the list beginning with the item after
+ ' iItemToDelete
+ for iCurrentItem = ( iItemToDelete + INDEX_CORRECTION ) to ListCount( aList() )
+ aList( iCurrentItem - INDEX_CORRECTION ) = aList( iCurrentItem )
+ next iCurrentItem
+
+ ' Delete the last entry, it is no longer used and it is duplicate to the item
+ ' at iListSizeOld-1 (iListSizeNew)
+ aList( iCurrentItem ) = ""
+ aList( 0 ) = iCurrentItem - INDEX_CORRECTION
+
+end function
+
+'*******************************************************************************
+
+function hListAppend( sNewString as string, aTargetList() as string ) as integer
+
+ '///<h3>Append an item to an existing list</h3>
+ '///<i>Prerequisite: Array compatible with those from t_lists.inc</i>
+ '///<i>About listfunctions: All listfunctions rely on a special type of
+ '///+ array. This can be string arrays and - in some cases - numeric
+ '///+ arrays. What makes the arrays unique is that the first item which
+ '///+ has the index 0 contains the number of items in the list to be used,
+ '///+ anything that is stored beyond this number is ignored. This has three
+ '///+ consequences: 1) all listfunctions that alter an array must update
+ '///+ the index stored in array(0) and 2) it is possible that the index
+ '///+ point beyond ubound of the array which will most likely cause a
+ '///+ runtime error. 3) Means that arrays may only have an upper boundary
+ '///+ declared, all loops must start with index array(1) and must end with
+ '///+ index array(val( array(0))</i><br>
+
+ const CFN = "hListAppend::"
+ const RC_ARRAY_TOO_SMALL = -1
+
+ dim iCurrentListSize as integer
+ dim iNewListSize as integer
+ dim iArraySize as integer
+ dim irc as integer
+
+ iCurrentListSize = val( aTargetList( 0 ) )
+ iNewListSize = iCurrentListSize + 1
+ iArraySize = ubound( aTargetList() )
+
+ if ( iNewListSize > iArraySize ) then
+ warnlog ( CFN & "Cannot append, array too small" )
+ printlog( CFN & "Array-Size.....: " & iArraySize )
+ printlog( CFN & "Requested index: " & iNewListSize )
+ hListAppend() = RC_ARRAY_TOO_SMALL
+ else
+ aTargetList( iNewListSize ) = sNewString
+ aTargetList( 0 ) = iNewListSize
+ hListAppend() = iNewListSize
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hManageComparisionList( sFileIn as string, sFileOut as string, sListOut() as string ) as integer
+
+ '///<h3>Function to create or compare a list to a reference</h3>
+ '///<i>Prerequisite: List of items to compare, input- and outputfilename</i><br>
+ '///<i>About listfunctions: All listfunctions rely on a special type of
+ '///+ array. This can be string arrays and - in some cases - numeric
+ '///+ arrays. What makes the arrays unique is that the first item which
+ '///+ has the index 0 contains the number of items in the list to be used,
+ '///+ anything that is stored beyond this number is ignored. This has three
+ '///+ consequences: 1) all listfunctions that alter an array must update
+ '///+ the index stored in array(0) and 2) it is possible that the index
+ '///+ point beyond ubound of the array which will most likely cause a
+ '///+ runtime error. 3) Means that arrays may only have an upper boundary
+ '///+ declared, all loops must start with index array(1) and must end with
+ '///+ index array(val( array(0))</i><br>
+ '///<u>BEWARE: This is a core function and used by many tests!<br>
+ '///Please read the inline documentation for further reference</u><br>
+ '///Function parameters:
+ '///<ol>
+ '///+<li>sFileIn = The file that contains the reference data</li>
+ '///+<li>sFileOut = The file new lists are written to in case of an error</li>
+ '///+<li>sListOut() = The list containing the newly retrieved data.</li>
+ '///</ol>
+ '///Description:
+ '///<ul>
+
+ const CFN = "hManageComparisionList::"
+
+ ' maximum lines per file. Currently this limit is determined by the help
+ ' tests which have up to 22000 entries + reseve.
+ const FILESIZE = 25000
+ const COMPARE_SUCCESS = 0
+ const ENCODING_UTF8 = "UTF8"
+
+ dim irc as integer
+ dim aReferenceList( FILESIZE ) as string
+
+ if ( GVERBOSE ) then printlog( CFN & "Reading: " & sFileIn )
+
+ ' Do not use hGetDataFileSection() as strings in some lists may begin with a
+ ' "#" which is interpreted as a comment by hGetDataFileSection()
+ listread( aReferenceList(), sFileIn, ENCODING_UTF8 )
+
+ ' Word of caution: If the number of new items equals the number of removed items
+ ' this function returns 0 -> success. This case is highly unlikely to ever happen
+ ' unless someone renames scripts.
+ irc = hListCompare( sListOut() , aReferenceList() )
+
+ '///+<li>In case the lists are not identical, write the new one to the local work directory</li>
+ if ( irc = COMPARE_SUCCESS ) then
+ printlog( CFN & "Comparision succeeded" )
+ hManageComparisionList() = COMPARE_SUCCESS
+ else
+ printlog( CFN & "The two compared lists differ. There are a number of possible reasons:" )
+ printlog( CFN & "- Installation requirements are not met (setup /a?, missing packages?)" )
+ printlog( CFN & "- Reference and actual UI-Content do not match: File an issue." )
+ printlog( CFN & "- The reference file does not exist: Follow steps below." )
+ printlog( CFN & "Verify and copy the file: " & sFileOut )
+ printlog( CFN & "to this location........: " & sFileIn )
+ printlog( CFN & "Check this file into the SCM or attach it to an issue" )
+ listwrite( sListOut(), sFileOut, ENCODING_UTF8 )
+ hManageComparisionList() = irc
+ endif
+
+ '///+<li>Return number of differences between the lists</li>
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hListCompare( aListOne() as String, aListTwo() as String ) as integer
+
+ const CFN = "hListcompare::"
+
+ '///<h3>Compare two lists with each other, where <b>list TWO</b> is the reference</h3>
+ '///<i>Prerequisites: Two lists compatible with listfunctions</i><br>
+ '///<i>About listfunctions: All listfunctions rely on a special type of
+ '///+ array. This can be string arrays and - in some cases - numeric
+ '///+ arrays. What makes the arrays unique is that the first item which
+ '///+ has the index 0 contains the number of items in the list to be used,
+ '///+ anything that is stored beyond this number is ignored. This has three
+ '///+ consequences: 1) all listfunctions that alter an array must update
+ '///+ the index stored in array(0) and 2) it is possible that the index
+ '///+ point beyond ubound of the array which will most likely cause a
+ '///+ runtime error. 3) Means that arrays may only have an upper boundary
+ '///+ declared, all loops must start with index array(1) and must end with
+ '///+ index array(val( array(0))</i><br>
+ '///<u>Duplicates gCompare2Lists but does not print warnlogs, evaluate returncode instead</u>
+ '///<ul>
+
+ dim aOneOnlyList( ubound( aListOne() ) ) as string
+ dim aTwoOnlyList( ubound( aListTwo() ) ) as string
+
+ dim iListOneIndex as integer
+ dim iListTwoIndex as integer
+
+ dim iTwoOnlyListSize as integer
+ dim iListOneSize as integer
+
+ dim bFound as boolean
+
+ '///+<li>Create a copy of list two so we do not change the original list</li>
+ ListCopy( aListTwo() , aTwoOnlyList() )
+
+ iTwoOnlyListSize = ListCount( aTwoOnlyList() )
+ iListOneSize = ListCount( aListOne() )
+
+
+ '///+<li>Step through each item in list one</li>
+ for iListOneIndex = 1 to iListOneSize
+
+ bFound = false
+
+ '///+<li>Compare it to each item in list two</li>
+ for iListTwoIndex = 1 to iTwoOnlyListSize
+
+ '///+<li>If the entries match, delete it from the TwoOnly list</li>
+ if ( aListOne( iListOneIndex ) = aTwoOnlyList( iListTwoIndex ) ) then
+
+ bFound = true
+ aTwoOnlyList( iListTwoIndex ) = aTwoOnlyList( iTwoOnlyListSize )
+ ' this breaks compatibility to listfunctions because the actual
+ ' number of items is out of sync with listcount
+ iTwoOnlyListSize = iTwoOnlyListSize -1
+ exit for
+
+ end if
+
+ next iListTwoIndex
+
+ '///+<li>If there is no match, the item exists in list one only -> copy</li>
+ if ( not bFound ) then hListAppend( aListOne( iListOneIndex ), aOneOnlyList() )
+
+ next iListOneIndex
+
+ ' restore compatibility to listfunctions so hListPrint() will not fail
+ aTwoOnlyList( 0 ) = iTwoOnlyListSize
+
+ '///+<li>List all items that exist in List One only</li>
+ if ( ListCount( aOneOnlyList() ) > 0 ) then
+ printlog( CFN & "Objects have been added to the list" )
+ hListPrint( aOneOnlyList() , "Items found in list ONE only (NEW)" )
+ hListCompare() = ListCount( aOneOnlyList() )
+ end if
+
+ '///+<li>List all items that exist in List Two only</li>
+ if ( ListCount( aTwoOnlyList() ) > 0 ) then
+ printlog( CFN & "Objects have been removed from the list" )
+ hListPrint( aTwoOnlyList() , "Items found in list TWO only (MISSING)" )
+ hListCompare() = ListCount( aTwoOnlyList() ) * -1
+ end if
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hListPrependString( aList() as string, cString as string ) as boolean
+
+ '///<h3>Insert a string infront of each item in a list</h3>
+ '///<i>Prerequisites: A list compatible with listfunctions</i><br>
+ '///<i>About listfunctions: All listfunctions rely on a special type of
+ '///+ array. This can be string arrays and - in some cases - numeric
+ '///+ arrays. What makes the arrays unique is that the first item which
+ '///+ has the index 0 contains the number of items in the list to be used,
+ '///+ anything that is stored beyond this number is ignored. This has three
+ '///+ consequences: 1) all listfunctions that alter an array must update
+ '///+ the index stored in array(0) and 2) it is possible that the index
+ '///+ point beyond ubound of the array which will most likely cause a
+ '///+ runtime error. 3) Means that arrays may only have an upper boundary
+ '///+ declared, all loops must start with index array(1) and must end with
+ '///+ index array(val( array(0))</i><br><br>
+ '///<i>Note that the function alters the input list. If the list contains
+ '///+ strings of the type &quot;MyString&quot; the items will be changed to
+ '///+ read &quot;Some Text : MyString&quot;</i><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>List (string)</li>
+ '///+<li>A text to be inserted infront of every item in the list</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>The returnvalue is currently undefined</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hListPrependString::"
+ dim iCurrentItem as integer
+
+ '///+<li>Cycle through the list and insert a text infront of each item</li>
+ for iCurrentItem = 1 to listcount( aList() )
+ aList( iCurrentItem ) = cString & " : " & aList( iCurrentItem )
+ next iCurrentItem
+
+ hListPrependString() = true
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hListAppendList( aBaseList() as string, aListToAppend() as string ) as integer
+
+ '///<h3>Append one list to another</h3>
+ '///<i>Prerequisites: A list compatible with listfunctions</i><br>
+ '///<i>About listfunctions: All listfunctions rely on a special type of
+ '///+ array. This can be string arrays and - in some cases - numeric
+ '///+ arrays. What makes the arrays unique is that the first item which
+ '///+ has the index 0 contains the number of items in the list to be used,
+ '///+ anything that is stored beyond this number is ignored. This has three
+ '///+ consequences: 1) all listfunctions that alter an array must update
+ '///+ the index stored in array(0) and 2) it is possible that the index
+ '///+ point beyond ubound of the array which will most likely cause a
+ '///+ runtime error. 3) Means that arrays may only have an upper boundary
+ '///+ declared, all loops must start with index array(1) and must end with
+ '///+ index array(val( array(0))</i><br><br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Target list (string)</li>
+ '///+<li>Source list (string)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Listsize (integer)</li>
+ '///<ul>
+ '///+<li>The size of the sum of both lists</li>
+ '///+<li>0 in case of error</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hListAppendList::"
+
+ dim iCurrentItem as integer
+ dim iNewSize as integer
+
+ '///+<li>Do some basic boundary checking</li>
+ if ( ubound( aBaseList() ) < _
+ ( listcount( aBaseList ) + listcount( aListToAppend() ) ) ) then
+ warnlog( CFN & "Base Array too small" )
+ iNewSize = 0
+ else
+
+ '///+<li>Append the list</li>
+ for iCurrentItem = 1 to listcount( aListToAppend() )
+
+ hListAppend( aBaseList() , aListToAppend( iCurrentItem ) )
+
+ next iCurrentItem
+
+ iNewSize = listcount( aBaseList() )
+
+ endif
+ '///</ul>
+
+end function
+
+
+'*******************************************************************************
+
+function hCountMatchesInList( acItemList() as string, cSearchTerm as string ) as integer
+
+
+ '///<h3>Find out how many times a string is found in a list</h3>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>List to be searched (String)</li>
+ '///<ul>
+ '///+<li>The list may not be empty</li>
+ '///+<li>Search begins at index 1</li>
+ '///</ul>
+
+ '///+<li>Expression to search for (String)</li>
+ '///<ul>
+ '///+<li>Only exact matches are counted</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Number of hits (Integer)</li>
+ '///<ul>
+ '///+<li>0: if no matches were found</li>
+ '///+<li>-1: Any error</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hCountMatchesInList::"
+ dim iHitCount as integer
+ dim iCurrentItem as integer
+
+ if ( GVERBOSE ) then printlog( CFN & "Begin with term: " & cSearchTerm )
+
+ for iCurrentItem = 1 to ListCount( acItemList() )
+ if ( GVERBOSE ) then printlog( acItemList( iCurrentItem ) )
+
+ if ( instr( acItemList( iCurrentItem ), cSearchTerm ) > 0 ) then
+ iHitCount = iHitCount + 1
+ endif
+ next iCurrentItem
+
+ if ( GVERBOSE ) then printlog( CFN & "Exit with result: " & iHitCount )
+ hCountMatchesInList() = iHitCount
+
+end function
+
+'*******************************************************************************
+
+function hListResultEvaluation( i_diffcount as integer, i_allowed_delta as integer ) as boolean
+
+ ' This function evaluates the outcome of hManageComaprisionList() or
+ ' hListCompare(). This extra step is done because in some cases the
+ ' program installations might differ slightly - in some CWS (when using the
+ ' archive) we can end up having a different set of import/export filters.
+ ' So the evaluation must allow for a specific number of mismatches which is
+ ' specified in i_allowed_delta.
+
+ hListResultEvaluation() = true
+
+ ' If lists are identical we return directly.
+ if ( i_diffcount = 0 ) then
+ printlog( "The lists are identical. Good" )
+ exit function
+ endif
+
+ ' if we have differences we need to have a closer look.
+ ' Note that the difference is optional.
+ if ( i_allowed_delta <> 0 ) then
+ if ( i_diffcount = i_allowed_delta ) then
+ printlog( "The lists have the allowed delta of " & i_allowed_delta )
+ exit function
+ endif
+ endif
+
+ warnlog( "The list check failed, please review the test." )
+ hListResultEvaluation() = false
+
+end function
diff --git a/testautomation/global/tools/includes/optional/t_locale_strings1.inc b/testautomation/global/tools/includes/optional/t_locale_strings1.inc
new file mode 100644
index 000000000000..29c4bcf3cb6b
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_locale_strings1.inc
@@ -0,0 +1,569 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/***********************************************************************
+'*
+'* owner : oliver.craemer@oracle.com
+'*
+'* short description : defining locale dependant strings
+'*
+'\***********************************************************************
+
+function fLocaleString (sReturn as string) as string
+
+'///The function fLocaleString should be used to concentrate all locale dependant strings
+'///+ in one file in order to minimize the workload for adapting a new language
+'///Here is a way how to get these strings out of OOo.
+'/// - "LocaleTableHeading" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleTableContents" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleNumber" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleText" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleCurrency" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleDate" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleTime" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocalePercent" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleScientific" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleFraction" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleBoolean" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleTable" : run testscript qa\qatesttool\writer\tools\w_get_locale_strings.bas
+'/// - "LocaleCurrencyValue" : enter 10 in a cell and format to currency
+'/// - "LocaleDateValue" : a valid ( for this locale) date format
+'/// - "LocaleDateOutput" : enter a valid date in a cell
+'/// - "LocaleTimeInput" : a valid timecode (e.g. 15:42)
+'/// - "LocaleTimeValue" : enter 15:42 in a cell
+'/// - "LocalePercentValue" : enter 14% in a cell
+'/// - "LocaleScientificValue" : enter 1e+008 in a cell
+'/// - "LocaleBooleanValue" : enter 1 in a cell and format to boolean value
+'/// - "LocaleLocaleSettings" : TOOLS-OPTIONS-LANGUAGE SETTINGS-Language
+'/// - "LocaleScriptType" : possible script types are "Western", "CJK" and "CTL"
+
+ Dim sLocaleTableHeading as string
+ Dim sLocaleTableContents as string
+ Dim sLocaleNumber as string
+ Dim sLocaleText as string
+ Dim sLocaleCurrency as string
+ Dim sLocaleDate as string
+ Dim sLocaleTime as string
+ Dim sLocalePercent as string
+ Dim sLocaleScientific as string
+ Dim sLocaleFraction as string
+ Dim sLocaleBoolean as string
+ Dim sLocaleTable as string
+ Dim sLocaleCurrencyValue as string
+ Dim sLocaleDateValue as string
+ Dim sLocaleDateOutput as string
+ Dim sLocaleTimeInput as string
+ Dim sLocaleTimeValue as string
+ Dim slocalePercentValue as string
+ Dim sLocaleScientificValue as string
+ Dim sLocaleBooleanValue as string
+ Dim sLocaleLocaleSettings as string
+ Dim sLocaleScriptType as string
+ Dim sLocaleNumFormLanEng as string
+ Dim sLocaleNumFormLanLith as string
+ Dim sLocaleNumFormLanDutch as string
+
+ select case iSprache
+ case 01 : sLocaleTableHeading = "Table Heading" ' English (USA)
+ sLocaleTableContents = "Table Contents"
+ sLocaleNumber = "Number"
+ sLocaleText = "Text"
+ sLocaleCurrency = "Currency"
+ sLocaleDate = "Date"
+ sLocaleTime = "Time"
+ sLocalePercent = "Percent"
+ sLocaleScientific = "Scientific"
+ sLocaleFraction = "Fraction"
+ sLocaleBoolean = "Boolean Value"
+ sLocaleTable = "Table"
+ sLocaleCurrencyValue = "$10.00"
+ sLocaleDateValue = "03/31/06"
+ sLocaleDateOutput = "03/31/06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "03:42:00 PM"
+ slocalePercentValue = "14.00%"
+ sLocaleScientificValue = "1.00E+008"
+ sLocaleBooleanValue = "TRUE"
+ sLocaleLocaleSettings = "English (USA)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "English (USA)"
+ sLocaleNumFormLanLith = "Lithuanian"
+ sLocaleNumFormLanDutch = "Dutch (Netherlands)"
+
+ case 03 : sLocaleTableHeading = "Cabeçalho da tabela" ' Portuguese
+ sLocaleTableContents = "Conteúdo da tabela"
+ sLocaleNumber = "Número"
+ sLocaleText = "Texto"
+ sLocaleCurrency = "Moeda"
+ sLocaleDate = "Data"
+ sLocaleTime = "Hora"
+ sLocalePercent = "Percentagem"
+ sLocaleScientific = "Científico"
+ sLocaleFraction = "Fracção"
+ sLocaleBoolean = "Valor logico"
+ sLocaleTable = "Tabela"
+ sLocaleCurrencyValue = "10,00 €"
+ sLocaleDateValue = "31-03-06"
+ sLocaleDateOutput = "31-03-06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "VERDADEIRO"
+ sLocaleLocaleSettings = "Português (Portugal)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Inglês (EUA)"
+ sLocaleNumFormLanLith = "Lituano"
+ sLocaleNumFormLanDutch = "Flamengo (Holanda)"
+
+ case 07 : sLocaleTableHeading = "Заголовок таблицы" ' Russian
+ sLocaleTableContents = "Содержимое таблицы"
+ sLocaleNumber = "Число"
+ sLocaleText = "Текст"
+ sLocaleCurrency = "Деньги"
+ sLocaleDate = "Дата"
+ sLocaleTime = "TВремя"
+ sLocalePercent = "Процент"
+ sLocaleScientific = "Наука"
+ sLocaleFraction = "Дробь"
+ sLocaleBoolean = "Логические значения"
+ sLocaleTable = "Таблица"
+ sLocaleCurrencyValue = "10,00руб."
+ sLocaleDateValue = "31.03.06"
+ sLocaleDateOutput = "31.03.06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "ИСТИНА"
+ sLocaleLocaleSettings = "Русский"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Английский (США)"
+ sLocaleNumFormLanLith = "Литовский"
+ sLocaleNumFormLanDutch = "Голландский (Нидерланды)"
+
+ case 31 : sLocaleTableHeading = "Tabelkop" ' Dutch
+ sLocaleTableContents = "Inhoud tabel"
+ sLocaleNumber = "Getal"
+ sLocaleText = "Tekst"
+ sLocaleCurrency = "Valuta"
+ sLocaleDate = "Datum"
+ sLocaleTime = "Tijd"
+ sLocalePercent = "Procent"
+ sLocaleScientific = "Wetenschappelijk"
+ sLocaleFraction = "Breuk"
+ sLocaleBoolean = "Logische waarde"
+ sLocaleTable = "Tabel"
+ sLocaleCurrencyValue = "€ 10,00"
+ sLocaleDateValue = "31-03-06"
+ sLocaleDateOutput = "31-03-06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "WAAR"
+ sLocaleLocaleSettings = "Nederlands (NL)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Engels (VS)"
+ sLocaleNumFormLanLith = "Litouws"
+ sLocaleNumFormLanDutch = "Nederlands (NL)"
+
+ case 33 : sLocaleTableHeading = "Titre de tableau" ' French
+ sLocaleTableContents = "Contenu de tableau"
+ sLocaleNumber = "Nombre"
+ sLocaleText = "Texte"
+ sLocaleCurrency = "Monétaire"
+ sLocaleDate = "Date"
+ sLocaleTime = "Heure"
+ sLocalePercent = "Pourcentage"
+ sLocaleScientific = "Scientifique"
+ sLocaleFraction = "Fraction"
+ sLocaleBoolean = "Valeur logique"
+ sLocaleTable = "Tableau"
+ sLocaleCurrencyValue = "10,00 €"
+ sLocaleDateValue = "31/03/06"
+ sLocaleDateOutput = "31/03/06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "VRAI"
+ sLocaleLocaleSettings = "Français (France)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Anglais (U.S.A.)"
+ sLocaleNumFormLanLith = "Lituanien"
+ sLocaleNumFormLanDutch = "Néerlandais (Pays-Bas)"
+
+ case 34 : sLocaleTableHeading = "Encabezado de la tabla" ' Spanish
+ sLocaleTableContents = "Contenido de la tabla"
+ sLocaleNumber = "Número"
+ sLocaleText = "Texto"
+ sLocaleCurrency = "Moneda"
+ sLocaleDate = "Fecha"
+ sLocaleTime = "Hora"
+ sLocalePercent = "Porcentaje"
+ sLocaleScientific = "Ciencia"
+ sLocaleFraction = "Fracción"
+ sLocaleBoolean = "Valor lógico"
+ sLocaleTable = "Tabla"
+ sLocaleCurrencyValue = "10,00 €"
+ sLocaleDateValue = "31/03/06"
+ sLocaleDateOutput = "31/03/06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "VERDADERO"
+ sLocaleLocaleSettings = "Español (España)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Inglés (Estados Unidos)"
+ sLocaleNumFormLanLith = "Lituano"
+ sLocaleNumFormLanDutch = "Holandés (Países Bajos)"
+
+ case 36 : sLocaleTableHeading = "Táblázatfejléc" ' Hungarian
+ sLocaleTableContents = "Táblázattartalom"
+ sLocaleNumber = "Szám"
+ sLocaleText = "Szöveg"
+ sLocaleCurrency = "Pénznem"
+ sLocaleDate = "Dátum"
+ sLocaleTime = "Idő"
+ sLocalePercent = "Százalék"
+ sLocaleScientific = "Tudományos"
+ sLocaleFraction = "Tört"
+ sLocaleBoolean = "Logikai érték"
+ sLocaleTable = "Táblázat"
+ sLocaleCurrencyValue = "10,00 Ft"
+ sLocaleDateValue = "06-03-31"
+ sLocaleDateOutput = "2006-03-31"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "IGAZ"
+ sLocaleLocaleSettings = "Magyar"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Angol (USA)"
+ sLocaleNumFormLanLith = "Litván"
+ sLocaleNumFormLanDutch = "Holland (Hollandia)"
+
+ case 39 : sLocaleTableHeading = "Intestazione tabella" ' Italian
+ sLocaleTableContents = "Contenuto tabella"
+ sLocaleNumber = "Numero"
+ sLocaleText = "Testo"
+ sLocaleCurrency = "Valuta"
+ sLocaleDate = "Data"
+ sLocaleTime = "Orario"
+ sLocalePercent = "Percentuale"
+ sLocaleScientific = "Scientifico"
+ sLocaleFraction = "Frazione"
+ sLocaleBoolean = "Valore booleano"
+ sLocaleTable = "Tabella"
+ sLocaleCurrencyValue = "€ 10,00"
+ sLocaleDateValue = "31/03/06"
+ sLocaleDateOutput = "31/03/06"
+ sLocaleTimeInput = "15.42"
+ sLocaleTimeValue = "15.42.00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "VERO"
+ sLocaleLocaleSettings = "Italiano (Italia)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Inglese (USA)"
+ sLocaleNumFormLanLith = "Lituano"
+ sLocaleNumFormLanDutch = "Olandese (Paesi Bassi)"
+
+ case 46 : sLocaleTableHeading = "Tabellöverskrift" ' Swedish
+ sLocaleTableContents = "Tabellinnehåll"
+ sLocaleNumber = "Tal"
+ sLocaleText = "Text"
+ sLocaleCurrency = "Valuta"
+ sLocaleDate = "Datum"
+ sLocaleTime = "Tid"
+ sLocalePercent = "Procent"
+ sLocaleScientific = "Vetenskap"
+ sLocaleFraction = "Bråk"
+ sLocaleBoolean = "Sannolikhet"
+ sLocaleTable = "Tabell"
+ sLocaleCurrencyValue = "10,00 kr"
+ sLocaleDateValue = "06-03-31"
+ sLocaleDateOutput = "06-03-31"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "SANT"
+ sLocaleLocaleSettings = "Svenska (Sverige)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Engelska (USA)"
+ sLocaleNumFormLanLith = "Litauiska"
+ sLocaleNumFormLanDutch = "Holländska (Nederländerna)"
+
+ case 48 : sLocaleTableHeading = "Nagłówek tabeli" ' Polish
+ sLocaleTableContents = "Zawartość tabeli"
+ sLocaleNumber = "Liczba"
+ sLocaleText = "Tekst"
+ sLocaleCurrency = "Waluta"
+ sLocaleDate = "Data"
+ sLocaleTime = "Godzina"
+ sLocalePercent = "Procent"
+ sLocaleScientific = "Naukowy"
+ sLocaleFraction = "Ułamek"
+ sLocaleBoolean = "Wartość logiczna"
+ sLocaleTable = "Tabela"
+ sLocaleCurrencyValue = "10,00 zł"
+ sLocaleDateValue = "2006-03-31"
+ sLocaleDateOutput = "2006-03-31"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "PRAWDA"
+ sLocaleLocaleSettings = "Polski"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Angielski (USA)"
+ sLocaleNumFormLanLith = "Litewski"
+ sLocaleNumFormLanDutch = "Holenderski (Holandia)"
+
+ case 49 : sLocaleTableHeading = "Tabellen Überschrift" ' German
+ sLocaleTableContents = "Tabellen Inhalt"
+ sLocaleNumber = "Zahl"
+ sLocaleText = "Text"
+ sLocaleCurrency = "Währung"
+ sLocaleDate = "Datum"
+ sLocaleTime = "Zeit"
+ sLocalePercent = "Prozent"
+ sLocaleScientific = "Wissenschaft"
+ sLocaleFraction = "Bruch"
+ sLocaleBoolean = "Wahrheitswert"
+ sLocaleTable = "Tabelle"
+ sLocaleCurrencyValue = "10,00 €"
+ sLocaleDateValue = "31.03.06"
+ sLocaleDateOutput = "31.03.06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "WAHR"
+ sLocaleLocaleSettings = "Deutsch (Deutschland)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Englisch (USA)"
+ sLocaleNumFormLanLith = "Litauisch"
+ sLocaleNumFormLanDutch = "Niederländisch (Niederlande)"
+
+ case 50 : sLocaleTableHeading = "Glava tabele" ' Slovenian
+ sLocaleTableContents = "Vsebina tabele"
+ sLocaleNumber = "Število"
+ sLocaleText = "Besedilo"
+ sLocaleCurrency = "Valuta"
+ sLocaleDate = "Datum"
+ sLocaleTime = "Čas"
+ sLocalePercent = "Odstotek"
+ sLocaleScientific = "Znanstveno"
+ sLocaleFraction = "Ulomek"
+ sLocaleBoolean = "Dvojiška vrednost"
+ sLocaleTable = "Tabela"
+ sLocaleCurrencyValue = "10,00 €"
+ sLocaleDateValue = "31.03.06"
+ sLocaleDateOutput = "31.03.06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "TRUE"
+ sLocaleLocaleSettings = "angleški (ZDA)"
+ sLocaleScriptType = "Zahodni"
+ sLocaleNumFormLanEng = "angleški (ZDA)"
+ sLocaleNumFormLanLith = "litovski"
+ sLocaleNumFormLanDutch = "nizozemski (Nizozemska)"
+
+ case 55 : sLocaleTableHeading = "Título da tabela" ' Brazil (Portuguese)
+ sLocaleTableContents = "Conteudo da table"
+ sLocaleNumber = "Número"
+ sLocaleText = "Texto"
+ sLocaleCurrency = "Moeda"
+ sLocaleDate = "Data"
+ sLocaleTime = "Hora"
+ sLocalePercent = "Porcentagem"
+ sLocaleScientific = "Científico"
+ sLocaleFraction = "Fração"
+ sLocaleBoolean = "Valor booleano"
+ sLocaleTable = "Tabela"
+ sLocaleCurrencyValue = "R$ 10,00"
+ sLocaleDateValue = "31/03/06"
+ sLocaleDateOutput = "31/03/06"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14,00%"
+ sLocaleScientificValue = "1,00E+008"
+ sLocaleBooleanValue = "VERDADEIRO"
+ sLocaleLocaleSettings = "Português (Brasil)"
+ sLocaleScriptType = "Western"
+ sLocaleNumFormLanEng = "Inglês (EUA)"
+ sLocaleNumFormLanLith = "Lituano"
+ sLocaleNumFormLanDutch = "Flamengo (Holanda)"
+
+ case 81 : sLocaleTableHeading = "表の見出し" ' Japanese
+ sLocaleTableContents = "表の内容"
+ sLocaleNumber = "数値"
+ sLocaleText = "テキスト"
+ sLocaleCurrency = "通貨"
+ sLocaleDate = "日付"
+ sLocaleTime = "時刻"
+ sLocalePercent = "パーセンテージ"
+ sLocaleScientific = "科学"
+ sLocaleFraction = "分数"
+ sLocaleBoolean = "論理値"
+ sLocaleTable = "表"
+ sLocaleCurrencyValue = "¥10"
+ sLocaleDateValue = "3月31日"
+ sLocaleDateOutput = "3月31日"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42"
+ slocalePercentValue = "14%"
+ sLocaleScientificValue = "1.00E+08"
+ sLocaleBooleanValue = "TRUE"
+ sLocaleLocaleSettings = "日本語"
+ sLocaleScriptType = "CJK"
+ sLocaleNumFormLanEng = "英語 (米国)"
+ sLocaleNumFormLanLith = "リトアニア語"
+ sLocaleNumFormLanDutch = "オランダ語 (オランダ)"
+
+ case 82 : sLocaleTableHeading = "표제목" ' Korean
+ sLocaleTableContents = "표 내용"
+ sLocaleNumber = "수"
+ sLocaleText = "텍스트"
+ sLocaleCurrency = "통화"
+ sLocaleDate = "날짜"
+ sLocaleTime = "시간"
+ sLocalePercent = "퍼센트"
+ sLocaleScientific = "과학"
+ sLocaleFraction = "분수"
+ sLocaleBoolean = "논리 값"
+ sLocaleTable = "표"
+ sLocaleCurrencyValue = "₩10"
+ sLocaleDateValue = "2006/3/31"
+ sLocaleDateOutput = "2006년 3월 31"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15시 42분 0초"
+ slocalePercentValue = "14%"
+ sLocaleScientificValue = "1.00E+08"
+ sLocaleBooleanValue = "참"
+ sLocaleLocaleSettings = "한국어(대한민국)"
+ sLocaleScriptType = "CJK"
+ sLocaleNumFormLanEng = "영어(미국)"
+ sLocaleNumFormLanLith = "리투아니아어"
+ sLocaleNumFormLanDutch = "네덜란드어(네덜란드)"
+
+ case 86 : sLocaleTableHeading = "表格标题" ' Chinese (simplified)
+ sLocaleTableContents = "表格内容"
+ sLocaleNumber = "数字"
+ sLocaleText = "文字"
+ sLocaleCurrency = "货币"
+ sLocaleDate = "日期"
+ sLocaleTime = "时间"
+ sLocalePercent = "百分比"
+ sLocaleScientific = "科学"
+ sLocaleFraction = "分数"
+ sLocaleBoolean = "逻辑值"
+ sLocaleTable = "表格"
+ sLocaleCurrencyValue = "¥10.00"
+ sLocaleDateValue = "2006/3/31"
+ sLocaleDateOutput = "06年3月31日"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14.00%"
+ sLocaleScientificValue = "1.00E+008"
+ sLocaleBooleanValue = "真"
+ sLocaleLocaleSettings = "中文(简体)"
+ sLocaleScriptType = "CJK"
+ sLocaleNumFormLanEng = "英语(美国)"
+ sLocaleNumFormLanLith = "立陶宛语"
+ sLocaleNumFormLanDutch = "荷兰语(荷兰)"
+
+ case 88 : sLocaleTableHeading = "表格標題" ' Chinese (traditional)
+ sLocaleTableContents = "表格內容"
+ sLocaleNumber = "数字"
+ sLocaleText = "文字"
+ sLocaleCurrency = "货币"
+ sLocaleDate = "日期"
+ sLocaleTime = "时间"
+ sLocalePercent = "百分比"
+ sLocaleScientific = "科学"
+ sLocaleFraction = "分数"
+ sLocaleBoolean = "逻辑值"
+ sLocaleTable = "表格"
+ sLocaleCurrencyValue = "NT$10.00"
+ sLocaleDateValue = "2006/3/31"
+ sLocaleDateOutput = "06/3/31"
+ sLocaleTimeInput = "15:42"
+ sLocaleTimeValue = "15:42:00"
+ slocalePercentValue = "14.00%"
+ sLocaleScientificValue = "1.00E+008"
+ sLocaleBooleanValue = "真"
+ sLocaleLocaleSettings = "中文 (繁體)"
+ sLocaleScriptType = "CJK"
+ sLocaleNumFormLanEng = "英文 (美國)"
+ sLocaleNumFormLanLith = "立陶宛文"
+ sLocaleNumFormLanDutch = "荷蘭文 (比利時)"
+
+ case else : ' Fallback
+ QAErrorLog "The test does not support language " +iSprache
+ fLocaleString = "Abortion"
+ exit function
+ end select
+
+ select case sReturn
+ case "LocaleTableHeading" : fLocaleString = slocaleTableHeading
+ case "LocaleTableContents" : fLocaleString = slocaleTableContents
+ case "LocaleNumber" : fLocaleString = sLocaleNumber
+ case "LocaleText" : fLocaleString = sLocaleText
+ case "LocaleCurrency" : fLocaleString = sLocaleCurrency
+ case "LocaleDate" : fLocaleString = sLocaleDate
+ case "LocaleTime" : fLocaleString = sLocaleTime
+ case "LocalePercent" : fLocaleString = sLocalePercent
+ case "LocaleScientific" : fLocaleString = sLocaleScientific
+ case "LocaleFraction" : fLocaleString = sLocaleFraction
+ case "LocaleBoolean" : fLocaleString = sLocaleBoolean
+ case "LocaleTable" : fLocaleString = sLocaleTable
+ case "LocaleCurrencyValue" : fLocaleString = sLocaleCurrencyValue
+ case "LocaleDateValue" : fLocaleString = sLocaleDateValue
+ case "LocaleDateOutput" : fLocaleString = sLocaleDateOutput
+ case "LocaleTimeInput" : fLocaleString = sLocaleTimeInput
+ case "LocaleTimeValue" : fLocaleString = sLocaleTimeValue
+ case "LocalePercentValue" : fLocaleString = slocalePercentValue
+ case "LocaleScientificValue" : fLocaleString = sLocaleScientificValue
+ case "LocaleBooleanValue" : fLocaleString = sLocaleBooleanValue
+ case "LocaleLocaleSettings" : fLocaleString = sLocaleLocaleSettings
+ case "LocaleScriptType" : fLocaleString = sLocaleScriptType
+ case "LocaleNumFormLanEng" : fLocaleString = sLocaleNumFormLanEng
+ case "LocaleNumFormLanLith" : fLocaleString = sLocaleNumFormLanLith
+ case "LocaleNumFormLanDutch" : fLocaleString = sLocaleNumFormLanDutch
+
+ case else : ' Fallback
+ QAErrorLog "String not available"
+ fLocaleString = "Abortion"
+ end select
+
+end function
diff --git a/testautomation/global/tools/includes/optional/t_locale_tools.inc b/testautomation/global/tools/includes/optional/t_locale_tools.inc
new file mode 100644
index 000000000000..75d18e2c5856
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_locale_tools.inc
@@ -0,0 +1,92 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/***********************************************************************
+'*
+'* owner : oliver.craemer@oracle.com
+'*
+'* short description : place it here
+'*
+'\***********************************************************************
+'*
+' #1 fThesaurusLocales 'Get locales which are supported by Thesaurus
+' #1 fSpellcheckerLocales 'Get locales which are supported by Spellchecker
+'*
+'\***********************************************************************
+
+function fThesaurusLocales as boolean
+'/// Gets the supported thesaurus locales from the API
+'/// Returns TRUE if iSprache is supported by Thesaurus
+'/// Returns FALSE if iSprache is not supported by Thesaurus
+
+ dim uno as object
+ dim linugServiceMgr as object
+ dim aAllLocales (256) as variant
+ dim sLocale as string
+ dim i as integer
+
+ fThesaurusLocales = FALSE
+ uno=hGetUnoService()
+ linugServiceMgr=uno.createInstance("com.sun.star.linguistic2.LinguServiceManager")
+ aAllLocales = linugServiceMgr.getThesaurus().getLocales()
+ for i = 0 to ubound( aAllLocales ())
+ sLocale = ( aAllLocales(i).Language & "-" & (aAllLocales(i).Country) )
+ printlog sLocale
+ if ConvertLanguage2 ( sLocale ) = iSprache then
+ fThesaurusLocales = TRUE
+ i = ubound( aAllLocales ())
+ endif
+ next i
+
+end function
+
+'-----------------------------------------------------------
+
+function fSpellcheckerLocales as boolean
+'/// Gets the supported spellchecker locales from the API
+'/// Returns TRUE if iSprache is supported by Spellchecker
+'/// Returns FALSE if iSprache is not supported by Spellchecker
+
+ dim uno as object
+ dim linugServiceMgr as object
+ dim aAllLocales (256) as variant
+ dim sLocale as string
+ dim i as integer
+
+ fSpellcheckerLocales = FALSE
+ uno=hGetUnoService()
+ linugServiceMgr=uno.createInstance("com.sun.star.linguistic2.LinguServiceManager")
+ aAllLocales = linugServiceMgr.getSpellchecker().getLocales()
+ for i = 0 to ubound( aAllLocales ())
+ sLocale = ( aAllLocales(i).Language & "-" & (aAllLocales(i).Country) )
+ printlog sLocale
+ if ConvertLanguage2 ( sLocale ) = iSprache then
+ fSpellcheckerLocales = TRUE
+ i = ubound( aAllLocales ())
+ endif
+ next i
+
+end function
+
diff --git a/testautomation/global/tools/includes/optional/t_macro_tools.inc b/testautomation/global/tools/includes/optional/t_macro_tools.inc
new file mode 100644
index 000000000000..c4b432135739
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_macro_tools.inc
@@ -0,0 +1,215 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+' **
+' ** owner : gregor.hartmann@oracle.com
+' **
+' ** short description : Helper functions for Macro tests
+' **
+'\******************************************************************************
+
+function hInsertMacroFromFile( cMacroId as string, optional cSource as string ) as integer
+
+ '///<h3>Paste a macro (taken from a file) to the basic IDE</h3>
+ '///<i>uses: framework/tools/input/macros.txt</i><br>
+ '///<i>Starting point: Basic IDE</i><br>
+ '///<u>Note</u>: Overwrites any existing macros in the current module<br>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Name (ID) of the macro to be inserted (string)</li>
+ '///<ul>
+ '///+<li>Allowed is any string that corresponds to a section in the source file</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Number of lines inserted (integer)</li>
+ '///<ul>
+ '///+<li>0: Error, no lines inserted</li>
+ '///+<li>&gt; 0: Number of lines</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hInsertMacroFromFile::"
+ const RETVAL_FAILURE = 0
+ const MAX_LINES_IN_MACRO_FILE = 10000
+
+ '///+<li>Find the path to the source file</li>
+ dim cFile as string
+ dim aInstructionList( MAX_LINES_IN_MACRO_FILE ) as string
+ dim iInstructionCount as integer
+ dim iCurrentInstruction as integer
+
+ if ( IsMissing( cSource ) ) then cFile = gTesttoolPath & "global/input/macros.txt"
+
+ '///+<li>retrieve the macro from the file with ID as section</li>
+ iInstructionCount = hGetDataFileSection( cFile, aInstructionList(), cMacroId, "", "" )
+
+ '///+<li>Delete all content from the BASIC IDE edit window</li>
+ '///+<li>Insert the code into the IDE line by line</li>
+ kontext "BasicIDE"
+ if ( EditWindow.exists() ) then
+ if ( hDeleteMacro() ) then
+ for iCurrentInstruction = 1 to iInstructionCount
+ EditWindow.TypeKeys( "<HOME>" )
+ EditWindow.TypeKeys( aInstructionList( iCurrentInstruction ) )
+ EditWindow.TypeKeys( "<RETURN>" )
+ next iCurrentInstruction
+ printlog( CFN & "Inserted macro: " & cMacroId )
+ hInsertMacroFromFile() = iInstructionCount
+ else
+ printlog( CFN & "IDE is not empty, will not insert macro" )
+ hInsertMacroFromFile() = RETVAL_FAILURE
+ endif
+ else
+ printlog( CFN & "Editwindow is not visible" )
+ hInsertMacroFromFile() = RETVAL_FAILURE
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hMacroOrganizerRunMacro( cMacroName as string ) as integer
+
+ ' Run a macro by name. Returnvalues as follows:
+ ' = 0: any error
+ ' > 0: position of macro in the list, success.
+
+ const CFN = "hMacroOrganizerRunMacro::"
+ const RETVAL_FAILURE = 0
+
+ dim iMacroPosition as integer
+
+ ToolsMacro_uno
+
+ kontext "Makro"
+ if ( Makro.exists( 2 ) ) then
+ hExpandAllNodes( MakroAus )
+ iMacroPosition = hSelectNodeByName( MakroAus, cMacroName )
+ if ( iMacroPosition ) then
+ iMacroPosition = hSelectNextNode( MakroAus )
+ if ( hClickButton( Ausfuehren ) ) then
+ hMacroOrganizerRunMacro() = iMacroPosition
+ else
+ ' run macro button not enabled
+ warnlog( CFN & "Unable to click <Run macro> button" )
+ hMacroOrganizerRunMacro() = RETVAL_FAILURE
+ endif
+ else
+ warnlog( CFN & "Macro was not found" )
+ hMacroOrganizerRunMacro() = RETVAL_FAILURE
+ endif
+ else
+ warnlog( CFN & "Failed to open Macro Organizer" )
+ hMacroOrganizerRunMacro() = RETVAL_FAILURE
+ endif
+
+
+end function
+
+'*******************************************************************************
+
+function hBasicIDERunMacro( cIdentifier as string ) as boolean
+
+ const CFN = "hBasicIDERunMacro(): "
+ const MAX_WAIT = 1
+ dim cMessage as string : cMessage = ""
+
+ kontext "BasicIDE"
+ if ( BasicIDE.exists() ) then
+
+ Wait( 2000 )
+
+ kontext "MacroBar"
+ if ( MacroBar.exists() ) then
+ BasicRun.click()
+ else
+ warnlog( "MacroBar not accessible" )
+ endif
+
+ kontext "Active"
+ if ( Active.exists( MAX_WAIT ) ) then
+ cMessage = Active.getText()
+ hCloseDialog( Active, "ok" )
+ endif
+
+ if ( cMessage = cIdentifier ) then
+ printlog( "The expected macro was executed" )
+ hBasicIDERunMacro() = true
+ else
+ printlog( CFN & "Incorrect macro executed" )
+ hBasicIDERunMacro() = false
+ endif
+ else
+ warnlog( CFN & "BasicIDE is not open" )
+ hBasicIDERunMacro() = false
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hExecMacro( cMacro as string ) as boolean
+
+ const CFN = "global::tools::includes::optional::t_macro_tools.inc::hExecMacro(): "
+
+ dim iCurrentModule as integer
+ dim iCurrentMacro as integer
+ hEXECMacro() = FALSE
+
+ ToolsMacro_uno
+
+ kontext "Makro"
+ if ( Makro.exists( 2 ) ) then
+ ' Iterate through the left treelist
+ for iCurrentModule = hExpandAllNodes( MakroAus ) to 1 step -1
+ MakroAus.select( iCurrentModule )
+ ' Iterate through the Macros list (right pane)
+ for iCurrentMacro = 1 to MakroListe.getItemCount()
+ MakroListe.select( iCurrentMacro )
+ ' Try to find the macro
+ if ( cMacro = MakroListe.getSelText() ) then
+ ' Run the macro
+ if ( Ausfuehren.isEnabled() ) then
+ Ausfuehren.click()
+ hExecMacro() = TRUE
+ exit function
+ else
+ warnlog( CFN & "Macro found but <Ausfuehren> is not enabled" )
+ exit function
+ endif
+ endif
+ next iCurrentMacro
+ next iCurrentModule
+ else
+ warnlog( CFN & "Macro Organizer is not open within 2 seconds" )
+ endif
+
+end function \ No newline at end of file
diff --git a/testautomation/global/tools/includes/optional/t_ole.inc b/testautomation/global/tools/includes/optional/t_ole.inc
new file mode 100644
index 000000000000..714d708fc4ee
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_ole.inc
@@ -0,0 +1,163 @@
+'encoding UTF-8 Do not remove or change this line!
+'*******************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/******************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Tools for OLE objects
+'*
+'\******************************************************************************
+
+function hGetOfficeVersion() as string
+
+ ' The "Insert OLE object" dialog lists the OLE Objects with application name
+ ' and version number. THe version numbers are tracked in the officeinfo.txt
+ ' file which must be adjusted each time we change to a new major version.
+
+ const CFN = "global::tools::includes::optional::t_ole.inc::hGetOfficeVersion(): "
+ const DATAFILE = "global/input/officeinfo.txt"
+ const MAX_LINES_IN_DATAFILE = 20
+
+ dim cPath as string
+ dim aItemList( MAX_LINES_IN_DATAFILE ) as string
+
+ ' Path to info file
+ cPath = convertpath( gTesttoolPath & DATAFILE )
+ if ( GVERBOSE ) then printlog( CFN & "Reading: " & cPath )
+
+ ' Read the file, store the list of known office versions
+ hGetDatafileSection( cPath, aItemList(), "", "", "" )
+
+ ' Search for the version number matching the product name, store value in global variable
+ gOfficeVersion = hGetValueForKeyAsString( aItemList(), gProductName )
+
+ ' Return content of the global variable as well
+ hGetOfficeVersion() = gOfficeVersion
+
+end function
+
+'*******************************************************************************
+
+function hGetOleObjectName( cApplication as string ) as string
+
+ ' for cApplication you may pass gApplication.
+
+ dim Application_API_Name as string
+ dim oUnoOfficeConnection as object
+ dim oUnoConfigurationAccess as object
+ dim aPropertyValue(1) as new com.sun.star.beans.PropertyValue
+ dim xViewRoot as object
+ dim cConfigString as string
+ dim cString as string
+
+ const CFN = "global::tools::includes::optional::t_ole.inc::hGetOleObjectName(): "
+
+ ' The application names for the API are case sensitive so we cannot use gApplication
+ select case ( ucase( cApplication ) )
+ case "WRITER" : Application_API_Name = "Writer"
+ case "CALC" : Application_API_Name = "Calc"
+ case "IMPRESS": Application_API_Name = "Impress"
+ case "DRAW" : Application_API_Name = "Draw"
+ case "MATH" : Application_API_Name = "Math"
+ case "CHART" : Application_API_Name = "Chart"
+ case else
+ warnlog( CFN & "Invalid object type passed to function: " & cApplication )
+ hGetOleObjectName() = ""
+ exit function
+ end select
+
+ if ( GVERBOSE ) then printlog( CFN & "Retrieving OLE name for: " & cApplication )
+
+ ' ...Embedding is physical path, ObjectNames the top node
+ aPropertyValue( 0 ).Name = "nodepath"
+ aPropertyValue( 0 ).Value = "/org.openoffice.Office.Embedding/ObjectNames/" & Application_API_Name
+
+ ' Connect to remote UNO
+ oUnoOfficeConnection = hGetUnoService( TRUE )
+
+ if ( isNull( oUnoOfficeConnection )) then
+ warnlog( CFN & "Failed to establish UNO connection, hGetUnoService failed" )
+ hGetOleObjectName() = ""
+ else
+ ' Get a configuration provider
+ oUnoConfigurationAccess = oUnoOfficeConnection.createInstance( "com.sun.star.configuration.ConfigurationProvider" )
+
+ ' Get access
+ xViewRoot = oUnoConfigurationAccess.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aPropertyValue() )
+ cConfigString = xViewRoot.getByName( "ObjectUIName" )
+
+ ' The string contains placeholders %PRODUCTNAME and %PRODUCTVERSION which have to be replaced
+ if ( gOfficeVersion = "" ) then
+ warnlog( CFN & "gOOoBaseVersion is empty, run hGetOfficeVersion() first" )
+ cString = right( cConfigString, len( cConfigString ) - 29 )
+ else
+ cString = gProductName & " " & gOfficeVersion & " " & right( cConfigString, len( cConfigString ) - 29 )
+ endif
+
+ endif
+
+ hGetOleObjectName() = cString
+
+end function
+
+'*******************************************************************************
+
+function GetOleDefaultNames()
+ dim sAllOle as string
+ dim j as integer
+
+ const CFN = "global::tools::includes::optional::t_ole.inc::GetOleDefaultNames(): "
+ if ( GVERBOSE ) then printlog( CFN & "Retrieving OLE names" )
+
+ hGetOfficeVersion()
+ gOLEWriter = hGetOleObjectName( "Writer" )
+ gOLECalc = hGetOleObjectName( "Calc" )
+ gOLEChart = hGetOleObjectName( "Chart" )
+ gOLEImpress = hGetOleObjectName( "Impress" )
+ gOLEDraw = hGetOleObjectName( "Draw" )
+ gOLEMath = hGetOleObjectName( "Math" )
+
+ ' There is no programatical way to retrieve the word for 'further objects'
+ ' Only way to get it language independent is to retrieve all other words and take the last other entry that lasts
+ ' Only available on windows platform
+ if ( gPlatgroup = "w95" ) then
+ sAllOle = gOLEWriter & gOLECalc & gOLEChart & gOLEImpress & gOLEDraw & gOLEMath
+ Call hNewDocument
+ InsertObjectOLEObject
+ Kontext "OLEObjektEinfuegen"
+ NeuErstellen.Check
+ WaitSlot()
+ for j=1 to ObjektTyp.GetItemCount
+ ObjektTyp.Select j
+ if 0 = instr (sAllOle, ObjektTyp.GetSelText ) then
+ gOleOthers = ObjektTyp.GetSelText
+ endif
+ next j
+ OLEObjektEinfuegen.cancel
+ hCloseDocument
+ endif
+end function
+
diff --git a/testautomation/global/tools/includes/optional/t_security_tools.inc b/testautomation/global/tools/includes/optional/t_security_tools.inc
new file mode 100644
index 000000000000..b86894a68eb1
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_security_tools.inc
@@ -0,0 +1,668 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Tools to ease testing of security related funtionality
+'*
+'\******************************************************************************
+
+function hSetPasswordRecommendation( bEnable as boolean ) as boolean
+
+ '///<h3>Toggle Tools/Options/OOo/Security: Password recommendation</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Mode (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: Switch password recommendation on</li>
+ '///+<li>FALSE: Switch password recommendation off</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Prior state (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: Password recommendation was on</li>
+ '///+<li>FALSE: Password recommendation was off</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hSetPasswordRecommendation::"
+
+ '///+<li>Open Tools/Options</li>
+ ToolsOptions
+
+ kontext "OptionenDlg"
+ if ( OptionenDlg.exists( 2 ) ) then
+
+ '///+<li>Go to the security page</li>
+ hToolsOptions( "STAROFFICE" , "SECURITY" )
+
+ '///+<li>Click on the &quot;Options...&quot; button</li>
+ kontext "TabSecurity"
+ if ( hClickButton( Options ) ) then
+
+ kontext "TabSecurityOptionsAndWarnings"
+ if ( TabSecurityOptionsAndWarnings.exists( 1 ) ) then
+
+ '///+<li>Retrieve the current setting for passwor recommendation</li>
+ if ( RecommendPasswordProtectionOnSaving.isChecked() ) then
+ hSetPasswordRecommendation() = true
+ else
+ hSetPasswordRecommendation() = false
+ endif
+
+ '///+<li>Set the requested state</li>
+ if ( bEnable ) then
+ printlog( CFN & "Enabled password recommendation" )
+ RecommendPasswordProtectionOnSaving.check()
+ else
+ printlog( CFN & "Disabled password recommendation" )
+ RecommendPasswordProtectionOnSaving.uncheck()
+ endif
+
+ hCloseDialog( TabSecurityOptionsAndWarnings, "ok" )
+
+ else
+ warnlog( "Failed to open security options page" )
+ hSetPasswordRecommendation() = false
+ endif
+
+ else
+ warnlog( CFN & "Unable to click options button" )
+ hSetPasswordRecommendation() = false
+ endif
+
+ '///+<li>Close Tools/Options</li>
+ Kontext "ToolsOptionsDlg"
+ hCloseDialog( ToolsOptionsDlg, "ok" )
+
+ else
+ warnlog( "Failed to open Tools/Options" )
+ endif
+ '///</ul>
+
+end function
+
+'******************************************************************************
+
+function hOpenDigitalSignaturesDialog() as boolean
+
+ '///<h3>Open the Digital Signatures Dialog via File-Menu</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: The Digital Signatures Dialog is open</li>
+ '///+<li>FALSE: The Digital Signatures Dialog is not open</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hOpenDigitalSignaturesDialog::"
+ const FILE_MENU_POSITION = 1
+ const SIGNATURES_MENU_POSITION_OTHER = 15
+ const SIGNATURES_MENU_POSITION_MATH = 14
+
+ hOpenDigitalSignaturesDialog() = false
+
+ '///+<li>Open the file-menu</li>
+ call hUseMenu()
+ call hMenuSelectNr( FILE_MENU_POSITION )
+
+ FileDigitalSignatures
+
+ ' At this stage either the digital signatures dialog or the messagebox
+ ' <The document needs to be saved> is open. In the latter case the function
+ ' returns false. The possibility that neither of both dialogs are open
+ ' must be handled in the parent function. This means there is no warning
+ ' here either
+
+ '///+<li>Verify that the Digital Signatures dialog is open</li>
+ kontext "DigitalSignature"
+ if ( DigitalSignature.exists() ) then
+ printlog( CFN & "Digital signatures is open" )
+ hOpenDigitalSignaturesDialog() = true
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hAllowMacroExecution() as boolean
+
+ '///<h3>Allow macro execution on Macro Security Warning dialog</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: Macro dialog is open, successfully clicked &quot;Run&quot;</li>
+ '///+<li>FALSE: Dialog was not opened</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hAllowMacroExecution::"
+ const MAX_WAIT_FOR_SECURITY_DIALOG = 5
+
+ '///+<li>Verify that the Macro security Warning is displayed</li>
+ kontext "SecurityWarning"
+ if ( SecurityWarning.exists( MAX_WAIT_FOR_SECURITY_DIALOG ) ) then
+
+ '///+<li>Click &quot;Run&quot; to allow macro execution</li>
+ printlog( CFN & "Allowing macro execution" )
+ hAllowMacroExecution() = hCloseDialog( SecurityWarning, "ok" )
+ else
+ printlog( CFN & "Macro dialog not displayed" )
+ hAllowMacroExecution() = false
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hDenyMacroExecution() as boolean
+
+ '///<h3>Deny macro execution on Macro Security Warning dialog</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: Macro dialog is open, successfully clicked &quot;Deny&quot;</li>
+ '///+<li>FALSE: Dialog was not opened</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hDenyMacroExecution::"
+
+ '///+<li>Verify that the Macro security Warning is displayed</li>
+ kontext "SecurityWarning"
+ if ( SecurityWarning.exists() ) then
+
+ '///+<li>Click &quot;Cancel&quot; to deny execution</li>
+ printlog( CFN & "Denied macro execution" )
+ hDenyMacroExecution() = hCloseDialog( SecurityWarning, "cancel" )
+ else
+ printlog( CFN & "Macro dialog not displayed" )
+ hDenyMacroExecution() = false
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hSwitchMacroSecurityTab( cTab as string )
+
+ '///<h3>Switch between Security Level and Trusted Paths</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>The Tabpage to be activated (string). Valid options are:</li>
+ '///<ul>
+ '///+<li>&quot;SecurityLevel&quot;</li>
+ '///+<li>&quot;TrustedPaths&quot;</li>
+ '///</ul>
+ '///</ol>
+
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Nothing</li>
+ '///</ol>
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ kontext
+
+ '///+<li>Switch to the given Tabpage</li>
+ select case ( lcase( cTab ) )
+ case "securitylevel" : active.setPage TabSecurityLevel
+ case "trustedpaths" : active.setPage TabTrustedSources
+ end select
+
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hAddTrustedPath( cPath as string ) as boolean
+
+ '///<h3>Add a directory to the list of trusted paths</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Fully qualified path to the directory (string)</li>
+ '///</ol>
+
+ '///<u>Return</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE = Path was successfully added</li>
+ '///+<li>FALSE = Failed to add the path</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hAddTrustedPath::"
+
+ dim iPathCount as integer
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ '///+<li>Open Tools/Options</li>
+ ToolsOptions
+
+ '///+<li>Switch to the Security page</li>
+ hToolsOptions( "StarOffice" , "Security" )
+
+ '///+<li>Click Macro Security</li>
+ hClickButton( MacroSecurity )
+
+ '///+<li>Switch to the Trusted Paths tab</li>
+ hSwitchMacroSecurityTab( "trustedpaths" )
+ kontext "TabTrustedSources"
+
+ '///+<li>Get the number of currently listed items from the list</li>
+ iPathCount = LocationsListBox.getItemCount()
+
+ '///+<li>Click the &quot;Add&quot; button</li>
+ hClickButton( LocationsAdd )
+
+ '///+<li>Enter a path to some files containing macros</li>
+ kontext "OeffnenDlg"
+ DateiName.setText( cPath )
+
+ '///+<li>Click &quot;Select&quot;</li>
+ hClickButton( Oeffnen )
+
+ '///+<li>Verify that the item has been added to the list</li>
+ kontext "TabTrustedSources"
+ if ( LocationsListBox.getItemCount() <> ( iPathCount + 1 ) ) then
+ warnlog( CFN & "Incorrect number of items in locations listbox" )
+ hAddTrustedPath() = false
+ else
+ printlog( "Added: " & cPath )
+ hAddTrustedPath() = true
+ endif
+
+ '///+<li>Close the dialog</li>
+ hCloseDialog( TabTrustedSources, "ok" )
+
+ '///+<li>Close Tools/Options</li>
+ Kontext "OptionenDlg"
+ hCloseDialog( OptionenDlg, "ok" )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hRemoveTrustedPath( cPath as string ) as boolean
+
+ '///<h3>Remove a directory from the list of trusted paths</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Fully qualified path to the directory (string)</li>
+ '///</ol>
+
+ '///<u>Return</u>:
+ '///<ol>
+ '///+<li>Errorcondition (boolean)</li>
+ '///<ul>
+ '///+<li>TRUE = Path was successfully added</li>
+ '///+<li>FALSE = Failed to add the path</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hRemoveTrustedPath()"
+
+ dim iPathCount as integer
+ dim iCurrentPathItem as integer
+
+ hRemoveTrustedPath() = false
+
+ '///<u>Description</u>:
+ '///<ul>
+
+ '///+<li>Open Tools/Options</li>
+ ToolsOptions
+
+ '///+<li>Switch to the Security page</li>
+ hToolsOptions( "StarOffice" , "Security" )
+
+ '///+<li>Click Macro Security</li>
+ hClickButton( MacroSecurity )
+
+ '///+<li>Switch to the Trusted Paths tab</li>
+ hSwitchMacroSecurityTab( "trustedpaths" )
+ kontext "TabTrustedSources"
+
+ if ( TabTrustedSources.exists() ) then
+
+ '///+<li>Get the number of currently listed items from the list</li>
+ iPathCount = LocationsListBox.getItemCount()
+
+ '///+<li>Find the entry in the list</li>
+ for iCurrentPathItem = 1 to iPathCount
+
+ '///+<li>If it is there, delete it</li>
+ LocationsListBox.select( iCurrentPathItem )
+ if ( LocationsListBox.getSelText() = cPath ) then
+ LocationsRemove.click()
+ printlog( CFN & "Removed item at pos. " & iCurrentPathItem )
+ hRemoveTrustedPath() = true
+ exit for
+ endif
+
+ next iCurrentPathItem
+
+ '///+<li>Close the dialog</li>
+ hCloseDialog( TabTrustedSources, "ok" )
+
+ else
+ warnlog( CFN & "Trusted Sources Tab did not open" )
+ hRemoveTrustedPath() = false
+ endif
+
+ '///+<li>Close Tools/Options</li>
+ Kontext "OptionenDlg"
+ hCloseDialog( OptionenDlg, "ok" )
+
+ '///</ul>
+
+end function
+
+
+'*******************************************************************************
+
+function hSecurityEnterPasswordOnSave( cPassword as string ) as boolean
+
+
+ '///<h3>Enter password when saving a document</h3>
+ '///<i>This function enters a password into the password dialog if the &quot;
+ '///+ Save with password&quot; checkbox is checked. It will automatically
+ '///+ generate a faulty password to be entered on first try (to see whether
+ '///+ the &quot;Invalid password confirmation&quot; dialog pops up, on second
+ '///+ attempt the password is confirmed correctly and thus the document should
+ '///+ save ok. The office should return to the document, the File Save dialog
+ '///+ should close after save.</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>Password to use (String)</li>
+ '///<ul>
+ '///+<li>Password should contain strange characters and glyphs if possible</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Errorcondition (Boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if all went well</li>
+ '///+<li>FALSE on any error</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hSecurityEnterPasswordOnSave::"
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Verify that the password dialog is present</li>
+ kontext "PasswordFileSave"
+ if ( PasswordFileSave.exists( 2 ) ) then
+
+ printlog( CFN & "Password dialog is displayed" )
+
+ '///+<li>Enter the password</li>
+ Password.setText( cPassword )
+
+ '///+<li>Confirm with incorrect password (e.g. append a number at random)</li>
+ PasswordConfirm.setText( cPassword & "1" )
+
+ '///+<li>Click on OK</li>
+ hCloseDialog( PasswordFileSave, "ok" )
+
+ '///+<li>There should be a warning about a faulty password confirmation</li>
+ kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ printlog( CFN & "Message: " & Active.getText() )
+
+ '///+<li>Close messagebox with OK</li>
+ Active.OK()
+ Active.notExists( 2 )
+ else
+ qaerrorlog( CFN & "Warning about faulty password confirmation is missing" )
+ hSecurityEnterPasswordOnSave() = false
+ endif
+
+ '///+<li>We should now be back on the password dialog</li>
+ kontext "PasswordFileSave"
+ if ( PasswordFileSave.exists() ) then
+
+ printlog( CFN & "Password dialog is displayed" )
+
+ '///+<li>Enter the password</li>
+ Password.setText( cPassword )
+
+ '///+<li>Confirm with correct password</li>
+ PasswordConfirm.setText( cPassword )
+
+ '///+<li>Click on OK</li>
+ hCloseDialog( PasswordFileSave, "ok" )
+ hSecurityEnterPasswordOnSave() = true
+
+ else
+
+ qaerrorlog( CFN & "The password dialog is missing after confirmation error" )
+ hSecurityEnterPasswordOnSave() = false
+
+ endif
+
+ else
+
+ qaerrorlog( CFN & "The password dialog did not open" )
+ hSecurityEnterPasswordOnSave() = false
+
+ endif
+
+ '///+<li>Verify that the &quot;File Save&quot; dialog is closed after saving</li>
+ kontext "SpeichernDlg"
+ if ( SpeichernDlg.exists() ) then
+ qaerrorlog( CFN & "File Save dialog is open, cancelling." )
+ SpeichernDlg.cancel()
+ hSecurityEnterPasswordOnSave() = false
+ endif
+ '///</ul>
+
+ if ( GVERBOSE ) then printlog( CFN & "Exit" )
+
+end function
+
+
+'*******************************************************************************
+
+function hSecurityEnterPasswordOnLoad( cPassword as string, bValid as boolean ) as boolean
+
+ '///<h3>Enter a password while loading a document</h3>
+ '///<i>Enters a valid or invalid password while loading a passworded file</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>Password (String)</li>
+ '///<ul>
+ '///+<li>The password should contain special characters and glyphs</li>
+ '///</ul>
+
+ '///+<li>Password validity (Boolean)</li>
+ '///<ul>
+ '///+<li>TRUE: The password is correct, the document should load</li>
+ '///+<li>FALSE: The password is incorrect, the document should not load</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Errorcondition (Boolean)</li>
+ '///<ul>
+ '///+<li>TRUE if the password protection worked as expected</li>
+ '///+<li>FALSE on any error</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hSecurityEnterPasswordOnLoad::"
+ if ( GVERBOSE ) then
+ printlog( CFN & "Enter with option (Password): " & cPassword )
+ printlog( CFN & "Enter with option (Validity): " & bValid )
+ endif
+
+ hSecurityEnterPasswordOnLoad() = true
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Verify that the password dialog exists</li>
+ kontext "PasswordFileOpen"
+ if ( PasswordFileOpen.exists( 3 ) ) then
+
+ '///+<li>Enter password, click OK</li>
+ PasswortName.setText( cPassword )
+ hCloseDialog( PasswordFileOpen, "ok" )
+
+ '///+<li>If the password was incorrect:</li>
+ '///<ul>
+ if ( not bValid ) then
+
+ '///+<li>Look for a warning message</li>
+ kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ printlog( CFN & "Message: " & Active.getText() )
+
+ '///+<li>Close the messagebox</li>
+ hCloseDialog( Active, "ok" )
+
+ '///+<li>Close the Password dialog with &quot;Cancel&quot;</li>
+ kontext "PasswordFileOpen"
+ if ( PasswordFileopen.exists( 2 ) ) then
+ hCloseDialog( PasswordFileOpen, "cancel" )
+ else
+ qaerrorlog( CFN & "Password dialog is not present" )
+ hSecurityEnterPasswordOnLoad() = false
+ endif
+ else
+ qaerrorlog( CFN & "Warning about incorrect password is missing" )
+ hSecurityEnterPasswordOnLoad() = false
+ endif
+
+ else
+ kontext "Active"
+ if ( Active.exists( 1 ) ) then
+ warnlog( CFN & "Unexpected messagebox: " & Active.getText() )
+ hSecurityEnterPasswordOnLoad() = false
+ endif
+ endif
+ '///</ul>
+
+ else
+ warnlog( CFN & "Password dialog is missing" )
+ hSecurityEnterPasswordOnLoad() = false
+ endif
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hSelectXMLSecTab( cTab as string ) as boolean
+
+ const CFN = "hSelectXMLSecTab::"
+ hSelectXMLSecTab() = false
+
+ kontext
+
+ select case ( ucase( cTab ) )
+ case "GENERAL" : active.setpage TabXMLSecGeneral
+ if ( TabXMLSecGeneral.exists() and TabXMLSecGeneral.isVisible() ) then
+ printlog( CFN & "Switched to General page" )
+ hSelectXMLSecTab() = true
+ exit function
+ endif
+
+ case "DETAILS" : active.setpage TabXMLSecDetails
+ if ( TabXMLSecDetails.exists() and TabXMLSecDetails.isVisible() ) then
+ printlog( CFN & "Switched to Details page" )
+ hSelectXMLSecTab() = true
+ exit function
+ endif
+
+ case "PATH" : active.setpage TabXMLSecCertPath
+ if ( TabXMLSecCertPath.exists() and TabXMLSecCertPath.isVisible() ) then
+ printlog( CFN & "Switched to Certification Path page" )
+ hSelectXMLSecTab() = true
+ exit function
+ endif
+ end select
+
+ warnlog( CFN & "Failed to switch XML Security Tabpage" )
+
+end function
+
diff --git a/testautomation/global/tools/includes/optional/t_set_standard_controls.inc b/testautomation/global/tools/includes/optional/t_set_standard_controls.inc
new file mode 100644
index 000000000000..fa31c04620e6
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_set_standard_controls.inc
@@ -0,0 +1,646 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : helge.delfs@oracle.com
+'*
+'* short description : Tool library for setting controls and verifying the functionality
+'*
+'**************************************************************************************************
+'*
+' #0 fSetListBoxByItem 'Function to select item in list box
+' #0 fSetListBoxByString 'Function to select item by string in list box
+' #0 fSetSpinFieldByString 'Function to set a string in a spin field control
+' #0 fSetSpinFieldByButton 'Function to set a spin field control by using 'more' or 'less' button
+' #0 fSetSpinFieldByLimit 'Function to set a spin field control to minimum or maximum value
+' #0 fSetComboBoxByItem 'Function to select item in combo box
+' #0 fSetComboBoxByString 'Function to select item in combo box
+' #0 fSetComboBoxByText 'Function to Edit Field part of a combo box
+' #0 fSetCheckBox 'Function to (un)check a check box
+' #0 fSetRadioButton 'Function to check a radio button
+' #0 fSetTextBox 'Function to set a textbox
+'*
+'\************************************************************************************************
+
+'///<u><b>Library for abtracted handling of several control types</b></u>
+'///+Note: This functions are designed to be called by wrapping functions
+'///+All functions are designed to return error codes depending on the behaviour of the action applied.
+'///<b>Return codes:</b>
+'///+<ul><li>Error 0: Success</li>
+'///+<li>Error 1: The basic action beeing applied caused a serious problem, e.g. a crash</li>
+'///+<li>Error 2 TO 9: A functional problem occurred.</li>
+'///+<li>Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible</li></ul>
+'/// NOTE: This errors can also be used for 'negative' testing.
+'///+<ul><li>Error 42: Wrong input. Probably only of interest during test development</li>
+'///+<li>Error 99: Unexpected behaviour - Shouldn't normally occur</li></ul>
+'///<b>ATTENTION:</b>
+'///+<ul><li>Only Errors 42 and 99 throw 'warnlogs'</li>
+'///+<li>All other errors are silent!</li>
+'///+<li>They only throw QAErrorlogs the give a hint what probably went wrong.</li>
+'///+<li>Expected Errors MUST exclusivly be handled by the calling routine!</li></ul>
+'///+<p><font size=-1><i>The idea and the first implementation of this library has been made by Peter Junge (pj at openoffice.org)</i></font></p>
+'
+'
+function fSetTextBox ( oThisTextBox as OBJECT , sThisText as STRING ) as INTEGER
+ fSetTextBox = 99
+'Function to set a text box
+'Input:
+'+OBJECT oThisTextBox (text box name in declaration)
+'+STRING sThisText (text to be set in text box control)
+' Return (Error-codes):
+'+0 = Sucess
+'+1 = Serious problem trying to set value
+'+2 = Value was not set
+'+11 = Text box is not visible
+'+12 = Text box is not enabled
+'+99 = Unexpected error
+
+ dim iIndex as INTEGER
+ dim iListLength as INTEGER
+ dim sResultInUI as STRING
+
+ sResultInUI = ""
+
+ printlog "Setting text in Text Box Edit field"
+ ' Check if desired Text box is visible
+ if NOT oThisTextBox.IsVisible then
+ QAErrorLog "Error 11: Text box is not visible"
+ fSetTextBox = 11
+ exit function
+ endif
+ ' Check if desired Text box is enabled
+ if NOT oThisTextBox.IsEnabled then
+ QAErrorLog "Error 12: Text box is not enabled"
+ fSetTextBox = 12
+ exit function
+ endif
+ ' Try to set text on Text Box
+ try
+ oThisTextBox.setText sThisText
+ catch
+ ' Throw error 1 and quit on serious problem
+ qaErrorLog "Error 1: Set text on Text box seems to cause a serious problem."
+ fSetTextBox = 1
+ exit function
+ endcatch
+ 'Verify (against input) if text was set correctly
+ sResultInUI = oThisTextBox.GetText
+ if sResultInUI = sThisText then
+ fSetTextBox = 0
+ printlog "Set '" & sThisText & "' in 'text box' control PASSED."
+ else
+ QAErrorLog "Error 2: Setting '" & sThisText & "' in 'text box' control failed!"
+ fSetTextBox = 2
+ endif
+
+ if fSetTextBox = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetListBoxByItem ( oThisListBox as OBJECT , iThisValue as INTEGER ) as INTEGER
+ fSetListBoxByItem = 99
+'Function to select item in list box
+'Input:
+'+OBJECT oThisListBox (list box name in declaration)
+'+INTEGER iThisValue (item number to be selected in list box control)
+'Return (Error-codes):
+'+0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+ 2 = Value was not set
+'+11 = List box is not visible
+'+12 = List box is not enabled
+'+13 = Item number to be selected out of list range
+'+99 = Unexpected error
+
+ dim iListLength as INTEGER
+ dim iResultFromUI as INTEGER
+
+ iResultFromUI = ""
+
+ printlog "Setting Item in list box"
+ 'Check if desired list box is visible
+ if NOT oThisListBox.IsVisible then
+ QAErrorLog "Error 11: List box is not visible"
+ fSetListBoxByItem = 11
+ exit function
+ endif
+ 'Check if desired list box is enabled
+ if NOT oThisListBox.IsEnabled then
+ QAErrorLog "Error 12: List box is not enabled"
+ fSetListBoxByItem = 12
+ exit function
+ endif
+ 'Check if input value is within list length
+ iListLength = oThisListBox.GetItemCount
+ if iThisValue < 1 OR iThisValue > iListLength then
+ QAErrorLog "Error 13: Item number out of list range"
+ fSetListBoxByItem = 13
+ exit function
+ endif
+ 'Try to set value in List Box
+ try
+ oThisListBox.select iThisValue
+ catch
+ 'Throw error 1 and quit on serious problem
+ QAErrorLog "Error 1: Set value on list box seems to cause a serious problem."
+ fSetListBoxByItem = 1
+ exit function
+ endcatch
+ 'Verify (against input) if item was set correctly
+ iResultFromUI = oThisListBox.GetSelIndex
+ if iResultFromUI = iThisValue then
+ fSetListBoxByItem = 0
+ printlog ">> Set value in list box seems to work"
+ else
+ QAErrorLog "Error 2: Set value in list box failed."
+ fSetListBoxByItem = 2
+ endif
+
+ if fSetListBoxByItem = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetListBoxByString ( oThisListBox as OBJECT , sThisString as STRING ) as INTEGER
+ fSetListBoxByString = 99
+'Function to select item by string in list box
+'Input:
+'+OBJECT oThisListBox (list box name in declaration)
+'+STRING sThisString (string trying to match in list box items)
+'Return(E rror-codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+ 2 = Value was not set
+'+11 = List box is not visible
+'+12 = List box is not enabled
+'+13 = String to be selected doesn't exist in list box
+'+99 = Unexpected error
+
+ dim iIndex as INTEGER
+ dim iListLength as INTEGER
+ dim bStringIsInList as BOOLEAN
+ dim sUIStringNow as STRING
+
+ bStringIsInList = FALSE
+ sUIStringNow = ""
+
+ printlog "** Setting Item in list box"
+ 'Check if desired list box is visible
+ if NOT oThisListBox.IsVisible then
+ qaErrorLog "Error 11: List box is not visible"
+ fSetListBoxByString = 11
+ exit function
+ endif
+ 'Check if desired list box is enabled
+ if NOT oThisListBox.IsEnabled then
+ qaErrorLog "Error 12: List box is not enabled"
+ fSetListBoxByString = 12
+ exit function
+ endif
+ 'Check if input value is existent in list entries
+ iListLength = oThisListBox.GetItemCount
+ for iIndex = 1 to iListLength
+ if oThisListBox.GetItemText ( iIndex ) = sThisString then
+ bStringIsInList = TRUE
+ endif
+ next iIndex
+ if bStringIsInList then
+ printlog "OK, String exists in list box"
+ else
+ qaErrorLog "Error 13: Input String not found in list entries"
+ fSetListBoxByString = 13
+ exit function
+ endif
+ 'Try to set value in List Box
+ try
+ oThisListBox.select sThisString
+ catch
+ 'Throw error 1 and quit on serious problem
+ qaErrorLog "Error 1: Set value on list box seems to cause a serious problem."
+ fSetListBoxByString = 1
+ exit function
+ endcatch
+ 'Verify (against input) if item was set correctly
+ sUIStringNow = oThisListBox.GetSelText
+ if sUIStringNow = sThisString then
+ fSetListBoxByString = 0
+ printlog "Setting value in list box is OK"
+ else
+ qaErrorLog "Error 2: Set value in list box failed."
+ fSetListBoxByString = 2
+ endif
+
+ if fSetListBoxByString = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetSpinFieldByString ( oThisSpinField as OBJECT , sThisString as STRING ) as INTEGER
+ fSetSpinFieldByString = 99
+'Function to set a string in a spin field control
+'Input:
+'+OBJECT oThisSpinField (spin field name in declaration)
+'+STRING sThisString (string to set in spin field control)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+11 = Spin field is not visible
+'+12 = Spin field is not enabled
+'+99 = Unexpected error
+
+ printlog "Setting value in spin field"
+ 'Check if desired spin field is visible
+ if NOT oThisSpinField.IsVisible then
+ qaErrorLog "Error 11: Spin field is not visible"
+ fSetSpinFieldByString = 11
+ exit function
+ endif
+ 'Check if desired spin field is enabled
+ if NOT oThisSpinField.IsEnabled then
+ qaErrorLog "Error 12: Spin field is not enabled"
+ fSetSpinFieldByString = 12
+ exit function
+ endif
+ 'Try to set value in spin field
+ try
+ oThisSpinField.setText sThisString
+ fSetSpinFieldByString = 0
+ catch
+ 'Throw error 1 and quit on serious problem
+ qaErrorLog "Error 1: Setting value on spin field seems to cause a serious problem."
+ fSetSpinFieldByString = 1
+ exit function
+ endcatch
+ if fSetSpinFieldByString = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetSpinFieldByButton ( oThisSpinField as OBJECT , sMoreOrLess as STRING , OPTIONAL iTimes as INTEGER ) as INTEGER
+ fSetSpinFieldByButton = 99
+'Function to set a spin field control by using More or Less button
+'Input:
+'+OBJECT oThisSpinField (spin field control name in declaration
+'+STRING sMoreOrLess has to be <i>more</i> or <i>less</i> (to click on 'More' or 'Less' button in spin field)
+'+<i>optional</i> INTEGER iTimes (How often to click if more than once)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+11 = Spin field is not visible
+'+12 = Spin field is not enabled
+'+42 = User error, input doesn't match
+'+99 = Unexpected error
+
+ 'toggle spin field as least once
+ if isMissing ( iTimes ) then
+ iTimes = 1
+ endif
+ printlog "Toggle value in spin field"
+ 'Check if desired spin field is visible
+ if NOT oThisSpinField.IsVisible then
+ qaErrorLog "Error 11: Spin field is not visible"
+ fSetSpinFieldByButton = 11
+ exit function
+ endif
+ 'Check if desired spin field is enabled
+ if NOT oThisSpinField.IsEnabled then
+ qaErrorLog "Error 12: Spin field is not enabled"
+ fSetSpinFieldByButton = 12
+ exit function
+ endif
+ 'Try to toggle value in spin field
+ try
+ select case lcase ( sMoreOrLess )
+ case "more" : oThisSpinField.more ( iTimes )
+ case "less" : oThisSpinField.less ( iTimes )
+ case else
+ fSetSpinFieldByButton = 42
+ warnlog "USER ERROR: Input doesn't match!"
+ exit function
+ end select
+ fSetSpinFieldByButton = 0
+ catch
+ 'Throw error 1 and quit on serious problem
+ qaErrorLog "Error 1: Try to toggle spin field seems to cause a serious problem."
+ fSetSpinFieldByButton = 1
+ exit function
+ endcatch
+ if fSetSpinFieldByButton = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetSpinFieldByLimit ( oThisSpinField as OBJECT , sMinOrMax as STRING ) as INTEGER
+ fSetSpinFieldByLimit = 99
+'Function to set a spin field control to minimum or maximum value
+'Input:
+'+OBJECT oThisSpinField (spin field name in declaration
+'+STRING sMinOrMax has to be <i>min</i> or <i>max</i> (to set spin field to minimum or maximum value)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+11 = Spin field is not visible
+'+12 = Spin field is not enabled
+'+42 = User error, input doesn't match
+'+99 = Unexpected error
+
+ printlog "Set spin field control to minimum or maximum value"
+ 'Check if desired spin field is visible
+ if NOT oThisSpinField.IsVisible then
+ qaErrorLog "Error 11: Spin field is not visible"
+ fSetSpinFieldByLimit = 11
+ exit function
+ endif
+ 'Check if desired spin field is enabled
+ if NOT oThisSpinField.IsEnabled then
+ qaErrorLog "Error 12: spin field is not enabled"
+ fSetSpinFieldByLimit = 12
+ exit function
+ endif
+ 'Try to set spin field to minimum or maximum value
+ try
+ select case lcase ( sMinOrMax )
+ case "max" : oThisSpinField.toMax
+ case "min" : oThisSpinField.toMin
+ case else
+ fSetSpinFieldByLimit = 42
+ warnlog "USER ERROR: Input doesn't match!"
+ exit function
+ end select
+ fSetSpinFieldByLimit = 0
+ catch
+ 'Throw error 1 and quit on serious problem
+ qaErrorLog "Error 1: Trying to set spin field to minimum or maximum value seems to cause a serious problem."
+ fSetSpinFieldByLimit = 1
+ exit function
+ endcatch
+ if fSetSpinFieldByLimit = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetComboBoxByItem ( oThisComboBox as OBJECT , iThisValue as INTEGER ) as INTEGER
+'This is an alias for 'fSetListBoxByItem'
+
+'Function to select item in combo box
+'Input:
+'+OBJECT oThisComboBox (combo box name in declaration)
+'+INTEGER iThisValue (item number to be selected in Combo box)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+ 2 = Value was not set
+'+11 = Combo box is not visible
+'+12 = Combo box is not enabled
+'+13 = Item number to be selected out of list range
+'+99 = Unexpected error
+ fSetComboBoxByItem = fSetListBoxByItem ( oThisComboBox , iThisValue )
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetComboBoxByString ( oThisComboBox as OBJECT , iThisString as STRING ) as INTEGER
+'This is an alias for 'fSetListBoxByString'
+'Function to select item in combo box
+'Input:
+'+OBJECT oThisComboBox (combo box name in declaration)
+'+STRING iThisString (string to be selected in combo box control)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+ 2 = Value was not set
+'+11 = Combo box is not visible
+'+12 = Combo box is not enabled
+'+13 = String to be selected doesn't exist in list box
+'+99 = Unexpected error
+ fSetComboBoxByString = fSetListBoxByString ( oThisComboBox , iThisString )
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetComboBoxByText ( oThisComboBox as OBJECT , sThisText as STRING , OPTIONAL bVerifyAgainstEntries as BOOLEAN ) as INTEGER
+ fSetComboBoxByText = 99
+'Function to Edit Field part of a combo box
+'Input:
+'+OBJECT oThisComboBox (combo box name in declaration)
+'+STRING sThisText (Text to be set in combo box edit field
+'+<i>optional</i> BOOLEAN bVerifyAgainstEntries (Check if setting the text succeeded)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to set value
+'+ 2 = Value was not set
+'+11 = Combo box is not visible
+'+12 = Combo box is not enabled
+'+13 = String to be selected doesn't exist in list box (if <i>optional</i> input parameter has been used)
+'+99 = Unexpected error
+
+ dim iIndex as INTEGER
+ dim iListLength as INTEGER
+ dim bStringIsInList as BOOLEAN
+ dim sStringinUI as STRING
+
+ bStringIsInList = FALSE
+ sStringinUI = ""
+
+ 'Only check Edit Field against list box if 'bVerifyAgainstEntries' is explizitly TRUE
+ if isMissing ( bVerifyAgainstEntries ) then
+ bVerifyAgainstEntries = FALSE
+ endif
+
+ printlog "Setting text in Combo Box Edit field"
+ 'Check if desired combo box is visible
+ if NOT oThisComboBox.IsVisible then
+ qaErrorLog "Error 11: Combo box is not visible"
+ fSetComboBoxByText = 11
+ exit function
+ endif
+ 'Check if desired combo box is enabled
+ if NOT oThisComboBox.IsEnabled then
+ qaErrorLog "Error 12: Combo box is not enabled"
+ fSetComboBoxByText = 12
+ exit function
+ endif
+ 'Check if input value is existent in list entries (optinal if desired)
+ if bVerifyAgainstEntries then
+ iListLength = oThisComboBox.GetItemCount
+ for iIndex = 1 to iListLength
+ if oThisComboBox.GetItemText ( iIndex ) = sThisText then
+ bStringIsInList = TRUE
+ endif
+ next iIndex
+ if bStringIsInList then
+ printlog "OK, string exists in list box control"
+ else
+ qaErrorLog "Error 13: Input string not found in list entries"
+ fSetComboBoxByText = 13
+ exit function
+ endif
+ endif
+ 'Trying to set text on combo box
+ try
+ oThisComboBox.setText sThisText
+ catch
+ 'Throw error 1 and quit on serious problem
+ qaErrorLog "Error 1: Set text in combo box seems to cause a serious problem."
+ fSetComboBoxByText = 1
+ exit function
+ endcatch
+ 'Verify (against input) if text was set correctly
+ sStringinUI = oThisComboBox.GetSelText
+ if sStringinUI = sThisText then
+ fSetComboBoxByText = 0
+ printlog "Setting text in Combo box works"
+ else
+ qaErrorLog "Error 2: Set text in Combo box failed."
+ fSetComboBoxByText = 2
+ endif
+
+ if fSetComboBoxByText = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetCheckBox ( oThisCheckBox as OBJECT , bCheck as BOOLEAN ) as INTEGER
+ fSetCheckBox = 99
+'Function to (un)check a check box
+'Input:
+'+OBJECT oThisCheckBox (check box name in declaration)
+'+BOOLEAN bCheck (check or uncheck the check box control)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to check the box
+'+ 2 = Box was not checked
+'+11 = Check box is not visible
+'+12 = Check box is not enabled
+'+99 = Unexpected error
+
+ printlog "Checking check box"
+ 'Check if desired check box is visible
+ if NOT oThisCheckBox.IsVisible then
+ qaErrorLog "Error 11: Check box is not visible"
+ fSetCheckBox = 11
+ exit function
+ endif
+ 'Check if desired check box is enabled
+ if NOT oThisCheckBox.IsEnabled then
+ qaErrorLog "Error 12: Check box is not enabled"
+ fSetCheckBox = 12
+ exit function
+ endif
+ 'Try to check check box control
+ try
+ if bCheck then
+ oThisCheckBox.Check
+ else
+ oThisCheckBox.Uncheck
+ endif
+ catch
+ 'Throw error 1 and quit on serious problem
+ if bCheck then
+ qaErrorLog "Error 1: Checking check box control cause into a serious problem."
+ else
+ qaErrorLog "Error 1: Unchecking check box control cause into a serious problem."
+ endif
+ fSetCheckBox = 1
+ exit function
+ endcatch
+ 'Verify (against input) if check box is checked
+ if oThisCheckBox.IsChecked = bCheck then
+ fSetCheckBox = 0
+ printlog "Check check box seems to work"
+ else
+ qaErrorLog "Error 2: Check check box failed."
+ fSetCheckBox = 2
+ endif
+ if fSetCheckBox = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+'
+'--------------------------------------------------------------------
+'
+function fSetRadioButton ( oThisRadioButton as OBJECT ) as INTEGER
+ fSetRadioButton = 99
+'Function to check a radio button
+'Input:
+'+OBJECT oThisRadioButton (radio button name in declaration)
+'Return (Error codes):
+'+ 0 = Sucess
+'+ 1 = Serious problem trying to check the radio button
+'+ 2 = Radio button was not checked
+'+11 = Radio button is not visible
+'+12 := Radio button is not enabled
+'+99 := Unexpected error
+ printlog "Checking radio button"
+ 'Check if desired radio button is visible
+ if NOT oThisRadioButton.IsVisible then
+ qaErrorLog "Error 11: Radio button is not visible"
+ fSetRadioButton = 11
+ exit function
+ endif
+ 'Check if desired radio button is enabled
+ if NOT oThisRadioButton.IsEnabled then
+ qaErrorLog "Error 12: Radio button is not enabled"
+ fSetRadioButton = 12
+ exit function
+ endif
+ 'Try to check Radio Button
+ try
+ oThisRadioButton.Check
+ catch
+ 'Throw error 1 and quit on serious problem
+ qaErrorLog "Error 1: Check radio button seems to cause a serious problem."
+ fSetRadioButton = 1
+ exit function
+ endcatch
+ 'Verify if radio button is checked
+ if oThisRadioButton.IsChecked = TRUE then
+ fSetRadioButton = 0
+ printlog "Check radio button seems to work"
+ else
+ qaErrorLog "Error 2: Check radio button failed."
+ fSetRadioButton = 2
+ endif
+ if fSetRadioButton = 99 then
+ warnlog "Error 99: Something unexpected happened!!"
+ endif
+end function
+
diff --git a/testautomation/global/tools/includes/optional/t_spreadsheet_tools1.inc b/testautomation/global/tools/includes/optional/t_spreadsheet_tools1.inc
new file mode 100644
index 000000000000..55da2fc1c9aa
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_spreadsheet_tools1.inc
@@ -0,0 +1,84 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/***********************************************************************
+'*
+'* owner : oliver.craemer@oracle.com
+'*
+'* short description : Global tools for spreadsheet
+'*
+'************************************************************************
+'*
+' #1 fGotoCell ' Set active cell in a spreadhseet to a defined cell adress
+'
+'*
+'\***********************************************************************
+
+function fGotoCell (sCelladdress as String) as integer
+'/// The function sets the active cell in a spreadsheet to a defined cell address.
+'/// Input: sCelladdress as String
+'/// Output: <ul><li>0 = active cell has changed successfully</li>
+'///+ <li>1 = active cell hasn't changed</li>
+
+ Dim sActualPlace as string
+
+ const CFN = "qa:qatesttool:global:tools:inc:t_spreadsheet_tools1.inc:fGotoCell: "
+
+ 'function will return 1 if something goes wrong
+ fGotoCell = 1
+ Kontext "RechenleisteCalc"
+ '/// If the spreadsheet <i>formula toolbar</i> isn't available make them
+ '/// + available with View / Toolbars / Formula Bar
+ if NOT RechenleisteCalc.Exists(1) then
+ ViewToolbarsFormulaBar
+ end if
+ try
+ Kontext "RechenleisteCalc"
+ sActualPlace = AktiverZellbereich.GetSelText
+ if UCase(sActualPlace) = UCase(sCelladdress) then
+ fGotocell = 0
+ exit function
+ else
+ sActualPlace = ""
+ '/// Type the cell address into the <i>name box</i>
+ AktiverZellbereich.SetText sCelladdress
+ '///+ and press RETURN
+ AktiverZellbereich.TypeKeys "<RETURN>"
+ sleep(1)
+ '/// If the <i>name box<i>' address has been changed to the expected
+ '///+ cell address the function was successfull.
+ sActualPlace = AktiverZellbereich.GetSelText
+ if UCase(sActualPlace) = UCase(sCelladdress) then
+ fGotocell = 0
+ else
+ warnlog CFN & "The cell address has not been changed!"
+ end if
+ end if
+ catch
+ warnlog CFN & "Something unexpected happened! The cell address has not been changed!"
+ fGotocell = 1
+ endcatch
+end function
+
diff --git a/testautomation/global/tools/includes/optional/t_stringtools.inc b/testautomation/global/tools/includes/optional/t_stringtools.inc
new file mode 100644
index 000000000000..6ffb2f467a1b
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_stringtools.inc
@@ -0,0 +1,355 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Functions for manipulation of strings
+'*
+'\******************************************************************************
+
+function hRemoveLineBreaks( cString as string ) as string
+
+ dim myString as string : myString = cString
+ myString = hStringReplaceChar( myString, CHR$(09), " " )
+ myString = hStringReplaceChar( myString, CHR$(13), " " )
+ myString = hStringReplaceChar( myString, CHR$(10), "" )
+ hRemoveLineBreaks() = myString
+
+end function
+
+'*******************************************************************************
+
+function hCompareSubStrings( cRef as string, cSub as string ) as integer
+
+ '///<h3>Find substring in a reference string</h3>
+ '///<i>Used to determine that we are on &quot;The first doc!&quot;</i><br><br>
+ '///<u>Parameter(s):</u>
+ '///<ol>
+ '///+<li>Term to search for (string)</li>
+ '///+<li>Term to be searched (string)</li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Errorcode (integer)</li>
+ '///<ul>
+ '///+<li>-1: Invalid parameter(s)</li>
+ '///+<li>0: Strings do not match</li>
+ '///+<li>1: Term is exact match</li>
+ '///+<li>2: Term is a substring</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hCompareSubStrings::"
+ const RETVAL_INVALID_PARAMETER = -1
+ const RETVAL_MATCH_NONE = 0
+ const RETVAL_MATCH_EXACT = 1
+ const RETVAL_MATCH_SUBSTRING = 2
+
+ '///+<li>Test function parameters</li>
+ if ( ( cRef = "" ) or ( cSub = "" ) ) then
+ warnlog( CFN & "invalid parameter(s): Empty string passed." )
+ hCompareSubStrings() = RETVAL_INVALID_PARAMETER
+ exit function
+ endif
+
+ dim irc as integer
+
+ '///+<li>Test if we have a substring</li>
+ if ( instr( cRef, cSub ) ) then
+ irc = RETVAL_MATCH_SUBSTRING
+ else
+ irc = RETVAL_MATCH_NONE
+ endif
+
+ '///+<li>Test if we have an exact match</li>
+ if ( irc = RETVAL_MATCH_SUBSTRING ) then
+ if ( ( cRef = cSub ) and ( len( cRef ) = len( cSub ) ) ) then
+ irc = RETVAL_MATCH_EXACT
+ endif
+ endif
+
+ if ( GVERBOSE ) then
+ select case irc
+ case RETVAL_MATCH_NONE : printlog( CFN & "No matching substring found" )
+ case RETVAL_MATCH_EXACT : printlog( CFN & "Strings are identical" )
+ case RETVAL_MATCH_SUBSTRING : printlog( CFN & "String is substring" )
+ end select
+ endif
+
+ hCompareSubStrings() = irc
+ '///</ul>
+
+end function
+
+'******************************************************************************
+
+function hGetDirTreeLevel( cFullPath as string ) as integer
+
+ '///<h3>Count the numbers of pathseparators in a path-string</h3>
+ '///<i>Used to find the level of current directory within the directory tree.<br>
+ '///+The function prints a warning when no pathseparators were found</i><br><br>
+ '///<u>Parameter(s):</u>
+ '///<ol>
+ '///+<li>Path (string) with <b>no trailing pathseparator</b></li>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Number of Pathseparators within the string (integer)</li>
+ '///<ul>
+ '///+<li>0 = failure</li>
+ '///+<li>&gt; 0 = level</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+ const CFN = "hGetDirTreeLevel::"
+
+ dim iCurrentChar as integer
+ dim cCurrentChar as string
+ dim iSeparatorCount as integer : iSeparatorCount = 0
+
+ '///+<li>Walk through the string</li>
+ '///<ul>
+ for iCurrentChar = 1 to len( cFullPath )
+
+ '///+<li>Get the next character</li>
+ cCurrentChar = mid( cFullPath , iCurrentChar , 1 )
+
+ '///+<li>If it is a separtator, increase the counter</li>
+ if ( cCurrentChar = gPathSigne ) then iSeparatorCount = iSeparatorCount + 1
+
+ next iCurrentChar
+ '///</ul>
+
+ '///+<li>Print a warning if no separators were found</li>
+ if ( iSeparatorCount = 0 ) then
+ warnlog( CFN & "Did not find any separators in given string: " & cFullPath )
+ endif
+ '///</ul>
+
+ hGetDirTreeLevel() = iSeparatorCount
+
+end function
+
+
+'*******************************************************************************
+
+function hGetStringFromStaticTextField( oControl as object ) as string
+
+ use "global\tools\includes\optional\t_accels.inc"
+
+ '///<h3>Get the string from a static textfield</h3>
+
+ '///<i>Static textfields like those in the document properties dialog are
+ '///+ in certain places designed in a way that the string can be selected
+ '///+ and copied to the clipboard. This has been introduced with SRC680m212
+ '///+ (9156). This function uses keyboard shortcuts for &quot;Select All&quot;
+ '///+ and &quot;Copy&quot; to get the string into the clipboard as .uno.Copy
+ '///+ is not enabled.</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>Name of the control (Object)</li>
+ '///<ul>
+ '///+<li>The object must exist in the current context</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Content of the field (String)</li>
+ '///<ul>
+ '///+<li>Blank if string is empty</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hGetStringFromStaticTextField::"
+ dim brc as boolean 'a multi purpose boolean returnvalue
+
+ dim cSelectAll as string
+ dim cCopy as string
+ dim cText as string
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Verify that the object exists</li>
+ '///+<li>Get the accelerator for SelectAll and Copy</li>
+ '///+<li>Execute SelectAll and Copy on control</li>
+ '///+<li>Get the string from the clipboard</li>
+ if ( oControl.exists() ) then
+ if ( oControl.isVisible() ) then
+ cSelectAll = hGetAccel( "SelectAll" )
+ cCopy = hGetAccel( "Copy" )
+
+ oControl.typeKeys( "<right>" )
+ oControl.typeKeys( cSelectAll )
+ oControl.typeKeys( cCopy )
+
+ cText = getClipboardText()
+ if ( GVERBOSE ) then printlog( CFN & "Exit with result: " & cText )
+ else
+ ctext = ""
+ warnlog( CFN & "Exit: Control exists but is not visible" )
+ endif
+ else
+ cText = ""
+ warnlog( CFN & "Exit: Control does not exist in this context" )
+ endif
+
+ '///</ul>
+
+ hGetStringFromStaticTextField() = cText
+
+end function
+
+
+'*******************************************************************************
+
+function hConvertStringToLong( cValue as string ) as long
+
+
+ '///<h3>Convert a stringvalue to long int</h3>
+
+ '///<i>The purpose of this function is to isolate the filesize from a string
+ '///+ of the type &quot;1.345 Bytes&quot; by removing the thousands-separator
+ '///+ and the trailing unit. The result is then a filesize as long integer
+ '///+ which then can be compared to the result from the BASIC function
+ '///+ FileLen( FileSpec )</i><br><br>
+
+ '///<u>Parameter(s):</u><br>
+ '///<ol>
+
+ '///+<li>String containing a long integer value (String)</li>
+ '///<ul>
+ '///+<li>No floating point values allowed</li>
+ '///+<li>Numeric value must be at the beginning of the string (no leading characters/spaces)</li>
+ '///+<li>Negative values are allowed</li>
+ '///+<li>Leading &quot;+&quot; is not allowed</li>
+ '///</ul>
+
+ '///</ol>
+
+
+ '///<u>Returns:</u><br>
+ '///<ol>
+ '///+<li>Value of the string as long integer (Long)</li>
+ '///<ul>
+ '///+<li>Thousands separator (. or ,) have been removed</li>
+ '///+<li>Decimal separators (though not allowed) have been removed</li>
+ '///</ul>
+ '///</ol>
+
+ const CFN = "hConvertStringToLong::"
+ const ONE_CHARACTER = 1
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter with option: " & cValue )
+
+ dim iLen as integer : iLen = len( cValue )
+
+ dim iChar as integer
+ dim cChar as string
+
+ dim cStringValue as string : cStringValue = ""
+
+ '///<u>Description:</u>
+ '///<ul>
+ '///+<li>Walk through the single chars of the string</li>
+ '///<ul>
+ for iChar = 1 to iLen
+
+ '///+<li>Get the current character</li>
+ cChar = mid( cValue , iChar , ONE_CHARACTER )
+
+ '///+<li>Copy valid characters to temporary string, drop invalid, exit on first space or other character</li>
+ select case cChar
+ case "-" : cStringValue = cStringValue & cChar
+ case "1" : cStringValue = cStringValue & cChar
+ case "2" : cStringValue = cStringValue & cChar
+ case "3" : cStringValue = cStringValue & cChar
+ case "4" : cStringValue = cStringValue & cChar
+ case "5" : cStringValue = cStringValue & cChar
+ case "6" : cStringValue = cStringValue & cChar
+ case "7" : cStringValue = cStringValue & cChar
+ case "8" : cStringValue = cStringValue & cChar
+ case "9" : cStringValue = cStringValue & cChar
+ case "0" : cStringValue = cStringValue & cChar
+ case else: ' do nothing
+ end select
+
+ next iChar
+ '///</ul>
+
+ if ( GVERBOSE ) then printlog( CFN & "Exit with value: " & cStringValue )
+
+ '///+<li>Convert string to long integer and return to calling function</li>
+ hConvertStringToLong() = val( cStringValue )
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hStringReplace( cString as string, search_string as string, replace_with as string ) as string
+
+ const CFN = "hStringReplace(): "
+
+ dim search_string_position as string
+ dim search_string_found as boolean : search_string_found = true
+ dim len_search_string as integer : len_search_string = len( search_string )
+ dim len_replace_with as integer : len_replace_with = len( replace_with )
+ dim myString as string : myString = cString
+
+ if ( GVERBOSE ) then printlog( CFN & "Replace all <" & search_string & "> with <" & replace_with & "> in <" & myString & ">" )
+
+ if ( not instr( replace_with, search_string ) and len_search_string >= len_replace_with ) then
+ do while( search_string_found )
+ search_string_position = instr( myString, search_string )
+ if ( search_string_position > 0 ) then
+ mid( myString, search_string_position, len( search_string ), replace_with )
+ else
+ search_string_found = false
+ endif
+ loop
+ else
+ warnlog( CFN & "Function used incorrectly" )
+ warnlog( CFN & "Replace all <" & search_string & "> with <" & replace_with & "> in <" & myString & ">" )
+ warnlog( CFN & "The new string must be of equal length or shorter than the string to be replaced" )
+ warnlog( CFN & "The new string may not contain the string to be replaced (e.g. replace 'a' with 'ha' is not allowed)" )
+ endif
+
+ if ( GVERBOSE ) then printlog( CFN & "Return string is <" & myString & ">" )
+ hStringReplace() = myString
+
+end function
diff --git a/testautomation/global/tools/includes/optional/t_toolbar_tools1.inc b/testautomation/global/tools/includes/optional/t_toolbar_tools1.inc
new file mode 100644
index 000000000000..77c72a9ec2dc
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_toolbar_tools1.inc
@@ -0,0 +1,418 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : helge.delfs@oracle.com
+'*
+'* short description : Toolbar tools 1
+'*
+'***************************************************************************************
+'*
+' #1 fActiveObjectInToolbar ' active/inactive image button in toolbar
+'*
+'\*************************************************************************************
+
+'******************************************************************
+'* Created by hercule.li@oracle.com
+'* This function will active or inactive image button in toolbar
+'* sToolbar : Toolbar name
+'* sObject : image button name
+'* bActive : Active or Inactive image button
+'* TRUE --> Active
+'* FALSE --> Inactive
+'* Will return the original status of the image button
+'*****************************************************************
+function fActiveObjectInToolbar(sToolbar as String , sObject as String , bActive as Boolean) as Boolean
+
+ Dim iObject as Integer
+ Dim sToolbarName as String
+ Dim sFlag as Boolean
+
+ sToolbarName = fGetToolbarName(sToolbar)
+ iObject = fGetObject(sToolbar , sObject)
+
+ ToolsCustomize
+ sleep 3
+ Kontext
+ Active.SetPage TabCustomizeToolbars
+ Kontext "TabCustomizeToolbars"
+ Menu.Select sToolbarName
+ Sleep 1
+ ToolbarContents.Typekeys "<Home>"
+ Sleep 1
+ if iObject-1 > 0 then
+ ToolbarContents.Typekeys "<Down>" , iObject-1
+ endif
+ sFlag = ToolbarContents.IsChecked
+ if bActive = TRUE then
+ if sFlag = FALSE then ToolbarContents.Check
+ else
+ ToolbarContents.UnCheck
+ endif
+ TabCustomizeToolbars.OK
+ fActiveObjectInToolbar = sFlag
+
+end function
+
+
+'******************************************
+'* This function will Get toolbar's name **
+'* Return Toolbar's name in StarOffice **
+'******************************************
+function fGetToolbarName(sToolbar) as String
+
+ Select case sToolbar
+ case "3D-Settings" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "3D-Settings"
+ case 33 : fGetToolbarName = "3D-Settings"
+ case 34 : fGetToolbarName = "3D-Settings"
+ case 39 : fGetToolbarName = "3D-Settings"
+ case 46 : fGetToolbarName = "3D-Settings"
+ case 49 : fGetToolbarName = "3D-Einstellungen"
+ case 50 : fGetToolbarName = "Nastavitve 3D"
+ case 55 : fGetToolbarName = "3D-Settings"
+ case 81 : fGetToolbarName = "3D-Settings"
+ case 82 : fGetToolbarName = "3D-Settings"
+ case 86 : fGetToolbarName = "3D-Settings"
+ case 88 : fGetToolbarName = "3D-Settings"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "3D-Settings"
+ end select
+
+ case "Align" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Align"
+ case 33 : fGetToolbarName = "Align"
+ case 34 : fGetToolbarName = "Align"
+ case 39 : fGetToolbarName = "Align"
+ case 46 : fGetToolbarName = "Align"
+ case 49 : fGetToolbarName = "Ausrichten"
+ case 50 : fGetToolbarName = "Poravnava"
+ case 55 : fGetToolbarName = "Align"
+ case 81 : fGetToolbarName = "Align"
+ case 82 : fGetToolbarName = "Align"
+ case 86 : fGetToolbarName = "Align"
+ case 88 : fGetToolbarName = "Align"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Align"
+ end select
+
+ case "Basic Shapes" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Basic Shapes"
+ case 33 : fGetToolbarName = "Basic Shapes"
+ case 34 : fGetToolbarName = "Basic Shapes"
+ case 39 : fGetToolbarName = "Basic Shapes"
+ case 46 : fGetToolbarName = "Basic Shapes"
+ case 49 : fGetToolbarName = "Standardformen"
+ case 50 : fGetToolbarName = "Osnovni liki"
+ case 55 : fGetToolbarName = "Basic Shapes"
+ case 81 : fGetToolbarName = "Basic Shapes"
+ case 82 : fGetToolbarName = "Basic Shapes"
+ case 86 : fGetToolbarName = "Basic Shapes"
+ case 88 : fGetToolbarName = "Basic Shapes"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Basic Shapes"
+ end select
+
+ case "Block Arrows" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Block Arrows"
+ case 33 : fGetToolbarName = "Block Arrows"
+ case 34 : fGetToolbarName = "Block Arrows"
+ case 39 : fGetToolbarName = "Block Arrows"
+ case 46 : fGetToolbarName = "Block Arrows"
+ case 49 : fGetToolbarName = "Blockpfeile"
+ case 50 : fGetToolbarName = "Votle puščice"
+ case 55 : fGetToolbarName = "Block Arrows"
+ case 81 : fGetToolbarName = "Block Arrows"
+ case 82 : fGetToolbarName = "Block Arrows"
+ case 86 : fGetToolbarName = "Block Arrows"
+ case 88 : fGetToolbarName = "Block Arrows"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Block Arrows"
+ end select
+
+ case "Bullets and Numbering" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Bullets and Numbering"
+ case 33 : fGetToolbarName = "Bullets and Numbering"
+ case 34 : fGetToolbarName = "Bullets and Numbering"
+ case 39 : fGetToolbarName = "Bullets and Numbering"
+ case 46 : fGetToolbarName = "Bullets and Numbering"
+ case 49 : fGetToolbarName = "Nummerierung und Aufzählungszeichen"
+ case 50 : fGetToolbarName = "Oznake in oštevilčevanje"
+ case 55 : fGetToolbarName = "Bullets and Numbering"
+ case 81 : fGetToolbarName = "Bullets and Numbering"
+ case 82 : fGetToolbarName = "Bullets and Numbering"
+ case 86 : fGetToolbarName = "Bullets and Numbering"
+ case 88 : fGetToolbarName = "Bullets and Numbering"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Bullets and Numbering"
+ end select
+
+ case "Database Form Design" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Database Form Design"
+ case 33 : fGetToolbarName = "Database Form Design"
+ case 34 : fGetToolbarName = "Database Form Design"
+ case 39 : fGetToolbarName = "Database Form Design"
+ case 46 : fGetToolbarName = "Database Form Design"
+ case 49 : fGetToolbarName = "Datenbank Formularentwurf"
+ case 50 : fGetToolbarName = "Oblikovanje obrazca zbirke podatkov"
+ case 55 : fGetToolbarName = "Database Form Design"
+ case 81 : fGetToolbarName = "Database Form Design"
+ case 82 : fGetToolbarName = "Database Form Design"
+ case 86 : fGetToolbarName = "Database Form Design"
+ case 88 : fGetToolbarName = "Database Form Design"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Database Form Design"
+ end select
+
+ case "Drawing" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Drawing"
+ case 33 : fGetToolbarName = "Drawing"
+ case 34 : fGetToolbarName = "Drawing"
+ case 39 : fGetToolbarName = "Drawing"
+ case 46 : fGetToolbarName = "Drawing"
+ case 49 : fGetToolbarName = "Zeichnen"
+ case 50 : fGetToolbarName = "Risba"
+ case 55 : fGetToolbarName = "Drawing"
+ case 81 : fGetToolbarName = "Drawing"
+ case 82 : fGetToolbarName = "Drawing"
+ case 86 : fGetToolbarName = "Drawing"
+ case 88 : fGetToolbarName = "Drawing"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Drawing"
+ end select
+
+ case "Drawing Object Properties" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Drawing Object Properties"
+ case 33 : fGetToolbarName = "Drawing Object Properties"
+ case 34 : fGetToolbarName = "Drawing Object Properties"
+ case 39 : fGetToolbarName = "Drawing Object Properties"
+ case 46 : fGetToolbarName = "Drawing Object Properties"
+ case 49 : fGetToolbarName = "Zeichnungsobjekt-Eigenschaften"
+ case 50 : fGetToolbarName = "Lastnosti risanega predmeta"
+ case 55 : fGetToolbarName = "Drawing Object Properties"
+ case 81 : fGetToolbarName = "Drawing Object Properties"
+ case 82 : fGetToolbarName = "Drawing Object Properties"
+ case 86 : fGetToolbarName = "Drawing Object Properties"
+ case 88 : fGetToolbarName = "Drawing Object Properties"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Drawing Object Properties"
+ end select
+
+ case "Form Design" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Form Design"
+ case 33 : fGetToolbarName = "Form Design"
+ case 34 : fGetToolbarName = "Form Design"
+ case 39 : fGetToolbarName = "Form Design"
+ case 46 : fGetToolbarName = "Form Design"
+ case 49 : fGetToolbarName = "Formular Entwurf"
+ case 50 : fGetToolbarName = "Oblikovanje obrazca"
+ case 55 : fGetToolbarName = "Form Design"
+ case 81 : fGetToolbarName = "Form Design"
+ case 82 : fGetToolbarName = "Form Design"
+ case 86 : fGetToolbarName = "Form Design"
+ case 88 : fGetToolbarName = "Form Design"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Form Design"
+ end select
+
+ case "Formatting" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Formatting"
+ case 33 : fGetToolbarName = "Formatting"
+ case 34 : fGetToolbarName = "Formatting"
+ case 39 : fGetToolbarName = "Formatting"
+ case 46 : fGetToolbarName = "Formatting"
+ case 49 : fGetToolbarName = "Format"
+ case 50 : fGetToolbarName = "Oblikovanje"
+ case 55 : fGetToolbarName = "Formatting"
+ case 81 : fGetToolbarName = "Formatting"
+ case 82 : fGetToolbarName = "Formatting"
+ case 86 : fGetToolbarName = "Formatting"
+ case 88 : fGetToolbarName = "Formatting"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Formatting"
+ end select
+
+ case "Frame" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Frame"
+ case 33 : fGetToolbarName = "Frame"
+ case 34 : fGetToolbarName = "Frame"
+ case 39 : fGetToolbarName = "Frame"
+ case 46 : fGetToolbarName = "Frame"
+ case 49 : fGetToolbarName = "Rahmen"
+ case 50 : fGetToolbarName = "Okvir"
+ case 55 : fGetToolbarName = "Frame"
+ case 81 : fGetToolbarName = "Frame"
+ case 82 : fGetToolbarName = "Frame"
+ case 86 : fGetToolbarName = "Frame"
+ case 88 : fGetToolbarName = "Frame"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Frame"
+ end select
+
+ case "Insert" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Insert"
+ case 33 : fGetToolbarName = "Insert"
+ case 34 : fGetToolbarName = "Insert"
+ case 39 : fGetToolbarName = "Insert"
+ case 46 : fGetToolbarName = "Insert"
+ case 49 : fGetToolbarName = "Einfügen"
+ case 50 : fGetToolbarName = "Vstavi"
+ case 55 : fGetToolbarName = "Insert"
+ case 81 : fGetToolbarName = "Insert"
+ case 82 : fGetToolbarName = "Insert"
+ case 86 : fGetToolbarName = "Insert"
+ case 88 : fGetToolbarName = "Insert"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Insert"
+ end select
+
+ case "OLE-Object" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "OLE-Object"
+ case 33 : fGetToolbarName = "OLE-Object"
+ case 34 : fGetToolbarName = "OLE-Object"
+ case 39 : fGetToolbarName = "OLE-Object"
+ case 46 : fGetToolbarName = "OLE-Object"
+ case 49 : fGetToolbarName = "OLE Objekt"
+ case 50 : fGetToolbarName = "Predmet OLE"
+ case 55 : fGetToolbarName = "OLE-Object"
+ case 81 : fGetToolbarName = "OLE-Object"
+ case 82 : fGetToolbarName = "OLE-Object"
+ case 86 : fGetToolbarName = "OLE-Object"
+ case 88 : fGetToolbarName = "OLE-Object"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "OLE-Object"
+ end select
+
+ case "Standard" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Standard"
+ case 33 : fGetToolbarName = "Standard"
+ case 34 : fGetToolbarName = "Standard"
+ case 39 : fGetToolbarName = "Standard"
+ case 46 : fGetToolbarName = "Standard"
+ case 49 : fGetToolbarName = "Standard"
+ case 50 : fGetToolbarName = "Standardno"
+ case 55 : fGetToolbarName = "Standard"
+ case 81 : fGetToolbarName = "Standard"
+ case 82 : fGetToolbarName = "Standard"
+ case 86 : fGetToolbarName = "Standard"
+ case 88 : fGetToolbarName = "Standard"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Standard"
+ end select
+
+ case "Table" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Table"
+ case 33 : fGetToolbarName = "Table"
+ case 34 : fGetToolbarName = "Table"
+ case 39 : fGetToolbarName = "Table"
+ case 46 : fGetToolbarName = "Table"
+ case 49 : fGetToolbarName = "Tabelle"
+ case 50 : fGetToolbarName = "Tabela"
+ case 55 : fGetToolbarName = "Table"
+ case 81 : fGetToolbarName = "Table"
+ case 82 : fGetToolbarName = "Table"
+ case 86 : fGetToolbarName = "Table"
+ case 88 : fGetToolbarName = "Table"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Table"
+ end select
+
+ case "Text Object" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "Text Object"
+ case 33 : fGetToolbarName = "Text Object"
+ case 34 : fGetToolbarName = "Text Object"
+ case 39 : fGetToolbarName = "Text Object"
+ case 46 : fGetToolbarName = "Text Object"
+ case 49 : fGetToolbarName = "Textobjekt"
+ case 50 : fGetToolbarName = "Besedilni predmet"
+ case 55 : fGetToolbarName = "Text Object"
+ case 81 : fGetToolbarName = "Text Object"
+ case 82 : fGetToolbarName = "Text Object"
+ case 86 : fGetToolbarName = "Text Object"
+ case 88 : fGetToolbarName = "Text Object"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "Text Object"
+ end select
+
+ case "XML Form Design" :
+ Select case iSprache
+ case 01 : fGetToolbarName = "XML Form Design"
+ case 33 : fGetToolbarName = "XML Form Design"
+ case 34 : fGetToolbarName = "XML Form Design"
+ case 39 : fGetToolbarName = "XML Form Design"
+ case 46 : fGetToolbarName = "XML Form Design"
+ case 49 : fGetToolbarName = "XML Formularentwurf"
+ case 50 : fGetToolbarName = "Oblikovanje obrazca XML"
+ case 55 : fGetToolbarName = "XML Form Design"
+ case 81 : fGetToolbarName = "XML Form Design"
+ case 82 : fGetToolbarName = "XML Form Design"
+ case 86 : fGetToolbarName = "XML Form Design"
+ case 88 : fGetToolbarName = "XML Form Design"
+ case else : QAErrorLog "The test does not support the language " + iSprache
+ fGetToolbarName = "XML Form Design"
+ end select
+
+ end select
+
+end function
+
+'*******************************************************
+'* This function will get the location for image button
+'* in Commands in Tools/Customize/Toolbars
+'*******************************************************
+function fGetObject(sToolbar as String , sObject as String) as Integer
+
+ select case gApplication
+
+ case "WRITER" : fGetObject = fGetObjectWriter(sToolbar , sObject)
+ case "HTML" : fGetObject = fGetObjectWriter(sToolbar , sObject)
+ case "MASTERDOCUMENT" : fGetObject = fGetObjectWriter(sToolbar , sObject)
+
+ case "CALC" : fGetObject = fGetObjectCalc(sToolbar , sObject)
+
+ case "IMPRESS" : fGetObject = fGetObjectImpress(sToolbar , sObject)
+
+ end select
+
+end function
+
+
diff --git a/testautomation/global/tools/includes/optional/t_toolbar_writer.inc b/testautomation/global/tools/includes/optional/t_toolbar_writer.inc
new file mode 100644
index 000000000000..892dbd09bb36
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_toolbar_writer.inc
@@ -0,0 +1,766 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : helge.delfs@oracle.com
+'*
+'* short description : Toolbar tools - Writer
+'*
+'***************************************************************************************
+'*
+' #0 fGetObjectWriter
+' #0 fGetObjectCalc
+'*
+'\*************************************************************************************
+
+'*******************************************************
+'* This function will get the location for image button
+'* in Commands in Tools/Customize/Toolbars from Writer
+'*******************************************************
+function fGetObjectWriter(sToolbar as String , sObject as String) as Integer
+
+ Select case sToolbar
+ case "3D-Settings"
+ Select case sObject
+ case "Extrusion On/Off" : fGetObjectWriter = 1
+ '----------------- 2
+ case "Tilt Down" : fGetObjectWriter = 3
+ case "Tilt Up" : fGetObjectWriter = 4
+ case "Tilt Left" : fGetObjectWriter = 5
+ case "Tilt Right" : fGetObjectWriter = 6
+ '----------------- 7
+ case "Depth" : fGetObjectWriter = 8
+ case "Direction" : fGetObjectWriter = 9
+ case "Lighting" : fGetObjectWriter = 10
+ case "Surfact" : fGetObjectWriter = 11
+ case "3D Color" : fGetObjectWriter = 12
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Align"
+ Select case sObject
+ case "Left" : fGetObjectWriter = 1
+ case "Centered" : fGetObjectWriter = 2
+ case "Right" : fGetObjectWriter = 3
+ case "Top" : fGetObjectWriter = 4
+ case "Center" : fGetObjectWriter = 5
+ case "Bottom" : fGetObjectWriter = 6
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Basic Shapes"
+ Select case sObject
+ case "Rectangle" : fGetObjectWriter = 1
+ case "Rectangle,Rounded" : fGetObjectWriter = 2
+ case "Square" : fGetObjectWriter = 3
+ case "Square,Rounded" : fGetObjectWriter = 4
+ case "Circle" : fGetObjectWriter = 5
+ case "Ellipse" : fGetObjectWriter = 6
+ '----------------- 7
+ case "Circle Pie" : fGetObjectWriter = 8
+ case "Isosceles Triangle" : fGetObjectWriter = 9
+ case "Right Triangle" : fGetObjectWriter = 10
+ case "Trapezoid" : fGetObjectWriter = 11
+ case "Diamond" : fGetObjectWriter = 12
+ case "Parallelogram" : fGetObjectWriter = 13
+ '----------------- 14
+ case "Regular Pentagon" : fGetObjectWriter = 15
+ case "Hexagon" : fGetObjectWriter = 16
+ case "Octagon" : fGetObjectWriter = 17
+ case "Cross" : fGetObjectWriter = 18
+ case "Ring" : fGetObjectWriter = 19
+ case "Block Arc" : fGetObjectWriter = 20
+ '----------------- 21
+ case "Cylinder" : fGetObjectWriter = 22
+ case "Cube" : fGetObjectWriter = 23
+ case "Rolded Corner" : fGetObjectWriter = 24
+ case "Rrame" : fGetObjectWriter = 25
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Block Arrows"
+ Select case sObject
+ end select
+
+ case "Bullets and Numbering"
+ Select case sObject
+ end select
+
+ case "Callouts"
+ Select case sObject
+ case "Rectanguar Callout" : fGetObjectWriter = 1
+ case "Rounded Rectanguar Callout" : fGetObjectWriter = 2
+ case "Round Callout" : fGetObjectWriter = 3
+ case "Cloud" : fGetObjectWriter = 4
+ case "Line Callout 1" : fGetObjectWriter = 5
+ case "Line Callout 2" : fGetObjectWriter = 6
+ case "Line Callout 3" : fGetObjectWriter = 7
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Color"
+ Select case sObject
+ case "Red" : fGetObjectWriter = 1
+ '----------------- 2
+ case "Green" : fGetObjectWriter = 3
+ '----------------- 4
+ case "Blue" : fGetObjectWriter = 5
+ '----------------- 6
+ case "Brightness" : fGetObjectWriter = 7
+ '----------------- 8
+ case "Contrast" : fGetObjectWriter = 9
+ '----------------- 10
+ case "Gamma" : fGetObjectWriter = 11
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Controls"
+ Select case sObject
+ end select
+
+ case "Database Controls"
+ Select case sObject
+ end select
+
+ case "Database Form Design"
+ Select case sObject
+ case "Change Anchor" : fGetObjectWriter = 12
+ case "Bring To Front" : fGetObjectWriter = 13
+ case "Send To Back" : fGetObjectWriter = 14
+ case "Group" : fGetObjectWriter = 15
+ case "UnGroup" : fGetObjectWriter = 18
+ case "Enter Group" : fGetObjectWriter = 19
+ case "Exit Group" : fGetObjectWriter = 20
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Drawing"
+ Select case sObject
+ case "Select" : fGetObjectWriter = 1
+ '----------------- 2
+ case "Line" : fGetObjectWriter = 3
+ case "Rectangle" : fGetObjectWriter = 4
+ case "Ellipse" : fGetObjectWriter = 5
+ case "Polygon" : fGetObjectWriter = 6
+ case "Curve" : fGetObjectWriter = 7
+ case "Freeform Line" : fGetObjectWriter = 8
+ case "Arc" : fGetObjectWriter = 9
+ case "Ellipse Pie" : fGetObjectWriter = 10
+ case "Circle Segment" : fGetObjectWriter = 11
+ case "Text" : fGetObjectWriter = 12
+ case "Vertical Text" : fGetObjectWriter = 13
+ case "Text Animation" : fGetObjectWriter = 14
+ case "Callouts" : fGetObjectWriter = 13
+ case "Vertical Callouts" : fGetObjectWriter = 14
+ '----------------- 15
+ case "Basic Shapes" : fGetObjectWriter = 16
+ case "Symbol Shapes" : fGetObjectWriter = 17
+ case "Block Arrows" : fGetObjectWriter = 18
+ case "Flowcharts" : fGetObjectWriter = 19
+ case "Callouts2" : fGetObjectWriter = 20
+ case "Stars" : fGetObjectWriter = 21
+ '----------------- 22
+ case "Points" : fGetObjectWriter = 23
+ '----------------- 24
+ case "Fontwork Gallery" : fGetObjectWriter = 25
+ case "Insert Graphics" : fGetObjectWriter = 26
+ '----------------- 27
+ case "Extrusion On/Off" : fGetObjectWriter = 28
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Drawing Object Properties"
+ Select case sObject
+ case "Line" : fGetObjectWriter = 1
+ case "Arrow Style" : fGetObjectWriter = 2
+ '----------------- 3
+ case "Line Style" : fGetObjectWriter = 4
+ '----------------- 5
+ case "Line Width" : fGetObjectWriter = 6
+ '----------------- 7
+ case "Line Color" : fGetObjectWriter = 8
+ '----------------- 9
+ case "Area" : fGetObjectWriter = 10
+ '----------------- 11
+ case "Area Style/Filling" : fGetObjectWriter = 12
+ '----------------- 13
+ case "Object rotation mode" : fGetObjectWriter = 14
+ case "Display Grid" : fGetObjectWriter = 15
+ case "Snap to Grid" : fGetObjectWriter = 16
+ case "Guides When Moving" : fGetObjectWriter = 17
+ '----------------- 18
+ case "Wrap Off" : fGetObjectWriter = 19
+ case "Page Wrap" : fGetObjectWriter = 20
+ case "Optimal Page Wrap" : fGetObjectWriter = 21
+ case "Wrap Left" : fGetObjectWriter = 22
+ case "Wrap Right" : fGetObjectWriter = 23
+ case "Wrap Through" : fGetObjectWriter = 24
+ case "Contour" : fGetObjectWriter = 25
+ '----------------- 26
+ case "To Foreground" : fGetObjectWriter = 27
+ case "To Background" : fGetObjectWriter = 28
+ case "Bring to Front" : fGetObjectWriter = 29
+ case "Send to Back" : fGetObjectWriter = 30
+ case "Alignment" : fGetObjectWriter = 31
+ '----------------- 32
+ case "Change Anchor" : fGetObjectWriter = 33
+ '----------------- 34
+ case "Ungroup" : fGetObjectWriter = 35
+ case "Group" : fGetObjectWriter = 36
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Edit Points"
+ Select case sObject
+ end select
+
+ case "Flowchart"
+ Select case sObject
+ end select
+
+ case "Fontwork"
+ Select case sObject
+ case "Fontwork Gallery" : fGetObjectWriter = 1
+ '----------------- 2
+ case "Fontwork Shape" : fGetObjectWriter = 3
+ case "Fontwork Same Letter Heights" : fGetObjectWriter = 4
+ '----------------- 5
+ case "Fontwork Alignment" : fGetObjectWriter = 6
+ case "Fontwork Character Spacing" : fGetObjectWriter = 7
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Fontwork Shape"
+ Select case sObject
+ end select
+
+ case "Form Design"
+ Select case sObject
+ case "Bring to Front" : fGetObjectWriter = 14
+ case "Send to Back" : fGetObjectWriter = 15
+ case "Group" : fGetObjectWriter = 17
+ case "UnGroup" : fGetObjectWriter = 18
+ case "Enter Group" : fGetObjectWriter = 19
+ case "Exit Group" : fGetObjectWriter = 20
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Form Filter"
+ Select case sObject
+ case "Apply Form-Based Filter" : fGetObjectWriter = 1
+ case "Filter Navigation" : fGetObjectWriter = 2
+ '----------------- 3
+ case "Close" : fGetObjectWriter = 4
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Form Navigation"
+ Select case sObject
+ end select
+
+ case "Form Object"
+ Select case sObject
+ end select
+
+ case "Formatting"
+ Select case sObject
+ case "Sytles and Formatting" : fGetObjectWriter = 1
+ '----------------- 2
+ case "Apply Style" : fGetObjectWriter = 3
+ '----------------- 4
+ case "Font Name" : fGetObjectWriter = 5
+ '----------------- 6
+ case "Font Size" : fGetObjectWriter = 7
+ '----------------- 8
+ case "Bold" : fGetObjectWriter = 9
+ case "Italic" : fGetObjectWriter = 10
+ case "Underline" : fGetObjectWriter = 11
+ case "Superscript" : fGetObjectWriter = 12
+ case "Subscript" : fGetObjectWriter = 13
+ '----------------- 14
+ case "Align Left" : fGetObjectWriter = 15
+ case "Centered" : fGetObjectWriter = 16
+ case "Align Right" : fGetObjectWriter = 17
+ case "Justfied" : fGetObjectWriter = 18
+ '----------------- 19
+ case "Left-To-Right" : fGetObjectWriter = 20
+ case "Right-To-Left" : fGetObjectWriter = 21
+ '----------------- 22
+ case "Line Spacing 1" : fGetObjectWriter = 23
+ case "Line Spacing 1.5" : fGetObjectWriter = 24
+ case "Line Spacing 2" : fGetObjectWriter = 25
+ '----------------- 26
+ case "Numbering Of/Off" : fGetObjectWriter = 27
+ case "Bullets Of/Off" : fGetObjectWriter = 28
+ case "Decrease Indent" : fGetObjectWriter = 29
+ case "Increase Indent" : fGetObjectWriter = 30
+ case "Increase Font" : fGetObjectWriter = 31
+ case "Reduce Font" : fGetObjectWriter = 32
+ '----------------- 33
+ case "Font Color" : fGetObjectWriter = 34
+ case "Highlighting" : fGetObjectWriter = 35
+ case "Background Color" : fGetObjectWriter = 36
+ '----------------- 37
+ case "Select All" : fGetObjectWriter = 38
+ case "Character" : fGetObjectWriter = 39
+ case "Paragraph" : fGetObjectWriter = 40
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Frame"
+ Select case sObject
+ case "Optimal Page Wrap" : fGetObjectWriter = 5
+ case "Wrap Left" : fGetObjectWriter = 6
+ case "Wrap Right" : fGetObjectWriter = 7
+ case "Wrap Through" : fGetObjectWriter = 8
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Full Screen"
+ Select case sObject
+ end select
+
+ case "Graphic Filter"
+ Select case sObject
+ end select
+
+ case "Insert"
+ Select case sObject
+ case "Chart" : fGetObjectWriter = 18
+ case "Insert Object" : fGetObjectWriter = 19
+ case "Controls" : fGetObjectWriter = 20
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Insert Object"
+ Select case sObject
+ end select
+
+ case "Media Playback"
+ Select case sObject
+ end select
+
+ case "More Controls"
+ Select case sObject
+ end select
+
+ case "More Database Controls"
+ Select case sObject
+ end select
+
+ case "More XML Form Controls"
+ Select case sObject
+ end select
+
+ case "OLE-Object"
+ Select case sObject
+ case "Wrap Left" : fGetObjectWriter = 11
+ case "Wrap Right" : fGetObjectWriter = 12
+ case "Optimal Page Wrap" : fGetObjectWriter = 16
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Optimize"
+ Select case sObject
+ end select
+
+ case "Page Preview"
+ Select case sObject
+ end select
+
+ case "Picture"
+ Select case sObject
+ end select
+
+ case "Standard"
+ Select case sObject
+ case "Load URL" : fGetObjectWriter = 1
+ case "New" : fGetObjectWriter = 2
+ case "New Document From Template" : fGetObjectWriter = 3
+ case "Open" : fGetObjectWriter = 4
+ case "Save" : fGetObjectWriter = 5
+ case "Save As" : fGetObjectWriter = 6
+ case "Document as E-mail" : fGetObjectWriter = 7
+ '----------------- 8
+ case "Edit File" : fGetObjectWriter = 9
+ '----------------- 10
+ case "Export Directly as PDF" : fGetObjectWriter = 11
+ case "Print File Directly" : fGetObjectWriter = 12
+ case "Page Rreview" : fGetObjectWriter = 13
+ '----------------- 14
+ case "Spellcheck" : fGetObjectWriter = 15
+ case "AutoSpellcheck" : fGetObjectWriter = 16
+ '----------------- 17
+ case "Cut" : fGetObjectWriter = 18
+ case "Copy" : fGetObjectWriter = 19
+ case "Paste" : fGetObjectWriter = 20
+ case "Format Paintbrush" : fGetObjectWriter = 21
+ '----------------- 22
+ case "Can't Undo" : fGetObjectWriter = 23
+ case "Can't Restore" : fGetObjectWriter = 24
+ '----------------- 25
+ case "Hyperlink" : fGetObjectWriter = 26
+ case "Table" : fGetObjectWriter = 27
+ case "Show Draw Functions" : fGetObjectWriter = 28
+ '----------------- 29
+ case "Find & Replace" : fGetObjectWriter = 30
+ case "Navigator" : fGetObjectWriter = 31
+ case "Gallery" : fGetObjectWriter = 32
+ case "Data Sources" : fGetObjectWriter = 33
+ case "Nonprinting Characters" : fGetObjectWriter = 34
+ case "Zoom" : fGetObjectWriter = 35
+ '----------------- 36
+ case "StarOffice Help" : fGetObjectWriter = 37
+ case "What's This?" : fGetObjectWriter = 38
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectWriter = 0
+ end select
+
+ case "Standard(Viewing MOde)"
+ Select case sObject
+ end select
+
+ case "Stars and Banners"
+ Select case sObject
+ end select
+
+ case "Symbol Shapes"
+ Select case sObject
+ end select
+
+ case "Table"
+ Select case sObject
+ case "Table" : fGetObjectWriter = 22
+ case "Columns" : fGetObjectWriter = 23
+ case "Rows" : fGetObjectWriter = 24
+ end select
+
+ case "Text Object"
+ Select case sObject
+ case "Line Spacing 1" : fGetObjectWriter = 16
+ case "Line Spacing 1.5" : fGetObjectWriter = 17
+ case "Line Spacing 2" : fGetObjectWriter = 18
+ case "Font Color" : fGetObjectWriter = 20
+ case "Left-To-Right" : fGetObjectWriter = 22
+ case "Right-To-Left" : fGetObjectWriter = 23
+ end select
+
+ case "XML Form Design"
+ Select case sObject
+ case "Bring to Front" : fGetObjectWriter = 14
+ case "Send to Back" : fGetObjectWriter = 15
+ case "Group" : fGetObjectWriter = 17
+ case "UnGroup" : fGetObjectWriter = 18
+ case "Enter Group" : fGetObjectWriter = 19
+ case "Exit Group" : fGetObjectWriter = 20
+ end select
+
+ end select
+
+end function
+
+
+'*******************************************************
+'* This function will get the location for image button
+'* in Commands in Tools/Customize/Toolbars from Calc
+'*******************************************************
+function fGetObjectCalc(sToolbar as String , sObject as String) as Integer
+
+ Select case sToolbar
+ case "3D-Settings"
+ Select case sObject
+ case "Extrusion On/Off" : fGetObjectCalc = 1
+ '----------------- 2
+ case "Tilt Down" : fGetObjectCalc = 3
+ case "Tilt Up" : fGetObjectCalc = 4
+ case "Tilt Left" : fGetObjectCalc = 5
+ case "Tilt Right" : fGetObjectCalc = 6
+ '----------------- 7
+ case "Depth" : fGetObjectCalc = 8
+ case "Direction" : fGetObjectCalc = 9
+ case "Lighting" : fGetObjectCalc = 10
+ case "Surfact" : fGetObjectCalc = 11
+ case "3D Color" : fGetObjectCalc = 12
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Align"
+ Select case sObject
+ case "Left" : fGetObjectCalc = 1
+ case "Centered" : fGetObjectCalc = 2
+ case "Right" : fGetObjectCalc = 3
+ case "Top" : fGetObjectCalc = 4
+ case "Center" : fGetObjectCalc = 5
+ case "Bottom" : fGetObjectCalc = 6
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Basic Shapes"
+ Select case sObject
+ end select
+
+ case "Block Arrows"
+ Select case sObject
+ end select
+
+ case "Callouts"
+ Select case sObject
+ end select
+
+ case "Color"
+ Select case sObject
+ end select
+
+ case "Controls"
+ Select case sObject
+ end select
+
+ case "Drawing"
+ Select case sObject
+ case "Select" : fGetObjectCalc = 1
+ '----------------- 2
+ case "Line" : fGetObjectCalc = 3
+ case "Rectangle" : fGetObjectCalc = 4
+ case "Ellipse" : fGetObjectCalc = 5
+ case "Polygon" : fGetObjectCalc = 6
+ case "Curve" : fGetObjectCalc = 7
+ case "Freeform Line" : fGetObjectCalc = 8
+ case "Arc" : fGetObjectCalc = 9
+ case "Ellipse Pie" : fGetObjectCalc = 10
+ case "Circle Segment" : fGetObjectCalc = 11
+ case "Text" : fGetObjectCalc = 12
+ case "Vertical Text" : fGetObjectCalc = 13
+ case "Text Animation" : fGetObjectCalc = 14
+ case "Callouts" : fGetObjectCalc = 15
+ case "Vertical Callouts" : fGetObjectCalc = 16
+ '----------------- 17
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Drawing Object Properties"
+ Select case sObject
+ case "Display Grid" : fGetObjectCalc = 21
+ case "Snap to Grid" : fGetObjectCalc = 22
+ case "Guides When Moving" : fGetObjectCalc = 23
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Flowchart"
+ Select case sObject
+ end select
+
+ case "Fontwork"
+ Select case sObject
+ end select
+
+ case "Fontwork Shape"
+ Select case sObject
+ end select
+
+ case "Form Design"
+ Select case sObject
+ case "Bring to Front" : fGetObjectCalc = 14
+ case "Send to Back" : fGetObjectCalc = 15
+ case "Group" : fGetObjectCalc = 17
+ case "UnGroup" : fGetObjectCalc = 18
+ case "Enter Group" : fGetObjectCalc = 19
+ case "Exit Group" : fGetObjectCalc = 20
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Form Filter"
+ Select case sObject
+ end select
+
+ case "Form Navigation"
+ Select case sObject
+ end select
+
+ case "Form Object"
+ Select case sObject
+ end select
+
+ case "Formatting" :
+ Select case sObject
+ case "Styles and Formatting" : fGetObjectCalc = 1
+ case "Apply Style" : fGetObjectCalc = 2
+ '---------------------- 3
+ case "Font Name" : fGetObjectCalc = 4
+ '---------------------- 5
+ case "Font Size" : fGetObjectCalc = 6
+ '---------------------- 7
+ case "Bold" : fGetObjectCalc = 8
+ case "Italic" : fGetObjectCalc = 9
+ case "Underline" : fGetObjectCalc = 10
+ case "Underline:Double" : fGetObjectCalc = 11
+ '---------------------- 12
+ case "Align Left" : fGetObjectCalc = 13
+ case "Align Center Horizontally" : fGetObjectCalc = 14
+ case "Align Right" : fGetObjectCalc = 15
+ case "Justified" : fGetObjectCalc = 16
+ case "Merge Cells" : fGetObjectCalc = 17
+ '---------------------- 18
+ case "Left-To-Right" : fGetObjectCalc = 19
+ case "Right-To-Left" : fGetObjectCalc = 20
+ '---------------------- 21
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Full Screen"
+ Select case sObject
+ case "Full Screen" : fGetObjectCalc = 1
+ end select
+
+ case "Graphic Filter"
+ Select case sObject
+ end select
+
+ case "Insert"
+ Select case sObject
+ case "Chart" : fGetObjectCalc = 18
+ case "Insert Object" : fGetObjectCalc = 19
+ case "Controls" : fGetObjectCalc = 20
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Insert Cell"
+ Select case sObject
+ end select
+
+ case "Insert Object"
+ Select case sObject
+ end select
+
+ case "Media Playback"
+ Select case sObject
+ end select
+
+ case "More Controls"
+ Select case sObject
+ end select
+
+ case "Picture"
+ Select case sObject
+ end select
+
+ case "Standard"
+ Select case sObject
+ case "Load URL" : fGetObjectCalc = 1
+ case "New" : fGetObjectCalc = 2
+ case "New Document From Template" : fGetObjectCalc = 3
+ case "Open" : fGetObjectCalc = 4
+ case "Save" : fGetObjectCalc = 5
+ case "Save As" : fGetObjectCalc = 6
+ case "Document as E-mail" : fGetObjectCalc = 7
+ '----------------- 8
+ case "Edit File" : fGetObjectCalc = 9
+ '----------------- 10
+ case "Export Directly as PDF" : fGetObjectCalc = 11
+ case "Print File Directly" : fGetObjectCalc = 12
+ case "Page Rreview" : fGetObjectCalc = 13
+ '----------------- 14
+ case "Spellcheck" : fGetObjectCalc = 15
+ case "AutoSpellcheck" : fGetObjectCalc = 16
+ '----------------- 17
+ case "Cut" : fGetObjectCalc = 18
+ case "Copy" : fGetObjectCalc = 19
+ case "Paste" : fGetObjectCalc = 20
+ case "Format Paintbrush" : fGetObjectCalc = 21
+ '----------------- 22
+ case "Can't Undo" : fGetObjectCalc = 23
+ case "Can't Restore" : fGetObjectCalc = 24
+ '----------------- 25
+ case "Hyperlink" : fGetObjectCalc = 26
+ case "Sort Ascending" : fGetObjectCalc = 27
+ case "Sort Descending" : fGetObjectCalc = 28
+ '----------------- 29
+ case "Insert Chart" : fGetObjectCalc = 30
+ case "Show Draw Functions" : fGetObjectCalc = 31
+ '----------------- 32
+ case "Find & Replace" : fGetObjectCalc = 33
+ case "Navigator" : fGetObjectCalc = 34
+ case "Gallery" : fGetObjectCalc = 35
+ case "Data Sources" : fGetObjectCalc = 36
+ case "Zoom" : fGetObjectCalc = 37
+ '----------------- 38
+ case "StarOffice Help" : fGetObjectCalc = 39
+ case "What's This?" : fGetObjectCalc = 40
+ case else : QAErrorLog "The test does not support Object : " + sObject
+ fGetObjectCalc = 0
+ end select
+
+ case "Standard(Viewing Mode)"
+ Select case sObject
+ end select
+
+ case "Stars and Banners"
+ Select case sObject
+ end select
+
+ case "Symbol Shapes"
+ Select case sObject
+ end select
+
+ case "Text Formatting"
+ Select case sObject
+ end select
+
+ case "Tools"
+ Select case sObject
+ end select
+
+ case "previewbar"
+ Select case sObject
+ end select
+
+ end select
+
+end function
+
+
+
diff --git a/testautomation/global/tools/includes/optional/t_treelist_tools.inc b/testautomation/global/tools/includes/optional/t_treelist_tools.inc
new file mode 100644
index 000000000000..3ce78163d843
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_treelist_tools.inc
@@ -0,0 +1,485 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Helpers for accessing treelists
+'*
+'\******************************************************************************
+
+function hGetNodeCount( oControl as object ) as integer
+
+ '///<h3>Retrieve the number of visible (open) nodes from a treelist</h3>
+ '///<u>Input</u>:
+ '///<ol>
+ '///+<li>Treelist control object (Object)</li>
+ '///<ul>
+ '///+<li>Object must exist in current context</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Returns</u>:
+ '///<ol>
+ '///+<li>Number of items in treelist</li>
+ '///<ul>
+ '///+<li>0 on any error</li>
+ '///+<li>&gt; 0 Number of items</li>
+ '///</ul>
+ '///</ol>
+ '///<u>Description</u>:
+ '///<ul>
+
+
+ const CFN = "hGetNodeCount::"
+ const RETVAL_FAILURE = 0
+ dim iCount as integer
+
+ '///+<li>Verify that the control exists</li>
+ if ( oControl.exists( 5 ) ) then
+
+ '///+<li>Verify that the control is enabled</li>
+ if ( oControl.isEnabled() ) then
+
+ if ( GVERBOSE ) then printlog( CFN & "Regular access, control available and enabled" )
+
+ '///+<li>get the number of items from the control</li>
+ iCount = oControl.getItemCount()
+ else
+ printlog( CFN & "Failure: Control claims to be disabled." )
+ iCount = RETVAL_FAILURE
+ endif
+ else
+ try
+ printlog( CFN & "Forcing access to non existing control" )
+ iCount = oControl.getItemCount()
+ catch
+ printlog( CFN & "Failure: Control not available." )
+ iCount = RETVAL_FAILURE
+ endcatch
+ endif
+
+ if ( GVERBOSE ) then printlog( CFN & "Exit with nodecount = " & iCount )
+
+ hGetNodeCount = iCount
+ '///</ul>
+
+end function
+
+'*******************************************************************************
+
+function hSelectTopNode( oControl as object ) as boolean
+
+ '///<h3>Move selection to the first node in a treelist</h3>
+ '///<ul>
+ '///+<li>Type the &quot;Home&quot;-key in a treelist, to select index 1</li>
+ '///+<li>Verify that the top node has been selected</li>
+ '///</ul>
+
+ const CFN = "hSelectTopNode::"
+
+ try
+ oControl.select( 1 )
+ WaitSlot()
+ hSelectTopNode() = true
+ catch
+ hSelectTopNode() = false
+ endcatch
+
+ if ( GVERBOSE ) then printlog( CFN & "Selected Node: " & oControl.getText() )
+
+end function
+
+'*******************************************************************************
+
+function hSelectNextNode( oControl as object ) as integer
+
+ '///<h3>Move one node down in a treelist</h3>
+ '///<ul>
+ '///+<li>Returns new position or 0 on error</li>
+ '///</ul>
+
+ const CFN = "hSelectNextNode::"
+
+ dim iPosBefore as integer
+ dim iPosAfter as integer
+
+ iPosBefore = oControl.getSelIndex()
+
+ oControl.typeKeys( "<DOWN>" )
+
+ iPosAfter = oControl.getSelIndex()
+
+ if ( iPosAfter = iPosBefore ) then hSelectNextNode() = 0
+
+ if ( iPosAfter = ( iPosBefore + 1 ) ) then hSelectNextNode() = iPosAfter
+
+ printlog( CFN & "Selected node: " & oControl.getText() )
+
+end function
+
+'*******************************************************************************
+
+function hGetNodeName( oControl as object , iNode as integer ) as string
+
+ '///<h3>Retrieve the name of a node in a treelist specified by index</h3>
+ '///<ul>
+ '///+<li>Returns the name of the node or empty string on error</li>
+ '///</ul>
+ const CFN = "hGetNodeName::"
+ dim iItemCount as integer
+
+ iItemCount = hGetNodeCount( oControl )
+ if ( iNode > iItemCount ) then
+ warnlog( CFN & "Selected node out of range, aborting" )
+ hGetNodeName() = ""
+ else
+ oControl.select( iNode )
+ hGetNodeName() = oControl.getSelText()
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hExpandNode( oControl as object, iNode as integer ) as integer
+
+ '///<h3>Expand a node in a treelist specified by index</h3>
+ '///<ul>
+ '///+<li>Returns new nodecount or 0 on error</li>
+ '///</ul>
+ const RC_FAILURE = 0
+ const CFN = "hExpandNode::"
+
+ dim iOldNodeCount as integer
+
+ if ( GVERBOSE ) then
+ printlog( CFN & "Enter with option (Control): " & oControl.name() )
+ printlog( CFN & "Enter with option (iNode): " & iNode )
+ endif
+
+ iOldNodeCount = hGetNodeCount( oControl )
+ if ( iNode <= iOldNodeCount ) then
+ if ( iNode > RC_FAILURE ) then
+ oControl.select( iNode )
+ endif
+ try
+ oControl.typekeys( "<RIGHT>" )
+ hExpandNode() = hGetNodeCount( oControl )
+ catch
+ warnlog( "#i84194# Treelist access failed (Keyboard navigation)" )
+ hExpandNode() = RC_FAILURE
+ endcatch
+ else
+ hExpandNode() = RC_FAILURE
+ endif
+
+end function
+
+'*******************************************************************************
+
+function hExpandAllNodes( oControl as object ) as integer
+
+ '///<h3>Expand all nodes of treelist</h3>
+ '///<ul>
+ '///+<li>Run through all items in the treelist, expand every node</li>
+ '///+<li>Returns the number of all nodes in the treelist</li>
+ '///</ul>
+
+ dim iNode as integer
+ dim iNodeCurCount as integer
+ dim iNodeRefCount as integer
+ dim iIteration as integer
+
+ const CFN = "hExpandAllNodes::"
+
+ hSelectTopNode( oControl )
+ iNodeCurCount = hGetNodeCount( oControl )
+ iNodeRefCount = -1
+ iIteration = 0
+
+ if ( GVERBOSE ) then
+ printlog( CFN & "Initial iNodeCurCount: " & iNodeCurCount )
+ printlog( CFN & "Initial iNodeRefCount: " & iNodeRefCount )
+ endif
+
+ do while ( iNodeRefCount < iNodeCurCount )
+
+ iIteration = iIteration + 1
+ iNodeRefCount = iNodeCurCount
+
+ for iNode = iNodeCurCount to 1 step -1
+ hExpandNode( oControl , iNode )
+ next iNode
+
+ iNodeCurCount = hGetNodeCount( oControl )
+
+ if ( GVERBOSE ) then
+ printlog( "" )
+ printlog( CFN & "Exit iteration....: " & iIteration )
+ printlog( CFN & "Exit iNodeCurCount: " & iNodeCurCount )
+ printlog( CFN & "Exit iNodeRefCount: " & iNodeRefCount )
+ endif
+
+ loop
+
+ if ( GVERBOSE ) then
+ printlog( CFN & "Exit with " & iNodeCurCount & _
+ " items after " & iIteration & " iterations" )
+ endif
+ hExpandAllNodes() = iNodeCurCount
+
+end function
+
+'*******************************************************************************
+
+function hGetAllNodeNames( oControl as object , lsList() as string ) as integer
+
+ hExpandAllNodes( oControl )
+ hGetAllNodeNames() = hGetVisibleNodeNames( oControl, lsList() )
+
+end function
+
+'*******************************************************************************
+
+function hGetVisibleNodeNames( oControl as object , lsList() as string ) as integer
+
+ '///<h3>Retrieve the names of all nodes in a treelist</h3>
+ '///<ul>
+ '///+<li>Expand all nodes of a treelist</li>
+ '///+<li>Store all node names into an array</li>
+ '///+<li>Return the number of nodes read (listcount), 0 on error</li>
+ '///</ul>
+
+ ' Get the list of all visible (expanded) nodes and store it
+ ' in lsList(). if _id > ubound lsList() an error is given and lsList remains
+ ' empty, thus returning "0"
+
+ const CFN = "hGetVisibleNodeNames::"
+
+ dim iNodeCount as integer
+ dim iThisNode as integer
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter" )
+
+ iNodeCount = hGetNodeCount( oControl )
+
+ ' Test whether the array provided is large enough to hold all items
+ ' from the treelist/list. If the array is ok fill it.
+ if ( iNodeCount > ubound( lsList() ) ) then
+ warnlog( "Array to small to hold: " & iNodeCount & " items" )
+ else
+ hSelectTopNode( oControl )
+ for iThisNode = 1 to iNodeCount
+ listappend( lsList() , hGetNodeName( oControl , iThisNode )
+ next iThisNode
+ endif
+
+ hGetVisibleNodeNames() = listcount( lsList() )
+ if ( GVERBOSE ) then printlog( CFN & "Exit" )
+
+end function
+
+'*******************************************************************************
+
+function hSelectNode( oControl as object , _id as integer ) as string
+
+ '///<h3>Select a node in a treelist by index</h3>
+ '///<ul>
+ '///+<li>Return the name of the selected node</li>
+ '///</ul>
+
+ oControl.select( _id ) : hSelectNode() = hGetNodeName( oControl , _id )
+
+end function
+
+'*******************************************************************************
+
+function hSelectNodeByName( oControl as object , _name as string ) as integer
+
+ '///<h3>Select a node by name in treelist (first occurrence)</h3>
+ '///<ul>
+ '///+<li>Try to find a node by name - directly</li>
+ '///+<li>If the node is not visible, expand all and search the tree</li>
+ '///+<li>Returns index of requested node or 0 on failure</li>
+ '///</ul>
+
+ const CFN = "hSelectNodeByName::"
+ const RETVAL_FAILURE = 0
+
+ dim iThisNode as integer
+ dim iCurrentNode as integer
+ dim iNodeCount as integer
+
+ dim cNodeName as string
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter with option (NodeName): " & _name )
+
+ iThisNode = RETVAL_FAILURE
+
+ ' First we try to jump to the node directly, if this fails we use the
+ ' slower but safer method (expand all nodes and step through)
+ try
+ oControl.select( _name )
+ iThisNode = oControl.getSelIndex()
+ hSelectNodeByName() = iThisNode
+ catch
+ printlog( CFN & "Node not visible: Using search method" )
+ iNodeCount = hExpandAllNodes( oControl )
+
+ for iCurrentNode = 1 to iNodeCount
+ oControl.select( iCurrentNode )
+ cNodeName = oControl.getSelText()
+
+ if ( cNodeName = _name ) then
+ iThisNode = iCurrentNode
+ exit for
+ endif
+
+ if ( instr( cNodeName, _name ) > 0 ) then
+ if ( instr( cNodeName, "(" ) > 0 ) then
+ printlog( CFN & "Node has readonly marker" )
+ iThisNode = iCurrentNode
+ exit for
+ else
+ qaerrorlog( CFN & "Fuzzy match. This might or might not be the correct node" )
+ endif
+ endif
+ next iCurrentNode
+ endcatch
+
+ if ( iThisNode = RETVAL_FAILURE ) then
+ printlog( CFN & "Exit: Node not found." )
+ else
+ if ( GVERBOSE ) then printlog( CFN & "Exit: Node selected at pos: " & iThisNode )
+ endif
+
+ hSelectNodeByName() = iThisNode
+
+end function
+
+'*******************************************************************************
+
+function hSelectTheLastNode( oControl as object ) as integer
+
+ '///<h3>Select the (absolute) last node in a treelist</h3>
+ '///<ul>
+ '///+<li>Expand all nodes</li>
+ '///+<li>Go to the last node, select it</li>
+ '///+<li>Return the number of the last node in the treelist</li>
+ '///</ul>
+
+ const CFN = "hSelectTheLastNode::"
+ dim iCurrentNodeCount as integer
+
+ iCurrentNodeCount = hExpandAllNodes( oControl )
+ if ( iCurrentNodeCount > 0 ) then
+ oControl.select( iCurrentNodeCount )
+ if ( GVERBOSE ) then
+ printlog( CFN & "Nodename.....: " & oControl.getText() )
+ printlog( CFN & "Node position: " & iCurrentNodeCount )
+ endif
+ else
+ iCurrentNodeCount = -1
+ endif
+
+ hSelectTheLastNode() = iCurrentNodeCount
+
+end function
+
+'*******************************************************************************
+
+function hVerifyNodeName( oControl as object , cName as string ) as boolean
+
+ '///<h3>Compare the name of the current node from a treelist to a reference string</h3>
+ '///<ul>
+ '///+<li>Returns true on success, false on failure</li>
+ '///</ul>
+
+ hVerifyNodeName() = false
+ if ( oControl.getSelText() = cName ) then hVerifyNodeName() = true
+
+end function
+
+'******************************************************************************
+
+function hGetListItems( oControl as object, aList() as string ) as integer
+
+ '///<h3>Retrieve the names of all nodes from a plain (linear) list</h3>
+ '///<ul>
+ '///+<li>Cycle through a list, append all entries to an array</li>
+ '///+<li>Returns number of items or 0 on error</li>
+ '///</ul>
+
+ const CFN = "hGetListItems::"
+ const RETVAL_FAILURE = 0
+
+ if ( GVERBOSE ) then printlog( CFN & "Enter with option (control): " & oControl.name() )
+
+ dim iItemCount as integer
+ dim iCurrentItem as integer
+ dim cCurrentItem as string
+
+ iItemCount = oControl.getItemCount()
+ if ( iItemCount > ubound( aList() ) ) then
+ printlog( CFN & "Array too small, needed: " & iItemCount )
+ hGetListItems() = RETVAL_FAILURE
+ exit function
+ endif
+
+ for iCurrentItem = 1 to iItemCount
+
+ oControl.select( iCurrentItem )
+ cCurrentItem = oControl.getSelText()
+ hListAppend( cCurrentItem, aList() )
+
+ next iCurrentItem
+
+ if ( GVERBOSE ) then printlog( CFN & "Exit with number of items: " & iItemCount )
+ hGetListItems() = iItemCount
+
+end function
+
+'*******************************************************************************
+
+function hFindInList( oControl as object, cObject as string ) as integer
+
+ const RETVAL_FAILURE = 0
+ dim iCurrentObject as integer
+
+ for iCurrentObject = 1 to oControl.getItemCount()
+
+ oControl.select( iCurrentObject )
+
+ if ( oControl.getSelText() = cObject ) then
+ hFindInList() = iCurrentObject
+ exit function
+ endif
+
+ next iCurrentObject
+
+ hFindInList() = RETVAL_FAILURE
+
+end function \ No newline at end of file
diff --git a/testautomation/global/tools/includes/optional/t_ui_filters.inc b/testautomation/global/tools/includes/optional/t_ui_filters.inc
new file mode 100644
index 000000000000..d4c536b73718
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_ui_filters.inc
@@ -0,0 +1,131 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/******************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Get the UI names for default filters
+'*
+'\******************************************************************************
+
+global gWriterFilter as String
+global gCalcFilter as String
+global gImpressFilter as String
+global gMasterDocFilter as String
+global gMathFilter as String
+global gDrawFilter as String
+global gHTMLFilter as String
+
+'*******************************************************************************
+
+sub GetDefaultFilterNames()
+
+ const CFN = "global::tools::includes::optional::t_ui_filters.inc::GetDefaultFilterNames():"
+
+ dim sMatchingFile as string
+ dim sFilterArray( 100 ) as string
+
+ const APPLICATION_COUNT = 7
+ dim cUIFilters( APPLICATION_COUNT ) as string
+ dim cAPIFilters( APPLICATION_COUNT ) as string
+
+ sMatchingFile = gTesttoolPath & "global\input\filters\"
+ sMatchingFile = sMatchingFile & "build_to_filter.txt"
+ sMatchingFile = convertpath( sMatchingFile )
+
+ hGetDataFileSection( sMatchingFile, sFilterArray(), "Current", "", "" )
+
+ cAPIFilters( 1 ) = hGetValueForKeyAsString( sFilterArray(), "WRITER" )
+ cAPIFilters( 2 ) = hGetValueForKeyAsString( sFilterArray(), "CALC" )
+ cAPIFilters( 3 ) = hGetValueForKeyAsString( sFilterArray(), "IMPRESS" )
+ cAPIFilters( 4 ) = hGetValueForKeyAsString( sFilterArray(), "MASTERDOCUMENT" )
+ cAPIFilters( 5 ) = hGetValueForKeyAsString( sFilterArray(), "MATH" )
+ cAPIFilters( 6 ) = hGetValueForKeyAsString( sFilterArray(), "DRAW" )
+ cAPIFilters( 7 ) = hGetValueForKeyAsString( sFilterArray(), "HTML" )
+
+ hGetFilterGroup( cAPIFilters(), cUIFilters() )
+
+ gWriterFilter = cUIFilters( 1 )
+ gCalcFilter = cUIFilters( 2 )
+ gImpressFilter = cUIFilters( 3 )
+ gMasterDocFilter = cUIFilters( 4 )
+ gMathFilter = cUIFilters( 5 )
+ gDrawFilter = cUIFilters( 6 )
+ gHTMLFilter = cUIFilters( 7 )
+
+end sub
+
+'*******************************************************************************
+
+function hGetFilterGroup( api_filters() as string, ui_filters() as string )
+
+ ' This is a function designed to deliver a massive speed improvement
+ ' compared to multiple calls to hGetUIFiltername() which establish a fresh
+ ' UNO connection on each call. This function establishes only one connection
+ ' and works with a list of API filter names which are matched to UI filter
+ ' names. This function does not wrap the UNO calls in a try...catch block
+ ' which means that if the function fails, it fails hard. Extra hard, that is.
+ ' There is no errorhandling. This function is intended for internal use only.
+ ' No returnvalue is defined at this time.
+
+ const CFN = "global::tools::includes::optional::t_ui_filters.inc::hGetFilterGroup():"
+
+ dim oUno as object
+ dim oService as object
+ dim oFilter as object
+
+ dim iCurrentFilter as integer
+
+ dim iFilterCount as integer : iFilterCount = ubound( api_filters() )
+
+ dim iAPIfilterList as integer
+
+ oUno = hGetUNOService( true )
+ oService = oUno.createInstance("com.sun.star.document.FilterFactory")
+
+ for iCurrentFilter = 1 to iFilterCount
+
+ oFilter = oService.getByName( api_filters( iCurrentFilter ) )
+
+ for iAPIFilterList = 0 to ubound( oFilter )
+
+ if ( oFilter( iAPIFilterList ).Name = "UIName" ) then
+ ui_filters( iCurrentFilter ) = oFilter( iAPIFilterList ).Value()
+ if ( GVERBOSE ) then
+ 'printlog( CFN & "DEBUG: Index (iCurrentFilter): " & iCurrentFilter )
+ 'printlog( CFN & "DEBUG: API Filter: " & api_filters( iCurrentFilter ) )
+ 'printlog( CFN & "DEBUG: UI Filter.: " & ui_filters( iCurrentFilter ) )
+ endif
+ endif
+
+ next iAPIFilterList
+
+ next iCurrentFilter
+
+end function
+
+'*******************************************************************************
+
diff --git a/testautomation/global/tools/includes/optional/t_user_info.inc b/testautomation/global/tools/includes/optional/t_user_info.inc
new file mode 100644
index 000000000000..429aad5d2e8e
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_user_info.inc
@@ -0,0 +1,56 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/******************************************************************************
+'*
+'* owner : gregor.hartmann@oracle.com
+'*
+'* short description : Extension Update Test
+'*
+'\******************************************************************************
+
+function hCheckForAdministratorPermissions() as boolean
+
+ ' this function returns TRUE if the user can create files in the office
+ ' program directory. This is relevant for macro security (VBA compatibility)
+ ' and extension manager behavior (access to shared installations).S
+
+ dim iFile as integer
+ dim cProbeFile as string
+
+ cProbeFile = convertpath( gNetzOfficePath & "program/tt_probe_file" )
+ try
+ iFile = FreeFile
+ open cProbeFile for output as iFile
+ close( iFile )
+ kill( cProbeFile )
+ hCheckForAdministratorPermissions() = true
+ printlog( "Current user has administrator permissions" )
+ catch
+ hCheckForAdministratorPermissions() = false
+ printlog( "Current user does not have administrator permissions" )
+ endcatch
+
+end function
diff --git a/testautomation/global/tools/includes/optional/t_xml1.inc b/testautomation/global/tools/includes/optional/t_xml1.inc
new file mode 100644
index 000000000000..5afd05cbb22f
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_xml1.inc
@@ -0,0 +1,652 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* Owner : helge.delfs@oracle.com
+'*
+'* short description : simple XML-Parser for XML-Files from Registration-Database and Routines to work with SAX-Parser in Testtool
+'*
+'***********************************************************************************
+' #1 hXMLGotoElement
+' #1 hXMLGetFirstCharsForElement
+' #1 ExtractSections
+' #1 GetXMLValue
+' #1 GetXMLTagValue
+' #1 GetXMLValueList
+' #1 GetXMLValueType
+' #1 GetXMLValueLine
+' #1 GetXMLValueGlobal
+' #1 GetExtractXMLValue
+' #1 GetExtractXMLValueList
+' #1 GetExtractXMLValueFromList
+' #1 hXMLSeekElementInTree
+'\**********************************************************************************
+
+function hXMLGotoElement ( sElementLine as String, optional bSilent as boolean) as boolean
+'/// uses SAX Interface in testtool ///'
+'///hXMLGotoElement ( sElementLine as String )
+'///+Input : sElementLine => the tree in DOM as one string seperated with ';'
+'///+ - - - - - to be more exact, the Attribute Values to 'oor:name' ///'
+'///+ - - - -: bSilent => print warnings? ///'
+'///+Output : --
+'///+Return : was the Element found?
+'///- you can jump directly to the correct entry in the DOM-tree
+
+ Dim sList (50) as String
+ Dim i as Integer
+ Dim x as Integer
+ Dim y as Integer
+ Dim n as Integer
+ dim iMax as integer
+ dim bFound as boolean
+ dim bFoundCollect as boolean
+ dim iAttrCount as integer
+ dim bLocalSilent as boolean
+
+ if (isMissing(bSilent)) then
+ bLocalSilent = FALSE
+ else
+ bLocalSilent = bSilent
+ endif
+
+ bFoundCollect = TRUE
+ ExtractSections ( sElementLine, sList () )
+
+ for i=1 to ListCount ( sList () ) ' for every Section
+ iMax = SAXGetChildCount()
+ x = 0
+ bFound = FALSE
+' ' ------------ debug start ----------------------
+' for n = 1 to iMax
+' SAXSeekElement (n)
+' Printlog " " + i + ":(" + n + "/" + iMax + "): '" + SAXGetElementName
+' iAttrCount = SAXGetAttributeCount
+' for y = 1 to iAttrCount
+' Printlog " " + i + ":" + n + ":(" + y + "/" + iAttrCount + "): '"+SAXGetAttributeName (y) +"' : '"+SAXGetAttributeValue (y) +"' "
+' next y
+' SAXSeekElement (0)
+' next n
+' ' ------------- debug end -----------------------
+ while ((bFound = FALSE) AND (x < iMax)) ' compare the VALUE for the ATTRIBUTE 'oor:name' with the wanted ITEM
+ inc(x) ' do it until it fits; else print warnlog
+ SAXSeekElement (x)
+ if (SAXGetAttributeValue ("oor:name") <> sList (i)) then
+ SAXSeekElement (0)
+ else
+ bFound = TRUE
+ endif
+ wend
+ if ((bFound = FALSE) AND (bSilent = FALSE)) then
+ Warnlog "hXMLGotoElement::ERROR! Element " + i + ": '" + sList (i) + "' not found :-("
+ endif
+ bFoundCollect = bFound AND bFoundCollect
+ next i
+ hXMLGotoElement = bFoundCollect
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function hXMLGetFirstCharsForElement ( sElementLine as String, optional sXMLFile as String, optional bClose as Boolean ) as String
+'/// uses SAX Interface in testtool ///'
+ Dim bCloseLocal as Boolean
+'///hXMLGetFirstCharsForElement ( sElementLine as String, optional sXMLFile as String, optional bClose as Boolean ) as String
+'///+Input : sElementLine => the tree in DOM as one string seperated with ';'
+'///+- sXMLFile => ( optional ) if you want to open the DOM for a file you can set here the filename
+'///+- bClose => ( optional ) if you want to close the DOM after getting the char, you can set this to TRUE ( default is FALSE )
+'///+Output : --
+'///+Return : the string for the element
+'///- you can jump directly to the correct entry in the DOM-tree and get the char for that entry
+'///- the DOM is closed after this return
+
+ if IsMissing( sXMLFile ) = FALSE then
+ SAXReadFile ( sXMLFile )
+ end if
+
+ if IsMissing( bClose ) = TRUE then
+ bCloseLocal = FALSE
+ else
+ bCloseLocal = bClose
+ end if
+
+ hXMLGotoElement ( sElementLine )
+ SAXSeekElement ( 1 )
+ if SAXGetNodeType = NodeTypeCharacter then
+ hXMLGetFirstCharsForElement = SAXGetChars
+ else
+ Warnlog "hXMLGetFirstCharsForElement : the element " + sElementLine + " has no chars"
+ hXMLGetFirstCharsForElement = ""
+ end if
+
+ if bCloseLocal = TRUE then SAXRelease
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function ExtractSections ( sInput as String, lsXMLsections() as String ) as Integer
+'///Input : - sInput => a full section seperated with ';'
+'///+- lsXMLsections => an empty list
+'///+Output : the list ( lxXMLsections ) with seperated sectionnames
+'///+Return : number of sections
+
+ Dim ii, iLen as Integer
+ Dim iList ( 50 ) as String
+ Dim bFirstEntry as Boolean
+ Dim Dummy as String
+ dim sTemp as string
+
+ lsXMLsections(0) = 0
+ iList (0) = 0
+ iLen = len ( sInput )
+ bFirstEntry = TRUE
+
+ for ii=1 to ( iLen )
+ Dummy = mid ( sInput, ii, 1 )
+ if ( mid ( sInput, ii, 1 ) ) = ";" then ListAppend ( iList(), Str ( ii ) )
+ next ii
+
+ for ii=1 to ( ListCount ( iList () ) )
+ if bFirstEntry = TRUE then
+ ListAppend ( lsXMLsections(), Left ( sInput, Val(iList(1))-1 ) )
+ bFirstEntry = FALSE
+ end if
+ Dummy = mid ( sInput, Val(iList(ii))+1, Val(iList(ii+1))-Val(iList(ii))-1 )
+ ListAppend ( lsXMLsections(), Dummy )
+ next ii
+
+ sTemp = ListCount ( lsXMLsections() )
+ ExtractSections = sTemp
+ if (sTemp = 0) then
+ ListAppend (lsXMLsections(), sInput)
+ ExtractSections = 1
+ end if
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function GetXMLValue ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String, optional bSilent as Boolean ) as String
+'/// Input : - sXMLfile => Filename with full path ///
+'///+ - - - - - sXMLsectionMaster => the master-section ( mostly in StarOffice the filename without extension ) ///
+'///+ - - - - - sXMLsection => full way to the item ///
+'///+ Output : - - ///
+'///+ Return : - the value ///
+'/// wraper for GetXMLValueGlobal ///'
+ if IsMIssing ( bSilent ) <> TRUE then
+ GetXMLValue = GetXMLValueGlobal ( sXMLfile, sXMLsectionMaster, sXMLsection, , , , bSilent )
+ else
+ GetXMLValue = GetXMLValueGlobal ( sXMLfile, sXMLsectionMaster, sXMLsection, , , , )
+ end if
+end function
+
+function GetXMLTagValue ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String, sValue as String ) as String
+'/// Input : - sXMLfile => Filename with full path ///
+'///+ - - - - - sXMLsectionMaster => the master-section ( mostly in StarOffice the filename without extension ) ///
+'///+ - - - - - sXMLsection => full way to the item ///
+'///+ Output : - - ///
+'///+ Return : - the value ///
+'/// wraper for GetXMLValueGlobal ///'
+ GetXMLTagValue = GetXMLValueGlobal ( sXMLfile, sXMLsectionMaster, sXMLsection, ,sValue , , )
+end function
+
+function GetXMLValueList ( lsXMLValue() as String, sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String ) as String
+'/// Input : - sXMLfile => Filename with full path ///
+'///+ - - - - - sXMLsectionMaster => the master-section ( mostly in StarOffice the filename without extension ) ///
+'///+ - - - - - sXMLsection => full way to the item ///
+'///+ Output : - - ///
+'///+ Return : - the value ///
+'/// wraper for GetXMLValueGlobal ///'
+ Dim sLine, sLine1 as String
+ Dim i, iCounter as Integer
+
+ sLine = GetXMLValueGlobal ( sXMLfile, sXMLsectionMaster, sXMLsection, ,"cfg:value" , TRUE, )
+ if sLine = "" then
+ GetXMLValueList = ""
+ else
+ GetXMLValueList = GetExtractXMLValueList ( lsXMLValue(), sLine, , )
+ end if
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function GetXMLValueType ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String, optional sType ) as String
+'/// Input : - sXMLfile => Filename with full path ///
+'///+ - - - - - sXMLsectionMaster => the master-section ( mostly in StarOffice the filename without extension ) ///
+'///+ - - - - - sXMLsection => full way to the item ///
+'///+ Output : - - ///
+'///+ Return : - the value ///
+'/// wraper for GetXMLValueGlobal ///'
+ Dim sDummy as String
+ if IsMissing ( sType ) = TRUE then
+ sDummy = "type"
+ else
+ sDummy = sType
+ end if
+
+ GetXMLValueGlobal ( sXMLfile, sXMLsectionMaster, sXMLsection, sDummy, , , )
+ GetXMLValueType = sDummy
+end function
+
+function GetXMLValueLine ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String ) as String
+'/// Input : - sXMLfile => Filename with full path ///
+'///+ - - - - - sXMLsectionMaster => the master-section ( mostly in StarOffice the filename without extension ) ///
+'///+ - - - - - sXMLsection => full way to the item ///
+'///+ Output : - - ///
+'///+ Return : - the value ///
+'/// wraper for GetXMLValueGlobal ///'
+ GetXMLValueLine = GetXMLValueGlobal ( sXMLfile, sXMLsectionMaster, sXMLsection,,, TRUE, )
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function GetXMLValueGlobal ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String, optional sXMLType, optional sXMLTag, optional biWholeLine, optional bSil as Boolean ) as String
+'/// uses no SAX Parser : just text search in the file ///'
+'/// You can get the value of an item in a XML-file. The value of the item must be set between &lt;value&gt; and &lt;value/&gt;. ///
+'///+ The item can be written in one line or in more lines. ///
+'/// Input : - sXMLfile => Filename with full path ///
+'///+ - - - - - sXMLsectionMaster => the master-section ( mostly in StarOffice the filename without extension ) ///
+'///+ - - - - - sXMLsection => full way to the item ///'
+'///+ - - - - - optional sXMLType => if you want to get the XML-Type this variable must be set ///'
+'///+ - - - - - optional sXMLTag => if sXMLTag isn't set, "value" is the tag, else you must set the tag here ///'
+'///+ Output : - optional sXMLType => if sXMLType is set, it will be returned the Type of the value as string ///'
+'///+ Return : - the value of the searched item ///'
+' Dim FileNum as Integer
+ Dim Pos, iSec, i, j, iDum as Integer
+ Dim MasterSecOK, MasterSecEnd, SecOK, SecEnd, bThrough, bWholeLine as Boolean
+ Dim xmlZeile, xmlZeile2, sVariable, sDummy, sDummy2 as String
+ Dim lsSecList ( 1000 ) as String
+ Dim lsInterim ( 1000 ) as String
+ Dim textin as object, sfa as object, xInput as object
+ Dim bSilent as Boolean
+
+ if ( IsMissing ( bSil ) ) = TRUE then
+ bSilent = FALSE
+ else
+ bSilent = TRUE
+ end if
+
+ if ( IsMissing ( biWholeLine ) ) = TRUE then
+ bWholeLine = FALSE
+ else
+ bWholeLine = TRUE
+ end if
+
+ if Dir( sXMLfile ) = "" then
+ if bSilent = FALSE then Warnlog "GetXMLValueGlobal(...) : " + sXMLfile + " is missing!"
+ exit function
+ end if
+
+ MasterSecOK = FALSE : MasterSecEND = FALSE
+ SecOK=FALSE : SecEND=FALSE
+ bThrough = FALSE
+ Pos = 1
+ GetXMLValueGlobal = ""
+
+ lsSecList (0) = 0
+ lsInterim (0) = 0
+
+ iSec = ExtractSections ( sXMLsection, lsSecList () )
+ sVariable = lsSecList (iSec)
+ ListDelete ( lsSecList(), iSec )
+ iSec = iSec-1
+ if iSec = 0 then ListAppend ( lsSecList(), "" )
+
+ textin = createUnoService( "com.sun.star.io.TextInputStream" )
+ textin.setEncoding("utf8")
+ sfa = createUnoService( "com.sun.star.ucb.SimpleFileAccess" )
+ xInput = sfa.openFileRead( sXMLfile )
+ textin.setInputStream( xInput )
+
+ do until textin.isEOF()
+ xmlZeile = textin.readLine()
+
+ xmlZeile = TrimTab ( Trim ( xmlZeile ) )
+ xmlZeile2 = lCASE( xmlZeile ) ' control case-insensitiv
+
+ if MasterSecOK = FALSE then ' master-section ( com.sun.star. ... )
+ if xmlZeile2= "<" + lCASE( sXMLsectionMaster ) + ">" OR Instr ( xmlZeile2, "<" + lCASE( sXMLsectionMaster ) + " " ) <> 0 then
+ MasterSecOK = TRUE
+ else
+ if xmlZeile2 = "<" + lCASE( sXMLsectionMaster ) + "/>" then
+ if bSilent = FALSE then warnlog "GetXMLValueGlobal(...) : '" + sXMLsectionMaster + "' -> master-section has no entries!"
+ exit do
+ end if
+ end if
+ else
+ if xmlZeile2= "</" + lCASE( sXMLsectionMaster ) + ">" OR xmlZeile2= "<" + lCASE( sXMLsectionMaster ) + "/>" then
+ if bSilent = FALSE then warnlog "GetXMLValueGlobal(...) : '" + lsSecList (Pos) + "' -> entry could not be found!"
+ exit do
+ end if
+
+ if ( Instr (xmlZeile2, lCASE ( "<" + lsSecList (Pos)) ) <> 0 AND iSec > 0 ) AND Pos < iSec+1 then
+ iDum = Instr ( lsSecList (Pos), " " )
+ if iDum <> 0 then lsSecList(Pos) = Left ( lsSecList(Pos), iDum -1 )
+ if xmlZeile2 = "<" + lCASE( lsSecList (Pos) ) + "/>" then
+ if Pos = iSec then
+ if bSilent = FALSE then Warnlog "GetXMLValueGlobal(...) : '" + svariable + "' -> entry could not be found"
+ else
+ if bSilent = FALSE then Warnlog "GetXMLValueGlobal(...) : '" + lsSecList (Pos) + "' -> entry could not be found"
+ end if
+ exit do
+ else
+ Pos = Pos + 1
+ end if
+ else
+ if Pos > iSec then
+ sDummy2 = Mid ( xmlZeile2, 2, len ( svariable ) + 1 )
+ if sDummy2 = lCase ( svariable ) + ">" OR sDummy2 = lCase ( svariable ) + " " OR bThrough = TRUE then
+ iDum = Instr ( svariable, " " ) ' inserted because an error in GetXMLValueLineExtra 3.11.00 (TZ)
+ if iDum <> 0 then svariable = Left ( svariable, iDum -1 ) ' inserted because an error in GetXMLValueLineExtra 3.11.00 (TZ)
+ sDummy = Mid ( xmlZeile2, len ( xmlZeile2 ) - 1 - len ( svariable), len ( svariable)+1 )
+ if ( bThrough = FALSE AND ( sDummy = "/" + lCase ( svariable ) OR Right (sDummy, 1 ) = "/" ) ) OR ( bThrough = TRUE AND sDummy = "/" + lCase ( svariable ) ) then
+ if ListCount ( lsInterim () ) = 0 then
+ if bWholeLine = TRUE then
+ GetXMLValueGlobal = xmlZeile
+ else
+ if ( IsMissing ( sXMLTag ) ) = TRUE then
+ if ( IsMissing ( sXMLType ) ) = TRUE then
+ GetXMLValueGlobal = GetExtractXMLValue ( xmlZeile,, )
+ else
+ GetXMLValueGlobal = GetExtractXMLValue ( xmlZeile, sXMLType, )
+ end if
+ else
+ if ( IsMissing ( sXMLType ) ) = TRUE then
+ GetXMLValueGlobal = GetExtractXMLValue ( xmlZeile,, sXMLTag )
+ else
+ GetXMLValueGlobal = GetExtractXMLValue ( xmlZeile, sXMLType, sXMLTag )
+ end if
+ end if
+ end if
+ else
+ ListAppend ( lsInterim (), xmlZeile2 )
+ if bWholeLine = TRUE then
+ for j=1 to ListCount ( lsInterim () )
+ GetXMLValueGlobal = GetXMLValueGlobal + lsInterim (j)
+ next j
+ else
+ if ( IsMissing ( sXMLTag ) ) = TRUE then
+ if ( IsMissing ( sXMLType ) ) = TRUE then
+ GetXMLValueGlobal = GetExtractXMLValueFromList ( lsInterim (),, )
+ else
+ GetXMLValueGlobal = GetExtractXMLValueFromList ( lsInterim (), sXMLType, )
+ end if
+ else
+ if ( IsMissing ( sXMLType ) ) = TRUE then
+ GetXMLValueGlobal = GetExtractXMLValueFromList ( lsInterim (),, sXMLTag )
+ else
+ GetXMLValueGlobal = GetExtractXMLValueFromList ( lsInterim (), sXMLType, sXMLTag )
+ end if
+ end if
+ end if
+ end if
+ bThrough = FALSE
+ exit do
+ else
+ if xmlZeile2 <> "" then
+ bThrough = TRUE
+ ListAppend ( lsInterim (), xmlZeile2 )
+ end if
+ end if
+ end if
+ end if
+ end if
+ end if
+ loop
+
+ xInput.closeInput '* uno-file-close
+
+ if bSilent = FALSE then
+ if MasterSecOK = FALSE then warnlog "GetXMLValueGlobal (...) : '" + sXMLsectionMaster + "' -> Master-section was not found!"
+ end if
+ wait 1000
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function GetExtractXMLValue ( sFullLine as String, optional sXMLType, optional sXMLTag ) as String
+'/// Get the value-string, when the text is only in one line. ///'
+'/// Input : - sFullLine => the whole line out of XML-File ///'
+'/// Output : - optional sXMLType => if sXMLType is set, it will be returned the Type of the value as string ///'
+'/// Return : - the text between <value> and <value/> ///'
+ Dim i, ii, iStart, iEnd as Integer
+ Dim sInterim, ssTag as String
+
+ if ( IsMissing ( sXMLTag ) ) = TRUE then
+ ssTag = "value"
+ else
+ ssTag = sXMLTag
+ end if
+
+ sInterim = lCase ( sFullLine )
+
+ if InStr ( sInterim, "<" + ssTag + "/>" ) <> 0 then
+ GetExtractXMLValue = ""
+ else
+ iStart = InStr ( sInterim, "<" + ssTag + ">" )
+ iEnd = InStr ( sInterim, "</" + ssTag + ">" )
+ if iStart <> 0 AND iEnd <> 0 then
+ if iStart + len(ssTag) + 2 = iEnd then
+ GetExtractXMLValue = ""
+ else
+ GetExtractXMLValue = Mid ( sFullLine, iStart + len ( ssTag )+2, iEnd - iStart - len ( ssTag ) - 2 )
+ end if
+ end if
+ end if
+
+ if ( IsMissing ( sXMLType ) ) = FALSE then
+ sXMLType = lcase (sXMLType)
+ ii = InStr ( sInterim, sXMLType + "=" )
+ if ii = 0 then ii = InStr ( sInterim, sXMLType + " =" )
+ if ii = 0 then ii = InStr ( sInterim, sXMLType + " =" )
+
+ if ii = 0 then
+ sXMLType = ""
+ else
+ for i=ii to len ( sInterim ) - ii
+ if Mid ( sInterim, i, 1 ) = chr (34) then
+ iStart=i
+ i=1000
+ end if
+ next i
+ for i=(iStart+1) to len ( sInterim ) - (iStart+1)
+ if Mid ( sInterim, i, 1 ) = chr (34) then
+ iEnd=i
+ i=1000
+ end if
+ next i
+ sXMLType = Mid ( sFullLine, iStart+1, iEnd-iStart-1 )
+ end if
+ end if
+
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function GetExtractXMLValueList ( lsXMLValues (), sFullLine as String, optional sXMLType, optional sXMLTag ) as Integer
+'/// Get the value-string, when the text is only in one line ///'
+'/// Input : - ///'
+'/// Output : - ///'
+'/// Return : - ///'
+ Dim i, ii, iStart, iEnd as Integer
+ Dim sInterim, ssTag as String
+
+ lsXMLValues(0)=0
+
+ if ( IsMissing ( sXMLTag ) ) = TRUE then
+ ssTag = "value"
+ else
+ ssTag = sXMLTag
+ end if
+
+ sInterim = lCase ( sFullLine )
+ ii = len( sInterim ) / len ( ssTag ) ' maximal so viele Wiederholungen, wie es sTags gibt
+
+ for i=1 to ii
+ if InStr ( sInterim, "<" + ssTag + "/>" ) = 0 then
+ iStart = InStr ( sInterim, "<" + ssTag + ">" )
+ iEnd = InStr ( sInterim, "</" + ssTag + ">" )
+ if iStart <> 0 AND iEnd <> 0 then
+ if iStart + len(ssTag) + 2 = iEnd then
+ ListAppend ( lsXMLValues(), "" )
+ sInterim = Mid ( sInterim, iEnd + len (ssTag)+2, len (sInterim) - iEnd - len (ssTag) - 1 - 2 )
+ else
+ ListAppend ( lsXMLValues(), Mid ( sInterim, iStart + len(ssTag)+2, iEnd - iStart - len(ssTag)-2 ) )
+ sInterim = Mid ( sInterim, iEnd + len (ssTag), len (sInterim) - iEnd - len (ssTag) - 1 )
+ end if
+ else
+ i = ii + 1
+ end if
+ end if
+ next i
+ GetExtractXMLValueList = ListCount ( lsXMLValues() )
+
+ if ( IsMissing ( sXMLType ) ) = FALSE then
+ sXMLType = lcase (sXMLType)
+ ii = InStr ( sInterim, sXMLType + "=" )
+ if ii = 0 then ii = InStr ( sInterim, sXMLType + " =" )
+ if ii = 0 then ii = InStr ( sInterim, sXMLType + " =" )
+
+ if ii = 0 then
+ sXMLType = ""
+ else
+ for i=ii to len ( sInterim ) - ii
+ if Mid ( sInterim, i, 1 ) = chr (34) then
+ iStart=i
+ i=1000
+ end if
+ next i
+ for i=(iStart+1) to len ( sInterim ) - (iStart+1)
+ if Mid ( sInterim, i, 1 ) = chr (34) then
+ iEnd=i
+ i=1000
+ end if
+ next i
+ sXMLType = Mid ( sFullLine, iStart+1, iEnd-iStart-1 )
+ end if
+ end if
+
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function GetExtractXMLValueFromList ( lsList() as String, optional sXMLType, optional sXMLTag ) as String
+'/// Get the value-string, when the text is in a list ( when the item is written in more than one line ). ///'
+'/// Input : - lsList() => the list of the whole entry of the xml-item ///'
+'/// Output : - optional sXMLType => if sXMLType is set, it will be returned the Type of the value as string ///'
+'/// Return : - the text between <value> and <value/> ///'
+ Dim i, ii, iStart, iEnd as Integer
+ Dim sInterim, sInterim1, ssTag as String
+
+ if ( IsMissing ( sXMLTag ) ) = TRUE then
+ ssTag = "value"
+ else
+ ssTag = sXMLTag
+ end if
+
+ for i=1 to ListCount ( lsList() )
+ sInterim1 = sInterim1 + lsList(i)
+ next i
+
+ sInterim = lCase ( sInterim1 )
+
+ if InStr ( sInterim, "<"+ ssTag +"/>" ) <> 0 then
+ GetExtractXMLValueFromList = ""
+ else
+ iStart = InStr ( sInterim, "<" + ssTag + ">" )
+ iEnd = InStr ( sInterim, "</" + ssTag + ">" )
+ if iStart <> 0 AND iEnd <> 0 then
+ if iStart + len(ssTag) + 2 = iEnd then
+ GetExtractXMLValueFromList = ""
+ else
+ GetExtractXMLValueFromList = Mid ( sInterim1, iStart + len ( ssTag )+2, iEnd - iStart - len ( ssTag ) - 2 )
+ end if
+ end if
+ end if
+
+ if ( IsMissing ( sXMLType ) ) = FALSE then
+ sXMLType = lcase (sXMLType)
+ ii = InStr ( sInterim, sXMLType + "=" )
+ if ii = 0 then ii = InStr ( sInterim, sXMLType + " =" )
+ if ii = 0 then ii = InStr ( sInterim, sXMLType + " =" )
+
+ if ii = 0 then
+ sXMLType = ""
+ else
+ for i=ii to len ( sInterim ) - ii
+ if Mid ( sInterim, i, 1 ) = chr (34) then
+ iStart=i
+ i=1000
+ end if
+ next i
+ for i=(iStart+1) to len ( sInterim ) - (iStart+1)
+ if Mid ( sInterim, i, 1 ) = chr (34) then
+ iEnd=i
+ i=1000
+ end if
+ next i
+ sXMLType = Mid ( sInterim1, iStart+1, iEnd-iStart-1 )
+ end if
+ end if
+end function
+'
+'-----------------------------------------------------------------------------
+'
+function hXMLSeekElementInTree ( sSeekThisNodeXML as STRING ) as BOOLEAN
+ hXMLSeekElementInTree = FALSE
+' Peter Junge: 2005-07-29
+'///<u><b>Recursion to find XML element</b></u>///
+'///Input: 'sSeekThisNodeXML' - XML element to seek, e.g. 'foo:bar'///
+'///(A XML DOM has to be loaded before)///
+'///Seek begins at current XML pointer///
+'///Return: TRUE if element was found, else FALSE///
+'///BEHAVIOUR: XML pointer is set to 'foo:bar' if found, if not XML pointer is reset to initial element///
+'///NOTE: Currently only the first appearence of 'foo:bar' is found.///
+'///NOTE: If e.g. the Nth element should be found you have to modify this function///
+'///NOTE: There should be further enhancements possible, e.g. find element with specific attribute///
+ dim iIndex as INTEGER
+ '///<ul><li>Check if current node matches 'sSeekThisNodeXML'</li>///
+ if SAXGetElementName() = sSeekThisNodeXML then
+ '///<li>MATCH: Function returns TRUE</li>///
+ hXMLSeekElementInTree = TRUE
+ else
+ '///<li>NO MATCH: LOOKUP if current node has elements</li>///
+ for iIndex = 1 to SAXGetChildCount()
+ '///<li>-> (Loop) Set pointer on child</li>///
+ SAXSeekElement ( iIndex )
+ '///<li>-> Check if child is a XML element</li>///
+ if SAXGetNodeType() = 556 then
+ '///<li>-> RECURSION: function recalls itself for current element</li>///
+ if hXMLSeekElementInTree ( sSeekThisNodeXML ) = TRUE then
+ '///<li>Don't forget to pass back the result TRUE to recursions parent</li>///
+ hXMLSeekElementInTree = TRUE
+ '///<li>Exit loop if found</li>///
+ Exit For
+ endif
+ endif
+ '///<li>NO MATCH: Go back to parent in DOM tree</li></ul>///
+ SAXSeekElement( 0 )
+ next iIndex
+ endif
+end function
+
diff --git a/testautomation/global/tools/includes/optional/t_xml2.inc b/testautomation/global/tools/includes/optional/t_xml2.inc
new file mode 100644
index 000000000000..46dc9b350393
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_xml2.inc
@@ -0,0 +1,492 @@
+'encoding UTF-8 Do not remove or change this line!
+'**************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/************************************************************************
+'*
+'* owner : helge.delfs@oracle.com
+'*
+'* short description : XML search routines II
+'*
+'************************************************************************
+'*
+' #1 GetXMLValueLineExtra ' DEPRECATED depending on t_xml1.inc::GetXMLValueGlobal
+' #1 XMLWellFormed ' Checks the well formness of a XML file.
+' #1 GetXMLValue2 ' OBSOLETE: XML search routine (as TT has no SAX included we have used that rountine)
+' #1 GetBodiesItemStyleName ' DEPRECATED used by ../xml/level1/inc/sxw7_02.inc
+' #1 GetLineInXMLBody ' DEPRECATED used by ../xml/level1/inc/sxw7_02.inc and ../sxw7_03.inc
+' #1 GetItemStyleName ' DEPRECATED used by ../xml/level1/inc/sxw7_01.inc
+' #1 GetXMLElementPath ' Gets the elementpath in a DOM tree (mostly used for [automatic-]styles)
+' #1 fWhereIsXMLElementInBody ' Gets the elementpath in a DOM tree in the second level (mostly body elements)
+'*
+'\***********************************************************************
+
+function GetXMLValueLineExtra ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String, sGroupTyp as String, sGroupName as String ) as String
+'///+ Input:<ul><li>sXMLfile =&gt; Filename with full path</li>
+'///+ <li>sXMLsectionMaster =&gt; The master-section (mostly in OpenOffice.org the filename without extension)</li>
+'///+ <li>sXMLsection =&gt; Full way to the item</li>
+'///+ <li>sGroupTyp =&gt; First entry after tag</li>
+'///+ <li>sGroupName =&gt; Value of first entry</li></ul>
+ GetXMLValueLineExtra = GetXMLValueGlobal ( sXMLfile, sXMLsectionMaster, sXMLsection + " " + sGroupTyp + "=" + Chr(34) + sGroupName + Chr(34),,, TRUE )
+end function
+
+'-------------------------------------------------------------------------
+
+function GetXMLItemInstance ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String ) as String
+'/// Input:<ul><li>sXMLfile =&gt; Filename with full path</li>
+'///+ <li>sXMLsectionMaster =&gt; The master-section (mostly in OpenOffice.org the filename without extension)</li>
+'///+ <li>sXMLsection =&gt; Full way to the item</li></ul>
+ Dim sLine, sLine2 as String
+ Dim iStart, iEnd, i, iStr, iLen as Integer
+
+ sLine = GetXMLValueLine ( sXMLfile, sXMLsectionMaster, sXMLsection )
+ sLine2 = lcase ( sLine )
+ iStr = Instr ( sLine2, "instance" )
+ iLen = len ( sLine2 )
+ iStart = 0
+
+ if iStr=0 then
+ GetXMLItemInstance = "false"
+ exit function
+ else
+ for i=iStr to iLen
+ if iStart = 0 then
+ if Mid ( sLine2, i, 1 ) = Chr(34) then iStart = i
+ else
+ if Mid ( sLine2, i, 1 ) = Chr(34) then
+ iEnd = i
+ i= iLen + 1
+ end if
+ end if
+ next i
+ end if
+ if iStart = 0 then
+ GetXMLItemInstance = ""
+ else
+ GetXMLItemInstance = Mid ( sLine, iStart+1, iEnd - iStart - 1 )
+ end if
+end function
+
+'-------------------------------------------------------------------------
+
+function GetXMLItemEncoding ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String ) as String
+'/// Input: <ul><li>sXMLfile =&gt; Filename with full path</li>
+'///+ <li>sXMLsectionMaster =&gt; The master-section (mostly in OpenOffice.org the filename without extension)</li>
+'///+ <li>sXMLsection =&gt; Full way to the item</li></ul>
+ Dim sLine, sLine2 as String
+ Dim iStart, iEnd, i, iStr, iLen as Integer
+
+ sLine = GetXMLValueLine ( sXMLfile, sXMLsectionMaster, sXMLsection )
+ sLine2 = lcase ( sLine )
+ iStr = Instr ( sLine2, "encoding" )
+ iLen = len ( sLine2 )
+ iStart = 0
+
+ if iStr=0 then
+ GetXMLItemEncoding = "false"
+ exit function
+ else
+ for i=iStr to iLen
+ if iStart = 0 then
+ if Mid ( sLine2, i, 1 ) = Chr(34) then iStart = i
+ else
+ if Mid ( sLine2, i, 1 ) = Chr(34) then
+ iEnd = i
+ i= iLen + 1
+ end if
+ end if
+ next i
+ end if
+ if iStart = 0 then
+ GetXMLItemEncoding = ""
+ else
+ GetXMLItemEncoding = Mid ( sLine, iStart+1, iEnd - iStart - 1 )
+ end if
+end function
+
+'-------------------------------------------------------------------------
+
+function XMLWellFormed ( sFileName as String, optional bDebug as Boolean ) as Boolean
+'/// Input: File name as string
+'/// <i>(obsolete: Debug)</i>
+'/// Return: TRUE or FALSE
+ Dim InputstreamXML as string
+ XMLWellFormed = FALSE
+ if IsMissing(bDebug) = FALSE then
+ warnlog "Debugmode 'XMLWellFormed' is obsolete. FUNCTION is now a native TestTool function!"
+ end if
+ InputstreamXML = SAXCheckWellFormed(sFileName)
+ if InputstreamXML <> "" then
+ warnlog "Problem was found: " & InputstreamXML
+ else
+ printlog "File: '" & sFileName & "' is well formed."
+ XMLWellFormed = TRUE
+ end if
+end function
+
+'-------------------------------------------------------------------------
+
+function GetXMLValue2 ( sXMLfile as String, sXMLsectionMaster as String, sXMLsection as String ) as String
+'/// Input: <ul><li>sXMLfile =&gt; Filename with full path</li></ul>
+ Dim lsList(10) as String
+ Dim sInterim, sInterim2 as String
+ Dim i, ii, iLen, ibegin ,iEnd as Integer
+
+ sInterim = GetXMLValueLine ( sXMLfile, sXMLsectionMaster, sXMLsection,,, )
+ if sInterim = "" then
+ GetXMLValue2 = ""
+ exit function
+ end if
+
+ i = ExtractSections ( sXMLsection, lsList() )
+ sInterim2 = lsList(i)
+ iLen = len ( sInterim )
+ ii = len ( sInterim2 ) + 1
+
+ for i=ii to iLen
+ if mid( sInterim, i, 1 ) = ">" then
+ iBegin = i+1
+ i=iLen+1
+ end if
+ next i
+ iEnd = ( iLen - ii - 1 ) - iBegin
+ GetXMLValue2 = Mid ( sInterim, iBegin, iEnd )
+end function
+
+'-------------------------------------------------------------------------
+
+function GetBodiesItemStyleName ( AXMLfile as string , WhichItem as string , HowOften as integer , OPTIONAL B ) as string
+' Author: Joerg Sievers
+'/// With GetBodiesItemStyleName you can get the NAME of a STYLE from
+'///+ a item in the BODY of a OpenOffice.org XML-file.
+'/// <blockquote>OPTIONAL PARAMETER
+'///+ If there are more than one &quot;style-name&quot; tags in ONE line, you
+'///+ have to use an optional parameter.
+'/// <i>see also</i>:<ul>
+'///+ <li>GetXMLValueLineExtra</li></ul>
+'/// <u>simple Example</u>:
+'///+ String = GetBodiesStyleName (&quot;example.sxc&quot;) , &quot;table:table-row&quot; , 2)
+'///+ Return: The second STYLE-NAME of the &apos;table-row&apos;-tag in the office:body
+'/// <u>Example with optional parameter</u>:
+'///+ XML-line you want to parse for the text:span style-name and it is the second
+'///+ text:span-attribute in the office:body-section:
+'///+ <blockquote>
+'///+ &lt;text:p text:style-name=&quot;P1&quot;&gt;&lt;text:span text:style-name=&quot;T1&quot;&gt;The first text&lt;/text:span&gt;&lt;/text:p&gt;
+'///+ &lt;text:p text:style-name=&quot;P4&quot;&gt;&lt;text:span text:style-name=&quot;T4&quot;&gt;Just a text&lt;/text:span&gt;&lt;/text:p&gt;
+'///+ </blockquote>
+'///+ then you have to use:
+'///+ String = GetBodiesStyleName (&quot;example.sxc&quot;) , &quot;table:table-row&quot; , 2 , 1)
+'///+ The first ineteger (2) is for the second <text:span-entry in the file.
+'///+ The OPTIONAL second integer is the 'ONE' AFTER the first tag in the same line.
+ Dim FileNum as integer
+ Dim XMLRawLine as string
+ Dim XMLCLearedLine as string
+ Dim a as integer
+ Dim i as integer
+ Dim FoundEntry as boolean
+ Dim DelLeft as integer
+ Dim ItemPosInString as integer
+ Dim XMLCLearedLineWithoutLeft as string
+ Dim DelRight as integer
+ Dim XMLCLearedAndSeperatedLine as string
+
+ if Dir ( AXMLfile ) = "" then
+ warnlog "GetBodiesItemStyleName(...) : '" & AXMLfile & "' is missing!"
+ exit function
+ end if
+
+ WhichItem = "<" & WhichItem
+
+ a = 0
+ FoundEntry = FALSE
+
+ FileNum = FreeFile
+
+ Open AXMLfile For Input As #FileNum
+
+ Do until EOF(#FileNum) = TRUE OR FoundEntry = TRUE
+
+ Line input #FileNum, XMLRawLine
+' deleting tabs and spaces
+ XMLCLearedLine = TrimTab ( Trim ( XMLRawLine ) )
+' jumping to the office:body
+ if InStr(XMLCLearedLine , "<office:document-") <> 0 then
+
+ Do until EOF(#FileNum) = TRUE OR FoundEntry = TRUE
+ Line input #FileNum, XMLRawLine
+ XMLCLearedLine = TrimTab ( Trim ( XMLRawLine ) )
+' if the count of the item is the same as the one searching for...
+ ItemPosInString = InStr(XMLCLearedLine , WhichItem)
+ if ItemPosInString <> 0 then
+' warnlog "Debug: ItemPosInString = '" & ItemPosInString & "'"
+' Is there more than one time the 'WhichItem' in this line?
+' (MUST BE GIVEN BY OPTIONAL PARAMETER!)
+ if IsMissing(B) = FALSE then
+ For i = 1 to B
+ DelLeft = InStr(XMLCLearedLine , "style-name=" & CHR$(34))
+ XMLCLearedLineWithoutLeft = Mid(XMLCLearedLine, DelLeft+12)
+ XMLCLearedLine = XMLCLearedLineWithoutLeft
+ Next i
+ end if
+ a = a+1
+ if a=HowOften then
+' searching for exakt attribute stylename="
+ DelLeft = InStr(XMLCLearedLine , "style-name=" & CHR$(34))
+' extrcting, stripping all things after the style-name-attribute (=12 chars)
+ XMLCLearedLineWithoutLeft = Mid(XMLCLearedLine, DelLeft+12)
+' extracting the real name without the "
+ DelRight = InStr(XMLCLearedLineWithoutLeft , CHR$(34))
+' stripping it
+ XMLCLearedAndSeperatedLine = Mid(XMLCLearedLineWithoutLeft, 1 , DelRight-1)
+ GetBodiesItemStyleName = GetBodiesItemStyleName+XMLCLearedAndSeperatedLine
+ FoundEntry = TRUE
+ end if
+ end if
+ loop
+ end if
+
+ loop
+ Close #FileNum
+end function
+
+'-------------------------------------------------------------------------
+
+function GetLineInXMLBody ( AXMLfile as string , WhichItem as string , HowOften as integer) as string
+'Author: Joerg Sievers
+'/// With this function you can extract a whole line in &lt;office:body&gt;
+'///+ of a XML document. It is important to give this routine the
+'///+ correct <ITEM and the count in <office:body>.
+'/// <u>simple Example</u>:
+'///+ We want to find the 2nd (!) table:table-row item
+'///+ &lt;table:table-row table:style-name=&quot;ro2&quot; table:visibility=&quot;collapse&quot;&gt;
+'///+ String = GetLineInXMLBody(gOfficePath & ConvertPath(&quot;Content.xml&quot;) , &quot;table:table-row&quot; , 2)
+'///+ Return: The whole line of the second &apos;table:table-row&apos;-item.
+ Dim FileNum as integer
+ Dim XMLRawLine as string
+ Dim XMLCLearedLine as string
+ Dim a as integer
+ Dim FoundEntry as boolean
+ Dim ItemPosInString as integer
+
+ if Dir ( AXMLfile ) = "" then
+ warnlog "GetLineInXMLBody(...) : '" & AXMLfile & "' is missing!"
+ exit function
+ end if
+
+ WhichItem = "<" & WhichItem
+
+ a = 0
+ FoundEntry = FALSE
+
+ FileNum = FreeFile
+
+ Open AXMLfile For Input As #FileNum
+
+ Do until EOF(#FileNum) = TRUE OR FoundEntry = TRUE
+
+ Line input #FileNum, XMLRawLine
+' deleting tabs and spaces
+ XMLCLearedLine = TrimTab ( Trim ( XMLRawLine ) )
+' jumping to the office:body
+ if InStr(XMLCLearedLine , "office:body") <> 0 then
+ Do until EOF(#FileNum) = TRUE OR FoundEntry = TRUE
+ Line input #FileNum, XMLRawLine
+ XMLCLearedLine = TrimTab ( Trim ( XMLRawLine ) )
+' if the count of the item is the same as the one searching for...
+ ItemPosInString = InStr(XMLCLearedLine , WhichItem)
+ if ItemPosInString <> 0 then
+ a = a+1
+ if a=HowOften then
+ GetLineInXMLBody = XMLCLearedLine
+' printlog "Debug from 'GetLineInXMLBody'-function: '" & XMLCLearedLine & "'"
+ FoundEntry = TRUE
+ end if
+ end if
+ loop
+ end if
+ loop
+ Close #FileNum
+end function
+'
+'-------------------------------------------------------------------------------
+'
+function GetItemStyleName ( sMainElement$ , sUsedElement$ , sElement$ , sCount as integer , sStyleName$ ) as string
+'Author: Joerg Sievers
+'/// With GetItemStyleName you can get the NAME of a STYLE in ANY
+'///+ Element in a main element (like office:body-content) of a OpenOffice.org XML-file.
+'/// ATTENTION:
+'///+ If the second parameter is the SAME as the third one, you are not going into the
+'///+ third area. You will stay in the DOM in the second, where e.g. table:table element could
+'///+ be found.
+'/// <u>simple Example</u>:
+'///+ String = GetItemStyleName ( &quot;office:body&quot;, &quot;table:table&quot;, &quot;table:table-row&quot; , 3 , &quot;table:style-name&quot; )
+'///+ Return: The (attribute) name of the 3rd table-row node in a Writer document.
+'///+ With this name you can search in the style-section for the correct values.
+ Dim InputstreamXML as integer
+ Dim i as integer
+ Dim a as integer
+ Dim xElementName as string
+ 'Read the file and go to the main DOM node
+ SAXSeekElement(1)
+' If you need a debug mode, enable the printlog entries
+' -----------------------------------------------------
+' printlog " +-- function: GetItemStyleName ---------------------------"
+' printlog " | Main Node : " & SAXGetElementName
+ 'Go to the main element (like office:body, office:script, office:automatic-styles, etc.)
+ SAXSeekElement(sMainElement$)
+' printlog " | Main Element : " & sMainElement$
+ if sUsedElement$ <> sElement$ then
+ SAXSeekElement(sUsedElement$)
+' printlog " | Used Element : " & sUsedElement$
+ end if
+ InputstreamXML = SaxGetChildCount
+' printlog " | Count of Children : " & InputstreamXML
+ for i = 1 to InputstreamXML
+ SAXSeekElement(i)
+ if SAXGetNodeType = NodeTypeElement then
+ xElementName = SAXGetElementName
+ if xElementName = sElement$ then
+ a= a+1
+' printlog "("& i & " / " & a & ") Element:" & xElementName
+ if a = sCount then
+ GetItemStyleName = SAXGetAttributeValue(sStyleName$)
+' printlog " | Name of Element : " & GetItemStyleName
+ exit for
+ end if
+ end if
+ SAXSeekElement(0)
+ end if
+ next i
+' printlog " +---------------------------------------------------------"
+end function
+
+'-------------------------------------------------------------------------
+
+function GetXMLElementPath ( sMainElement$ , sUsedElement$ , sStyleName$, sStyleNameValue$ ) as string
+'Author: Joerg Sievers
+'///+ Returns the path (in a DOM tree) for an exact named element.
+'///+ With this string it is possible to navigate easily to a named
+'///+ element with <i>SAXSeekElement</i>-function.
+ Dim InputstreamXML as integer
+ Dim i as integer
+ Dim xAttributeValue as string
+ Dim a as integer
+ Dim xElementName as string
+ 'Read the file and go to the main DOM node
+ SAXSeekElement("/")
+ SAXSeekElement(1)
+ InputstreamXML = SaxGetChildCount
+' If you need a debug mode, enable the printlog entries
+' -----------------------------------------------------
+' printlog " +-- function: GetXMLElementPath --------------------------"
+' printlog " | Main Node : " & SAXGetElementName
+ 'Go to the main element (like office:body, office:script, office:automatic-styles, etc.)
+ SAXSeekElement(sMainElement$)
+' printlog " | Main Element : " & sMainElement$
+ InputstreamXML = SaxGetChildCount
+' printlog " | Count of Children : " & InputstreamXML
+ for i = 1 to InputstreamXML
+ SAXSeekElement(i)
+ xElementName = SAXGetElementName(i)
+ if xElementName = sUsedElement$ then
+ xAttributeValue = SAXGetAttributeValue(sStyleName$)
+ if xAttributeValue = sStyleNameValue$ then
+' printlog " | Elementname (" & i & ") : " & xElementName
+' printlog " | Attribute value : " & xAttributeValue
+ GetXMLElementPath = SAXGetElementPath
+ exit for
+ end if
+ end if
+ SAXSeekElement(0)
+ next i
+' printlog " +---------------------------------------------------------"
+end function
+
+'-------------------------------------------------------------------------
+
+function fWhereIsXMLElementInBody ( sSubDocumentRootElement as string , sDocumentRootElement as string , sWhichElement as string , OPTIONAL A ) as string
+Dim iXMLElements as integer
+Dim k as integer
+Dim iXMLElementsInSecondLayer as integer
+Dim i as integer
+'/// A function to parse a XML DOM of an office document and return the <i>Elementpath</i>
+'///+ of an element where you can search for in the <u>second level</u>.
+SAXSeekElement(sSubDocumentRootElement)
+'/// Input:<ol><li>Which element to be searched for</li>
+'///+ <li><i>SubDocumentRootElement</i>:
+'///+ <ul><li>office:document-meta</li>
+'///+ <li>office:document-styles</li>
+'///+ <li>office:document-content</li>
+'///+ <li>office:document-settings</li></ul></li>
+SAXSeekElement(sDocumentRootElement)
+'///+ <li><i>DocumentRootElement</i>:
+'///+ <ul><li>office:meta</li>
+'///+ <li>office:settings</li>
+'///+ <li>office:scripts</li>
+'///+ <li>office:font-decls</li>
+'///+ <li>office:styles</li>
+'///+ <li>office:automatic-styles</li>
+'///+ <li>office:master-styles</li>
+ '///+ <li>office:body</li></ul></li></ol>
+iXMLElements = SAXGetChildCount
+ 'If you need debug information, change next line value to TRUE
+ EnableQAErrors = FALSE
+ QAErrorLog "Debug: t_xml2.inc::fWhereIsXMLElementInBody::iXMLElements = "& iXMLElements
+for i = 1 to iXMLElements
+ if SAXHasElement(i) = TRUE then
+ SAXSeekElement(i)
+ QAErrorLog "Debug: t_xml2.inc::fWhereIsXMLElementInBody::SAXSeekelement(i) [" & i & "] = +- "& SAXGetElementname(i)
+ iXMLElementsInSecondLayer = SAXGetChildCount
+ QAErrorLog "Debug: t_xml2.inc::fWhereIsXMLElementInBody::iXMLElementsInSecondLayer [" & i & "] = +- "& iXMLElementsInSecondLayer
+ if iXMLElementsInSecondLayer <> 0 then
+ for k = 1 to iXMLElementsInSecondLayer
+ SAXSeekElement(k)
+ if SAXGetNodeType = NodeTypeElement then
+ QAErrorLog "Debug: t_xml2.inc::fWhereIsXMLElementInBody::SAXGetElementName(a) [" & k & "] = +- "& SAXGetElementName(k)
+ if IsMissing(A) then
+ if SAXGetElementName(k) = sWhichElement then
+ fWhereIsXMLElementInBody = SAXGetElementPath
+ QAErrorLog "Debug: t_xml2.inc::fWhereIsXMLElementInBody =" & fWhereIsXMLElementInBody
+ exit function
+ end if
+ else
+ if SAXGetElementName((k-1)+A) = sWhichElement then
+ SAXSeekElement(0)
+ SAXSeekElement(sWhichElement , A)
+ QAErrorLog "Debug: t_xml2.inc::fWhereIsXMLElementInBody::SAXGetChildCount =" & SAXGetChildCount
+ fWhereIsXMLElementInBody = SAXGetElementPath
+ QAErrorLog "Debug: t_xml2.inc::fWhereIsXMLElementInBody =" & fWhereIsXMLElementInBody
+ exit function
+ end if
+ end if
+ end if
+ SAXSeekElement(0)
+ next k
+ end if
+ SAXSeekElement(0)
+ end if
+next i
+end function
+'-------------------------------------------------------------------------
+
diff --git a/testautomation/global/tools/includes/optional/t_xml_filter1.inc b/testautomation/global/tools/includes/optional/t_xml_filter1.inc
new file mode 100644
index 000000000000..7ccab1c0db88
--- /dev/null
+++ b/testautomation/global/tools/includes/optional/t_xml_filter1.inc
@@ -0,0 +1,822 @@
+'encoding UTF-8 Do not remove or change this line!
+'*******************************************************************************
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' 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
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+'/******************************************************************************
+'*
+'* owner : helge.delfs@oracle.com
+'*
+'* short description : Tools / XML Filter Settings Resource Test
+'*
+'\******************************************************************************
+
+testcase tToolsXMLFilterSettings
+
+ Dim iCountOfXSLTStylesAtBeginning as integer
+ Dim iCountOfXSLTStylesAfterInstallCheck as integer
+ Dim iApplicationEntries as integer
+ Dim ia as integer
+ Dim ib as integer
+ Dim ic as integer
+ Dim iCountMsgBox as integer
+ Dim sErrorPointerTextForResultfile as string
+ Dim sFilterPackagePath as string
+ Dim sDocXMLTestFile as string
+ Dim sWhichFilterToUse as string
+ Dim sTempReadFilterName as string
+ Dim bREMOVEXSLT as boolean
+ Dim bJavaBroken as boolean
+
+ 'Not being used for Writer/WEB
+ if gApplication = "HTML" then
+ goto endsub
+ endif
+
+ 'Define the pointer where all warnlogs/QAErrorLogs will come from in this routine.
+ sErrorPointerTextForResultfile = "global::tools::inc::t_xml_filter1,inc::tToolsXMLFilterSettings: "
+
+ 'Later it will be detected if the JRE is working with the office installation
+ 'Here bJavaBroken will be set to the default behaviour (Java is detected and is working)
+ bJavaBroken = FALSE
+
+ '/// Opening new document.
+ printlog "- Opening new (application) document."
+ call hNewDocument
+ '/// Calling the menu item <i>Tools -&gt; XML Filter Settings</i>
+ ToolsXMLFilterSettings
+ printlog "- XML Filter Settings"
+ Kontext "XMLFilterSettings"
+ if XMLFilterSettings.Exists(1) then
+ call Dialogtest (XMLFilterSettings)
+ else
+ warnlog sErrorPointerTextForResultfile & "Slot to open the 'XML Filter Settings dialog' failed. Exiting."
+ goto endsub
+ end if
+ 'Counting the existing XSLT stylesheets to verify them after the
+ 'XSLT stylesheet Check. Setting bREMOVEXSLT = FALSE which only will
+ 'be TRUE if the count of before and after the check are different.
+ bREMOVEXSLT = FALSE
+ iCountOfXSLTStylesAtBeginning = FilterList.GetItemCount
+ '/// Closing the XML Filter Settings-dialog.
+ printlog "Closing the 'XML Filter Settings'-dialog."
+ CloseBtn.Click
+ '/// Checking if there are any XSLT stylesheets available (<i>finitialXMLSetting(&quot;docbook or word or excel&quot;)</i>).
+ printlog " + Checking if there are any XSLT stylesheets available."
+ select case gApplication
+ case "CALC" : sWhichFilterToUse = "excel"
+ case "WRITER" : sWhichFilterToUse = "word"
+ case else : sWhichFilterToUse = "docbook"
+ end select
+ if finitialXMLSetting(sWhichFilterToUse) = FALSE then
+ warnlog "It wasn't possible to use/install external XML filter. Test aborting!"
+ goto endsub
+ end if
+ ToolsXMLFilterSettings
+ printlog "Open XML Filter Settings dialog again."
+ Kontext "XMLFilterSettings"
+ iCountOfXSLTStylesAfterInstallCheck = FilterList.GetItemCount
+ if iCountOfXSLTStylesAfterInstallCheck <> iCountOfXSLTStylesAtBeginning then
+ bREMOVEXSLT = TRUE
+ end if
+ '/// Checking disabling of buttons on this dialog.
+ printlog " + Checking that Edit/Test/Delete/SaveToPackage buttons disabled when no filter is selected."
+ if EditBtn.IsEnabled then
+ FilterList.Typekeys "<MOD1 SPACE>"
+ sleep(1)
+ end if
+ if EditBtn.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "Edit button: Enabled when no entry is selected!?"
+ end if
+ if TestXSLTs.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "TestXSLTs button: Enabled when no entry is selected!?"
+ end if
+ if DeleteBtn.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "Delete button: Enabled when no entry is selected!?"
+ end if
+ if SaveToPackage.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "SaveToPackage button: Enabled when no entry is selected!?"
+ end if
+ '/// Checking disabling of buttons on this dialog.
+ printlog " + Checking that Edit/Test/Delete/SaveToPackage buttons enabled when one filter is selected."
+ if NOT EditBtn.IsEnabled then
+ FilterList.Typekeys "<SPACE>"
+ sleep(1)
+ end if
+ if NOT EditBtn.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "Edit button: Disabled when one entry is selected!?"
+ end if
+ if NOT TestXSLTs.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "TestXSLTs button: Disabled when one entry is selected!?"
+ end if
+ if NOT DeleteBtn.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "Delete button: Disabled when one entry is selected!?"
+ end if
+ if NOT SaveToPackage.IsEnabled then
+ warnlog sErrorPointerTextForResultfile & "SaveToPackage button: Disabled when one entry is selected!?"
+ end if
+ '/// <i>[Loop]</i>
+ '///+ <ol><li>Clicking the &quot;New&quot; button</li>
+ '///+ <li>Clicking the &quot;Edit&quot; button</li></ol>
+ Kontext "XMLFilterSettings"
+ FilterList.TypeKeys "<HOME>"
+ for ic = 1 to iCountOfXSLTStylesAfterInstallCheck
+ Kontext "XMLFilterSettings"
+ if ( XMLFilterSettings.exists( 2 ) ) then
+
+ 'read the filter names from the dialog.
+ sTempReadFilterName = FilterList.GetItemText(ic)
+
+ 'lower case comparison!
+ sTempReadFilterName = lcase(sTempReadFilterName)
+ if InStr(sTempReadFilterName , sWhichFilterToUse) <> 0 then
+ FilterList.TypeKeys "<DOWN> " , ic-1
+ ' printlog "DEBUG: Filtername: " & FilterList.GetItemText(ic)
+ WaitSlot() ' Sort of NOOP
+ endif
+ else
+ warnlog( "XML Filter Settings dialog too slow/not displayed" )
+ endif
+ next ic
+ for ia = 1 to 2
+ Kontext "XMLFilterSettings"
+ select case ia
+ case 1 : printlog "+- New"
+ NewBtn.Click
+ case 2 : printlog "+- Edit"
+ EditBtn.Click
+ end select
+ sleep(1)
+ Kontext "XMLFilter"
+ if XMLFilter.Exists(2) then
+ select case ia
+ case 1 : printlog " (XML Filter: New)"
+ case 2 : printlog " (XML Filter: Edit)"
+ end select
+ call Dialogtest (XMLFilter)
+ Tabcontrol.SetPage TabXMLGeneral
+ Kontext "TabXMLGeneral"
+ printlog " +- TabXMLGeneral"
+ if ia = 1 then
+ '/// If the &quot;New&quot;-button has been used:
+ call Dialogtest (TabXMLGeneral)
+ iApplicationEntries = Application.GetItemCount
+ '///+ <ul><li>Checking the count of applications. Should be 8.</li></ul>
+ printlog " Checking the count of applications. Should be 8."
+ if iApplicationEntries <> 8 then
+ warnlog " +- There should be 8 applications listed in the 'Application'-listbox but there are " & iApplicationEntries & " available!"
+ else
+ printlog " +- 8 applications listed in 'Application' listbox."
+ end if
+ end if
+ Kontext "XMLFilter"
+ Tabcontrol.SetPage TabXMLTransformation
+ Kontext "TabXMLTransformation"
+ printlog " +- TabXMLTransformation"
+ call Dialogtest (TabXMLTransformation)
+ '/// On tab page &quot;Transformation&quot; press all &quot;Browse&quot;-buttons.
+ printlog " +- On tab page 'Transformation' press all 'Browse'-buttons."
+ for ib = 1 to 4
+ Kontext "TabXMLTransformation"
+ select case ib
+ case 1 : printlog " +- Browse button 'DTD'"
+ DTDBrowse.Click
+ case 2 : printlog " +- Browse button 'XSLT for export'"
+ XSLTForExportBrowse.Click
+ case 3 : printlog " +- Browse button 'XSLT for import'"
+ XSLTForImportBrowse.Click
+ case 4 : printlog " +- Browse button 'Template for import'"
+ BrowseTemplateForImport.Click
+ end select
+
+ Kontext "OeffnenDlg"
+ if OeffnenDlg.Exists(3) then
+ '/// After every click on &quot;Browse&quot;-button an &quot;FileOpen&quot;-dialog shoud be visible. Cancel that dialog.
+ printlog " +- After every click on 'Browse'-button an 'FileOpen'-dialog shoud be visible. Cancel that dialog."
+ call Dialogtest (OeffnenDlg)
+ OeffnenDlg.Cancel
+
+ else
+ warnlog sErrorPointerTextForResultfile & "File Open dialog did not appeared."
+ end if
+ next ib
+ '/// [Loop end]
+ Kontext "XMLFilter"
+ if ( XMLFilter.exists( 3 ) ) then
+ printlog " +- Closing 'XML Filter: New Filter'-dialog."
+ XMLFilter.Cancel
+ else
+ warnlog( "XML Filter Dialog not available" )
+ endif
+ '/// Closing &quot;XML Filter: New Filter&quot;-dialog
+ else
+ warnlog "XML Filter dialog did not appeared!"
+ end if
+ next ia
+ Kontext "XMLFilterSettings"
+ '/// Clicking &quot;Test XLSTs&quot;-button.
+ printlog "+- Clicking 'Test XLSTs'-button."
+ TestXSLTs.Click
+
+ 'If it's an Import filter it makes no sense to test the export.
+ if sWhichFilterToUse = "docbook" then
+
+ printlog "+- E X P O R T (Writer, Impress)"
+ Kontext "TestXMLFilter"
+ if TestXMLFilter.Exists( 3 ) then
+ call Dialogtest(TestXMLFilter)
+ else
+ warnlog sErrorPointerTextForResultfile & "Testing of the XML filter not possible. Exiting."
+ Kontext "XMLFilterSettings"
+ '/// Closing the &quot;XML Filter Settings&quot;-dialog.
+ printlog "+- Closing the 'XML Filter Settings'-dialog."
+ 'Deinstall the XSLT stylesheet if this routine has
+ 'added one at the beginning.
+ if bREMOVEXSLT = TRUE then
+ call sRemoveXSLTFilter
+ end if
+ Kontext "XMLFilterSettings"
+ CloseBtn.Click
+ '/// Closing the opened application document.
+ printlog "- Closing the opened application document."
+ '/// ...if there is more than 1 document opened.
+ if GetDocumentCount > 1 then
+ call hCloseDocument
+ end if
+ 'Here the routine stops if the test dialog is not opening.
+ goto endsub
+ end if
+ ExportBrowseBtn.Click
+ '/// Press first &quot;Browse&quot;-button on the &quot;Test XML Filter&quot;-dialog.
+ printlog " +-Press first 'Browse'-button on the 'Test XML Filter'-dialog."
+
+ Kontext "OeffnenDlg"
+ if OeffnenDlg.Exists( 3 ) then
+ call Dialogtest (OeffnenDlg)
+ OeffnenDlg.Cancel
+ '/// Closing 'FileOpen'-Dialog.
+ printlog " +- Closing 'FileOpen'-Dialog."
+ else
+ warnlog sErrorPointerTextForResultfile & "File Open dialog did not occoured?!"
+ end if
+
+ Kontext "TestXMLFilter"
+ if ( TestXMLFilter.exists( 2 ) ) then
+ '/// If the application is Writer (because the default XSLT stylesheets are only Writer filter).
+ '///+<ul><li>Clicking on &quot;Current Document&quot;-button.</li></ul>
+ if gApplication = "WRITER" then
+ printlog " +- Clicking on 'Current Document'-button."
+ CurrentDocument.Click
+
+ '/// If Java is not [correctly] installed a messagebox will be shown and the test of the filter will be canceled!
+ Kontext "Messagebox"
+ if MessageBox.Exists( 5 ) then
+ warnlog Messagebox.GetText
+ try
+ Messagebox.Cancel
+ catch
+ Messagebox.OK
+ endcatch
+ else
+ try
+ Kontext "XMLFilterOutput"
+ if XMLFilterOutput.Exists(1) then
+ '/// &quot;XML Filter Output&quot;-dialog should be visible.
+ printlog " +- 'XML Filter Output'-dialog should be visible."
+ call Dialogtest(XMLFilterOutput)
+ '/// Clicking &quot;Validate&quot;-button.
+ printlog " +- Clicking 'Validate'-button."
+ Validate.Click
+ WaitSlot( 2000 )
+ '/// Checking that the validate output control is visible inside the window.
+ printlog " +- Checking that the validate output control is visible inside the window."
+ if NOT ValidateOutput.isVisible then
+ warnlog " +- Validate output is not visible!"
+ end if
+ '/// Closing &quot;XML Filter Output&quot;-dialog.
+ printlog " +- Closing 'XML Filter Output'-dialog."
+ XMLFilterOutput.Close
+
+ else
+ warnlog sErrorPointerTextForResultfile & "XML Filter Ouput dialog did not occoured."
+ end if
+ catch
+ warnlog "Testing of XSLTs does not work."
+ endcatch
+ end if
+ else
+ Kontext "TestXMLFilter"
+ printlog " +- 'Current Document'-button should not be enabled if no !"
+ if CurrentDocument.IsEnabled then
+ Kontext "DocumentWriter"
+ try
+ DocumentWriter.TypeKeys "A writer document exists!"
+ catch
+ QAErrorLog "'Current Document'-button is enabled but a 'Writer' XML filter has been selected! If there's no Writer document (may be in the background) also opened it would be a bug!"
+ endcatch
+ end if
+ end if
+ else
+ warnlog( "FATAL: TestXMLFilter not available" )
+ end if
+ printlog "+- I M P O R T"
+ endif
+
+
+ Kontext "TestXMLFilter"
+ if ( TestXMLFilter.exists( 2 ) ) then
+ '/// Clicking &quot;Browse&quot;-button (Import).
+ printlog " +- Clicking 'Browse'-button (Import)."
+ ImportBrowseBtn.Click
+
+ Kontext "OeffnenDlg"
+ if OeffnenDlg.Exists( 2 ) then
+ call Dialogtest (OeffnenDlg)
+ '/// Closing &quot;FileOpen&quot;-dialog.
+ printlog " +- Closing 'FileOpen'-dialog."
+ OeffnenDlg.Cancel
+ else
+ warnlog sErrorPointerTextForResultfile & "File Open dialog did not occoured?!"
+ end if
+ else
+ warnlog( "FATAL: Dialog <TestXMLFilter> is not available" )
+ endif
+
+ Kontext "TestXMLFilter"
+ '/// Checking if 'Display Source'-checkbox is checked (should not be!).
+ printlog " +- Checking if 'Display Source'-checkbox is checked (should not be!)."
+ if NOT DisplaySource.IsChecked then
+ DisplaySource.Check
+ else
+ warnlog " +- Display source should be NOT checked as default!"
+ end if
+ Kontext "TestXMLFilter"
+ select case sWhichFilterToUse
+ case "docbook" : '/// If DocBook XML is being tested use a DocBook XML file.
+ sDocXMLTestFile = ConvertPath(gTestToolPath & "global\input\xml_filter\docbook.xml")
+ case "word" : '/// If Word XML is being tested use a Word XML file.
+ sDocXMLTestFile = ConvertPath(gTestToolPath & "global\input\xml_filter\word.xml")
+ case "excel" : '/// If Excel XML is being tested use a Excel XML file.
+ sDocXMLTestFile = ConvertPath(gTestToolPath & "global\input\xml_filter\excel.xml")
+ case "xhtml" : '/// If XHTML is being tested that use a XHTML file.
+ sDocXMLTestFile = ConvertPath(gTestToolPath & "global\input\xml_filter\xhtml.xhtml")
+ case else : warnlog sErrorPointerTextForResultfile & "Wrong parameter has been used! Exiting"
+ Kontext "TestXMLFilter"
+ '/// Closing the &quot;Test XML Filter&quot;-dialog.
+ printlog " +- Closing the 'Test XML Filter'-dialog"
+ CloseBtn.Click
+ Kontext "XMLFilterSettings"
+ '/// Closing the &quot;XML Filter Settings&quot;-dialog.
+ printlog "+- Closing the 'XML Filter Settings'-dialog."
+ 'Deinstall the XSLT stylesheet if this routine has
+ 'added one at the beginning.
+ if bREMOVEXSLT = TRUE then
+ call sRemoveXSLTFilter
+ end if
+ Kontext "XMLFilterSettings"
+ CloseBtn.Click
+ '/// Closing the opened application document.
+ printlog "- Closing the opened application document."
+ '/// ...if there is more than 1 document opened.
+ if GetDocumentCount > 1 then
+ Call hCloseDocument
+ end if
+ goto endsub
+ end select
+ '/// Clicking &quot;Browse&quot;-button (Import) again to test it with the XML file.
+ printlog " +- Clicking 'Browse'-button (Import) again to test it the XML file."
+ ImportBrowseBtn.Click
+
+ Kontext "OeffnenDlg"
+ if OeffnenDlg.Exists( 3 ) then
+ call Dialogtest (OeffnenDlg)
+ Dateiname.SetText sDocXMLTestFile
+ Oeffnen.Click
+ try
+ ' If Java is not [correctly] installed a messagebox will be shown and the test of the filter will be canceled!
+ Kontext "Messagebox"
+ if Messagebox.Exists(2) then
+ for iCountMsgBox = 1 to 5
+ Kontext "Messagebox"
+ if MessageBox.Exists(2) then
+ if MessageBox.GetRT = 304 then
+ if iCountMsgBox = 1 then
+ warnlog sErrorPointerTextForResultfile & "No output window was visible! Exiting routine!"
+ endif
+ QAErrorLog "Dialog (" & iCountMsgBox & "): " & Messagebox.GetText
+ Messagebox.OK
+ bJavaBroken = TRUE
+ if iCountMsgBox > 3 then
+ warnlog "Instead of 3 times the missing Java RT box will be shown " & iCountMsgBox & " times."
+ endif
+ end if
+ else
+ exit for
+ endif
+ next iCountMsgBox
+ endif
+ Kontext "XMLFilterOutput"
+ if XMLFilterOutput.Exists(3) then
+ '/// &quot;XML Filter Output&quot;-dialog should be visible.
+ printlog " +- 'XML Filter Output'-dialog should be visible."
+ call Dialogtest(XMLFilterOutput)
+ '/// Clicking &quot;Validate&quot;-button.
+ printlog " +- Clicking 'Validate'-button."
+ Validate.Click
+
+ Kontext "Messagebox"
+ if Messagebox.Exists( 2 ) then
+ if bJavaBroken then
+ Messagebox.OK
+ else
+ warnlog Messagebox.GetText
+ Messagebox.OK
+ endif
+ endif
+ '/// Checking that the validate output control is visible inside the window.
+ printlog " +- Checking that the validate output control is visible inside the window."
+ Kontext "XMLFilterOutput"
+ if NOT ValidateOutput.isVisible then
+ warnlog " +- Validate output is not visible!"
+ end if
+ '/// Closing &quot;XML Filter Output&quot;-dialog.
+ printlog " +- Closing 'XML Filter Output'-dialog."
+ Kontext "XMLFilterOutput"
+ XMLFilterOutput.Close
+ else
+ warnlog sErrorPointerTextForResultfile & "No output window was visible! Exiting routine!"
+ Kontext "TestXMLFilter"
+ '/// Closing the &quot;Test XML Filter&quot;-dialog.
+ printlog " +- Closing the 'Test XML Filter'-dialog"
+ CloseBtn.Click
+ Kontext "XMLFilterSettings"
+ '/// Closing the &quot;XML Filter Settings&quot;-dialog.
+ printlog "+- Closing the 'XML Filter Settings'-dialog."
+ 'Deinstall the XSLT stylesheet if this routine has
+ 'added one at the beginning.
+ if bREMOVEXSLT = TRUE then
+ call sRemoveXSLTFilter
+ end if
+ Kontext "XMLFilterSettings"
+ CloseBtn.Click
+ '/// Closing the opened application document.
+ printlog "- Closing the opened application document."
+ '/// ...if there is more than 1 document opened.
+ if GetDocumentCount > 1 then
+ call hCloseDocument
+ end if
+ 'Here the routine stops if there is no Java installed or the output was not visible.
+ goto endsub
+ end if
+ catch
+ '/// If Java is not [correctly] installed a messagebox will be shown and the test of the filter will be canceled!
+ Kontext "Messagebox"
+ if MessageBox.Exists( 2 ) then
+ warnlog Messagebox.GetText
+ Messagebox.OK
+ warnlog sErrorPointerTextForResultfile & "Java is not usable! Exiting routine!"
+ Kontext "TestXMLFilter"
+ '/// Closing the &quot;Test XML Filter&quot;-dialog.
+ printlog " +- Closing the 'Test XML Filter'-dialog"
+ CloseBtn.Click
+ Kontext "XMLFilterSettings"
+ '/// Closing the &quot;XML Filter Settings&quot;-dialog.
+ printlog "+- Closing the 'XML Filter Settings'-dialog."
+ 'Deinstall the XSLT stylesheet if this routine has
+ 'added one at the beginning.
+ if bREMOVEXSLT = TRUE then
+ call sRemoveXSLTFilter
+ end if
+ Kontext "XMLFilterSettings"
+ CloseBtn.Click
+ '/// Closing the opened application document.
+ printlog "- Closing the opened application document."
+ '/// ...if there is more than 1 document opened.
+ if GetDocumentCount > 1 then
+ call hCloseDocument
+ end if
+ goto endsub
+ end if
+ endcatch
+ else
+ warnlog sErrorPointerTextForResultfile & "File Open dialog missing! Not able to load test documents. Exiting routine!"
+ Kontext "TestXMLFilter"
+ '/// Closing the &quot;Test XML Filter&quot;-dialog.
+ printlog " +- Closing the 'Test XML Filter'-dialog"
+ CloseBtn.Click
+ Kontext "XMLFilterSettings"
+ '/// Closing the &quot;XML Filter Settings&quot;-dialog.
+ printlog "+- Closing the 'XML Filter Settings'-dialog."
+ 'Deinstall the XSLT stylesheet if this routine has
+ 'added one at the beginning.
+ if bREMOVEXSLT = TRUE then
+ call sRemoveXSLTFilter
+ end if
+ Kontext "XMLFilterSettings"
+ CloseBtn.Click
+ '/// Closing the opened application document.
+ printlog "- Closing the opened application document."
+ '/// ...if there is more than 1 document opened.
+ if GetDocumentCount > 1 then
+ call hCloseDocument
+ end if
+ goto endsub
+ end if
+ '/// Closing the tested XML document
+ printlog " +- Closing the tested XML document"
+ '/// ...if there is more than 1 document opened.
+ if GetDocumentCount > 1 then
+ call hCloseDocument
+ else
+ QAErrorLog "#i27370# Normaly there should be a second document but there is none!"
+ end if
+
+ Kontext "TestXMLFilter"
+ if ( TestXMLFilter.exists( 1 ) ) then
+ if bJavaBroken = FALSE then
+ '/// Clicking on &quot;Recent File&quot;-Button.
+ printlog " +- Clicking on 'Recent File'-Button."
+ RecentFile.Click
+
+ Kontext "XMLFilterOutput"
+ '/// &quot;XML Filter Output&quot;-dialog should be visible.
+ printlog " +- 'XML Filter Output'-dialog should be visible."
+
+ Kontext "XMLFilterOutput"
+ '/// Closing &quot;XML Filter Output&quot;-dialog.
+ printlog " +- Closing 'XML Filter Output'-dialog."
+ XMLFilterOutput.Close
+
+ '/// Closing the tested XML document
+ printlog " +- Closing the tested XML document"
+ '/// ...if there is more than 1 document opened.
+ if GetDocumentCount > 1 then
+ call hCloseDocument
+ else
+ QAErrorLog "#i27370# Normaly there should be a second document but there is none!"
+ end if
+
+ Kontext "TestXMLFilter"
+ '/// Closing the &quot;Test XML Filter&quot;-dialog.
+ printlog " +- Closing the 'Test XML Filter'-dialog"
+ endif
+ else
+ warnlog( "Dialog <TestXMLFilter> is not available" )
+ endif
+
+ CloseBtn.Click
+
+ Kontext "XMLFilterSettings"
+ if ( XMLFilterSettings.exists( 1 ) ) then
+ '/// Clicking &quot;Delete&quot;-button.
+ printlog " +- Clicking 'Delete'-button"
+ DeleteBtn.Click
+ Kontext
+ if Active.Exists(1) then
+ if Active.GetRT = 304 then
+ Active.No
+ end if
+ end if
+ else
+ warnlog( "Dialog <XMLFilterSettings> is not available" )
+ endif
+
+ '/// Clicking 'Save to Package'-button.
+ Kontext "XMLFilterSettings"
+ if ( XMLFilterSettings.exists( 1 ) ) then
+
+ printlog " +- Clicking 'Save to Package'-button."
+ SaveToPackage.Click
+
+ Kontext "SpeichernDlg"
+ if SpeichernDlg.Exists( 3 ) then
+ call Dialogtest(SpeichernDlg)
+ SpeichernDlg.Cancel
+ '/// Closing 'File Save As'-Dialog.
+ printlog " +- Closing 'File Save As'-Dialog."
+ else
+ warnlog sErrorPointerTextForResultfile & "Save As dialog missing!"
+ end if
+ else
+ warnlog( "Dialog <XMLFilterSettings> is not available" )
+ endif
+
+
+ '/// Clicking 'Open Package'-button.
+ Kontext "XMLFilterSettings"
+ if ( XMLFilterSettings.exists( 1 ) ) then
+ printlog " +- Clicking 'Open Package'-button."
+ OpenPackage.Click
+
+ Kontext "OeffnenDlg"
+ if OeffnenDlg.Exists( 3 ) then
+ call Dialogtest(OeffnenDlg)
+ OeffnenDlg.Cancel
+ '/// Closing 'FileOpen'-Dialog.
+ printlog " +- Closing 'FileOpen'-Dialog."
+ else
+ warnlog sErrorPointerTextForResultfile & "File open dialog missing!"
+ end if
+ else
+ warnlog( "Dialog <XMLFilterSettings> is not available" )
+ endif
+
+
+ '/// Closing the &quot;XML Filter Settings&quot;-dialog.
+ Kontext "XMLFilterSettings"
+ if ( XMLFilterSettings.exists( 1 ) ) then
+ printlog "+- Closing the 'XML Filter Settings'-dialog."
+ 'Deinstall the XSLT stylesheet if this routine has
+ 'added one at the beginning.
+ if bREMOVEXSLT = TRUE then
+ call sRemoveXSLTFilter
+ end if
+ else
+ warnlog( "Dialog <XMLFilterSettings> is not available" )
+ endif
+
+
+ Kontext "XMLFilterSettings"
+ if ( XMLFilterSettings.exists( 1 ) ) then
+ CloseBtn.Click
+ '/// Closing the opened application document.
+ else
+ warnlog( "Dialog <XMLFilterSettings> is not available" )
+ endif
+
+ printlog "- Closing the opened application document."
+ '/// ...if there is more than 1 document opened.
+ if ( hFileCloseAll() <> 2 ) then
+ QAErrorLog "#i27370# Normaly there should be a second document but there is none!"
+ end if
+
+endcase
+
+'-------------------------------------------------------------------------
+
+sub fInitialXMLSetting( sXMLFilterType as string ) as boolean
+'/// This small function adds the latest and greatest XSLT stylesheet
+'///+ to the office.<br>
+'///+ The result is TRUE if the packages are already available or if they
+'///+ have been installed successfully in this routine.
+'/// <u>Input</u>: excel, word, docbook, xhtml
+'/// <u>Output</u>: TRUE or FALSE
+ Dim iCountOfDefaultXSLTStyles as integer
+ Dim iSecondCountOfDefaultXSLTStyles as integer
+ Dim sFilterPackagePath as string
+ Dim sTempReadFilterName as string
+ Dim ia as integer
+
+ 'Setting boolean to FALSE
+ fInitialXMLSetting = FALSE
+ '/// Opening new document.
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: Opening new " & gApplication & " document."
+ call hNewDocument
+ '/// Calling the menu item <i>Tools -&gt; XML Filter Settings</i>
+ ToolsXMLFilterSettings
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: Opening the XML Filter Settings dialog."
+ Kontext "XMLFilterSettings"
+ call Dialogtest (XMLFilterSettings)
+ '/// Checking if there are any XSLT stylesheets available.
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: Checking if there are any XSLT stylesheets available."
+ iCountOfDefaultXSLTStyles = FilterList.GetItemCount
+ ' printlog "DEBUG (a): " & iCountOfDefaultXSLTStyles
+ if iCountOfDefaultXSLTStyles <> 0 then
+ '/// Check if the same filter already exists.
+ 'Using lowercased input parameter.
+ sXMLFilterType = lcase(sXMLFilterType)
+ for ia = 1 to iCountOfDefaultXSLTStyles
+ Kontext "XMLFilterSettings"
+ 'read the filter names from the dialog.
+ sTempReadFilterName = FilterList.GetItemText(ia)
+ ' printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: DEBUG: (" & ia & ") " & sTempReadFilterName
+ 'lower case comparison!
+ sTempReadFilterName = lcase(sTempReadFilterName)
+ 'if a _part_ of the filtername matches the readed filter name the criteria is true!
+ if InStr(sTempReadFilterName , sXMLFilterType) <> 0 then
+ fInitialXMLSetting = TRUE
+ Kontext "XMLFilterSettings"
+ CloseBtn.Click
+ Call hCloseDocument
+ exit sub
+ end if
+ next ia
+ 'if no filter name maches the for...next loop will be left
+ 'and the same routine as used for 0 filter installed will
+ 'be used to install a filter package.
+ end if
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: The XML filter is not available: Adding the " & sXMLFilterType & " XML filter."
+ '///+ The packages will be used from &quot;qatesttool/global/input/xslt_stylesheets/*.jar&quot;
+ ' printlog "DEBUG: " & sXMLFilterType
+ select case sXMLFilterType
+ case "excel" : sFilterPackagePath = ConvertPath(gTestToolPath & "global\input\xslt_stylesheets\excel.jar")
+ case "word" : sFilterPackagePath = ConvertPath(gTestToolPath & "global\input\xslt_stylesheets\word.jar")
+ case "docbook" : sFilterPackagePath = ConvertPath(gTestToolPath & "global\input\xslt_stylesheets\docbook.jar")
+ case "xhtml" : sFilterPackagePath = ConvertPath(gTestToolPath & "global\input\xslt_stylesheets\xhtml.jar")
+ end select
+ OpenPackage.Click
+
+ Kontext "OeffnenDlg"
+ if ( OeffnenDlg.exists( 2 ) ) then
+ call Dialogtest (OeffnenDlg)
+ Dateiname.SetText sFilterPackagePath
+ Oeffnen.Click
+
+ Kontext
+ if Active.Exists(3) then
+ if Active.GetRT = 304 then
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: " & Active.GetText
+ Active.OK
+ Kontext "XMLFilterSettings"
+ iSecondCountOfDefaultXSLTStyles = FilterList.GetItemCount
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: Checking again the count of installed XSLT stylesheets."
+ if iSecondCountOfDefaultXSLTStyles <> (iCountOfDefaultXSLTStyles+1) then
+ warnlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: It was not possible to add " & sXMLFilterType & "-XML filter!"
+ warnlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: Test aborted!"
+ exit sub
+ else
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: XML filter has been installed!"
+ fInitialXMLSetting = TRUE
+ end if
+ end if
+ end if
+ else
+ warnlog( "Dialog <OeffnenDlg> is not available" )
+ endif
+
+ Kontext "XMLFilterSettings"
+ if ( XMLFilterSettings.exists( 1 ) ) then
+ '/// Closing the XML Filter Settings-dialog.
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: Closing the 'XML Filter Settings'-dialog."
+ CloseBtn.Click
+ else
+ warnlog( "Dialog <XMLFilterSettings> is not available" )
+ endif
+ '/// Closing the opened application document.
+ printlog "global::tools::inc::t_xml_filter1,inc::fInitialXMLSetting: Closing the opened application document."
+ call hCloseDocument
+end sub
+
+'-------------------------------------------------------------------------
+
+sub sRemoveXSLTFilter
+ Dim sXMLFilterType as string
+ Dim iCountOfDefaultXSLTStyles as integer
+ Dim ia as integer
+ Dim sTempReadFilterName as string
+ Kontext "XMLFilterSettings"
+ select case gApplication
+ case "CALC" : sXMLFilterType = "excel"
+ case "WRITER" : sXMLFilterType = "word"
+ case else : sXMLFilterType = "docbook"
+ end select
+ iCountOfDefaultXSLTStyles = FilterList.GetItemCount
+ if iCountOfDefaultXSLTStyles <> 0 then
+ '/// Search for the filter in filter list.
+ 'Using lowercased input parameter.
+ for ia = 1 to iCountOfDefaultXSLTStyles
+ Kontext "XMLFilterSettings"
+ 'read the filter names from the dialog.
+ sTempReadFilterName = FilterList.GetItemText(ia)
+ 'lower case comparison!
+ if InStr(sTempReadFilterName , sXMLFilterType) <> 0 then
+ '/// If the filter has been found delete it.
+ FilterList.TypeKeys "<HOME>"
+ wait( 100 )
+ FilterList.TypeKeys "<DOWN>" , (ia-1)
+ wait( 100 )
+ DeleteBtn.Click
+ Kontext
+ if Active.Exists(1) then
+ if Active.GetRT = 304 then
+ Active.Yes
+ end if
+ end if
+ exit sub
+ end if
+ next ia
+ else
+ warnlog "The count of XML filters has to be >0! Problem?"
+ end if
+end sub
+