summaryrefslogtreecommitdiff
path: root/librelogo/source
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-11-07 23:31:44 +0100
committerAndras Timar <atimar@suse.com>2012-11-07 23:32:35 +0100
commit74abeff02b750fb22fc3d56299abc2cd12d357d3 (patch)
treecbd82d31a89f4ecfe8bcf7cbc0c0bc1cabc80af1 /librelogo/source
parent0facaa9fe659efa0e0a3ddbeea81e83e1fede191 (diff)
integrate librelogo to the build
Change-Id: I4cd29f6a893d72a49233bb53d19701d0bdd0e078
Diffstat (limited to 'librelogo/source')
-rw-r--r--librelogo/source/ChangeLog82
-rw-r--r--librelogo/source/LibreLogo/LibreLogo.py1407
-rw-r--r--librelogo/source/LibreLogoDummy.py14
-rw-r--r--librelogo/source/META-INF/manifest.xml9
-rw-r--r--librelogo/source/README43
-rw-r--r--librelogo/source/description-en-US.txt1
-rw-r--r--librelogo/source/description.xml20
-rw-r--r--librelogo/source/help/en-US/LibreLogo.xhp388
-rw-r--r--librelogo/source/help/en-US/help.tree18
-rw-r--r--librelogo/source/help/en-US/tree_strings.xhp29
-rw-r--r--librelogo/source/icons/lc_arrowshapes.circular-arrow.pngbin0 -> 787 bytes
-rw-r--r--librelogo/source/icons/lc_arrowshapes.circular-leftarrow.pngbin0 -> 1082 bytes
-rw-r--r--librelogo/source/icons/lc_arrowshapes.down-arrow.pngbin0 -> 527 bytes
-rw-r--r--librelogo/source/icons/lc_arrowshapes.up-arrow.pngbin0 -> 487 bytes
-rw-r--r--librelogo/source/icons/lc_basicstop.pngbin0 -> 616 bytes
-rw-r--r--librelogo/source/icons/lc_editglossary.pngbin0 -> 705 bytes
-rw-r--r--librelogo/source/icons/lc_navigationbarleft.pngbin0 -> 831 bytes
-rw-r--r--librelogo/source/icons/lc_newdoc.pngbin0 -> 445 bytes
-rw-r--r--librelogo/source/icons/lc_runbasic.pngbin0 -> 740 bytes
-rw-r--r--librelogo/source/icons/sc_arrowshapes.circular-arrow.pngbin0 -> 482 bytes
-rw-r--r--librelogo/source/icons/sc_arrowshapes.circular-leftarrow.pngbin0 -> 631 bytes
-rw-r--r--librelogo/source/icons/sc_arrowshapes.down-arrow.pngbin0 -> 340 bytes
-rw-r--r--librelogo/source/icons/sc_arrowshapes.up-arrow.pngbin0 -> 323 bytes
-rw-r--r--librelogo/source/icons/sc_basicstop.pngbin0 -> 397 bytes
-rw-r--r--librelogo/source/icons/sc_editglossary.pngbin0 -> 429 bytes
-rw-r--r--librelogo/source/icons/sc_navigationbarleft.pngbin0 -> 626 bytes
-rw-r--r--librelogo/source/icons/sc_newdoc.pngbin0 -> 350 bytes
-rw-r--r--librelogo/source/icons/sc_runbasic.pngbin0 -> 534 bytes
-rw-r--r--librelogo/source/pythonpath/LibreLogo_en_US.properties151
-rw-r--r--librelogo/source/pythonpath/librelogodummy_path.py3
-rw-r--r--librelogo/source/registry/data/org/openoffice/Office/Addons.xcu286
-rw-r--r--librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu18
-rw-r--r--librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu18
33 files changed, 2487 insertions, 0 deletions
diff --git a/librelogo/source/ChangeLog b/librelogo/source/ChangeLog
new file mode 100644
index 000000000000..17f19a88a998
--- /dev/null
+++ b/librelogo/source/ChangeLog
@@ -0,0 +1,82 @@
+2012-11-06 László Németh:
+ * uppercase/translation icon:
+ - expands and uppercase Logo commands (fd -> FORWARD)
+ - translation between supported languages (commands, decimal sign, for/in order)
+ * new icon for clear screen
+ * add English manual (see LibreLogo/Logo/Turtle graphics in Help)
+
+2012-10-25 László Németh:
+ * fix positioning to the faulty program line
+ * program cache depends from the (modified) language of the document, too
+
+2012-10-21 László Németh:
+ * speed up command line
+ * add multiline tooltip to the command line (it works well from LibO 3.6.2)
+ * random color constants: ~color, eg. '~orange', '~green' etc.
+ * handle modulo operator
+ * ask before the compilation of long documents (avoid freezings)
+ * add compilation cache to the multiline programs
+ * better help window caption in the command line
+
+2012-06-27 László Németh:
+ * fix __string__ (use localized decimal sign)
+ * fix repcount in loops with inner picture block
+ * handle reopened documents
+ * modified argument list of custom dashed penstyle
+ * fix warning messages at maximum recursion depth and memory
+ * add hatching styles (fillstyle num or
+ fillstyle [line count(max 3), color, distance, degree]
+ * add localized set(), range(), sorted()
+ * fix turtle selection at program start
+ * modified turtle colors
+ * fix showturtle
+ * fix LineStyle_SOLID and LineStyle_DASHED
+ * add repcount to the infinite loop
+ * add logical expression and better list support to the simple LibreLogo expression parser
+ * add string size limit for Print()
+ * support "pic" without block: new shape
+ * use localized __string__ for STR instead of str
+ * add min, max, and regex functions: sub, search, findall
+ * fix double round in localizations
+ * more stable dotted lines in the PDF export (implemented as arrays of dot-headed arrows)
+ * circles with dotted lines
+ * working pos and pagesize indices in expressions
+
+2012-05-17 László Németh:
+ * fix opt. suffix syntax of for+in (eg. with Finnish :ssa, Hungarian -ban)
+ * add dashed outline of turtle to show "pen up" state
+ * fix initial turtle focus for OpenOffice.org and older LibreOffice versions
+ * parsing simple (with 0 or 1 argument) user functions in complex expressions
+ * add localized "global"
+ * add localized operator "in" for logical expressions
+ * parsing user functions with 2 or more arguments in simple numerical expressions
+ * function heading supports coordinates
+ * function position supports drawing
+ * function pensize supports argument any
+ * set SizeProtect feature of turtle shape
+ * replace random while repcount variable with iterator
+ * fix repcount checking in conditions of "while" loops
+ * add repcount support to "for x in y" loops
+ * fix OUTPUT and STOP for lines with multiple commands
+ * fix = -> == conversion in logical expressions in OUTPUT
+ * fix multiple document support using CreationDate instead of Title
+ * better OpenOffice.org 3.2 compatibility (optional usage of feature Visible)
+
+2012-05-08 László Németh:
+ * picture [] handles left hanging shapes better
+ * function random works on lists or list-convertable objects (string, tuple, dict, set), too
+ * faster "label" (remove unnecessary shape search)
+ * document-level turtle states
+ * clean name spaces
+ * localization of "pi" (localizations support greek letter pi as alternative)
+ * localized "float"
+ * int & float support localized decimal signs and measurements (float '10,5cm')
+ * print, label, text support localized decimal sign
+
+2012-05-02 László Németh:
+ * fix slow drawing of new line shapes (unnecessary shape search)
+ * "circle" and "square" are synonyms of ellipse and rectangle, eg.
+ square num = rectangle [num, num]
+
+2012-04-27 László Németh:
+ * Initial release
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
new file mode 100644
index 000000000000..9a45b2b20caf
--- /dev/null
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -0,0 +1,1407 @@
+# -*- encoding: UTF-8 -*-
+# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+import sys, os, uno, unohelper
+import re, random, traceback, itertools
+import threading, time as __time__
+
+ctx = uno.getComponentContext()
+__lngpath__ = re.sub("[\w_.]*$", "", ctx.ServiceManager.createInstanceWithContext("org.openoffice.LibreLogo.LibreLogoDummy", ctx).get_path())
+__translang__ = "cz|de|dk|en_US|es|fr|hu|it|nl|no|pl|pt|ru|se|sl" # FIXME supported languages for language guessing, expand this list, according to the localizations
+__lng__ = {}
+__docs__ = {}
+__prevcode__ = None
+__prevlang__ = None
+__prevcompiledcode__ = None
+__thread__ = None
+__lock__ = threading.Lock()
+__halt__ = False
+__compiled__ = ""
+__group__ = 0
+__groupstack__ = []
+__grouplefthang__ = 0
+__comp__ = {}
+__strings__ = []
+__colors__ = {}
+__COLORS__ = ['BLACK', 0x000000], ['SILVER', 0xc0c0c0], ['GRAY', 0x808080], \
+ ['WHITE', 0xffffff], ['MAROON', 0x800000], ['RED', 0xff0000], \
+ ['PURPLE', 0x800080], ['FUCHSIA', 0xff00ff], ['GREEN', 0x008000], \
+ ['LIME', 0x00ff00], ['OLIVE', 0x808000], ['YELLOW', 0xffff00], \
+ ['NAVY', 0x000080], ['BLUE', 0x0000ff], ['TEAL', 0x008080], \
+ ['AQUA', 0x00ffff], ['PINK', 0xffc0cb], ['TOMATO', 0xff6347], \
+ ['ORANGE', 0xffa500], ['GOLD', 0xffd700], ['VIOLET', 0x9400d3], \
+ ['SKYBLUE', 0x87ceeb], ['CHOCOLATE', 0xd2691e], ['BROWN', 0xa52a2a], \
+ ['INVISIBLE', 0xff000000]
+__SLEEP_SLICE_IN_MILLISECONDS__ = 500
+__PT_TO_TWIP__ = 20
+__MM_TO_PT__ = 1/(25.4/72)
+__MM10_TO_TWIP__ = 1/(2540.0/72/20) # 0.01 mm to twentieth point
+__FILLCOLOR__ = 0x8000ff00
+__LINEWIDTH__ = 0.5 * __PT_TO_TWIP__
+__ENCODED_STRING__ = "_s_%s___"
+__DECODE_STRING_REGEX__ = "_s_([0-9]+)___"
+__LINEBREAK__ = "#_@L_i_N_e@_#"
+__TURTLE__ = "turtle"
+__ACTUAL__ = "actual"
+__BASEFONTFAMILY__ = "Linux Biolinum G"
+__LineStyle_DOTTED__ = 2
+
+class __Doc__:
+ def __init__(self, doc):
+ self.doc = doc
+ try:
+ self.drawpage = doc.DrawPage # Writer
+ except:
+ self.drawpage = doc.DrawPages.getByIndex(0) # Draw, Impress
+ self.shapecache = {}
+ self.zoomvalue = 0
+ self.initialize()
+
+ def initialize(self):
+ self.pen = 1
+ self.pencolor = 0
+ self.pensize = __LINEWIDTH__
+ self.linestyle = __LineStyle_SOLID__
+ self.linejoint = __ROUNDED__
+ self.oldlc = 0
+ self.oldlw = 0
+ self.oldls = __LineStyle_SOLID__
+ self.oldlj = __ROUNDED__
+ self.continuous = True
+ self.areacolor = __FILLCOLOR__
+ self.hatch = None
+ self.textcolor = 0
+ self.fontfamily = __BASEFONTFAMILY__
+ self.fontheight = 12
+ self.fontweight = 100
+ self.fontstyle = 0
+
+from math import pi, sin, cos, asin, sqrt
+
+from com.sun.star.awt import Point as __Point__
+from com.sun.star.drawing import LineDash as __LineDash__
+from com.sun.star.drawing import Hatch as __Hatch__
+from com.sun.star.drawing import PolyPolygonBezierCoords as __Bezier__
+from com.sun.star.text.TextContentAnchorType import AT_PAGE as __AT_PAGE__
+from com.sun.star.text.WrapTextMode import THROUGHT as __THROUGHT__
+from com.sun.star.drawing.LineJoint import NONE as __Joint_NONE__
+from com.sun.star.drawing.LineJoint import BEVEL as __BEVEL__
+from com.sun.star.drawing.LineJoint import MITER as __MITER__
+from com.sun.star.drawing.LineJoint import ROUND as __ROUNDED__
+from com.sun.star.drawing.LineStyle import SOLID as __LineStyle_SOLID__
+from com.sun.star.drawing.LineStyle import DASH as __LineStyle_DASHED__
+from com.sun.star.drawing.DashStyle import RECT as __DashStyle_RECT__
+from com.sun.star.drawing.DashStyle import ROUND as __DashStyle_ROUND__
+from com.sun.star.drawing.DashStyle import ROUNDRELATIVE as __DashStyle_ROUNDRELATIVE__
+from com.sun.star.drawing.CircleKind import FULL as __FULL__
+from com.sun.star.drawing.CircleKind import SECTION as __SECTION__
+from com.sun.star.drawing.CircleKind import CUT as __CUT__
+from com.sun.star.drawing.CircleKind import ARC as __ARC__
+from com.sun.star.awt.FontSlant import NONE as __Slant_NONE__
+from com.sun.star.awt.FontSlant import ITALIC as __Slant_ITALIC__
+from com.sun.star.awt import Size as __Size__
+from com.sun.star.awt import WindowDescriptor as __WinDesc__
+from com.sun.star.awt.WindowClass import MODALTOP as __MODALTOP__
+from com.sun.star.awt.VclWindowPeerAttribute import OK as __OK__
+from com.sun.star.awt.VclWindowPeerAttribute import YES_NO_CANCEL as __YES_NO_CANCEL__ # OK_CANCEL, YES_NO, RETRY_CANCEL, DEF_OK, DEF_CANCEL, DEF_RETRY, DEF_YES, DEF_NO
+from com.sun.star.awt.PushButtonType import OK as __Button_OK__
+from com.sun.star.awt.PushButtonType import CANCEL as __Button_CANCEL__
+from com.sun.star.util.MeasureUnit import APPFONT as __APPFONT__
+from com.sun.star.beans import PropertyValue as __property__
+from com.sun.star.lang import Locale
+
+def __getprop__(name, value):
+ p, p.Name, p.Value = __property__(), name, value
+ return p
+
+def __l12n__(lng):
+ try:
+ return __lng__[lng]
+ except:
+ try:
+ __lng__[lng] = dict([[i.split("=")[0].strip(), i.split("=")[1].strip().decode("unicode-escape")] for i in open(__lngpath__ + "LibreLogo_" + lng + ".properties", 'r').readlines() if "=" in i])
+ return __lng__[lng]
+ except:
+ return None
+
+# dot for dotted line (implemented as an array of dot-headed arrows, because PostScript dot isn't supported by Writer)
+__bezierdot__ = __Bezier__()
+__dots__ = []
+for i in range(32):
+ __dots__ += [__Point__(round(sin(360.0/32 * i * pi/180.0) * 1000), round(cos(360.0/32 * i * pi/180) * 1000))]
+__bezierdot__.Coordinates = (tuple(__dots__),)
+__bezierdot__.Flags = ((0,) * 32,)
+
+def __getdocument__():
+ global __docs__, _
+ doc = XSCRIPTCONTEXT.getDocument()
+ try:
+ _ = __docs__[doc.Title]
+ _.doc.Title # Is existing instance (not the garbage of the previous instance of a reopened document or a new "Untitled 1")?
+ except:
+ _ = __Doc__(doc)
+ __docs__[doc.Title] = _
+
+# input function, result: input string or 0
+def Input(s):
+ try:
+ ctx = uno.getComponentContext()
+ smgr = ctx.ServiceManager
+ text = ""
+
+ # dialog
+ d = smgr.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", ctx)
+ ps = _.doc.CurrentController.Frame.ContainerWindow.getPosSize()
+ lo = _.doc.CurrentController.Frame.ContainerWindow.convertSizeToLogic(__Size__(ps.Width, ps.Height), __APPFONT__)
+ d.PositionX, d.PositionY, d.Width, d.Height = lo.Width/2 - 75, lo.Height/2 - 25, 150, 50
+
+ # label
+ l = d.createInstance("com.sun.star.awt.UnoControlFixedTextModel" )
+
+ if type(s) == list:
+ text = s[1]
+ s = s[0]
+ l.PositionX, l.PositionY, l.Width, l.Height, l.Name, l.TabIndex, l.Label = 5, 4, 140, 14, "l1", 2, s
+
+ # textbox or combobox
+ e = d.createInstance("com.sun.star.awt.UnoControlEditModel")
+ e.PositionX, e.PositionY, e.Width, e.Height, e.Name, e.TabIndex = 5, 14, 140, 12, "e1", 0
+
+ # buttons
+ b = d.createInstance( "com.sun.star.awt.UnoControlButtonModel" )
+ b.PositionX, b.PositionY, b.Width, b.Height, b.Name, b.TabIndex, b.PushButtonType, b.DefaultButton = 55, 32, 45, 14, "b1", 1, __Button_OK__, True
+ b2 = d.createInstance( "com.sun.star.awt.UnoControlButtonModel" )
+ b2.PositionX, b2.PositionY, b2.Width, b2.Height, b2.Name, b2.TabIndex, b2.PushButtonType = 100, 32, 45, 14, "b2", 1, __Button_CANCEL__
+
+ # insert the control models into the dialog model
+ d.insertByName( "l1", l)
+ d.insertByName( "b1", b)
+ d.insertByName( "b2", b2)
+ d.insertByName( "e1", e)
+
+ # create the dialog control and set the model
+ controlContainer = smgr.createInstanceWithContext("com.sun.star.awt.UnoControlDialog", ctx)
+ controlContainer.setModel(d)
+
+ # create a peer
+ toolkit = smgr.createInstanceWithContext("com.sun.star.awt.ExtToolkit", ctx)
+ controlContainer.setVisible(False)
+ controlContainer.createPeer(toolkit, None)
+
+ # execute it
+ inputtext = controlContainer.execute()
+ if inputtext:
+ inputtext = e.Text
+
+ # dispose the dialog
+ controlContainer.dispose()
+ return inputtext
+ except Exception, e:
+ __trace__()
+
+def __string__(s, decimal = None): # convert decimal sign, localized BOOL and SET
+ if not decimal:
+ decimal = _.decimal
+ if decimal == ',' and type(s) == float:
+ return str(s).replace(".", ",")
+ if type(s) in [list, tuple, dict, set]:
+ __strings__ = []
+ s = re.sub("(?u)(['\"])(([^'\"]|\\['\"])*)(?<!\\\\)\\1", __encodestring__, str(s)) # XXX fix double '\'\"'
+ if decimal == ',':
+ s = s.replace(".", ",")
+ return re.sub(__DECODE_STRING_REGEX__, __decodestring__, \
+ s.replace('set', __locname__('SET')).replace('True', __locname__('TRUE')).replace('False', __locname__('FALSE')))
+ if type(s) in [str, unicode]:
+ return s
+ elif type(s) == bool:
+ return __locname__(str(s).upper())
+ return str(s)
+
+def Print(s):
+ s = __string__(s, _.decimal)
+ z = MessageBox(_.doc.CurrentController.Frame.ContainerWindow, s[:500] + s[500:5000].replace('\n', ' '), "", "messbox")
+
+def MessageBox(parent, message, title, msgtype = "messbox", buttons = __OK__):
+ msgtypes = ("messbox", "infobox", "errorbox", "warningbox", "querybox")
+ if not (msgtype in msgtypes):
+ msgtype = "messbox"
+ d = __WinDesc__()
+ d.Type = __MODALTOP__
+ d.WindowServiceName = msgtype
+ d.ParentIndex = -1
+ d.Parent = parent
+ d.WindowAttributes = buttons
+ tk = parent.getToolkit()
+ msgbox = tk.createWindow(d)
+ msgbox.setMessageText(message)
+ if title:
+ msgbox.setCaptionText(title)
+ return msgbox.execute()
+
+def Random(r):
+ try:
+ return r * random.random()
+ except:
+ return list(r)[int(random.random() * len(r))]
+
+def to_ascii(s):
+ return s.encode("unicode-escape").replace("\u", "__u__").replace(r"\x", "__x__")
+
+def to_unicode(s):
+ return s.replace("__x__", r"\x").replace("__u__", "\u").decode("unicode-escape")
+
+def __trace__():
+ if 'PYUNO_LOGLEVEL' in os.environ:
+ print(traceback.format_exc())
+
+def __locname__(name, l = -1):
+ if l == -1:
+ l = _.lng
+ for i in __l12n__(l):
+ if i == name.upper():
+ return __l12n__(l)[i].split("|")[0] # return with the first localized name
+ return to_unicode(name)
+
+def __translate__(arg = None):
+ global _
+ __initialize__()
+ __setlang__()
+ # detect language
+ text = _.doc.getText().getString()
+ # remove comments and strings
+ text = re.sub(r"[ ]*;[^\n]*", "", re.sub(ur"['„“‘«»「][^\n'”“‘’«»」]*['”“‘’«»」]", "", re.sub(r"^[ \t]*[;#][^\n]*", "", text)))
+ text = " ".join(set(re.findall("(?u)\w+", text)) - set(re.findall("(?u)\w*\d+\w*", text))).lower() # only words
+ ctx = uno.getComponentContext()
+ guess = ctx.ServiceManager.createInstanceWithContext("com.sun.star.linguistic2.LanguageGuessing", ctx)
+ guess.disableLanguages(guess.getEnabledLanguages())
+ guess.enableLanguages(tuple([Locale(i, "", "") for i in __translang__.split("|")]))
+ guess = guess.guessPrimaryLanguage(text, 0, len(text))
+ lang = __l12n__(guess.Language + "_" + guess.Country)
+ if not lang:
+ lang = __l12n__(guess.Language)
+ if not lang:
+ lang = __l12n__(_.lng)
+ if not lang:
+ lang = __l12n__("en_US")
+
+ lq = '\'' + lang['LEFTSTRING'].replace("|", "")
+ rq = '\'' + lang['RIGHTSTRING'].replace("|", "")
+ __strings__ = []
+
+ text = re.sub("(?u)([%s])([^\n%s]*)(?<!\\\\)[%s]" % (lq, rq, rq), __encodestring__, _.doc.getText().getString())
+ text = re.sub('(?u)(?<![0-9])(")(~?\w*)', __encodestring__, text)
+
+ # translate the program to the language of the document FIXME space/tab
+ exception = ['DECIMAL']
+ in1 = lang['IN'].upper()
+ in2 = __l12n__(_.lng)['IN'].split("|")[0].upper()
+ if in1[0] == '-' and in2[0] != '-': # "for x y-in" -> "for x in y"
+ exception += ['IN']
+ text = re.sub(ur"(?ui)\b((?:%s) +:?\w+) +([^\n]+)(?:%s) +(?=[[] |[[]\n)" % (lang['FOR'], in1), "\\1 %s \\2 " % in2, text)
+ text = re.sub(ur"(?ui)(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % in1, "%s \\1" % in2, text)
+ elif in1[0] != '-' and in2[0] == '-': # "for x in y" -> "for x y-in"
+ exception += ['IN']
+ text = re.sub(ur"(?ui)(?<=\n)((?:%s)\b +:?\w+) +(?:%s) +([^\n]+?) +(?=[[] |[[]\n)" % (lang['FOR'], in1), "\\1 \\2%s " % in2, text)
+ text = re.sub(ur"(?ui)(?<!:)\b(?:%s) +(:?\b\w+|[[][^[\n]*])\b" % in1, "\\1%s" % in2, text)
+ for i in set(lang) - set(exception):
+ text = re.sub(ur'(?ui)(?<!:)\b(%s)\b' % lang[i], __l12n__(_.lng)[i].split("|")[0].upper(), text)
+ text = re.sub(ur"(?<=\d)[%s](?=\d)" % lang['DECIMAL'], __l12n__(_.lng)['DECIMAL'], text)
+
+ # decode strings
+ quoted = u"(?ui)(?<=%s)(%%s)(?=%s)" % (__l12n__(_.lng)['LEFTSTRING'][0], __l12n__(_.lng)['RIGHTSTRING'][0])
+ text = re.sub(__DECODE_STRING_REGEX__, __decodestring2__, text)
+ for i in __COLORS__ + (['NONE'], ['BEVEL'], ['MITER'], ['ROUNDED'], ['SOLID'], ['DASH'], ['DOTTED'], ['BOLD'], ['ITALIC'], ['UPRIGHT'], ['NORMAL']):
+ text = re.sub(quoted % lang[i[0]], __l12n__(_.lng)[i[0]].split("|")[0].upper(), text)
+ _.doc.getText().setString(text)
+ # convert to paragraphs
+ __dispatcher__(".uno:ExecuteSearch", (__getprop__("SearchItem.SearchString", r"\n"), __getprop__("SearchItem.ReplaceString", r"\n"), \
+ __getprop__("Quiet", True), __getprop__("SearchItem.Command", 3), __getprop__("SearchItem.StyleFamily", 2)))
+
+class LogoProgram(threading.Thread):
+ def __init__(self, code):
+ self.code = code
+ threading.Thread.__init__(self)
+
+ def run(self):
+ global __thread__
+ try:
+ exec(self.code)
+ except Exception as e:
+ try:
+ TRACEPATTERN = '"<string>", line '
+ message = traceback.format_exc()
+ l = re.findall(TRACEPATTERN + '[0-9]+', message)
+ if len(l) > 0 and not "SystemExit" in message:
+ line = len(re.findall(__LINEBREAK__, ''.join(self.code.split("\n")[:int(l[-1][len(TRACEPATTERN):])]))) + 1
+ caption = __l12n__(_.lng)['LIBRELOGO']
+ if __prevcode__ and "\n" in __prevcode__:
+ __gotoline__(line)
+ caption = __l12n__(_.lng)['ERROR'] % line
+ parent = _.doc.CurrentController.Frame.ContainerWindow
+ if "maximum recursion" in message:
+ MessageBox(parent, __l12n__(_.lng)['ERR_STOP'] + " " + __l12n__(_.lng)['ERR_MAXRECURSION'] % sys.getrecursionlimit(), __l12n__(_.lng)['LIBRELOGO'])
+ elif "cannot initialize memory" in message or "Couldn't instantiate" in message:
+ MessageBox(parent, __l12n__(_.lng)['ERR_STOP'] + " " + __l12n__(_.lng)['ERR_MEMORY'], __l12n__(_.lng)['LIBRELOGO'])
+ elif "ZeroDivisionError" in message:
+ MessageBox(parent, __l12n__(_.lng)['ERR_ZERODIVISION'], caption, "errorbox")
+ elif "IndexError" in message:
+ MessageBox(parent, __l12n__(_.lng)['ERR_INDEX'], caption, "errorbox")
+ elif "KeyError" in message:
+ MessageBox(parent, __l12n__(_.lng)['ERR_KEY'] % eval(re.search("KeyError: ([^\n]*)", message).group(1)), caption, "errorbox")
+ elif "NameError" in message:
+ if "__repeat__" in message:
+ MessageBox(parent, __l12n__(_.lng)['ERR_ARGUMENTS'] % (__locname__('REPEAT'), 1, 0), caption, "errorbox")
+ else:
+ MessageBox(parent, __l12n__(_.lng)['ERR_NAME'] % \
+ to_unicode(re.search("(?<=name ')[\w_]*(?=')", message).group(0)), caption, "errorbox")
+ elif "TypeError" in message and "argument" in message and "given" in message:
+ r = re.search("([\w_]*)[(][)][^\n]* (\w+) arguments? [(](\d+)", message) # XXX later: handle 'no arguments' + plural
+ MessageBox(parent, __l12n__(_.lng)['ERR_ARGUMENTS'] % (__locname__(r.group(1)), r.group(2), r.group(3)), caption, "errorbox")
+ else:
+ origline = __compiled__.split("\n")[line-1]
+ if not "com.sun.star" in message and not "__repeat__" in message and not "*)" in message and ("[" in origline or "]" in origline):
+ MessageBox(parent, __l12n__(_.lng)['ERR_BLOCK'], caption, "errorbox")
+ else:
+ MessageBox(parent, __l12n__(_.lng)['ERROR'] %line, __l12n__(_.lng)['LIBRELOGO'], "errorbox")
+ __trace__()
+ except:
+ pass
+ with __lock__:
+ __thread__ = None
+
+
+def __encodestring__(m):
+ __strings__.append(re.sub("\\[^\\]", "", m.group(2)))
+ return __ENCODED_STRING__ % (len(__strings__) - 1)
+
+def __decodestring__(m):
+ return "u'%s'" % __strings__[int(m.group(1))]
+
+def __decodestring2__(m):
+ return __l12n__(_.lng)['LEFTSTRING'][0] + __strings__[int(m.group(1))] + __l12n__(_.lng)['RIGHTSTRING'][0]
+
+def __initialize__():
+ global __halt__, __thread__
+ __getdocument__()
+ _.zoomvalue = _.doc.CurrentController.getViewSettings().ZoomValue
+ shape = __getshape__(__TURTLE__)
+ if not shape:
+ shape = _.doc.createInstance( "com.sun.star.drawing.PolyPolygonShape" )
+ shape.AnchorType = __AT_PAGE__
+ shape.TextWrap = __THROUGHT__
+ shape.Opaque = True
+ _.drawpage.add(shape)
+ shape.PolyPolygon = ((__Point__(-60, 0), __Point__(0, -100), __Point__(60, 0)), (__Point__(0, 0), __Point__(0, 100)), \
+ (__Point__(-250, 0),), (__Point__(0, 250),), (__Point__(250, 0),), (__Point__(0, -250),), # single points for wider selection
+ (__Point__(0, 0),)) # last point for position handling
+ _.shapecache[__TURTLE__] = shape
+ shape.Name = __TURTLE__
+ _.initialize()
+ turtlehome()
+ _.doc.CurrentController.select(shape)
+ shape.LineJoint = __MITER__
+ shape.Shadow = True
+ shape.FillColor, transparence = __splitcolor__(_.areacolor)
+ shape.FillTransparence = min(95, transparence)
+ shape.ShadowColor, shape.ShadowTransparence, shape.ShadowXDistance, shape.ShadowYDistance = (0, 20, 0, 0)
+# shape.ShadowColor, shape.ShadowTransparence, shape.ShadowXDistance, shape.ShadowYDistance = (0, max(20, 100 - transparence), 0, 0)
+ shape.LineColor, shape.LineTransparence = __splitcolor__(_.pencolor)
+ shape.LineWidth = min(_.pensize, (1 + _.pen * 2) * __PT_TO_TWIP__)
+ shape.SizeProtect = True
+
+def pagesize(n = -1):
+ if n == -1:
+ ps = _.doc.CurrentController.getViewCursor().PageStyleName
+ page = _.doc.StyleFamilies.getByName("PageStyles").getByName(ps)
+ return [page.Width * __MM10_TO_TWIP__ / __PT_TO_TWIP__, page.Height * __MM10_TO_TWIP__ / __PT_TO_TWIP__]
+ return None
+
+def turtlehome():
+ turtle = __getshape__(__TURTLE__)
+ if turtle:
+ ps = _.doc.CurrentController.getViewCursor().PageStyleName
+ page = _.doc.StyleFamilies.getByName("PageStyles").getByName(ps)
+ turtle.setPosition(__Point__((page.Width - turtle.BoundRect.Width)/2, (page.Height - turtle.BoundRect.Height)/2))
+ turtle.LineStyle = __LineStyle_SOLID__
+ turtle.LineJoint = __MITER__
+ turtle.LineWidth = min(_.pensize, (1 + _.pen * 2) * __PT_TO_TWIP__)
+ turtle.LineColor, none = __splitcolor__(_.pencolor)
+ turtle.LineTransparence = 25
+ turtle.RotateAngle = 0
+ turtle.ZOrder = 1000
+
+def __pen__(n):
+ _.pen = n
+ turtle = __getshape__(__TURTLE__)
+ if turtle:
+ if n:
+ turtle.LineStyle = __LineStyle_SOLID__
+ turtle.LineWidth = min(_.pensize, 3 * __PT_TO_TWIP__)
+ else:
+ turtle.LineStyle = __LineStyle_DASHED__
+ turtle.LineDash = __LineDash__(__DashStyle_RECT__, 0, 0, 1, __PT_TO_TWIP__, __PT_TO_TWIP__)
+ turtle.LineWidth = min(_.pensize, __PT_TO_TWIP__)
+
+
+def __visible__(shape, visible = -1): # for OOo 3.2 compatibility
+ try:
+ if visible == -1:
+ return shape.Visible
+ shape.Visible = visible
+ except:
+ return True
+
+def hideturtle():
+ turtle = __getshape__(__TURTLE__)
+ if turtle:
+ __visible__(turtle, False)
+ turtle.LineTransparence, turtle.FillTransparence = 100, 100 # for saved files
+ __dispatcher__(".uno:Escape")
+
+def showturtle():
+ turtle = __getshape__(__TURTLE__)
+ if turtle:
+ if not turtle.Parent:
+ _.drawpage.add(turtle)
+ pencolor(_.pencolor)
+ fillcolor(_.areacolor)
+ pensize(_.pensize/__PT_TO_TWIP__)
+ __visible__(turtle, True)
+ _.doc.CurrentController.select(__getshape__(__TURTLE__))
+ else:
+ __initialize__()
+
+def left(arg=None):
+ if __thread__:
+ return None
+ __initialize__()
+ turtle = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection')
+ turtle.add(__getshape__(__TURTLE__))
+ _.doc.CurrentController.select(turtle)
+# _.doc.CurrentController.select(__getshape__(__TURTLE__)) # it works from LibreOffice 3.5
+ rotate(__TURTLE__, 1500)
+ return None
+
+def right(arg=None):
+ if __thread__:
+ return None
+ __initialize__()
+ turtle = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection')
+ turtle.add(__getshape__(__TURTLE__))
+ _.doc.CurrentController.select(turtle)
+ rotate(__TURTLE__, -1500)
+ return None
+
+def goforward(arg=None):
+ if __thread__:
+ return None
+ __initialize__()
+ turtle = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection')
+ turtle.add(__getshape__(__TURTLE__))
+ _.doc.CurrentController.select(turtle)
+ forward(10)
+ return None
+
+def gobackward(arg=None):
+ if __thread__:
+ return None
+ __initialize__()
+ turtle = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection')
+ turtle.add(__getshape__(__TURTLE__))
+ _.doc.CurrentController.select(turtle)
+ backward(10)
+ return None
+
+def commandline(arg=None, arg2=None):
+ run(arg, arg2)
+
+def __setlang__():
+ global _
+ loc = _.doc.CurrentController.getViewCursor().CharLocale
+ _.lng = loc.Language + '_' + loc.Country
+ if not __l12n__(_.lng):
+ _.lng = loc.Language
+ if not __l12n__(_.lng):
+ _.lng = "en_US"
+
+def run(arg=None, arg2 = -1):
+ global _, __thread__, __halt__, _, __prevcode__, __prevlang__, __prevcompiledcode__
+ if __thread__:
+ return None
+ with __lock__:
+ __thread__ = 1
+ try:
+ __initialize__()
+ __setlang__()
+ if arg2 == -1:
+ arg2 = _.doc.getText().getString()
+ if len(arg2) > 20000:
+ if MessageBox(_.doc.CurrentController.Frame.ContainerWindow, __l12n__(_.lng)['ERR_NOTAPROGRAM'], __l12n__(_.lng)['LIBRELOGO'], "querybox", __YES_NO_CANCEL__) <> 2:
+ with __lock__:
+ __thread__ = None
+ return None
+ __gotoline__(1)
+ if __prevcode__ and __prevcode__ == arg2 and __prevlang__ == _.lng:
+ __thread__ = LogoProgram(__prevcompiledcode__)
+ else:
+ __prevcode__ = arg2
+ __prevlang__ = _.lng
+ __prevcompiledcode__ = __compil__(arg2)
+ __thread__ = LogoProgram(__prevcompiledcode__)
+ __halt__ = False
+ turtle = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection')
+ turtle.add(__getshape__(__TURTLE__))
+ _.doc.CurrentController.select(turtle)
+ __thread__.start()
+ except Exception as e:
+ __thread__ = None
+ __trace__()
+ return None
+
+def stop(arg=None):
+ global __halt__
+ with __lock__:
+ __halt__ = True
+ return None
+
+def home(arg=None):
+ if __thread__:
+ return None
+ __getdocument__()
+ turtle = __getshape__(__TURTLE__)
+ if turtle:
+ __removeshape__(__TURTLE__)
+ _.drawpage.remove(turtle)
+ __initialize__()
+ __dispatcher__(".uno:Escape")
+ if not __halt__:
+ return None
+ _.pencolor = 0
+ _.pensize = __LINEWIDTH__
+ _.areacolor = __FILLCOLOR__
+ pen = 1
+ __removeshape__(__ACTUAL__)
+
+def clearscreen(arg=None):
+ __getdocument__()
+ turtle = __getshape__(__TURTLE__)
+ if not turtle:
+ __initialize__()
+ if not __halt__:
+ return
+ __cs__(False)
+ __dispatcher__(".uno:Escape")
+
+def __checkhalt__():
+ global __thread__, __halt__
+ if __halt__:
+ with __lock__:
+ __thread__ = None
+ sys.exit()
+
+def __cs__(select = True):
+ turtle = __getshape__(__TURTLE__)
+ if turtle:
+ __visible__(turtle, False)
+ if _.doc.CurrentController.select(_.drawpage) and \
+ _.doc.CurrentController.getSelection().ImplementationName == "com.sun.star.drawing.SvxShapeCollection":
+ __dispatcher__(".uno:Delete")
+ if turtle:
+ __visible__(turtle, True)
+ if select:
+ _.doc.CurrentController.select(_.drawpage)
+
+def __dispatcher__(s, properties = ()):
+ ctx = XSCRIPTCONTEXT.getComponentContext()
+ d = ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.DispatchHelper", ctx)
+ d.executeDispatch(_.doc.CurrentController.Frame, s, "", 0, properties)
+
+def __getshape__(shapename):
+ try:
+ if _.shapecache[shapename].Parent:
+ return _.shapecache[shapename]
+ _.shapecache.pop(shapename)
+ except:
+ pass
+ return None
+
+def __angle__(deg):
+ if deg == u'any':
+ return random.random() * 36000
+ return deg * 100
+
+def turnleft(deg):
+ rotate(__TURTLE__, __angle__(deg))
+
+def turnright(deg):
+ rotate(__TURTLE__, -__angle__(deg))
+
+def heading(deg = -1, go = False):
+ turtle = __getshape__(__TURTLE__)
+ if deg == -1:
+ return turtle.RotateAngle / 100
+ else:
+ if deg == u'any':
+ turtle.RotateAngle = random.random() * 36000
+ elif type(deg) == list:
+ pos = turtle.getPosition()
+ px, py = pos.X + turtle.BoundRect.Width / 2.0, pos.Y + turtle.BoundRect.Height / 2.0
+ dx = px * __MM10_TO_TWIP__ - deg[0] * __PT_TO_TWIP__
+ dy = deg[1] * __PT_TO_TWIP__ - py * __MM10_TO_TWIP__
+ n = sqrt(dx**2 + dy**2)
+ if dy > 0 and n > 0:
+ turtle.RotateAngle = a = -(180 + asin(dx / n) / (pi/180)) * 100 + 72000 # +720 for max(angle, preciseAngle) of __go__()
+ elif n > 0:
+ turtle.RotateAngle = a = asin(dx / n) / (pi/180) * 100 + 72000
+ if go and n > 0:
+ __go__(__TURTLE__, -n, False, a)
+ else:
+ turtle.RotateAngle = deg * 100
+
+def rotate(shapename, deg):
+ shape = __getshape__(shapename)
+ if shape:
+ shape.RotateAngle = shape.RotateAngle + deg
+
+def forward(n):
+ if type(n) == list:
+ pos = position()
+ position([pos[0] + n[0], pos[1] + n[1]])
+ else:
+ __go__(__TURTLE__, -n * __PT_TO_TWIP__)
+
+def backward(n):
+ if type(n) == list:
+ forward([-n[0], -n[1]])
+ turnright(180)
+ else:
+ __go__(__TURTLE__, n * __PT_TO_TWIP__)
+
+def __dots__(n, pos, dx, dy, r = 0): # dots for dotted polyline or circle
+ k = abs(int(1.0 * n / max(10, _.pensize) / 2.0))
+ dots = []
+ px, py = pos.X, pos.Y
+ for i in range(k + 1):
+ if k > 0:
+ if r:
+ px, py = pos.X + sin(360.0/k * i * pi/180.0) * r, pos.Y + cos(360.0/k * i * pi/180) * r
+ else:
+ px, py = pos.X + round(i * dx/k), pos.Y + round(i * dy/k)
+ dots += [(__Point__(px, py),__Point__(px + 10, py + 10))]
+ return dots
+
+def __draw__(d):
+ shape = _.doc.createInstance( "com.sun.star.drawing." + d)
+ shape.AnchorType = __AT_PAGE__
+ shape.TextWrap = __THROUGHT__
+ __visible__(shape, False)
+ while __zoom__(): # temporary fix program halt with continuous zoom
+ while __zoom__():
+ __time__.sleep(0.2)
+ __time__.sleep(0.2)
+ _.drawpage.add(shape)
+ if __group__:
+ __group__.add(shape)
+ return shape
+
+def __zoom__():
+ z = _.doc.CurrentController.getViewSettings().ZoomValue
+ if z <> _.zoomvalue:
+ _.zoomvalue = z
+ return True
+ return False
+
+def __lefthang__(shape):
+ global __grouplefthang__
+ if __group__:
+ p = shape.getPosition()
+ if p.X < __grouplefthang__:
+ __grouplefthang__ = p.X
+
+def __go__(shapename, n, dot = False, preciseAngle = -1):
+ turtle = __getshape__(shapename)
+ turtlepos = None
+ if shapename == __TURTLE__:
+ try:
+ turtlepos = turtle.PolyPolygon[-1][-1]
+ except:
+ pass
+ pos = turtle.getPosition()
+ dx = n * sin((pi/180)*(max(turtle.RotateAngle, preciseAngle)/100))
+ dy = n * cos((pi/180)*(max(turtle.RotateAngle, preciseAngle)/100))
+ turtle.setPosition(__Point__(pos.X + dx / __MM10_TO_TWIP__, pos.Y + dy / __MM10_TO_TWIP__))
+ if (_.pencolor <> _.oldlc or _.pensize <> _.oldlw or _.linestyle <> _.oldls or _.linejoint <> _.oldlj):
+ __removeshape__(__ACTUAL__)
+ shape = None
+ else:
+ shape = __getshape__(__ACTUAL__)
+ _.oldlw = _.pensize
+ _.oldlc = _.pencolor
+ _.oldls = _.linestyle
+ _.oldlj = _.linejoint
+ if shape and not _.pen and not dot:
+ _.continuous = False
+ return
+ c, c2 = __Point__(pos.X + turtle.BoundRect.Width / 2.0, pos.Y + turtle.BoundRect.Height / 2.0), __Point__(round(dx), round(dy))
+ if shape and "LineShape" in shape.ShapeType:
+ if _.continuous or dot:
+ last = shape.PolyPolygon[-1][-1]
+ if not (turtlepos and (abs(last.X - turtlepos.X) > 100 or abs(last.Y - turtlepos.Y) > 100) and
+ (not __group__ or (shape.getPosition().X > 0 and turtle.getPosition().X > 0))): # picture [ ] keeps hanging shapes
+ if dot or _.linestyle == __LineStyle_DOTTED__:
+ shape.PolyPolygon = tuple( list(shape.PolyPolygon) + __dots__(n, turtlepos, dx, dy))
+ else:
+ last.X = last.X + c2.X
+ last.Y = last.Y + c2.Y
+ shape.PolyPolygon = tuple( list(shape.PolyPolygon[:-1]) + [tuple( list(shape.PolyPolygon[-1]) + [last])])
+ __lefthang__(shape)
+ return
+ elif turtlepos:
+ shape.PolyPolygon = tuple( list(shape.PolyPolygon) + [(turtlepos, __Point__(turtlepos.X + c2.X, turtlepos.Y + c2.Y))])
+ _.continuous = True
+ __lefthang__(shape)
+ return
+ if not _.pen and not dot:
+ return
+ shape = __draw__("PolyLineShape")
+ shape.RotateAngle = 0
+ shape.PolyPolygon = tuple([tuple([__Point__(0, 0)])])
+ shape.setPosition(c)
+ last = shape.PolyPolygon[-1][-1]
+ last2 = __Point__(last.X + c2.X, last.Y + c2.Y)
+ shape.LineStyle, shape.LineDash = __linestyle__(_.linestyle)
+ shape.LineJoint = _.linejoint
+ if dot or _.linestyle == __LineStyle_DOTTED__:
+ shape.PolyPolygon = tuple( list(shape.PolyPolygon) + __dots__(n, last, c2.X, c2.Y))
+ shape.LineStart = __bezierdot__
+ shape.LineStartCenter = True
+ shape.LineStartWidth = _.pensize / __MM10_TO_TWIP__
+ shape.LineWidth = 0
+ else:
+ shape.PolyPolygon = tuple([tuple( list(shape.PolyPolygon[-1]) + [last2])])
+ shape.LineWidth = _.pensize / __MM10_TO_TWIP__
+ shape.LineColor, shape.LineTransparence = __splitcolor__(_.pencolor)
+ __visible__(shape, True)
+ shape.Name = __ACTUAL__
+ _.shapecache[__ACTUAL__] = shape
+ _.oldlw = _.pensize
+ _.oldlc = _.pencolor
+ _.oldls = _.linestyle
+ _.oldlj = _.linejoint
+ _.continuous = True
+ __lefthang__(shape)
+
+def __fillit__(filled = True):
+ oldshape = __getshape__(__ACTUAL__)
+ if oldshape.LineStartCenter:
+ __removeshape__(__ACTUAL__) # FIXME close dotted polyline
+ return
+ if oldshape and "LineShape" in oldshape.ShapeType:
+ shape = __draw__("PolyPolygonShape")
+ shape.PolyPolygon = oldshape.PolyPolygon
+ shape.setPosition(oldshape.getPosition())
+ shape.LineStyle, shape.LineDash = __linestyle__(_.linestyle)
+ shape.LineJoint = _.linejoint
+ if _.hatch:
+ shape.FillBackground = True
+ shape.FillHatch = _.hatch
+ shape.FillStyle = 3
+ else:
+ shape.FillStyle = int(filled)
+ shape.LineWidth = _.pensize / __MM10_TO_TWIP__
+ shape.LineColor, shape.LineTransparence = __splitcolor__(_.pencolor)
+ shape.FillColor, shape.FillTransparence = __splitcolor__(_.areacolor)
+ shape.setString(oldshape.getString())
+ oldshape.Name = ""
+ shape.Name = __ACTUAL__
+ _.shapecache[__ACTUAL__] = shape
+ if __group__:
+ __group__.remove(oldshape)
+ __visible__(shape, True)
+ _.drawpage.remove(oldshape)
+ elif oldshape and "PolyPolygon" in oldshape.ShapeType:
+ oldshape.LineStyle = int(_.pen)
+ oldshape.LineJoint = _.linejoint
+ if _.hatch:
+ oldshape.FillBackground = True
+ oldshape.FillHatch = _.hatch
+ oldshape.FillStyle = 3
+ else:
+ oldshape.FillStyle = int(filled)
+ oldshape.LineWidth = _.pensize / __MM10_TO_TWIP__
+ oldshape.LineColor, oldshape.LineTransparence = __splitcolor__(_.pencolor)
+ oldshape.FillColor, oldshape.FillTransparence = __splitcolor__(_.areacolor)
+
+def point():
+ oldpen, _.pen = _.pen, 1
+ oldstyle, _.linestyle = _.linestyle, __LineStyle_DOTTED__
+ __go__(__TURTLE__, 0, True)
+ _.pen, _.linestyle = oldpen, oldstyle
+
+def __boxshape__(shapetype, l):
+ if type(l) <> type([]): # default for circle and square
+ l = [l, l]
+ turtle = __getshape__(__TURTLE__)
+ shape = __draw__(shapetype + "Shape")
+ if _.hatch:
+ shape.FillBackground = True
+ shape.FillHatch = _.hatch
+ shape.FillStyle = 3
+ else:
+ shape.FillStyle = 1
+ pos = turtle.getPosition()
+ pos.X = pos.X - (l[0] * __PT_TO_TWIP__ / __MM10_TO_TWIP__ / 2) + turtle.BoundRect.Width / 2.0
+ pos.Y = pos.Y - (l[1] * __PT_TO_TWIP__ / __MM10_TO_TWIP__ / 2) + turtle.BoundRect.Height / 2.0
+ shape.setPosition(pos)
+ shape.setSize(__Size__(l[0] * __PT_TO_TWIP__ / __MM10_TO_TWIP__, l[1] * __PT_TO_TWIP__ / __MM10_TO_TWIP__))
+ shape.LineStyle, shape.LineDash = __linestyle__(_.linestyle)
+ shape.LineWidth = _.pensize / __MM10_TO_TWIP__
+ shape.LineJoint = _.linejoint
+ shape.LineColor, shape.LineTransparence = __splitcolor__(_.pencolor)
+ shape.FillColor, shape.FillTransparence = __splitcolor__(_.areacolor)
+ shape.RotateAngle = turtle.RotateAngle
+ if shapetype == "Rectangle" and len(l) > 2:
+ shape.CornerRadius = l[2] * __PT_TO_TWIP__
+ elif shapetype == "Ellipse" and len(l) > 2:
+ try:
+ shape.CircleKind = __SECTION__
+ shape.CircleStartAngle = (-l[3] - 270) * 100
+ shape.CircleEndAngle = (-l[2] - 270) * 100
+ shape.CircleKind = [__FULL__, __SECTION__, __CUT__, __ARC__][l[4]]
+ except:
+ pass
+ __visible__(shape, True)
+ __removeshape__(__ACTUAL__)
+ _.shapecache[__ACTUAL__] = shape
+ __lefthang__(shape)
+
+def ellipse(l):
+ if _.linestyle == __LineStyle_DOTTED__:
+ __removeshape__(__ACTUAL__)
+ point()
+ shape = __getshape__(__ACTUAL__)
+ shape.PolyPolygon = tuple(__dots__(l * pi * __PT_TO_TWIP__, shape.PolyPolygon[0][0], 0, 0, l/2 * __PT_TO_TWIP__))
+ else:
+ __boxshape__("Ellipse", l)
+
+def rectangle(l):
+ if _.linestyle == __LineStyle_DOTTED__:
+ __removeshape__(__ACTUAL__)
+ point()
+ shape = __getshape__(__ACTUAL__)
+ shape.PolyPolygon = tuple(__dots__(l * pi * __PT_TO_TWIP__, shape.PolyPolygon[0][0], 0, 0, l/2 * __PT_TO_TWIP__))
+ else:
+ __boxshape__("Rectangle", l)
+
+def label(st):
+ turtle = __getshape__(__TURTLE__)
+ shape = __draw__("TextShape")
+ shape.RotateAngle = turtle.RotateAngle
+ pos = turtle.getPosition()
+ pos.X = pos.X + turtle.BoundRect.Width / 2.0
+ pos.Y = pos.Y + turtle.BoundRect.Height / 2.0
+ shape.setSize(__Size__(1, 1))
+ shape.TextAutoGrowWidth = True
+ text(shape, st)
+ shape.setPosition(__Point__(pos.X - shape.BoundRect.Width/2, pos.Y - shape.BoundRect.Height/2))
+ __visible__(shape, True)
+ __lefthang__(shape)
+
+def text(shape, st):
+ if shape:
+ shape.setString(__string__(st, _.decimal))
+ c = shape.createTextCursor()
+ c.gotoStart(False)
+ c.gotoEnd(True)
+ c.CharColor, none = __splitcolor__(_.textcolor)
+ c.CharHeight = _.fontheight
+ c.CharWeight = __fontweight__(_.fontweight)
+ c.CharPosture = __fontstyle__(_.fontstyle)
+ c.CharFontName = _.fontfamily
+
+def sleep(t):
+ for i in range(t/__SLEEP_SLICE_IN_MILLISECONDS__):
+ __checkhalt__()
+ __time__.sleep(0.5)
+ __checkhalt__()
+ __time__.sleep(t%__SLEEP_SLICE_IN_MILLISECONDS__/1000.0)
+
+def __removeshape__(shapename):
+ try:
+ _.shapecache.pop(shapename).Name = ""
+ except:
+ pass
+
+def __fontweight__(w):
+ if type(w) == int:
+ return w
+ elif re.match(__l12n__(_.lng)['BOLD'], w, flags = re.I):
+ return 150
+ elif re.match(__l12n__(_.lng)['NORMAL'], w, flags = re.I):
+ return 100
+ return 100
+
+def __fontstyle__(w):
+ if type(w) == int:
+ return w
+ elif re.match(__l12n__(_.lng)['ITALIC'], w, flags = re.I):
+ return __Slant_ITALIC__
+ elif re.match(__l12n__(_.lng)['UPRIGHT'], w, flags = re.I):
+ return __Slant_NONE__
+ return __Slant_NONE__
+
+def __color__(c):
+ if type(c) in [int, float, long]:
+ return c
+ if type(c) == unicode:
+ if c == u'any':
+# return __COLORS__[int(random.random() * 24)][1]
+ return int(random.random() * 2**31) # max. 50% transparency
+ if c[0:1] == '~':
+ c = __componentcolor__(__colors__[_.lng][c[1:].lower()])
+ for i in range(3):
+ c[i] = max(min(c[i] + int(random.random() * 64) - 32, 255), 0)
+ return __color__(c)
+ return __colors__[_.lng][c.lower()]
+ if type(c) == list:
+ if len(c) == 1:
+ return __COLORS__[int(c[0])][1]
+ if len(c) == 3:
+ return (int(c[0])%256 << 16) + (int(c[1])%256 << 8) + int(c[2])%256
+ return (int(c[3])%256 << 24) + (int(c[0])%256 << 16) + (int(c[1])%256 << 8) + int(c[2])%256
+
+def __linestyle__(s):
+ if _.pen == 0:
+ return 0, __LineDash__()
+ if _.linestyle == __LineStyle_DASHED__:
+ return _.linestyle, __LineDash__(__DashStyle_RECT__, 0, 0, 1, 100, 100)
+ elif _.linestyle == __LineStyle_DOTTED__:
+ return __LineStyle_DASHED__, __LineDash__(__DashStyle_RECT__, 1, 1, 0, 0, 100000)
+ elif type(s) == list:
+ return __LineStyle_DASHED__, __LineDash__((s[5:6] or [0])[0], s[0], s[1] * __PT_TO_TWIP__, s[2], s[3] * __PT_TO_TWIP__, s[4] * __PT_TO_TWIP__)
+ return s, __LineDash__()
+
+def fillstyle(s):
+ if type(s) == list:
+ color, null = __splitcolor__(__color__(s[1]))
+ _.hatch = __Hatch__(s[0] - 1, color, s[2] * __PT_TO_TWIP__, s[3] * 10)
+ elif s == 0:
+ _.hatch = None
+ elif s <= 10: # using hatching styles of Writer
+ fillstyle([[1, 0, 5, 0], [1, 0, 5, 45], [1, 0, 5, -45], [1, 0, 5, 90], [2, [127, 0, 0], 5, 45], [2, [127, 0, 0], 5, 0], [2, [0, 0, 127], 5, 45], [2, [0, 0, 127], 5, 0], [3, [0, 0, 127], 5, 0], [1, 0, 25, 45]][s-1])
+
+def __splitcolor__(c):
+ """Split color constants to RGB (3-byte) + transparency (%)"""
+ return int(c) & 0xffffff, (int(c) >> 24) / (255.0/100)
+
+def __componentcolor__(c):
+ a = [ (c & 0xff0000) >> 16, (c & 0xff00) >> 8, c & 0xff ]
+ if c > 2**24:
+ a.append((c & 0xff000000) >> 24)
+ return a
+
+def pencolor(n = -1):
+ if n != -1:
+ _.pencolor = __color__(n)
+ turtle = __getshape__(__TURTLE__)
+ if turtle and __visible__(turtle):
+ turtle.LineColor, turtle.LineTransparence = __splitcolor__(_.pencolor)
+ else:
+ return __componentcolor__(_.pencolor)
+
+def pensize(n = -1):
+ if n != -1:
+ if n == 'any':
+ _.pensize = random.random() * 10 * __PT_TO_TWIP__
+ else:
+ _.pensize = n * __PT_TO_TWIP__
+ turtle = __getshape__(__TURTLE__)
+ if turtle and __visible__(turtle):
+ turtle.LineWidth = min(_.pensize, (1 + _.pen * 2) * __PT_TO_TWIP__)
+ return _.pensize / __PT_TO_TWIP__
+
+def penstyle(n = -1):
+ if n == -1:
+ try:
+ return __locname__(_.linestyle.value)
+ except:
+ return __locname__('DOTTED')
+ if type(n) == list and len(n) >= 5:
+ _.linestyle = n
+ elif re.match(__l12n__(_.lng)['SOLID'], n, flags = re.I):
+ _.linestyle = __LineStyle_SOLID__
+ elif re.match(__l12n__(_.lng)['DASH'], n, flags = re.I):
+ _.linestyle = __LineStyle_DASHED__
+ elif re.match(__l12n__(_.lng)['DOTTED'], n, flags = re.I):
+ _.linestyle = __LineStyle_DOTTED__
+
+def penjoint(n = -1):
+ if n == -1:
+ return __locname__(_.linejoint.value)
+ if re.match(__l12n__(_.lng)['NONE'], n, flags = re.I):
+ _.linejoint = __Joint_NONE__
+ elif re.match(__l12n__(_.lng)['BEVEL'], n, flags = re.I):
+ _.linejoint = __BEVEL__
+ elif re.match(__l12n__(_.lng)['MITER'], n, flags = re.I):
+ _.linejoint = __MITER__
+ elif re.match(__l12n__(_.lng)['ROUNDED'], n, flags = re.I):
+ _.linejoint = __ROUNDED__
+
+def fillcolor(n = -1):
+ if n != -1:
+ _.areacolor = __color__(n)
+ turtle = __getshape__(__TURTLE__)
+ if turtle and __visible__(turtle):
+ turtle.FillColor, transparence = __splitcolor__(_.areacolor)
+ turtle.FillTransparence = min(95, transparence)
+ else:
+ return __componentcolor__(_.areacolor)
+
+def fontcolor(n = -1):
+ if n != -1:
+ _.textcolor = __color__(n)
+ else:
+ return __componentcolor__(_.textcolor)
+
+def position(n = -1):
+ turtle = __getshape__(__TURTLE__)
+ if turtle:
+ if n != -1:
+ if n == 'any':
+ ps = pagesize()
+ heading([random.random() * ps[0], random.random() * ps[1]], True)
+ else:
+ heading(n, True)
+ else:
+ pos = turtle.getPosition()
+ pos.X, pos.Y = pos.X + turtle.BoundRect.Width / 2.0, pos.Y + turtle.BoundRect.Height / 2.0
+ return [ pos.X * __MM10_TO_TWIP__ / __PT_TO_TWIP__, pos.Y * __MM10_TO_TWIP__ / __PT_TO_TWIP__ ]
+
+def __groupstart__():
+ global __group__, __grouplefthang__, __groupstack__
+ __removeshape__(__ACTUAL__)
+ __groupstack__.append(__group__)
+ __groupstack__.append(__grouplefthang__)
+ __group__ = uno.getComponentContext().ServiceManager.createInstance('com.sun.star.drawing.ShapeCollection')
+ __grouplefthang__ = 0
+
+def __groupend__():
+ global __group__, __grouplefthang__, __groupstack__
+ g = 0
+ if __group__.getCount() > 1:
+ if __grouplefthang__ < 0:
+ for i in range(__group__.Count):
+ s = __group__.getByIndex(i)
+ p = s.getPosition()
+ p.X = p.X + -__grouplefthang__
+ s.setPosition(p)
+ g = _.drawpage.group(__group__)
+ p = g.getPosition()
+ p.X = p.X + __grouplefthang__
+ g.setPosition(p)
+ else:
+ g = _.drawpage.group(__group__)
+ g.TextWrap = __THROUGHT__
+ elif __group__.getCount() == 1:
+ g = __group__.getByIndex(0)
+ __grouplefthang__ = min(__groupstack__.pop(), __grouplefthang__)
+ __group__ = __groupstack__.pop()
+ if __group__ and g:
+ __group__.add(g)
+ __removeshape__(__ACTUAL__)
+
+def __int__(x): # handle eg. int("10cm")
+ if type(x) == str or type(x) == unicode:
+ x = __float__(x)
+ return int(x)
+
+def __float__(x): # handle eg. float("10,5cm")
+ if type(x) == str or type(x) == unicode:
+ for i in __comp__[_.lng]:
+ x = re.sub(u"(?iu)" + i[0], i[1], x)
+ x = eval(x)
+ return float(x)
+
+def __loadlang__(lang, a):
+ global comp, __colors__
+ __colors__[lang] = {}
+ for i in __COLORS__:
+ for j in a[i[0]].split("|"):
+ __colors__[lang][j] = i[1]
+
+ repcount = a['REPCOUNT'].split('|')[0]
+ loopi = itertools.count()
+ loop = lambda r: "%(i)s = 1\n%(orig)s%(j)s = %(i)s\n%(i)s += 1\n" % \
+ { "i": repcount + str(loopi.next()), "j": repcount, "orig": re.sub( ur"(?ui)(?<!:)\b%s\b" % repcount, repcount + str(loopi.next()-1), r.group(0)) }
+
+ __comp__[lang] = [
+ [ur"(?<!:)\b(?:%s) [[]" % a['GROUP'], "\n__groupstart__()\nfor __groupindex__ in range(2):\n[\nif __groupindex__ == 1:\n[\n__groupend__()\nbreak\n]\n"],
+ [ur"(?<!:)\b(?:%s)\b" % a['GROUP'], "\n__removeshape__(__ACTUAL__)\n"],
+ [ur"(\n| )][ \n]*\[(\n| )", "\n]\nelse:\n[\n"], # if/else block
+ [ur"(?<!\n)\[(?= |\n)", ":\n[\n"], # start block
+ [ur"( ]|\n]$)", "\n]\n"], # finish block
+ [ur"(?<!:)\b(?:%s)\b" % a['FOR'], "\nfor"],
+ [ur"(?<!:)\b(?:%s)\b" % a['REPEAT'], "\n__repeat__"],
+ [ur"(?<!:)\b(?:%s)\b" % a['BREAK'], "\nbreak"],
+ [ur"(?<!:)\b(?:%s)\b" % a['CONTINUE'], "\ncontinue"],
+ [ur"(?<!:)\b(?:%s)\b" % a['REPCOUNT'], repcount],
+ [ur"(?<!:)\b(?:%s)\b" % a['IF'], "\nif"],
+ [ur"(?<!:)\b(?:%s)\b" % a['WHILE'], "\nwhile"],
+ [ur"(?<!:)\b(?:%s)\b" % a['OUTPUT'], "\nreturn"],
+ [ur"\n(if|while|return) [^\n]*", lambda r: re.sub("(?<![=!<>])=(?!=)", "==", r.group(0))], # = -> ==, XXX x = y = 1?
+ [ur"(?<=\n)(for\b :?\w+) ([^\n]+)(?<=\w|]|}|\))(?=-|:)(?:%s)\b" % a['IN'], "\\1 in \\2"], # "for x y-in" -> "for x in y"
+ [ur"(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % a['IN'], "in \\1"], # "x y-in" -> "x in y"
+ [ur"(?<!:)\b(?:%s)\b" % a['IN'], "in"],
+ [ur"(?<!:)\b(?:%s)\b[ \t]+(:?\w+)\b(?! in\b)" % a['FOR'], "\nfor \\1 in"],
+ [ur"(?<=\n)__repeat__ :\n", "while True:\n"], # infinite loop
+ [ur"(?<=\n)(for|while) (?!__groupindex__)[^\n]*:\n\[\n", loop], # loop variables for repcount (not groupindex loop)
+ [ur"(?<=\n)__repeat__([^\n]*\w[^\n]*):(?=\n)", "for %s in range(1, 1+int(\\1)):" % repcount], # repeat block
+ [ur"(?<=\d)[%s](?=\d)" % a['DECIMAL'], "."], # decimal sign
+ [ur"(?<!/)/(?!/)", "*1.0/"], # fix division: /1 -> /1.0, but not with //
+ [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['HOUR'], "\\1*30"], # 12h = 12*30°
+ [ur"(?<=\d)(%s)" % a['DEG'], ""], # 1° -> 1
+ [ur"(?<!:)\b(?:__def__)[ \t]+(\w+)\b[ \t]*([:]?\w[^\n]*)", "\ndef \\1(\\2):\n["],
+ [ur"(?<!:)\b(?:__def__)\s+(\w+)", "\ndef \\1():\n["],
+ [ur"(?<!:)\b(?:%s)\b" % a['END'], "\n]"],
+ [ur"(?<!:)\b(?:%s)\b" % a['GLOBAL'], "global"],
+ [ur"(?<!:)\b(?:%s)\b" % a['TRUE'], "True"],
+ [ur"(?<!:)\b(?:%s)\b" % a['FALSE'], "False"],
+ [ur"(?<!:)\b(?:%s)\b" % a['NOT'], "not"],
+ [ur"(?<!:)\b(?:%s)\b" % a['AND'], "and"],
+ [ur"(?<!:)\b(?:%s)\b" % a['OR'], "or"],
+ [ur"(?<!:)\b(?:%s)\b" % a['INT'], "__int__"],
+ [ur"(?<!:)\b(?:%s)\b" % a['FLOAT'], "__float__"],
+ [ur"(?<!:)\b(?:%s)\b" % a['STR'], "__string__"],
+ [ur"(?<!:)\b(?:%s)\b" % a['COUNT'], "len"],
+ [ur"(?<!:)\b(?:%s)\b" % a['ROUND'], "round"],
+ [ur"(?<!:)\b(?:%s)\b" % a['ABS'], "abs"],
+ [ur"(?<!:)\b(?:%s)\b" % a['SIN'], "sin"],
+ [ur"(?<!:)\b(?:%s)\b" % a['COS'], "cos"],
+ [ur"(?<!:)\b(?:%s)\b" % a['PI'], "pi"],
+ [ur"(?<!:)\b(?:%s)\b" % a['SQRT'], "sqrt"],
+ [ur"(?<!:)\b(?:%s)\b" % a['MIN'], "min"],
+ [ur"(?<!:)\b(?:%s)\b" % a['MAX'], "max"],
+ [ur"(?<!:)\b(?:%s)\b" % a['STOP'], "\nreturn None"],
+ [ur"(?<!:)\b(?:%s)\b" % a['CLEARSCREEN'], "\n__cs__()"],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENCOLOR'], "\n)pencolor("],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENSTYLE'], "\n)penstyle("],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENJOINT'], "\n)penjoint("],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FILLCOLOR'], "\n)fillcolor("],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FILLSTYLE'], "\n)fillstyle("],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTCOLOR'], "\n)fontcolor("],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTFAMILY'], "\nglobal _\n_.fontfamily="],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTHEIGHT'], "\nglobal _\n_.fontheight="],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTWEIGHT'], "\nglobal _\n_.fontweight="],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTSTYLE'], "\nglobal _\n_.fontstyle="],
+ [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENWIDTH'], "\n)pensize("],
+ [ur"(?<!:)\b(?:%s)\b" % a['PENDOWN'], "\nglobal _\n__pen__(1)"],
+ [ur"(?<!:)\b(?:%s)\b" % a['PENUP'], "\nglobal _\n__pen__(0)"],
+ [ur"(?<!:)\b(?:%s)\b" % a['HIDETURTLE'], "\nhideturtle()"],
+ [ur"(?<!:)\b(?:%s)\b" % a['SHOWTURTLE'], "\nshowturtle()"],
+ [ur"(?<!:)\b(?:%s)\b\[" % a['POSITION'], "position()["],
+ [ur"(?<!:)\b(?:%s)\b(?!\()" % a['POSITION'], "\n)position("],
+ [ur"(?<!:)\b(?:%s)\b" % a['HEADING'], "\n)heading("],
+ [ur"(?<!:)\b(?:%s)\b" % a['PAGESIZE'], "pagesize()"],
+ [ur"(?<!:)\b(?:%s)\b" % a['POINT'], "\npoint()"],
+ [ur"(?<!:)\b(?:%s)\b" % (a['ELLIPSE'] + "|" + a['CIRCLE']), "\n)ellipse("],
+ [ur"(?<!:)\b(?:%s)\b" % (a['RECTANGLE'] + "|" + a['SQUARE']), "\n)rectangle("],
+ [ur"(?<!:)\b(?:%s)\b" % a['CLOSE'], "\n__fillit__(False)"],
+ [ur"(?<!:)\b(?:%s)\b" % a['FILL'], "\n__fillit__()"],
+ [ur"(?<!:)\b(?:%s)\b" % a['LABEL'], "\n)label("],
+ [ur"(?<!:)\b(?:%s)\b" % a['TEXT'], "\n)text(__getshape__(__ACTUAL__),"],
+ [ur"(text\([ \t]*\"[^\"\n\)]*)", "\\1\"\n"],
+ [ur"(?<!:)\b(?:%s)\b" % a['HOME'], "\nturtlehome()"],
+ [ur"(?<!:)\b(?:%s)\b" % a['SLEEP'], "\n)sleep("],
+ [ur"(?<!:)\b(?:%s)\b" % a['FORWARD'], "\n)forward("],
+ [ur"(?<!:)\b(?:%s)\b" % a['BACKWARD'], "\n)backward("],
+ [ur"(?<!:)\b(?:%s)\b" % a['TURNRIGHT'], "\n)turnright("],
+ [ur"(?<!:)\b(?:%s)\b" % a['RANDOM'], "Random"],
+ [ur"(?<!:)\b(?:%s)\b(?= \d)" % 'Random', "random.random()*"],
+ [ur"(?<!:)\b(?:%s)\b" % a['SET'], "set"],
+ [ur"(?<!:)\b(?:%s)\b" % a['RANGE'], "range"],
+ [ur"(?<!:)\b(?:%s)\b" % a['LIST'], "list"],
+ [ur"(?<!:)\b(?:%s)\b" % a['TUPLE'], "tuple"],
+ [ur"(?<!:)\b(?:%s)\b" % a['SORTED'], "sorted"],
+ [ur"(?<!:)\b(?:%s)\b ?\(" % a['RESEARCH'], "re.search('(?u)'+"],
+ [ur"(?<!:)\b(?:%s)\b ?\(" % a['RESUB'], "re.sub('(?u)'+"],
+ [ur"(?<!:)\b(?:%s)\b ?\(" % a['REFINDALL'], "re.findall('(?u)'+"],
+ [ur"(?<!:)\b(?:%s)\b" % a['ANY'], "u'any'"],
+ [ur"(?<!:)\b(?:%s) (\w+|[[][^\]]*])\b" % a['INPUT'], " Input(\\1)"],
+ [ur"(?<!:)\b(?:%s)\b" % a['PRINT'], "\n)Print("],
+ [ur"(?<!:)\b(?:%s)\b" % a['TURNLEFT'], "\n)turnleft("],
+ [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['PT'], "\\1"],
+ [ur"\b([0-9]+([,.][0-9]+)?)(%s)(?!\w)" % a['INCH'], "\\1*72"],
+ [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['MM'], "\\1*%s" % __MM_TO_PT__],
+ [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['CM'], "\\1*%s*10" % __MM_TO_PT__],
+ [ur"\b(__(?:int|float|string)__len|round|abs|sin|cos|sqrt|set|list|tuple|sorted)\b ((?:\w|\d+([,.]\d+)?|[-+*/]| )+)\)" , "\\1(\\2))" ], # fix parsing: (1 + sqrt x) -> (1 + sqrt(x))
+ [ur"(?<=[-*/=+,]) ?\n\)(\w+)\(", "\\1()"], # read attributes, eg. x = fillcolor
+ [ur"(?<=return) ?\n\)(\w+)\(", "\\1()"], # return + user function
+ [ur"(?<=(?:Print|label)\() ?\n\)(\w+)\(", "\\1()\n"] # Print/label + user function
+ ]
+
+def __concatenation__(r): # keep line positions with extra line breaks
+ s = re.subn("~[ \t]*\n", " ", r.group(0))
+ return s[0] + "\n" * s[1]
+
+def __compil__(s):
+ global _, comp, __strings__, __compiled__
+ try:
+ loc = _.doc.CurrentController.getViewCursor().CharLocale
+ try:
+ _.lng = loc.Language + '_' + loc.Country
+ __loadlang__(_.lng, __l12n__(_.lng))
+ except:
+ __trace__()
+ _.lng = loc.Language
+ __loadlang__(_.lng, __l12n__(_.lng))
+ except:
+ __trace__()
+ _.lng = 'en'
+ if not _.lng in __comp__:
+ __loadlang__(_.lng, __l12n__(_.lng))
+
+ _.decimal = __l12n__(_.lng)['DECIMAL']
+ names = {}
+
+ rmsp = re.compile(r"[ ]*([=+*/]|==|<=|>=|<>|!=|-[ ]+)[ ]*")
+ chsp = re.compile(r"[ \t]+")
+ chch = re.compile(r"(?u)(?<!\w):(?=\w)")
+ parenfix = re.compile(ur"(?ui)(\([^\(\[\]\)]+)]\)")
+
+ # remove CR characters and split lines
+ s = re.sub(r'[ \t\r]*(?=\n)', '', s)
+
+ # remove full line comments
+ s = re.sub(r"^[ \t]*[;#][^\n]*", "", s)
+ s = re.sub(r"(?<=\n)[ \t]*[;#][^\n]*", "", s)
+
+ # concatenate lines
+ __compiled__ = re.sub(r'([^\n]*~[ \t]*\n)+[^\n]*', __concatenation__, s)
+
+ # sign original line breaks
+ s = re.sub("(?<=\n)", __LINEBREAK__ + "\n", __compiled__)
+
+ # encode strings
+ lq = '\'' + __l12n__(_.lng)['LEFTSTRING'].replace("|", "")
+ rq = '\'' + __l12n__(_.lng)['RIGHTSTRING'].replace("|", "")
+ __strings__ = []
+ s = re.sub("(?u)([%s])([^\n%s]*)(?<!\\\\)[%s]" % (lq, rq, rq), __encodestring__, s)
+ s = re.sub('(?u)(?<![0-9])(")(~?\w*)', __encodestring__, s)
+
+ # remove extra spaces
+ s = chsp.sub(" ", s)
+
+ # remove inline comments
+ s = re.sub(r"[ ]*;[^\n]*", "", s)
+
+ # n-dash and m-dash as minus signs
+ s = re.sub(ur"(?u)[–—]", "-", s)
+
+ # replace procedure names
+ s = re.sub(ur"(?i)^[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "__def__ ", s)
+ s = re.sub(ur"(?i)\n[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "\n__def__ ", s)
+ subnames = re.findall(u"(?iu)(?<=__def__ )\w+", s)
+ globs = ""
+
+ functions = ["range", "__int__", "__float__", "Random", "Input", "__string__", "len", "round", "abs", "sin", "cos", "sqrt", "set", "list", "tuple", "re.sub", "re.search", "re.findall", "sorted", "min", "max"]
+
+ if len(subnames) > 0:
+ globs = "global %s" % ", ".join(subnames)
+ # search user functions (function calls with two or more arguments need explicite Python parentheses)
+ functions += [ re.findall("(?u)\w+",i[0])[0] for i in re.findall(ur"""(?iu)(?<=__def__ )([^\n]*)\n # beginning of a procedure
+ (?:[^\n]*(?<!\b(%(END)s))\n)* # 0 or more lines (not END)
+ [^\n]*\b(?:%(OUTPUT)s)\b[^\n]*\n # line with OUTPUT (functions = procedures with OUTPUT)
+ (?:[^\n]*(?<!\b(?:%(END)s))\n)* # 0 or more lines (not END)
+ (?:%(END)s)\b""" % __l12n__(_.lng), s, re.X) ] # final END (XXX multiple names of "END" doesn't supported)
+ # add line breaks before procedure calls
+ procedures = set(subnames) - set(functions)
+ if len(procedures) > 0:
+ s = re.sub(ur"(?<!__def__)(?<![-+=*/])(?<!%s)(?:^|[ \t]+)(" % ")(?<!".join(functions) + "|".join(procedures) + ")", r"\n\1", s)
+
+ # compile native Logo
+ for i in __comp__[_.lng]:
+ s = re.sub(u"(?iu)" + i[0], i[1], s)
+
+ indent = 0
+ result = ""
+ func = re.compile("(?iu)(def (\w+))(\(.*\):)")
+ expr = ur"""(?iu)(?<!def[ ])(?<![:\w])%(name)s(?!\w)(?!\()(?![ ]\()
+ (
+ ([ ]+\[*([-+]|\([ ]?)*((%(functions)s)\b[ ]*\(*)*
+ (?:[0-9]+([,.][0-9]+)?|:?\w+(?:[.]\w+[\(]?[\)]?)?]*|\[])]*[\)]*
+ (
+ (?:[ ]*([+*/,<>]|//|==|<=|>=|<>|!=)[ ]*|[ ]*-[ ]+|-|[ ]*[*][*][ ]*) # operators, eg. "**", " - ", "-", "- "
+ \[*([-+]|\([ ]?)* # minus sign, parenthesis
+ ((%(functions)s)\b[ ]*\(*)*([0-9]+([.,][0-9]+)?|:?\w+(?:[.]\w+[\(]?[\)]?)?)]*
+ ([ ]?\))*)*
+ [\)]*){,%(repeat)s}
+ )
+"""
+ chargsp = re.compile(r"(?<![\(,])(?<!%s) (?!\)|,)" % ")(?<!".join(functions))
+
+ # compile to Python
+ joinfunc = "|".join(functions)
+ funcnames = {}
+
+ for i in s.split("\n"):
+ i = i.strip()
+ if i[0:4] == 'def ':
+ s = func.search(i)
+ if s.group(3) == '():':
+ names[s.group(2)] = (0, "")
+ else:
+ s2 = len(chsp.findall(s.group(3))) + 1
+ i = s.group(1) + chsp.sub(", ", s.group(3))
+ names[s.group(2)] = (s2, re.compile(expr % {"name": s.group(2), "functions": joinfunc, "repeat": s2}, re.X))
+ for j in functions:
+ if j in i:
+ if not j in funcnames:
+ funcnames[j] = (1, re.compile(expr % {"name": j, "functions": joinfunc, "repeat": 1 + 2 * int(j == 'range')}, re.X))
+ r = funcnames[j][1].search(i)
+ while r:
+ i = i[:r.start()] + j + '(' + chargsp.sub(", ", rmsp.sub(lambda l: l.group(1).strip(), r.group(1).strip())) + ')' + i[r.end():]
+ i = parenfix.sub("\\1)]", i)
+ r = funcnames[j][1].search(i)
+ for j in names:
+ if j in i:
+ if names[j][0] == 0:
+ if not j in functions:
+ i = re.sub(ur"(?iu)(?<!def )(?<![_\w])\b%s\b(?!\w)" %j, j+'()', i)
+ else:
+ r = names[j][1].search(i)
+ if r:
+ i = i[:r.start()] + j + '(' + chargsp.sub(", ", rmsp.sub(lambda l: l.group(1).strip(), r.group(1).strip())) + ')' + i[r.end():]
+ i = parenfix.sub("\\1)]", i)
+ if i[0:1] == '[':
+ i = i[1:]
+ indent += 1
+ result = result + "\n" + " " * indent + "__checkhalt__()\n"
+ if i[0:1] == ')':
+ i = i[1:] + ')'
+ result = result + "\n" + " " * indent + i
+ if i[0:1] == ']':
+ result = result[:-1]
+ indent -= 1
+
+ # colon_to_underline in Logo variables
+ result = chch.sub("_", result)
+
+ # character encoding
+ result = to_ascii(result).replace(r"\n", "\n")
+
+ # decode strings
+ result = re.sub(__DECODE_STRING_REGEX__, __decodestring__, result)
+ return to_ascii(globs) + "\n" + result
+
+def __gotoline__(n):
+ __dispatcher__(".uno:Escape")
+ c = _.doc.Text.createTextCursor()
+ c.gotoStart(False)
+ for i in range(1, n):
+ c.gotoNextParagraph(False)
+ _.doc.CurrentController.getViewCursor().gotoRange(c, False)
+
+g_exportedScripts = left, right, goforward, gobackward, run, stop, home, clearscreen, commandline, __translate__
+g_ImplementationHelper = unohelper.ImplementationHelper()
+g_ImplementationHelper.addImplementation( \
+ None,"org.openoffice.script.LibreLogo", \
+ ("org.openoffice.script.ServiceLibreLogo",),)
diff --git a/librelogo/source/LibreLogoDummy.py b/librelogo/source/LibreLogoDummy.py
new file mode 100644
index 000000000000..1d65ff4919fa
--- /dev/null
+++ b/librelogo/source/LibreLogoDummy.py
@@ -0,0 +1,14 @@
+# dummy UNO component to get the path of the localizations
+import uno, unohelper, os, sys
+from com.sun.star.lang import XMain
+class LibreLogoDummyComponent(XMain, unohelper.Base):
+ def __init__( self, ctx ):
+ self.ctx = ctx
+
+ def get_path(self):
+ import librelogodummy_path
+ return librelogodummy_path.get_path()
+
+g_ImplementationHelper = unohelper.ImplementationHelper()
+g_ImplementationHelper.addImplementation( \
+ LibreLogoDummyComponent,"org.openoffice.comp.pyuno.LibreLogoDummy",("org.openoffice.LibreLogo.LibreLogoDummy",),)
diff --git a/librelogo/source/META-INF/manifest.xml b/librelogo/source/META-INF/manifest.xml
new file mode 100644
index 000000000000..a10be2952af5
--- /dev/null
+++ b/librelogo/source/META-INF/manifest.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest:manifest>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="LibreLogoDummy.py"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.framework-script" manifest:full-path="LibreLogo"/>
+ <manifest:file-entry manifest:full-path="Office/UI/StartModuleWindowState.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
+ <manifest:file-entry manifest:full-path="Office/UI/WriterWindowState.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
+ <manifest:file-entry manifest:full-path="Addons.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.help" manifest:full-path="help"/>
+</manifest:manifest> \ No newline at end of file
diff --git a/librelogo/source/README b/librelogo/source/README
new file mode 100644
index 000000000000..ffe5ea0a1611
--- /dev/null
+++ b/librelogo/source/README
@@ -0,0 +1,43 @@
+LibreOffice Logo 0.2 RC2
+
+License: GNU LGPL & GPL, MPL
+
+Home page: http://www.numbertext.org/logo
+
+(c) László Németh (nemeth at numbertextdotorg)
+
+FSF.hu Foundation, http://www.fsf.hu
+
+Icons copyright: OpenOffice.org/LibreOffice
+
+Introduction
+============
+
+LibreLogo is a Logo-like programming language with interactive vectorgraphics for education and DTP
+
+- presentation: http://www.numbertext.org/logo/librelogo.pdf
+- basic Logo syntax for back compability with educational Logo systems
+- interactive vectorgraphics in LibreOffice Writer
+- native commands (easily translatable)
+- Python data structures (list, tuple, set, dictionary) and other Python features
+
+Usage
+=====
+
+See Logo in LibreOffice Help and http://www.numbertext.org/logo for documentation.
+
+Translation
+===========
+
+create your_language_id.lng in LibreOffice/ based on en.lng.
+
+Compilation:
+
+python make.py
+
+Development
+===========
+
+LibreLogo uses the PyUNO scripting framework, so Addons.xcu URLs depend from the
+full name of the package. Modify them according to the package name with the
+version number.
diff --git a/librelogo/source/description-en-US.txt b/librelogo/source/description-en-US.txt
new file mode 100644
index 000000000000..6e9566518da8
--- /dev/null
+++ b/librelogo/source/description-en-US.txt
@@ -0,0 +1 @@
+Programming language and environment for education, graphic design and desktop publishing. Usage: View→Toolbars→Logo toolbar in Writer. See Logo in LibreOffice Help.
diff --git a/librelogo/source/description.xml b/librelogo/source/description.xml
new file mode 100644
index 000000000000..6711d7806ccb
--- /dev/null
+++ b/librelogo/source/description.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description xmlns="http://openoffice.org/extensions/description/2006"
+ xmlns:d="http://openoffice.org/extensions/description/2006"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+ <identifier value="org.openoffice.comp.pyuno.LibreLogo" />
+ <display-name>
+ <name lang="en-US">LibreLogo</name>
+ </display-name>
+ <version value="0.2rc2" />
+ <publisher>
+ <name lang="en-US" xlink:href="http://www.numbertext.org/logo">László Németh</name>
+ <name lang="hu" xlink:href="http://www.numbertext.org/logo">Németh László</name>
+ </publisher>
+ <extension-description>
+ <src lang="en-US" xlink:href="description-en-US.txt" />
+ </extension-description>
+ <dependencies>
+ <OpenOffice.org-minimal-version value="3.2" d:name="OpenOffice.org 3.2" />
+ </dependencies>
+</description>
diff --git a/librelogo/source/help/en-US/LibreLogo.xhp b/librelogo/source/help/en-US/LibreLogo.xhp
new file mode 100644
index 000000000000..7d6539d53da7
--- /dev/null
+++ b/librelogo/source/help/en-US/LibreLogo.xhp
@@ -0,0 +1,388 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<helpdocument version="1.0">
+<meta>
+<topic id="LibreLogo" indexer="include" status="PUBLISH">
+<title id="title">LibreLogo</title>
+<filename>/org.openoffice.comp.pyuno.LibreLogo/LibreLogo.xhp</filename>
+</topic>
+</meta>
+<body>
+
+<bookmark xml-lang="en-US" branch="index" id="bm1">
+<bookmark_value>LibreLogo</bookmark_value>
+<bookmark_value>Logo</bookmark_value>
+<bookmark_value>Turtle graphics</bookmark_value>
+</bookmark>
+
+<paragraph role="heading" level="1" xml-lang="en-US" id="hd_170">LibreLogo</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_180">LibreLogo is a simple, native, Logo-like programming environment with turtle vector graphics for teaching of computing (programming and word processing), DTP and graphic design. See http://www.numbertext.org/logo/librelogo.pdf.</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_220">LibreLogo toolbar</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_230">The LibreLogo toolbar (View » Toolbars » Logo) contains turtle moving, program run and stop, home and clear screen and syntax highlighting/translating icons and an input bar (command line).</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_240">Turtle moving icons</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_250">They are equivalents of the Logo commands “FORWARD 10”, “BACK 10”, “LEFT 15”, “RIGHT 15”. Clicking on one of the icons will also focus the turtle shape scrolling the page to its position.</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_280">Program run and start</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_290">Click on the icon “run” to execute the text of the Writer document as a LibreLogo program.</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_300">Click on the icon “stop” to stop the program execution.</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_310">Home</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_320">Click on the icon “home” to reset the position and settings of the turtle.</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_330">Clear screen</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_340">Click on the icon “clear screen” to remove the drawing objects of the document.</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_350">Command line</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_360">Hit Enter in the command line to execute its content. To stop the program use the icon “stop”.</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_370">Hold down the Enter to repeat the command line, for example, on the following command sequence:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_380">&#160;FORWARD&#160;200&#160;LEFT&#160;89<br/></paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_390">To reset the command line click triple in it or press Ctrl-A to select the previous commands, and type the new commands.</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_400">Syntax highlighting/Translating</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_410">It expands and upper case Logo commands in the Writer document. Change the language of the document (Tools » Options » Language Settings » Languages » Western) and click on this icon to translate the Logo program to the selected language.</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_420">Program editing</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_430">LibreLogo drawings and programs use the same Writer document. The LibreLogo canvas is on the first page of the Writer document. You can insert a page break before the LibreLogo programs and set the zoom/font size for a comfortable two page layout for LibreLogo programming: left (first) page is the canvas, right (second) page is for the LibreLogo programs.</paragraph>
+<paragraph role="heading" level="1" xml-lang="en-US" id="hd_440">LibreLogo programming language</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_450">LibreLogo is a native, easily localisable, Logo-like programming language. It is back-compatible with the older Logo systems in the case of the simple Logo programs used in education, eg.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_460">&#160;TO&#160;triangle&#160;:size<br/>&#160;REPEAT&#160;3&#160;[<br/>&#160;&#160;&#160;FORWARD&#160;:size<br/>&#160;&#160;&#160;LEFT&#160;120<br/>&#160;]<br/>&#160;END<br/>&#160;<br/>&#160;triangle&#160;10&#160;triangle&#160;100&#160;triangle&#160;200<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_470">Differences from the Logo programming language</paragraph>
+<list type="unordered">
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_480">List members are comma separated: POSITION [0, 0]</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_490">Program blocks and lists are different</paragraph>
+ </listitem>
+ <listitem>
+ <list type="unordered">
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_500">Program blocks need space or new line at parenthesization: REPEAT 10 [ forward 10 left 36 ]</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_510">Lists need close parenthesization: POSITION [0, 0], and not POSITION [ 0, 0 ]</paragraph>
+ </listitem>
+ </list>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_520">1-line function declarations have not supported yet (TO and END need new lines).</paragraph>
+ </listitem>
+</list>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_530">Other features of LibreLogo</paragraph>
+<list type="unordered">
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_540">The colon is optional before the variables (like in the Berkeley Logo)</paragraph>
+ <paragraph role="code" xml-lang="en-US" id="par_550">&#160;TO&#160;triangle&#160;size<br/>&#160;&#160;&#160;REPEAT&#160;3&#160;[&#160;FORWARD&#160;size&#160;LEFT&#160;120&#160;]<br/>&#160;END<br/></paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="paragraph" xml-lang="en-US" id="par_560">String notation supports also orthographical and Python syntax:</paragraph>
+ <paragraph role="code" xml-lang="en-US" id="par_570">&#160;PRINT&#160;"word" ;&#160;original&#160;Logo&#160;syntax<br/>&#160;PRINT&#160;“Arbitrary&#160;text.” ;&#160;orthography,&#160;Writer<br/>&#160;PRINT&#160;'Arbitrary&#160;text.' ;&#160;Python&#160;syntax<br/></paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="paragraph" xml-lang="en-US" id="par_580">Python list and string handling</paragraph>
+ <paragraph role="code" xml-lang="en-US" id="par_590">&#160;PRINT&#160;“text”[2] ;&#160;print&#160;“x”<br/>&#160;PRINT&#160;“text”[1:3] ;&#160;print&#160;“ex”<br/></paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="paragraph" xml-lang="en-US" id="par_600">Python-like FOR loop</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="paragraph" xml-lang="en-US" id="par_610">Python-like variable declaration:</paragraph>
+ <paragraph role="code" xml-lang="en-US" id="par_620">&#160;x&#160;=&#160;15<br/>&#160;PRINT&#160;x<br/></paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="paragraph" xml-lang="en-US" id="par_630">There are no extra query functions:</paragraph>
+ <paragraph role="code" xml-lang="en-US" id="par_640">&#160;PRINT&#160;FILLCOLOR<br/>&#160;p&#160;=&#160;POSITION<br/>&#160;PRINT&#160;p<br/>&#160;REPEAT&#160;10&#160;[&#160;POSITION&#160;ANY&#160;POSITION&#160;p&#160;]<br/></paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="paragraph" xml-lang="en-US" id="par_650">Alternative parenthesization in function calls</paragraph>
+ <paragraph role="code" xml-lang="en-US" id="par_660">&#160;TO&#160;star&#160;size&#160;color<br/>&#160;FILLCOLOR&#160;color<br/>&#160;REPEAT&#160;5&#160;[&#160;LEFT&#160;72&#160;FORWARD&#160;size&#160;RIGHT&#160;144&#160;FORWARD&#160;size&#160;]<br/>&#160;FILL<br/>&#160;END<br/>&#160;<br/>&#160;star&#160;100&#160;“red”<br/>&#160;star&#160;(100,&#160;“green”)<br/>&#160;star(100,&#160;“blue”)<br/></paragraph>
+ </listitem>
+</list>
+<paragraph role="heading" level="1" xml-lang="en-US" id="hd_670">LibreLogo commands</paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_680">Basic syntax</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_690">Case sensitivity</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_700">Commands, color constants are case insensitive:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_710">&#160;PRINT&#160;“Hello,&#160;World!”<br/>&#160;print&#160;“Hello,&#160;World,&#160;again!”<br/></paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_720">Variable names are case sensitive:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_730">&#160;a&#160;=&#160;5<br/>&#160;A&#160;=&#160;7<br/>&#160;PRINT&#160;a<br/>&#160;PRINT&#160;A<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_740">Program lines</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_750">Lines of a LibreLogo program are paragraphs in the LibreOffice Writer document. A program line can contain multiple commands:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_760">&#160;PRINT&#160;“Hello,&#160;World!”&#160;PRINT&#160;“LibreLogo”<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_770">Comments</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_780">Lines or line parts are comments from a semicolon to the end of the line (paragraph):</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_790">&#160;;&#160;some&#160;comments<br/>&#160;PRINT&#160;5&#160;*&#160;5 ;&#160;some&#160;comments<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_800">Break program lines to multiple paragraphs</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_810">It’s possible to break a program line for more paragraphs using the character tilde at the end of the line:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_820">&#160;PRINT&#160;“This&#160;is&#160;a&#160;very&#160;long&#160;”&#160;+&#160;~<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;“warning&#160;message”<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_830">Turtle moving</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_840">FORWARD (fd)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_850">&#160;FORWARD&#160;10 ;&#160;move&#160;forward&#160;10pt&#160;(1pt&#160;=&#160;1/72&#160;inch)<br/>&#160;FORWARD&#160;10pt ;&#160;see&#160;above<br/>&#160;FORWARD&#160;0.5in ;&#160;move&#160;forward&#160;0.5&#160;inch&#160;(1&#160;inch&#160;=&#160;2.54&#160;cm)<br/>&#160;FORWARD&#160;1" ;&#160;see&#160;above<br/>&#160;FD&#160;1mm<br/>&#160;FD&#160;1cm<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_860">BACK (bk)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_870">&#160;BACK&#160;10&#160;;&#160;move&#160;back&#160;10pt<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_880">LEFT (lt)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_890">&#160;LEFT&#160;90 ;&#160;turn&#160;counterclockwise&#160;90&#160;degrees<br/>&#160;LEFT&#160;90° ;&#160;see&#160;above<br/>&#160;LT&#160;3h ;&#160;see&#160;above&#160;(clock&#160;position)<br/>&#160;LT&#160;any ;&#160;turn&#160;to&#160;a&#160;random&#160;position<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_900">RIGHT (rt)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_910">&#160;RIGHT&#160;90 ;&#160;turn&#160;clockwise&#160;90&#160;degrees<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_920">PENUP (pu)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_930">&#160;PENUP ;&#160;turtle&#160;will&#160;move&#160;without&#160;drawing<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_940">PENDOWN (pd)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_950">&#160;PENDOWN ;&#160;turtle&#160;will&#160;move&#160;with&#160;drawing<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_960">POSITION (pos)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_970">&#160;POSITION&#160;[0,&#160;0] ;&#160;turn&#160;and&#160;move&#160;to&#160;the&#160;top-left&#160;corner<br/>&#160;POSITION&#160;PAGESIZE ;&#160;turn&#160;and&#160;move&#160;to&#160;the&#160;bottom-right&#160;corner<br/>&#160;POSITION&#160;[PAGESIZE[0],&#160;0]&#160;;&#160;turn&#160;and&#160;move&#160;to&#160;the&#160;top-right&#160;corner<br/>&#160;POSITION&#160;ANY ;&#160;turn&#160;and&#160;move&#160;to&#160;a&#160;random&#160;position<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_980">HEADING (seth)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_990">&#160;HEADING&#160;0 ;&#160;turn&#160;north<br/>&#160;HEADING&#160;12h ;&#160;see&#160;above<br/>&#160;HEADING&#160;ANY ;&#160;turn&#160;to&#160;a&#160;random&#160;position<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1000">Other turtle commands</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1010">HIDETURTLE (ht)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1020">&#160;HIDETURTLE ;&#160;hide&#160;turtle&#160;(until&#160;the&#160;showturtle&#160;command)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1030">SHOWTURTLE (st)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1040">&#160;SHOWTURTLE ;&#160;show&#160;turtle<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1050">HOME</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1060">&#160;HOME ;&#160;reset&#160;initial&#160;turtle&#160;settings&#160;and&#160;position<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1070">CLEARSCREEN (cs)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1080">&#160;CLEARSCREEN ;&#160;remove&#160;drawing&#160;objects&#160;of&#160;the&#160;document<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1090">FILL and CLOSE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1100">&#160;FILL ;&#160;close&#160;and&#160;fill&#160;the&#160;actual&#160;line&#160;shape<br/>&#160;CLOSE ;&#160;close&#160;the&#160;actual&#160;line&#160;shape<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1110">Pen settings</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1120">PENSIZE (ps)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1130">&#160;PENSIZE&#160;100 ;&#160;line&#160;width&#160;is&#160;100&#160;points<br/>&#160;PENSIZE&#160;ANY ;&#160;equivalent&#160;of&#160;PENSIZE&#160;RANDOM&#160;10<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1140">PENCOLOR/PENCOLOUR (pc)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1150">&#160;PENCOLOR&#160;“red” ;&#160;set&#160;red&#160;pen&#160;color&#160;(by&#160;color&#160;name,&#160;see&#160;color&#160;constants)<br/>&#160;PENCOLOR&#160;[255,&#160;255,&#160;0] ;&#160;set&#160;yellow&#160;color&#160;(RGB&#160;list)<br/>&#160;PENCOLOR&#160;0xffff00 ;&#160;set&#160;yellow&#160;color&#160;(hexa&#160;code)<br/>&#160;PENCOLOR&#160;0 ;&#160;set&#160;black&#160;color&#160;(0x000000)<br/>&#160;PENCOLOR&#160;ANY ;&#160;random&#160;color<br/>&#160;PENCOLOR&#160;[5] ;&#160;set&#160;red&#160;color&#160;(by&#160;color&#160;identifier,&#160;see&#160;color&#160;constants)<br/>&#160;PENCOLOR&#160;“invisible” ;&#160;invisible&#160;pen&#160;color&#160;for&#160;shapes&#160;without&#160;visible&#160;outline<br/>&#160;PENCOLOR&#160;“~red” ;&#160;set&#160;random&#160;red&#160;color<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1160">PENJOINT/LINEJOINT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1170">&#160;PENJOINT&#160;“rounded” ;&#160;rounded&#160;line&#160;joint&#160;(default)<br/>&#160;PENJOINT&#160;“miter” ;&#160;sharp&#160;line&#160;joint<br/>&#160;PENJOINT&#160;“bevel” ;&#160;bevel&#160;line&#160;joint<br/>&#160;PENJOINT&#160;“none” ;&#160;without&#160;line&#160;joint<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1180">PENSTYLE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1190">&#160;PENSTYLE&#160;“solid” ;&#160;solid&#160;line&#160;(default)<br/>&#160;PENSTYLE&#160;“dotted” ;&#160;dotted&#160;line<br/>&#160;PENSTYLE&#160;“dashed” ;&#160;dashed&#160;line<br/>&#160;<br/>&#160;;&#160;custom&#160;dot–dash&#160;pattern&#160;specified&#160;by&#160;a&#160;list&#160;with&#160;the&#160;following&#160;arguments:<br/>&#160;;&#160;–&#160;number&#160;of&#160;the&#160;neighbouring&#160;dots<br/>&#160;;&#160;–&#160;length&#160;of&#160;a&#160;dot<br/>&#160;;&#160;–&#160;number&#160;of&#160;the&#160;neighbouring&#160;dashes<br/>&#160;;&#160;–&#160;length&#160;of&#160;a&#160;dash<br/>&#160;;&#160;–&#160;distance&#160;of&#160;the&#160;dots/dashes<br/>&#160;;&#160;–&#160;type&#160;(optional):<br/>&#160;;&#160;&#160;&#160;0&#160;=&#160;dots&#160;are&#160;rectangles&#160;(default)<br/>&#160;;&#160;&#160;&#160;2&#160;=&#160;dots&#160;are&#160;squares&#160;(lengths&#160;and&#160;distances&#160;are&#160;relative&#160;to&#160;the&#160;pensize)<br/>&#160;<br/>&#160;PENSTYLE&#160;[3,&#160;1mm,&#160;2,&#160;4mm,&#160;2mm,&#160;2] ;&#160;...––...––...––<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1200">Fill settings</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1210">FILLCOLOR/FILLCOLOUR (fc)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1220">&#160;FILLCOLOR&#160;“blue” ;&#160;fill&#160;with&#160;blue&#160;color,&#160;see&#160;also&#160;PENCOLOR<br/>&#160;FILLCOLOR&#160;“invisible”&#160;CIRCLE&#160;10 ;&#160;unfilled&#160;circle<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1230">FILLSTYLE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1240">&#160;FILLSTYLE&#160;0 ;&#160;fill&#160;without&#160;hatches&#160;(default)<br/>&#160;FILLSTYLE&#160;1 ;&#160;black&#160;single&#160;hatches&#160;(horizontal)<br/>&#160;FILLSTYLE&#160;2 ;&#160;black&#160;single&#160;hatches&#160;(45&#160;degrees)<br/>&#160;FILLSTYLE&#160;3 ;&#160;black&#160;single&#160;hatches&#160;(-45&#160;degrees)<br/>&#160;FILLSTYLE&#160;4 ;&#160;black&#160;single&#160;hatches&#160;(vertical)<br/>&#160;FILLSTYLE&#160;5 ;&#160;red&#160;crossed&#160;hatches&#160;(45&#160;degrees)<br/>&#160;FILLSTYLE&#160;6 ;&#160;red&#160;crossed&#160;hatches&#160;(0&#160;degrees)<br/>&#160;FILLSTYLE&#160;7 ;&#160;blue&#160;crossed&#160;hatches&#160;(45&#160;degrees)<br/>&#160;FILLSTYLE&#160;8 ;&#160;blue&#160;crossed&#160;hatches&#160;(0&#160;degrees)<br/>&#160;FILLSTYLE&#160;9 ;&#160;blue&#160;triple&#160;crossed<br/>&#160;FILLSTYLE&#160;10 ;&#160;black&#160;wide&#160;single&#160;hatches&#160;(45&#160;degrees)<br/>&#160;<br/>&#160;;&#160;custom&#160;hatches&#160;specified&#160;by&#160;a&#160;list&#160;with&#160;the&#160;following&#160;arguments:<br/>&#160;;&#160;–&#160;style&#160;(1&#160;=&#160;single,&#160;2&#160;=&#160;double,&#160;3&#160;=&#160;triple&#160;hatching)<br/>&#160;;&#160;–&#160;color<br/>&#160;;&#160;–&#160;distance<br/>&#160;;&#160;–&#160;degree<br/>&#160;<br/>&#160;FILLSTYLE&#160;[2,&#160;“green”,&#160;3pt,&#160;15°] ;&#160;green&#160;crossed&#160;hatches&#160;(15&#160;degrees)<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1250">Drawing objects</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1260">CIRCLE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1270">&#160;CIRCLE&#160;100 ;&#160;draw&#160;a&#160;circle&#160;shape&#160;(diameter&#160;=&#160;100pt)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1280">ELLIPSE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1290">&#160;ELLIPSE&#160;[50,&#160;100] ;&#160;draw&#160;an&#160;ellipse&#160;with&#160;50&#160;and&#160;100&#160;diameters<br/>&#160;ELLIPSE&#160;[50,&#160;100,&#160;2h,&#160;12h] ;&#160;draw&#160;an&#160;elliptical&#160;sector&#160;(from&#160;2h&#160;clock&#160;position&#160;to&#160;12h)<br/>&#160;ELLIPSE&#160;[50,&#160;100,&#160;2h,&#160;12h,&#160;2]&#160;&#160;;&#160;draw&#160;an&#160;elliptical&#160;segment<br/>&#160;ELLIPSE&#160;[50,&#160;100,&#160;2h,&#160;12h,&#160;3]&#160;&#160;;&#160;draw&#160;an&#160;elliptical&#160;arc<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1300">SQUARE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1310">&#160;SQUARE&#160;100 ;&#160;draw&#160;a&#160;square&#160;shape&#160;(size&#160;=&#160;100pt)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1320">RECTANGLE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1330">&#160;RECTANGLE&#160;[50,&#160;100] ;&#160;draw&#160;a&#160;rectange&#160;shape&#160;(50×100pt)<br/>&#160;RECTANGLE&#160;[50,&#160;100,&#160;50] ;&#160;draw&#160;a&#160;rectangle&#160;<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1340">POINT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1350">&#160;POINT ;&#160;draw&#160;a&#160;point&#160;with&#160;size&#160;and&#160;color&#160;of&#160;the&#160;pen<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1360">LABEL</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1370">&#160;LABEL&#160;“text” ;&#160;print&#160;text&#160;in&#160;the&#160;turte&#160;position<br/>&#160;LABEL&#160;'text' ;&#160;see&#160;above<br/>&#160;LABEL&#160;"text ;&#160;see&#160;above&#160;(only&#160;for&#160;single&#160;words)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1380">TEXT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1390">&#160;CIRCLE&#160;10&#160;TEXT&#160;“text” ;&#160;set&#160;text&#160;of&#160;the&#160;actual&#160;drawing&#160;object<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1400">Font settings</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1410">FONTCOLOR/FONTCOLOUR</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1420">&#160;FONTCOLOR&#160;“green” ;&#160;set&#160;font&#160;color<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1430">FONTFAMILY</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1440">&#160;FONTFAMILY&#160;“Linux&#160;Libertine&#160;G” ;&#160;set&#160;font&#160;(family)<br/>&#160;FONTFAMILY&#160;“Linux&#160;Libertine&#160;G:smcp=1” ;&#160;set&#160;also&#160;font&#160;feature&#160;(small&#160;caps)<br/>&#160;FONTFAMILY&#160;“Linux&#160;Libertine&#160;G:smcp=1&amp;onum=1” ;&#160;small&#160;caps&#160;+&#160;old&#160;figures<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1450">FONTSIZE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1460">&#160;FONTSIZE&#160;12 ;&#160;set&#160;12pt<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1470">FONTWEIGHT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1480">&#160;FONTWEIGHT&#160;“bold” ;&#160;set&#160;bold&#160;font<br/>&#160;FONTWEIGHT&#160;“normal” ;&#160;set&#160;normal&#160;weight<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1490">FONTSTYLE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1500">&#160;FONTSTYLE&#160;“italic” ;&#160;set&#160;italic&#160;variant<br/>&#160;FONTSTYLE&#160;“normal” ;&#160;set&#160;normal&#160;variant<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1510">PICTURE (pic)</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1520">PICTURE is for </paragraph>
+<list type="unordered">
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_1530">shape grouping;</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_1540">starting new line shapes;</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" xml-lang="en-US" id="par_1550">keeping the consistency of positions and line shapes at the left border.</paragraph>
+ </listitem>
+</list>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1560">Shape grouping</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1570">&#160;;&#160;PICTURE&#160;[&#160;LibreLogo_commands&#160;]<br/>&#160;PICTURE&#160;[&#160;FORWARD&#160;100&#160;CIRCLE&#160;100&#160;] ;&#160;tree-like&#160;grouped&#160;shape<br/></paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1580">See also “Group” in LibreOffice Writer Help.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1590">&#160;TO&#160;tree&#160;location<br/>&#160;&#160;&#160;PENUP&#160;POSITION&#160;location&#160;HEADING&#160;0&#160;PENDOWN<br/>&#160;&#160;&#160;PICTURE&#160;[&#160;FORWARD&#160;100&#160;CIRCLE&#160;100&#160;] ;&#160;tree-like&#160;grouped&#160;shape<br/>&#160;END<br/>&#160;<br/>&#160;PICTURE&#160;[&#160;tree&#160;[30,&#160;50]&#160;tree&#160;[100,&#160;50]&#160;] ;&#160;grouped&#160;shapes&#160;in&#160;a&#160;grouped&#160;shape<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1600">Starting new line shapes</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1610">&#160;PICTURE ;&#160;start&#160;a&#160;new&#160;line&#160;shape<br/>&#160;FORWARD&#160;10&#160;PICTURE&#160;FORWARD&#160;10 ;&#160;two&#160;line&#160;shapes<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1620">Consistency at the left border</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1630">Use picture to keep the consistency of positions and line shapes at the left border of Writer:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1640">&#160;PICTURE&#160;[&#160;CIRCLE&#160;20&#160;POSITION&#160;[-100,&#160;100]&#160;CIRCLE&#160;20&#160;]<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1650">Loops</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1660">REPEAT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1670">&#160;;&#160;REPEAT&#160;number&#160;[&#160;commands&#160;]<br/>&#160;<br/>&#160;REPEAT&#160;10&#160;[&#160;FORWARD&#160;10&#160;LEFT&#160;45&#160;CIRCLE&#160;10&#160;] ;&#160;repeat&#160;10&#160;times<br/></paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1680">&#160;;&#160;number&#160;is&#160;optional<br/>&#160;<br/>&#160;REPEAT&#160;[&#160;POSITION&#160;ANY&#160;] ;&#160;endless&#160;loop<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1690">REPCOUNT</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1700">Loop variable (also in the FOR and WHILE loops).</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1710">&#160;REPEAT&#160;100&#160;[&#160;FORWARD&#160;REPCOUNT&#160;LEFT&#160;90&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1720">FOR IN</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1730">Loop for the list elements:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1740">&#160;FOR&#160;i&#160;IN&#160;[1,&#160;5,&#160;7,&#160;9,&#160;11]&#160;[<br/>&#160;&#160;&#160;FORWARD&#160;i<br/>&#160;&#160;&#160;LEFT&#160;90<br/>&#160;]<br/></paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1750">Loop for the characters of a character sequence:</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1760">&#160;FOR&#160;i&#160;IN&#160;“text”&#160;[<br/>&#160;&#160;&#160;LABEL&#160;i<br/>&#160;&#160;&#160;FORWARD&#160;10<br/>&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1770">WHILE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1780">&#160;WHILE&#160;TRUE&#160;[&#160;POSITION&#160;ANY&#160;] ;&#160;endless&#160;loop<br/>&#160;WHILE&#160;REPCOUNT&#160;&lt;=&#160;10&#160;[&#160;FORWARD&#160;50&#160;LEFT&#160;36&#160;] ;&#160;as&#160;REPEAT&#160;10&#160;[&#160;...&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1790">BREAK</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1800">Stop the loop.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1810">&#160;REPEAT&#160;[ ;&#160;endless&#160;loop<br/>&#160;&#160;&#160;POSITION&#160;ANY<br/>&#160;&#160;&#160;IF&#160;REPCOUNT&#160;=&#160;100&#160;[&#160;BREAK&#160;]&#160;&#160;;&#160;equivalent&#160;of&#160;the&#160;REPEAT&#160;100&#160;[&#160;...&#160;]<br/>&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1820">CONTINUE</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1830">Jump into the next iteration of the loop.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1840">&#160;REPEAT&#160;100&#160;[<br/>&#160;&#160;&#160;POSITION&#160;ANY<br/>&#160;&#160;&#160;IF&#160;REPCOUNT&#160;%&#160;2&#160;&lt;>&#160;0&#160;[&#160;CONTINUE&#160;]<br/>&#160;&#160;&#160;CIRCLE&#160;10 ;&#160;draw&#160;circles&#160;on&#160;every&#160;2nd&#160;positions<br/>&#160;]<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1850">Conditions</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1860">IF</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1870">&#160;;&#160;IF&#160;condition&#160;[&#160;true&#160;block&#160;]<br/>&#160;;&#160;IF&#160;condition&#160;[&#160;true&#160;block&#160;]&#160;[&#160;false&#160;block&#160;]<br/>&#160;<br/>&#160;IF&#160;a&#160;&lt;&#160;10&#160;[&#160;PRINT&#160;“Small”&#160;]<br/>&#160;IF&#160;a&#160;&lt;&#160;10&#160;[&#160;PRINT&#160;“Small”&#160;]&#160;[&#160;PRINT&#160;“Big”&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1880">AND, OR, NOT</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1890">Logical operators.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1900">&#160;IF&#160;a&#160;&lt;&#160;10&#160;AND&#160;NOT&#160;a&#160;&lt;&#160;5&#160;[&#160;PRINT&#160;“5,&#160;6,&#160;7,&#160;8&#160;or&#160;9”&#160;]<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1910">Subroutines</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1920">TO, END</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1930">New word (or procedure).</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1940">&#160;TO&#160;triangle<br/>&#160;&#160;&#160;REPEAT&#160;[&#160;FORWARD&#160;100&#160;RIGHT&#160;120&#160;]&#160;FILL<br/>&#160;END<br/>&#160;<br/>&#160;REPEAT&#160;10&#160;[&#160;triangle&#160;PENUP&#160;POSITION&#160;ANY&#160;PENDOWN&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1950">OUTPUT</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1960">Return value of the function.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_1970">&#160;TO&#160;randomletter<br/>&#160;&#160;&#160;OUTPUT&#160;RANDOM&#160;“qwertzuiopasdfghjklyxcvbnm”<br/>&#160;END<br/>&#160;<br/>&#160;PRINT&#160;randomletter&#160;+&#160;randomletter&#160;+&#160;randomletter ;&#160;print&#160;3-letter&#160;random&#160;character&#160;sequence<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1980">STOP</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_1990">Return from the procedure.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2000">&#160;TO&#160;example&#160;number<br/>&#160;&#160;&#160;IF&#160;number&#160;&lt;&#160;0&#160;[&#160;STOP&#160;]<br/>&#160;&#160;&#160;PRINT&#160;SQRT&#160;number ;&#160;print&#160;square&#160;root<br/>&#160;]<br/>&#160;<br/>&#160;example&#160;100<br/>&#160;example&#160;-1 ;&#160;without&#160;output&#160;and&#160;error<br/>&#160;example&#160;25<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2010">Default variables</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2020">ANY</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2030">Default random value of colors, etc.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2040">&#160;PENCOLOR&#160;ANY ;&#160;random&#160;pen&#160;color<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2050">TRUE</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2060">Logical value.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2070">&#160;WHILE&#160;TRUE&#160;[&#160;POSITION&#160;ANY&#160;] ;&#160;endless&#160;loop<br/>&#160;PRINT&#160;TRUE ;&#160;print&#160;true<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2080">FALSE</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2090">Logical value.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2100">&#160;WHILE&#160;NOT&#160;FALSE&#160;[&#160;POSITION&#160;ANY&#160;] ;&#160;endless&#160;loop<br/>&#160;PRINT&#160;FALSE ;&#160;print&#160;false<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2110">PAGESIZE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2120">&#160;PRINT&#160;PAGESIZE ;&#160;print&#160;list&#160;of&#160;the&#160;page&#160;sizes&#160;in&#160;points,&#160;eg.&#160;[595.30,&#160;841.89]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2130">PI/π</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2140">&#160;PRINT&#160;PI ;&#160;print&#160;3.14159265359<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2150">Input/Output</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2160">PRINT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2170">&#160;PRINT&#160;“text” ;&#160;print&#160;“text”&#160;in&#160;a&#160;dialog&#160;box<br/>&#160;PRINT&#160;5&#160;+&#160;10 ;&#160;print&#160;15<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2180">INPUT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2190">&#160;PRINT&#160;INPUT&#160;“Input&#160;value?” ;&#160;ask&#160;and&#160;print&#160;a&#160;string&#160;by&#160;a&#160;query&#160;dialog&#160;box<br/>&#160;PRINT&#160;FLOAT&#160;(INPUT&#160;“First&#160;number?”)&#160;+&#160;FLOAT&#160;(INPUT&#160;“Second&#160;number?”)&#160;;&#160;simple&#160;calculator<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2200">SLEEP</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2210">&#160;SLEEP&#160;1000 ;&#160;wait&#160;for&#160;1000&#160;ms&#160;(1&#160;sec)<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2220">GLOBAL</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2230">Set global variables used in procedures.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2240">&#160;GLOBAL&#160;about<br/>&#160;about&#160;=&#160;“LibreLogo”<br/>&#160;<br/>&#160;TO&#160;example<br/>&#160;&#160;&#160;PRINT&#160;about<br/>&#160;&#160;&#160;GLOBAL&#160;about ;&#160;when&#160;we&#160;want&#160;to&#160;add&#160;a&#160;new&#160;value<br/>&#160;&#160;&#160;about&#160;=&#160;“new&#160;value&#160;for&#160;the&#160;global&#160;variable”<br/>&#160;END<br/>&#160;<br/>&#160;example<br/>&#160;PRINT&#160;about<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2250">Functions</paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2260">RANDOM</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2270">&#160;PRINT&#160;RANDOM&#160;100 ;&#160;random&#160;float&#160;number&#160;(0&#160;&lt;=&#160;x&#160;&lt;&#160;100)<br/>&#160;PRINT&#160;RANDOM&#160;“text” ;&#160;random&#160;letter&#160;of&#160;the&#160;“text”<br/>&#160;PRINT&#160;RANDOM&#160;[1,&#160;2] ;&#160;random&#160;list&#160;element&#160;(1&#160;or&#160;2)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2280">INT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2290">&#160;PRINT&#160;INT&#160;3.8 ;&#160;print&#160;3&#160;(integer&#160;part&#160;of&#160;3.8)<br/>&#160;PRINT&#160;INT&#160;RANDOM&#160;100 ;&#160;random&#160;integer&#160;number&#160;(0&#160;&lt;=&#160;x&#160;&lt;&#160;100)<br/>&#160;PRINT&#160;INT&#160;“7” ;&#160;convert&#160;the&#160;string&#160;parameter&#160;to&#160;integer<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2300">FLOAT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2310">&#160;;&#160;convert&#160;the&#160;string&#160;parameter&#160;to&#160;float&#160;number<br/>&#160;PRINT&#160;2&#160;*&#160;FLOAT&#160;“5.5” ;&#160;print&#160;11.0<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2320">STR</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2330">&#160;;&#160;convert&#160;the&#160;number&#160;parameter&#160;to&#160;string<br/>&#160;PRINT&#160;“Result:&#160;”&#160;+&#160;STR&#160;5 ;&#160;print&#160;“Result:&#160;5”<br/>&#160;PRINT&#160;10&#160;*&#160;STR&#160;5 ;&#160;print&#160;5555555555<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2340">SQRT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2350">&#160;PRINT&#160;SQRT&#160;100 ;&#160;print&#160;10,&#160;square&#160;root&#160;of&#160;100<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2360">SIN</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2370">&#160;PRINT&#160;SIN&#160;90&#160;*&#160;PI/180 ;&#160;print&#160;1.0&#160;(sinus&#160;of&#160;90°&#160;in&#160;radians)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2380">COS</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2390">&#160;PRINT&#160;COS&#160;0&#160;*&#160;PI/180 ;&#160;print&#160;1.0&#160;(sinus&#160;of&#160;0°&#160;in&#160;radians)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2400">ROUND</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2410">&#160;PRINT&#160;ROUND&#160;3.8 ;&#160;print&#160;4&#160;(rounding&#160;3.8)<br/>&#160;PRINT&#160;ROUND&#160;RANDOM&#160;100 ;&#160;random&#160;integer&#160;number&#160;(0&#160;&lt;=&#160;x&#160;&lt;=&#160;100)<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2420">ABS</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2430">&#160;PRINT&#160;ABS&#160;-10 ;&#160;print&#160;10,&#160;absolute&#160;value&#160;of&#160;-10<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2440">COUNT</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2450">&#160;PRINT&#160;COUNT&#160;“text” ;&#160;print&#160;4,&#160;character&#160;count&#160;of&#160;“text”<br/>&#160;PRINT&#160;COUNT&#160;[1,&#160;2,&#160;3] ;&#160;print&#160;3,&#160;size&#160;of&#160;the&#160;list<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2460">SET</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2470">&#160;;&#160;Convert&#160;list&#160;to&#160;Python&#160;set<br/>&#160;PRINT&#160;SET&#160;[4,&#160;5,&#160;6,&#160;6] ;&#160;print&#160;{4,&#160;5,&#160;6}<br/>&#160;PRINT&#160;SET&#160;[4,&#160;5,&#160;6,&#160;6]&#160;|&#160;SET&#160;[4,&#160;1,&#160;9] ;&#160;print&#160;{1,&#160;4,&#160;5,&#160;6,&#160;9},&#160;union<br/>&#160;PRINT&#160;SET&#160;[4,&#160;5,&#160;6,&#160;6]&#160;&amp;&#160;SET&#160;[4,&#160;1,&#160;9] ;&#160;print&#160;{4},&#160;intersection<br/>&#160;PRINT&#160;SET&#160;([4,&#160;5,&#160;6,&#160;6])&#160;-&#160;SET&#160;[4,&#160;1,&#160;9] ;&#160;print&#160;{5,&#160;6},&#160;difference<br/>&#160;PRINT&#160;SET&#160;[4,&#160;5,&#160;6,&#160;6]&#160;^&#160;SET&#160;[4,&#160;1,&#160;9] ;&#160;print&#160;{1,&#160;5,&#160;6,&#160;9},&#160;symmetric&#160;difference&#160;&#160;<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2480">RANGE</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2490">&#160;;&#160;Python-like&#160;list&#160;generation<br/>&#160;PRINT&#160;RANGE&#160;10 ;&#160;print&#160;[0,&#160;1,&#160;2,&#160;3,&#160;4,&#160;5,&#160;6,&#160;7,&#160;8,&#160;9]<br/>&#160;PRINT&#160;RANGE&#160;3&#160;10 ;&#160;print&#160;[3,&#160;4,&#160;5,&#160;6,&#160;7,&#160;8,&#160;9]<br/>&#160;PRINT&#160;RANGE&#160;3&#160;10&#160;3 ;&#160;print&#160;[3,&#160;6,&#160;9]<br/>&#160;<br/>&#160;FOR&#160;i&#160;in&#160;RANGE&#160;10&#160;50&#160;10&#160;[ ;&#160;loop&#160;for&#160;[10,&#160;20,&#160;30,&#160;40]<br/>&#160;&#160;&#160;FORWARD&#160;i<br/>&#160;&#160;&#160;LEFT&#160;90<br/>&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2500">LIST</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2510">&#160;;&#160;remove&#160;the&#160;repeating&#160;elements&#160;of&#160;a&#160;list&#160;using&#160;set&#160;and&#160;list&#160;conversion<br/>&#160;PRINT&#160;LIST&#160;(SET&#160;[1,&#160;3,&#160;5,&#160;5,&#160;2,&#160;1]) ;&#160;print&#160;[1,&#160;3,&#160;5,&#160;2]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2520">TUPLE</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2530">Conversion to Python tuple (non-modifiable list)</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2540">&#160;PRINT&#160;TUPLE&#160;[4,&#160;5]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2550">SORTED</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2560">It returns with a sorted list.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2570">&#160;PRINT&#160;SORTED&#160;[5,&#160;1,&#160;3,&#160;4] ;&#160;print&#160;[1,&#160;3,&#160;4,&#160;5]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2580">SUB</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2590">Substitue character sequences using regex (regular expression) patterns.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2600">&#160;PRINT&#160;SUB&#160;(“t”,&#160;“T”,&#160;“text”) ;&#160;print&#160;“Text”,&#160;replacing&#160;“t”&#160;with&#160;“T”<br/>&#160;PRINT&#160;SUB&#160;(“(.)”,&#160;“\\1\\1”,&#160;“text”)&#160;;&#160;print&#160;“tteexxtt”,&#160;doubling&#160;every&#160;characters<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2610">SEARCH</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2620">Search character sequences patterns using regex patterns.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2630">&#160;IF&#160;SEARCH&#160;(“\w”,&#160;word)&#160;[&#160;PRINT&#160;“Letter&#160;in&#160;the&#160;word.”&#160;]<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2640">FINDALL</paragraph>
+<paragraph role="paragraph" xml-lang="en-US" id="par_2650">Find all character sequences in the input string matching the given regex pattern.</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2660">&#160;PRINT&#160;FINDALL(“\w+”,&#160;“Dogs,&#160;cats.”) ;&#160;print&#160;[“Dogs”,&#160;“cats”],&#160;the&#160;list&#160;of&#160;the&#160;words.<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2670">MIN</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2680">&#160;PRINT&#160;MIN&#160;[1,&#160;2,&#160;3] ;&#160;print&#160;1,&#160;the&#160;lowest&#160;element&#160;of&#160;the&#160;list<br/></paragraph>
+<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2690">MAX</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2700">&#160;PRINT&#160;MAX&#160;[1,&#160;2,&#160;3] ;&#160;print&#160;3,&#160;the&#160;greatest&#160;element&#160;of&#160;the&#160;list<br/></paragraph>
+<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2710">Color constants</paragraph>
+<paragraph role="code" xml-lang="en-US" id="par_2720">&#160;PENCOLOR&#160;“SILVER” ;&#160;set&#160;by&#160;name<br/>&#160;PENCOLOR&#160;[1] ;&#160;set&#160;by&#160;identifiers<br/>&#160;PENCOLOR&#160;“~SILVER” ;&#160;random&#160;silver&#160;color<br/>&#160;<br/></paragraph>
+<table><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2740">Identifier</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2750">Name</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2770">0</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2780">BLACK</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2800">1</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2810">SILVER</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2830">2</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2840">GRAY/GREY</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2860">3</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2870">WHITE</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2890">4</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2900">MAROON</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2920">5</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2930">RED</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2950">6</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2960">PURPLE</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2980">7</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2990">FUCHSIA/MAGENTA</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3010">8</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3020">GREEN</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3040">9</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3050">LIME</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3070">10</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3080">OLIVE</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3100">11</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3110">YELLOW</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3130">12</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3140">NAVY</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3160">13</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3170">BLUE</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3190">14</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3200">TEAL</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3220">15</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3230">AQUA</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3250">16</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3260">PINK</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3280">17</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3290">TOMATO</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3310">18</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3320">ORANGE</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3340">19</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3350">GOLD</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3370">20</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3380">VIOLET</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3400">21</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3410">SKYBLUE</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3430">22</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3440">CHOCOLATE</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3460">23</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3470">BROWN</paragraph></tablecell>
+</tablerow><tablerow>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3490">24</paragraph></tablecell>
+<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3500">INVISIBLE</paragraph></tablecell>
+</tablerow></table>
+</body></helpdocument>
diff --git a/librelogo/source/help/en-US/help.tree b/librelogo/source/help/en-US/help.tree
new file mode 100644
index 000000000000..10d79ef2958a
--- /dev/null
+++ b/librelogo/source/help/en-US/help.tree
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<tree_view>
+<help_section application="swriter" id="02" title="LibreLogo">
+ <node id="0225" title="LibreLogo">
+ <topic id="help/org.openoffice.comp.pyuno.LibreLogo/LibreLogo.xhp">LibreLogo</topic>
+ </node>
+</help_section>
+</tree_view>
diff --git a/librelogo/source/help/en-US/tree_strings.xhp b/librelogo/source/help/en-US/tree_strings.xhp
new file mode 100644
index 000000000000..b56e4ffe200c
--- /dev/null
+++ b/librelogo/source/help/en-US/tree_strings.xhp
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpdocument version="1.0">
+
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<meta>
+ <topic id="tree_stringsxml" indexer="include" status="PUBLISH">
+ <title xml-lang="en-US" id="tit" localize="false">Note to translators:</title>
+ <filename>/mediawiki/help/treestrings.xhp</filename>
+ </topic>
+</meta>
+
+<body>
+ <comment>This file contains extra strings for the contents (*.tree) files. No indexing!</comment>
+ <switch select="sys"> <case select="OS2">
+ <paragraph role="heading" level="1" id="hd_id3150150" xml-lang="en-US" localize="false">File: help.tree</paragraph>
+ <paragraph role="paragraph" id="par_id3160160" xml-lang="en-US">&lt;help_section application=&quot;swriter&quot; id=&quot;02&quot; title=&quot;LibreLogo&quot;&gt;</paragraph>
+ <paragraph role="paragraph" id="par_id3170170" xml-lang="en-US">&lt;node id=&quot;0225&quot; title=&quot;LibreLogo&quot;&gt;</paragraph>
+ </case> </switch>
+</body>
+
+</helpdocument>
diff --git a/librelogo/source/icons/lc_arrowshapes.circular-arrow.png b/librelogo/source/icons/lc_arrowshapes.circular-arrow.png
new file mode 100644
index 000000000000..b7a5a9258ca7
--- /dev/null
+++ b/librelogo/source/icons/lc_arrowshapes.circular-arrow.png
Binary files differ
diff --git a/librelogo/source/icons/lc_arrowshapes.circular-leftarrow.png b/librelogo/source/icons/lc_arrowshapes.circular-leftarrow.png
new file mode 100644
index 000000000000..ad2197838ca7
--- /dev/null
+++ b/librelogo/source/icons/lc_arrowshapes.circular-leftarrow.png
Binary files differ
diff --git a/librelogo/source/icons/lc_arrowshapes.down-arrow.png b/librelogo/source/icons/lc_arrowshapes.down-arrow.png
new file mode 100644
index 000000000000..d3b81b9f6446
--- /dev/null
+++ b/librelogo/source/icons/lc_arrowshapes.down-arrow.png
Binary files differ
diff --git a/librelogo/source/icons/lc_arrowshapes.up-arrow.png b/librelogo/source/icons/lc_arrowshapes.up-arrow.png
new file mode 100644
index 000000000000..6ae84abe8376
--- /dev/null
+++ b/librelogo/source/icons/lc_arrowshapes.up-arrow.png
Binary files differ
diff --git a/librelogo/source/icons/lc_basicstop.png b/librelogo/source/icons/lc_basicstop.png
new file mode 100644
index 000000000000..ab9bddb4a98b
--- /dev/null
+++ b/librelogo/source/icons/lc_basicstop.png
Binary files differ
diff --git a/librelogo/source/icons/lc_editglossary.png b/librelogo/source/icons/lc_editglossary.png
new file mode 100644
index 000000000000..fcba68f1feb5
--- /dev/null
+++ b/librelogo/source/icons/lc_editglossary.png
Binary files differ
diff --git a/librelogo/source/icons/lc_navigationbarleft.png b/librelogo/source/icons/lc_navigationbarleft.png
new file mode 100644
index 000000000000..7e69c8045fbe
--- /dev/null
+++ b/librelogo/source/icons/lc_navigationbarleft.png
Binary files differ
diff --git a/librelogo/source/icons/lc_newdoc.png b/librelogo/source/icons/lc_newdoc.png
new file mode 100644
index 000000000000..8e18798acdb2
--- /dev/null
+++ b/librelogo/source/icons/lc_newdoc.png
Binary files differ
diff --git a/librelogo/source/icons/lc_runbasic.png b/librelogo/source/icons/lc_runbasic.png
new file mode 100644
index 000000000000..da2d9d97badf
--- /dev/null
+++ b/librelogo/source/icons/lc_runbasic.png
Binary files differ
diff --git a/librelogo/source/icons/sc_arrowshapes.circular-arrow.png b/librelogo/source/icons/sc_arrowshapes.circular-arrow.png
new file mode 100644
index 000000000000..35a5e9719607
--- /dev/null
+++ b/librelogo/source/icons/sc_arrowshapes.circular-arrow.png
Binary files differ
diff --git a/librelogo/source/icons/sc_arrowshapes.circular-leftarrow.png b/librelogo/source/icons/sc_arrowshapes.circular-leftarrow.png
new file mode 100644
index 000000000000..62eeee65fba4
--- /dev/null
+++ b/librelogo/source/icons/sc_arrowshapes.circular-leftarrow.png
Binary files differ
diff --git a/librelogo/source/icons/sc_arrowshapes.down-arrow.png b/librelogo/source/icons/sc_arrowshapes.down-arrow.png
new file mode 100644
index 000000000000..7290cae2f1c4
--- /dev/null
+++ b/librelogo/source/icons/sc_arrowshapes.down-arrow.png
Binary files differ
diff --git a/librelogo/source/icons/sc_arrowshapes.up-arrow.png b/librelogo/source/icons/sc_arrowshapes.up-arrow.png
new file mode 100644
index 000000000000..5f9bcc197f81
--- /dev/null
+++ b/librelogo/source/icons/sc_arrowshapes.up-arrow.png
Binary files differ
diff --git a/librelogo/source/icons/sc_basicstop.png b/librelogo/source/icons/sc_basicstop.png
new file mode 100644
index 000000000000..1c6ff922a786
--- /dev/null
+++ b/librelogo/source/icons/sc_basicstop.png
Binary files differ
diff --git a/librelogo/source/icons/sc_editglossary.png b/librelogo/source/icons/sc_editglossary.png
new file mode 100644
index 000000000000..4e14c031a4ae
--- /dev/null
+++ b/librelogo/source/icons/sc_editglossary.png
Binary files differ
diff --git a/librelogo/source/icons/sc_navigationbarleft.png b/librelogo/source/icons/sc_navigationbarleft.png
new file mode 100644
index 000000000000..e544a7581f33
--- /dev/null
+++ b/librelogo/source/icons/sc_navigationbarleft.png
Binary files differ
diff --git a/librelogo/source/icons/sc_newdoc.png b/librelogo/source/icons/sc_newdoc.png
new file mode 100644
index 000000000000..e914775a2693
--- /dev/null
+++ b/librelogo/source/icons/sc_newdoc.png
Binary files differ
diff --git a/librelogo/source/icons/sc_runbasic.png b/librelogo/source/icons/sc_runbasic.png
new file mode 100644
index 000000000000..8dd695c1e767
--- /dev/null
+++ b/librelogo/source/icons/sc_runbasic.png
Binary files differ
diff --git a/librelogo/source/pythonpath/LibreLogo_en_US.properties b/librelogo/source/pythonpath/LibreLogo_en_US.properties
new file mode 100644
index 000000000000..f9a0d0b87ee6
--- /dev/null
+++ b/librelogo/source/pythonpath/LibreLogo_en_US.properties
@@ -0,0 +1,151 @@
+# turtle graphics
+
+FORWARD=forward|fd
+BACKWARD=back|bk
+TURNLEFT=left|turnleft|lt
+TURNRIGHT=right|turnright|rt
+PENUP=penup|pu
+PENDOWN=pendown|pd
+HOME=home
+POINT=point
+CIRCLE=circle
+ELLIPSE=ellipse
+SQUARE=square
+RECTANGLE=rectangle
+LABEL=label
+PENCOLOR=pencolor|pencolour|linecolor|pc
+ANY=any
+PENWIDTH=pensize|penwidth|linewidth|ps
+PENSTYLE=penstyle|linestyle
+PENJOINT=penjoint|linejoint
+NONE=none
+BEVEL=bevel
+MITER=miter
+ROUNDED=round
+SOLID=solid
+DASH=dashed
+DOTTED=dotted
+CLOSE=close
+FILL=fill
+FILLCOLOR=fillcolor|fillcolour|fc
+FILLSTYLE=fillstyle
+FONTCOLOR=fontcolor|textcolor|textcolour
+FONTHEIGHT=fontsize|textsize|textheight
+FONTWEIGHT=fontweight
+FONTSTYLE=fontstyle
+BOLD=bold
+ITALIC=italic
+UPRIGHT=upright|normal
+NORMAL=normal
+FONTFAMILY=fontfamily
+CLEARSCREEN=clearscreen|cs
+TEXT=text
+HIDETURTLE=hideturtle|ht|hideme
+SHOWTURTLE=showturtle|st|showme
+POSITION=position|pos|setpos
+HEADING=heading|setheading|seth
+PAGESIZE=pagesize
+GROUP=picture|pic
+
+# control structures
+
+TO=to
+END=end
+STOP=stop
+REPEAT=repeat|forever
+REPCOUNT=repcount
+BREAK=break
+CONTINUE=continue
+WHILE=while
+FOR=for
+IN=in
+IF=if
+OUTPUT=output
+LEFTSTRING=\u201c|\u2018
+RIGHTSTRING=\u201d|\u2019
+TRUE=true
+FALSE=false
+NOT=not
+AND=and
+OR=or
+INPUT=input
+PRINT=print
+SLEEP=sleep
+GLOBAL=global
+
+# functions
+RANDOM=random
+INT=int
+FLOAT=float
+STR=str
+SQRT=sqrt
+SIN=sin
+COS=cos
+ROUND=round
+ABS=abs
+COUNT=count
+SET=set
+RANGE=range
+LIST=list
+TUPLE=tuple
+SORTED=sorted
+RESUB=sub
+RESEARCH=search
+REFINDALL=findall
+MIN=min
+MAX=max
+
+PI=pi|\u03c0
+
+# measurement
+DECIMAL=.
+DEG=\u00b0
+HOUR=h
+MM=mm
+CM=cm
+PT=pt
+INCH=in|"
+
+# color codes
+
+INVISIBLE=invisible
+BLACK=black
+SILVER=silver
+GRAY=gray|grey
+WHITE=white
+MAROON=maroon
+RED=red
+PURPLE=purple
+FUCHSIA=fuchsia|magenta
+GREEN=green
+LIME=lime
+OLIVE=olive
+YELLOW=yellow
+NAVY=navy
+BLUE=blue
+TEAL=teal
+AQUA=aqua|cyan
+PINK=pink
+TOMATO=tomato
+ORANGE=orange
+GOLD=gold
+VIOLET=violet
+SKYBLUE=skyblue
+CHOCOLATE=chocolate
+BROWN=brown
+
+# messages
+
+LIBRELOGO=LibreLogo
+ERROR=Error (in line %s)
+ERR_ZERODIVISION=Division by zero.
+ERR_NAME=Unknown name: \u2018%s\u201d.
+ERR_ARGUMENTS=%s takes %s arguments (%s given).
+ERR_BLOCK=Error (extra or missing spaces at brackets?)
+ERR_KEY=Unknown element: %s
+ERR_INDEX=Index out of range.
+
+ERR_STOP=Program terminated:
+ERR_MAXRECURSION=maximum recursion depth (%d) exceeded.
+ERR_MEMORY=not enough memory.
+ERR_NOTAPROGRAM=Do you want to run this text document?
diff --git a/librelogo/source/pythonpath/librelogodummy_path.py b/librelogo/source/pythonpath/librelogodummy_path.py
new file mode 100644
index 000000000000..f600a162b1cf
--- /dev/null
+++ b/librelogo/source/pythonpath/librelogodummy_path.py
@@ -0,0 +1,3 @@
+import uno, re, sys, os, traceback
+def get_path():
+ return os.path.join(os.path.dirname(sys.modules[__name__].__file__), __name__ + ".py")
diff --git a/librelogo/source/registry/data/org/openoffice/Office/Addons.xcu b/librelogo/source/registry/data/org/openoffice/Office/Addons.xcu
new file mode 100644
index 000000000000..3ad52bbc0eb9
--- /dev/null
+++ b/librelogo/source/registry/data/org/openoffice/Office/Addons.xcu
@@ -0,0 +1,286 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
+ <node oor:name="AddonUI">
+ <node oor:name="OfficeToolBar">
+ <node oor:name="LibreLogo.OfficeToolBar" oor:op="replace">
+ <node oor:name="m01" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$goforward?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Forward</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m02" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$gobackward?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Back</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m03" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$left?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Left</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m04" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$right?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Right</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m05" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$run?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Start (the program in the Writer document)</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m06" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$stop?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Stop</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m07" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$home?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Home</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m08" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$clearscreen?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Clear screen</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ <node oor:name="m09" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$commandline?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">FORWARD (fd), BACK (bk), LEFT (lt), RIGHT (rt) • fd 72, bk 1cm + 1in + 1", lt 90, rt 1.5h
+REPEAT num [ commands ], REPCOUNT • repeat 100 [ fd repcount lt 91 ]
+PENUP (pu), PENDOWN (pd), FILL, CLOSE, HOME, CLEARSCREEN (cs), PENSIZE (ps 5)
+PENCOLOR (pc), FILLCOLOR (fc) • pc “red”, pc 0xff0000, fc [255, 0, 0], fc any
+POSITION (pos), HEADING (seth) • pos [0, 0], pos pagesize, seth 60, seth [0, 0]
+CIRCLE, ELLIPSE, BOX, RECTANGLE • circle 10 ellipse [5, 9] box 10 rectangle [5, 2]
+LABEL, TEXT, PRINT • label “Some text”, circle 200 text “center of the actual shape”
+FONTFAMILY “Font” FONTSIZE 9 FONTCOLOR “red” FONTWEIGHT “bold”
+TO name arguments ... END, TO name arguments, OUTPUT return_value, END
+RANDOM, SQRT, INT, COUNT, ABS, SIN, COS, INPUT • ps random 100, print count “string”
+PICTURE (pic) [ ... ] • group different shapes: pic [ fd 100 circle 50 ]</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="ControlType" oor:type="xs:string">
+ <value>Editfield</value>
+ </prop>
+ <prop oor:name="Width" oor:type="xs:long">
+ <value>300</value>
+ </prop>
+ </node>
+ <node oor:name="m10" oor:op="replace">
+ <prop oor:name="Context" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument</value>
+ </prop>
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$__translate__?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Uppercase commands, also translate them to the language of the document</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="Images">
+ <node oor:name="logo-forward" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$goforward?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_arrowshapes.up-arrow.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_arrowshapes.up-arrow.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-backward" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$gobackward?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_arrowshapes.down-arrow.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_arrowshapes.down-arrow.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-left" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$left?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_arrowshapes.circular-leftarrow.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_arrowshapes.circular-leftarrow.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-right" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$right?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_arrowshapes.circular-arrow.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_arrowshapes.circular-arrow.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-run" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$run?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_runbasic.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_runbasic.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-stop" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$stop?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_basicstop.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_basicstop.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-home" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$home?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_navigationbarleft.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_navigationbarleft.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-clearscreen" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$clearscreen?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_newdoc.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_newdoc.png</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="logo-translate" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:librelogo-0.2.oxt|LibreLogo|LibreLogo.py$__translate__?language=Python&amp;location=user:uno_packages</value>
+ </prop>
+ <node oor:name="UserDefinedImages">
+ <prop oor:name="ImageSmallURL">
+ <value>%origin%/icons/sc_editglossary.png</value>
+ </prop>
+ <prop oor:name="ImageBigURL">
+ <value>%origin%/icons/lc_editglossary.png</value>
+ </prop>
+ </node>
+ </node>
+
+ </node>
+
+ </node>
+</oor:component-data>
diff --git a/librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu b/librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu
new file mode 100644
index 000000000000..4fb8fd9ae34f
--- /dev/null
+++ b/librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="StartModuleWindowState" oor:package="org.openoffice.Office.UI">
+ <node oor:name="UIElements">
+ <node oor:name="States">
+ <node oor:name="private:resource/toolbar/addon_LibreLogo.OfficeToolBar" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Logo</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="Locked" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu b/librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
new file mode 100644
index 000000000000..3a37baaac011
--- /dev/null
+++ b/librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI">
+ <node oor:name="UIElements">
+ <node oor:name="States">
+ <node oor:name="private:resource/toolbar/addon_LibreLogo.OfficeToolBar" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Logo</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ <prop oor:name="Locked" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+</oor:component-data>