Kaydet (Commit) 969e2dd3 authored tarafından Matthias Seidel's avatar Matthias Seidel Kaydeden (comit) Caolán McNamara

Deleted whitespace, fixed typos and spelling errors

(cherry picked from commit 16c6c9fb)

Change-Id: I61f469100dc49fe9c00171b59c3390834bb3af78
Reviewed-on: https://gerrit.libreoffice.org/59425
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 5f1451f0
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
--> -->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="GetTexts" script:language="StarBasic">Option Explicit <script:module xmlns:script="http://openoffice.org/2000/script" script:name="GetTexts" script:language="StarBasic">Option Explicit
&apos; Macro-Description: &apos; Description:
&apos; This Macro extracts the strings out of the currently activated document and inserts them into a log document. &apos; This macro extracts the strings out of the currently active document and inserts them into a log document.
&apos; The aim of the macro is to provide the programmer an insight into the StarOffice API &apos; The aim of the macro is to provide the programmer an insight into the OpenOffice API.
&apos; It focusses on how document-Objects are accessed. &apos; It focuses on how document objects are accessed.
&apos; Therefore not only texts of the document-body are retrieved but also Texts of general &apos; Therefore not only texts of the document body are retrieved but also texts of general
&apos; document Objects like, Annotations, charts and general Document Information &apos; document objects like, annotations, charts and general document information.
Public oLogDocument, oLogText, oLogCursor, oLogHeaderStyle, oLogBodyTextStyle as Object Public oLogDocument, oLogText, oLogCursor, oLogHeaderStyle, oLogBodyTextStyle as Object
Public oDocument as Object Public oDocument as Object
...@@ -35,13 +35,13 @@ Sub Main ...@@ -35,13 +35,13 @@ Sub Main
Dim sDocType as String Dim sDocType as String
Dim oHyperCursor as Object Dim oHyperCursor as Object
Dim oCharStyles as Object Dim oCharStyles as Object
BasicLibraries.LoadLibrary(&quot;Tools&quot;) BasicLibraries.LoadLibrary(&quot;Tools&quot;)
On Local Error GoTo NODOCUMENT On Local Error GoTo NODOCUMENT
oDocument = StarDesktop.ActiveFrame.Controller.Model oDocument = StarDesktop.ActiveFrame.Controller.Model
sDocType = GetDocumentType(oDocument) sDocType = GetDocumentType(oDocument)
NODOCUMENT: NODOCUMENT:
If Err &lt;&gt; 0 Then If Err &lt;&gt; 0 Then
Msgbox(&quot;This macro extracts all data from the active Writer, Calc or Draw document.&quot; &amp; chr(13) &amp;_ Msgbox(&quot;This macro extracts all data from the active Writer, Calc or Draw/Impress document.&quot; &amp; chr(13) &amp;_
&quot;To start this macro you have to activate a document first.&quot; , 16, GetProductName) &quot;To start this macro you have to activate a document first.&quot; , 16, GetProductName)
Exit Sub Exit Sub
End If End If
...@@ -52,7 +52,7 @@ Dim oCharStyles as Object ...@@ -52,7 +52,7 @@ Dim oCharStyles as Object
If Not IsNull(oLogDocument) Then If Not IsNull(oLogDocument) Then
oLogText = oLogDocument.Text oLogText = oLogDocument.Text
&apos; create and define the character styles of the Log-document &apos; create and define the character styles of the log document
oCharStyles = oLogDocument.StyleFamilies.GetByName(&quot;CharacterStyles&quot;) oCharStyles = oLogDocument.StyleFamilies.GetByName(&quot;CharacterStyles&quot;)
oLogHeaderStyle = oLogDocument.createInstance(&quot;com.sun.star.style.CharacterStyle&quot;) oLogHeaderStyle = oLogDocument.createInstance(&quot;com.sun.star.style.CharacterStyle&quot;)
oCharStyles.InsertbyName(&quot;Log Header&quot;, oLogHeaderStyle) oCharStyles.InsertbyName(&quot;Log Header&quot;, oLogHeaderStyle)
...@@ -98,7 +98,7 @@ Dim oCharStyles as Object ...@@ -98,7 +98,7 @@ Dim oCharStyles as Object
End Sub End Sub
&apos; ***********************************************Calc-Documents************************************************** &apos; ***********************************************Calc documents**************************************************
Sub GetCalcStrings() Sub GetCalcStrings()
Dim i, n as integer Dim i, n as integer
...@@ -111,7 +111,7 @@ Dim oSheets as Object ...@@ -111,7 +111,7 @@ Dim oSheets as Object
For i = 0 to osheets.Count - 1 For i = 0 to osheets.Count - 1
oSheet = osheets.GetbyIndex(i) oSheet = osheets.GetbyIndex(i)
SheetName = oSheet.Name SheetName = oSheet.Name
MakeLogHeadLine(&quot;Sheet No. &quot; &amp; i &amp; &quot;(&quot; &amp; SheetName &amp; &quot;)&quot; ) MakeLogHeadLine(&quot;Sheet No. &quot; &amp; i &amp; &quot; (&quot; &amp; SheetName &amp; &quot;)&quot; )
&apos; Check the &quot;body&quot; of the sheet &apos; Check the &quot;body&quot; of the sheet
GetCellTexts(oSheet) GetCellTexts(oSheet)
...@@ -182,7 +182,7 @@ Dim n,m as integer ...@@ -182,7 +182,7 @@ Dim n,m as integer
End Sub End Sub
&apos; ***********************************************Writer-Documents************************************************** &apos; ***********************************************Writer documents**************************************************
Sub GetParagraphTexts(oParaObject as Object, HeadLine as String) Sub GetParagraphTexts(oParaObject as Object, HeadLine as String)
Dim ParaEnum as Object Dim ParaEnum as Object
...@@ -199,7 +199,7 @@ Dim oCell as Object ...@@ -199,7 +199,7 @@ Dim oCell as Object
While ParaEnum.HasMoreElements While ParaEnum.HasMoreElements
oPara = ParaEnum.NextElement oPara = ParaEnum.NextElement
&apos; Note: The Enumeration ParaEnum lists all tables and Paragraphs. &apos; Note: The enumeration ParaEnum lists all tables and paragraphs.
&apos; Therefore we have to find out what kind of object &quot;oPara&quot; actually is &apos; Therefore we have to find out what kind of object &quot;oPara&quot; actually is
If oPara.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then If oPara.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then
&apos; &quot;oPara&quot; is a Paragraph &apos; &quot;oPara&quot; is a Paragraph
...@@ -222,7 +222,6 @@ Dim oCell as Object ...@@ -222,7 +222,6 @@ Dim oCell as Object
End Sub End Sub
Sub GetChartStrings(oSheet as Object, HeaderLine as String) Sub GetChartStrings(oSheet as Object, HeaderLine as String)
Dim i as Integer Dim i as Integer
Dim aChartObject as Object Dim aChartObject as Object
...@@ -257,7 +256,6 @@ Dim aChartDiagram as Object ...@@ -257,7 +256,6 @@ Dim aChartDiagram as Object
End Sub End Sub
Sub GetFrameTexts() Sub GetFrameTexts()
Dim i as integer Dim i as integer
Dim oTextFrame as object Dim oTextFrame as object
...@@ -271,8 +269,8 @@ Dim oFrameTextPort as Object ...@@ -271,8 +269,8 @@ Dim oFrameTextPort as Object
oTextFrame = oDocument.TextFrames.GetbyIndex(i) oTextFrame = oDocument.TextFrames.GetbyIndex(i)
WriteStringToLogFile(oTextFrame.Name) WriteStringToLogFile(oTextFrame.Name)
&apos; Is the frame bound to the Page &apos; Is the frame bound to the page?
If oTextFrame.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE Then If oTextFrame.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE Then
GetParagraphTexts(oTextFrame, &quot;Text Frame Contents&quot;) GetParagraphTexts(oTextFrame, &quot;Text Frame Contents&quot;)
End If End If
...@@ -315,7 +313,6 @@ Dim CurElement as Object ...@@ -315,7 +313,6 @@ Dim CurElement as Object
End Sub End Sub
Sub GetLinkedFileNames() Sub GetLinkedFileNames()
Dim oDocSections as Object Dim oDocSections as Object
Dim LinkedFileName as String Dim LinkedFileName as String
...@@ -357,7 +354,7 @@ Sub GetWriterStrings() ...@@ -357,7 +354,7 @@ Sub GetWriterStrings()
End Sub End Sub
&apos; ***********************************************Draw-Documents************************************************** &apos; ***********************************************Draw/Impress documents**************************************************
Sub GetDrawPageTitles(LocObject as Object) Sub GetDrawPageTitles(LocObject as Object)
Dim n as integer Dim n as integer
...@@ -366,9 +363,9 @@ Dim oPage as Object ...@@ -366,9 +363,9 @@ Dim oPage as Object
For n = 0 to LocObject.Count - 1 For n = 0 to LocObject.Count - 1
oPage = LocObject.GetbyIndex(n) oPage = LocObject.GetbyIndex(n)
WriteStringtoLogFile(oPage.Name) WriteStringtoLogFile(oPage.Name)
&apos; Is the Page a DrawPage and not a MasterPage? &apos; Is the page a DrawPage and not a MasterPage?
If oPage.supportsService(&quot;com.sun.star.drawing.DrawPage&quot;)then If oPage.supportsService(&quot;com.sun.star.drawing.DrawPage&quot;)then
&apos; Get the Name of the NotesPage (only relevant for Impress-Documents) &apos; Get the name of the NotesPage (only relevant for Impress documents)
If oDocument.supportsService(&quot;com.sun.star.presentation.PresentationDocument&quot;) then If oDocument.supportsService(&quot;com.sun.star.presentation.PresentationDocument&quot;) then
WriteStringtoLogFile(oPage.NotesPage.Name) WriteStringtoLogFile(oPage.NotesPage.Name)
End If End If
...@@ -425,10 +422,10 @@ Dim oDocuProps as Object ...@@ -425,10 +422,10 @@ Dim oDocuProps as Object
WriteStringToLogFile(oDocuProps.Description) WriteStringToLogFile(oDocuProps.Description)
WriteStringToLogFile(oDocuProps.Subject) WriteStringToLogFile(oDocuProps.Subject)
WriteStringToLogFile(oDocuProps.Author) WriteStringToLogFile(oDocuProps.Author)
&apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.ReplyTo) &apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.ReplyTo)
&apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.Recipient) &apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.Recipient)
&apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.References) &apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.References)
&apos; WriteStringToLogFile(oDocuProps.Keywords) &apos; WriteStringToLogFile(oDocuProps.Keywords)
End Sub End Sub
...@@ -454,7 +451,7 @@ Dim oSearchDesc as Object ...@@ -454,7 +451,7 @@ Dim oSearchDesc as Object
For i = 0 to oAllHyperLinks.Count - 1 For i = 0 to oAllHyperLinks.Count - 1
oFound = oAllHyperLinks(i) oFound = oAllHyperLinks(i)
oCrsr = oFound.Text.createTextCursorByRange(oFound) oCrsr = oFound.Text.createTextCursorByRange(oFound)
WriteStringToLogFile(oCrs.HyperLinkURL) &apos;Url WriteStringToLogFile(oCrs.HyperLinkURL) &apos;Url
WriteStringToLogFile(oCrs.HyperLinkTarget) &apos;Name WriteStringToLogFile(oCrs.HyperLinkTarget) &apos;Name
WriteStringToLogFile(oCrs.HyperLinkName) &apos;Frame WriteStringToLogFile(oCrs.HyperLinkName) &apos;Frame
Next i Next i
...@@ -517,14 +514,14 @@ Dim i as integer ...@@ -517,14 +514,14 @@ Dim i as integer
End If End If
End Sub End Sub
&apos; ***********************************************LogDocument************************************************** &apos; ***********************************************Log document**************************************************
Sub WriteStringtoLogFile( sString as String) Sub WriteStringtoLogFile( sString as String)
If (Not FieldInArray(LogArray(),LogIndex,sString))AND (NOT ISNULL(sString)) Then If (Not FieldInArray(LogArray(),LogIndex,sString))AND (NOT ISNULL(sString)) Then
LogArray(LogIndex) = sString LogArray(LogIndex) = sString
LogIndex = LogIndex + 1 LogIndex = LogIndex + 1
oLogText.insertString(oLogCursor,sString,False) oLogText.insertString(oLogCursor,sString,False)
oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False) oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
End If End If
End Sub End Sub
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment