|
wxMaxima
|
Document serializers extracted from the Worksheet class. More...
#include <wx/gdicmn.h>#include <wx/string.h>#include <wx/textfile.h>#include <memory>#include <vector>Go to the source code of this file.
Functions | |
| bool | WorksheetExport::ExportToHTML (GroupCell *tree, Configuration *configuration, const wxString &file, ViewCellPointers *cellPointers, GroupCell *hCaret) |
| Export the tree to an HTML file. | |
| std::unique_ptr< Cell > | WorksheetExport::CopySelection (Cell *start, Cell *end, bool asData=false) |
| Copy the cell range into a fresh list of cells. | |
| wxSize | WorksheetExport::CopyToFile (const wxString &file, Cell *start, Cell *end, bool asData, double scale, const Configuration *const *configuration) |
| Render the cell range into an image file; returns the image's size. | |
| bool | WorksheetExport::ExportToTeX (GroupCell *tree, Configuration *configuration, const wxString &file, ViewCellPointers *cellPointers, GroupCell *hCaret) |
| Export the tree to a LaTeX document; images go to a <name>_img directory. | |
| void | WorksheetExport::ExportToMAC (wxTextFile &output, GroupCell *tree, bool wxm, const std::vector< int > &cellMap, bool fixReorderedIndices) |
| Serialize the tree as .wxm (wxm = true) or .mac lines into output. | |
| void | WorksheetExport::AddLineToFile (wxTextFile &output, const wxString &s) |
| Add a (possibly multi-line) string to output as individual lines. | |
| void | WorksheetExport::CalculateReorderedCellIndices (GroupCell *tree, int &cellIndex, std::vector< int > &cellMap) |
| Determine the (iN)/(oN) indices a fresh evaluation would assign. | |
| wxString | WorksheetExport::RTFStart (Configuration *configuration) |
| The RTF document header: font, color and stylesheet tables. | |
| wxString | WorksheetExport::RTFEnd () |
| The RTF document footer matching RTFStart(). | |
| wxString | WorksheetExport::SelectionToSelfContainedHTML (GroupCell *startGroup, GroupCell *endGroup, Configuration *configuration) |
| Render a range of GroupCells as one self-contained HTML document (GH #2265/#2266/#2267): the stylesheet is inlined into a <style> element and every image is inlined as a base64 data: URI, so the result has no external file references at all and can be dropped straight onto the clipboard for "Copy as HTML" or otherwise used outside the context of the original document's directory. | |
Document serializers extracted from the Worksheet class.
These functions turn a worksheet's cell tree into HTML, LaTeX and .mac/.wxm batch files, plus the RTF document frame used by the clipboard code. They are document functionality, not view functionality: they read only the cell tree and the Configuration, never the scrolling/cursor/mouse state, which is why they live outside the Worksheet class. Worksheet keeps thin wrappers that add the view-side bracketing (busy cursor, clip-region toggling, the saved-flag and backup-file dance).
test_WorksheetExport pins the byte-exact output of everything in here.
| void WorksheetExport::CalculateReorderedCellIndices | ( | GroupCell * | tree, |
| int & | cellIndex, | ||
| std::vector< int > & | cellMap | ||
| ) |
Determine the (iN)/(oN) indices a fresh evaluation would assign.
Fills cellMap with old-index -> new-index so ExportToMAC can renumber references inside the exported code.
| std::unique_ptr< Cell > WorksheetExport::CopySelection | ( | Cell * | start, |
| Cell * | end, | ||
| bool | asData = false |
||
| ) |
Copy the cell range into a fresh list of cells.
| asData |
|
| bool WorksheetExport::ExportToHTML | ( | GroupCell * | tree, |
| Configuration * | configuration, | ||
| const wxString & | file, | ||
| ViewCellPointers * | cellPointers, | ||
| GroupCell * | hCaret | ||
| ) |
Export the tree to an HTML file.
Writes the HTML to file and the stylesheet, the equation images (in the format selected by Configuration::HTMLequationFormat()) and a .wxmx copy of the document into a <name>_htmlimg directory next to it.
| cellPointers | and |
| hCaret | are only passed through to the embedded .wxmx copy, which stores the cursor position. |
| void WorksheetExport::ExportToMAC | ( | wxTextFile & | output, |
| GroupCell * | tree, | ||
| bool | wxm, | ||
| const std::vector< int > & | cellMap, | ||
| bool | fixReorderedIndices | ||
| ) |
Serialize the tree as .wxm (wxm = true) or .mac lines into output.
| cellMap | With fixReorderedIndices, the (iN)/(oN) indices are rewritten through this map (see CalculateReorderedCellIndices) so the numbering matches a fresh evaluation order. |
| wxString WorksheetExport::SelectionToSelfContainedHTML | ( | GroupCell * | startGroup, |
| GroupCell * | endGroup, | ||
| Configuration * | configuration | ||
| ) |
Render a range of GroupCells as one self-contained HTML document (GH #2265/#2266/#2267): the stylesheet is inlined into a <style> element and every image is inlined as a base64 data: URI, so the result has no external file references at all and can be dropped straight onto the clipboard for "Copy as HTML" or otherwise used outside the context of the original document's directory.
Unlike ExportToHTML() this never touches the user's own files: any temporary files it needs (images have to be rendered to a real path, see OutCommon.cpp's PrivateTempDir() for why) are written to and cleaned up from a private, mode-0700 scratch directory.
| startGroup |
param endGroup The inclusive range of top-level cells to render (both must be non-null and endGroup must be reachable from startGroup via GetNext()).