![]() |
|
|
| Declarations | DeclarationsMacrosThe macro BESTVIEWAPI is declared as: #define BESTVIEWAPI(T) extern "C" T _cdecl Windows classesThere are two windows classes declared:
Broadcast messagesNext broadcast messages are registered during the bvInit function call:
StructuresLANGUAGE_PAIRThe structure is used to describe languages in the resource file.
struct LANGUAGE_PAIR
{
LPCTSTR pszLanguageID; // Language ID from the resource file
LPCTSTR pszLanguageName; // The name of the language
};
COREPREVIEW_PAGESIZEThe structure is used to describe users's paper size. struct COREPREVIEW_PAGESIZE
{
DWORD dwSize; // size of this structure
DWORD dwPageWidth; // width of the paper, in the 0.01 millimiters
DWORD dwPageHeight; // height of the paper, in the 0.01 millimiters
DWORD dwLeftOffset; // offset from the left edge of the paper,
// in the 0.01 millimiters
DWORD dwTopOffset; // offset from the top edge of the paper,
// in the 0.01 millimiters
DWORD dwWidth; // width of the printable area,
// in the 0.01 millimiters
DWORD dwHeight; // height of of the printable area,
// in the 0.01 millimiters
};
COREPREVIEW_COORDINATESPACEThe structure is intended for internal use only. struct COREPREVIEW_COORDINATESPACE
{
HDC dc; // handle of the device context to be set
LONG ViewportExtWidth; // width of viewport
LONG ViewportExtHeight; // height of viewport
LONG ViewportOrgXOffset; // offset from the left edge of the viewport
LONG ViewportOrgYOffset; // offset from the top edge of the viewport
};
PAPERSIZETYPEThe structure describes paper sizes.
struct PAPERSIZETYPE
{
DWORD dmPaperSize; // see DEVMODE dmPaperSize available values.
// Also please read comments for bvGetPaperTypeByItsSizes
// function
LPCTSTR pszName; // name of the paper
LONG Width; // width of the paper, in 0.001 mm
LONG Height; // width of the paper, in 0.001 mm
};
COREPREVIEW_CALLBACKThe structure is used to route messages between user's drawing class and preview window.
struct
COREPREVIEW_CALLBACK
{
DWORD dwSize; // size of this structure
LPVOID lpUserData; // pointer to user data
COREPREVIEW_PAGESIZE CorePreviewPageSize; // the size of page
LONG lNumPages; // the number of pages
LONG lInitialPreviewMode; // the initial preview mode.
// See COREPREVIEW_MODE enumeration
float fScaleFactor; // the scale factor for PREVIEW_MODE_CUSTOM mode
void (__stdcall* pfnDrawPage)
(const COREPREVIEW_CALLBACK *,HDC,DWORD,DWORD,LPRECT); //
// pointer to callback function,
// see CorePreviewCallbackWrapper
// for details
void (__stdcall* pfnMouseMove)
(const COREPREVIEW_CALLBACK *,LONG,LONG,LONG,LONG); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
void (__stdcall* pfnPreviewModeChanged)
(const COREPREVIEW_CALLBACK *,LONG,float); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
void (__stdcall* pfnForwardMessage)
(const COREPREVIEW_CALLBACK*,HWND,UINT,WPARAM,LPARAM); //
// pointer to callback function , see CorePreviewCallbackWrapper
//for details
LONG (__stdcall* pfnWindowIsAboutToClose)(const COREPREVIEW_CALLBACK *); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
void (__stdcall* pfnMsgNcDestroy)(const COREPREVIEW_CALLBACK *,HWND); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
LPCTSTR (__stdcall* pfnGetPrintDocName)(const COREPREVIEW_CALLBACK *); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
void (__stdcall *pfnStartPrint)(const COREPREVIEW_CALLBACK *,HDC,LPCTSTR); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
void (__stdcall *pfnEndPrint)(const COREPREVIEW_CALLBACK * ); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
LONG (__stdcall *pfnBeforePrint)(const COREPREVIEW_CALLBACK * ,HWND,LPCTSTR,PDEVMODE); //
// pointer to callback function, see CorePreviewCallbackWrapper
// for details
};
TYPOGRAPHICTEXTThe structure is used to describe advanced options for drawing text with bvDrawTypographicText function.
struct TYPOGRAPHICTEXT
{
LONG lUseKerningPairs; // if not zero then kerning pairs will be used
LONG lTrimLeadingSpaces; // if not zero then the leading spaces
// in each line will be cut
float fFirstLineOffset; // This the left offset of the first line,
// "break line" indent, in logical units.
float fLineSpacingFactor; // This is the factor of
// the interval between lines.
float fHScalingFactor; // The factor of distance between letters.
float fPreParagraphIndent; // The indent before each paragraph.
float PostParagraphIndent; // The indent after each paragraph.
};
EnumerationsCOREPREVIEW_MODEThe enumeration describes scale modes of the preview window:
enum COREPREVIEW_MODE
{
PREVIEW_MODE_WIDTH=0x01,
PREVIEW_MODE_HEIGHT=0x02,
PREVIEW_MODE_100_PERCENT=0x03,
PREVIEW_MODE_CUSTOM=0x04
};
MessagesThe enumeration describes messages are processed by preview windows:
enum COREPREVIEW_MESSAGES
{
COREPREVIEW_BASE=WM_USER+1,
COREPREVIEW_INIT=COREPREVIEW_BASE+1, // wParam - 0,
// lParam - PCOREPREVIEW_CALLBACK
COREPREVIEW_SETMODE=COREPREVIEW_BASE+2, // wParam - ptr to float - fZoom,
// lParam - COREPREVIEW_MODE
COREPREVIEW_GETMODE=COREPREVIEW_BASE+3, // wParam - ptr to float - fZoom,
// lParam - ptr to LONG,
// COREPREVIEW_MODE
COREPREVIEW_PAGEDIRTY=COREPREVIEW_BASE+4, // wParam - 0, lParam - page number
COREPREVIEW_SHOWMARGINS=COREPREVIEW_BASE+5, // wParam - 0,
// lParam - true - show,
// false - not show
COREPREVIEW_AREMARGINSSHOWN= COREPREVIEW_BASE+6,// wParam - 0,
// lParam - ptr to LONG
COREPREVIEW_SETNUMPAGESPERWIDTH= COREPREVIEW_BASE+7,// wParam - 0,
// lParam - pages
COREPREVIEW_GETNUMPAGESPERWIDTH= COREPREVIEW_BASE+8,// wParam - 0,
// lParam - ptr to LONG
COREPREVIEW_SETNUMPAGESPERHEIGHT= COREPREVIEW_BASE+9,// wParam - 0,
// lParam - pages
COREPREVIEW_GETNUMPAGESPERHEIGHT=COREPREVIEW_BASE+10,// wParam - 0,
// lParam - ptr to LONG
COREPREVIEW_SETHDCCOORINATESPACE=COREPREVIEW_BASE+11 // wParam - 0,
// lParam - PCOREPREVIEW_COORDINATESPACE
};
| |||||||||||||||||||||||||||||||||||||||||||||||||||||