'encoding UTF-8 Do not remove or change this line! '************************************************************** ' ' Licensed to the Apache Software Foundation (ASF) under one ' or more contributor license agreements. See the NOTICE file ' distributed with this work for additional information ' regarding copyright ownership. The ASF licenses this file ' to you under the Apache License, Version 2.0 (the ' "License"); you may not use this file except in compliance ' with the License. You may obtain a copy of the License at ' ' http://www.apache.org/licenses/LICENSE-2.0 ' ' Unless required by applicable law or agreed to in writing, ' software distributed under the License is distributed on an ' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ' KIND, either express or implied. See the License for the ' specific language governing permissions and limitations ' under the License. ' '************************************************************** ' ** ' ** short description : tools for tools/macro test ' ** '\****************************************************************************** function hSelectTheLastModule( bEditEnabled as Boolean ) as string '///

Select the last (editable) module in the macro seletor treelist 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 '///

Create a new Basic module for the current document

'///Starting point: Basic Macro Organizer is visible and has focus 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 did not open" ) hCreateModuleForDoc() = false endif else warnlog( CFN & "Failed to click 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 '///

Open the Basic Library/Module/Dialog Organizer

'///Starting point: Basic IDE is open and has focus '/// end function '******************************************************************************* function hSelectBasicObjectOrganizerTab( iTabPage as integer ) as boolean const CFN = "hSelectBasicObjectOrganizerTab::" '///

Switch between tab pages in the Basic Object Organizer

'///Starting point: Masic Object Organizer is visible and has focus '///
    '///+
  1. 1 = Modules
  2. '///+
  3. 2 = Dialogs
  4. '///+
  5. 3 = Libraries
  6. '///
'///Description: '/// hSelectBasicObjectOrganizerTab() = false end function '******************************************************************************* function hDeleteLibrary( iLocation as integer, cLibName as string ) as boolean '///

Delete a library by name via Macro Object Organizer

'///Starting point: Plain document '/// end function '******************************************************************************* function hNameBasicModule( cName as string ) as boolean '///

Name a Basic Module

'///Starting point: Clicked "New..." button in Basic Macro organizer.
'///+ 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.

'///Input: '///
    '///+
  1. Name of the module (string)
  2. '///
'///Returns: '///
    '///+
  1. Errorcondition (Boolean)
  2. '///
      '///+
    • TRUE if name is valid, module has been created
    • '///+
    • FALSE if name is invalid or naming dialog does not exist
    • '///
    '///
'///Description: '/// end function