private void initModes() {

        // set all internal modes to disabled
        m_modeEnabled = false;
        m_modeReplaceParagraphs = false;
        m_modeWord = false;
        m_modeXhtml = false;

        // extract all operation modes
        List<String> modes = getModes();

        // configure the tidy depending on the operation mode
        if (modes.contains(CmsHtmlConverter.PARAM_ENABLED)) {
            m_modeEnabled = true;
        }
        if (modes.contains(CmsHtmlConverter.PARAM_XHTML)) {
            m_modeEnabled = true;
            m_modeXhtml = true;
        }
        if (modes.contains(CmsHtmlConverter.PARAM_WORD)) {
            m_modeEnabled = true;
            m_modeWord = true;
        }
        if (modes.contains(CmsHtmlConverter.PARAM_REPLACE_PARAGRAPHS)) {
            m_modeEnabled = true;
            m_modeReplaceParagraphs = true;
        }

        // get line separator length
        m_lineSeparatorLength = System.getProperty("line.separator").length();

        // we need this only if the conversion is enabled
        if (m_modeEnabled) {

            // create the main tidy object
            m_tidy = new Tidy();

            // set specified word, XHTML conversion settings
            m_tidy.setXHTML(m_modeXhtml);
            m_tidy.setWord2000(m_modeWord);

            // add additional tags
            // those are required to handle word 2002 (and newer) documents
            Properties additionalTags = new Properties();
            additionalTags.put("new-empty-tags", "o:smarttagtype");
            additionalTags.put("new-inline-tags", "o:smarttagtype");
            m_tidy.getConfiguration().addProps(additionalTags);

            // set the default tidy configuration

            // set the tidy encoding
            m_tidy.setInputEncoding(getEncoding());
            m_tidy.setOutputEncoding(getEncoding());

            // disable the tidy meta element in output
            m_tidy.setTidyMark(false);
            // disable clean mode
            m_tidy.setMakeClean(false);
            // enable numeric entities
            m_tidy.setNumEntities(true);
            // create output of the body only
            m_tidy.setPrintBodyOnly(true);
            // force output creation even if there are tidy errors
            m_tidy.setForceOutput(true);
            // set tidy to quiet mode to prevent output
            m_tidy.setQuiet(true);
            // disable warning output
            m_tidy.setShowWarnings(false);
            // allow comments in the output
            m_tidy.setHideComments(false);
            // set no line break before a <br>
            m_tidy.setBreakBeforeBR(false);
            // don't wrap attribute values
            m_tidy.setWrapAttVals(false);
            // warp lines after 100 chars
            m_tidy.setWraplen(100);
            // no indentation
            m_tidy.setSpaces(0);

            if (m_modeWord) {
                // create the regular expression for cleanup, only used in word clean mode
                m_clearStyle = new Pattern[m_cleanupPatterns.length];
                for (int i = 0; i < m_cleanupPatterns.length; i++) {
                    m_clearStyle[i] = Pattern.compile(m_cleanupPatterns[i]);
                }
            }

            // add paragraph replacement regular expression and values if needed
            if (m_modeReplaceParagraphs) {
                // add the regular expression and values for paragraph replacements
                String[] newPatterns = new String[m_replacePatterns.length + m_replaceParagraphPatterns.length];
                String[] newValues = new String[m_replacePatterns.length + m_replaceParagraphPatterns.length];
                System.arraycopy(m_replacePatterns, 0, newPatterns, 0, m_replacePatterns.length);
                System.arraycopy(
                    m_replaceParagraphPatterns,
                    0,
                    newPatterns,
                    m_replacePatterns.length,
                    m_replaceParagraphPatterns.length);
                System.arraycopy(m_replaceValues, 0, newValues, 0, m_replacePatterns.length);
                System.arraycopy(
                    m_replaceParagraphValues,
                    0,
                    newValues,
                    m_replacePatterns.length,
                    m_replaceParagraphPatterns.length);
                m_replacePatterns = newPatterns;
                m_replaceValues = newValues;
            }

            // create the regular expression for replace
            m_replaceStyle = new Pattern[m_replacePatterns.length];
            for (int i = 0; i < m_replacePatterns.length; i++) {
                m_replaceStyle[i] = Pattern.compile(m_replacePatterns[i]);
            }
        }
    }
