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; }
// ********************************************************* // 印刷プレビュー // ********************************************************* 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 ); } }
// ********************************************************* // 印刷開始 // ********************************************************* 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>" ); }
// ********************************************************* // 印刷終了 // ********************************************************* void LboxIEPrint::EndDoc( void ) { this->Doc.Put( "</PRE>\n" ); this->Doc.Put( "</BODY>\n" ); this->Doc.Put( "</HTML>\n" ); this->Doc.Close(); }
// ********************************************************* // 改ページ // ********************************************************* void LboxIEPrint::NextPage( void ) { this->Doc.Put( "</PRE>\n" ); this->Doc.Put( "<PRE style='page-break-before:always'>" ); }
// ********************************************************* // 文字列出力 // ********************************************************* void LboxIEPrint::Write( LboxString *LString ) { LboxIEPrint::Write( LString->szLboxString ); } void LboxIEPrint::Write( LPTSTR lpData ) { this->Doc.Put( lpData ); }
// ********************************************************* // 改行出力 // ********************************************************* void LboxIEPrint::Cr( int nCr ) { int i; for( i = 1; i <= nCr; i++ ) { this->Doc.Put( "\n" ); } }
// ********************************************************* // プレビューウインドウの存在チェック // ********************************************************* 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; }
// ********************************************************* // フォントサイズ指定文字列作成 // ********************************************************* 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; }
// ********************************************************* // 強調文字列作成 // ********************************************************* 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; }
// ********************************************************* // 左位置指定文字列作成 // ********************************************************* 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; }