1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 from Pyblio.Format.Generator import Generator as Base
22
23 import uno
24
25 _gc = uno.getConstantByName
26
27 ITALIC = (_gc("com.sun.star.awt.FontSlant.ITALIC"),
28 _gc("com.sun.star.awt.FontSlant.NONE"))
29
30 BOLD = (_gc("com.sun.star.awt.FontWeight.BOLD"),
31 _gc("com.sun.star.awt.FontWeight.NORMAL"))
32
33
35 """ Returns an object capable of transforming an abstract
36 representation of text into actual text in OpenOffice."""
37
39 self.t = text
40 self.c = cursor
41 self.first = False
42 return
43
45 self.t.insertString(self.c, t, False)
46
48 self.c.CharPosture = ITALIC[0]
49 for s in t.children: self(s)
50 self.c.CharPosture = ITALIC[1]
51
53 self.c.CharWeight = BOLD[0]
54 for s in t.children: self(s)
55 self.c.CharWeight = BOLD[1]
56
58 self.t.insertString(self.c, u'\x0a', False)
59
62
64 if self.first:
65 self.first = False
66 else:
67 self.t.insertString(self.c, u'\x0d', False)
68 self.t.insertString(self.c, u'[%s]\xa0' % key, False)
69