/**
 * Highlighter implementation using the GeSHi algorithm adapted to OpenOffice.org API.
 * 
 * @author cbosdonnat
 */
public final class HighlighterImpl extends WeakBase implements XServiceInfo, XHighlighter {
 
    private static final String IMPLEMENTATION_NAME = HighlighterImpl.class.getName();
    private static final String[] SERVICE_NAMES = { "org.openoffice.coooder.Highlighter" };
 
    private static final int OPEN = 0;
    private static final int CLOSE = 1;
 
    private static final String NUMBER_REGEX = "[-+]?\\b(?:[0-9]*\\.)?[0-9]+\\b";
 
 
    private final XComponentContext mContext;
    private XLanguage mLanguage;
 
    private CompiledPatternsCache mPatternsCache;
 
    private XTextRange mSelectionStart;
    private XTextDocument mTextDocument;
    private int mLength;
 
 
    public HighlighterImpl(XComponentContext pContext) {
        mContext = pContext;
        mPatternsCache = new CompiledPatternsCache();
    };
 
    public static XSingleComponentFactory __getComponentFactory(String pImplementationName) {
        XSingleComponentFactory xFactory = null;
 
        if (pImplementationName.equals(IMPLEMENTATION_NAME)) {
            xFactory = Factory.createComponentFactory(HighlighterImpl.class, SERVICE_NAMES);   
        }
        return xFactory;
    }
}