REM ***** BASIC ***** Dim oDialog AS Object Dim document AS Object Sub Main End Sub Sub InsertSwitch InsertSwitchTag(FALSE) End Sub Sub InsertSwitchInline InsertSwitchTag(TRUE) End Sub Sub InsertSwitchTag(bInline As Boolean) document = StarDesktop.CurrentComponent Dim oCur as Object BasicLibraries.LoadLibrary("HelpAuthoring") oDialog = LoadDialog("HelpAuthoring", "dlgSwitch") oDialogModel = oDialog.Model oOptSys = oDialog.GetControl("opSwitchSystem") oOptAppl = oDialog.GetControl("opSwitchAppl") oOptDistrib = oDialog.GetControl("opSwitchDistrib") If oDialog.Execute() = 1 Then If oOptSys.State Then sType = "sys" ElseIf oOptAppl.State Then sType = "appl" ElseIf oOptDistrib.State Then sType = "distrib" End If Else End If oDialog.Dispose If bInline Then oSel = thiscomponent.getcurrentcontroller.getselection oCur = oSel(0).getText.createTextCursorByRange(oSel(0)) oStart = oCur.getStart oCurStart = oStart.getText.createTextCursorByRange(oStart) oEnd = oCur.getEnd oCurEnd = oEnd.getText.createTextCursorByRange(oEnd) thiscomponent.getcurrentcontroller.select(oCurStart) InsertTag("SWITCHINLINE_","<SWITCHINLINE select=""" + sType + """>","hlp_aux_switch") InsertCase(sType,TRUE,oCur) thiscomponent.getcurrentcontroller.select(oCurEnd) CloseSwitchInline GoLeft(1) Else CR_before GoUp(1) SetParaStyle("hlp_aux_switch") InsertTag("SWITCH_","<SWITCH select=""" + sType + """>","hlp_aux_switch") GoLeft(1) GoDown(1) SetCharStyle("Default") CloseSwitch GoUp(1) InsertCase(sType,FALSE,oCur) End If End Sub Sub InsertCaseElement document = StarDesktop.CurrentComponent Dim oCur as Object BasicLibraries.LoadLibrary("HelpAuthoring") oDialog = LoadDialog("HelpAuthoring", "dlgSwitch") oDialogModel = oDialog.Model oOptSys = oDialog.GetControl("opSwitchSystem") oOptAppl = oDialog.GetControl("opSwitchAppl") oOptDistrib = oDialog.GetControl("opSwitchDistrib") If oDialog.Execute() = 1 Then If oOptSys.State Then sType = "sys" ElseIf oOptAppl.State Then sType = "appl" ElseIf oOptDistrib.State Then sType = "distrib" End If Else End If oDialog.Dispose InsertCase(sType,FALSE,oCur) End Sub Sub InsertDefaultElement document = StarDesktop.CurrentComponent BasicLibraries.LoadLibrary("HelpAuthoring") InsertDefault End Sub Sub InsertCaseInlineElement document = StarDesktop.CurrentComponent Dim oCur as Object BasicLibraries.LoadLibrary("HelpAuthoring") oDialog = LoadDialog("HelpAuthoring", "dlgSwitch") oDialogModel = oDialog.Model oOptSys = oDialog.GetControl("opSwitchSystem") oOptAppl = oDialog.GetControl("opSwitchAppl") oOptDistrib = oDialog.GetControl("opSwitchDistrib") If oDialog.Execute() = 1 Then If oOptSys.State Then sType = "sys" ElseIf oOptAppl.State Then sType = "appl" ElseIf oOptDistrib.State Then sType = "distrib" End If Else End If oDialog.Dispose oSel = thiscomponent.getcurrentcontroller.getselection oCur = oSel(0).getText.createTextCursorByRange(oSel(0)) oStart = oCur.getStart oCurStart = oStart.getText.createTextCursorByRange(oStart) oEnd = oCur.getEnd oCurEnd = oEnd.getText.createTextCursorByRange(oEnd) InsertCase(sType,TRUE,oCur) GoLeft(1) End Sub Sub InsertDefaultInlineElement document = StarDesktop.CurrentComponent BasicLibraries.LoadLibrary("HelpAuthoring") oSel = thiscomponent.getcurrentcontroller.getselection oCur = oSel(0).getText.createTextCursorByRange(oSel(0)) oStart = oCur.getStart oCurStart = oStart.getText.createTextCursorByRange(oStart) oEnd = oCur.getEnd oCurEnd = oEnd.getText.createTextCursorByRange(oEnd) InsertDefaultInline(oCur) GoLeft(1) End Sub Sub InsertCaseSys InsertCase("sys",FALSE) End Sub Sub InsertCaseAppl InsertCase("appl",FALSE) End Sub Sub InsertCaseDistrib InsertCase("distrib",FALSE) End Sub Sub InsertCaseInlineSys InsertCase("sys",TRUE) End Sub Sub InsertCaseInlineAppl InsertCase("appl",TRUE) End Sub Sub InsertCaseInlineDistrib InsertCase("distrib",TRUE) End Sub Sub InsertDefaultInline(oCur as Object) oSel = thiscomponent.getcurrentcontroller.getselection 'oCur = oSel(0).getText.createTextCursorByRange(oSel(0)) oStart = oCur.getStart oCurStart = oStart.getText.createTextCursorByRange(oStart) oEnd = oCur.getEnd oCurEnd = oEnd.getText.createTextCursorByRange(oEnd) thiscomponent.getcurrentcontroller.select(oCurStart) InsertTag("DEFAULTINLINE_","<DEFAULTINLINE>") thiscomponent.getcurrentcontroller.select(oCurEnd) InsertTag("_DEFAULTINLINE","</DEFAULTINLINE>") End Sub Sub InsertCase(sType As String, bInline As Boolean,oCur As Object) document = StarDesktop.CurrentComponent BasicLibraries.LoadLibrary("HelpAuthoring") oDialog = LoadDialog("HelpAuthoring", "dlgCase") oDialogModel = oDialog.Model oOptPredefined = oDialog.GetControl("opPredefined") oCbPredefined = oDialog.GetControl("cbPredefined") oOptSpecify = oDialog.GetControl("opSpecify") oTxtSpecify = oDialog.GetControl("txtSpecify") oTxtSpecify.setVisible(FALSE) If sType = "sys" Then arItems = Array("WIN","UNIX","MAC") ElseIf sType = "appl" Then arItems = Array("CALC","CHART","DRAW","IMPRESS","MATH","WRITER","BASIC") ElseIf sType = "distrib" Then arItems = Array("OPENSOURCE","COMMERCIAL") Else msgbox "Unknown Case. Go tell Frank about this",0,"D'oh!" Exit Sub End If oCbPredefined.AddItems(arItems,ubound(arItems)) oCbPredefined.SetText(arItems(0)) If oDialog.Execute() = 1 Then If oOptPredefined.State Then sSelect = oCbPredefined.GetText Else sSelect = oTxtSpecify.Text End If If bInline Then oSel = thiscomponent.getcurrentcontroller.getselection 'oCur = oSel(0).getText.createTextCursorByRange(oSel(0)) oStart = oCur.getStart oCurStart = oStart.getText.createTextCursorByRange(oStart) oEnd = oCur.getEnd oCurEnd = oEnd.getText.createTextCursorByRange(oEnd) thiscomponent.getcurrentcontroller.select(oCurStart) InsertTag("CASEINLINE_","<CASEINLINE select="""+sSelect+""">") thiscomponent.getcurrentcontroller.select(oCurEnd) InsertTag("_CASEINLINE","</CASEINLINE>") Else CR_before GoUp(1) SetParaStyle("hlp_aux_switch") InsertTag("CASE_","<CASE select=""" + sSelect+""">","hlp_aux_switch") GoLeft(1) GoDown(1) SetCharStyle("Default") CloseCase GoUp(1) End If End If oDialog.dispose End Sub Sub StatusChange oOptPredefined = oDialog.GetControl("opPredefined") oCbPredefined = oDialog.GetControl("cbPredefined") oOptSpecify = oDialog.GetControl("opSpecify") oTxtSpecify = oDialog.GetControl("txtSpecify") If oOptPredefined.State Then oCbPredefined.setVisible(TRUE) oTxtSpecify.setVisible(FALSE) ElseIf oOptSpecify.State Then oCbPredefined.setVisible(FALSE) oTxtSpecify.setVisible(TRUE) End If End Sub Sub CloseCase CR SetParaStyle("hlp_aux_switch") InsertTag("_CASE","</CASE>","hlp_aux_switch") End Sub Sub InsertDefault CR_before GoUp(1) SetParaStyle("hlp_aux_switch") InsertTag("DEFAULT_","<DEFAULT>","hlp_aux_switch") GoLeft(1) GoDown(1) SetCharStyle("Default") CloseDefault GoUp(1) End Sub Sub CloseDefault CR SetParaStyle("hlp_aux_switch") InsertTag("_DEFAULT","</DEFAULT>","hlp_aux_switch") End Sub Sub CloseSwitch CR SetParaStyle("hlp_aux_switch") InsertTag("_SWITCH","</SWITCH>","hlp_aux_switch") End Sub Sub CloseSwitchInline InsertTag("_SWITCHINLINE","</SWITCHINLINE>") End Sub