How and where are LibreOffice settings (really) kept?

OS: Linux Mint 18.3 (based on Ubuntu Xenial)

In theory these settings are under ~/.config/libreoffice/4/
… in that directory I find a directory called “user” which itself contains about 10 - 12 subdirectories (autocorr, autotext, etc.) and a file called registrymodifications.xcu.

Other sources on this and other sites say that it is simple: this is where settings are kept. But this doesn’t appear to be so.

To clarify: in Writer, when I go Tools → Options → LibreOffice → Paths, all these paths are set at their default locations, i.e. /home/mike/.config/libreoffice/4/user/autocorr, …/autotext, etc.

Under these circumstances you should be able to save all your settings by saving ~/.config/libreoffice/4/user and restore them by restoring that “user” directory.

Equally, by storing “user” and then deleting it you would all your settings to be reset to “default”, with no new styles, no customisations such as hotkeys for styles. You would expect “user” to be recreated, with a default (unmodified) registrymodifications.xcu inside it.

But actually, with no LO programs running, I move “user” somewhere else. Then I open Writer, and “user” is indeed recreated, with registrymodifications.xcu inside it. BUT… I find that my own created styles continue to exist, and even that my recent hotkey settings for certain styles are still active!

The other side of the coin is that occasionally, for reasons I don’t understand, my settings are sometimes “wiped” for no reason that I can understand, when I have not deleted ~/.config/libreoffice/4/user, or made any changes to its contents. This happened today. Styles were not deleted, but my macros have disappeared, all my neutralisation of over-zealous autocorrect settings have gone, etc. etc.

It’s been months since I made a backup of “user” and I think the previous backup was made with LO version 4. Anyway, restoring the last-saved “user” didn’t work.

In short, it would appear that there’s more to these settings than all of them simply being kept under ~/.config/libreoffice/4/temp/. Anyone got any clues?

Some settings for sure are within the document, which contains file styles.xml and settings.xml. If you find e.g. an user defined style after having reset your user profile, it comes from the document. You definitely won’t be delighted, if a style on existing document won’t exist any longer just for the reason of having reset your user profile (or just think about sending the file to a friend having not your definition of the style - how should he view the document correctly, if styles wouldn’t be part of the document).

The rest is in the user profile (program specific stuff) - never noticed anything else than these two locations and some of your details sound a bit obscure.