xref: /trunk/test/odf-validate/fixtures/ole-text-edge/make.py (revision 0e16a31d78a652c56c5c0fc79c752f48b9048df9)
1# usage: runpy.sh fixtures/ole-text-edge/make.py <port> <out.odg>   (office saving ODF 1.2 Extended)
2# OLE shapes whose text is: none, a label, one space, a line break only, a date field only.
3import sys, uno
4from unohelp import connect, desktop, pv
5from com.sun.star.awt import Size, Point
6
7port, out = int(sys.argv[1]), sys.argv[2]
8d = desktop(connect(port))
9doc = d.loadComponentFromURL("private:factory/sdraw", "_blank", 0, (pv("Hidden", True),))
10page = doc.DrawPages.getByIndex(0)
11for i, text in enumerate(("", "OLE label", " ", "\n", None)):
12    s = doc.createInstance("com.sun.star.drawing.OLE2Shape")
13    s.CLSID = "078B7ABA-54FC-457F-8551-6147e776a997"
14    page.add(s)
15    s.Position = Point(1000 + i * 5000, 2000); s.Size = Size(4000, 3000)
16    if text is None:
17        f = doc.createInstance("com.sun.star.text.TextField.DateTime")
18        f.IsFixed = True
19        f.IsDate = True
20        s.insertTextContent(s.createTextCursor(), f, False)
21    elif text:
22        s.String = text
23doc.storeToURL(uno.systemPathToFileUrl(out), (pv("FilterName", "draw8"),))
24doc.close(True)
25