X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/119f7a8c81c6fa9fd26f6ceab7e2ee3973054355..5d35dca95fed224817455e65e70f9f52ca3e293c:/utils/tex2rtf/src/htmlutil.cpp diff --git a/utils/tex2rtf/src/htmlutil.cpp b/utils/tex2rtf/src/htmlutil.cpp index d29e17b7f3..2ba1279576 100644 --- a/utils/tex2rtf/src/htmlutil.cpp +++ b/utils/tex2rtf/src/htmlutil.cpp @@ -28,6 +28,10 @@ #include "tex2rtf.h" #include "table.h" + +extern wxHashTable TexReferences; + + extern void DecToHex(int, char *); void GenerateHTMLIndexFile(char *fname); @@ -76,6 +80,11 @@ static bool inTable = FALSE; // This is defined in the Tex2Any library. extern char *BigBuffer; +// DHS Two-column table dimensions. +static int TwoColWidthA = -1; +static int TwoColWidthB = -1; + + class HyperReference: public wxObject { public: @@ -172,7 +181,7 @@ void ReopenFile(FILE **fd, char **fileName) { if (*fd) { - fprintf(*fd, "\n\n"); + fprintf(*fd, "\n\n"); fclose(*fd); } fileId ++; @@ -574,6 +583,17 @@ char *ParseColourString(char *bkStr, bool *isPicture) else return NULL; } +void OutputFont(void) +{ + // Output + TexOutput("\n"); +} + // Output start of block void OutputBodyStart(void) { @@ -628,6 +648,8 @@ void OutputBodyStart(void) } } TexOutput(">\n"); + + OutputFont(); } // Called on start/end of macro examination @@ -1018,7 +1040,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) if (inTabular) { // End cell, start cell - TexOutput(""); + + TexOutput(""); // Start new row and cell, setting alignment for the first cell. if (currentColumn < noColumns) @@ -1042,6 +1065,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start) else sprintf(buf, "\n"); TexOutput(buf); + OutputFont(); } else TexOutput("&"); @@ -1090,12 +1114,13 @@ void HTMLOnMacro(int macroId, int no_args, bool start) else sprintf(buf, "\n"); TexOutput(buf); + OutputFont(); } else { // End cell and row // Start new row and cell - TexOutput("\n\n"); + TexOutput("\n\n"); } break; } @@ -1189,8 +1214,12 @@ void HTMLOnMacro(int macroId, int no_args, bool start) { if ( start ) TexOutput("\n\n"); - else + else { TexOutput("\n
\n"); + // DHS + TwoColWidthA = -1; + TwoColWidthB = -1; + } break; } case ltPAR: @@ -1893,7 +1922,11 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) { if (helpRefText) TraverseChildrenFromChunk(helpRefText); - TexOutput(" (REF NOT FOUND)"); + if (!ignoreBadRefs) + TexOutput(" (REF NOT FOUND)"); + wxString errBuf; + errBuf.Printf("Warning: unresolved reference '%s'", refName); + OnInform((char *)errBuf.c_str()); } } else TexOutput("??"); @@ -2021,7 +2054,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) if (imageFile) delete[] imageFile; imageFile = NULL; - if (f) + if (!f.IsEmpty()) { imageFile = copystring(f); } @@ -2077,6 +2110,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) descriptionItemArg = GetArgChunk(); return FALSE; } + return TRUE; } case ltTWOCOLITEM: case ltTWOCOLITEMRULED: @@ -2089,17 +2123,31 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) */ if (arg_no == 1) { - if ( start ) - TexOutput("\n\n"); - else - TexOutput("\n\n"); + if ( start ) { + // DHS + if (TwoColWidthA > -1) { + char buf[100]; + sprintf(buf,"\n\n",TwoColWidthA); + TexOutput(buf); + } else + TexOutput("\n\n"); + OutputFont(); + } else + TexOutput("\n\n"); } if (arg_no == 2) { - if ( start ) - TexOutput("\n\n"); - else - TexOutput("\n\n"); + // DHS + if ( start ) { + if (TwoColWidthB > -1) { + char buf[100]; + sprintf(buf,"\n\n",TwoColWidthB); + TexOutput(buf); + } else + TexOutput("\n\n"); + OutputFont(); + } else + TexOutput("\n\n"); } return TRUE; break; @@ -2153,6 +2201,30 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) TexOutput("

\n"); break; } + // DHS + case ltTWOCOLWIDTHA: + { + if (start) + { + char *val = GetArgData(); + float points = ParseUnitArgument(val); + TwoColWidthA = (int)((points * 100.0) / 72.0); + } + return FALSE; + break; + } + // DHS + case ltTWOCOLWIDTHB: + { + if (start) + { + char *val = GetArgData(); + float points = ParseUnitArgument(val); + TwoColWidthB = (int)((points * 100.0) / 72.0); + } + return FALSE; + break; + } /* * Accents * @@ -2577,6 +2649,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) if (compatibilityMode) { TexOutput("\n"); + OutputFont(); /* for (int i = 0; i < noColumns; i++) { @@ -2856,25 +2929,25 @@ bool HTMLGo(void) if (Chapters) { - fprintf(Chapters, "\n\n"); + fprintf(Chapters, "\n\n"); fclose(Chapters); Chapters = NULL; } if (Sections) { - fprintf(Sections, "\n\n"); + fprintf(Sections, "\n\n"); fclose(Sections); Sections = NULL; } if (Subsections && !combineSubSections) { - fprintf(Subsections, "\n\n"); + fprintf(Subsections, "\n\n"); fclose(Subsections); Subsections = NULL; } if (Subsubsections && !combineSubSections) { - fprintf(Subsubsections, "\n\n"); + fprintf(Subsubsections, "\n\n"); fclose(Subsubsections); Subsubsections = NULL; } @@ -2942,7 +3015,7 @@ bool HTMLGo(void) fclose(fd); } - fprintf(tmpTitle, "\n\n"); + fprintf(tmpTitle, "\n\n"); if (htmlFrameContents) {