# Class CalcAddins

Object
WeakBase
CalcAddins

All Implemented Interfaces:
  `XLocalizable, XServiceInfo, XServiceName, XTypeProvider, XInterface, XWeak`

Direct Known Subclasses:
  `ReferencingFunctions`

public abstract class CalcAddins extends WeakBase implements XServiceName, XServiceInfo, XLocalizable
Base class for methods to export as formulas in the Apache OpenOffice spread sheet.

Since:
  0.8

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final XComponentContext`
  `context`
  Indirectly provides access to the service manager.

  ### Fields inherited from class com.sun.star.lib.uno.helper.WeakBase

  `_mapTypes`

  ### Fields inherited from interface com.sun.star.lang.XLocalizable

  `UNOTYPEINFO`

  ### Fields inherited from interface com.sun.star.lang.XServiceInfo

  `UNOTYPEINFO`

  ### Fields inherited from interface com.sun.star.lang.XServiceName

  `UNOTYPEINFO`

  ### Fields inherited from interface com.sun.star.lang.XTypeProvider

  `UNOTYPEINFO`

  ### Fields inherited from interface com.sun.star.uno.XWeak

  `UNOTYPEINFO`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CalcAddins(XComponentContext context)`
  Constructs add-ins for Calc.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected final Locale`
  `getJavaLocale()`
  Returns the locale as an object from the Java standard SDK.
  `final Locale`
  `getLocale()`
  Returns the current locale used by this instance.
  `protected final String`
  `getLocalizedMessage(Throwable exception)`
  Returns the localized message from the specified exception.
  `protected final Logger`
  `getLogger()`
  Returns the logger to use for logging warnings.
  `abstract String`
  `getServiceName()`
  The service name that can be used to create such an object by a factory.
  `final String[]`
  `getSupportedServiceNames()`
  Provides the supported service names of the implementation, including also indirect service names.
  `final void`
  `setLocale(Locale locale)`
  Sets the locale to be used by this object.
  `final boolean`
  `supportsService(String name)`
  Tests whether the specified service is supported, i.e. implemented by the implementation.

  ### Methods inherited from class com.sun.star.lib.uno.helper.WeakBase

  `finalize, getImplementationId, getTypes, queryAdapter`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface com.sun.star.lang.XServiceInfo

  `getImplementationName`

- ## Field Details

  - ### context

    protected final XComponentContext context
    Indirectly provides access to the service manager. For example, `com​.sun​.star​.sdb​.DatabaseContext` holds databases registered with OpenOffice.

- ## Constructor Details

  - ### CalcAddins

    protected CalcAddins(XComponentContext context)
    Constructs add-ins for Calc.
    Parameters:
      `context` - the value to assign to the `context` field.

- ## Method Details

  - ### getServiceName

    public abstract String getServiceName()
    The service name that can be used to create such an object by a factory.
    Specified by:
      `getServiceName` in interface `XServiceName`
    Returns:
      the service name.

  - ### getSupportedServiceNames

    public final String[] getSupportedServiceNames()
    Provides the supported service names of the implementation, including also indirect service names.
    Specified by:
      `getSupportedServiceNames` in interface `XServiceInfo`
    Returns:
      sequence of service names that are supported.

  - ### supportsService

    public final boolean supportsService(String name)
    Tests whether the specified service is supported, i.e. implemented by the implementation.
    Specified by:
      `supportsService` in interface `XServiceInfo`
    Parameters:
      `name` - name of service to be tested.
    Returns:
      `true` if the service is supported, `false` otherwise.

  - ### setLocale

    public final void setLocale(Locale locale)
    Sets the locale to be used by this object.
    Specified by:
      `setLocale` in interface `XLocalizable`
    Parameters:
      `locale` - the new locale.

  - ### getLocale

    public final Locale getLocale()
    Returns the current locale used by this instance.
    Specified by:
      `getLocale` in interface `XLocalizable`
    Returns:
      the current locale.

  - ### getJavaLocale

    protected final Locale getJavaLocale()
    Returns the locale as an object from the Java standard SDK.
    Returns:
      the current locale.

  - ### getLocalizedMessage

    protected final String getLocalizedMessage(Throwable exception)
    Returns the localized message from the specified exception. If no message is available, returns a default string. This method never return a null value.
    Parameters:
      `exception` - the exception for which to get the localized message.
    Returns:
      an error message to report to the user.

  - ### getLogger

    protected final Logger getLogger()
    Returns the logger to use for logging warnings.
    Returns:
      the logger to use.