wxMaxima
Loading...
Searching...
No Matches
WXMformat.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2008-2009 Ziga Lenarcic <zigalenarcic@users.sourceforge.net>
5// (C) 2012-2013 Doug Ilijev <doug.ilijev@gmail.com>
6// (C) 2015-2018 Gunter Königsmann <wxMaxima@physikbuch.de>
7// (C) 2020 Kuba Ober <kuba@bertec.com>
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//
14// This program is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License for more details.
18//
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// SPDX-License-Identifier: GPL-2.0+
25
26#ifndef WXMFORMAT_H
27#define WXMFORMAT_H
28
29#include <memory>
30#include "cells/GroupCell.h"
31#include <vector>
32
33class wxTextBuffer;
34
36// This enum's elements must be synchronized with (GroupCell.h) GroupType
37enum WXMHeaderId {
38 WXM_INVALID = GC_TYPE_INVALID,
39 WXM_INPUT = GC_TYPE_CODE,
40 WXM_TITLE = GC_TYPE_TITLE,
41 WXM_SECTION = GC_TYPE_SECTION,
42 WXM_SUBSECTION = GC_TYPE_SUBSECTION,
43 WXM_SUBSUBSECTION = GC_TYPE_SUBSUBSECTION,
44 WXM_HEADING5 = GC_TYPE_HEADING5,
45 WXM_HEADING6 = GC_TYPE_HEADING6,
46 WXM_COMMENT = GC_TYPE_TEXT,
47 WXM_CAPTION = GC_TYPE_IMAGE,
48 WXM_PAGEBREAK = GC_TYPE_PAGEBREAK,
49 WXM_IMAGE,
50 WXM_ANSWER,
51 WXM_QUESTION,
52 WXM_FOLD, WXM_FOLD_END,
53 WXM_HIDE,
54 WXM_AUTOANSWER,
55 // The WXM_HIDDEN_* entries try to recover broken wxm files
56 WXM_HIDDEN_INPUT = GC_TYPE_CODE + 128,
57 WXM_HIDDEN_TITLE = GC_TYPE_TITLE + 128,
58 WXM_HIDDEN_SECTION = GC_TYPE_SECTION + 128,
59 WXM_HIDDEN_SUBSECTION = GC_TYPE_SUBSECTION + 128,
60 WXM_HIDDEN_SUBSUBSECTION = GC_TYPE_SUBSUBSECTION + 128,
61 WXM_HIDDEN_HEADING5 = GC_TYPE_HEADING5 + 128,
62 WXM_HIDDEN_HEADING6 = GC_TYPE_HEADING6 + 128,
63 WXM_HIDDEN_COMMENT = GC_TYPE_TEXT + 128,
64 WXM_HIDDEN_CAPTION = GC_TYPE_IMAGE + 128,
65
66 WXM_MAX // Must be the last member
67};
68
69namespace Format
70{
71
78 wxString TreeToWXM(GroupCell *cell, bool wxm = true);
79
81 std::unique_ptr<GroupCell> TreeFromWXM(const std::vector<wxString> &wxmLines, Configuration *config);
82
88 std::unique_ptr<GroupCell> ParseWXMFile(wxTextBuffer &text, Configuration *config);
89
95 std::unique_ptr<GroupCell> ParseMACContents(const wxString &macContents, Configuration *config);
96
101 std::unique_ptr<GroupCell> ParseMACFile(wxTextBuffer &text, bool xMaximaFile, Configuration *config);
102
104 extern const wxString WXMFirstLine;
105 extern const wxString m_emptyString;
106
107}; // namespace Format
108
109#endif // WXMFORMAT_H
This file defines the class GroupCell that bundles input and output in the worksheet.
The configuration storage for the current worksheet.
Definition: Configuration.h:85
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:74