Added numberings validation
This commit is contained in:
parent
fa3ff2c16b
commit
6d4031e1aa
4 changed files with 87 additions and 2 deletions
|
@ -29,6 +29,7 @@ Sub validateButton
|
|||
Dim badNumberings As Boolean
|
||||
Dim badFootnoteSigns As Boolean
|
||||
Dim badGraphics As Boolean
|
||||
Dim needExtendedInfo As Boolean
|
||||
badGraphics = false
|
||||
badText = false
|
||||
badFootnoteSigns = false
|
||||
|
@ -50,6 +51,15 @@ Sub validateButton
|
|||
If badGraphics Then
|
||||
MsgBox graphicsReport
|
||||
EndIf
|
||||
Dim config As Object
|
||||
config = initRedactionConfiguration()
|
||||
If config.getPropertyValue("complexity") = "makerUp" then
|
||||
needExtendedInfo = true
|
||||
Else
|
||||
needExtendedInfo = false
|
||||
EndIf
|
||||
printNumberingSymbols(needExtendedInfo)
|
||||
|
||||
If badText OR badNumberings OR badFootnoteSigns OR badGraphics Then
|
||||
MsgBox "Перед публикацией документа следует исправить все найденные замечания."
|
||||
If badText Then
|
||||
|
@ -148,6 +158,80 @@ Private Function checkAllFootnotes()
|
|||
checkAllFootnotes = result
|
||||
End Function
|
||||
|
||||
Private Sub printNumberingSymbols(needExtendedInfo)
|
||||
Dim families As Object
|
||||
Dim numStyles As Object
|
||||
Dim numStyle As Object
|
||||
Dim numRules As Object
|
||||
Dim numRule As Object
|
||||
Dim prop As Object
|
||||
Dim enum1 As Object
|
||||
Dim enum1Element As Object
|
||||
Dim fontProp As Object
|
||||
Dim fontName As String
|
||||
Dim result As String
|
||||
Dim resultBad As String
|
||||
dim excerpt As String
|
||||
dim exLength As Integer
|
||||
families = ThisComponent.StyleFamilies
|
||||
numStyles = families.getByName("NumberingStyles")
|
||||
result = ""
|
||||
resultBad = ""
|
||||
enum1 = ThisComponent.Text.createEnumeration
|
||||
Do While enum1.hasMoreElements
|
||||
enum1Element = enum1.nextElement
|
||||
If enum1Element.supportsService("com.sun.star.text.Paragraph") Then
|
||||
If NOT IsMissing(enum1Element.NumberingRules) AND NOT IsEmpty(enum1Element.NumberingRules) Then
|
||||
numRules = enum1Element.NumberingRules
|
||||
If numRules.hasElements Then
|
||||
numRule = numRules.getByIndex(enum1Element.NumberingLevel)
|
||||
fontName = ""
|
||||
fontChar = ""
|
||||
For k = 0 To Ubound(numRule)
|
||||
prop = numRule(k)
|
||||
If prop.Name = "BulletFont" Then
|
||||
fontName = prop.Value.Name
|
||||
EndIf
|
||||
If prop.Name = "BulletChar" Then
|
||||
fontChar = prop.Value
|
||||
EndIf
|
||||
Next k
|
||||
exLength = 15
|
||||
excerpt = enum1Element.String
|
||||
If Len(excerpt) < exLength Then
|
||||
exLength = Len(excerpt)
|
||||
EndIf
|
||||
tmp = "Уровень " & (j + 1) & " шрифт " & fontName & " символ " & fontChar & " (" & Hex(Asc(fontChar)) & ") "& Left(excerpt,exLength) & chr(10)
|
||||
If Asc(fontChar) > 57344 AND Asc(fontChar) < 63743 Then
|
||||
resultBad = resultBad & tmp
|
||||
ElseIf fontName <> "IPH Astra Serif" _
|
||||
AND fontName <> "OpenSymbol" _
|
||||
AND fontName <> "IPH Lib Serif" _
|
||||
AND fontName <> "IPH Lib Sans" _
|
||||
AND fontName <> "Liberation Serif" _
|
||||
AND fontName <> "Liberation Sans" _
|
||||
AND needExtendedInfo Then
|
||||
result = result & tmp
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
Loop
|
||||
dim report as String
|
||||
report = ""
|
||||
If result = "" AND resultBad = "" Then
|
||||
Exit sub
|
||||
Else
|
||||
If resultBad <> "" Then
|
||||
report = "Маркером в следующих списках нумерации задан некорректный символ"& chr(10) & resultBad
|
||||
EndIf
|
||||
If result <> "" Then
|
||||
report = report & "В следующих списках нумерации найдены шрифты "& chr(10)& result
|
||||
EndIf
|
||||
EndIf
|
||||
MsgBox report
|
||||
End Sub
|
||||
|
||||
Private Sub showTrackedChanges
|
||||
dim document as object
|
||||
dim dispatcher as object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue