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

Declares wxm::BreakIntoPages(), the page breaking printing and the PDF export share. More...

#include "precomp.h"
#include <wx/defs.h>
#include <vector>
Include dependency graph for PageBreaks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::vector< wxCoord > wxm::BreakIntoPages (const GroupCell *tree, wxCoord pageHeight)
 Decides where the pages of a printout or a PDF start.
 

Detailed Description

Declares wxm::BreakIntoPages(), the page breaking printing and the PDF export share.

Function Documentation

◆ BreakIntoPages()

std::vector< wxCoord > wxm::BreakIntoPages ( const GroupCell *  tree,
wxCoord  pageHeight 
)

Decides where the pages of a printout or a PDF start.

The worksheet is laid out as one endless scroll as wide as the paper; this cuts that scroll into pages no taller than pageHeight. A page may only start between two blocks, a block being the input part of a group or one line of its output, so no line is ever cut in two. Beyond that:

  • a page break cell (GC_TYPE_PAGEBREAK) starts a new page with whatever follows it, even if that would still fit on the current page;
  • a heading is not left alone at the bottom of a page: if the group after it has to go onto the next page, the heading goes with it;
  • a block taller than a whole page gets a page of its own (and is cut off at its bottom, as nothing can be done about that) – unless its last cell says where it may be cut (Cell::PageBreakCandidates(), an oversized matrix between its rows). Then it starts on the current page if its first part fits there, and continues over as many pages as it needs, each cut at the last such place that still fits.
Parameters
treeThe first group of the laid-out worksheet: its cells' positions (GetRect()) have to be up to date.
pageHeightThe height of the printable area, in the units the worksheet was laid out in.
Returns
The worksheet y coordinate of the top of each page, in ascending order. Empty only for an empty worksheet. A page ends where the next one starts; the last one ends pageHeight below its start.

The first block of its group?

The group it belongs to

Where a page may start inside this block (Cell::PageBreakCandidates())

Only those of the block's last cell: see there.