CCPrintData Class Reference

PDF printind data class; written to a file with a link to it in the registry. More...

#include <CCPrintData.h>

Collaboration diagram for CCPrintData:
Collaboration graph
[legend]

List of all members.

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 PageDataGetPageData (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< PageDatam_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)

Detailed Description

PDF printind data class; written to a file with a link to it in the registry.

Definition at line 36 of file CCPrintData.h.


Member Function Documentation

void CCPrintData::AddLink ( const RECTL &  rect,
int  nPage,
int  nDestPage,
long  lX,
long  lY,
LPCTSTR  lpTitle = NULL 
)

Add a location-based INTERNAL link data.

Parameters:
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.

Parameters:
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.

Parameters:
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 OEMSendPage().

void CCPrintData::CleanData ( HANDLE  hPrinter,
DWORD  dwProcessID 
) [protected]

Clean the current data for THIS process.

Parameters:
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).

Parameters:
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.

Parameters:
hPrinter Handle to the printer

Definition at line 592 of file CCPrintData.cpp.

References CleanData().

Referenced by OEMEndDoc().

void CCPrintData::EnsurePage ( int  nPage  )  [protected]

Ensure we have enough pages to put data in the requested page.

Parameters:
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.

Returns:
The number of pages in the structure

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.

Parameters:
nPage The page to get data for (1-based)
Returns:
The data for the page, or an empty (dummy) data if there's no such page defined

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.

Returns:
true if there's any data, false for no links

Definition at line 172 of file CCPrintData.h.

References m_pages.

Referenced by OEMSendPage().

bool CCPrintData::IsTestPage (  )  const [inline]

Checks if this is a test run.

Returns:
true if this is a test run, false if not

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).

Parameters:
hPrinter Handle to the printer
Returns:
true if loaded the data auccessfully, false if failed to load

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.

Parameters:
lpFilename Path to file to read
Returns:
true if read successfully, false if failed

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).

Parameters:
hPrinter Handle to printer
Returns:
true if reloaded the data auccessfully, false if failed

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).

Parameters:
hPrinter Handle to the printer
Returns:
true if successfully saved, false if failed

Definition at line 602 of file CCPrintData.cpp.

References CleanData(), CCPrintRegistry::EraseRegistryValue(), JOBDATA_FILE_KEY, JOBDATA_TIME_KEY, CCPrintRegistry::SetRegistryDWORD(), CCPrintRegistry::SetRegistryString(), and WriteToFile().

void CCPrintData::SetPageSize ( int  nPage,
const SIZEL &  sz 
) [inline]

Set the size of a page (return data only).

Parameters:
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.

Parameters:
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).

Parameters:
hPrinter Handle to printer
Returns:
true if updated the process data successfully, false if failed

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.

Parameters:
lpFilename Name of write to write to
Returns:
true if successfully write, false if failed

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().


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

Generated on Mon Jun 18 12:40:43 2012 for CC PDF Converter by doxygen 1.6.1