Grammalecte  Diff

Differences From Artifact [b4674c5ea1]:

To Artifact [7f07846793]:


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
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







+













+



-
-
+
+


-
+

-
+

-
+


-
-
+
+


-
-
-
+
+
+

+
-
-
+
+
+
+
+
+
+


-
-
+
+


-
-
+
+


-
-
+
+


-
-
+
+







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

import helpers


xDesktop = None
xLEDialog = None       # dialog for Lexicon Editor


class AppLauncher (unohelper.Base, XJobExecutor):
    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]

    # XJobExecutor
    def trigger (self, sCmd):
        global xLEDialog
        try:
            if sCmd == "About":
                import About
                xDialog = About.AboutGrammalecte(self.ctx)
                xDialog.run(self.sLang)
                xAboutDialog = About.AboutGrammalecte(self.ctx)
                xAboutDialog.run(self.sLang)
            elif sCmd.startswith("CJ"):
                import Conjugueur
                xDialog = Conjugueur.Conjugueur(self.ctx)
                xConjDialog = Conjugueur.Conjugueur(self.ctx)
                if sCmd[2:3] == "/":
                    xDialog.run(sCmd[3:])
                    xConjDialog.run(sCmd[3:])
                else:
                    xDialog.run()
                    xConjDialog.run()
            elif sCmd == "TF":
                import TextFormatter
                xDialog = TextFormatter.TextFormatter(self.ctx)
                xDialog.run(self.sLang)
                xTFDialog = TextFormatter.TextFormatter(self.ctx)
                xTFDialog.run(self.sLang)
            elif sCmd == "DI":
                import DictOptions
                xDialog = DictOptions.DictOptions(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "LE":
                xDODialog = DictOptions.DictOptions(self.ctx)
                xDODialog.run(self.sLang)
            elif sCmd.startswith("LE"):
                import LexiconEditor
                if not xLEDialog or xLEDialog.bClosed:
                xDialog = LexiconEditor.LexiconEditor(self.ctx)
                xDialog.run(self.sLang)
                    xLEDialog = LexiconEditor.LexiconEditor(self.ctx)
                    if sCmd[2:3] == "/":
                        xLEDialog.run(self.sLang, sCmd[3:])
                    else:
                        xLEDialog.run(self.sLang)
                elif sCmd[2:3] == "/":
                    xLEDialog.newEntry(sCmd[3:])
            elif sCmd == "MA":
                import Author
                xDialog = Author.Author(self.ctx)
                xDialog.run(self.sLang)
                xAuthorDialog = Author.Author(self.ctx)
                xAuthorDialog.run(self.sLang)
            elif sCmd == "OP":
                import Options
                xDialog = Options.GC_Options(self.ctx)
                xDialog.run(self.sLang)
                xGCDialog = Options.GC_Options(self.ctx)
                xGCDialog.run(self.sLang)
            elif sCmd == "EN":
                import Enumerator
                xDialog = Enumerator.Enumerator(self.ctx)
                xDialog.run(self.sLang)
                xEnumDialog = Enumerator.Enumerator(self.ctx)
                xEnumDialog.run(self.sLang)
            elif sCmd == "GO":
                import GraphicOptions
                xDialog = GraphicOptions.GraphicOptions(self.ctx)
                xDialog.run(self.sLang)
                xGODialog = GraphicOptions.GraphicOptions(self.ctx)
                xGODialog.run(self.sLang)
            elif sCmd.startswith("FA/"):
                findAll(sCmd[6:], (sCmd[3:4] == "y"), (sCmd[4:5] == "y"))
            # elif sCmd.startswith("URL/"):
            #     # Call from context menu to launch URL?
            #     # http://opengrok.libreoffice.org/xref/core/sw/source/ui/lingu/olmenu.cxx#785
            #     xSystemShellExecute = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.system.SystemShellExecute', self.ctx)
            #     xSystemShellExecute.execute(url, "", uno.getConstantByName("com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY"))