private void initModes ( ) { m_modeEnabled = false ; m_modeReplaceParagraphs = false ; m_modeWord = false ; m_modeXhtml = false ; List < String > modes = getModes ( ) ; if ( modes . contains ( CmsHtmlConverter . PARAM_ENABLED ) ) { m_modeEnabled = true ; } if ( modes . contains ( CmsHtmlConverter . PARAM_XHTML ) ) { m_modeEnabled = true ; m_modeXhtml = true ; } if ( modes . contains ( CmsHtmlConverter . PARAM_WORD ) ) { m_modeEnabled = true ; m_modeWord = true ; } if ( modes . contains ( CmsHtmlConverter . PARAM_REPLACE_PARAGRAPHS ) ) { m_modeEnabled = true ; m_modeReplaceParagraphs = true ; } m_lineSeparatorLength = System . getProperty ( "line.separator" ) . length ( ) ; if ( m_modeEnabled ) { m_tidy = new Tidy ( ) ; m_tidy . setXHTML ( m_modeXhtml ) ; m_tidy . setWord2000 ( m_modeWord ) ; Properties additionalTags = new Properties ( ) ; additionalTags . put ( "new-empty-tags" , "o:smarttagtype" ) ; additionalTags . put ( "new-inline-tags" , "o:smarttagtype" ) ; m_tidy . getConfiguration ( ) . addProps ( additionalTags ) ; m_tidy . setInputEncoding ( getEncoding ( ) ) ; m_tidy . setOutputEncoding ( getEncoding ( ) ) ; m_tidy . setTidyMark ( false ) ; m_tidy . setMakeClean ( false ) ; m_tidy . setNumEntities ( true ) ; m_tidy . setPrintBodyOnly ( true ) ; m_tidy . setForceOutput ( true ) ; m_tidy . setQuiet ( true ) ; m_tidy . setShowWarnings ( false ) ; m_tidy . setHideComments ( false ) ; m_tidy . setBreakBeforeBR ( false ) ; m_tidy . setWrapAttVals ( false ) ; m_tidy . setWraplen ( 100 ) ; m_tidy . setSpaces ( 0 ) ; if ( m_modeWord ) { m_clearStyle = new Pattern [ m_cleanupPatterns . length ] ; for ( int i = 0 ; i < m_cleanupPatterns . length ; i ++ ) { m_clearStyle [ i ] = Pattern . compile ( m_cleanupPatterns [ i ] ) ; } } if ( m_modeReplaceParagraphs ) { String [ ] newPatterns = new String [ m_replacePatterns . length + m_replaceParagraphPatterns . length ] ; String [ ] newValues = new String [ m_replacePatterns . length + m_replaceParagraphPatterns . length ] ; System . arraycopy ( m_replacePatterns , 0 , newPatterns , 0 , m_replacePatterns . length ) ; System . arraycopy ( m_replaceParagraphPatterns , 0 , newPatterns , m_replacePatterns . length , m_replaceParagraphPatterns . length ) ; System . arraycopy ( m_replaceValues , 0 , newValues , 0 , m_replacePatterns . length ) ; System . arraycopy ( m_replaceParagraphValues , 0 , newValues , m_replacePatterns . length , m_replaceParagraphPatterns . length ) ; m_replacePatterns = newPatterns ; m_replaceValues = newValues ; } m_replaceStyle = new Pattern [ m_replacePatterns . length ] ; for ( int i = 0 ; i < m_replacePatterns . length ; i ++ ) { m_replaceStyle [ i ] = Pattern . compile ( m_replacePatterns [ i ] ) ; } } }
Initializes the JTidy modes.<p>