* @param propertiesManager to check properties in
     */
    protected void applyViewerPreferences(Catalog catalog, PropertiesManager propertiesManager) {
        if (catalog == null) {
            return;
        }

        ViewerPreferences viewerPref = catalog.getViewerPreferences();

        // Hide the toolbar?
        if ((viewerPref != null) && (viewerPref.hasHideToolbar())) {
            if (viewerPref.getHideToolbar()) {
                if (completeToolBar != null) {
                    completeToolBar.setVisible(false);
                }
            }
        } else {
            if (completeToolBar != null) {
                completeToolBar.setVisible(
                        !PropertiesManager.checkAndStoreBooleanProperty(propertiesManager,
                                PropertiesManager.PROPERTY_VIEWPREF_HIDETOOLBAR,
                                false));
            }
        }

        // Hide the menubar?
        if ((viewerPref != null) && (viewerPref.hasHideMenubar())) {
            if (viewerPref.getHideMenubar()) {
                if ((viewer != null) && (viewer.getJMenuBar() != null)) {
                    viewer.getJMenuBar().setVisible(false);
                }
            }
        } else {
            if ((viewer != null) && (viewer.getJMenuBar() != null)) {
                viewer.getJMenuBar().setVisible(
                        !PropertiesManager.checkAndStoreBooleanProperty(propertiesManager,
                                PropertiesManager.PROPERTY_VIEWPREF_HIDEMENUBAR,
                                false));
            }
        }

        // Fit the GUI frame to the size of the document?
        if ((viewerPref != null) && (viewerPref.hasFitWindow())) {
            if (viewerPref.getFitWindow()) {
                if (viewer != null) {
                    viewer.setSize(
                            documentViewController.getDocumentView().getDocumentSize());
                }
            }
        } else {
            if ((PropertiesManager.checkAndStoreBooleanProperty(propertiesManager,
                    PropertiesManager.PROPERTY_VIEWPREF_FITWINDOW,
                    false)) && (viewer != null)) {
                viewer.setSize(
                        documentViewController.getDocumentView().getDocumentSize());
            }
        }
    }