scantools  1.0.4
Graphics manipulation with a view towards scanned documents
Public Types | Public Member Functions | List of all members
paperSize Class Reference

The paperSize class identifies and stores paper sizes. More...

#include <paperSize.h>

Public Types

enum  format {
  A4 , A5 , empty , Letter ,
  Legal
}
 List of supported standard sizes. More...
 

Public Member Functions

 paperSize ()
 Constructs empty paperSize.
 
 paperSize (length width, length height)
 Constructs paperSize of given width and height. More...
 
 paperSize (format f)
 Constructs paperSize for given standard format. More...
 
 paperSize (QString formatString, bool *ok=0)
 Constructs paperSize from a string. More...
 
bool isEmpty () const
 Checks for empty paper size. More...
 
void setHeight (length height)
 Sets paper height. More...
 
void setWidth (length width)
 Sets paper width. More...
 
length height () const
 Height of the paper. More...
 
length width () const
 Width of the paper. More...
 
void setSize (format f)
 Sets paperSize to a given standard format. More...
 
bool setSize (QString formatString)
 Reads paperSize from a string. More...
 

Detailed Description

The paperSize class identifies and stores paper sizes.

This is a trivial class that helps to identify and store paper sizes. It knows about a few standard sizes.

Definition at line 31 of file paperSize.h.

Member Enumeration Documentation

◆ format

List of supported standard sizes.

Enumerator
A4 

DIN A4.

A5 

DIN A5.

empty 

0x0mm

Letter 

US Standard Letter.

Legal 

US Legal.

Definition at line 35 of file paperSize.h.

Constructor & Destructor Documentation

◆ paperSize() [1/3]

paperSize::paperSize ( length  width,
length  height 
)
inline

Constructs paperSize of given width and height.

Parameters
widthWidth of the new paper size
heightHeight of the new paper size

Definition at line 53 of file paperSize.h.

◆ paperSize() [2/3]

paperSize::paperSize ( format  f)
inline

Constructs paperSize for given standard format.

Parameters
fStandard paper format

Definition at line 61 of file paperSize.h.

◆ paperSize() [3/3]

paperSize::paperSize ( QString  formatString,
bool *  ok = 0 
)
inline

Constructs paperSize from a string.

This method calls setSize(QString, bool *) interally.

Parameters
okIf the string is not recoginzed *ok is set to false and the paper size if empty. Otherwise, *ok is set to true.
formatStringShould be "A4", "Letter", "297mmx210mm" etc.

Definition at line 74 of file paperSize.h.

Member Function Documentation

◆ height()

length paperSize::height ( ) const
inline

Height of the paper.

Returns
height

Definition at line 110 of file paperSize.h.

◆ isEmpty()

bool paperSize::isEmpty ( ) const
inline

Checks for empty paper size.

Returns
True if either width <= 0mm or height <= 0.mm, false otherwise

Definition at line 84 of file paperSize.h.

◆ setHeight()

void paperSize::setHeight ( length  height)
inline

Sets paper height.

Parameters
heightHeight of the papger

Definition at line 92 of file paperSize.h.

◆ setSize() [1/2]

void paperSize::setSize ( format  f)

Sets paperSize to a given standard format.

Parameters
fOn of the standard formats defined above

◆ setSize() [2/2]

bool paperSize::setSize ( QString  formatString)

Reads paperSize from a string.

Parameters
formatStringShould be "A4", "Letter", "297mmx210mm" etc.
Returns
If the string is not recoginzed false is returned and the paper size if empty. Otherwise, the methods returns true.

◆ setWidth()

void paperSize::setWidth ( length  width)
inline

Sets paper width.

Parameters
widthWidth of the papger

Definition at line 101 of file paperSize.h.

◆ width()

length paperSize::width ( ) const
inline

Width of the paper.

Returns
width

Definition at line 118 of file paperSize.h.


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