When it happens: Cursing can begin in any stage of dementia, especially moderate.
Why it happens: In someone with dementia, swearing is rarely completely intentional. It's part of a host of language problems that often strike and that are slightly different from person to person. Lost inhibition may be allowing the brain's language processing centers to release formerly self-censored words. He or she may in fact be trying to communicate a different sentiment entirely. Cursing often shows up in otherwise mild-mannered adults who never misspoke before.
What you can do:
Avoid shaming the person or urging your loved one to hold his or her tongue in front of children.
Don't act shocked or even startled. These reactions change the vibe in the room without changing the behavior, which can't be helped.
Act as if you didn't hear anything. As with a young child, drawing attention to the word may cause it to be used again, to spark the reaction.
Alternately, in some people it works to matter-of-factly correct: "We don't use that word, Bob." Then distract.
In public or among company, simply smile apologetically and (discreetly) explain that your loved one has dementia and cursing is an unfortunate side effect for some people.
Explain to children that the person has a "brain disease" that makes him or her talk funny and say things that aren't meant (and are not to be repeated!).