Icons
This commit is contained in:
parent
d7008bc972
commit
aceaef82fd
5 changed files with 82 additions and 0 deletions
|
@ -12,10 +12,92 @@
|
|||
doNotTrack
|
||||
statusIndicator.Start("Чистка документа начата, подождите",30)
|
||||
cleanFormatting
|
||||
disposePageBreaks
|
||||
disposeAllLinks
|
||||
disposeAllBookmarks
|
||||
statusIndicator.end()
|
||||
saveAndreload()
|
||||
End Sub
|
||||
|
||||
Private Sub disposeAllLinks()
|
||||
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
||||
SrchAttributes(0).Name = "CharStyleName"
|
||||
SrchAttributes(0).Value = "Internet Link"
|
||||
Dim ReplAttributes(2) as new com.sun.star.beans.PropertyValue
|
||||
ReplAttributes(0).Name = "HyperlinkTarget"
|
||||
ReplAttributes(0).Value = ""
|
||||
ReplAttributes(1).Name = "HyperLinkURL"
|
||||
ReplAttributes(1).Value = ""
|
||||
ReplAttributes(2).Name = "CharStyleName"
|
||||
ReplAttributes(2).Value = ThisComponent.getStyleFamilies().getByIndex(0).ElementNames(0)
|
||||
setAttributesBySearchPattern(searchPattern,SrchAttributes,ReplAttributes)
|
||||
End Sub
|
||||
|
||||
Private Sub disposeAllBookmarks()
|
||||
Dim bookmarks As Object
|
||||
Dim elementName As String
|
||||
elementName = ThisComponent.Links.ElementNames(6)
|
||||
bookmarks = ThisComponent.Links.getByName(elementName)
|
||||
While bookmarks.hasElements()
|
||||
bookmark = bookmarks.getByName(bookmarks.ElementNames(0))
|
||||
bookmark.dispose()
|
||||
Wend
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub disposePageBreaks
|
||||
oTextCursor = ThisComponent.Text.CreateTextCursor()
|
||||
enum1 = ThisComponent.Text.createEnumeration
|
||||
While enum1.hasMoreElements
|
||||
enum1Element = enum1.nextElement
|
||||
If enum1Element.supportsService("com.sun.star.text.Paragraph") Then
|
||||
If enum1Element.BreakType <> com.sun.star.style.BreakType.NONE Then
|
||||
oTextCursor.goToRange(enum1Element.getAnchor(), false)
|
||||
If NOT IsEmpty(oTextCursor.PageDescName) Then
|
||||
oTextCursor.PageDescName = ""
|
||||
End If
|
||||
oTextCursor.BreakType = com.sun.star.style.BreakType.NONE
|
||||
End If
|
||||
ElseIf enum1Element.supportsService("com.sun.star.text.TextTable") Then
|
||||
If NOT IsEmpty(enum1Element.PageDescName) Then
|
||||
enum1Element.PageDescName = ""
|
||||
End If
|
||||
enum1Element.BreakType = com.sun.star.style.BreakType.NONE
|
||||
EndIf
|
||||
Wend
|
||||
End Sub
|
||||
|
||||
Private Sub setAttributesBySearchPattern(searchPattern As String, SrchAttributes, ReplAttributes)
|
||||
|
||||
Dim oSearch
|
||||
Dim oTextCursor As Object
|
||||
Dim oViewCursor As Object
|
||||
Dim lineIndent
|
||||
Dim foundPatterns() As Object
|
||||
document = ThisComponent.CurrentController.Frame
|
||||
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||
oSearch = ThisComponent.createSearchDescriptor()
|
||||
oSearch.SearchString = searchPattern
|
||||
oSearch.SearchRegularExpression=True
|
||||
oSearch.SearchAll = True
|
||||
oSearch.searchStyles = true
|
||||
If Not IsEmpty(SrchAttributes(0).Value) Then
|
||||
oSearch.SetSearchAttributes(SrchAttributes())
|
||||
End If
|
||||
oFound = ThisComponent.findFirst(oSearch)
|
||||
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)
|
||||
Loop
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub saveAndreload()
|
||||
|
||||
dim document as object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue