Module Df_print.pkg

     1//****************************************************************************//
     2//                                                                            //
     3// $File name  : DF_PRINT.PKG                                                 //
     4// $File title : WinPrint for DataFlex 3.05 and 4.x                           //
     5// Notice      : Copyright (c) ADB-UTVECKLING AB 1996-1997, Sweden            //
     6// $Author     : Janne Wassberg                                               //
     7// $System     : WinPrint                                                     //
     8// Created     : 96-01-30 @ 17.27.59                                          //
     9// $Last Rev   : 97-01-11 @ 12.00.00                                          //
    10//                                                                            //
    11// $Description  This class makes it possible to use Windows printer          //
    12//               system and functions in DataFlex                             //
    13//                                                                            //
    14//               The DataFlex class and DLL is written by:                    //
    15//                                                                            //
    16//               ADB-UTVECKLING AB                                            //
    17//               Gustvalundsv. 153                                            //
    18//               167 51 Bromma                                                //
    19//               Sweden                                                       //
    20//               Phone +46 (0)8 704 04 00                                     //
    21//               Fax   +46 (0)8 704 04 02                                     //
    22//               Compuserve  100336,2407                                      //
    23//               Internet    dataflex.adbutveckling.se                        //
    24//                                                                            //
    25//                                                                            //
    26//                                                                            //
    27// $Rev History                                                               //
    28//   00-05-23 JJT converted all OEMtoChar to ToAnsi                           //
    29//   99-04-28     1.22                                                        //
    30//   99-03-24     1.20                                                        //
    31//   99-02-17 SF  Added PrintDlgInPreview property, selects whether clicking  //
    32//                the print toolbar button in the preview should display      //
    33//                the Print Dialog or not. (default: False)                   //
    34//                Made changes to DFPreview accordingly.                      //
    35//                                                                            //
    36//   98-07-29 JJT Changes to support 1.15.3 (length of Str Support)           //
    37//                DfWrite(ln)Pos, DfWrite(ln)PostoPage now support            //
    38//                optional extra parameter (maximum length)                   //
    39//                                                                            //
    40//   97-01-11 Janne Wassberg                                                  //
    41//                                                                            //
    42//            Changed the implementation or errors in different languages     //
    43//                                                                            //
    44//                                                                            //
    45//   96-12-16 JJT - Various changes for VDF4 support.                         //
    46//                  Base DF_Printer on dfBasePanel so it can be USEd on desktop.  //
    47//                  Use window handle of Main_Window when possible.           //
    48//                  Use integer WinPRintId for easier faster access to        //
    49//                  global object oWinPrint.                                  //
    50//                                                                            //
    51//   96-09-03 Release of version 1.11                                         //
    52//                                                                            //
    53//   96-07-09 Release of version 1.1                                          //
    54//                                                                            //
    55//   96-04-26 Release of version 1.1 beta-2                                   //
    56//                                                                            //
    57//   96-03-18 Release of version 1.0                                          //
    58//                                                                            //
    59//   96-02-28 Release of version 1.0 beta                                     //
    60//                                                                            //
    61//   96-01-30 File header created. The experiment started !!!!                //
    62//                                                                            //
    63//                                                                            //
    64//****************************************************************************//
    65
    66    use windows.pkg
    67    Use LanguageText.pkg
    68    Use DLL.pkg
    69    Use WinPrint_Constants.pkg  // constants used by this class and winprint2
    70
    71
    72    //************************************************************
    73    //*************** API INTERFACE DFPRINT.DLL ******************
    74    //************************************************************
    75
    76
    77    //*** Creates a new page and the number of columns provided in
    78    //*** iColumns 0= no columns
    79    //*** returns pagenumber or PRN_FALSE=Error
    80    //***
    81    External_Function32 CreatePage "CreatePage"  DFPRINT.DLL ;
    82        Integer iColumns;
    83        Returns Integer
    84
    85
    86    //*** Set all margins for a page in Inch
    87    //*** Returns PRN_FALSE=Error or PRN_TRUE
    88    //***
    89    External_Function32 SetMarginsInch "SetMarginsInch"  DFPRINT.DLL ;
    90        Integer iLeft;
    91        Integer iTop;
    92        Integer iRight;
    93        Integer iBottom;
    94        Returns Integer
    95
    96
    97    //*** Set all margins for a page in CM
    98    //*** Returns PRN_FALSE=Error or PRN_TRUE
    99    //***
   100    External_Function32 SetMarginsMm "SetMarginsMm"  DFPRINT.DLL ;
   101        Integer iLeft;
   102        Integer iTop;
   103        Integer iRight;
   104        Integer iBottom;
   105        Returns Integer
   106
   107
   108    //*** Sets the font to specified font.
   109    //*** Returns PRN_FALSE=Error or PRN_TRUE
   110    //***
   111    External_Function32 SetFont "SetFont"  DFPRINT.DLL ;
   112        String  sFontName;
   113        Integer iFontNameLen;
   114        Returns Integer
   115
   116
   117    //*** Sets the fontsize to height and width.
   118    //*** Returns PRN_FALSE=Error or PRN_TRUE
   119    //***
   120    External_Function32 SetFontSize "SetFontSize"  DFPRINT.DLL ;
   121        Integer iHeight;
   122        Integer iWidth;
   123        Returns Integer
   124
   125
   126    //*** Sets fontstyle.
   127    //*** Returns PRN_FALSE=Error or PRN_TRUE
   128    //*** Using any combination of:
   129    //*** FONT_?? + RGB_??
   130    //***
   131    //*** Use FONT_DEFAULT to disable all effects (standard)
   132    //***
   133    External_Function32 SetFontStyle "SetFontStyle"  DFPRINT.DLL ;
   134        DWORD dwStyle;
   135        Returns Integer
   136
   137
   138    //*** Sets underline.
   139    //*** Returns PRN_FALSE=Error or PRN_TRUE
   140    //*** TRUE=Underline FALSE=Removes underline
   141    //***
   142    External_Function32 SetUnderline "Setunderline"  DFPRINT.DLL ;
   143        Integer iUnderline;
   144        Returns Integer
   145
   146
   147    //*** Sets bold.
   148    //*** Returns PRN_FALSE=Error or PRN_TRUE
   149    //*** TRUE=Bold FALSE=Removes Bold
   150    //***
   151    External_Function32 SetBold "SetBold"  DFPRINT.DLL ;
   152        Integer iBold;
   153        Returns Integer
   154
   155
   156    //*** Sets italic.
   157    //*** Returns PRN_FALSE=Error or PRN_TRUE
   158    //*** TRUE=Italic FALSE=Removes Italic
   159    //***
   160    External_Function32 SetItalic "SetItalic"  DFPRINT.DLL ;
   161        Integer iItalic;
   162        Returns Integer
   163
   164
   165    //*** Sets strikeout.
   166    //*** Returns PRN_FALSE=Error or PRN_TRUE
   167    //*** TRUE=Strikeout FALSE=Removes Strikeout
   168    //***
   169    External_Function32 SetStrikeout "SetStrikeout"  DFPRINT.DLL ;
   170        Integer iStrikeout;
   171        Returns Integer
   172
   173
   174    //*** Writes a line to a pagenumber using active fonts.
   175    //*** If you are using columns it will write the text to
   176    //*** specified column. 0= Don´t use column.
   177    //*** If you send -1 it will be treated as a string.
   178    //*** If send a number it will indicate that it´s a number
   179    //*** and how many decimals you want.
   180    //*** Returns PRN_FALSE=Error or PRN_TRUE
   181    //*** TRUE=Linefeed (writeln) FALSE=No linefeed (write)
   182    //***
   183    External_Function32 WriteLineToPage "WriteLineToPage"  DFPRINT.DLL ;
   184        Integer iPageNr;
   185        String  sText;
   186        Integer iTextLen;
   187        Integer iLineFeed;
   188        Integer iWriteToCol;
   189        Integer iDecimal;
   190        Returns Integer
   191
   192
   193    //*** Obsolete, replaced by WriteLinetoPositionInchEx
   194    //*** Writes a line to a pagenumber using active fonts.
   195    //*** at a given position in Inch from left margin
   196    //*** If you send -1 it will be treated as a string.
   197    //*** If send a number it will indicate that it´s a number
   198    //*** and how many decimals you want.
   199    //*** Returns PRN_FALSE=Error or PRN_TRUE
   200    //*** TRUE=Linefeed (writeln) FALSE=No linefeed (write)
   201    //***
   202    External_Function32 WriteLineToPositionInch "WriteLineToPositionInch"  DFPRINT.DLL ;
   203        Integer iPageNr ;
   204        String sText;
   205        Integer iTextLen;
   206        Integer iLineFeed;
   207        Integer iCols;
   208        Integer iDecimal;
   209        Returns Integer
   210
   211    //*** Same as above expect the maximum length is also passed (iLe). This is now the
   212    //*** preferred message and can be used in placef WriteLinetoPostitionMn (if no max
   213    //*** length pass-1)
   214    //***
   215    External_Function32 WriteLineToPositionInchEx "WriteLineToPositionInchEx"  DFPRINT.DLL ;
   216        Integer iPageNr String  sT Integer iT;
   217        Integer iL Integer iC Integer iD Integer iLe;
   218        Returns Integer
   219
   220    //*** Obsolete, replaced by WriteLinetoPositionMmEx
   221    //*** Writes a line to a pagenumber using active fonts.
   222    //*** at a given position in CM from left margin
   223    //*** If you send -1 it will be treated as a string.
   224    //*** If send a number it will indicate that it´s a number
   225    //*** and how many decimals you want.
   226    //*** Returns PRN_FALSE=Error or PRN_TRUE
   227    //*** TRUE=Linefeed (writeln) FALSE=No linefeed (write)
   228    //***
   229    External_Function32 WriteLineToPositionMm "WriteLineToPositionMm"  DFPRINT.DLL ;
   230        Integer iPageNr;
   231        String  sText;
   232        Integer iTextLen;
   233        Integer iLineFeed;
   234        Integer iCols;
   235        Integer iDecimal;
   236        Returns Integer
   237
   238    //*** Same as above expect the maximum length is also passed (iLe). This is now the
   239    //*** preferred message and can be used in placef WriteLinetoPostitionMn (if no max
   240    //*** length pass-1)
   241    //***
   242    External_Function32 WriteLineToPositionMmEx "WriteLineToPositionMmEx"  DFPRINT.DLL;
   243        Integer iPageNr String  sT Integer iT;
   244        Integer iL Integer iC Integer iD Integer iLe;
   245        Returns Integer
   246
   247
   248    //*** Opens Print Setup.
   249    //*** Returns PRN_TRUE
   250    //*** HWND is a handle to the parent window
   251    //***
   252    External_Function32 ExecutePrintSetup "ExecutePrintSetup"  DFPRINT.DLL ;
   253        Pointer hwnd;
   254        Returns Integer
   255
   256
   257    //*** Opens Print Dialog.
   258    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   259    //*** HWND is a handle to the parent window
   260    //***
   261    External_Function32 ExecutePrintDialog "ExecutePrintDialog"  DFPRINT.DLL ;
   262        Pointer hwnd;
   263        Returns Integer
   264
   265
   266    //*** Shows a preview of your document.
   267    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   268    //*** HWND must be the container handle (MAIN)
   269    //***
   270    External_Function32 PreviewDocument "PreviewDocument"  DFPRINT.DLL ;
   271        Pointer hwnd;
   272        Returns Integer
   273
   274    External_Function32 PreviewDocumentEx "PreviewDocumentEx"  DFPRINT.DLL ;
   275        Pointer hwnd;
   276        Integer bPrntDlg;
   277        Returns Integer
   278
   279    External_Function32 PreviewDocumentEx2 "PreviewDocumentEx2"  DFPRINT.DLL ;
   280        Pointer hwnd;
   281        Integer bPrntDlg;
   282        Integer bPrntSetup;
   283        Integer bPrnt;
   284        Returns Integer
   285
   286
   287    //*** Prints your document using the settings in print setup.
   288    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   289    //*** HWND is a handle to the parent window
   290    //***
   291    External_Function32 PrintDocument "PrintDocument"  DFPRINT.DLL ;
   292        Pointer hwnd;
   293        Returns Integer
   294
   295
   296    //*** Clear all resurces used by Windows and prepares for
   297    //*** a new document. Printer settings remains.
   298    //*** Should be called after a print
   299    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   300    //***
   301    External_Function32 ClearDocument "ClearDocument"  DFPRINT.DLL ;
   302        Returns Integer
   303
   304
   305    //*** Creates a header. The param you send sets the type
   306    //*** of header you would like to have.
   307    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   308    //***
   309    //*** DFPageTop         0
   310    //*** DFReportHeader    1
   311    //*** DFPageHeader      2
   312    //*** DFPageTitle       3
   313    //*** DFSubHeader       4
   314    //*** DFSubTotal        5
   315    //*** DFTotal           6
   316    //*** DFPageTotal       7
   317    //*** DFPageFooter      8
   318    //*** DFReportFooter    9
   319    //*** DFPageBottom      10
   320    //*** DFPageHeader2     11
   321    //***
   322    //***
   323    External_Function32 BeginHeader "BeginHeader"  DFPRINT.DLL ;
   324        Integer iInternalObj;
   325        Integer iHeaderNr;
   326        Integer iHeaderType;
   327        Returns Integer
   328
   329
   330    //*** End´s a header definition. Headers can NOT be nested
   331    //***
   332    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   333    //***
   334    External_Function32 EndHeader "EndHeader"  DFPRINT.DLL ;
   335        Returns Integer
   336
   337
   338    //*** Writes a header to current line
   339    //***
   340    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   341    //***
   342    External_Function32 WriteHeaderToPage "WriteHeaderToPage"  DFPRINT.DLL ;
   343        Integer iPageNr;
   344        Integer iHeaderNr;
   345        Integer iInternalObj;
   346        Integer iHeaderType;
   347        Returns Integer
   348
   349
   350    //*** Posision the header to Left,right or center on the page
   351    //*** 0=Left, 1=Center, 2=Right
   352    //***
   353    //*** Returns PRN_FALSE=Error or PRN_TRUE
   354    //***
   355    External_Function32 SetHeaderPlacement "SetHeaderPlacement"  DFPRINT.DLL ;
   356        Integer iPlace;
   357        Returns Integer
   358
   359
   360    //*** Sets frametype of header with color and weight of frame
   361    //*** using inch
   362    //*** 0=No frame, 1=Margin to margin, 2=frame size
   363    //***
   364    //*** Returns PRN_FALSE=Error or PRN_TRUE
   365    //***
   366    External_Function32 SetHeaderFrameInch "SetHeaderFrameInch"  DFPRINT.DLL ;
   367        Integer iFrame;
   368        Dword   dwColor;
   369        Integer iWeight;
   370        Dword   dwFillCol;
   371        Integer iFill;
   372        Returns Integer
   373
   374
   375    //*** Sets frametype of header with color and weight of frame
   376    //*** using cm
   377    //*** 0=No frame, 1=Margin to margin, 2=frame size
   378    //***
   379    //*** Returns PRN_FALSE=Error or PRN_TRUE
   380    //***
   381    External_Function32 SetHeaderFrameMm "SetHeaderFrameMm"  DFPRINT.DLL ;
   382        Integer iFrame;
   383        Dword   dwColor;
   384        Integer iWeight;
   385        Dword   dwFillCol;
   386        Integer iFill;
   387        Returns Integer
   388
   389
   390    //*** Sets the header to be reprinted on page breake done
   391    //*** by the DLL. Default is HDR_WRAP
   392    //***
   393    //*** HDR_NOWRAP = 0
   394    //*** HDR_WRAP   = 1
   395    //***
   396    //*** Returns PRN_FALSE=Error or PRN_TRUE
   397    //***
   398    External_Function32 SetHeaderWrap "SetHeaderWrap"  DFPRINT.DLL ;
   399        Integer iOnOff;
   400        Returns Integer
   401
   402
   403
   404    //*** Writes a bitmap to a pagenumber at a given position in CM
   405    //*** from left margin. The pos param. you have to send is upper left
   406    //*** and down right
   407    //*** Returns PRN_FALSE=Error or PRN_TRUE
   408    //***
   409    External_Function32 DrawBitmapToPageMm "DrawBitmapToPageMm" DFPRINT.DLL;
   410        Integer iPageNr;
   411        String  sName;
   412        Integer iNameLen;
   413        Integer iLTopX;
   414        Integer iLTopY;
   415        Integer iRBotX;
   416        Integer iRBotY;
   417        Integer iUCp;
   418        Returns Integer
   419
   420
   421    //*** Writes a bitmap to a pagenumber at a given position in Inch
   422    //*** from left margin. The pos param. you have to send is upper left
   423    //*** and down right
   424    //*** Returns PRN_FALSE=Error or PRN_TRUE
   425    //***
   426    External_Function32 DrawBitmapToPageInch "DrawBitmapToPageInch" DFPRINT.DLL;
   427        Integer iPageNr;
   428        String  sName;
   429        Integer iNameLen;
   430        Integer iLTopX;
   431        Integer iLTopY;
   432        Integer iRBotX;
   433        Integer iRBotY;
   434        Integer iUCp;
   435        Returns Integer
   436
   437
   438    //*** Check if the header and a given number of lines fits on the page
   439    //***
   440    //*** Returns PRN_FALSE=Error or PRN_TRUE
   441    //***
   442    External_Function32 SetExtraLineCheck "SetExtraLineCheck"  DFPRINT.DLL ;
   443        Integer iLines;
   444        Returns Integer
   445
   446
   447    //*** Sets the pd flags of the printer dialog/setup
   448    //***
   449    //*** Returns PRN_FALSE=Error or PRN_TRUE
   450    //***
   451    External_Function32 SetPrintDialogFlags "SetPrintDialogFlags"  DFPRINT.DLL ;
   452        Integer iFlags;
   453        Returns Integer
   454
   455
   456    //*** Selects a printer without accessing the print dialog/setup
   457    //***
   458    //*** Returns PRN_FALSE=Not a valid printer, or PRN_TRUE=Ok
   459    //***
   460    External_Function32 SelectPrinter "SelectPrinter"  DFPRINT.DLL ;
   461        String  sDriver;
   462        Integer iDriverLen;
   463        String  sDevice;
   464        Integer iDeviceLen;
   465        String  sPort;
   466        Integer iPortLen;
   467        Integer iUpdate;
   468        Returns Integer
   469
   470
   471    //*** Sets the paper bin for the first page in a report
   472    //*** using valid printer flags.
   473    //***
   474    //*** Returns PRN_FALSE=Error or PRN_TRUE
   475    //***
   476    External_Function32 SetFirstPagePaperSource "SetFirstPagePaperSource"  DFPRINT.DLL ;
   477        Integer iFlags;
   478        Returns Integer
   479
   480
   481    //*** Creates a RGB color value that can be used in WinPrint
   482    //*** as a constant. Each color in RGB is a value betwen 0-255.
   483    //***
   484    //*** Returns a valid constant value for WinPrint
   485    //***
   486    External_Function32 RGBToDFPrintColor "RGBToDFPrintColor"  DFPRINT.DLL ;
   487        Integer iRed;
   488        Integer iGreen;
   489        Integer iBlue;
   490        Returns DWORD
   491
   492
   493    //*** Sets color in WinPrint using the color value created
   494    //*** by RGBToDFPrintColor.
   495    //***
   496    //*** Returns True or false
   497    //***
   498    External_Function32 SetColor "SetColor"  DFPRINT.DLL ;
   499        DWORD dwDFColor;
   500        Returns Integer
   501
   502
   503    //*** Report_Header/_Footer are placed at the paper edge as default.
   504    //*** With this function you can move the placement of the sections
   505    //*** for the first page or all pages.
   506    //*** Returns PRN_FALSE=Error or PRN_TRUE
   507    //***
   508    External_Function32 SetAbsoluteMarginsInch "SetAbsoluteMarginsInch" DFPRINT.DLL;
   509        Integer iTop;
   510        Integer iBottom;
   511        Integer iAll;
   512        Returns Integer
   513
   514
   515    //*** Report_Header/_Footer are placed at the paper edge as default.
   516    //*** With this function you can move the placement of the sections
   517    //*** for the first page or all pages.
   518    //*** Returns PRN_FALSE=Error or PRN_TRUE
   519    //***
   520    External_Function32 SetAbsoluteMarginsMm "SetAbsoluteMarginsMm" DFPRINT.DLL;
   521        Integer iTop;
   522        Integer iBottom;
   523        Integer iAll;
   524        Returns Integer
   525
   526
   527    //*** SetAlign can be used to jystify the text to a given position.
   528    //*** Returns PRN_FALSE=Error or PRN_TRUE
   529    //***
   530    External_Function32 SetAlign "SetAlign" DFPRINT.DLL;
   531        Integer iAlign;
   532        Returns Integer
   533
   534
   535
   536    //*** Writes an ellipse to a pagenumber at a given position in Inch
   537    //*** from left margin. The pos param. you have to send upper left
   538    //*** and down right. dwBColor is boarder color, dwFillColor is fill color
   539    //*** If iFill is true the ellipsen will be filled of it´s false it will
   540    //*** be transparent.iW is weight and iWr is wrap.
   541    //*** Returns PRN_FALSE=Error or PRN_TRUE
   542    //***
   543    External_Function32 DrawEllipInch "DrawEllipInch" DFPRINT.DLL;
   544        Integer iPNr;
   545        Integer iLTX;
   546        Integer iLTY;
   547        Integer iRBX;
   548        Integer iRBY;
   549        Dword   dBC;
   550        Dword   dFC;
   551        Integer iFi;
   552        Integer iW;
   553        Integer iUCp;
   554        Integer iWr;
   555        Returns Integer
   556
   557
   558    //*** Writes an ellipse to a pagenumber at a given position in CM
   559    //*** from left margin. The pos param. you have to send is upper left
   560    //*** and down right.dwBColor is boarder color, dwFillColor is fill color
   561    //*** If iFill is true the ellipsen will be filled of it´s false it will
   562    //*** be transparent.iW is weight and iWr is wrap.
   563    //*** Returns PRN_FALSE=Error or PRN_TRUE
   564    //***
   565    External_Function32 DrawEllipMm "DrawEllipMm" DFPRINT.DLL;
   566        Integer iPNr;
   567        Integer iLTX;
   568        Integer iLTY;
   569        Integer iRBX;
   570        Integer iRBY;
   571        Dword   dBC;
   572        Dword   dFC;
   573        Integer iFi;
   574        Integer iW;
   575        Integer iUCp;
   576        Integer iWr;
   577        Returns Integer
   578
   579
   580    //*** Writes an rectangle to a pagenumber at a given position in Inch
   581    //*** from left margin. The pos param. you have to send is upper left
   582    //*** and down right.dwBColor is boarder color, dwFillColor is fill color
   583    //*** If iFill is true the ellipsen will be filled of it´s false it will
   584    //*** be transparent.iW is weight and iWr is wrap.
   585    //*** Returns PRN_FALSE=Error or PRN_TRUE
   586    //***
   587    External_Function32 DrawRectInch "DrawRectInch" DFPRINT.DLL;
   588        Integer iPNr;
   589        Integer iLTX;
   590        Integer iLTY;
   591        Integer iRBX;
   592        Integer iRBY;
   593        Dword   dBC;
   594        Dword   dFC;
   595        Integer iFi;
   596        Integer iW;
   597        Integer iUCp;
   598        Integer iWr;
   599        Returns Integer
   600
   601
   602    //*** Writes an rectangle to a pagenumber at a given position in CM
   603    //*** from left margin. The pos param. you have to send is upper left
   604    //*** and down right.dwBColor is boarder color, dwFillColor is fill color
   605    //*** If iFill is true the ellipsen will be filled of it´s false it will
   606    //*** be transparent.iW is weight and iWr is wrap.
   607    //*** Returns PRN_FALSE=Error or PRN_TRUE
   608    //***
   609    External_Function32 DrawRectMm "DrawRectMm" DFPRINT.DLL;
   610        Integer iPNr;
   611        Integer iLTX;
   612        Integer iLTY;
   613        Integer iRBX;
   614        Integer iRBY;
   615        Dword   dBC;
   616        Dword   dFC;
   617        Integer iFi;
   618        Integer iW;
   619        Integer iUCp;
   620        Integer iWr;
   621        Returns Integer
   622
   623
   624    //*** Check if a certain number of lines fits the page, if not print a
   625    //*** new page before printing..
   626    //***
   627    //*** Returns PRN_FALSE=Error or PRN_TRUE
   628    //***
   629    External_Function32 ConfirmLines "ConfirmLines"  DFPRINT.DLL ;
   630        Integer iPageNr;
   631        Integer iLines;
   632        Returns Integer
   633
   634
   635    //*** Creates a diagram of the type DFGR_?? with the effects of the
   636    //*** type DFGR_??. Returns a unique number for the diagram.
   637    //*** The returned ID is used by the other diagram functions. The
   638    //*** size of the diagram is set in Inch.
   639    //***
   640    //*** Returns Diagram Id or PRN_FALSE=Error
   641    //***
   642    External_Function32 CreateDiagramInch "CreateDiagramInch"  DFPRINT.DLL ;
   643        Integer iType;
   644        Integer iFx;
   645        Integer iWidth;
   646        Integer iHeight;
   647        Integer iXyAxis;
   648        Returns Integer
   649
   650
   651    //*** Creates a diagram of the type DFGR_?? with the effects of the
   652    //*** type DFGR_??. Returns a unique number for the diagram.
   653    //*** The returned ID is used by the other diagram functions. The
   654    //*** size of the diagram is set in cm.
   655    //***
   656    //*** Returns Diagram Id or PRN_FALSE=Error
   657    //***
   658    External_Function32 CreateDiagramMm "CreateDiagramMm"  DFPRINT.DLL ;
   659        Integer iType;
   660        Integer iFx;
   661        Integer iWidth;
   662        Integer iHeight;
   663        Integer iXyAxis;
   664        Returns Integer
   665
   666
   667    //*** Locks a specified diagram so it can´t take any more entrys.
   668    //***
   669    //*** Returns PRN_FALSE=Error or PRN_TRUE
   670    //***
   671    External_Function32 LockDiagram "LockDiagram"  DFPRINT.DLL ;
   672        Integer iDId;
   673        Returns Integer
   674
   675
   676    //*** Adds an entry to a specified diagram (ID from CreateDiagram)
   677    //*** iDId is the id of the diagram
   678    //*** sTxt is a describing text for the value
   679    //*** iTxtLen is the len of the DataFlex string
   680    //*** iValue is an integer value for the diagram !!!!
   681    //*** dwBcolor is the boarder color
   682    //*** dwFcolor is the fill color
   683    //*** iFill is DFGR_FILL or DFGR_TRAN
   684    //*** iDec tells how mwny decimals you want on a value
   685    //*** iVP tells if you want no value, value or percent
   686    //*** iExt  is DFGR_IN or DFGR_OUT pulls the pie out in circel diagram
   687    //***
   688    //*** Returns Diagram Id or PRN_FALSE=Error
   689    //***
   690    External_Function32 AddDiagramEntry "AddDiagramEntry" DFPRINT.DLL;
   691        Integer iDId;
   692        String  sT;
   693        Integer iTL;
   694        String  sV;
   695        Integer iVL;
   696        Dword   dBC;
   697        Dword   dFC;
   698        Integer iFil;
   699        Integer iDec;
   700        integer iVP;
   701        Integer iExt;
   702        Returns Integer
   703
   704
   705    //*** Writes the diagram to a page at the current line at a
   706    //*** specified position. Using INCH
   707    //***
   708    //*** Returns PRN_FALSE=Error or PRN_TRUE
   709    //***
   710    //SF 11/07/97 - Added an extra param.
   711    External_Function32 DrawDiagramToPageInch "DrawDiagramToPageInch"  DFPRINT.DLL ;
   712        Integer iPageNr;
   713        Integer iDId;
   714        Integer ixPos;
   715        Integer iyPos;
   716        Integer iUCp;
   717        Returns Integer
   718
   719
   720    //*** Writes the diagram to a page at the current line at a
   721    //*** specified position. Using CM
   722    //***
   723    //*** Returns PRN_FALSE=Error or PRN_TRUE
   724    //***
   725    //SF 11/07/97 - Added an extra param.
   726    External_Function32 DrawDiagramToPageMm "DrawDiagramToPageMm"  DFPRINT.DLL ;
   727        Integer iPageNr;
   728        Integer iDId;
   729        Integer ixPos;
   730        Integer iyPos;
   731        Integer iUCp;
   732        Returns Integer
   733
   734
   735    //*** Sets the caption of a diagram with the last used font
   736    //***
   737    //*** Returns PRN_FALSE=Error or PRN_TRUE
   738    //***
   739    External_Function32 SetDiagramCaption "SetDiagramCaption"  DFPRINT.DLL ;
   740        Integer iDId;
   741        String  sText;
   742        Integer iTextLen;
   743        Returns Integer
   744
   745
   746    //*** Sets the horizontal caption of a diagram.
   747    //***
   748    //*** Returns PRN_FALSE=Error or PRN_TRUE
   749    //***
   750    External_Function32 SetDiagramXText "SetDiagramXText"  DFPRINT.DLL ;
   751        Integer iDId;
   752        String  sText;
   753        Integer iTextLen;
   754        Returns Integer
   755
   756
   757    //*** Sets the vertical caption of a diagram.
   758    //***
   759    //*** Returns PRN_FALSE=Error or PRN_TRUE
   760    //***
   761    External_Function32 SetDiagramYText "SetDiagramYText"  DFPRINT.DLL ;
   762        Integer iDId;
   763        String  sText;
   764        Integer iTextLen;
   765        Integer iVert;
   766        Returns Integer
   767
   768
   769    //*** Draws i line to a page. Using XY cords ONLY with color
   770    //*** weight and wrap using inch as metrics.
   771    //***
   772    //*** Returns PRN_FALSE=Error or PRN_TRUE
   773    //***
   774    External_Function32 DrawXYLineInch "DrawXYLineInch"  DFPRINT.DLL ;
   775        Integer iPageNr;
   776        Integer iFromX;
   777        Integer iFromY;
   778        Integer iToX;
   779        Integer iToY;
   780        Dword   dwColor;
   781        Integer iWeight;
   782        Integer iUCp;
   783        Integer iWrap;
   784        Returns Integer
   785
   786
   787    //*** Draws i line to a page. Using XY cords ONLY with color
   788    //*** weight and wrap using cm as metrics.
   789    //***
   790    //*** Returns PRN_FALSE=Error or PRN_TRUE
   791    //***
   792    External_Function32 DrawXYLineMm "DrawXYLineMm"  DFPRINT.DLL ;
   793        Integer iPageNr;
   794        Integer iFromX;
   795        Integer iFromY;
   796        Integer iToX;
   797        Integer iToY;
   798        Dword   dwColor;
   799        Integer iWeight;
   800        Integer iUCp;
   801        Integer iWrap;
   802        Returns Integer
   803
   804
   805    //*** Draws i line to a page. Using XY cords and length with color
   806    //*** weight and NO wrap using inch as metrics.
   807    //***
   808    //*** Returns PRN_FALSE=Error or PRN_TRUE
   809    //***
   810    External_Function32 DrawLineInch "DrawLineInch"  DFPRINT.DLL ;
   811        Integer iPageNr;
   812        Integer iFromX;
   813        Integer iFromY;
   814        Integer iLength;
   815        Integer iHorVer;
   816        Dword   dwColor;
   817        Integer iWeight;
   818        Integer iUCp;
   819        Returns Integer
   820
   821
   822    //*** Draws i line to a page. Using XY cords and length with color
   823    //*** weight and NO wrap using cm as metrics.
   824    //***
   825    //*** Returns PRN_FALSE=Error or PRN_TRUE
   826    //***
   827    External_Function32 DrawLineMm "DrawLineMm"  DFPRINT.DLL ;
   828        Integer iPageNr;
   829        Integer iFromX;
   830        Integer iFromY;
   831        Integer iLength;
   832        Integer iHorVer;
   833        Dword   dwColor;
   834        Integer iWeight;
   835        Integer iUCp;
   836        Returns Integer
   837
   838
   839    //*** Clears the printer and all resurces used by Windows,
   840    //*** prepares for a new document.
   841    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   842    //***
   843    External_Function32 ClearPrinter "ClearPrinter"  DFPRINT.DLL ;
   844        Returns Integer
   845
   846
   847
   848    //*** Retrieves the driver name of the currently selected printer.
   849    //*** The param is a pointer to a DF string
   850    //***
   851    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   852    //***
   853    External_Function32 GetCurrentDriver "GetCurrentDriver"  DFPRINT.DLL ;
   854        Pointer pDrvStr;
   855        Returns Integer
   856
   857
   858    //*** Retrieves the device name of the currently selected printer.
   859    //*** The param is a pointer to a DF string
   860    //***
   861    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   862    //***
   863    External_Function32 GetCurrentDevice "GetCurrentDevice"  DFPRINT.DLL ;
   864        Pointer pDevStr;
   865        Returns Integer
   866
   867
   868    //*** Retrieves the output port that the currently selected printer
   869    //*** is mapped to.
   870    //*** The param is a pointer to a DF string
   871    //***
   872    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   873    //***
   874    External_Function32 GetCurrentPort "GetCurrentPort"  DFPRINT.DLL ;
   875        Pointer pPortStr;
   876        Returns Integer
   877
   878
   879    //*** Retrieves the printer options set in Print Dialog and Print Setup.
   880    //*** The return value is a combination of all flags.
   881    //***
   882    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   883    //***
   884    External_Function32 GetPrintDialogFlags "GetPrintDialogFlags"  DFPRINT.DLL ;
   885        Returns Dword
   886
   887
   888    //*** Retrieves the user defined papersize. This function is only valid
   889    //*** DF_PAPER_USER flag is set.
   890    //***
   891    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   892    //***
   893    External_Function32 GetUserDefinedPapersize "GetUserDefinedPapersize"  DFPRINT.DLL ;
   894        Returns Integer
   895
   896
   897    //*** Sets the user defined papersize. This function is only valid
   898    //*** DF_PAPER_USER flag is set.
   899    //***
   900    //*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   901    //***
   902    External_Function32 SetUserDefinedPapersize "SetUserDefinedPapersize"  DFPRINT.DLL ;
   903        Integer iPSize;
   904        Returns Integer
   905
   906
   907    //*** To check if a specific flag is set or not.
   908    //***
   909    //*** Returns PRN_TRUE=  if the flag is set
   910    //*** Returns PRN_FALSE= If the flag not is set
   911    //***
   912    External_Function32 IsPrintDialogFlag "IsPrintDialogFlag"  DFPRINT.DLL ;
   913        Dword   dwPDFlag;
   914        Returns Integer
   915
   916
   917    //*** Allows you to set a single print dialog flag.
   918    //***
   919    //*** Returns PRN_TRUE=  Ok
   920    //*** Returns PRN_FALSE= Error
   921    //***
   922    External_Function32 SetSpecificPrintDialogFlag "SetSpecificPrintDialogFlag"  DFPRINT.DLL ;
   923        Dword   dwPDFlag;
   924        Returns Integer
   925
   926
   927    //*** Allows you to set the number of copies to be printed.
   928    //***
   929    //*** Returns PRN_TRUE=  Ok
   930    //*** Returns PRN_FALSE= Error
   931    //***
   932    External_Function32 SetNumberOfPrintCopies "SetNumberOfPrintCopies"  DFPRINT.DLL ;
   933        Integer iNrOfCopies;
   934        Returns Integer
   935
   936
   937    //*** Our intention was to be able to use escape seq from WinPrint
   938    //*** but for some reasons the PASSTHRUE is not working. It will
   939    //*** MAYBE be implemented later.
   940
   941    ////*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   942    ////***
   943    //External_Function32 WriteEscape "WriteEscape"  DFPRINT.DLL ;
   944    //    Integer iPageNr;
   945    //    Integer iEsc;
   946    //    String  sSeq;
   947    //    Integer iSeqlen;
   948    //    Returns Integer
   949    //
   950    //
   951    ////*** Returns PRN_TRUE=Ok PRN_FALSE=Cancel
   952    ////***
   953    //External_Function32 QueryWriteEscape "QueryWriteEscape"  DFPRINT.DLL ;
   954    //    Integer iEsc;
   955    //    Returns Integer
   956    //
   957
   958
   959
   960    //************************************************************************//
   961    //                                                                        //
   962    // $Module type: CLASS                                                    //
   963    // $Module name: DF_PRINTER                                               //
   964    // $Author     : Janne Wassberg                                           //
   965    // Created     : 96-01-30 @ 20.39.19                                      //
   966    //                                                                        //
   967    // Description Class for Windows printsystem and DataFlex 3.05 and 4.x    //
   968    //                                                                        //
   969    //                                                                        //
   970    //                                                                        //
   971    // $Rev History                                                           //
   972    //   96-04-23 Ready for version 1.1                                       //
   973    //   96-01-30 Module header created                                       //
   974    //                                                                        //
   975    //************************************************************************//
   976
   977    { Visibility=Private }
   978    Class DF_Printer is a dfBasePanel  // This will have a handle. //JT
   979        Procedure Construct_Object
   980            forward send construct_object
   981
   982            Object oDFColorArray is an Array
   983               //Moved into array
   984               Set Array_Value  Item 0  To RGB_WHITE
   985               Set Array_Value  Item 1  To RGB_RED
   986               Set Array_Value  Item 2  To RGB_BLUE
   987               Set Array_Value  Item 3  To RGB_GREEN
   988               Set Array_Value  Item 4  To RGB_YELLOW
   989               Set Array_Value  Item 5  To RGB_GREY
   990               Set Array_Value  Item 6  To RGB_CYAN
   991               Set Array_Value  Item 7  To RGB_MAGENTA
   992               Set Array_Value  Item 8  To RGB_DRED
   993               Set Array_Value  Item 9  To RGB_DBLUE
   994               Set Array_Value  Item 10 To RGB_DGREEN
   995               Set Array_Value  Item 11 To RGB_DYELLOW
   996               Set Array_Value  Item 12 To RGB_DGREY
   997               Set Array_Value  Item 13 To RGB_DCYAN
   998               Set Array_Value  Item 14 To RGB_DMAGENTA
   999               Set Array_Value  Item 15 To RGB_BLACK
  1000            End_Object
  1001
  1002            //*** You can use CM or INCH
  1003            Property String  DFCurrent_Metrics "CM"
  1004
  1005            //*** internal properties
  1006            Property Integer DFCurrent_Color      0
  1007            Property String  DFCurrent_OutPut     "WinPrint"
  1008            Property Integer DFCurrent_Page       0
  1009            Property Integer DFCurrent_Diagram    0
  1010            Property Integer DFCurrent_HeaderType 0
  1011            Property Integer DFCurrent_HeaderNr   0
  1012            Property Number  DFCurrent_FontSize   10
  1013            Property String  DFCurrent_Font       "Arial"
  1014
  1015            //*** Default values for margins 2.53 CM = 1 inch
  1016            Property Number  DFLeft_Margin   2.53
  1017            Property Number  DFTop_Margin    2.53
  1018            Property Number  DFright_Margin  2.53
  1019            Property Number  DFBottom_Margin 2.53
  1020
  1021            //*** Internal object counters
  1022            Property Integer DFPageTopCount       0
  1023            Property Integer DFReportHeaderCount  0
  1024            Property Integer DFPageHeaderCount    0
  1025            Property Integer DFPageTitleCount     0
  1026            Property Integer DFTotalCount         0
  1027            Property Integer DFPageTotalCount     0
  1028            Property Integer DFPageFooterCount    0
  1029            Property Integer DFReportFooterCount  0
  1030            Property Integer DFPageBottomCount    0
  1031
  1032            //*** Can be increased to a maximum of 20 for
  1033            //*** each sub. The DLL handles 20 options
  1034            //*** If you increase them to more then 9
  1035            //*** options you also have to change the
  1036            //*** functions for Zero and Calculation
  1037            //***
  1038            Property Integer DFSubHeader1Count    0
  1039            Property Integer DFSubHeader2Count    0
  1040            Property Integer DFSubHeader3Count    0
  1041            Property Integer DFSubHeader4Count    0
  1042            Property Integer DFSubHeader5Count    0
  1043            Property Integer DFSubHeader6Count    0
  1044            Property Integer DFSubHeader7Count    0
  1045            Property Integer DFSubHeader8Count    0
  1046            Property Integer DFSubHeader9Count    0
  1047            Property Integer DFSubTotal1Count     0
  1048            Property Integer DFSubTotal2Count     0
  1049            Property Integer DFSubTotal3Count     0
  1050            Property Integer DFSubTotal4Count     0
  1051            Property Integer DFSubTotal5Count     0
  1052            Property Integer DFSubTotal6Count     0
  1053            Property Integer DFSubTotal7Count     0
  1054            Property Integer DFSubTotal8Count     0
  1055            Property Integer DFSubTotal9Count     0
  1056
  1057            Property Integer PrintDlgInPreview  0
  1058            Property Integer EnablePrintSetupFromPreview  1
  1059            Property Integer EnablePrintFromPreview  1
  1060
  1061            Object oDiagramArray is an Array
  1062            End_Object
  1063        End_Procedure
  1064
  1065        Procedure Destroy_Object
  1066            Forward Send Destroy_Object
  1067        End_Procedure
  1068
  1069        Procedure DFZeroCounters
  1070            Set DFPageTopCount      To  0
  1071            Set DFReportHeaderCount To  0
  1072            Set DFPageHeaderCount   To  0
  1073            Set DFPageTitleCount    To  0
  1074            Set DFTotalCount        To  0
  1075            Set DFPageTotalCount    To  0
  1076            Set DFPageFooterCount   To  0
  1077            Set DFReportFooterCount To  0
  1078            Set DFPageBottomCount   To  0
  1079
  1080            Set DFSubHeader1Count   To  0
  1081            Set DFSubHeader2Count   To  0
  1082            Set DFSubHeader3Count   To  0
  1083            Set DFSubHeader4Count   To  0
  1084            Set DFSubHeader5Count   To  0
  1085            Set DFSubHeader6Count   To  0
  1086            Set DFSubHeader7Count   To  0
  1087            Set DFSubHeader8Count   To  0
  1088            Set DFSubHeader9Count   To  0
  1089
  1090            Set DFSubTotal1Count    To  0
  1091            Set DFSubTotal2Count    To  0
  1092            Set DFSubTotal3Count    To  0
  1093            Set DFSubTotal4Count    To  0
  1094            Set DFSubTotal5Count    To  0
  1095            Set DFSubTotal6Count    To  0
  1096            Set DFSubTotal7Count    To  0
  1097            Set DFSubTotal8Count    To  0
  1098            Set DFSubTotal9Count    To  0
  1099        End_Procedure
  1100
  1101        //Only for internal use
  1102        Function DFCalcCounters Integer HeaderNr Integer HeaderType Returns Integer
  1103            Integer iCounter
  1104
  1105            If HeaderType Eq DFPageTop Begin
  1106                Get DFPageTopCount To iCounter
  1107                Move (iCounter+1) To iCounter
  1108                Set DFPageTopCount To iCounter
  1109                Function_Return iCounter
  1110            End
  1111            If HeaderType Eq DFReportHeader Begin
  1112                Get DFReportHeaderCount To iCounter
  1113                Move (iCounter+1) To iCounter
  1114                Set DFReportHeaderCount To iCounter
  1115                Function_Return iCounter
  1116            End
  1117            If ((HeaderType Eq DFPageHeader) or (HeaderType Eq DFPageHeader2)) Begin
  1118                Get DFPageHeaderCount To iCounter
  1119                Move (iCounter+1) To iCounter
  1120                Set DFPageHeaderCount To iCounter
  1121                Function_Return iCounter
  1122            End
  1123            If HeaderType Eq DFPageTitle Begin
  1124                Get DFPageTitleCount To iCounter
  1125                Move (iCounter+1) To iCounter
  1126                Set DFPageTitleCount To iCounter
  1127                Function_Return iCounter
  1128            End
  1129            If HeaderType Eq DFTotal Begin
  1130                Get DFTotalCount To iCounter
  1131                Move (iCounter+1) To iCounter
  1132                Set DFTotalCount To iCounter
  1133                Function_Return iCounter
  1134            End
  1135            If HeaderType Eq DFPageTotal Begin
  1136                Get DFPageTotalCount To iCounter
  1137                Move (iCounter+1) To iCounter
  1138                Set DFPageTotalCount To iCounter
  1139                Function_Return iCounter
  1140            End
  1141            If HeaderType Eq DFPageFooter Begin
  1142                Get DFPageFooterCount To iCounter
  1143                Move (iCounter+1) To iCounter
  1144                Set DFPageFooterCount To iCounter
  1145                Function_Return iCounter
  1146            End
  1147            If HeaderType Eq DFReportFooter Begin
  1148                Get DFReportFooterCount To iCounter
  1149                Move (iCounter+1) To iCounter
  1150                Set DFReportFooterCount To iCounter
  1151                Function_Return iCounter
  1152            End
  1153            If HeaderType Eq DFPageBottom Begin
  1154                Get DFPageBottomCount To iCounter
  1155                Move (iCounter+1) To iCounter
  1156                Set DFPageBottomCount To iCounter
  1157                Function_Return iCounter
  1158            End
  1159
  1160            If HeaderType Eq DFSubHeader Begin
  1161
  1162                If HeaderNr Eq 1 Begin
  1163                    Get DFSubHeader1Count To iCounter
  1164                    Move (iCounter+1) To iCounter
  1165                    Set DFSubHeader1Count To iCounter
  1166                    Function_Return iCounter
  1167                End
  1168                If HeaderNr Eq 2 Begin
  1169                    Get DFSubHeader2Count To iCounter
  1170                    Move (iCounter+1) To iCounter
  1171                    Set DFSubHeader2Count To iCounter
  1172                    Function_Return iCounter
  1173                End
  1174                If HeaderNr Eq 3 Begin
  1175                    Get DFSubHeader3Count To iCounter
  1176                    Move (iCounter+1) To iCounter
  1177                    Set DFSubHeader3Count To iCounter
  1178                    Function_Return iCounter
  1179                End
  1180                If HeaderNr Eq 4 Begin
  1181                    Get DFSubHeader4Count To iCounter
  1182                    Move (iCounter+1) To iCounter
  1183                    Set DFSubHeader4Count To iCounter
  1184                    Function_Return iCounter
  1185                End
  1186                If HeaderNr Eq 5 Begin
  1187                    Get DFSubHeader5Count To iCounter
  1188                    Move (iCounter+1) To iCounter
  1189                    Set DFSubHeader5Count To iCounter
  1190                    Function_Return iCounter
  1191                End
  1192                If HeaderNr Eq 6 Begin
  1193                    Get DFSubHeader6Count To iCounter
  1194                    Move (iCounter+1) To iCounter
  1195                    Set DFSubHeader6Count To iCounter
  1196                    Function_Return iCounter
  1197                End
  1198                If HeaderNr Eq 7 Begin
  1199                    Get DFSubHeader7Count To iCounter
  1200                    Move (iCounter+1) To iCounter
  1201                    Set DFSubHeader7Count To iCounter
  1202                    Function_Return iCounter
  1203                End
  1204                If HeaderNr Eq 8 Begin
  1205                    Get DFSubHeader8Count To iCounter
  1206                    Move (iCounter+1) To iCounter
  1207                    Set DFSubHeader8Count To iCounter
  1208                    Function_Return iCounter
  1209                End
  1210                If HeaderNr Eq 9 Begin
  1211                    Get DFSubHeader9Count To iCounter
  1212                    Move (iCounter+1) To iCounter
  1213                    Set DFSubHeader9Count To iCounter
  1214                    Function_Return iCounter
  1215                End
  1216
  1217            End
  1218
  1219            If HeaderType Eq DFSubTotal Begin
  1220
  1221                If HeaderNr Eq 1 Begin
  1222                    Get DFSubTotal1Count To iCounter
  1223                    Move (iCounter+1) To iCounter
  1224                    Set DFSubTotal1Count To iCounter
  1225                    Function_Return iCounter
  1226                End
  1227                If HeaderNr Eq 2 Begin
  1228                    Get DFSubTotal2Count To iCounter
  1229                    Move (iCounter+1) To iCounter
  1230                    Set DFSubTotal2Count To iCounter
  1231                    Function_Return iCounter
  1232                End
  1233                If HeaderNr Eq 3 Begin
  1234                    Get DFSubTotal3Count To iCounter
  1235                    Move (iCounter+1) To iCounter
  1236                    Set DFSubTotal3Count To iCounter
  1237                    Function_Return iCounter
  1238                End
  1239                If HeaderNr Eq 4 Begin
  1240                    Get DFSubTotal4Count To iCounter
  1241                    Move (iCounter+1) To iCounter
  1242                    Set DFSubTotal4Count To iCounter
  1243                    Function_Return iCounter
  1244                End
  1245                If HeaderNr Eq 5 Begin
  1246                    Get DFSubTotal5Count To iCounter
  1247                    Move (iCounter+1) To iCounter
  1248                    Set DFSubTotal5Count To iCounter
  1249                    Function_Return iCounter
  1250                End
  1251                If HeaderNr Eq 6 Begin
  1252                    Get DFSubTotal6Count To iCounter
  1253                    Move (iCounter+1) To iCounter
  1254                    Set DFSubTotal6Count To iCounter
  1255                    Function_Return iCounter
  1256                End
  1257                If HeaderNr Eq 7 Begin
  1258                    Get DFSubTotal7Count To iCounter
  1259                    Move (iCounter+1) To iCounter
  1260                    Set DFSubTotal7Count To iCounter
  1261                    Function_Return iCounter
  1262                End
  1263                If HeaderNr Eq 8 Begin
  1264                    Get DFSubTotal8Count To iCounter
  1265                    Move (iCounter+1) To iCounter
  1266                    Set DFSubTotal8Count To iCounter
  1267                    Function_Return iCounter
  1268                End
  1269                If HeaderNr Eq 9 Begin
  1270                    Get DFSubTotal9Count To iCounter
  1271                    Move (iCounter+1) To iCounter
  1272                    Set DFSubTotal9Count To iCounter
  1273                    Function_Return iCounter
  1274                End
  1275
  1276            End
  1277
  1278            Function_Return PRN_FALSE
  1279        End_Function
  1280
  1281        //*** Only for internal use
  1282        Function DFCurrentCounters Integer HeaderNr Integer HeaderType Returns Integer
  1283            Integer iCounter
  1284
  1285            If HeaderType Eq DFPageTop Begin
  1286                Get DFPageTopCount To iCounter
  1287                Function_Return iCounter
  1288            End
  1289            If HeaderType Eq DFReportHeader Begin
  1290                Get DFReportHeaderCount To iCounter
  1291                Function_Return iCounter
  1292            End
  1293            If ((HeaderType Eq DFPageHeader) or (HeaderType Eq DFPageHeader2)) Begin
  1294                Get DFPageHeaderCount To iCounter
  1295                Function_Return iCounter
  1296            End
  1297            If HeaderType Eq DFPageTitle Begin
  1298                Get DFPageTitleCount To iCounter
  1299                Function_Return iCounter
  1300            End
  1301            If HeaderType Eq DFTotal Begin
  1302                Get DFTotalCount To iCounter
  1303                Function_Return iCounter
  1304            End
  1305            If HeaderType Eq DFPageTotal Begin
  1306                Get DFPageTotalCount To iCounter
  1307                Function_Return iCounter
  1308            End
  1309            If HeaderType Eq DFPageFooter Begin
  1310                Get DFPageFooterCount To iCounter
  1311                Function_Return iCounter
  1312            End
  1313            If HeaderType Eq DFReportFooter Begin
  1314                Get DFReportFooterCount To iCounter
  1315                Function_Return iCounter
  1316            End
  1317            If HeaderType Eq DFPageBottom Begin
  1318                Get DFPageBottomCount To iCounter
  1319                Function_Return iCounter
  1320            End
  1321
  1322
  1323            If HeaderType Eq DFSubHeader Begin
  1324
  1325                If HeaderNr Eq 1 Begin
  1326                    Get DFSubHeader1Count To iCounter
  1327                    Function_Return iCounter
  1328                End
  1329                If HeaderNr Eq 2 Begin
  1330                    Get DFSubHeader2Count To iCounter
  1331                    Function_Return iCounter
  1332                End
  1333                If HeaderNr Eq 3 Begin
  1334                    Get DFSubHeader3Count To iCounter
  1335                    Function_Return iCounter
  1336                End
  1337                If HeaderNr Eq 4 Begin
  1338                    Get DFSubHeader4Count To iCounter
  1339                    Function_Return iCounter
  1340                End
  1341                If HeaderNr Eq 5 Begin
  1342                    Get DFSubHeader5Count To iCounter
  1343                    Function_Return iCounter
  1344                End
  1345                If HeaderNr Eq 6 Begin
  1346                    Get DFSubHeader6Count To iCounter
  1347                    Function_Return iCounter
  1348                End
  1349                If HeaderNr Eq 7 Begin
  1350                    Get DFSubHeader7Count To iCounter
  1351                    Function_Return iCounter
  1352                End
  1353                If HeaderNr Eq 8 Begin
  1354                    Get DFSubHeader8Count To iCounter
  1355                    Function_Return iCounter
  1356                End
  1357                If HeaderNr Eq 9 Begin
  1358                    Get DFSubHeader9Count To iCounter
  1359                    Function_Return iCounter
  1360                End
  1361
  1362            End
  1363
  1364            If HeaderType Eq DFSubTotal Begin
  1365
  1366                If HeaderNr Eq 1 Begin
  1367                    Get DFSubTotal1Count To iCounter
  1368                    Function_Return iCounter
  1369                End
  1370                If HeaderNr Eq 2 Begin
  1371                    Get DFSubTotal2Count To iCounter
  1372                    Function_Return iCounter
  1373                End
  1374                If HeaderNr Eq 3 Begin
  1375                    Get DFSubTotal3Count To iCounter
  1376                    Function_Return iCounter
  1377                End
  1378                If HeaderNr Eq 4 Begin
  1379                    Get DFSubTotal4Count To iCounter
  1380                    Function_Return iCounter
  1381                End
  1382                If HeaderNr Eq 5 Begin
  1383                    Get DFSubTotal5Count To iCounter
  1384                    Function_Return iCounter
  1385                End
  1386                If HeaderNr Eq 6 Begin
  1387                    Get DFSubTotal6Count To iCounter
  1388                    Function_Return iCounter
  1389                End
  1390                If HeaderNr Eq 7 Begin
  1391                    Get DFSubTotal7Count To iCounter
  1392                    Function_Return iCounter
  1393                End
  1394                If HeaderNr Eq 8 Begin
  1395                    Get DFSubTotal8Count To iCounter
  1396                    Function_Return iCounter
  1397                End
  1398                If HeaderNr Eq 9 Begin
  1399                    Get DFSubTotal9Count To iCounter
  1400                    Function_Return iCounter
  1401                End
  1402
  1403            End
  1404
  1405            Function_Return PRN_FALSE
  1406        End_Function
  1407
  1408
  1409        //***
  1410        Function DFNewPage Integer Columns Returns Integer
  1411            Integer iRetVal
  1412
  1413            Move (CreatePage(Columns)) To iRetVal
  1414
  1415            If iRetVal Ne PRN_FALSE Begin
  1416                Set DFCurrent_Page to iRetVal
  1417                Function_Return iRetVal
  1418            End
  1419            If iRetVal Eq PRN_FALSE Begin
  1420                Set DFCurrent_Page to iRetVal
  1421                Error DFERR_WINPRINT DFPrintError900
  1422                Function_Return iRetVal
  1423            End
  1424        End_Function
  1425
  1426        //JT
  1427        //***Return handle to use for winprint dialog. If main_window
  1428        //   exists, use it. Else, get object's handle
  1429        Function Report_Window_Handle returns handle
  1430           Integer hWnd Obj
  1431           Get Main_window of desktop to Obj
  1432           If Obj ;
  1433              Get Window_Handle of Obj to hWnd
  1434           If hWnd eq 0  ;
  1435              Get Window_Handle to hWnd
  1436           function_return hWnd
  1437        End_Function
  1438
  1439
  1440        //***
  1441        Function DFPrintDialog Returns Integer
  1442            Pointer hwnd
  1443            Integer iRetVal
  1444
  1445            //Move (Container_Handle(Parent(self))) to hwnd
  1446            Get Report_Window_Handle to hWnd //JT
  1447            Move (ExecutePrintDialog(hwnd)) To iRetVal
  1448
  1449            Function_Return iRetVal
  1450        End_Function
  1451
  1452
  1453        //***
  1454        Procedure DFPrintSetup
  1455            Pointer hwnd
  1456            Integer iRetVal
  1457
  1458            //Move (Container_Handle(Parent(self))) to hwnd
  1459            Get Report_Window_Handle to hWnd //JT
  1460            Move (ExecutePrintSetup(hwnd)) To iRetVal
  1461
  1462            If iRetVal Eq PRN_TRUE Begin
  1463            End
  1464            If iRetVal Eq PRN_FALSE Begin
  1465            End
  1466        End_Procedure
  1467
  1468
  1469        //***
  1470        Procedure DFPreview
  1471            Pointer hwnd
  1472            Integer iRetVal
  1473            Integer bPrntDlg bPrintSetup bPrint
  1474            //Move (Container_Handle(Parent(self))) to hwnd
  1475            Get Report_Window_Handle to hWnd //JT
  1476            Get PrintDlgInPreview to bPrntDlg
  1477            Get EnablePrintSetupFromPreview to bPrintSetup
  1478            Get EnablePrintFromPreview to bPrint
  1479
  1480            // As of 12.0 we are disabling the new disable logic before invokign the previewer and then
  1481            // restoring it. This old previewer gets disabled by the window disable logic. If this was not
  1482            // an obsolete class, we'd change the viewer, but as an old class this is the best choice.
  1483
  1484            Send EnableNewModalityLogic of Desktop False
  1485            Move (PreviewDocumentEx2(hwnd,bPrntDlg,bPrintSetup,bPrint)) To iRetVal
  1486            Send EnableNewModalityLogic of Desktop True
  1487
  1488            If iRetVal Eq PRN_TRUE Begin
  1489            End
  1490            If iRetVal Eq PRN_FALSE Begin
  1491                Error DFERR_WINPRINT DFPrintError901
  1492            End
  1493        End_Procedure
  1494
  1495
  1496        //***
  1497        Procedure DFPrintDoc
  1498            Pointer hwnd
  1499            Integer iRetVal
  1500
  1501            //Move (Container_Handle(Parent(self))) to hwnd
  1502            Get Report_Window_Handle to hWnd //JT
  1503            Move (PrintDocument(hwnd)) To iRetVal
  1504
  1505            If iRetVal Eq PRN_TRUE Begin
  1506            End
  1507            If iRetVal Eq PRN_FALSE Begin
  1508                Error DFERR_WINPRINT DFPrintError902
  1509            End
  1510        End_Procedure
  1511
  1512
  1513        //***
  1514        Procedure DFClearDoc
  1515            Integer iRetVal
  1516
  1517            Move (ClearDocument()) To iRetVal
  1518
  1519            If iRetVal Eq PRN_TRUE Begin
  1520            End
  1521            If iRetVal Eq PRN_FALSE Begin
  1522                Error DFERR_WINPRINT DFPrintError903
  1523            End
  1524        End_Procedure
  1525
  1526
  1527        //***
  1528        Procedure DFSetFont String FontName
  1529            Integer iRetVal
  1530            Integer iFlen
  1531
  1532            Move (Length(FontName)) To iFlen
  1533            Move (SetFont(FontName,iFlen)) To iRetVal
  1534
  1535            If iRetVal Eq PRN_TRUE Begin
  1536                Set DFCurrent_Font To FontName
  1537            End
  1538            If iRetVal Eq PRN_FALSE Begin
  1539                Error DFERR_WINPRINT DFPrintError904
  1540            End
  1541        End_Procedure
  1542
  1543
  1544        //***
  1545        Procedure DFSetFontSize Integer Height Integer Width
  1546            Integer iRetVal
  1547
  1548            Move (SetFontSize(Height,Width)) To iRetVal
  1549
  1550            If iRetVal Eq PRN_TRUE Begin
  1551                Set DFCurrent_FontSize To Height
  1552            End
  1553            If iRetVal Eq PRN_FALSE Begin
  1554                Error DFERR_WINPRINT  DFPrintError905
  1555            End
  1556        End_Procedure
  1557
  1558
  1559        //***
  1560        Procedure DFSetFontStyle DWORD Style
  1561            Integer iRetVal
  1562
  1563            Move (SetFontStyle(Style)) To iRetVal
  1564
  1565            If iRetVal Eq PRN_TRUE Begin
  1566            End
  1567            If iRetVal Eq PRN_FALSE Begin
  1568                Error DFERR_WINPRINT DFPrintError906
  1569            End
  1570        End_Procedure
  1571
  1572
  1573        //***
  1574        Procedure DFSetUnderline Integer Underline
  1575            Integer iRetVal
  1576
  1577            Move (SetUnderline(Underline)) To iRetVal
  1578
  1579            If iRetVal Eq PRN_TRUE Begin
  1580            End
  1581            If iRetVal Eq PRN_FALSE Begin
  1582                Error DFERR_WINPRINT DFPrintError907
  1583            End
  1584        End_Procedure
  1585
  1586
  1587        //***
  1588        Procedure DFSetBold Integer Bold
  1589            Integer iRetVal
  1590
  1591            Move (SetBold(Bold)) To iRetVal
  1592
  1593            If iRetVal Eq PRN_TRUE Begin
  1594            End
  1595            If iRetVal Eq PRN_FALSE Begin
  1596                Error DFERR_WINPRINT DFPrintError908
  1597            End
  1598        End_Procedure
  1599
  1600
  1601        //***
  1602        Procedure DFSetItalic Integer Italic
  1603            Integer iRetVal
  1604
  1605            Move (SetItalic(Italic)) To iRetVal
  1606
  1607            If iRetVal Eq PRN_TRUE Begin
  1608            End
  1609            If iRetVal Eq PRN_FALSE Begin
  1610                Error DFERR_WINPRINT DFPrintError909
  1611            End
  1612        End_Procedure
  1613
  1614
  1615        //***
  1616        Procedure DFSetStrikeout Integer Strikeout
  1617            Integer iRetVal
  1618
  1619            Move (SetStrikeout(Strikeout)) To iRetVal
  1620
  1621            If iRetVal Eq PRN_TRUE Begin
  1622            End
  1623            If iRetVal Eq PRN_FALSE Begin
  1624                Error DFERR_WINPRINT DFPrintError910
  1625            End
  1626        End_Procedure
  1627
  1628
  1629        //***
  1630        Procedure DFSetMargins Number Left Number Top Number Right Number Bottom
  1631            Integer iRetVal
  1632            String  sMetrics
  1633
  1634            Get DFCurrent_Metrics To sMetrics
  1635
  1636            Move (Left*100)   To Left
  1637            Move (Top*100)    To Top
  1638            Move (Right*100)  To Right
  1639            Move (Bottom*100) To Bottom
  1640
  1641            If sMetrics Eq "CM" Begin
  1642                Move (SetMarginsMm(Left,Top,Right,Bottom)) To iRetVal
  1643            End
  1644            If sMetrics Eq "INCH" Begin
  1645                Move (SetMarginsInch(Left,Top,Right,Bottom)) To iRetVal
  1646            End
  1647
  1648
  1649            If iRetVal Eq PRN_TRUE Begin
  1650                Set DFLeft_Margin   To (Left/100)
  1651                Set DFTop_Margin    To (Top/100)
  1652                Set DFRight_Margin  To (Right/100)
  1653                Set DFBottom_Margin To (Bottom/100)
  1654            End
  1655            If iRetVal Eq PRN_FALSE Begin
  1656                Error DFERR_WINPRINT DFPrintError911
  1657            End
  1658        End_Procedure
  1659
  1660
  1661        //***
  1662        Procedure DFSetLeftMargin Number Left
  1663            Integer iRetVal
  1664            String  sMetrics
  1665            Number  Top Right Bottom
  1666
  1667            Get DFCurrent_Metrics To sMetrics
  1668
  1669            Get DFTop_Margin    To Top
  1670            Get DFRight_Margin  To Right
  1671            Get DFBottom_Margin To Bottom
  1672
  1673            Move (Left*100)   To Left
  1674            Move (Top*100)    To Top
  1675            Move (Right*100)  To Right
  1676            Move (Bottom*100) To Bottom
  1677
  1678            If sMetrics Eq "CM" Begin
  1679                Move (SetMarginsMm(Left,Top,Right,Bottom)) To iRetVal
  1680            End
  1681            If sMetrics Eq "INCH" Begin
  1682                Move (SetMarginsInch(Left,Top,Right,Bottom)) To iRetVal
  1683            End
  1684
  1685
  1686            If iRetVal Eq PRN_TRUE Begin
  1687                Set DFLeft_Margin   To (Left/100)
  1688            End
  1689            If iRetVal Eq PRN_FALSE Begin
  1690                Error DFERR_WINPRINT DFPrintError912
  1691            End
  1692        End_Procedure
  1693
  1694
  1695        //***
  1696        Procedure DFSetRightMargin Number Right
  1697            Integer iRetVal
  1698            String  sMetrics
  1699            Number  Left Top Bottom
  1700
  1701            Get DFCurrent_Metrics To sMetrics
  1702
  1703            Get DFLeft_Margin   To Left
  1704            Get DFTop_Margin    To Top
  1705            Get DFBottom_Margin To Bottom
  1706
  1707            Move (Left*100)   To Left
  1708            Move (Top*100)    To Top
  1709            Move (Right*100)  To Right
  1710            Move (Bottom*100) To Bottom
  1711
  1712            If sMetrics Eq "CM" Begin
  1713                Move (SetMarginsMm(Left,Top,Right,Bottom)) To iRetVal
  1714            End
  1715            If sMetrics Eq "INCH" Begin
  1716                Move (SetMarginsInch(Left,Top,Right,Bottom)) To iRetVal
  1717            End
  1718
  1719
  1720            If iRetVal Eq PRN_TRUE Begin
  1721                Set DFRight_Margin   To (Right/100)
  1722            End
  1723            If iRetVal Eq PRN_FALSE Begin
  1724                Error DFERR_WINPRINT DFPrintError913
  1725            End
  1726        End_Procedure
  1727
  1728
  1729        //***
  1730        Procedure DFSetTopMargin Number Top
  1731            Integer iRetVal
  1732            String  sMetrics
  1733            Number  Left Right Bottom
  1734
  1735            Get DFCurrent_Metrics To sMetrics
  1736
  1737            Get DFLeft_Margin   To Left
  1738            Get DFRight_Margin  To Right
  1739            Get DFBottom_Margin To Bottom
  1740
  1741            Move (Left*100)   To Left
  1742            Move (Top*100)    To Top
  1743            Move (Right*100)  To Right
  1744            Move (Bottom*100) To Bottom
  1745
  1746            If sMetrics Eq "CM" Begin
  1747                Move (SetMarginsMm(Left,Top,Right,Bottom)) To iRetVal
  1748            End
  1749            If sMetrics Eq "INCH" Begin
  1750                Move (SetMarginsInch(Left,Top,Right,Bottom)) To iRetVal
  1751            End
  1752
  1753
  1754            If iRetVal Eq PRN_TRUE Begin
  1755                Set DFTop_Margin   To (Top/100)
  1756            End
  1757            If iRetVal Eq PRN_FALSE Begin
  1758                Error DFERR_WINPRINT DFPrintError914
  1759            End
  1760        End_Procedure
  1761
  1762
  1763        //***
  1764        Procedure DFSetBottomMargin Number Bottom
  1765            Integer iRetVal
  1766            String  sMetrics
  1767            Number  Left Top Right
  1768
  1769            Get DFCurrent_Metrics To sMetrics
  1770
  1771            Get DFLeft_Margin   To Left
  1772            Get DFTop_Margin    To Top
  1773            Get DFRight_Margin  To Right
  1774
  1775            Move (Left*100)   To Left
  1776            Move (Top*100)    To Top
  1777            Move (Right*100)  To Right
  1778            Move (Bottom*100) To Bottom
  1779
  1780            If sMetrics Eq "CM" Begin
  1781                Move (SetMarginsMm(Left,Top,Right,Bottom)) To iRetVal
  1782            End
  1783            If sMetrics Eq "INCH" Begin
  1784                Move (SetMarginsInch(Left,Top,Right,Bottom)) To iRetVal
  1785            End
  1786
  1787
  1788            If iRetVal Eq PRN_TRUE Begin
  1789                Set DFBottom_Margin   To (Bottom/100)
  1790            End
  1791            If iRetVal Eq PRN_FALSE Begin
  1792                Error DFERR_WINPRINT DFPrintError915
  1793            End
  1794        End_Procedure
  1795
  1796
  1797        //***
  1798        Procedure DFWriteToPage Integer Page String sText DWORD iStyle Integer Column Integer Dec
  1799            Integer iRetVal
  1800            Integer iTlen
  1801
  1802            Send DFSetFontStyle iStyle
  1803            Get ToAnsi sText To sText
  1804            Move (Length(sText)) To iTlen
  1805            Move (WriteLineToPage(Page,sText,iTLen,PRN_FALSE,Column,Dec)) To iRetVal
  1806
  1807            If iRetVal Eq PRN_TRUE Begin
  1808            End
  1809            If iRetVal Eq PRN_FALSE Begin
  1810                Error DFERR_WINPRINT DFPrintError916
  1811            End
  1812        End_Procedure
  1813
  1814
  1815        //***
  1816        Procedure DFWritelnToPage Integer Page String sText DWORD iStyle Integer Column Integer Dec
  1817            Integer iRetVal
  1818            Integer iTlen
  1819
  1820            Send DFSetFontStyle iStyle
  1821            Get ToAnsi sText To sText
  1822            Move (Length(sText)) To iTlen
  1823            Move (WriteLineToPage(Page,sText,iTLen,PRN_TRUE,Column,Dec)) To iRetVal
  1824
  1825            If iRetVal Eq PRN_TRUE Begin
  1826            End
  1827            If iRetVal Eq PRN_FALSE Begin
  1828                Error DFERR_WINPRINT DFPrintError917
  1829            End
  1830        End_Procedure
  1831
  1832
  1833        //***
  1834        Procedure DFWrite String sText DWORD iStyle Integer Column Integer Dec
  1835            Integer iRetVal
  1836            Integer CurrPage
  1837            Integer iTlen
  1838
  1839            Get DFCurrent_Page To CurrPage
  1840
  1841            Send DFSetFontStyle iStyle
  1842            Get ToAnsi sText To sText
  1843            Move (Length(sText)) To iTlen
  1844            Move (WriteLineToPage(CurrPage,sText,iTLen,PRN_FALSE,Column,Dec)) To iRetVal
  1845
  1846            If iRetVal Eq PRN_TRUE Begin
  1847            End
  1848            If iRetVal Eq PRN_FALSE Begin
  1849                Error DFERR_WINPRINT DFPrintError918
  1850            End
  1851        End_Procedure
  1852
  1853
  1854        //***
  1855        Procedure DFWriteln String sText DWORD iStyle Integer Column Integer Dec
  1856            Integer iRetVal
  1857            Integer CurrPage
  1858            Integer iTlen
  1859
  1860            Get DFCurrent_Page To CurrPage
  1861
  1862            Send DFSetFontStyle iStyle
  1863            Get ToAnsi sText To sText
  1864            Move (Length(sText)) To iTlen
  1865            Move (WriteLineToPage(CurrPage,sText,iTLen,PRN_TRUE,Column,Dec)) To iRetVal
  1866
  1867            If iRetVal Eq PRN_TRUE Begin
  1868            End
  1869            If iRetVal Eq PRN_FALSE Begin
  1870                Error DFERR_WINPRINT DFPrintError919
  1871            End
  1872        End_Procedure
  1873
  1874
  1875        //***
  1876        Procedure DFWritePosToPage Integer Page String sText DWORD iStyle Number Pos Integer Dec Number nLen
  1877            Integer iRetVal
  1878            Integer iTlen
  1879            String  sMetrics
  1880            Integer iLength
  1881
  1882            If (num_arguments<6 OR nLen=0) Move 0 to iLength
  1883            Else Move (nLen * 100) to iLength
  1884
  1885            Get DFCurrent_Metrics To sMetrics
  1886
  1887            Send DFSetFontStyle iStyle
  1888            Get ToAnsi sText To sText
  1889            Move (Length(sText)) To iTlen
  1890
  1891            Move (Pos*100) To Pos
  1892
  1893            If sMetrics Eq "CM" Begin
  1894                Move (WriteLineToPositionMmEx(Page,sText,iTLen,PRN_FALSE,Pos,Dec,iLength));
  1895                To iRetVal
  1896            End
  1897            If sMetrics Eq "INCH" Begin
  1898                Move (WriteLineToPositionInchEx(Page,sText,iTLen,PRN_FALSE,Pos,Dec,iLength));
  1899                To iRetVal
  1900            End
  1901
  1902
  1903            If iRetVal Eq PRN_TRUE Begin
  1904            End
  1905            If iRetVal Eq PRN_FALSE Begin
  1906                Error DFERR_WINPRINT DFPrintError920
  1907            End
  1908        End_Procedure
  1909
  1910
  1911        //***
  1912        Procedure DFWritelnPosToPage Integer Page String sText DWORD iStyle Number Pos Integer Dec Number nLen
  1913            Integer iRetVal
  1914            Integer iTlen
  1915            String  sMetrics
  1916            Integer iLength
  1917
  1918            If (num_arguments<6 OR nLen=0) Move 0 to iLength
  1919            Else Move (nLen *100) to iLength
  1920
  1921            Get DFCurrent_Metrics To sMetrics
  1922
  1923            Send DFSetFontStyle iStyle
  1924            Get ToAnsi sText To sText
  1925            Move (Length(sText)) To iTlen
  1926
  1927            Move (Pos*100) To Pos
  1928
  1929            If sMetrics Eq "CM" Begin
  1930                Move (WriteLineToPositionMmEx(Page,sText,iTLen,PRN_TRUE,Pos,Dec,iLength));
  1931                To iRetVal
  1932            End
  1933            If sMetrics Eq "INCH" Begin
  1934                Move (WriteLineToPositionInchEx(Page,sText,iTLen,PRN_TRUE,Pos,Dec,iLength));
  1935                To iRetVal
  1936            End
  1937
  1938
  1939            If iRetVal Eq PRN_TRUE Begin
  1940            End
  1941            If iRetVal Eq PRN_FALSE Begin
  1942                Error DFERR_WINPRINT DFPrintError921
  1943            End
  1944        End_Procedure
  1945
  1946
  1947        //***
  1948        Procedure DFWritePos String sText DWORD iStyle Number Pos Integer Dec Number nLen
  1949            Integer iRetVal
  1950            Integer CurrPage
  1951            Integer iTlen
  1952            String  sMetrics
  1953            Integer iLength
  1954
  1955            If (num_arguments<5 OR nLen=0) Move 0 to iLength
  1956            Else Move (nLen *100) to iLength
  1957
  1958            Get DFCurrent_Metrics To sMetrics
  1959            Get DFCurrent_Page To CurrPage
  1960
  1961            Send DFSetFontStyle iStyle
  1962            Get ToAnsi sText To sText
  1963            Move (Length(sText)) To iTlen
  1964
  1965            Move (Pos*100) To Pos
  1966
  1967            If sMetrics Eq "CM" Begin
  1968                Move (WriteLineToPositionMmEx(CurrPage,sText,iTLen,PRN_FALSE,Pos,Dec,iLength));
  1969                To iRetVal
  1970            End
  1971            If sMetrics Eq "INCH" Begin
  1972                Move (WriteLineToPositionInchEx(CurrPage,sText,iTLen,PRN_FALSE,Pos,Dec,iLength));
  1973                To iRetVal
  1974            End
  1975
  1976
  1977            If iRetVal Eq PRN_TRUE Begin
  1978            End
  1979            If iRetVal Eq PRN_FALSE Begin
  1980                Error DFERR_WINPRINT DFPrintError922
  1981            End
  1982        End_Procedure
  1983
  1984
  1985        //***
  1986        Procedure DFWritelnPos String sText DWORD iStyle Number Pos Integer Dec Number nLen
  1987            Integer iRetVal
  1988            Integer CurrPage
  1989            Integer iTlen
  1990            String  sMetrics
  1991            Integer iLength
  1992
  1993            If (num_arguments<5 OR nLen=0) Move 0 to iLength
  1994            Else Move (nLen *100) to iLength
  1995
  1996            Get DFCurrent_Metrics To sMetrics
  1997            Get DFCurrent_Page To CurrPage
  1998
  1999            Send DFSetFontStyle iStyle
  2000            Get ToAnsi sText To sText
  2001            Move (Length(sText)) To iTlen
  2002
  2003            Move (Pos*100) To Pos
  2004
  2005            If sMetrics Eq "CM" Begin
  2006                Move (WriteLineToPositionMmEx(CurrPage,sText,iTLen,PRN_TRUE,Pos,Dec,iLength));
  2007                To iRetVal
  2008            End
  2009            If sMetrics Eq "INCH" Begin
  2010                Move (WriteLineToPositionInchEx(CurrPage,sText,iTLen,PRN_TRUE,Pos,Dec,iLength));
  2011                To iRetVal
  2012            End
  2013
  2014            If iRetVal Eq PRN_TRUE Begin
  2015            End
  2016            If iRetVal Eq PRN_FALSE Begin
  2017                Error DFERR_WINPRINT DFPrintError923
  2018            End
  2019        End_Procedure
  2020
  2021
  2022        //***
  2023        Procedure DFSetMetrics String Metrics
  2024            If Metrics Eq "CM" Begin
  2025                Set DFCurrent_Metrics To Metrics
  2026                Procedure_Return
  2027            End
  2028            If Metrics Eq "INCH" Begin
  2029                Set DFCurrent_Metrics To Metrics
  2030                Procedure_Return
  2031            End
  2032            Else Begin
  2033                Error DFERR_WINPRINT  DFPrintError924
  2034            End
  2035        End_Procedure
  2036
  2037
  2038
  2039        //***
  2040        Procedure DFBeginHeaderType Integer HeaderNr Integer HeaderType
  2041            Integer iRetVal
  2042            Integer iObjCount
  2043
  2044            If ((HeaderType Eq DFSubHeader) or (HeaderType Eq DFSubTotal)) Begin
  2045                //*** Do nothing for the moment
  2046            End
  2047            Else Move 0 to HeaderNr // If the user made a mistake
  2048
  2049            Get DFCalcCounters HeaderNr HeaderType To iObjCount
  2050
  2051            Set DFCurrent_HeaderType To HeaderType
  2052            Set DFCurrent_HeaderNr   To HeaderNr
  2053
  2054            Move (BeginHeader(HeaderNr,iObjCount,HeaderType)) To iRetVal
  2055
  2056            If iRetVal Eq PRN_TRUE Begin
  2057            End
  2058            If iRetVal Eq PRN_FALSE Begin
  2059                Error DFERR_WINPRINT DFPrintError925
  2060            End
  2061        End_Procedure
  2062
  2063
  2064        //***
  2065        Procedure DFEndHeaderType
  2066            Integer iRetVal
  2067
  2068                Move (EndHeader()) To iRetVal
  2069
  2070            If iRetVal Eq PRN_TRUE Begin
  2071            End
  2072            If iRetVal Eq PRN_FALSE Begin
  2073                Error DFERR_WINPRINT DFPrintError926
  2074            End
  2075        End_Procedure
  2076
  2077
  2078        //***
  2079        Procedure DFWriteHeaderType Integer HeaderNr Integer HeaderType
  2080            Integer iRetVal
  2081            Integer CurrPage
  2082            Integer iObjCount
  2083
  2084            Get DFCurrentCounters HeaderNr HeaderType to iObjCount
  2085
  2086            Get DFCurrent_Page To CurrPage
  2087
  2088            Move (WriteHeaderToPage(CurrPage,HeaderNr,iObjCount,HeaderType)) To iRetVal
  2089
  2090            If iRetVal Eq PRN_TRUE Begin
  2091            End
  2092            If iRetVal Eq PRN_FALSE Begin
  2093                Error DFERR_WINPRINT DFPrintError927
  2094            End
  2095        End_Procedure
  2096
  2097
  2098        //***
  2099        Procedure DFWriteHeaderTypeToPage Integer PageNr Integer HeaderNr Integer HeaderType
  2100            Integer iRetVal
  2101            integer iObjCount
  2102
  2103            Get DFCurrentCounters HeaderNr HeaderType to iObjCount
  2104
  2105            Move (WriteHeaderToPage(PageNr,HeaderNr,iObjCount,HeaderType)) To iRetVal
  2106
  2107            If iRetVal Eq PRN_TRUE Begin
  2108            End
  2109            If iRetVal Eq PRN_FALSE Begin
  2110                Error DFERR_WINPRINT DFPrintError928
  2111            End
  2112        End_Procedure
  2113
  2114
  2115        //***
  2116        Procedure DFHeaderPosition Integer Place
  2117            Integer iRetVal
  2118
  2119             Move (SetHeaderPlacement(Place)) To iRetVal
  2120
  2121            If iRetVal Eq PRN_TRUE Begin
  2122            End
  2123            If iRetVal Eq PRN_FALSE Begin
  2124                Error DFERR_WINPRINT DFPrintError929
  2125            End
  2126        End_Procedure
  2127
  2128
  2129        //***
  2130        Procedure DFHeaderFrameType Integer Frame Dword dwColor Number nWeight;
  2131                                    Dword FColor Integer iFill
  2132            String  sMetrics
  2133            Integer iWeight
  2134            Integer iRetVal
  2135
  2136            Move (nWeight*100) To iWeight
  2137
  2138            Get DFCurrent_Metrics To sMetrics
  2139
  2140            If sMetrics Eq "CM" Begin
  2141                Move (SetHeaderFrameMm(Frame,dwColor,iWeight,FColor,iFill)) To iRetVal
  2142            End
  2143            If sMetrics Eq "INCH" Begin
  2144                Move (SetHeaderFrameInch(Frame,dwColor,iWeight,FColor,iFill)) To iRetVal
  2145            End
  2146
  2147            If iRetVal Eq PRN_TRUE Begin
  2148            End
  2149            If iRetVal Eq PRN_FALSE Begin
  2150                Error DFERR_WINPRINT DFPrintError930
  2151            End
  2152        End_Procedure
  2153
  2154
  2155        //***
  2156        Procedure DFHeaderWrap Integer OnOff
  2157            Integer iRetVal
  2158
  2159             Move (SetHeaderWrap(OnOff)) To iRetVal
  2160
  2161            If iRetVal Eq PRN_TRUE Begin
  2162            End
  2163            If iRetVal Eq PRN_FALSE Begin
  2164                Error DFERR_WINPRINT DFPrintError931
  2165            End
  2166        End_Procedure
  2167
  2168        //***
  2169        //SF 21/8 - Modified to support GR_USECURRPOS better
  2170        Procedure DFWriteBMP String sFileName Number StartX Number StartY Number Height Number Width Integer iUCp
  2171            Integer iRetVal
  2172            Integer CurrPage
  2173            Integer iFlen
  2174            String  sMetrics
  2175            Integer LeftTX  LeftTY RightBX RightBY
  2176            Number  nLeftTX nLeftTY nRightBX nRightBY
  2177
  2178
  2179            If ((StartX Ne -998) and (StartX Ne -999));
  2180                Move (StartX*100) To StartX
  2181            If ((StartY Ne -998) and (StartY Ne -999));
  2182                Move (StartY*100) To StartY
  2183            If ((Width Ne -998) and (Width Ne -999));
  2184                Move (Width*100) To Width
  2185            If ((Height Ne -998) and (Height Ne -999));
  2186                Move (Height*100) To Height
  2187
  2188            Get DFCurrent_Metrics To sMetrics
  2189            Get DFCurrent_Page To CurrPage
  2190
  2191            Move (Length(sFileName)) To iFlen
  2192
  2193            If sMetrics Eq "CM" Begin
  2194                Move (DrawBitmapToPageMm(CurrPage,sFileName,iFLen,StartX,StartY,Width,Height,iUCp));
  2195                To iRetVal
  2196            End
  2197            If sMetrics Eq "INCH" Begin
  2198                Move (DrawBitmapToPageInch(CurrPage,sFileName,iFLen,StartX,StartY,Width,Height,iUCp));
  2199                To iRetVal
  2200            End
  2201
  2202            If iRetVal Eq PRN_TRUE Begin
  2203            End
  2204            If iRetVal Eq PRN_FALSE Begin
  2205                Error DFERR_WINPRINT DFPrintError932
  2206            End
  2207        End_Procedure
  2208
  2209
  2210        //***
  2211        //SF 21/8 - Modified to support GR_USECURRPOS better
  2212        Procedure DFWriteBMPToPage Integer iPage String sFileName Number StartX Number StartY Number Height Number Width Integer iUCp
  2213            Integer iRetVal
  2214            Integer iFlen
  2215            String  sMetrics
  2216            Integer LeftTX  LeftTY RightBX RightBY
  2217            Number  nLeftTX nLeftTY nRightBX nRightBY
  2218
  2219
  2220            If ((StartX Ne -998) and (StartX Ne -999));
  2221                Move (StartX*100) To StartX
  2222            If ((StartY Ne -998) and (StartY Ne -999));
  2223                Move (StartY*100) To StartY
  2224            If ((Width Ne -998) and (Width Ne -999));
  2225                Move (Width*100) To Width
  2226            If ((Height Ne -998) and (Height Ne -999));
  2227                Move (Height*100) To Height
  2228
  2229            Get DFCurrent_Metrics To sMetrics
  2230
  2231            Move (Length(sFileName)) To iFlen
  2232
  2233            If sMetrics Eq "CM" Begin
  2234                Move (DrawBitmapToPageMm(iPage,sFileName,iFLen,StartX,StartY,Width,Height,iUCp));
  2235                To iRetVal
  2236            End
  2237            If sMetrics Eq "INCH" Begin
  2238                Move (DrawBitmapToPageInch(iPage,sFileName,iFLen,StartX,StartY,Width,Height,iUCp));
  2239                To iRetVal
  2240            End
  2241
  2242            If iRetVal Eq PRN_TRUE Begin
  2243            End
  2244            If iRetVal Eq PRN_FALSE Begin
  2245                Error DFERR_WINPRINT DFPrintError933
  2246            End
  2247        End_Procedure
  2248
  2249
  2250        //***
  2251        Procedure DFHeaderLineCheck Integer Lines
  2252            Integer iRetVal
  2253
  2254             Move (SetExtraLineCheck(Lines)) To iRetVal
  2255
  2256            If iRetVal Eq PRN_TRUE Begin
  2257            End
  2258            If iRetVal Eq PRN_FALSE Begin
  2259                Error DFERR_WINPRINT DFPrintError934
  2260            End
  2261        End_Procedure
  2262
  2263
  2264        //***
  2265        Procedure DFPrintFlags Integer Flags
  2266            Integer iRetVal
  2267
  2268             Move (SetPrintDialogFlags(Flags)) To iRetVal
  2269
  2270            If iRetVal Eq PRN_TRUE Begin
  2271            End
  2272            If iRetVal Eq PRN_FALSE Begin
  2273                Error DFERR_WINPRINT DFPrintError935
  2274            End
  2275        End_Procedure
  2276
  2277
  2278        //***
  2279        Procedure DFSelectPrinter String sDriver String sDevice String sPort Integer iUpdate
  2280            Integer iRetVal
  2281            Integer iDriverLen iDeviceLen iPortLen
  2282
  2283            Move (Length(sDriver)) To iDriverLen
  2284            Move (Length(sDevice)) To iDeviceLen
  2285            Move (Length(sPort))   To iPortLen
  2286
  2287            Move (SelectPrinter(sDriver,iDriverLen,sDevice,iDeviceLen,;
  2288                  sPort,iPortLen,iUpdate)) To iRetVal
  2289
  2290            If iRetVal Eq PRN_TRUE Begin
  2291            End
  2292
  2293            If iRetVal Eq PRN_FALSE Begin
  2294                Error DFERR_WINPRINT DFPrintError936
  2295            End
  2296        End_Procedure
  2297
  2298
  2299        //***
  2300        Procedure DFPrinterBinFirstPage Integer Flags
  2301            Integer iRetVal
  2302
  2303             Move (SetFirstPagePaperSource(Flags)) To iRetVal
  2304
  2305            If iRetVal Eq PRN_TRUE Begin
  2306            End
  2307            If iRetVal Eq PRN_FALSE Begin
  2308                Error DFERR_WINPRINT DFPrintError937
  2309            End
  2310        End_Procedure
  2311
  2312
  2313        //***
  2314        Function DFGetDFColor Integer iRed Integer iGreen Integer iBlue Returns DWORD
  2315            DWord iRetVal
  2316
  2317             Move (RGBToDFPrintColor(iRed,iGreen,iBlue)) To iRetVal
  2318
  2319            //If iRetVal Eq PRN_TRUE Begin
  2320            //End
  2321
  2322            If iRetVal Eq PRN_FALSE Begin
  2323                Error DFERR_WINPRINT DFPrintError938
  2324            End
  2325            Function_Return iRetVal
  2326        End_Function
  2327
  2328
  2329        //***
  2330        Procedure DFSetDFColor DWORD dwColor
  2331            Integer iRetVal
  2332
  2333             Move (SetColor(dwColor)) To iRetVal
  2334
  2335            //If iRetVal Eq PRN_TRUE Begin
  2336            //End
  2337
  2338            If iRetVal Eq PRN_FALSE Begin
  2339                Error DFERR_WINPRINT DFPrintError939
  2340            End
  2341        End_Procedure
  2342
  2343
  2344        //***
  2345        Procedure DFSetTopBottom Number nTop Number nBottom Integer iAll
  2346            Integer iRetVal
  2347            String  sMetrics
  2348            Integer iTop iBottom
  2349
  2350            Move (nTop*100)    To iTop
  2351            Move (nBottom*100) To iBottom
  2352
  2353            Get DFCurrent_Metrics To sMetrics
  2354
  2355            If sMetrics Eq "CM" Begin
  2356                Move (SetAbsoluteMarginsMm(iTop,iBottom,iAll)) To iRetVal
  2357            End
  2358            If sMetrics Eq "INCH" Begin
  2359                Move (SetAbsoluteMarginsInch(iTop,iBottom,iAll)) To iRetVal
  2360            End
  2361
  2362            If iRetVal Eq PRN_TRUE Begin
  2363            End
  2364            If iRetVal Eq PRN_FALSE Begin
  2365                Error DFERR_WINPRINT DFPrintError940
  2366            End
  2367        End_Procedure
  2368
  2369
  2370        //***
  2371        Procedure DFSetJMode Integer iAlign
  2372            Integer iRetVal
  2373
  2374            Move (SetAlign(iAlign)) To iRetVal
  2375
  2376            If iRetVal Eq PRN_TRUE Begin
  2377            End
  2378            If iRetVal Eq PRN_FALSE Begin
  2379                Error DFERR_WINPRINT DFPrintError941
  2380            End
  2381        End_Procedure
  2382
  2383
  2384        //***
  2385        //SF 21/8 - Modified to support GR_USECURRPOS better
  2386        Procedure DFWriteEllip Number StartX Number StartY Number Height Number Width;
  2387                  Dword BColor Dword FColor Integer iFill Number nWeight Integer Wrap Integer iUCp
  2388
  2389            Integer iRetVal
  2390            Integer CurrPage
  2391            String  sMetrics
  2392            Integer LeftTX  LeftTY RightBX RightBY
  2393            Number  nLeftTX nLeftTY nRightBX nRightBY
  2394            Integer iWeight
  2395
  2396
  2397            If ((StartX Ne -998) and (StartX Ne -999));
  2398                Move (StartX*100) To StartX
  2399            If ((StartY Ne -998) and (StartY Ne -999));
  2400                Move (StartY*100) To StartY
  2401            If ((Width Ne -998) and (Width Ne -999));
  2402                Move (Width*100) To Width
  2403            If ((Height Ne -998) and (Height Ne -999));
  2404                Move (Height*100) To Height
  2405
  2406            Move (nWeight*100) To iWeight
  2407
  2408
  2409            Get DFCurrent_Metrics To sMetrics
  2410            Get DFCurrent_Page To CurrPage
  2411
  2412
  2413            If sMetrics Eq "CM" Begin
  2414                Move (DrawEllipMm(CurrPage,StartX,StartY,Width,Height,;
  2415                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2416            End
  2417            If sMetrics Eq "INCH" Begin
  2418                Move (DrawEllipInch(CurrPage,StartX,StartY,Width,Height,;
  2419                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2420            End
  2421
  2422            If iRetVal Eq PRN_TRUE Begin
  2423            End
  2424            If iRetVal Eq PRN_FALSE Begin
  2425                Error DFERR_WINPRINT DFPrintError942
  2426            End
  2427        End_Procedure
  2428
  2429
  2430        //***
  2431        //SF 21/8 - Modified to support GR_USECURRPOS better
  2432        Procedure DFWriteEllipToPage Integer iPage Number StartX Number StartY Number Height Number Width;
  2433                  Dword BColor Dword FColor Integer iFill Number nWeight Integer Wrap Integer iUCp
  2434
  2435            Integer iRetVal
  2436            String  sMetrics
  2437            Integer LeftTX  LeftTY RightBX RightBY
  2438            Number  nLeftTX nLeftTY nRightBX nRightBY
  2439            Integer iWeight
  2440
  2441
  2442            If ((StartX Ne -998) and (StartX Ne -999));
  2443                Move (StartX*100) To StartX
  2444            If ((StartY Ne -998) and (StartY Ne -999));
  2445                Move (StartY*100) To StartY
  2446            If ((Width Ne -998) and (Width Ne -999));
  2447                Move (Width*100) To Width
  2448            If ((Height Ne -998) and (Height Ne -999));
  2449                Move (Height*100) To Height
  2450
  2451
  2452            Move (nWeight*100) To iWeight
  2453
  2454
  2455            Get DFCurrent_Metrics To sMetrics
  2456
  2457            If sMetrics Eq "CM" Begin
  2458                Move (DrawEllipMm(iPage,StartX,StartY,Width,Height,;
  2459                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2460            End
  2461            If sMetrics Eq "INCH" Begin
  2462                Move (DrawEllipInch(iPage,StartX,StartY,Width,Height,;
  2463                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2464            End
  2465
  2466            If iRetVal Eq PRN_TRUE Begin
  2467            End
  2468            If iRetVal Eq PRN_FALSE Begin
  2469                Error DFERR_WINPRINT DFPrintError943
  2470            End
  2471        End_Procedure
  2472
  2473
  2474        //***
  2475        //SF 21/8 - Modified to support GR_USECURRPOS better
  2476        Procedure DFWriteRect Number StartX Number StartY Number Height Number Width;
  2477                  Dword BColor Dword FColor Integer iFill Number nWeight Integer Wrap Integer iUCp
  2478
  2479            Integer iRetVal
  2480            Integer CurrPage
  2481            String  sMetrics
  2482            Integer LeftTX  LeftTY RightBX RightBY
  2483            Number  nLeftTX nLeftTY nRightBX nRightBY
  2484            Integer iWeight
  2485
  2486
  2487            If ((StartX Ne -998) and (StartX Ne -999));
  2488                Move (StartX*100) To StartX
  2489            If ((StartY Ne -998) and (StartY Ne -999));
  2490                Move (StartY*100) To StartY
  2491            If ((Width Ne -998) and (Width Ne -999));
  2492                Move (Width*100) To Width
  2493            If ((Height Ne -998) and (Height Ne -999));
  2494                Move (Height*100) To Height
  2495
  2496            Move (nWeight*100) To iWeight
  2497
  2498
  2499            Get DFCurrent_Metrics To sMetrics
  2500            Get DFCurrent_Page To CurrPage
  2501
  2502
  2503            If sMetrics Eq "CM" Begin
  2504                Move (DrawRectMm(CurrPage,StartX,StartY,Width,Height,;
  2505                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2506            End
  2507            If sMetrics Eq "INCH" Begin
  2508                Move (DrawRectInch(CurrPage,StartX,StartY,Width,Height,;
  2509                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2510            End
  2511
  2512            If iRetVal Eq PRN_TRUE Begin
  2513            End
  2514            If iRetVal Eq PRN_FALSE Begin
  2515                Error DFERR_WINPRINT DFPrintError944
  2516            End
  2517        End_Procedure
  2518
  2519
  2520        //***
  2521        //SF 21/8 - Modified to support GR_USECURRPOS better
  2522        Procedure DFWriteRectToPage Integer iPage Number StartX Number StartY Number Height Number Width;
  2523                  Dword BColor Dword FColor Integer iFill Number nWeight Integer Wrap Integer iUCp
  2524
  2525            Integer iRetVal
  2526            String  sMetrics
  2527            Integer LeftTX  LeftTY RightBX RightBY
  2528            Number  nLeftTX nLeftTY nRightBX nRightBY
  2529            Integer iWeight
  2530
  2531
  2532            If ((StartX Ne -998) and (StartX Ne -999));
  2533                Move (StartX*100) To StartX
  2534            If ((StartY Ne -998) and (StartY Ne -999));
  2535                Move (StartY*100) To StartY
  2536            If ((Width Ne -998) and (Width Ne -999));
  2537                Move (Width*100) To Width
  2538            If ((Height Ne -998) and (Height Ne -999));
  2539                Move (Height*100) To Height
  2540
  2541
  2542            Move (nWeight*100) To iWeight
  2543
  2544
  2545            Get DFCurrent_Metrics To sMetrics
  2546
  2547            If sMetrics Eq "CM" Begin
  2548                Move (DrawRectMm(iPage,StartX,StartY,Width,Height,;
  2549                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2550            End
  2551            If sMetrics Eq "INCH" Begin
  2552                Move (DrawRectInch(iPage,StartX,StartY,Width,Height,;
  2553                BColor,FColor,iFill,iWeight,iUCp,Wrap)) To iRetVal
  2554            End
  2555
  2556            If iRetVal Eq PRN_TRUE Begin
  2557            End
  2558            If iRetVal Eq PRN_FALSE Begin
  2559                Error DFERR_WINPRINT DFPrintError945
  2560            End
  2561        End_Procedure
  2562
  2563
  2564        //***
  2565        Procedure DFLineCheck Integer Lines
  2566            Integer CurrPage
  2567            Integer iRetVal
  2568
  2569            Get DFCurrent_Page To CurrPage
  2570
  2571            Move (ConfirmLines(CurrPage,Lines)) To iRetVal
  2572
  2573            If iRetVal Eq PRN_TRUE Begin
  2574            End
  2575            If iRetVal Eq PRN_FALSE Begin
  2576                Error DFERR_WINPRINT DFPrintError946
  2577            End
  2578        End_Procedure
  2579
  2580
  2581        //***
  2582        Procedure DFCreateDiagram Integer iType Integer iFx Number nHeight Number nWidth Integer bXyAxis
  2583            Integer iRetVal
  2584            String  sMetrics
  2585            Integer iWidth
  2586            Integer iHeight
  2587
  2588            Move (nHeight*100) To iHeight
  2589            Move (nWidth*100)  To iWidth
  2590
  2591            Set DFCurrent_Color To 0
  2592
  2593            Get DFCurrent_Metrics To sMetrics
  2594
  2595            If sMetrics Eq "CM" Begin
  2596                Move (CreateDiagramMm(iType,iFx,iWidth,iHeight,bXyAxis)) To iRetVal
  2597            End
  2598            If sMetrics Eq "INCH" Begin
  2599                Move (CreateDiagramInch(iType,iFx,iWidth,iHeight,bXyAxis)) To iRetVal
  2600            End
  2601
  2602
  2603            If iRetVal Ne PRN_FALSE Begin
  2604                Set DFCurrent_Diagram To iRetVal
  2605            End
  2606            If iRetVal Eq PRN_FALSE Begin
  2607                Error DFERR_WINPRINT DFPrintError947
  2608            End
  2609        End_Procedure
  2610
  2611
  2612        //***
  2613        Procedure DFDiagram_Item Integer iDiagram String sLabel Number nValue;
  2614                                 Dword BColor Dword FColor Integer iFill;
  2615                                 Integer iDec Integer iVP Integer iExt
  2616
  2617            Integer iRetVal
  2618            Integer iLabelLen
  2619            Integer iValLen
  2620            Integer iCurrColor
  2621
  2622            If FColor Eq -1 Begin
  2623                Get DFCurrent_Color To iCurrColor
  2624
  2625                Move (iCurrColor+1)  To iCurrColor
  2626
  2627                If iCurrColor Gt 15 Move 1 To iCurrColor
  2628
  2629                Get Array_Value Of (oDFColorArray(self));
  2630                Item iCurrColor To FColor
  2631
  2632                Set DFCurrent_Color To iCurrColor
  2633            End
  2634
  2635            Get ToAnsi sLabel To sLabel
  2636
  2637            Move (Length(sLabel)) To iLabelLen
  2638            Move (Length(nValue)) To iValLen
  2639
  2640            Move (AddDiagramEntry(iDiagram,sLabel,iLabelLen,nValue,iValLen,;
  2641                  BColor,FColor,iFill,iDec,iVP,iExt)) To iRetVal
  2642
  2643            If iRetVal Eq PRN_TRUE Begin
  2644            End
  2645            If iRetVal Eq PRN_FALSE Begin
  2646                Error DFERR_WINPRINT DFPrintError948
  2647            End
  2648        End_Procedure
  2649
  2650
  2651        //***
  2652        Procedure DFLockDiagram Integer iDiagram
  2653            Integer iRetVal
  2654
  2655            Move (LockDiagram(iDiagram)) To iRetVal
  2656
  2657            If iRetVal Eq PRN_TRUE Begin
  2658            End
  2659            If iRetVal Eq PRN_FALSE Begin
  2660                Error DFERR_WINPRINT DFPrintError949
  2661            End
  2662        End_Procedure
  2663
  2664
  2665
  2666        //***
  2667        //SF 11/07/97 - Added an extra param.
  2668        Procedure DFDrawDiagram Integer iDiagram Number nYPos Number nXPos Integer iUCp
  2669            Integer iRetVal
  2670            Integer CurrPage
  2671            String  sMetrics
  2672            Integer iXPos
  2673            Integer iYPos
  2674
  2675            Move (nXPos*100) To iXPos
  2676            Move (nYPos*100) To iYPos
  2677
  2678            Get DFCurrent_Metrics To sMetrics
  2679            Get DFCurrent_Page To CurrPage
  2680
  2681            If nYPos Eq -999 Move -999 To iYPos
  2682
  2683            If sMetrics Eq "CM" Begin
  2684                Move (DrawDiagramToPageMm(CurrPage,iDiagram,iXPos,iYPos,iUCp)) To iRetVal
  2685            End
  2686            If sMetrics Eq "INCH" Begin
  2687                Move (DrawDiagramToPageInch(CurrPage,iDiagram,iXPos,iYPos,iUCp)) To iRetVal
  2688            End
  2689
  2690            If iRetVal Eq PRN_TRUE Begin
  2691            End
  2692            If iRetVal Eq PRN_FALSE Begin
  2693                Error DFERR_WINPRINT DFPrintError950
  2694            End
  2695        End_Procedure
  2696
  2697
  2698        //***
  2699        //SF 11/07/97 - Added an extra param.
  2700        Procedure DFDrawDiagramToPage Integer iPage Integer iDiagram Number nYPos Number nXPos Integer iUCp
  2701            Integer iRetVal
  2702            String  sMetrics
  2703            Integer iXPos
  2704            Integer iYPos
  2705
  2706            Move (nXPos*100) To iXPos
  2707            Move (nYPos*100) To iYPos
  2708
  2709            Get DFCurrent_Metrics To sMetrics
  2710
  2711            If nYPos Eq -999 Move -999 To iYPos
  2712
  2713            If sMetrics Eq "CM" Begin
  2714                Move (DrawDiagramToPageMm(iPage,iDiagram,iXPos,iYPos,iUCp)) To iRetVal
  2715            End
  2716            If sMetrics Eq "INCH" Begin
  2717                Move (DrawDiagramToPageInch(iPage,iDiagram,iXPos,iYPos,iUCp)) To iRetVal
  2718            End
  2719
  2720            If iRetVal Eq PRN_TRUE Begin
  2721            End
  2722            If iRetVal Eq PRN_FALSE Begin
  2723                Error DFERR_WINPRINT DFPrintError951
  2724            End
  2725        End_Procedure
  2726
  2727
  2728        //***
  2729        Procedure DFDiagramLabel Integer iDiagram String sLabel
  2730            Integer iRetVal
  2731            Integer iLabelLen
  2732
  2733            Get ToAnsi sLabel To sLabel
  2734
  2735            Move (Length(sLabel)) To iLabelLen
  2736
  2737            Move (SetDiagramCaption(iDiagram,sLabel,iLabelLen)) To iRetVal
  2738
  2739            If iRetVal Eq PRN_TRUE Begin
  2740            End
  2741            If iRetVal Eq PRN_FALSE Begin
  2742                Error DFERR_WINPRINT DFPrintError952
  2743            End
  2744        End_Procedure
  2745
  2746
  2747        //***
  2748        Procedure DFDiagramXLabel Integer iDiagram String sLabel
  2749            Integer iRetVal
  2750            Integer iLabelLen
  2751
  2752            Get ToAnsi sLabel To sLabel
  2753
  2754            Move (Length(sLabel)) To iLabelLen
  2755
  2756            Move (SetDiagramXText(iDiagram,sLabel,iLabelLen)) To iRetVal
  2757
  2758            If iRetVal Eq PRN_TRUE Begin
  2759            End
  2760            If iRetVal Eq PRN_FALSE Begin
  2761                Error DFERR_WINPRINT DFPrintError953
  2762            End
  2763        End_Procedure
  2764
  2765
  2766        //***
  2767        Procedure DFDiagramYLabel Integer iDiagram String sLabel Integer iVert
  2768            Integer iRetVal
  2769            Integer iLabelLen
  2770
  2771            Get ToAnsi sLabel To sLabel
  2772
  2773            Move (Length(sLabel)) To iLabelLen
  2774
  2775            Move (SetDiagramYText(iDiagram,sLabel,iLabelLen,iVert)) To iRetVal
  2776
  2777            If iRetVal Eq PRN_TRUE Begin
  2778            End
  2779            If iRetVal Eq PRN_FALSE Begin
  2780                Error DFERR_WINPRINT DFPrintError954
  2781            End
  2782        End_Procedure
  2783
  2784
  2785        //***
  2786        Procedure DFWriteXYLine Number StartX Number StartY Number StoppX Number StoppY;
  2787                  Dword Color Number nWeight Integer Wrap Integer iUCp
  2788
  2789            Integer iRetVal
  2790            Integer CurrPage
  2791            String  sMetrics
  2792            Integer iStartX iStartY iStoppX iStoppY
  2793            Integer iWeight
  2794
  2795            Move (StartX*100)  To iStartX
  2796            Move (StartY*100)  To iStartY
  2797            Move (StoppX*100)  To iStoppX
  2798            Move (StoppY*100)  To iStoppY
  2799
  2800            Move (nWeight*100) To iWeight
  2801
  2802            If StoppY  Eq -998 Move -998 To iStoppY
  2803            If StoppX  Eq -998 Move -998 To iStoppX
  2804
  2805            If StartY  Eq -999 Move -999 To iStoppY
  2806            If StartX  Eq -999 Move -999 To iStoppX
  2807
  2808            Get DFCurrent_Metrics To sMetrics
  2809            Get DFCurrent_Page To CurrPage
  2810
  2811
  2812            If sMetrics Eq "CM" Begin
  2813                Move (DrawXYLineMm(CurrPage,iStartX,iStartY,iStoppX,iStoppY,;
  2814                Color,iWeight,iUCp,Wrap)) To iRetVal
  2815            End
  2816            If sMetrics Eq "INCH" Begin
  2817                Move (DrawXYLineInch(CurrPage,iStartX,iStartY,iStoppX,iStoppY,;
  2818                Color,iWeight,iUCp,Wrap)) To iRetVal
  2819            End
  2820
  2821            If iRetVal Eq PRN_TRUE Begin
  2822            End
  2823            If iRetVal Eq PRN_FALSE Begin
  2824                Error DFERR_WINPRINT DFPrintError955
  2825            End
  2826        End_Procedure
  2827
  2828
  2829        //***
  2830        Procedure DFWriteLine Number StartX Number StartY Number Lenght;
  2831                              Integer iHorVert Dword Color Number nWeight Integer iUCp
  2832
  2833            Integer iRetVal
  2834            Integer CurrPage
  2835            String  sMetrics
  2836            Integer iStartX iStartY iLenght
  2837            Integer iWeight
  2838
  2839            Move (StartX*100)  To iStartX
  2840            Move (StartY*100)  To iStartY
  2841            Move (Lenght*100)  To iLenght
  2842            Move (nWeight*100) To iWeight
  2843
  2844            If StartY Eq -999 Move -999 To iStartY
  2845            If StartX Eq -999 Move -999 To iStartX
  2846            If Lenght Eq -998 Move -998 To iLenght
  2847
  2848            Get DFCurrent_Metrics To sMetrics
  2849            Get DFCurrent_Page To CurrPage
  2850
  2851
  2852            If sMetrics Eq "CM" Begin
  2853                Move (DrawLineMm(CurrPage,iSTartX,iStartY,iLenght,;
  2854                iHorVert,Color,iWeight,iUCp)) To iRetVal
  2855            End
  2856            If sMetrics Eq "INCH" Begin
  2857                Move (DrawLineInch(CurrPage,iSTartX,iStartY,iLenght,;
  2858                iHorVert,Color,iWeight,iUCp)) To iRetVal
  2859            End
  2860
  2861            If iRetVal Eq PRN_TRUE Begin
  2862            End
  2863            If iRetVal Eq PRN_FALSE Begin
  2864                Error DFERR_WINPRINT DFPrintError956
  2865            End
  2866        End_Procedure
  2867
  2868
  2869        //***
  2870        Procedure DFClearPrinter
  2871            Integer iRetVal
  2872
  2873            Move (ClearPrinter()) To iRetVal
  2874
  2875            If iRetVal Eq PRN_TRUE Begin
  2876            End
  2877            If iRetVal Eq PRN_FALSE Begin
  2878                Error DFERR_WINPRINT DFPrintError957
  2879            End
  2880        End_Procedure
  2881
  2882
  2883
  2884        //***
  2885         Function DFGetCurrentDriver Returns String
  2886            Integer iRetVal
  2887            String  sDFStr
  2888            Pointer pDFStr
  2889
  2890            Move (Repeat( Character(0), 255 )) to sDFStr
  2891            GetAddress of sDFStr to pDFStr
  2892
  2893            Move (GetCurrentDriver(pDFStr)) To iRetVal
  2894
  2895            If iRetVal Eq PRN_TRUE Begin
  2896            End
  2897            If iRetVal Eq PRN_FALSE Begin
  2898                Error DFERR_WINPRINT DFPrintError958
  2899            End
  2900
  2901            Move (CString(sDFStr)) To sDFStr
  2902            Function_Return sDFStr
  2903         End_Function
  2904
  2905
  2906        //***
  2907         Function DFGetCurrentDevice Returns String
  2908            Integer iRetVal
  2909            String  sDFStr
  2910            Pointer pDFStr
  2911
  2912            Move (Repeat( Character(0), 255 )) to sDFStr
  2913            GetAddress of sDFStr to pDFStr
  2914
  2915            Move (GetCurrentDevice(pDFStr)) To iRetVal
  2916
  2917            If iRetVal Eq PRN_TRUE Begin
  2918            End
  2919            If iRetVal Eq PRN_FALSE Begin
  2920                Error DFERR_WINPRINT DFPrintError959
  2921            End
  2922
  2923            Move (CString(sDFStr)) To sDFStr
  2924            Function_Return sDFStr
  2925         End_Function
  2926
  2927
  2928        //***
  2929         Function DFGetCurrentPort Returns String
  2930            Integer iRetVal
  2931            String  sDFStr
  2932            Pointer pDFStr
  2933
  2934            Move (Repeat( Character(0), 255 )) to sDFStr
  2935            GetAddress of sDFStr to pDFStr
  2936
  2937            Move (GetCurrentPort(pDFStr)) To iRetVal
  2938
  2939            If iRetVal Eq PRN_TRUE Begin
  2940            End
  2941            If iRetVal Eq PRN_FALSE Begin
  2942                Error DFERR_WINPRINT DFPrintError960
  2943            End
  2944
  2945            Move (CString(sDFStr)) To sDFStr
  2946            Function_Return sDFStr
  2947         End_Function
  2948
  2949
  2950        //***
  2951         Function DFGetPrintDialogFlags Returns Dword
  2952            Dword dwRetVal
  2953
  2954            Move (GetPrintDialogFlags()) To dwRetVal
  2955
  2956            Function_Return dwRetVal
  2957         End_Function
  2958
  2959
  2960        //***
  2961        //*** Returns PRN_TRUE=  if the flag is set     (1)
  2962        //*** Returns PRN_FALSE= If the flag not is set (0)
  2963        //***
  2964         Function DFCheckPrintDialogFlag Dword PDFlag Returns Integer
  2965            Integer iRetVal
  2966
  2967            Move (IsPrintDialogFlag(PDFlag)) To iRetVal
  2968
  2969            Function_Return iRetVal
  2970         End_Function
  2971
  2972
  2973        //***
  2974         Procedure DFSetSpecPrintFlag Dword PDFlag
  2975            Integer iRetVal
  2976
  2977            Move (SetSpecificPrintDialogFlag(PDFlag)) To iRetVal
  2978
  2979            If iRetVal Eq PRN_TRUE Begin
  2980            End
  2981            If iRetVal Eq PRN_FALSE Begin
  2982                Error DFERR_WINPRINT DFPrintError961
  2983            End
  2984         End_Procedure
  2985
  2986
  2987        //***
  2988         Function DFGetUserDefinedLength Returns Number
  2989            Integer iRetVal
  2990            Number  nRetVal
  2991
  2992            Move (GetUserDefinedPapersize()) To iRetVal
  2993
  2994            If iRetVal Eq PRN_FALSE Begin
  2995                Error DFERR_WINPRINT DFPrintError962
  2996                Function_Return 0
  2997            End
  2998
  2999            Move (Hi(iRetVal)) To nRetVal
  3000            Move (nRetVal/100) To nRetVal //Returns CM
  3001
  3002            Function_Return nRetVal
  3003         End_Function
  3004
  3005
  3006        //***
  3007         Function DFGetUserDefinedWidth Returns Number
  3008            Integer iRetVal
  3009            Number  nRetVal
  3010
  3011            Move (GetUserDefinedPapersize()) To iRetVal
  3012
  3013            If iRetVal Eq PRN_FALSE Begin
  3014                Error DFERR_WINPRINT DFPrintError963
  3015                Function_Return 0
  3016            End
  3017
  3018            Move (Low(iRetVal)) To nRetVal
  3019            Move (nRetVal/100) To nRetVal //Returns CM
  3020
  3021            Function_Return nRetVal
  3022         End_Function
  3023
  3024
  3025        //*** To be set in CM
  3026         Procedure DFSetUserDefinedPapersize Number nLength Number nWidth
  3027            Integer iRetVal
  3028            Integer iLength
  3029            Integer iWidth
  3030            Integer iSize
  3031
  3032            Move (nLength*100) To iLength
  3033            Move (nWidth*100)  To iWidth
  3034
  3035            Move ((iLength*65536)+iWidth) To iSize
  3036
  3037            Move (SetUserDefinedPapersize(iSize)) To iRetVal
  3038
  3039            If iRetVal Eq PRN_FALSE Begin
  3040                Error DFERR_WINPRINT DFPrintError964
  3041            End
  3042
  3043         End_Procedure
  3044
  3045         Procedure DFSetNumberOfCopies Integer iNrOfCopies
  3046            Integer iRetVal
  3047            Move (SetNumberOfPrintCopies(iNrOfCopies)) to iRetVal
  3048            If (Not(iRetVal));
  3049                Error DFERR_WINPRINT DFPrintError965
  3050         End_Procedure
  3051
  3052
  3053        //*** Escape will not work, see comment att dll call
  3054        ////***
  3055        //Procedure DFWriteEsc Integer EscFunc String EscSeq
  3056        //    Integer iRetVal
  3057        //    Integer CurrPage
  3058        //    integer iEscLen
  3059        //
  3060        //    Get DFCurrent_Page To CurrPage
  3061        //
  3062        //    Get ToAnsi EscSeq To EscSeq
  3063        //
  3064        //    Move (Length(EscSeq)) To iEscLen
  3065        //
  3066        //    Move (WriteEscape(CurrPage,EscFunc,EscSeq,iEscLen)) To iRetVal
  3067        //
  3068        //    If iRetVal Eq PRN_TRUE Begin
  3069        //    End
  3070        //    If iRetVal Eq PRN_FALSE Begin
  3071        //        Error DFERR_WINPRINT DFPrintError958
  3072        //    End
  3073        //End_Procedure
  3074        ////***
  3075        //Procedure DFQueryEsc Integer EscFunc
  3076        //    Integer iRetVal
  3077        //
  3078        //    Move (QueryWriteEscape(EscFunc)) To iRetVal
  3079        //
  3080        //    If iRetVal Eq PRN_TRUE Begin
  3081        //    End
  3082        //    If iRetVal Eq PRN_FALSE Begin
  3083        //        Error DFERR_WINPRINT DFPrintError959
  3084        //    End
  3085        //End_Procedure
  3086
  3087
  3088
  3089
  3090        //*************************************************************
  3091        //*** This procedures and functions are used when building  ***
  3092        //*** complex graphics when you need to change value of the ***
  3093        //*** current diagram, so you can mix diagrams within each  ***
  3094        //*** other.                                                ***
  3095        //*************************************************************
  3096
  3097
  3098        Function DFGetCurrentDiagram Returns Integer
  3099            Integer iRetVal
  3100            Get DFCurrent_Diagram To iRetVal
  3101            Function_Return iRetVal
  3102        End_Function
  3103
  3104        Procedure DFSetCurrentDiagram Integer iDiagram
  3105            Set DFCurrent_Diagram To iDiagram
  3106        End_Procedure
  3107
  3108        Procedure DFSetDiagramList Integer Item# Integer iDiagram
  3109            Set Array_Value of (oDiagramArray(self));
  3110            Item Item# To iDiagram
  3111        End_Procedure
  3112
  3113        Function DFGetDiagramList Integer Item# Returns Integer
  3114            Integer iRetVal
  3115            Get Array_Value of (oDiagramArray(self));
  3116            Item Item# To iRetVal
  3117            Function_Return iRetVal
  3118        End_Function
  3119
  3120        Procedure DFClearDiagramList
  3121            Send Delete_Data To (oDiagramArray(self))
  3122        End_Procedure
  3123
  3124        Function DFGetCurrentColor Returns Dword
  3125            Dword   dwRetVal
  3126            Integer iCurrColor
  3127
  3128            Get DFCurrent_Color To iCurrColor
  3129            Get Array_Value Of (oDFColorArray(self));
  3130            Item iCurrColor To dwRetVal
  3131
  3132            Function_Return dwRetVal
  3133        End_Function
  3134
  3135
  3136        Function DFGetColor Integer iColor Returns Dword
  3137            DWord   dwRetVal
  3138
  3139            Get Array_Value Of (oDFColorArray(self));
  3140            Item iColor To dwRetVal
  3141
  3142            Function_Return dwRetVal
  3143        End_Function
  3144
  3145
  3146        //*************************************************************
  3147        //*** This procedures and functions are used when building  ***
  3148        //*** complex graphics when you need to change value of the ***
  3149        //*** current diagram, so you can mix diagrams within each  ***
  3150        //*** other.                                                ***
  3151        //*************************************************************
  3152
  3153    Procedure End_Construct_Object
  3154        Forward Send End_Construct_Object
  3155        Set Visible_State to FALSE
  3156        Send Page_Object TRUE
  3157    End_Procedure
  3158
  3159End_Class
  3160
  3161Use Winprint_Commands.pkg  // commands used by this class and by winprint2
  3162
  3163    //************************************************************************//
  3164    //                                                                        //
  3165    // $Module type: OBJECT                                                   //
  3166    // $Module name: oWinPrint                                                //
  3167    // $Author     : JW                                                       //
  3168    // Created     : 96-01-30 @ 18.45.49                                      //
  3169    //                                                                        //
  3170    // Description                                                            //
  3171    //                                                                        //
  3172    //                                                                        //
  3173    // $Rev History                                                           //
  3174    //   96-01-30 Ready for version 1.1                                       //
  3175    //   96-01-30 Module header created                                       //
  3176    //                                                                        //
  3177    //************************************************************************//
  3178
  3179//    Integer WinPrintId  // Provide simple access to global object //JT
  3180    Object oWinPrint is an DF_PRINTER
  3181
  3182        Procedure DFPrint
  3183            Integer iRetVal
  3184
  3185            Get DFPrintDialog To iRetVal
  3186
  3187            If iRetVal Eq PRN_TRUE Begin
  3188                Send DFPrintDoc
  3189                Send DFClearDoc
  3190            End
  3191        End_Procedure
  3192        Move self to WinPrintId
  3193    End_Object
  3194
  3195
  3196