Module Dfrptvw.pkg

     1// DFRPTVW.PKG
     2//
     3// ReportView
     4// ReportPanel
     5//
     6// Data Access Corporation
     7//
     8//  9/22/97 JJT      - moved print_to_xxx modes to PtrModes.pkg
     9// 12/05/96 JJT      - Converted from 3.1 character mode
    10// 06/08/95 LS & JJT - Converted from what is now Query_View
    11//
    12// ReportView  - Used to create modeless report views
    13//
    14//    Normally accessed with the Command Activate_View or Deferred_View
    15//    just like a normal view
    16//
    17// ReportPanel - Used to create modal popup report panels
    18//
    19//    Normally accessed with a Popup or Modal_Popup message.
    20//
    21//
    22// Both classes use the mixin ReportView_Mixin and share the following
    23//
    24// The public message protocol:
    25//
    26// Property Integer Report_Object_ID
    27//
    28//   Object ID of the Standard_Report object to communicate with. If during
    29//   end_construct_object it is 0, it will attempt to find a child report
    30//   object for you.
    31//
    32//
    33// Property Report_Object_Id
    34//   This contains the Id of the report to run. Normally this is set
    35//   automatically when the object created. During end_construct_object
    36//   it broadcasts a message to all possible reports asking for an ID.
    37//   If the report is "view enabled" it will assign an ID. This works if
    38//   there is only one report per view. If you have multiple reports you can
    39//   set this yourself or end run_report directly to the required child
    40//   report.
    41//
    42// Property Output_Device_Mode  Print_to_Window|Print_to_Printer|
    43//                              Print_to_File|Print_To_Printer_No_Dialog
    44// Property Output_Device_Name  stringval
    45//
    46//   Since it is so common to direct a report to either a logic device type
    47//   (printer, screen, file) or a device name these properties are provided to
    48//   make it easy for a report view to set these and a report to access them.
    49//   It is up to the report to choose to use these and it is up to the programmer
    50//   to set them.
    51//
    52// Send Run_Report
    53//
    54//   This runs the report in Report_object_id. While this could be used to
    55//   run a batch report (no UI is involved) it is expected that batch report
    56//   running will not be that simple. To run a batch report you will most
    57//   certainly need to create some new messages. You will either need to create
    58//   properties that you would set and the send run_report, or, you would create
    59//   a new message (e.g., run_vendor_report) which would expect you to pass
    60//   the required parameters to set-up and run the report.
    61//
    62//
    63
    64Use dfPanel.pkg
    65Use PtrModes.pkg   // define print_to_xxxx modes
    66
    67register_procedure Initialize_All_Reports Integer Obj Integer Msg
    68
    69Class ReportView_Mixin is a Mixin
    70    { Visibility=Private }
    71    procedure Define_ReportView_Mixin
    72        { Visibility=Private }
    73        Property integer Report_Object_ID 0
    74
    75        { EnumList="Print_To_File, Print_To_Printer, Print_To_Printer_No_Dialog, Print_To_Window" }
    76        { Category=Report }
    77        Property integer Output_Device_Mode Print_To_Printer
    78        { Category=Report }
    79        Property String  Output_Device_Name ""
    80        Property Handle  Server
    81        { DesignTime=False }
    82        Property Handle  Main_DD
    83    end_procedure
    84
    85    { Visibility=Private }
    86    procedure Report_Callback integer Obj
    87        If (Report_Object_ID(self)=0) ;
    88            set Report_Object_ID to Obj
    89    end_procedure
    90
    91    { Visibility=Private }
    92    procedure Define_End_ReportView_Mixin
    93        integer Cur_Obj
    94        // if the report id has not been set yet:
    95        // ask the first report object to identify itself. If it does not
    96        // leave it at 0.
    97        move self to Cur_Obj
    98        broadcast send Initialize_All_Reports Cur_Obj MSG_Report_CallBack
    99    end_procedure
   100
   101    Procedure Run_Report
   102        integer Obj
   103        Get Report_Object_Id to Obj
   104        If Obj send Run_Report to Obj
   105    End_procedure
   106
   107    Procedure Request_Cancel
   108      Send Deactivate
   109    End_procedure
   110
   111    { NoDoc=True }
   112    Procedure Deactivate Integer eDeactivateScope Returns Integer
   113        handle hoReport
   114        integer iFail eArea
   115        Move (if(num_arguments=0, AREA_TYPE, eDeactivateScope)) to eArea // in case no param is passed
   116
   117        if (eArea<>0) begin // when eArea is zero, we've already done this once
   118            // augment to send OnClosingView to the report. If this is a winprint2
   119            // report it will use this to clear the document. All other reports
   120            // will do nothing, possibly delegating back to here
   121            Get Report_Object_Id to hoReport
   122            if hoReport begin
   123                Send OnClosingView to hoReport
   124            end
   125       end
   126       Forward get msg_deactivate eArea to iFail
   127       Procedure_Return iFail
   128    end_procedure
   129
   130    { Visibility=Private }
   131    Procedure OnClosingView
   132        // do nothing, this catches messages the delegate.
   133    end_procedure
   134
   135
   136End_class
   137
   138{ ComponentType=RVClass }
   139{ HelpTopic=ReportView }
   140{ DDOHost=True }
   141{ DataAware=True }
   142Class ReportView is a View
   143
   144   Import_Class_Protocol ReportView_Mixin
   145
   146   Procedure Construct_Object
   147      Forward Send Construct_Object
   148      Send Define_ReportView_Mixin
   149   End_Procedure // Construct_Object
   150
   151   Procedure End_Construct_Object
   152      Send Define_End_ReportView_Mixin
   153      Forward Send End_Construct_Object
   154   End_Procedure // End_Construct_Object
   155
   156End_Class
   157
   158{ HelpTopic=ReportPanel }
   159{ DDOHost=True }
   160{ DataAware=True }
   161Class ReportPanel is a ModalPanel
   162
   163   Import_Class_Protocol ReportView_Mixin
   164
   165   Procedure Construct_Object
   166      Forward Send Construct_Object
   167      Send Define_ReportView_Mixin
   168   End_Procedure // Construct_Object
   169
   170   Procedure End_Construct_Object
   171      Send Define_End_ReportView_Mixin
   172      Forward Send End_Construct_Object
   173   End_Procedure // End_Construct_Object
   174
   175End_Class
   176