Don't think of it as two distinct things. There is a spectrum of "straightness" in the forehand that goes from a complete double bend and a straight arm.
Federer doesn't hit with a complete straight arm every single time. All you have to do is think about adjusting your arm position to meet the ball. So, if the ball if further out in front, you hit with a more straight arm. If it's closer to you, you obviously have to do a double bend.
So really all there is to do is adjust your contact position.