Commit 30149e93 authored by Jérome Perrin's avatar Jérome Perrin

Generate different replacement text for openoffice 1 and openoffice 2.

This generates valid ODF for openoffice 2 documents. Behaviour unchanged for
openoffice 1 documents.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19846 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 587d8392
...@@ -415,15 +415,27 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0"> ...@@ -415,15 +415,27 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0">
# XXX: Pictures directory not managed (seems facultative) # XXX: Pictures directory not managed (seems facultative)
# <manifest:file-entry manifest:media-type="" manifest:full-path="ObjBFE4F50D/Pictures/"/> # <manifest:file-entry manifest:media-type="" manifest:full-path="ObjBFE4F50D/Pictures/"/>
is_legacy = ('oasis.opendocument' not in self.content_type) is_legacy = ('oasis.opendocument' not in self.content_type)
replacement = """<draw:image draw:style-name="%s" draw:name="ERP5Image%d" if is_legacy:
text:anchor-type="paragraph" svg:x="%s" svg:y="%s" replacement = """<draw:image draw:style-name="%s" draw:name="ERP5Image%d"
svg:width="%.3fcm" svg:height="%.3fcm" xlink:href="%sPictures/%s" text:anchor-type="paragraph" svg:x="%s" svg:y="%s"
xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/> svg:width="%.3fcm" svg:height="%.3fcm" xlink:href="#Pictures/%s"
""" % (options_dict['style'], actual_idx, xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
options_dict['x'], options_dict['y'], """ % (options_dict['style'], actual_idx,
w, h, options_dict['x'], options_dict['y'],
is_legacy and '#' or '', w, h,
pic_name.split('/')[-1] ) pic_name.split('/')[-1] )
else:
replacement = """<draw:frame draw:style-name="%s" draw:name="ERP5Image%d"
text:anchor-type="paragraph" svg:x="%s" svg:y="%s"
svg:width="%.3fcm" svg:height="%.3fcm">
<draw:image xlink:href="Pictures/%s" xlink:type="simple"
xlink:show="embed" xlink:actuate="onLoad"/>
</draw:frame>
""" % (options_dict['style'], actual_idx,
options_dict['x'], options_dict['y'],
w, h,
pic_name.split('/')[-1] )
if not (self.content_type.endswith('draw') or if not (self.content_type.endswith('draw') or
self.content_type.endswith('presentation') or self.content_type.endswith('presentation') or
self.content_type.endswith('writer') or self.content_type.endswith('writer') or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment