Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hi Regina, On Fri, 2011-01-14 at 23:23 +0100, Regina Henschel wrote: I use the German LibO RC3 on WinXP and the filters are not there. Riight - we fixed this bug; having said that Pierre's work should make the binfilter tolerably small, instead of another handful of megabytes that the vast majority of the world doesn't want to download. So - hopefully that'll make everyone happy. Thanks for the report though, ATB, Michael. PS. you might want to consider converting your old StarOffice documents ;-) though good to have some for testing I guess. -- michael.me...@novell.com , Pseudo Engineer, itinerant idiot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hi all, there is something wrong actually. Removing *Export*-filter is reasonable, but now in LibO RC3 I cannot *read* my SO5 files. Kind regards Regina Pierre-André Jacquod schrieb: Hello, these days, I have tried (and not really with full success) to understand how binfilter works... My goal: since it is an old legacy format, make StarOffice formats read-only, and clean binfilter component of all code used for writing files. Reason: with read-only, you will still be able to read your old files / archive, but his will push the users to use a current / supported format in case of change. So a less heavy software, use of well-maintained (see minutes of tech steering call ... 2010.12.09) After some code reading here a resume of my understanding. Thanks for correcting, asking, challenging me. I hope I did not understand it too wrongly. 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 0x0001L) 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) Currently, I have simulated it locally adding in libs-core/sfx2/source/bastyp/fltfnc.cxx: (almost at the end of the function SfxFilterContainer::ReadSingleFilter_Impl ) if (nFormatVersion SOFFICE_FILEFORMAT_60) { pFilter-nFormatType = ( nFlags | SFX_FILTER_OPENREADONLY); } this is not a nice hack, but it demonstrates me that it works / how it works. This shows me: a) it works. Yesss : -) b) there are functions defined in libs-core and binfilter (sfx2 of libs-core and sfx2 in binfilters) that are redundant. e.g SFX_FILTER_OPENREADONLY (and other constant values) are defined in both filters/binfilter/inc/bf_sfx2/docfilt.hxx libs-core/sfx2/inc/sfx2/docfilt.hxx 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... I noticed the following at SaveAs: all StarOffice format were still available, but were producing an error at saving, since they are now by me read-only... I did not find the place, but could someone hint me where this is? Actually, I think the list of format displayed at Save or SaveAs should contain only not read-only filters, something like this in pseudo-code: (if (filter.getFlags() SFX_FILTER_OPENREADONLY) != SFX_FILTER_OPENREADONLY) { display this filter in save / saveas dialog} (note: I also saw a function isReadOnly() or something like this that could be called on filter objects, returning true / false. Is probably even better...) I do not think there are currently READONLY filters, but basically, I think this is a bug not taking this flag into account. And so in one go all problem solved in switching the binfilter to READ-ONLY. If someone could help me for this part... Finaly, at saving, this work like this: (valid for StarOffice format... beware, other format, other paths) SfxObjectShell::PreDoSaveAs_Impl(param) in libs-core SfxObjectShell::SaveTo_Impl(param) for ExporTo in libs-core SfxObjectShell::PreDoSaveAs_Impl(param) SfxObjectShell::SaveTo_Impl(param) 2 in sfx2_objstor.cxx SfxObjectShell::SaveAsOwnFormat( param) in sfx2_objstor.cxx SfxObjectShell::SaveAs(param) in sfx2_objstor.cxx SfxObjectShell::SaveInfoAndConfig_Impl(param2) BasicManager::Store(param) BasicManager::Store(param2) BasicLibInfo::Store(param) StgWriter::Write (param) Sw3Writer::WriteStorage() Sw3IO::SaveAs Sw3IO::Save ExportTo is finished and has returned with the ExportTo function going magically to the binfilter module. I did not understood what I read there, with the uno part... Until (and with) the function BasicLibInfo::Store(param), this the common part of binfilter for all modules. Then it splits to writer, calc,... At opening with read-write filter, some of these write functions are called (for the lock file). With a read-only filter, this does not happens. At opening, there is also the dark magic call (:- ( through uno to go through the different filters one by one for generating them So how to go ahead? Here I am asking you: - is it OK to go ahead with this idea? - should I make a feature/StarOffice-read-only branch ? - could someone (help me) implement the sorting in order to ensure that read-only filters are not available for Save / Save As? Of course, if going ahead on this way, I will search the code in order to find the right place
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hi, On 01/14/2011 07:33 PM, Regina Henschel wrote: Hi all, there is something wrong actually. Removing *Export*-filter is reasonable, but now in LibO RC3 I cannot *read* my SO5 files. Kind regards Regina Up to now, nothing has been committed. On trunk master, all is OK, I just tested it. regards ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hi Pierre-André, Pierre-André Jacquod schrieb: Hi, On 01/14/2011 07:33 PM, Regina Henschel wrote: Hi all, there is something wrong actually. Removing *Export*-filter is reasonable, but now in LibO RC3 I cannot *read* my SO5 files. Kind regards Regina Up to now, nothing has been committed. On trunk master, all is OK, I just tested it. I use the German LibO RC3 on WinXP and the filters are not there. Kind regards Regina ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
there is something wrong actually. Removing *Export*-filter is reasonable, but now in LibO RC3 I cannot *read* my SO5 files. That is caused by the build having been done without --enable-binfilter, I think. Not on purpose, and not related to this making binfilter formats read-only discussion at all. --tml ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hi Pierre, On Sat, 2011-01-08 at 00:15 +0100, Pierre-André Jacquod wrote: The filter, despite write is not usable (no export). ... So ideally could it be: not export, READONLY and pop-up ?? :- / I'd still prefer not to set the read-only flag if possible, it is a After playing a bit, I agree, and I think it will be possible to handle that in a proper way. Just stupid question: should a warning pop-up really be set ? Not if it causes some an ugly nastiness :-) Finally, making the binfilter import only (i.e without export / write functionality) is a shared property of ALL file formats which (would not have) / have not the EXPORT flag set. Nothing to do with legacy or not... True. I found a place to put such a pop-up (but I think this is quite a dirty place): :-) Personally, I think we can avoid this. Anyone expecting to save in this ten+ year old, shocking format is deranged anyway, so there is not much we can do to help them with dialogs I suspect :-) So - if we drop that; where are we at ? :-) If we can load the file, edit it, and hit 'save as' (without having to click the get me out of ! #$#$%#%ing read-only-mode button) I'm thrilled, lets merge it and start write specific ripping junk out of the binfilter code :-) Thanks ! Michael. -- michael.me...@novell.com , Pseudo Engineer, itinerant idiot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hi Pierre, This looks like a really useful start :-) On Mon, 2011-01-03 at 13:27 +0100, Jan Holesovsky wrote: Second issue I see: (I just though of it right now, did not yet test / investigate): with opening in read/write and without EXPORT filter, what happens with the auto-save option, after some changes have been done? No idea, without testing myself. I think we could fallback to autosaving in ODF format, if we do not do it yet ;-) Autosave happens to your home directory in ~/.libreoffice or equivalent, and in ODF (or should do), so this shouldn't be a major issue. I'd still prefer not to set the read-only flag if possible, it is a terribly annoying feature [see the other threads about read-only mode]. Agreed, read-only mode is an abomination in my view. Anyhow - just wondering how this is progressing ? :-) and looking forward to having it integrated. ATB, Michael. -- michael.me...@novell.com , Pseudo Engineer, itinerant idiot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hi Pierre-Andre, On 2010-12-30 at 17:30 +0100, Pierre-André Jacquod wrote: Thus, there is a major difference: With READONLY, no lock-file is generated when the file is openend. With filter without the EXPORT, the lock-file is still generated This comes during the load process, where the SfxMedium::IsReadOnly() function is called in order to decide if this lock-file has to be created or not.(Not spotted the exact place yet) Actually, I think this is not a correct behaviour. If the filter is not EXPORT; there is no reason to create the lock-file ? or ??? Should I consider changing the code of the loading part, in order to not create a lock-file if the filter has not EXPORT properties? From file point of view, this is the same case: you can not save this file as-is. This is a good point - as you say, I agree we can omit the creation of the lock file. It would be good to double-check how it behaves when you have a format where you have one filter for reading, and other one for writing ;-) But either way, I don't think that actually creating the lock even though the filter is import-only is that serious issue, ie. you can remove the locking of the file later, it is not blocking your work. Second issue I see: (I just though of it right now, did not yet test / investigate): with opening in read/write and without EXPORT filter, what happens with the auto-save option, after some changes have been done? No idea, without testing myself. I think we could fallback to autosaving in ODF format, if we do not do it yet ;-) The filter, despite write is not usable (no export). ... So ideally could it be: not export, READONLY and pop-up ?? :- / I'd still prefer not to set the read-only flag if possible, it is a terribly annoying feature [see the other threads about read-only mode]. As outlined above, my favorite approach would be to 'disconnect' the binfilter from the save functionality first, add the dialog on open, and dialog pop-up just at the end of loading the document ? will search for the right place. Thanks a lot! Regards, Kendy ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] making binfilter aka StarOffice FileFormat read-only
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 0x0001L) 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 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice] making binfilter aka StarOffice FileFormat read-only
Hello, these days, I have tried (and not really with full success) to understand how binfilter works... My goal: since it is an old legacy format, make StarOffice formats read-only, and clean binfilter component of all code used for writing files. Reason: with read-only, you will still be able to read your old files / archive, but his will push the users to use a current / supported format in case of change. So a less heavy software, use of well-maintained (see minutes of tech steering call ... 2010.12.09) After some code reading here a resume of my understanding. Thanks for correcting, asking, challenging me. I hope I did not understand it too wrongly. 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 0x0001L) 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) Currently, I have simulated it locally adding in libs-core/sfx2/source/bastyp/fltfnc.cxx: (almost at the end of the function SfxFilterContainer::ReadSingleFilter_Impl ) if (nFormatVersion SOFFICE_FILEFORMAT_60) { pFilter-nFormatType = ( nFlags | SFX_FILTER_OPENREADONLY); } this is not a nice hack, but it demonstrates me that it works / how it works. This shows me: a) it works. Yesss : -) b) there are functions defined in libs-core and binfilter (sfx2 of libs-core and sfx2 in binfilters) that are redundant. e.g SFX_FILTER_OPENREADONLY (and other constant values) are defined in both filters/binfilter/inc/bf_sfx2/docfilt.hxx libs-core/sfx2/inc/sfx2/docfilt.hxx 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... I noticed the following at SaveAs: all StarOffice format were still available, but were producing an error at saving, since they are now by me read-only... I did not find the place, but could someone hint me where this is? Actually, I think the list of format displayed at Save or SaveAs should contain only not read-only filters, something like this in pseudo-code: (if (filter.getFlags() SFX_FILTER_OPENREADONLY) != SFX_FILTER_OPENREADONLY) { display this filter in save / saveas dialog} (note: I also saw a function isReadOnly() or something like this that could be called on filter objects, returning true / false. Is probably even better...) I do not think there are currently READONLY filters, but basically, I think this is a bug not taking this flag into account. And so in one go all problem solved in switching the binfilter to READ-ONLY. If someone could help me for this part... Finaly, at saving, this work like this: (valid for StarOffice format... beware, other format, other paths) SfxObjectShell::PreDoSaveAs_Impl(param) in libs-core SfxObjectShell::SaveTo_Impl(param) for ExporTo in libs-core SfxObjectShell::PreDoSaveAs_Impl(param) SfxObjectShell::SaveTo_Impl(param) 2 in sfx2_objstor.cxx SfxObjectShell::SaveAsOwnFormat( param) in sfx2_objstor.cxx SfxObjectShell::SaveAs(param) in sfx2_objstor.cxx SfxObjectShell::SaveInfoAndConfig_Impl(param2) BasicManager::Store(param) BasicManager::Store(param2) BasicLibInfo::Store(param) StgWriter::Write (param) Sw3Writer::WriteStorage() Sw3IO::SaveAs Sw3IO::Save ExportTo is finished and has returned with the ExportTo function going magically to the binfilter module. I did not understood what I read there, with the uno part... Until (and with) the function BasicLibInfo::Store(param), this the common part of binfilter for all modules. Then it splits to writer, calc,... At opening with read-write filter, some of these write functions are called (for the lock file). With a read-only filter, this does not happens. At opening, there is also the dark magic call (:- ( through uno to go through the different filters one by one for generating them So how to go ahead? Here I am asking you: - is it OK to go ahead with this idea? - should I make a feature/StarOffice-read-only branch ? - could someone (help me) implement the sorting in order to ensure that read-only filters are not available for Save / Save As? Of course, if going ahead on this way, I will search the code in order to find the right place for activating the SFX_FILTER_OPENREADONLY flag as property for the filter, not using this hackhopefully Thanks for your feed-backs Regards Pierre-André