Added check for headings in tables
This commit is contained in:
parent
15a5bd6f0d
commit
e5244b8259
6 changed files with 104 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
<?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="Configuration" script:language="StarBasic" script:moduleType="normal">Public Const redactionExtensionName As String = "cleanAndValidate"
|
||||
Public Const redactionExtensionVersion = "0.8.4"
|
||||
Public Const redactionExtensionVersion = "0.8.5"
|
||||
Function initRedactionConfiguration()
|
||||
On Error Goto exceptionHandler
|
||||
Dim regFactory As Object
|
||||
|
|
|
@ -230,6 +230,9 @@ Function getRussian(identifier As String) As String
|
|||
Case "inPageStyle"
|
||||
getRussian = "стиля страниц"
|
||||
Exit Function
|
||||
Case "table"
|
||||
getRussian = "таблице"
|
||||
Exit Function
|
||||
Case Else
|
||||
getRussian = "Перевод не найден"
|
||||
End Select
|
||||
|
@ -442,6 +445,9 @@ Function getEnglish(identifier As String) As String
|
|||
Case "inPageStyle"
|
||||
getEnglish = "of page style"
|
||||
Exit Function
|
||||
Case "table"
|
||||
getEnglish = "table"
|
||||
Exit Function
|
||||
Case Else
|
||||
getEnglish = "No translation"
|
||||
End Select
|
||||
|
@ -653,6 +659,9 @@ Function getCroatian(identifier As String) As String
|
|||
Case "inPageStyle"
|
||||
getCroatian = "stil stranice"
|
||||
Exit Function
|
||||
Case "table"
|
||||
getCroatian = "stola"
|
||||
Exit Function
|
||||
Case Else
|
||||
getCroatian = "No translation"
|
||||
End Select
|
||||
|
@ -864,6 +873,9 @@ Function getSerbian(identifier As String) As String
|
|||
Case "inPageStyle"
|
||||
getSerbian = "стил странице"
|
||||
Exit Function
|
||||
Case "table"
|
||||
getSerbian = "стола"
|
||||
Exit Function
|
||||
Case Else
|
||||
getSerbian = "No translation"
|
||||
End Select
|
||||
|
@ -1075,6 +1087,9 @@ Function getBosnian(identifier As String) As String
|
|||
Case "inPageStyle"
|
||||
getBosnian = "stil stranice"
|
||||
Exit Function
|
||||
Case "table"
|
||||
getBosnian = "stola"
|
||||
Exit Function
|
||||
Case Else
|
||||
getBosnian = "No translation"
|
||||
End Select
|
||||
|
|
|
@ -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="Validation" script:language="StarBasic">Sub markval7
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval9
|
||||
|
||||
End Sub
|
||||
|
||||
|
@ -28,6 +28,7 @@ Sub validateButton
|
|||
Dim sectionsReport As String
|
||||
Dim outlinePageStylesReport As String
|
||||
Dim outlineInNotesReport As String
|
||||
Dim oulineInTablesReport As String
|
||||
Dim badText As Boolean
|
||||
Dim badNumberings As Boolean
|
||||
Dim needExtendedInfo As Boolean
|
||||
|
@ -40,9 +41,13 @@ Sub validateButton
|
|||
sectionsReport = checkSectionsInTables
|
||||
outlineInNotesReport = checkNotesOutline()
|
||||
outlinePageStylesReport = checkHeadingsInHeadersFooters
|
||||
oulineInTablesReport = checkHeadingsInTextTables
|
||||
If outlineInNotesReport <> "" Then
|
||||
MsgBox outlineInNotesReport
|
||||
EndIf
|
||||
If oulineInTablesReport <> "" Then
|
||||
MsgBox oulineInTablesReport
|
||||
EndIf
|
||||
If outlinePageStylesReport <> "" Then
|
||||
MsgBox outlinePageStylesReport
|
||||
EndIf
|
||||
|
@ -68,7 +73,7 @@ Sub validateButton
|
|||
|
||||
printNumberingSymbols(needExtendedInfo)
|
||||
|
||||
If badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR outlinePageStylesReport <> "" Then
|
||||
If badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR oulineInTablesReport <> "" OR outlinePageStylesReport <> "" Then
|
||||
MsgBox getTranslation("validationWarning")
|
||||
If badText Then
|
||||
MsgBox getTranslation("validationBadSymbolsNotification")
|
||||
|
@ -286,6 +291,85 @@ Function checkHeadingsInHeadersFooters As String
|
|||
checkHeadingsInHeadersFooters = result
|
||||
End Function
|
||||
|
||||
Function checkHeadingsInTextTables(oText As Object) As String
|
||||
Dim enum1Element As Object
|
||||
Dim enum1 As Object
|
||||
Dim enum2 As Object
|
||||
Dim thisPortion As Object
|
||||
Dim footnoteText As Object
|
||||
Dim label As String
|
||||
Dim labelNum As Integer
|
||||
Dim i As Integer
|
||||
Dim count As Integer
|
||||
Dim cell As Object
|
||||
Dim cellText As Object
|
||||
Dim firstCellName As String
|
||||
Dim result As String
|
||||
result = ""
|
||||
enum1 = ThisComponent.Text.createEnumeration
|
||||
While enum1.hasMoreElements
|
||||
enum1Element = enum1.nextElement
|
||||
If enum1Element.supportsService("com.sun.star.text.TextTable") Then
|
||||
firstCellName = enum1Element.getCellByPosition(0,0).cellName
|
||||
cellNames = enum1Element.cellNames
|
||||
For i = LBound(cellNames) To Ubound(cellNames)
|
||||
cell = enum1Element.getCellByName(cellNames(i))
|
||||
cellText = cell.getText()
|
||||
If cellNames(i) = firstCellName Then
|
||||
If isHeadingNotFirstInText(cellText) Then
|
||||
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("table") & " " & enum1Element.TableName & chr(10)
|
||||
EndIf
|
||||
Else
|
||||
If isHeadingsInText(cellText) Then
|
||||
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("table") & " " & enum1Element.TableName & chr(10)
|
||||
EndIf
|
||||
EndIf
|
||||
Next i
|
||||
EndIf
|
||||
Wend
|
||||
checkHeadingsInTextTables = result
|
||||
End Function
|
||||
|
||||
Function isHeadingNotFirstInText(oText As Object) As Boolean
|
||||
Dim enum1Element As Object
|
||||
Dim enum1 As Object
|
||||
Dim enum2 As Object
|
||||
Dim thisPortion As Object
|
||||
Dim footnoteText As Object
|
||||
Dim label As String
|
||||
Dim labelNum As Integer
|
||||
Dim i As Integer
|
||||
Dim count As Integer
|
||||
Dim cell As Object
|
||||
Dim cellText As Object
|
||||
Dim first As Boolean
|
||||
first = true
|
||||
enum1 = oText.createEnumeration
|
||||
While enum1.hasMoreElements
|
||||
enum1Element = enum1.nextElement
|
||||
If enum1Element.supportsService("com.sun.star.text.Paragraph") Then
|
||||
If Not first Then
|
||||
If enum1Element.OutlineLevel > 0 Then
|
||||
isHeadingNotFirstInText = true
|
||||
Exit Function
|
||||
EndIf
|
||||
EndIf
|
||||
ElseIf enum1Element.supportsService("com.sun.star.text.TextTable") Then
|
||||
cellNames = enum1Element.cellNames
|
||||
For i = LBound(cellNames) To Ubound(cellNames)
|
||||
cell = enum1Element.getCellByName(cellNames(i))
|
||||
cellText = cell.getText()
|
||||
If isHeadingsInText(cellText) Then
|
||||
isHeadingNotFirstInText = true
|
||||
Exit Function
|
||||
EndIf
|
||||
Next i
|
||||
EndIf
|
||||
first = false
|
||||
Wend
|
||||
isHeadingNotFirstInText = false
|
||||
End Function
|
||||
|
||||
Function isHeadingsInText(oText As Object) As Boolean
|
||||
Dim enum1Element As Object
|
||||
Dim enum1 As Object
|
||||
|
@ -322,7 +406,6 @@ Function isHeadingsInText(oText As Object) As Boolean
|
|||
isHeadingsInText = false
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub printNumberingSymbols(needExtendedInfo)
|
||||
Dim families As Object
|
||||
Dim numStyles As Object
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
def releaseVersion = "0.8.4"
|
||||
def releaseVersion = "0.8.5"
|
||||
task oxt(type: Zip) {
|
||||
dependsOn = [ 'setVersion','setVersionInBasicCode' ]
|
||||
from './'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:dep="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<identifier value="pro.litvinovg.Redaction"/>
|
||||
<version value="0.8.4"/>
|
||||
<version value="0.8.5"/>
|
||||
<platform value="all"/>
|
||||
<display-name>
|
||||
<name lang="en">Cleaning and validation documents for publishing in html and epub with pagination</name>
|
||||
|
|
BIN
translations.ods
BIN
translations.ods
Binary file not shown.
Loading…
Add table
Reference in a new issue