Module cCrystalPreview.pkg

     1Use DFADlg.pkg   // defines view class
     2Use cCrystalActiveXReportViewer.pkg
     3
     4// PREVIEW WINDOW - Object is created for each PRINT_TO_WINDOW
     5
     6// This subclass will be used to display reports to the screen.
     7
     8{ HelpTopic=cCrystalPreview }
     9Class cCrystalPreview Is A View
    10
    11    Procedure Construct_Object
    12        Boolean bAttached
    13        Handle  hoViewer
    14        Forward Send Construct_Object
    15        Set Border_Style To Border_Thick    // Makes preview resizable
    16        Set Maximize_Icon To True           // Allow maximize
    17
    18        { Category=Report }
    19        Property Integer piZoom 1           // 1- fit width, 2 fit page, all other numbers are a percentage
    20        { Category=Report }
    21        Property Handle phoActiveXReportViewer 0
    22
    23        // create RDC Previewer
    24        Get Create U_cCrystalActiveXReportViewer to hoViewer
    25        Set Location  of hoViewer To 0 0
    26        Set peAnchors of hoViewer To anAll
    27        Send CreateComObject of hoViewer
    28        Send AssignViewerDefaults hoViewer
    29        Set phoActiveXReportViewer to hoViewer
    30        Set GuiSize to (GetSystemMetrics (SM_CYSCREEN)-150)  (GetSystemMetrics (SM_CXSCREEN)-75) // client area size
    31        Send Adjust_Logicals
    32        Set GuiSize of hoViewer to (Hi(GuiSize(Self))) (Low(GuiSize(Self))) // window size same as parent client area size
    33        Send Adjust_Logicals of hoViewer
    34    End_Procedure  // Construct_Object
    35
    36    // this is called when the com viewer is created and is used to set properties of the
    37    // viewer. This could be augmented in a sub-class to create you own preferences.
    38    { MethodType=Procedure }
    39    Procedure AssignViewerDefaults handle hoViewer
    40        Set ComDisplayToolbar           of hoViewer To True
    41        Set ComDisplayBorder            of hoViewer To False
    42        Set ComDisplayTabs              of hoViewer To False
    43        Set ComDisplayBackgroundEdge    of hoViewer To True
    44        Set ComDisplayGroupTree         of hoViewer To False
    45        //
    46        Set ComEnableGroupTree          of hoViewer To False
    47        Set ComEnableStopButton         of hoViewer To False
    48        Set ComEnablePrintButton        of hoViewer To True
    49        Set ComEnableCloseButton        of hoViewer To False
    50        Set ComEnableRefreshButton      of hoViewer To False
    51        Set ComEnableExportButton       of hoViewer To True
    52        Set ComEnableSearchExpertButton of hoViewer To True
    53        Set ComEnableHelpButton         of hoViewer To False
    54        //
    55        Set ComEnableZoomControl        of hoViewer To True
    56        Set ComEnableProgressControl    of hoViewer To True
    57        Set ComEnableSearchControl      of hoViewer To True
    58        Set ComEnableNavigationControls of hoViewer To True
    59        //
    60        Set ComEnableDrillDown          of hoViewer To False
    61        Set ComEnableAnimationCtrl      of hoViewer To True
    62        Set ComEnableSelectExpertButton of hoViewer To False
    63        Set ComEnablePopupMenu          of hoViewer To False
    64        Set ComLaunchHTTPHyperlinksInNewBrowser of hoViewer To True
    65    End_Procedure
    66
    67    //Displays report in the preview control.
    68    Procedure DisplayReport Handle hoReport
    69        Handle hoViewer
    70        Get phoActiveXReportViewer to hoViewer
    71        If (hoViewer) Begin
    72            Send Popup Of (Self)
    73            Set  ComReportSource Of hoViewer To (pvComObject(hoReport))
    74            Send ComViewReport   Of hoViewer
    75            Send ComZoom         Of hoViewer (piZoom(Self))
    76        End
    77        Else Begin
    78            Error DFERR_CRYSTAL_REPORT C_$CrystalCOMPreviewerNotCreated
    79            Send Destroy
    80        End
    81    End_Procedure // DisplayReport
    82
    83    //Destroy report when it is closed.
    84    { NoDoc=True }
    85    Procedure Deactivate Integer iScope Returns Integer
    86        Integer iRet
    87        If (Num_Arguments) Begin
    88            Forward Get msg_Deactivate iScope To iRet
    89        End
    90        Else Begin
    91            Forward Get msg_Deactivate To iRet
    92            Send Destroy
    93        End
    94    End_Procedure
    95End_Class // cCrystalPreview
    96
    97