wxMaxima
Loading...
Searching...
No Matches
Functions
WorksheetExport.h File Reference

Document serializers extracted from the Worksheet class. More...

#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/textfile.h>
#include <memory>
#include <vector>
Include dependency graph for WorksheetExport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool WorksheetExport::ExportToHTML (GroupCell *tree, Configuration *configuration, const wxString &file, CellPointers *cellPointers, GroupCell *hCaret)
 Export the tree to an HTML file.
 
std::unique_ptr< CellWorksheetExport::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)
 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().
 

Detailed Description

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.

Function Documentation

◆ CalculateReorderedCellIndices()

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.

◆ CopySelection()

std::unique_ptr< Cell > WorksheetExport::CopySelection ( Cell start,
Cell end,
bool  asData = false 
)

Copy the cell range into a fresh list of cells.

Parameters
asData
  • true: The cells are copied in the cell list order.
  • false: The cells are copied in the draw list order

◆ ExportToHTML()

bool WorksheetExport::ExportToHTML ( GroupCell tree,
Configuration configuration,
const wxString &  file,
CellPointers 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.

Parameters
cellPointersand
hCaretare only passed through to the embedded .wxmx copy, which stores the cursor position.

◆ ExportToMAC()

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.

Parameters
cellMapWith fixReorderedIndices, the (iN)/(oN) indices are rewritten through this map (see CalculateReorderedCellIndices) so the numbering matches a fresh evaluation order.