Module cSigCJCalendarControl.pkg

     1//==============================================================================
     2// Project      : SigCj - VDF Classes for Codejock
     3// File         : cSigCJCalendarControl.pkg
     4// Description  : VDF Class for Codejock control
     5//
     6// Revision     : $Rev: 624 $
     7//                $Date: 2010-02-26 15:56:09 -0500 (Fri, 26 Feb 2010) $
     8//                $Author: martin $
     9//
    10// Requirements : Visual DataFlex 12.1+
    11//                Codejock SuitePro - Version 12.0.0+
    12//
    13// Copyright    : (c) 2008 VDF SIG UK
    14//                Visual DataFlex Special Interest Group UK.
    15//                http://www.vdfsig.co.uk/
    16//                dev@vdfsig.co.uk
    17//
    18//                This file is part of SigCj.
    19//
    20//                SigCj is free software: you can redistribute it and/or modify
    21//                it under the terms of the GNU Lesser General Public License
    22//                as published by the Free Software Foundation, either version
    23//                2.1 of the License, or (at your option) any later version.
    24//
    25//                SigCj is distributed in the hope that it will be useful, but
    26//                WITHOUT ANY WARRANTY; without even the implied warranty of
    27//                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    28//                GNU Lesser General Public License for more details.
    29//
    30//                If you have the complete SigCj workspace then a copy of the
    31//                GNU Lesser General Public License is in the Docs folder. If
    32//                not, see <http://www.gnu.org/licenses/>.
    33//
    34//==============================================================================
    35
    36//==============================================================================
    37//NOTES
    38//=====
    39//CAUTION - Codejock use the term "Event" for an item / entry in the calendar.
    40//          Do not confuse program events with calendar items!!!
    41//==============================================================================
    42
    43//Comment out the next line to remove all references to the standard files. If 
    44//you do not want to use the standard files you have to do this to stop the 
    45//compiler complaining.
    46Define SigCj_Use_StdFiles
    47
    48//Comment out the next line to remove all references to the standard special 
    49//date files. If you do not want to use the standard special date files you 
    50//have to do this to stop the compiler complaining.
    51Define SigCj_Use_StdDates
    52
    53//Comment out the next line to remove all references to the standard resource 
    54//and schedule files. If you do not want to use the standard resource and 
    55//schedule files you have to do this to stop the compiler complaining.
    56Define SigCj_Use_StdResources
    57
    58//==============================================================================
    59//Use Codejock
    60
    61Use SigCjW_Calendar.pkg
    62Use cSigCJMethods_Mixin.pkg
    63Use cSigCJPushButton.pkg
    64Use cSigCJContextMenu.pkg
    65
    66//=============================================================================
    67//Enums
    68//=====
    69//
    70//TimeScale
    71//---------
    72Define eCal_TimeScale_5       for 5
    73Define eCal_TimeScale_10      for 10
    74Define eCal_TimeScale_15      for 15
    75Define eCal_TimeScale_20      for 20
    76Define eCal_TimeScale_30      for 30
    77Define eCal_TimeScale_60      for 60
    78
    79//ViewType
    80//--------
    81Define eCal_ViewType_Day      for OLExtpCalendarDayView
    82Define eCal_ViewType_Working  for OLExtpCalendarWorkWeekView
    83Define eCal_ViewType_Week     for OLExtpCalendarWeekView
    84Define eCal_ViewType_Month    for OLExtpCalendarMonthView
    85Define eCal_ViewType_FullWeek for OLExtpCalendarFullWeekView
    86
    87//Data Providers
    88//--------------
    89Define eCal_DataProvider_XML      for "XML"
    90Define eCal_DataProvider_Access   for "Microsoft.Jet.OLEDB.4.0"
    91Define eCal_DataProvider_Outlook  for "MAPI"
    92Define eCal_DataProvider_Custom   for "custom"
    93
    94//Built In Dialogs
    95//----------------
    96Define eCal_Dialog_NewEvent       for 1
    97Define eCal_Dialog_EditEvent      for 2
    98Define eCal_Dialog_EditRecurrence for 3
    99Define eCal_Dialog_Reminders      for 4
   100Define eCal_Dialog_TimeScale      for 5
   101Define eCal_Dialog_NewEvent2      for 6
   102
   103//Mouse Buttons
   104//-------------
   105Define eCal_Mouse_Button_Left    for 1
   106Define eCal_Mouse_Button_Right   for 2
   107
   108Define eCal_Mouse_Shift          for 1
   109Define eCal_Mouse_Ctrl           for 2
   110Define eCal_Mouse_Alt            for 4
   111Define eCal_Mouse_Shift_Ctrl     for (eCal_Mouse_Shift + eCal_Mouse_Ctrl )
   112Define eCal_Mouse_Alt_Shift      for (eCal_Mouse_Alt   + eCal_Mouse_Shift)
   113Define eCal_Mouse_Alt_Ctrl       for (eCal_Mouse_Alt   + eCal_Mouse_Ctrl )
   114Define eCal_Mouse_Shift_Alt_Ctrl for (eCal_Mouse_Shift + eCal_Mouse_Alt + eCal_Mouse_Ctrl)
   115
   116//Show Caption Bar
   117//----------------
   118Define eCal_NoCaptionBar                for 0
   119Define eCal_ShowCaptionBar              for 1
   120Define eCal_CaptionBarDateLabel         for 2
   121Define eCal_CaptionBarScrollDateButtons for 4
   122Define eCal_CaptionBarSwitchViewButtons for 8
   123Define eCal_FullCaptionBar              for 15
   124
   125//Days
   126//----
   127Define eCal_Sunday      for 1
   128Define eCal_Monday      for 2
   129Define eCal_Tuesday     for 3
   130Define eCal_Wednesday   for 4
   131Define eCal_Thursday    for 5
   132Define eCal_Friday      for 6
   133Define eCal_Saturday    for 7
   134
   135//Month / Week view options
   136//-------------------------
   137Define eCal_MW_None    for 0
   138Define eCal_MW_Week    for 1
   139Define eCal_MW_Month   for 2
   140Define eCal_MW_Both    for 3
   141
   142//Working Week Mask -WW
   143//---------------------
   144Define eCal_WW_Sunday    for OLExtpCalendarDaySunday
   145Define eCal_WW_Monday    for OLExtpCalendarDayMonday
   146Define eCal_WW_Tuesday   for OLExtpCalendarDayTuesday
   147Define eCal_WW_Wednesday for OLExtpCalendarDayWednesday
   148Define eCal_WW_Thursday  for OLExtpCalendarDayThursday
   149Define eCal_WW_Friday    for OLExtpCalendarDayFriday
   150Define eCal_WW_Saturday  for OLExtpCalendarDaySaturday
   151Define eCal_WW_AllWeek   for OLExtpCalendarDayAllWeek
   152Define eCal_WW_SaSu      for OLExtpCalendarDaySaSu
   153Define eCal_WW_Mo_Fr     for OLExtpCalendarDayMo_Fr
   154
   155//Time Mark
   156//---------
   157Define eCal_TM_None             for OLExtpCalendarCurrentTimeMarkNone
   158Define eCal_TM_VisibleForToday  for OLExtpCalendarCurrentTimeMarkVisibleForToday
   159Define eCal_TM_VisibleAlways    for OLExtpCalendarCurrentTimeMarkVisibleAlways
   160Define eCal_TM_Printed          for OLExtpCalendarCurrentTimeMarkPrinted
   161
   162//Special Dates - Allow Edit
   163Define eCal_AE_No   for 0
   164Define eCal_AE_Yes  for 1
   165Define eCal_AE_Ask  for 2
   166
   167//Resources
   168Define eCal_RS_None         for 0
   169Define eCal_RS_StdFiles     for 1 
   170Define eCal_RS_CustomFiles  for 2
   171
   172//Data Types
   173Define eCal_DT_DataFlex for 1
   174Define eCal_DT_OutLook  for 2
   175
   176//=============================================================================
   177
   178Struct tdEvent
   179    Integer iURN              //NUM  8.0
   180    Boolean bAllDayEvent      //NUM  2.0
   181    String  sBody             //ASC  254
   182    Integer eBusyStatus       //NUM  2.0
   183    String  sCategories       //ASC  254
   184    Date    dCreationDate     //DAT    6
   185    String  tmCreationTime    //ASC    5
   186    String  sCustomIcons      //ASC  254
   187    String  sCustomProp       //ASC  254
   188    Date    dEndDate          //DAT    6
   189    String  tmEndTime         //ASC    5
   190    Integer eImportance       //NUM  2.0
   191    String  sLabel            //ASC  254
   192    Date    dLastMod_Date     //DAT    6
   193    String  tmLastMod_Time    //ASC    5
   194    String  sLocation         //ASC  254
   195    Boolean bMeetingFlag      //NUM  2.0
   196    Boolean bPrivateFlag      //NUM  2.0
   197    Integer eRecurr_State     //NUM  2.0
   198    Boolean bReminder         //NUM  2.0
   199    Integer iRem_MinsBefore   //NUM  8.0
   200    String  sRem_SoundFile    //ASC  254
   201    Integer iScheduleID       //NUM  8.0
   202    Date    dStartDate        //DAT    6
   203    String  tmStartTime       //ASC    5
   204    String  sSubject          //ASC  254
   205    Date    dRE_StartDateOrg  //DAT    6
   206    String  tmRE_StartTimeOrg //ASC    5
   207    Date    dRE_EndDateOrg    //DAT    6
   208    String  tmRE_EndTimeOrg   //ASC    5
   209    Boolean bRE_Deleted       //NUM  2.0
   210    Integer iRec_Pattern_id   //NUM  8.0
   211End_Struct
   212
   213Struct tdR_Pat
   214  //Member                    File  Def
   215  //------------------------- ----------
   216    Integer iURN              //NUM 8.0
   217    String  sCustomProp_XML   //ASC 254
   218    Integer iDurationMinutes  //NUM 8.0
   219    Integer iEndAfterOcc      //NUM 8.0
   220    Date    dEndDate          //DAT   6
   221    String  tmEndTime         //ASC   5
   222    Integer eEndMethod        //NUM 2.0
   223    Integer iMasterEventId    //NUM 8.0
   224    Date    dStartDate        //DAT   6
   225    String  tmStartTime       //ASC   5
   226    Boolean bRoD_WeekDayOnly  //NUM 2.0
   227    Integer iRoD_Int_Days     //NUM 4.0
   228    Integer iRoData1          //NUM 8.0
   229    Integer iRoData2          //NUM 8.0
   230    Integer iRoData3          //NUM 8.0
   231    Integer iRoData4          //NUM 8.0
   232    Integer iRoM_DayOfMonth   //NUM 2.0
   233    Integer iRoM_Int_Months   //NUM 8.0
   234    Integer iRoM_NthInt_Mths  //NUM 8.0
   235    Integer iRoM_Nth_Day      //NUM 2.0
   236    Integer eRoM_Nth_DayMask  //NUM 2.0
   237    Integer eRoRecurr_Type    //NUM 2.0
   238    Integer eRoW_DayWeekMask  //NUM 2.0
   239    Integer iRoW_Int_Weeks    //NUM 8.0
   240    Integer iRoY_DayOfMonth   //NUM 2.0
   241    Integer iRoY_MonthOfYear  //NUM 2.0
   242    Integer iRoY_NthM_OfYear  //NUM 8.0
   243    Integer iRoY_Nth_Day      //NUM 2.0
   244    Integer iRoY_Nth_DayMask  //NUM 8.0
   245End_Struct
   246
   247Struct tdCal_Category
   248    Integer iURN            //NUM 2.0
   249    String  sShort_Desc     //ASC  10
   250    String  sLong_Desc      //ASC  40
   251    Integer iBorder_Color  //NUM 8.0
   252    Integer iColor_Light   //NUM 8.0
   253    Integer iColor_Dark    //NUM 8.0
   254    Number  nGradient       //NUM 2.2
   255    Integer iCategory_Set   //NUM 4.0
   256End_Struct
   257
   258Struct tdCal_Dates
   259    Date    dDate
   260    String  sTitle
   261    Integer iBackColor
   262    Boolean bAllDay
   263    Integer eAllowEvents
   264End_Struct
   265
   266//=============================================================================
   267//A global handle is created for the Calendar control. This makes it easier for
   268//other objects that need to 'connect' to the calendar control. E.G. the
   269//Data Picker object.
   270
   271Global_Variable Handle ghoSigCj_Calendar
   272
   273//=============================================================================
   274//Datafiles Cal_Sys  - This provides Unique Reference Numbers for the other two files.
   275//                     (Includes methods to allocate the URNs)
   276//          CalEvent - This stores the calendar events.
   277//                     (The DD is not used... but we need the file to be open)
   278//          CalR_Pat - This stores the Recurrence Paterns for the calendar events.
   279//                     (The DD is not used... but we need the file to be open)
   280//          Cal_Cats - This stores the custom categoey details.
   281//                     (The DD is not used... but we need the file to be open)
   282
   283#IFDEF SigCj_Use_StdFiles
   284Use Cal_Sys.DD
   285Use CalEvent.DD
   286Use CalR_Pat.DD
   287Use Cal_Cats.DD
   288#ENDIF
   289
   290#IFDEF SigCj_Use_StdDates
   291Use Cal_Date.DD
   292#ENDIF
   293
   294#IFDEF SigCj_Use_StdResources
   295Use Cal_Lay.DD
   296Use Cal_Res.DD
   297Use Cal_Sch.DD
   298Use Cal_SRL.DD
   299#ENDIF
   300
   301//=============================================================================
   302//Context Menu
   303//=============================================================================
   304
   305Define cEventRCCM_RemoveException  for 1
   306Define cEventRCCM_GotoCRM          for 2    //Not Used
   307
   308Class cCRM_MenuItem is a cCJMenuItem
   309
   310    Procedure Construct_Object
   311        Forward Send Construct_Object
   312
   313        { DesignTime=False }
   314        Property Handle  phoCallBack
   315        { DesignTime=False }
   316        Property Handle  phmMsg
   317        { DesignTime=False }
   318        Property Variant pvEvent
   319
   320        Set pbEnabled   to False
   321        Set pbVisible   to False
   322    End_Procedure
   323
   324    //-------------------------------------------------------------------------
   325
   326    Procedure OnExecute Variant vCommandBarControl
   327        Handle  hoCallBack hmMsg
   328        Variant vEvent
   329        String  sMessage
   330
   331        Get phoCallBack to hoCallBack
   332        Get phmMsg      to hmMsg
   333        Get pvEvent     to vEvent
   334
   335        Send hmMsg of hoCallBack vEvent
   336    End_Procedure
   337End_Class
   338
   339//-----------------------------------------------------------------------------
   340
   341Class cEventRCCM is a cCJContextMenu
   342
   343    Procedure Construct_Object
   344        Forward Send Construct_Object
   345
   346        Property Integer piItemCount 0
   347
   348        //Define a cCRM_MenuItem object for each item that may be required.
   349
   350        Object oRemoveException is a cCRM_MenuItem
   351        End_Object
   352
   353        //Object oGotoCRM is a cCRM_MenuItem
   354        //End_Object
   355
   356    End_Procedure
   357
   358    //-------------------------------------------------------------------------
   359
   360    Procedure ConfigureItem Integer eItem Handle hoCallBack Handle hmMsg String sCaption Boolean bSeparator Variant vEvent
   361        Handle  hoItem
   362        Integer iItemCount
   363
   364//        If (eItem = cEventRCCM_GotoCRM)         Move oGotoCRM         to hoItem
   365        If (eItem = cEventRCCM_RemoveException) Move oRemoveException to hoItem
   366        If (hoItem > 0) Begin
   367            Set phoCallBack of hoItem to hoCallBack
   368            Set phmMsg      of hoItem to hmMsg
   369            Set pvEvent     of hoItem to vEvent
   370            Set psCaption   of hoItem to sCaption
   371            Set pbEnabled   of hoItem to True
   372            Set pbVisible   of hoItem to True
   373
   374            Get piItemCount to iItemCount
   375            Set piItemCount to (iItemCount + 1)
   376
   377            If (bSeparator and (iItemCount > 0)) Set pbControlBeginGroup of hoItem to True
   378        End
   379    End_Procedure
   380
   381    //-------------------------------------------------------------------------
   382
   383    Procedure Display_RCCM
   384        Send Popup
   385    End_Procedure
   386End_Class
   387
   388//=============================================================================
   389//Dialogs
   390//=============================================================================
   391
   392Class cCJ_CalendarDialogs is a cSigCjComCalendarDialogs
   393    Procedure Construct_Object
   394        Boolean bIsComObjectCreated bRetVal
   395        Handle  hWND
   396        Variant vCal_ComObject
   397
   398        Forward Send Construct_Object
   399
   400        Get IsComObjectCreated to bIsComObjectCreated
   401        If (not(bIsComObjectCreated)) Begin
   402            Send CreateComObject
   403        End
   404
   405        //Attached the dialogs to the calendar container
   406        Move (Window_Handle(Parent(Self))) to hWND
   407        Set ComParentHWND to hWND
   408
   409        //Attached the dialogs ro the calendar object
   410        Get pvComObject of ghoSigCj_Calendar to vCal_ComObject
   411        Set ComCalendar to vCal_ComObject
   412
   413        //Reminders
   414        Get ComCreateRemindersWindow to bRetVal
   415    End_Procedure
   416End_Class
   417
   418//=============================================================================
   419//Date Picker
   420//=============================================================================
   421
   422{ DesignerClass=cDTContainer3D }
   423Class cSigCJCalendarDatePicker is a cSigCjComDatePicker
   424
   425    Procedure Construct_Object
   426        Forward Send Construct_Object   // very important!
   427
   428        Set peAutoCreate to acAutoCreate
   429
   430        { DesignTime=False }
   431        Property Boolean Private_pbDayMetrics False
   432
   433    End_Procedure
   434
   435    Procedure End_Construct_Object
   436        Variant vCJ_Cal
   437
   438        Forward Send End_Construct_Object   // very important!
   439
   440        //Set defaults
   441        Set ComBorderStyle     to OLExtpDatePickerBorderNone
   442        Set ComShowWeekNumbers to True
   443
   444        //Set Theme
   445        //We will be using the Office 07 theme, so (as yet) I have not
   446        //implemented theme changing.
   447        Send Set_Theme_To_Office_07
   448
   449        //Attach to the Calendar control
   450        Get pvComObject of ghoSigCj_Calendar to vCJ_Cal
   451        Send ComAttachToCalendar vCJ_Cal
   452    End_Procedure
   453
   454    Procedure OnCreate
   455        Forward Send OnCreate
   456        
   457        If (Private_pbDayMetrics(Self)) Begin
   458            Set ComAskDayMetrics to True
   459            Send OnSetDateRange
   460        End 
   461        
   462    End_Procedure  
   463       
   464   { MethodType=Property Category="CodeJock" InitialValue=False }
   465    Procedure Set pbDayMetrics Boolean bValue
   466         Set Private_pbDayMetrics to bValue
   467    End_Procedure
   468
   469    Function pbDayMetrics Returns Boolean
   470        Function_Return (Private_pbDayMetrics(Self))  
   471    End_Function
   472
   473    { MethodType=Event }        
   474    Procedure OnSetDateRange
   475        // Hook for setting the date range
   476    End_Procedure
   477
   478    { MethodType=Event }        
   479    Procedure OnDayMetrics Handle hoDayMetrics Date dValue
   480        // Hook, sent for each day in the date range
   481    End_Procedure
   482    
   483    // This will only get called if pbDayMetrics is set to True
   484    Procedure OnComDayMetrics DateTime llDay Variant llMetrics
   485        Handle hoDayMetrics 
   486        Date   dDate
   487
   488        Move llDay to dDate
   489        Get Create U_cSigCjComDatePickerDayMetrics to hoDayMetrics
   490        Set pvComObject of hoDayMetrics to llMetrics
   491            Send OnDayMetrics hoDayMetrics dDate    
   492        Send Destroy of hoDayMetrics
   493    End_Procedure
   494
   495    Procedure Set_Theme_To_Office_07
   496        Handle hoThemeOffice07
   497        Variant vTheme
   498
   499        Get Create U_cSigCjComDatePickerThemeOffice2007 to hoThemeOffice07
   500            Get pvComObject of hoThemeOffice07 to vTheme
   501            Send ComSetTheme vTheme
   502        Send Destroy of hoThemeOffice07
   503    End_Procedure
   504
   505End_Class
   506
   507//=============================================================================
   508//Calendar - class definition
   509//=============================================================================
   510
   511{ OverrideProperty=Label_Col_Offset          DesignTime=False }
   512{ OverrideProperty=Label_Justification_Mode  DesignTime=False }
   513{ OverrideProperty=Label_Row_Offset          DesignTime=False }
   514{ OverrideProperty=piMinSize                 DesignTime=False }
   515{ OverrideProperty=Border_Style              DesignTime=False }
   516{ OverrideProperty=Visible_State             DesignTime=False }
   517{ OverrideProperty=Attach_Parent_State       DesignTime=False }
   518{ OverrideProperty=Block_Mouse_State         DesignTime=False }
   519{ OverrideProperty=Client_Area_State         DesignTime=False }
   520{ OverrideProperty=Delegation_Mode           DesignTime=False }
   521{ OverrideProperty=Focus_Mode                DesignTime=False }
   522{ OverrideProperty=pbBindValue               DesignTime=False }
   523{ OverrideProperty=peAutoCreate              DesignTime=False }
   524{ OverrideProperty=peNeighborhood            DesignTime=False }
   525{ OverrideProperty=Popup_State               DesignTime=False }
   526{ OverrideProperty=Ring_State                DesignTime=False }
   527{ OverrideProperty=Scope_State               DesignTime=False }
   528{ OverrideProperty=Search_Case               DesignTime=False }
   529{ OverrideProperty=Skip_State                DesignTime=False }
   530{ OverrideProperty=Help_Id                   DesignTime=False }
   531{ OverrideProperty=Help_Keyword              DesignTime=False }
   532{ OverrideProperty=psHtmlHelpTopic           DesignTime=False }
   533{ OverrideProperty=Status_Help               DesignTime=False }
   534{ OverrideProperty=Use_Parent_Status_Help    DesignTime=False }
   535{ OverrideProperty=psLicenseKey              DesignTime=False }
   536{ OverrideProperty=psProgID                  DesignTime=False }
   537{ OverrideProperty=Color                     InitialValue=clActiveCaption }
   538Class cSigCJCalendarControl is a cSigCjComCalendarControl
   539    Import_Class_Protocol cSigCJMethods_Mixin
   540
   541    //=========================================================================
   542
   543    Procedure Construct_Object
   544        Forward Send Construct_Object
   545
   546        Set peAutoCreate to acAutoCreate
   547        Move Self to ghoSigCj_Calendar
   548
   549        //---------------------------------------------------------------------
   550
   551        { Visibility=Private DesignTime=False }
   552        Property Handle phoOptions
   553        { Visibility=Private DesignTime=False }
   554        Property Handle phoPrintOptions
   555        { Visibility=Private DesignTime=False }
   556        Property Handle phoPrintPreviewOptions
   557
   558        { DesignTime=False }
   559        Property tdEvent        ptEvent_Buffer
   560        { DesignTime=False }
   561        Property tdR_Pat        ptR_Pat_Buffer
   562        { DesignTime=False }
   563        Property tdCal_Dates[]  ptCal_Dates
   564        
   565        //---------------------------------------------------------------------
   566
   567        { DesignTime=False }
   568        Property Boolean  pbUseIcons                         True
   569        { DesignTime=False }
   570        Property Boolean  pbUseCustomIcons                   False
   571        { DesignTime=False }
   572        Property Boolean  pbUseCustomProperties              False
   573        { DesignTime=False }
   574        Property DateTime pdtHitDateTime
   575        { DesignTime=False }
   576        Property Integer  Private_peCaptionBar                       eCal_FullCaptionBar
   577        { DesignTime=False }
   578        Property Boolean  Private_pbEnableReminders                  True
   579        { DesignTime=False }
   580        Property Boolean  Private_pbEnableStdToolTips                True
   581        { DesignTime=False }
   582        Property String   Private_psPrintPreviewTitle                ""
   583        { DesignTime=False }
   584        Property Boolean  Private_pbUseCustomDialogs                 False
   585        { DesignTime=False }
   586        Property Boolean  Private_pbUseCustomCategories              False
   587        { DesignTime=False }
   588        Property Boolean  Private_pbClickToAdd                       True
   589        { DesignTime=False }
   590        Property String   Private_psClickToAddText                   //
   591        { DesignTime=False }
   592        Property Integer  Private_peDayViewCurrentTimeMarkVisible    eCal_TM_VisibleAlways
   593        { DesignTime=False }
   594        Property Boolean  Private_pbDayViewShowMinutes               True
   595        { DesignTime=False }
   596        Property Boolean  Private_pbInPlaceCreateEvent               False
   597        { DesignTime=False }
   598        Property Boolean  Private_pbInPlaceEdit_AfterEventResize     False
   599        { DesignTime=False }
   600        Property Boolean  Private_pbInPlaceEdit_ByF2                 False
   601        { DesignTime=False }
   602        Property Boolean  Private_pbInPlaceEdit_ByMouseClick         False
   603        { DesignTime=False }
   604        Property Boolean  Private_pbInPlaceEdit_ByTab                False
   605        { DesignTime=False }
   606        Property Integer  Private_peFirstDayOfTheWeek                eCal_Sunday
   607        { DesignTime=False }
   608        Property Boolean  Private_pbCompressWeekendDays              True
   609        { DesignTime=False }
   610        Property Boolean  Private_pbUseOutlookGlyphs                 False
   611        { DesignTime=False }
   612        Property Integer  Private_peShowEndDate                      eCal_MW_None
   613        { DesignTime=False }
   614        Property Integer  Private_peShowTimeAsClocks                 eCal_MW_None
   615        { DesignTime=False }
   616        Property Integer  Private_peTimeScale                        eCal_TimeScale_30
   617        { DesignTime=False }
   618        Property Integer  Private_peViewType                         eCal_ViewType_Working
   619        { DesignTime=False }
   620        Property String   Private_ptmWorkDayEndTime                  "17:00"
   621        { DesignTime=False }
   622        Property String   Private_ptmWorkDayStartTime                "09:00"
   623        { DesignTime=False }
   624        Property Integer  Private_peWorkWeekMask                     eCal_WW_Mo_Fr
   625        { DesignTime=False }
   626        Property String   Private_ptmTimeScaleMinTime                "08:00"
   627        { DesignTime=False }
   628        Property String   Private_ptmTimeScaleMaxTime                "19:00"
   629
   630        { DesignTime=False }
   631        Property Boolean  Private_pbPrnLandscape                     False
   632        { DesignTime=False }
   633        Property Boolean  Private_pbPrnGreyScale                     False
   634        { DesignTime=False }
   635        Property Boolean  Private_pbPrnPrintDateHeader               False
   636        { DesignTime=False }
   637        Property DateTime Private_pdtPrnPrintFrom                    //
   638        { DesignTime=False }
   639        Property DateTime Private_pdtPrnPrintTo                      //
   640        { DesignTime=False }
   641        Property Boolean  Private_pbPrnFromToExactly                 False
   642        { DesignTime=False }
   643        Property String   Private_psPrnFooterLeft                    ""
   644        { DesignTime=False }
   645        Property String   Private_psPrnFooterCenter                  ""
   646        { DesignTime=False }
   647        Property String   Private_psPrnFooterRight                   ""
   648        { DesignTime=False }
   649        Property String   Private_psPrnHeaderLeft                    ""
   650        { DesignTime=False }
   651        Property String   Private_psPrnHeaderCenter                  ""
   652        { DesignTime=False }
   653        Property String   Private_psPrnHeaderRight                   ""
   654        { DesignTime=False }
   655        Property Number   Private_pnPrnMarginBottom                  1.0
   656        { DesignTime=False }
   657        Property Number   Private_pnPrnMarginTop                     1.0
   658        { DesignTime=False }
   659        Property Number   Private_pnPrnMarginLeft                    1.0
   660        { DesignTime=False }
   661        Property Number   Private_pnPrnMarginRight                   1.0
   662        { DesignTime=False }
   663        Property Boolean  Private_pbMultiColumnWeekMode              True
   664
   665        //---------------------------------------------------------------------
   666
   667        { Category=Codejock InitialValue=16777215 }
   668        Property Integer piWorkingCellBackColor     16777215
   669        { Category=Codejock InitialValue=16248294 }
   670        Property Integer piNonWorkingCellBackColor  16248294
   671        { Category=Codejock InitialValue="CAUTION - Special Date" }
   672        Property String psAllowEventTitle           "CAUTION - Special Date"
   673        { Category=Codejock InitialValue="Create Event?" }
   674        Property String psAllowEventText            "Create Event?"
   675        
   676        //---------------------------------------------------------------------
   677
   678        { Category=Codejock }
   679        Property String  ptmLastWorkDayEndTime      "16:00"
   680        { Category=Codejock }
   681        Property Boolean pbShorterLastDay           True
   682        { Category=Codejock }
   683        Property Boolean pbShadeLunchTime           True
   684        { Category=Codejock }
   685        Property String  ptmLunchEndTime            "14:00"
   686        { Category=Codejock }
   687        Property String  ptmLunchStartTime          "13:00"
   688        { Category=Codejock }
   689        Property Boolean pbUseStdFiles              True
   690        { Category=Codejock }
   691        Property Boolean pbUseStdDates              True
   692        { Category=Codejock }
   693        Property Boolean pbUseScaleTimes            False
   694
   695        //---------------------------------------------------------------------
   696        //Commonly used objects or objects many levels down (so once found we save them here for speed).
   697        { DesignTime=False }
   698        Property Handle  phoOptions                         (Create(Self, U_cSigCjComCalendarOptions))
   699        { DesignTime=False }
   700        Property Handle  phoPrintOptions                    (Create(Self, U_cSigCjComCalendarPrintOptions))
   701        { DesignTime=False }
   702        Property Handle  phoPrintPreviewOptions             (Create(Self, U_cSigCjComXtremePrintPreviewOptions))
   703        { DesignTime=False }
   704        Property Handle  phoDayView                         (Create(Self, U_cSigCjComCalendarDayView))
   705        
   706        { DesignTime=False }
   707        Property Handle  Private_phoWorkingCellColors       (Create(Self, U_cSigCjComCalendarThemeDayViewCellColors))
   708        { DesignTime=False }
   709        Property Handle  Private_phoNonWorkingCellColors    (Create(Self, U_cSigCjComCalendarThemeDayViewCellColors))
   710        { DesignTime=False }
   711        Property Handle  Private_phoThemeDayViewCellParams  (Create(Self, U_cSigCjComCalendarThemeDayViewCellParams))
   712        { DesignTime=False }
   713        Property Handle  Private_phoDataProvider            (Create(Self, U_cSigCjComCalendarDataProvider))
   714        { DesignTime=False }
   715        Property Handle  Private_phoDataProvider_RS         (Create(Self, U_cSigCjComCalendarDataProvider))
   716        { DesignTime=False }
   717        Property Handle  Private_phoCategoriesIDs           (Create(Self, U_cSigCjComCalendarEventCategoryIDs))
   718        { DesignTime=False }
   719        Property Handle  Private_phoCategories              (Create(Self, U_cSigCjComCalendarEventCategories))
   720        { DesignTime=False }
   721        Property Handle  Private_phoCustomIcons             (Create(Self, U_cSigCjComCalendarIconIDs))
   722        { DesignTime=False }
   723        Property Handle  Private_phoCustomProps             (Create(Self, U_cSigCjComCalendarCustomProperties))
   724        { DesignTime=False }
   725        Property Handle  Private_phoEvent                   (Create(Self, U_cSigCjComCalendarEvent))
   726        { DesignTime=False }
   727        Property Handle  Private_phoEvents                  (Create(Self, U_cSigCjComCalendarEvents))
   728        { DesignTime=False }
   729        Property Handle  Private_phoR_Pat                   (Create(Self, U_cSigCjComCalendarRecurrencePattern))
   730        { DesignTime=False }
   731        Property Handle  Private_phoR_Pat_Options           (Create(Self, U_cSigCjComCalendarRecurrencePatternOptions))
   732
   733        //---------------------------------------------------------------------
   734
   735        { Category="Codejock" InitialValue="" }
   736        Property String psDataSource ""
   737
   738        { Category="Codejock" InitialValue=eCal_DT_DataFlex }
   739        { EnumList="eCal_DT_DataFlex, eCal_DT_OutLook" }
   740        Property Integer peDataType eCal_DT_DataFlex
   741
   742        { Category="Codejock" InitialValue=eCal_RS_None }
   743        { EnumList="eCal_RS_None, eCal_RS_StdFiles, eCal_RS_CustomFiles" }
   744        Property Integer peUseResources     eCal_RS_None
   745        { Category=Codejock InitialValue="" }
   746        Property String  psResourceLayout   ""
   747        
   748        { DesignTime=False }
   749        Property Handle  Private_phoCalResources (Create(Self, U_cSigCjComCalendarResources))
   750        { DesignTime=False }
   751        Property Handle  Private_phoCalSchedules (Create(Self, U_cSigCjComCalendarSchedules))
   752
   753        { DesignTime=False }
   754        Property Handle  Private_phoResource (Create(Self, U_cSigCjComCalendarResource))
   755        { DesignTime=False }
   756        Property Handle  Private_phoSchedule (Create(Self, U_cSigCjComCalendarSchedule))
   757
   758        { DesignTime=False }
   759        Property Handle  Private_phoScheduleIDs (Create(Self, U_cSigCjComCalendarScheduleIDs))
   760
   761        //---------------------------------------------------------------------
   762
   763#IFDEF SigCj_Use_StdFiles
   764        Object oeCal_Sys_DD is a Cal_Sys_DataDictionary
   765        End_Object
   766#ENDIF
   767    End_Procedure
   768
   769    Procedure End_Construct_Object
   770        Handle  hoOptions
   771        Variant vOptions
   772
   773        Forward Send End_Construct_Object   // very important!
   774
   775        //Set the theme to Office 07... The theme setting has not been implemented (Yet).
   776        Send Set_Theme_To_Office_07
   777
   778        //The meeting / private / recurring icons are not displayed by default,
   779        //they have to be enabled individually and for each view type.
   780        //This enables all glyphs / icons for all view types.
   781        Send Enable_Icons
   782
   783        //This removes the default categories and loads new categoreies from the Cal_Cats table
   784        //---------------------------------------------------------------------
   785        Object oe_CJ_CalendarDialogs is a cCJ_CalendarDialogs
   786        End_Object
   787
   788        //---------------------------------------------------------------------
   789    End_Procedure
   790
   791    Procedure OnCreate
   792        Handle  hoFlags hoCalResources hoCalSchedules
   793        Variant vFlags   vCalResources  vCalSchedules
   794        Integer iUseResources
   795        
   796        Forward Send OnCreate
   797
   798        Set pvComObject of (phoOptions            (Self)) to (ComOptions            (Self))
   799        Set pvComObject of (phoPrintOptions       (Self)) to (ComPrintOptions       (Self))
   800        Set pvComObject of (phoPrintPreviewOptions(Self)) to (ComPrintPreviewOptions(Self))
   801        Set pvComObject of (phoDayView(Self))             to (ComDayView(Self))
   802
   803        Set peCaptionBar                    to (Private_peCaptionBar                   (Self))
   804        Set pbEnableReminders               to (Private_pbEnableReminders              (Self))
   805        Set pbEnableStdToolTips             to (Private_pbEnableStdToolTips            (Self))
   806        Set psPrintPreviewTitle             to (Private_psPrintPreviewTitle            (Self))
   807        Set pbUseCustomDialogs              to (Private_pbUseCustomDialogs             (Self))
   808        Set pbUseCustomCategories           to (Private_pbUseCustomCategories          (Self))
   809        Set pbClickToAdd                    to (Private_pbClickToAdd                   (Self))
   810        Set psClickToAddText                to (Private_psClickToAddText               (Self))
   811        Set peDayViewCurrentTimeMarkVisible to (Private_peDayViewCurrentTimeMarkVisible(Self))
   812        Set pbDayViewShowMinutes            to (Private_pbDayViewShowMinutes           (Self))
   813        Set pbInPlaceCreateEvent            to (Private_pbInPlaceCreateEvent           (Self))
   814        Set pbInPlaceEdit_AfterEventResize  to (Private_pbInPlaceEdit_AfterEventResize (Self))
   815        Set pbInPlaceEdit_ByF2              to (Private_pbInPlaceEdit_ByF2             (Self))
   816        Set pbInPlaceEdit_ByMouseClick      to (Private_pbInPlaceEdit_ByMouseClick     (Self))
   817        Set pbInPlaceEdit_ByTab             to (Private_pbInPlaceEdit_ByTab            (Self))
   818        Set peFirstDayOfTheWeek             to (Private_peFirstDayOfTheWeek            (Self))
   819        Set pbCompressWeekendDays           to (Private_pbCompressWeekendDays          (Self))
   820        Set pbMultiColumnWeekMode           to (Private_pbMultiColumnWeekMode          (Self))
   821        Set pbUseOutlookGlyphs              to (Private_pbUseOutlookGlyphs             (Self))
   822        Set peShowEndDate                   to (Private_peShowEndDate                  (Self))
   823        Set peShowTimeAsClocks              to (Private_peShowTimeAsClocks             (Self))
   824        Set peTimeScale                     to (Private_peTimeScale                    (Self))
   825        Set peViewType                      to (Private_peViewType                     (Self))
   826        Set ptmWorkDayEndTime               to (Private_ptmWorkDayEndTime              (Self))
   827        Set ptmWorkDayStartTime             to (Private_ptmWorkDayStartTime            (Self))
   828        Set peWorkWeekMask                  to (Private_peWorkWeekMask                 (Self))
   829        Set ptmTimeScaleMinTime             to (Private_ptmTimeScaleMinTime            (Self))
   830        Set ptmTimeScaleMaxTime             to (Private_ptmTimeScaleMaxTime            (Self))
   831
   832//        Set pbPrnLandscape                  to (Private_pbPrnLandscape                 (Self))
   833//        Set pbPrnGreyScale                  to (Private_pbPrnGreyScale                 (Self))
   834//        Set pbPrnPrintDateHeader            to (Private_pbPrnPrintDateHeader           (Self))
   835//        Set pdtPrnPrintFrom                 to (Private_pdtPrnPrintFrom                (Self))
   836//        Set pdtPrnPrintTo                   to (Private_pdtPrnPrintTo                  (Self))
   837//        Set pbPrnFromToExactly              to (Private_pbPrnFromToExactly             (Self))
   838//        Set psPrnFooterLeft                 to (Private_psPrnFooterLeft                (Self))
   839//        Set psPrnFooterCenter               to (Private_psPrnFooterCenter              (Self))
   840//        Set psPrnFooterRight                to (Private_psPrnFooterRight               (Self))
   841//        Set psPrnHeaderLeft                 to (Private_psPrnHeaderLeft                (Self))
   842//        Set psPrnHeaderCenter               to (Private_psPrnHeaderCenter              (Self))
   843//        Set psPrnHeaderRight                to (Private_psPrnHeaderRight               (Self))
   844//        Set pnPrnMarginBottom               to (Private_pnPrnMarginBottom              (Self))
   845//        Set pnPrnMarginTop                  to (Private_pnPrnMarginTop                 (Self))
   846//        Set pnPrnMarginLeft                 to (Private_pnPrnMarginLeft                (Self))
   847//        Set pnPrnMarginRight                to (Private_pnPrnMarginRight               (Self))
   848
   849
   850        Get Create U_cSigCjComCalendarFlagsSet to hoFlags
   851            Get ComBeforeDrawThemeObjectFlags to vFlags
   852            Set pvComObject of hoFlags to vFlags
   853
   854            Send ComSetFlag of hoFlags OLExtpCalendarBeforeDraw_DayViewCell
   855        Send Destroy of hoFlags
   856
   857        //---------------------------------------------------------------------
   858        
   859        Send Set_Single_Data_Source (peDataType(Self)) (psDataSource(Self))
   860        Get peUseResources to iUseResources
   861
   862//        If (iUseResources = eCal_RS_None) Begin
   863//            Send Set_Single_Data_Source (peDataType(Self)) (psDataSource(Self))
   864//        End
   865//        Else Begin
   866        If (iUseResources <> eCal_RS_None) Begin
   867            Get Private_phoCalResources to hoCalResources
   868            Send CreateComObject of hoCalResources
   869
   870            If (iUseResources = eCal_RS_StdFiles) Begin
   871                Send Load_Resources 
   872            End
   873            Else Begin
   874                Send OnLoad_Resources
   875            End
   876
   877            Get pvComObject of hoCalResources to vCalResources
   878            Send ComSetMultipleResources vCalResources
   879        End
   880
   881        //---------------------------------------------------------------------
   882
   883        Send Setup_Categories
   884        Send ComPopulate
   885    End_Procedure
   886
   887    //=========================================================================
   888
   889    Procedure OnLoad_Resources
   890        //Hook
   891    End_Procedure
   892    
   893    Procedure Load_Resources
   894        Boolean bFound
   895        Handle  hoCalResources hoResource
   896        Variant vResource
   897        Integer iLast_Res
   898        String  sLayout
   899        
   900#IFDEF SigCj_Use_StdResources
   901        Get psResourceLayout to sLayout
   902        
   903        Clear Cal_Lay
   904        Move sLayout to Cal_Lay.Title
   905        Find Eq Cal_Lay by Index.2
   906        If (Found) Begin
   907            Clear Cal_SRL
   908            Move Cal_Lay.ID to Cal_SRL.Layout
   909            Repeat 
   910                Find GT Cal_SRL by Index.1
   911                Move (Found) to bFound
   912                If (bFound) Move (Cal_SRL.Layout = Cal_Lay.ID) to bFound
   913                If (bFound) Begin
   914                    Relate Cal_SRL  
   915                    Clear Cal_Res
   916                    Move Cal_SRL.Resource to Cal_Res.ID
   917                    Find Eq Cal_Res by Index.1 
   918                    Clear Cal_Sch
   919                    Move Cal_SRL.Schedule to Cal_Sch.ID
   920                    Find Eq Cal_Sch by Index.1 
   921                    Send Add_Resource_And_Schedule (Trim(Cal_Res.Title)) Cal_Sch.ID (Trim(Cal_Sch.Title)) Cal_Res.DataType (Trim(Cal_Res.DataSource))
   922                End
   923            Until (not(bFound))
   924        End
   925        Else Begin
   926            Error 5001 "Invalid Calendar Layout Title"    
   927            Send Close_panel
   928        End
   929#ENDIF
   930    End_Procedure
   931
   932    //Add Resource / schedule
   933    
   934    Procedure Add_Resource_And_Schedule String sResourceName Integer iScheduleID String sScheduleName Integer iDataType String sDataSource
   935        Boolean bFound bOK
   936        Handle hoResource hoSchedule hoScheduleIDs hoDataProvider hoCalSchedules hoCalResources 
   937        Variant vResource  vSchedule  vScheduleIDs  vDataProvider  vCalSchedules
   938        Integer iCount iLoop
   939        String sName
   940        
   941        Get Private_phoDataProvider_RS to hoDataProvider
   942
   943        //---------------------------------------------------------------------
   944        //Find / Add Resource
   945        Get Private_phoCalResources to hoCalResources
   946        Get Private_phoResource     to hoResource
   947        
   948        Get ComCount of hoCalResources to iCount
   949        Decrement iCount    // zero based
   950        Move False to bFound
   951        For iLoop from 0 to iCount
   952            Get ComItem of hoCalResources iLoop to vResource
   953            Set pvComObject of hoResource to vResource
   954            Get ComName of hoResource to sName             
   955            If (sName = sResourceName) Begin
   956                Move True to bFound
   957                
   958                //Bomb loop as found. This leaves hoResource pointing to the 
   959                //corrrect resource object.
   960                Move iCount to iLoop    
   961            End
   962        Loop
   963
   964        If (not(bFound)) Begin
   965            //Not found so add a resource object.
   966            Get Create U_cSigCjComCalendarResource to hoResource
   967            Send CreateComObject of hoResource
   968            Get pvComObject of hoResource to vResource
   969            Set ComName of hoResource to sResourceName
   970            Send ComAdd of hoCalResources vResource
   971
   972            If (iDataType = eCal_DT_DataFlex) Begin
   973                Get pvComObject of hoDataProvider to vDataProvider
   974                //Need to create the data provider the first time, after that
   975                //we will use the same object. This is just for DataFlex files.
   976                If (IsNullComObject(vDataProvider)) Begin
   977                    Send ComSetDataProvider2 of hoResource ("Provider="+eCal_DataProvider_Custom+";DSN=Not Needed") True
   978                    Get ComDataProvider of hoResource to vDataProvider
   979                    Set pvComObject of hoDataProvider to vDataProvider
   980                    Get ComOpen of hoDataProvider to bOK
   981                    If (not(bOK)) Begin
   982                        Get ComCreate of hoDataProvider to bOK
   983                    End
   984                End
   985                Else Begin
   986                    Send ComSetDataProvider of hoResource vDataProvider False
   987                End
   988            End
   989            Else Begin
   990                //For PST files we will create a new data provider for each
   991                //resource.
   992                Send ComSetDataProvider2 of hoResource ("Provider="+eCal_DataProvider_Outlook+";DSN="+sDataSource) True
   993                Get ComDataProvider of hoResource to vDataProvider
   994                Set pvComObject of hoDataProvider to vDataProvider
   995                Get ComOpen of hoDataProvider to bOK
   996                If (not(bOK)) Begin
   997                    Get ComCreate of hoDataProvider to bOK
   998                End
   999            End
  1000        End
  1001        
  1002        //---------------------------------------------------------------------
  1003        //Find / Add Schedule
  1004        Get Private_phoCalSchedules to hoCalSchedules
  1005        Get ComSchedules of hoDataProvider to vCalSchedules
  1006        Set pvComObject of hoCalSchedules to vCalSchedules
  1007        
  1008        Get Private_phoSchedule to hoSchedule
  1009        
  1010        Get ComCount of hoCalSchedules to iCount
  1011        Decrement iCount    // zero based
  1012        Move False to bFound
  1013        For iLoop from 0 to iCount
  1014            Get ComItem of hoCalSchedules iLoop to vSchedule
  1015            Set pvComObject of hoSchedule to vSchedule
  1016
  1017            //The ID could be used to find the schedule, but the name is used
  1018            //for consistancy with the Resource above. 
  1019            Get ComName of hoSchedule to sName             
  1020            If (sName = sScheduleName) Begin
  1021                Move True to bFound
  1022                
  1023                //Bomb loop as found. This leaves hoSchedule pointing to the 
  1024                //corrrect schedule object.
  1025                Move iCount to iLoop    
  1026            End
  1027        Loop
  1028        
  1029        If (not(bFound)) Begin
  1030            //Not found so add a schedule object.
  1031            Get ComAddNewSchedule of hoCalSchedules sScheduleName to bOK
  1032            If (bOK) Begin
  1033                Get ComCount of hoCalSchedules to iCount
  1034                Decrement iCount
  1035                Get ComItem of hoCalSchedules iCount to vSchedule
  1036                Set pvComObject of hoSchedule to vSchedule
  1037                Set ComId of hoSchedule to iScheduleID
  1038            End
  1039        End
  1040
  1041        //---------------------------------------------------------------------
  1042        //Find / Attach Resource and Scehdule
  1043        If (iDataType = eCal_DT_DataFlex) Begin
  1044        Get ComExistsScheduleID of hoResource iScheduleID False to bFound
  1045        If (not(bFound)) Begin
  1046            Get Private_phoScheduleIDs to hoScheduleIDs
  1047            Get ComScheduleIDs of hoResource to vScheduleIDs
  1048            Set pvComObject of hoScheduleIDs to vScheduleIDs
  1049            
  1050            Send ComAdd of hoScheduleIDs iScheduleID 
  1051        End
  1052        End    
  1053    End_Procedure
  1054
  1055    //=========================================================================
  1056    //Property Methods
  1057    //=========================================================================
  1058
  1059    { MethodType=Property Category="CodeJock" InitialValue=eCal_FullCaptionBar }
  1060    { EnumList="eCal_NoCaptionBar, eCal_CaptionBarDateLabel, eCal_CaptionBarScrollDateButtons, eCal_CaptionBarSwitchViewButtons, eCal_FullCaptionBar" }
  1061    Procedure Set peCaptionBar Integer eCaption
  1062
  1063        If (IsComObjectCreated(Self)) Begin
  1064            Set ComShowCaptionBar                  to (eCaption iand eCal_ShowCaptionBar)
  1065            Set ComShowCaptionBarDateLabel         to (eCaption iand eCal_CaptionBarDateLabel)
  1066            Set ComShowCaptionBarScrollDateButtons to (eCaption iand eCal_CaptionBarScrollDateButtons)
  1067            Set ComShowCaptionBarSwitchViewButtons to (eCaption iand eCal_CaptionBarSwitchViewButtons)
  1068#IF (SigCj_Codejock_Version > 120101) 
  1069            //New for 13.0.0 - Time Line mode. Disable the button until we implement support for this.
  1070            Set ComShowTimelineButton to False
  1071#ENDIF
  1072        End
  1073
  1074        Set Private_peCaptionBar to eCaption
  1075    End_Procedure
  1076
  1077    Function peCaptionBar Returns Integer
  1078        Boolean bValue
  1079        Integer eCaption
  1080
  1081        If (IsComObjectCreated(Self)) Begin
  1082            Get ComShowCaptionBar to eCaption
  1083
  1084            Get ComShowCaptionBarDateLabel to bValue
  1085            If (bValue) Move (eCaption ior eCal_CaptionBarDateLabel) to eCaption
  1086
  1087            Get ComShowCaptionBarScrollDateButtons to bValue
  1088            If (bValue) Move (eCaption ior eCal_CaptionBarScrollDateButtons) to eCaption
  1089
  1090            Get ComShowCaptionBarSwitchViewButtons to bValue
  1091            If (bValue) Move (eCaption ior eCal_CaptionBarSwitchViewButtons) to eCaption
  1092        End
  1093        Else Get Private_peCaptionBar to eCaption
  1094
  1095        Function_Return eCaption
  1096    End_Function
  1097
  1098    //-------------------------------------------------------------------------
  1099
  1100    { MethodType=Property Category="CodeJock" InitialValue=True }
  1101    Procedure Set pbEnableReminders Boolean bState
  1102        Set Private_pbEnableReminders to bState
  1103        If (IsComObjectCreated(Self)) Begin
  1104            Send ComEnableReminders bState
  1105        End
  1106    End_Procedure
  1107
  1108    Function pbEnableReminders Returns Boolean
  1109        Boolean bState
  1110
  1111        If (IsComObjectCreated(Self)) Begin
  1112            Get ComIsRemindersEnabled to bState
  1113        End
  1114        Else Begin
  1115            Get Private_pbEnableReminders to bState
  1116        End
  1117
  1118        Function_Return bState
  1119    End_Function
  1120
  1121    //-------------------------------------------------------------------------
  1122
  1123    { MethodType=Property Category="CodeJock" InitialValue=True }
  1124    Procedure Set pbEnableStdToolTips Boolean bValue
  1125        Set SigCjProperty Set_Private_pbEnableStdToolTips Set_ComEnableAddNewTooltip (phoOptions(Self)) to bValue
  1126    End_Procedure
  1127
  1128    Function pbEnableStdToolTips Returns Boolean
  1129        Function_Return (SigCjProperty(Self, Get_Private_pbEnableStdToolTips, Get_ComEnableAddNewTooltip, (phoOptions(Self)) ))
  1130    End_Function
  1131
  1132    //-------------------------------------------------------------------------
  1133
  1134    { MethodType=Property Category="CodeJock" InitialValue="" }
  1135    Procedure Set psPrintPreviewTitle String sValue
  1136        Set SigCjProperty Set_Private_psPrintPreviewTitle Set_ComTitle (phoPrintPreviewOptions(Self)) to sValue
  1137    End_Procedure
  1138
  1139    Function psPrintPreviewTitle Returns String
  1140        Function_Return (SigCjProperty(Self, Get_Private_psPrintPreviewTitle, Get_ComTitle, (phoPrintPreviewOptions(Self)) ))
  1141    End_Function
  1142
  1143    //-------------------------------------------------------------------------
  1144
  1145    { MethodType=Property Category="CodeJock" InitialValue=False }
  1146    Procedure Set pbUseCustomDialogs Boolean bValue
  1147        Set Private_pbUseCustomDialogs to bValue
  1148    End_Procedure
  1149
  1150    Function pbUseCustomDialogs Returns Boolean
  1151        Function_Return (Private_pbUseCustomDialogs(Self))
  1152    End_Function
  1153
  1154    //-------------------------------------------------------------------------
  1155
  1156    { MethodType=Property Category="CodeJock" InitialValue=False }
  1157    Procedure Set pbUseCustomCategories Boolean bValue
  1158        Set Private_pbUseCustomCategories to bValue
  1159    End_Procedure
  1160
  1161    Function pbUseCustomCategories Returns Boolean
  1162        Function_Return (Private_pbUseCustomCategories(Self))
  1163    End_Function
  1164
  1165    //-------------------------------------------------------------------------
  1166
  1167    { MethodType=Property Category="CodeJock" InitialValue=True }
  1168    Procedure Set pbClickToAdd Boolean bValue
  1169        Set SigCjProperty Set_Private_pbClickToAdd Set_ComEnableAddNewTooltip (phoOptions(Self)) to bValue
  1170    End_Procedure
  1171
  1172    Function pbClickToAdd Returns Boolean
  1173        Function_Return (SigCjProperty(Self, Get_Private_pbClickToAdd, Get_ComEnableAddNewTooltip, (phoOptions(Self)) ))
  1174    End_Function
  1175
  1176    //-------------------------------------------------------------------------
  1177
  1178    { MethodType=Property Category="CodeJock" InitialValue="" }
  1179    Procedure Set psClickToAddText String sValue
  1180        Set SigCjProperty Set_Private_psClickToAddText Set_ComTooltipAddNewText (phoOptions(Self)) to sValue
  1181    End_Procedure
  1182
  1183    Function psClickToAddText Returns String
  1184        Function_Return (SigCjProperty(Self, Get_Private_psClickToAddText, Get_ComTooltipAddNewText, (phoOptions(Self)) ))
  1185    End_Function
  1186
  1187    //-------------------------------------------------------------------------
  1188
  1189    { MethodType=Property Category="CodeJock" InitialValue=eCal_TM_VisibleAlways }
  1190    { EnumList="eCal_TM_None, eCal_TM_VisibleForToday, eCal_TM_VisibleAlways, eCal_TM_Printed" }
  1191    Procedure Set peDayViewCurrentTimeMarkVisible Integer eValue
  1192        Set SigCjProperty Set_Private_peDayViewCurrentTimeMarkVisible Set_ComDayViewCurrentTimeMarkVisible (phoOptions(Self)) to eValue
  1193    End_Procedure
  1194
  1195    Function peDayViewCurrentTimeMarkVisible Returns Integer
  1196        Function_Return (SigCjProperty(Self, Get_Private_peDayViewCurrentTimeMarkVisible, Get_ComDayViewCurrentTimeMarkVisible, (phoOptions(Self)) ))
  1197    End_Function
  1198
  1199    //-------------------------------------------------------------------------
  1200
  1201    { MethodType=Property Category="CodeJock" InitialValue=True }
  1202    Procedure Set pbDayViewShowMinutes Boolean bValue
  1203        Set SigCjProperty Set_Private_pbDayViewShowMinutes Set_ComDayViewTimeScaleShowMinutes (phoOptions(Self)) to bValue
  1204    End_Procedure
  1205
  1206    Function pbDayViewShowMinutes Returns Boolean
  1207        Function_Return (SigCjProperty(Self, Get_Private_pbDayViewShowMinutes, Get_ComDayViewTimeScaleShowMinutes, (phoOptions(Self)) ))
  1208    End_Function
  1209
  1210    //-------------------------------------------------------------------------
  1211
  1212    { MethodType=Property Category="CodeJock" InitialValue=True }
  1213    Procedure Set pbInPlaceCreateEvent Boolean bValue
  1214        Set SigCjProperty Set_Private_pbInPlaceCreateEvent Set_ComEnableInPlaceCreateEvent (phoOptions(Self)) to bValue
  1215    End_Procedure
  1216
  1217    Function pbInPlaceCreateEvent Returns Boolean
  1218        Function_Return (SigCjProperty(Self, Get_Private_pbInPlaceCreateEvent, Get_ComEnableInPlaceCreateEvent, (phoOptions(Self)) ))
  1219    End_Function
  1220
  1221    //-------------------------------------------------------------------------
  1222
  1223    { MethodType=Property Category="CodeJock" InitialValue=False }
  1224    Procedure Set pbInPlaceEdit_AfterEventResize Boolean bValue
  1225        Set SigCjProperty Set_Private_pbInPlaceEdit_AfterEventResize Set_ComEnableInPlaceEditEventSubject_AfterEventResize (phoOptions(Self)) to bValue
  1226    End_Procedure
  1227
  1228    Function pbInPlaceEdit_AfterEventResize Returns Boolean
  1229        Function_Return (SigCjProperty(Self, Get_Private_pbInPlaceEdit_AfterEventResize, Get_ComEnableInPlaceEditEventSubject_AfterEventResize, (phoOptions(Self)) ))
  1230    End_Function
  1231
  1232    //-------------------------------------------------------------------------
  1233
  1234    { MethodType=Property Category="CodeJock" InitialValue=False }
  1235    Procedure Set pbInPlaceEdit_ByF2 Boolean bValue
  1236        Set SigCjProperty Set_Private_pbInPlaceEdit_ByF2 Set_ComEnableInPlaceEditEventSubject_ByF2 (phoOptions(Self)) to bValue
  1237    End_Procedure
  1238
  1239    Function pbInPlaceEdit_ByF2 Returns Boolean
  1240        Function_Return (SigCjProperty(Self, Get_Private_pbInPlaceEdit_ByF2, Get_ComEnableInPlaceEditEventSubject_ByF2, (phoOptions(Self)) ))
  1241    End_Function
  1242
  1243    //-------------------------------------------------------------------------
  1244
  1245    { MethodType=Property Category="CodeJock" InitialValue=False }
  1246    Procedure Set pbInPlaceEdit_ByMouseClick Boolean bValue
  1247        Set SigCjProperty Set_Private_pbInPlaceEdit_ByMouseClick Set_ComEnableInPlaceEditEventSubject_ByMouseClick (phoOptions(Self)) to bValue
  1248    End_Procedure
  1249
  1250    Function pbInPlaceEdit_ByMouseClick Returns Boolean
  1251        Function_Return (SigCjProperty(Self, Get_Private_pbInPlaceEdit_ByMouseClick, Get_ComEnableInPlaceEditEventSubject_ByMouseClick, (phoOptions(Self)) ))
  1252    End_Function
  1253
  1254    //-------------------------------------------------------------------------
  1255
  1256    { MethodType=Property Category="CodeJock" InitialValue=False }
  1257    Procedure Set pbInPlaceEdit_ByTab Boolean bValue
  1258        Set SigCjProperty Set_Private_pbInPlaceEdit_ByTab Set_ComEnableInPlaceEditEventSubject_ByTab (phoOptions(Self)) to bValue
  1259    End_Procedure
  1260
  1261    Function pbInPlaceEdit_ByTab Returns Boolean
  1262        Function_Return (SigCjProperty(Self, Get_Private_pbInPlaceEdit_ByTab, Get_ComEnableInPlaceEditEventSubject_ByTab, (phoOptions(Self)) ))
  1263    End_Function
  1264
  1265    //-------------------------------------------------------------------------
  1266
  1267    { MethodType=Property Category="CodeJock" InitialValue=eCal_Sunday }
  1268    { EnumList="eCal_Sunday, eCal_Monday, eCal_Tuesday, eCal_Wednesday, eCal_Thursday, eCal_Friday, eCal_Saturday" }
  1269    Procedure Set peFirstDayOfTheWeek Integer eValue
  1270        Set SigCjProperty Set_Private_peFirstDayOfTheWeek Set_ComFirstDayOfTheWeek (phoOptions(Self)) to eValue
  1271    End_Procedure
  1272
  1273    Function peFirstDayOfTheWeek Returns Boolean
  1274        Function_Return (SigCjProperty(Self, Get_Private_peFirstDayOfTheWeek, Get_ComFirstDayOfTheWeek, (phoOptions(Self)) ))
  1275    End_Function
  1276
  1277    //-------------------------------------------------------------------------
  1278
  1279    { MethodType=Property Category="CodeJock" InitialValue=True }
  1280    Procedure Set pbCompressWeekendDays Boolean bValue
  1281        Set SigCjProperty Set_Private_pbCompressWeekendDays Set_ComMonthViewCompressWeekendDays (phoOptions(Self)) to bValue
  1282    End_Procedure
  1283
  1284    Function pbCompressWeekendDays Returns Boolean
  1285        Function_Return (SigCjProperty(Self, Get_Private_pbCompressWeekendDays, Get_ComMonthViewCompressWeekendDays, (phoOptions(Self)) ))
  1286    End_Function
  1287
  1288    //-------------------------------------------------------------------------
  1289
  1290    { MethodType=Property Category="CodeJock" InitialValue=True }
  1291    Procedure Set pbMultiColumnWeekMode Boolean bValue
  1292#IF (SigCj_Codejock_Version > 120101) 
  1293        Set SigCjProperty Set_Private_pbMultiColumnWeekMode Set_ComUseMultiColumnWeekMode (phoOptions(Self)) to bValue
  1294#ENDIF
  1295    End_Procedure
  1296
  1297    Function pbMultiColumnWeekMode Returns Boolean
  1298#IF (SigCj_Codejock_Version > 120101) 
  1299        Function_Return (SigCjProperty(Self, Get_Private_pbMultiColumnWeekMode, Get_ComUseMultiColumnWeekMode, (phoOptions(Self)) ))
  1300#ENDIF
  1301    End_Function
  1302
  1303    //-------------------------------------------------------------------------
  1304    { MethodType=Property Category="CodeJock" InitialValue=False }
  1305    Procedure Set pbUseOutlookGlyphs Boolean bValue
  1306        Set SigCjProperty Set_Private_pbUseOutlookGlyphs Set_ComUseOutlookFontGlyphs (phoOptions(Self)) to bValue
  1307    End_Procedure
  1308
  1309    Function pbUseOutlookGlyphs Returns Boolean
  1310        Function_Return (SigCjProperty(Self, Get_Private_pbUseOutlookGlyphs, Get_ComUseOutlookFontGlyphs, (phoOptions(Self)) ))
  1311    End_Function
  1312
  1313    //-------------------------------------------------------------------------
  1314
  1315    { MethodType=Property Category="CodeJock" InitialValue=eCal_MW_None }
  1316    { EnumList=" eCal_MW_None, eCal_MW_Week, eCal_MW_Month, eCal_MW_Both" }
  1317    Procedure Set peShowEndDate Integer eValue
  1318
  1319        If (IsComObjectCreated(Self)) Begin
  1320            Set ComMonthViewShowEndDate of (phoOptions(Self)) to (eValue iand eCal_MW_Month)
  1321            Set ComWeekViewShowEndDate  of (phoOptions(Self)) to (eValue iand eCal_MW_Week)
  1322        End
  1323
  1324        Set Private_peShowEndDate to eValue
  1325    End_Procedure
  1326
  1327    Function peShowEndDate Returns Integer
  1328        Boolean bValue
  1329        Integer eValue
  1330
  1331        If (IsComObjectCreated(Self)) Begin
  1332            Get ComMonthViewShowEndDate of (phoOptions(Self)) to eValue
  1333
  1334            Get ComWeekViewShowEndDate of (phoOptions(Self)) to bValue
  1335            If (bValue) Move (eValue ior eCal_MW_Week) to eValue
  1336        End
  1337        Else Get Private_peShowEndDate to eValue
  1338
  1339        Function_Return eValue
  1340    End_Function
  1341
  1342    //-------------------------------------------------------------------------
  1343
  1344    { MethodType=Property Category="CodeJock" InitialValue=eCal_MW_None }
  1345    { EnumList=" eCal_MW_None, eCal_MW_Week, eCal_MW_Month, eCal_MW_Both" }
  1346    Procedure Set peShowTimeAsClocks Integer eValue
  1347
  1348        If (IsComObjectCreated(Self)) Begin
  1349            Set ComMonthViewShowTimeAsClocks of (phoOptions(Self)) to (eValue iand eCal_MW_Month)
  1350            Set ComWeekViewShowTimeAsClocks  of (phoOptions(Self)) to (eValue iand eCal_MW_Week)
  1351        End
  1352
  1353        Set Private_peShowTimeAsClocks to eValue
  1354    End_Procedure
  1355
  1356    Function peShowTimeAsClocks Returns Integer
  1357        Boolean bValue
  1358        Integer eValue
  1359
  1360        If (IsComObjectCreated(Self)) Begin
  1361            Get ComMonthViewShowTimeAsClocks of (phoOptions(Self)) to eValue
  1362
  1363            Get ComWeekViewShowTimeAsClocks of (phoOptions(Self)) to bValue
  1364            If (bValue) Move (eValue ior eCal_MW_Week) to eValue
  1365        End
  1366        Else Get Private_peShowTimeAsClocks to eValue
  1367
  1368        Function_Return eValue
  1369    End_Function
  1370
  1371    //-------------------------------------------------------------------------
  1372
  1373    { EnumList="eCal_TimeScale_5, eCal_TimeScale_10, eCal_TimeScale_15, eCal_TimeScale_20, eCal_TimeScale_30, eCal_TimeScale_60" }
  1374    { MethodType=Property Category="CodeJock" InitialValue=eCal_TimeScale_30 }
  1375    Procedure Set peTimeScale Integer eValue
  1376        Handle hoDayView
  1377        Variant vDayView
  1378
  1379        If (IsComObjectCreated(Self)) Begin
  1380            Get Create U_cSigCjComCalendarDayView to hoDayView
  1381                Get ComDayView to vDayView
  1382                Set pvComObject  of hoDayView to vDayView
  1383                Set ComTimeScale of hoDayView to eValue
  1384            Send Destroy of hoDayView
  1385        End
  1386
  1387        Set Private_peTimeScale to eValue
  1388    End_Procedure
  1389
  1390    {MethodType=Property }
  1391    Function peTimeScale Returns Integer
  1392        Integer eValue
  1393        Handle hoDayView
  1394        Variant vDayView
  1395
  1396        If (IsComObjectCreated(Self)) Begin
  1397            Get Create U_cSigCjComCalendarDayView to hoDayView
  1398                Get ComDayView to vDayView
  1399                Set pvComObject  of hoDayView to vDayView
  1400                Get ComTimeScale of hoDayView to eValue
  1401            Send Destroy of hoDayView
  1402        End
  1403        Else Begin
  1404            Get Private_peTimeScale to eValue
  1405        End
  1406        Function_Return eValue
  1407    End_Function
  1408
  1409    //-------------------------------------------------------------------------
  1410
  1411    { MethodType=Property Category="CodeJock" InitialValue=eCal_ViewType_Working }
  1412    { EnumList="eCal_ViewType_Day, eCal_ViewType_Working, eCal_ViewType_Week, eCal_ViewType_Month, eCal_ViewType_FullWeek" }
  1413    Procedure Set peViewType Integer eValue
  1414        Set SigCjProperty Set_Private_peViewType Set_ComViewType to eValue
  1415    End_Procedure
  1416
  1417    Function peViewType Returns Boolean
  1418        Function_Return (SigCjProperty(Self, Get_Private_peViewType, Get_ComViewType ))
  1419    End_Function
  1420
  1421    //-------------------------------------------------------------------------
  1422
  1423    { MethodType=Property Category="CodeJock" InitialValue="17:00" }
  1424    Procedure Set ptmWorkDayEndTime String tmValue
  1425        DateTime dtWork
  1426        Integer iHour iMins
  1427
  1428        Set Private_ptmWorkDayEndTime to tmValue
  1429        If (phoOptions(Self) and IsComObjectCreated(phoOptions(Self))) Begin
  1430            //Have to get current value... Codejock issue
  1431            //and then set the hours and mins from integers... Dataflex issue
  1432            //Fun working this lot out!!!!
  1433            Get ComWorkDayEndTime of (phoOptions(Self)) to dtWork
  1434            Get SigCj_GetHours   tmValue to iHour
  1435            Get SigCj_GetMinutes tmValue to iMins
  1436            Move (DateSetHour  (dtWork, iHour)) to dtWork
  1437            Move (DateSetMinute(dtWork, iMins)) to dtWork
  1438
  1439            //Now we can set the time!!
  1440            Set ComWorkDayEndTime of (phoOptions(Self)) to dtWork
  1441        End
  1442
  1443    End_Procedure
  1444
  1445    Function ptmWorkDayEndTime Returns String
  1446        //We always return our private property as the COM property is returned as a DateTime
  1447        Function_Return (Private_ptmWorkDayEndTime(Self))
  1448    End_Function
  1449
  1450    //-------------------------------------------------------------------------
  1451
  1452    { MethodType=Property Category="CodeJock" InitialValue="09:00" }
  1453    Procedure Set ptmWorkDayStartTime String tmValue
  1454        DateTime dtWork
  1455        Integer iHour iMins
  1456
  1457        Set Private_ptmWorkDayStartTime to tmValue
  1458        If (phoOptions(Self) and IsComObjectCreated(phoOptions(Self))) Begin
  1459            //Have to get current value... Codejock issue
  1460            //and then set the hours and mins from integers... Dataflex issue
  1461            //Fun working this lot out!!!!
  1462            Get ComWorkDayStartTime of (phoOptions(Self)) to dtWork
  1463            Get SigCj_GetHours   tmValue to iHour
  1464            Get SigCj_GetMinutes tmValue to iMins
  1465            Move (DateSetHour  (dtWork, iHour)) to dtWork
  1466            Move (DateSetMinute(dtWork, iMins)) to dtWork
  1467
  1468            //Now we can set the time!!
  1469            Set ComWorkDayStartTime of (phoOptions(Self)) to dtWork
  1470        End
  1471
  1472    End_Procedure
  1473
  1474    Function ptmWorkDayStartTime Returns String
  1475        //We always return our private property as the COM property is returned as a DateTime
  1476        Function_Return (Private_ptmWorkDayStartTime(Self))
  1477    End_Function
  1478
  1479    //-------------------------------------------------------------------------
  1480
  1481    { MethodType=Property Category="CodeJock" InitialValue="08:00" }
  1482    Procedure Set ptmTimeScaleMinTime String tmValue
  1483        DateTime dtWork dtEmpty
  1484        Integer iHour iMins
  1485
  1486        If (pbUseScaleTimes(Self)=False) Procedure_Return
  1487   
  1488        Set Private_ptmTimeScaleMinTime to tmValue
  1489        If (phoDayView(Self) and IsComObjectCreated(phoDayView(Self))) Begin
  1490#IF (SigCj_Codejock_Version > 120002) 
  1491            Get ComTimeScaleMinTime of (phoDayView(Self)) to dtWork
  1492            Get SigCj_GetHours   tmValue to iHour
  1493            Get SigCj_GetMinutes tmValue to iMins
  1494            Move (DateSetHour  (dtWork, iHour)) to dtWork
  1495            Move (DateSetMinute(dtWork, iMins)) to dtWork
  1496            Move (DateSetSecond(dtWork,     1)) to dtWork
  1497
  1498            //Now we can set the time!!
  1499            Set ComTimeScaleMinTime of (phoDayView(Self)) to dtWork
  1500#ENDIF
  1501        End
  1502
  1503    End_Procedure
  1504
  1505    Function ptmTimeScaleMinTime Returns String
  1506        //We always return our private property as the COM property is returned as a DateTime
  1507        Function_Return (Private_ptmTimeScaleMinTime(Self))
  1508    End_Function
  1509
  1510    { MethodType=Property Category="CodeJock" InitialValue="19:00" }
  1511    Procedure Set ptmTimeScaleMaxTime String tmValue
  1512        DateTime dtWork dtEmpty
  1513        Integer iHour iMins
  1514
  1515        If (pbUseScaleTimes(Self)=False) Procedure_Return
  1516        
  1517        Set Private_ptmTimeScaleMaxTime to tmValue
  1518        If (phoDayView(Self) and IsComObjectCreated(phoDayView(Self))) Begin
  1519#IF (SigCj_Codejock_Version > 120002) 
  1520            Get ComTimeScaleMaxTime of (phoDayView(Self)) to dtWork
  1521            Get SigCj_GetHours   tmValue to iHour
  1522            Get SigCj_GetMinutes tmValue to iMins
  1523            Move (DateSetHour  (dtWork, iHour)) to dtWork
  1524            Move (DateSetMinute(dtWork, iMins)) to dtWork
  1525            Move (DateSetSecond(dtWork,     1)) to dtWork
  1526
  1527            //Now we can set the time!!
  1528            Set ComTimeScaleMaxTime of (phoDayView(Self)) to dtWork
  1529#ENDIF
  1530        End
  1531
  1532    End_Procedure
  1533
  1534    Function ptmTimeScaleMaxTime Returns String
  1535        //We always return our private property as the COM property is returned as a DateTime
  1536        Function_Return (Private_ptmTimeScaleMaxTime(Self))
  1537    End_Function
  1538
  1539    //-------------------------------------------------------------------------
  1540
  1541    { MethodType=Property Category="CodeJock" InitialValue=eCal_WW_Mo_Fr }
  1542    { EnumList="eCal_WW_Sunday, eCal_WW_Monday, eCal_WW_Tuesday, eCal_WW_Wednesday, eCal_WW_Thursday, eCal_WW_Friday, eCal_WW_Saturday, eCal_WW_AllWeek, eCal_WW_SaSu, eCal_WW_Mo_Fr" }
  1543    Procedure Set peWorkWeekMask Integer eValue
  1544        Set SigCjProperty Set_Private_peWorkWeekMask Set_ComWorkWeekMask (phoOptions(Self)) to eValue
  1545    End_Procedure
  1546
  1547    Function peWorkWeekMask Returns Boolean
  1548        Function_Return (SigCjProperty(Self, Get_Private_peWorkWeekMask, Get_ComWorkWeekMask, (phoOptions(Self)) ))
  1549    End_Function
  1550
  1551    //-------------------------------------------------------------------------
  1552
  1553//        Property Boolean  Private_pbPrnLandscape                     False
  1554//        Property Boolean  Private_pbPrnGreyScale                     False
  1555//        Property Boolean  Private_pbPrnPrintDateHeader               False
  1556//        Property DateTime Private_pdtPrnPrintFrom                    //
  1557//        Property DateTime Private_pdtPrnPrintTo                      //
  1558//        Property Boolean  Private_pbPrnFromToExactly                 False
  1559//        Property String   Private_psPrnFooterLeft                    ""
  1560//        Property String   Private_psPrnFooterCenter                  ""
  1561//        Property String   Private_psPrnFooterRight                   ""
  1562//        Property String   Private_psPrnHeaderLeft                    ""
  1563//        Property String   Private_psPrnHeaderCenter                  ""
  1564//        Property String   Private_psPrnHeaderRight                   ""
  1565//        Property Number   Private_pnPrnMarginBottom                  1.0
  1566//        Property Number   Private_pnPrnMarginTop                     1.0
  1567//        Property Number   Private_pnPrnMarginLeft                    1.0
  1568//        Property Number   Private_pnPrnMarginRight                   1.0
  1569
  1570    //=========================================================================
  1571
  1572    Function Date_and_Time_to_DateTime Date dDate String sTime Returns DateTime
  1573        DateTime dtRetVal
  1574
  1575        Move dDate to dtRetVal
  1576        Move (DateSetHour  (dtRetVal, Left (sTime,2))) to dtRetVal
  1577        Move (DateSetMinute(dtRetVal, Right(sTime,2))) to dtRetVal
  1578
  1579        Function_Return dtRetVal
  1580    End_Function
  1581
  1582    //-------------------------------------------------------------------------
  1583
  1584    Function DateTime_to_Time DateTime dtTime Returns String
  1585        String sHour sMins
  1586
  1587        Move (DateGetHour(dtTime)) to sHour
  1588        If (sHour < 10) Move ("0" + sHour) to sHour
  1589
  1590        Move (DateGetMinute(dtTime)) to sMins
  1591        If (sMins < 10) Move ("0" + sMins) to sMins
  1592
  1593        Function_Return (sHour + ":" + sMins)
  1594    End_Function
  1595
  1596    //-------------------------------------------------------------------------
  1597
  1598    //=========================================================================
  1599    //Control Data Events
  1600    //=========================================================================
  1601
  1602    Procedure OnComDoCreateEvent Variant llpEvent Integer ByRef llNewEventID Boolean ByRef llbResult
  1603        tdEvent tEvent
  1604
  1605        //Make sure we are returning a valid value
  1606        Move False to llbResult
  1607
  1608        //Move object data to buffer
  1609        Get Move_Event_Object_Data_To_tdEvent llpEvent to tEvent
  1610
  1611        If (pbUseStdFiles(Self)) Begin
  1612#IFDEF SigCj_Use_StdFiles
  1613            Clear CalEvent
  1614            Lock
  1615                Get Allocate_CalEvent_URN of oeCal_Sys_DD to tEvent.iURN
  1616                Send Move_tdEvent_To_StdFile_Event tEvent
  1617                SaveRecord CalEvent
  1618            Unlock
  1619
  1620            Move tEvent.iURN to llNewEventID
  1621            Move True to llbResult
  1622#ENDIF
  1623        End
  1624        Else Begin
  1625            Get OnEvent_Create tEvent to llNewEventID
  1626            If (llNewEventID <> 0) Move True to llbResult
  1627        End
  1628    End_Procedure
  1629
  1630    //-------------------------------------------------------------------------
  1631
  1632    Procedure OnComDoCreateRPattern Variant llpPattern Integer ByRef llNewPatternID Boolean ByRef llbResult
  1633        tdR_Pat tR_Pat
  1634
  1635        //Make sure we are returning a valid value
  1636        Move False to llbResult
  1637
  1638        //Move object data to buffer
  1639        Get Move_R_Pat_Object_Data_To_tdR_Pat llpPattern to tR_Pat
  1640
  1641        If (pbUseStdFiles(Self)) Begin
  1642#IFDEF SigCj_Use_StdFiles
  1643            Clear CalR_Pat
  1644            Lock
  1645                Get Allocate_CalR_Pat_URN of oeCal_Sys_DD to tR_Pat.iURN
  1646                Send Move_tdR_Pat_To_StdFile_R_Pat tR_Pat
  1647                SaveRecord CalR_Pat
  1648            Unlock
  1649
  1650            Move tR_Pat.iURN to llNewPatternID
  1651            Move True to llbResult
  1652#ENDIF
  1653        End
  1654        Else Begin
  1655            Get OnR_Pat_Create tR_Pat to llNewPatternID
  1656            If (llNewPatternID <> 0) Move True to llbResult
  1657        End
  1658    End_Procedure
  1659
  1660    //-------------------------------------------------------------------------
  1661
  1662    Procedure OnComDoDeleteEvent Variant llpEvent Boolean ByRef llbResult
  1663        Handle  hoEvent
  1664        Integer iEventID
  1665
  1666        Get Private_phoEvent to hoEvent
  1667        Set pvComObject of hoEvent to llpEvent
  1668        Get ComId of hoEvent to iEventID
  1669
  1670        Move False to llbResult
  1671
  1672        If (pbUseStdFiles(Self)) Begin
  1673#IFDEF SigCj_Use_StdFiles
  1674            Clear CalEvent
  1675            Move iEventID to CalEvent.URN
  1676            Find Eq CalEvent by Index.1
  1677            If (Found) Begin
  1678                Lock
  1679                    Delete CalEvent
  1680                Unlock
  1681                Move True to llbResult
  1682            End
  1683#ENDIF
  1684        End
  1685        Else Begin
  1686            Get OnEvent_Delete iEventID to llbResult
  1687        End
  1688    End_Procedure
  1689
  1690    //-------------------------------------------------------------------------
  1691
  1692    Procedure OnComDoDeleteRPattern Variant llpPattern Boolean ByRef llbResult
  1693        Handle  hoR_Pat
  1694        Integer iPatternID
  1695
  1696        Get Private_phoR_Pat to hoR_Pat
  1697        Set pvComObject of hoR_Pat to llpPattern
  1698        Get ComID of hoR_Pat to iPatternID
  1699
  1700        Move False to llbResult
  1701
  1702        If (pbUseStdFiles(Self)) Begin
  1703#IFDEF SigCj_Use_StdFiles
  1704            Clear CalR_Pat
  1705            Move iPatternID to CalR_Pat.URN
  1706            Find Eq CalR_Pat by Index.1
  1707            If (Found) Begin
  1708                Lock
  1709                    Delete CalR_Pat
  1710                Unlock
  1711                Move True to llbResult
  1712            End
  1713#ENDIF
  1714        End
  1715        Else Begin
  1716            Get OnR_Pat_Delete iPatternID to llbResult
  1717        End
  1718    End_Procedure
  1719
  1720    //-------------------------------------------------------------------------
  1721
  1722    Procedure OnComDoReadEvent Integer llEventID Variant ByRef llpEvent
  1723        tdEvent tEvent
  1724
  1725        If (pbUseStdFiles(Self)) Begin
  1726#IFDEF SigCj_Use_StdFiles
  1727            Clear CalEvent
  1728            Move llEventID to CalEvent.URN
  1729            Find EQ CalEvent by Index.1
  1730            If (Found) Begin
  1731                Get Move_StdFile_Event_To_tdEvent to tEvent
  1732            End
  1733            Else Begin
  1734                Move 0 to tEvent.iURN
  1735            End
  1736#ENDIF
  1737        End
  1738        Else Begin
  1739            Get OnEvent_Read llEventID to tEvent
  1740        End
  1741
  1742        If (tEvent.iURN <> 0) Begin
  1743            Get Create_Event_Object_From_tdEvent tEvent False to llpEvent
  1744        End
  1745    End_Procedure
  1746
  1747    //-------------------------------------------------------------------------
  1748
  1749    Procedure OnComDoReadRPattern Integer llPatternID Variant ByRef llpPattern
  1750        tdR_Pat tR_Pat
  1751
  1752        If (pbUseStdFiles(Self)) Begin
  1753#IFDEF SigCj_Use_StdFiles
  1754            Clear CalR_Pat
  1755            Move llPatternID to CalR_Pat.URN
  1756            Find Eq CalR_Pat by Index.1
  1757            If (Found) Begin
  1758                Get Move_StdFile_R_Pat_To_tdR_Pat to tR_Pat
  1759            End
  1760            Else Begin
  1761                Move 0 to tR_Pat.iURN
  1762            End
  1763#ENDIF
  1764        End
  1765        Else Begin
  1766            Get OnR_Pat_Read llPatternID to tR_Pat
  1767        End
  1768
  1769        If (tR_Pat.iURN <> 0) Begin
  1770            Get Create_R_Pat_Object_From_tdR_Pat tR_Pat to llpPattern
  1771        End
  1772    End_Procedure
  1773
  1774    //-------------------------------------------------------------------------
  1775
  1776    Procedure OnComDoRetrieveDayEvents DateTime lldtDay Variant llEvents
  1777        Date    dThisDate
  1778        tdEvent tEvent
  1779
  1780        Set pvComObject of (Private_phoEvents(Self)) to llEvents
  1781        Move lldtDay to dThisDate
  1782
  1783        If (pbUseStdFiles(Self)) Begin
  1784#IFDEF SigCj_Use_StdFiles
  1785            Clear CalEvent
  1786            Move dThisDate to CalEvent.EndDate
  1787            Find GT CalEvent by Index.2
  1788            While (Found)
  1789                If (CalEvent.StartDate <= dThisDate) Begin
  1790                    If ((CalEvent.Recurr_State = OLExtpCalendarRecurrenceNotRecurring) or ;
  1791                        (CalEvent.Recurr_State = OLExtpCalendarRecurrenceMaster)) Begin
  1792
  1793                        Get Move_StdFile_Event_To_tdEvent to tEvent
  1794                        Send Add_Event_For_Day tEvent
  1795                    End
  1796                End
  1797
  1798                Find GT CalEvent by Index.2
  1799            End
  1800#ENDIF
  1801        End
  1802        Else Begin
  1803            Send OnEvents_For_Day    dThisDate
  1804        End
  1805        If (pbUseStdDates(Self)) Begin
  1806            Send Load_Special_Date dThisDate
  1807        End
  1808        Else Begin
  1809            Send OnLoad_Special_Date dThisDate
  1810        End
  1811    End_Procedure
  1812
  1813    Procedure Add_Event_For_Day tdEvent tEvent
  1814        Variant vEvent
  1815
  1816        Move (NullComObject()) to vEvent
  1817        Get Create_Event_Object_From_tdEvent tEvent False to vEvent
  1818
  1819        If (not(IsNullComObject(vEvent))) Begin
  1820            Send ComAdd of (Private_phoEvents(Self)) vEvent
  1821        End
  1822    End_Procedure
  1823
  1824    Procedure OnLoad_Special_Date Date dThisDate
  1825    End_Procedure
  1826
  1827    Procedure Load_Special_Date Date dThisDate
  1828        Integer iIndex
  1829        tdCal_Dates tCal_Date
  1830        
  1831#IFDEF SigCj_Use_StdDates
  1832        Clear Cal_Date
  1833        Move dThisDate to Cal_Date.Date_From
  1834        Find Le Cal_Date by Index.1
  1835        If ((Found) and (dThisDate >= Cal_Date.Date_From) and (dThisDate <= Cal_Date.Date_To)) Begin
  1836            Move dThisDate            to tCal_Date.dDate
  1837            Move Cal_Date.Title       to tCal_Date.sTitle
  1838            Move Cal_Date.BackColour  to tCal_Date.iBackColor
  1839            Move Cal_Date.AllDay      to tCal_Date.bAllDay
  1840            Move Cal_Date.AllowEvents to tCal_Date.eAllowEvents
  1841            
  1842            Send Add_Special_Date tCal_Date
  1843        End
  1844#ENDIF
  1845    End_Procedure
  1846
  1847    Function Cal_Find_Date tdCal_Dates tCal_Dates tdCal_Dates tDate Returns Integer
  1848        Integer iRetVal
  1849        
  1850        Move (NE) to iRetVal
  1851        If (tCal_Dates.dDate = tDate.dDate) Move (EQ) to iRetVal
  1852
  1853        Function_Return iRetVal
  1854    End_Function  
  1855
  1856    Function Cal_Special_Date Date dDate Returns Integer
  1857        tdCal_Dates[] tCal_Dates
  1858        tdCal_Dates   tDate
  1859        Integer iDate
  1860        
  1861        Get ptCal_Dates to tCal_Dates
  1862        Move dDate to tDate.dDate
  1863         
  1864        Move (SearchArray(tDate, tCal_Dates, Self, get_Cal_Find_Date)) to iDate
  1865        
  1866        Function_Return iDate        
  1867    End_Function
  1868
  1869    Procedure Add_Special_Date tdCal_Dates tCal_Date
  1870        Integer iIndex
  1871        tdCal_Dates[] tCalDates
  1872
  1873        //Check if already added 
  1874        If (Cal_Special_Date(Self,tCal_Date.dDate) = -1) Begin
  1875            Get ptCal_Dates to tCalDates
  1876            Move (SizeOfArray(tCalDates)) to iIndex
  1877            Move tCal_Date to tCalDates[iIndex]
  1878            Set ptCal_Dates to tCalDates
  1879        End
  1880    End_Procedure
  1881
  1882    Function Cal_BackColor Integer iDate Returns Integer
  1883        tdCal_Dates[] tCal_Dates
  1884        
  1885        Get ptCal_Dates to tCal_Dates
  1886        
  1887        Function_Return tCal_Dates[iDate].iBackColor
  1888    End_Function
  1889
  1890    Function Cal_AllDay Integer iDate Returns Boolean
  1891        tdCal_Dates[] tCal_Dates
  1892        
  1893        Get ptCal_Dates to tCal_Dates
  1894        
  1895        Function_Return tCal_Dates[iDate].bAllDay
  1896    End_Function
  1897
  1898    Function Cal_AllowEvents Integer iDate Returns Integer
  1899        tdCal_Dates[] tCal_Dates
  1900        
  1901        Get ptCal_Dates to tCal_Dates
  1902        
  1903        Function_Return tCal_Dates[iDate].eAllowEvents
  1904    End_Function
  1905
  1906    //-------------------------------------------------------------------------
  1907
  1908    Procedure OnComDoUpdateEvent Variant llpEvent Boolean ByRef llbResult
  1909        tdEvent tEvent
  1910
  1911        //Make sure we are returning a valid value
  1912        Move False to llbResult
  1913
  1914        //Move object data to buffer
  1915        Get Move_Event_Object_Data_To_tdEvent llpEvent to tEvent
  1916
  1917        If (pbUseStdFiles(Self)) Begin
  1918#IFDEF SigCj_Use_StdFiles
  1919            Clear CalEvent
  1920            Move tEvent.iURN to CalEvent.URN
  1921            Find Eq CalEvent by Index.1
  1922            If (Found) Begin
  1923                Reread
  1924                    Send Move_tdEvent_To_StdFile_Event tEvent
  1925                    SaveRecord CalEvent
  1926                Unlock
  1927                Move True to llbResult
  1928            End
  1929#ENDIF
  1930        End
  1931        Else Begin
  1932            Get OnEvent_Save tEvent to llbResult
  1933        End
  1934    End_Procedure
  1935
  1936    //-------------------------------------------------------------------------
  1937
  1938    Procedure OnComDoUpdateRPattern Variant llpPattern Boolean ByRef llbResult
  1939        tdR_Pat tR_Pat
  1940
  1941        //Make sure we are returning a valid value
  1942        Move False to llbResult
  1943
  1944        //Move object data to buffer
  1945        Get Move_R_Pat_Object_Data_To_tdR_Pat llpPattern to tR_Pat
  1946
  1947        If (pbUseStdFiles(Self)) Begin
  1948#IFDEF SigCj_Use_StdFiles
  1949            Clear CalR_Pat
  1950            Move tR_Pat.iURN to CalR_Pat.URN
  1951            Find Eq CalR_Pat by Index.1
  1952            If (Found) Begin
  1953                Reread
  1954                    Send Move_tdR_Pat_To_StdFile_R_Pat tR_Pat
  1955                    SaveRecord CalR_Pat
  1956                Unlock
  1957                Move True to llbResult
  1958            End
  1959#ENDIF
  1960        End
  1961        Else Begin
  1962            Get OnR_Pat_Save tR_Pat to llbResult
  1963        End
  1964    End_Procedure
  1965
  1966    //-------------------------------------------------------------------------
  1967
  1968    Procedure OnComDoGetUpcomingEvents DateTime lldtFrom Integer llPeriodMinutes Variant llpEvents
  1969        Boolean  bFound
  1970        DateTime dtTo dtStart
  1971        TimeSpan tsTo
  1972        tdEvent  tEvent
  1973        Handle   hoEvents
  1974        Variant  vEvent
  1975
  1976        //Workout To Date Time
  1977        Move (DateSetHour(tsTo, (llPeriodMinutes / 60))) to tsTo
  1978        Move (DateSetMinute(tsTo, mod(llPeriodMinutes,60))) to tsTo
  1979        Move (lldtFrom + tsTo) to dtTo
  1980
  1981        Get Private_phoEvents to hoEvents
  1982        Set pvComObject of hoEvents to llpEvents
  1983
  1984        If (pbUseStdFiles(Self)) Begin
  1985#IFDEF SigCj_Use_StdFiles
  1986            Clear CalEvent
  1987            Move lldtFrom  to CalEvent.StartDate
  1988            Move (DateTime_to_Time(Self,lldtFrom)) to CalEvent.StartTime
  1989            Find Gt CalEvent by Index.4
  1990            While (Found)
  1991                Move (Date_and_Time_to_DateTime(Self,CalEvent.StartDate, CalEvent.StartTime)) to dtStart
  1992                If ((dtStart >= lldtFrom) and (dtStart <= dtTo)) Begin
  1993                    Get Move_StdFile_Event_To_tdEvent to tEvent
  1994
  1995                    Send Add_Upcoming_Event tEvent
  1996                End
  1997                Find Gt CalEvent by Index.4
  1998            Loop
  1999#ENDIF
  2000        End
  2001        Else Begin
  2002            Send OnEvent_GetUpcoming lldtFrom dtTo
  2003        End
  2004    End_Procedure
  2005
  2006    Procedure Add_Upcoming_Event tdEvent tEvent
  2007        Variant vEvent
  2008
  2009        Get Create_Event_Object_From_tdEvent tEvent False to vEvent
  2010
  2011        If (not(IsNullComObject(vEvent))) Begin
  2012            Send ComAdd of (Private_phoEvents(Self)) vEvent
  2013        End
  2014    End_Procedure
  2015
  2016    //=========================================================================
  2017    //Std File --> Buffer methods
  2018    //=========================================================================
  2019
  2020#IFDEF SigCj_Use_StdFiles
  2021    Function Move_StdFile_Event_To_tdEvent Returns tdEvent
  2022        tdEvent tEvent
  2023
  2024        Move CalEvent.URN               to tEvent.iURN
  2025        Move CalEvent.AllDayEvent       to tEvent.bAllDayEvent
  2026        Move CalEvent.Body              to tEvent.sBody
  2027        Move CalEvent.BusyStatus        to tEvent.eBusyStatus
  2028        Move CalEvent.Categories        to tEvent.sCategories
  2029        Move CalEvent.CreationDate      to tEvent.dCreationDate
  2030        Move CalEvent.CreationTime      to tEvent.tmCreationTime
  2031        Move CalEvent.CustomIcons       to tEvent.sCustomIcons
  2032        Move CalEvent.CustomProp        to tEvent.sCustomProp
  2033        Move CalEvent.EndDate           to tEvent.dEndDate
  2034        Move CalEvent.EndTime           to tEvent.tmEndTime
  2035        Move CalEvent.Importance        to tEvent.eImportance
  2036        Move CalEvent.Label             to tEvent.sLabel
  2037        Move CalEvent.LastMod_Date      to tEvent.dLastMod_Date
  2038        Move CalEvent.LastMod_Time      to tEvent.tmLastMod_Time
  2039        Move CalEvent.Location          to tEvent.sLocation
  2040        Move CalEvent.MeetingFlag       to tEvent.bMeetingFlag
  2041        Move CalEvent.PrivateFlag       to tEvent.bPrivateFlag
  2042        Move CalEvent.Recurr_State      to tEvent.eRecurr_State
  2043        Move CalEvent.Reminder          to tEvent.bReminder
  2044        Move CalEvent.Rem_MinsBefore    to tEvent.iRem_MinsBefore
  2045        Move CalEvent.Rem_SoundFile     to tEvent.sRem_SoundFile
  2046        Move CalEvent.ScheduleID        to tEvent.iScheduleID
  2047        Move CalEvent.StartDate         to tEvent.dStartDate
  2048        Move CalEvent.StartTime         to tEvent.tmStartTime
  2049        Move CalEvent.Subject           to tEvent.sSubject
  2050        Move CalEvent.RE_StartDateOrg   to tEvent.dRE_StartDateOrg
  2051        Move CalEvent.RE_StartTimeOrg   to tEvent.tmRE_StartTimeOrg
  2052        Move CalEvent.RE_EndDateOrg     to tEvent.dRE_EndDateOrg
  2053        Move CalEvent.RE_EndTimeOrg     to tEvent.tmRE_EndTimeOrg
  2054        Move CalEvent.RE_Deleted        to tEvent.bRE_Deleted
  2055        Move CalEvent.Rec_Pattern_id    to tEvent.iRec_Pattern_id
  2056
  2057        Function_Return tEvent
  2058    End_Function
  2059
  2060    //-------------------------------------------------------------------------
  2061
  2062    Function Move_StdFile_R_Pat_To_tdR_Pat Returns tdR_Pat
  2063        tdR_Pat tR_Pat
  2064
  2065        Move CalR_Pat.URN               to tR_Pat.iURN
  2066        Move CalR_Pat.CustomProp_XML    to tR_Pat.sCustomProp_XML
  2067        Move CalR_Pat.DurationMinutes   to tR_Pat.iDurationMinutes
  2068        Move CalR_Pat.EndAfterOcc       to tR_Pat.iEndAfterOcc
  2069        Move CalR_Pat.EndDate           to tR_Pat.dEndDate
  2070        Move CalR_Pat.EndMethod         to tR_Pat.eEndMethod
  2071        Move CalR_Pat.MasterEventId     to tR_Pat.iMasterEventId
  2072        Move CalR_Pat.StartDate         to tR_Pat.dStartDate
  2073        Move CalR_Pat.StartTime         to tR_Pat.tmStartTime
  2074        Move CalR_Pat.roD_WeekDayOnly   to tR_Pat.bRoD_WeekDayOnly
  2075        Move CalR_Pat.roD_Int_Days      to tR_Pat.iRoD_Int_Days
  2076        Move CalR_Pat.roData1           to tR_Pat.iRoData1
  2077        Move CalR_Pat.roData2           to tR_Pat.iRoData2
  2078        Move CalR_Pat.roData3           to tR_Pat.iRoData3
  2079        Move CalR_Pat.roData4           to tR_Pat.iRoData4
  2080        Move CalR_Pat.roM_DayOfMonth    to tR_Pat.iRoM_DayOfMonth
  2081        Move CalR_Pat.roM_Int_Months    to tR_Pat.iRoM_Int_Months
  2082        Move CalR_Pat.roM_NthInt_Mths   to tR_Pat.iRoM_NthInt_Mths
  2083        Move CalR_Pat.roM_Nth_Day       to tR_Pat.iRoM_Nth_Day
  2084        Move CalR_Pat.roM_Nth_DayMask   to tR_Pat.eRoM_Nth_DayMask
  2085        Move CalR_Pat.roRecurr_Type     to tR_Pat.eRoRecurr_Type
  2086        Move CalR_Pat.roW_DayWeekMask   to tR_Pat.eRoW_DayWeekMask
  2087        Move CalR_Pat.roW_Int_Weeks     to tR_Pat.iRoW_Int_Weeks
  2088        Move CalR_Pat.roY_DayOfMonth    to tR_Pat.iRoY_DayOfMonth
  2089        Move CalR_Pat.roY_MonthOfYear   to tR_Pat.iRoY_MonthOfYear
  2090        Move CalR_Pat.roY_NthM_OfYear   to tR_Pat.iRoY_NthM_OfYear
  2091        Move CalR_Pat.roY_Nth_Day       to tR_Pat.iRoY_Nth_Day
  2092        Move CalR_Pat.roY_Nth_DayMask   to tR_Pat.iRoY_Nth_DayMask
  2093
  2094        Function_Return tR_Pat
  2095    End_Function
  2096#ENDIF
  2097
  2098    //=========================================================================
  2099    //Buffer --> Object methods
  2100    //=========================================================================
  2101
  2102    Function Create_Event_Object_From_tdEvent tdEvent tEvent Boolean bRException Returns Variant
  2103        Handle   hoDataProvider hoEvent hoCategories hoCustomIcons hoCustomProps hoDiary_CallBack
  2104        Integer  iURN
  2105        DateTime dtWork
  2106        Variant  vEvent vCategories vCustomIcons vCustomProps
  2107
  2108        Get Private_phoDataProvider to hoDataProvider
  2109
  2110        Get Private_phoEvent to hoEvent
  2111        Get ComCreateEventEx of hoDataProvider tEvent.iURN to vEvent
  2112        Set pvComObject of hoEvent to vEvent
  2113
  2114        Set ComBody                         of hoEvent to (Trim(tEvent.sBody))
  2115        Set ComSubject                      of hoEvent to (Trim(tEvent.sSubject))
  2116        Set ComLocation                     of hoEvent to (Trim(tEvent.sLocation))
  2117
  2118        Set ComAllDayEvent                  of hoEvent to tEvent.bAllDayEvent
  2119        Set ComBusyStatus                   of hoEvent to tEvent.eBusyStatus
  2120        Set ComImportance                   of hoEvent to tEvent.eImportance
  2121        Set ComLabel                        of hoEvent to (Trim(tEvent.sLabel))
  2122        Set ComMeetingFlag                  of hoEvent to tEvent.bMeetingFlag
  2123        Set ComPrivateFlag                  of hoEvent to tEvent.bPrivateFlag
  2124        Set ComReminder                     of hoEvent to tEvent.bReminder
  2125        Set ComReminderMinutesBeforeStart   of hoEvent to tEvent.iRem_MinsBefore
  2126        Set ComReminderSoundFile            of hoEvent to (Trim(tEvent.sRem_SoundFile))
  2127        Set ComScheduleID                   of hoEvent to tEvent.iScheduleID
  2128
  2129        If (tEvent.eRecurr_State <> OLExtpCalendarRecurrenceMaster) Begin
  2130            Get Date_and_Time_to_DateTime tEvent.dStartDate tEvent.tmStartTime to dtWork
  2131            Set ComStartTime of hoEvent to dtWork
  2132
  2133            Get Date_and_Time_to_DateTime tEvent.dEndDate   tEvent.tmEndTime   to dtWork
  2134            Set ComEndTime of hoEvent to dtWork
  2135        End
  2136
  2137        Get ComCategories of hoEvent to vCategories
  2138        Get Private_phoCategoriesIDs to hoCategories
  2139        Set pvComObject of hoCategories to vCategories
  2140        Send ComLoadFromString of hoCategories tEvent.sCategories
  2141
  2142        Get ComCustomIcons of hoEvent to vCustomIcons
  2143        Get Private_phoCustomIcons to hoCustomIcons
  2144        Set pvComObject of hoCustomIcons to vCustomIcons
  2145        Send ComLoadFromString of hoCustomIcons tEvent.sCustomIcons
  2146
  2147        Get ComCustomProperties of hoEvent to vCustomProps
  2148        Get Private_phoCustomProps to hoCustomProps
  2149        Set pvComObject of hoCustomProps to vCustomProps
  2150        Send ComLoadFromString of hoCustomProps tEvent.sCustomProp
  2151
  2152        If (bRException) Begin
  2153            Send ComMakeAsRException of hoEvent
  2154
  2155            //These are Hidden !!!!!!!!!!!!
  2156            Get Date_and_Time_to_DateTime tEvent.dRE_StartDateOrg tEvent.tmRE_StartTimeOrg to dtWork
  2157            Set ComRExceptionStartTimeOrig of hoEvent to dtWork
  2158
  2159            Get Date_and_Time_to_DateTime tEvent.dRE_EndDateOrg   tEvent.tmRE_EndTimeOrg   to dtWork
  2160            Set ComRExceptionEndTimeOrig of hoEvent to dtWork
  2161
  2162            Set ComRExceptionDeleted       of hoEvent to tEvent.bRE_Deleted
  2163        End
  2164        Else Begin
  2165            Set ComProperty of hoCustomProps "process_RecurrenceState"     to tEvent.eRecurr_State
  2166            Set ComProperty of hoCustomProps "process_RecurrencePatternID" to tEvent.iRec_Pattern_id
  2167        End
  2168
  2169        Function_Return vEvent
  2170    End_Function
  2171
  2172    //-------------------------------------------------------------------------
  2173
  2174    Function Create_R_Pat_Object_From_tdR_Pat tdR_Pat tR_Pat Returns Variant
  2175        Handle   hoDataProvider hoR_Pat hoR_Pat_Options hoCustomProps
  2176        DateTime dtWork
  2177        Variant  vR_Pat vR_Pat_Options vCustomProps
  2178
  2179        Get Private_phoDataProvider to hoDataProvider
  2180
  2181        Get Private_phoR_Pat to hoR_Pat
  2182        Get ComCreateRecurrencePattern of hoDataProvider tR_Pat.iURN to vR_Pat
  2183        Set pvComObject of hoR_Pat to vR_Pat
  2184
  2185        Set ComMasterEventId   of hoR_Pat to tR_Pat.iMasterEventId
  2186        Set ComDurationMinutes of hoR_Pat to tR_Pat.iDurationMinutes
  2187        Set ComEndMethod       of hoR_Pat to tR_Pat.eEndMethod
  2188
  2189        Case Begin
  2190            Case (tR_Pat.eEndMethod = OLExtpCalendarPatternEndDate)
  2191                Set ComEndDate of hoR_Pat to tR_Pat.dEndDate
  2192            Case Break
  2193
  2194            Case (tR_Pat.eEndMethod = OLExtpCalendarPatternEndAfterOccurrences)
  2195                Set ComEndAfterOccurrences of hoR_Pat to tR_Pat.iEndAfterOcc
  2196            Case Break
  2197
  2198            Case Else
  2199                //if no end info change end type
  2200                Set ComEndMethod of hoR_Pat to OLExtpCalendarPatternEndNoDate
  2201        Case End
  2202
  2203        Set ComStartDate of hoR_Pat to tR_Pat.dStartDate
  2204        Get Date_and_Time_to_DateTime tR_Pat.dStartDate tR_Pat.tmStartTime to dtWork
  2205        Set ComStartTime of hoR_Pat to dtWork
  2206
  2207        Get ComOptions of hoR_Pat to vR_Pat_Options
  2208        Get Private_phoR_Pat_Options to hoR_Pat_Options
  2209        Set pvComObject of hoR_Pat_Options to vR_Pat_Options
  2210
  2211        Set ComDailyEveryWeekDayOnly  of hoR_Pat_Options to tR_Pat.bRoD_WeekDayOnly
  2212        Set ComDailyIntervalDays      of hoR_Pat_Options to tR_Pat.iRoD_Int_Days
  2213        Set ComData1                  of hoR_Pat_Options to tR_Pat.iRoData1
  2214        Set ComData2                  of hoR_Pat_Options to tR_Pat.iRoData2
  2215        Set ComData3                  of hoR_Pat_Options to tR_Pat.iRoData3
  2216        Set ComData4                  of hoR_Pat_Options to tR_Pat.iRoData4
  2217        Set ComMonthlyDayOfMonth      of hoR_Pat_Options to tR_Pat.iRoM_DayOfMonth
  2218        Set ComMonthlyIntervalMonths  of hoR_Pat_Options to tR_Pat.iRoM_Int_Months
  2219        Set ComMonthNthIntervalMonths of hoR_Pat_Options to tR_Pat.iRoM_NthInt_Mths
  2220        Set ComMonthNthWhichDay       of hoR_Pat_Options to tR_Pat.iRoM_Nth_Day
  2221        Set ComMonthNthWhichDayMask   of hoR_Pat_Options to tR_Pat.eRoM_Nth_DayMask
  2222        Set ComRecurrenceType         of hoR_Pat_Options to tR_Pat.eRoRecurr_Type
  2223        Set ComWeeklyDayOfWeekMask    of hoR_Pat_Options to tR_Pat.eRoW_DayWeekMask
  2224        Set ComWeeklyIntervalWeeks    of hoR_Pat_Options to tR_Pat.iRoW_Int_Weeks
  2225        Set ComYearlyDayOfMonth       of hoR_Pat_Options to tR_Pat.iRoY_DayOfMonth
  2226        Set ComYearlyMonthOfYear      of hoR_Pat_Options to tR_Pat.iRoY_MonthOfYear
  2227        Set ComYearNthMonthOfYear     of hoR_Pat_Options to tR_Pat.iRoY_NthM_OfYear
  2228        Set ComYearNthWhichDay        of hoR_Pat_Options to tR_Pat.iRoY_Nth_Day
  2229        Set ComYearNthWhichDayMask    of hoR_Pat_Options to tR_Pat.iRoY_Nth_DayMask
  2230
  2231        Get ComCustomProperties of hoR_Pat to vCustomProps
  2232        Get Private_phoCustomProps to hoCustomProps
  2233        Set pvComObject of hoCustomProps to vCustomProps
  2234        Send ComLoadFromString of hoCustomProps tR_Pat.sCustomProp_XML
  2235
  2236        Send ReadRPatternExceptions
  2237
  2238        Function_Return vR_Pat
  2239    End_Function
  2240
  2241    //-------------------------------------------------------------------------
  2242
  2243    Procedure ReadRPatternExceptions
  2244        Boolean bFound
  2245        Integer iSave_Event_URN iPatternID
  2246        Variant vEvent
  2247        tdEvent tEvent
  2248
  2249        Get ComID of (Private_phoR_Pat(Self)) to iPatternID
  2250
  2251        If (pbUseStdFiles(Self)) Begin
  2252#IFDEF SigCj_Use_StdFiles
  2253            Move CalEvent.URN to iSave_Event_URN
  2254
  2255            Clear CalEvent
  2256            Move OLExtpCalendarRecurrenceException to CalEvent.Recurr_State
  2257            Move iPatternID to CalEvent.Rec_Pattern_id
  2258            Find GT CalEvent by Index.3
  2259            Move Found to bFound
  2260            If (bFound) Move (CalEvent.Recurr_State   = OLExtpCalendarRecurrenceException) to bFound
  2261            If (bFound) Move (CalEvent.Rec_Pattern_id = iPatternID                       ) to bFound
  2262            While (bFound)
  2263                Get Move_StdFile_Event_To_tdEvent to tEvent
  2264
  2265                Send Add_R_Pat_Exception_Event tEvent
  2266
  2267                Find GT CalEvent by Index.3
  2268                Move Found to bFound
  2269                If (bFound) Move (CalEvent.Recurr_State   = OLExtpCalendarRecurrenceException) to bFound
  2270                If (bFound) Move (CalEvent.Rec_Pattern_id = iPatternID                       ) to bFound
  2271            End
  2272
  2273            Clear CalEvent
  2274            Move iSave_Event_URN to CalEvent.URN
  2275            Find Eq CalEvent by Index.1
  2276#ENDIF
  2277        End
  2278        Else Begin
  2279            Send OnEventLoadR_Pat_Exceptions iPatternID
  2280        End
  2281    End_Procedure
  2282
  2283    //-------------------------------------------------------------------------
  2284
  2285    Procedure Add_R_Pat_Exception_Event tdEvent tEvent
  2286        Variant vEvent
  2287
  2288        Move (NullComObject()) to vEvent
  2289        Get Create_Event_Object_From_tdEvent tEvent True to vEvent
  2290
  2291        If (not(IsNullComObject(vEvent))) Begin
  2292            Send ComSetException of (Private_phoR_Pat(Self)) vEvent
  2293        End
  2294    End_Procedure
  2295
  2296    //=========================================================================
  2297    //Object --> Buffer methods
  2298    //=========================================================================
  2299
  2300    Function Move_Event_Object_Data_To_tdEvent Variant vEvent Returns tdEvent
  2301        Handle hoEvent hoR_Pat hoCategories hoCustomIcons hoCustomProps
  2302        Variant         vR_Pat vCategories vCustomIcons vCustomProps
  2303        DateTime dtWork
  2304
  2305        tdEvent tEvent
  2306
  2307        //Get the predeclared Dataflex objects
  2308        Get Private_phoEvent         to hoEvent
  2309        Get Private_phoR_Pat         to hoR_Pat
  2310        Get Private_phoCategoriesIDs to hoCategories
  2311        Get Private_phoCustomIcons   to hoCustomIcons
  2312        Get Private_phoCustomProps   to hoCustomProps
  2313
  2314        Set pvComObject of hoEvent to vEvent
  2315
  2316        Get ComId                           of hoEvent to tEvent.iURN
  2317        Get ComAllDayEvent                  of hoEvent to tEvent.bAllDayEvent
  2318        Get ComBody                         of hoEvent to tEvent.sBody
  2319        Get ComBusyStatus                   of hoEvent to tEvent.eBusyStatus
  2320        Get ComImportance                   of hoEvent to tEvent.eImportance
  2321        Get ComLabel                        of hoEvent to tEvent.sLabel
  2322        Get ComLocation                     of hoEvent to tEvent.sLocation
  2323        Get ComMeetingFlag                  of hoEvent to tEvent.bMeetingFlag
  2324        Get ComPrivateFlag                  of hoEvent to tEvent.bPrivateFlag
  2325        Get ComRecurrenceState              of hoEvent to tEvent.eRecurr_State
  2326        Get ComReminder                     of hoEvent to tEvent.bReminder
  2327        Get ComReminderMinutesBeforeStart   of hoEvent to tEvent.iRem_MinsBefore
  2328        Get ComReminderSoundFile            of hoEvent to tEvent.sRem_SoundFile
  2329        Get ComScheduleID                   of hoEvent to tEvent.iScheduleID
  2330        Get ComSubject                      of hoEvent to tEvent.sSubject
  2331        Get ComRExceptionDeleted            of hoEvent to tEvent.bRE_Deleted
  2332
  2333        If ((tEvent.eRecurr_State = OLExtpCalendarRecurrenceMaster) or ;
  2334            (tEvent.eRecurr_State = OLExtpCalendarRecurrenceException)) Begin
  2335
  2336            Get ComRecurrencePattern of hoEvent to vR_Pat
  2337            Set pvComObject of hoR_Pat to vR_Pat
  2338
  2339            Get ComID of hoR_Pat to tEvent.iRec_Pattern_id
  2340        End
  2341        Else Begin
  2342            Move 0 to tEvent.iRec_Pattern_id
  2343        End
  2344
  2345        Get ComStartTime of hoEvent to dtWork
  2346        Move dtWork to tEvent.dStartDate
  2347        Get DateTime_to_Time dtWork to tEvent.tmStartTime
  2348
  2349        Get ComEndTime of hoEvent to dtWork
  2350        If (IsDateValid(dtWork)) Begin
  2351            Move dtWork to tEvent.dEndDate
  2352        End
  2353        Get DateTime_to_Time dtWork to tEvent.tmEndTime
  2354
  2355        Get ComCreationTime of hoEvent to dtWork
  2356        Move dtWork to tEvent.dCreationDate
  2357        Get DateTime_to_Time dtWork to tEvent.tmCreationTime
  2358
  2359        Get ComLastModificationTime of hoEvent to dtWork
  2360        Move dtWork to tEvent.dLastMod_Date
  2361        Get DateTime_to_Time dtWork to tEvent.tmLastMod_Time
  2362
  2363        Get ComRExceptionStartTimeOrig of hoEvent to dtWork
  2364        Move dtWork to tEvent.dRE_StartDateOrg
  2365        Get DateTime_to_Time dtWork to tEvent.tmRE_StartTimeOrg
  2366
  2367        Get ComRExceptionEndTimeOrig of hoEvent to dtWork
  2368        Move dtWork to tEvent.dRE_EndDateOrg
  2369        Get DateTime_to_Time dtWork to tEvent.tmRE_EndTimeOrg
  2370
  2371        Get ComCategories of hoEvent to vCategories
  2372        Set pvComObject of hoCategories to vCategories
  2373        Get ComSaveToString of hoCategories to tEvent.sCategories
  2374
  2375        //Remove multiple cats. leave only the last one selected / added
  2376        Move (Left(tEvent.sCategories,(pos(",",tEvent.sCategories) -1))) to tEvent.sCategories
  2377
  2378        Get ComCustomIcons of hoEvent to vCustomIcons
  2379        Set pvComObject of hoCustomIcons to vCustomIcons
  2380        Get ComSaveToString of hoCustomIcons to tEvent.sCustomIcons
  2381
  2382        Get ComCustomProperties of hoEvent to vCustomProps
  2383        Set pvComObject of hoCustomProps to vCustomProps
  2384        Get ComSaveToString of hoCustomProps to tEvent.sCustomProp
  2385
  2386        Function_Return tEvent
  2387    End_Function
  2388
  2389    //-------------------------------------------------------------------------
  2390
  2391    Function Move_R_Pat_Object_Data_To_tdR_Pat Variant vR_Pat Returns tdR_Pat
  2392        Handle   hoR_Pat hoCustomProps hoR_Pat_Options
  2393        Variant           vCustomProps  vR_Pat_Options
  2394        DateTime dtWork
  2395        tdR_Pat  tR_Pat
  2396
  2397        Get Private_phoR_Pat to hoR_Pat
  2398        Set pvComObject of hoR_Pat to vR_Pat
  2399
  2400        Get ComId                   of hoR_Pat to tR_Pat.iURN
  2401        Get ComDurationMinutes      of hoR_Pat to tR_Pat.iDurationMinutes
  2402        Get ComEndAfterOccurrences  of hoR_Pat to tR_Pat.iEndAfterOcc
  2403        Get ComEndMethod            of hoR_Pat to tR_Pat.eEndMethod
  2404        Get ComMasterEventId        of hoR_Pat to tR_Pat.iMasterEventId
  2405
  2406        Get ComEndDate              of hoR_Pat to tR_Pat.dEndDate
  2407
  2408        Get ComStartDate            of hoR_Pat to tR_Pat.dStartDate
  2409        Get ComStartTime of hoR_Pat to dtWork
  2410        Get DateTime_to_Time dtWork to tR_Pat.tmStartTime
  2411
  2412        Get ComCustomProperties of hoR_Pat to vCustomProps
  2413        Get Private_phoCustomProps to hoCustomProps
  2414        Set pvComObject of hoCustomProps to vCustomProps
  2415        Get ComSaveToString of hoCustomProps to tR_Pat.sCustomProp_XML
  2416
  2417        Get ComOptions of hoR_Pat to vR_Pat_Options
  2418        Get Private_phoR_Pat_Options to hoR_Pat_Options
  2419        Set pvComObject of hoR_Pat_Options to vR_Pat_Options
  2420
  2421        Get ComDailyEveryWeekDayOnly  of hoR_Pat_Options to tR_Pat.bRoD_WeekDayOnly
  2422        Get ComDailyIntervalDays      of hoR_Pat_Options to tR_Pat.iRoD_Int_Days
  2423        Get ComData1                  of hoR_Pat_Options to tR_Pat.iRoData1
  2424        Get ComData2                  of hoR_Pat_Options to tR_Pat.iRoData2
  2425        Get ComData3                  of hoR_Pat_Options to tR_Pat.iRoData3
  2426        Get ComData4                  of hoR_Pat_Options to tR_Pat.iRoData4
  2427        Get ComMonthlyDayOfMonth      of hoR_Pat_Options to tR_Pat.iRoM_DayOfMonth
  2428        Get ComMonthlyIntervalMonths  of hoR_Pat_Options to tR_Pat.iRoM_Int_Months
  2429        Get ComMonthNthIntervalMonths of hoR_Pat_Options to tR_Pat.iRoM_NthInt_Mths
  2430        Get ComMonthNthWhichDay       of hoR_Pat_Options to tR_Pat.iRoM_Nth_Day
  2431        Get ComMonthNthWhichDayMask   of hoR_Pat_Options to tR_Pat.eRoM_Nth_DayMask
  2432        Get ComRecurrenceType         of hoR_Pat_Options to tR_Pat.eRoRecurr_Type
  2433        Get ComWeeklyDayOfWeekMask    of hoR_Pat_Options to tR_Pat.eRoW_DayWeekMask
  2434        Get ComWeeklyIntervalWeeks    of hoR_Pat_Options to tR_Pat.iRoW_Int_Weeks
  2435        Get ComYearlyDayOfMonth       of hoR_Pat_Options to tR_Pat.iRoY_DayOfMonth
  2436        Get ComYearlyMonthOfYear      of hoR_Pat_Options to tR_Pat.iRoY_MonthOfYear
  2437        Get ComYearNthMonthOfYear     of hoR_Pat_Options to tR_Pat.iRoY_NthM_OfYear
  2438        Get ComYearNthWhichDay        of hoR_Pat_Options to tR_Pat.iRoY_Nth_Day
  2439        Get ComYearNthWhichDayMask    of hoR_Pat_Options to tR_Pat.iRoY_Nth_DayMask
  2440
  2441        Function_Return tR_Pat
  2442    End_Function
  2443
  2444    //=========================================================================
  2445    //Buffer --> Std File methods
  2446    //=========================================================================
  2447
  2448#IFDEF SigCj_Use_StdFiles
  2449    Procedure Move_tdEvent_To_StdFile_Event tdEvent tEvent
  2450        Move tEvent.iURN              to CalEvent.URN
  2451        Move tEvent.bAllDayEvent      to CalEvent.AllDayEvent
  2452        Move tEvent.sBody             to CalEvent.Body
  2453        Move tEvent.eBusyStatus       to CalEvent.BusyStatus
  2454        Move tEvent.sCategories       to CalEvent.Categories
  2455        Move tEvent.dCreationDate     to CalEvent.CreationDate
  2456        Move tEvent.tmCreationTime    to CalEvent.CreationTime
  2457        Move tEvent.sCustomIcons      to CalEvent.CustomIcons
  2458        Move tEvent.sCustomProp       to CalEvent.CustomProp
  2459        Move tEvent.dEndDate          to CalEvent.EndDate
  2460        Move tEvent.tmEndTime         to CalEvent.EndTime
  2461        Move tEvent.eImportance       to CalEvent.Importance
  2462        Move tEvent.sLabel            to CalEvent.Label
  2463        Move tEvent.dLastMod_Date     to CalEvent.LastMod_Date
  2464        Move tEvent.tmLastMod_Time    to CalEvent.LastMod_Time
  2465        Move tEvent.sLocation         to CalEvent.Location
  2466        Move tEvent.bMeetingFlag      to CalEvent.MeetingFlag
  2467        Move tEvent.bPrivateFlag      to CalEvent.PrivateFlag
  2468        Move tEvent.eRecurr_State     to CalEvent.Recurr_State
  2469        Move tEvent.bReminder         to CalEvent.Reminder
  2470        Move tEvent.iRem_MinsBefore   to CalEvent.Rem_MinsBefore
  2471        Move tEvent.sRem_SoundFile    to CalEvent.Rem_SoundFile
  2472        Move tEvent.iScheduleID       to CalEvent.ScheduleID
  2473        Move tEvent.dStartDate        to CalEvent.StartDate
  2474        Move tEvent.tmStartTime       to CalEvent.StartTime
  2475        Move tEvent.sSubject          to CalEvent.Subject
  2476        Move tEvent.dRE_StartDateOrg  to CalEvent.RE_StartDateOrg
  2477        Move tEvent.tmRE_StartTimeOrg to CalEvent.RE_StartTimeOrg
  2478        Move tEvent.dRE_EndDateOrg    to CalEvent.RE_EndDateOrg
  2479        Move tEvent.tmRE_EndTimeOrg   to CalEvent.RE_EndTimeOrg
  2480        Move tEvent.bRE_Deleted       to CalEvent.RE_Deleted
  2481        Move tEvent.iRec_Pattern_id   to CalEvent.Rec_Pattern_id
  2482    End_Procedure
  2483
  2484    //-------------------------------------------------------------------------
  2485
  2486    Procedure Move_tdR_Pat_To_StdFile_R_Pat tdR_Pat tR_Pat
  2487        Move tR_Pat.iURN             to CalR_Pat.URN
  2488        Move tR_Pat.sCustomProp_XML  to CalR_Pat.CustomProp_XML
  2489        Move tR_Pat.iDurationMinutes to CalR_Pat.DurationMinutes
  2490        Move tR_Pat.iEndAfterOcc     to CalR_Pat.EndAfterOcc
  2491        Move tR_Pat.dEndDate         to CalR_Pat.EndDate
  2492        Move tR_Pat.eEndMethod       to CalR_Pat.EndMethod
  2493        Move tR_Pat.iMasterEventId   to CalR_Pat.MasterEventId
  2494        Move tR_Pat.dStartDate       to CalR_Pat.StartDate
  2495        Move tR_Pat.tmStartTime      to CalR_Pat.StartTime
  2496        Move tR_Pat.bRoD_WeekDayOnly to CalR_Pat.roD_WeekDayOnly
  2497        Move tR_Pat.iRoD_Int_Days    to CalR_Pat.roD_Int_Days
  2498        Move tR_Pat.iRoData1         to CalR_Pat.roData1
  2499        Move tR_Pat.iRoData2         to CalR_Pat.roData2
  2500        Move tR_Pat.iRoData3         to CalR_Pat.roData3
  2501        Move tR_Pat.iRoData4         to CalR_Pat.roData4
  2502        Move tR_Pat.iRoM_DayOfMonth  to CalR_Pat.roM_DayOfMonth
  2503        Move tR_Pat.iRoM_Int_Months  to CalR_Pat.roM_Int_Months
  2504        Move tR_Pat.iRoM_NthInt_Mths to CalR_Pat.roM_NthInt_Mths
  2505        Move tR_Pat.iRoM_Nth_Day     to CalR_Pat.roM_Nth_Day
  2506        Move tR_Pat.eRoM_Nth_DayMask to CalR_Pat.roM_Nth_DayMask
  2507        Move tR_Pat.eRoRecurr_Type   to CalR_Pat.roRecurr_Type
  2508        Move tR_Pat.eRoW_DayWeekMask to CalR_Pat.roW_DayWeekMask
  2509        Move tR_Pat.iRoW_Int_Weeks   to CalR_Pat.roW_Int_Weeks
  2510        Move tR_Pat.iRoY_DayOfMonth  to CalR_Pat.roY_DayOfMonth
  2511        Move tR_Pat.iRoY_MonthOfYear to CalR_Pat.roY_MonthOfYear
  2512        Move tR_Pat.iRoY_NthM_OfYear to CalR_Pat.roY_NthM_OfYear
  2513        Move tR_Pat.iRoY_Nth_Day     to CalR_Pat.roY_Nth_Day
  2514        Move tR_Pat.iRoY_Nth_DayMask to CalR_Pat.roY_Nth_DayMask
  2515    End_Procedure
  2516#ENDIF
  2517
  2518    //=========================================================================
  2519    //Non Std Table Events
  2520    //=========================================================================
  2521
  2522    Procedure OnEvent_GetUpcoming DateTime dtFrom DateTime dtTo
  2523        Error 5001 "OnEvent_GetUpcoming - Custom Table Event not coded"
  2524    End_Procedure
  2525
  2526    Function OnEvent_Create tdEvent tEvent_Data Returns Integer
  2527        Error 5001 "OnEvent_Create - Custom Table Event not coded"
  2528    End_Function
  2529
  2530    //-------------------------------------------------------------------------
  2531
  2532    Function OnEvent_Delete Integer iEvent_ID Returns Boolean
  2533        Error 5001 "OnEvent_Delete - Custom Table Event not coded"
  2534    End_Function
  2535
  2536    //-------------------------------------------------------------------------
  2537
  2538    Function OnEvent_Read Integer iEvent_ID Returns tdEvent
  2539        Error 5001 "OnEvent_Read - Custom Table Event not coded"
  2540    End_Function
  2541
  2542    //-------------------------------------------------------------------------
  2543
  2544    Function OnEvent_Save tdEvent tEvent_Data Returns Boolean
  2545        Error 5001 "OnEvent_Save - Custom Table Event not coded"
  2546    End_Function
  2547
  2548    //-------------------------------------------------------------------------
  2549
  2550    Procedure OnEvents_For_Day Date dDay
  2551        Error 5001 "OnEvent_For_Day - Custom Table Event not coded"
  2552    End_Procedure
  2553
  2554    //-------------------------------------------------------------------------
  2555
  2556    Procedure OnEventLoadR_Pat_Exceptions Integer iPatternID
  2557        Error 5001 "OnEventLoadR_Pat_Exceptions - Custom Table Event not coded"
  2558    End_Procedure
  2559
  2560    //-------------------------------------------------------------------------
  2561
  2562    Function OnR_Pat_Create tdR_Pat tR_Pat_Data Returns Integer
  2563        Error 5001 "OnR_Pat_Create - Custom Table Event not coded"
  2564    End_Function
  2565
  2566    //-------------------------------------------------------------------------
  2567
  2568    Function OnR_Pat_Delete Integer iR_Pat_ID Returns Boolean
  2569        Error 5001 "OnR_Pat_Delete - Custom Table Event not coded"
  2570    End_Function
  2571
  2572    //-------------------------------------------------------------------------
  2573
  2574    Function OnR_Pat_Read Integer iR_Pat_ID Returns tdR_Pat
  2575        Error 5001 "OnR_Pat_Read - Custom Table Event not coded"
  2576    End_Procedure
  2577
  2578    //-------------------------------------------------------------------------
  2579
  2580    Function OnR_Pat_Save tdR_Pat tR_Pat_Data Returns Boolean
  2581        Error 5001 "OnR_Pat_Save - Custom Table Event not coded"
  2582    End_Function
  2583
  2584    //-------------------------------------------------------------------------
  2585
  2586    Procedure OnCategory_Load 
  2587        Error 5001 "OnCategory_load  - Custom Table Event not coded"
  2588    End_Procedure
  2589
  2590    //=========================================================================
  2591    //Other Events
  2592    //=========================================================================
  2593
  2594    Procedure OnComBeforeEditOperation Variant llOpParams Boolean ByRef llbCancelOperation
  2595        Handle  hoParams bConfirmDelete hoEventViews
  2596        Integer iOperation iBtn iCount
  2597        String  sMessage sTitle
  2598        Variant vEventViews
  2599
  2600        Move False to bConfirmDelete
  2601
  2602        Get Create U_cSigCjComCalendarEditOperationParameters to hoParams
  2603            Set pvComObject of hoParams to llOpParams
  2604
  2605            Get ComOperation of hoParams to iOperation
  2606
  2607            //-------------------------------------------------------------
  2608            Case Begin
  2609                Case (iOperation = OLExtpCalendarEO_Unknown)                      //Unknown operation value.
  2610                    Case Break
  2611
  2612                Case (iOperation = OLExtpCalendarEO_DragCopy)                     //Drag copy event.
  2613                    Case Break
  2614
  2615                Case (iOperation = OLExtpCalendarEO_DragMove)                     //Drag move event.
  2616                    Case Break
  2617
  2618                Case (iOperation = OLExtpCalendarEO_DragResizeBegin)              //Drag Resizing event begin.
  2619                    Case Break
  2620
  2621                Case (iOperation = OLExtpCalendarEO_DragResizeEnd)                //Drag Resizing event end.
  2622                    Case Break
  2623
  2624                Case (iOperation = OLExtpCalendarEO_EditSubject_ByF2)             //In-place edit event by pressing F2 key.
  2625                    Case Break
  2626
  2627                Case (iOperation = OLExtpCalendarEO_EditSubject_ByMouseClick)     //In-place edit event by mouse click.
  2628                    Case Break
  2629
  2630                Case (iOperation = OLExtpCalendarEO_EditSubject_ByTab)            //In-place edit event tab key.
  2631                    Case Break
  2632
  2633                Case (iOperation = OLExtpCalendarEO_EditSubject_AfterEventResize) //In-place edit event after resizing an event.
  2634                    Case Break
  2635
  2636                Case (iOperation = OLExtpCalendarEO_Cut)                          //Cut events.
  2637                    Case Break
  2638
  2639                Case (iOperation = OLExtpCalendarEO_Copy)                         //Copy events.
  2640                    Case Break
  2641
  2642                Case (iOperation = OLExtpCalendarEO_Paste)                        //Paste event.
  2643                    Case Break
  2644
  2645                //-------------------------------------------------------------
  2646
  2647                Case (iOperation = OLExtpCalendarEO_DeleteSelectedEvents)         //Delete selected events.
  2648                    Get ComEventViews of hoParams to vEventViews
  2649                    Get Create U_cSigCjComCalendarViewEvents to hoEventViews
  2650                        Set pvComObject of hoEventViews to vEventViews
  2651
  2652                        Get ComCount of hoEventViews to iCount
  2653                    Send Destroy of hoEventViews
  2654
  2655                    //Handle both single selection and muilt selection here as
  2656                    //this only gets called once, where ...EO_DeleteEvent gets
  2657                    //called for each event .
  2658                    If (iCount = 1) Begin
  2659                        Move "Delete the event"     to sMessage
  2660                        Move "Confirm Delete Event" to sTitle
  2661                    End
  2662                    Else Begin
  2663                        Move "Delete the selected events" to sMessage
  2664                        Move "Confirm Delete Events"      to sTitle
  2665                    End
  2666
  2667                    Get YesNo_Box sMessage sTitle to iBtn
  2668                    If (iBtn = MBR_NO) Begin
  2669                        Move True to llbCancelOperation
  2670                    End
  2671
  2672                    Case Break
  2673
  2674                //-------------------------------------------------------------
  2675
  2676                Case (iOperation = OLExtpCalendarEO_DeleteEvent)                  //Delete event. Sent for a single event or for each selected event.
  2677                    Case Break
  2678
  2679                Case (iOperation = OLExtpCalendarEO_InPlaceCreateEvent)           //In-place event creation.
  2680                    Case Break
  2681
  2682                //-------------------------------------------------------------
  2683
  2684            Case End
  2685
  2686            //-------------------------------------------------------------
  2687
  2688        Send Destroy of hoParams
  2689
  2690    End_Procedure
  2691
  2692    //-------------------------------------------------------------------------
  2693
  2694    Procedure OnComReminders OLECalendarRemindersAction llAction Variant llReminder
  2695        If (llAction = OLExtpCalendarRemindersFire) Begin
  2696            Send ComShowRemindersWindow of oe_CJ_CalendarDialogs
  2697        End
  2698    End_Procedure
  2699
  2700    //-------------------------------------------------------------------------
  2701
  2702    Procedure OnComViewChanged
  2703        Handle  hoActiveView
  2704        Variant vActiveView
  2705
  2706        Get Create U_cSigCjComCalendarView to hoActiveView
  2707            Get ComActiveView to vActiveView
  2708            Set pvComObject of hoActiveView to vActiveView
  2709
  2710            Send OnViewChanged hoActiveView
  2711        Send Destroy of hoActiveView
  2712    End_Procedure
  2713
  2714    Procedure OnViewChanged Handle hoActiveView
  2715        //dummy to be over ridden
  2716    End_Procedure
  2717
  2718    //-------------------------------------------------------------------------
  2719
  2720    Procedure GetHitCode Variant ByRef vViewEvent Integer ByRef iHitCode
  2721        Handle  hoActiveView hoHitTest
  2722        Variant vActiveView vHitTest
  2723        DateTime dtHitDateTime
  2724        
  2725        Get Create U_cSigCjComCalendarView to hoActiveView
  2726            Get ComActiveView to vActiveView
  2727            Set pvComObject of hoActiveView to vActiveView
  2728
  2729            Get Create U_cSigCjComCalendarHitTestInfo to hoHitTest
  2730                Get ComHitTest of hoActiveView to vHitTest
  2731                Set pvComObject of hoHitTest to vHitTest
  2732
  2733                Get ComHitCode   of hoHitTest to iHitCode
  2734                Get ComViewEvent of hoHitTest to vViewEvent
  2735                
  2736                //We save the Hit date & Time here as we have it.
  2737                //This is used with Special Dates Allow Edit when showing dialogs 
  2738                Get ComHitDateTime of hoHitTest to dtHitDateTime
  2739                Set pdtHitDateTime to dtHitDateTime
  2740                
  2741            Send Destroy of hoHitTest
  2742        Send Destroy of hoActiveView
  2743    End_Procedure
  2744
  2745    //-------------------------------------------------------------------------
  2746
  2747    Procedure OnComPrePopulate Variant llViewGroup Variant llEvents
  2748        Boolean bReminder bOccurrence bException bMeeting bPrivate
  2749        Integer iCount iLoop iRecState
  2750        Handle  hoEvent hoCustomIcons hoEvents
  2751        Variant vEvent  vCustomIcons
  2752
  2753        Get Create U_cSigCjComCalendarEvents to hoEvents
  2754            Set pvComObject of hoEvents to llEvents
  2755
  2756            Get ComCount of hoEvents to iCount
  2757            Decrement iCount
  2758
  2759            For iLoop from 0 to iCount
  2760                Get ComEvent of hoEvents iLoop to vEvent
  2761                Get Create U_cSigCjComCalendarEvent to hoEvent
  2762                    Set pvComObject of hoEvent to vEvent
  2763
  2764                    Get ComReminder    of hoEvent to bReminder
  2765                    Get ComMeetingFlag of hoEvent to bMeeting
  2766                    Get ComPrivateFlag of hoEvent to bPrivate
  2767
  2768                    Get ComRecurrenceState of hoEvent to iRecState
  2769                    Move (iRecState = OLExtpCalendarRecurrenceOccurrence) to bOccurrence
  2770                    Move (iRecState = OLExtpCalendarRecurrenceException ) to bException
  2771
  2772                    Get ComCustomIcons of hoEvent to vCustomIcons
  2773                    Get Create U_cSigCjComCalendarIconIDs to hoCustomIcons
  2774                        Set pvComObject of hoCustomIcons to vCustomIcons
  2775
  2776                        If (bReminder  ) Send ComAddIfNeed of hoCustomIcons OLExtpCalendarEventIconIDReminder
  2777                        Else             Send ComRemoveID  of hoCustomIcons OLExtpCalendarEventIconIDReminder
  2778
  2779                        If (bOccurrence) Send ComAddIfNeed of hoCustomIcons OLExtpCalendarEventIconIDOccurrence
  2780                        Else             Send ComRemoveID  of hoCustomIcons OLExtpCalendarEventIconIDOccurrence
  2781
  2782                        If (bException ) Send ComAddIfNeed of hoCustomIcons OLExtpCalendarEventIconIDException
  2783                        Else             Send ComRemoveID  of hoCustomIcons OLExtpCalendarEventIconIDException
  2784
  2785                        If (bMeeting   ) Send ComAddIfNeed of hoCustomIcons OLExtpCalendarEventIconIDMeeting
  2786                        Else             Send ComRemoveID  of hoCustomIcons OLExtpCalendarEventIconIDMeeting
  2787
  2788                        If (bPrivate   ) Send ComAddIfNeed of hoCustomIcons OLExtpCalendarEventIconIDPrivate
  2789                        Else             Send ComRemoveID  of hoCustomIcons OLExtpCalendarEventIconIDPrivate
  2790                    Send Destroy of hoCustomIcons
  2791                Send Destroy of hoEvent
  2792            Loop
  2793
  2794        Send Destroy of hoEvents
  2795    End_Procedure
  2796
  2797    //-------------------------------------------------------------------------
  2798
  2799    Procedure OnComDblClick
  2800        Integer iHitCode iEventID
  2801        Handle  hoViewEvent hoEvent
  2802        Variant vViewEvent vEvent
  2803
  2804        Move (NullComObject()) to vViewEvent
  2805        Send GetHitCode (&vViewEvent) (&iHitCode)
  2806
  2807        If ((iHitCode =    1) or ;
  2808            (iHitCode = 8193)) Begin
  2809            Send Show_Built_In_Dialog eCal_Dialog_NewEvent vEvent //vEvent not need for NewEvent
  2810        End
  2811        If ((iHitCode =    32) or ;
  2812            (iHitCode =  8208) or ;
  2813            (iHitCode =  8224) or ;
  2814            (iHitCode =  9472) or ;
  2815            (iHitCode = 10496)) Begin
  2816            //Now need the Event from the ViewEvent
  2817            Get Create U_cSigCjComCalendarViewEvent to hoViewEvent
  2818                Set pvComObject of hoViewEvent to vViewEvent
  2819                Get ComEvent of hoViewEvent to vEvent
  2820            Send Destroy of hoViewEvent
  2821
  2822            Send Show_Built_In_Dialog eCal_Dialog_EditEvent vEvent
  2823        End
  2824    End_Procedure
  2825
  2826    //-------------------------------------------------------------------------
  2827
  2828    Procedure OnComMouseUp Short llButton Short llShift OLE_XPOS_PIXELS llx OLE_YPOS_PIXELS lly
  2829        Boolean bAddRemoveException bAddGotoCRM
  2830        Integer iRecState iCRM_Link iHitCode
  2831        Handle  hoViewEvent hoEvent hoCustomProps hoRCCM
  2832        Variant vViewEvent  vEvent  vCustomProps
  2833
  2834        If (llButton = eCal_Mouse_Button_Right) Begin
  2835
  2836            Send GetHitCode (&vViewEvent) (&iHitCode)
  2837            If (iHitCode = 8224) Begin
  2838                //Now need the Event from the ViewEvent
  2839                Get Create U_cSigCjComCalendarViewEvent to hoViewEvent
  2840                    Set pvComObject of hoViewEvent to vViewEvent
  2841                    Get ComEvent of hoViewEvent to vEvent
  2842                Send Destroy of hoViewEvent
  2843
  2844                Get Create U_cSigCjComCalendarEvent to hoEvent
  2845                    Set pvComObject of hoEvent to vEvent
  2846
  2847                    Get ComRecurrenceState of hoEvent to iRecState
  2848                    If (iRecState = OLExtpCalendarRecurrenceException) Move True to bAddRemoveException
  2849
  2850                    Get ComCustomProperties of hoEvent to vCustomProps
  2851                    Get Create U_cSigCjComCalendarCustomProperties to hoCustomProps
  2852                        Set pvComObject of hoCustomProps to vCustomProps
  2853
  2854                        Get ComProperty of hoCustomProps "CRM_Link" to iCRM_Link
  2855                    Send Destroy of hoCustomProps
  2856                    Move (iCRM_Link > 0) to bAddGotoCRM
  2857                Send Destroy of hoEvent
  2858            End
  2859        End
  2860
  2861        If (bAddRemoveException or bAddGotoCRM) Begin
  2862            Get Create U_cEventRCCM to hoRCCM
  2863                If (bAddGotoCRM)         Send ConfigureItem of hoRCCM cEventRCCM_GotoCRM         (Self) "msg_GotoCRM"         "Goto CRM Entry"   True vEvent
  2864                If (bAddRemoveException) Send ConfigureItem of hoRCCM cEventRCCM_RemoveException (Self) "msg_RemoveException" "Remove Exception" True vEvent
  2865
  2866                Send Display_RCCM of hoRCCM
  2867            Send Destroy of hoRCCM
  2868        End
  2869    End_Procedure
  2870
  2871    //-------------------------------------------------------------------------
  2872
  2873    Procedure GotoCRM Variant vEvent
  2874//        Handle  hoCustomProps hoEvent hoCallBack
  2875//        Variant vCustomProps
  2876//        Integer iURN
  2877//
  2878//        Get Create U_cSigCjComCalendarEvent to hoEvent
  2879//            Set pvComObject of hoEvent to vEvent
  2880//
  2881//            Get ComCustomProperties of hoEvent to vCustomProps
  2882//            Get Create U_cSigCjComCalendarCustomProperties to hoCustomProps
  2883//                Set pvComObject of hoCustomProps to vCustomProps
  2884//
  2885//                Get ComProperty of hoCustomProps "CRM_Link" to iURN
  2886//            Send Destroy of hoCustomProps
  2887//        Send Destroy of hoEvent
  2888//
  2889//        Send Close_Panel
  2890    End_Procedure
  2891
  2892    //-------------------------------------------------------------------------
  2893
  2894    Procedure RemoveException Variant vEvent
  2895        Handle  hoEvent
  2896        Integer iURN
  2897
  2898        Get Create U_cSigCjComCalendarEvent to hoEvent
  2899            Set pvComObject of hoEvent to vEvent
  2900
  2901            Get ComID of hoEvent to iURN
  2902        Send Destroy of hoEvent
  2903
  2904#IFDEF SigCj_Use_StdFiles
  2905        Clear CalEvent
  2906        Move iURN to CalEvent.URN
  2907        Find eq CalEvent by Index.1
  2908        If (Found) Begin
  2909            Lock
  2910                Delete CalEvent
  2911            Unlock
  2912        End
  2913#ENDIF 
  2914        Send Force_Data_Refresh
  2915    End_Procedure
  2916
  2917    //-------------------------------------------------------------------------
  2918
  2919    Procedure Force_Data_Refresh
  2920        Handle  hoDataProvider
  2921
  2922        Get Private_phoDataProvider to hoDataProvider
  2923        Send ComRemoveAllEvents of hoDataProvider
  2924
  2925        Send ComPopulate
  2926        Send ComRedrawControl
  2927    End_Procedure
  2928
  2929    //-------------------------------------------------------------------------
  2930
  2931//    Procedure OnComSelectionChanged OLECalendarSelectionChanged llSelType
  2932//        If (llSelType = OLExtpCalendarSelectionUnknown) Begin
  2933//            Set pdSelectedDate to "01/01/1900"    
  2934//        End
  2935//        If (llSelType = OLExtpCalendarSelectionDays) Begin
  2936//            
  2937//        End
  2938//        If (llSelType = OLExtpCalendarSelectionEvents) Begin
  2939//            
  2940//        End
  2941//    End_Procedure
  2942
  2943    Procedure Show_Built_In_Dialog Integer eDialog Variant vEvent
  2944        Boolean bOK 
  2945        DateTime dtHitDateTime
  2946        Date dHitDate
  2947        Integer iSpecial_Date eAllow
  2948
  2949        If (eDialog = eCal_Dialog_NewEvent) Begin
  2950            Get pdtHitDateTime to dtHitDateTime 
  2951            Move (Date(dtHitDateTime)) to dHitDate
  2952            Get Cal_Special_Date dHitDate to iSpecial_Date
  2953
  2954            Move False to bOK
  2955            If (iSpecial_Date <> -1) Begin
  2956                Move (Cal_AllowEvents(Self,iSpecial_Date)) to eAllow
  2957                If (eAllow = eCal_AE_Ask) Begin
  2958                    If (YesNo_Box(psAllowEventText(Self), psAllowEventTitle(Self), MB_DEFBUTTON2) = MBR_YES) Move True to bOK
  2959                End
  2960                If (eAllow = eCal_AE_Yes) Begin
  2961                    Move True to bOK
  2962                End
  2963            End
  2964            Else Begin
  2965                Move True to bOK
  2966            End
  2967
  2968            If (bOK) Begin
  2969                Get ComShowNewEvent of oe_CJ_CalendarDialogs to bOK
  2970            End
  2971        End
  2972
  2973        If (eDialog = eCal_Dialog_EditEvent) Begin
  2974            Get ComShowEditEvent of oe_CJ_CalendarDialogs vEvent to bOK
  2975        End
  2976    End_Procedure
  2977
  2978    //-------------------------------------------------------------------------
  2979
  2980    Procedure Set_Theme_To_Office_07
  2981        Handle hoThemeOffice07 hoCustonIcons hoWorkspace
  2982        Variant vTheme vCustonIcons
  2983        String sBitmapPath
  2984
  2985        Handle hoDayView hoDay hoGroup hoCell hoWorkCell hoNonWorkCell
  2986        Variant vDayView  vDay  vGroup  vCell  vWorkCell  vNonWorkCell
  2987        Integer iColor
  2988
  2989        Get phoWorkspace of ghoApplication to hoWorkspace
  2990        Get psBitmapPath of hoWorkspace to sBitmapPath
  2991
  2992        Get Create U_cSigCjComCalendarThemeOffice2007 to hoThemeOffice07
  2993        Get ComTheme to vTheme
  2994
  2995        Send CreateComObject of hoThemeOffice07
  2996            Get pvComObject of hoThemeOffice07 to vTheme
  2997            Send ComSetTheme vTheme
  2998
  2999            //Load any custom options (e.g. icons etc)
  3000            Get ComCustomIcons of hoThemeOffice07 to vCustonIcons
  3001            Get Create U_cSigCjComImageManagerIcons to hoCustonIcons
  3002                Set pvComObject of hoCustonIcons to vCustonIcons
  3003
  3004                Send ComLoadIcon of hoCustonIcons (sBitmapPath + "\Cal_Reminder.ico"  ) OLExtpCalendarEventIconIDReminder   OLExtpImageNormal
  3005                Send ComLoadIcon of hoCustonIcons (sBitmapPath + "\Cal_Occurrence.ico") OLExtpCalendarEventIconIDOccurrence OLExtpImageNormal
  3006                Send ComLoadIcon of hoCustonIcons (sBitmapPath + "\Cal_Exception.ico" ) OLExtpCalendarEventIconIDException  OLExtpImageNormal
  3007                Send ComLoadIcon of hoCustonIcons (sBitmapPath + "\Cal_Meeting.ico"   ) OLExtpCalendarEventIconIDMeeting    OLExtpImageNormal
  3008                Send ComLoadIcon of hoCustonIcons (sBitmapPath + "\Cal_Private.ico"   ) OLExtpCalendarEventIconIDPrivate    OLExtpImageNormal
  3009//                Send ComLoadIcon of hoCustonIcons (sBitmapPath + "\Diary_Link.ico"      ) cj_CRM_Link_Icon                    OLExtpImageNormal
  3010//                Send ComLoadIcon of hoCustonIcons (sBitmapPath + "\Diary_Complete.ico"  ) cj_CRM_Complete_Icon                OLExtpImageNormal
  3011
  3012            Send Destroy of hoCustonIcons
  3013            //Standard colors
  3014            //We drill down to the color objects. Having got to them we Set 
  3015            //properties so that they are easy to access.
  3016
  3017            //This is coded as a full Create Destory set incase we need to
  3018            //access the intermediate objects for anything else.
  3019
  3020            Get Private_phoWorkingCellColors    to hoWorkCell
  3021            Get Private_phoNonWorkingCellColors to hoNonWorkCell
  3022
  3023            Get ComDayView of hoThemeOffice07 to vDayView
  3024            Get Create U_cSigCjComCalendarThemeOffice2007DayView to hoDayView
  3025                Set pvComObject of hoDayView to vDayView
  3026
  3027                Get ComDay of hoDayView to vDay
  3028                Get Create U_cSigCjComCalendarThemeOffice2007DayViewDay to hoDay
  3029                    Set pvComObject of hoDay to vDay
  3030
  3031                    Get ComGroup of hoDay to vGroup
  3032                    Get Create U_cSigCjComCalendarThemeOffice2007DayViewDayGroup to hoGroup
  3033                        Set pvComObject of hoGroup to vGroup
  3034
  3035                        Get ComCell of hoGroup to vCell
  3036                        Get Create U_cSigCjComCalendarThemeDayViewCell to hoCell
  3037                            Set pvComObject of hoCell to vCell
  3038
  3039                            Get ComWorkCell of hoCell to vWorkCell
  3040                            Set pvComObject of hoWorkCell to vWorkCell
  3041
  3042                            Get ComNonWorkCell of hoCell to vNonWorkCell
  3043                            Set pvComObject of hoNonWorkCell to vNonWorkCell
  3044
  3045                            //We do not destory the Non/WorkingCell objects
  3046
  3047                        Send Destroy of hoCell
  3048                    Send Destroy of hoGroup
  3049                Send Destroy of hoDay
  3050            Send Destroy of hoDayView
  3051        Send Destroy of hoThemeOffice07
  3052    End_Procedure
  3053
  3054    //-------------------------------------------------------------------------
  3055
  3056    Procedure Custom_Icon Variant llpEvent Integer iIcon Boolean bShow
  3057        Handle  hoCustomIcons hoEvent
  3058        Variant vCustomIcons
  3059
  3060        Get Create U_cSigCjComCalendarEvent to hoEvent
  3061            Set pvComObject of hoEvent to llpEvent
  3062
  3063            Get ComCustomIcons of hoEvent to vCustomIcons
  3064            Get Create U_cSigCjComCalendarIconIDs to hoCustomIcons
  3065                Set pvComObject of hoCustomIcons to vCustomIcons
  3066
  3067                If (bShow) Send ComAddIfNeed of hoCustomIcons iIcon
  3068                Else       Send ComRemoveID  of hoCustomIcons iIcon
  3069            Send Destroy of hoCustomIcons
  3070        Send Destroy of hoEvent
  3071    End_Procedure
  3072
  3073    //-------------------------------------------------------------------------
  3074
  3075    Procedure Add_Link_Icon Variant llpEvent
  3076        Handle  hoCustomIcons hoEvent
  3077        Variant vCustomIcons
  3078
  3079        Get Create U_cSigCjComCalendarEvent to hoEvent
  3080            Set pvComObject of hoEvent to llpEvent
  3081
  3082            Get ComCustomIcons of hoEvent to vCustomIcons
  3083            Get Create U_cSigCjComCalendarIconIDs to hoCustomIcons
  3084                Set pvComObject of hoCustomIcons to vCustomIcons
  3085
  3086//                Send ComAddIfNeed of hoCustomIcons cj_CRM_Link_Icon
  3087
  3088            Send Destroy of hoCustomIcons
  3089        Send Destroy of hoEvent
  3090    End_Procedure
  3091
  3092    //-------------------------------------------------------------------------
  3093
  3094    Procedure Enable_Icons
  3095        Integer iView ismDay
  3096        Handle hoThemeOffice07 hoView hoEvent hoIcons hoDay hoGroup hoSM_Day hoFormula
  3097        Variant vIconsToDraw vView vEvent vIcons vTheme vDay vSM_Day vGroup vFormula
  3098
  3099        Get ComTheme to vTheme
  3100        Get Create U_cSigCjComCalendarThemeOffice2007 to hoThemeOffice07
  3101            Set pvComObject of hoThemeOffice07 to vTheme
  3102
  3103            For iView from 1 to 3
  3104                If (iView = 1) Begin
  3105                    Get ComDayView of hoThemeOffice07 to vView
  3106                    Get Create U_cSigCjComCalendarThemeOffice2007DayView to hoView
  3107                End
  3108                If (iView = 2) Begin
  3109                    Get ComWeekView of hoThemeOffice07 to vView
  3110                    Get Create U_cSigCjComCalendarThemeOffice2007WeekView to hoView
  3111                End
  3112                If (iView = 3) Begin
  3113                    Get ComMonthView of hoThemeOffice07 to vView
  3114                    Get Create U_cSigCjComCalendarThemeOffice2007MonthView to hoView
  3115                End
  3116                    Set pvComObject of hoView to vView
  3117
  3118                    Get comEvent of hoView to vEvent
  3119                    If (iView = 1) Get Create U_cSigCjComCalendarThemeOffice2007DayViewEvent   to hoEvent
  3120                    If (iView = 2) Get Create U_cSigCjComCalendarThemeOffice2007WeekViewEvent  to hoEvent
  3121                    If (iView = 3) Get Create U_cSigCjComCalendarThemeOffice2007MonthViewEvent to hoEvent
  3122                        Set pvComObject of hoEvent to vEvent
  3123
  3124                        Get ComEventIconsToDraw of hoEvent to vIcons
  3125                        Get Create U_cSigCjComCalendarThemeEventIconsToDraw to hoIcons
  3126                            Set pvComObject of hoIcons to vIcons
  3127
  3128                            Set ComShowException    of hoIcons to True
  3129                            Set ComShowMeeting      of hoIcons to True
  3130                            Set ComShowOccurrence   of hoIcons to True
  3131                            Set ComShowPrivate      of hoIcons to True
  3132                            Set ComShowReminder     of hoIcons to True
  3133                        Send Destroy of hoIcons
  3134
  3135                        Get ComHeightFormula of hoEvent to vFormula
  3136                        Get Create U_cSigCjComCalendarThemeFormulaMulDivC to hoFormula
  3137                            Set pvComObject of hoFormula to vFormula
  3138
  3139                            Set ComConstant of hoFormula to 5
  3140                        Send Destroy of hoFormula
  3141                    Send Destroy of hoEvent
  3142
  3143                    Get ComDay of hoView to vDay
  3144                    If (iView = 1) Get Create U_cSigCjComCalendarThemeOffice2007DayViewDay   to hoDay
  3145                    If (iView = 2) Get Create U_cSigCjComCalendarThemeOffice2007WeekViewDay  to hoDay
  3146                    If (iView = 3) Get Create U_cSigCjComCalendarThemeOffice2007MonthViewDay to hoDay
  3147                        Set pvComObject of hoDay to vDay
  3148
  3149                        If (iView = 1) Begin
  3150                            Get ComGroup of hoDay to vGroup
  3151                            Get Create U_cSigCjComCalendarThemeOffice2007DayViewDayGroup to hoGroup
  3152                            Set pvComObject of hoGroup to vGroup
  3153                        End
  3154                        Else Move hoDay to hoGroup
  3155                        For ismDay from 1 to 2
  3156                            If (ismDay = 1) Begin
  3157                                Get ComSingleDayEvent of hoGroup to vSM_Day
  3158                                Get Create U_cSigCjComCalendarThemeOffice2007DayViewEventSingleDay to hoSM_Day
  3159                            End
  3160                            If (ismDay = 2) Begin
  3161                                Get ComMultiDayEvent of hoGroup to vSM_Day
  3162                                Get Create U_cSigCjComCalendarThemeOffice2007DayViewEventMultiDay to hoSM_Day
  3163                            End
  3164                                Set pvComObject of hoSM_Day to vSM_Day
  3165
  3166                                Get ComEventIconsToDraw of hoSM_Day to vIcons
  3167                                Get Create U_cSigCjComCalendarThemeEventIconsToDraw to hoIcons
  3168                                    Set pvComObject of hoIcons to vIcons
  3169
  3170                                    Set ComShowException    of hoIcons to True
  3171                                    Set ComShowMeeting      of hoIcons to True
  3172                                    Set ComShowOccurrence   of hoIcons to True
  3173                                    Set ComShowPrivate      of hoIcons to True
  3174                                    Set ComShowReminder     of hoIcons to True
  3175                                Send Destroy of hoIcons
  3176                            Send Destroy of hoSM_Day
  3177                        Loop
  3178
  3179                        If (iView = 1) Send Destroy of hoGroup
  3180                    Send Destroy of hoDay
  3181                Send Destroy of hoView
  3182            Loop
  3183
  3184        Send ComRefreshMetrics of hoThemeOffice07
  3185        Send Destroy of hoThemeOffice07
  3186    End_Procedure
  3187
  3188    //-------------------------------------------------------------------------
  3189
  3190    Procedure Setup_Categories
  3191        Handle  hoDataProvider hoCategories 
  3192        Variant vCategories  
  3193        tdCal_Category tCat
  3194
  3195        Get Private_phoDataProvider to hoDataProvider
  3196
  3197        Get Private_phoCategories to hoCategories
  3198        Get ComEventCategories of hoDataProvider to vCategories
  3199        Set pvComObject of hoCategories to vCategories
  3200            
  3201        Send ComRemoveAll of hoCategories
  3202
  3203        If (pbUseStdFiles(Self)) Begin
  3204#IFDEF SigCj_Use_StdFiles
  3205            Clear Cal_Cats
  3206            Find gt Cal_Cats by Index.1
  3207            While (Found)
  3208                Get Move_StdFile_Cats_To_tdCats to tCat
  3209                Send Add_Category tCat
  3210                    
  3211                Find gt Cal_Cats by Index.1
  3212            Loop
  3213#ENDIF
  3214        End
  3215        Else Begin
  3216            Send OnCategory_Load 
  3217        End
  3218    End_Procedure
  3219
  3220#IFDEF SigCj_Use_StdFiles
  3221    Function Move_StdFile_Cats_To_tdCats Returns tdCal_Category
  3222        tdCal_Category tCats
  3223        
  3224        Move Cal_Cats.ID             to tCats.iURN
  3225        Move Cal_Cats.Short_Desc     to tCats.sShort_Desc
  3226        Move Cal_Cats.Long_Desc      to tCats.sLong_Desc
  3227        Move Cal_Cats.BorderColour   to tCats.iBorder_Color
  3228        Move Cal_Cats.ColourDark     to tCats.iColor_Dark
  3229        Move Cal_Cats.ColourLight    to tCats.iColor_Light
  3230        Move Cal_Cats.GradientFactor to tCats.nGradient
  3231
  3232        Function_Return tCats
  3233    End_Function
  3234#ENDIF
  3235
  3236    Procedure Add_Category tdCal_Category tCat
  3237        Boolean bIsComObjectCreated
  3238        Handle  hoCategory hoColorGradient 
  3239        Variant vCategory vBackGround
  3240
  3241        Get Create U_cSigCjComCalendarEventCategory to hoCategory
  3242            Get IsComObjectCreated of hoCategory to bIsComObjectCreated
  3243            If (not(bIsComObjectCreated)) Begin
  3244                Send CreateComObject of hoCategory
  3245            End
  3246    
  3247            Set ComID          of hoCategory to tCat.iURN
  3248            Set ComName        of hoCategory to tCat.sShort_Desc
  3249            Set ComBorderColor of hoCategory to tCat.iBorder_Color
  3250    
  3251            Get ComBackground of hoCategory to vBackGround
  3252            Get Create U_cSigCjComCalendarThemeColorGradient to hoColorGradient
  3253                Set pvComObject of hoColorGradient to vBackGround
  3254    
  3255                Set ComColorDark      of hoColorGradient to tCat.iColor_Dark
  3256                Set ComColorLight     of hoColorGradient to tCat.iColor_Light
  3257                Set ComGradientFactor of hoColorGradient to tCat.nGradient
  3258    
  3259            Send Destroy of hoColorGradient
  3260
  3261            Get pvComObject of hoCategory to vCategory
  3262            Send ComAdd of (Private_phoCategories(Self)) vCategory
  3263        Send Destroy of hoCategory
  3264    End_Procedure
  3265
  3266    //-------------------------------------------------------------------------
  3267
  3268    Function Date_Range_String Handle hoActiveView Returns String
  3269        Handle  hoDay
  3270        Variant vDay
  3271        Integer iDaysCount
  3272        String  sRange
  3273        Date    dDate
  3274
  3275        Get ComDaysCount of hoActiveView to iDaysCount
  3276
  3277        If (iDaysCount < 1) Begin
  3278            Move "Error no days selected" to sRange
  3279        End
  3280        Else Begin
  3281            Get Create U_cSigCjComCalendarViewDay to hoDay
  3282                Get ComDays of hoActiveView 0 to vDay
  3283                Set pvComObject of hoDay to vDay
  3284                Get ComDate of hoDay to dDate
  3285                Move dDate to sRange
  3286
  3287                If (iDaysCount > 1) Begin
  3288                    Get ComDays of hoActiveView (iDaysCount -1) to vDay
  3289                    Set pvComObject of hoDay to vDay
  3290                    Get ComDate of hoDay to dDate
  3291                    Move (sRange + " - " + String(dDate)) to sRange
  3292                End
  3293            Send Destroy of hoDay
  3294        End
  3295
  3296        Function_Return sRange
  3297    End_Function
  3298
  3299    //-------------------------------------------------------------------------
  3300
  3301    Procedure Set_Single_Data_Source Integer iDataType String sDataSource
  3302        Boolean bOK
  3303        Handle  hoDataProvider
  3304        Variant vDataProvider
  3305        String  sConnection
  3306
  3307        //We only support DataFlex & Outlook at present.
  3308        If (iDataType = eCal_DT_DataFlex) Begin
  3309            Move "Provider=custom;DSN=Not Needed" to sConnection
  3310        End
  3311        Else Begin
  3312            Move ("Provider=" + eCal_DataProvider_Outlook + ";Data Source=" + sDataSource) to sConnection
  3313        End
  3314
  3315        Send ComSetDataProvider sConnection
  3316
  3317        Get Private_phoDataProvider to hoDataProvider
  3318        Get ComDataProvider to vDataProvider
  3319        Set pvComObject of hoDataProvider to vDataProvider
  3320
  3321        Get ComOpen of hoDataProvider to bOK
  3322        If (not(bOK)) Begin
  3323            Get ComCreate of hoDataProvider to bOK
  3324        End
  3325    End_Procedure
  3326
  3327    //=========================================================================
  3328
  3329    Function IsTimeBetween DateTime dtTime String sStartTime String sEndTime Returns Boolean
  3330        Integer iWork iStart iEnd iTime
  3331        String  sWork
  3332
  3333        Move (Left(sStartTime,5)) to sStartTime //strip of secinds (if there)
  3334        Move (Left(sEndTime,5)) to sEndTime //strip of secinds (if there)
  3335
  3336        Move (Replaces(":",sEndTime,  "")) to iEnd
  3337        Move (Replaces(":",sStartTime,"")) to iStart
  3338
  3339        Move (DateGetHour(dtTime)) to sWork
  3340        Move (DateGetMinute(dtTime)) to iWork
  3341        If (iWork < 10) Move (Append(sWork,"0")) to sWork
  3342        Move (Append(sWork,String(iWork))) to iTime
  3343
  3344        Function_Return ((iTime >= iStart) and (iTime < iEnd))
  3345    End_Function
  3346
  3347    Function IsLastWeekDay Date dDate Returns Boolean
  3348        Integer iDay iMask iLastDay
  3349
  3350        Move (Mod(dDate,7)) to iDay //Saturday = 1 Friday = 0
  3351
  3352        Get peWorkWeekMask to iMask
  3353        If (iMask = eCal_WW_AllWeek ) Move 2 to iLastDay    //Assume Sunday is last day of week
  3354        If (iMask = eCal_WW_SaSu    ) Move 2 to iLastDay
  3355        If (iMask = eCal_WW_Mo_Fr   ) Move 0 to iLastDay
  3356        If (iMask = 126             ) Move 1 to iLastDay
  3357
  3358        Function_Return (iDay = iLastDay)
  3359    End_Function
  3360
  3361    Procedure OnComBeforeDrawThemeObject OLECalendarBeforeDrawThemeObject lleObjType Variant llDrawParams
  3362        Boolean  bWorkCell bShade bLastDay
  3363        Handle   hoDrawParams hoCellColor
  3364        DateTime dtBegin
  3365        Integer  iIndex iSpecial_Date
  3366        Integer iWorkingColor iNonWorkingColor
  3367
  3368        If (lleObjType = OLExtpCalendarBeforeDraw_DayViewCell) Begin
  3369            Get Private_phoThemeDayViewCellParams to hoDrawParams
  3370            Set pvComObject  of hoDrawParams to llDrawParams
  3371            Get ComBeginTime of hoDrawParams to dtBegin
  3372            Get ComWorkCell  of hoDrawParams to bWorkCell
  3373
  3374            Get piWorkingCellBackColor    to iWorkingColor
  3375            Get piNonWorkingCellBackColor to iNonWorkingColor
  3376
  3377            Get Cal_Special_Date (Date(dtBegin)) to iSpecial_Date
  3378            If (iSpecial_Date <> -1) Begin
  3379                Move (Cal_BackColor(Self,iSpecial_Date)) to iWorkingColor
  3380                If (Cal_AllDay(Self,iSpecial_Date)) Begin
  3381                    Move (Cal_BackColor(Self,iSpecial_Date)) to iNonWorkingColor
  3382                End
  3383            End
  3384            Else Begin
  3385                If (bWorkCell) Begin
  3386                    If (pbShadeLunchTime(Self)) Begin
  3387                        Get IsTimeBetween dtBegin (ptmLunchStartTime(Self)) (ptmLunchEndTime(Self)) to bShade
  3388                        If (bShade) Begin
  3389                            Move iNonWorkingColor to iWorkingColor
  3390                        End
  3391                    End
  3392    
  3393                    If (pbShorterLastDay(Self)) Begin
  3394                        Get ComIndex of hoDrawParams to iIndex
  3395    
  3396                        //need to cast the DateTime as passing DateTime to a Date results in a DateTime!
  3397                        Get IsLastWeekDay (Date(dtBegin)) to bLastDay
  3398                        If (bLastDay) Begin
  3399                            Get IsTimeBetween dtBegin (ptmLastWorkDayEndTime(Self)) (Private_ptmWorkDayEndTime(Self)) to bShade
  3400                            If (bShade) Begin
  3401                            Move iNonWorkingColor to iWorkingColor
  3402                            End
  3403                        End
  3404                    End
  3405                End
  3406            End // not special
  3407            
  3408            If (bWorkCell) Begin
  3409                Get Private_phoWorkingCellColors to hoCellColor
  3410                Set ComBackgroundColor of hoCellColor to iWorkingColor
  3411            End
  3412            Else Begin
  3413                Get Private_phoNonWorkingCellColors to hoCellColor
  3414                Set ComBackgroundColor of hoCellColor to iNonWorkingColor
  3415            End
  3416        End
  3417
  3418    End_Procedure
  3419End_Class
  3420
  3421//==============================================================================
  3422//End of Package - cSigCJCalendarControl.pkg
  3423//==============================================================================
  3424