Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc for Elexis version 2.1.7.dev vom 17.03.2013

ag.ion.bion.officelayer.internal.util
Class NumberFormatService

java.lang.Object
  extended by ag.ion.bion.officelayer.internal.util.NumberFormatService
All Implemented Interfaces:
INumberFormatService

public class NumberFormatService
extends java.lang.Object
implements INumberFormatService

Number format service.


Constructor Summary
NumberFormatService(ITextDocument textDocument, com.sun.star.util.XNumberFormatsSupplier xNumberFormatsSupplier)
          Constructs new NumberFormatService.
 
Method Summary
 java.lang.String applyFormat(java.lang.String text, INumberFormat numberFormat)
          Applies the given format to the given string and returns the formatted new string.
 java.lang.String convertNumberToString(int key, double number)
          Converts a number into a string.
 double convertStringToNumber(int key, java.lang.String text)
          Converts a string which contains a formatted number into a number.
 INumberFormat getNumberFormat(int key)
          Returns number format on the basis of the submitted key.
 INumberFormat[] getNumberFormats()
          Returns all available number formats.
 INumberFormat[] getNumberFormats(short type)
          Returns all available number formats of the given type.
 com.sun.star.util.XNumberFormatsSupplier getXNumberFormatsSupplier()
          Returns the OpenOffice.org XNumberFormatsSupplier interface it was created with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberFormatService

public NumberFormatService(ITextDocument textDocument,
                           com.sun.star.util.XNumberFormatsSupplier xNumberFormatsSupplier)
                    throws java.lang.IllegalArgumentException
Constructs new NumberFormatService.

Parameters:
textDocument - the textDocument of this service
xNumberFormatsSupplier - OpenOffice.org XNumberFormatsSupplier interface
Throws:
java.lang.IllegalArgumentException - if the OpenOffice.org XNumberFormatsSupplier interface is not valid
Method Detail

getXNumberFormatsSupplier

public com.sun.star.util.XNumberFormatsSupplier getXNumberFormatsSupplier()
Returns the OpenOffice.org XNumberFormatsSupplier interface it was created with.

Specified by:
getXNumberFormatsSupplier in interface INumberFormatService
Returns:
the OpenOffice.org XNumberFormatsSupplier interface it was created with

getNumberFormat

public INumberFormat getNumberFormat(int key)
                              throws UtilException
Returns number format on the basis of the submitted key.

Specified by:
getNumberFormat in interface INumberFormatService
Parameters:
key - key of the number format
Returns:
number format on the basis of the submitted key
Throws:
UtilException - if the number format is not available

getNumberFormats

public INumberFormat[] getNumberFormats()
                                 throws UtilException
Returns all available number formats.

Specified by:
getNumberFormats in interface INumberFormatService
Returns:
all available number formats
Throws:
UtilException - if the number formats are not available

getNumberFormats

public INumberFormat[] getNumberFormats(short type)
                                 throws UtilException
Returns all available number formats of the given type.

Specified by:
getNumberFormats in interface INumberFormatService
Parameters:
type - the type to get all number formats for as constants of NumberFormat
Returns:
all available number formats of the given type
Throws:
UtilException - if the number formats are not available

convertStringToNumber

public double convertStringToNumber(int key,
                                    java.lang.String text)
                             throws UtilException
Converts a string which contains a formatted number into a number. If this is a text format, the string will not be converted.

Specified by:
convertStringToNumber in interface INumberFormatService
Parameters:
key - the key of the format for the conversion
text - the text to be converted
Returns:
the number
Throws:
UtilException - if the conversion fails

convertNumberToString

public java.lang.String convertNumberToString(int key,
                                              double number)
                                       throws UtilException
Converts a number into a string.

Specified by:
convertNumberToString in interface INumberFormatService
Parameters:
key - the key of the format for the conversion
number - the number to be converted
Returns:
the string
Throws:
UtilException - if the conversion fails

applyFormat

public java.lang.String applyFormat(java.lang.String text,
                                    INumberFormat numberFormat)
                             throws UtilException
Applies the given format to the given string and returns the formatted new string.

Specified by:
applyFormat in interface INumberFormatService
Parameters:
text - the text to apply number format for
numberFormat - the number format to be applied
Returns:
the formatted new string
Throws:
UtilException - if format fails

Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc for Elexis version 2.1.7.dev vom 17.03.2013