The no-firing-inside-buildings or underground is a valid problem, sure. (with z-levels, its no problem - just allow firing if there are at least 5+ empty z-levels above the firing position)
As is, one would have to do a “more hacky” implementation:
If its underground, disallow completely as there are no high ceilings undeground currently (missile silo discounted as it is very cramped inside)
If above ground, disable firing if the mortar’s tile has a roof. If the target’s tile has a roof, allow the mortar to land on that roof 
The indirect firing method is no problem though, just choose the point inside the reality bubble where you wish the shell to land. If its valid to shoot (no ceiling), shell will land there. (if accurate shot)
As for accurancy, i guess a mortar cannot be astoundingly difficult to aim, or soldiers would not hit anything during battle conditions. Mortar teams certainly weren’t crunching ballistics math in the field.
My impression is that mortars are marked with a distance scale, so one has to point correctly, assess distance, set the weapon for that distance, and fire.
Of course this is not really accurate, but it is no problem with a big blast radius.
And of course, heavy weapons skill can represent mortar accurancy: Shell lands in a random position inside a circle with the target in the center, and within a radius determined by skill. (large radius with low skill and small with high skill)
EDIT
For completion purposes:
If not moving between shots, each consequent mortar shot must gain an accurancy bonus (simulating aiming readjustments)