* src/docgen/OpenOfficeDoc.py: Make the output conform to the DTDs

for OpenOffice.org XML


svn: r4914
This commit is contained in:
Julio Sánchez 2005-07-08 23:13:29 +00:00
parent 7ee891943f
commit 830356f1fd
2 changed files with 22 additions and 25 deletions

View File

@ -1,3 +1,7 @@
2005-07-09 Julio Sanchez <jsanchez@users.sourceforge.net>
* src/docgen/OpenOfficeDoc.py: Make the output conform to the DTDs
for OpenOffice.org XML
2005-07-08 Alex Roitman <shura@gramps-project.org> 2005-07-08 Alex Roitman <shura@gramps-project.org>
* src/plugins/GraphViz.py: Use single margin value, properly use * src/plugins/GraphViz.py: Use single margin value, properly use
cm for margin, properly use 2 digits after converting to inches. cm for margin, properly use 2 digits after converting to inches.

View File

@ -152,9 +152,9 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.cntnt.write('draw:fill-color="#%02x%02x%02x" ' % style.get_fill_color()) self.cntnt.write('draw:fill-color="#%02x%02x%02x" ' % style.get_fill_color())
if style.get_line_style() == BaseDoc.DASHED: if style.get_line_style() == BaseDoc.DASHED:
self.cntnt.write('draw:color="#cccccc" ') self.cntnt.write('svg:stroke-color="#cccccc" ')
else: else:
self.cntnt.write('draw:color="#%02x%02x%02x" ' % style.get_color()) self.cntnt.write('svg:stroke-color="#%02x%02x%02x" ' % style.get_color())
if style.get_line_width(): if style.get_line_width():
self.cntnt.write('draw:stroke="solid" ') self.cntnt.write('draw:stroke="solid" ')
@ -304,10 +304,10 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
#Begin photo style #Begin photo style
self.cntnt.write('<style:style style:name="Left" style:family="graphics"') self.cntnt.write('<style:style style:name="Left" style:family="graphics"')
self.cntnt.write(' style:parent-name="photo">') self.cntnt.write(' style:parent-style-name="photo">')
self.cntnt.write('<style:properties style:run-through="foreground"') self.cntnt.write('<style:properties style:run-through="foreground"')
self.cntnt.write(' style:wrap="parallel"') self.cntnt.write(' style:wrap="parallel"')
self.cntnt.write(' style:numer-wrapped-paragraphs="no-limit"') self.cntnt.write(' style:number-wrapped-paragraphs="no-limit"')
self.cntnt.write(' style:wrap-contour="false" style:vertical-pos="from-top"') self.cntnt.write(' style:wrap-contour="false" style:vertical-pos="from-top"')
self.cntnt.write(' style:vertical-rel="paragraph-content"') self.cntnt.write(' style:vertical-rel="paragraph-content"')
self.cntnt.write(' style:horizontal-pos="left"') self.cntnt.write(' style:horizontal-pos="left"')
@ -320,10 +320,10 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.cntnt.write('</style:style>\n') self.cntnt.write('</style:style>\n')
self.cntnt.write('<style:style style:name="Right" style:family="graphics"') self.cntnt.write('<style:style style:name="Right" style:family="graphics"')
self.cntnt.write(' style:parent-name="photo">') self.cntnt.write(' style:parent-style-name="photo">')
self.cntnt.write('<style:properties style:run-through="foreground"') self.cntnt.write('<style:properties style:run-through="foreground"')
self.cntnt.write(' style:wrap="parallel"') self.cntnt.write(' style:wrap="parallel"')
self.cntnt.write(' style:numer-wrapped-paragraphs="no-limit"') self.cntnt.write(' style:number-wrapped-paragraphs="no-limit"')
self.cntnt.write(' style:wrap-contour="false" style:vertical-pos="from-top"') self.cntnt.write(' style:wrap-contour="false" style:vertical-pos="from-top"')
self.cntnt.write(' style:vertical-rel="paragraph-content"') self.cntnt.write(' style:vertical-rel="paragraph-content"')
self.cntnt.write(' style:horizontal-pos="right"') self.cntnt.write(' style:horizontal-pos="right"')
@ -336,7 +336,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.cntnt.write('</style:style>\n') self.cntnt.write('</style:style>\n')
self.cntnt.write('<style:style style:name="Single" style:family="graphics"') self.cntnt.write('<style:style style:name="Single" style:family="graphics"')
self.cntnt.write(' style:parent-name="Graphics">') self.cntnt.write(' style:parent-style-name="Graphics">')
self.cntnt.write('<style:properties style:vertical-pos="from-top"') self.cntnt.write('<style:properties style:vertical-pos="from-top"')
self.cntnt.write(' style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)"') self.cntnt.write(' style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)"')
self.cntnt.write(' draw:luminance="0%" draw:contrast="0" draw:red="0%"') self.cntnt.write(' draw:luminance="0%" draw:contrast="0" draw:red="0%"')
@ -346,7 +346,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.cntnt.write('</style:style>\n') self.cntnt.write('</style:style>\n')
self.cntnt.write('<style:style style:name="Row" style:family="graphics"') self.cntnt.write('<style:style style:name="Row" style:family="graphics"')
self.cntnt.write(' style:parent-name="Graphics">') self.cntnt.write(' style:parent-style-name="Graphics">')
self.cntnt.write('<style:properties style:vertical-pos="from-top"') self.cntnt.write('<style:properties style:vertical-pos="from-top"')
self.cntnt.write(' style:vertical-rel="paragraph"') self.cntnt.write(' style:vertical-rel="paragraph"')
self.cntnt.write(' style:horizontal-pos="from-left"') self.cntnt.write(' style:horizontal-pos="from-left"')
@ -512,7 +512,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.sfile.write('xmlns:math="http://www.w3.org/1998/Math/MathML" ') self.sfile.write('xmlns:math="http://www.w3.org/1998/Math/MathML" ')
self.sfile.write('xmlns:form="http://openoffice.org/2000/form" ') self.sfile.write('xmlns:form="http://openoffice.org/2000/form" ')
self.sfile.write('xmlns:script="http://openoffice.org/2000/script" ') self.sfile.write('xmlns:script="http://openoffice.org/2000/script" ')
self.sfile.write('office:class="text" office:version="0.9">\n') self.sfile.write('office:version="0.9">\n')
self.sfile.write('<office:font-decls>\n') self.sfile.write('<office:font-decls>\n')
self.sfile.write('<style:font-decl style:name="Times New Roman" ') self.sfile.write('<style:font-decl style:name="Times New Roman" ')
self.sfile.write('fo:font-family="&apos;Times New Roman&apos;" ') self.sfile.write('fo:font-family="&apos;Times New Roman&apos;" ')
@ -629,22 +629,15 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.sfile.write('</style:page-master>\n') self.sfile.write('</style:page-master>\n')
self.sfile.write('</office:automatic-styles>\n') self.sfile.write('</office:automatic-styles>\n')
self.sfile.write('<office:master-styles>\n') self.sfile.write('<office:master-styles>\n')
self.sfile.write('<draw:layer-set>\n')
self.sfile.write('<draw:layer draw:name="layout"/>\n')
self.sfile.write('<draw:layer draw:name="background"/>\n')
self.sfile.write('<draw:layer draw:name="backgroundobjects"/>\n')
self.sfile.write('<draw:layer draw:name="controls"/>\n')
self.sfile.write('<draw:layer draw:name="measurelines"/>\n')
self.sfile.write('</draw:layer-set>\n')
self.sfile.write('<style:master-page style:name="Standard" ') self.sfile.write('<style:master-page style:name="Standard" ')
self.sfile.write('style:page-master-name="pm1"/>\n') self.sfile.write('style:page-master-name="pm1"/>\n')
self.sfile.write('<draw:layer-set>\n')
self.sfile.write('<draw:layer draw:name="layout" draw:locked="false" ')
self.sfile.write('draw:printable="true" draw:visible="true"/>\n')
self.sfile.write('<draw:layer draw:name="background" draw:locked="false" ')
self.sfile.write('draw:printable="true" draw:visible="true"/>\n')
self.sfile.write('<draw:layer draw:name="backgroundobjects" ')
self.sfile.write('draw:locked="false" draw:printable="true" draw:visible="true"/>\n')
self.sfile.write('<draw:layer draw:name="controls" draw:locked="false" ')
self.sfile.write('draw:printable="true" draw:visible="true"/>\n')
self.sfile.write('<draw:layer draw:name="measurelines" draw:locked="false" ')
self.sfile.write('draw:printable="true" draw:visible="true"/>\n')
self.sfile.write('</draw:layer-set>\n')
self.sfile.write('<style:master-page style:name="Home" ')
self.sfile.write('style:page-master-name="PM0" draw:style-name="dp1"/>\n')
self.sfile.write('</office:master-styles>\n') self.sfile.write('</office:master-styles>\n')
self.sfile.write('</office:document-styles>\n') self.sfile.write('</office:document-styles>\n')
@ -755,7 +748,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.meta.write('xmlns:xlink="http://www.w3.org/1999/xlink" ') self.meta.write('xmlns:xlink="http://www.w3.org/1999/xlink" ')
self.meta.write('xmlns:dc="http://purl.org/dc/elements/1.1/" ') self.meta.write('xmlns:dc="http://purl.org/dc/elements/1.1/" ')
self.meta.write('xmlns:meta="http://openoffice.org/2000/meta" ') self.meta.write('xmlns:meta="http://openoffice.org/2000/meta" ')
self.meta.write('office:class="text" office:version="0.9">\n'); self.meta.write('office:version="0.9">\n');
self.meta.write('<office:meta>\n') self.meta.write('<office:meta>\n')
self.meta.write('<meta:generator>') self.meta.write('<meta:generator>')
self.meta.write(const.progName + ' ' + const.version) self.meta.write(const.progName + ' ' + const.version)
@ -850,7 +843,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.cntnt.write('"/>\n') self.cntnt.write('"/>\n')
def draw_line(self,style,x1,y1,x2,y2): def draw_line(self,style,x1,y1,x2,y2):
self.cntnt.write('<draw:line draw:style="%s" '% style) self.cntnt.write('<draw:line draw:style-name="%s" '% style)
self.cntnt.write('svg:x1="%.3fcm" ' % x1) self.cntnt.write('svg:x1="%.3fcm" ' % x1)
self.cntnt.write('svg:y1="%.3fcm" ' % y1) self.cntnt.write('svg:y1="%.3fcm" ' % y1)
self.cntnt.write('svg:x2="%.3fcm" ' % x2) self.cntnt.write('svg:x2="%.3fcm" ' % x2)