Fixes for link removal macro
This commit is contained in:
parent
d5ba33005f
commit
6e1794a27e
1 changed files with 32 additions and 12 deletions
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub cleanButton
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Private Sub markFxFxF
|
||||
End Sub
|
||||
|
||||
Sub cleanButton
|
||||
Dim description As String
|
||||
Dim statusIndicator as Object
|
||||
statusIndicator = ThisComponent.getCurrentController.statusIndicator
|
||||
|
@ -188,7 +191,7 @@ End Function
|
|||
Private Sub disposeAllLinks()
|
||||
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
||||
SrchAttributes(0).Name = "CharStyleName"
|
||||
SrchAttributes(0).Value = "Internet Link"
|
||||
SrchAttributes(0).Value = "Internet link"
|
||||
Dim ReplAttributes(2) as new com.sun.star.beans.PropertyValue
|
||||
ReplAttributes(0).Name = "HyperlinkTarget"
|
||||
ReplAttributes(0).Value = ""
|
||||
|
@ -196,7 +199,7 @@ Private Sub disposeAllLinks()
|
|||
ReplAttributes(1).Value = ""
|
||||
ReplAttributes(2).Name = "CharStyleName"
|
||||
ReplAttributes(2).Value = ThisComponent.getStyleFamilies().getByIndex(0).ElementNames(0)
|
||||
setAttributesBySearchPattern(searchPattern,SrchAttributes,ReplAttributes)
|
||||
setAttributesBySearchPattern("",SrchAttributes,ReplAttributes)
|
||||
End Sub
|
||||
|
||||
Private Sub disposeAllBookmarks()
|
||||
|
@ -239,6 +242,8 @@ Private Sub setAttributesBySearchPattern(searchPattern As String, SrchAttributes
|
|||
Dim oTextCursor As Object
|
||||
Dim oViewCursor As Object
|
||||
Dim lineIndent
|
||||
dim stringValue1 As String
|
||||
dim stringValue2 As String
|
||||
Dim foundPatterns() As Object
|
||||
document = ThisComponent.CurrentController.Frame
|
||||
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||
|
@ -251,15 +256,30 @@ Private Sub setAttributesBySearchPattern(searchPattern As String, SrchAttributes
|
|||
oSearch.SetSearchAttributes(SrchAttributes())
|
||||
End If
|
||||
oFound = ThisComponent.findFirst(oSearch)
|
||||
Dim replace As Boolean
|
||||
|
||||
Do While Not IsNull(oFound)
|
||||
For i = LBound(ReplAttributes) To Ubound(ReplAttributes)
|
||||
' Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
||||
' Mri oFound
|
||||
If oFound.getPropertySetInfo.hasPropertyByName(ReplAttributes(i).Name) Then
|
||||
oFound.SetPropertyValue(ReplAttributes(i).Name,ReplAttributes(i).Value)
|
||||
EndIf
|
||||
Next i
|
||||
oFound = ThisComponent.findNext(oFound.End, oSearch)
|
||||
replace = true
|
||||
|
||||
For j = LBound(SrchAttributes) To Ubound(SrchAttributes)
|
||||
If oFound.getPropertySetInfo.hasPropertyByName(SrchAttributes(j).Name) Then
|
||||
stringValue1 = "" & oFound.getPropertyValue(SrchAttributes(j).Name)
|
||||
stringValue2 = "" & SrchAttributes(j).Value
|
||||
If stringValue1 <> stringValue2 Then
|
||||
replace = replace AND False
|
||||
EndIf
|
||||
Else
|
||||
replace = replace AND False
|
||||
EndIf
|
||||
Next j
|
||||
If replace then
|
||||
For i = LBound(ReplAttributes) To Ubound(ReplAttributes)
|
||||
If oFound.getPropertySetInfo.hasPropertyByName(ReplAttributes(i).Name) Then
|
||||
oFound.SetPropertyValue(ReplAttributes(i).Name,ReplAttributes(i).Value)
|
||||
EndIf
|
||||
Next i
|
||||
EndIf
|
||||
oFound = ThisComponent.findNext(oFound.End, oSearch)
|
||||
Loop
|
||||
|
||||
End Sub
|
||||
|
@ -785,4 +805,4 @@ Private Function getStyleNames(oFamily,bLocalized as Boolean, _
|
|||
Endif
|
||||
xArray(iUB) = vNextElement
|
||||
End Sub
|
||||
</script:module>
|
||||
</script:module>
|
Loading…
Add table
Reference in a new issue