Added line length limit to subscript and superscript for cleaning
This commit is contained in:
parent
7694a8911a
commit
d9b458210a
5 changed files with 71 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
<?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 mark75
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark76
|
||||
|
||||
End Sub
|
||||
|
||||
|
@ -1482,6 +1482,8 @@ End Function
|
|||
|
||||
|
||||
Private Sub convertFormatToUserFields(identifier As String, styleNames, styleValues)
|
||||
Dim maxLength As Integer
|
||||
maxLength = getMaxLength(identifier)
|
||||
Dim leftField As String
|
||||
Dim rightField As String
|
||||
Dim i As Integer
|
||||
|
@ -1505,15 +1507,31 @@ Private Sub convertFormatToUserFields(identifier As String, styleNames, styleVal
|
|||
i = 0
|
||||
Do While not isNull(found)
|
||||
If Len(found.String) <> 0 AND NOT IsNull(found.Text) Then
|
||||
If maxLength < 0 Or Len(found.String) < maxLength Then
|
||||
insertUserField(found.End,rightField & i,"")
|
||||
insertUserField(found.start,leftField & i,"")
|
||||
i = i + 1
|
||||
EndIf
|
||||
EndIf
|
||||
found = Thiscomponent.findNext(found.End, SDesc)
|
||||
|
||||
Loop
|
||||
End Sub
|
||||
|
||||
Function getMaxLength(identifier As String) As Integer
|
||||
Dim config As Object
|
||||
config = initRedactionConfiguration()
|
||||
If identifier = "SubScript" Then
|
||||
getMaxLength = CInt(config.getPropertyValue("subscript_max_length"))
|
||||
Exit Function
|
||||
EndIf
|
||||
If identifier = "SuperScript" Then
|
||||
getMaxLength = CInt(config.getPropertyValue("superscript_max_length"))
|
||||
Exit Function
|
||||
EndIf
|
||||
getMaxLength = -1
|
||||
End Function
|
||||
|
||||
Private Sub convertUserFieldsToFormat(identifier As String, styleNames , styleValues)
|
||||
Dim oTextCursor As Object
|
||||
Dim oMasters As Object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue