Added numberings validation
This commit is contained in:
parent
fa3ff2c16b
commit
6d4031e1aa
4 changed files with 87 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ConfigDialog" dlg:left="196" dlg:top="109" dlg:width="157" dlg:height="64" dlg:closeable="true" dlg:moveable="true">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:checkbox dlg:id="CB_complexity" dlg:tab-index="0" dlg:left="5" dlg:top="13" dlg:width="150" dlg:height="19" dlg:value="Включить расширенное управление чисткой" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="CB_complexity" dlg:tab-index="0" dlg:left="5" dlg:top="13" dlg:width="150" dlg:height="19" dlg:value="Включить режим эксперта" dlg:checked="false"/>
|
||||
<dlg:button dlg:id="OK" dlg:tab-index="1" dlg:left="9" dlg:top="45" dlg:width="59" dlg:height="13" dlg:value="Сохранить" dlg:button-type="ok"/>
|
||||
<dlg:button dlg:id="CommandButton1" dlg:tab-index="2" dlg:left="-132" dlg:top="41" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
|
||||
<dlg:button dlg:id="CANCEL" dlg:tab-index="3" dlg:left="77" dlg:top="45" dlg:width="59" dlg:height="13" dlg:value="Отмена" dlg:button-type="cancel"/>
|
||||
|
|
|
@ -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