33 #include <wx/xml/xml.h>
35 #include <wx/filesys.h>
36 #include <wx/fs_arc.h>
38 #include <wx/hashmap.h>
65 void SetUserLabel(wxString label){ m_userDefinedLabel = label; }
70 std::unique_ptr<Cell> ParseLine(wxString s,
CellType style = MC_TYPE_DEFAULT);
75 std::unique_ptr<Cell> ParseTag(wxXmlNode *node,
bool all =
true);
76 std::unique_ptr<Cell> ParseRowTag(wxXmlNode *node);
83 using MathCellFunc = std::unique_ptr<Cell> (
MathParser::*)(wxXmlNode *node);
84 WX_DECLARE_STRING_HASH_MAP(MathCellFunc, MathCellFunctionHash);
87 using GroupCellFunc = std::unique_ptr<GroupCell> (
MathParser::*)(wxXmlNode *node);
88 WX_DECLARE_STRING_HASH_MAP(GroupCellFunc, GroupCellFunctionHash);
91 static MathCellFunctionHash m_innerTags;
93 static GroupCellFunctionHash m_groupTags;
96 static void ParseCommonAttrs(wxXmlNode *node,
Cell *cell);
98 static void ParseCommonAttrs(wxXmlNode *node,
const std::unique_ptr<T> &cell)
99 { ParseCommonAttrs(node, cell.get()); }
102 static void ParseCommonGroupCellAttrs(wxXmlNode *node,
const std::unique_ptr<GroupCell> &group);
105 std::unique_ptr<Cell> HandleNullPointer(std::unique_ptr<Cell> &&cell);
119 wxXmlNode *GetNextTag(wxXmlNode *node);
122 int CountChildren(wxXmlNode *node);
129 wxXmlNode *SkipWhitespaceNode(wxXmlNode *node);
142 std::unique_ptr<Cell> ParseCellTag(wxXmlNode *node);
144 std::unique_ptr<GroupCell> GroupCellFromCodeTag(wxXmlNode *node);
146 std::unique_ptr<GroupCell> GroupCellFromImageTag(wxXmlNode *node);
148 std::unique_ptr<GroupCell> GroupCellFromTitleTag(wxXmlNode *WXUNUSED(node));
150 std::unique_ptr<GroupCell> GroupCellFromSectionTag(wxXmlNode *WXUNUSED(node));
152 std::unique_ptr<GroupCell> GroupCellFromPagebreakTag(wxXmlNode *WXUNUSED(node));
154 std::unique_ptr<GroupCell> GroupCellFromSubsectionTag(wxXmlNode *node);
156 std::unique_ptr<GroupCell> GroupCellFromSubsubsectionTag(wxXmlNode *WXUNUSED(node));
158 std::unique_ptr<GroupCell> GroupCellHeading5Tag(wxXmlNode *WXUNUSED(node));
160 std::unique_ptr<GroupCell> GroupCellHeading6Tag(wxXmlNode *WXUNUSED(node));
162 std::unique_ptr<GroupCell> GroupCellFromTextTag(wxXmlNode *WXUNUSED(node));
168 std::unique_ptr<Cell> ParseEditorTag(wxXmlNode *node);
171 std::unique_ptr<Cell> ParseFracTag(wxXmlNode *node);
173 std::unique_ptr<Cell> ParseText(wxXmlNode *node,
TextStyle style = TS_DEFAULT);
175 std::unique_ptr<Cell> ParseVariableNameTag(wxXmlNode *node){
return ParseText(node->GetChildren(), TS_VARIABLE);}
177 std::unique_ptr<Cell> ParseOperatorNameTag(wxXmlNode *node){
return ParseText(node->GetChildren(), TS_FUNCTION);}
179 std::unique_ptr<Cell> ParseMiscTextTag(wxXmlNode *node);
181 std::unique_ptr<Cell> ParseNumberTag(wxXmlNode *node){
return ParseText(node->GetChildren(), TS_NUMBER);}
183 std::unique_ptr<Cell> ParseHiddenOperatorTag(wxXmlNode *node);
185 std::unique_ptr<Cell> ParseGreekTag(wxXmlNode *node){
return ParseText(node->GetChildren(), TS_GREEK_CONSTANT);}
187 std::unique_ptr<Cell> ParseSpecialConstantTag(wxXmlNode *node){
return ParseText(node->GetChildren(), TS_SPECIAL_CONSTANT);}
189 std::unique_ptr<Cell> ParseFunctionNameTag(wxXmlNode *node){
return ParseText(node->GetChildren(), TS_FUNCTION);}
191 std::unique_ptr<Cell> ParseSpaceTag(wxXmlNode *WXUNUSED(node)){
return std::make_unique<TextCell>(m_group, m_configuration, wxT(
" "));}
196 std::unique_ptr<Cell> ParseMthTag(wxXmlNode *node);
198 std::unique_ptr<Cell> ParseOutputLabelTag(wxXmlNode *node);
200 std::unique_ptr<Cell> ParseStringTag(wxXmlNode *node);
202 std::unique_ptr<Cell> ParseHighlightTag(wxXmlNode *node);
204 std::unique_ptr<Cell> ParseImageTag(wxXmlNode *node);
206 std::unique_ptr<Cell> ParseAnimationTag(wxXmlNode *node);
208 std::unique_ptr<Cell> ParseCharCode(wxXmlNode *node);
210 std::unique_ptr<Cell> ParseSupTag(wxXmlNode *node);
212 std::unique_ptr<Cell> ParseSubTag(wxXmlNode *node);
214 std::unique_ptr<Cell> ParseAbsTag(wxXmlNode *node);
216 std::unique_ptr<Cell> ParseConjugateTag(wxXmlNode *node);
218 std::unique_ptr<Cell> ParseUnderTag(wxXmlNode *node);
221 std::unique_ptr<Cell> ParseTableTag(wxXmlNode *node);
224 std::unique_ptr<Cell> ParseAtTag(wxXmlNode *node);
226 std::unique_ptr<Cell> ParseDiffTag(wxXmlNode *node);
228 std::unique_ptr<Cell> ParseSumTag(wxXmlNode *node);
230 std::unique_ptr<Cell> ParseIntTag(wxXmlNode *node);
232 std::unique_ptr<Cell> ParseFunTag(wxXmlNode *node);
234 std::unique_ptr<Cell> ParseSqrtTag(wxXmlNode *node);
236 std::unique_ptr<Cell> ParseLimitTag(wxXmlNode *node);
238 std::unique_ptr<Cell> ParseParenTag(wxXmlNode *node);
240 std::unique_ptr<Cell> ParseSubSupTag(wxXmlNode *node);
242 std::unique_ptr<Cell> ParseMmultiscriptsTag(wxXmlNode *node);
244 std::unique_ptr<Cell> ParseOutputTag(wxXmlNode *node);
246 std::unique_ptr<Cell> ParseMtdTag(wxXmlNode *node);
249 wxString m_userDefinedLabel;
251 static wxRegEx m_graphRegex;
258 std::shared_ptr<wxFileSystem> m_fileSystem;
259 static wxString m_unknownXMLTagToolTip;
262 #endif // MATHPARSER_H