From: F J Franklin (F.J.Franklin@sheffield.ac.uk)
Date: Tue Oct 22 2002 - 04:53:04 EDT
> When saving a file which has previously been loaded or
> when loading after a file has been saved, we attempt
> to synchronize the two filetypes.
My feeling is that this should be done by each importer and exporter. They
know best who their "opposite number" is, or even whether there is an
opposite number.
> A better system would replace the numeric filetype
> with an ASCII string ID specifically designed to be
> passed around as a filetype and to be checkable to
> synchronize importers and exporters.
I started working on this last night. Each importer/exporter has a name.
Those internal to AbiWord start with "AbiWord::" and those provided by
plug-ins should start with "<plug-in name>::" - a primitive namespacing
that ties in with the unique naming of plug-ins.
The :: is then followed by the description, e.g.
"AbiWord::AWML11"
"AbiWord::AWML11/compressed"
"AbiWord::AWML11/template"
"AbiWord::RTF"
"AbiWord::RTF (attic)"
"AbiWord::RTF (!MSWord)"
...
These internal ones get #defined in ie_types.h
Importers and exporters can then be looked up by name.
Where it gets interesting is in cases like "AbiWord::HTML", the HTML4
exporter, which exists only as an exporter, although there may be an HTML
import plug-in available. In this case the exporter can't suggest a
"preferred importer" because there may be none, but it can set a MIME type
which AbiWord can use later, i.e. "text/html". Similarly the other HTML
exporters "AbiWord::HTML (XHTML)" & "AbiWord::HTML (XHTML+PHP)" would set
the MIME type to be "application/xhtml" (I think that's right).
Need to add a
UT_Confidence supportsMimeType (const char * pszMimeType);
method to the sniffers.
Of course, not all formats have a registered MIME type, so we may need to
get imaginitive, but I don't think that's too much of a problem.
Plug-ins add the extra complication that they can be
loaded/unloaded/reloaded, and therefore the use of an exporter once does
not guarantee the future existence of the same exporter. Similarly for
importers. The MIME type (or pseudo-MIME type) info provides a fall-back.
Regards, Frank
Francis James Franklin
F.J.Franklin@shef.ac.uk
`Medium atomic weights are available: Gold, Lead, Copper, Jet, Diamond,
Radium, Sapphire, Silver and Steel.
`Sapphire and Steel have been assigned...'
This archive was generated by hypermail 2.1.4 : Tue Oct 22 2002 - 05:00:44 EDT