class LboxIEPrint : public LboxIE

  コンストラクタ



このクラスを使用する場合は、アプリケーションの開始処理に CoInitialize( NULL ) を実行し、
アプリケーションの終了処理に CoUninitialize( ) を実行して下さい

  
LboxIEPrint::LboxIEPrint()
{
	LboxTool *TempTool;
	TempTool = new LboxTool();
	TempTool->ProgramDirectory( &TempPath );
	delete TempTool;

	Timeout = 60;
	BaseFont.operator = ("MS 明朝");
	BaseFontSize.operator = ("16px");
	hWndDocView = NULL;
	bPreview = false;
}

LboxIEPrint::~LboxIEPrint()
{
	GetWindowThreadProcessId( this->GetWindowHandle(), &curProcessId );
	EnumWork = new LboxString( 80 );
	EnumWindows(
		EnumCloseProc,
		0
	);
	delete EnumWork;
}
  



  ReportPreview



  
// *********************************************************
// 印刷プレビュー
// *********************************************************
void LboxIEPrint::ReportPreview( LboxString *LString )
{
	LboxIEPrint::ReportPreview( LString->szLboxString );
}
void LboxIEPrint::ReportPreview( LPTSTR lpDocName )
{
	if ( bPreview ) {
		GetWindowThreadProcessId( this->GetWindowHandle(), &curProcessId );
		EnumWork = new LboxString( 80 );
		EnumWindows(
			EnumCloseProc,
			0
		);
		delete EnumWork;
		bPreview = false;
	}

	LboxString *TargetPath;
	TargetPath = new LboxString();

	TargetPath->operator = (&TempPath);
	TargetPath->AddBackslash();
	TargetPath->operator += ( lpDocName );
	TargetPath->operator += ( ".htm" );
	
	this->Load( TargetPath );
	delete TargetPath;

	int i;
	for( i = 0; i < (this->Timeout * 10); i++ ) {
		Sleep( 100 );
		if ( !(this->GetBusy()) ) {
			this->Preview();
			bPreview = true;
			break;
		}
	}

	if ( this->IsPreview() ) {
		BringWindowToTop( this->hWndDocView );
	}

}
  



  StartDoc

  
// *********************************************************
// 印刷開始
// *********************************************************
void LboxIEPrint::StartDoc( LboxString *LString )
{
	LboxIEPrint::StartDoc( LString->szLboxString );
}
void LboxIEPrint::StartDoc( LPTSTR lpDocName )
{
	LboxString *TargetPath;
	TargetPath = new LboxString();

	TargetPath->operator = (&TempPath);
	TargetPath->AddBackslash();
	TargetPath->operator += ( lpDocName );
	TargetPath->operator += ( ".htm" );

	this->Doc.WriteOpen( TargetPath );
	delete TargetPath;

	this->Doc.Put( "<HTML>\n" );
	this->Doc.Put( "<HEAD>\n" );
	this->Doc.Put( "<META http-equiv=\"Content-type\"" );
	this->Doc.Put( " content=\"text/html; charset=Shift_JIS\">\n" );
	this->Doc.PutPrintf("<TITLE>%s</TITLE>\n", lpDocName );
	this->Doc.Put( "<HEAD>\n" );
	this->Doc.Put( "<STYLE>\n" );
	this->Doc.PutPrintf( "PRE { font-family: \"%s\";\n", 
		BaseFont.szLboxString
	);
	this->Doc.PutPrintf( "font-size:%s\n", BaseFontSize.szLboxString );
	this->Doc.Put( "}\n" );
	this->Doc.Put( "</STYLE>\n" );
	this->Doc.Put( "</HEAD>\n" );
	this->Doc.Put( "<BODY>\n" );
	this->Doc.Put( "<PRE>" );

}
  



  EndDoc

  
// *********************************************************
// 印刷終了
// *********************************************************
void LboxIEPrint::EndDoc( void )
{
	this->Doc.Put( "</PRE>\n" );
	this->Doc.Put( "</BODY>\n" );
	this->Doc.Put( "</HTML>\n" );
	this->Doc.Close();
}
  



  NextPage

  
// *********************************************************
// 改ページ
// *********************************************************
void LboxIEPrint::NextPage( void )
{
	this->Doc.Put( "</PRE>\n" );
	this->Doc.Put( "<PRE style='page-break-before:always'>" );
}
  



  Write

  
// *********************************************************
// 文字列出力
// *********************************************************
void LboxIEPrint::Write( LboxString *LString )
{
	LboxIEPrint::Write( LString->szLboxString );
}
void LboxIEPrint::Write( LPTSTR lpData )
{
	this->Doc.Put( lpData );
}
  



  Cr

  
// *********************************************************
// 改行出力
// *********************************************************
void LboxIEPrint::Cr( int nCr )
{
	int i;
	for( i = 1; i <= nCr; i++ ) {
		this->Doc.Put( "\n" );
	}
}
  



  IsPreview

  
// *********************************************************
// プレビューウインドウの存在チェック
// *********************************************************
BOOL LboxIEPrint::IsPreview( void )
{
	BOOL bRet;
	bRet = false;
	hWndDocViewStatic = NULL;

	GetWindowThreadProcessId( this->GetWindowHandle(), &curProcessId );
	EnumWork = new LboxString( 80 );
	EnumWindows(
		EnumIsProc,
		0
	);
	delete EnumWork;
	this->hWndDocView = hWndDocViewStatic;
	if ( this->hWndDocView != NULL ) {
		bRet = true;
	}

	return bRet;
}
  



  Size

  
// *********************************************************
// フォントサイズ指定文字列作成
// *********************************************************
LboxString *LboxIEPrint::Size( int nSize, LboxString *LString )
{
	LboxString Local;
	Local.operator = ("<SPAN style='font-size:");
	Local.Printfcat( "%d'>", nSize );
	Local.operator += ( LString );
	Local.operator += ( "</SPAN>" );
	LString->operator = ( &Local );

	return LString;
}
  



  Bold

  
// *********************************************************
// 強調文字列作成
// *********************************************************
LboxString *LboxIEPrint::Bold( LboxString *LString )
{
	LboxString Local;
	Local.operator = ("<SPAN style='font-weight:bold'>");
	Local.operator += ( LString );
	Local.operator += ( "</SPAN>" );
	LString->operator = ( &Local );

	return LString;
}
  



  Left

  
// *********************************************************
// 左位置指定文字列作成
// *********************************************************
LboxString *LboxIEPrint::Left( int nLeft, LboxString *LString )
{
	LboxString Local;
	Local.operator = ("<SPAN style='position:absolute;left:");
	Local.Printfcat( "%d'>", nLeft );
	Local.operator += ( LString );
	Local.operator += ( "</SPAN>" );
	LString->operator = ( &Local );

	return LString;
}
  










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