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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
<!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 description As String
|
||||||
Dim statusIndicator as Object
|
Dim statusIndicator as Object
|
||||||
statusIndicator = ThisComponent.getCurrentController.statusIndicator
|
statusIndicator = ThisComponent.getCurrentController.statusIndicator
|
||||||
|
@ -188,7 +191,7 @@ End Function
|
||||||
Private Sub disposeAllLinks()
|
Private Sub disposeAllLinks()
|
||||||
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
||||||
SrchAttributes(0).Name = "CharStyleName"
|
SrchAttributes(0).Name = "CharStyleName"
|
||||||
SrchAttributes(0).Value = "Internet Link"
|
SrchAttributes(0).Value = "Internet link"
|
||||||
Dim ReplAttributes(2) as new com.sun.star.beans.PropertyValue
|
Dim ReplAttributes(2) as new com.sun.star.beans.PropertyValue
|
||||||
ReplAttributes(0).Name = "HyperlinkTarget"
|
ReplAttributes(0).Name = "HyperlinkTarget"
|
||||||
ReplAttributes(0).Value = ""
|
ReplAttributes(0).Value = ""
|
||||||
|
@ -196,7 +199,7 @@ Private Sub disposeAllLinks()
|
||||||
ReplAttributes(1).Value = ""
|
ReplAttributes(1).Value = ""
|
||||||
ReplAttributes(2).Name = "CharStyleName"
|
ReplAttributes(2).Name = "CharStyleName"
|
||||||
ReplAttributes(2).Value = ThisComponent.getStyleFamilies().getByIndex(0).ElementNames(0)
|
ReplAttributes(2).Value = ThisComponent.getStyleFamilies().getByIndex(0).ElementNames(0)
|
||||||
setAttributesBySearchPattern(searchPattern,SrchAttributes,ReplAttributes)
|
setAttributesBySearchPattern("",SrchAttributes,ReplAttributes)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub disposeAllBookmarks()
|
Private Sub disposeAllBookmarks()
|
||||||
|
@ -239,6 +242,8 @@ Private Sub setAttributesBySearchPattern(searchPattern As String, SrchAttributes
|
||||||
Dim oTextCursor As Object
|
Dim oTextCursor As Object
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
Dim lineIndent
|
Dim lineIndent
|
||||||
|
dim stringValue1 As String
|
||||||
|
dim stringValue2 As String
|
||||||
Dim foundPatterns() As Object
|
Dim foundPatterns() As Object
|
||||||
document = ThisComponent.CurrentController.Frame
|
document = ThisComponent.CurrentController.Frame
|
||||||
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||||
|
@ -251,14 +256,29 @@ Private Sub setAttributesBySearchPattern(searchPattern As String, SrchAttributes
|
||||||
oSearch.SetSearchAttributes(SrchAttributes())
|
oSearch.SetSearchAttributes(SrchAttributes())
|
||||||
End If
|
End If
|
||||||
oFound = ThisComponent.findFirst(oSearch)
|
oFound = ThisComponent.findFirst(oSearch)
|
||||||
|
Dim replace As Boolean
|
||||||
|
|
||||||
Do While Not IsNull(oFound)
|
Do While Not IsNull(oFound)
|
||||||
|
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)
|
For i = LBound(ReplAttributes) To Ubound(ReplAttributes)
|
||||||
' Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
|
||||||
' Mri oFound
|
|
||||||
If oFound.getPropertySetInfo.hasPropertyByName(ReplAttributes(i).Name) Then
|
If oFound.getPropertySetInfo.hasPropertyByName(ReplAttributes(i).Name) Then
|
||||||
oFound.SetPropertyValue(ReplAttributes(i).Name,ReplAttributes(i).Value)
|
oFound.SetPropertyValue(ReplAttributes(i).Name,ReplAttributes(i).Value)
|
||||||
EndIf
|
EndIf
|
||||||
Next i
|
Next i
|
||||||
|
EndIf
|
||||||
oFound = ThisComponent.findNext(oFound.End, oSearch)
|
oFound = ThisComponent.findNext(oFound.End, oSearch)
|
||||||
Loop
|
Loop
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue