home *** CD-ROM | disk | FTP | other *** search
/ com!online 2001 December / COMCD1201.iso / openoffice / f_0177 / GetTexts.xba < prev    next >
Encoding:
Extensible Markup Language  |  2001-04-25  |  19.6 KB  |  613 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="GetTexts" script:language="StarBasic">Option Explicit
  4. ' Option f├╝r doppelte Strings
  5. ' Alternativtexte, Namen usw f├╝r HTML-Seiten--> ist Anbindung an StarOfficeAPI geplant?
  6. ' Verlustanzeige "Wo ist Peggy?"
  7. ' ├£berschriften f├╝r Textfelder
  8. ' GetTextFrames mit Peter absprechen
  9. ' Ole - Objekte auch mit einbeziehen?
  10. ' Redimensionierung des LogArrays, wenn Implementierung so weit ist
  11. ' Namen von Notizenseiten mit Peter durchsprechen
  12.  
  13. ' Macro-Description:
  14. ' This Macro extracts the Strings out of the currently activated document und inserts them into a logdocument
  15. ' The aim of the macro is to provide the programmer an insight into the StarOffice API
  16. ' It focusses on how document-Objects are accessed.
  17. ' Therefor not only texts of the document-body are retrieved but also Texts of general
  18. ' document Objects like, Annotations, charts and general Document Information
  19.  
  20. Public oLogDocument, oLogText, oLogCursor, oLogHeaderStyle, oLogBodyTextStyle as Object
  21. Public oDocument as Object
  22. Public LogArray(1000) as String
  23. Public LogIndex as Integer
  24. Public oLocHeaderStyle as Object
  25.  
  26. Sub Main
  27. Dim sDocType as String
  28. Dim oHyperCursor as Object
  29. Dim oCharStyles as Object
  30.  
  31.         BasicLibraries.LoadLibrary("Tools")
  32.  
  33.     On Local Error GoTo NODOCUMENT
  34.     oDocument = StarDesktop.ActiveFrame.Controller.Model
  35.     sDocType = GetDocumentType(oDocument)
  36.     NODOCUMENT:
  37.     If Err <> 0 Then
  38.         Msgbox("This Macro extracts all Data of the displayed Writer-, Calc or Draw-Documents." & chr(13) &_
  39.                "To start this macro you have to activate a Document first!" , 16, "StarOffice 5.2")
  40.         Exit Sub
  41.     End If
  42.     On Local Error Goto 0
  43.  
  44.     ' Open a new document where all the texts are inserted
  45.     oLogDocument = StarDesktop.LoadComponentFromURL( "staroffice:factory/swriter","_blank",0,NoArgs())
  46.     oLogText = oLogDocument.Text
  47.  
  48.     ' create and define the character styles of the Log-document
  49.     oCharStyles = oLogDocument.StyleFamilies.GetByName("CharacterStyles")
  50.     oLogHeaderStyle = oLogDocument.createInstance("com.sun.star.style.CharacterStyle")
  51.     oLogHeaderStyle.charWeight = com.sun.star.awt.FontWeight.BOLD
  52.     oLogBodyTextStyle = oLogDocument.createInstance("com.sun.star.style.CharacterStyle")
  53.     oCharStyles.InsertbyName("LogHeading", oLogHeaderStyle)
  54.     oCharStyles.InsertbyName("LogBodyText", oLogBodyTextStyle)
  55.  
  56.     ' Insert the title of the activated document as a hyperlink
  57.     oHyperCursor = oLogText.createTextCursor()
  58.     oHyperCursor.charWeight = com.sun.star.awt.FontWeight.BOLD
  59.     oHyperCursor.gotoStart(False)
  60.     oHyperCursor.HyperLinkURL = oDocument.URL
  61.     oHyperCursor.HyperLinkTarget = oDocument.URL
  62.     If oDocument.DocumentInfo.Title <> "" Then
  63.         oHyperCursor.HyperlinkName = oDocument.DocumentInfo.Title
  64.     End If
  65.     oLogText.insertString(oHyperCursor, oDocument.DocumentInfo.Title, False)
  66.     oLogText.insertControlCharacter(oHyperCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
  67.  
  68.     oLogCursor = oLogText.createTextCursor()
  69.     oLogCursor.GotoEnd(False)
  70.     ' "Switch off" the Hyperlink - Properties
  71.     oLogCursor.SetPropertyToDefault("HyperLinkURL")
  72.     oLogCursor.SetPropertyToDefault("HyperLinkTarget")
  73.     oLogCursor.SetPropertyToDefault("HyperLinkName")
  74.     LogIndex = 0
  75.  
  76.     ' Get the Properties of the document Info
  77.     GetDocumentInfo()
  78.  
  79.     Select Case sDocType
  80.         Case "sWriter"
  81.             GetWriterStrings()
  82.         Case "sCalc"
  83.             GetCalcStrings()
  84.         Case "sDraw"
  85.             GetDrawStrings()
  86.         Case Else
  87.             Msgbox("This Macro only works with Writer-, Calc or Draw/Impress-Documents!", 16, "StarOffice 5.2")
  88.     End Select
  89.  
  90. End Sub
  91.  
  92.  
  93. ' ***********************************************Calc-Documents**************************************************
  94.  
  95. Sub GetCalcStrings()
  96. Dim i, n as integer
  97. Dim oSheet as Object
  98. Dim SheetName as String
  99. Dim oSheets as Object
  100.     ' Create a sequence of all sheets within the document
  101.     oSheets = oDocument.Sheets
  102.  
  103.     For i = 0 to osheets.Count - 1
  104.         oSheet = osheets.GetbyIndex(i)
  105.         SheetName = oSheet.Name
  106.         MakeLogHeadLine("Sheet No " & i & "(" & SheetName & ")" )
  107.  
  108.         ' Check the "body" of the sheet
  109.         GetCellTexts(oSheet)
  110.  
  111.         If oSheet.IsScenario then
  112.             MakeLogHeadLine("Scenario-Comments of " & SheetName & "'")
  113.             WriteStringtoLogFile(osheet.ScenarioComment)
  114.         End if
  115.  
  116.         GetAnnotations(oSheet, "Annotations of '" & SheetName & "'")
  117.  
  118.         GetChartStrings(oSheet, "Charts of '" & SheetName & "'")
  119.  
  120.         GetControlStrings(oSheet.DrawPage, "Controls of '" & SheetName & "'")
  121.     Next
  122.  
  123.     ' Pictures
  124.     GetCalcGraphicNames()
  125.  
  126.     GetNamedRanges()
  127. End Sub
  128.  
  129.  
  130. Sub GetCellTexts(oSheet as Object)
  131. Dim BigRange, BigEnum, oCell as Object
  132.     BigRange = oDocument.CreateInstance("com.sun.star.sheet.SheetCellRanges")
  133.     BigRange.InsertbyName("",oSheet)
  134.     BigEnum = BigRange.GetCells.CreateEnumeration
  135.     While BigEnum.hasmoreElements
  136.         oCell = BigEnum.NextElement
  137.         If (oCell.Type = com.sun.star.util.NumberFormat.TEXT) AND (oCell.String <> "") then
  138.             WriteStringtoLogFile(oCell.String)
  139.         End If
  140.     Wend
  141. End Sub
  142.  
  143.  
  144. Sub GetAnnotations(oSheet as Object, HeaderLine as String)
  145. Dim oNotes as Object
  146. Dim n as Integer
  147.     oNotes = oSheet.getAnnotations
  148.     If oNotes.hasElements() then
  149.         MakeLogHeadLine(HeaderLine)
  150.         For n = 0 to oNotes.Count-1
  151.             WriteStringtoLogFile(oNotes.GetbyIndex(n).String)
  152.         Next
  153.     End if
  154. End Sub
  155.  
  156.  
  157. Sub GetNamedRanges()
  158. Dim i as integer
  159.     MakeLogHeadLine("Named Ranges")
  160.     For i = 0 To oDocument.NamedRanges.Count - 1
  161.         WriteStringtoLogFile(oDocument.NamedRanges.GetbyIndex(i).Name)
  162.     Next
  163. End Sub
  164.  
  165.  
  166. Sub GetCalcGraphicNames()
  167. Dim n,m as integer
  168.     MakeLogHeadLine("Pictures")
  169.     For n = 0 To oDocument.Drawpages.count-1
  170.         For m = 0 To oDocument.Drawpages.GetbyIndex(n).Count - 1
  171.             WriteStringtoLogFile(oDocument.DrawPages.GetbyIndex(n).GetbyIndex(m).Text.String)
  172.         Next m
  173.     Next n
  174. End Sub
  175.  
  176.  
  177. ' ***********************************************Writer-Documents**************************************************
  178.  
  179. Sub GetParagraphTexts(oParaObject as Object, HeadLine as String)
  180. Dim ParaEnum as Object
  181. Dim oPara as Object
  182. Dim oTextPortEnum as Object
  183. Dim oTextPortion as Object
  184. Dim i as integer
  185. Dim oCellNames()
  186. Dim oCell as Object
  187.  
  188.     MakeLogHeadLine(HeadLine)
  189.     ParaEnum = oParaObject.Text.CreateEnumeration
  190.  
  191.     While ParaEnum.HasMoreElements
  192.         oPara = ParaEnum.NextElement
  193.  
  194.         ' Note: The Enumeration ParaEnum lists all tables and Paragraphs.
  195.         ' Therefor we have to find out what kind of object "oPara" actually is
  196.         If oPara.supportsService("com.sun.star.text.Paragraph") Then
  197.             ' "oPara" is a Paragraph
  198.             oTextPortEnum = oPara.createEnumeration
  199.             While oTextPortEnum.hasmoreElements
  200.                 oTextPortion = oTextPortEnum.nextElement()
  201.                 WriteStringToLogFile(oTextPortion.String)
  202.             Wend
  203.         Else
  204.             ' "oPara" is a table
  205.             oCellNames = oPara.CellNames
  206.             For i = 0 To Ubound(oCellNames())
  207.                 If oCellNames(i) <> "" Then
  208.                     oCell = oPara.getCellByName(oCellNames(i))
  209.                     WriteStringToLogFile(oCell.String)
  210.                 End If
  211.             Next
  212.         End If
  213.     Wend
  214. End Sub
  215.  
  216.  
  217.  
  218. Sub GetChartStrings(oSheet as Object, HeaderLine as String)
  219. Dim i as Integer
  220. Dim aChartObject as Object
  221. Dim aChartDiagram as Object
  222.  
  223.     MakeLogHeadLine(HeaderLine)
  224.  
  225.     For i = 0 to oSheet.Charts.Count-1
  226.         aChartObject = oSheet.Charts.GetByIndex(i).EmbeddedObject
  227.         If aChartObject.HasSubTitle then
  228.             WriteStringToLogFile(aChartObject.SubTitle.String)
  229.         End If
  230.  
  231.         If aChartObject.HasMainTitle then
  232.             WriteStringToLogFile(aChartObject.Title.String)
  233.         End If
  234.  
  235.         aChartDiagram = aChartObject.Diagram
  236.  
  237.         If aChartDiagram.hasXAxisTitle Then
  238.             WriteStringToLogFile(aChartDiagram.XAxisTitle)
  239.         End If
  240.  
  241.         If aChartDiagram.hasYAxisTitle Then
  242.             WriteStringToLogFile(aChartDiagram.YAxisTitle)
  243.         End If
  244.  
  245.         If aChartDiagram.hasZAxisTitle Then
  246.             WriteStringToLogFile(aChartDiagram.ZAxisTitle)
  247.         End If
  248.     Next i
  249. End Sub
  250.  
  251.  
  252.  
  253. Sub GetFrameTexts()
  254. Dim i as integer
  255. Dim oTextFrame as object
  256. Dim oFrameEnum as Object
  257. Dim oFramePort as Object
  258. Dim oFrameTextEnum as Object
  259. Dim oFrameTextPort as Object
  260.  
  261.     MakeLogHeadLine("Text Frames")
  262.     For i = 0 to oDocument.TextFrames.Count-1
  263.         oTextFrame = oDocument.TextFrames.GetbyIndex(i)
  264.         WriteStringToLogFile(oTextFrame.Name)
  265.  
  266.         ' Is the frame bound to the Page
  267.         If oTextFrame.AnchorType  = com.sun.star.text.TextContentAnchorType.AT_PAGE  Then
  268.             GetParagraphTexts(oTextFrame, "Textframe Content")
  269.         End If
  270.  
  271.         oFrameEnum = oTextFrame.CreateEnumeration
  272.         While oFrameEnum.HasMoreElements
  273.             oFramePort = oFrameEnum.NextElement
  274.             If oFramePort.supportsService("com.sun.star.text.Paragraph") then
  275.                 oFrameTextEnum = oFramePort.createEnumeration
  276.                 While oFrameTextEnum.HasMoreElements
  277.                     oFrameTextPort = oFrameTextEnum.NextElement
  278.                     If oFrameTextPort.SupportsService("com.sun.star.text.TextFrame") Then
  279.                         WriteStringtoLogFile(oFrameTextPort.String)
  280.                     End If
  281.                 Wend
  282.             Else
  283.                 WriteStringtoLogFile(oFramePort.Name)
  284.             End if
  285.         Wend
  286.     Next
  287. End Sub
  288.  
  289.  
  290. Sub GetTextFieldStrings()
  291. Dim aTextField as Object
  292. Dim i as integer
  293. Dim CurElement as Object
  294.     MakeLogHeadLine("TextFields")
  295.     aTextfield = oDocument.getTextfields.CreateEnumeration
  296.     While aTextField.hasmoreElements
  297.         CurElement = aTextField.NextElement
  298.         If CurElement.PropertySetInfo.hasPropertybyName("Content") Then
  299.             WriteStringtoLogFile(CurElement.Content)
  300.         ElseIf CurElement.PropertySetInfo.hasPropertybyName("PlaceHolder") Then
  301.             WriteStringtoLogFile(CurElement.PlaceHolder)
  302.             WriteStringtoLogFile(CurElement.Hint)
  303.         ElseIf Curelement.TextFieldMaster.PropertySetInfo.HasPropertybyName("Content") then
  304.             WriteStringtoLogFile(CurElement.TextFieldMaster.Content)
  305.         End If
  306.     Wend
  307. End Sub
  308.  
  309.  
  310.  
  311. Sub GetLinkedFileNames()
  312. Dim oDocSections as Object
  313. Dim LinkedFileName as String
  314. Dim i as Integer
  315.     If Right(oDocument.URL,3) = "sgl" Then
  316.         MakeLogHeadLine("Sub Documents")
  317.         oDocSections = oDocument.TextSections
  318.         For i = 0 to oDocSections.Count - 1
  319.             LinkedFileName = oDocSections.GetbyIndex(i).FileLink.FileURL
  320.             If LinkedFileName <> "" Then
  321.                 WriteStringToLogFile(LinkedFileName)
  322.             End If
  323.         Next i
  324.     End If
  325. End Sub
  326.  
  327.  
  328. Sub GetSectionNames()
  329. Dim i as integer
  330. Dim oDocSections as Object
  331.     MakeLogHeadLine("Sections")
  332.     oDocSections = oDocument.TextSections
  333.     For i = 0 to oDocSections.Count-1
  334.         WriteStringtoLogFile(oDocSections.GetbyIndex(i).Name)
  335.     Next
  336. End Sub
  337.  
  338.  
  339. Sub GetWriterStrings()
  340.     GetParagraphTexts(oDocument, "Document Body")
  341.     GetGraphicNames()
  342.     GetStyles()
  343.     GetControlStrings(oDocument.DrawPage, "Controls")
  344.     GetTextFieldStrings()
  345.     GetSectionNames()
  346.     GetFrameTexts()
  347.     GetHyperLinks
  348.     GetLinkedFileNames()
  349. End Sub
  350.  
  351.  
  352. ' ***********************************************Draw-Documents**************************************************
  353.  
  354. Sub GetDrawPageTitles(LocObject as Object)
  355. Dim n as integer
  356. Dim oPage as Object
  357.  
  358.     For n = 0 to LocObject.Count - 1
  359.         oPage = LocObject.GetbyIndex(n)
  360.         WriteStringtoLogFile(oPage.Name)
  361.         ' Is the Page a DrawPage and not a MasterPage?
  362.         If oPage.supportsService("com.sun.star.drawing.DrawPage")then
  363.             ' Get the Name of the NotesPage (only relevant for Impress-Documents)
  364.             If oDocument.supportsService("com.sun.star.presentation.PresentationDocument") then
  365.                 WriteStringtoLogFile(oPage.NotesPage.Name)
  366.             End If
  367.         End If
  368.     Next
  369. End Sub
  370.  
  371.  
  372. Sub GetPageStrings(oPages as Object)
  373. Dim m, n, s as Integer
  374. Dim oPage, oPageElement, oShape as Object
  375.     For n = 0 to oPages.Count-1
  376.         oPage = oPages.GetbyIndex(n)
  377.         If oPage.HasElements then
  378.             For m = 0 to oPage.Count-1
  379.                 oPageElement = oPage.GetByIndex(m)
  380.                 If HasUnoInterfaces(oPageElement,"com.sun.star.container.XIndexAccess") Then
  381.                     ' The Object "oPageElement" a group of Shapes, that can be accessed by their index
  382.                     For s = 0 To oPageElement.Count - 1
  383.                         WriteStringToLogFile(oPageElement.GetByIndex(s).String)
  384.                     Next s
  385.                 Else
  386.                     WriteStringtoLogFile(oPageElement.String)
  387.                 End If
  388.             Next
  389.         End If
  390.     Next
  391. End Sub
  392.  
  393.  
  394. Sub GetDrawStrings()
  395. Dim oDPages, oMPages as Object
  396.  
  397.     oDPages = oDocument.DrawPages
  398.     oMPages = oDocument.Masterpages
  399.  
  400.     MakeLogHeadLine("Titles")
  401.     GetDrawPageTitles(oDPages)
  402.     GetDrawPageTitles(oMPages)
  403.  
  404.     MakeLogHeadLine("Document Body")
  405.     GetPageStrings(oDPages)
  406.     GetPageStrings(oMPages)
  407. End Sub
  408.  
  409.  
  410. ' ***********************************************Misc**************************************************
  411.  
  412. Sub GetDocumentInfo()
  413. Dim oDocuInfo as Object
  414.     MakeLogHeadLine("Document Info")
  415.     oDocuInfo = oDocument.DocumentInfo
  416.     WriteStringToLogFile(oDocuInfo.Title)
  417.     WriteStringToLogFile(oDocuInfo.Description)
  418.     WriteStringToLogFile(oDocuInfo.Theme)
  419.     WriteStringToLogFile(oDocuInfo.Author)
  420.     WriteStringToLogFile(oDocuInfo.ReplyTo)
  421.     WriteStringToLogFile(oDocuInfo.Recipient)
  422.     WriteStringToLogFile(oDocuInfo.References)
  423.     WriteStringToLogFile(oDocuInfo.Keywords)
  424. End Sub
  425.  
  426.  
  427. Sub GetHyperlinks()
  428. Dim i as integer
  429. Dim oCrsr as Object
  430. Dim oAllHyperLinks as Object
  431. Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
  432. Dim oSearchDesc as Object
  433.  
  434.     MakeLogHeadLine("HyperLinks")
  435.     ' create a Search-Descriptor
  436.     oSearchDesc = oDocument.CreateSearchDescriptor
  437.     oSearchDesc.Valuesearch = False
  438.  
  439.     ' define the Search-attributes
  440.     srchattributes(0).Name = "HyperLinkURL"
  441.     srchattributes(0).Value = ""
  442.     oSearchDesc.SetSearchAttributes(SrchAttributes())
  443.  
  444.     oAllHyperLinks = oDocument.findAll(oSearchDesc())
  445.  
  446.     For i = 0 to oAllHyperLinks.Count - 1
  447.         oFound = oAllHyperLinks(i)
  448.         oCrsr = oFound.Text.createTextCursorByRange(oFound)
  449.         WriteStringToLogFile(oCrs.HyperLinkURL)       'Url
  450.         WriteStringToLogFile(oCrs.HyperLinkTarget)    'Name
  451.         WriteStringToLogFile(oCrs.HyperLinkName)    'Frame
  452.     Next i
  453. End Sub
  454.  
  455.  
  456. Sub GetGraphicNames()
  457. Dim i as integer
  458. Dim oDocGraphics as Object
  459.     MakeLogHeadLine("Pictures")
  460.     oDocGraphics = oDocument.GraphicObjects
  461.     For i = 0 to oDocGraphics.count - 1
  462.         WriteStringtoLogFile(oDocGraphics.GetbyIndex(i).Name)
  463.     Next
  464. End Sub
  465.  
  466.  
  467. Sub GetStyles()
  468. Dim m,n as integer
  469.     MakeLogHeadLine("Userdefined Templates")
  470.  
  471.     ' Check all StyleFamilies(i.e. PageStyles, ParagraphStyles, CharacterStyles, cellStyles)
  472.     For n = 0 to oDocument.StyleFamilies.Count - 1
  473.         For m = 0 to oDocument.StyleFamilies.getbyIndex(n).Count-1
  474.             If oDocument.StyleFamilies.GetbyIndex(n).getbyIndex(m).IsUserDefined then
  475.                 WriteStringtoLogFile(oDocument.StyleFamilies.GetbyIndex(n).getbyIndex(m).Name)
  476.             End If
  477.         Next
  478.     Next
  479. End Sub
  480.  
  481.  
  482. Sub GetControlStrings(oDPage as Object, HeaderLine as String)
  483. Dim aForm as Object
  484. Dim m,n as integer
  485.     MakeLogHeadLine(HeaderLine)
  486.     'SearchFor all possible Controls
  487.     For n = 0 to oDPage.Forms.Count - 1
  488.         aForm = oDPage.Forms(n)
  489.         For m = 0 to aForm.Count-1
  490.             GetControlContent(aForm.GetbyIndex(m))
  491.         Next
  492.     Next
  493. End Sub
  494.  
  495.  
  496. Sub GetControlContent(LocControl as Object)
  497. Dim i as integer
  498.  
  499.     If LocControl.PropertySetInfo.HasPropertybyName("Label") then
  500.         WriteStringtoLogFile(LocControl.Label)
  501.  
  502.     ElseIf LocControl.SupportsService("com.sun.star.form.component.ListBox") then
  503.         For i = 0 to Ubound(LocControl.StringItemList())
  504.             WriteStringtoLogFile(LocControl.StringItemList(i))
  505.         Next
  506.     End If
  507.     If LocControl.PropertySetInfo.HasPropertybyName("HelpText") then
  508.         WriteStringtoLogFile(LocControl.Helptext)
  509.     End If
  510. End Sub
  511.  
  512. ' ***********************************************LogDocument**************************************************
  513.  
  514. Sub WriteStringtoLogFile( sString as String)
  515.  
  516.     ' Schreibt den String in ein Array
  517.     If (Not FieldInArray(LogArray(),LogIndex,sString))AND (NOT ISNULL(sString)) Then
  518.         LogArray(LogIndex) = sString
  519.         LogIndex = LogIndex + 1
  520.         oLogText.insertString(oLogCursor,sString,False)
  521.            oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
  522.     End If
  523. End Sub
  524.  
  525.  
  526. Sub MakeLogHeadLine(HeadText as String)
  527.     oLogCursor.CharStyle = "LogHeading"
  528.     oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
  529.     oLogText.insertString(oLogCursor,HeadText,False)
  530.     oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
  531.     oLogCursor.CharStyle = "LogBodyText"
  532. End Sub
  533.  
  534.  
  535.  
  536. 'Sub GetHTMLStrings(SearchString as String)
  537. 'Dim i,AsciiCount as integer
  538. 'Dim AsciiLocChar as string
  539. 'Dim TTString,AddString as String
  540. 'Dim oTextCursor as object
  541. 'Dim LeaveLoop as Boolean
  542.  
  543. '    oSearchDesc = oDocument.createSearchDescriptor()
  544. '    oSearchDesc.SearchRegularExpression = True
  545. '    oSearchDesc.Searchstring = SearchString & """" & "*" & """"
  546. '    oFoundall = oDocument.FindAll(oSearchDesc)
  547.  
  548. '    For i = 0 to oFoundAll.Count-1
  549. '        oFound = oFoundall(i)
  550. '        oTextCursor = oDocument.text.CreateTextCursorbyRange(oFound)
  551. '        oTextCursor.GotoNextWord(false)
  552. '        oTextCursor.GotoStartofWord(True)
  553. '        oTextCursor.GoRight(1,True)
  554. '        TTString = oTextCursor.String
  555. '        If    Left(TTString,1) = """" Then
  556. '            LeaveLoop = False
  557. '            oTextCursor.GoRight(1,True)
  558. '            Do
  559. '                oTextCursor.GoRight(1,True)
  560. '                TTString = TTString + Right(oTextCursor.String,1)
  561. '                If Right(oTextCursor.String,1) = """" Then
  562. '                    TTString = ReplaceString(TTString,"","""")
  563. '                    LeaveLoop = True
  564. '                End If
  565. '            Loop Until LeaveLoop = True
  566. '
  567. '        End If
  568. '
  569. '        If TTString <> "" then
  570. '            TTString = ReplaceHTMLChars(TTString)
  571. '            WriteStringtoLogFile(TTString)
  572. '        End if
  573. '    Next i
  574. '
  575. 'End Sub
  576.  
  577. '    If sDocMimeType = "text/html" then
  578. '        FileProperties(0).Name = "FilterName"
  579. '        FileProperties(0).Value = "swriter: TEXT"
  580. '        FilePath = oDocument.URL
  581. '        oDocument.Dispose
  582. '
  583. '        oDocument = OpenDocument(FilePath,FileProperties(),StarDesktop)       '!!!!!!!
  584. '
  585. '        MakeLogHeadLine("Alternativtexte")
  586. '        GetHTMLStrings("ALT=")
  587. '
  588. '        MakeLogHeadLine("Referenzen")
  589. '        GetHTMLStrings("HREF=")
  590. '
  591. '        MakeLogHeadLine("Namen")
  592. '        GetHTMLStrings("NAME=")
  593. '    Else
  594.  
  595.  
  596. Sub LoadLibrary(sLibname as String)
  597. Dim oArg(0) as new com.sun.star.beans.PropertyValue
  598. Dim oUrl as new com.sun.star.util.URL
  599. Dim oTrans as Object
  600. Dim oDisp as Object
  601.  
  602.     oArg(0).Name = "LibraryName"
  603.     oArg(0).Value = sLibname
  604.  
  605.     oTrans = createUNOService("com.sun.star.util.URLTransformer")
  606.     oUrl.Complete = "slot:6517"
  607.     oTrans.parsestrict(oUrl)
  608.  
  609.     oDisp = StarDesktop.currentFrame.queryDispatch(oUrl, "_self", 0)
  610.     oDisp.dispatch(oUrl, oArg())
  611. End Sub
  612. </script:module>
  613.