"die er eben noch gehabt hatte"
Let's look how we got there...
The basic statement would be: "Er hatte die eben noch gehabt." ("He has had her still just now" or simpler "He still had her just now" )
But, since this is a "Nebensatz" (subordinate clause), the rule says to move the past tense helper verb "hatte" to the end of the clause and the subject ("er") after the backward referencing article ("die").
Thus we get: "..., die er eben no gehabt hatte,..."
This is btw. "Plusquamperfect" (auch "vollendete Vergangenheit"; "completed past"), which is build from the simple past (Imperfekt or Präteritum and the Partizip Perfekt; "hatte gehabt").
HTH