Further work on the document view.
Fix a few bugs.
We only need one PPPreferences class.