PDF printind data class; written to a file with a link to it in the registry. More...
#include <CCPrintData.h>
Classes | |
struct | LinkData |
Internal helper class for link data. More... | |
struct | PageData |
Structure for keeping data for all the links in a page (and some extra page-specific data). More... | |
Public Member Functions | |
CCPrintData () | |
Default constructor. | |
bool | IsTestPage () const |
Checks if this is a test run. | |
bool | HasData () const |
Check if there's any link data here. | |
const PageData & | GetPageData (int nPage) const |
Returns the link data for the requested page. | |
size_t | GetPageCount () const |
Returns the number of pages we have data for. | |
void | SetTestPage (bool bSet=true) |
Set the page test flag. | |
void | AddLink (const std::tstring &sURL, const std::tstring &sText, int nPage, int nRepeat=1) |
Add a text-based link data. | |
void | AddLink (const std::tstring &sURL, const RECTL &rect, int nPage, LPCTSTR lpTitle=NULL) |
Add a location-based link data. | |
void | AddLink (const RECTL &rect, int nPage, int nDestPage, long lX, long lY, LPCTSTR lpTitle=NULL) |
Add a location-based INTERNAL link data. | |
void | SetPageSize (int nPage, const SIZEL &sz) |
Set the size of a page (return data only). | |
bool | LoadProcessData (HANDLE hPrinter) |
Load the print data for this process from a file (use correct registry key). | |
bool | SaveProcessData (HANDLE hPrinter) |
Save the print data for this process to a file (and update the registry key). | |
bool | UpdateProcessData (HANDLE hPrinter) |
Save the print data for this process to a file (use same file). | |
bool | ReloadProcessData (HANDLE hPrinter) |
Load the print data for this process from a file (use same file). | |
void | CleanSaved (HANDLE hPrinter) |
Clean the file data for this process and the registry keys; also remove. | |
void | CleanThis () |
Clean this object. | |
Protected Member Functions | |
void | CleanOldData (HANDLE hPrinter) |
Clean any old data for any process (older then 5 minutes). | |
void | CleanData (HANDLE hPrinter, DWORD dwProcessID) |
Clean the current data for THIS process. | |
bool | WriteToFile (LPCTSTR lpFilename) |
Write the link data to a file. | |
bool | ReadFromFile (LPCTSTR lpFilename) |
Read the link data from a file. | |
void | EnsurePage (int nPage) |
Ensure we have enough pages to put data in the requested page. | |
Protected Attributes | |
std::vector< PageData > | m_pages |
Array of pages data. | |
PageData | m_dummy |
Default (empty) page data. | |
bool | m_bTestPage |
true if this is a test run (for finding Excel factors, for example) |
PDF printind data class; written to a file with a link to it in the registry.
Definition at line 36 of file CCPrintData.h.
void CCPrintData::AddLink | ( | const RECTL & | rect, | |
int | nPage, | |||
int | nDestPage, | |||
long | lX, | |||
long | lY, | |||
LPCTSTR | lpTitle = NULL | |||
) |
Add a location-based INTERNAL link data.
rect | Location of the link | |
nPage | The page in which this link is printed | |
nDestPage | The page to which the internal link links | |
lX | X Offset in the linked page | |
lY | Y Offset in the linked page | |
lpTitle | The link's tooltip (future) |
Definition at line 744 of file CCPrintData.cpp.
References EnsurePage(), and m_pages.
void CCPrintData::AddLink | ( | const std::tstring & | sURL, | |
const RECTL & | rect, | |||
int | nPage, | |||
LPCTSTR | lpTitle = NULL | |||
) |
Add a location-based link data.
sURL | The link's URL | |
rect | The link location | |
nPage | The page in which this link is printed | |
lpTitle | The link's tooltip (future) |
Definition at line 728 of file CCPrintData.cpp.
References EnsurePage(), and m_pages.
void CCPrintData::AddLink | ( | const std::tstring & | sURL, | |
const std::tstring & | sText, | |||
int | nPage, | |||
int | nRepeat = 1 | |||
) |
Add a text-based link data.
sURL | The link's URL | |
sText | The text to look for | |
nPage | The page in which this link is printed | |
nRepeat | The amount of times to look for the text before making it the link |
Definition at line 714 of file CCPrintData.cpp.
References EnsurePage(), and m_pages.
Referenced by CCCPDFExcelAddinObj::DoPrint(), and OEMSendPage().
void CCPrintData::CleanData | ( | HANDLE | hPrinter, | |
DWORD | dwProcessID | |||
) | [protected] |
Clean the current data for THIS process.
hPrinter | Handle to printer | |
dwProcessID | Process ID |
Definition at line 573 of file CCPrintData.cpp.
References CCPrintRegistry::EraseRegistryValue(), CCPrintRegistry::GetRegistryString(), JOBDATA_FILE_KEY, JOBDATA_TIME_KEY, and tstring.
Referenced by CleanOldData(), CleanSaved(), and SaveProcessData().
void CCPrintData::CleanOldData | ( | HANDLE | hPrinter | ) | [protected] |
Clean any old data for any process (older then 5 minutes).
hPrinter | Handle to printer |
Definition at line 534 of file CCPrintData.cpp.
References CleanData(), CCPrintRegistry::EnumRegistryValues(), CCPrintRegistry::GetRegistryDWORD(), and JOBDATA_TIME_PREFIX.
Referenced by LoadProcessData().
void CCPrintData::CleanSaved | ( | HANDLE | hPrinter | ) |
Clean the file data for this process and the registry keys; also remove.
hPrinter | Handle to the printer |
Definition at line 592 of file CCPrintData.cpp.
References CleanData().
Referenced by CCCPDFExcelAddinObj::DoPrint(), OEMEndDoc(), and CCCPDFExcelAddinObj::OnButtonClick().
void CCPrintData::EnsurePage | ( | int | nPage | ) | [protected] |
Ensure we have enough pages to put data in the requested page.
nPage | The page to ensure exists |
Definition at line 702 of file CCPrintData.cpp.
References m_pages.
Referenced by AddLink().
size_t CCPrintData::GetPageCount | ( | ) | const [inline] |
Returns the number of pages we have data for.
Definition at line 189 of file CCPrintData.h.
References m_pages.
Referenced by OEMStartDoc().
const PageData& CCPrintData::GetPageData | ( | int | nPage | ) | const [inline] |
Returns the link data for the requested page.
nPage | The page to get data for (1-based) |
Definition at line 178 of file CCPrintData.h.
References m_dummy, and m_pages.
Referenced by OEMSendPage(), and OEMStartPage().
bool CCPrintData::HasData | ( | ) | const [inline] |
Check if there's any link data here.
Definition at line 172 of file CCPrintData.h.
References m_pages.
Referenced by CCCPDFExcelAddinObj::DoPrint(), and OEMSendPage().
bool CCPrintData::IsTestPage | ( | ) | const [inline] |
Checks if this is a test run.
Definition at line 167 of file CCPrintData.h.
References m_bTestPage.
Referenced by OEMSendPage(), OEMStartDoc(), and OEMStartPage().
bool CCPrintData::LoadProcessData | ( | HANDLE | hPrinter | ) |
Load the print data for this process from a file (use correct registry key).
hPrinter | Handle to the printer |
Definition at line 458 of file CCPrintData.cpp.
References CleanOldData(), CleanThis(), CCPrintRegistry::GetRegistryDWORD(), CCPrintRegistry::GetRegistryString(), JOBDATA_FILE_KEY, JOBDATA_TIME_KEY, ReadFromFile(), and tstring.
Referenced by OEMStartDoc().
bool CCPrintData::ReadFromFile | ( | LPCTSTR | lpFilename | ) | [protected] |
Read the link data from a file.
lpFilename | Path to file to read |
Definition at line 498 of file CCPrintData.cpp.
References DATAFILE_PAGE_COUNT, DATAFILE_PAGE_TEST, DATAFILE_SECTION_MAIN, FileINI::GetKeys(), FileINI::LoadINIFile(), m_bTestPage, and m_pages.
Referenced by LoadProcessData(), and ReloadProcessData().
bool CCPrintData::ReloadProcessData | ( | HANDLE | hPrinter | ) |
Load the print data for this process from a file (use same file).
hPrinter | Handle to printer |
Definition at line 437 of file CCPrintData.cpp.
References CCPrintRegistry::GetRegistryString(), JOBDATA_FILE_KEY, ReadFromFile(), and tstring.
bool CCPrintData::SaveProcessData | ( | HANDLE | hPrinter | ) |
Save the print data for this process to a file (and update the registry key).
hPrinter | Handle to the printer |
Definition at line 602 of file CCPrintData.cpp.
References CleanData(), CCPrintRegistry::EraseRegistryValue(), JOBDATA_FILE_KEY, JOBDATA_TIME_KEY, CCPrintRegistry::SetRegistryDWORD(), CCPrintRegistry::SetRegistryString(), and WriteToFile().
Referenced by CCCPDFExcelAddinObj::DoPrint().
void CCPrintData::SetPageSize | ( | int | nPage, | |
const SIZEL & | sz | |||
) | [inline] |
Set the size of a page (return data only).
nPage | The page to update | |
sz | The page printing size |
Definition at line 206 of file CCPrintData.h.
References m_pages.
Referenced by OEMSendPage().
void CCPrintData::SetTestPage | ( | bool | bSet = true |
) | [inline] |
Set the page test flag.
bSet | Value to set |
Definition at line 194 of file CCPrintData.h.
References m_bTestPage.
Referenced by OEMSendPage(), and OEMStartDoc().
bool CCPrintData::UpdateProcessData | ( | HANDLE | hPrinter | ) |
Save the print data for this process to a file (use same file).
hPrinter | Handle to printer |
Definition at line 416 of file CCPrintData.cpp.
References CCPrintRegistry::GetRegistryString(), JOBDATA_FILE_KEY, tstring, and WriteToFile().
Referenced by OEMSendPage().
bool CCPrintData::WriteToFile | ( | LPCTSTR | lpFilename | ) | [protected] |
Write the link data to a file.
lpFilename | Name of write to write to |
Definition at line 648 of file CCPrintData.cpp.
References DATAFILE_PAGE_COUNT_WRITE, DATAFILE_PAGE_TEST_WRITE, DATAFILE_SECTION_MAIN_WRITE, m_bTestPage, m_pages, and tstring.
Referenced by SaveProcessData(), and UpdateProcessData().