Added check for sections in tables

This commit is contained in:
Georgy Litvinov 2020-07-06 09:43:46 +02:00
parent 6c42e2b6b3
commit 6059460ced
7 changed files with 63 additions and 5 deletions

View file

@ -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 = &quot;cleanAndValidate&quot;
Public Const redactionExtensionVersion = &quot;0.8.2&quot;
Public Const redactionExtensionVersion = &quot;0.8.3&quot;
Function initRedactionConfiguration()
On Error Goto exceptionHandler
Dim regFactory As Object

View file

@ -212,6 +212,12 @@ Function getRussian(identifier As String) As String
Case &quot;setOutlineLevel&quot;
getRussian = &quot;задан уровень структуры документа&quot;
Exit Function
Case &quot;section&quot;
getRussian = &quot;Раздел&quot;
Exit Function
Case &quot;isInTable&quot;
getRussian = &quot;находится внутри таблицы.&quot;
Exit Function
Case Else
getRussian = &quot;Перевод не найден&quot;
End Select
@ -406,6 +412,12 @@ Function getEnglish(identifier As String) As String
Case &quot;setOutlineLevel&quot;
getEnglish = &quot;set document structure level&quot;
Exit Function
Case &quot;section&quot;
getEnglish = &quot;Section&quot;
Exit Function
Case &quot;isInTable&quot;
getEnglish = &quot;located inside the table.&quot;
Exit Function
Case Else
getEnglish = &quot;No translation&quot;
End Select
@ -599,6 +611,12 @@ Function getCroatian(identifier As String) As String
Case &quot;setOutlineLevel&quot;
getCroatian = &quot;zadati uroven strukturni dokument&quot;
Exit Function
Case &quot;section&quot;
getCroatian = &quot;Odjeljak&quot;
Exit Function
Case &quot;isInTable&quot;
getCroatian = &quot;smještene unutar stola.&quot;
Exit Function
Case Else
getCroatian = &quot;No translation&quot;
End Select
@ -792,6 +810,12 @@ Function getSerbian(identifier As String) As String
Case &quot;setOutlineLevel&quot;
getSerbian = &quot;задатен уровен структури документа&quot;
Exit Function
Case &quot;section&quot;
getSerbian = &quot;Одјељак&quot;
Exit Function
Case &quot;isInTable&quot;
getSerbian = &quot;смештене унутар стола.&quot;
Exit Function
Case Else
getSerbian = &quot;No translation&quot;
End Select
@ -985,6 +1009,12 @@ Function getBosnian(identifier As String) As String
Case &quot;setOutlineLevel&quot;
getBosnian = &quot;zadati uroven strukturni dokument&quot;
Exit Function
Case &quot;section&quot;
getBosnian = &quot;Odjeljak&quot;
Exit Function
Case &quot;isInTable&quot;
getBosnian = &quot;smještene unutar stola.&quot;
Exit Function
Case Else
getBosnian = &quot;No translation&quot;
End Select

View file

@ -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 markval5
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval6
End Sub
@ -25,6 +25,7 @@ End Function
Sub validateButton
Dim footnotesReport As String
Dim graphicsReport As String
Dim sectionsReport As String
Dim outlineInNotesReport As String
Dim badText As Boolean
Dim badNumberings As Boolean
@ -35,6 +36,7 @@ Sub validateButton
badNumberings = false
footnotesReport = noteSingsCheck
graphicsReport = checkGraphics
sectionsReport = checkSectionsInTables
outlineInNotesReport = checkNotesOutline()
If outlineInNotesReport &lt;&gt; &quot;&quot; Then
MsgBox outlineInNotesReport
@ -45,6 +47,9 @@ Sub validateButton
If graphicsReport &lt;&gt; &quot;&quot; Then
MsgBox graphicsReport
EndIf
If sectionsReport &lt;&gt; &quot;&quot; Then
MsgBox sectionsReport
EndIf
If isInDoc(&quot;[\uE000-\uF8FF]&quot;) Then
badText = true
EndIf
@ -57,7 +62,7 @@ Sub validateButton
printNumberingSymbols(needExtendedInfo)
If badText OR badNumberings OR footnotesReport &lt;&gt; &quot;&quot; OR graphicsReport &lt;&gt; &quot;&quot; Or outlineInNotesReport &lt;&gt; &quot;&quot; Then
If badText OR badNumberings OR footnotesReport &lt;&gt; &quot;&quot; OR graphicsReport &lt;&gt; &quot;&quot; Or outlineInNotesReport &lt;&gt; &quot;&quot; Or sectionsReport &lt;&gt; &quot;&quot; Then
MsgBox getTranslation(&quot;validationWarning&quot;)
If badText Then
MsgBox getTranslation(&quot;validationBadSymbolsNotification&quot;)
@ -165,6 +170,7 @@ End Function
Function checkNotesOutline As String
Dim oDescriptor As Object
Dim footNotes As Object
Dim endNotes As Object
Dim x As Integer
Dim aNote As Object
Dim oEnum As Object
@ -198,6 +204,27 @@ Function checkNotesOutline As String
checkNotesOutline = result
End Function
Function checkSectionsInTables As String
Dim x As Integer
Dim oEnum As Object
Dim result As String
Dim sections As Object
Dim section As Object
Dim anchor As Object
Dim anchorText As Object
result = &quot;&quot;
sections = thisComponent.TextSections
for x = 0 to sections.Count -1
section = sections.getByIndex(x)
anchor = section.getAnchor()
anchorText = anchor.getText()
If anchorText.supportsService(&quot;com.sun.star.text.CellProperties&quot;) Then
result = result &amp; getTranslation(&quot;section&quot;) &amp; &quot; &quot; &amp; section.Name &amp; &quot; &quot; &amp; getTranslation(&quot;isInTable&quot;) &amp; chr(10)
EndIf
Next
checkSectionsInTables = result
End Function
Private Sub printNumberingSymbols(needExtendedInfo)
Dim families As Object
Dim numStyles As Object

View file

@ -1,4 +1,4 @@
def releaseVersion = "0.8.2"
def releaseVersion = "0.8.3"
task oxt(type: Zip) {
dependsOn = [ 'setVersion','setVersionInBasicCode' ]
from './'

View file

@ -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.2"/>
<version value="0.8.3"/>
<platform value="all"/>
<display-name>
<name lang="en">Cleaning and validation documents for publishing in html and epub with pagination</name>

View file

@ -1,3 +1,4 @@
0.8.3 Added check for sections in tables
0.7.19 Do not try to clean in read only mode
0.7.16 Added timestamp to document properties after cleaning
0.7.14 Search for formatting in styles

Binary file not shown.