Getting the source
Vanilla up-stream
See the tools project for build guides for various platforms.
You might be interested particulary in the [Get the source code] (for Linux, but it is quite similar for all the platforms). Also [this page] might interesting for you, though it is a little old.
ooo-build
There are loads of versions of OO.o, and several choices of branch, with multiple outstanding patch sets. I recommend you build from up-stream CVS HEAD milestones (SRC680 milestones), with patch sets to make them easier to build from [1]
The very latest ooo-build (a small ~1.5Mb build wrapper) can be got from CVS thus:
export CVSROOT=':pserver:anonymous@anoncvs.gnome.org:/cvs/gnome'
cvs login
cvs -z3 checkout -P ooo-build
Note: You are going to need to download an additional ~150Mb of compressed source, and have ~3Gb of space to unpack and build it in.