[File] [PATCH] of Magdir/wordprocessors for Star-, Open-, Libre-Office Gallery *.thm

Christos Zoulas christos at zoulas.com
Fri Oct 25 20:16:15 UTC 2019


On Oct 25,  3:28pm, joerg.jen.der.ek at gmx.net (=?UTF-8?Q?J=c3=b6rg_Jenderek?=) wrote:
-- Subject: [File] [PATCH] of Magdir/wordprocessors for Star-, Open-, Libre-O

| Hello,
| some days ago i run file command inside LibreOffice directories. In
| sub directory gallery there files of Office Galleries are stored.
| 
| Apparently a gallery consist of some files. For every gallery beside
| the SDG file there seems to exist files with same main name but with
| extension sdv, thm and sometimes str. I will handle here only
| THM files and the other files in a future session.
| 
| The samples with file name extension thm are described by file command
| version 5.37 only as data.
| 
| The same gallery format is already used in old StarOffice 5.2 dated
| about May 2000. And the format is still used in actual LibreOffice
| with version 6.3.2.2. The gallery is also used in OpenOffice.
| 
| So i add comment line to Magdir/wordprocessors like
| # URL:		https://en.wikipedia.org/wiki/StarOffice
| 
| Unfortunately i find no file format specification for such THM parts.
| So i rely on my own observations.
| 
| All THM examples start with the same 2 byte sequence. This is used as
| first test by line
|  0		ubeshort	0x0400
| 
| Afterwards the name of Gallery theme is stored as Pascal string. This
| information is later shown by line
|  >>2		pstring/h	x		%s
| 
| Unfortunately the  first test is not unique enough. This matches also
| bad example file2147.chk. There bytes 3 and 4 are null. Lowest found
| value was 2 for sg16.thm with name "3D". So skip this bad example by
| looking for positive theme name length by magic line
|  >2		uleshort	>0	StarOffice Gallery theme
| 
| Some sites on the net call the THM samples like "OpenOffice.org
| configuration", but such files are already used in predecessor
| software StarOffice. Furthermore the THM files only occur in the
| context of a Gallery and contain the theme name of the gallery.
| Therefore i choose describing text "StarOffice Gallery theme".
| This also a reasonable for abbreviation thm for theme. This
| abbreviation is used as file name extension, which is shown by magic
| line
|  !:ext		thm
| Using other StarOffice mime types mentioned on OpenOffice site as
| guide line i choose a user defined mime type by line
|  !:mime		application/x-stargallery-thm
| 
| These 2 magic tests are sufficient for my examples, but i try to look
| for more possible tests. In all THM samples the ASCII keyword GALRESRV
| appears near the end. So this can be used by line like
|  >>0		search/8415	GALRESRV
| This matches big THM example
| "C:\Program Files (x86)\StarOffice6.0\share\gallery\sg27.thm"
| But if i create a bigger gallery with "neues thema6.thm" the above
| test does not fit, so i must raise search limit and the magic test now
| becomes like
|  >>0		search/19299	GALRESRV
| Furthermore a high search range is a performance killer. So i do not
| use this as additional test.
| 
| After the theme names some bytes are stored. For many of them i do not
| know what this mean. But one byte in my inspected samples was always
| null. So maybe this can be used as additional line like
|  >>(2.s+9)	ubyte		0
| But for me this seems to be a lucky event. So i do not use this as
| additional test.
| 
| After the theme name the number of gallery objects is stored. A
| Gallery can be empty. In this case it contains 0 objects. This is
| displayed by lines
|  >>(2.s+4)	ulelong		x		\b, %u object
|  >>(2.s+4)	ulelong		!1		\bs
| 
| Three bytes behind the object number the name of the first object
| name is stored as Pascal string. This can be an "internal" name like
| d2194, an URL like file:///P:/Pictures/1999_1024_23_Tikal.jpg, a
| partial file name like /sounds/apert2.wav or RESRV for empty
| galleries. So i display first object name for non empty gallery by lin
| es
|  >>(2.s+4)	ulelong		>0
|  >>>(2.s+11)	pstring/h	x		\b, 1st %s
| 
| After applying the above mentioned modifications by patch
| file-5.37-wordprocessors-thm.diff then i get a describing output like
| 
| file2147.chk:     data
| neues thema6.thm: StarOffice Gallery theme
|       		  MorePictures,
| 		  315 objects,
| 		  1st file:///C:/Users/user1/Pictures/
| 		  1999_1024_23_Tikal.jpg
| neues thema7.thm: StarOffice Gallery theme
|       		  LongGalleryName___________________________
| 		  0 objects
| sg16.thm:         StarOffice Gallery theme
| 		  3D,
| 		  12 objects,
| 		  1st dd2066
| sg25.thm:         StarOffice Gallery theme
| 		  private://gallery/hidden/HtmlExportButtons,
| 		  49 objects,
| 		  1st /htmlexpo/sologo.gif
| sg27.thm:         StarOffice Gallery theme
| 		  Navigation,
| 		  238 objects,
| 		  1st /navi%2D2d/wh%5Fup.gif
| sg33.thm:         StarOffice Gallery theme
| 		  Probleml\303\266sungen,
| 		  72 objects,
| 		  1st /troubleshooting/question-mark_blue.wmf
| sounds.thm:       StarOffice Gallery theme
| 		  sounds,
| 		  35 objects,
| 		  1st /sounds/apert2.wav
| 
| I hope my diff file can be applied in future version of
| file utility.

Committed, thanks!

christos


More information about the File mailing list