50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
xSubMenuContainer = xContextMenu.createInstance("com.sun.star.ui.ActionTriggerContainer")
for j, s in enumerate(lMorph):
self._addItemToContextMenu(xSubMenuContainer, j, "ActionTrigger", Text=s, CommandURL="service:net.grammalecte.AppLauncher?None")
# create root menu entry
i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sRoot, SubContainer=xSubMenuContainer)
else:
i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="# erreur : {}".format(item))
# Links to Conjugueur
if aVerb:
i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
for sVerb in aVerb:
i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="Conjuguer “{}”…".format(sVerb),
CommandURL="service:net.grammalecte.AppLauncher?CJ/"+sVerb)
|
|
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
xSubMenuContainer = xContextMenu.createInstance("com.sun.star.ui.ActionTriggerContainer")
for j, s in enumerate(lMorph):
self._addItemToContextMenu(xSubMenuContainer, j, "ActionTrigger", Text=s, CommandURL="service:net.grammalecte.AppLauncher?None")
# create root menu entry
i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sRoot, SubContainer=xSubMenuContainer)
else:
i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="# erreur : {}".format(item))
# Links to Conjugueur
if aVerb:
i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
for sVerb in aVerb:
i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="Conjuguer “{}”…".format(sVerb),
CommandURL="service:net.grammalecte.AppLauncher?CJ/"+sVerb)
|
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
|
oSpellChecker = oGC.getSpellChecker()
else:
oSpellChecker = SpellChecker("${lang}", "fr-allvars.bdic")
if not oLexicographe:
oLexicographe = lxg.Lexicographe(oSpellChecker)
except:
traceback.print_exc()
def execute (self, args):
if not args:
return
try:
# what version of the software?
xSettings = helpers.getConfigSetting("org.openoffice.Setup/Product", False)
sProdName = xSettings.getByName("ooName")
sVersion = xSettings.getByName("ooSetupVersion")
if (sProdName == "LibreOffice" and sVersion < "4") or sProdName == "OpenOffice.org":
return
# what event?
bCorrectEvent = False
for arg in args:
if arg.Name == "Environment":
for v in arg.Value:
if v.Name == "EnvType" and v.Value == "DOCUMENTEVENT":
bCorrectEvent = True
|
|
|
|
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
|
oSpellChecker = oGC.getSpellChecker()
else:
oSpellChecker = SpellChecker("${lang}", "fr-allvars.bdic")
if not oLexicographe:
oLexicographe = lxg.Lexicographe(oSpellChecker)
except:
traceback.print_exc()
def execute (self, args):
if not args:
return
try:
# what version of the software?
xSettings = helpers.getConfigSetting("org.openoffice.Setup/Product", False)
sProdName = xSettings.getByName("ooName")
sVersion = xSettings.getByName("ooSetupVersion")
if (sProdName == "LibreOffice" and sVersion < "4") or sProdName == "OpenOffice.org":
return
# what event?
bCorrectEvent = False
for arg in args:
if arg.Name == "Environment":
for v in arg.Value:
if v.Name == "EnvType" and v.Value == "DOCUMENTEVENT":
bCorrectEvent = True
|
165
166
167
168
169
170
171
172
173
174
175
|
if model.supportsService("com.sun.star.text.TextDocument"):
xController = model.getCurrentController()
if xController:
xController.registerContextMenuInterceptor(MyContextMenuInterceptor(self.ctx))
#print("OFF")
except:
traceback.print_exc()
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(JobExecutor, "grammalecte.ContextMenuHandler", ("grammalecte.ContextMenuHandler",),)
|
|
|
165
166
167
168
169
170
171
172
173
174
175
|
if model.supportsService("com.sun.star.text.TextDocument"):
xController = model.getCurrentController()
if xController:
xController.registerContextMenuInterceptor(MyContextMenuInterceptor(self.ctx))
#print("OFF")
except:
traceback.print_exc()
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(JobExecutor, "grammalecte.ContextMenuHandler", ("grammalecte.ContextMenuHandler",),)
|