xref: /trunk/main/helpauthoring/HelpAuthoring/Embed.xba (revision 66b843ff8f1eedd2e69941f1ea52fa080f01ec28)
11ecadb57SMathias Bauer<?xml version="1.0" encoding="UTF-8"?>
21ecadb57SMathias Bauer<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*3e02b54dSAndrew Rist<!--***********************************************************
4*3e02b54dSAndrew Rist *
5*3e02b54dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
6*3e02b54dSAndrew Rist * or more contributor license agreements.  See the NOTICE file
7*3e02b54dSAndrew Rist * distributed with this work for additional information
8*3e02b54dSAndrew Rist * regarding copyright ownership.  The ASF licenses this file
9*3e02b54dSAndrew Rist * to you under the Apache License, Version 2.0 (the
10*3e02b54dSAndrew Rist * "License"); you may not use this file except in compliance
11*3e02b54dSAndrew Rist * with the License.  You may obtain a copy of the License at
12*3e02b54dSAndrew Rist *
13*3e02b54dSAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
14*3e02b54dSAndrew Rist *
15*3e02b54dSAndrew Rist * Unless required by applicable law or agreed to in writing,
16*3e02b54dSAndrew Rist * software distributed under the License is distributed on an
17*3e02b54dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18*3e02b54dSAndrew Rist * KIND, either express or implied.  See the License for the
19*3e02b54dSAndrew Rist * specific language governing permissions and limitations
20*3e02b54dSAndrew Rist * under the License.
21*3e02b54dSAndrew Rist *
22*3e02b54dSAndrew Rist ***********************************************************-->
231ecadb57SMathias Bauer<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Embed" script:language="StarBasic">&apos; *** MODULE EMBED ***
241ecadb57SMathias Bauer
251ecadb57SMathias BauerDim oDialog AS Object
261ecadb57SMathias BauerDim oBrowseDialog As Object
271ecadb57SMathias BauerDim document AS Object
281ecadb57SMathias BauerDim arParas(0) As String
291ecadb57SMathias BauerDim arSecs(0) As String
301ecadb57SMathias BauerDim arVars(0) As String
311ecadb57SMathias Bauer
321ecadb57SMathias Bauer&apos;=======================================================
331ecadb57SMathias Bauer&apos; Main
341ecadb57SMathias Bauer&apos;-------------------------------------------------------
351ecadb57SMathias Bauer&apos; Embeds a variable or a section
361ecadb57SMathias Bauer&apos;=======================================================
371ecadb57SMathias BauerSub Main(optional bCR As Boolean)
381ecadb57SMathias Bauer
391ecadb57SMathias Bauer    If not IsHelpFile Then
401ecadb57SMathias Bauer        msgbox(strErr_NoHelpFile)
411ecadb57SMathias Bauer        Exit Sub
421ecadb57SMathias Bauer    End If
431ecadb57SMathias Bauer
441ecadb57SMathias Bauer    GlobalScope.BasicLibraries.loadLibrary(&quot;Tools&quot;)
451ecadb57SMathias Bauer
461ecadb57SMathias Bauer    document = StarDesktop.CurrentComponent
471ecadb57SMathias Bauer
481ecadb57SMathias Bauer    BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
491ecadb57SMathias Bauer    oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgEmbed&quot;)
501ecadb57SMathias Bauer    oDialogModel = oDialog.Model
511ecadb57SMathias Bauer
521ecadb57SMathias Bauer    oTxtFilePath = oDialog.GetControl(&quot;txtFilePath&quot;)          &apos; path to file, rel to Docroot
531ecadb57SMathias Bauer    oTxtID = oDialog.GetControl(&quot;txtID&quot;)                  &apos; anchor
541ecadb57SMathias Bauer    oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)      &apos; pure filename
551ecadb57SMathias Bauer    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
561ecadb57SMathias Bauer    oOpSection = oDialog.GetControl(&quot;opSection&quot;)
571ecadb57SMathias Bauer
581ecadb57SMathias Bauer    DocRoot = ReadConfig(&quot;HelpPrefix&quot;)
591ecadb57SMathias Bauer    EmbedFolder = ReadConfig(&quot;LastEmbedDir&quot;)
601ecadb57SMathias Bauer    EmbedFile = ReadConfig(&quot;LastEmbedFile&quot;)
611ecadb57SMathias Bauer    EmbedID = ReadConfig(&quot;LastEmbedAnchor&quot;)
621ecadb57SMathias Bauer    EmbedType = ReadConfig(&quot;LastEmbedType&quot;)
631ecadb57SMathias Bauer    If EmbedType = &quot;Variable&quot; Then
641ecadb57SMathias Bauer        oOpVariable.State = TRUE
651ecadb57SMathias Bauer    Else
661ecadb57SMathias Bauer        oOpVariable.State = FALSE
671ecadb57SMathias Bauer    End If
681ecadb57SMathias Bauer    SetLabel
691ecadb57SMathias Bauer
701ecadb57SMathias Bauer    If IsSubDir(EmbedFolder,DocRoot) Then
711ecadb57SMathias Bauer        RelDir = Right(EmbedFolder,Len(EmbedFolder)-Len(DocRoot))
721ecadb57SMathias Bauer        If Dir(DocRoot+RelDir+EmbedFile) &gt; &quot;&quot; Then
731ecadb57SMathias Bauer            oTxtFilePath.Text = RelDir+EmbedFile
741ecadb57SMathias Bauer            oTxtHidFName.Text = DocRoot+RelDir+EmbedFile
751ecadb57SMathias Bauer            oTxtID.Text = EmbedID
761ecadb57SMathias Bauer        End If
771ecadb57SMathias Bauer    End If
781ecadb57SMathias Bauer
791ecadb57SMathias Bauer
801ecadb57SMathias Bauer    GoForIt = 1
811ecadb57SMathias Bauer
821ecadb57SMathias Bauer    If (oDialog.Execute() = 1 AND oTxtFilePath.Text &lt;&gt; &quot;&quot;) Then
831ecadb57SMathias Bauer&apos;      msgbox (oTxtFilePath.Text)
841ecadb57SMathias Bauer
851ecadb57SMathias Bauer        If oTxtID.Text = &quot;&quot; Then
861ecadb57SMathias Bauer            msgbox &quot;You did not specify a section or variable to embed.&quot;,256
871ecadb57SMathias Bauer        Else
881ecadb57SMathias Bauer            WriteConfig(&quot;LastEmbedAnchor&quot;,oTxtID.Text)
891ecadb57SMathias Bauer            If oOpVariable.State Then
901ecadb57SMathias Bauer                txtEmbed = oTxtFilePath.Text + &quot;#&quot; + oTxtID.Text
911ecadb57SMathias Bauer                InsertTag(&quot;EMBEDVAR&quot;,&quot;&lt;EMBEDVAR var=&quot;&quot;&quot; + txtEmbed + &quot;&quot;&quot;&gt;&quot;,&quot;hlp_aux_tag&quot;)
921ecadb57SMathias Bauer                SetCharStyle(&quot;Default&quot;)
931ecadb57SMathias Bauer                WriteConfig(&quot;LastEmbedType&quot;,&quot;Variable&quot;)
941ecadb57SMathias Bauer            Else
951ecadb57SMathias Bauer                txtEmbed = oTxtFilePath.Text + &quot;#&quot; + oTxtID.Text
961ecadb57SMathias Bauer                CR
971ecadb57SMathias Bauer                SetParaStyle(&quot;hlp_aux_embed&quot;)
981ecadb57SMathias Bauer                SetCharStyle(&quot;hlp_aux_tag&quot;)
991ecadb57SMathias Bauer                InsertTag(&quot;EMBED&quot;,&quot;&lt;EMBED href=&quot;&quot;&quot; + txtEmbed + &quot;&quot;&quot;&gt;&quot;,&quot;hlp_aux_tag&quot;)
1001ecadb57SMathias Bauer                CR
1011ecadb57SMathias Bauer                WriteConfig(&quot;LastEmbedType&quot;,&quot;Section&quot;)
1021ecadb57SMathias Bauer            End If
1031ecadb57SMathias Bauer        End If
1041ecadb57SMathias Bauer    End If
1051ecadb57SMathias Bauer    oDialog.dispose
1061ecadb57SMathias BauerEnd Sub
1071ecadb57SMathias Bauer
1081ecadb57SMathias Bauer&apos;=======================================================
1091ecadb57SMathias Bauer&apos; SetLabel
1101ecadb57SMathias Bauer&apos;-------------------------------------------------------
1111ecadb57SMathias Bauer&apos; Changes the text field label in the dialog
1121ecadb57SMathias Bauer&apos;=======================================================
1131ecadb57SMathias BauerSub SetLabel
1141ecadb57SMathias Bauer    olblID = oDialog.GetControl(&quot;lblID&quot;)
1151ecadb57SMathias Bauer    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
1161ecadb57SMathias Bauer    If oOpVariable.getState Then
1171ecadb57SMathias Bauer        olblID.setText(&quot;Variable ID&quot;)
1181ecadb57SMathias Bauer        oDialog.Title = &quot;Embed Variable&quot;
1191ecadb57SMathias Bauer    Else
1201ecadb57SMathias Bauer        olblID.setText(&quot;Section or Paragraph ID&quot;)
1211ecadb57SMathias Bauer        oDialog.Title = &quot;Embed Section&quot;
1221ecadb57SMathias Bauer    End If
1231ecadb57SMathias BauerEnd Sub
1241ecadb57SMathias Bauer
1251ecadb57SMathias BauerSub GetFile
1261ecadb57SMathias BauerDim ListAny(0) as Long
1271ecadb57SMathias Bauer    ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
1281ecadb57SMathias Bauer    oFileDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
1291ecadb57SMathias Bauer    oFileDialog.Initialize(ListAny())
1301ecadb57SMathias Bauer
1311ecadb57SMathias Bauer    DocRoot = ReadConfig(&quot;HelpPrefix&quot;)
1321ecadb57SMathias Bauer    sLastEmbedDir = ReadConfig(&quot;LastEmbedDir&quot;)
1331ecadb57SMathias Bauer    sLastEmbedFile = ReadConfig(&quot;LastEmbedFile&quot;)
1341ecadb57SMathias Bauer
1351ecadb57SMathias Bauer    If IsSubDir(sLastEmbedDir,DocRoot) Then
1361ecadb57SMathias Bauer        oFileDialog.setDisplayDirectory(sLastEmbedDir)
1371ecadb57SMathias Bauer        If sLastEmbedFile &lt;&gt; &quot;&quot; AND Dir(sLastEmbedDir+sLastEmbedFile) &gt; &quot;&quot; Then
1381ecadb57SMathias Bauer            oFileDialog.setDefaultName(sLastEmbedFile)
1391ecadb57SMathias Bauer        End If
1401ecadb57SMathias Bauer    Else
1411ecadb57SMathias Bauer        oFileDialog.setDisplayDirectory(DocRoot)
1421ecadb57SMathias Bauer    End If
1431ecadb57SMathias Bauer
1441ecadb57SMathias Bauer    oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types/&quot;)
1451ecadb57SMathias Bauer    oTypes() = oMasterKey.Types
1461ecadb57SMathias Bauer    oFileDialog.AppendFilter(&quot;Help&quot;, &quot;*.xhp&quot;)
1471ecadb57SMathias Bauer
1481ecadb57SMathias Bauer    oFileDialog.SetTitle(&quot;Embed From Help File&quot;)
1491ecadb57SMathias Bauer    iAccept = oFileDialog.Execute()
1501ecadb57SMathias Bauer    If iAccept = 1 Then
1511ecadb57SMathias Bauer        sPath = oFileDialog.Files(0)
1521ecadb57SMathias Bauer        sCurDir = oFileDialog.getDisplayDirectory +&quot;/&quot;
1531ecadb57SMathias Bauer        WriteConfig(&quot;LastEmbedDir&quot;,sCurDir)
1541ecadb57SMathias Bauer        LastFile = Right(sPath, Len(sPath) - Len(sCurDir))
1551ecadb57SMathias Bauer        WriteConfig(&quot;LastEmbedFile&quot;,LastFile)
1561ecadb57SMathias Bauer
1571ecadb57SMathias Bauer        oTxtPath = oDialog.GetControl(&quot;txtFilePath&quot;)
1581ecadb57SMathias Bauer        oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)
1591ecadb57SMathias Bauer        oTxtHidFName.Text = sPath
1601ecadb57SMathias Bauer
1611ecadb57SMathias Bauer        If IsSubDir(sCurDir,DocRoot) Then
1621ecadb57SMathias Bauer            oTxtPath.Text = GetRelPath(sPath, DocRoot)
1631ecadb57SMathias Bauer        Else
1641ecadb57SMathias Bauer            oTxtPath.Text = sPath
1651ecadb57SMathias Bauer            msgbox(&quot;File is outside of your Document Root&quot;,48,&quot;Warning&quot;)
1661ecadb57SMathias Bauer        End If
1671ecadb57SMathias Bauer
1681ecadb57SMathias Bauer        oButBrowseIDs = oDialog.GetControl(&quot;butBrowseIDs&quot;)
1691ecadb57SMathias Bauer        oButBrowseIDs.Enable = true
1701ecadb57SMathias Bauer    End If
1711ecadb57SMathias Bauer
1721ecadb57SMathias BauerEnd Sub
1731ecadb57SMathias Bauer
1741ecadb57SMathias BauerSub UpdateFileName
1751ecadb57SMathias Bauer    oTxtPath = oDialog.GetControl(&quot;txtFilePath&quot;)
1761ecadb57SMathias Bauer    ShortFName = oTxtPath.Text
1771ecadb57SMathias Bauer
1781ecadb57SMathias Bauer    If ShortFName &gt; &quot;&quot; Then
1791ecadb57SMathias Bauer
1801ecadb57SMathias Bauer        oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)
1811ecadb57SMathias Bauer        FName = oTxtHidFName.Text
1821ecadb57SMathias Bauer
1831ecadb57SMathias Bauer        If Right(FName, Len(ShortFName)) &lt;&gt; ShortFName Then
1841ecadb57SMathias Bauer        &apos;  oTxtHidFName.Text = MakeAbsPath(ShortFName)
1851ecadb57SMathias Bauer            oTxtHidFName.Text = ShortFName
1861ecadb57SMathias Bauer        End If
1871ecadb57SMathias Bauer
1881ecadb57SMathias Bauer        oButBrowseIDs = oDialog.GetControl(&quot;butBrowseIDs&quot;)
1891ecadb57SMathias Bauer        If not(FileExists(oTxtHidFName.Text)) Then
1901ecadb57SMathias Bauer            msgbox oTxtHidFName.Text+&quot; cannot be found.&quot;,48,&quot;D&apos;oh!&quot;
1911ecadb57SMathias Bauer            oButBrowseIDs.Enable = false
1921ecadb57SMathias Bauer        Else
1931ecadb57SMathias Bauer            oButBrowseIDs.Enable = true
1941ecadb57SMathias Bauer        End If
1951ecadb57SMathias Bauer    End If
1961ecadb57SMathias BauerEnd Sub
1971ecadb57SMathias Bauer
1981ecadb57SMathias BauerSub BrowseEmbed
1991ecadb57SMathias Bauer    BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
2001ecadb57SMathias Bauer    oBrowseDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlg_BrowseEmbed&quot;)
2011ecadb57SMathias Bauer    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
2021ecadb57SMathias Bauer    oTxtPath = oDialog.GetControl(&quot;txtFilePath&quot;)
2031ecadb57SMathias Bauer    oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)
2041ecadb57SMathias Bauer    filename = oTxtHidFName.Text
2051ecadb57SMathias Bauer
2061ecadb57SMathias Bauer    ReDim arParas(0)
2071ecadb57SMathias Bauer    ReDim arVars(0)
2081ecadb57SMathias Bauer    ReDim arSecs(0)
2091ecadb57SMathias Bauer
2101ecadb57SMathias Bauer&apos;  msgbox(filename)
2111ecadb57SMathias Bauer
2121ecadb57SMathias Bauer    iNumber = Freefile
2131ecadb57SMathias Bauer    If FileExists(filename) Then
2141ecadb57SMathias Bauer        Dim arLines(0) As String
2151ecadb57SMathias Bauer        Open filename For Input As iNumber
2161ecadb57SMathias Bauer        Do While (not eof(iNumber))
2171ecadb57SMathias Bauer            Line Input #iNumber, sLine
2181ecadb57SMathias Bauer            sDim = ubound(arLines())+1
2191ecadb57SMathias Bauer            ReDim Preserve arLines(sDim)
2201ecadb57SMathias Bauer            arLines(sDim) = sLine
2211ecadb57SMathias Bauer        Loop
2221ecadb57SMathias Bauer        Close #iNumber
2231ecadb57SMathias Bauer        sContent = join(arLines(),&quot; &quot;)
2241ecadb57SMathias Bauer
2251ecadb57SMathias Bauer        arTmp() = split(sContent,&quot;&lt;paragraph&quot;)
2261ecadb57SMathias Bauer        For n=1 to ubound(arTmp())
2271ecadb57SMathias Bauer            If arTmp(n) &lt;&gt; &quot;&quot; Then
2281ecadb57SMathias Bauer                arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;id=&quot;)-3)
2291ecadb57SMathias Bauer                sId = Left(arTmp(n),Instr(arTmp(n),&quot;&quot;&quot;&quot;)-1)
2301ecadb57SMathias Bauer                arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;&gt;&quot;))
2311ecadb57SMathias Bauer                arTmp(n) = Left(arTmp(n),Instr(arTmp(n),&quot;&lt;/paragraph&gt;&quot;)-1)
2321ecadb57SMathias Bauer                If Len(arTmp(n) &gt; 100) Then
2331ecadb57SMathias Bauer                    arTmp(n) = Left(arTmp(n),100)+&quot;...&quot;
2341ecadb57SMathias Bauer                End If
2351ecadb57SMathias Bauer                sDim = ubound(arParas())
2361ecadb57SMathias Bauer                arParas(sDim) = sId+&quot;: &quot;+arTmp(n)
2371ecadb57SMathias Bauer                sDim = ubound(arParas())+1
2381ecadb57SMathias Bauer                ReDim Preserve arParas(sDim)
2391ecadb57SMathias Bauer            End If
2401ecadb57SMathias Bauer        Next n
2411ecadb57SMathias Bauer
2421ecadb57SMathias Bauer        arTmp() = split(sContent,&quot;&lt;section&quot;)
2431ecadb57SMathias Bauer        For n=1 to ubound(arTmp())
2441ecadb57SMathias Bauer            If arTmp(n) &lt;&gt; &quot;&quot; Then
2451ecadb57SMathias Bauer                arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;id=&quot;)-3)
2461ecadb57SMathias Bauer                sId = Left(arTmp(n),Instr(arTmp(n),&quot;&quot;&quot;&quot;)-1)
2471ecadb57SMathias Bauer                arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;&gt;&quot;))
2481ecadb57SMathias Bauer                If Instr(arTmp(n),&quot;&lt;/section&gt;&quot;)&gt;0 Then
2491ecadb57SMathias Bauer                    arTmp(n) = Left(arTmp(n),Instr(arTmp(n),&quot;&lt;/section&gt;&quot;)-1)
2501ecadb57SMathias Bauer                End If
2511ecadb57SMathias Bauer                If Len(arTmp(n) &gt; 100) Then
2521ecadb57SMathias Bauer                    arTmp(n) = Left(arTmp(n),100)+&quot;...&quot;
2531ecadb57SMathias Bauer                End If
2541ecadb57SMathias Bauer                sDim = ubound(arSecs())
2551ecadb57SMathias Bauer                arSecs(sDim) = sId+&quot;: &quot;+arTmp(n)
2561ecadb57SMathias Bauer                sDim = ubound(arSecs())+1
2571ecadb57SMathias Bauer                ReDim Preserve arSecs(sDim)
2581ecadb57SMathias Bauer            End If
2591ecadb57SMathias Bauer        Next n
2601ecadb57SMathias Bauer
2611ecadb57SMathias Bauer        arTmp() = split(sContent,&quot;&lt;variable&quot;)
2621ecadb57SMathias Bauer        For n=1 to ubound(arTmp())
2631ecadb57SMathias Bauer            If arTmp(n) &lt;&gt; &quot;&quot; Then
2641ecadb57SMathias Bauer                arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;id=&quot;)-3)
2651ecadb57SMathias Bauer                sId = Left(arTmp(n),Instr(arTmp(n),&quot;&quot;&quot;&quot;)-1)
2661ecadb57SMathias Bauer                arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;&gt;&quot;))
2671ecadb57SMathias Bauer                arTmp(n) = Left(arTmp(n),Instr(arTmp(n),&quot;&lt;/variable&gt;&quot;)-1)
2681ecadb57SMathias Bauer                If Len(arTmp(n) &gt; 100) Then
2691ecadb57SMathias Bauer                    arTmp(n) = Left(arTmp(n),100)+&quot;...&quot;
2701ecadb57SMathias Bauer                End If
2711ecadb57SMathias Bauer                sDim = ubound(arVars())
2721ecadb57SMathias Bauer                arVars(sDim) = sId+&quot;: &quot;+arTmp(n)
2731ecadb57SMathias Bauer                sDim = ubound(arVars())+1
2741ecadb57SMathias Bauer                ReDim Preserve arVars(sDim)
2751ecadb57SMathias Bauer            End If
2761ecadb57SMathias Bauer        Next n
2771ecadb57SMathias Bauer
2781ecadb57SMathias Bauer        ShowSecs
2791ecadb57SMathias Bauer
2801ecadb57SMathias Bauer        If oBrowseDialog.Execute() = 1 Then
2811ecadb57SMathias Bauer            olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
2821ecadb57SMathias Bauer            sSelected = olbElements.SelectedItem
2831ecadb57SMathias Bauer            sSelected = Left(sSelected,Instr(sSelected,&quot;:&quot;)-1)
2841ecadb57SMathias Bauer            oTxtID = oDialog.GetControl(&quot;txtID&quot;)
2851ecadb57SMathias Bauer            oTxtID.Text = sSelected
2861ecadb57SMathias Bauer        End If
2871ecadb57SMathias Bauer    Else
2881ecadb57SMathias Bauer        msgbox &quot;Cannot open &quot;+filename,48,&quot;Error&quot;
2891ecadb57SMathias Bauer    End If
2901ecadb57SMathias BauerEnd Sub
2911ecadb57SMathias Bauer
2921ecadb57SMathias BauerSub UpdateLIst
2931ecadb57SMathias Bauer    oOpSections = oBrowseDialog.GetControl(&quot;opSections&quot;)
2941ecadb57SMathias Bauer    oOpVariables = oBrowseDialog.GetControl(&quot;opVariables&quot;)
2951ecadb57SMathias Bauer    oOpParas = oBrowseDialog.GetControl(&quot;opParas&quot;)
2961ecadb57SMathias Bauer    If oOpSections.getState Then
2971ecadb57SMathias Bauer        ShowSecs
2981ecadb57SMathias Bauer    ElseIf oOpVariables.getState Then
2991ecadb57SMathias Bauer        ShowVars
3001ecadb57SMathias Bauer    ElseIf oOpParas.getState Then
3011ecadb57SMathias Bauer        ShowParas
3021ecadb57SMathias Bauer    End If
3031ecadb57SMathias BauerEnd Sub
3041ecadb57SMathias Bauer
3051ecadb57SMathias BauerSub ShowSecs
3061ecadb57SMathias Bauer    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
3071ecadb57SMathias Bauer    olbElements.RemoveItems(0,olbElements.ItemCount)
3081ecadb57SMathias Bauer    olbElements.AddItems(arSecs(),ubound(arSecs()))
3091ecadb57SMathias Bauer    oOpSection = oDialog.GetControl(&quot;opSection&quot;)
3101ecadb57SMathias Bauer    oOpSection.setState(TRUE)
3111ecadb57SMathias Bauer    SetLabel
3121ecadb57SMathias BauerEnd Sub
3131ecadb57SMathias Bauer
3141ecadb57SMathias BauerSub ShowVars
3151ecadb57SMathias Bauer    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
3161ecadb57SMathias Bauer    olbElements.RemoveItems(0,olbElements.ItemCount)
3171ecadb57SMathias Bauer    olbElements.AddItems(arVars(),ubound(arVars()))
3181ecadb57SMathias Bauer    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
3191ecadb57SMathias Bauer    oOpVariable.setState(TRUE)
3201ecadb57SMathias Bauer    SetLabel
3211ecadb57SMathias BauerEnd Sub
3221ecadb57SMathias Bauer
3231ecadb57SMathias BauerSub ShowParas
3241ecadb57SMathias Bauer    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
3251ecadb57SMathias Bauer    olbElements.RemoveItems(0,olbElements.ItemCount)
3261ecadb57SMathias Bauer    olbElements.AddItems(arParas(),ubound(arParas()))
3271ecadb57SMathias Bauer    oOpVariable = oDialog.GetControl(&quot;opSection&quot;)
3281ecadb57SMathias Bauer    oOpVariable.setState(TRUE)
3291ecadb57SMathias Bauer    SetLabel
3301ecadb57SMathias BauerEnd Sub
3311ecadb57SMathias Bauer
3321ecadb57SMathias BauerSub CheckButton
3331ecadb57SMathias Bauer    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
3341ecadb57SMathias Bauer    obutSelect = oBrowseDialog.GetControl(&quot;butSelect&quot;)
3351ecadb57SMathias Bauer    sSelected = olbElements.SelectedItem
3361ecadb57SMathias Bauer    If sSelected = &quot;&quot; Then
3371ecadb57SMathias Bauer        oButSelect.enable = false
3381ecadb57SMathias Bauer    Else
3391ecadb57SMathias Bauer        oButSelect.enable = true
3401ecadb57SMathias Bauer    End If
3411ecadb57SMathias BauerEnd Sub
3421ecadb57SMathias Bauer
3431ecadb57SMathias Bauer
3441ecadb57SMathias BauerFunction IsSubDir(D as String, R as String)
3451ecadb57SMathias Bauer     IsSubDir = (Left(D,Len(R)) = R)
3461ecadb57SMathias BauerEnd Function
3471ecadb57SMathias Bauer</script:module>
348