6#if !defined(OWL_PRINTER_H)
10#if defined(BI_HAS_PRAGMA_ONCE)
23#include <owl/printer.rh>
86 virtual void GetDialogInfo(
int& minPage,
int& maxPage,
int& selFromPage,
int& selToPage);
89 virtual bool HasPage(
int pageNumber);
183 auto GetData() const -> const DEVMODE* {
return reinterpret_cast<const DEVMODE*
>(Buffer.data()); }
188 auto GetData() -> DEVMODE* {
return reinterpret_cast<DEVMODE*
>(Buffer.data()); }
191 std::vector<char> Buffer;
194 static auto GetDefaultPrinter() ->
tstring;
200 void SetDevice(
const tstring& device);
201 virtual void ClearDevice();
202 virtual void Setup(
TWindow* parent);
208 auto GetDC() -> std::unique_ptr<TPrintDC>;
210 static void SetUserAbort(HDC abortDC = HDC(-1));
211 static HDC GetUserAbort();
220 TSize GetPageSize()
const;
221 void SetPageSize(
const TSize& pagesize);
222 TSize GetPageSizeInch()
const;
223 void SetPageSizeInch(
const TSize& pageSizeInch);
230 LPCTSTR GetOutputFile()
const;
231 void SetOutputFile(
const tstring& outputFile);
234 virtual void SetPageSizes(
const TPrintDC& dc);
284 return DeviceCapabilities(s.GetDeviceName(), s.GetOutputName(), capability, output, s.GetDevMode());
319 auto GetBinNames() const -> TBinNames;
320 auto GetBins() const -> TBins;
321 auto CanCollate() const ->
bool;
322 auto IsColorDevice() const ->
bool;
323 auto GetMaxCopies() const ->
int;
324 auto GetDriverVersion() const -> DWORD;
325 auto HasDuplexSupport() const ->
bool;
326 auto GetResolutions() const -> TResolutions;
327 auto GetDevModeExtra() const ->
int;
328 auto GetDevModeFields() const -> DWORD;
329 auto GetDriverDependencies() const -> TFileDependencies;
330 auto GetMaxExtent() const ->
TSize;
331 auto GetReadyMedia() const -> TPaperForms;
332 auto GetMediaTypeNames() const -> TMediaTypeNames;
333 auto GetMediaTypes() const -> TMediaTypes;
334 auto GetMinExtent() const ->
TSize;
335 auto GetLandscapeOrientation() const ->
int;
336 auto GetNupConfigurations() const -> TNupConfigurations;
337 auto GetPaperNames() const -> TPaperNames;
338 auto GetPapers() const -> TPapers;
339 auto GetPaperSizes() const -> TPaperSizes;
340 auto GetDescriptionLanguages() const -> TDescriptionLanguages;
341 auto GetMemoryCapacity() const ->
int;
342 auto GetPrintRate() const ->
int;
343 auto GetPrintRatePpm() const ->
int;
344 auto GetPrintRateUnit() const -> TPrintRateUnit;
345 auto GetDevModeSize() const ->
int;
346 auto CanStaple() const ->
bool;
347 auto GetTrueTypeCapabilities() const -> DWORD;
348 auto GetDriverSpecificationVersion() const -> DWORD;
353 virtual
bool ExecPrintDialog(
TWindow* parent);
354 virtual
bool ExecPageSetupDialog(
TWindow* parent);
366 static HDC UserAbortDC;
390 static void Raise(
uint resId = IDS_PRINTERERROR);
404 static void Raise(
int error = SP_ERROR);
TDialog(TWindow *parent, TResId resId, TModule *module=nullptr)
Constructor for a TDialog object.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
A DC class that provides access to a printer.
TPrintDialog::TData contains information required to initialize the printer dialog box with the user'...
TPrintDialog displays a modal print or a page setup dialog.
auto GetData() const -> const DEVMODE *
Returns a pointer to the device data (const).
TDevMode(const tstring &device)
Retrieves the DEVMODE device data for the given device.
auto GetData() -> DEVMODE *
Returns a pointer to the device data.
TPrinterAbortDlg(TWindow *parent, TResId, const tstring &title, const tstring &device, const tstring &port, HDC=HDC(-1))
Constructs an Abort dialog box that contains a Cancel button and displays the given title,...
HDC PrnDC
Device context to print on.
void SetupWindow() override
Overrides SetupWindow. This function disables the Close system menu option.
void CmCancel()
Handles the print-cancel button by setting the user print abort flag in the application.
DECLARE_RESPONSE_TABLE(TPrinterAbortDlg)
TPrinter is an encapsulation around the Windows printer device interface, and represents the physical...
std::vector< tstring > TDescriptionLanguages
Return type for GetDescriptionsLanguages.
std::vector< tstring > TPaperNames
Return type for GetPaperNames.
std::vector< tstring > TPaperForms
Return type for GetReadyMedia.
auto GetSetup() const -> const TPrintDialog::TData &
TPrinter(const tstring &device=GetDefaultPrinter())
Associates this TPrinter object with the given printer device.
TPrintDialog::TData & GetSetup()
Returns a reference to the TPrintDialog data structure.
std::vector< WORD > TBins
Return type for GetBins.
std::vector< tstring > TMediaTypeNames
Return type for GetMediaTypeNames.
std::vector< tstring > TBinNames
Return type for GetBinNames.
std::vector< tstring > TFileDependencies
Return type for GetDriverDependencies.
TPrintRateUnit
Return type for GetPrintRateUnit.
std::vector< int > TNupConfigurations
Return type for GetNupConfigurations.
std::vector< DWORD > TMediaTypes
Return type for GetMediaTypes.
TCapability
Encapsulates the capability constants defined for the Windows API function DeviceCapabilities.
std::vector< TSize > TPaperSizes
Return type for GetPaperSizes.
std::vector< WORD > TPapers
Return type for GetPapers.
auto GetCapability(TCapability capability, TCHAR *output) const -> DWORD
Get information about the device.
std::vector< TSize > TResolutions
Return type for GetResolutions.
TPrintout represents the physical printed document that is to sent to a printer to be printed.
virtual void BeginDocument(int startPage, int endPage, uint flags)
The printer object's Print function calls BeginDocument once before printing each copy of a document.
bool WantForceAllBands() const
Returns true if the force all bands.
LPCTSTR GetTitle() const
Returns the title of the current printout.
virtual bool HasPage(int pageNumber)
HasPage is called after every page is printed.
TPrintDC * GetPrintDC()
Returns the DC associated with the printout.
void SetBanding(bool banding=true)
Sets the banding flag for the printout.
virtual void EndPrinting()
The printer object's Print function calls EndPrinting after all copies of the document finish printin...
TPrintout(LPCTSTR title)
Constructs an instance of TPrintout with the given title.
virtual void EndDocument()
The printer object's Print function calls EndDocument after each copy of the document finishes printi...
virtual void SetPrintParams(TPrintDC *dc, TSize pageSize)
SetPrintParams sets DC to dc and PageSize to pageSize.
virtual void PrintPage(int page, TRect &rect, uint flags)
PrintPage is called for every page (or band, if Banding is true) and must be overridden to print the ...
void SetPageSize(const TSize &pagesize)
Sets the size of the page.
void SetForceAllBands(bool force=true)
Sets the force banding flag.
TSize GetPageSize() const
Retrieves the size of the page.
bool WantBanding() const
Returns true if banding is desired.
void SetTitle(LPCTSTR title)
Sets a new title for this printout.
virtual void GetDialogInfo(int &minPage, int &maxPage, int &selFromPage, int &selToPage)
Retrieves information needed to allow the printing of selected pages of the document and returns true...
virtual void BeginPrinting()
The printer object's Print function calls BeginPrinting once at the beginning of a print job,...
void SetPrintDC(TPrintDC *dc)
Sets the associated DC.
TRect is a mathematical class derived from tagRect.
The tagSIZE struct is defined as.
Classes that inherit from TStreamableBase are known as streamable classes (their objects can be writt...
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TXPrinter * Clone()
Clone the exception object for safe throwing across stack frames.
void Throw()
Throws the exception.
TXPrinter(uint resId=IDS_PRINTERERROR)
Constructs a TXPrinter object with a default IDS_PRINTERERROR message.
static void Raise(uint resId=IDS_PRINTERERROR)
Creates the exception object and throws it.
tstring GetErrorMessage(TModule *=0) const
Returns the error message for the current error code.
TXPrinting(int error=SP_ERROR)
Constructs a TXPrinting object with a default IDS_PRINTERERROR message.
void Throw()
Throws the exception.
static void Raise(int error=SP_ERROR)
Creates the exception object and throws it.
Definition of TDialog class and TDialogAttr struct.
#define DECLARE_STREAMABLE_OWL(cls, ver)
#define DECLARE_STREAMABLE_INLINES(cls)
TXOwl(const tstring &msg, uint resId=0)
An OWL exception with a given message for displaying and an unsigned Id that can be used for identifi...
TPrintoutFlags
TPrintout banding flags.
@ pfText
Current band accepts text.
@ pfBoth
Current band accepts both text and graphics.
@ pfGraphics
Current band accepts graphics.
Object Windows Library (OWLNext Core).
Definition of Print and PrintSetup common Dialogs classes.