Code cleaning
This commit is contained in:
parent
52a5b70bbf
commit
dd90a5b726
6 changed files with 102 additions and 80 deletions
|
@ -3,7 +3,7 @@
|
||||||
xmlns:dep="http://openoffice.org/extensions/description/2006"
|
xmlns:dep="http://openoffice.org/extensions/description/2006"
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<identifier value="pro.litvinovg.epublishing" />
|
<identifier value="pro.litvinovg.epublishing" />
|
||||||
<version value="0.2.5" />
|
<version value="0.2.6" />
|
||||||
<platform value="all" />
|
<platform value="all" />
|
||||||
<display-name>
|
<display-name>
|
||||||
<name lang="ru">Инструменты для создания электронных изданий</name>
|
<name lang="ru">Инструменты для создания электронных изданий</name>
|
||||||
|
|
|
@ -79,6 +79,7 @@ Sub replacePageStyleByPortrait(pageStyleName As String)
|
||||||
Dim oldPageStyle As Object
|
Dim oldPageStyle As Object
|
||||||
Dim textEnumeration As Object
|
Dim textEnumeration As Object
|
||||||
Dim enumerationElement As Object
|
Dim enumerationElement As Object
|
||||||
|
Dim i As Integer
|
||||||
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
||||||
oldPageStyle = pageStyles.getByName(pageStyleName)
|
oldPageStyle = pageStyles.getByName(pageStyleName)
|
||||||
For i = 0 To pageStyles.getCount() - 1
|
For i = 0 To pageStyles.getCount() - 1
|
||||||
|
|
|
@ -5,14 +5,19 @@
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub resetNotesStyle
|
Sub resetNotesStyle
|
||||||
Dim oDescriptor 'The search descriptor
|
Dim oDescriptor As Object
|
||||||
dim dispatcher as Object
|
Dim dispatcher As Object
|
||||||
|
Dim x As Integer
|
||||||
|
Dim oViewCursor As Object
|
||||||
|
Dim document As Object
|
||||||
|
Dim allNotes As Object
|
||||||
|
Dim aNote As Object
|
||||||
|
Dim oEnum As Object
|
||||||
|
Dim oCurPar As Object
|
||||||
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||||
dim document as Object
|
|
||||||
document = ThisComponent.CurrentController.Frame
|
document = ThisComponent.CurrentController.Frame
|
||||||
Dim oViewCursor As Object 'View cursor
|
|
||||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||||
allNotes= thisComponent.FootNotes
|
allNotes = thisComponent.FootNotes
|
||||||
for x = 0 to allNotes.Count -1
|
for x = 0 to allNotes.Count -1
|
||||||
aNote = allNotes.getByIndex(x)
|
aNote = allNotes.getByIndex(x)
|
||||||
aNote.Anchor.CharStyleName="Footnote anchor"
|
aNote.Anchor.CharStyleName="Footnote anchor"
|
||||||
|
@ -100,14 +105,15 @@ Function RND_String
|
||||||
OutputString=""
|
OutputString=""
|
||||||
randomize
|
randomize
|
||||||
|
|
||||||
for i = 1 to 20
|
For i = 1 to 20
|
||||||
|
|
||||||
Select Case i
|
Select Case i
|
||||||
Case 5, 8, 11, 14
|
Case 5, 8, 11, 14
|
||||||
OutputString=OutputString+"-"
|
OutputString=OutputString+"-"
|
||||||
Case Else
|
Case Else
|
||||||
TempString=Hex(int(rnd*256))
|
TempString=Hex(int(rnd*256))
|
||||||
if len(TempString)<2 then TempString=TempString+"0"
|
If len(TempString) < 2 Then
|
||||||
|
TempString=TempString+"0"
|
||||||
|
EndIf
|
||||||
OutputString=OutputString+TempString
|
OutputString=OutputString+TempString
|
||||||
End Select
|
End Select
|
||||||
next i
|
next i
|
||||||
|
@ -312,10 +318,10 @@ Sub convertBookmarksToFootnotes()
|
||||||
Dim backward As Object
|
Dim backward As Object
|
||||||
linkPrefix = "footnote-"
|
linkPrefix = "footnote-"
|
||||||
backLinkSuffix = "-backlink"
|
backLinkSuffix = "-backlink"
|
||||||
|
Dim i As Integer
|
||||||
|
|
||||||
bookmarkName = ThisComponent.Links.ElementNames(6)
|
bookmarkName = ThisComponent.Links.ElementNames(6)
|
||||||
bookmarks = ThisComponent.Links.getByName(bookmarkName)
|
bookmarks = ThisComponent.Links.getByName(bookmarkName)
|
||||||
' Mri bookmarks
|
|
||||||
bookmarkNames = bookmarks.getElementNames()
|
bookmarkNames = bookmarks.getElementNames()
|
||||||
For i = LBound(bookmarkNames) To Ubound(bookmarkNames)
|
For i = LBound(bookmarkNames) To Ubound(bookmarkNames)
|
||||||
bookmarkName = bookmarkNames(i)
|
bookmarkName = bookmarkNames(i)
|
||||||
|
@ -423,7 +429,7 @@ Sub replaceParaStyle
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
Dim enum1 As Object
|
Dim enum1 As Object
|
||||||
Dim oTextCursor As Object
|
Dim oTextCursor As Object
|
||||||
|
Dim i As Integer
|
||||||
oStyles = ThisComponent.StyleFamilies
|
oStyles = ThisComponent.StyleFamilies
|
||||||
paraStyles = oStyles.getByName(oStyles.elementNames(1))
|
paraStyles = oStyles.getByName(oStyles.elementNames(1))
|
||||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||||
|
@ -484,7 +490,10 @@ Sub replaceParaStyle
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
function getIndex(a, v)
|
Function getIndex(a, v)
|
||||||
|
Dim id As Integer
|
||||||
|
Dim nRight As Integer
|
||||||
|
Dim nLen As Integer
|
||||||
id = 0
|
id = 0
|
||||||
nRight = uBound(a)
|
nRight = uBound(a)
|
||||||
nLen = len(v)
|
nLen = len(v)
|
||||||
|
@ -497,34 +506,42 @@ function getIndex(a, v)
|
||||||
end if
|
end if
|
||||||
wend
|
wend
|
||||||
getIndex = -1
|
getIndex = -1
|
||||||
end function
|
End Function
|
||||||
|
|
||||||
sub subShellSort(mArray)
|
Sub subShellSort(mArray)
|
||||||
|
|
||||||
dim n as integer, h as integer, i as integer, j as integer, t as string, Ub as integer, LB as Integer
|
Dim n As Integer
|
||||||
|
Dim h As Integer
|
||||||
|
Dim i As Integer
|
||||||
|
Dim j As Integer
|
||||||
|
Dim t As String
|
||||||
|
Dim Ub As Integer
|
||||||
|
Dim LB As Integer
|
||||||
Lb = lBound(mArray)
|
Lb = lBound(mArray)
|
||||||
Ub = uBound(mArray)
|
Ub = uBound(mArray)
|
||||||
|
|
||||||
' compute largest increment
|
' compute largest increment
|
||||||
n = Ub - Lb + 1
|
n = Ub - Lb + 1
|
||||||
h = 1
|
h = 1
|
||||||
if n > 14 then
|
If n > 14 then
|
||||||
do while h < n
|
do while h < n
|
||||||
h = 3 * h + 1
|
h = 3 * h + 1
|
||||||
loop
|
loop
|
||||||
h = h \ 3
|
h = h \ 3
|
||||||
h = h \ 3
|
h = h \ 3
|
||||||
end if
|
End If
|
||||||
do while h > 0
|
Do While h > 0
|
||||||
for i = Lb + h to Ub
|
For i = Lb + h to Ub
|
||||||
t = mArray(i)
|
t = mArray(i)
|
||||||
for j = i - h to Lb step -h
|
For j = i - h to Lb step -h
|
||||||
if strComp(mArray(j), t, 0) < 1 then exit for
|
If strComp(mArray(j), t, 0) < 1 then
|
||||||
|
Exit For
|
||||||
|
EndIf
|
||||||
mArray(j + h) = mArray(j)
|
mArray(j + h) = mArray(j)
|
||||||
next j
|
Next j
|
||||||
mArray(j + h) = t
|
mArray(j + h) = t
|
||||||
next i
|
Next i
|
||||||
h = h \ 3
|
h = h \ 3
|
||||||
loop
|
Loop
|
||||||
end sub
|
End Sub
|
||||||
</script:module>
|
</script:module>
|
|
@ -130,6 +130,8 @@ Sub setFootnotesNumberingLevel(level)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub doNotTrack
|
Private Sub doNotTrack
|
||||||
|
Dim dispatcher As Object
|
||||||
|
Dim document As Object
|
||||||
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
||||||
document = ThisComponent.CurrentController.Frame
|
document = ThisComponent.CurrentController.Frame
|
||||||
dim trackProperties(0) as new com.sun.star.beans.PropertyValue
|
dim trackProperties(0) as new com.sun.star.beans.PropertyValue
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<?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="TOCLinks" script:language="StarBasic" script:moduleType="normal">Sub markTOC2
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="TOCLinks" script:language="StarBasic" script:moduleType="normal">Sub markTOC4
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub makeOutlineLinks
|
Sub makeOutlineLinks
|
||||||
|
Dim i As Integer
|
||||||
For i = 1 To 10
|
For i = 1 To 10
|
||||||
makeLinksWithLevel(i)
|
makeLinksWithLevel(i)
|
||||||
Next i
|
Next i
|
||||||
|
@ -100,6 +101,7 @@ Function getOutlineWithLevel(curNum)
|
||||||
Dim cellEnum2 As Object
|
Dim cellEnum2 As Object
|
||||||
Dim par() As Object
|
Dim par() As Object
|
||||||
Dim parName As String
|
Dim parName As String
|
||||||
|
Dim cellEnumElement As Object
|
||||||
parName = "Contents " + curNum
|
parName = "Contents " + curNum
|
||||||
enum1 = ThisComponent.Text.createEnumeration
|
enum1 = ThisComponent.Text.createEnumeration
|
||||||
While enum1.hasMoreElements
|
While enum1.hasMoreElements
|
||||||
|
@ -132,7 +134,8 @@ Function getOutlineWithLevel(curNum)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Sub addToArray(xArray(),vNextElement)
|
Sub addToArray(xArray(),vNextElement)
|
||||||
Dim iUB%,iLB%
|
Dim iUB As Integer
|
||||||
|
Dim iLB As Integer
|
||||||
iLB = lBound(xArray())
|
iLB = lBound(xArray())
|
||||||
iUB = uBound(xArray())
|
iUB = uBound(xArray())
|
||||||
If iLB > iUB then
|
If iLB > iUB then
|
||||||
|
|
|
@ -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="journals" script:language="StarBasic">Private sub journalsMark5
|
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="journals" script:language="StarBasic">Private sub journalsMark7
|
||||||
End sub
|
End sub
|
||||||
|
|
||||||
Dim templateName As String
|
Dim templateName As String
|
||||||
|
@ -15,6 +15,16 @@ Dim sectionName As String
|
||||||
Private Sub makeUpIssue
|
Private Sub makeUpIssue
|
||||||
turnOffTracking
|
turnOffTracking
|
||||||
Dim description As String
|
Dim description As String
|
||||||
|
Dim i As Integer
|
||||||
|
Dim statusIndicator as Object
|
||||||
|
Dim oViewCursor As Object
|
||||||
|
Dim oTextCursor As Object
|
||||||
|
Dim articleEndPosition As Object
|
||||||
|
Dim page As String
|
||||||
|
Dim firstPage As String
|
||||||
|
Dim tmp As String
|
||||||
|
Dim nSections As Long
|
||||||
|
|
||||||
description = "Вы уверены, что хотите запустить сборку выпуска ?"
|
description = "Вы уверены, что хотите запустить сборку выпуска ?"
|
||||||
If NOT confirm(description) Then
|
If NOT confirm(description) Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
|
@ -25,20 +35,9 @@ Private Sub makeUpIssue
|
||||||
PQ = "ВФ"
|
PQ = "ВФ"
|
||||||
imagesRelativePath = "/Links/Header/"
|
imagesRelativePath = "/Links/Header/"
|
||||||
allImagesRelativePath = "/Links/Header-icons/"
|
allImagesRelativePath = "/Links/Header-icons/"
|
||||||
|
|
||||||
Dim statusIndicator as Object
|
|
||||||
statusIndicator = ThisComponent.getCurrentController.StatusIndicator
|
statusIndicator = ThisComponent.getCurrentController.StatusIndicator
|
||||||
Dim oViewCursor As Object
|
|
||||||
Dim oTextCursor As Object
|
|
||||||
Dim articleEndPosition As Object
|
|
||||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||||
Dim page As String
|
|
||||||
Dim firstPage As String
|
|
||||||
|
|
||||||
Dim tmp As String
|
|
||||||
|
|
||||||
sectionName = ""
|
sectionName = ""
|
||||||
Dim nSections As Long
|
|
||||||
oFilename = ThisComponent.Location
|
oFilename = ThisComponent.Location
|
||||||
|
|
||||||
'Exit if no sections in document or document not saved
|
'Exit if no sections in document or document not saved
|
||||||
|
@ -166,14 +165,14 @@ Private Sub setPageNumbersDeprecated()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub setAtricleVars(i)
|
Private Sub setAtricleVars(i As Integer)
|
||||||
'updateUserField("article" + i + "LastPage", CStr(getArticleLastPage()) )
|
'updateUserField("article" + i + "LastPage", CStr(getArticleLastPage()) )
|
||||||
updateUserField("article" + i + "UDK", getUDK())
|
updateUserField("article" + i + "UDK", getUDK())
|
||||||
updateUserField("author" + i + "Copyright", getCopyright() )
|
updateUserField("author" + i + "Copyright", getCopyright() )
|
||||||
'updateUserField("rightHeader" + i , getTitleHeader() )
|
'updateUserField("rightHeader" + i , getTitleHeader() )
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function lastPageNum(i)
|
Private Function lastPageNum(i As Integer)
|
||||||
Dim docLastPage As Integer
|
Dim docLastPage As Integer
|
||||||
Dim curPageNum As Integer
|
Dim curPageNum As Integer
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
|
@ -301,7 +300,7 @@ Private Function getArticleHeader()
|
||||||
oViewCursor.goToRange(oSavePosition, false)
|
oViewCursor.goToRange(oSavePosition, false)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function getSectionX(section)
|
Private Function getSectionX(section As String)
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
Dim oSavePosition As Object
|
Dim oSavePosition As Object
|
||||||
Dim startPage As String
|
Dim startPage As String
|
||||||
|
@ -341,7 +340,7 @@ End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Private Sub setArticlePageStyles(i)
|
Private Sub setArticlePageStyles(i As Integer)
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
Dim oTextCursor As Object
|
Dim oTextCursor As Object
|
||||||
Dim oText As Object
|
Dim oText As Object
|
||||||
|
@ -387,7 +386,7 @@ Private Sub setArticlePageStyles(i)
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub setFirstPageMetadata(curStyle,i)
|
Private Sub setFirstPageMetadata(curStyle As Object,i As Integer)
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
Dim oSavePosition As Object
|
Dim oSavePosition As Object
|
||||||
Dim savePageName As String
|
Dim savePageName As String
|
||||||
|
@ -414,7 +413,7 @@ Private Sub setFirstPageMetadata(curStyle,i)
|
||||||
sendRM()
|
sendRM()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub setDefaultFirstPageMetadata(curStyle,i)
|
Private Sub setDefaultFirstPageMetadata(curStyle As Object,i As Integer)
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
Dim oHeaderTable As Object
|
Dim oHeaderTable As Object
|
||||||
Dim oFooterTable As Object
|
Dim oFooterTable As Object
|
||||||
|
@ -453,7 +452,7 @@ Private Sub setDefaultFirstPageMetadata(curStyle,i)
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub setPHAFirstPageMetadata(curStyle,i)
|
Private Sub setPHAFirstPageMetadata(curStyle As Object,i As Integer)
|
||||||
Dim oViewCursor As Object
|
Dim oViewCursor As Object
|
||||||
Dim oHeader As Object
|
Dim oHeader As Object
|
||||||
Dim oFooterTable As Object
|
Dim oFooterTable As Object
|
||||||
|
@ -1018,7 +1017,7 @@ Private Sub updateLastPageFields
|
||||||
Dim strPos As Integer
|
Dim strPos As Integer
|
||||||
Dim articleNum As Integer
|
Dim articleNum As Integer
|
||||||
Dim curNum As Integer
|
Dim curNum As Integer
|
||||||
Dim pageNum As Integer
|
Dim pageNum As String
|
||||||
Dim textCursor As Object
|
Dim textCursor As Object
|
||||||
Dim lastPages%( 100 )
|
Dim lastPages%( 100 )
|
||||||
For i = 0 to 100
|
For i = 0 to 100
|
||||||
|
@ -1061,7 +1060,6 @@ Private Sub updateLastPageFields
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
EndIf
|
EndIf
|
||||||
'TODO:
|
'TODO:
|
||||||
'OR enum1Element.supportsService("com.sun.star.text.TextTable")
|
'OR enum1Element.supportsService("com.sun.star.text.TextTable")
|
||||||
|
@ -1608,8 +1606,9 @@ Function getPageStyleNameFromEnum(enumElement)
|
||||||
EndIf
|
EndIf
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Function getPageNumber(cursor)
|
Function getPageNumber(cursor As Object) As String
|
||||||
Dim oField 'Field to insert
|
Dim oField As Object
|
||||||
|
Dim oTextCursor As Object
|
||||||
oTextCursor = cursor.Text.createTextCursorByRange(cursor.Start)
|
oTextCursor = cursor.Text.createTextCursorByRange(cursor.Start)
|
||||||
oField = ThisComponent.createInstance("com.sun.star.text.textfield.PageNumber")
|
oField = ThisComponent.createInstance("com.sun.star.text.textfield.PageNumber")
|
||||||
oField.NumberingType = 4
|
oField.NumberingType = 4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue