Added check for headings in footers and headers
This commit is contained in:
parent
6059460ced
commit
15a5bd6f0d
7 changed files with 164 additions and 5 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.3"
|
Public Const redactionExtensionVersion = "0.8.4"
|
||||||
Function initRedactionConfiguration()
|
Function initRedactionConfiguration()
|
||||||
On Error Goto exceptionHandler
|
On Error Goto exceptionHandler
|
||||||
Dim regFactory As Object
|
Dim regFactory As Object
|
||||||
|
|
|
@ -218,6 +218,18 @@ Function getRussian(identifier As String) As String
|
||||||
Case "isInTable"
|
Case "isInTable"
|
||||||
getRussian = "находится внутри таблицы."
|
getRussian = "находится внутри таблицы."
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "foundHeadingIn"
|
||||||
|
getRussian = "Найден заголовок в"
|
||||||
|
Exit Function
|
||||||
|
Case "inHeader"
|
||||||
|
getRussian = "верхнем колонтитуле"
|
||||||
|
Exit Function
|
||||||
|
Case "inFooter"
|
||||||
|
getRussian = "нижнем колонтитуле"
|
||||||
|
Exit Function
|
||||||
|
Case "inPageStyle"
|
||||||
|
getRussian = "стиля страниц"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getRussian = "Перевод не найден"
|
getRussian = "Перевод не найден"
|
||||||
End Select
|
End Select
|
||||||
|
@ -418,6 +430,18 @@ Function getEnglish(identifier As String) As String
|
||||||
Case "isInTable"
|
Case "isInTable"
|
||||||
getEnglish = "located inside the table."
|
getEnglish = "located inside the table."
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "foundHeadingIn"
|
||||||
|
getEnglish = "Found heading in"
|
||||||
|
Exit Function
|
||||||
|
Case "inHeader"
|
||||||
|
getEnglish = "header"
|
||||||
|
Exit Function
|
||||||
|
Case "inFooter"
|
||||||
|
getEnglish = "footer"
|
||||||
|
Exit Function
|
||||||
|
Case "inPageStyle"
|
||||||
|
getEnglish = "of page style"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getEnglish = "No translation"
|
getEnglish = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -617,6 +641,18 @@ Function getCroatian(identifier As String) As String
|
||||||
Case "isInTable"
|
Case "isInTable"
|
||||||
getCroatian = "smještene unutar stola."
|
getCroatian = "smještene unutar stola."
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "foundHeadingIn"
|
||||||
|
getCroatian = "Naslov pronađen u"
|
||||||
|
Exit Function
|
||||||
|
Case "inHeader"
|
||||||
|
getCroatian = "zaglavlje"
|
||||||
|
Exit Function
|
||||||
|
Case "inFooter"
|
||||||
|
getCroatian = "podnožje"
|
||||||
|
Exit Function
|
||||||
|
Case "inPageStyle"
|
||||||
|
getCroatian = "stil stranice"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getCroatian = "No translation"
|
getCroatian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -816,6 +852,18 @@ Function getSerbian(identifier As String) As String
|
||||||
Case "isInTable"
|
Case "isInTable"
|
||||||
getSerbian = "смештене унутар стола."
|
getSerbian = "смештене унутар стола."
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "foundHeadingIn"
|
||||||
|
getSerbian = "Наслов пронађен у"
|
||||||
|
Exit Function
|
||||||
|
Case "inHeader"
|
||||||
|
getSerbian = "хеадер"
|
||||||
|
Exit Function
|
||||||
|
Case "inFooter"
|
||||||
|
getSerbian = "фоотер"
|
||||||
|
Exit Function
|
||||||
|
Case "inPageStyle"
|
||||||
|
getSerbian = "стил странице"
|
||||||
|
Exit Function
|
||||||
Case Else
|
Case Else
|
||||||
getSerbian = "No translation"
|
getSerbian = "No translation"
|
||||||
End Select
|
End Select
|
||||||
|
@ -1015,6 +1063,18 @@ Function getBosnian(identifier As String) As String
|
||||||
Case "isInTable"
|
Case "isInTable"
|
||||||
getBosnian = "smještene unutar stola."
|
getBosnian = "smještene unutar stola."
|
||||||
Exit Function
|
Exit Function
|
||||||
|
Case "foundHeadingIn"
|
||||||
|
getBosnian = "Naslov pronađen u"
|
||||||
|
Exit Function
|
||||||
|
Case "inHeader"
|
||||||
|
getBosnian = "zaglavlje"
|
||||||
|
Exit Function
|
||||||
|
Case "inFooter"
|
||||||
|
getBosnian = "podnožje"
|
||||||
|
Exit Function
|
||||||
|
Case "inPageStyle"
|
||||||
|
getBosnian = "stil stranice"
|
||||||
|
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 markval6
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval7
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ Sub validateButton
|
||||||
Dim footnotesReport As String
|
Dim footnotesReport As String
|
||||||
Dim graphicsReport As String
|
Dim graphicsReport As String
|
||||||
Dim sectionsReport As String
|
Dim sectionsReport As String
|
||||||
|
Dim outlinePageStylesReport As String
|
||||||
Dim outlineInNotesReport As String
|
Dim outlineInNotesReport As String
|
||||||
Dim badText As Boolean
|
Dim badText As Boolean
|
||||||
Dim badNumberings As Boolean
|
Dim badNumberings As Boolean
|
||||||
|
@ -38,9 +39,14 @@ Sub validateButton
|
||||||
graphicsReport = checkGraphics
|
graphicsReport = checkGraphics
|
||||||
sectionsReport = checkSectionsInTables
|
sectionsReport = checkSectionsInTables
|
||||||
outlineInNotesReport = checkNotesOutline()
|
outlineInNotesReport = checkNotesOutline()
|
||||||
|
outlinePageStylesReport = checkHeadingsInHeadersFooters
|
||||||
If outlineInNotesReport <> "" Then
|
If outlineInNotesReport <> "" Then
|
||||||
MsgBox outlineInNotesReport
|
MsgBox outlineInNotesReport
|
||||||
EndIf
|
EndIf
|
||||||
|
If outlinePageStylesReport <> "" Then
|
||||||
|
MsgBox outlinePageStylesReport
|
||||||
|
EndIf
|
||||||
|
|
||||||
If footnotesReport <> "" Then
|
If footnotesReport <> "" Then
|
||||||
MsgBox footnotesReport
|
MsgBox footnotesReport
|
||||||
EndIf
|
EndIf
|
||||||
|
@ -62,7 +68,7 @@ Sub validateButton
|
||||||
|
|
||||||
printNumberingSymbols(needExtendedInfo)
|
printNumberingSymbols(needExtendedInfo)
|
||||||
|
|
||||||
If badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" Then
|
If badText OR badNumberings OR footnotesReport <> "" OR graphicsReport <> "" Or outlineInNotesReport <> "" Or sectionsReport <> "" OR outlinePageStylesReport <> "" Then
|
||||||
MsgBox getTranslation("validationWarning")
|
MsgBox getTranslation("validationWarning")
|
||||||
If badText Then
|
If badText Then
|
||||||
MsgBox getTranslation("validationBadSymbolsNotification")
|
MsgBox getTranslation("validationBadSymbolsNotification")
|
||||||
|
@ -225,6 +231,98 @@ Function checkSectionsInTables As String
|
||||||
checkSectionsInTables = result
|
checkSectionsInTables = result
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Function checkHeadingsInHeadersFooters As String
|
||||||
|
Dim result As String
|
||||||
|
Dim count As Integer
|
||||||
|
Dim oStyle As Object
|
||||||
|
Dim i As Integer
|
||||||
|
result = ""
|
||||||
|
Dim pageStyles As Object
|
||||||
|
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
||||||
|
count = pageStyles.count - 1
|
||||||
|
For i = 0 to count
|
||||||
|
oStyle = pageStyles.getByIndex(i)
|
||||||
|
If oStyle.isInUse Then
|
||||||
|
If oStyle.HeaderIsOn Then
|
||||||
|
If oStyle.HeaderIsShared Then
|
||||||
|
If isHeadingsInText(oStyle.HeaderText) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inHeader") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
Else
|
||||||
|
If isHeadingsInText(oStyle.HeaderTextLeft) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inHeader") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
If isHeadingsInText(oStyle.HeaderTextRight) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inHeader") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
If NOT oStyle.FirstIsShared Then
|
||||||
|
If isHeadingsInText(oStyle.HeaderTextFirst) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inHeader") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
If oStyle.FooterIsOn Then
|
||||||
|
If oStyle.FooterIsShared Then
|
||||||
|
If isHeadingsInText(oStyle.FooterText) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inFooter") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
Else
|
||||||
|
If isHeadingsInText(oStyle.FooterTextLeft) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inFooter") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
If isHeadingsInText(oStyle.FooterTextRight) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inFooter") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
If NOT oStyle.FirstIsShared Then
|
||||||
|
If isHeadingsInText(oStyle.FooterTextFirst) Then
|
||||||
|
result = result & getTranslation("foundHeadingIn") & " " & getTranslation("inFooter") & " " & getTranslation("inPageStyle") & " " & oStyle.getName() & chr(10)
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
EndIf
|
||||||
|
Next i
|
||||||
|
checkHeadingsInHeadersFooters = result
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function isHeadingsInText(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
|
||||||
|
enum1 = oText.Text.createEnumeration
|
||||||
|
While enum1.hasMoreElements
|
||||||
|
enum1Element = enum1.nextElement
|
||||||
|
If enum1Element.supportsService("com.sun.star.text.Paragraph") Then
|
||||||
|
If enum1Element.OutlineLevel > 0 Then
|
||||||
|
isHeadingsInText = true
|
||||||
|
Exit Function
|
||||||
|
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
|
||||||
|
isHeadingsInText = true
|
||||||
|
Exit Function
|
||||||
|
EndIf
|
||||||
|
Next i
|
||||||
|
EndIf
|
||||||
|
Wend
|
||||||
|
isHeadingsInText = false
|
||||||
|
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.3"
|
def releaseVersion = "0.8.4"
|
||||||
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.3"/>
|
<version value="0.8.4"/>
|
||||||
<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>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
0.8.4 Added check for headings in footers and headers
|
||||||
0.8.3 Added check for sections in tables
|
0.8.3 Added check for sections in tables
|
||||||
0.7.19 Do not try to clean in read only mode
|
0.7.19 Do not try to clean in read only mode
|
||||||
0.7.16 Added timestamp to document properties after cleaning
|
0.7.16 Added timestamp to document properties after cleaning
|
||||||
|
|
BIN
translations.ods
BIN
translations.ods
Binary file not shown.
Loading…
Add table
Reference in a new issue