* src/BaseDoc.py:
* src/docgen/PSDrawDoc.py: * src/docgen/SvgDrawDoc.py: * src/docgen/PdfDoc.py: * src/docgen/OpenOfficeDoc.py: * src/docgen/GtkPrint.py: * src/docgen/LPRDoc.py: * src/docgen/ODFDoc.py: * src/plugins/AncestorChart2.py: * src/plugins/DescendChart.py: * src/plugins/StatisticsChart.py: * src/plugins/TimeLine.py: Remove height and width from GraphicsStyle svn: r8237
This commit is contained in:
@@ -418,7 +418,7 @@ class GtkDoc(BaseDoc.BaseDoc):
|
||||
def draw_path(self,style,path):
|
||||
pass
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self,style,text,x,y, w, h):
|
||||
pass
|
||||
|
||||
def draw_text(self,style,text,x,y):
|
||||
|
||||
@@ -1056,7 +1056,7 @@ class LPRDoc(BaseDoc.BaseDoc):
|
||||
|
||||
self.gpc.setrgbcolor(0,0,0)
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self,style,text,x,y, w, h):
|
||||
#assuming that we start drawing box from current position
|
||||
|
||||
self.brand_new_page = 0
|
||||
@@ -1067,8 +1067,8 @@ class LPRDoc(BaseDoc.BaseDoc):
|
||||
para_name = box_style.get_paragraph_style()
|
||||
para_style = self.style_list[para_name]
|
||||
fontstyle = para_style.get_font()
|
||||
bh = cm2u(box_style.get_height())
|
||||
bw = cm2u(box_style.get_width())
|
||||
bh = cm2u(h)
|
||||
bw = cm2u(w)
|
||||
|
||||
if box_style.get_shadow():
|
||||
ss = cm2u(box_style.get_shadow_space())
|
||||
|
||||
@@ -62,6 +62,7 @@ _esc_map = {
|
||||
'\x1a' : '',
|
||||
'\x0c' : '',
|
||||
'\n' : '<text:line-break/>',
|
||||
'\t' : '<text:tab-stop/>',
|
||||
'<super>' : '<text:span text:style-name="GSuper">',
|
||||
'</super>' : '</text:span>',
|
||||
}
|
||||
@@ -1049,10 +1050,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
|
||||
pstyle = self.style_list[para_name]
|
||||
font = pstyle.get_font()
|
||||
if box_style.get_width():
|
||||
sw = box_style.get_width()*1.2
|
||||
else:
|
||||
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
||||
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
||||
|
||||
self.cntnt.write('<draw:frame text:anchor-type="paragraph" ')
|
||||
self.cntnt.write('draw:z-index="2" ')
|
||||
@@ -1084,7 +1082,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('svg:y="%.2fcm">' % float(y))
|
||||
self.cntnt.write('</draw:rect>\n')
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self,style,text,x,y, w, h):
|
||||
box_style = self.draw_styles[style]
|
||||
para_name = box_style.get_paragraph_style()
|
||||
shadow_width = box_style.get_shadow_space()
|
||||
@@ -1094,8 +1092,8 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('draw:style-name="%s_shadow" ' % style)
|
||||
self.cntnt.write('draw:z-index="0" ')
|
||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||
self.cntnt.write('svg:width="%.2fcm" ' % box_style.get_width())
|
||||
self.cntnt.write('svg:height="%.2fcm" ' % box_style.get_height())
|
||||
self.cntnt.write('svg:width="%.2fcm" ' % w)
|
||||
self.cntnt.write('svg:height="%.2fcm" ' % h)
|
||||
self.cntnt.write('svg:x="%.2fcm" ' % (float(x)+shadow_width))
|
||||
self.cntnt.write('svg:y="%.2fcm">\n' % (float(y)+shadow_width))
|
||||
self.cntnt.write('</draw:rect>\n')
|
||||
@@ -1104,16 +1102,14 @@ class ODFDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('draw:style-name="%s" ' % style)
|
||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||
self.cntnt.write('draw:z-index="1" ')
|
||||
self.cntnt.write('svg:width="%.2fcm" ' % box_style.get_width())
|
||||
self.cntnt.write('svg:height="%.2fcm" ' % box_style.get_height())
|
||||
self.cntnt.write('svg:width="%.2fcm" ' % w)
|
||||
self.cntnt.write('svg:height="%.2fcm" ' % h)
|
||||
self.cntnt.write('svg:x="%.2fcm" ' % float(x))
|
||||
self.cntnt.write('svg:y="%.2fcm">\n' % float(y))
|
||||
if text != "":
|
||||
self.cntnt.write('<text:p text:style-name="%s">' % para_name)
|
||||
self.cntnt.write('<text:span text:style-name="F%s">' % para_name)
|
||||
text = text.replace('\t','<text:tab-stop/>')
|
||||
text = text.replace('\n','<text:line-break/>')
|
||||
self.cntnt.write(escape(text))
|
||||
self.cntnt.write(escape(text,_esc_map))
|
||||
self.cntnt.write('</text:span>')
|
||||
self.cntnt.write('</text:p>\n')
|
||||
self.cntnt.write('</draw:rect>\n')
|
||||
|
||||
@@ -896,11 +896,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
||||
|
||||
pstyle = self.style_list[para_name]
|
||||
font = pstyle.get_font()
|
||||
if box_style.get_width():
|
||||
sw = box_style.get_width()
|
||||
else:
|
||||
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
||||
|
||||
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
||||
|
||||
self.cntnt.write('<draw:text-box draw:style-name="%s" ' % style)
|
||||
self.cntnt.write('draw:layer="layout" ')
|
||||
@@ -929,7 +925,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('svg:y="%.3fcm">' % float(y))
|
||||
self.cntnt.write('</draw:rect>\n')
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self,style,text,x,y, w, h):
|
||||
box_style = self.draw_styles[style]
|
||||
para_name = box_style.get_paragraph_style()
|
||||
shadow_width = box_style.get_shadow_space()
|
||||
@@ -939,8 +935,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('draw:style-name="%s_shadow" ' % style)
|
||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||
self.cntnt.write('draw:z-index="0" ')
|
||||
self.cntnt.write('svg:width="%.3fcm" ' % box_style.get_width())
|
||||
self.cntnt.write('svg:height="%.3fcm" ' % box_style.get_height())
|
||||
self.cntnt.write('svg:width="%.3fcm" ' % w)
|
||||
self.cntnt.write('svg:height="%.3fcm" ' % h)
|
||||
self.cntnt.write('svg:x="%.3fcm" ' % (float(x)+shadow_width))
|
||||
self.cntnt.write('svg:y="%.3fcm">\n' % (float(y)+shadow_width))
|
||||
self.cntnt.write('</draw:rect>\n')
|
||||
@@ -949,8 +945,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
||||
self.cntnt.write('draw:style-name="%s" ' % style)
|
||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||
self.cntnt.write('draw:z-index="1" ')
|
||||
self.cntnt.write('svg:width="%.3fcm" ' % box_style.get_width())
|
||||
self.cntnt.write('svg:height="%.3fcm" ' % box_style.get_height())
|
||||
self.cntnt.write('svg:width="%.3fcm" ' % w)
|
||||
self.cntnt.write('svg:height="%.3fcm" ' % h)
|
||||
self.cntnt.write('svg:x="%.3fcm" ' % float(x))
|
||||
self.cntnt.write('svg:y="%.3fcm">\n' % float(y))
|
||||
if text != "":
|
||||
|
||||
@@ -324,42 +324,40 @@ class PSDrawDoc(BaseDoc.BaseDoc):
|
||||
self.f.write('%s %s %s setrgbcolor stroke\n' % lrgb(color))
|
||||
self.f.write('grestore\n')
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self,style,text,x,y, w, h):
|
||||
x = x + self.paper.get_left_margin()
|
||||
y = y + self.paper.get_top_margin()
|
||||
|
||||
box_style = self.draw_styles[style]
|
||||
para_name = box_style.get_paragraph_style()
|
||||
p = self.style_list[para_name]
|
||||
|
||||
bh = box_style.get_height()
|
||||
bw = box_style.get_width()
|
||||
|
||||
self.f.write('gsave\n')
|
||||
|
||||
shadsize = box_style.get_shadow_space()
|
||||
if box_style.get_shadow():
|
||||
self.f.write('newpath\n')
|
||||
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x+shadsize,y+shadsize)))
|
||||
self.f.write('0 -%s cm rlineto\n' % gformat(bh))
|
||||
self.f.write('%s cm 0 rlineto\n' % gformat(bw))
|
||||
self.f.write('0 %s cm rlineto\n' % gformat(bh))
|
||||
self.f.write('0 -%s cm rlineto\n' % gformat(h))
|
||||
self.f.write('%s cm 0 rlineto\n' % gformat(w))
|
||||
self.f.write('0 %s cm rlineto\n' % gformat(h))
|
||||
self.f.write('closepath\n')
|
||||
self.f.write('.5 setgray\n')
|
||||
self.f.write('fill\n')
|
||||
self.f.write('newpath\n')
|
||||
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x,y)))
|
||||
self.f.write('0 -%s cm rlineto\n' % gformat(bh))
|
||||
self.f.write('%s cm 0 rlineto\n' % gformat(bw))
|
||||
self.f.write('0 %s cm rlineto\n' % gformat(bh))
|
||||
self.f.write('0 -%s cm rlineto\n' % gformat(h))
|
||||
self.f.write('%s cm 0 rlineto\n' % gformat(w))
|
||||
self.f.write('0 %s cm rlineto\n' % gformat(h))
|
||||
self.f.write('closepath\n')
|
||||
self.f.write('1 setgray\n')
|
||||
self.f.write('fill\n')
|
||||
self.f.write('newpath\n')
|
||||
if box_style.get_line_width():
|
||||
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x,y)))
|
||||
self.f.write('0 -%s cm rlineto\n' % gformat(bh))
|
||||
self.f.write('%s cm 0 rlineto\n' % gformat(bw))
|
||||
self.f.write('0 %s cm rlineto\n' % gformat(bh))
|
||||
self.f.write('0 -%s cm rlineto\n' % gformat(h))
|
||||
self.f.write('%s cm 0 rlineto\n' % gformat(w))
|
||||
self.f.write('0 %s cm rlineto\n' % gformat(h))
|
||||
self.f.write('closepath\n')
|
||||
self.f.write('%s setlinewidth\n' % gformat(box_style.get_line_width()))
|
||||
self.f.write('%s %s %s setrgbcolor stroke\n' % lrgb(box_style.get_color()))
|
||||
@@ -372,7 +370,7 @@ class PSDrawDoc(BaseDoc.BaseDoc):
|
||||
mar = 10/28.35
|
||||
f_in_cm = p.get_font().get_size()/28.35
|
||||
fs = f_in_cm * 1.2
|
||||
center = y + (bh + fs)/2.0 + (fs*shadsize)
|
||||
center = y + (h + fs)/2.0 + (fs*shadsize)
|
||||
ystart = center - (fs/2.0) * nlines
|
||||
for i in range(nlines):
|
||||
ypos = ystart + (i * fs)
|
||||
|
||||
@@ -472,22 +472,19 @@ class PdfDoc(BaseDoc.BaseDoc):
|
||||
p.closePath()
|
||||
self.drawing.add(p)
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self,style,text,x,y, w, h):
|
||||
y = self.get_usable_height() - y
|
||||
|
||||
box_style = self.draw_styles[style]
|
||||
para_name = box_style.get_paragraph_style()
|
||||
p = self.style_list[para_name]
|
||||
|
||||
w = box_style.get_width()*cm
|
||||
h = box_style.get_height()*cm
|
||||
|
||||
sspace = box_style.get_shadow_space()
|
||||
if box_style.get_shadow():
|
||||
col = make_color((0xc0,0xc0,0xc0))
|
||||
r = reportlab.graphics.shapes.Rect((x+sspace)*cm,
|
||||
(y-sspace)*cm-h,
|
||||
w,h,
|
||||
w*cm,h*cm,
|
||||
fillColor=col,
|
||||
strokeColor=col)
|
||||
self.drawing.add(r)
|
||||
@@ -495,7 +492,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
||||
sw = box_style.get_line_width()
|
||||
fc = box_style.get_fill_color()
|
||||
sc = box_style.get_color()
|
||||
r = reportlab.graphics.shapes.Rect((x)*cm,(y*cm)-h,w,h,
|
||||
r = reportlab.graphics.shapes.Rect((x)*cm,(y*cm)-(h*cm),w*cm,h*cm,
|
||||
strokeWidth=sw,
|
||||
fillColor=fc,
|
||||
strokeColor=sc)
|
||||
|
||||
@@ -170,28 +170,26 @@ class SvgDrawDoc(BaseDoc.BaseDoc):
|
||||
self.f.write('stroke:#%02x%02x%02x; ' % s.get_color())
|
||||
self.f.write('stroke-width:%.2f;"/>\n' % s.get_line_width())
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self,style,text,x,y, w, h):
|
||||
x = x + self.paper.get_left_margin()
|
||||
y = y + self.paper.get_top_margin()
|
||||
|
||||
box_style = self.draw_styles[style]
|
||||
para_name = box_style.get_paragraph_style()
|
||||
p = self.style_list[para_name]
|
||||
|
||||
bh = box_style.get_height()
|
||||
bw = box_style.get_width()
|
||||
box_style = self.draw_styles[style]
|
||||
para_name = box_style.get_paragraph_style()
|
||||
p = self.style_list[para_name]
|
||||
|
||||
if box_style.get_shadow():
|
||||
self.f.write('<rect ')
|
||||
self.f.write('x="%4.2fcm" ' % (x+0.15))
|
||||
self.f.write('y="%4.2fcm" ' % (y+0.15))
|
||||
self.f.write('width="%4.2fcm" ' % bw)
|
||||
self.f.write('height="%4.2fcm" ' % bh)
|
||||
self.f.write('width="%4.2fcm" ' % w)
|
||||
self.f.write('height="%4.2fcm" ' % h)
|
||||
self.f.write('style="fill:#808080; stroke:#808080; stroke-width:1;"/>\n')
|
||||
self.f.write('<rect ')
|
||||
self.f.write('x="%4.2fcm" ' % x)
|
||||
self.f.write('y="%4.2fcm" ' % y)
|
||||
self.f.write('width="%4.2fcm" ' % bw)
|
||||
self.f.write('height="%4.2fcm" ' % bh)
|
||||
self.f.write('width="%4.2fcm" ' % w)
|
||||
self.f.write('height="%4.2fcm" ' % h)
|
||||
self.f.write('style="fill:#%02x%02x%02x; ' % box_style.get_fill_color())
|
||||
self.f.write('stroke:#%02x%02x%02x; ' % box_style.get_color())
|
||||
self.f.write('stroke-width:%f;"/>\n' % box_style.get_line_width())
|
||||
@@ -202,7 +200,7 @@ class SvgDrawDoc(BaseDoc.BaseDoc):
|
||||
nlines = len(lines)
|
||||
mar = 10/28.35
|
||||
fs = (font_size/28.35) * 1.2
|
||||
center = y + (bh + fs)/2.0 + (fs*0.2)
|
||||
center = y + (h + fs)/2.0 + (fs*0.2)
|
||||
ystart = center - (fs/2.0) * nlines
|
||||
for i in range(nlines):
|
||||
ypos = ystart + (i * fs)
|
||||
|
||||
Reference in New Issue
Block a user