wxMaxima
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Static Public Member Functions
OutCommon Class Reference

A collection of common code used in rendering the cells to a non-default output, e.g. a graphics file. More...

#include <OutCommon.h>

Data Structures

class  DataObject
 An object that can be filled with output data in given format for the clipboard. More...
 

Public Member Functions

std::unique_ptr< DataObjectGetDataObject (const wxDataFormat &format)
 Returns the representation that can be placed on the clipboard. Removes the file the data was saved in.
 
 OutCommon (const Configuration *const *configuration, const wxString &filename, int fullWidth, double scale)
 Constructs the instance of the helper, temporarily overriding the configuration.
 
 OutCommon (const Configuration *const *configuration, int fullWidth, double scale)
 
 OutCommon (const OutCommon &)=delete
 
void operator= (const OutCommon &)=delete
 
int Scale_Px (double px) const
 
double GetScale () const
 
const wxString & GetFilename () const
 
const wxString & GetTempFilename () const
 
ConfigurationGetConfiguration ()
 Get the configuration for the file/bitmap/... output.
 
const ConfigurationGetScreenConfig () const
 Get the configuration for the screen output.
 
wxSize getPPI () const
 
void SetRecalculationContext (wxDC *context)
 Sets the context for the configuration used in recalculating the cell dimensions.
 
bool PrepareLayout (Cell *tree)
 Prepares to render the tree to the output DC, and computes the size of the output.
 
wxSize GetSize () const
 Returns the size of the prepared output layout.
 
void SetSize (wxSize size)
 Sets the "default" size of the prepared layout.
 
wxSize GetScaledSize () const
 Returns the size of the prepared output layout multiplied by the scale factor.
 
wxSize GetInvScaledSize () const
 Returns the size of the prepared output layout divided by the scale factor.
 
bool ToClipboard (const wxDataFormat &format)
 Copies the representation of the list of cells that was passed to SetData() to the clipboard.
 
void Draw (Cell *tree)
 Recursively draws the cells.
 

Static Public Member Functions

static wxString AccessibleText (const Cell *tree)
 The plain-text form of a cell list, for use as an accessible label.
 

Detailed Description

A collection of common code used in rendering the cells to a non-default output, e.g. a graphics file.

Constructor & Destructor Documentation

◆ OutCommon()

OutCommon::OutCommon ( const Configuration *const *  configuration,
const wxString &  filename,
int  fullWidth,
double  scale 
)
explicit

Constructs the instance of the helper, temporarily overriding the configuration.

Parameters
fullWidthmultiplied by scale is only used as maximum width during line breaking.
configurationThe configuration to build upon
filenameThe name of the output file
scaleThe scaling factor of the output document

Member Function Documentation

◆ AccessibleText()

wxString OutCommon::AccessibleText ( const Cell tree)
static

The plain-text form of a cell list, for use as an accessible label.

Exported maths is a picture: an SVG draws it as anonymous paths, a PNG as pixels, and either way a screen reader has nothing to announce unless we hand it the text. This is the one place that text is derived, so the SVG's <title>/aria-label and the PNG's Description chunk cannot drift apart.

The text is what ListToString() gives - the same rendering the clipboard and the .wxm exporter use, so what is spoken matches what copying the cell as text would give.

Every run of whitespace collapses to a single space. 2-D ASCII-art maths pads its lines with long space runs and tabs to keep fraction bars and matrices aligned; that alignment is meaningless once the text is spoken rather than drawn, and leaving it in makes the label a stuttering mess. Line breaks go for the same reason: the result is a single label, not a document.

Parameters
treeThe cell list that was rendered, or null.
Returns
The label, or an empty string if there is nothing to describe.

The documentation for this class was generated from the following files: