There is, unfortunately, no way around identifying a noun’s gender and case in the sentence in question when determining which form of welche and diese is correct.
Sieh mal, die Jacke{Nom. Fem. Sing.} ist doch toll!
Welche{Nom. Fem. Sing.} Jacke?
Diese{Nom. Fem. Sing.} Jacke.
Wollen Sie den Anzug{Akk. Mask. Sing.} kaufen?
Welchen{Akk. Mask. Sing.} Anzug?
Diesen{Akk. Mask. Sing.} Anzug.
Magst du dich in diesem{Dat. Mask. Sing.} oder in diesem Spiegel{Dat. Mask. Sing.} anschauen?
In welchem{Dat. Mask. Sing.} Spiegel? Ich sehe keinen.
Die Katze des Hofs{Gen. Mask. Sing.} ist gestern gestorben.
Welches{Gen. Mask. Sing.} Hofs?
Gefällt Ihnen das Auto{Nom. Neut. Sing.}?
Welches{Nom. Neut. Sing.} Auto?
Mögen Sie Brote{Akk. Neut. Plur.}?
Welche{Akk. Neut. Plur.} Brote?
As a side note, you used the termns direct and indirect object. In German grammar, it is better to use dative object, accusative object, genitive object and prepositional object to refer to different types of object. While there is a large overlap between English and French indirect objects and German dative objects, note that a dative object typically connects to the verb directly as a direct object in English and French would. Prepositional objects typically have a case governed by the preposition which can be either dative or accusative.
Finally remember that French direct objects and German accusative objects do not match perfectly. Consider the verb aider qn which in French has a direct object and its translation jemandem helfen which in German requires dative.