示例#1
0
 def __init__ (self, ctx):
     self.ctx = ctx
     # In this extension, French is default language.
     # It is assumed that those who need to use the French dictionaries understand French and may not understand English.
     xSettings = helpers.getConfigSetting("/org.openoffice.Setup/L10N", False)
     sLocale = xSettings.getByName("ooLocale")  # Note: look at ooSetupSystemLocale value?
     self.sLang = sLocale[0:2]
示例#2
0
文件: Options.py 项目: mrmen/machange
 def __init__ (self, ctx):
     self.ctx = ctx
     self.xSvMgr = self.ctx.ServiceManager
     self.xContainer = None
     #self.xNode = helpers.getConfigSetting("/org.openoffice.Lightproof_%s/Leaves"%pkg, True)
     self.xNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Leaves", True)
     self.nSecret = 0
示例#3
0
 def actionPerformed (self, actionEvent):
     try:
         if self.xRB_m.getState():
             self.sSelectedDic = 'moderne'
         elif self.xRB_c.getState():
             self.sSelectedDic = 'classique'
         elif self.xRB_r.getState():
             self.sSelectedDic = 'reforme1990'
         elif self.xRB_t.getState():
             self.sSelectedDic = 'toutesvariantes'
         else:
             # no dictionary selected
             pass
         if self.sSelectedDic and self.sSelectedDic != self.sCurrentDic :
             # Modify the registry
             xSettings = helpers.getConfigSetting("/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr", True)
             xLocations = xSettings.getByName("Locations")
             v1 = xLocations[0].replace(self.sCurrentDic, self.sSelectedDic)
             v2 = xLocations[1].replace(self.sCurrentDic, self.sSelectedDic)
             #xSettings.replaceByName("Locations", xLocations)  # doesn't work, see line below
             uno.invoke(xSettings, "replaceByName", ("Locations", uno.Any("[]string", (v1, v2))))
             xSettings.commitChanges()
         self.xContainer.endExecute()
     except:
         traceback.print_exc()
示例#4
0
    def run (self, sLang):
        try:
            ui.selectLang(sLang)

            self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)

            # dialog
            self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
            self.xDialog.Width = 160
            self.xDialog.Height = 320
            self.xDialog.Title = ui.get('windowtitle')
            xWindowSize = helpers.getWindowSize()
            self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2))
            self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2))

            # xWidgets
            nLblWidth = 140
            nURLcolor = 0x4444FF

            xFD1 = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
            xFD1.Height = 10
            xFD1.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
            xFD1.Name = "Verdana"

            xFD2 = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
            xFD2.Height = 10
            xFD2.Name = "Verdana"

            xFD3 = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
            xFD3.Height = 12
            xFD3.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
            xFD3.Name = "Verdana"

            # logo
            xDefaultContext = self.ctx.ServiceManager.DefaultContext
            xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
            sExtPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR")
            self._addWidget('imgMainLogo', 'ImageControl', 5, 5, 150, 80, ImageURL = sExtPath+"/img/logo120_text.png", Border = 0, ScaleMode = 1)

            # Infos
            self._addWidget('lblVersion', 'FixedText', 10, 90, nLblWidth, 10, Label = ui.get('version'), Align = 1, FontDescriptor = xFD2)
            self._addWidget('lblLicence', 'FixedText', 10, 100, nLblWidth, 10, Label = ui.get('license'), Align = 1, FontDescriptor = xFD2)
            self._addWidget('lblWebsite', 'FixedHyperlink', 10, 110, nLblWidth, 10, Label = ui.get('website'), Align = 1, \
                            URL="https://grammalecte.net/?from=grammalecte-lo", FontDescriptor = xFD1, TextColor = nURLcolor)

            # Python
            self._addWidget('lblpython', 'FixedText', 10, 125, nLblWidth//2, 10, Align = 1, TextColor = 0x666666, FontDescriptor = xFD2, \
                            Label = ui.get('pythonver') + "{0[0]}.{0[1]}.{0[2]}".format(sys.version_info))
            self._addWidget('console_button', 'Button', nLblWidth-40, 124, 40, 10, \
                            Label = ui.get('console'), FontDescriptor = xFD2, TextColor = 0x666666)

            # other
            self._addWidget('line', 'FixedLine', 10, 140, nLblWidth, 10)

            # sponsors
            self._addWidget('lblMsg', 'FixedText', 10, 155, nLblWidth, 10, Label = ui.get('message'), FontDescriptor = xFD2, Align = 1)
            self._addWidget('lblURL1', 'FixedHyperlink', 10, 170, nLblWidth, 10, Label = ui.get('sponsor'), \
                            Align = 1, URL="http://lamouette.org/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor)
            self._addWidget('imgSponsor', 'ImageControl', 5, 180, 150, 50, ImageURL = sExtPath+"/img/LaMouette_small.png", Border = 0, ScaleMode = 1)
            self._addWidget('lblURL2', 'FixedHyperlink', 10, 235, nLblWidth, 10, Label = ui.get('sponsor2'), \
                            Align = 1, URL="https://www.algoo.fr/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor)
            self._addWidget('imgSponsor2', 'ImageControl', 5, 245, 150, 50, ImageURL = sExtPath+"/img/Algoo_logo.png", Border = 0, ScaleMode = 1)
            self._addWidget('lblURL3', 'FixedHyperlink', 10, 300, nLblWidth, 10, Label = ui.get('link'), \
                            Align = 1, URL="https://grammalecte.net/#thanks", FontDescriptor = xFD1, TextColor = nURLcolor)

            # container
            self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
            self.xContainer.setModel(self.xDialog)
            self.xContainer.getControl('console_button').addActionListener(self)
            self.xContainer.getControl('console_button').setActionCommand('Console')
            self.xContainer.setVisible(False)
            xToolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
            self.xContainer.createPeer(xToolkit, None)
            self.xContainer.execute()
        except:
            traceback.print_exc()
示例#5
0
    def run (self, sLang):
        dUI = ds_strings.getUI(sLang)

        # what is the current dictionary
        xSettings = helpers.getConfigSetting("/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr", False)
        xLocations = xSettings.getByName("Locations")
        m = re.search(r"fr-(\w*)\.(?:dic|aff)", xLocations[0])
        self.sCurrentDic = m.group(1)
        
        # dialog
        self.dialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.dialog.Width = 200
        self.dialog.Height = 290
        self.dialog.Title = dUI.get('title', "#title#")
        
        # xWidgets
        padding = 10
        hspace = 60
        posY1 = 20; posY2 = posY1 + hspace; posY3 = posY2 + hspace; posY4 = posY3 + hspace; posY5 = posY4 + hspace + 10;
        nLblWidth = 170
        nLblHeight = 20
        nDescWidth = 170
        nDescHeight = 40
        
        xFD1 = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFD1.Height = 12
        xFD1.Name = "Verdana"
        
        xFD2 = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFD2.Height = 11
        xFD2.Name = "Verdana"
        
        xFD3 = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFD3.Height = 10
        xFD3.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
        xFD3.Name = "Verdana"
        
        gbm = self.addWidget('groupbox', 'GroupBox', 5, 5, 190, 260, Label = dUI.get('choose', "#choose#"), FontDescriptor = xFD1, FontRelief = 1, TextColor = 0xAA2200)
        
        # Note: the only way to group RadioButtons is to create them successively
        rbm_m = self.addWidget('rb-moderne', 'RadioButton', padding, posY1, nLblWidth, nLblHeight, Label = dUI.get('moderne', "#moderne#"), FontDescriptor = xFD2, FontRelief = 1, TextColor = 0x0022AA)
        self.xRB_m = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlRadioButton', self.ctx)
        self.xRB_m.setModel(rbm_m)
        rbm_c = self.addWidget('rb-classique', 'RadioButton', padding, posY2, nLblWidth, nLblHeight, Label = dUI.get('classique', "#classique#"), FontDescriptor = xFD2, FontRelief = 1, TextColor = 0x0022AA)
        self.xRB_c = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlRadioButton', self.ctx)
        self.xRB_c.setModel(rbm_c)
        rbm_r = self.addWidget('rb-reforme1990', 'RadioButton', padding, posY3, nLblWidth, nLblHeight, Label = dUI.get('reforme1990', "#reforme1990#"), FontDescriptor = xFD2, FontRelief = 1, TextColor = 0x0022AA)
        self.xRB_r = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlRadioButton', self.ctx)
        self.xRB_r.setModel(rbm_r)
        rbm_t = self.addWidget('rb-toutesvariantes', 'RadioButton', padding, posY4, nLblWidth, nLblHeight, Label = dUI.get('toutesvariantes', "#toutesvariantes#"), FontDescriptor = xFD2, FontRelief = 1, TextColor = 0x0022AA)
        self.xRB_t = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlRadioButton', self.ctx)
        self.xRB_t.setModel(rbm_t)
        
        label_m = self.addWidget('label_m', 'FixedText', 20, posY1+10, nDescWidth, nDescHeight, Label = dUI.get('descModern', "#descModern#"), MultiLine = True)
        label_c = self.addWidget('label_c', 'FixedText', 20, posY2+10, nDescWidth, nDescHeight, Label = dUI.get('descClassic', "#descClassic#"), MultiLine = True)
        label_r = self.addWidget('label_r', 'FixedText', 20, posY3+10, nDescWidth, nDescHeight, Label = dUI.get('descReform', "#descReform#"), MultiLine = True)
        label_t = self.addWidget('label_t', 'FixedText', 20, posY4+10, nDescWidth, nDescHeight, Label = dUI.get('descAllvar', "#descAllvar#"), MultiLine = True)
        
        if self.sCurrentDic:
            self.setRadioButton(self.sCurrentDic)
            sMsgLabel = dUI.get('restart', "#restart#")
            bButtonActive = True
        else:
            sMsgLabel = dUI.get('error', "#error#")
            bButtonActive = False
        
        label_info = self.addWidget('label_info', 'FixedText', 10, posY4+50, 180, 10, Label = sMsgLabel, TextColor = 0xAA2200, MultiLine = True)
        button = self.addWidget('select', 'Button', padding+40, posY5, 100, 14, Label = dUI.get('select', "#select#"), FontDescriptor = xFD3, TextColor = 0x004400, Enabled = bButtonActive)
        
        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.dialog)
        self.xContainer.getControl('select').addActionListener(self)
        self.xContainer.setVisible(False)
        toolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
        self.xContainer.createPeer(toolkit, None)
        self.xContainer.execute()
示例#6
0
    def run(self, sLang):
        # lang
        ui.selectLang(sLang)

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext(
            'com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 400
        self.xDialog.Height = 280
        self.xDialog.Title = ui.get('title')
        xWindowSize = helpers.getWindowSize()
        self.xDialog.PositionX = int((xWindowSize.Width / 2) -
                                     (self.xDialog.Width / 2))
        self.xDialog.PositionY = int((xWindowSize.Height / 2) -
                                     (self.xDialog.Height / 2))

        # fonts
        xFDTitle = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFDTitle.Height = 9
        xFDTitle.Weight = uno.getConstantByName(
            "com.sun.star.awt.FontWeight.BOLD")
        xFDTitle.Name = "Verdana"

        xFDMono = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFDMono.Height = 8
        xFDMono.Name = "Monospace"

        # widget
        nX = 10
        nY1 = 5
        nY2 = nY1 + 200

        nWidth = self.xDialog.Width - 20
        nHeight = 10

        # Add
        self._addWidget("new_entry",
                        'FixedLine',
                        nX,
                        nY1,
                        nWidth,
                        nHeight,
                        Label=ui.get("new_entry"),
                        FontDescriptor=xFDTitle)

        self._addWidget('newnamelbl',
                        'FixedText',
                        nX,
                        nY1 + 10,
                        60,
                        nHeight,
                        Label=ui.get("name"))
        self._addWidget('newreplacelbl',
                        'FixedText',
                        nX + 65,
                        nY1 + 10,
                        130,
                        nHeight,
                        Label=ui.get("pattern"))
        self._addWidget('newbylbl',
                        'FixedText',
                        nX + 200,
                        nY1 + 10,
                        100,
                        nHeight,
                        Label=ui.get("repl"))

        self.xNewName = self._addWidget('newname',
                                        'Edit',
                                        nX,
                                        nY1 + 20,
                                        60,
                                        10,
                                        FontDescriptor=xFDMono)
        self.xNewPattern = self._addWidget('newreplace',
                                           'Edit',
                                           nX + 65,
                                           nY1 + 20,
                                           130,
                                           10,
                                           FontDescriptor=xFDMono)
        self.xNewRepl = self._addWidget('newby',
                                        'Edit',
                                        nX + 200,
                                        nY1 + 20,
                                        100,
                                        10,
                                        FontDescriptor=xFDMono)
        self.xNewRegex = self._addWidget('newregex',
                                         'CheckBox',
                                         nX + 305,
                                         nY1 + 22,
                                         35,
                                         nHeight,
                                         Label=ui.get("regex"),
                                         HelpText=ui.get("regex_help"))
        self.xNewCaseSens = self._addWidget('newcasesens',
                                            'CheckBox',
                                            nX + 340,
                                            nY1 + 22,
                                            40,
                                            nHeight,
                                            Label=ui.get("casesens"),
                                            HelpText=ui.get("casesens_help"),
                                            State=True)

        self._addWidget('order_info',
                        'FixedText',
                        nX,
                        nY1 + 32,
                        300,
                        nHeight,
                        Label=ui.get("order_info"))
        self._addWidget('add',
                        'Button',
                        self.xDialog.Width - 50,
                        nY1 + 31,
                        40,
                        11,
                        Label=ui.get('add'))

        lColumns = [
            {
                "Title": ui.get("name"),
                "ColumnWidth": 80
            },
            {
                "Title": ui.get("pattern"),
                "ColumnWidth": 160
            },
            {
                "Title": ui.get("repl"),
                "ColumnWidth": 120
            },
            {
                "Title": ui.get("regex"),
                "ColumnWidth": 60
            },
            {
                "Title": ui.get("casesens"),
                "ColumnWidth": 60
            },
        ]
        self.xGridModel = self._addGrid("list_grid", nX, nY1 + 45, nWidth, 150,
                                        lColumns)

        # Modify
        self._addWidget("edit_entry",
                        'FixedLine',
                        nX,
                        nY2,
                        nWidth,
                        nHeight,
                        Label=ui.get("edit_entry"),
                        FontDescriptor=xFDTitle)
        self._addWidget('editnamelbl',
                        'FixedText',
                        nX,
                        nY2 + 10,
                        60,
                        nHeight,
                        Label=ui.get("name"))
        self._addWidget('editreplacelbl',
                        'FixedText',
                        nX + 65,
                        nY2 + 10,
                        130,
                        nHeight,
                        Label=ui.get("pattern"))
        self._addWidget('editbylbl',
                        'FixedText',
                        nX + 200,
                        nY2 + 10,
                        100,
                        nHeight,
                        Label=ui.get("repl"))

        self.xEditName = self._addWidget('editname',
                                         'Edit',
                                         nX,
                                         nY2 + 20,
                                         60,
                                         10,
                                         FontDescriptor=xFDMono,
                                         Enabled=False)
        self.xEditPattern = self._addWidget('editreplace',
                                            'Edit',
                                            nX + 65,
                                            nY2 + 20,
                                            130,
                                            10,
                                            FontDescriptor=xFDMono,
                                            Enabled=False)
        self.xEditRepl = self._addWidget('editby',
                                         'Edit',
                                         nX + 200,
                                         nY2 + 20,
                                         100,
                                         10,
                                         FontDescriptor=xFDMono,
                                         Enabled=False)
        self.xEditRegex = self._addWidget('editregex',
                                          'CheckBox',
                                          nX + 305,
                                          nY2 + 22,
                                          35,
                                          nHeight,
                                          Label=ui.get("regex"),
                                          HelpText=ui.get("regex_help"),
                                          Enabled=False)
        self.xEditCaseSens = self._addWidget('editcasesens',
                                             'CheckBox',
                                             nX + 340,
                                             nY2 + 22,
                                             40,
                                             nHeight,
                                             Label=ui.get("casesens"),
                                             HelpText=ui.get("casesens_help"),
                                             Enabled=False)

        self.xDeleteButton = self._addWidget('delete',
                                             'Button',
                                             nX,
                                             nY2 + 31,
                                             40,
                                             11,
                                             Label=ui.get('delete'),
                                             TextColor=0xAA0000,
                                             Enabled=False)
        self.xApplyButton = self._addWidget('apply',
                                            'Button',
                                            nX + (self.xDialog.Width / 2) - 20,
                                            nY2 + 31,
                                            40,
                                            11,
                                            Label=ui.get('apply'),
                                            HelpText="apply_help",
                                            TextColor=0x0000AA,
                                            Enabled=False)
        self.xApplyRes = self._addWidget('apply_res',
                                         'FixedText',
                                         nX + (self.xDialog.Width / 2) + 30,
                                         nY2 + 33,
                                         60,
                                         10,
                                         Label="",
                                         Align=2,
                                         Enabled=False)
        self.xModifyButton = self._addWidget('modify',
                                             'Button',
                                             self.xDialog.Width - 50,
                                             nY2 + 31,
                                             40,
                                             11,
                                             Label=ui.get('modify'),
                                             TextColor=0x00AA00,
                                             Enabled=False)

        # import, export, save, close
        self._addWidget("buttons_line", 'FixedLine', nX,
                        self.xDialog.Height - 30, nWidth, nHeight)
        self._addWidget('import',
                        'Button',
                        nX,
                        self.xDialog.Height - 20,
                        50,
                        14,
                        Label=ui.get('import'),
                        FontDescriptor=xFDTitle,
                        TextColor=0x0000AA)
        self._addWidget('export',
                        'Button',
                        nX + 55,
                        self.xDialog.Height - 20,
                        50,
                        14,
                        Label=ui.get('export'),
                        FontDescriptor=xFDTitle,
                        TextColor=0x00AA00)
        self._addWidget('delete_all',
                        'Button',
                        nX + (self.xDialog.Width / 2) - 35,
                        self.xDialog.Height - 20,
                        70,
                        14,
                        Label=ui.get('delete_all'),
                        FontDescriptor=xFDTitle,
                        TextColor=0xAA0000)
        self._addWidget('save_and_close',
                        'Button',
                        self.xDialog.Width - 110,
                        self.xDialog.Height - 20,
                        100,
                        14,
                        Label=ui.get('save_and_close'),
                        FontDescriptor=xFDTitle,
                        TextColor=0x00AA00)

        # data
        self.dRules = {}
        self.iSelectedRow = -1
        self.nFieldMaxLen = 250

        # load configuration
        self.xGLOptionNode = helpers.getConfigSetting(
            "/org.openoffice.Lightproof_${implname}/Other/", True)
        self.loadRules()

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext(
            'com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControl = self.xContainer.getControl('list_grid')
        self.xGridControl.addSelectionListener(self)
        self.xContainer.getControl('add').addActionListener(self)
        self.xContainer.getControl('add').setActionCommand('Add')
        self.xContainer.getControl('delete').addActionListener(self)
        self.xContainer.getControl('delete').setActionCommand('Delete')
        self.xContainer.getControl('apply').addActionListener(self)
        self.xContainer.getControl('apply').setActionCommand('Apply')
        self.xContainer.getControl('modify').addActionListener(self)
        self.xContainer.getControl('modify').setActionCommand('Modify')
        self.xContainer.getControl('import').addActionListener(self)
        self.xContainer.getControl('import').setActionCommand('Import')
        self.xContainer.getControl('export').addActionListener(self)
        self.xContainer.getControl('export').setActionCommand('Export')
        self.xContainer.getControl('delete_all').addActionListener(self)
        self.xContainer.getControl('delete_all').setActionCommand('DeleteAll')
        self.xContainer.getControl('save_and_close').addActionListener(self)
        self.xContainer.getControl('save_and_close').setActionCommand(
            'SaveAndClose')
        self.xContainer.setVisible(False)  # True for non modal dialog
        xToolkit = self.xSvMgr.createInstanceWithContext(
            'com.sun.star.awt.ExtToolkit', self.ctx)
        self.xContainer.createPeer(xToolkit, None)
        self.xContainer.execute()
示例#7
0
    def run (self, sLang):
        ui.selectLang(sLang)

        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)

        # what is the current Hunspell dictionary
        self.xHunspellNode = helpers.getConfigSetting("/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr", True)
        xLocations = self.xHunspellNode.getByName("Locations")
        m = re.search(r"fr-(\w*)\.(?:dic|aff)", xLocations[0])
        self.sHunspellCurrentDic = m.group(1)  if m  else ""

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 200
        self.xDialog.Height = 285
        self.xDialog.Title = ui.get('title')
        xWindowSize = helpers.getWindowSize()
        self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2))
        self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2))

        # fonts
        xFDTitle = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFDTitle.Height = 9
        xFDTitle.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
        xFDTitle.Name = "Verdana"

        xFDSubTitle = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFDSubTitle.Height = 10
        xFDSubTitle.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
        xFDSubTitle.Name = "Verdana"

        # widget
        nX = 10
        nY1 = 10
        nY2 = nY1 + 60
        nY3 = nY2 + 25
        nY4 = nY3 + 45
        nY5 = nY4 + 95

        nWidth = self.xDialog.Width - 20
        nHeight = 10

        # Graphspell dictionary section
        self._addWidget("graphspell_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = ui.get("graphspell_section"), FontDescriptor = xFDTitle)
        self.xMainDic = self._addWidget('activate_main', 'CheckBox', nX, nY1+15, nWidth, nHeight, Label = ui.get('activate_main'), FontDescriptor = xFDSubTitle, TextColor = 0x000088, State = True)
        self._addWidget('activate_main_descr', 'FixedText', nX+10, nY1+25, nWidth-10, nHeight*2, Label = ui.get('activate_main_descr'), MultiLine = True)
        self._addWidget('spelling', 'FixedText', nX+10, nY1+45, nWidth-80, nHeight, Label = ui.get('spelling'), FontDescriptor = xFDSubTitle)
        self.xInfoDicButton = self._addWidget('info_dic_button', 'Button', nX+160, nY1+45, 12, 9, Label = "‹i›")
        self.xSelClassic = self._addWidget('classic', 'RadioButton', nX+10, nY1+55, 50, nHeight, Label = ui.get('classic'))
        self.xSelReform = self._addWidget('reform', 'RadioButton', nX+65, nY1+55, 55, nHeight, Label = ui.get('reform'))
        self.xSelAllvars = self._addWidget('allvars', 'RadioButton', nX+120, nY1+55, 60, nHeight, Label = ui.get('allvars'))
        self.xCommunityDic = self._addWidget('activate_community', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = ui.get('activate_community'), FontDescriptor = xFDSubTitle, TextColor = 0x000088, Enabled = False)
        self._addWidget('activate_community_descr', 'FixedText', nX+10, nY2+25, nWidth-10, nHeight*1, Label = ui.get('activate_community_descr'), MultiLine = True)
        self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = ui.get('activate_personal'), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self._addWidget('activate_personal_descr', 'FixedText', nX+10, nY3+25, nWidth-10, nHeight*1, Label = ui.get('activate_personal_descr'), MultiLine = True)

        # Spell suggestion engine section
        self._addWidget("suggestion_section", 'FixedLine', nX, nY4, nWidth, nHeight, Label = ui.get("suggestion_section"), FontDescriptor = xFDTitle)
        self.xGraphspellSugg = self._addWidget('activate_spell_sugg', 'CheckBox', nX, nY4+15, nWidth, nHeight, Label = ui.get('activate_spell_sugg'))
        self._addWidget('activate_spell_sugg_descr', 'FixedText', nX, nY4+25, nWidth, nHeight*6, Label = ui.get('activate_spell_sugg_descr'), MultiLine = True)

        # Restart message
        self._addWidget('restart', 'FixedText', nX, nY5, nWidth, nHeight*2, Label = ui.get('restart'), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000)

        # Button
        self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = ui.get('apply_button'), FontDescriptor = xFDTitle, TextColor = 0x005500)
        self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = ui.get('cancel_button'), FontDescriptor = xFDTitle, TextColor = 0x550000)

        self._loadOptions()

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xContainer.getControl('info_dic_button').addActionListener(self)
        self.xContainer.getControl('info_dic_button').setActionCommand('InfoDic')
        self.xContainer.getControl('apply_button').addActionListener(self)
        self.xContainer.getControl('apply_button').setActionCommand('Apply')
        self.xContainer.getControl('cancel_button').addActionListener(self)
        self.xContainer.getControl('cancel_button').setActionCommand('Cancel')
        self.xContainer.setVisible(False)
        toolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
        self.xContainer.createPeer(toolkit, None)
        self.xContainer.execute()