[Libreoffice] making binfilter aka StarOffice FileFormat read-only

Jan Holesovsky kendy at suse.cz
Wed Dec 29 09:20:31 PST 2010


Hi Pierre-Andre,

On 2010-12-27 at 21:31 +0100, Pierre-André Jacquod wrote:

> An easy (and clean) possibility would be to change the filters defined
> in binfilter as read-only filters (using as filter flag
> SFX_FILTER_OPENREADONLY defined as 0x00010000L) This will make the
> opening read-only. By this way, this is not possible any more to save
> using these file formats.
> (I have not yet found where this is set, but still searching)

IIRC the resolution was a bit different ;-)  This way the user will be
unable to modify the document, unless she uses the 'create copy'
possibility, right?

The proposal was to load it so that it is read/write, but issue a
warning like "The format of the file you opened is legacy, and the write
support is discontinued.  You will be unable to save your changes,
unless you choose another file format.  Please consider migrating the
document to a newer format, like ODF.", and remove it from from the Save
As... menu (and consequently from Save).

To do the latter, it might be (as the first step) enough to remove
EXPORT from filter/source/config/fragments/filters/StarWriter_5_0.xcu
and others that use com.sun.star.comp.office.BF_MigrateFilter as the
FilterService.

> c) it seems there are elements in the sfx2 of binfilter that are still
> called, generated, but have no impact on the running system. For exemple
> function SfxFilterContainer::ReadExternalFilters (in
> binfilter/bf_sfx2/source/bastyp/sfx2_fltfnc.cxx) is still called,
> produced me a lot of debug text, but the above mentionned code inserted
> at the same place (as in libs-core but within his function) did not
> produced any effect. So this function is still called, but its effects
> are not taken into account.
> 
> d) So binfilter could be simplified if I take out all wrinting stuff,
> and not needed section of code still called...

Yes - I think Caolan's callcatches might help you here a lot.

> with the ExportTo function going "magically" to the binfilter module. I
> did not understood what I read there, with the uno part...

http://kohei.us/2007/05/08/how-to-pretend-to-write-an-export-filter/

might hopefully help you to understand part of the magic :-)

> So how to go ahead?
> 
> Here I am asking you:
> - is it OK to go ahead with this idea?

As outlined above, my favorite approach would be to 'disconnect' the
binfilter from the save functionality first, add the dialog on open, and
then do the cleanup.

> - should I make a feature/StarOffice-read-only branch ?

Let's do the first step directly against master, once you have the
initial patch (that removes the Save and Save As... functionality for
binfilter), and the rest (the cleanup) in a feature branch; how does
that sound?

> - could someone (help me) implement the sorting in order to ensure that
> read-only filters are not available for Save / Save As?

I hope I helped a bit, please ask more if not really :-)

Thanks a lot,
Kendy



More information about the LibreOffice mailing list