
import unohelper
from com.sun.star.task import XJobExecutor

class ImageExample(unohelper.Base, XJobExecutor):
    '''Class that implements the service registered in LibreOffice'''

    def __init__(self, context):
        self.context = context

g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
    ImageExample,
    'org.libreoffice.imageexample.ImageExample',
    ('com.sun.star.task.JobExecutor',))


import unohelper
from com.sun.star.task import XJobExecutor

class ImageExample(unohelper.Base, XJobExecutor):
    '''Class that implements the service registered in LibreOffice'''

    def __init__(self, context):
        self.context = context
        self.desktop = self.createUnoService("com.sun.star.frame.Desktop")
        self.graphics = self.createUnoService("com.sun.star.graphic.GraphicProvider")

    def createUnoService(self, name):
        return self.context.ServiceManager.createInstanceWithContext(name, self.context)

g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
    ImageExample,
    'org.libreoffice.imageexample.ImageExample',
    ('com.sun.star.task.JobExecutor',))

Add code to create needed uno services
Add code to create needed uno services

  
  import unohelper
  from com.sun.star.task import XJobExecutor
  
  class ImageExample(unohelper.Base, XJobExecutor):
      '''Class that implements the service registered in LibreOffice'''
  
      def __init__(self, context):
          self.context = context
+         self.desktop = self.createUnoService("com.sun.star.frame.Desktop")
+         self.graphics = self.createUnoService("com.sun.star.graphic.GraphicProvider")
+ 
+     def createUnoService(self, name):
+         return self.context.ServiceManager.createInstanceWithContext(name, self.context)
  
  g_ImplementationHelper = unohelper.ImplementationHelper()
  g_ImplementationHelper.addImplementation(
      ImageExample,
      'org.libreoffice.imageexample.ImageExample',
      ('com.sun.star.task.JobExecutor',))
  
Add code to create needed uno services
## Code Before:

import unohelper
from com.sun.star.task import XJobExecutor

class ImageExample(unohelper.Base, XJobExecutor):
    '''Class that implements the service registered in LibreOffice'''

    def __init__(self, context):
        self.context = context

g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
    ImageExample,
    'org.libreoffice.imageexample.ImageExample',
    ('com.sun.star.task.JobExecutor',))

## Instruction:
Add code to create needed uno services
## Code After:

import unohelper
from com.sun.star.task import XJobExecutor

class ImageExample(unohelper.Base, XJobExecutor):
    '''Class that implements the service registered in LibreOffice'''

    def __init__(self, context):
        self.context = context
        self.desktop = self.createUnoService("com.sun.star.frame.Desktop")
        self.graphics = self.createUnoService("com.sun.star.graphic.GraphicProvider")

    def createUnoService(self, name):
        return self.context.ServiceManager.createInstanceWithContext(name, self.context)

g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(
    ImageExample,
    'org.libreoffice.imageexample.ImageExample',
    ('com.sun.star.task.JobExecutor',))
