 Hello, everybody. Thanks for going lunch and listening to me. We are actually two people presenting. It's me and my imaginary friend, David Tardon, that nobody actually ever saw in a conference, but me. And it's actually him who prepared the slides just five minutes ago. So thank you, Michael, for taking some time so that we could finalize it. So the agenda, it will be introduction to input filters. Then we will speak a little bit about filter configuration in LibreOffice. Then we will speak about the use of accessibility filter that Michael makes like so much. And then we will give an example of integration of LibreVentch-based filter and also an example of an easy way of setting a new LibreVentch-based library. Since I have 15 minutes, I will be speaking without reading. So introduction to input filters. Why to write input filters? So, yeah, that's a good question, actually, because as we know, ODF is the future of the humanity. The only problem is that humanity doesn't know it yet. So, yeah, so there are other file formats that are not ODF. And there are also users that want to be able to read them. So it is not our fault that we have to write input filter. It is the humanity and the users. So, and we decided that we will be nice and we will be playing along with the humanity and the users. So even if they don't play the same, according to the same rules. So what are the options in LibreOffice for writing input filters? They are the easiest filters in the world that are called accessibility filters that I will explain something about them. And I see a nice smile on Svante's face because he used to be the one who was taking care of this thing. So, Svante, if I say something very stupid, please keep it up. Or one can do a full-blown filters that are different from accessibility filters. And one can use one of the existing framework. We have actually two new frameworks in LibreOffice. One is called LibreVenture Framework because it's based on the LibreVenture APIs. And another one is Orcas framework that is based on LibOrcas that Kohi and Marcos who are happily not here know something about. Or we can produce ODF or Betas Flat ODF as an intermediate format for internal filter frameworks in LibreOffice. Or we can use the UNO to directly create the document from create the UNO structure of the document directly from the file. Or we can do another thing. We can push the document into internal LibreOffice structure. Therefore, as they do this, or we can use... No, we can't use because it's deprecated but they used to be an X-merge framework that is basically Java framework. Oh, accessibility filters. It's easy. But it works only for pure external formats. It's quite hard to write an accessibility filter for something like binary, visual file. And there is also this character of accessibility that is setting itself in the bright only mode that makes it a bit difficult to write something else than just easy filter by accessibility because even the author himself two weeks after will not remember what actually he was wanting to achieve and what the sheet means. And also in LibreOffice, only accessibility 1.0 is supported out of the box because we use Libre Accessory for accessibility transforms, which is good because Libre Accessory is extremely quick. It's better than a Java-based framework. But it doesn't have some nifty 2.0 features that many of accessibility writers love. As to use of existing framework, Librevenge, Librevenge, I actually pretty like this framework. I don't know why, but it's a document liberation project framework. It's called Librevenge Library because document liberation project is a project of a revenge. I mean reverse engineering. And we support text, presentation, vector graphics and spreadsheets for the while. We use ODF as an intermediate format. We have a library that actually takes the APIs of Librevenge and uses them to generate ODF. So, and there are already a dozen of existing import libraries supporting many formats like Warfare Effect, Publisher, Visio, Workscore of the Adobe PageMaker, and Keynote, and whatever. Very many things. Orcas, that's Cohes, and Marcos says, Marcos, David brought you et al, but that's basically you. It supports spreadsheets. Again, internally supports ODF, OpenXML, Numeric, CSV. For the while, no other filters use it for, but it can be used. Yeah. Then why to use one of these frameworks? Because it's much easier than UNO. And also UNO is somehow a world of its own and sometimes when you are just a programmer and not UNO expert, you might get confused by UNO syntax and UNO operators. Okay, we can have some unsupported features still in this frameworks, but it's software, so we can always support unsupported features or we accept patches very happily. And in our opinion, the best choice is this for the less important file format. Why is a less important file format? If the file format needs to be quick writing and reading, it might be not the best solution to go through several intermediary APIs. The production of ODF is an intermediary format. It's slower, but we don't need to, this is another filter type. Produce just ODF XML. Slower, but there is no need for any framework or even UNO because there are already filter adapters that interface with UNO. And we have two existing filters that use this approach. But given our bias, we still think that it's probably easier to use LibreVenge instead, so we can use directly, you know, the existing filters that do it like the OXML filters that use UNO, RTF filter, and many of those that I don't remember because the German guy called Artheimer is hiding them from me. And also filter can be extension because extensions can use, you know, like for example, Qualen's OpenOfficeFork diafilter, OpenOfficeFork diafilter has quite funny prefix, I don't know what it means, but the diafilter part, it means that it's importing the diagrams. And for use of Internet LibreOffice Structures is the fastest, it has the high potential of breaking things because you are touching things that only Qualen and Stefan Bergman understand. And the Aligasi filters like V1 or V8, it means the Microsoft V binary filters. And we just hope that nobody is considering doing that for a new filter, yeah, that's it for this part. And concerning the Xmerge framework, it was Java only, we removed all existing filters in 4.0, it's possible that there are still external filters using this framework, but yeah, if you want to write a filter, forget that Xmerge existed, so. So very quickly about the XSLT filters, creating a new XSLT filter is extremely easy. Tools, XML filter settings, all you need is to have an XSL transform that converts a foreign XML-based file format of flat ODF, yeah, that's if you are, if you know how to write a transform, you can integrate it very easily. We have certain number of XSLT-based filters in the, in liberal office, and they even work, I think. When you are setting up a new filter, you have to choose filter name, in the general term you have to choose filter name, file type, and file extension, file type is, is basically what you'll be receiving that document. If you convert spreadsheets, you will want to know what will be the XML that you will be putting out. If you, yeah, liberal office writer access be, it means that it uses open office org 1.0 file format in flat version, and it will be a writer document, yeah. File extension, that is pretty easy because it's basically the extension, that the files that you are going to convert will be using, and the application that will receive the converted document, it's the writer, because we have to specify so that it doesn't try to load it into org, for example. So you can see how easy it is, and then you can, in the transformation tab, you put the doc type, if applicable, accessibility for import, template for import it needed, template it means that if the file format you are importing is a file format that doesn't have style with itself, like for example, doc book file format needs, you need some style for the document to have when you import it into liberal office. If the file format you are importing, it's just a meta, just the data, and you want to make something nice visual, so. It is possible to request use of accessibility 2.0 processor, but requires installing accessibility to transformer extension, so. You can see how the dialog looks, and that's it, there is a possibility to export this as an extension, and that's it. It's very easy, given that you know the accessibility and you know how to write it, so that it actually does something meaningful, that I doubt anybody but Swanta knows, so. Now, liberal office needs some things to be done so that it considers the filter as a filter. You have to make a further configuration, and the configuration, it's the XML fragments that are describing the filter itself and the type the filter is handling. Type describes the file format, filter specifies how to handle the type. It means which service will import it and similar thing. It is possible to have more filters for the same type importing to different document services. Yeah, yeah, we have HTML that we can import as web document or as write a document, so. This fragments are then assembled by a custom tool into a big XML file in the liberal office installation. And the type property, what do you put there, there are extensions, there is my type, there is the text service, the service that is able to detect whether this document actually is that the is of this type, then there are some about preferred whether this one, this service, this type, is the type that is able to detect whether this document actually is of this type. This type is primary for the extension and preferred filters and UI name of the type. So it appears in the dialogue with the right name and that one is localizable. And yeah, and you can put some different patterns. Let me just show you an example. For example, for the publisher, for Microsoft Publishers document, the detect service is called Compsonstar Comptram MSPubImportFilter, so the importer implements the detection function. Also, the extension is pub, man type is application, XMS publisher, preferred, yes, for this file format is the only filter we have, so it's preferred and then it's public. Publish a document that is filtered and we'll handle it, so. And in the UI, in English, it will appear as Microsoft Publishers. For filter properties, there is a filter service, then document service, which will receive it, like for example, Compsonstar drawing document. Let me actually give you the example because it will be in the slides and it's not necessarily really to go completely for it. For example, we have the name of the filter, for that is publisher document. They are all the options, it's import filter only, it's alien, it's not internal filter. They use this option, third-party filter preferred. I explained everything there, but it's not something that you would want to, you want to know it only when you need it, so. For filter service, this one is going to be imported into draw and the name in the UI will be Microsoft Publisher 97 to 2010. The file format version is zero. I don't know whether it changes anything and it links to the type. As the type links to the filter, their filter links to the type, so they are closely with each other and yeah. That's what we have. Yeah, no, this filter service is who is the, what is the service name of the filter? So when we get this, when the type is detected and calls the filter, so you know which service will actually convert the document. So for adding a new filter, you have to create this config for the format in filter source config fragments types. The easiest way is to copy something that already exists and modified. Add a file to an appropriate filter configuration add type section in filter configuration filter, my make file so that it's not just there and nobody is using it. Create also the filter configuration and then add it to the make file and it will get merged like that. Now the most intelligent way still writing filters for liberal office is to use the liberal range framework that is state of art best framework of the world. The source code location, the code that integrates all these liberal range based libraries is right a perfect module. In the right a perfect source core is the generic part and then you have per application filter specific for application so that, so that liberal range framework based filters, they don't, we don't produce a zillion of shared libraries. We have one shared library per application so that packages they can add it to Calc and so we have Calc writer draw directories for that. For if you create a new library based on liberal range API it requires adding new header and source file to appropriate appropriate application directory. Again typically you take what is existing you compete and you run set on it and also there is adding, you have to add some boilerplate to VPFTs, draw generic filter CXX and to the component file. But again it's very easy because you look what is done for the previous ones and you just add your thing into it. You don't even need to understand that. I myself I don't understand it so there is no big problem with it. For writing a code, there is a class called import filter base that contains most of the necessary boilerplate in every application directory. So it means that the real work for every integration is just few lines. Yeah, there are mainly these filters, they use it apart writer for the word perfect filter, which does a lot of additional work because word perfect actually supports also of passwords and several things. So it expires dialogue for password if the password is protected, if the document is password protected. So most filters only need to override to function do detect format and do import format, document that are just few lines each. You can see that in the old time this was how we would write an import, a filter detection function. We would take basically the model of the document, we would get input stream from it, we would run something on the input stream it's supportive and then we would get out the name. So, and that was before done according to the developer manual. So we made it a bit easier. So now for example the do detect format, you just have one function that you need to know that you need to have in your library function that can detect whether it is a format supported by a library or not, but then you do something like this and it will be enough, this is an overriding function for that returns in the old string, it returns the name of the type if you detect it, if not it returns, it puts the nothing and it returns through if you detected it and if you didn't detect it it returns false, that's LibreVent framework, that's why it's very easy so on. And for filter function is the same, in your library you will have a document, you will have some function that will take and LibreVent input type and LibreVent generator type as parameters and you just override it this way for your library. The thing is that how to get this parser function and everything, how to do a library for import. Okay, just to say that after you do this there are still some little configures, some make files have to be changed, but it's always good to ask someone of us, me or David, when he is available on ILC, he is almost always, there is always a particular commit that one can just study and copy and it's very easy. Once we tell you this, look this hash, we integrate this library in it, you will see what needs to be done, it's not a big deal. Okay, but for example, we were speaking how to integrate with LibreOffice, but how to write a library. We decided that sometimes it's a bit complicated and there is a lot of similar things that have to be done in the beginning of the library creation that we were normally doing, like one day we would spend to just set the framework or one evening and run set of it and we realized that actually we can write a tool that will generate a library and this tool we have it, you have the git URL of it, it's called Project Generator and the script is called Project Generator and I will actually try to do something, I don't know whether I will manage, it's quite possible that I will be able to create for you the one just dummy library. I just updated, okay, it's up to date. So Project Generator, I will call it LibLocon I will put as a comment that is LibreOffice Confiliated Library, the author is me, this is my email for all the girls that want to write to me. The main class will be called Locon Document and the namespace will be Locon. So I just run and it will generate something when you see, you will see that it created some directory LibLocon and we can now auto generate the directory and come on, they're supposed to be quick. Okay, but you can configure it, I configured it with disable where all because it will shut me some arrows because there will be some variables that are unused parameters. So it will configure, it will check whether RibreVentch libraries are accessible. I actually created Locon, LibreOffice Conf format is a text format, so I will be feeding it to writer. And I can make, make and I compile it and yeah. So it's a skeleton, it doesn't do anything, but it's in less than five minutes, you have a skeleton that you can start the program into, which it can be good because me, it was normally taking me several hours to get the skeleton clean, so. And the generator is a software, so if there are bugs, it's always possible to send us patches, so let me see when I am. Wait, yeah, so this one's, this was the, I will leave it, I will leave the information in the slides, so. And if you want to read something more, we have, I published a blog about writing filters that stems from one article I wrote for Linux Magazine last year, so, and David, he also, he started a series of actually specifically using LibreVentch, so if you want to use the best framework in the world, you go there and I think he actually updated and there is a part to already, and he will be writing after, if someone actually reads it, he will be writing more of it, so, yeah. So thank you so much, if you have questions you ask, if you don't have, you can go to eat or wait for another person.