* src/docgen/PSDrawDoc.py: Scaleable shadow

* src/docgen/OpenOfficeDoc.py: Scaleable shadow
* src/docgen/KwordDoc.py (KwordDoc.close): handle KWord mime type
* src/grampslib_wrap.c: handle NULL pointers


svn: r2614
This commit is contained in:
Don Allingham 2004-01-09 03:16:48 +00:00
parent 7c66298bf8
commit 02be6b99f1
2 changed files with 15 additions and 12 deletions

View File

@ -909,6 +909,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
def draw_box(self,style,text,x,y): def draw_box(self,style,text,x,y):
box_style = self.draw_styles[style] box_style = self.draw_styles[style]
para_name = box_style.get_paragraph_style() para_name = box_style.get_paragraph_style()
shadow_width = box_style.get_shadow_space()
self.f.write('<draw:rect text:anchor-type="paragraph" ') self.f.write('<draw:rect text:anchor-type="paragraph" ')
self.f.write('draw:style-name="%s_shadow" ' % style) self.f.write('draw:style-name="%s_shadow" ' % style)
@ -916,8 +917,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.f.write('draw:z-index="0" ') self.f.write('draw:z-index="0" ')
self.f.write('svg:width="%.3fcm" ' % box_style.get_width()) self.f.write('svg:width="%.3fcm" ' % box_style.get_width())
self.f.write('svg:height="%.3fcm" ' % box_style.get_height()) self.f.write('svg:height="%.3fcm" ' % box_style.get_height())
self.f.write('svg:x="%.3fcm" ' % (float(x)+0.2)) self.f.write('svg:x="%.3fcm" ' % (float(x)+shadow_width))
self.f.write('svg:y="%.3fcm">\n' % (float(y)+0.2)) self.f.write('svg:y="%.3fcm">\n' % (float(y)+shadow_width))
self.f.write('</draw:rect>\n') self.f.write('</draw:rect>\n')
self.f.write('<draw:rect text:anchor-type="paragraph" ') self.f.write('<draw:rect text:anchor-type="paragraph" ')

View File

@ -332,15 +332,17 @@ class PSDrawDoc(BaseDoc.BaseDoc):
bh = box_style.get_height() bh = box_style.get_height()
bw = box_style.get_width() bw = box_style.get_width()
self.f.write('gsave\n') self.f.write('gsave\n')
# if box_style.get_shadow():
self.f.write('newpath\n') shadsize = box_style.get_shadow_space()
self.f.write('%f cm %f cm moveto\n' % self.translate(x+0.15,y+0.15)) if box_style.get_shadow():
self.f.write('0 -%f cm rlineto\n' % bh) self.f.write('newpath\n')
self.f.write('%f cm 0 rlineto\n' % bw) self.f.write('%f cm %f cm moveto\n' % self.translate(x+shadsize,y+shadsize))
self.f.write('0 %f cm rlineto\n' % bh) self.f.write('0 -%f cm rlineto\n' % bh)
self.f.write('closepath\n') self.f.write('%f cm 0 rlineto\n' % bw)
self.f.write('.5 setgray\n') self.f.write('0 %f cm rlineto\n' % bh)
self.f.write('fill\n') self.f.write('closepath\n')
self.f.write('.5 setgray\n')
self.f.write('fill\n')
self.f.write('newpath\n') self.f.write('newpath\n')
self.f.write('%f cm %f cm moveto\n' % self.translate(x,y)) self.f.write('%f cm %f cm moveto\n' % self.translate(x,y))
self.f.write('0 -%f cm rlineto\n' % bh) self.f.write('0 -%f cm rlineto\n' % bh)
@ -364,7 +366,7 @@ class PSDrawDoc(BaseDoc.BaseDoc):
mar = 10/28.35 mar = 10/28.35
f_in_cm = p.get_font().get_size()/28.35 f_in_cm = p.get_font().get_size()/28.35
fs = f_in_cm * 1.2 fs = f_in_cm * 1.2
center = y + (bh + fs)/2.0 + (fs*0.2) center = y + (bh + fs)/2.0 + (fs*shadsize)
ystart = center - (fs/2.0) * nlines ystart = center - (fs/2.0) * nlines
for i in range(nlines): for i in range(nlines):
ypos = ystart + (i * fs) ypos = ystart + (i * fs)