Grammalecte  Check-in [c46f9e162f]

Overview
Comment:[lo] Text formatter editor (draft)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | new_feature | lo
Files: files | file ages | folders
SHA3-256: c46f9e162fe63eab7b15fcf64ce579d8400f91402465d3af0660e517f817a099
User & Date: olr on 2020-12-15 16:33:30
Original Comment: [lo] Text formatter editor
Other Links: manifest | tags
Context
2020-12-16
17:54
[lo] text formatter editor: save, import, export check-in: ac50c72aa8 user: olr tags: lo, trunk
2020-12-15
16:33
[lo] Text formatter editor (draft) check-in: c46f9e162f user: olr tags: lo, new_feature, trunk
16:31
[lo] launch console from menu check-in: 7e2f01e527 user: olr tags: lo, trunk
Changes

Modified gc_lang/fr/oxt/TextFormatter/TextFormatter.py from [1015843a01] to [8366eaa359].

10
11
12
13
14
15
16


17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
..
34
35
36
37
38
39
40

41
42
43
44
45
46
47
..
56
57
58
59
60
61
62

63
64
65
66
67
68
69
...
206
207
208
209
210
211
212



213
214
215
216
217

218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
...
270
271
272
273
274
275
276


277
278
279
280
281
282
283
...
346
347
348
349
350
351
352



353
354
355
356
357
358
359
...
658
659
660
661
662
663
664




665
666
667
668
669
670
671
import json

import tf_strings
import tf_options
import tf_tabrep
import helpers



import unohelper
import uno
from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener


from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK
# BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY
# DEFAULT_BUTTON_OK, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_RETRY, DEFAULT_BUTTON_YES, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_IGNORE
from com.sun.star.awt.MessageBoxType import INFOBOX # MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX


def MessageBox (xParentWin, sMsg, sTitle, nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK):
    ctx = uno.getComponentContext()
    xToolkit = ctx.ServiceManager.createInstanceWithContext("com.sun.star.awt.Toolkit", ctx)
    xMsgBox = xToolkit.createMessageBox(xParentWin, nBoxType, nBoxButtons, sTitle, sMsg)
    return xMsgBox.execute()

................................................................................

class TextFormatter (unohelper.Base, XActionListener, XJobExecutor):
    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xContainer = None
        self.xDialog = None


    # XJobExecutor
    def trigger (self, args):
        try:
            xTF = TextFormatter(self.ctx)
            xTF.run()
        except:
................................................................................
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def run (self, sLang):

        self.dUI = tf_strings.getUI(sLang)

        ## dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 310
        self.xDialog.Title = self.dUI.get('title', "#title#")

................................................................................
        self.misc1a = self._addWidget('misc1a', 'CheckBox', x2+80, y+15, 30, nHeight, Label = self.dUI.get('misc1a', "#err"), State = True)
        self.misc2 = self._addWidget('misc2', 'CheckBox', x2, y+25, nWidth, nHeight, Label = self.dUI.get('misc2', "#err"), State = True)
        self.misc3 = self._addWidget('misc3', 'CheckBox', x2, y+35, nWidth, nHeight, Label = self.dUI.get('misc3', "#err"), State = True)
        #self.misc4 = self._addWidget('misc4', 'CheckBox', x2, y+45, nWidth, nHeight, Label = self.dUI.get('misc4', "#err"), State = True)
        self.misc5 = self._addWidget('misc5', 'CheckBox', x2, y+45, nWidth, nHeight, Label = self.dUI.get('misc5', "#err"), State = True)
        self.misc5b = self._addWidget('misc5b', 'CheckBox', x2+10, y+55, nWidth-40, nHeight, Label = self.dUI.get('misc5b', "#err"), State = False)
        self.misc5c = self._addWidget('misc5c', 'CheckBox', x2+nWidth-25, y+55, 30, nHeight, Label = self.dUI.get('misc5c', "#err"), State = False)



        self.misc1_res = self._addWidget('misc1_res', 'FixedText', nPosRes, y+15, 20, nHeight, Label = "", Align = 2)
        self.misc2_res = self._addWidget('misc2_res', 'FixedText', nPosRes, y+25, 20, nHeight, Label = "", Align = 2)
        self.misc3_res = self._addWidget('misc3_res', 'FixedText', nPosRes, y+35, 20, nHeight, Label = "", Align = 2)
        #self.misc4_res = self._addWidget('misc4_res', 'FixedText', nPosRes, y+45, 20, nHeight, Label = "", Align = 2)
        self.misc5_res = self._addWidget('misc5_res', 'FixedText', nPosRes, y+45, 20, nHeight, Label = "", Align = 2)


        # group box // restructuration
        y = y + 65
        self.struct = self._addWidget('struct', 'CheckBox', x2, y+2, nWidth, nHeight, Label = self.dUI.get('struct', "#err"), FontDescriptor = xFD1, \
                                      FontRelief = 1, TextColor = nColor, HelpText = self.dUI.get('struct_help', "#err"), State = False)
        self._addWidget("section6", 'FixedLine', nRightLimit2-(nWidth//3), y, nWidth//3, nHeight)
        self.struct1 = self._addWidget('struct1', 'CheckBox', x2, y+15, nWidth, nHeight, Label = self.dUI.get('struct1', "#err"), State = True, Enabled = False)
        self.struct2 = self._addWidget('struct2', 'CheckBox', x2, y+25, nWidth, nHeight, Label = self.dUI.get('struct2', "#err"), State = True, Enabled = False)
        self.struct3 = self._addWidget('struct3', 'CheckBox', x2, y+35, nWidth, nHeight, Label = self.dUI.get('struct3', "#err"), \
                                       HelpText = self.dUI.get('struct3_help', "#err"), State = False, Enabled = False)
        self.struct1_res = self._addWidget('struct1_res', 'FixedText', nPosRes, y+15, 20, nHeight, Label = "", Align = 2)
        self.struct2_res = self._addWidget('struct2_res', 'FixedText', nPosRes, y+25, 20, nHeight, Label = "", Align = 2)
        self.struct3_res = self._addWidget('struct3_res', 'FixedText', nPosRes, y+35, 20, nHeight, Label = "", Align = 2)

        # dialog height
        self.xDialog.Height = 272
        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))

        # lists of checkbox widgets
        self.dCheckboxWidgets = {
            "ssp":      [self.ssp1, self.ssp2, self.ssp3, self.ssp4, self.ssp5, self.ssp6, self.ssp7],
            "space":    [self.space1, self.space2],
            "nbsp":     [self.nbsp1, self.nbsp2, self.nbsp3, self.nbsp4, self.nbsp5, self.nbsp6, self.nnbsp1, self.nnbsp2, self.nnbsp4],
            "delete":   [self.delete1, self.delete2, self.delete2a, self.delete2b, self.delete2c],
            "typo":     [self.typo1, self.typo2, self.typo3, self.typo3a, self.typo3b, self.typo4, self.typo4a, self.typo4b, self.typo5, self.typo6, \
                         self.typo7, self.typo8, self.typo8a, self.typo8b, self.typo_ff, self.typo_fi, self.typo_ffi, self.typo_fl, self.typo_ffl, \
                         self.typo_ft, self.typo_st],
            "misc":     [self.misc1, self.misc2, self.misc3, self.misc5, self.misc1a, self.misc5b, self.misc5c], #self.misc4,
            "struct":   [self.struct1, self.struct2, self.struct3]
        }

        # progress bar
        self.pbar = self._addWidget('pbar', 'ProgressBar', 22, self.xDialog.Height-16, 210, 10)
        self.pbar.ProgressValueMin = 0
        self.pbar.ProgressValueMax = 32
................................................................................

        ## container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xContainer.setVisible(False)
        self.xContainer.getControl('info').addActionListener(self)
        self.xContainer.getControl('info').setActionCommand('Info')


        self.xContainer.getControl('default').addActionListener(self)
        self.xContainer.getControl('default').setActionCommand('Default')
        self.xContainer.getControl('apply').addActionListener(self)
        self.xContainer.getControl('apply').setActionCommand('Apply')
        self.xContainer.getControl('ssp').addActionListener(self)
        self.xContainer.getControl('ssp').setActionCommand('SwitchSsp')
        self.xContainer.getControl('space').addActionListener(self)
................................................................................
                self._setApplyButtonLabel()
            elif xActionEvent.ActionCommand == 'SwitchStruct':
                self._switchCheckBox(self.struct)
                self._setApplyButtonLabel()
            elif xActionEvent.ActionCommand == 'Default':
                self._setConfig(tf_options.dDefaultOpt)
                self._setApplyButtonLabel()



            elif xActionEvent.ActionCommand == 'Info':
                xDesktop = self.xSvMgr.createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)
                xDoc = xDesktop.getCurrentComponent()
                xWindow = xDoc.CurrentController.Frame.ContainerWindow
                MessageBox (xWindow, self.dUI.get('infomsg', "#err"), self.dUI.get('infotitle', "#err"))
            else:
                print("Wrong command: " + xActionEvent.ActionCommand)
................................................................................
                    n = self._replaceList(xElem, "misc5a")
                    if self.misc5b.State:
                        n += self._replaceList(xElem, "misc5b")
                        if self.misc5c.State:
                            n += self._replaceList(xElem, "misc5c")
                    self.misc5_res.Label = str(n)
                    self.pbar.ProgressValue += 1




                self.misc.State = False
                self._switchCheckBox(self.misc)
            self.pbar.ProgressValue = self.pbar.ProgressValueMax
            # end of processing
            xPointer.setType(uno.getConstantByName("com.sun.star.awt.SystemPointer.ARROW"))
            xWindowPeer.setPointer(xPointer)
            for x in xWindowPeer.Windows:







>
>




<





>







 







>







 







>







 







>
>
>





>


|












|













|







 







>
>







 







>
>
>







 







>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
..
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
...
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
...
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
...
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
...
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
import json

import tf_strings
import tf_options
import tf_tabrep
import helpers

import TextFormatterEditor

import unohelper
import uno
from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener


from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK
# BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY
# DEFAULT_BUTTON_OK, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_RETRY, DEFAULT_BUTTON_YES, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_IGNORE
from com.sun.star.awt.MessageBoxType import INFOBOX # MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX


def MessageBox (xParentWin, sMsg, sTitle, nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK):
    ctx = uno.getComponentContext()
    xToolkit = ctx.ServiceManager.createInstanceWithContext("com.sun.star.awt.Toolkit", ctx)
    xMsgBox = xToolkit.createMessageBox(xParentWin, nBoxType, nBoxButtons, sTitle, sMsg)
    return xMsgBox.execute()

................................................................................

class TextFormatter (unohelper.Base, XActionListener, XJobExecutor):
    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xContainer = None
        self.xDialog = None
        helpers.startConsole()

    # XJobExecutor
    def trigger (self, args):
        try:
            xTF = TextFormatter(self.ctx)
            xTF.run()
        except:
................................................................................
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def run (self, sLang):
        self.sLang = sLang
        self.dUI = tf_strings.getUI(sLang)

        ## dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 310
        self.xDialog.Title = self.dUI.get('title', "#title#")

................................................................................
        self.misc1a = self._addWidget('misc1a', 'CheckBox', x2+80, y+15, 30, nHeight, Label = self.dUI.get('misc1a', "#err"), State = True)
        self.misc2 = self._addWidget('misc2', 'CheckBox', x2, y+25, nWidth, nHeight, Label = self.dUI.get('misc2', "#err"), State = True)
        self.misc3 = self._addWidget('misc3', 'CheckBox', x2, y+35, nWidth, nHeight, Label = self.dUI.get('misc3', "#err"), State = True)
        #self.misc4 = self._addWidget('misc4', 'CheckBox', x2, y+45, nWidth, nHeight, Label = self.dUI.get('misc4', "#err"), State = True)
        self.misc5 = self._addWidget('misc5', 'CheckBox', x2, y+45, nWidth, nHeight, Label = self.dUI.get('misc5', "#err"), State = True)
        self.misc5b = self._addWidget('misc5b', 'CheckBox', x2+10, y+55, nWidth-40, nHeight, Label = self.dUI.get('misc5b', "#err"), State = False)
        self.misc5c = self._addWidget('misc5c', 'CheckBox', x2+nWidth-25, y+55, 30, nHeight, Label = self.dUI.get('misc5c', "#err"), State = False)
        self.misccustom = self._addWidget('misccustom', "CheckBox", x2, y+65, nWidth-40, nHeight, Label = self.dUI.get('misccustom', "#err"), State = False)
        self.beditor = self._addWidget('editor', 'Button', x2+95, y+64, 30, 9, Label = self.dUI.get('editor', "#err"), \
                                        HelpText = self.dUI.get('editor_help', "#err"), FontDescriptor = xFDsmall)
        self.misc1_res = self._addWidget('misc1_res', 'FixedText', nPosRes, y+15, 20, nHeight, Label = "", Align = 2)
        self.misc2_res = self._addWidget('misc2_res', 'FixedText', nPosRes, y+25, 20, nHeight, Label = "", Align = 2)
        self.misc3_res = self._addWidget('misc3_res', 'FixedText', nPosRes, y+35, 20, nHeight, Label = "", Align = 2)
        #self.misc4_res = self._addWidget('misc4_res', 'FixedText', nPosRes, y+45, 20, nHeight, Label = "", Align = 2)
        self.misc5_res = self._addWidget('misc5_res', 'FixedText', nPosRes, y+45, 20, nHeight, Label = "", Align = 2)
        self.misccustom_res = self._addWidget('misccustom_res', 'FixedText', nPosRes, y+55, 20, nHeight, Label = "", Align = 2)

        # group box // restructuration
        y = y + 75
        self.struct = self._addWidget('struct', 'CheckBox', x2, y+2, nWidth, nHeight, Label = self.dUI.get('struct', "#err"), FontDescriptor = xFD1, \
                                      FontRelief = 1, TextColor = nColor, HelpText = self.dUI.get('struct_help', "#err"), State = False)
        self._addWidget("section6", 'FixedLine', nRightLimit2-(nWidth//3), y, nWidth//3, nHeight)
        self.struct1 = self._addWidget('struct1', 'CheckBox', x2, y+15, nWidth, nHeight, Label = self.dUI.get('struct1', "#err"), State = True, Enabled = False)
        self.struct2 = self._addWidget('struct2', 'CheckBox', x2, y+25, nWidth, nHeight, Label = self.dUI.get('struct2', "#err"), State = True, Enabled = False)
        self.struct3 = self._addWidget('struct3', 'CheckBox', x2, y+35, nWidth, nHeight, Label = self.dUI.get('struct3', "#err"), \
                                       HelpText = self.dUI.get('struct3_help', "#err"), State = False, Enabled = False)
        self.struct1_res = self._addWidget('struct1_res', 'FixedText', nPosRes, y+15, 20, nHeight, Label = "", Align = 2)
        self.struct2_res = self._addWidget('struct2_res', 'FixedText', nPosRes, y+25, 20, nHeight, Label = "", Align = 2)
        self.struct3_res = self._addWidget('struct3_res', 'FixedText', nPosRes, y+35, 20, nHeight, Label = "", Align = 2)

        # dialog height
        self.xDialog.Height = 277
        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))

        # lists of checkbox widgets
        self.dCheckboxWidgets = {
            "ssp":      [self.ssp1, self.ssp2, self.ssp3, self.ssp4, self.ssp5, self.ssp6, self.ssp7],
            "space":    [self.space1, self.space2],
            "nbsp":     [self.nbsp1, self.nbsp2, self.nbsp3, self.nbsp4, self.nbsp5, self.nbsp6, self.nnbsp1, self.nnbsp2, self.nnbsp4],
            "delete":   [self.delete1, self.delete2, self.delete2a, self.delete2b, self.delete2c],
            "typo":     [self.typo1, self.typo2, self.typo3, self.typo3a, self.typo3b, self.typo4, self.typo4a, self.typo4b, self.typo5, self.typo6, \
                         self.typo7, self.typo8, self.typo8a, self.typo8b, self.typo_ff, self.typo_fi, self.typo_ffi, self.typo_fl, self.typo_ffl, \
                         self.typo_ft, self.typo_st],
            "misc":     [self.misc1, self.misc2, self.misc3, self.misc5, self.misc1a, self.misc5b, self.misc5c, self.misccustom], #self.misc4,
            "struct":   [self.struct1, self.struct2, self.struct3]
        }

        # progress bar
        self.pbar = self._addWidget('pbar', 'ProgressBar', 22, self.xDialog.Height-16, 210, 10)
        self.pbar.ProgressValueMin = 0
        self.pbar.ProgressValueMax = 32
................................................................................

        ## container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xContainer.setVisible(False)
        self.xContainer.getControl('info').addActionListener(self)
        self.xContainer.getControl('info').setActionCommand('Info')
        self.xContainer.getControl('editor').addActionListener(self)
        self.xContainer.getControl('editor').setActionCommand('Editor')
        self.xContainer.getControl('default').addActionListener(self)
        self.xContainer.getControl('default').setActionCommand('Default')
        self.xContainer.getControl('apply').addActionListener(self)
        self.xContainer.getControl('apply').setActionCommand('Apply')
        self.xContainer.getControl('ssp').addActionListener(self)
        self.xContainer.getControl('ssp').setActionCommand('SwitchSsp')
        self.xContainer.getControl('space').addActionListener(self)
................................................................................
                self._setApplyButtonLabel()
            elif xActionEvent.ActionCommand == 'SwitchStruct':
                self._switchCheckBox(self.struct)
                self._setApplyButtonLabel()
            elif xActionEvent.ActionCommand == 'Default':
                self._setConfig(tf_options.dDefaultOpt)
                self._setApplyButtonLabel()
            elif xActionEvent.ActionCommand == 'Editor':
                xDialog = TextFormatterEditor.TextFormatterEditor(self.ctx)
                xDialog.run(self.sLang)
            elif xActionEvent.ActionCommand == 'Info':
                xDesktop = self.xSvMgr.createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)
                xDoc = xDesktop.getCurrentComponent()
                xWindow = xDoc.CurrentController.Frame.ContainerWindow
                MessageBox (xWindow, self.dUI.get('infomsg', "#err"), self.dUI.get('infotitle', "#err"))
            else:
                print("Wrong command: " + xActionEvent.ActionCommand)
................................................................................
                    n = self._replaceList(xElem, "misc5a")
                    if self.misc5b.State:
                        n += self._replaceList(xElem, "misc5b")
                        if self.misc5c.State:
                            n += self._replaceList(xElem, "misc5c")
                    self.misc5_res.Label = str(n)
                    self.pbar.ProgressValue += 1
                if self.misccustom.State:
                    n = self._replaceList(xElem, "misccustom")
                    self.misccustom_res.Label = str(n)
                    self.pbar.ProgressValue += 1
                self.misc.State = False
                self._switchCheckBox(self.misc)
            self.pbar.ProgressValue = self.pbar.ProgressValueMax
            # end of processing
            xPointer.setType(uno.getConstantByName("com.sun.star.awt.SystemPointer.ARROW"))
            xWindowPeer.setPointer(xPointer)
            for x in xWindowPeer.Windows:

Added gc_lang/fr/oxt/TextFormatter/TextFormatterEditor.py version [5352d7d61f].























































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# Text Formatter Editor
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import platform
import json
import re

import helpers
import tfe_strings as ui
import grammalecte.graphspell as sc

from com.sun.star.awt import XActionListener
from com.sun.star.awt.grid import XGridSelectionListener

from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK
# BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY
# DEFAULT_BUTTON_OK, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_RETRY, DEFAULT_BUTTON_YES, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_IGNORE
from com.sun.star.awt.MessageBoxType import INFOBOX, ERRORBOX # MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX


def MessageBox (xDocument, sMsg, sTitle, nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK):
    xParentWin = xDocument.CurrentController.Frame.ContainerWindow
    ctx = uno.getComponentContext()
    xToolkit = ctx.ServiceManager.createInstanceWithContext("com.sun.star.awt.Toolkit", ctx)
    xMsgBox = xToolkit.createMessageBox(xParentWin, nBoxType, nBoxButtons, sTitle, sMsg)
    return xMsgBox.execute()


def _waitPointer (funcDecorated):
    def wrapper (*args, **kwargs):
        # self is the first parameter if the decorator is applied on a object
        self = args[0]
        # before
        xPointer = self.xSvMgr.createInstanceWithContext("com.sun.star.awt.Pointer", self.ctx)
        xPointer.setType(uno.getConstantByName("com.sun.star.awt.SystemPointer.WAIT"))
        xWindowPeer = self.xContainer.getPeer()
        xWindowPeer.setPointer(xPointer)
        for x in xWindowPeer.Windows:
            x.setPointer(xPointer)
        # processing
        result = funcDecorated(*args, **kwargs)
        # after
        xPointer.setType(uno.getConstantByName("com.sun.star.awt.SystemPointer.ARROW"))
        xWindowPeer.setPointer(xPointer)
        for x in xWindowPeer.Windows:
            x.setPointer(xPointer)
        self.xContainer.setVisible(True) # seems necessary to refresh the dialog box and text widgets (why?)
        # return
        return result
    return wrapper


class TextFormatterEditor (unohelper.Base, XActionListener, XGridSelectionListener):

    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xContainer = None
        self.xDialog = None

    def _addWidget (self, name, wtype, x, y, w, h, **kwargs):
        xWidget = self.xDialog.createInstance('com.sun.star.awt.UnoControl%sModel' % wtype)
        xWidget.Name = name
        xWidget.PositionX = x
        xWidget.PositionY = y
        xWidget.Width = w
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def _addGrid (self, name, x, y, w, h, columns, **kwargs):
        xGridModel = self.xDialog.createInstance('com.sun.star.awt.grid.UnoControlGridModel')
        xGridModel.Name = name
        xGridModel.PositionX = x
        xGridModel.PositionY = y
        xGridModel.Width = w
        xGridModel.Height = h
        xColumnModel = xGridModel.ColumnModel
        for e in columns:
            xCol = xColumnModel.createColumn()
            for k, w in e.items():
                setattr(xCol, k, w)
            xColumnModel.addColumn(xCol)
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

    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("replace"))
        self._addWidget('newbylbl', 'FixedText', nX+200, nY1+10, 100, nHeight, Label = ui.get("by"))

        self.xNewname = self._addWidget('newname', 'Edit', nX, nY1+19, 60, 10, FontDescriptor = xFDMono)
        self.xNewreplace = self._addWidget('newreplace', 'Edit', nX+65, nY1+19, 130, 10, FontDescriptor = xFDMono)
        self.xNewby = self._addWidget('newby', 'Edit', nX+200, nY1+19, 100, 10, FontDescriptor = xFDMono)
        self.xNewregex = self._addWidget('newregex', 'CheckBox', nX+305, nY1+21, 35, nHeight, Label = ui.get("regex"), HelpText=ui.get("regex_help"))
        self.xNewcasesens = self._addWidget('newcasesens', 'CheckBox', nX+340, nY1+21, 40, nHeight, Label = ui.get("casesens"), HelpText=ui.get("casesens_help"), State=True)

        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("replace"),  "ColumnWidth": 140},
            {"Title": ui.get("by"),       "ColumnWidth": 140},
            {"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("replace"))
        self._addWidget('editbylbl', 'FixedText', nX+200, nY2+10, 100, nHeight, Label = ui.get("by"))

        self.xEditname = self._addWidget('editname', 'Edit', nX, nY2+19, 60, 10, FontDescriptor = xFDMono, Enabled = False)
        self.xEditreplace = self._addWidget('editreplace', 'Edit', nX+65, nY2+19, 130, 10, FontDescriptor = xFDMono, Enabled = False)
        self.xEditby = self._addWidget('editby', 'Edit', nX+200, nY2+19, 100, 10, FontDescriptor = xFDMono, Enabled = False)
        self.xEditregex = self._addWidget('editregex', 'CheckBox', nX+305, nY2+21, 35, nHeight, Label = ui.get("regex"), HelpText=ui.get("regex_help"), Enabled = False)
        self.xEditcasesens = self._addWidget('editcasesens', 'CheckBox', nX+340, nY2+21, 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.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-35, nWidth, nHeight)
        self._addWidget('import', 'Button', nX, self.xDialog.Height-25, 50, 14, Label = ui.get('import'), FontDescriptor = xFDTitle, TextColor = 0x0000AA)
        self._addWidget('export', 'Button', nX+60, self.xDialog.Height-25, 50, 14, Label = ui.get('export'), FontDescriptor = xFDTitle, TextColor = 0x00AA00)
        self._addWidget('save', 'Button', self.xDialog.Width-120, self.xDialog.Height-25, 50, 14, Label = ui.get('save'), FontDescriptor = xFDTitle, TextColor = 0x00AA00)
        self._addWidget('close', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = ui.get('close'), FontDescriptor = xFDTitle, TextColor = 0xAA0000)

        # data
        self.dRules = {}
        self.iSelectedRow = -1
        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('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('save').addActionListener(self)
        self.xContainer.getControl('save').setActionCommand('Save')
        self.xContainer.getControl('close').addActionListener(self)
        self.xContainer.getControl('close').setActionCommand('Close')
        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()

    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            if xActionEvent.ActionCommand == "Add":
                self.addRule()
            elif xActionEvent.ActionCommand == "Delete":
                self.deleteRule()
            elif xActionEvent.ActionCommand == "Modify":
                self.modifyRule()
            elif xActionEvent.ActionCommand == "Apply":
                self.apply()
            elif xActionEvent.ActionCommand == "Save":
                self.saveRules()
            elif xActionEvent.ActionCommand == "Import":
                self.importRules()
            elif xActionEvent.ActionCommand == "Export":
                self.exportRules()
            elif xActionEvent.ActionCommand == "Close":
                self.xContainer.endExecute()       # Modal dialog
        except:
            traceback.print_exc()

    # XGridSelectionListener
    def selectionChanged (self, xGridSelectionEvent):
        try:
            aRows = self.xGridControl.getSelectedRows()
            if aRows and len(aRows) == 1:
                self.iSelectedRow = aRows[0]
                self.sSelectedRuleName, sReplace, sBy, sRegex, sCaseSens = self.xGridModel.GridDataModel.getRowData(self.iSelectedRow)
                # fill fields
                self.xEditname.Text = self.sSelectedRuleName
                self.xEditreplace.Text = sReplace
                self.xEditby.Text = sBy
                self.xEditregex.State = sRegex == "True"
                self.xEditcasesens.State = sCaseSens == "True"
                # enable widgets
                self.xEditname.Enabled = True
                self.xEditreplace.Enabled = True
                self.xEditby.Enabled = True
                self.xEditregex.Enabled = True
                self.xEditcasesens.Enabled = True
                self.xDeleteButton.Enabled = True
                self.xApplyButton.Enabled = True
                self.xModifyButton.Enabled = True
        except:
            self._clearEditFields()
            traceback.print_exc()

    # Code
    def _clearAddFields (self):
        self.xNewname.Text = ""
        self.xNewreplace.Text = ""
        self.xNewby.Text = ""
        self.xNewregex.State = False
        self.xNewcasesens.State = True

    def _clearEditFields (self):
        self.xEditname.Text = ""
        self.xEditreplace.Text = ""
        self.xEditby.Text = ""
        self.xEditregex.State = False
        self.xEditcasesens.State = True
        # disable widgets
        self.xEditname.Enabled = False
        self.xEditreplace.Enabled = False
        self.xEditby.Enabled = False
        self.xEditregex.Enabled = False
        self.xEditcasesens.Enabled = False
        self.xDeleteButton.Enabled = False
        self.xApplyButton.Enabled = False
        self.xModifyButton.Enabled = False

    def addRule (self):
        if not self._checkRuleName(self.xNewname.Text):
            MessageBox(self.xDocument, ui.get("name_error"), ui.get("name_error_title"), ERRORBOX)
            return
        if not self.xNewname.Text or not self.xNewreplace.Text:
            MessageBox(self.xDocument, ui.get("name_and_replace_error"), ui.get("name_and_replace_error_title"), ERRORBOX)
            return
        sRuleName = self.xNewname.Text
        if sRuleName in self.dRules:
            MessageBox(self.xDocument, ui.get('add_name_error'), ui.get("add_name_error_title"), ERRORBOX)
            return
        self.dRules[sRuleName] = {
            "sReplace": self.xNewreplace.Text,
            "sBy": self.xNewby.Text,
            "bRegex": self.xNewregex.State == 1,
            "bCaseSens": self.xNewcasesens.State == 1
        }
        xGridDataModel = self.xGridModel.GridDataModel
        xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName))
        self._clearAddFields()

    def _getValuesForRow (self, sRuleName):
        return (sRuleName, self.dRules[sRuleName]["sReplace"], self.dRules[sRuleName]["sBy"], str(self.dRules[sRuleName]["bRegex"]), str(self.dRules[sRuleName]["bCaseSens"]))

    def _checkRuleName (self, sRuleName):
        return re.match(r"\w[\w_#.,;!?-]*", sRuleName)

    def modifyRule (self):
        if not self._checkRuleName(self.xEditname.Text):
            MessageBox(self.xDocument, ui.get("name_error"), ui.get("name_error_title"), ERRORBOX)
            return
        sRuleName = self.xEditname.Text
        if self.iSelectedRow < 0 or not sRuleName or not self.xEditreplace.Text:
            MessageBox(self.xDocument, ui.get("name_and_replace_error"), ui.get("name_and_replace_error_title"), ERRORBOX)
            return
        if sRuleName != self.sSelectedRuleName and sRuleName in self.dRules:
            MessageBox(self.xDocument, ui.get("modify_name_error"), ui.get("modify_name_error_title"), ERRORBOX)
            return
        try:
            self.dRules[sRuleName] = {
                "sReplace": self.xEditreplace.Text,
                "sBy": self.xEditby.Text,
                "bRegex": self.xEditregex.State == 1,
                "bCaseSens": self.xEditcasesens.State == 1
            }
            aColumns = (0, 1, 2, 3, 4)
            self.xGridModel.GridDataModel.updateRowData(aColumns, self.iSelectedRow, self._getValuesForRow(sRuleName))
        except:
            traceback.print_exc()

    def deleteRule (self):
        if self.sSelectedRuleName != self.xEditname.Text:
            MessageBox(self.xDocument, ui.get('delete_name_error'), ui.get("delete_name_error_title"), ERRORBOX)
            return
        sRuleName = self.sSelectedRuleName
        if not sRuleName or sRuleName not in self.dRules:
            return
        try:
            self._clearEditFields()
            self.xGridModel.GridDataModel.removeRow(self.iSelectedRow)
            self.iSelectedRow = -1
            del self.dRules[sRuleName]
        except:
            traceback.print_exc()

    @_waitPointer
    def apply (self):
        pass

    def loadRules (self):
        pass

    @_waitPointer
    def saveRules (self):
        pass

    def importRules (self):
        pass

    def exportRules (self):
        if not self.dRules:
            return
        sText = json.dumps(self.dRules, ensure_ascii=False)
        try:
            xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx)  # other possibility: com.sun.star.ui.dialogs.SystemFilePicker
            xFilePicker.initialize([uno.getConstantByName("com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_SIMPLE")]) # seems useless
            xFilePicker.appendFilter("Supported files", "*.json")
            xFilePicker.setDefaultName("grammalecte_tf_trans_rules.json") # doesn’t work on Windows
            xFilePicker.setDisplayDirectory("")
            xFilePicker.setMultiSelectionMode(False)
            nResult = xFilePicker.execute()
            if nResult == 1:
                # lFile = xFilePicker.getSelectedFiles()
                lFile = xFilePicker.getFiles()
                spfExported = lFile[0][5:].lstrip("/") # remove file://
                if platform.system() != "Windows":
                    spfExported = "/" + spfExported
                #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json")
                with open(spfExported, "w", encoding="utf-8") as hDst:
                    hDst.write(sText)
        except:
            sMessage = traceback.format_exc()
            MessageBox(self.xDocument, sMessage, self.ui.get('export_title'), ERRORBOX)

Modified gc_lang/fr/oxt/TextFormatter/tf_options.py from [478caed3d0] to [d6b9728d6e].

2
3
4
5
6
7
8
9
10
11

dDefaultOpt = {
    'ssp': 1, 'ssp1': 1, 'ssp2': 1, 'ssp3': 1, 'ssp4': 1, 'ssp5': 1, 'ssp6': 1, 'ssp7': 1,
    'nbsp': 1, 'nbsp1': 1, 'nbsp2': 1, 'nbsp3': 1, 'nbsp4': 1, 'nbsp5': 1, 'nbsp6': 1, 'nnbsp1': 0, 'nnbsp2': 0, 'nnbsp4': 0,
    'space': 1, 'space1': 1, 'space2': 1,
    'delete': 0, 'delete1': 1, 'delete2': 1, 'delete2a': 0, 'delete2b': 1, 'delete2c': 0,
    'typo': 1, 'typo1': 1, 'typo2': 1, 'typo3': 1, 'typo4': 1, 'typo5': 1, 'typo6': 1, 'typo7': 1, 'typo8': 0, 'typo3a': 0, 'typo3b': 1, 'typo4a': 1, 'typo4b': 0, 'typo8a': 0, 'typo8b': 1, 'typo_ff': 1, 'typo_fi':1, 'typo_ffi':1, 'typo_fl':1, 'typo_ffl':1, 'typo_ft':1, 'typo_st': 1,
    'misc': 1, 'misc1': 1, 'misc2': 1, 'misc3': 1, 'misc5': 1, 'misc1a': 0, 'misc5b': 0, 'misc5c': 0,
    'struct': 0, 'struct1': 1, 'struct2': 1, 'struct3': 0,
}







|


2
3
4
5
6
7
8
9
10
11

