void *CnvXtthelpToHtml::insert( navh_eItemType item_type, const char *text1, const char *text2, const char *text3, const char *link, const char *link_bookmark, const char *file_name, navh_eHelpFile file_type, int help_index, const char *bookmark) { int i; static int in_table = 0; if ( (text2 && strcmp(text2, "") != 0) || (text3 && strcmp(text3, "") != 0) ) { if ( !in_table && cf) { cf->f << "<TABLE>" << endl; in_table = 1; } } else { if ( in_table && cf) { // Close table (keep if empty line) if ( !( text1 && strcmp( text1, "") == 0 && (item_type == navh_eItemType_Help || item_type == navh_eItemType_HelpCode || item_type == navh_eItemType_HelpBold))) { cf->f << "</TABLE>" << endl; in_table = 0; } } } switch ( item_type) { case navh_eItemType_Topic: { pwr_tFileName fname; subject_to_fname( fname, text1, 1); cf = new CnvFile(); cf->f.open( fname); cf->f << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\"http://www.w3.org/TR/REC-html40/loose.dtd>" << endl << "<!--NewPage-->" << endl << "<HTML>" << endl << "<HEAD>" << endl << "<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">" << endl << "<!-- Generated by co_convert.-->" << endl << "<TITLE>" << endl << "Generated Documentation (Untitled)" << endl << "</TITLE>" << endl << "<LINK REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"../pcss.css\" TITLE=\"Style\">" << endl << "</HEAD>" << endl << //"<H2>" << text1 << "</H2><BR>" << endl << "<P>" << endl; return NULL; } case navh_eItemType_EndTopic: { if ( !cf) break; cf->f.close(); delete cf; cf = 0; return NULL; } case navh_eItemType_Help: case navh_eItemType_HelpCode: { if ( !cf) break; if ( item_type == navh_eItemType_HelpCode && !in_table) { cf->f << "<CODE>"; for ( const char *s = text1; s && *s == ' '; s++) cf->f << " "; } pwr_tFileName fname; if ( strcmp( link, "") != 0) { if ( strncmp( link, "$web:", 5) == 0) { if ( strncmp( &link[5], "$pwrp_web/", 10) == 0) strcpy( fname, &link[15]); else strcpy( fname, &link[5]); } else if ( strncmp( link, "$class:", 7) == 0) { char *s; // Get prefix from file strcpy( fname, "./orm/"); s = strrchr( file_name, '/'); if ( s) strcat( fname, s+1); s = strchr( fname, '_'); if ( s) *(s+1) = 0; strcat( fname, &link[7]); strcat( fname, ".html"); } else if ( (strstr( link, ".htm") != 0) || (strstr( link, ".pdf") != 0)) { strcpy( fname, link); } else { subject_to_fname( fname, link, 0); if ( strcmp( link_bookmark, "") != 0) { strcat( fname, "#"); strcat( fname, link_bookmark); } } if ( !in_table) cf->f << "<A HREF=\"" << fname << "\">"; } else if ( bookmark) { if ( in_table) { cf->f << "</TABLE>" << endl; in_table = 0; } cf->f << "<A NAME=\"" << bookmark << "\">"; } if ( ! in_table) { cf->f << text1; if ( strcmp( link, "") != 0 || bookmark) cf->f << "<BR></A>" << endl; else cf->f << "<BR>" << endl; if ( item_type == navh_eItemType_HelpCode) cf->f << "</CODE>"; } else { cf->f << "<TR><TD>"; if ( strcmp( link, "") != 0) cf->f << "<A HREF=\"" << fname << "\">"; else if ( bookmark != 0) cf->f << "<A NAME=\"" << bookmark << "\">"; cf->f << text1; if ( strcmp( text2, "") != 0 || strcmp( text3, "") != 0) { for ( i = 0; i < (int)(CNV_TAB - strlen(text1)); i++) cf->f << " "; cf->f << " </TD><TD>" << text2; if ( strcmp( text3, "") != 0) { for ( i = 0; i < (int)(CNV_TAB - strlen(text2)); i++) cf->f << " "; cf->f << " </TD><TD>" << text3; } } if ( strcmp( link, "") != 0 || bookmark) cf->f << "</A>" << endl; else cf->f << endl; cf->f << "</TD></TR>"; } return NULL; } case navh_eItemType_HelpBold: { if ( !cf) break; pwr_tFileName fname; if ( strcmp( link, "") != 0) { if ( strncmp( link, "$web:", 5) == 0) { if ( strncmp( &link[5], "$pwrp_web/", 10) == 0) strcpy( fname, &link[15]); else strcpy( fname, &link[5]); } else if ( strncmp( link, "$class:", 7) == 0) { char *s; // Get prefix from file strcpy( fname, "./orm/"); s = strrchr( file_name, '/'); if ( s) strcat( fname, s+1); s = strchr( fname, '_'); if ( s) *(s+1) = 0; strcat( fname, &link[7]); strcat( fname, ".html"); } else if ( (strstr( link, ".htm") != 0) || (strstr( link, ".pdf") != 0)) { strcpy( fname, link); } else { subject_to_fname( fname, link, 0); if ( strcmp( link_bookmark, "") != 0) { strcat( fname, "#"); strcat( fname, link_bookmark); } } if ( !in_table) cf->f << "<A HREF=\"" << fname << "\">"; } else if ( bookmark) { if ( !in_table) cf->f << "<A NAME=\"" << bookmark << "\">"; } if ( ! in_table) { cf->f << "<B>" << text1 << "</B>"; if ( strcmp( link, "") != 0 || bookmark) cf->f<< "<BR></A>" << endl; else cf->f<< "<BR>" << endl; } else { cf->f << "<TR><TD><B>"; if ( strcmp( link, "") != 0) cf->f << "<A HREF=\"" << fname << "\">"; else if ( bookmark != 0) cf->f << "<A NAME=\"" << bookmark << "\">"; cf->f << text1; if ( strcmp( link, "") != 0 || bookmark) cf->f << "</A>"; if ( strcmp( text2, "") != 0 || strcmp( text3, "") != 0) { for ( i = 0; i < (int)(CNV_TAB - strlen(text1)); i++) cf->f << " "; cf->f << " </B></TD><TD><B>" << text2; if ( strcmp( text3, "") != 0) { for ( i = 0; i < (int)(CNV_TAB - strlen(text2)); i++) cf->f << " "; cf->f << " </B></TD><TD><B>" << text3; } } if ( strcmp( link, "") != 0 || bookmark) cf->f << "</A>" << endl; else cf->f << endl; cf->f << "</B></TD></TR>"; } return NULL; } case navh_eItemType_HelpHeader: { if ( !cf) break; cf->f << "<H1>" << text1 << "</H1>" << endl; return NULL; } case navh_eItemType_Header: { if ( !cf) break; if ( bookmark != 0) cf->f << "<A NAME=\"" << bookmark << "\">"; cf->f << "<H3>" << text1 << "</H3>"; if ( bookmark != 0) cf->f << "</A>"; cf->f << endl; return NULL; } case navh_eItemType_HeaderLarge: { if ( !cf) break; if ( bookmark != 0) cf->f << "<A NAME=\"" << bookmark << "\">"; cf->f << "<H2>" << text1 << "</H2>"; if ( bookmark != 0) cf->f << "</A>"; cf->f << endl; return NULL; } case navh_eItemType_HorizontalLine: { if ( !cf) break; cf->f << "<HR>" << endl; return NULL; } case navh_eItemType_Image: { if ( !cf) break; cf->f << "<IMG SRC=\"" << text1 << "\"><BR>" << endl; return NULL; } default: return 0; } return 0; }
void *CnvXtthelpToText::insert( navh_eItemType item_type, const char *text1, const char *text2, const char *text3, const char *alink, const char *link_bookmark, const char *file_name, navh_eHelpFile file_type, int help_index, const char *bookmark, int coding) { if ( print_disable) return NULL; if ( item_type != navh_eItemType_Topic && !in_topic) return NULL; switch ( item_type) { case navh_eItemType_DocTitlePage: case navh_eItemType_DocInfoPage: case navh_eItemType_Style: case navh_eItemType_EndChapter: case navh_eItemType_Chapter: case navh_eItemType_HeaderLevel: case navh_eItemType_EndHeaderLevel: case navh_eItemType_Image: return NULL; case navh_eItemType_Topic: { if ( first_topic) { pwr_tFileName fname; subject_to_fname( fname, text1, 1); cf = new CnvFile(); cf->f.open( fname); first_topic = 0; } in_topic = 1; return NULL; } case navh_eItemType_EndTopic: in_topic = 0; break; case navh_eItemType_PageBreak: { cf->f << "\f"; return NULL; } case navh_eItemType_Help: case navh_eItemType_HelpCode: case navh_eItemType_HelpBold: case navh_eItemType_Header: case navh_eItemType_HeaderLarge: case navh_eItemType_HelpHeader: { cf->f << text1; if ( text2) { cf->f << " "; for ( int i = 0; i < (int)(CNV_TAB - strlen(text1) - 1); i++) cf->f << " "; cf->f << text2; if ( text3) { cf->f << " "; for ( int i = 0; i < (int)(CNV_TAB - strlen(text2) - 1); i++) cf->f << " "; cf->f << text3; } } cf->f << endl; break; } case navh_eItemType_HorizontalLine: { for ( int i = 0; i < 80; i++) cf->f << "-"; cf->f << endl; return NULL; } case navh_eItemType_Option: { if ( strcmp( text1, "printdisable") == 0) print_disable = 1; else if ( strcmp( text1, "printenable") == 0) print_disable = 0; return NULL; } default: return 0; } return 0; }