You do need to declare what type of activation you are doing when you activate the unit. However, if you are doing a fire & movement there is nothing that says you have to declare how far you're going to move. So:
1) You declare a fire & movement action. You have the squad fire at an enemy squad that is in op fire mode and try to pin it. Your attack fails so you decide that your squad will not move any hexes, thus denying the enemy unit a chance to op fire you.
2) You declare a fire & movement action. You advance into a hex that is in LOS and range of an enemy unit that is in op fire. Then enemy decides not to attack you with the opfire in hopes that you will move closer. You decide that's as far as you will advance and fire from there, thus avoiding enemy op fire.
This is where the historical tactic of "Overlapping Fields of Fire" come in handy. This will take care of situation #2.
As for situation #1? Well, you got the drop on them, or they couldn't get a good fix on your position fast enough, or there wasn't enough time to focus on the target after being fired at, or the fire from you unit was just enough to cause them flinch for a second. Remember, if those moves are carried out in Action Turns, it sorta all happens at once. If your opponent really wanted to attack your unit before it dove into cover or out of line of sight, then they should have made sure they won the initiative so they could take their action turns first.