Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
16c6c9fb
Kaydet (Commit)
16c6c9fb
authored
Agu 21, 2018
tarafından
Matthias Seidel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Deleted whitespace, fixed typos and spelling errors
üst
3d3594a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
29 deletions
+26
-29
GetTexts.xba
wizards/source/gimmicks/GetTexts.xba
+26
-29
No files found.
wizards/source/gimmicks/GetTexts.xba
Dosyayı görüntüle @
16c6c9fb
...
@@ -21,12 +21,12 @@
...
@@ -21,12 +21,12 @@
*
*
***********************************************************-->
***********************************************************-->
<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
'
Macro-
Description:
'
Description:
'
This
Macro extracts the Strings out of the currently activated document und inserts them into a logdocument
'
This
macro extracts the strings out of the currently active document and inserts them into a log document.
'
The aim of the macro is to provide the programmer an insight into the
StarOffice API
'
The aim of the macro is to provide the programmer an insight into the
OpenOffice API.
'
It focus
ses on how document-O
bjects are accessed.
'
It focus
es on how document o
bjects are accessed.
'
Therefor
not only texts of the document-body are retrieved but also T
exts of general
'
Therefor
e not only texts of the document body are retrieved but also t
exts of general
'
document
Objects like, Annotations, charts and general Document Information
'
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
...
@@ -38,13 +38,13 @@ Sub Main
...
@@ -38,13 +38,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(
"
Tools
"
)
BasicLibraries.LoadLibrary(
"
Tools
"
)
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
<>
0 Then
If Err
<>
0 Then
Msgbox(
"
This macro extracts all data from the active Writer, Calc or Draw document.
"
&
chr(13)
&
_
Msgbox(
"
This macro extracts all data from the active Writer, Calc or Draw
/Impress
document.
"
&
chr(13)
&
_
"
To start this macro you have to activate a document first.
"
, 16, GetProductName)
"
To start this macro you have to activate a document first.
"
, 16, GetProductName)
Exit Sub
Exit Sub
End If
End If
...
@@ -55,7 +55,7 @@ Dim oCharStyles as Object
...
@@ -55,7 +55,7 @@ Dim oCharStyles as Object
If Not IsNull(oLogDocument) Then
If Not IsNull(oLogDocument) Then
oLogText = oLogDocument.Text
oLogText = oLogDocument.Text
'
create and define the character styles of the
Log-
document
'
create and define the character styles of the
log
document
oCharStyles = oLogDocument.StyleFamilies.GetByName(
"
CharacterStyles
"
)
oCharStyles = oLogDocument.StyleFamilies.GetByName(
"
CharacterStyles
"
)
oLogHeaderStyle = oLogDocument.createInstance(
"
com.sun.star.style.CharacterStyle
"
)
oLogHeaderStyle = oLogDocument.createInstance(
"
com.sun.star.style.CharacterStyle
"
)
oCharStyles.InsertbyName(
"
Log Header
"
, oLogHeaderStyle)
oCharStyles.InsertbyName(
"
Log Header
"
, oLogHeaderStyle)
...
@@ -101,7 +101,7 @@ Dim oCharStyles as Object
...
@@ -101,7 +101,7 @@ Dim oCharStyles as Object
End Sub
End Sub
'
***********************************************Calc
-D
ocuments**************************************************
'
***********************************************Calc
d
ocuments**************************************************
Sub GetCalcStrings()
Sub GetCalcStrings()
Dim i, n as integer
Dim i, n as integer
...
@@ -114,7 +114,7 @@ Dim oSheets as Object
...
@@ -114,7 +114,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(
"
Sheet No.
"
&
i
&
"
(
"
&
SheetName
&
"
)
"
)
MakeLogHeadLine(
"
Sheet No.
"
&
i
&
"
(
"
&
SheetName
&
"
)
"
)
'
Check the
"
body
"
of the sheet
'
Check the
"
body
"
of the sheet
GetCellTexts(oSheet)
GetCellTexts(oSheet)
...
@@ -185,7 +185,7 @@ Dim n,m as integer
...
@@ -185,7 +185,7 @@ Dim n,m as integer
End Sub
End Sub
'
***********************************************Writer
-D
ocuments**************************************************
'
***********************************************Writer
d
ocuments**************************************************
Sub GetParagraphTexts(oParaObject as Object, HeadLine as String)
Sub GetParagraphTexts(oParaObject as Object, HeadLine as String)
Dim ParaEnum as Object
Dim ParaEnum as Object
...
@@ -202,8 +202,8 @@ Dim oCell as Object
...
@@ -202,8 +202,8 @@ Dim oCell as Object
While ParaEnum.HasMoreElements
While ParaEnum.HasMoreElements
oPara = ParaEnum.NextElement
oPara = ParaEnum.NextElement
'
Note: The
Enumeration ParaEnum lists all tables and P
aragraphs.
'
Note: The
enumeration ParaEnum lists all tables and p
aragraphs.
'
Therefor we have to find out what kind of object
"
oPara
"
actually is
'
Therefor
e
we have to find out what kind of object
"
oPara
"
actually is
If oPara.supportsService(
"
com.sun.star.text.Paragraph
"
) Then
If oPara.supportsService(
"
com.sun.star.text.Paragraph
"
) Then
'
"
oPara
"
is a Paragraph
'
"
oPara
"
is a Paragraph
oTextPortEnum = oPara.createEnumeration
oTextPortEnum = oPara.createEnumeration
...
@@ -225,7 +225,6 @@ Dim oCell as Object
...
@@ -225,7 +225,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
...
@@ -260,7 +259,6 @@ Dim aChartDiagram as Object
...
@@ -260,7 +259,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
...
@@ -274,8 +272,8 @@ Dim oFrameTextPort as Object
...
@@ -274,8 +272,8 @@ Dim oFrameTextPort as Object
oTextFrame = oDocument.TextFrames.GetbyIndex(i)
oTextFrame = oDocument.TextFrames.GetbyIndex(i)
WriteStringToLogFile(oTextFrame.Name)
WriteStringToLogFile(oTextFrame.Name)
'
Is the frame bound to the
Page
'
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,
"
Text Frame Contents
"
)
GetParagraphTexts(oTextFrame,
"
Text Frame Contents
"
)
End If
End If
...
@@ -318,7 +316,6 @@ Dim CurElement as Object
...
@@ -318,7 +316,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
...
@@ -360,7 +357,7 @@ Sub GetWriterStrings()
...
@@ -360,7 +357,7 @@ Sub GetWriterStrings()
End Sub
End Sub
'
***********************************************Draw
-D
ocuments**************************************************
'
***********************************************Draw
/Impress d
ocuments**************************************************
Sub GetDrawPageTitles(LocObject as Object)
Sub GetDrawPageTitles(LocObject as Object)
Dim n as integer
Dim n as integer
...
@@ -369,9 +366,9 @@ Dim oPage as Object
...
@@ -369,9 +366,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)
'
Is the
P
age a DrawPage and not a MasterPage?
'
Is the
p
age a DrawPage and not a MasterPage?
If oPage.supportsService(
"
com.sun.star.drawing.DrawPage
"
)then
If oPage.supportsService(
"
com.sun.star.drawing.DrawPage
"
)then
'
Get the
Name of the NotesPage (only relevant for Impress-D
ocuments)
'
Get the
name of the NotesPage (only relevant for Impress d
ocuments)
If oDocument.supportsService(
"
com.sun.star.presentation.PresentationDocument
"
) then
If oDocument.supportsService(
"
com.sun.star.presentation.PresentationDocument
"
) then
WriteStringtoLogFile(oPage.NotesPage.Name)
WriteStringtoLogFile(oPage.NotesPage.Name)
End If
End If
...
@@ -428,10 +425,10 @@ Dim oDocuProps as Object
...
@@ -428,10 +425,10 @@ Dim oDocuProps as Object
WriteStringToLogFile(oDocuProps.Description)
WriteStringToLogFile(oDocuProps.Description)
WriteStringToLogFile(oDocuProps.Subject)
WriteStringToLogFile(oDocuProps.Subject)
WriteStringToLogFile(oDocuProps.Author)
WriteStringToLogFile(oDocuProps.Author)
'
WriteStringToLogFile(oDocuProps.UserDefinedProperties.ReplyTo)
'
WriteStringToLogFile(oDocuProps.UserDefinedProperties.ReplyTo)
'
WriteStringToLogFile(oDocuProps.UserDefinedProperties.Recipient)
'
WriteStringToLogFile(oDocuProps.UserDefinedProperties.Recipient)
'
WriteStringToLogFile(oDocuProps.UserDefinedProperties.References)
'
WriteStringToLogFile(oDocuProps.UserDefinedProperties.References)
'
WriteStringToLogFile(oDocuProps.Keywords)
'
WriteStringToLogFile(oDocuProps.Keywords)
End Sub
End Sub
...
@@ -457,7 +454,7 @@ Dim oSearchDesc as Object
...
@@ -457,7 +454,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)
'
Url
WriteStringToLogFile(oCrs.HyperLinkURL)
'
Url
WriteStringToLogFile(oCrs.HyperLinkTarget)
'
Name
WriteStringToLogFile(oCrs.HyperLinkTarget)
'
Name
WriteStringToLogFile(oCrs.HyperLinkName)
'
Frame
WriteStringToLogFile(oCrs.HyperLinkName)
'
Frame
Next i
Next i
...
@@ -520,14 +517,14 @@ Dim i as integer
...
@@ -520,14 +517,14 @@ Dim i as integer
End If
End If
End Sub
End Sub
'
***********************************************Log
D
ocument**************************************************
'
***********************************************Log
d
ocument**************************************************
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment