First case: The attack bonus is correct, +4 for strength, +1 BAB, +1 WF. The damage is also correct, 1-1/2 strength bonus.
Second case, attack bonus is correct, but the damage is incorrect.
You can choose to take a –1 penalty on all melee attack rolls and combat maneuver checks to gain a +2 bonus on all melee damage rolls. This bonus to damage is increased by half (+50%) if you are making an attack with a two-handed weapon
(d20pfsrd.com)
This actually means that its supposed to be 2d6 + 9, as the bonus is +3.
Third case, your raging strength is 22. That is a +6 bonus, meaning +8 normal raging attack bonus, and +7 when power attacking. The damage is 2d6 + 12, just as stated.
- Greatsword +6, 2d6 + 6
- Power attack: Greatsword +5, 2d6 + 9
- Rage, Power attack: Greatsword +7, 2d6 + 12
- Rage: Greatsword + 8, 2d6 + 9
Correct (and downvote) me if I'm wrong, not exactly a PF expert
Edit: I'll add how to calculate it for future reference:
Attack bonus: That is your BAB + strength modifier + any feats and buffs
BAB: in the barbarian case, it is equal to your class level
Strength modifier: not 1-1/2. In ranged attacks, it is the Dex modifier.
Feats: In your case, Weapon Focus, although others may apply.
The damage bonus: your strength modifier (or 1-1/2 of it when fighting with two hands and a non-light weapon) + any relevant feat bonuses
Feat bonus, in your case is the Power attack, described above.
Edit 2:
As Rob noted in the comments, it is extremely helpful to have a character sheet when enraged, and when not. It means that you have all your stats written down, including the attacks, and you can just switch as you start raging.
As I'm wielding a crossbow, would I add my attack missile bonus (+12)
to my attack roll to see if I get past the AC, or to the damage roll
to see how much damage I deal?
The listed missile attack bonus is used to determine if you hit something; it's added only to your attack rolls. The damage rolls are determined seperately. For a crossbow, by default the damage is only the flat roll from the weapon.
You add the magical enhancement bonus, if it has one, to both the attack roll and the damage.
It's even weirder for bows. When shooting with a bow, you also attack with the listed missile attack bonus, but you have to use your strength modifier on the damage roll if it is negative. Which means with a bow your character would deal -1 damage because of low strength, but a high strength character would not add his strength to the damage roll unless it's a special (expensive) Composite Bow.
Hope this helps clear it up a little.
Best Answer
I was just walking someone through this last night and it is tricky because of how far apart all the relevant rules are. Your proficiency bonus depends on your level, as shown in the chart on PHB p.15 and in your class advancement chart. You add it whenever you use a tool, skill, or weapon you're proficient in (among other things), as explained on PHB p. 12.
Stat bonus: By default, melee weapons use Strength and ranged weapons use Dexterity (PHB p. 194). However, melee weapons with Finesse (as indicated in the table on PHB p. 149) let you use Dexterity instead if you so choose, as described on PHB p. 147. Also, Thrown weapons use the same attribute you would use if you were using it as a melee weapon - so Strength unless it has the Finesse property, in which case you can choose to use Dexterity instead.
You'll use Strength for both: the halberd because it's a melee weapon without Finesse, the javelin because it's a Thrown weapon without Finesse. Your attack roll modifier is [your proficiency bonus + STR + any other relevant modifiers]. For a beginning character (Levels 1-4) with a Strength of 16, that'll be +5 total.