Files
libreoffice/helpcompiler/inc/BasCodeTagger.hxx
Andras Timar 67b8c0339e fdo#41737 syntax highlighting of Basic code examples in offline help
Change-Id: I7dc5b189e98a0351bac0eab28c1161b5893f5ef1
2013-02-13 10:19:21 +01:00

57 lines
1.4 KiB
C++

#ifndef BASCODETAGGER_HXX
#define BASCODETAGGER_HXX
#include <iostream>
#include <cstdlib>
#include <string>
#include <list>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <rtl/ustring.hxx>
#include <svtools/syntaxhighlight.hxx>
#include <helpcompiler/dllapi.h>
class BasicCodeTagger;
class LibXmlTreeWalker;
//!Tagger class.
class L10N_DLLPUBLIC BasicCodeTagger
{
private:
xmlDocPtr m_pDocument;
std::list<xmlNodePtr> m_BasicCodeContainerTags;
LibXmlTreeWalker *m_pXmlTreeWalker;
std::list<std::string> m_BasicCodeStringList;
SyntaxHighlighter m_Highlighter;
bool m_bTaggingCompleted;
void tagParagraph( xmlNodePtr paragraph );
xmlChar* getTypeString( TokenTypes tokenType );
void getBasicCodeContainerNodes();
void tagBasCodeParagraphs();
public:
enum TaggerException { FILE_WRITING, NULL_DOCUMENT, EMPTY_DOCUMENT };
BasicCodeTagger( xmlDocPtr rootDoc );
~BasicCodeTagger();
void tagBasicCodes();
};
//================LibXmlTreeWalker===========================================================
class L10N_DLLPUBLIC LibXmlTreeWalker
{
private:
xmlNodePtr m_pCurrentNode;
std::list<xmlNodePtr> m_Queue; //!Queue for breath-first search
public:
LibXmlTreeWalker( xmlDocPtr doc );
~LibXmlTreeWalker() {}
void nextNode();
xmlNodePtr currentNode();
bool end();
void ignoreCurrNodesChildren();
};
#endif