Hi Fridrich, Fridrich Strba wrote:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello, good people, > > Just wondering how easy would it be to hack a system that when one is > trying to open in OOo a 0-byte-long document, it opens an empty document > in the application that corresponds to its extension. I would not mind > to program this if I have some pointers. You have to hack at several places. The first is that the type detection must be made aware of this. This could be done most easily in the TypeDetection service (filter/source/config/cache/typedetection.cxx ) by checking the size of the stream it creates before calling the type detector services (search for "addInputStream") The next place to hack is the filter code itself. The easiest way would be to add some code in the load() method of the UNO model (sfx2/source/doc/sfxbasemodel.cxx). As soon as sfxbasemodel detects that the stream is empty it should create an empty storage with the correct type at the file location, but not commit it so that no file is created on disk. But it shouldn't try to load from this temporary storage (as it does not provide the necessary streams), instead of this m_pObjectShell->DoInitNew() should be called, but I assume some additional code massaging is necessary as this method does a little bit "too much". If you want to tackle it: try to do what I described and once you're finished, let's discuss how to proceed. Ciao, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to "[EMAIL PROTECTED]". I use it for the OOo lists and only rarely read other mails sent to it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]