rem zmienia "*" na symbol "cdot" w formułach w bieżącym dokumencie
sub ast2cdot()
d = thisComponent
frames = d.EmbeddedObjects
for i = 0 to frames.Count-1
f = frames.getByIndex(i).Component
if f.ImplementationName = "com.sun.star.comp.math.FormulaDocument" then
f.Formula = replace(f.Formula, "*", " cdot ")
endif
next i
end sub
def ast2cdot():
' zmienia "*" na symbol "cdot" w formułach w bieżącym dokumencie '
d = XSCRIPTCONTEXT.getDocument()
frames = d.EmbeddedObjects
for i in range(frames.Count):
f = frames.getByIndex(i).Component
if f.ImplementationName == "com.sun.star.comp.math.FormulaDocument":
f.Formula = f.Formula.replace("*", " cdot ")
sub wlacz()
d = thisComponent
c = d.currentController
h = CreateUnoListener("my_","com.sun.star.view.XSelectionChangeListener")
c.addSelectionChangeListener(h)
end sub
sub my_SelectionChanged(evt)
ast2cdot(evt.Source.Selection)
end sub
sub my_disposing(evt)
' pusta
end sub
sub ast2cdot(s)
on error goto done
f = s.Component
if f.ImplementationName = "com.sun.star.comp.math.FormulaDocument" then
f.Formula = replace(f.Formula, "*", " cdot ")
end if
done:
end sub
import uno
import unohelper
from com.sun.star.view import XSelectionChangeListener
class mySelectionChangeListener(unohelper.Base, XSelectionChangeListener):
def selectionChanged(self, evt):
ast2cdot(evt.Source.Selection)
def disposing(self, evt):
pass
def ast2cdot(sel):
try:
f = sel.Component
if f.ImplementationName == "com.sun.star.comp.math.FormulaDocument":
f.Formula = f.Formula.replace("*", " cdot ")
except:
pass
def wlacz():
d = XSCRIPTCONTEXT.getDocument()
c = d.getCurrentController()
h = mySelectionChangeListener()
c.addSelectionChangeListener(h)
g_exportedScripts = (wlacz,)
Użytkownicy przeglądający ten dział: Brak zidentyfikowanych użytkowników i 1 gość