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,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue