diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a4238f2066..d0abc5a84a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,44 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-11-10 12:29 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/libmisc/common.mak + * contrib/apollo/common.mak + * contrib/libnf/common.mak + * contrib/gd/common.mak + * contrib/htmllib/common.mak + * contrib/tip/common.mak + * contrib/adordd/common.mak + * contrib/rdd_ads/common.mak + * contrib/libgt/common.mak + * contrib/btree/common.mak + * contrib/win32/common.mak + * contrib/directx/common.mak + * contrib/samples/common.mak + * contrib/mysql/common.mak + * contrib/bmdbfcdx/common.mak + * contrib/pgsql/common.mak + ! .obj -> $(OBJEXT) + + * contrib/pgsql/make_b32.bat + * contrib/pgsql/make_vc.bat + ! Minor fix. + + + contrib/pdflib/make_vc.bat + + contrib/pdflib/make_b32.bat + + contrib/pdflib/common.mak + + contrib/pdflib/pdf1.prg + + contrib/pdflib/pdfhbdoc.ch + + contrib/pdflib/pdf.ch + + contrib/pdflib/pdfhbdocs.prg + * contrib/pdflib/pdflib.h + * contrib/pdflib/pdfhbdoc.c + * Borrowed from xhb. + ! Fixed HB_ITEM -> PHB_ITEM. + ! Fixed warnings. + + Added non-GNU make files. + ; NOTE: I didn't test this, it would be great if someone would. + 2007-11-10 06:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) - contrib/hgf/tests/build_b32.bat + contrib/hgf/tests/bld_b32.bat @@ -135,8 +173,8 @@ + contrib/pgsql/make_vc.bat * Changed most libs to use the generic non-GNU makefiles. + Added support for MSVC for all above libs. - ; directx won't build under MSVC with an error. + Added "implib" for rdd_ads. TOFIX: Doesn't work for MSVC. + ; TOFIX: directx won't build under MSVC with an error. ; TOFIX: I couldn't compile pgsql using latest 8.2.5. * contrib/samples/gauge.c diff --git a/harbour/contrib/adordd/common.mak b/harbour/contrib/adordd/common.mak index 835be016b2..fccca37a44 100644 --- a/harbour/contrib/adordd/common.mak +++ b/harbour/contrib/adordd/common.mak @@ -11,7 +11,7 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\adordd.obj + $(OBJ_DIR)\adordd$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/apollo/common.mak b/harbour/contrib/apollo/common.mak index f361656429..7746b3e923 100644 --- a/harbour/contrib/apollo/common.mak +++ b/harbour/contrib/apollo/common.mak @@ -11,8 +11,8 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\apollo.obj \ - $(OBJ_DIR)\apollo1.obj \ + $(OBJ_DIR)\apollo$(OBJEXT) \ + $(OBJ_DIR)\apollo1$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/bmdbfcdx/common.mak b/harbour/contrib/bmdbfcdx/common.mak index 27f1655117..f90b6b96fb 100644 --- a/harbour/contrib/bmdbfcdx/common.mak +++ b/harbour/contrib/bmdbfcdx/common.mak @@ -11,8 +11,8 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\bmdbfcdx1.obj \ - $(OBJ_DIR)\bmsixcdx1.obj \ + $(OBJ_DIR)\bmdbfcdx1$(OBJEXT) \ + $(OBJ_DIR)\bmsixcdx1$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/btree/common.mak b/harbour/contrib/btree/common.mak index 0f80926cfe..1cec2a9c5a 100644 --- a/harbour/contrib/btree/common.mak +++ b/harbour/contrib/btree/common.mak @@ -11,8 +11,8 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\hb_btree.obj \ - $(OBJ_DIR)\tbtree.obj \ + $(OBJ_DIR)\hb_btree$(OBJEXT) \ + $(OBJ_DIR)\tbtree$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/directx/common.mak b/harbour/contrib/directx/common.mak index 88fe2a0f77..f944233ef4 100644 --- a/harbour/contrib/directx/common.mak +++ b/harbour/contrib/directx/common.mak @@ -11,7 +11,7 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\w32_ddrw.obj \ + $(OBJ_DIR)\w32_ddrw$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/gd/common.mak b/harbour/contrib/gd/common.mak index 8fe8cbb8f1..a8e07ac23c 100644 --- a/harbour/contrib/gd/common.mak +++ b/harbour/contrib/gd/common.mak @@ -11,12 +11,12 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\gdwrp.obj \ - $(OBJ_DIR)\gd.obj \ - $(OBJ_DIR)\gdimage.obj \ - $(OBJ_DIR)\gdchart.obj \ - $(OBJ_DIR)\gdbar.obj \ - $(OBJ_DIR)\gdbarcod.obj \ + $(OBJ_DIR)\gdwrp$(OBJEXT) \ + $(OBJ_DIR)\gd$(OBJEXT) \ + $(OBJ_DIR)\gdimage$(OBJEXT) \ + $(OBJ_DIR)\gdchart$(OBJEXT) \ + $(OBJ_DIR)\gdbar$(OBJEXT) \ + $(OBJ_DIR)\gdbarcod$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/htmllib/common.mak b/harbour/contrib/htmllib/common.mak index 6edf3f1382..39327356b7 100644 --- a/harbour/contrib/htmllib/common.mak +++ b/harbour/contrib/htmllib/common.mak @@ -11,18 +11,18 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\ohtm.obj \ - $(OBJ_DIR)\htmbrows.obj \ - $(OBJ_DIR)\oedit.obj \ - $(OBJ_DIR)\ofile.obj \ - $(OBJ_DIR)\jlist.obj \ - $(OBJ_DIR)\oini.obj \ - $(OBJ_DIR)\jwindow.obj \ - $(OBJ_DIR)\ocgi.obj \ - $(OBJ_DIR)\oframe.obj \ - $(OBJ_DIR)\counter.obj \ - $(OBJ_DIR)\errorsys.obj \ - $(OBJ_DIR)\htmutil.obj \ + $(OBJ_DIR)\ohtm$(OBJEXT) \ + $(OBJ_DIR)\htmbrows$(OBJEXT) \ + $(OBJ_DIR)\oedit$(OBJEXT) \ + $(OBJ_DIR)\ofile$(OBJEXT) \ + $(OBJ_DIR)\jlist$(OBJEXT) \ + $(OBJ_DIR)\oini$(OBJEXT) \ + $(OBJ_DIR)\jwindow$(OBJEXT) \ + $(OBJ_DIR)\ocgi$(OBJEXT) \ + $(OBJ_DIR)\oframe$(OBJEXT) \ + $(OBJ_DIR)\counter$(OBJEXT) \ + $(OBJ_DIR)\errorsys$(OBJEXT) \ + $(OBJ_DIR)\htmutil$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/libgt/common.mak b/harbour/contrib/libgt/common.mak index 942203e921..12c1c65aba 100644 --- a/harbour/contrib/libgt/common.mak +++ b/harbour/contrib/libgt/common.mak @@ -11,23 +11,23 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\asciisum.obj \ - $(OBJ_DIR)\ascpos.obj \ - $(OBJ_DIR)\atdiff.obj \ - $(OBJ_DIR)\chareven.obj \ - $(OBJ_DIR)\charmix.obj \ - $(OBJ_DIR)\charodd.obj \ - $(OBJ_DIR)\chrcount.obj \ - $(OBJ_DIR)\chrfirst.obj \ - $(OBJ_DIR)\chrtotal.obj \ - $(OBJ_DIR)\strasint.obj \ - $(OBJ_DIR)\strcount.obj \ - $(OBJ_DIR)\strcspn.obj \ - $(OBJ_DIR)\strdiff.obj \ - $(OBJ_DIR)\strexpan.obj \ - $(OBJ_DIR)\strleft.obj \ - $(OBJ_DIR)\strpbrk.obj \ - $(OBJ_DIR)\strright.obj + $(OBJ_DIR)\asciisum$(OBJEXT) \ + $(OBJ_DIR)\ascpos$(OBJEXT) \ + $(OBJ_DIR)\atdiff$(OBJEXT) \ + $(OBJ_DIR)\chareven$(OBJEXT) \ + $(OBJ_DIR)\charmix$(OBJEXT) \ + $(OBJ_DIR)\charodd$(OBJEXT) \ + $(OBJ_DIR)\chrcount$(OBJEXT) \ + $(OBJ_DIR)\chrfirst$(OBJEXT) \ + $(OBJ_DIR)\chrtotal$(OBJEXT) \ + $(OBJ_DIR)\strasint$(OBJEXT) \ + $(OBJ_DIR)\strcount$(OBJEXT) \ + $(OBJ_DIR)\strcspn$(OBJEXT) \ + $(OBJ_DIR)\strdiff$(OBJEXT) \ + $(OBJ_DIR)\strexpan$(OBJEXT) \ + $(OBJ_DIR)\strleft$(OBJEXT) \ + $(OBJ_DIR)\strpbrk$(OBJEXT) \ + $(OBJ_DIR)\strright$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/libmisc/common.mak b/harbour/contrib/libmisc/common.mak index 6c0fda9eb6..71b700e530 100644 --- a/harbour/contrib/libmisc/common.mak +++ b/harbour/contrib/libmisc/common.mak @@ -11,19 +11,19 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\dates2.obj \ - $(OBJ_DIR)\dbftools.obj \ - $(OBJ_DIR)\hb_f.obj \ - $(OBJ_DIR)\mathx.obj \ - $(OBJ_DIR)\strfmt.obj \ - $(OBJ_DIR)\stringsx.obj \ + $(OBJ_DIR)\dates2$(OBJEXT) \ + $(OBJ_DIR)\dbftools$(OBJEXT) \ + $(OBJ_DIR)\hb_f$(OBJEXT) \ + $(OBJ_DIR)\mathx$(OBJEXT) \ + $(OBJ_DIR)\strfmt$(OBJEXT) \ + $(OBJ_DIR)\stringsx$(OBJEXT) \ \ - $(OBJ_DIR)\fileread.obj \ - $(OBJ_DIR)\nconvert.obj \ - $(OBJ_DIR)\numtxten.obj \ - $(OBJ_DIR)\numtxthu.obj \ - $(OBJ_DIR)\stringp.obj \ - $(OBJ_DIR)\twirler.obj + $(OBJ_DIR)\fileread$(OBJEXT) \ + $(OBJ_DIR)\nconvert$(OBJEXT) \ + $(OBJ_DIR)\numtxten$(OBJEXT) \ + $(OBJ_DIR)\numtxthu$(OBJEXT) \ + $(OBJ_DIR)\stringp$(OBJEXT) \ + $(OBJ_DIR)\twirler$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/libnf/common.mak b/harbour/contrib/libnf/common.mak index 35675380e9..569130b7e6 100644 --- a/harbour/contrib/libnf/common.mak +++ b/harbour/contrib/libnf/common.mak @@ -11,140 +11,140 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\caplock.obj \ - $(OBJ_DIR)\color2n.obj \ - $(OBJ_DIR)\descend.obj \ - $(OBJ_DIR)\numlock.obj \ - $(OBJ_DIR)\proper.obj \ - $(OBJ_DIR)\shift.obj \ - $(OBJ_DIR)\mouse.obj \ - $(OBJ_DIR)\getvid.obj \ - $(OBJ_DIR)\setkeys.obj \ - $(OBJ_DIR)\setlastk.obj \ - $(OBJ_DIR)\ftisprn.obj \ - $(OBJ_DIR)\ftidle.obj \ - $(OBJ_DIR)\iamidle.obj \ - $(OBJ_DIR)\chdir.obj \ - $(OBJ_DIR)\rmdir.obj \ - $(OBJ_DIR)\alt.obj \ - $(OBJ_DIR)\ctrl.obj \ - $(OBJ_DIR)\getenvrn.obj \ - $(OBJ_DIR)\n2color.obj \ - $(OBJ_DIR)\origin.obj \ - $(OBJ_DIR)\prtscr.obj \ - $(OBJ_DIR)\stod.obj \ - $(OBJ_DIR)\kspeed.obj \ - $(OBJ_DIR)\mkdir.obj \ - $(OBJ_DIR)\getver.obj \ - $(OBJ_DIR)\ftattr.obj \ - $(OBJ_DIR)\dispc.obj \ - $(OBJ_DIR)\fttext.obj \ - $(OBJ_DIR)\ftshadow.obj \ - $(OBJ_DIR)\putkey.obj \ + $(OBJ_DIR)\caplock$(OBJEXT) \ + $(OBJ_DIR)\color2n$(OBJEXT) \ + $(OBJ_DIR)\descend$(OBJEXT) \ + $(OBJ_DIR)\numlock$(OBJEXT) \ + $(OBJ_DIR)\proper$(OBJEXT) \ + $(OBJ_DIR)\shift$(OBJEXT) \ + $(OBJ_DIR)\mouse$(OBJEXT) \ + $(OBJ_DIR)\getvid$(OBJEXT) \ + $(OBJ_DIR)\setkeys$(OBJEXT) \ + $(OBJ_DIR)\setlastk$(OBJEXT) \ + $(OBJ_DIR)\ftisprn$(OBJEXT) \ + $(OBJ_DIR)\ftidle$(OBJEXT) \ + $(OBJ_DIR)\iamidle$(OBJEXT) \ + $(OBJ_DIR)\chdir$(OBJEXT) \ + $(OBJ_DIR)\rmdir$(OBJEXT) \ + $(OBJ_DIR)\alt$(OBJEXT) \ + $(OBJ_DIR)\ctrl$(OBJEXT) \ + $(OBJ_DIR)\getenvrn$(OBJEXT) \ + $(OBJ_DIR)\n2color$(OBJEXT) \ + $(OBJ_DIR)\origin$(OBJEXT) \ + $(OBJ_DIR)\prtscr$(OBJEXT) \ + $(OBJ_DIR)\stod$(OBJEXT) \ + $(OBJ_DIR)\kspeed$(OBJEXT) \ + $(OBJ_DIR)\mkdir$(OBJEXT) \ + $(OBJ_DIR)\getver$(OBJEXT) \ + $(OBJ_DIR)\ftattr$(OBJEXT) \ + $(OBJ_DIR)\dispc$(OBJEXT) \ + $(OBJ_DIR)\fttext$(OBJEXT) \ + $(OBJ_DIR)\ftshadow$(OBJEXT) \ + $(OBJ_DIR)\putkey$(OBJEXT) \ \ - $(OBJ_DIR)\aading.obj \ - $(OBJ_DIR)\aavg.obj \ - $(OBJ_DIR)\acctadj.obj \ - $(OBJ_DIR)\acctmnth.obj \ - $(OBJ_DIR)\acctqtr.obj \ - $(OBJ_DIR)\acctweek.obj \ - $(OBJ_DIR)\acctyear.obj \ - $(OBJ_DIR)\adessort.obj \ - $(OBJ_DIR)\aemaxlen.obj \ - $(OBJ_DIR)\aeminlen.obj \ - $(OBJ_DIR)\amedian.obj \ - $(OBJ_DIR)\anomatch.obj \ - $(OBJ_DIR)\any2any.obj \ - $(OBJ_DIR)\aredit.obj \ - $(OBJ_DIR)\asum.obj \ - $(OBJ_DIR)\at2.obj \ - $(OBJ_DIR)\bitclr.obj \ - $(OBJ_DIR)\bitset.obj \ - $(OBJ_DIR)\blink.obj \ - $(OBJ_DIR)\byt2bit.obj \ - $(OBJ_DIR)\byt2hex.obj \ - $(OBJ_DIR)\byteand.obj \ - $(OBJ_DIR)\byteneg.obj \ - $(OBJ_DIR)\bytenot.obj \ - $(OBJ_DIR)\byteor.obj \ - $(OBJ_DIR)\bytexor.obj \ - $(OBJ_DIR)\calendar.obj \ - $(OBJ_DIR)\clrsel.obj \ - $(OBJ_DIR)\cntryset.obj \ - $(OBJ_DIR)\d2e.obj \ - $(OBJ_DIR)\datecnfg.obj \ - $(OBJ_DIR)\dayofyr.obj \ - $(OBJ_DIR)\daytobow.obj \ - $(OBJ_DIR)\dectobin.obj \ - $(OBJ_DIR)\diskfunc.obj \ - $(OBJ_DIR)\dispmsg.obj \ - $(OBJ_DIR)\dosver.obj \ - $(OBJ_DIR)\e2d.obj \ - $(OBJ_DIR)\easter.obj \ - $(OBJ_DIR)\elapmil.obj \ - $(OBJ_DIR)\elapsed.obj \ - $(OBJ_DIR)\eltime.obj \ - $(OBJ_DIR)\findith.obj \ - $(OBJ_DIR)\firstday.obj \ - $(OBJ_DIR)\gcd.obj \ - $(OBJ_DIR)\hex2dec.obj \ - $(OBJ_DIR)\invclr.obj \ - $(OBJ_DIR)\isbit.obj \ - $(OBJ_DIR)\isbiton.obj \ - $(OBJ_DIR)\isshare.obj \ - $(OBJ_DIR)\lastday.obj \ - $(OBJ_DIR)\linked.obj \ - $(OBJ_DIR)\madd.obj \ - $(OBJ_DIR)\menu1.obj \ - $(OBJ_DIR)\menuto.obj \ - $(OBJ_DIR)\metaph.obj \ - $(OBJ_DIR)\miltime.obj \ - $(OBJ_DIR)\min2dhm.obj \ - $(OBJ_DIR)\month.obj \ - $(OBJ_DIR)\mouse1.obj \ - $(OBJ_DIR)\netpv.obj \ - $(OBJ_DIR)\nooccur.obj \ - $(OBJ_DIR)\ntow.obj \ - $(OBJ_DIR)\nwlstat.obj \ - $(OBJ_DIR)\page.obj \ - $(OBJ_DIR)\pchr.obj \ - $(OBJ_DIR)\pegs.obj \ - $(OBJ_DIR)\pending.obj \ - $(OBJ_DIR)\pickday.obj \ - $(OBJ_DIR)\popadder.obj \ - $(OBJ_DIR)\prtesc.obj \ - $(OBJ_DIR)\pvid.obj \ - $(OBJ_DIR)\qtr.obj \ - $(OBJ_DIR)\rand1.obj \ - $(OBJ_DIR)\restsets.obj \ - $(OBJ_DIR)\ftround.obj \ - $(OBJ_DIR)\savearr.obj \ - $(OBJ_DIR)\savesets.obj \ - $(OBJ_DIR)\scregion.obj \ - $(OBJ_DIR)\sinkey.obj \ - $(OBJ_DIR)\sleep.obj \ - $(OBJ_DIR)\sqzn.obj \ - $(OBJ_DIR)\tbwhile.obj \ - $(OBJ_DIR)\tempfile.obj \ - $(OBJ_DIR)\vertmenu.obj \ - $(OBJ_DIR)\vidmode.obj \ - $(OBJ_DIR)\wda.obj \ - $(OBJ_DIR)\week.obj \ - $(OBJ_DIR)\workdays.obj \ - $(OBJ_DIR)\woy.obj \ - $(OBJ_DIR)\xbox.obj \ - $(OBJ_DIR)\year.obj + $(OBJ_DIR)\aading$(OBJEXT) \ + $(OBJ_DIR)\aavg$(OBJEXT) \ + $(OBJ_DIR)\acctadj$(OBJEXT) \ + $(OBJ_DIR)\acctmnth$(OBJEXT) \ + $(OBJ_DIR)\acctqtr$(OBJEXT) \ + $(OBJ_DIR)\acctweek$(OBJEXT) \ + $(OBJ_DIR)\acctyear$(OBJEXT) \ + $(OBJ_DIR)\adessort$(OBJEXT) \ + $(OBJ_DIR)\aemaxlen$(OBJEXT) \ + $(OBJ_DIR)\aeminlen$(OBJEXT) \ + $(OBJ_DIR)\amedian$(OBJEXT) \ + $(OBJ_DIR)\anomatch$(OBJEXT) \ + $(OBJ_DIR)\any2any$(OBJEXT) \ + $(OBJ_DIR)\aredit$(OBJEXT) \ + $(OBJ_DIR)\asum$(OBJEXT) \ + $(OBJ_DIR)\at2$(OBJEXT) \ + $(OBJ_DIR)\bitclr$(OBJEXT) \ + $(OBJ_DIR)\bitset$(OBJEXT) \ + $(OBJ_DIR)\blink$(OBJEXT) \ + $(OBJ_DIR)\byt2bit$(OBJEXT) \ + $(OBJ_DIR)\byt2hex$(OBJEXT) \ + $(OBJ_DIR)\byteand$(OBJEXT) \ + $(OBJ_DIR)\byteneg$(OBJEXT) \ + $(OBJ_DIR)\bytenot$(OBJEXT) \ + $(OBJ_DIR)\byteor$(OBJEXT) \ + $(OBJ_DIR)\bytexor$(OBJEXT) \ + $(OBJ_DIR)\calendar$(OBJEXT) \ + $(OBJ_DIR)\clrsel$(OBJEXT) \ + $(OBJ_DIR)\cntryset$(OBJEXT) \ + $(OBJ_DIR)\d2e$(OBJEXT) \ + $(OBJ_DIR)\datecnfg$(OBJEXT) \ + $(OBJ_DIR)\dayofyr$(OBJEXT) \ + $(OBJ_DIR)\daytobow$(OBJEXT) \ + $(OBJ_DIR)\dectobin$(OBJEXT) \ + $(OBJ_DIR)\diskfunc$(OBJEXT) \ + $(OBJ_DIR)\dispmsg$(OBJEXT) \ + $(OBJ_DIR)\dosver$(OBJEXT) \ + $(OBJ_DIR)\e2d$(OBJEXT) \ + $(OBJ_DIR)\easter$(OBJEXT) \ + $(OBJ_DIR)\elapmil$(OBJEXT) \ + $(OBJ_DIR)\elapsed$(OBJEXT) \ + $(OBJ_DIR)\eltime$(OBJEXT) \ + $(OBJ_DIR)\findith$(OBJEXT) \ + $(OBJ_DIR)\firstday$(OBJEXT) \ + $(OBJ_DIR)\gcd$(OBJEXT) \ + $(OBJ_DIR)\hex2dec$(OBJEXT) \ + $(OBJ_DIR)\invclr$(OBJEXT) \ + $(OBJ_DIR)\isbit$(OBJEXT) \ + $(OBJ_DIR)\isbiton$(OBJEXT) \ + $(OBJ_DIR)\isshare$(OBJEXT) \ + $(OBJ_DIR)\lastday$(OBJEXT) \ + $(OBJ_DIR)\linked$(OBJEXT) \ + $(OBJ_DIR)\madd$(OBJEXT) \ + $(OBJ_DIR)\menu1$(OBJEXT) \ + $(OBJ_DIR)\menuto$(OBJEXT) \ + $(OBJ_DIR)\metaph$(OBJEXT) \ + $(OBJ_DIR)\miltime$(OBJEXT) \ + $(OBJ_DIR)\min2dhm$(OBJEXT) \ + $(OBJ_DIR)\month$(OBJEXT) \ + $(OBJ_DIR)\mouse1$(OBJEXT) \ + $(OBJ_DIR)\netpv$(OBJEXT) \ + $(OBJ_DIR)\nooccur$(OBJEXT) \ + $(OBJ_DIR)\ntow$(OBJEXT) \ + $(OBJ_DIR)\nwlstat$(OBJEXT) \ + $(OBJ_DIR)\page$(OBJEXT) \ + $(OBJ_DIR)\pchr$(OBJEXT) \ + $(OBJ_DIR)\pegs$(OBJEXT) \ + $(OBJ_DIR)\pending$(OBJEXT) \ + $(OBJ_DIR)\pickday$(OBJEXT) \ + $(OBJ_DIR)\popadder$(OBJEXT) \ + $(OBJ_DIR)\prtesc$(OBJEXT) \ + $(OBJ_DIR)\pvid$(OBJEXT) \ + $(OBJ_DIR)\qtr$(OBJEXT) \ + $(OBJ_DIR)\rand1$(OBJEXT) \ + $(OBJ_DIR)\restsets$(OBJEXT) \ + $(OBJ_DIR)\ftround$(OBJEXT) \ + $(OBJ_DIR)\savearr$(OBJEXT) \ + $(OBJ_DIR)\savesets$(OBJEXT) \ + $(OBJ_DIR)\scregion$(OBJEXT) \ + $(OBJ_DIR)\sinkey$(OBJEXT) \ + $(OBJ_DIR)\sleep$(OBJEXT) \ + $(OBJ_DIR)\sqzn$(OBJEXT) \ + $(OBJ_DIR)\tbwhile$(OBJEXT) \ + $(OBJ_DIR)\tempfile$(OBJEXT) \ + $(OBJ_DIR)\vertmenu$(OBJEXT) \ + $(OBJ_DIR)\vidmode$(OBJEXT) \ + $(OBJ_DIR)\wda$(OBJEXT) \ + $(OBJ_DIR)\week$(OBJEXT) \ + $(OBJ_DIR)\workdays$(OBJEXT) \ + $(OBJ_DIR)\woy$(OBJEXT) \ + $(OBJ_DIR)\xbox$(OBJEXT) \ + $(OBJ_DIR)\year$(OBJEXT) -# $(OBJ_DIR)\sysmem.obj \ -# $(OBJ_DIR)\dfile.obj \ -# $(OBJ_DIR)\vidcur.obj \ -# $(OBJ_DIR)\scancode.obj \ -# $(OBJ_DIR)\setdate.obj \ -# $(OBJ_DIR)\settime.obj \ -# $(OBJ_DIR)\nwsem.obj \ -# $(OBJ_DIR)\nwuid.obj \ +# $(OBJ_DIR)\sysmem$(OBJEXT) \ +# $(OBJ_DIR)\dfile$(OBJEXT) \ +# $(OBJ_DIR)\vidcur$(OBJEXT) \ +# $(OBJ_DIR)\scancode$(OBJEXT) \ +# $(OBJ_DIR)\setdate$(OBJEXT) \ +# $(OBJ_DIR)\settime$(OBJEXT) \ +# $(OBJ_DIR)\nwsem$(OBJEXT) \ +# $(OBJ_DIR)\nwuid$(OBJEXT) \ -# $(OBJ_DIR)\floptst.obj +# $(OBJ_DIR)\floptst$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/mysql/common.mak b/harbour/contrib/mysql/common.mak index 948ae59ee3..e928e7676a 100644 --- a/harbour/contrib/mysql/common.mak +++ b/harbour/contrib/mysql/common.mak @@ -11,9 +11,9 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\tmysql.obj \ - $(OBJ_DIR)\tsqlbrw.obj \ - $(OBJ_DIR)\mysql.obj + $(OBJ_DIR)\tmysql$(OBJEXT) \ + $(OBJ_DIR)\tsqlbrw$(OBJEXT) \ + $(OBJ_DIR)\mysql$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/pdflib/common.mak b/harbour/contrib/pdflib/common.mak new file mode 100644 index 0000000000..93e5d7cdb0 --- /dev/null +++ b/harbour/contrib/pdflib/common.mak @@ -0,0 +1,18 @@ +# +# $Id$ +# + +LIBNAME = hbpdflib + +LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) + +# +# LIB rules +# + +LIB_OBJS = \ + $(OBJ_DIR)\pdfhbdoc$(OBJEXT) \ + $(OBJ_DIR)\pdf1$(OBJEXT) \ + +all: \ + $(LIB_PATH) \ diff --git a/harbour/contrib/pdflib/make_b32.bat b/harbour/contrib/pdflib/make_b32.bat new file mode 100644 index 0000000000..f2a16b0a07 --- /dev/null +++ b/harbour/contrib/pdflib/make_b32.bat @@ -0,0 +1,60 @@ +@echo off +rem +rem $Id$ +rem + +rem --------------------------------------------------------------- +rem IMPORTANT: You'll need PDFLIB lib sources this envvar +rem to be set to successfully build this library: +rem set C_USR=-IC:\pdflib\src\pdflib +rem --------------------------------------------------------------- + +rem --------------------------------------------------------------- +rem This is a generic template file, if it doesn't fit your own needs +rem please DON'T MODIFY IT. +rem +rem Instead, make a local copy and modify that one, or make a call to +rem this batch file from your customized one. [vszakats] +rem +rem Set any of the below settings to customize your build process: +rem set HB_MAKE_PROGRAM= +rem set HB_MAKE_FLAGS= +rem --------------------------------------------------------------- + +if "%HB_CC_NAME%" == "" set HB_CC_NAME=b32 +if "%HB_MAKE_PROGRAM%" == "" set HB_MAKE_PROGRAM=make.exe +set HB_MAKEFILE=..\mtpl_%HB_CC_NAME%.mak + +rem --------------------------------------------------------------- + +if "%1" == "clean" goto CLEAN +if "%1" == "CLEAN" goto CLEAN + +if "%1" == "install" goto INSTALL +if "%1" == "INSTALL" goto INSTALL + +:BUILD + + %HB_MAKE_PROGRAM% %HB_MAKE_FLAGS% -f %HB_MAKEFILE% %1 %2 %3 > make_%HB_CC_NAME%.log + if errorlevel 1 notepad make_%HB_CC_NAME%.log + goto EXIT + +:CLEAN + + %HB_MAKE_PROGRAM% %HB_MAKE_FLAGS% -f %HB_MAKEFILE% CLEAN > make_%HB_CC_NAME%.log + if exist make_%HB_CC_NAME%.log del make_%HB_CC_NAME%.log > nul + if exist inst_%HB_CC_NAME%.log del inst_%HB_CC_NAME%.log > nul + goto EXIT + +:INSTALL + + if "%HB_INSTALL_PREFIX%" == "" set HB_INSTALL_PREFIX=..\.. + + if "%HB_BIN_INSTALL%" == "" set HB_BIN_INSTALL=%HB_INSTALL_PREFIX%\bin + if "%HB_INC_INSTALL%" == "" set HB_INC_INSTALL=%HB_INSTALL_PREFIX%\include + if "%HB_LIB_INSTALL%" == "" set HB_LIB_INSTALL=%HB_INSTALL_PREFIX%\lib + + %HB_MAKE_PROGRAM% %HB_MAKE_FLAGS% -f %HB_MAKEFILE% INSTALL > nul + goto EXIT + +:EXIT diff --git a/harbour/contrib/pdflib/make_vc.bat b/harbour/contrib/pdflib/make_vc.bat new file mode 100644 index 0000000000..79e9a9e770 --- /dev/null +++ b/harbour/contrib/pdflib/make_vc.bat @@ -0,0 +1,60 @@ +@echo off +rem +rem $Id$ +rem + +rem --------------------------------------------------------------- +rem IMPORTANT: You'll need PDFLIB lib sources this envvar +rem to be set to successfully build this library: +rem set C_USR=-IC:\pdflib\src\pdflib +rem --------------------------------------------------------------- + +rem --------------------------------------------------------------- +rem This is a generic template file, if it doesn't fit your own needs +rem please DON'T MODIFY IT. +rem +rem Instead, make a local copy and modify that one, or make a call to +rem this batch file from your customized one. [vszakats] +rem +rem Set any of the below settings to customize your build process: +rem set HB_MAKE_PROGRAM= +rem set HB_MAKE_FLAGS= +rem --------------------------------------------------------------- + +if "%HB_CC_NAME%" == "" set HB_CC_NAME=vc +if "%HB_MAKE_PROGRAM%" == "" set HB_MAKE_PROGRAM=nmake.exe +set HB_MAKEFILE=..\mtpl_%HB_CC_NAME%.mak + +rem --------------------------------------------------------------- + +if "%1" == "clean" goto CLEAN +if "%1" == "CLEAN" goto CLEAN + +if "%1" == "install" goto INSTALL +if "%1" == "INSTALL" goto INSTALL + +:BUILD + + %HB_MAKE_PROGRAM% %HB_MAKE_FLAGS% -f %HB_MAKEFILE% %1 %2 %3 > make_%HB_CC_NAME%.log + if errorlevel 1 notepad make_%HB_CC_NAME%.log + goto EXIT + +:CLEAN + + %HB_MAKE_PROGRAM% %HB_MAKE_FLAGS% -f %HB_MAKEFILE% CLEAN > make_%HB_CC_NAME%.log + if exist make_%HB_CC_NAME%.log del make_%HB_CC_NAME%.log > nul + if exist inst_%HB_CC_NAME%.log del inst_%HB_CC_NAME%.log > nul + goto EXIT + +:INSTALL + + if "%HB_INSTALL_PREFIX%" == "" set HB_INSTALL_PREFIX=..\.. + + if "%HB_BIN_INSTALL%" == "" set HB_BIN_INSTALL=%HB_INSTALL_PREFIX%\bin + if "%HB_INC_INSTALL%" == "" set HB_INC_INSTALL=%HB_INSTALL_PREFIX%\include + if "%HB_LIB_INSTALL%" == "" set HB_LIB_INSTALL=%HB_INSTALL_PREFIX%\lib + + %HB_MAKE_PROGRAM% %HB_MAKE_FLAGS% -f %HB_MAKEFILE% INSTALL > nul + goto EXIT + +:EXIT diff --git a/harbour/contrib/pdflib/pdf.ch b/harbour/contrib/pdflib/pdf.ch new file mode 100644 index 0000000000..7e4d948a4f --- /dev/null +++ b/harbour/contrib/pdflib/pdf.ch @@ -0,0 +1,230 @@ +#include "fileio.ch" +#include "common.ch" + +#define CRLF chr(13)+chr(10) + +#define NORMAL 0 +#define BOLD 1 +#define ITALIC 2 +#define BOLDITALIC 3 + +#define BOOKLEVEL 1 +#define BOOKTITLE 2 +#define BOOKPARENT 3 +#define BOOKPREV 4 +#define BOOKNEXT 5 +#define BOOKFIRST 6 +#define BOOKLAST 7 +#define BOOKCOUNT 8 +#define BOOKPAGE 9 +#define BOOKCOORD 10 + +#define FONTNAME 1 // font name +#define FONTSIZE 2 // font size +#define LPI 3 // lines per inch +#define PAGESIZE 4 // page size +#define PAGEORIENT 5 // page orientation +#define PAGEX 6 +#define PAGEY 7 +#define REPORTWIDTH 8 // report width +#define REPORTPAGE 9 // report page +#define REPORTLINE 10 // report line +#define FONTNAMEPREV 11 // prev font name +#define FONTSIZEPREV 12 // prev font size +#define PAGEBUFFER 13 // page buffer +#define REPORTOBJ 14 // current obj +#define DOCLEN 15 // document length +#define TYPE1 16 // array of type 1 fonts +#define MARGINS 17 // recalc margins ? +#define HEADEREDIT 18 // edit header ? +#define NEXTOBJ 19 // next obj +#define PDFTOP 20 // top row +#define PDFLEFT 21 // left & right margin in mm +#define PDFBOTTOM 22 // bottom row +#define HANDLE 23 // handle +#define PAGES 24 // array of pages +#define REFS 25 // array of references +#define BOOKMARK 26 // array of bookmarks +#define HEADER 27 // array of headers +#define FONTS 28 // array of report fonts +#define IMAGES 29 // array of report images +#define PAGEIMAGES 30 // array of current page images +#define PAGEFONTS 31 // array of current page fonts +#define FONTWIDTH 32 // array of fonts width's +#define OPTIMIZE 33 // optimized ? +#define CREATOR 34 +#define KEYWORD 35 +#define AUTHOR 36 +#define SUBJECT 37 +#define OVERLINE 38 +#define UNDERLINE 39 +#define PDFCOMPLVL 40 +#define PARAMLEN 40 // number of report elements + +#define ALIGN_LEFT 1 +#define ALIGN_CENTER 2 +#define ALIGN_RIGHT 3 +#define ALIGN_JUSTIFY 4 + +#define IMAGE_WIDTH 1 +#define IMAGE_HEIGHT 2 +#define IMAGE_XRES 3 +#define IMAGE_YRES 4 +#define IMAGE_BITS 5 +#define IMAGE_FROM 6 +#define IMAGE_LENGTH 7 + +#define BYTE 1 +#define ASCII 2 +#define SHORT 3 +#define LONG 4 +#define RATIONAL 5 +#define SBYTE 6 +#define UNDEFINED 7 +#define SSHORT 8 +#define SLONG 9 +#define SRATIONAL 10 +#define FLOAT 11 +#define DOUBLE 12 + +#define pdf_ALICEBLUE "F0F8FF" +#define pdf_ANTIQUEWHITE "FAEBD7" +#define pdf_AQUA "00FFFF" +#define pdf_AQUAMARINE "7FFFD4" +#define pdf_AZURE "F0FFFF" +#define pdf_BEIGE "F5F5DC" +#define pdf_BISQUE "FFE4C4" +#define pdf_BLACK "000000" +#define pdf_BLANCHEDALMOND "FFEBCD" +#define pdf_BLUE "0000FF" +#define pdf_BLUEVIOLET "8A2BE2" +#define pdf_BROWN "A52A2A" +#define pdf_BURLYWOOD "DEB887" +#define pdf_CADETBLUE "5F9EA0" +#define pdf_CHARTREUSE "7FFF00" +#define pdf_CHOCOLATE "D2691E" +#define pdf_CORAL "FF7F50" +#define pdf_CORNFLOWERBLUE "6495ED" +#define pdf_CORNSILK "FFF8DC" +#define pdf_CRIMSON "DC143C" +#define pdf_CYAN "00FFFF" +#define pdf_DARKBLUE "00008B" +#define pdf_DARKCYAN "008B8B" +#define pdf_DARKGOLDENROD "B8860B" +#define pdf_DARKGRAY "A9A9A9" +#define pdf_DARKGREEN "006400" +#define pdf_DARKKHAKI "BDB76B" +#define pdf_DARKMAGENTA "8B008B" +#define pdf_DARKOLIVEGREEN "556B2F" +#define pdf_DARKORANGE "FF8C00" +#define pdf_DARKORCHID "9932CC" +#define pdf_DARKRED "8B0000" +#define pdf_DARKSALMON "E9967A" +#define pdf_DARKSEAGREEN "8FBC8F" +#define pdf_DARKSLATEBLUE "483D8B" +#define pdf_DARKSLATEGRAY "2F4F4F" +#define pdf_DARKTURQUOISE "00CED1" +#define pdf_DARKVIOLET "9400D3" +#define pdf_DEEPPINK "FF1493" +#define pdf_DEEPSKYBLUE "00BFFF" +#define pdf_DIMGRAY "696969" +#define pdf_DODGERBLUE "1E90FF" +#define pdf_FIREBRICK "B22222" +#define pdf_FLORALWHITE "FFFAF0" +#define pdf_FORESTGREEN "228B22" +#define pdf_FUCHSIA "FF00FF" +#define pdf_GAINSBORO "DCDCDC" +#define pdf_GHOSTWHITE "F8F8FF" +#define pdf_GOLD "FFD700" +#define pdf_GOLDENROD "DAA520" +#define pdf_GRAY "808080" +#define pdf_GREEN "008000" +#define pdf_GREENYELLOW "ADFF2F" +#define pdf_HONEYDEW "F0FFF0" +#define pdf_HOTPINK "FF69B4" +#define pdf_INDIANRED "CD5C5C" +#define pdf_INDIGO "4B0082" +#define pdf_IVORY "FFFFF0" +#define pdf_KHAKI "F0E68C" +#define pdf_LAVENDER "E6E6FA" +#define pdf_LAVENDERBLUSH "FFF0F5" +#define pdf_LAWNGREEN "7CFC00" +#define pdf_LEMONCHIFFON "FFFACD" +#define pdf_LIGHTBLUE "ADD8E6" +#define pdf_LIGHTCORAL "F08080" +#define pdf_LIGHTCYAN "E0FFFF" +#define pdf_LIGHTGOLDENRODYELLOW "FAFAD2" +#define pdf_LIGHTGREEN "90EE90" +#define pdf_LIGHTGREY "D3D3D3" +#define pdf_LIGHTPINK "FFB6C1" +#define pdf_LIGHTSALMON "FFA07A" +#define pdf_LIGHTSEAGREEN "20B2AA" +#define pdf_LIGHTSKYBLUE "87CEFA" +#define pdf_LIGHTSLATEGRAY "778899" +#define pdf_LIGHTSTEELBLUE "B0C4DE" +#define pdf_LIGHTYELLOW "FFFFE0" +#define pdf_LIME "00FF00" +#define pdf_LIMEGREEN "32CD32" +#define pdf_LINEN "FAF0E6" +#define pdf_MAGENTA "FF00FF" +#define pdf_MAROON "800000" +#define pdf_MEDIUMAQUAMARINE "66CDAA" +#define pdf_MEDIUMBLUE "0000CD" +#define pdf_MEDIUMORCHID "BA55D3" +#define pdf_MEDIUMPURPLE "9370DB" +#define pdf_MEDIUMSEAGREEN "3CB371" +#define pdf_MEDIUMSLATEBLUE "7B68EE" +#define pdf_MEDIUMSPRINGGREEN "00FA9A" +#define pdf_MEDIUMTURQUOISE "48D1CC" +#define pdf_MEDIUMVIOLETRED "C71585" +#define pdf_MIDNIGHTBLUE "191970" +#define pdf_MINTCREAM "F5FFFA" +#define pdf_MISTYROSE "FFE4E1" +#define pdf_MOCCASIN "FFE4B5" +#define pdf_NAVAJOWHITE "FFDEAD" +#define pdf_NAVY "000080" +#define pdf_OLDLACE "FDF5E6" +#define pdf_OLIVE "808000" +#define pdf_OLIVEDRAB "6B8E23" +#define pdf_ORANGE "FFA500" +#define pdf_ORANGERED "FF4500" +#define pdf_ORCHID "DA70D6" +#define pdf_PALEGOLDENROD "EEE8AA" +#define pdf_PALEGREEN "98FB98" +#define pdf_PALETURQUOISE "AFEEEE" +#define pdf_PALEVIOLETRED "DB7093" +#define pdf_PAPAYAWHIP "FFEFD5" +#define pdf_PEACHPUFF "FFDAB9" +#define pdf_PERU "CD853F" +#define pdf_PINK "FFC0CB" +#define pdf_PLUM "DDADDD" +#define pdf_POWDERBLUE "B0E0E6" +#define pdf_PURPLE "800080" +#define pdf_RED "FF0000" +#define pdf_ROSYBROWN "BC8F8F" +#define pdf_ROYALBLUE "4169E1" +#define pdf_SADDLEBROWN "8B4513" +#define pdf_SALMON "FA8072" +#define pdf_SANDYBROWN "F4A460" +#define pdf_SEAGREEN "2E8B57" +#define pdf_SEASHELL "FFF5EE" +#define pdf_SIENNA "A0522D" +#define pdf_SILVER "C0C0C0" +#define pdf_SKYBLUE "87CEEB" +#define pdf_SLATEBLUE "6A5ACD" +#define pdf_SLATEGRAY "708090" +#define pdf_SNOW "FFFAFA" +#define pdf_SPRINGGREEN "00FF7F" +#define pdf_STEELBLUE "4682B4" +#define pdf_TAN "D2B48C" +#define pdf_TEAL "008080" +#define pdf_THISTLE "D8BFD8" +#define pdf_TOMATO "FF6347" +#define pdf_TURQUOISE "40E0D0" +#define pdf_VIOLET "EE82EE" +#define pdf_WHEAT "F5DEB3" +#define pdf_WHITE "FFFFFF" +#define pdf_WHITESMOKE "F5F5F5" +#define pdf_YELLOW "FFFF00" +#define pdf_YELLOWGREEN "9ACD32" + diff --git a/harbour/contrib/pdflib/pdf1.prg b/harbour/contrib/pdflib/pdf1.prg new file mode 100644 index 0000000000..eccc1f4418 --- /dev/null +++ b/harbour/contrib/pdflib/pdf1.prg @@ -0,0 +1,1848 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * PDF api Api for multiple porpurse + * + * Copyright 2000-2004 Luiz Rafael Culik + * 2000-2004 Priptpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + + +#include "common.ch" +#include "pdfhbdoc.ch" +#include "pdf.ch" +#include "hbclass.ch" + +/* TPdf class +based on work of : Victor K. . http://www.ihaveparts.com ++ many new itens that Victor code dont handle +*/ +MEMVAR lLandScape // GLOBAL EXTERNAL + +CLASS TPdf + + EXPORT: + DATA aReport INIT Array( PARAMLEN ) + + METHOD New( cFile, nLen, nHeigth, nWidth ) + METHOD Pdfnewpage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize ) + METHOD Pdfclosepage() + METHOD Pdfclose() + METHOD Pdfpagesize( _cPageSize ) + METHOD Pdfpageorient( _cPageOrient ) + METHOD Pdfsetlpi( _nLpi ) + METHOD Pdfsetfont( _cFont, _nType, _nSize, cId ) + METHOD Pdfdrawheader() + METHOD Pdfmargins( nTop, nLeft, nBottom ) + METHOD Pdfimageinfo( cFile ) + METHOD Pdftiffinfo( cFile ) + + METHOD Pdfjpeginfo( cFile ) + METHOD Pdfimage( cFile, nRow, nCol, nHeight, nWidth, cId, Scalex, Scaley ) + METHOD Pdfatsay( cString, nRow, nCol, lExact, cId ) + METHOD Pdfgetfontinfo( cParam ) + METHOD Pdfpagenum( n ) + PROTECTED: + METHOD Pdfstringb( cString ) + + /* New method added by Luiz Rafael Culik not exist on original code */ + export: + METHOD Getpagetype( nWidth, nHeight ) + METHOD Settop( N ) INLINE ::aReport[ PDFTOP ] := N // top + METHOD Setleft( N ) INLINE ::aReport[ PDFLEFT ] := N // left & right + METHOD Setbottom( N ) INLINE ::aReport[ PDFBOTTOM ] := N + METHOD Pdf_Rect( x, y, width, height ) + METHOD Pdf_Stroke() + METHOD Setoverline( l ) + METHOD Setunderline( l ) + METHOD Pdfmoveto( X, Y ) + METHOD Pdflineto( X, Y ) + METHOD Pdfsetlinewidth( w ) + METHOD Pdfsetlinecap( w ) + METHOD Pdfsetdash( b, w ) + METHOD Pdfsave( lBuf ) + METHOD Pdfrestore( lBuf ) + METHOD Pdfunder( Text, Len, X, Y ) + METHOD Pdfover( Text, Len, x, y ) + METHOD Pdf_Str_Width( Text, Len, Font, Size ) + METHOD Pdfsetrgbcolor( R, G, B ) + METHOD Pdfscale( X, Y, lBuf ) + METHOD Pdftranslate( tX, tY ) + + METHOD Pdfpnginfo( cFile ) + METHOD Pdfrotate( pHi ) + METHOD Pdfclosepath() + METHOD Pdfendpath() + + METHOD Pdfcurveto( x1, y1, x2, y2, x3, y3 ) + METHOD Pdfcomplevel( x ) + METHOD Pdfinfo( cTitle, cAuthor, cKey, cCreator ) + METHOD PDF_setrgbcolor_fill( R, G, B ) +ENDCLASS + + /* Original Victor Code (with some itens nowt needed removed*/ + +METHOD NEW( cFile, nLen, nHeigth, nWidth ) CLASS TPdf + +LOCAL cTemp +LOCAL nI +LOCAL nJ +LOCAL n1 +LOCAL n2 := 896 +LOCAL n12 + + DEFAULT nLen TO 200 + DEFAULT nHeigth TO a4_height, nWidth TO a4_width + + ::aReport[ HANDLE ] := Fcreate( cFile ) + IF ::aReport[ HANDLE ] <= 0 + RETURN NIL + ENDIF + + // if nHeigth < a4_height + // nHeigth := a4_height + // endif + + // if nWidth < a4_width + // nWidth := a4_width + // endif + + ::aReport[ FONTNAME ] := 1 + ::aReport[ FONTSIZE ] := 10 + ::aReport[ LPI ] := 6 + ::aReport[ PAGESIZE ] :=::GetPageType( nWidth, nHeigth ) + ::aReport[ PAGEORIENT ] := Iif( nWidth > nHeigth, "P", "L" ) + ::aReport[ PAGEX ] := nWidth + ::aReport[ PAGEY ] := nHeigth + + ::aReport[ REPORTWIDTH ] := nLen // 200 // should be as parameter + ::aReport[ REPORTPAGE ] := 0 + ::aReport[ REPORTLINE ] := 0 //5 + ::aReport[ FONTNAMEPREV ] := 0 + ::aReport[ FONTSIZEPREV ] := 0 + ::aReport[ PAGEBUFFER ] := "" + ::aReport[ REPORTOBJ ] := 1 //2 + ::aReport[ DOCLEN ] := 0 + ::aReport[ TYPE1 ] := { "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique", "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique" } // 0.04 + ::aReport[ MARGINS ] := .t. + ::aReport[ HEADEREDIT ] := .f. + ::aReport[ NEXTOBJ ] := 0 + ::aReport[ PDFTOP ] := 1 // top + ::aReport[ PDFLEFT ] := 10 // Left & right + ::aReport[ PDFBOTTOM ] := ::aReport[ PAGEY ] * ::aReport[ LPI ] - 1 // bottom, DEFAULT "LETTER", "P", 6 + + ::aReport[ PAGES ] := {} + ::aReport[ REFS ] := { 0, 0 } + ::aReport[ BOOKMARK ] := {} + ::aReport[ HEADER ] := {} + ::aReport[ FONTS ] := {} + ::aReport[ IMAGES ] := {} + ::aReport[ PAGEIMAGES ] := {} + ::aReport[ PAGEFONTS ] := {} + + cTemp := Memoread( "fonts.dat" ) // times, times-bold, times-italic, times-bolditalic, helvetica..., courier... // 0.04 + n1 := Len( cTemp ) / ( 2 * n2 ) + ::aReport[ FONTWIDTH ] := Array( n1, n2 ) + ::aReport[ PDFCOMPLVL ] := 0 + ::aReport[ NEXTOBJ ] := ::aReport[ REPORTOBJ ] + 4 + + n12 := 2 * n2 // 0.04 + FOR nI := 1 TO n1 + FOR nJ := 1 TO n2 + + ::aReport[ FONTWIDTH, nI, nJ ] := Bin2i( Substr( cTemp, ( nI - 1 ) * n12 + ( nJ - 1 ) * 2 + 1, 2 ) ) + NEXT + NEXT + + ::aReport[ CREATOR ] := "" + ::aReport[ KEYWORD ] := "" + ::aReport[ AUTHOR ] := "" + ::aReport[ SUBJECT ] := "" + ::aReport[ OVERLINE ] := .f. + ::aReport[ UNDERLINE ] := .f. + + ::aReport[ DOCLEN ] := 0 + cTemp := "%PDF-1.3" + CRLF + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + +RETURN SELF + +METHOD Pdfnewpage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize ) CLASS TPdf + +LOCAL nAdd := 76.2 + DEFAULT _cPageSize TO ::aReport[ PAGESIZE ] + DEFAULT _cPageOrient TO ::aReport[ PAGEORIENT ] + DEFAULT _nLpi TO ::aReport[ LPI ] + DEFAULT _cFontName TO ::pdfGetFontInfo( "NAME" ) + DEFAULT _nFontType TO ::pdfGetFontInfo( "TYPE" ) + DEFAULT _nFontSize TO ::aReport[ FONTSIZE ] + + IF !Empty( ::aReport[ PAGEBUFFER ] ) + ::pdfClosePage() + ENDIF + + ::aReport[ PAGEFONTS ] := {} + ::aReport[ PAGEIMAGES ] := {} + + ++ ::aReport[ REPORTPAGE ] // NEW !!! + + ::pdfPageSize( _cPageSize ) + ::pdfPageOrient( _cPageOrient ) + ::pdfSetLPI( _nLpi ) + + ::pdfSetFont( _cFontName, _nFontType, _nFontSize ) + + ::pdfDrawHeader() + + ::aReport[ REPORTLINE ] := 0 + ::aReport[ FONTNAMEPREV ] := 0 + ::aReport[ FONTSIZEPREV ] := 0 +RETURN nil + +METHOD Pdfclosepage() CLASS TPdf + +LOCAL cTemp +LOCAL cBuffer +LOCAL nBuffer +LOCAL nRead +LOCAL nI +LOCAL k +LOCAL nImage +LOCAL nFont +LOCAL nImageHandle +LOCAL Row := 0 +LOCAL rowsperstrip +LOCAL res + + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + + Aadd( ::aReport[ PAGES ], ::aReport[ REPORTOBJ ] + 1 ) + + cTemp := ; + Ltrim( Str( ++ ::aReport[ REPORTOBJ ] ) ) + " 0 obj" + CRLF + ; + "<<" + CRLF + ; + "/Type /Page /Parent 1 0 R" + CRLF + ; + "/Resources " + Ltrim( Str( ++ ::aReport[ REPORTOBJ ] ) ) + " 0 R" + CRLF + ; + "/MediaBox [ 0 0 " + Ltrim( Transform( ::aReport[ PAGEX ], "9999.99" ) ) + " " + ; + Ltrim( Transform( ::aReport[ PAGEY ], "9999.99" ) ) + " ]" + CRLF + ; + "/Contents " + Ltrim( Str( ++ ::aReport[ REPORTOBJ ] ) ) + " 0 R" + CRLF + ; + ">>" + CRLF + ; + "endobj" + CRLF + // "/Contents [ " + LTrim(Str( ++::aReport[ REPORTOBJ ] )) + " 0 R ]" + CRLF + ; + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + cTemp := ; + Ltrim( Str( ::aReport[ REPORTOBJ ] - 1 ) ) + " 0 obj" + CRLF + ; + "<<" + CRLF + ; + "/ColorSpace << /DeviceRGB /DeviceGray >>" + CRLF + ; //version 0.01 + "/ProcSet [ /PDF /Text /ImageB /ImageC ]" + + IF Len( ::aReport[ PAGEFONTS ] ) > 0 + cTemp += CRLF + ; + "/Font" + CRLF + ; + "<<" + + FOR nI := 1 TO Len( ::aReport[ PAGEFONTS ] ) + nFont := Ascan( ::aReport[ FONTS ], { | arr | arr[ 1 ] == ::aReport[ PAGEFONTS, nI ] } ) + //IF nFont == 0 + // alert("New font after!!!") + //ENDIF + cTemp += CRLF + "/Fo" + Ltrim( Str( nFont ) ) + " " + Ltrim( Str( ::aReport[ FONTS, nFont, 2 ] ) ) + " 0 R" + NEXT + + cTemp += CRLF + ">>" + ENDIF + + IF Len( ::aReport[ PAGEIMAGES ] ) > 0 + + cTemp += CRLF + "/XObject" + CRLF + "<<" + FOR nI := 1 TO Len( ::aReport[ PAGEIMAGES ] ) + nImage := Ascan( ::aReport[ IMAGES ], { | arr | arr[ 1 ] == ::aReport[ PAGEIMAGES, nI, 1 ] } ) + IF nImage == 0 + Aadd( ::aReport[ IMAGES ], { ::aReport[ PAGEIMAGES, nI, 1 ], ++ ::aReport[ NEXTOBJ ], ::pdfImageInfo( ::aReport[ PAGEIMAGES, nI, 1 ] ) } ) + nImage := Len( ::aReport[ IMAGES ] ) + ENDIF + cTemp += CRLF + "/Image" + Ltrim( Str( nImage ) ) + " " + Ltrim( Str( ::aReport[ IMAGES, nImage, 2 ] ) ) + " 0 R" + NEXT + cTemp += CRLF + ">>" + ENDIF + + cTemp += CRLF + ">>" + CRLF + "endobj" + CRLF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + cTemp := Ltrim( Str( ::aReport[ REPORTOBJ ] ) ) + " 0 obj << /Length " + ; + Ltrim( Str( ::aReport[ REPORTOBJ ] + 1 ) ) + " 0 R " + CRLF + ; + Iif( ::aReport[ PDFCOMPLVL ] > 0, "/Filter/FlateDecode" + CRLF + ">>", CRLF + ">>" ) + CRLF + ; + "stream" + CRLF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + IF Len( ::aReport[ PAGEIMAGES ] ) > 0 + cTemp := "" + FOR nI := 1 TO Len( ::aReport[ PAGEIMAGES ] ) + IF ::aReport[ PAGEIMAGES, nI, 6 ] != 0 .AND. ::aReport[ PAGEIMAGES, nI, 7 ] != 0 + cTemp +=::pdfsave( .f. ) + cTemp +=::pdfscale( ::aReport[ PAGEIMAGES, nI, 6 ], ::aReport[ PAGEIMAGES, nI, 7 ], .f. ) + ENDIF + cTemp +=::pdfsave( .f. ) + nImage := Ascan( ::aReport[ IMAGES ], { | arr | arr[ 1 ] == ::aReport[ PAGEIMAGES, nI, 1 ] } ) + cTemp += CRLF + Ltrim( Str( Iif( ::aReport[ PAGEIMAGES, nI, 5 ] == 0, pdfM2X( ::aReport[ IMAGES, nImage, 3, IMAGE_HEIGHT ] ), ::aReport[ PAGEIMAGES, nI, 4 ] ) ) ) + ; + " 0 0 " + ; + Ltrim( Str( Iif( ::aReport[ PAGEIMAGES, nI, 4 ] == 0, pdfM2X( ::aReport[ IMAGES, nImage, 3, IMAGE_WIDTH ] ), ::aReport[ PAGEIMAGES, nI, 5 ] ) ) ) + ; + " " + Ltrim( Str( ::aReport[ PAGEIMAGES, nI, 3 ] ) ) + /* + " " + LTrim(Str( ::aReport[ PAGEY ] - ::aReport[ PAGEIMAGES ][ nI ][ 2 ] - ; + IIF( ::aReport[ PAGEIMAGES ][ nI ][ 4 ] == 0, pdfM2X( ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_HEIGHT ] / ::aReport[ IMAGES ][ nImage ][ 3 ][ IMAGE_YRES ] * 25.4 ), ::aReport[ PAGEIMAGES ][ nI ][ 4 ]))) + " cm" + */ + rowsperstrip := ::aReport[ PAGEIMAGES, nI, 5 ] + res := calcdata( ::aReport[ PAGEIMAGES, nI, 5 ], ::aReport[ PAGEIMAGES, nI, 2 ], ::aReport[ PAGEIMAGES, nI, 5 ] ) + + cTemp += " " + Ltrim( Str( res ) ) + " cm" + + cTemp += CRLF + "/Image" + Ltrim( Str( nImage ) ) + " Do" + cTemp +=::pdfrestore( .f. ) + IF ::aReport[ PAGEIMAGES, nI, 6 ] != 0 .AND. ::aReport[ PAGEIMAGES, nI, 7 ] != 0 + cTemp +=::pdfrestore( .f. ) + ENDIF + + NEXT + ::aReport[ PAGEBUFFER ] := cTemp + ::aReport[ PAGEBUFFER ] + ENDIF + + IF ::aReport[ PDFCOMPLVL ] > 0 + + cTemp := HB_COMPRESS( ::aReport[ PDFCOMPLVL ], ::aReport[ PAGEBUFFER ] ) + ELSE + cTemp := ::aReport[ PAGEBUFFER ] + ENDIF + cTemp += CRLF + "endstream" + CRLF + ; + "endobj" + CRLF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + cTemp := Ltrim( Str( ++ ::aReport[ REPORTOBJ ] ) ) + " 0 obj" + CRLF + ; + Ltrim( Str( Len( ::aReport[ PAGEBUFFER ] ) ) ) + CRLF + ; + "endobj" + CRLF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + FOR nI := 1 TO Len( ::aReport[ FONTS ] ) + IF ::aReport[ FONTS, nI, 2 ] > ::aReport[ REPORTOBJ ] + + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + + cTemp := ; + Ltrim( Str( ::aReport[ FONTS, nI, 2 ] ) ) + " 0 obj" + CRLF + ; + "<<" + CRLF + ; + "/Type /Font" + CRLF + ; + "/Subtype /Type1" + CRLF + ; + "/Name /Fo" + Ltrim( Str( nI ) ) + CRLF + ; + "/BaseFont /" + ::aReport[ TYPE1, ::aReport[ FONTS, nI, 1 ] ] + CRLF + ; + "/Encoding /WinAnsiEncoding" + CRLF + ; + ">>" + CRLF + ; + "endobj" + CRLF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + ENDIF + NEXT + + FOR nI := 1 TO Len( ::aReport[ IMAGES ] ) + IF ::aReport[ IMAGES, nI, 2 ] > ::aReport[ REPORTOBJ ] + + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + + // "/Filter /CCITTFaxDecode" FOR B&W only ? + cTemp := ; + Ltrim( Str( ::aReport[ IMAGES, nI, 2 ] ) ) + " 0 obj" + CRLF + ; + "<<" + CRLF + ; + "/Type /XObject" + CRLF + ; + "/Subtype /Image" + CRLF + ; + "/Name /Image" + Ltrim( Str( nI ) ) + CRLF + IF At( ".PNG", Upper( ::aReport[ IMAGES, nI, 1 ] ) ) > 0 + cTemp += "/Filter[/FlateDecode]" + CRLF + cTemp += "/DecodeParms[<>]" + CRLF + ELSE + cTemp += "/Filter [" + Iif( At( ".JPG", Upper( ::aReport[ IMAGES, nI, 1 ] ) ) > 0, " /DCTDecode", "" ) + " ]" + CRLF + ENDIF + cTemp += "/Width " + Ltrim( Str( ::aReport[ IMAGES, nI, 3, IMAGE_WIDTH ] ) ) + CRLF + ; + "/Height " + Ltrim( Str( ::aReport[ IMAGES, nI, 3, IMAGE_HEIGHT ] ) ) + CRLF + ; + "/BitsPerComponent " + Ltrim( Str( ::aReport[ IMAGES, nI, 3, IMAGE_BITS ] ) ) + CRLF + IF ::aReport[ IMAGES, nI, 3, 8 ] == 2 + cTemp += "/ColorSpace/" + Iif( ::aReport[ IMAGES, nI, 3, IMAGE_BITS ] == 1, "DeviceGray", "DeviceRGB" ) + CRLF + ; + "/Length " + Ltrim( Str( ::aReport[ IMAGES, nI, 3, IMAGE_LENGTH ] ) ) + CRLF + ; + ">>" + CRLF + ; + "stream" + CRLF + ELSE + cTemp += "/ColorSpace[/Indexed/DeviceRGB 255 " + Ltrim( Str( ::aReport[ IMAGES, nI, 2 ] + 1 ) ) + " 0 R]" + CRLF + ; + "/Length " + Ltrim( Str( ::aReport[ IMAGES, nI, 3, IMAGE_LENGTH ] ) ) + CRLF + ; + ">>" + CRLF + ; + "stream" + CRLF + + ENDIF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + nImageHandle := Fopen( ::aReport[ IMAGES, nI, 1 ] ) + + Fseek( nImageHandle, ::aReport[ IMAGES, nI, 3, IMAGE_FROM ] ) + + nBuffer := 8192 + cBuffer := Space( nBuffer ) + k := 0 + WHILE k < ::aReport[ IMAGES, nI, 3, IMAGE_LENGTH ] + IF k + nBuffer <= ::aReport[ IMAGES, nI, 3, IMAGE_LENGTH ] + nRead := nBuffer + ELSE + nRead := ::aReport[ IMAGES, nI, 3, IMAGE_LENGTH ] - k + ENDIF + Fread( nImageHandle, @cBuffer, nRead ) + + ::aReport[ DOCLEN ] += nRead + Fwrite( ::aReport[ HANDLE ], cBuffer, nRead ) + k += nRead + ENDDO + + cTemp := "endstream" + CRLF + ; + "endobj" + CRLF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + IF ::aReport[ IMAGES, nI, 3, 8 ] == 3 + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + cTemp := Ltrim( Str( ::aReport[ IMAGES, nI, 2 ] + 1 ) ) + " 0 obj" + CRLF + ; + "<>" + CRLF + ; + "stream" + CRLF + ; + ::aReport[ IMAGES, nI, 3, 9 ] + "endstream" + CRLF + ; + "endobj" + CRLF + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + ++ ::aReport[ NEXTOBJ ] + ENDIF + + ENDIF + NEXT + + ::aReport[ REPORTOBJ ] := ::aReport[ NEXTOBJ ] + + ::aReport[ NEXTOBJ ] := ::aReport[ REPORTOBJ ] + 4 + + ::aReport[ PAGEBUFFER ] := "" + +RETURN nil + +METHOD Pdfpagesize( _cPageSize ) CLASS TPdf + +LOCAL nSize +LOCAL aSize := { { "LETTER", letter_width, letter_height }, { "LEGAL", legal_width, legal_height }, { "LEDGER", ledger_width, ledger_height }, { "A4", a4_width, a4_height }, { "A3", a3_width, a3_height } } + + DEFAULT _cPageSize TO "LETTER" + + nSize := Ascan( aSize, { | arr | arr[ 1 ] = _cPageSize } ) + + IF nSize = 0 //.or. nSize > 2 //0.05 + nSize := 1 + ENDIF + + ::aReport[ PAGESIZE ] := aSize[ nSize, 1 ] + + IF ::aReport[ PAGEORIENT ] = "P" + ::aReport[ PAGEX ] := aSize[ nSize, 2 ] + ::aReport[ PAGEY ] := aSize[ nSize, 3 ] + ELSE + ::aReport[ PAGEX ] := aSize[ nSize, 3 ] + ::aReport[ PAGEY ] := aSize[ nSize, 2 ] + ENDIF + +RETURN nil + +METHOD Pdfpageorient( _cPageOrient ) CLASS TPdf + + DEFAULT _cPageOrient TO Iif( lLandScape, "L", "P" ) + + ::aReport[ PAGEORIENT ] := _cPageOrient + ::pdfPageSize( ::aReport[ PAGESIZE ] ) + +RETURN nil + +METHOD Pdfsetlpi( _nLpi ) CLASS TPdf + +LOCAL cLpi := Alltrim( Str( _nLpi ) ) + DEFAULT _nLpi TO 6 + + cLpi := Iif( cLpi $ "1;2;3;4;6;8;12;16;24;48", cLpi, "6" ) + ::aReport[ LPI ] := Val( cLpi ) + + ::pdfPageSize( ::aReport[ PAGESIZE ] ) +RETURN nil + +METHOD Pdfsetfont( _cFont, _nType, _nSize, cId ) CLASS TPdf + + DEFAULT _cFont TO "Times" + DEFAULT _nType TO 0 + DEFAULT _nSize TO 10 + + HB_SYMBOL_UNUSED( cId ) + + _cFont := Upper( _cFont ) + ::aReport[ FONTSIZE ] := _nSize + + IF _cFont == "TIMES" + ::aReport[ FONTNAME ] := _nType + 1 + ELSEIF _cFont == "HELVETICA" + ::aReport[ FONTNAME ] := _nType + 5 + ELSE + ::aReport[ FONTNAME ] := _nType + 9 // 0.04 + ENDIF + + Aadd( ::aReport[ PAGEFONTS ], ::aReport[ FONTNAME ] ) + + IF Ascan( ::aReport[ FONTS ], { | arr | arr[ 1 ] == ::aReport[ FONTNAME ] } ) == 0 + Aadd( ::aReport[ FONTS ], { ::aReport[ FONTNAME ], ++ ::aReport[ NEXTOBJ ] } ) + ENDIF + +RETURN nil + +METHOD Pdfdrawheader() CLASS TPdf + +LOCAL _nFont +LOCAL _nSize +LOCAL nLen := Len( ::aReport[ HEADER ] ) + + IF nLen > 0 + + // save font + _nFont := ::aReport[ FONTNAME ] + _nSize := ::aReport[ FONTSIZE ] + + ::aReport[ FONTNAME ] := _nFont + ::aReport[ FONTSIZE ] := _nSize + + IF ::aReport[ MARGINS ] + ::pdfMargins() + ENDIF + + ELSE + IF ::aReport[ MARGINS ] + ::aReport[ PDFTOP ] := 1 // top + ::aReport[ PDFLEFT ] := 10 // Left & right + ::aReport[ PDFBOTTOM ] := ::aReport[ PAGEY ] * ::aReport[ LPI ] - 1 // bottom, default "LETTER", "P", 6 + + ::aReport[ MARGINS ] := .f. + ENDIF + ENDIF +RETURN nil + +METHOD Pdfmargins( nTop, nLeft, nBottom ) CLASS TPdf + + IF nTop <> NIL + ::aReport[ PDFTOP ] := nTop + ENDIF + IF nLeft <> NIL + ::aReport[ PDFLEFT ] := nLeft + ENDIF + IF nBottom <> NIL + ::aReport[ PDFBOTTOM ] := nBottom + ENDIF + + ::aReport[ MARGINS ] := .f. + +RETURN nil + +METHOD Pdfimageinfo( cFile ) CLASS TPdf + +LOCAL cTemp := Upper( Substr( cFile, Rat( '.', cFile ) + 1 ) ) +LOCAL aTemp := {} + DO CASE + CASE cTemp == "TIF" + aTemp :=::pdfTIFFInfo( cFile ) + CASE cTemp == "JPG" + aTemp :=::pdfJPEGInfo( cFile ) + CASE cTemp == "PNG" + aTemp :=::pdfPngInfo( cFile ) + ENDCASE + +RETURN aTemp + +METHOD Pdftiffinfo( cFile ) CLASS TPdf + +LOCAL c40 := Chr( 0 ) + Chr( 0 ) + Chr( 0 ) + Chr( 0 ) +LOCAL aType := { "BYTE", "ASCII", "SHORT", "LONG", "RATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "FLOAT", "DOUBLE" } +LOCAL aCount := { 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 } +LOCAL nTemp +LOCAL nHandle +LOCAL cValues +LOCAL c2 +LOCAL nFieldType +LOCAL nCount +LOCAL nPos +LOCAL nTag +LOCAL nValues +LOCAL nOffset +LOCAL cTemp +LOCAL cIFDNext +LOCAL nIFD +LOCAL nFields +LOCAL cTag +LOCAL nPages +LOCAL nn + +LOCAL nWidth := 0 +LOCAL nHeight := 0 +LOCAL nBits := 0 +LOCAL nFrom := 0 +LOCAL nLength := 0 +LOCAL xRes := 0 +LOCAL yRes := 0 +LOCAL aTemp := {} + + nHandle := Fopen( cFile ) + + c2 := ' ' + Fread( nHandle, @c2, 2 ) + /* +IF c2 == 'II' .or. c2 == 'MM' +ELSE + alert("Not II or MM") +ENDIF +*/ + Fread( nHandle, @c2, 2 ) + /* +IF c2 <> '*' + Chr(0) + alert("Not *") +ENDIF +*/ + cIFDNext := ' ' + Fread( nHandle, @cIFDNext, 4 ) + + cTemp := Space( 12 ) + nPages := 0 + + WHILE cIFDNext <> c40 //read IFD's + + nIFD := Bin2l( cIFDNext ) + + Fseek( nHandle, nIFD ) + //?'*** IFD ' + LTrim(Str( ++nPages )) + + Fread( nHandle, @c2, 2 ) + nFields := Bin2i( c2 ) + + FOR nn := 1 TO nFields + Fread( nHandle, @cTemp, 12 ) + + nTag := Bin2w( Substr( cTemp, 1, 2 ) ) + nFieldType := Bin2w( Substr( cTemp, 3, 2 ) ) + /* + 1 = BYTE 8-bit unsigned integer. + 2 = ASCII 8-bit byte that contains a 7-bit ASCII code; the last byte + must be NUL (binary zero). + 3 = SHORT 16-bit (2-byte) unsigned integer. + 4 = LONG 32-bit (4-byte) unsigned integer. + 5 = RATIONAL Two LONGs: the first represents the numerator of a + fraction; the second, the denominator. + + In TIFF 6.0, some new field types have been defined: + + 6 = SBYTE An 8-bit signed (twos-complement) integer. + 7 = UNDEFINED An 8-bit byte that may contain anything, depending on + the definition of the field. + 8 = SSHORT A 16-bit (2-byte) signed (twos-complement) integer. + 9 = SLONG A 32-bit (4-byte) signed (twos-complement) integer. + 10 = SRATIONAL Two SLONG’s: the first represents the numerator of a + fraction, the second the denominator. + 11 = FLOAT Single precision (4-byte) IEEE format. + 12 = DOUBLE Double precision (8-byte) IEEE format. + */ + nCount := Bin2l( Substr( cTemp, 5, 4 ) ) + nOffset := Bin2l( Substr( cTemp, 9, 4 ) ) + + IF nCount > 1 .OR. nFieldType == RATIONAL .OR. nFieldType == SRATIONAL + nPos := filepos( nHandle ) + Fseek( nHandle, nOffset ) + + nValues := nCount * aCount[ nFieldType ] + cValues := Space( nValues ) + Fread( nHandle, @cValues, nValues ) + Fseek( nHandle, nPos ) + ELSE + cValues := Substr( cTemp, 9, 4 ) + ENDIF + + IF nFieldType == ASCII + -- nCount + ENDIF + //?'Tag' + //??' ' + Padr( nTag, 10 ) + cTag := '' + DO CASE + CASE nTag == 256 + /* + ImageWidth + Tag = 256 (100.H) + Type = SHORT or LONG + The number of columns in the image, i.e., the number of pixels per scanline. + */ + //??'ImageWidth' + cTag := 'ImageWidth' + /* + IF nFieldType <> SHORT .and. nFieldType <> LONG + alert('Wrong Type FOR ImageWidth') + ENDIF +*/ + IF nFieldType == SHORT + nWidth := Bin2w( Substr( cValues, 1, 2 ) ) + ELSEIF nFieldType == LONG + nWidth := Bin2l( Substr( cValues, 1, 4 ) ) + ENDIF + + CASE nTag == 257 + /* + ImageLength + Tag = 257 (101.H) + Type = SHORT or LONG + The number of rows (sometimes described as scanlines) in the image. + */ + //??'ImageLength' + cTag := 'ImageLength' + /* + IF nFieldType <> SHORT .and. nFieldType <> LONG + alert('Wrong Type FOR ImageLength') + ENDIF +*/ + IF nFieldType == SHORT + nHeight := Bin2w( Substr( cValues, 1, 2 ) ) + ELSEIF nFieldType == LONG + nHeight := Bin2l( Substr( cValues, 1, 4 ) ) + ENDIF + + CASE nTag == 258 + /* + BitsPerSample + Tag = 258 (102.H) + Type = SHORT + The number of bits per component. + Allowable values for Baseline TIFF grayscale images are 4 and 8, allowing either + 16 or 256 distinct shades of gray. + */ + //??'BitsPerSample' + cTag := 'BitsPerSample' + nTemp := 0 + IF nFieldType == SHORT + nTemp := Bin2w( cValues ) + ELSE + //alert('Wrong Type for BitsPerSample') + ENDIF + nBits := nTemp + //IF nTemp <> 4 .and. nTemp <> 8 + // alert('Wrong Value for BitsPerSample') + //ENDIF + CASE nTag == 259 + /* + Compression + Tag = 259 (103.H) + Type = SHORT + Values: + 1 = No compression, but pack data into bytes as tightly as possible, leaving no unused + bits (except at the end of a row). The component values are stored as an array of + type BYTE. Each scan line (row) is padded to the next BYTE boundary. + 2 = CCITT Group 3 1-Dimensional ModIFied Huffman run length encoding. See + Section 10 for a description of ModIFied Huffman Compression. + 32773 = PackBits compression, a simple byte-oriented run length scheme. See the + PackBits section for details. + Data compression applies only to raster image data. All other TIFF fields are + unaffected. + Baseline TIFF readers must handle all three compression schemes. + */ + //??'Compression' + cTag := 'Compression' + nTemp := 0 + IF nFieldType == SHORT + nTemp := Bin2w( cValues ) + ELSE + //alert('Wrong Type for Compression') + ENDIF + //IF nTemp <> 1 .and. nTemp <> 2 .and. nTemp <> 32773 + // alert('Wrong Value for Compression') + //ENDIF + CASE nTag == 262 + /* + PhotometricInterpretation + Tag = 262 (106.H) + Type = SHORT + Values: + 0 = WhiteIsZero. For bilevel and grayscale images: 0 is imaged as white. The maxi-mum + value is imaged as black. This is the normal value for Compression=2. + 1 = BlackIsZero. For bilevel and grayscale images: 0 is imaged as black. The maxi-mum + value is imaged as white. IF this value is specIFied for Compression=2, the + image should display and print reversed. + */ + //??'PhotometricInterpretation' + cTag := 'PhotometricInterpretation' + nTemp := - 1 + IF nFieldType == SHORT + nTemp := Bin2w( cValues ) + ELSE + //alert('Wrong Type for PhotometricInterpretation') + ENDIF + IF nTemp <> 0 .AND. nTemp <> 1 .AND. nTemp <> 2 .AND. nTemp <> 3 + //alert('Wrong Value for PhotometricInterpretation') + ENDIF + CASE nTag == 264 + /* + CellWidth + The width of the dithering or halftoning matrix used to create a dithered or + halftoned bilevel file.Tag = 264 (108.H) + Type = SHORT + N = 1 + No default. See also Threshholding. + */ + //??'CellWidth' + cTag := 'CellWidth' + IF nFieldType <> SHORT + //alert('Wrong Type for CellWidth') + ENDIF + CASE nTag == 265 + /* + CellLength + The length of the dithering or halftoning matrix used to create a dithered or + halftoned bilevel file. + Tag = 265 (109.H) + Type = SHORT + N = 1 + This field should only be present IF Threshholding = 2 + No default. See also Threshholding. + */ + //??'CellLength' + cTag := 'CellLength' + IF nFieldType <> SHORT + //alert('Wrong Type for CellLength') + ENDIF + CASE nTag == 266 + /* + FillOrder + The logical order of bits within a byte. + Tag = 266 (10A.H) + Type = SHORT + N = 1 + */ + //??'FillOrder' + cTag := 'FillOrder' + IF nFieldType <> SHORT + //alert('Wrong Type for FillOrder') + ENDIF + CASE nTag == 273 + /* + StripOffsets + Tag = 273 (111.H) + Type = SHORT or LONG + For each strip, the byte offset of that strip. + */ + //??'StripOffsets' + cTag := 'StripOffsets' + IF nFieldType <> SHORT .AND. nFieldType <> LONG + //alert('Wrong Type for StripOffsets') + ENDIF + + IF nFieldType == SHORT + nFrom := Bin2w( Substr( cValues, 1, 2 ) ) + ELSEIF nFieldType == LONG + nFrom := Bin2l( Substr( cValues, 1, 4 ) ) + ENDIF + + CASE nTag == 277 + /* + SamplesPerPixel + Tag = 277 (115.H) + Type = SHORT + The number of components per pixel. This number is 3 for RGB images, unless + extra samples are present. See the ExtraSamples field for further information. + */ + //??'SamplesPerPixel' + cTag := 'SamplesPerPixel' + IF nFieldType <> SHORT + //alert('Wrong Type for SamplesPerPixel') + ENDIF + CASE nTag == 278 + /* + RowsPerStrip + Tag = 278 (116.H) + Type = SHORT or LONG + The number of rows in each strip (except possibly the last strip.) + For example, IF ImageLength is 24, and RowsPerStrip is 10, then there are 3 + strips, with 10 rows in the first strip, 10 rows in the second strip, and 4 rows in the + third strip. (The data in the last strip is not padded with 6 extra rows of dummy + data.) + */ + //??'RowsPerStrip' + cTag := 'RowsPerStrip' + IF nFieldType <> SHORT .AND. nFieldType <> LONG + //alert('Wrong Type for RowsPerStrip') + ENDIF + CASE nTag == 279 + /* + StripByteCounts + Tag = 279 (117.H) + Type = SHORT or LONG + For each strip, the number of bytes in that strip after any compression. + */ + //??'StripByteCounts' + cTag := 'StripByteCounts' + IF nFieldType <> SHORT .AND. nFieldType <> LONG + //alert('Wrong Type for StripByteCounts') + ENDIF + + IF nFieldType == SHORT + nLength := Bin2w( Substr( cValues, 1, 2 ) ) + ELSEIF nFieldType == LONG + nLength := Bin2l( Substr( cValues, 1, 4 ) ) + ENDIF + + nLength *= nCount // Count all strips !!! + + CASE nTag == 282 + /* + XResolution + Tag = 282 (11A.H) + Type = RATIONAL + The number of pixels per ResolutionUnit in the ImageWidth (typically, horizontal + - see Orientation) direction. + */ + //??'XResolution' + cTag := 'XResolution' + IF nFieldType <> RATIONAL + //alert('Wrong Type for XResolution') + ENDIF + xRes := Bin2l( Substr( cValues, 1, 4 ) ) + CASE nTag == 283 + /* + YResolution + Tag = 283 (11B.H) + Type = RATIONAL + The number of pixels per ResolutionUnit in the ImageLength (typically, vertical) + direction. + */ + //??'YResolution' + cTag := 'YResolution' + IF nFieldType <> RATIONAL + //alert('Wrong Type for YResolution') + ENDIF + yRes := Bin2l( Substr( cValues, 1, 4 ) ) + CASE nTag == 284 + //??'PlanarConfiguration' + cTag := 'PlanarConfiguration' + IF nFieldType <> SHORT + //alert('Wrong Type for PlanarConfiguration') + ENDIF + CASE nTag == 288 + /* + FreeOffsets + For each string of contiguous unused bytes in a TIFF file, the byte offset of the + string. + Tag = 288 (120.H) + Type = LONG + Not recommended for general interchange. + See also FreeByteCounts. + */ + //??'FreeOffsets' + cTag := 'FreeOffsets' + IF nFieldType <> LONG + //alert('Wrong Type FOR FreeOffsets') + ENDIF + CASE nTag == 289 + /* + FreeByteCounts + For each string of contiguous unused bytes in a TIFF file, the number of bytes in + the string. + Tag = 289 (121.H) + Type = LONG + Not recommended for general interchange. + See also FreeOffsets. + */ + //??'FreeByteCounts' + cTag := 'FreeByteCounts' + IF nFieldType <> LONG + //alert('Wrong Type for FreeByteCounts') + ENDIF + CASE nTag == 296 + /* + ResolutionUnit + Tag = 296 (128.H) + Type = SHORT + Values: + 1 = No absolute unit of measurement. Used for images that may have a non-square + aspect ratio but no meaningful absolute dimensions. + 2 = Inch. + 3 = Centimeter. + Default = 2 (inch). + */ + //??'ResolutionUnit' + cTag := 'ResolutionUnit' + nTemp := 0 + IF nFieldType == SHORT + nTemp := Bin2w( cValues ) + ELSE + //alert('Wrong Type for ResolutionUnit') + ENDIF + IF nTemp <> 1 .AND. nTemp <> 2 .AND. nTemp <> 3 + //alert('Wrong Value for ResolutionUnit') + ENDIF + CASE nTag == 305 + //??'Software' + cTag := 'Software' + IF nFieldType <> ASCII + //alert('Wrong Type for Software') + ENDIF + CASE nTag == 306 + /* + DateTime + Date and time of image creation. + Tag = 306 (132.H) + Type = ASCII + N = 2 0 + The format is: YYYY:MM:DD HH:MM:SS, with hours like those on a 24-hour + clock, and one space character between the date and the time. The length of the + string, including the terminating NUL, is 20 bytes. + */ + //??'DateTime' + cTag := 'DateTime' + IF nFieldType <> ASCII + //alert('Wrong Type for DateTime') + ENDIF + CASE nTag == 315 + /* + Artist + Person who created the image. + Tag = 315 (13B.H) + Type = ASCII + Note: some older TIFF files used this tag FOR storing Copyright information. + */ + //??'Artist' + cTag := 'Artist' + IF nFieldType <> ASCII + //alert('Wrong Type for Artist') + ENDIF + CASE nTag == 320 + /* + ColorMap + Tag = 320 (140.H) + Type = SHORT + N = 3 * (2**BitsPerSample) + This field defines a Red-Green-Blue color map (often called a lookup table) for + palette color images. In a palette-color image, a pixel value is used to index into an + RGB-lookup table. FOR example, a palette-color pixel having a value of 0 would + be displayed according to the 0th Red, Green, Blue triplet. + In a TIFF ColorMap, all the Red values come first, followed by the Green values, + then the Blue values. In the ColorMap, black is represented by 0,0,0 and white is + represented by 65535, 65535, 65535. + */ + //??'ColorMap' + cTag := 'ColorMap' + IF nFieldType <> SHORT + //alert('Wrong Type for ColorMap') + ENDIF + CASE nTag == 338 + /* + ExtraSamples + Description of extra components. + Tag = 338 (152.H) + Type = SHORT + N = m + */ + //??'ExtraSamples' + cTag := 'ExtraSamples' + IF nFieldType <> SHORT + //alert('Wrong Type for ExtraSamples') + ENDIF + CASE nTag == 33432 + /* + Copyright + Copyright notice. + Tag = 33432 (8298.H) + Type = ASCII + Copyright notice of the person or organization that claims the copyright to the + image. The complete copyright statement should be listed in this field including + any dates and statements of claims. For example, “Copyright, John Smith, 19xx. + All rights reserved. + */ + //??'Copyright' + cTag := 'Copyright' + IF nFieldType <> ASCII + //alert('Wrong Type for Copyright') + ENDIF + OTHERWISE + //??'Unknown' + cTag := 'Unknown' + ENDCASE + /* + ??Padr( cTag, 30 ) + ??' type ' + Padr(aType[ nFieldType ], 10) + ' count ' + LTrim(Str(nCount)) + ' <' + DO CASE + CASE nFieldType == BYTE + for nI := 1 to nCount + ??' ' + LTrim(Str(asc( SubStr( cValues, nI, 1 )))) + NEXT + CASE nFieldType == ASCII + ??' ' + FOR nI := 1 to nCount + ??SubStr( cValues, nI, 1 ) + NEXT + CASE nFieldType == SHORT + FOR nI := 1 to nCount + ??' ' + LTrim(Str(bin2w(SubStr( cValues, ( nI - 1 ) * 2 + 1, 2 )))) + NEXT + CASE nFieldType == LONG + FOR nI := 1 to nCount + ??' ' + LTrim(Str(bin2l(SubStr( cValues, ( nI - 1 ) * 4 + 1, 4 )))) + NEXT + CASE nFieldType == RATIONAL + FOR nI := 1 to nCount + ??' ' + LTrim(Str(bin2l(SubStr( cValues, ( nI - 1 ) * 8 + 1, 4 )))) + '/' + LTrim(Str(bin2l(SubStr( cValues, nI + 4, 4 )))) + NEXT + CASE nFieldType == SBYTE + FOR nI := 1 to nCount + ??' ' + LTrim(Str(asc( SubStr( cValues, nI, 1 )))) + NEXT + CASE nFieldType == UNDEFINED + FOR nI := 1 to nCount + ??' ' + SubStr( cValues, nI, 1 ) + NEXT + CASE nFieldType == SSHORT + FOR nI := 1 to nCount + ??' ' + LTrim(Str(Bin2I(SubStr( cValues, ( nI - 1 ) * 2 + 1, 2 )))) + NEXT + CASE nFieldType == SLONG + FOR nI := 1 to nCount + ??' ' + LTrim(Str(bin2l(SubStr( cValues, ( nI - 1 ) * 4 + 1, 4 )))) + NEXT + CASE nFieldType == SRATIONAL + FOR nI := 1 to nCount + ??' ' + LTrim(Str(bin2l(SubStr( cValues, ( nI - 1 ) * 8 + 1, 4 )))) + '/' + LTrim(Str(bin2l(SubStr( cValues, nI + 4, 4 )))) + NEXT + CASE nFieldType == FLOAT + CASE nFieldType == DOUBLE + FOR nI := 1 to nCount + ??' ' + LTrim(Str(ctof(SubStr( cValues, ( nI - 1 ) * 8 + 1, 8 )))) + NEXT + + ENDCASE + ??' >' + */ + NEXT + Fread( nHandle, @cIFDNext, 4 ) + ENDDO + + Fclose( nHandle ) + + Aadd( aTemp, nWidth ) + Aadd( aTemp, nHeight ) + Aadd( aTemp, xRes ) + Aadd( aTemp, yRes ) + Aadd( aTemp, nBits ) + Aadd( aTemp, nFrom ) + Aadd( aTemp, nLength ) + Aadd( aTemp, 0 ) + +RETURN aTemp + +METHOD Pdfjpeginfo( cFile ) CLASS TPdf + +LOCAL c255 +LOCAL nAt +LOCAL nHandle +LOCAL nWidth := 0 +LOCAL nHeight := 0 +LOCAL nBits := 8 +LOCAL nFrom := 0 +LOCAL nLength := 0 +LOCAL xRes := 0 +LOCAL yRes := 0 +LOCAL aTemp := {} + + nHandle := Fopen( cFile ) + + c255 := Space( 1024 ) + Fread( nHandle, @c255, 1024 ) + + xRes := Asc( Substr( c255, 15, 1 ) ) * 256 + Asc( Substr( c255, 16, 1 ) ) + yRes := Asc( Substr( c255, 17, 1 ) ) * 256 + Asc( Substr( c255, 18, 1 ) ) + + nAt := At( Chr( 255 ) + Chr( 192 ), c255 ) + 5 + nHeight := Asc( Substr( c255, nAt, 1 ) ) * 256 + Asc( Substr( c255, nAt + 1, 1 ) ) + nWidth := Asc( Substr( c255, nAt + 2, 1 ) ) * 256 + Asc( Substr( c255, nAt + 3, 1 ) ) + + Fclose( nHandle ) + + nLength := filesize( cFile ) + + Aadd( aTemp, nWidth ) + Aadd( aTemp, nHeight ) + Aadd( aTemp, xRes ) + Aadd( aTemp, yRes ) + Aadd( aTemp, nBits ) + Aadd( aTemp, nFrom ) + Aadd( aTemp, nLength ) + aadd( aTemp,2) + +RETURN aTemp + +METHOD Pdfimage( cFile, nRow, nCol, nHeight, nWidth, cId, Scalex, Scaley ) + + DEFAULT nRow TO ::aReport[ REPORTLINE ] + DEFAULT nCol TO 0 + DEFAULT nHeight TO 0 + DEFAULT nWidth TO 0 + + DEFAULT cId TO "" + DEFAULT scalex TO 0, sCaley TO 0 + + Aadd( ::aReport[ PAGEIMAGES ], { cFile, nRow, nCol, nHeight, nWidth, scalex, scaley } ) + +RETURN nil + +METHOD Pdfatsay( cString, nRow, nCol, lExact, cId ) CLASS TPdf + +LOCAL _nFont +LOCAL lReverse +LOCAL nAt + + DEFAULT nRow TO ::aReport[ REPORTLINE ] + DEFAULT lExact TO .f. + DEFAULT cId TO "" + + IF ( nAt := At( "#pagenumber#", cString ) ) > 0 + cString := Left( cString, nAt - 1 ) + Ltrim( Str( ::pdfPageNum() ) ) + Substr( cString, nAt + 12 ) + ENDIF + + lReverse := .f. + IF !Empty( cString ) + + IF ::aReport[ UNDERLINE ] + ::Pdfunder( cString, Len( cString ), nCol, nRow ) + ENDIF + + IF ::aReport[ OVERLINE ] + ::PdfOver( cString, Len( cString ), nCol, nRow ) + ENDIF + + cString :=::pdfStringB( cString ) + + _nFont := Ascan( ::aReport[ FONTS ], { | arr | arr[ 1 ] == ::aReport[ FONTNAME ] } ) + + IF ::aReport[ FONTNAME ] <> ::aReport[ FONTNAMEPREV ] + ::aReport[ FONTNAMEPREV ] := ::aReport[ FONTNAME ] + ::aReport[ PAGEBUFFER ] += CRLF + "BT /Fo" + Ltrim( Str( _nFont ) ) + " " + Ltrim( Transform( ::aReport[ FONTSIZE ], "999.99" ) ) + " Tf " + Ltrim( Transform( nCol, "9999.99" ) ) + " " + Ltrim( Transform( nRow, "9999.99" ) ) + " Td (" + cString + ") Tj ET" + ELSEIF ::aReport[ FONTSIZE ] <> ::aReport[ FONTSIZEPREV ] + ::aReport[ FONTSIZEPREV ] := ::aReport[ FONTSIZE ] + ::aReport[ PAGEBUFFER ] += CRLF + "BT /Fo" + Ltrim( Str( _nFont ) ) + " " + Ltrim( Transform( ::aReport[ FONTSIZE ], "999.99" ) ) + " Tf " + Ltrim( Transform( nCol, "9999.99" ) ) + " " + Ltrim( Transform( nRow, "9999.99" ) ) + " Td (" + cString + ") Tj ET" + ELSE + + ::aReport[ PAGEBUFFER ] += CRLF + "BT " + Ltrim( Transform( nCol, "9999.99" ) ) + " " + Ltrim( Transform( nRow, "9999.99" ) ) + " Td (" + cString + ") Tj ET" + ENDIF + IF lReverse + ::aReport[ PAGEBUFFER ] += " 0 g " + ENDIF + ENDIF +RETURN nil + +METHOD Pdfstringb( cString ) CLASS TPdf + + cString := Strtran( cString, "(", "\(" ) + cString := Strtran( cString, ")", "\)" ) + +RETURN cString + +METHOD Pdfgetfontinfo( cParam ) CLASS TPdf + +LOCAL cRet + IF cParam == "NAME" + IF Left( ::aReport[ TYPE1, ::aReport[ FONTNAME ] ], 5 ) == "Times" + cRet := "Times" + ELSEIF Left( ::aReport[ TYPE1, ::aReport[ FONTNAME ] ], 9 ) == "Helvetica" + cRet := "Helvetica" + ELSE + cRet := "Courier" // 0.04 + ENDIF + ELSE // size + cRet := Int( ( ::aReport[ FONTNAME ] - 1 ) % 4 ) + ENDIF +RETURN cRet + +METHOD Pdfpagenum( n ) CLASS TPdf + + DEFAULT n TO 0 + IF n > 0 + ::aReport[ REPORTPAGE ] := n // NEW !!! + ENDIF +RETURN ::aReport[ REPORTPAGE ] + +METHOD Pdfclose() CLASS TPdf + +LOCAL nI +LOCAL cTemp +LOCAL nObj1 +LOCAL nBooklen + +FIELD FIRST, PREV, NEXT, LAST, COUNT, PARENT, PAGE, COORD, TITLE, LEVEL + + ::pdfClosePage() + + // kids + ::aReport[ REFS, 2 ] := ::aReport[ DOCLEN ] + cTemp := ; + "1 0 obj" + CRLF + ; + "<<" + CRLF + ; + "/Type /Pages /Count " + Ltrim( Str( ::aReport[ REPORTPAGE ] ) ) + CRLF + ; + "/Kids [" + + FOR nI := 1 TO ::aReport[ REPORTPAGE ] + cTemp += " " + Ltrim( Str( ::aReport[ PAGES, nI ] ) ) + " 0 R" + NEXT + + cTemp += " ]" + CRLF + ; + ">>" + CRLF + ; + "endobj" + CRLF + + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + // info + ++ ::aReport[ REPORTOBJ ] + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + cTemp := Ltrim( Str( ::aReport[ REPORTOBJ ] ) ) + " 0 obj" + CRLF + ; + "<< /Title ()" + CRLF + ; + "/Producer ()" + CRLF + ; + Iif( !Empty( ::aReport[ AUTHOR ] ), "/Author (" + ::aReport[ AUTHOR ] + ')', "/Author ()" ) + CRLF + ; + "/Creator ()" + CRLF + ; + Iif( !Empty( ::aReport[ SUBJECT ] ), "/Subject (" + ::aReport[ SUBJECT ] + ')', "/Subject ()" ) + CRLF + ; + Iif( !Empty( ::aReport[ KEYWORD ] ), "/Keywords (" + ::aReport[ KEYWORD ] + ')', "/Keywords ()" ) + CRLF + ; + "/CreationDate (D:" + Str( Year( Date() ), 4 ) + Padl( Month( Date() ), 2, "0" ) + Padl( Day( Date() ), 2, "0" ) + Substr( Time(), 1, 2 ) + Substr( Time(), 4, 2 ) + Substr( Time(), 7, 2 ) + ")" + CRLF + ; + ">>" + CRLF + ; + "endobj" + CRLF + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + // root + ++ ::aReport[ REPORTOBJ ] + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + cTemp := Ltrim( Str( ::aReport[ REPORTOBJ ] ) ) + " 0 obj" + CRLF + ; + "<< /Type /Catalog /Pages 1 0 R /Outlines " + Ltrim( Str( ::aReport[ REPORTOBJ ] + 1 ) ) + " 0 R" + Iif( ( nBookLen := Len( ::aReport[ BOOKMARK ] ) ) > 0, " /PageMode /UseOutlines", "" ) + " >>" + CRLF + "endobj" + CRLF + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + + ++ ::aReport[ REPORTOBJ ] + nObj1 := ::aReport[ REPORTOBJ ] + + IF nBookLen == 0 + cTemp := Ltrim( Str( ::aReport[ REPORTOBJ ] ) ) + " 0 obj" + CRLF + "<< /Type /Outlines /Count 0 >>" + CRLF + "endobj" + CRLF + Aadd( ::aReport[ REFS ], ::aReport[ DOCLEN ] ) + ::aReport[ DOCLEN ] += Len( cTemp ) + Fwrite( ::aReport[ HANDLE ], cTemp ) + ENDIF + + cTemp := CRLF + ::aReport[ DOCLEN ] += Len( cTemp ) + + ++ ::aReport[ REPORTOBJ ] + cTemp += "xref" + CRLF + ; + "0 " + Ltrim( Str( ::aReport[ REPORTOBJ ] ) ) + CRLF + ; + Padl( ::aReport[ REFS, 1 ], 10, "0" ) + " 65535 f" + CRLF + + FOR nI := 2 TO Len( ::aReport[ REFS ] ) + cTemp += Padl( ::aReport[ REFS, nI ], 10, "0" ) + " 00000 n" + CRLF + NEXT + + cTemp += "trailer << /Size " + Ltrim( Str( ::aReport[ REPORTOBJ ] ) ) + " /Root " + Ltrim( Str( nObj1 - 1 ) ) + " 0 R /Info " + Ltrim( Str( nObj1 - 2 ) ) + " 0 R >>" + CRLF + ; + "startxref" + CRLF + ; + Ltrim( Str( ::aReport[ DOCLEN ] ) ) + CRLF + ; + "%%EOF" + CRLF + Fwrite( ::aReport[ HANDLE ], cTemp ) + /* + IF ::aReport[ OPTIMIZE ] + pdfOptimize( ) coming ! + ENDIF +*/ + Fclose( ::aReport[ HANDLE ] ) + + ::aReport := nil + +RETURN nil +/* + +/* new methods added by Luiz Rafael Culik */ + +METHOD Getpagetype( nWidth, nHeight ) CLASS TPdf + +LOCAL nPos +LOCAL aSize := { { "LETTER", letter_width, letter_height }, { "LEGAL", legal_width, legal_height }, { "LEDGER", ledger_width, ledger_height }, { "A4", a4_width, a4_height }, { "A3", a3_width, a3_height } } + + nPos := Ascan( aSize, { | x | x[ 2 ] == nWidth .AND. x[ 3 ] == nHeight } ) + + IF nPos == 0 + nPos := Ascan( aSize, { | x | x[ 3 ] == nWidth .AND. x[ 2 ] == nHeight } ) + ENDIF + +RETURN aSize[ nPos, 1 ] + +METHOD Pdf_Rect( x, y, width, height ) CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Str( x ) ) + " " + ; + Ltrim( Str( y ) ) + " " + ; + Ltrim( Str( width ) ) + " " + ; + Ltrim( Str( height ) ) + " " + ; + " re" + ; + CRLF +RETURN nil + +METHOD Pdf_Stroke() CLASS TPdf + + ::aReport[ PAGEBUFFER ] += "S" + CRLF + +RETURN nil + +METHOD Setoverline( l ) CLASS TPdf + +LOCAL Res := ::aReport[ OVERLINE ] + ::aReport[ OVERLINE ] := l + +RETURN Res + +METHOD Setunderline( l ) CLASS TPdf + +LOCAL Res := ::aReport[ UNDERLINE ] + ::aReport[ UNDERLINE ] = l + +RETURN Res + +METHOD Pdfmoveto( X, Y ) CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Str( x ) ) + " " + ; + Ltrim( Str( y ) ) + " " + ; + "m" + CRLF +RETURN nil + +METHOD Pdflineto( X, Y ) CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Str( x ) ) + " " + ; + Ltrim( Str( y ) ) + " " + ; + "l" + CRLF +RETURN NIL + +METHOD Pdfsetlinewidth( w ) CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Str( w ) ) + " " + ; + "w" + CRLF +RETURN nil + +METHOD Pdfsetlinecap( w ) CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Str( w ) ) + " " + ; + "J" + CRLF +RETURN nil + +METHOD Pdfsetdash( b, w ) CLASS TPdf + + IF b == 0 .AND. w == 0 + ::aReport[ PAGEBUFFER ] += CRLF + ; + "[] " + ; + "0 d" + ELSE + ::aReport[ PAGEBUFFER ] += CRLF + ; + "[" + Ltrim( Str( b ) ) + " " + ; + Ltrim( Str( w ) ) + "]" + ; + "0 d" + ENDIF + +RETURN nil + +METHOD Pdfsave( lBuf ) CLASS TPdf + +LOCAL cBuf := CRLF + "q" + DEFAULT lBuf TO .t. + + IF !lBuf + RETURN cBuf + ELSE + ::aReport[ PAGEBUFFER ] += cBuf + ENDIF + +RETURN nil + +METHOD Pdfrestore( lBuf ) CLASS TPdf + +LOCAL cBuf := CRLF + "Q " + DEFAULT lBuf TO .t. + + IF !lBuf + RETURN cBuf + ELSE + ::aReport[ PAGEBUFFER ] += cBuf + ENDIF + +RETURN nil + +METHOD Pdfunder( Text, Len, X, Y ) CLASS TPdf + +LOCAL xScale := 1 +LOCAL yScale := 1 +LOCAL length +LOCAL nWidth := 0.00 +LOCAL nLineWidth +LOCAL Delta_y + + IF Right( Text, 1 ) == Chr( 255 ) .OR. Right( Text, 1 ) == Chr( 254 ) // reverse or underline + -- len + ENDIF + + nLineWidth := ::aReport[ FONTSIZE ] * 50 / 1000 * ; + ( 1 / 100 ) * Iif( xScale > yScale, xScale, yScale ) + + /* the font size may be negative, resulting in bad line width */ + nLineWidth := Abs( nLineWidth ) + length :=::Pdf_Str_Width( text, len, 0, ::aReport[ FONTSIZE ] ) + + IF ( length == 0 ) + RETURN nil + ENDIF + + Delta_y := ( ::aReport[ FONTSIZE ] * - 100 / 1000 + 0 ) * ; + Abs( 1 ) / 100 * Iif( xScale > yScale, xScale, yScale ) + + ::Pdfsave() + ::PDFSetLineWidth( 1 ) + ::PdfSetLineCap( 0 ) + ::PdfSetDash( 0, 0 ) + ::PDFMoveTo( x, y ) + ::PdfLineTo( x + length, y ) + ::Pdf_Stroke() + ::PdfRestore() + +RETURN nil + +METHOD Pdfover( Text, Len, x, y ) CLASS TPdf + +LOCAL xScale := 1 +LOCAL yScale := 1 +LOCAL length +LOCAL Delta_y +LOCAL nWidth := 0.00 +LOCAL nLineWidth + + IF Right( Text, 1 ) == Chr( 255 ) .OR. Right( Text, 1 ) == Chr( 254 ) // reverse or underline + -- Len + ENDIF + nLineWidth := ::aReport[ FONTSIZE ] * 50 / 1000 * ; + ( 1 / 100 ) * Iif( xScale > yScale, xScale, yScale ) + + /* the font size may be negative, resulting in bad line width */ + nLineWidth := Abs( nLineWidth ) + + length :=::pdf_str_width( text, len, 0, ::aReport[ FONTSIZE ] ) + + IF ( length == 0 ) + RETURN nil + ENDIF + + Delta_y := ( ::aReport[ FONTSIZE ] * - 100 / 1000 + 0 ) * ; + Abs( 1 ) / 100 * Iif( xScale > yScale, xScale, yScale ) + ::PdfSave() + ::PDFSetLineWidth( 1 ) + ::PdfSetLineCap( 0 ) + ::PdfSetDash( 0, 0 ) + ::PDFMoveTo( x, y + delta_y ) + ::PdfLineTo( x + length, y + delta_y ) + ::Pdf_Stroke() + ::PdfRestore() + +RETURN nil + +METHOD Pdf_Str_Width( Text, Len, Font, Size ) CLASS TPdf + +LOCAL cp +LOCAL i +LOCAL width := 0.0 +LOCAL nWidth := 0.00 +LOCAL nArr +LOCAL nAdd := ( ::aReport[ FONTNAME ] - 1 ) % 4 + + HB_SYMBOL_UNUSED( Font ) + + IF ::pdfGetFontInfo( "NAME" ) = "Times" + nArr := 1 + ELSEIF ::pdfGetFontInfo( "NAME" ) = "Helvetica" + nArr := 2 + ELSE + nArr := 3 // 0.04 + ENDIF + + IF ( Len == 0 ) + Len := Len( text ) + ENDIF + + /* We cannot handle CID fonts */ + + FOR EACH cp IN TEXT + i := hb_enumindex() + /* take word spacing parameter into account at each blank */ + IF ( cp == " " ) + width += 1 + ENDIF + /* individual character width plus character spacing parameter */ + width += size * ::aReport[ FONTWIDTH, nArr, ( Asc( Substr( Text, i, 1 ) ) - 32 ) * 4 + 1 + nAdd ] / 1000 + + NEXT + + /* take current text matrix and horizontal scaling factor into account */ + width *= 1 + +RETURN width + +METHOD Pdfsetrgbcolor( R, G, B ) CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Transform( R / 255, "9.9999" ) ) + " " + ; + Ltrim( Transform( G / 255, "9.9999" ) ) + " " + ; + Ltrim( Transform( B / 255, "9.9999" ) ) + " rg " + CRLF + ; + Ltrim( Transform( R / 255, "9.9999" ) ) + " " + ; + Ltrim( Transform( G / 255, "9.9999" ) ) + " " + ; + Ltrim( Transform( B / 255, "9.9999" ) ) + " RG " + +RETURN NIL + +METHOD Pdfscale( X, Y, lBuf ) CLASS TPdf + + DEFAULT lBuf TO .t. + IF !lBuf + RETURN CRLF + ; + Ltrim( Str( x ) ) + " 0 0 " + ; + Ltrim( Str( y ) ) + " 0 0 cm" + ELSE + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Str( x ) ) + " 0 0 " + ; + Ltrim( Str( y ) ) + " 0 0 cm" + ENDIF + +RETURN NIL + +METHOD Pdftranslate( tX, tY ) CLASS TPdf + + IF ( tX == 0 .AND. tY == 0 ) + RETURN NIL + ENDIF + + ::aReport[ PAGEBUFFER ] += CRLF + ; + " 1 0 0 1 " + Ltrim( Str( Tx ) ) + ; + Ltrim( Str( tY ) ) + " cm" +RETURN NIL + +METHOD Pdfpnginfo( cFile ) CLASS TPdf + +LOCAL c255 +LOCAL nHandle +LOCAL nWidth := 0 +LOCAL nHeight := 0 +LOCAL nBits := 8 +LOCAL nFrom := 135 +LOCAL nPLTEPos +LOCAL nDistTonPhys := 0 +LOCAL nPhys +LOCAL nLength := filesize( cFile ) +LOCAL xRes := 0 +LOCAL cPalletData := "" +LOCAL yRes := 0 +LOCAL aTemp := {} +LOCAL nIendPos := nLength - 16 +LOCAL nb +LOCAL cData := "" +LOCAL nColor + + nHandle := Fopen( cFile ) + + c255 := Space( 1024 ) + Fread( nHandle, @c255, 1024 ) + + // xRes := asc(SubStr( c255, 15, 1 )) * 256 + asc(SubStr( c255, 16, 1 )) + // yRes := asc( SubStr( c255, 17, 1 )) * 256 + asc(SubStr( c255, 18, 1 )) + + // nAt := At( Chr(255) + Chr(192), c255 ) + 5 + // nHeight := asc(SubStr( c255, nAt, 1 )) * 256 + asc(SubStr( c255, nAt + 1, 1 )) + // nWidth := asc( SubStr( c255, nAt + 2, 1 )) * 256 + asc(SubStr( c255, nAt + 3, 1 )) + nPLTEPos := At( "PLTE", c255 ) + + IF nPLTEPos > 0 + nPhys := At( 'pHYs', c255 ) + nFrom := At( "IDAT", c255 ) + 3 + + nPLTEPos += 4 + nDistTonPhys := 768 + cPalletData := Substr( c255, nPLTEPos, nDistTonPhys ) + + ENDIF + + xRes := ( Asc( Substr( c255, 17, 1 ) ) ) + ( Asc( Substr( c255, 18, 1 ) ) ) + ( Asc( Substr( c255, 19, 1 ) ) ) + ( Asc( Substr( c255, 20, 1 ) ) ) + yRes := ( Asc( Substr( c255, 21, 1 ) ) ) + ( Asc( Substr( c255, 22, 1 ) ) ) + ( Asc( Substr( c255, 23, 1 ) ) ) + ( Asc( Substr( c255, 24, 1 ) ) ) + nBits := ( Asc( Substr( c255, 25, 1 ) ) ) + nColor := ( Asc( Substr( c255, 26, 1 ) ) ) + cData := Substr( c255, At( "IDAT", c255 ) + 4 ) + nb := At( "IDAT", c255 ) + + Fclose( nHandle ) + + nLength := filesize( cFile ) + + Aadd( aTemp, xRes ) + Aadd( aTemp, yRes ) + Aadd( aTemp, xRes ) + Aadd( aTemp, yRes ) + Aadd( aTemp, nBits ) + Aadd( aTemp, nFrom ) + Aadd( aTemp, nLength - nFrom - 16 ) + Aadd( aTemp, nColor ) + Aadd( aTemp, cPalletData ) + Aadd( aTemp, nDistTonPhys ) + + RETURN aTemp + +#define PDF_M_PI 3.14159265358979323846 /* pi */ +METHOD Pdfrotate( pHi ) CLASS TPdf + +LOCAL c +LOCAL s + + IF pHi == 0 + RETURN NIL + ENDIF + phi := ( phi * PDF_M_PI / 180 ) /* convert to radians */ + c := cos( phi ) + s := sin( phi ) + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Str( c ) ) + " " + ; + Ltrim( Str( s ) ) + " " + ; + Ltrim( Str( - s ) ) + " " + ; + Ltrim( Str( c ) ) + " 0 0 cm" + +RETURN NIL + +METHOD Pdfclosepath() CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + "h" +RETURN NIL + +METHOD Pdfendpath() CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + "n" +RETURN NIL + +METHOD Pdfcurveto( x1, y1, x2, y2, x3, y3 ) CLASS TPdf + + IF ( x2 == x3 .AND. y2 == y3 ) /* second c.p. coincides with final point */ + ::aReport[ PAGEBUFFER ] += CRLF + Ltrim( Str( x1 ) ) + " " + ; + Ltrim( Str( y1 ) ) + " " + ; + Ltrim( Str( x3 ) ) + " " + ; + Ltrim( Str( y3 ) ) + " y" + + ELSE /* general case with four distinct points */ + ::aReport[ PAGEBUFFER ] += CRLF + Ltrim( Str( x1 ) ) + " " + ; + Ltrim( Str( y1 ) ) + " " + ; + Ltrim( Str( x2 ) ) + " " + ; + Ltrim( Str( y2 ) ) + " " + ; + Ltrim( Str( x3 ) ) + " " + ; + Ltrim( Str( y3 ) ) + " c" + + ENDIF +RETURN NIL + +METHOD Pdfcomplevel( x ) CLASS TPdf + + ::aReport[ PDFCOMPLVL ] := x +RETURN NIL +METHOD Pdfinfo( cTitle, cAuthor, cKey, cCreator ) CLASS TPdf + + DEFAULT cAuthor TO "" + DEFAULT cTitle TO "" + DEFAULT cKey TO "", cCreator TO "" + ::aReport[ CREATOR ] := cCreator + ::aReport[ KEYWORD ] := cKey + ::aReport[ AUTHOR ] := cAuthor + ::aReport[ SUBJECT ] := cTitle +RETURN NIL + +STATIC FUNCTION FilePos( nHandle ) + +RETURN ( Fseek( nHandle, 0, FS_RELATIVE ) ) +STATIC FUNCTION pdfM2X( n ) /* + +//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ */ +RETURN n +METHOD PDF_setrgbcolor_fill( R, G, B ) CLASS TPdf + + ::aReport[ PAGEBUFFER ] += CRLF + ; + Ltrim( Transform( R / 255, "9.9999" ) ) + " " + ; + Ltrim( Transform( G / 255, "9.9999" ) ) + " " + ; + Ltrim( Transform( B / 255, "9.9999" ) ) + " rg " + +RETURN nil diff --git a/harbour/contrib/pdflib/pdfhbdoc.c b/harbour/contrib/pdflib/pdfhbdoc.c index 7b98cfbcee..7336b0a0fe 100644 --- a/harbour/contrib/pdflib/pdfhbdoc.c +++ b/harbour/contrib/pdflib/pdfhbdoc.c @@ -6,7 +6,7 @@ * Harbour Project source code: * PDF low level Api for HBDOC * - * Copyright 2000 Luiz Rafael Culik + * Copyright 2000-2004 Luiz Rafael Culik * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -65,436 +65,540 @@ PDF *szPDFFile; #define LEAD ((int) (FONTSIZESMALL * 1.0)) #define LEADLINK ((int) (FONTSIZESMALL * 1.3)) #define LEADTABLE ((int) (FONTSIZESMALL * 1.2)) -static float iRow=800; + +static float fRow = 800; static float fOldPos; static float iWidth; -static float iCol; -static int sziFontBold=0; -static int sziFont=0; -static int iPage=1; +static float fCol; +static int sziFontBold = 0; +static int sziFont = 0; +static int iPage = 1; static ULONG uiLen; static ULONG uiCount; static BOOL bTItems; static BOOL bFItems; -PHB_ITEM pArray=NULL; -static float hb_checkStringWidth(const char *szString); -static float hb_pdfGetHeight(const char *szText); -static void hb_ProcessTableItem(PHB_ITEM p1,PHB_ITEM p2,PHB_ITEM p3,PHB_ITEM p4); -float getText(PDF *p,const char *szText,int iFont,float irow,float icol,float iw); -void setText(PDF *p,const char *szText,float irow,float icol,float h,float iw); +#if 0 +static float fRow = 0 +#endif +static float fCurCol = 0, fCurLastCol, fLastRow; +static float fStartCol, fStartCol2; +static PHB_ITEM pArray = NULL; +static BOOL bInitArray = 0; +static float hb_checkStringWidth( const char * szString ); +static float hb_pdfGetHeight( const char *szText ); +static void hb_ProcessTableItem( PHB_ITEM p1, PHB_ITEM p2, PHB_ITEM p3, PHB_ITEM p4 ); +float getText( PDF *p, const char *szText, int iFont, float frow, float fcol, float iw); +void setText( PDF *p, const char *szText, float frow, float fcol, float h, float iw); HB_FUNC(HB_PDFNEW) { -const char *szFileResult; -szFileResult= (char *) hb_parc(1); -if (szPDFFile ==NULL) { - szPDFFile=PDF_new(); - PDF_set_value(szPDFFile,"compress", (float) 9); -} + const char *szFileResult; + szFileResult= ( char * ) hb_parc( 1 ); -if (PDF_open_file(szPDFFile, szFileResult) == -1) { - hb_retl(1); - } - PDF_set_info(szPDFFile, "Keywords", "Harbour compiler"); - PDF_set_info(szPDFFile, "Subject", "Harbour"); - PDF_set_info(szPDFFile, "Title", "Harbour doc guide"); - PDF_set_info(szPDFFile, "Creator", "HBDOC Harbour Document Extractor"); - PDF_set_info(szPDFFile, "Author", "Luiz Rafael Culik"); - sziFont = PDF_findfont(szPDFFile, FONTNORMAL, "host", 0); - sziFontBold = PDF_findfont(szPDFFile, FONTBOLD, "host", 0); - hb_retl(0); + if ( szPDFFile == NULL) + { + szPDFFile = PDF_new(); + PDF_set_value( szPDFFile, "compress", ( float ) 9); + } + + if ( PDF_open_file( szPDFFile, szFileResult ) == -1 ) + { + hb_retl( 1 ); + } + + PDF_set_info( szPDFFile, "Keywords", "XHarbour compiler" ); + PDF_set_info( szPDFFile, "Subject" , "XHarbour" ) ; + PDF_set_info( szPDFFile, "Title" , "XHarbour doc guide" ); + PDF_set_info( szPDFFile, "Creator" , "HBDOC XHarbour Document Extractor" ); + PDF_set_info( szPDFFile, "Author" , "Luiz Rafael Culik" ); + sziFont = PDF_findfont( szPDFFile, FONTNORMAL, "host", 0); + sziFontBold = PDF_findfont( szPDFFile, FONTBOLD, "host", 0); + hb_retl( 0 ); } HB_FUNC(HB_PDFNEWPAGE) { - const char *szTitleT; - szTitleT= (char *) hb_parc(1); - - - PDF_begin_page(szPDFFile, a4_width, a4_height); /* start a new page */ - PDF_setfont(szPDFFile, sziFontBold, FONTSIZEBOLD); - PDF_show_xy(szPDFFile, szTitleT,50,iRow-=LEAD); -// PDF_show_xy(szPDFFile, szKeyWordT, 50, iRow-=LEAD); + const char *szTitleT; + fCurCol = 0; + szTitleT= ( char * ) hb_parc( 1 ); + PDF_begin_page( szPDFFile, a4_width, a4_height ); /* start a new page */ + PDF_setfont( szPDFFile, sziFontBold, FONTSIZEBOLD ); + PDF_show_xy( szPDFFile, szTitleT, 50, fRow -= LEAD ); } HB_FUNC(HB_PDFENDPAGE) { - iRow=800; - PDF_end_page(szPDFFile); /* close page */ - iPage++; + fRow = 800; + PDF_end_page( szPDFFile ); /* close page */ + iPage ++ ; } HB_FUNC(HB_PDFWRITEBOLDTEXT) { - const char *szTextT; + const char *szTextT; + szTextT = ( char * ) hb_parc( 1 ); + if ( fRow<=40) + { + fRow=800; + PDF_end_page( szPDFFile ); + sziFont = PDF_findfont( szPDFFile, FONTNORMAL, "host", 0 ); + sziFontBold = PDF_findfont( szPDFFile, FONTBOLD, "host", 0 ); + PDF_begin_page( szPDFFile, a4_width, a4_height ); /* start a new page */ + iPage ++ ; + } - szTextT=(char *) hb_parc(1); + PDF_setfont( szPDFFile, sziFontBold, FONTSIZESMALL ); - if (iRow<=40) { - iRow=800; - PDF_end_page(szPDFFile); - sziFont = PDF_findfont(szPDFFile, FONTNORMAL, "host", 0); - sziFontBold = PDF_findfont(szPDFFile, FONTBOLD, "host", 0); - PDF_begin_page(szPDFFile, a4_width, a4_height); /* start a new page */ - iPage++; + PDF_show_xy( szPDFFile, szTextT, 25, fRow -= LEAD ); + PDF_setfont( szPDFFile, sziFont, FONTSIZESMALL ); } - PDF_setfont(szPDFFile, sziFontBold, FONTSIZESMALL); - PDF_show_xy(szPDFFile, szTextT,25, iRow-=LEAD); - PDF_setfont(szPDFFile, sziFont, FONTSIZESMALL); - } HB_FUNC(HB_PDFWRITEBOLDTEXT1) { - const char *szTextT; - szTextT=(char *) hb_parc(1); - if (iRow<=40) { + const char *szTextT; + szTextT = ( char * ) hb_parc( 1 ); - iRow=800; - PDF_end_page(szPDFFile); - PDF_begin_page(szPDFFile, a4_width, a4_height); /* start a new page */ - sziFont = PDF_findfont(szPDFFile, FONTNORMAL, "host", 0); - sziFontBold = PDF_findfont(szPDFFile, FONTBOLD, "host", 0); - iPage++; + if ( fRow <= 40 ) + { + fRow = 800; + PDF_end_page( szPDFFile ); + PDF_begin_page( szPDFFile, a4_width, a4_height ); /* start a new page */ + sziFont = PDF_findfont( szPDFFile, FONTNORMAL, "host", 0); + sziFontBold = PDF_findfont( szPDFFile, FONTBOLD, "host", 0); + iPage ++; + } + + PDF_setfont( szPDFFile, sziFontBold, FONTSIZEBOLD ); + PDF_show_xy( szPDFFile, szTextT, 25, fRow -= LEAD ); + PDF_setfont( szPDFFile, sziFont, FONTSIZESMALL ); } - PDF_setfont(szPDFFile, sziFontBold, FONTSIZEBOLD); - PDF_show_xy(szPDFFile, szTextT,25, iRow-=LEAD); - PDF_setfont(szPDFFile, sziFont, FONTSIZESMALL); - } HB_FUNC(HB_PDFWRITETEXT) { - const char *szTextT; - szTextT=(char *) hb_parc(1); - if (iRow<=40) { - iRow=800; - PDF_end_page(szPDFFile); - sziFont = PDF_findfont(szPDFFile, FONTNORMAL, "host", 0); - sziFontBold = PDF_findfont(szPDFFile, FONTBOLD, "host", 0); - PDF_begin_page(szPDFFile, a4_width, a4_height); /* start a new page */ - iPage++; -} + const char *szTextT; + szTextT = ( char * ) hb_parc( 1 ); - PDF_setfont(szPDFFile, sziFont, FONTSIZESMALL); - PDF_show_xy(szPDFFile,szTextT,25,iRow-=LEAD); + if ( fRow <= 40 ) + { + fRow=800; + PDF_end_page( szPDFFile ); + sziFont = PDF_findfont( szPDFFile, FONTNORMAL, "host", 0); + sziFontBold = PDF_findfont( szPDFFile, FONTBOLD, "host", 0); + PDF_begin_page( szPDFFile, a4_width, a4_height); /* start a new page */ + iPage ++; + } + + PDF_setfont( szPDFFile, sziFont, FONTSIZESMALL ); + PDF_show_xy( szPDFFile, szTextT, 25, fRow -= LEAD); } HB_FUNC(HB_PDFCLOSE) { - hb_itemRelease(pArray); - PDF_close(szPDFFile); /* close PDF document */ - PDF_delete(szPDFFile); /* delete the PDF object */ - szPDFFile=NULL; - sziFontBold=NULL; - sziFont=NULL; - + hb_itemClear( pArray ); + PDF_close( szPDFFile ); /* close PDF document */ + PDF_delete( szPDFFile ); /* delete the PDF object */ + szPDFFile=NULL; + sziFontBold=0; + sziFont=0; } + HB_FUNC(HB_PDFWRITEARG) { - const char *szTextT; - const char *szBTextT; + const char *szTextT; + const char *szBTextT; - szTextT=(char *) hb_parc(2); - szBTextT=(char *) hb_parc(1); + szTextT = ( char * ) hb_parc( 2 ); + szBTextT = ( char * ) hb_parc( 1 ); - if (iRow<=40) { - iRow=800; - PDF_end_page(szPDFFile); - sziFont = PDF_findfont(szPDFFile, FONTNORMAL, "host", 0); - sziFontBold = PDF_findfont(szPDFFile, FONTBOLD, "host", 0); - PDF_begin_page(szPDFFile, a4_width, a4_height); /* start a new page */ - iPage++; -} - PDF_setfont(szPDFFile, sziFontBold, FONTSIZESMALL); - PDF_show_xy(szPDFFile,szBTextT,25,iRow-=LEAD); - PDF_setfont(szPDFFile, sziFont, FONTSIZESMALL); - PDF_show(szPDFFile,szTextT); + if ( fRow <= 40 ) + { + fRow = 800; + PDF_end_page( szPDFFile ); + sziFont = PDF_findfont( szPDFFile, FONTNORMAL, "host", 0); + sziFontBold = PDF_findfont( szPDFFile, FONTBOLD, "host", 0); + PDF_begin_page( szPDFFile, a4_width, a4_height); /* start a new page */ + iPage ++; + } + + PDF_setfont( szPDFFile, sziFontBold, FONTSIZESMALL ); + PDF_show_xy( szPDFFile, szBTextT, 25, fRow -= LEAD ); + PDF_setfont( szPDFFile, sziFont, FONTSIZESMALL ); + PDF_show( szPDFFile, szTextT ); } HB_FUNC(HB_PDFADDLINK) { -int iPagetoGo=hb_parni(2); -const char *szLink; + int iPagetoGo = hb_parni( 2 ) - 1; + const char *szLink; -szLink=(char *) hb_parc(1); - if (iRow<=40) { - iRow=800; - PDF_end_page(szPDFFile); - sziFont = PDF_findfont(szPDFFile, FONTNORMAL, "host", 0); - sziFontBold = PDF_findfont(szPDFFile, FONTBOLD, "host", 0); - PDF_begin_page(szPDFFile, a4_width, a4_height); /* start a new page */ - PDF_setfont(szPDFFile, sziFont, FONTSIZESMALL); - iPage++; + szLink = ( char * ) hb_parc( 1 ); + if (fRow <= 40 ) + { + fRow = 800; + PDF_end_page( szPDFFile ); + sziFont = PDF_findfont( szPDFFile, FONTNORMAL, "host", 0 ); + sziFontBold = PDF_findfont( szPDFFile, FONTBOLD, "host", 0 ); + PDF_begin_page( szPDFFile, a4_width, a4_height ); /* start a new page */ + PDF_setfont( szPDFFile, sziFont, FONTSIZESMALL ); + iPage ++; + } + + fCol = ( float ) fRow; + iWidth = hb_checkStringWidth( szLink ); + + // New Page, so curCol is 0 + if ( fCurCol == 0) + { + fCurCol = 60 ; + fLastRow = ( fRow - LEADLINK ); + fCurLastCol = ( fCol - LEAD ); + fStartCol = 49 ; + fStartCol2 = 50 ; + + } + + if ( fCurCol + iWidth + 10 <= a4_width ) + { + PDF_set_border_color( szPDFFile, ( float ) 1 ,( float ) 1 ,( float ) 1 ); + PDF_add_locallink( szPDFFile, fStartCol, fLastRow, fCurCol + iWidth, fCol, iPagetoGo, "fitwidth"); + PDF_setrgbcolor( szPDFFile, ( float ) 0, ( float ) 0, ( float ) 1 ); + PDF_set_parameter( szPDFFile, "underline", "true" ); + PDF_show_xy( szPDFFile, szLink, fStartCol2, fCurLastCol ); + PDF_setrgbcolor( szPDFFile, ( float ) 0, ( float ) 0, ( float ) 0); + PDF_set_parameter( szPDFFile, "underline", "false"); + fCurCol += 10 + iWidth; + fStartCol += iWidth; + fStartCol2 += iWidth; + + + if( fCurCol > a4_width ) + { + fCurCol = 00 ; + fStartCol = 49 ; + fStartCol2 = 50 ; + fRow -= LEADLINK; + fCol -= LEAD; + + } } -iCol= (float) iRow; -iWidth=hb_checkStringWidth(szLink); - -PDF_set_border_color(szPDFFile, (float) 1 ,(float) 1 ,(float) 1); -PDF_add_locallink(szPDFFile, 49, iRow-=LEADLINK,60+iWidth, iCol, iPagetoGo, "fitwidth"); -PDF_setrgbcolor(szPDFFile, (float) 0, (float) 0, (float) 1); -PDF_set_parameter(szPDFFile, "underline","true"); -PDF_show_xy(szPDFFile,szLink,50,iCol-=LEAD); -PDF_setrgbcolor(szPDFFile, (float) 0, (float) 0, (float) 0); -PDF_set_parameter(szPDFFile, "underline","false"); -iWidth=0; + iWidth = 0 ; } HB_FUNC(HB_PDFINITBOOK) { -PHB_ITEM pItems; -pItems=hb_param(1,HB_IT_ARRAY); -uiLen=hb_arrayLen(pItems); -if (pArray == NULL){ - pArray=hb_itemArrayNew( uiLen ); + PHB_ITEM pItems; + pItems = hb_param( 1, HB_IT_ARRAY ); + uiLen = hb_arrayLen( pItems ); + + if ( !bInitArray ) + { + pArray = hb_itemNew( NULL ); + hb_arrayNew( pArray, 0 ); + bInitArray = 1; } -for (uiCount=1;uiCount<=uiLen;uiCount++) - { - const char *szBook = (char *) hb_arrayGetCPtr(pItems,uiCount); - int iLevel; - PHB_ITEM pTempArray=hb_itemArrayNew(2); - PHB_ITEM pTemp; - PHB_ITEM pTempDesc; - iLevel=PDF_add_bookmark(szPDFFile, szBook, 0, 0); - pTempDesc=hb_itemPutC(NULL,hb_arrayGetCPtr(pItems,uiCount)) ; - hb_itemArrayPut(pTempArray,1,pTempDesc); - hb_itemRelease(pTempDesc); - pTemp=hb_itemPutNI(NULL,iLevel); - hb_itemArrayPut(pTempArray,2,pTemp); - hb_itemRelease(pTemp); - hb_itemArrayPut(pArray,uiCount,pTempArray); - hb_itemRelease(pTempArray) ; + for ( uiCount = 1 ; uiCount <= uiLen ; uiCount++ ) + { + const char *szBook = ( char * ) hb_arrayGetCPtr( pItems, uiCount ); + int iLevel; + PHB_ITEM TempArray = hb_itemNew( NULL ); + PHB_ITEM Temp = hb_itemNew( NULL ); + hb_arrayNew( TempArray, 2 ); + iLevel = PDF_add_bookmark( szPDFFile, szBook, 0, 0 ); + hb_arraySetForward( TempArray, 1, hb_itemPutC( Temp, hb_arrayGetCPtr( pItems, uiCount ) ) ); + hb_arraySetForward( TempArray, 2, hb_itemPutNI( Temp, iLevel) ); + hb_arraySetForward( pArray, uiCount, TempArray ); + + hb_itemRelease( Temp ); + hb_itemRelease( TempArray ); + } } -} + HB_FUNC(HB_PDFBOOKMARK) { -const char *szBook1=(char *)hb_parc(2); -ULONG uiPos; -PHB_ITEM pTempArray; -int iParent=0; -PHB_ITEM pBlock=hb_param(3,HB_IT_BLOCK); -uiPos=hb_arrayScan(pArray,pBlock,NULL,NULL); -if (uiPos>0) { - pTempArray=hb_itemArrayGet(pArray,uiPos); - iParent=hb_arrayGetNI(pTempArray,2); -} + const char *szBook1 =( char * )hb_parc( 2 ); + ULONG uiPos; + PHB_ITEM TempArray = hb_itemNew( NULL ); + int iParent = 0; + PHB_ITEM pBlock = hb_param( 3, HB_IT_BLOCK ); + + uiPos = hb_arrayScan( pArray, pBlock, NULL, NULL, FALSE ); + + if ( uiPos > 0 ) + { + if ( hb_arrayGet( pArray, uiPos, TempArray ) ) + { + iParent = hb_arrayGetNI( TempArray, 2 ); + hb_itemClear( TempArray ); + } + } + PDF_add_bookmark(szPDFFile, szBook1, iParent, 0); -hb_itemRelease(pTempArray); + + hb_itemRelease( TempArray ); } + HB_FUNC(HB_GETPAGE) { - hb_retni(iPage); - } -static BOOL hb_checkRow(float iLine) -{ - if (iLine<=20) { - iRow=800; - PDF_end_page(szPDFFile); - PDF_begin_page(szPDFFile, a4_width, a4_height); /* start a new page */ - iPage++; - return TRUE; - } - return FALSE; + hb_retni( iPage ); } + +#if 0 +static BOOL hb_checkRow( float iLine ) +{ + if ( iLine <= 20 ) + { + fRow = 800; + PDF_end_page( szPDFFile ); + PDF_begin_page( szPDFFile, a4_width, a4_height); /* start a new page */ + iPage ++; + return TRUE; + } + + return FALSE; +} +#endif + static float hb_checkStringWidth(const char *szString) { -float fReturn; -fReturn= PDF_stringwidth(szPDFFile,szString,sziFont,FONTSIZESMALL); -return fReturn; + float fReturn; + fReturn = PDF_stringwidth( szPDFFile, szString, sziFont, FONTSIZESMALL); + return fReturn; } + HB_FUNC(HB_PDFTABLE) { -PHB_ITEM pTableItem ; -PHB_ITEM pTableItem1 ; -PHB_ITEM pTableItem2 ; -PHB_ITEM pTableItem3 ; -ULONG ulPos; + PHB_ITEM pTableItem ; + PHB_ITEM pTableItem1 ; + PHB_ITEM pTableItem2 ; + PHB_ITEM pTableItem3 ; + ULONG ulPos; + + pTableItem = hb_param( 1, HB_IT_ARRAY ); + pTableItem1 = hb_param( 2, HB_IT_ARRAY ); + pTableItem2 = hb_param( 3, HB_IT_ARRAY ); + pTableItem3 = hb_param( 4, HB_IT_ARRAY ); + + if ( pTableItem2 != NULL) + { + bTItems = TRUE; + } + + if ( pTableItem3 != NULL ) + { + bFItems = TRUE; + bTItems = FALSE; + } + + fRow -= LEAD; + + for ( ulPos = 1 ; ulPos <= hb_arrayLen( pTableItem ) ; ulPos ++ ) + { + PHB_ITEM TempArray = hb_itemNew( NULL ); + PHB_ITEM TempArray1 = hb_itemNew( NULL ); + + fCol = fRow; + hb_arrayGet( pTableItem, ulPos, TempArray ); + hb_arrayGet( pTableItem1, ulPos, TempArray1 ); + + if ( !bTItems && !bFItems) + { + hb_ProcessTableItem( TempArray, TempArray1, NULL, NULL); + hb_itemClear( TempArray ); + hb_itemClear( TempArray1 ); + } + + if ( bTItems && !bFItems) + { + PHB_ITEM TempArray2 = hb_itemNew( NULL ); + + hb_arrayGet( pTableItem2 , ulPos, TempArray2 ); + hb_ProcessTableItem( TempArray, TempArray1, TempArray2, NULL ); + hb_itemClear( TempArray ); + hb_itemClear( TempArray1 ); + hb_itemClear( TempArray2 ); + + hb_itemRelease( TempArray2 ); + } + + if (!bTItems && bFItems) + { + PHB_ITEM TempArray2 = hb_itemNew( NULL ); + PHB_ITEM TempArray3 = hb_itemNew( NULL ); + + hb_arrayGet( pTableItem2, ulPos, TempArray2 ); + hb_arrayGet( pTableItem3, ulPos, TempArray3 ); + hb_ProcessTableItem( TempArray, TempArray1, TempArray2, TempArray3 ); + hb_itemClear( TempArray ); + hb_itemClear( TempArray1 ); + hb_itemClear( TempArray2 ); + hb_itemClear( TempArray3 ); + + hb_itemRelease( TempArray2 ); + hb_itemRelease( TempArray3 ); + } + } -pTableItem =hb_param(1,HB_IT_ARRAY); -pTableItem1 =hb_param(2,HB_IT_ARRAY); -pTableItem2 =hb_param(3,HB_IT_ARRAY); -pTableItem3 =hb_param(4,HB_IT_ARRAY); -if (pTableItem2 != NULL){ - bTItems=TRUE; -} -if (pTableItem3 != NULL){ - bFItems=TRUE; bTItems=FALSE; + bFItems=FALSE; + fOldPos=0; } -iRow-=LEAD; -for (ulPos=1;ulPos<=hb_arrayLen(pTableItem);ulPos++) { -PHB_ITEM pTempArray ; -PHB_ITEM pTempArray1 ; -iCol=iRow; - pTempArray=hb_itemArrayGet(pTableItem,ulPos); - pTempArray1=hb_itemArrayGet(pTableItem1,ulPos); - if (!bTItems && !bFItems) { -/* if (ulPos<2) { - iRow-=LEAD; - }*/ - hb_ProcessTableItem(pTempArray,pTempArray1,NULL,NULL); - hb_itemRelease(pTempArray); - hb_itemRelease(pTempArray1); - } - if (bTItems && !bFItems) { - PHB_ITEM pTempArray2; - - pTempArray2=hb_itemArrayGet(pTableItem2,ulPos); - hb_ProcessTableItem(pTempArray,pTempArray1,pTempArray2,NULL); - hb_itemRelease(pTempArray); - hb_itemRelease(pTempArray1); - hb_itemRelease(pTempArray2); - } - if (!bTItems && bFItems) { -PHB_ITEM pTempArray2 ; -PHB_ITEM pTempArray3 ; - - pTempArray2=hb_itemArrayGet(pTableItem2,ulPos); - pTempArray3=hb_itemArrayGet(pTableItem3,ulPos); - hb_ProcessTableItem(pTempArray,pTempArray1,pTempArray2,pTempArray3); - hb_itemRelease(pTempArray); - hb_itemRelease(pTempArray1); - hb_itemRelease(pTempArray2); - hb_itemRelease(pTempArray3); - } -} -bTItems=FALSE; -bFItems=FALSE; - fOldPos=0; -} -static void hb_ProcessTableItem(PHB_ITEM p1,PHB_ITEM p2,PHB_ITEM p3,PHB_ITEM p4) +static void hb_ProcessTableItem( PHB_ITEM p1, PHB_ITEM p2, PHB_ITEM p3, PHB_ITEM p4) { ULONG ulTempPos; ULONG ulLen; - float fHeight; - float fI; - float iitem,iitem1,iitem2,iitem3; - - ulLen=hb_arrayLen(p1); - for (ulTempPos=1;ulTempPos<=ulLen;ulTempPos++){ - const char *szTemp=(char *) hb_arrayGetCPtr(p1,ulTempPos); - const char *szTemp1=(char *) hb_arrayGetCPtr(p2,ulTempPos); + float iitem, iitem1, iitem2,iitem3; + + ulLen = hb_arrayLen( p1 ); + + for ( ulTempPos = 1 ; ulTempPos <= ulLen ; ulTempPos ++ ) + { + const char *szTemp = ( char * ) hb_arrayGetCPtr( p1, ulTempPos ); + const char *szTemp1 = ( char * ) hb_arrayGetCPtr( p2, ulTempPos ); + + if (!bTItems && !bFItems) + { + PDF_setfont( szPDFFile, sziFont, FONTSIZETABLE); + iitem = getText( szPDFFile, szTemp1, sziFont, 293, fRow, 261); + iitem1 = getText( szPDFFile, szTemp, sziFont, 27, fRow, 261); + if ( iitem < iitem1) + { + setText( szPDFFile, szTemp1, 293, fRow, iitem1, 261); + setText( szPDFFile, szTemp, 27, fRow, iitem1, 261); + fRow -= iitem1; + } + else + { + setText( szPDFFile, szTemp1, 293, fRow, iitem, 261); + setText( szPDFFile, szTemp, 27, fRow, iitem, 261); + fRow -= iitem; + } - if (!bTItems && !bFItems) { - PDF_setfont(szPDFFile, sziFont, FONTSIZETABLE); - iitem=getText(szPDFFile,szTemp1,sziFont,293,iRow,261); - iitem1=getText(szPDFFile,szTemp,sziFont,27,iRow,261); - if (iitem iitem1 && iitem > iitem2) + { + setText( szPDFFile, szTemp2, 381, fRow, iitem, 173); + setText( szPDFFile, szTemp1, 204, fRow, iitem, 172); + setText( szPDFFile, szTemp , 27, fRow, iitem, 172); + fRow -= iitem; + } + + if ( iitem2 > iitem && iitem2 >iitem1) + { + setText( szPDFFile, szTemp2, 381, fRow, iitem2, 173); + setText( szPDFFile, szTemp1, 204, fRow, iitem2, 172); + setText( szPDFFile, szTemp, 27, fRow, iitem2, 172); + fRow -= iitem2; + } + + if ( iitem1 > iitem && iitem1 > iitem2 ) + { + setText( szPDFFile, szTemp2, 381, fRow, iitem1, 173); + setText( szPDFFile, szTemp1, 204, fRow, iitem1, 172); + setText( szPDFFile, szTemp, 27, fRow, iitem1, 172); + fRow -= iitem1; + } + + } + + if ( !bTItems && bFItems ) + { + const char * szTemp2 = ( char * ) hb_arrayGetCPtr( p3, ulTempPos ); + const char * szTemp3 = ( char * ) hb_arrayGetCPtr( p4, ulTempPos ); + + PDF_setfont( szPDFFile, sziFont, FONTSIZETABLE); + iitem1 = getText( szPDFFile, szTemp3, sziFont, 426, fRow, 128 ); + iitem2 = getText( szPDFFile, szTemp2, sziFont, 293, fRow, 128 ); + iitem = getText( szPDFFile, szTemp1, sziFont, 160, fRow, 128 ); + iitem3 = getText( szPDFFile, szTemp, sziFont, 27, fRow, 128 ); + if (iitem > iitem1 && iitem > iitem2 && iitem > iitem3) + { + setText( szPDFFile, szTemp3, 426, fRow, iitem, 128); + setText( szPDFFile, szTemp2, 293, fRow, iitem, 128); + setText( szPDFFile, szTemp1, 160, fRow, iitem, 128); + setText( szPDFFile, szTemp, 27, fRow, iitem, 128); + fRow -= iitem; + } + else + { + if (iitem2 > iitem && iitem2 > iitem1 && iitem2 > iitem3) + { + setText( szPDFFile, szTemp3, 426, fRow, iitem2, 128); + setText( szPDFFile, szTemp2, 293, fRow, iitem2, 128); + setText( szPDFFile, szTemp1, 160, fRow, iitem2, 128); + setText( szPDFFile, szTemp, 27, fRow, iitem2, 128); + fRow -= iitem2; + } + else + { + if ( iitem1 > iitem && iitem1 > iitem2 && iitem1 > iitem3) + { + setText( szPDFFile, szTemp3, 426, fRow, iitem1, 128); + setText( szPDFFile, szTemp2, 293, fRow, iitem1, 128); + setText( szPDFFile, szTemp1, 160, fRow, iitem1, 128); + setText( szPDFFile, szTemp, 27, fRow, iitem1, 128); + fRow -= iitem1; + } + else + { + if ( iitem3 > iitem && iitem3 > iitem2 && iitem3 > iitem) + { + setText( szPDFFile, szTemp3, 426, fRow, iitem3, 128); + setText( szPDFFile, szTemp2, 293, fRow, iitem3, 128); + setText( szPDFFile, szTemp1, 160, fRow, iitem3, 128); + setText( szPDFFile, szTemp, 27, fRow, iitem3, 128); + fRow -= iitem3; + } + else + { + setText( szPDFFile, szTemp3, 426, fRow, iitem3, 128); + setText( szPDFFile, szTemp2, 293, fRow, iitem3, 128); + setText( szPDFFile, szTemp1, 160, fRow, iitem3, 128); + setText( szPDFFile, szTemp, 27, fRow, iitem3, 128); + fRow -= iitem3; + + } + } + } + } + } } - if (bTItems && !bFItems) { - const char * szTemp2=(char *) hb_arrayGetCPtr(p3,ulTempPos); - PDF_setfont(szPDFFile, sziFont, FONTSIZETABLE); - iitem=getText(szPDFFile,szTemp2,sziFont,381,iRow,173); - iitem1=getText(szPDFFile,szTemp1,sziFont,204,iRow,172); - iitem2=getText(szPDFFile,szTemp,sziFont,27,iRow,172); - if (iitem > iitem1 && iitem >iitem2) { - setText(szPDFFile ,szTemp2,381,iRow,iitem,173); - setText(szPDFFile ,szTemp1,204,iRow,iitem,172); - setText(szPDFFile ,szTemp,27,iRow,iitem,172); - iRow-=iitem; - } - - if (iitem2> iitem && iitem2>iitem1){ - setText(szPDFFile ,szTemp2,381,iRow,iitem2,173); - setText(szPDFFile ,szTemp1,204,iRow,iitem2,172); - setText(szPDFFile ,szTemp,27,iRow,iitem2,172); - iRow-=iitem2; - } - - if (iitem1> iitem && iitem1>iitem2 ){ - setText(szPDFFile ,szTemp2,381,iRow,iitem1,173); - setText(szPDFFile ,szTemp1,204,iRow,iitem1,172); - setText(szPDFFile ,szTemp,27,iRow,iitem1,172); - iRow-=iitem1; - } - -} - if (!bTItems && bFItems) { - const char * szTemp2=(char *) hb_arrayGetCPtr(p3,ulTempPos); - const char * szTemp3=(char *) hb_arrayGetCPtr(p4,ulTempPos); - PDF_setfont(szPDFFile, sziFont, FONTSIZETABLE); - iitem1=getText(szPDFFile ,szTemp3,sziFont,426,iRow,128); - iitem2=getText(szPDFFile ,szTemp2,sziFont,293,iRow,128); - iitem=getText(szPDFFile ,szTemp1,sziFont,160,iRow,128); - iitem3=getText(szPDFFile ,szTemp,sziFont,27,iRow,128); - if (iitem > iitem1 && iitem >iitem2 && iitem>iitem3) { - setText(szPDFFile ,szTemp3,426,iRow,iitem,128); - setText(szPDFFile ,szTemp2,293,iRow,iitem,128); - setText(szPDFFile ,szTemp1,160,iRow,iitem,128); - setText(szPDFFile ,szTemp,27,iRow,iitem,128); - iRow-=iitem; - } - else { - if (iitem2> iitem && iitem2>iitem1 && iitem2>iitem3){ - setText(szPDFFile ,szTemp3,426,iRow,iitem2,128); - setText(szPDFFile ,szTemp2,293,iRow,iitem2,128); - setText(szPDFFile ,szTemp1,160,iRow,iitem2,128); - setText(szPDFFile ,szTemp,27,iRow,iitem2,128); - iRow-=iitem2; - } - else { - if (iitem1> iitem && iitem1>iitem2 && iitem1>iitem3){ - setText(szPDFFile ,szTemp3,426,iRow,iitem1,128); - setText(szPDFFile ,szTemp2,293,iRow,iitem1,128); - setText(szPDFFile ,szTemp1,160,iRow,iitem1,128); - setText(szPDFFile ,szTemp,27,iRow,iitem1,128); - iRow-=iitem1; - } - else { - if (iitem3> iitem && iitem3>iitem2 && iitem3>iitem){ - setText(szPDFFile ,szTemp3,426,iRow,iitem3,128); - setText(szPDFFile ,szTemp2,293,iRow,iitem3,128); - setText(szPDFFile ,szTemp1,160,iRow,iitem3,128); - setText(szPDFFile ,szTemp,27,iRow,iitem3,128); - iRow-=iitem3; -} - else { - setText(szPDFFile ,szTemp3,426,iRow,iitem3,128); - setText(szPDFFile ,szTemp2,293,iRow,iitem3,128); - setText(szPDFFile ,szTemp1,160,iRow,iitem3,128); - setText(szPDFFile ,szTemp,27,iRow,iitem3,128); - iRow-=iitem3; - - } - } - } - } } -} -} - -float getText(PDF *p,const char *szText,int iFont,float irow,float icol,float iw) +float getText( PDF *p, const char *szText, int iFont, float frow, float fcol, float iw ) { -float h; -float w; -int c; -h=FONTSIZETABLE*2; -PDF_setfont(p, iFont, 7.0); -c=PDF_show_boxed(p, szText, irow, icol, iw, h, "justify", "blind"); -while (c>0){ - h+= FONTSIZETABLE; - c=PDF_show_boxed(p, szText, irow, icol, iw, h, "justify", "blind"); -} -return h; + float h; + int c; + h = FONTSIZETABLE * 2; + PDF_setfont( p, iFont, 7.0); + + c = PDF_show_boxed( p, szText, frow, fcol, iw, h, "justify", "blind" ); + + while ( c > 0) + { + h += FONTSIZETABLE; + c = PDF_show_boxed(p, szText, frow, fcol, iw, h, "justify", "blind" ); + } + + return h; } -void setText(PDF *p,const char *szText,float irow,float icol,float h,float iw) +void setText( PDF *p, const char *szText, float frow, float fcol, float h, float iw ) { - - PDF_show_boxed(p, szText, irow, icol, iw, h, "justify", ""); - PDF_rect(p,irow,icol,iw+5,h); - PDF_stroke(p); + PDF_show_boxed( p, szText, frow, fcol, iw, h, "justify", "" ); + PDF_rect( p, frow, fcol, iw + 5, h ); + PDF_stroke( p ); } diff --git a/harbour/contrib/pdflib/pdfhbdoc.ch b/harbour/contrib/pdflib/pdfhbdoc.ch new file mode 100644 index 0000000000..b7a68d803d --- /dev/null +++ b/harbour/contrib/pdflib/pdfhbdoc.ch @@ -0,0 +1,31 @@ +/* Defines */ +#define FONTBOLD "Courier-Bold" +#define FONTNORMAL "Courier" +#define FONTSIZEBOLD 15.0 +#define FONTSIZETABLE 8.5 +#define LEADLINK ( (fontSizePoints * 1.3)) +#define LEADTABLE ( (fontSizePoints * 1.2)) +#define a0_width 2380.0 +#define a0_height 3368.0 +#define a1_width 1684.0 +#define a1_height 2380.0 +#define a2_width 1190.0 +#define a2_height 1684.0 +#define a3_width 842.0 +#define a3_height 1190.0 +#define a4_width 595.0 +#define a4_height 842.0 +#define a5_width 421.0 +#define a5_height 595.0 +#define a6_width 297.0 +#define a6_height 421.0 +#define b5_width 501.0 +#define b5_height 709.0 +#define letter_width 612.0 +#define letter_height 792.0 +#define legal_width 612.0 +#define legal_height 1008.0 +#define ledger_width 1224.0 +#define ledger_height 792.0 +#define p11x17_width 792.0 +#define p11x17_height 1224.0 diff --git a/harbour/contrib/pdflib/pdfhbdocs.prg b/harbour/contrib/pdflib/pdfhbdocs.prg new file mode 100644 index 0000000000..394fd53314 --- /dev/null +++ b/harbour/contrib/pdflib/pdfhbdocs.prg @@ -0,0 +1,1310 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * PDF api Api for multiple porpurse + * + * Copyright 2000-2004 Luiz Rafael Culik + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + + +#pragma begindump +/* declare for later use on C functions */ +#include "hbapi.h" +#include "hbfast.h" +#pragma enddump + +#include "pdfhbdoc.ch" +#include "common.ch" +#INCLUDE "pdf.ch" + +/*Variaveis Staticas */ +GLOBAL lLandScape := .F. +STATIC fontSizePoints := 10.0 /*10.0*/ +STATIC NumofRows +STATIC LEAD := 10 +STATIC iRow := 800 +STATIC fCurrentRowSetting := 800 +STATIC fOldPos +STATIC iWidth +STATIC iCol +STATIC sziFontBold := 0 +STATIC fFootBottom := 40 +STATIC fColumn := 10 +STATIC sziFont := 0 +STATIC fPageWidth := a4_width +STATIC fPageHeigth := a4_height +STATIC iPage := 1 +STATIC uiLen +STATIC uiCount +STATIC bTItems +STATIC bFItems +STATIC szUserpass +STATIC iLastLinkPos := 0 +STATIC oPdf + +STATIC FUNCTION setBox( irow, icol, h, iw ) + + opdf:PDF_RECT( irow, icol, h, iw ) + + opdf:PDF_STROKE() +RETURN NIL + +FUNCTION HB_PDFNEW( szFileResult, fontsize, iStartRow, iBottom, iStartCol, iEndBottom, szMasterPass, szPass ) + + DEFAULT fontsize TO fontSizePoints + DEFAULT iStartRow TO fPageWidth + DEFAULT iBottom TO fPageHeigth + DEFAULT iStartCol TO fColumn + DEFAULT iEndBottom TO fFootBottom + DEFAULT szMasterPass TO "" + DEFAULT szPass TO "" + szFileResult := Lower( szFileResult ) + + oPdf := TPdf():New( szFileResult,, iStartRow, iBottom ) + IF oPdf == NIL + RETURN .f. + ENDIF + + fColumn := iStartCol + oPdf:SetTop( iRow ) // top + oPdf:SetLeft( fColumn ) // left & right + oPdf:SetBottom( iEndBottom ) + + fPageWidth := iStartRow + fPageHeigth := iBottom + + fontSizePoints := fontsize + LEAD := fontSizePoints + + /* Ajusta Coluna inicial/rodapé e o numero atual de linhas por pagina */ + + iRow := iStartRow - iEndBottom + fCurrentRowSetting := iRow + fFootBottom := iEndBottom + fColumn := iStartCol + NumofRows := iRow / fontSizePoints + +RETURN .T. + +FUNCTION HB_PDFENDPAGE + + iRow := fCurrentRowSetting + opdf:PDFCLOSEpage() /* close page */ + iPage ++ + iLastLinkPos := 0 +RETURN NIL + +FUNCTION HB_PDFNEWPAGE( szTitleT, szFile ) + +LOCAL image +LOCAL scale_x +LOCAL scale_y + + oPdf:pdfNewPage( "A4", Iif( fPageHeigth < fPageWidth, "P", "L" ),, "Courier", 0 ) + IF Ischaracter( szFile ) + IF lLandScape .OR. opdf:aReport[ PAGEORIENT ] == "L" + oPdf:pdfImage( szFile, 490 / 0.4, 60, 126, 126,, 0.4, 0.4 ) + ELSE + oPdf:pdfImage( szFile, 755 / 0.4, 20, 126, 126,, 0.4, 0.4 ) + ENDIF + ENDIF + oPdF:PDFsetfont( "Courier", 1, FONTSIZEBOLD ) + oPdf:pdfAtSay( szTitleT, iRow -= 15, fColumn, .T. ) + +RETURN nil + +FUNC HB_PDFWRITETEXT( cText ) + + IF ( iRow <= fFootBottom ) + iRow := fCurrentRowSetting + opdf:PDFCLOSEpage() + //PDF_begin_page(szPDFFile, fPageWidth, fPageHeigth) /* start a new page */ + oPdf:pdfNewPage( "A4", Iif( fPageHeigth < fPageWidth, "P", "L" ),, "Courier", 0 ) + iLastLinkPos := 0 + iPage ++ + ENDIF + + opdf:PDFsetfont( FONTNORMAL, 0, fontSizePoints ) + + opdf:pdfAtSay( cText, iRow -= LEAD, fColumn, .T. ) +RETURN nil + +FUNC HB_PDFWRITEBOLDTEXT( ctext ) + + IF ( iRow <= fFootBottom ) + iRow := fCurrentRowSetting + opdf:PDFCLOSEpage() + //PDF_begin_page(szPDFFile, fPageWidth, fPageHeigth) /* start a new page */ + oPdf:pdfNewPage( "A4", Iif( fPageHeigth < fPageWidth, "P", "L" ),, "Courier", 1 ) + iLastLinkPos := 0 + iPage ++ + ENDIF + + opdf:PDFsetfont( FONTNORMAL, 1, fontSizePoints ) + opdf:pdfAtSay( cText, iRow -= LEAD, fColumn, .T. ) + +RETURN nil + +FUNC HB_PDFWRITETEXTBOLD1( cText ) + + IF ( iRow <= fFootBottom ) + iRow := fCurrentRowSetting + opdf:PDFCLOSEpage() + //PDF_begin_page(szPDFFile, fPageWidth, fPageHeigth) /* start a new page */ + oPdf:pdfNewPage( "A4", Iif( fPageHeigth < fPageWidth, "P", "L" ),, "Courier", 1 ) + iLastLinkPos := 0 + iPage ++ + ENDIF + + opdf:PDFsetfont( FONTNORMAL, 1, FONTSIZEBOLD ) + opdf:pdfAtSay( cText, iRow -= LEAD, fColumn, .T. ) + // PDFsetfont(FONTNORMAL,0, fontSizePoints) + +RETURN nil + +FUNCTION HB_PDFCLOSE + + opdf:pdfclose() + fontSizePoints := 10.0 /*10.0*/ + LEAD := 10 + iRow := 800 + fCurrentRowSetting := 800 + lLandScape := .F. + + RETURN nil + + /* FUNCAO PDFMAXLINES() + Essa funcao retorna o numero maximo de linhas por pagina de + acordo com a fonte setada. +*/ + +FUNCTION PDFMAXLINES + + RETURN NumofRows + + /* FUNCAO PDFMAXCOLS() + + Essa funcao retorna o numero maximo de colunas por pagina de + acordo com a fonte setada. +*/ + +FUNCTION PDFMAXCOLS + +RETURN ( ( fPageWidth - 2 * fColumn ) / fontSizePoints ) + +FUNCTION PDFWRITETEXTAT( cText, iThisRow, iThisCol ) + +LOCAL currow + iThisRow := Iif( Isnumber( iThisRow ), fCurrentRowSetting - RowtoPoint( iThisRow ), iRow ) + iThisCol := RowtoPoint( iThisCol ) + currow := iRow + opdf:PDFsetfont( FONTNORMAL, 0, fontSizePoints ) + opdf:pdfAtSay( cText, iThisRow, iThisCol, .T. ) + +RETURN Nil + +FUNCTION POINTTOROW( iPt ) + +LOCAL thisRow + + thisRow := iPt / FONTSIZEPOINTS + +RETURN NUMOFROWS - thisRow + +FUNCTION ROWTOPOINT( ThisRow ) + + RETURN thisRow * FONTSIZEPOINTS + + /* FUNCAO PDFWRITETABLE(nRow, nCol , aTableCols, aLenCol,nNumLines, nStyle) + Parametros + nRow -> Linha onde tabela inicia + nCol -> Coluna onde tabela inicia + aTableCols -> Array de Items da coluna + aLenCol -> Array com as larguras da coluna + nNumLines -> Numero de linhas da tabela + nStyle -> Stilo da tabela +*/ + +FUNCTION PDFWRITETABLE( nRow, nCol, pArray, pCol, fNumLines, nStyle ) + +LOCAL ulTempPos +LOCAL ulTempPos1 +LOCAL fRow := GraphRowtoPoint( nRow ) - 0.5 * fontSizePoints +LOCAL fCol := RowtoPoint( nCol ) +LOCAL nNumLines := fNumLines +LOCAL fThisRow := RowtoPoint( nRow ) +LOCAL fCurRow := fNumLines + 0.5 * fontSizePoints +LOCAL fLinesDiff := fNumLines - fRow + +LOCAL DiffFromRow := fRow - iRow +LOCAL fLen := 0 +LOCAL fCurrRow := fRow +LOCAL fTemp +LOCAL fOldCol := fCol +LOCAL pTemp +LOCAL nLineGen +LOCAL fBoxSize +LOCAL fLastRow +LOCAL cItem + + DEFAULT pArray TO NIL + + SWITCH( nStyle ) + +CASE 0 + + FOR Each pTemp in pCol + fLen += RowtoPoint( pTemp ) + + NEXT + + setBox( fCol, fRow, fLen, - fCurRow ) + + FOR EACH pTemp IN pArray + fRow -= LEAD + + IF Isarray( pTemp ) + fCol := fOldCol + FOR each cItem IN pTemp + ultempPos1 := hb_enumindex() + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + fCol += RowtoPoint( pCol[ ulTempPos1 ] ) + NEXT + ENDIF + + NEXT + + iRow -= fNumLines + fontSizePoints + + EXIT + +CASE 1 + + fTemp := - fCurRow + + fCol := fOldCol + + FOR each pTemp in pCol + setBox( fCol, fRow, RowtoPoint( pTemp ), - fCurRow + ( 1 * fontSizePoints ) ) + fCol += RowtoPoint( pTemp ) + + NEXT + + FOR each pTemp IN pArray + + IF Isarray( pTemp ) + fRow -= LEAD + fCol := fOldCol + + FOR each cItem in pTemp + ulTempPos1 := hb_enumindex() + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + fCol += RowtoPoint( pCol[ ulTempPos1 ] ) + NEXT + + ENDIF + + NEXT + + iRow -= fNumLines + fontSizePoints + + EXIT + +CASE 2 + + nLineGen := 0 + fBoxSize := 0 + fLastRow := fRow + + fTemp := - fCurRow + fLen := fRow + + FOR each pTemp in pCol + fBoxSize += RowtoPoint( pTemp ) + NEXT + + WHILE ( nLineGen < nNumLines ) + + setBox( fCol, fLen, fBoxSize, - fontSizePoints * 1.5 ) + fLen -= fontSizePoints * 1.5 + nLineGen += 2 + ENDDO + + fRow := fCurrRow + fLen := fRow + nLineGen := 0 + + FOR EACH pTemp IN pCol + + WHILE ( nLineGen < nNumLines ) + + setBox( fCol, fLen, RowtoPoint( pTemp ), - fontSizePoints * 1.5 ) + fLen -= fontSizePoints * 1.5 + nLineGen += 2 + + ENDDO + + fCol += RowtoPoint( pTemp ) + fLen := fRow + nLineGen := 0 + NEXT + + fCol := fOldCol + + fRow := fLastRow + fRow -= LEAD + + FOR EACH pTemp in pArray + ulTempPos := hb_enumindex() + + IF Isarray( pTemp ) + + //if ( hb_arrayGet(pArray, ulTempPos,pTemp)) + + fCol := fOldCol + + FOR each cItem in pTemp + + // PDF_show_xy( szPDFFile, hb_arrayGetCPtr( pTemp , ulTempPos1 ), fCol+1 , fRow ) + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + fCol += RowtoPoint( pCol[ hb_enumindex() ] ) + NEXT + + fRow -= LEAD + + IF ( ulTempPos == 1 ) + fRow += LEAD / 2 + ELSE + fRow -= LEAD / 2 + ENDIF + ENDIF + + IF ( ulTempPos == 1 ) + fRow -= LEAD + ENDIF + + NEXT + + iRow -= fNumLines + fontSizePoints + EXIT + +CASE 3 + + fBoxSize := 0 + fLastRow := fRow + + fTemp := - fCurRow + fLen := fRow + + FOR EACH pTemp in pCol + fBoxSize += RowtoPoint( pTemp ) + NEXT + + fTemp := - fCurRow + setBox( fCol, fRow, fBoxSize, - ( 1.5 * fontSizePoints ) ) + fTemp := fCurRow + fNumLines -= RowtoPoint( 3 ) + fCurRow := fNumLines + 0.5 * fontSizePoints + setBox( fCol, fRow - 1.5 * fontSizePoints, fBoxSize, - fCurRow + ( 1.0 * fontSizePoints ) ) + fRow := fCurrRow + fCol := fOldCol + + FOR EACH pTemp In pCol + + // if (ulTempPos == 1 ||ulTempPos == 2 ) + setBox( fCol, fRow, RowtoPoint( pTemp ), - ( 1.5 * fontSizePoints ) ) + // else + setBox( fCol, fRow - 1.5 * fontSizePoints, RowtoPoint( pTemp ), - fCurRow + ( 1.0 * fontSizePoints ) ) + + fCol += RowtoPoint( pTemp ) + + NEXT + + fRow -= LEAD + + FOR EACH pTemp in pArray + ulTempPos := hb_enumindex() + + IF Isarray( ptemp ) + + fCol := fOldCol + + FOR each cItem in pTemp + ulTempPos1 := hb_enumindex() + + IF ( ulTempPos == 1 ) + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + ELSE + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + ENDIF + + fCol += RowtoPoint( pCol[ ulTempPos1 ] ) + + NEXT + + fRow -= LEAD + + IF ( ulTempPos == 1 ) + fRow += LEAD / 2 + ENDIF + + ENDIF + + IF ( ulTempPos == 1 ) + fRow -= LEAD + ENDIF + NEXT + iRow -= fNumLines + fontSizePoints + + EXIT + +CASE 4 + + // printf("estou case 3 \n") + fBoxSize := 0 + fLastRow := fRow + + fTemp := - fCurRow + FOR each pTemp in pCol + fBoxSize += RowtoPoint( pTemp ) + NEXT + + setBox( fCol, fRow, fBoxSize, - ( fontSizePoints * 1.5 ) ) + setBox( fCol, fRow - ( fNumLines + 0.5 * fontSizePoints ) + ( 1.5 * fontSizePoints ), fBoxSize, + ( fontSizePoints * 1.5 ) ) + fCol := fOldCol + + FOR EACH pTemp IN pCol + setBox( fCol, fRow, RowtoPoint( pTemp ), - fCurRow + ( 1.5 * fontSizePoints ) ) + fCol += RowtoPoint( pTemp ) + NEXT + + FOR each pTemp in pArray + ulTempPos := hb_enumindex() + + IF Isarray( pTemp ) + fRow -= LEAD + fCol := fOldCol + FOR each cItem in pTemp + ulTempPos1 := hb_enumindex() + IF ulTempPos == Len( pTemp ) + opdf:pdfAtSay( cItem, fRow - ( 0.5 * fontSizePoints ), fCol + 1, .T. ) + ELSEIF ulTempPos == 1 + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + ELSE + opdf:pdfAtSay( cItem, fRow - ( 0.5 * fontSizePoints ), fCol + 1, .T. ) + ENDIF + fCol += RowtoPoint( pCol[ ulTempPos1 ] ) + NEXT + fRow -= LEAD + ENDIF + + NEXT + iRow -= fNumLines + fontSizePoints + EXIT + +CASE 5 + + fBoxSize := 0 + FOR each pTemp in pCol + fBoxSize += RowtoPoint( pTemp ) + NEXT + setBox( fCol, fRow, fBoxSize, - ( 1.5 * fontSizePoints ) ) + + fNumLines -= RowtoPoint( 3 ) + fCurRow := fNumLines + 0.5 * fontSizePoints + setBox( fCol, fRow - 1.5 * fontSizePoints, fBoxSize, - fCurRow + ( 2 * fontSizePoints ) ) + fRow -= LEAD + + FOR EACH pTemp in pArray + + ulTempPos := hb_enumindex() + + IF Isarray( ptemp ) + + fCol := fOldCol + FOR each cItem in pTemp + ulTempPos1 := hb_enumindex() + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + fCol += RowtoPoint( pCol[ ulTempPos1 ] ) + NEXT + fRow -= LEAD + IF ( ulTempPos == 1 ) + fRow += LEAD / 2 + ENDIF + ENDIF + + IF ( ulTempPos == 1 ) + fRow -= LEAD + ENDIF + NEXT + iRow -= fNumLines + fontSizePoints + EXIT + +CASE 6 + + nLineGen := 0 + fBoxSize := 0 + + fTemp := - fCurRow + fLen := fRow + + FOR each pTemp in pCol + fBoxSize += RowtoPoint( pTemp ) + NEXT + WHILE ( nLineGen < nNumLines ) + + setBox( fCol, fLen, fBoxSize, - fontSizePoints * 1.5 ) + fLen -= fontSizePoints * 1.5 + nLineGen += 2 + ENDDO + + fRow -= LEAD + + FOR each pTemp in pArray + ulTempPos := hb_enumindex() + + IF Isarray( ptemp ) + + fCol := fOldCol + + FOR each cItem in pTemp + + ulTempPos1 := hB_enumIndex() + opdf:pdfAtSay( cItem, fRow, fCol + 1, .T. ) + + fCol += RowtoPoint( pCol[ ulTempPos1 ] ) + NEXT + + fRow -= LEAD + + IF ( ulTempPos == 1 ) + fRow += LEAD / 2 + ELSE + fRow -= LEAD / 2 + ENDIF + ENDIF + + IF ( ulTempPos == 1 ) + fRow -= LEAD + ENDIF + + NEXT + iRow -= fNumLines + fontSizePoints + EXIT + + END +RETURN 0 + +FUNCTION GraphRowtoPoint( thisRow ) + +RETURN fCurrentRowSetting - ( thisRow * fontSizePoints ) + +STATIC FUNCTION inverty( y ) + +RETURN fCurrentRowSetting - y + +FUNCTION PDFTEXTBOXED2( pText, pEnd, pStart, lDecRow, lBold ) + +LOCAL iSize +LOCAL sLastSize := 0 +LOCAL ulTempPos := 0 +LOCAL cText + DEFAULT lBold TO .F. + + iSize := PdfMaxBoxSize( pText, Iif( lBold, 1, 0 ), pEnd, iRow, pStart ) + + FOR each cText in pText + setText( cText, pStart[ hb_enumindex() ], iRow, iSize, pEnd[ hb_enumindex() ], lBold ) + NEXT + + IF ( lDecRow ) + iRow -= iSize + ENDIF + + RETURN nil + + /* FUNCAO PDFNEW( Nome,Tamanho fonte,largura pagina, altura pagina,coluna inicial,linha final,Senhamestre,SenhaNormal, aInfo) + Parametros: + Nome -> Nome do arquivo a ser criado + Tamanho fonte -> Tamanho da fonte a ser usada nesse documento + largura pagina -> Tamanho da largura da pagina + altura paginas -> Tamanho da altura da pagina + coluna inicial -> Coluna inicial do texto + linha final -> Linha final do texto ( + Senhamestre -> senha mestre de protecao + SenhaNormal -> senha do arquivo + aInfo -> Array de caracteres contendo informacoes do arquivo + Array nesse Formato -> { Keywords,Subject,Title,Creator,Author} + retorna verdadeiro se o arquivo foi criado, senao falso +*/ + +FUNCTION Pdfnew( szFileresult, fontsize, iStartRow, iBottom, iStartCol, iEndBottom, szMasterPass, szPass, ainfo ) + + DEFAULT fontsize TO fontSizePoints + DEFAULT iStartRow TO fPageWidth + DEFAULT iBottom TO fPageHeigth + DEFAULT iStartCol TO fColumn + DEFAULT iEndBottom TO fFootBottom + DEFAULT szMasterPass TO Nil + DEFAULT szPass TO Nil + + oPdf := TPdf():New( szFileResult,, iStartRow, iBottom ) + IF oPdf == NIL + RETURN 0 + ENDIF + /* Ajusta fonte da geração e numero de linhas para pulos */ + fontSizePoints := fontsize + LEAD := fontSizePoints + + /* Ajusta Coluna inicial/rodapé e o numero atual de linhas por pagina */ + fPageWidth := iStartRow + fPageHeigth := iBottom + + iRow := iStartRow - iEndBottom + IF ( iRow > 800 ) + iRow := 800 + ENDIF + NumofRows := iRow / fontSizePoints + fCurrentRowSetting := iRow + fFootBottom := iEndBottom + fColumn := iStartCol + + IF Isarray( aInfo ) + opdf:PDFINFO( aInfo[ 1 ], aInfo[ 5 ], aInfo[ 2 ], aInfo[ 4 ] ) + ENDIF +RETURN 1 + +FUNCTION PDFEND + + opdf:PDFclose() /* close PDF document */ + + fontSizePoints := 10.0 /*10.0*/ + LEAD := 10 + iRow := 800 + fCurrentRowSetting := 800 + sziFontBold := 0 + fFootBottom := 40 + fColumn := 10 + sziFont := 0 + fPageWidth := a4_width + fPageHeigth := a4_height + iPage := 1 + lLandScape := .F. + + RETURN nil + + /* PDFSETUNDERLINE( lUnder ) + Parametros + lUnder -> Flag the informa se e para usar underline ou nao + retorna o ultimo setting +*/ + +FUNCTION PDFSETUNDERLINE( lSet ) + + RETURN opdf:SetUnderline( lSet ) + /* PDFSETOVERLINE( lUnder ) + Parametros + lUnder -> Flag the informa se e para usar overline ou nao + retorna o ultimo setting +*/ +FUNCTION PDFSETOVERLINE( l ) + + RETURN opdf:SetOverline( l ) + + /* FUNCAO PDFSTARTPAGE( aHead,llShowHeader) +PARAMETROS + aHead -> Array que contem os cabecalhos das colunas + llShowHeader -> flag que indica de e para criar uma nova pagina +*/ + +FUNCTION PDFSTARTPAGE( aPage, bOpenPage ) + +LOCAL cItem +LOCAL i + DEFAULT bOpenPage TO .f. + + IF ( bOpenPage ) + opdf:pdfNewPage( "A4", Iif( fPageHeigth < fPageWidth, "P", "L" ),, "Courier", 0 ) + ENDIF + FOR each citem in aPage + i := hb_enumindex() + + IF ( i == 1 ) + opdf:PDFsetfont( "Courier", 1, FONTSIZEBOLD ) + opdf:pdfAtSay( cItem, iRow -= 15, fColumn, .T. ) + + ELSE + + opdf:PDFsetfont( "Courier", 0, fontSizePoints ) + opdf:pdfAtSay( cItem, iRow -= LEAD, fColumn, .T. ) + ENDIF + NEXT + + RETURN nil + + /* FUNCAO PDFDRAWPAGE( aPage) + Parametros + aPage -> Array com items a escrever na PDF + bOnNewPage -> Code block para evaluar se pagina acabar +*/ + +FUNCTION PDFDRAWPAGE( aPage, bOnNewPage ) + +LOCAL cItem +LOCAL i + + FOR each cItem in aPage + + /* testa se a pagina acabou */ + IF ( iRow <= fFootBottom ) + + iRow := fCurrentRowSetting + opdf:pdfClosePage() + iLastLinkPos := 0 + opdf:pdfNewPage( "A4", Iif( fPageHeigth < fPageWidth, "P", "L" ),, "Courier", 0 ) + iPage ++ + IF isblock( bOnNewPage ) + Eval( bOnNewPage ) + ENDIF + + ENDIF + opdf:PDFsetfont( "Courier", 0, fontSizePoints ) + opdf:pdfAtSay( cItem, iRow -= LEAD, fColumn, .T. ) + + NEXT + + RETURN nil + + /* FUNCAO PDFENDPAGE() + fecha a pagina em criacao +*/ + +FUNCTION PDFENDPAGE + + iRow := fCurrentRowSetting + opdf:PDFclosepage() /* close page */ + iPage ++ + iLastLinkPos := 0 +RETURN nil + +STATIC FUNCTION SetText( szText, irow, icol, h, iw, bBold ) + + opdf:PDFsetfont( "Courier", Iif( bBold, 1, 0 ), fontSizePoints ) + opdf:PDF_rect( irow, icol, iw + 5, h ) + opdf:PDF_stroke() + // PDF_show_boxed(p, szText, irow, icol, iw, h, "center", "") + opdf:pdfText( szText, iRow, iCol, iw, 0, 2 ) +RETURN nil + +FUNCTION getText( szText, iFont, irow, icol, iw ) + +LOCAL h +LOCAL w +LOCAL c + h := fontSizePoints * 2.1 + c := opdf:pdfTextCount( szText, irow, icol, iw, 0, 2 ) + h += fontSizePoints * c +RETURN h + +FUNCTION PdfMaxBoxSize( pText, iFont, pEnd, iw, pStart ) + +LOCAL fMax := 0 +LOCAL fCurrentSize +LOCAL ulTempPos + FOR ulTempPos := 1 TO Len( pText ) + + fCurrentSize := getText( pText[ ulTempPos ], iFont, pStart[ ulTempPos ], iRow, pEnd[ ulTempPos ] ) + fMax := Iif( fCurrentSize > fMax, fCurrentSize, fMax ) + NEXT +RETURN fMax + +FUNCTION PDFHR( fPos, fStart ) + + DEFAULT fPos TO Iif( lLandScape, fPageWidth - fColumn, fPageHeigth - fColumn ) + DEFAULT fStart TO fColumn + opdf:PDFmoveto( fStart * fontSizePoints, iRow - LEAD / 2 ) + opdf:PDFlineto( fPos * fontSizePoints, iRow - LEAD / 2 ) + iRow -= LEAD + opdf:PDF_stroke( ) + + /* +FUNCAO PDFPAGENUMBER() + Retorna o numero da pagina atual sendo construida +*/ + +FUNCTION PDFPAGENUMBER + + RETURN iPage + + /* FUNCAO PDFCURRENTLINE() +retorna a linha atual +*/ +FUNCTION PDFCURRENTLINE + + RETURN PointtoRow( iRow ) + + /* FUNCAO PDFNEWLINE() +incremanta a linha atual +*/ + +PROCEDURE PDFNEWLINE + + iRow -= LEAD +RETURN +FUNCTION PDFPLACEIMAGE( szfile, row, col, scale_y ) + + // int image; +LOCAL scale_x + row := RowtoPoint( row ) + col := RowtoPoint( col ) + col := inverty( col ) + + scale_x := 0.40 + scale_y := Iif( Isnumber( scale_y ), scale_y / 100, 0.40 ) + + opdf:PdfImage( szfile, row / scale_y, col ) + +RETURN nil +FUNCTION HB_SETLANDSCAPE( lLand ) + + lLandScape := lLand + // oPdf:pdfPageOrient( Iif( lLand, "L", "P" ) ) +RETURN nil + +FUNCTION Pdfcomplevel( X ) + + opdf:PdfCompLevel( x ) +RETURN NIL + + // inline c functions + +#pragma begindump + int Bin2i( BYTE * pszString ) + { + + ULONG ulLen = strlen( pszString ) ; + int i = HB_MKSHORT( ( ulLen >= 1 ) ? ( BYTE ) pszString[ 0 ]:0, + ( ulLen >= 2 ) ? ( BYTE ) pszString[ 1 ] :0 ) ; + //int i; + // i = *((short *) pszString); + return i ; + } + const char szFontTable[ ] = { + "\xfa\0\xfa\0\xfa\0\xfa\0\x4d\x01\x4d\x01\x4d\x01\x85\x01" + "\x98\x01\x2b\x02\xa4\x01\x2b\x02\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\x41\x03\xe8\x03\x41\x03\x41\x03" + "\x0a\x03\x41\x03\x0a\x03\x0a\x03\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\x34\x02\x3a\x02\xa3\x02\x3a\x02" + "\xfa\0\xfa\0\xfa\0\xfa\0\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\xfa\0\xfa\0\xfa\0\xfa\0\x16\x01\x16\x01\x16\x01\x16\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\x16\x01\x4d\x01\x4d\x01\x4d\x01\x16\x01\x4d\x01\x4d\x01\x4d\x01" + "\x34\x02\x3a\x02\xa3\x02\x3a\x02\x34\x02\x3a\x02\xa3\x02\x3a\x02" + "\x34\x02\x3a\x02\xa3\x02\x3a\x02\xbc\x01\xf4\x01\xf4\x01\xf4\x01" + "\x99\x03\xa2\x03\x98\x03\x40\x03\xd2\x02\xd2\x02\x63\x02\x9b\x02" + "\x9b\x02\x9b\x02\x63\x02\x9b\x02\x9b\x02\xd2\x02\x9b\x02\x9b\x02" + "\xd2\x02\xd2\x02\xd2\x02\xd2\x02\x63\x02\x9b\x02\x63\x02\x9b\x02" + "\x2c\x02\x63\x02\x63\x02\x9b\x02\xd2\x02\x0a\x03\xd2\x02\xd2\x02" + "\xd2\x02\x0a\x03\xd2\x02\x0a\x03\x4d\x01\x85\x01\x4d\x01\x85\x01" + "\x85\x01\xf4\x01\xbc\x01\xf4\x01\xd2\x02\x0a\x03\x9b\x02\x9b\x02" + "\x63\x02\x9b\x02\x2c\x02\x63\x02\x79\x03\xb0\x03\x41\x03\x79\x03" + "\xd2\x02\xd2\x02\x9b\x02\xd2\x02\xd2\x02\x0a\x03\xd2\x02\xd2\x02" + "\x2c\x02\x63\x02\x63\x02\x63\x02\xd2\x02\x0a\x03\xd2\x02\xd2\x02" + "\x9b\x02\xd2\x02\x63\x02\x9b\x02\x2c\x02\x2c\x02\xf4\x01\x2c\x02" + "\x63\x02\x9b\x02\x2c\x02\x63\x02\xd2\x02\xd2\x02\xd2\x02\xd2\x02" + "\xd2\x02\xd2\x02\x63\x02\x9b\x02\xb0\x03\xe8\x03\x41\x03\x79\x03" + "\xd2\x02\xd2\x02\x63\x02\x9b\x02\xd2\x02\xd2\x02\x2c\x02\x63\x02" + "\x63\x02\x9b\x02\x2c\x02\x63\x02\x4d\x01\x4d\x01\x85\x01\x4d\x01" + "\x16\x01\x16\x01\x16\x01\x16\x01\x4d\x01\x4d\x01\x85\x01\x4d\x01" + "\xd5\x01\x45\x02\xa6\x01\x3a\x02\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\xbc\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\x2c\x02\xf4\x01\xf4\x01\xbc\x01\xbc\x01\xbc\x01\xbc\x01" + "\xf4\x01\x2c\x02\xf4\x01\xf4\x01\xbc\x01\xbc\x01\xbc\x01\xbc\x01" + "\x4d\x01\x4d\x01\x16\x01\x4d\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\x2c\x02\xf4\x01\x2c\x02\x16\x01\x16\x01\x16\x01\x16\x01" + "\x16\x01\x4d\x01\x16\x01\x16\x01\xf4\x01\x2c\x02\xbc\x01\xf4\x01" + "\x16\x01\x16\x01\x16\x01\x16\x01\x0a\x03\x41\x03\xd2\x02\x0a\x03" + "\xf4\x01\x2c\x02\xf4\x01\x2c\x02\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\x2c\x02\xf4\x01\xf4\x01\xf4\x01\x2c\x02\xf4\x01\xf4\x01" + "\x4d\x01\xbc\x01\x85\x01\x85\x01\x85\x01\x85\x01\x85\x01\x85\x01" + "\x16\x01\x4d\x01\x16\x01\x16\x01\xf4\x01\x2c\x02\xf4\x01\x2c\x02" + "\xf4\x01\xf4\x01\xbc\x01\xbc\x01\xd2\x02\xd2\x02\x9b\x02\x9b\x02" + "\xf4\x01\xf4\x01\xbc\x01\xf4\x01\xf4\x01\xf4\x01\xbc\x01\xbc\x01" + "\xbc\x01\xbc\x01\x85\x01\x85\x01\xe0\x01\x8a\x01\x90\x01\x5c\x01" + "\xc8\0\xdc\0\x13\x01\xdc\0\xe0\x01\x8a\x01\x90\x01\x5c\x01" + "\x1d\x02\x08\x02\x1d\x02\x3a\x02\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\x4d\x01\x4d\x01\x85\x01\x85\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xa7\0\xa7\0\xa7\0\xa7\0\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xb4\0\x16\x01\xd6\0\x16\x01" + "\xbc\x01\xf4\x01\x2c\x02\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x2c\x02\x2c\x02\xf4\x01\x2c\x02\x2c\x02\x2c\x02\xf4\x01\x2c\x02" + "\0\0\0\0\0\0\0\0\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xfa\0\xfa\0\xfa\0\xfa\0\0\0\0\0\0\0\0\0" + "\xc5\x01\x1c\x02\x0b\x02\xf4\x01\x5e\x01\x5e\x01\x5e\x01\x5e\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\xbc\x01\xf4\x01\x2c\x02\xf4\x01" + "\xbc\x01\xf4\x01\x2c\x02\xf4\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xe8\x03\xe8\x03\x79\x03\xe8\x03\xe8\x03\xe8\x03\xe8\x03\xe8\x03" + "\0\0\0\0\0\0\0\0\xbc\x01\xf4\x01\xf4\x01\xf4\x01" + "\0\0\0\0\0\0\0\0\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\0\0\0\0\0\0\0\0" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\0\0\0\0\0\0\0\0\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\xe8\x03\xe8\x03\x79\x03\xe8\x03\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\x79\x03\xe8\x03\x79\x03\xb0\x03" + "\0\0\0\0\0\0\0\0\x14\x01\x2c\x01\x14\x01\x0a\x01" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\x63\x02\x9b\x02\x2c\x02\x63\x02\xd2\x02\x0a\x03\xd2\x02\xd2\x02" + "\x79\x03\xe8\x03\xb0\x03\xb0\x03\x36\x01\x4a\x01\x36\x01\x2c\x01" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\x9b\x02\xd2\x02\x9b\x02\xd2\x02" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\x16\x01\x16\x01\x16\x01\x16\x01" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\x16\x01\x16\x01\x16\x01\x16\x01\xf4\x01\xf4\x01\xf4\x01\xf4\x01" + "\xd2\x02\xd2\x02\x9b\x02\xd2\x02\xf4\x01\x2c\x02\xf4\x01\xf4\x01" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\x16\x01\x16\x01\x16\x01\x16\x01\x16\x01\x4d\x01\x16\x01\x4d\x01" + "\x63\x01\xda\x01\x63\x01\xda\x01\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x79\x03\x79\x03\x79\x03\x79\x03" + "\x9b\x02\xd2\x02\x9b\x02\xd2\x02\xde\0\x16\x01\xde\0\x16\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x85\x01\x85\x01\x85\x01\x85\x01\x48\x02\x48\x02\x48\x02\x48\x02" + "\x16\x01\x16\x01\x16\x01\x16\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x16\x01\x16\x01\x16\x01\x16\x01\x16\x01\x16\x01\x16\x01\x16\x01" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x16\x01\x4d\x01\x16\x01\x4d\x01\x16\x01\x4d\x01\x16\x01\x4d\x01" + "\x48\x02\x48\x02\x48\x02\x48\x02\x48\x02\x48\x02\x48\x02\x48\x02" + "\x48\x02\x48\x02\x48\x02\x48\x02\x2c\x02\x63\x02\x2c\x02\x63\x02" + "\xf7\x03\xcf\x03\xf7\x03\xcf\x03\x9b\x02\xd2\x02\x9b\x02\xd2\x02" + "\x9b\x02\xd2\x02\x9b\x02\xd2\x02\xd2\x02\xd2\x02\xd2\x02\xd2\x02" + "\xd2\x02\xd2\x02\xd2\x02\xd2\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02" + "\x63\x02\x63\x02\x63\x02\x63\x02\x0a\x03\x0a\x03\x0a\x03\x0a\x03" + "\xd2\x02\xd2\x02\xd2\x02\xd2\x02\x16\x01\x16\x01\x16\x01\x16\x01" + "\xf4\x01\x2c\x02\xf4\x01\x2c\x02\x9b\x02\xd2\x02\x9b\x02\xd2\x02" + "\x2c\x02\x63\x02\x2c\x02\x63\x02\x41\x03\x41\x03\x41\x03\x41\x03" + "\xd2\x02\xd2\x02\xd2\x02\xd2\x02\x0a\x03\x0a\x03\x0a\x03\x0a\x03" + "\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x0a\x03\x0a\x03\x0a\x03\x0a\x03" + "\xd2\x02\xd2\x02\xd2\x02\xd2\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02" + "\x63\x02\x63\x02\x63\x02\x63\x02\xd2\x02\xd2\x02\xd2\x02\xd2\x02" + "\x9b\x02\x9b\x02\x9b\x02\x9b\x02\xb0\x03\xb0\x03\xb0\x03\xb0\x03" + "\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02" + "\x63\x02\x63\x02\x63\x02\x63\x02\x16\x01\x4d\x01\x16\x01\x4d\x01" + "\x16\x01\x16\x01\x16\x01\x16\x01\x16\x01\x4d\x01\x16\x01\x4d\x01" + "\xd5\x01\x48\x02\xd5\x01\x48\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\xde\0\x16\x01\xde\0\x16\x01\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x63\x02\x2c\x02\x63\x02\xf4\x01\x2c\x02\xf4\x01\x2c\x02" + "\x2c\x02\x63\x02\x2c\x02\x63\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x16\x01\x4d\x01\x16\x01\x4d\x01\x2c\x02\x63\x02\x2c\x02\x63\x02" + "\x2c\x02\x63\x02\x2c\x02\x63\x02\xde\0\x16\x01\xde\0\x16\x01" + "\xde\0\x16\x01\xde\0\x16\x01\xf4\x01\x2c\x02\xf4\x01\x2c\x02" + "\xde\0\x16\x01\xde\0\x16\x01\x41\x03\x79\x03\x41\x03\x79\x03" + "\x2c\x02\x63\x02\x2c\x02\x63\x02\x2c\x02\x63\x02\x2c\x02\x63\x02" + "\x2c\x02\x63\x02\x2c\x02\x63\x02\x2c\x02\x63\x02\x2c\x02\x63\x02" + "\x4d\x01\x85\x01\x4d\x01\x85\x01\xf4\x01\x2c\x02\xf4\x01\x2c\x02" + "\x16\x01\x4d\x01\x16\x01\x4d\x01\x2c\x02\x63\x02\x2c\x02\x63\x02" + "\xf4\x01\x2c\x02\xf4\x01\x2c\x02\xd2\x02\x0a\x03\xd2\x02\x0a\x03" + "\xf4\x01\x2c\x02\xf4\x01\x2c\x02\xf4\x01\x2c\x02\xf4\x01\x2c\x02" + "\xf4\x01\xf4\x01\xf4\x01\xf4\x01\x4e\x01\x85\x01\x4e\x01\x85\x01" + "\x04\x01\x18\x01\x04\x01\x18\x01\x4e\x01\x85\x01\x4e\x01\x85\x01" + "\x48\x02\x48\x02\x48\x02\x48\x02\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\xa7\0\xa7\0\xa7\0\xa7\0\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\xbf\0\xee\0\xbf\0\xee\0" + "\x4d\x01\xf4\x01\x4d\x01\xf4\x01\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\xf4\x01\x63\x02\xf4\x01\x63\x02\xf4\x01\x63\x02\xf4\x01\x63\x02" + "\0\0\0\0\0\0\0\0\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\x16\x01\x16\x01\x16\x01\x16\x01\0\0\0\0\0\0\0\0" + "\x19\x02\x2c\x02\x19\x02\x2c\x02\x5e\x01\x5e\x01\x5e\x01\x5e\x01" + "\xde\0\x16\x01\xde\0\x16\x01\x4d\x01\xf4\x01\x4d\x01\xf4\x01" + "\x4d\x01\xf4\x01\x4d\x01\xf4\x01\x2c\x02\x2c\x02\x2c\x02\x2c\x02" + "\xe8\x03\xe8\x03\xe8\x03\xe8\x03\xe8\x03\xe8\x03\xe8\x03\xe8\x03" + "\0\0\0\0\0\0\0\0\x63\x02\x63\x02\x63\x02\x63\x02" + "\0\0\0\0\0\0\0\0\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\0\0\0\0\0\0\0\0" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\0\0\0\0\0\0\0\0\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01\x4d\x01" + "\xe8\x03\xe8\x03\xe8\x03\xe8\x03\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\xe8\x03\xe8\x03\xe8\x03\xe8\x03" + "\0\0\0\0\0\0\0\0\x72\x01\x72\x01\x72\x01\x72\x01" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\x2c\x02\x63\x02\x2c\x02\x63\x02\x0a\x03\x0a\x03\x0a\x03\x0a\x03" + "\xe8\x03\xe8\x03\xe8\x03\xe8\x03\x6d\x01\x6d\x01\x6d\x01\x6d\x01" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\x79\x03\x79\x03\x79\x03\x79\x03" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\x16\x01\x16\x01\x16\x01\x16\x01" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\xde\0\x16\x01\xde\0\x16\x01\x63\x02\x63\x02\x63\x02\x63\x02" + "\xb0\x03\xb0\x03\xb0\x03\xb0\x03\x63\x02\x63\x02\x63\x02\x63\x02" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + "\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02\x58\x02" + } ; + const int szFontTable_size = 5376 ; + + HB_FUNC( CALCDATA ) + { + int rowsperstrip = hb_parnd( 1 ) ; + float y = hb_parnd( 2 ) ; + float h = hb_parnd( 3 ) ; + int row, res ; + int p ; + for ( row = 0 ; row < h ; row += rowsperstrip ) + { + int height ; + height = row + rowsperstrip > h ? h - row :rowsperstrip ; + p = ( h - row - height ) ; + res = y + 1 * p ; + } + hb_retni( res ) ; + } +#pragma enddump + + /*FUNCAO PDFBOXCOLOR(nRed,nGreen,nBlue) + Parametros + nRed -> Quantidade de vermelho na composicao da cor ( valor entre 0 a 255) + nGreen -> Quantidade de verde na composicao da cor ( valor entre 0 a 255) + nBlue -> Quantidade de azul na composicao da cor ( valor entre 0 a 255) +*/ + +FUNCTION PDFBOXCOLOR( R, G, B ) + + oPdf:PDFsetrgbcolor( R / 255, G / 255, B / 255 ) +RETURN NIL + +FUNCTION PDFTEXTCOLOR( R, G, B ) + + oPdf:PDFsetrgbcolor( R / 255, G / 255, B / 255 ) +RETURN NIL + diff --git a/harbour/contrib/pdflib/pdflib.h b/harbour/contrib/pdflib/pdflib.h index d0bdc6be70..08b390373e 100644 --- a/harbour/contrib/pdflib/pdflib.h +++ b/harbour/contrib/pdflib/pdflib.h @@ -49,7 +49,7 @@ #ifdef WIN32 -#define PDFLIB_CALL __cdecl +#define PDFLIB_CALL __cdecl #ifdef PDFLIB_EXPORTS #define PDFLIB_API __declspec(dllexport) /* prepare a DLL (PDFlib-internal use only) */ @@ -57,17 +57,17 @@ #elif defined(PDFLIB_DLL) #define PDFLIB_API __declspec(dllimport) /* PDFlib clients - import PDFlib DLL fcts. */ -#else /* !PDFLIB_DLL */ -#define PDFLIB_API /* */ /* default: generate or use static library */ +#else /* !PDFLIB_DLL */ +#define PDFLIB_API /* */ /* default: generate or use static library */ -#endif /* !PDFLIB_DLL */ +#endif /* !PDFLIB_DLL */ -#else /* !WIN32 */ +#else /* !WIN32 */ #if (((defined __IBMC__) || (defined __IBMCPP__)) && (defined __DLL__)) #define PDFLIB_CALL _Export #define PDFLIB_API -#endif /* IBM VisualAge C++ DLL */ +#endif /* IBM VisualAge C++ DLL */ #ifndef PDFLIB_CALL #define PDFLIB_CALL @@ -76,7 +76,7 @@ #define PDFLIB_API #endif -#endif /* !WIN32 */ +#endif /* !WIN32 */ /* Make our declarations C++ compatible */ #ifdef __cplusplus @@ -103,11 +103,11 @@ typedef struct PDF_s PDF; */ /* PDFlib version number, major part */ -#define PDFLIB_MAJORVERSION 3 +#define PDFLIB_MAJORVERSION 3 /* PDFlib version number, minor part (must use two decimal places if != 0) */ -#define PDFLIB_MINORVERSION 02 -#define PDFLIB_VERSIONSTRING "3.02" +#define PDFLIB_MINORVERSION 02 +#define PDFLIB_VERSIONSTRING "3.02" /* * ActiveX uses the Class ID; @@ -152,7 +152,7 @@ PDF_new2(errorproc errorhandler, PDFLIB_API void * PDFLIB_CALL PDF_get_opaque(PDF *p); -#endif /* !SWIG */ +#endif /* !SWIG */ /* Create a new PDF object. */ PDFLIB_API PDF * PDFLIB_CALL @@ -180,7 +180,7 @@ PDF_open_fp(PDF *p, FILE *fp); /* Open a new PDF in memory, and install a callback for fetching the data */ PDFLIB_API void PDFLIB_CALL PDF_open_mem(PDF *p, size_t (*writeproc)(PDF *p, void *data, size_t size)); -#endif /* !defined(SWIG) */ +#endif /* !defined(SWIG) */ /* Get the contents of the PDF output buffer. The result must be used by the client before calling any other PDFlib function. Must not be @@ -211,7 +211,7 @@ PDF_end_page(PDF *p); #define PDF_NonfatalError 11 #define PDF_UnknownError 12 -#endif /* !SWIG */ +#endif /* !SWIG */ /* Set some PDFlib parameter with string type */ PDFLIB_API void PDFLIB_CALL @@ -332,7 +332,7 @@ PDF_setpolydash(PDF *p, float *dasharray, int length); #ifndef SWIG /* Maximum length of dash arrays */ -#define MAX_DASH_LENGTH 8 +#define MAX_DASH_LENGTH 8 #endif /* Set the flatness to a value between 0 and 100 inclusive. */ @@ -536,7 +536,7 @@ PDF_close_image(PDF *p, int image); help with preparing the thumbnail, but simply places it in the output. */ PDFLIB_API void PDFLIB_CALL PDF_add_thumbnail(PDF *p, int im); -#endif /* PDF_THUMBNAILS_SUPPORTED */ +#endif /* PDF_THUMBNAILS_SUPPORTED */ /* * ---------------------------------------------------------------------- @@ -648,34 +648,34 @@ Acrobat 4 maximum page size: 200" = 14400 pt = 508 cm /* The page sizes are only available to the C and C++ bindings */ #ifndef SWIG -#define a0_width (float) 2380.0 -#define a0_height (float) 3368.0 -#define a1_width (float) 1684.0 -#define a1_height (float) 2380.0 -#define a2_width (float) 1190.0 -#define a2_height (float) 1684.0 -#define a3_width (float) 842.0 -#define a3_height (float) 1190.0 -#define a4_width (float) 595.0 -#define a4_height (float) 842.0 -#define a5_width (float) 421.0 -#define a5_height (float) 595.0 -#define a6_width (float) 297.0 -#define a6_height (float) 421.0 -#define b5_width (float) 501.0 -#define b5_height (float) 709.0 -#define letter_width (float) 612.0 -#define letter_height (float) 792.0 -#define legal_width (float) 612.0 -#define legal_height (float) 1008.0 -#define ledger_width (float) 1224.0 -#define ledger_height (float) 792.0 -#define p11x17_width (float) 792.0 -#define p11x17_height (float) 1224.0 +#define a0_width (float) 2380.0 +#define a0_height (float) 3368.0 +#define a1_width (float) 1684.0 +#define a1_height (float) 2380.0 +#define a2_width (float) 1190.0 +#define a2_height (float) 1684.0 +#define a3_width (float) 842.0 +#define a3_height (float) 1190.0 +#define a4_width (float) 595.0 +#define a4_height (float) 842.0 +#define a5_width (float) 421.0 +#define a5_height (float) 595.0 +#define a6_width (float) 297.0 +#define a6_height (float) 421.0 +#define b5_width (float) 501.0 +#define b5_height (float) 709.0 +#define letter_width (float) 612.0 +#define letter_height (float) 792.0 +#define legal_width (float) 612.0 +#define legal_height (float) 1008.0 +#define ledger_width (float) 1224.0 +#define ledger_height (float) 792.0 +#define p11x17_width (float) 792.0 +#define p11x17_height (float) 1224.0 #endif #ifdef __cplusplus -} /* extern "C" */ +} // extern "C" #endif -#endif /* PDFLIB_H */ +#endif /* PDFLIB_H */ diff --git a/harbour/contrib/pgsql/common.mak b/harbour/contrib/pgsql/common.mak index bd056c96d9..77e271494b 100644 --- a/harbour/contrib/pgsql/common.mak +++ b/harbour/contrib/pgsql/common.mak @@ -11,8 +11,8 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\tpostgre.obj \ - $(OBJ_DIR)\postgres.obj + $(OBJ_DIR)\tpostgre$(OBJEXT) \ + $(OBJ_DIR)\postgres$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/pgsql/make_b32.bat b/harbour/contrib/pgsql/make_b32.bat index e3076413cb..cd3dc7838c 100644 --- a/harbour/contrib/pgsql/make_b32.bat +++ b/harbour/contrib/pgsql/make_b32.bat @@ -4,7 +4,7 @@ rem $Id$ rem rem --------------------------------------------------------------- -rem IMPORTANT: You'll need MySQL sources and this envvar +rem IMPORTANT: You'll need PostreSQL sources and this envvar rem to be set to successfully build this library: rem set C_USR=-IC:\postgresql-8.2.5\src\include rem --------------------------------------------------------------- diff --git a/harbour/contrib/pgsql/make_vc.bat b/harbour/contrib/pgsql/make_vc.bat index c99abceed8..cdffffe354 100644 --- a/harbour/contrib/pgsql/make_vc.bat +++ b/harbour/contrib/pgsql/make_vc.bat @@ -4,7 +4,7 @@ rem $Id$ rem rem --------------------------------------------------------------- -rem IMPORTANT: You'll need MySQL sources and this envvar +rem IMPORTANT: You'll need PostreSQL sources and this envvar rem to be set to successfully build this library: rem set C_USR=-IC:\postgresql-8.2.5\src\include rem --------------------------------------------------------------- diff --git a/harbour/contrib/rdd_ads/common.mak b/harbour/contrib/rdd_ads/common.mak index bad5597bbc..ed5661f25f 100644 --- a/harbour/contrib/rdd_ads/common.mak +++ b/harbour/contrib/rdd_ads/common.mak @@ -11,9 +11,9 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\ads1.obj \ - $(OBJ_DIR)\adsfunc.obj \ - $(OBJ_DIR)\adsmgmnt.obj + $(OBJ_DIR)\ads1$(OBJEXT) \ + $(OBJ_DIR)\adsfunc$(OBJEXT) \ + $(OBJ_DIR)\adsmgmnt$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/samples/common.mak b/harbour/contrib/samples/common.mak index 027c14accb..da7da03dc1 100644 --- a/harbour/contrib/samples/common.mak +++ b/harbour/contrib/samples/common.mak @@ -11,14 +11,14 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\environ.obj \ - $(OBJ_DIR)\date.obj \ - $(OBJ_DIR)\dbf.obj \ - $(OBJ_DIR)\gauge.obj \ - $(OBJ_DIR)\num.obj \ - $(OBJ_DIR)\stack.obj \ - $(OBJ_DIR)\status.obj \ - $(OBJ_DIR)\time.obj + $(OBJ_DIR)\environ$(OBJEXT) \ + $(OBJ_DIR)\date$(OBJEXT) \ + $(OBJ_DIR)\dbf$(OBJEXT) \ + $(OBJ_DIR)\gauge$(OBJEXT) \ + $(OBJ_DIR)\num$(OBJEXT) \ + $(OBJ_DIR)\stack$(OBJEXT) \ + $(OBJ_DIR)\status$(OBJEXT) \ + $(OBJ_DIR)\time$(OBJEXT) all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/tip/common.mak b/harbour/contrib/tip/common.mak index 810e063d69..b28d963a86 100644 --- a/harbour/contrib/tip/common.mak +++ b/harbour/contrib/tip/common.mak @@ -11,24 +11,24 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\base64x.obj \ - $(OBJ_DIR)\encmthd.obj \ - $(OBJ_DIR)\utils.obj \ + $(OBJ_DIR)\base64x$(OBJEXT) \ + $(OBJ_DIR)\encmthd$(OBJEXT) \ + $(OBJ_DIR)\utils$(OBJEXT) \ \ - $(OBJ_DIR)\cgi.obj \ - $(OBJ_DIR)\client.obj \ - $(OBJ_DIR)\credent.obj \ - $(OBJ_DIR)\encb64.obj \ - $(OBJ_DIR)\encoder.obj \ - $(OBJ_DIR)\encqp.obj \ - $(OBJ_DIR)\encurl.obj \ - $(OBJ_DIR)\ftpcln.obj \ - $(OBJ_DIR)\httpcln.obj \ - $(OBJ_DIR)\mail.obj \ - $(OBJ_DIR)\popcln.obj \ - $(OBJ_DIR)\smtpcln.obj \ - $(OBJ_DIR)\thtml.obj \ - $(OBJ_DIR)\url.obj \ + $(OBJ_DIR)\cgi$(OBJEXT) \ + $(OBJ_DIR)\client$(OBJEXT) \ + $(OBJ_DIR)\credent$(OBJEXT) \ + $(OBJ_DIR)\encb64$(OBJEXT) \ + $(OBJ_DIR)\encoder$(OBJEXT) \ + $(OBJ_DIR)\encqp$(OBJEXT) \ + $(OBJ_DIR)\encurl$(OBJEXT) \ + $(OBJ_DIR)\ftpcln$(OBJEXT) \ + $(OBJ_DIR)\httpcln$(OBJEXT) \ + $(OBJ_DIR)\mail$(OBJEXT) \ + $(OBJ_DIR)\popcln$(OBJEXT) \ + $(OBJ_DIR)\smtpcln$(OBJEXT) \ + $(OBJ_DIR)\thtml$(OBJEXT) \ + $(OBJ_DIR)\url$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/win32/common.mak b/harbour/contrib/win32/common.mak index a69c92b737..4755315031 100644 --- a/harbour/contrib/win32/common.mak +++ b/harbour/contrib/win32/common.mak @@ -11,12 +11,12 @@ LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) # LIB_OBJS = \ - $(OBJ_DIR)\tprinter.obj \ - $(OBJ_DIR)\w32_ole.obj \ - $(OBJ_DIR)\w32_prn.obj \ + $(OBJ_DIR)\tprinter$(OBJEXT) \ + $(OBJ_DIR)\w32_ole$(OBJEXT) \ + $(OBJ_DIR)\w32_prn$(OBJEXT) \ \ - $(OBJ_DIR)\w32_tole.obj \ - $(OBJ_DIR)\w32_tprn.obj \ + $(OBJ_DIR)\w32_tole$(OBJEXT) \ + $(OBJ_DIR)\w32_tprn$(OBJEXT) \ all: \ $(LIB_PATH) \