Description: The document templates are currently organized in categories by the Template Manager (`File > Templates > Manage templates`). The categories are taken from the folders contained in the template paths specified in `Tools > Options > Libreoffice > Paths > Templates`. Currently only one level of template categories is displayed. Sub-categories are not displayed. For example: if the template path is set to `TemplateTest/`, the `TemplateTest/categoryA/letter.ott` template is displayed inside the `categoryA`, but the `templatepath/categoryA/subcategoryA/subletter.ott` template is not shown at all, not even in the `categoryA`. Complex organisations have lots of templates. So it would be **very useful** to have nested categories in the Template Manager, to better classify them (eg. by office and by process). This is why I suggest: * allowing nested template categories, from nested folders in the selected template paths; * using a directory-like visualization for categories and sub-categories, instead of the `Category` pop down in the Template Manager, because it seems more friendly to basic office users. For comparison, this seems already possible in the many Microsoft Office versions, see how it works there: http://www.addbalance.com/usersguide/templates.htm Steps to Reproduce: 1. Create a new folder `TemplateTest` and add it in `Tools > Options > Libreoffice > Paths > Templates` 2. Create and put a `letter.ott` template into the `TemplateTest` folder. 3. Create a nested folder called `categoryA` inside the `TemplateTest` folder 4. Create and put a `letter2.ott` template into the `categoryA` folder. 5. Create a nested folder called `subcategoryA` inside the `categoryA` folder 6. Create and put a `letter3.ott` template into the `subcategoryA` folder. 7. Open the Template Manager with `File > Templates > Manage templates` 8. The templates `letter.ott` and `letter2.ott` are displayed, `letter2.ott` is not. No sub category is shown as well. Actual Results: The templates `letter.ott` and `letter2.ott` are displayed, `letter3.ott` is not. No sub category is shown as well. Expected Results: The templates `letter.ott`, `letter2.ott`, and `letter3.ott` should be displayed. The nested sub category `subcategoryA` should be displayed as a folder of `categoryA`. Reproducible: Always User Profile Reset: No Additional Info: Thank you!
Valid enhancement. Should we allow an infinte depth of folders or limit them to a certain depth?
Well, I do not imagine using more than 3 or 4 levels. But, as it happens for nested directories, I neither see a reason to limit nesting.
I tried to understand the logic behind the creation of the template list and it is quite overwhelming. I think that in SfxDocTplService_Impl::createFromContent no sub folders are included, and I have to check if there is a possibility to read the entire directories including their sub folders to create the correct list by adding a new entry in the ResultSetInclude enum.
Proposed patch: https://gerrit.libreoffice.org/c/core/+/139593 However, after opening a folder, LO somehow destroys the entire folder hierarchy and the files cannot be read again. I will try to speak to some people at the LiboCon and try to solve this, but at the moment after countless debugging houers I can't really help here :(
Good job! A first step in the right direction. Thank you!
May I help in any way? Testing?
Atm, I hope to get the enhancement complete, but I am in cheerful spirits 😊
Could not figure it out how the HierarchyManager rertrieves its names and where it calls the file system, for instance, with FindFileW on Windows. It never calls them, somehow magically it has all the names of the files without any subdirectory. Sometimes all the subdiretories show up ,sometimes not, and I have no idea how to resolve this issue.
So no hope to solve this bug? Anyway, happy new year
Unfortunately, I have no idea how to solve this issue. Lots of calls to subclasses and delegations, even some kind of cache that checks if all the folders AND subfolders are in place. Then it even gets stranger. SOMETIMES all the folders including subfolders work, sometimes they disappear event on the file system itself. Imho, this section needs a rework or someone with a deeper understanding of the code base that left untouched for 22 years according to github.