After fixing tdf#133661, the documents created using Windows Explorer's ShellNew command follow some LibreOffice settings (language, fonts). However, they still do not honor user-defined default templates (as configured in File->Templates->Manage Templates). This means that the two methods of creating new LibreOffice documents (from within LibreOffice application, and from Explorer's context menu), which from user's PoV should be interchangeable and give identical results, in fact behave differently: the former method does what user told to do, while the latter ignored user default template setting. With the fix to tdf#123476, LibreOffice now opens 0-byte files with ODT/ODS/etc extensions as empty documents in the corresponding component. This paves a way to implement the missing functionality: process such files to make them use default templates, and then create empty files in Windows ShellNew handler (i.e., drop soffice.* files in C:\Program Files\LibreOffice\share\template\shellnew, and replace "FileName" with "NullFile" in ShellNew registry subkeys [1]). We should detect that the opened file that uses our native filter is 0-byte file (tools::isEmptyFileUrl) somewhere before the call to SfxObjectShell::DoLoad, and use SfxObjectFactory::GetStandardTemplate to get the default template for the component service. Then we must use the template to initialize the document, but unlike the normal creation of a new document from a template, we must make it have the name and location of the 0-byte file. I don't have a specific proposal where should this happen, and how to implement the substitution of temporary storage (that is used for newly created files) with the 0-byte file, thus not marking this an easy hack. [1] https://docs.microsoft.com/en-us/windows/win32/shell/context#extending-the-new-submenu
+1
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/064f4fe82c30118a34c4aeb47bf8604f0b8356a1 tdf#139991: move 0-byte file handling to SfxFrameLoader_Impl::load It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.