Two former editors of Rupert Murdoch's now defunct News of the World tabloid were having an affair at the time their reporters were hacking into phones, attorneys said in a London court on Thursday.