It's not as confusing as it seems:
17 hexes or less, have LOS to target hex: Direct Fire.
17 hexes or less, do not have LOS to target hex: Indirect Fire
More than 17 hexes, have LOS to target hex: Indirect Fire
More than 17 hexes, do not have LOS to target hex: Indirect Fire.
Direct Fire
In all instances, start with the attacker’s Gunnery Skill as a base to-hit number, with a +4 to-hit modifier; apply all other
modifiers as noted below. All direct-fire artillery attacks are made during the Weapon Attack Phase.
Cruise Missiles: Cruise missiles cannot be used to make any of the following attacks.
Flight Times: As noted on the Indirect Artillery Flight Times Table (see p. 181), any direct-fire artillery attack lands in the
same turn it is made.
To make a direct artillery attack, the artillery unit must have line of sight to the target hex, and the target hex must be no further than seventeen hexes away. Do not modify the to-hit number for range, target movement, the terrain of the target hex or an immobile target. The base to-hit number is modified normally for the attacker’s movement and for firing through (not into) woods and for other terrain features. -- Tactical Operations, Corrected Second Printing, p. 185.
So for direct fire this gives modifiers of: Gunnery Skill +4 + attacker's movement modifier + intervening terrrain
Indirect Fire at Targets Seventeen Hexes or Less Away
Artillery units may make an indirect attack on a unit that is less than seventeen hexes away if there is no LOS to the target hex. Modify the to-hit number for attacker movement during the turn in which it fires. Note: If firing at targets more than seventeen hexes away, use the standard rules for indirect artillery fire.
-- Tactical Operations, Corrected Second Printing, p. 185.
So this gives us the following modifiers:
Indirect Fire, within 17 hexes: Gunnery Skill +4 + Attacker's movement modifier
(the +4 comes because it's under the full page Direct Fire heading on p. 185 which states that "In all instances, start with the attacker’s Gunnery Skill as a base to-hit number, with a +4 to-hit modifier; apply all other modifiers as noted below." So it's a hybrid between Direct and Indirect attack)
For all Indirect fire, with or without LOS, outside of 17 hexes: Gunnery skill +7 + Artillery Modifiers from the Artillery Modifiers table on p. 180 of Tactical Operations. Artillery attacks over 17 hexes away also have to take into account flight time from the Indirect Artillery Flight Times table on p. 181 of Tactical Operations, as they are over 1 mapsheet away from the target.