1) Assuming that the unity gain in the line input stays around 40, it means that below this there is a digital attenuation.
Incorrect. The gain or attenuation of the signal is done in the analog preamp stage, before the analog to digital converter.
This means that going line-in with an external preamp should be done without moving from this 40 level. Is this right?
If 40 on the R09HR is the unity setting then that's a reasonable goal. You probably won't notice any noise or distortion in a fairly wide range around that setting though. The effective limits of that range seem open to debate, but if you need to further attenuate or amplify the signal somewhat from your initial setting of 40, that shouldn't worry you too much.
2) If keeping the unity level causes an overload even if the preamp is set at a low gain this means we have an output which is too high. I guess this could occour because we are using very sensitive mics.
Or the preamp may have a high output level. That's common with professional gear. I have to set my Grace V3 preamp gain very low when feeding my old R-09. I like to keep the R-09 input level at around 13 or so when using an external preamp (though as mentioned above, a bit higher or lower is no big deal) and that means I usually need to set the V3's gain quite low so that it's meters barely register. That's because as a piece of professional grade gear, the V3 is designed to output a higher level signal than the consumer grade R-09 was designed to receive, but I can turn the knobs and adjust for that, it still sounds good and there is no noise problem so I don't worry about it.
There shoud be two possibilities; adding an attenuator between the preamp and the deck or lowering the input level below 40, with the distortion consequences somebody complains about. Right again?
Right. But realize that lowering the input setting on the recorder below 40 achieves the same thing as using an external attenuator.. until you reach the limit where the input overloads and distorts. If you need even more attenuation because you can't reduce the input level on the recorder any further without risking distortion, then you'll either need to reduce the gain on the external preamp farther (which you've presumably already done), engage the output pad on the mic if there is one, or use some kind of external signal attenuator between the preamp and the recorder or between the mic and the preamp.
3) If we go directly line in with a battery box and so WITHOUT an external preamp and we raise the input level over 40 (which seems to me could be a third solution), are we using the same preamp circuit we have in the mic mode? If it is true it means that we have a) high mic input; b) low mic input ; c) line in which acts either as an even lower mic input if set over 40, or like a true line input if set at unity gain. Right or wrong?
In every input configuration, the signal will go through the same analog preamp stage of the recorder. The main thing that changes is the amount of gain applied (the other thing that changes is the availability of plug-in power when using the mic inputs). The main reason for using an external preamp with this recorder other than as a way to provide phantom power for mics that require it, is to provide a greater range of signal amplification or reduction without as much noise creeping in at high R-09HR gain settings or possible distortion at very low R-09HR gain settings then is available using the built in analog preamp stage of the R-09HR alone. Some people here select preamps for their 'sound' and 'tonal coloration' but that's a whole different discussion.
In any case you can reduce the level (attenuate), increase the level (add gain) or keep the level the same (the mysterious unity input setting) using the level control on the recorder for any of the various input configurations and those changes all take place in the analog preamp stage. If you don't notice any objectionable noise in your recordings when using the line-input and a higher input level setting as compared to using the mic input and a lower input level setting, then you don't need an external preamp at all.