how can I write in mandarin using Writer in

I am learning Mandarin and need to find a way to write in characters by inputting the pinyin on std QWERTY keyboard. Do I need an add-on or download additional languages? And how do I control a switch between normal english entry and pinyin-mandarin when required?
Many thanks