Bugfixes
This commit is contained in:
parent
d1ab0c9de1
commit
3f8fd4f186
1 changed files with 36 additions and 8 deletions
|
@ -1,10 +1,9 @@
|
|||
<?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="Hyphenations" script:language="StarBasic">Private Sub markHyph2
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Hyphenations" script:language="StarBasic">Private Sub markHyph3
|
||||
End sub
|
||||
|
||||
Private Sub convertHyphInDoc()
|
||||
|
||||
Dim description As String
|
||||
Dim allNotes As Object
|
||||
dim aNote As Object
|
||||
|
@ -69,26 +68,32 @@ Private Sub convertHyphInText(textElement)
|
|||
End Sub
|
||||
|
||||
Private Sub convertParaHyphens(para)
|
||||
Dim lineEnd As String
|
||||
Dim lineEnds() As Object
|
||||
Dim autoHyphens() As Object
|
||||
Dim autoBreaks() As Object
|
||||
Dim lineNumbers() As Integer
|
||||
' Dim lineShifts() As Integer
|
||||
Dim charNum as Integer
|
||||
Dim lineLength As Integer
|
||||
Dim i As Integer
|
||||
Dim vCurs As Object
|
||||
Dim tCurs As Object
|
||||
Dim lineCurs As Object
|
||||
'No hyphenation needed
|
||||
If para.ParaIsHyphenation = false Then
|
||||
Exit Sub
|
||||
EndIf
|
||||
vCurs = ThisComponent.currentController.getViewCursor()
|
||||
vCurs.goToRange(para.Anchor,false)
|
||||
tCurs = vCurs.Text.createTextCursorByRange(vCurs)
|
||||
vCurs.goToRange(para.Start,false)
|
||||
tCurs = para.Text.createTextCursorByRange(vCurs)
|
||||
tCurs.goToStartOfParagraph(false)
|
||||
vCurs.goToRange(tCurs,false)
|
||||
i = 0
|
||||
Do While NOT tCurs.isEndOfParagraph() OR NOT tCurs.isStartOfParagraph()
|
||||
vCurs.gotoEndOfLine(true)
|
||||
lineLength = Len(vCurs.String)
|
||||
vCurs.gotoEndOfLine(false)
|
||||
lineCursor = para.Text.createTextCursorByRange(vCurs.End)
|
||||
lineCursor.goToRange(tCurs,true)
|
||||
lineLength = Len(lineCursor.String)
|
||||
vCurs.collapseToEnd()
|
||||
i = i + 1
|
||||
tCurs.goToRange(vCurs.End,false)
|
||||
|
@ -110,10 +115,15 @@ Private Sub convertParaHyphens(para)
|
|||
If needHyphen(lastChar,nextChar,lineLength) Then
|
||||
addToArray(autoHyphens(),tCurs.Text.createTextCursorByRange(tCurs))
|
||||
addToArray(lineNumbers(),i)
|
||||
' addToArray(lineShifts(),1)
|
||||
'replaceHyphen(tCurs,vCurs)
|
||||
ElseIf needLineBreak(lastChar,newChar) Then
|
||||
addToArray(autoBreaks(),tCurs.Text.createTextCursorByRange(tCurs))
|
||||
' addToArray(lineShifts(),1)
|
||||
Else
|
||||
' addToArray(lineShifts(),0)
|
||||
EndIf
|
||||
addToArray(lineEnds(),tCurs.Text.createTextCursorByRange(tCurs))
|
||||
tCurs.goRight(1,false)
|
||||
vCurs.goToRange(tCurs,false)
|
||||
Loop
|
||||
|
@ -129,9 +139,27 @@ Private Sub convertParaHyphens(para)
|
|||
replaceHyphen(autoHyphens(i),lineNumbers(i))
|
||||
Next i
|
||||
EndIf
|
||||
' verifyHyphenation(lineEnds,lineShifts)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub verifyHyphenation(lineEnds() As Object)
|
||||
Dim i As Integer
|
||||
If Lbound(lineEnds) > Ubound(lineEnds) Then
|
||||
Exit Sub
|
||||
EndIf
|
||||
Dim vCurs As Object
|
||||
vCurs = ThisComponent.currentController.getViewCursor()
|
||||
For i = (Lbound(lineEnds)) To (Ubound(lineEnds))
|
||||
vCurs.goToRange(lineEnds(i),false)
|
||||
If NOT (vCurs.isAtEndOfLine() OR vCurs.isAtStartOfLine()) Then
|
||||
MsgBox "Конвертация прервана. Обратитесь к разработчику."
|
||||
Stop
|
||||
EndIf
|
||||
Next i
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub insertBreak(tCursor As Object)
|
||||
'U+200B Zero length space
|
||||
tCursor.String = ""
|
||||
|
|
Loading…
Add table
Reference in a new issue