'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 ' ' for a copy of the LGPLv3 License. ' '/************************************************************************ '* '* owner : joerg.skottke@sun.com '* '* short description : Functions for manipulation of strings '* '\****************************************************************************** function hRemoveLineBreaks( cString as string ) as string '///

Remove linebreaks and tabs from a string

'///Used to "beautify" content of messageboxes when printed to the log

'///Parameter(s): '///
    '///+
  1. Content of a messagebox as captured with .getText() (string)
  2. '///
'///Returns: '///
    '///+
  1. A string without tabs, linebreaks and linefeed (string)
  2. '///
'///Description: '/// end function '******************************************************************************* function hCompareSubStrings( cRef as string, cSub as string ) as integer '///

Find substring in a reference string

'///Used to determine that we are on "The first doc!"

'///Parameter(s): '///
    '///+
  1. Term to search for (string)
  2. '///+
  3. Term to be searched (string)
  4. '///
'///Returns: '///
    '///+
  1. Errorcode (integer)
  2. '/// '///
'///Description: '/// end function '****************************************************************************** function hGetDirTreeLevel( cFullPath as string ) as integer '///

Count the numbers of pathseparators in a path-string

'///Used to find the level of current directory within the directory tree.
'///+The function prints a warning when no pathseparators were found


'///Parameter(s): '///
    '///+
  1. Path (string) with no trailing pathseparator
  2. '///
'///Returns: '///
    '///+
  1. Number of Pathseparators within the string (integer)
  2. '/// '///
'///Description: '/// hGetDirTreeLevel() = iSeparatorCount end function '******************************************************************************* function hGetStringFromStaticTextField( oControl as object ) as string use "global\tools\includes\optional\t_accels.inc" '///

Get the string from a static textfield

'///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 "Select All" '///+ and "Copy" to get the string into the clipboard as .uno.Copy '///+ is not enabled.

'///Parameter(s):
'///
    '///+
  1. Name of the control (Object)
  2. '/// '///
'///Returns:
'///
    '///+
  1. Content of the field (String)
  2. '/// '///
const CFN = "hGetStringFromStaticTextField::" dim brc as boolean 'a multi purpose boolean returnvalue dim cSelectAll as string dim cCopy as string dim cText as string printlog( CFN & "Enter" ) '///Description: '/// hGetStringFromStaticTextField() = cText end function '******************************************************************************* function hConvertStringToLong( cValue as string ) as long '///

Convert a stringvalue to long int

'///The purpose of this function is to isolate the filesize from a string '///+ of the type "1.345 Bytes" 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 )

'///Parameter(s):
'///
    '///+
  1. String containing a long integer value (String)
  2. '/// '///
'///Returns:
'///
    '///+
  1. Value of the string as long integer (Long)
  2. '/// '///
const CFN = "hConvertStringToLong::" printlog( CFN & "Enter with option: " & cValue ) dim brc as boolean 'a multi purpose boolean returnvalue dim iLen as integer iLen = len( cValue ) dim iChar as integer dim cChar as string dim cStringValue as string cStringValue = "" '///Description: '/// end function