Use arrays as input for navigator dialog
This commit is contained in:
parent
3d07310e8a
commit
42682e4331
1 changed files with 24 additions and 10 deletions
|
@ -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 markval26
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval27
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -953,11 +953,13 @@ End Function
|
||||||
|
|
||||||
Function findBadCharacters() As Boolean
|
Function findBadCharacters() As Boolean
|
||||||
Dim founds As Object
|
Dim founds As Object
|
||||||
|
Dim foundObjects() As Object
|
||||||
founds = findInDoc("[\uE000-\uF8FF]+")
|
founds = findInDoc("[\uE000-\uF8FF]+")
|
||||||
findBadCharacters = false
|
findBadCharacters = false
|
||||||
If founds.count <> 0 Then
|
If founds.count <> 0 Then
|
||||||
MsgBox getTranslation("validationBadSymbolsNotification")
|
MsgBox getTranslation("validationBadSymbolsNotification")
|
||||||
startNavigatorDialog(getTranslation("badSymbols"),founds)
|
foundObjects = convertXIndexAccessToArray(founds)
|
||||||
|
startNavigatorDialog(getTranslation("badSymbols"),foundObjects)
|
||||||
findBadCharacters = true
|
findBadCharacters = true
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
|
@ -966,6 +968,7 @@ End Function
|
||||||
Function findColoredBackgroundInDoc() As Boolean
|
Function findColoredBackgroundInDoc() As Boolean
|
||||||
Dim founds As Object
|
Dim founds As Object
|
||||||
Dim sDesc As Object
|
Dim sDesc As Object
|
||||||
|
Dim foundObjects() As Object
|
||||||
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
|
||||||
SrchAttributes(0).Name = "CharBackTransparent"
|
SrchAttributes(0).Name = "CharBackTransparent"
|
||||||
SrchAttributes(0).Value = False
|
SrchAttributes(0).Value = False
|
||||||
|
@ -979,14 +982,15 @@ Function findColoredBackgroundInDoc() As Boolean
|
||||||
findColoredBackgroundInDoc = false
|
findColoredBackgroundInDoc = false
|
||||||
If founds.count <> 0 Then
|
If founds.count <> 0 Then
|
||||||
MsgBox getTranslation("foundColoredTextMessage")
|
MsgBox getTranslation("foundColoredTextMessage")
|
||||||
startNavigatorDialog(getTranslation("coloredTextDescription"),founds)
|
foundObjects = convertXIndexAccessToArray(founds)
|
||||||
|
startNavigatorDialog(getTranslation("coloredTextDescription"),foundObjects)
|
||||||
findColoredBackgroundInDoc = true
|
findColoredBackgroundInDoc = true
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Sub startNavigatorDialog(objectsDescription As String,founds As Object)
|
Sub startNavigatorDialog(objectsDescription As String,foundObjects() As Object)
|
||||||
Dim dialog As Object
|
Dim dialog As Object
|
||||||
Dim leftImageURL As String
|
Dim leftImageURL As String
|
||||||
Dim rightImageURL As String
|
Dim rightImageURL As String
|
||||||
|
@ -994,15 +998,13 @@ Sub startNavigatorDialog(objectsDescription As String,founds As Object)
|
||||||
Dim maxNum As Long
|
Dim maxNum As Long
|
||||||
Dim found As Object
|
Dim found As Object
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
|
||||||
'Mri founds
|
|
||||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||||
waitingForDialog = true
|
waitingForDialog = true
|
||||||
maxNum = founds.count - 1
|
maxNum = UBound(foundObjects)
|
||||||
dialog = notModalDialog("Navigator")
|
dialog = notModalDialog("Navigator")
|
||||||
dialog.getControl("found").SetText(getTranslation("navigatorFound") & CStr(maxNum+1))
|
dialog.getControl("found").SetText(getTranslation("navigatorFound") & CStr(maxNum+1))
|
||||||
curNum = 0
|
curNum = 0
|
||||||
found = founds.getByIndex(curNum)
|
found = foundObjects(curNum)
|
||||||
dialog.getControl("current").SetText(CStr(curNum+1))
|
dialog.getControl("current").SetText(CStr(curNum+1))
|
||||||
|
|
||||||
dialog.getControl("description").SetText(objectsDescription)
|
dialog.getControl("description").SetText(objectsDescription)
|
||||||
|
@ -1022,14 +1024,14 @@ Sub startNavigatorDialog(objectsDescription As String,founds As Object)
|
||||||
EndIf
|
EndIf
|
||||||
If dialog.getControl("prev").model.state = 1 then
|
If dialog.getControl("prev").model.state = 1 then
|
||||||
curNum = getPrevFound(curNum, maxNum)
|
curNum = getPrevFound(curNum, maxNum)
|
||||||
found = founds.getByIndex(curNum)
|
found = foundObjects(curNum)
|
||||||
oViewCursor.goToRange(found,false)
|
oViewCursor.goToRange(found,false)
|
||||||
dialog.getControl("current").SetText(CStr(curNum+1))
|
dialog.getControl("current").SetText(CStr(curNum+1))
|
||||||
dialog.getControl("prev").model.state = 0
|
dialog.getControl("prev").model.state = 0
|
||||||
EndIf
|
EndIf
|
||||||
If dialog.getControl("next").model.state = 1 then
|
If dialog.getControl("next").model.state = 1 then
|
||||||
curNum = getNextFound(curNum, maxNum)
|
curNum = getNextFound(curNum, maxNum)
|
||||||
found = founds.getByIndex(curNum)
|
found = foundObjects(curNum)
|
||||||
oViewCursor.goToRange(found,false)
|
oViewCursor.goToRange(found,false)
|
||||||
dialog.getControl("current").SetText(CStr(curNum+1))
|
dialog.getControl("current").SetText(CStr(curNum+1))
|
||||||
dialog.getControl("next").model.state = 0
|
dialog.getControl("next").model.state = 0
|
||||||
|
@ -1040,6 +1042,18 @@ Sub startNavigatorDialog(objectsDescription As String,founds As Object)
|
||||||
dialog.dispose
|
dialog.dispose
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Function convertXIndexAccessToArray(founds As Object) As Variant
|
||||||
|
Dim i As Integer
|
||||||
|
Dim maxNum As Integer
|
||||||
|
Dim arrayOfObjects() As Object
|
||||||
|
maxNum = founds.count - 1
|
||||||
|
For i = 0 To maxNum
|
||||||
|
addToArray(arrayOfObjects,founds.getByIndex(i))
|
||||||
|
Next i
|
||||||
|
convertXIndexAccessToArray = arrayOfObjects
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Function getNextFound(curNum As Long, max As Long) As Long
|
Function getNextFound(curNum As Long, max As Long) As Long
|
||||||
If curNum < max Then
|
If curNum < max Then
|
||||||
getNextFound = curNum + 1
|
getNextFound = curNum + 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue