[sword-cvs] sword/src/modules/filters thmlrtf.cpp,1.27,1.28
sword@www.crosswire.org
sword@www.crosswire.org
Fri, 9 May 2003 11:26:31 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv1859
Modified Files:
thmlrtf.cpp
Log Message:
no message
Index: thmlrtf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlrtf.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** thmlrtf.cpp 25 Feb 2003 04:12:47 -0000 1.27
--- thmlrtf.cpp 9 May 2003 18:26:29 -0000 1.28
***************
*** 18,21 ****
--- 18,22 ----
#include <string.h>
#include <thmlrtf.h>
+ #include <swmodule.h>
SWORD_NAMESPACE_START
***************
*** 214,218 ****
--- 215,259 ----
buf += " {\\i1\\fs15 (";
}
+ else if (!strncmp(token, "img ", 4)) {
+ const char *src = strstr(token, "src");
+ if (!src) // assert we have a src attribute
+ return false;
+ char* filepath = new char[strlen(module->getConfigEntry("AbsoluteDataPath")) + strlen(token)];
+ *filepath = 0;
+ strcpy(filepath, module->getConfigEntry("AbsoluteDataPath"));
+ unsigned long i = strlen(filepath);
+ const char *c;
+ for (c = (src + 5); *c != '"'; c++) {
+ filepath[i] = *c;
+ i++;
+ }
+ filepath[i] = 0;
+
+ for (c = filepath + strlen(filepath); c > filepath && *c != '.'; c--);
+ c++;
+
+ char imgc;
+ FILE* imgfile;
+ /*
+ if (stricmp(c, "jpg") || stricmp(c, "jpeg")) {
+ imgfile = fopen(filepath, "r");
+ if (imgfile != NULL) {
+ buf += "{\\nonshppict {\\pict\\jpegblip ";
+ while (feof(imgfile) != EOF) {
+ buf.appendFormatted("%2x", fgetc(imgfile));
+ }
+ fclose(imgfile);
+ buf += "}}";
+ }
+ }
+ else if (stricmp(c, "png")) {
+ buf += "{\\*\\shppict {\\pict\\pngblip ";
+
+ buf += "}}";
+ }
+ */
+ delete filepath;
+ }
else {
return false; // we still didn't handle token