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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
<!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"
|
<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()
|
Function initRedactionConfiguration()
|
||||||
On Error Goto exceptionHandler
|
On Error Goto exceptionHandler
|
||||||
Dim regFactory As Object
|
Dim regFactory As Object
|
||||||
|
|
|
@ -230,6 +230,9 @@ Function getRussian(identifier As String) As String
|
||||||
Case "inPageStyle"
|
Case "inPageStyle"
|
||||||
getRussian = "стиля страниц"
|
getRussian = "стиля страниц"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "table"
|
||||||
|
getRussian = "таблице"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getRussian = "Перевод не найден"
|
getRussian = "Перевод не найден"
|
||||||
End Select
|
End Select
|
||||||
|
@ -442,6 +445,9 @@ Function getEnglish(identifier As String) As String
|
||||||
Case "inPageStyle"
|
Case "inPageStyle"
|
||||||
getEnglish = "of page style"
|
getEnglish = "of page style"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "table"
|
||||||
|
getEnglish = "table"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getEnglish = "No translation"
|
getEnglish = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -653,6 +659,9 @@ Function getCroatian(identifier As String) As String
|
||||||
Case "inPageStyle"
|
Case "inPageStyle"
|
||||||
getCroatian = "stil stranice"
|
getCroatian = "stil stranice"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "table"
|
||||||
|
getCroatian = "stola"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getCroatian = "No translation"
|
getCroatian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -864,6 +873,9 @@ Function getSerbian(identifier As String) As String
|
||||||
Case "inPageStyle"
|
Case "inPageStyle"
|
||||||
getSerbian = "стил странице"
|
getSerbian = "стил странице"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "table"
|
||||||
|
getSerbian = "стола"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getSerbian = "No translation"
|
getSerbian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -1075,6 +1087,9 @@ Function getBosnian(identifier As String) As String
|
||||||
Case "inPageStyle"
|
Case "inPageStyle"
|
||||||
getBosnian = "stil stranice"
|
getBosnian = "stil stranice"
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "table"
|
||||||
|
getBosnian = "stola"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getBosnian = "No translation"
|
getBosnian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
<!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
|
End Sub
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ Sub validateButton
|
||||||
Dim sectionsReport As String
|
Dim sectionsReport As String
|
||||||
Dim outlinePageStylesReport As String
|
Dim outlinePageStylesReport As String
|
||||||
Dim outlineInNotesReport As String
|
Dim outlineInNotesReport As String
|
||||||
|
Dim oulineInTablesReport As String
|
||||||
Dim badText As Boolean
|
Dim badText As Boolean
|
||||||
Dim badNumberings As Boolean
|
Dim badNumberings As Boolean
|
||||||
Dim needExtendedInfo As Boolean
|
Dim needExtendedInfo As Boolean
|
||||||
|
@ -40,9 +41,13 @@ Sub validateButton
|
||||||
sectionsReport = checkSectionsInTables
|
sectionsReport = checkSectionsInTables
|
||||||
outlineInNotesReport = checkNotesOutline()
|
outlineInNotesReport = checkNotesOutline()
|
||||||
outlinePageStylesReport = checkHeadingsInHeadersFooters
|
outlinePageStylesReport = checkHeadingsInHeadersFooters
|
||||||
|
oulineInTablesReport = checkHeadingsInTextTables
|
||||||
If outlineInNotesReport <> "" Then
|
If outlineInNotesReport <> "" Then
|
||||||
MsgBox outlineInNotesReport
|
MsgBox outlineInNotesReport
|
||||||
EndIf
|
EndIf
|
||||||
|
If oulineInTablesReport <> "" Then
|
||||||
|
MsgBox oulineInTablesReport
|
||||||
|
EndIf
|
||||||
If outlinePageStylesReport <> "" Then
|
If outlinePageStylesReport <> "" Then
|
||||||
MsgBox outlinePageStylesReport
|
MsgBox outlinePageStylesReport
|
||||||
EndIf
|
EndIf
|
||||||
|
@ -68,7 +73,7 @@ Sub validateButton
|
||||||
|
|
||||||
printNumberingSymbols(needExtendedInfo)
|
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")
|
MsgBox getTranslation("validationWarning")
|
||||||
If badText Then
|
If badText Then
|
||||||
MsgBox getTranslation("validationBadSymbolsNotification")
|
MsgBox getTranslation("validationBadSymbolsNotification")
|
||||||
|
@ -286,6 +291,85 @@ Function checkHeadingsInHeadersFooters As String
|
||||||
checkHeadingsInHeadersFooters = result
|
checkHeadingsInHeadersFooters = result
|
||||||
End Function
|
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
|
Function isHeadingsInText(oText As Object) As Boolean
|
||||||
Dim enum1Element As Object
|
Dim enum1Element As Object
|
||||||
Dim enum1 As Object
|
Dim enum1 As Object
|
||||||
|
@ -322,7 +406,6 @@ Function isHeadingsInText(oText As Object) As Boolean
|
||||||
isHeadingsInText = false
|
isHeadingsInText = false
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Private Sub printNumberingSymbols(needExtendedInfo)
|
Private Sub printNumberingSymbols(needExtendedInfo)
|
||||||
Dim families As Object
|
Dim families As Object
|
||||||
Dim numStyles As Object
|
Dim numStyles As Object
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
def releaseVersion = "0.8.4"
|
def releaseVersion = "0.8.5"
|
||||||
task oxt(type: Zip) {
|
task oxt(type: Zip) {
|
||||||
dependsOn = [ 'setVersion','setVersionInBasicCode' ]
|
dependsOn = [ 'setVersion','setVersionInBasicCode' ]
|
||||||
from './'
|
from './'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?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">
|
<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"/>
|
<identifier value="pro.litvinovg.Redaction"/>
|
||||||
<version value="0.8.4"/>
|
<version value="0.8.5"/>
|
||||||
<platform value="all"/>
|
<platform value="all"/>
|
||||||
<display-name>
|
<display-name>
|
||||||
<name lang="en">Cleaning and validation documents for publishing in html and epub with pagination</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