After a great summer this year, Google Summer of Code comes to an end. This report intends to summarize all the work done for print dialog during the program. I would like to thank The Document Foundation, LibreOffice community, Google and my amazing mentor Katarina Behrens for this opportunity.
LibreOffice's print dialog is available in Writer, Calc, Impress, Draw and Basic IDE applications. The main goal was to let major printing options to be direct and easy for the user. First, let's take a look at the print dialog before this GSoC (Writer version):
That print dialog was designed by OpenOffice team in 2009 (notice I said OpenOffice. It was not LibreOffice yet!). Back then, screen resolutions were low and there were no full HD monitors. So maybe that's why print dialog was small. Revamped print dialog, however, is big. Making it big allowed a bigger print preview area, which is preferred because the user can view the document better. Besides, it's better to have a big print preview than a big printer selection list.
All print dialog's main features are now available under the General tab, including the content of the former Page Layout tab. This way, it is easier for the user to set up printing. Application-specific printing options are all under the second (and last) tab. Options tab has been removed since it is actually very rare to use its features nowadays. But don't worry, there is a new "More Options..." button that opens a sub-dialog with any extra options that might be needed. A first look in the new print dialog (Writer version) is provided below:
Features highlights are listed below.
-
Print odd/even pages: in old print dialog, the user would have to go to Page Layout tab and then select to include "right pages" (odd pages), "left pages" (even pages) or all pages. And this feature was not available in all print dialog versions. Now, this option is in print pages drop-down in the General tab. Straightforward, easy and now available in all print dialog versions.
-
Select Paper Sides (Duplex): the user can now select paper sides (also known as duplex mode) directly in print dialog.
The example below was executed in Impress.
-
Select Page Size: it is possible to select page size directly from print dialog as well. No need to go printer properties anymore.
-
Select Page Orientation: in old print dialog, the user would have to go to printer properties to select the page orientation. There was also another way: in print dialog, under former Page Layout tab, select "Custom" in Pages per sheet drop-down and only then the option to change page orientation would show up. Now, it is possible to select the page orientation directly in the General tab. In Writer, printer page orientation is now synchronized with document orientation. That means that if you select page orientation in print dialog, the document will adapt to the new orientation. There is no need to close the print dialog, go to Format->Page, set the orientation you want to print and then reopen print dialog.
The example below was executed in Writer.
- Preview Option: it is possible to disable print preview content. This option is useful when the document is very big or when the system is slow because it can take an annoying time to render the preview. If that is your case, simply disable print preview.
The example below was executed in Calc.
Print dialog's code is in my mentor's words: "a spaghetti bowl". It's one dialog, but its code is fragmented in different modules. Common options are usually set in the "common modules", but there are some exceptions. Those exceptions and all application-specific options need to be set in each application module. Setting up a printing feature for one application can be very different from setting the same feature for another one. That happens because there are different document types, each one with its own peculiarities. Making new/redesigned features work with old ones can also be tricky.
The UI is designed in Glade with GTK, but UI control is set up in vcl module, with vcl standard (a little bit different from GTK standard). There is also some UI controls set up by UNO API in each application module. Printing controls are also shared by vcl printer controller and each application module via UNO API. Some printing options can be set in vcl and be applied to the application. Other options are set in the application module and then applied to the print dialog in vcl. And there are options that have a both-way controller communication between vcl and application, which can make them difficult to handle. There is not much documentation about the print dialog code - what options are available? Which arguments can they receive? To answer those questions, some code deciphering was necessary.
In Writer, the document can be printed as a brochure. In Impress, on the other hand, slides can be printed as handouts, notes etc. In Writer, the document has clearly defined pages. In Calc, the document has different spreadsheet tabs and pages are defined as cell ranges. And these are just a few examples of how different printing can be for each application.
In LibreOffice community, it is common to hear the sentence: happy hacking. Working in print dialog really made me feel like a hacker sometimes.
These are some features that had not been implemented during GSoC. Some suggestions for the print dialog are also presented:
- Synchronize printer page orientation with document orientation in Impress, Draw, and Calc.
- Get paper size names directly from printer's driver in the printer dialog.
- Add a "print current page" option to the print pages drop-down and leave page selection entry box blank. Leaving it blank would actually show its page selection example placeholder. Page selection entry box could also be always enabled, so the user could simply type the pages to print without having to select the correct option for that in print pages drop-down first. Print pages drop-down would adjust to reflect the user's page selection entry and vice-versa.
- tdf#67905 adds an option to disable print preview in print dialog
- New Print Dialog Design
- Reinserts optional UI options into print dialog
- Configures page range in print dialog
- Sets pages per sheet and brochure in print dialog
- Minor UI fixes in print dialog
- Adds More options dialog with single jobs checkbox in print dialog
- Sets paper sizes listbox in print dialog
- Syncs paper names in vcl with i18nutil/*/paper.hxx
- tdf#112294 fix comments listbox selection in writer print dialog
- Reinserts print comments in print dialog (writer)
- Sets duplex (paper sides) box in print dialog
- Reinserts alternative impress document types in print dialog
- Fix paper size combobox selection
- Reinserts storeToSettings and readToSettings in print dialog
- Sets page orientation box in print dialog
- Adds print even pages/print odd pages options in print dialog
- Resolves the mismatching behavior between page size and orientaton selection
- Adds 16k papers to print files in vcl and paper files in i18nutil
- Print dialog UI adjustments
- Increases MAXSLOPPY value in i18nutil/*/paper.cxx
Patches #20 and #21 are still open, so they have not been merged yet. The code is on feature/print_revamp branch. Any update on open patches can be checked there.
It has been a great experience to work with LibreOffice this summer. I know there are a lot of requests for the print dialog. Unfortunately, I could not make them all come true. However, I will continue contributing to LibreOffice, especially for its print dialog. I am also available to fix any future bugs that might come out my code. That's all, folks!
Is it possible to do the future work in next Gsoc?