dDefaultOpt = {
    'ssp': 1, 'ssp1': 1, 'ssp2': 1, 'ssp3': 1, 'ssp4': 1, 'ssp5': 1, 'ssp6': 1, 'ssp7': 1,
    'nbsp': 1, 'nbsp1': 1, 'nbsp2': 1, 'nbsp3': 1, 'nbsp4': 1, 'nbsp5': 1, 'nbsp6': 1, 'nnbsp1': 0, 'nnbsp2': 0, 'nnbsp4': 0,
    'space': 1, 'space1': 1, 'space2': 1,
    'delete': 0, 'delete1': 1, 'delete2': 1, 'delete2a': 0, 'delete2b': 1, 'delete2c': 0,
    'typo': 1, 'typo1': 1, 'typo2': 1, 'typo3': 1, 'typo4': 1, 'typo5': 1, 'typo6': 1, 'typo7': 1, 'typo8': 0, 'typo3a': 0, 'typo3b': 1, 'typo4a': 1, 'typo4b': 0, 'typo8a': 0, 'typo8b': 1, 'typo_ff': 1, 'typo_fi':1, 'typo_ffi':1, 'typo_fl':1, 'typo_ffl':1, 'typo_ft':1, 'typo_st': 1,
    'misc': 1, 'misc1': 1, 'misc2': 1, 'misc3': 1, 'misc5': 1, 'misc1a': 0, 'misc5b': 0, 'misc5c': 0, 'misccustom': 0,
    'struct': 0, 'struct1': 1, 'struct2': 1, 'struct3': 0,
}

Modified gc_lang/fr/oxt/TextFormatter/tf_strings.py from [7368cd8ce9] to [175f03c72e].

65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
80
81
82
83


84
85
86
87
88
89
90
...
149
150
151
152
153
154
155

156
157
158
159
160
161
162
163
164
165
166
167


168
169
170
171
172
173
174
175
176
177
        "misc1": "Ordinaux (15e, XXIe…)",
        "misc1a": "e → ᵉ",
        "misc2": "Et cætera, etc.",
        "misc3": "Traits d’union manquants",
        "misc5": "Apostrophes manquantes",
        "misc5b": "lettres isolées (j’ n’ m’ t’ s’ c’ d’ l’)",
        "misc5c": "Maj.",


        "struct": "~Restructuration [!]",
        "struct_help": "Attention : la restructuration coupe ou fusionne les paragraphes.",
        "struct1": "Retour à la ligne ⇒ fin de paragraphe",
        "struct2": "Enlever césures en fin de ligne/paragraphe",
        "struct3": "Fusionner les paragraphes contigus [!]",
        "struct3_help": "Concatène tous les paragraphes non séparés par un paragraphe vide.\nAttention : LibreOffice et OpenOffice ne peuvent accepter des paragraphes de plus de 65535 caractères, ce qui fait environ 12 pages avec une police de taille 12. Un dépassement de cette limite fera planter le logiciel. À partir de LibreOffice 4.3, cette limitation n’existe plus.",

        "default": "[·]",
        "default_help": "Options par défaut",

        "bsel": "Sur la sélection active",


        "apply": "~Appliquer",
        "close": "~Fermer",

        "info": "(i)",
        "infotitle": "Informations",
        "infomsg": "Le formateur de texte est un outil qui automatise la correction d’erreurs typographiques en employant le moteur interne “Chercher & remplacer” de Writer.\n\nUtilisez l’outil avec prudence. À cause de certaines limitations, le formateur ne peut gérer tous les cas. Vérifiez votre texte après emploi."
    },
................................................................................
        "misc1": "Ordinals (15e, XXIe…)",
        "misc1a": "e → ᵉ",
        "misc2": "Et cætera, etc.",
        "misc3": "Missing hyphens",
        "misc5": "Missing apostrophes",
        "misc5b": "single letters (j’ n’ m’ t’ s’ c’ d’ l’)",
        "misc5c": "Cap.",


        "struct": "~Restructuration [!]",
        "struct_help": "Caution: Restructuration cuts or merges paragraphs.",
        "struct1": "End of line ⇒ end of paragraph",
        "struct2": "Remove syllabification hyphens at EOL/EOP",
        "struct3": "Merge contiguous paragraphs [!]",
        "struct3_help": "Concatenate all paragraphs not separated by an empty paragraph.\nCaution: LibreOffice and OpenOffice can’t deal with paragraphs longer than 65,535 characters, which is about 12 pages with font size 12. Overstepping this limit will crash the software. For LibreOffice 4.3 and beyond, this limitation doesn’t exist any more.",

        "default": "[·]",
        "default_help": "Default options",

        "bsel": "On current selection",


        "apply": "~Apply",
        "close": "~Close",

        "info": "(i)",
        "infotitle": "Informations",
        "infomsg": "The text formatter is a tool which automates correction of typographical errors by using the internal engine “Search & replace” of Writer.\n\nUse this tool with caution. Due to several limitations, it cannot handle all cases. Check your text after use."
    }
}









>












>
>







 







>












>
>










65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
        "misc1": "Ordinaux (15e, XXIe…)",
        "misc1a": "e → ᵉ",
        "misc2": "Et cætera, etc.",
        "misc3": "Traits d’union manquants",
        "misc5": "Apostrophes manquantes",
        "misc5b": "lettres isolées (j’ n’ m’ t’ s’ c’ d’ l’)",
        "misc5c": "Maj.",
        "misccustom": "Transformations personnelles",

        "struct": "~Restructuration [!]",
        "struct_help": "Attention : la restructuration coupe ou fusionne les paragraphes.",
        "struct1": "Retour à la ligne ⇒ fin de paragraphe",
        "struct2": "Enlever césures en fin de ligne/paragraphe",
        "struct3": "Fusionner les paragraphes contigus [!]",
        "struct3_help": "Concatène tous les paragraphes non séparés par un paragraphe vide.\nAttention : LibreOffice et OpenOffice ne peuvent accepter des paragraphes de plus de 65535 caractères, ce qui fait environ 12 pages avec une police de taille 12. Un dépassement de cette limite fera planter le logiciel. À partir de LibreOffice 4.3, cette limitation n’existe plus.",

        "default": "[·]",
        "default_help": "Options par défaut",

        "bsel": "Sur la sélection active",
        "editor": "~Editeur…",
        "editor_help": "Éditeur de transformations",
        "apply": "~Appliquer",
        "close": "~Fermer",

        "info": "(i)",
        "infotitle": "Informations",
        "infomsg": "Le formateur de texte est un outil qui automatise la correction d’erreurs typographiques en employant le moteur interne “Chercher & remplacer” de Writer.\n\nUtilisez l’outil avec prudence. À cause de certaines limitations, le formateur ne peut gérer tous les cas. Vérifiez votre texte après emploi."
    },
................................................................................
        "misc1": "Ordinals (15e, XXIe…)",
        "misc1a": "e → ᵉ",
        "misc2": "Et cætera, etc.",
        "misc3": "Missing hyphens",
        "misc5": "Missing apostrophes",
        "misc5b": "single letters (j’ n’ m’ t’ s’ c’ d’ l’)",
        "misc5c": "Cap.",
        "misccustom": "Custom transformations",

        "struct": "~Restructuration [!]",
        "struct_help": "Caution: Restructuration cuts or merges paragraphs.",
        "struct1": "End of line ⇒ end of paragraph",
        "struct2": "Remove syllabification hyphens at EOL/EOP",
        "struct3": "Merge contiguous paragraphs [!]",
        "struct3_help": "Concatenate all paragraphs not separated by an empty paragraph.\nCaution: LibreOffice and OpenOffice can’t deal with paragraphs longer than 65,535 characters, which is about 12 pages with font size 12. Overstepping this limit will crash the software. For LibreOffice 4.3 and beyond, this limitation doesn’t exist any more.",

        "default": "[·]",
        "default_help": "Default options",

        "bsel": "On current selection",
        "editor": "~Editor…",
        "editor_help": "Transformations editor",
        "apply": "~Apply",
        "close": "~Close",

        "info": "(i)",
        "infotitle": "Informations",
        "infomsg": "The text formatter is a tool which automates correction of typographical errors by using the internal engine “Search & replace” of Writer.\n\nUse this tool with caution. Due to several limitations, it cannot handle all cases. Check your text after use."
    }
}


Added gc_lang/fr/oxt/TextFormatter/tfe_strings.py version [17e244691b].













































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Strings for Text Formatter Editor


sUI = "fr"


def selectLang (sLang):
    global sUI
    sUI = sLang  if sLang in dStrings  else "fr"


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Éditeur des transformations personnalisées",

        "name": "Nom de la règle",
        "replace": "Remplacer",
        "by": "par",
        "regex": "Regex",
        "regex_help": "Une expression régulière est une forme de syntaxe décrivant un motif de recherche de caractères",
        "casesens": "Casse rigide",
        "casesens_help": "La casse des caractères sera respectée telle quelle.",

        "new_entry": "Nouvelle entrée",
        "edit_entry": "Édition de l’entrée sélectionnée",

        "add": "Ajouter",
        "delete": "Supprimer",
        "modify": "Modifier",
        "apply": "Appliquer",
        "apply_help": "Appliquer cette règle sur le texte",

        "save": "Enregistrer",
        "import": "Importer",
        "export": "Exporter",
        "close": "Fermer",

        "name_error": "Pour le nom des règles, utilisez uniquement les lettres, les nombres et les caractères parmi ‹_-#.,;!?›.",
        "name_error_title": "Le nom de la règle n’est pas conforme.",

        "name_and_replace_error": "Ni le nom de la règle, ni ce qui doit être remplacé ne peut être vide. Veuillez remplir les champs requis.",
        "name_and_replace_error_title": "L’un des champs requis est vide",

        "add_name_error": "Une règle porte déjà ce nom. Veuillez modifier son nom.",
        "add_name_error_title": "Nom déjà utilisé",

        "delete_name_error": "Vous avez modifié le nom de la règle. Veuillez resélectionner la règle que vous voulez supprimer, et cliquez sur ‹Supprimer›.",
        "delete_name_error_title": "Nom de la règle à supprimer douteux",

        "modify_name_error": "Une autre règle porte déjà ce nom. Veuillez modifier le nom de la règle.",
        "modify_name_error_title": "Nouveau nom déjà utilisé par une autre règle",
    },
    "en": {
        "title": "Grammalecte · Editor for custom transformations",

        "name": "Rule name",
        "replace": "Replace",
        "by": "by",
        "regex": "Regex",
        "regex_help": "A regular expression is a kind of syntax describing a search pattern of characters",
        "casesens": "Case sensitivity",
        "casesens_help": "Characters case will be treated as written.",

        "new_entry": "New entry",
        "edit_entry": "Edition for selected entry",

        "add": "Add",
        "delete": "Delete",
        "modify": "Modify",
        "apply": "Apply",
        "apply_help": "Apply this rule on the text",

        "save": "Save",
        "import": "Import",
        "export": "Export",
        "close": "Close",

        "name_error": "For rules names, only use letters, numbers et characters among ‹_-#.,;!?›",
        "name_error_title": "Le nom de la règle n’est pas conforme.",

        "name_and_replace_error": "Neither the rule name, neither what has to be replaced can be empty. Please, fill the required fields.",
        "name_and_replace_error_title": "One of the required fields is empty",

        "add_name_error": "There is already a rule with this name. Please, find another name.",
        "add_name_error_title": "Rule name already used",

        "delete_name_error": "You have modified the name of the rule. Please, select again the rule you want to delete and click on ‹Delete›.",
        "delete_name_error_title": "Dubious rule name to delete",

        "modify_name_error": "This rule name is already used by another rule. Please, modify the rule name.",
        "modify_name_error_title": "New rule name already used by another rule",
    }
}