home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 October A / Pcwk10a98.iso / Lotus / LOTUS / WORDPRO / SCRIPTS / UIWATCH.LSS < prev    next >
Text File  |  1998-05-14  |  12KB  |  397 lines

  1. Option Public
  2. Public ConvertCase As MenuItem
  3. Sub Main
  4.     .UpdateUI
  5.     Dim MenuBar As MenuItem
  6.     Dim FileMenu As MenuItem
  7.     Dim TextMenu As MenuItem
  8.     Dim ViewMenu As MenuItem
  9.     Dim TableMenu As MenuItem
  10.     Dim EditMenu As MenuItem
  11.     Dim InsertMenu As MenuItem
  12.     Dim FormatMenu As MenuItem
  13.     Dim ToolsMenu As MenuItem
  14.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  15.     Set FileMenu = MenuBar.items("&File")
  16.     FileMenu.Action = "uiwatch.lss!File_Menu"
  17.     Set TextMenu = MenuBar.items("&Text")
  18.     TextMenu.Action = "uiwatch.lss!Text_Menu"
  19.     Set ViewMenu = MenuBar.items("&View")
  20.     ViewMenu.Action = "uiwatch.lss!View_Menu"
  21.     Set TableMenu = MenuBar.items("T&able")
  22.     TableMenu.Action = "uiwatch.lss!Table_Menu"
  23.     Set EditMenu = MenuBar.items("&Edit")
  24.     EditMenu.Action = "uiwatch.lss!Edit_Menu"
  25.     Set InsertMenu = MenuBar.items("&Insert")
  26.     InsertMenu.Action = "uiwatch.lss!Insert_Menu"
  27.     Set FormatMenu = MenuBar.items("F&ormat")
  28.     FormatMenu.Action = "uiwatch.lss!Format_Menu"
  29.     Set ToolsMenu = MenuBar.items("&Tools")
  30.     ToolsMenu.Action = "uiwatch.lss!Tools_Menu"
  31. End Sub
  32. Sub File_Menu
  33.     Dim MenuBar As MenuItem
  34.     Dim FileMenu As MenuItem
  35.     Dim Revert As MenuItem
  36.     Dim DocName As String
  37.     Dim DocPath As String
  38.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  39.     Set Filemenu = MenuBar.items("&File")
  40.     Set Revert =  FileMenu.items("&Revert to Saved")
  41.     Revert.OverrideCheckAndEnable = True
  42.     If .ActiveDocument Is Nothing Then
  43.         Revert.Enabled = False
  44.     Else
  45.         DocPath = .ActiveDocument.Path
  46.         If DocPath = "" Then
  47.             Revert.Enabled = False
  48.         Else
  49.             Revert.Enabled = True
  50.         End If
  51.     End If
  52. End Sub
  53. Sub Text_Menu
  54.     Dim MenuBar As MenuItem
  55.     Dim TextMenu As MenuItem
  56.     Dim Caps As MenuItem
  57.     Dim Upper As MenuItem
  58.     Dim Lower As MenuItem
  59.     Dim Small As MenuItem
  60.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  61.     Set Textmenu = MenuBar.items("&Text")
  62.     Set Caps =  TextMenu.items("&Caps")
  63.     Set Upper = Caps.items("&Upper Case")
  64.     Upper.OverrideCheckAndEnable = True
  65.     If .Text.Font.UpperCase = True Then
  66.         Upper.Checked = True
  67.     Else
  68.         Upper.Checked = False
  69.     End If
  70.     Set Lower = Caps.items("&Lower Case")
  71.     Lower.OverrideCheckAndEnable = True
  72.     If .Text.Font.LowerCase = True Then
  73.         Lower.Checked = True
  74.     Else
  75.         Lower.Checked = False
  76.     End If
  77.     Set Small = Caps.items("&Small Caps")
  78.     Small.OverrideCheckAndEnable = True
  79.     If .Text.Font.SmallCaps = True Then
  80.         Small.Checked = True
  81.     Else
  82.         Small.Checked = False
  83.     End If
  84. End Sub
  85. Sub View_Menu
  86.     Dim MenuBar As MenuItem
  87.     Dim ViewMenu As MenuItem
  88.     Dim Tools As MenuItem
  89.     Dim ScriptBar As MenuItem
  90.     Dim Text_Bar As MenuItem
  91.     Dim UnivBar As MenuItem
  92.     Dim Normal As MenuItem
  93.     Dim Layout As MenuItem
  94.     Dim Outline As MenuItem
  95.     Dim FullScreen As MenuItem
  96.     Dim Footnotes As MenuItem
  97.     Dim Graphics As MenuItem
  98.     Dim Table_Grid As MenuItem
  99.     Dim Hidden_Text As MenuItem
  100.     Dim Returns As MenuItem
  101.     Dim BarShowing As Integer
  102.     Dim ScriptPal As IconBar
  103.     Dim TextPal As Iconbar
  104.     Dim UnivPal As Iconbar
  105.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  106.     Set ViewMenu = MenuBar.items("&View")
  107.     Set Tools =  ViewMenu.items("&Toolbars")
  108.     
  109.     Set ScriptBar = Tools.items("&Script Tools")
  110.     ScriptBar.OverrideCheckAndEnable = True    
  111.     Set ScriptPal = .ApplicationWindow.IconBarManager.IconBars("Script Tools")
  112.     BarShowing = ScriptPal.IsShowing
  113.     
  114.     If BarShowing = True Then
  115.         ScriptBar.Checked = True
  116.     Else
  117.         ScriptBar.Checked = False
  118.     End If
  119.     
  120.     Set Text_Bar = Tools.items("&Text")
  121.     Text_Bar.OverrideCheckAndEnable = True    
  122.     Set TextPal = .ApplicationWindow.IconBarManager.IconBars("Text")
  123.     BarShowing = TextPal.IsShowing
  124.     
  125.     If BarShowing = True Then
  126.         Text_Bar.Checked = True
  127.     Else
  128.         Text_Bar.Checked = False
  129.     End If
  130.     
  131.     Set UnivBar = Tools.items("&Universal")
  132.     UnivBar.OverrideCheckAndEnable = True    
  133.     Set UnivPal = .ApplicationWindow.IconBarManager.IconBars("Universal")
  134.     BarShowing = UnivPal.IsShowing
  135.     
  136.     If BarShowing = True Then
  137.         UnivBar.Checked = True
  138.     Else
  139.         UnivBar.Checked = False
  140.     End If
  141.     
  142.     Set FullScreen = ViewMenu.items("F&ull Screen")
  143.     FullScreen.OverrideCheckAndEnable = True
  144.     Set Normal = ViewMenu.items("&Normal")
  145.     Normal.OverrideCheckAndEnable = True
  146.     Set Layout = ViewMenu.items("&Page Layout")
  147.     Layout.OverrideCheckAndEnable = True
  148.     Set Outline = ViewMenu.items("&Outline")
  149.     Outline.OverrideCheckAndEnable = True
  150.     Set Footnotes = ViewMenu.items("&Footnotes")
  151.     Set Graphics = ViewMenu.items("&Graphics")
  152.     Graphics.OverrideCheckAndEnable = True
  153.     Set Table_Grid = ViewMenu.items("Table Grid&lines")
  154.     Table_Grid.OverrideCheckAndEnable = True
  155.     Set Hidden_Text = ViewMenu.items("Hidden Te&xt")
  156.     Hidden_Text.OverrideCheckAndEnable = True
  157.     Set Returns = ViewMenu.items("&Show Paragraph Symbols")
  158.     Returns.OverrideCheckAndEnable = True
  159.     If .ActiveDocument Is Nothing Then
  160.         FullScreen.Enabled = False
  161.         Normal.Enabled = False
  162.         Outline.Enabled = False
  163.         Layout.Enabled = False
  164.         Normal.Checked = False
  165.         Layout.Checked = False
  166.         Outline.Checked = False
  167.         Graphics.Enabled = False
  168.         Table_Grid.Enabled = False
  169.         Hidden_Text.Enabled = False
  170.         Returns.Enabled = False
  171.         Graphics.Checked = False
  172.         Table_Grid.Checked = False
  173.         Hidden_Text.Checked = False
  174.         Returns.Checked = False
  175.     Else
  176.         FullScreen.Enabled = True
  177.         Normal.Enabled = True
  178.         Outline.Enabled = True
  179.         Layout.Enabled = True
  180.         Graphics.Enabled = True
  181.         Table_Grid.Enabled = True
  182.         Hidden_Text.Enabled = True
  183.         Returns.Enabled = True
  184.         
  185.         If .ActiveDocWindow.WinViewPrefs.IsViewPictures = True Then
  186.             Graphics.Checked = True
  187.         Else
  188.             Graphics.Checked = False
  189.         End If
  190.         
  191.         If .ActiveDocWindow.WinViewPrefs.IsViewTableGridLines = True Then
  192.             Table_Grid.Checked = True
  193.         Else
  194.             Table_Grid.Checked = False
  195.         End If
  196.         
  197.         If CurrentDocument.DivisionOptions.ShowHiddenText = True Then
  198.             Hidden_Text.Checked = True
  199.         Else
  200.             Hidden_Text.Checked = False
  201.         End If
  202.         
  203.         If .ActiveDocWindow.WinViewPrefs.IsViewReturns = True Then
  204.             Returns.Checked = True
  205.         Else
  206.             Returns.Checked = False
  207.         End If
  208.         
  209.         If .Division.Foundry.Footnotes.Count = 0 Then
  210.             Footnotes.OverrideCheckAndEnable = True
  211.             Footnotes.Enabled = False
  212.         Else
  213.             Footnotes.OverrideCheckAndEnable = False
  214.         End If    
  215.         
  216.         If .ActiveDocWindow.WinViewPrefs.IsInOutline = False Then
  217.             If .ActiveDocWindow.WinViewPrefs.IsInDraft = True Then
  218.                 Normal.Checked = True
  219.                 Layout.Checked = False
  220.                 Outline.Checked = False
  221.             End If
  222.         End If
  223.         
  224.         If .ActiveDocWindow.WinViewPrefs.IsInOutline = False Then
  225.             If .ActiveDocWindow.WinViewPrefs.IsInDraft = False Then
  226.                 Normal.Checked = False
  227.                 Layout.Checked = True
  228.                 Outline.Checked = False
  229.             End If
  230.         End If
  231.         
  232.         If .ActiveDocWindow.WinViewPrefs.IsInOutline = True Then
  233.             Normal.Checked = False
  234.             Layout.Checked = False
  235.             Outline.Checked = True
  236.         End If
  237.         
  238.     End If    
  239. End Sub
  240. Sub Table_Menu
  241.     Dim MenuBar As MenuItem
  242.     Dim TableMenu As MenuItem
  243.     Dim Table_From_Text As MenuItem
  244.     Dim GridLines As MenuItem
  245.     Dim Row_Col As MenuItem
  246.     Dim GrdLines As Integer
  247.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  248.     Set TableMenu = MenuBar.items("T&able")
  249.     Set Table_From_Text =  TableMenu.items("Convert Text to Table...")
  250.     Set GridLines = TableMenu.items("&Gridlines")
  251.     Set Row_Col = TableMenu.items("Ro&w/Col Indicators")
  252.     Table_From_Text.OverrideCheckAndEnable = True
  253.     GridLines.OverrideCheckAndEnable = True
  254.     Row_Col.OverrideCheckAndEnable = True
  255.     If .ActiveDocument Is Nothing Then
  256.         GridLines.Enabled = False
  257.         Table_From_Text.Enabled = False
  258.         Row_Col.Enabled = False
  259.     Else    
  260.         If Not(.Text.SelectionType = $LwpSelectionTypeText) Then
  261.             Table_From_Text.Enabled = False
  262.         Else
  263.             Table_From_Text.Enabled = True
  264.         End If
  265.         If Not (.Table Is Nothing) Then
  266.             If .Table.IsValid = True Then
  267.                 GridLines.Enabled = True
  268.                 Row_Col.Enabled = True
  269.                 If .ActiveDocWindow.WinViewPrefs.IsViewTableHeadings = True Then
  270.                     Row_Col.Checked = True
  271.                 Else
  272.                     Row_Col.Checked = False
  273.                 End If
  274.                 GrdLines = .ActiveDocWindow.WinViewPrefs.IsViewTableGridLines
  275.                 If GrdLines = False Then
  276.                     GridLines.Checked = False
  277.                 Else
  278.                     GridLines.Checked = True
  279.                 End If
  280.             End If
  281.         Else
  282.             GridLines.Enabled = False
  283.             GridLines.Checked = False
  284.             Row_Col.Enabled = False
  285.             Row_Col.Checked = False
  286.         End If
  287.     End If
  288. End Sub
  289. Sub Edit_Menu
  290.     Dim MenuBar As MenuItem
  291.     Dim EditMenu As MenuItem
  292.     Dim Clear As MenuItem
  293.     Dim L_Case As MenuItem
  294.     Dim U_Case As MenuItem
  295.     Dim I_Cap As MenuItem
  296.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  297.     Set EditMenu = MenuBar.items("&Edit")
  298.     Set Clear =  EditMenu.items("Cle&ar")
  299.     Set ConvertCase = EditMenu.items("Con&vert Case")
  300.     Set L_Case = ConvertCase.items("&Lowercase")
  301.     Set U_Case = ConvertCase.items("&Uppercase")
  302.     Set I_Cap = ConvertCase.items("&Initial Capitals")
  303.     Clear.OverrideCheckAndEnable = True
  304.     ConvertCase.OverrideCheckAndEnable = True
  305.     L_Case.OverrideCheckAndEnable = True
  306.     U_Case.OverrideCheckAndEnable = True
  307.     I_Cap.OverrideCheckAndEnable = True
  308.     If .ActiveDocument Is Nothing Then
  309. '        ConvertCase.Enabled = False
  310.         L_Case.Enabled = False
  311.         U_Case.Enabled = False
  312.         I_Cap.Enabled = False
  313.         Clear.Enabled = False
  314.     Else
  315. '        ConvertCase.Enabled = True
  316.         L_Case.Enabled = True
  317.         U_Case.Enabled = True
  318.         I_Cap.Enabled = True
  319.         Clear.Enabled = True
  320.     End If
  321. End Sub
  322. Sub Insert_Menu
  323.     Dim MenuBar As MenuItem
  324.     Dim InsertMenu As MenuItem
  325.     Dim Hyperlink As MenuItem
  326.     Dim FootNote As MenuItem
  327.     Dim EndNote As MenuItem
  328.     Dim Foot_Opt As MenuItem
  329.     Dim End_Opt As MenuItem
  330.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  331.     Set InsertMenu = MenuBar.items("&Insert")
  332.     Set FootNote = InsertMenu.items("&Footnote")
  333.     Set EndNote = InsertMenu.items("&Endnote")
  334.     Set Hyperlink =  InsertMenu.items("Hyperl&ink...")
  335.     Set Foot_Opt = FootNote.items("&Options...")
  336.     Set End_Opt = EndNote.items("&Options...")
  337.     Hyperlink.OverrideCheckAndEnable = True
  338.     If .ActiveDocument Is Nothing Then
  339.         Hyperlink.Enabled = False
  340.         Foot_Opt.OverrideCheckAndEnable = True
  341.         End_Opt.OverrideCheckAndEnable = True
  342.         Foot_Opt.Enabled = False
  343.         End_Opt.Enabled = False
  344.     Else
  345.         Foot_Opt.OverrideCheckAndEnable = False
  346.         End_Opt.OverrideCheckAndEnable = False
  347.         Hyperlink.Enabled = True
  348.     End If
  349. End Sub
  350. Sub Format_Menu
  351.     Dim MenuBar As MenuItem
  352.     Dim FormatMenu As MenuItem
  353.     Dim Tabset As MenuItem
  354.     Dim Borders As MenuItem
  355.     Dim Frameitem As MenuItem
  356.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  357.     Set FormatMenu = MenuBar.items("F&ormat")
  358.     Set Tabset =  FormatMenu.items("&Tabs...")
  359.     Tabset.OverrideCheckAndEnable = True
  360.     If .ActiveDocument Is Nothing Then
  361.         Tabset.Enabled = False
  362.     Else
  363.         Tabset.Enabled = True
  364.     End If
  365.     Set Borders = FormatMenu.items("&Borders and Shading")
  366.     Set Frameitem = Borders.items("&Frame...")
  367.     If .ActiveDocument Is Nothing Then
  368.         Frameitem.OverrideCheckAndEnable = False
  369.     Else
  370.         If Typename(.Layout) = "NOTELAYOUT" Then    
  371.             Frameitem.OverrideCheckAndEnable = True
  372.             Frameitem.Enabled = False
  373.         Else
  374.             Frameitem.OverrideCheckAndEnable = False
  375.         End If
  376.     End If    
  377. End Sub
  378. Sub Tools_Menu
  379.     Dim MenuBar As MenuItem
  380.     Dim ToolsMenu As MenuItem
  381.     Dim Hyperlink As MenuItem
  382.     Dim Highlight As MenuItem
  383.     Set MenuBar = .ApplicationWindow.LwpMenuBar
  384.     Set ToolsMenu = MenuBar.items("&Tools")
  385.     Set Hyperlink =  ToolsMenu.items("H&ypertext/Web Links")
  386.     Set Highlight = ToolsMenu.items("&Highlight")
  387.     Hyperlink.OverrideCheckAndEnable = True
  388.     Highlight.OverrideCheckAndEnable = True
  389.     If .ActiveDocument Is Nothing Then
  390.         Hyperlink.Enabled = False
  391.         Highlight.Enabled = False
  392.     Else
  393.         Hyperlink.Enabled = True
  394.         Highlight.Enabled = True
  395.     End If
  396. End Sub
  397.