Поставьте, пожалуйста “We were dancing when he came,” Tom said. в Reported Speech
Tom said that they had been dancing when he had come.