Code cleaning
This commit is contained in:
parent
2d4407b269
commit
52a5b70bbf
3 changed files with 44 additions and 21 deletions
|
@ -3,7 +3,7 @@
|
|||
xmlns:dep="http://openoffice.org/extensions/description/2006"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<identifier value="pro.litvinovg.epublishing" />
|
||||
<version value="0.2.4" />
|
||||
<version value="0.2.5" />
|
||||
<platform value="all" />
|
||||
<display-name>
|
||||
<name lang="ru">Инструменты для создания электронных изданий</name>
|
||||
|
|
|
@ -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="Album" script:language="StarBasic" script:moduleType="normal">Sub albumMark2
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Album" script:language="StarBasic" script:moduleType="normal">Sub albumMark3
|
||||
End Sub
|
||||
|
||||
Sub rotatePageButton
|
||||
|
@ -27,11 +27,9 @@ Sub makePageAlbum
|
|||
Exit Sub
|
||||
EndIf
|
||||
rotatePageClockwise(curPageStyleName)
|
||||
'saveAndreload()
|
||||
End Sub
|
||||
|
||||
Sub findBestAnchor()
|
||||
'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
||||
Dim curPageStyleName As String
|
||||
Dim oViewCursor As Object
|
||||
Dim oTextCursor As Object
|
||||
|
@ -55,12 +53,11 @@ Sub undoPageAlbum
|
|||
applyPortraitPageStyle(curPageStyleName)
|
||||
End Sub
|
||||
|
||||
sub applyPortraitPageStyle(pageStyleName)
|
||||
sub applyPortraitPageStyle(pageStyleName As String)
|
||||
Dim pageStyles As Object
|
||||
Dim pageStyle As Object
|
||||
Dim oViewCursor As Object
|
||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||
breakType = oViewCursor.getPropertyValue("BreakType")
|
||||
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
||||
pageStyle = pageStyles.getByName(pageStyleName)
|
||||
If NOT pageStyle.IsLandScape Then
|
||||
|
@ -68,20 +65,20 @@ sub applyPortraitPageStyle(pageStyleName)
|
|||
Exit sub
|
||||
EndIf
|
||||
If pageStyles.hasByName("portrait_" & pageStyleName) Then
|
||||
|
||||
replacePageStyleByPortrait(pageStyleName)
|
||||
removeAlbumFrames(pageStyleName)
|
||||
' Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
||||
Else
|
||||
MsgBox "Стиль страницы с портретной ориентацией portrait_" & pageStyleName & " не был найден. "
|
||||
EndIf
|
||||
|
||||
End Sub
|
||||
|
||||
Sub replacePageStyleByPortrait(pageStyleName)
|
||||
Sub replacePageStyleByPortrait(pageStyleName As String)
|
||||
Dim pageStyles As Object
|
||||
Dim pageStyle As Object
|
||||
Dim oldPageStyle As Object
|
||||
Dim textEnumeration As Object
|
||||
Dim enumerationElement As Object
|
||||
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
||||
oldPageStyle = pageStyles.getByName(pageStyleName)
|
||||
For i = 0 To pageStyles.getCount() - 1
|
||||
|
@ -115,7 +112,7 @@ Sub replacePageStyleByPortrait(pageStyleName)
|
|||
End Sub
|
||||
|
||||
|
||||
Sub removeAlbumFrames(pageStyleName)
|
||||
Sub removeAlbumFrames(pageStyleName As String)
|
||||
Dim drawPagesEnum As Object
|
||||
Dim drawPage As Object
|
||||
drawPagesEnum = ThisComponent.DrawPage.CreateEnumeration()
|
||||
|
@ -127,7 +124,7 @@ Sub removeAlbumFrames(pageStyleName)
|
|||
Wend
|
||||
End Sub
|
||||
|
||||
sub savePortraitPageStyle(pageStyleName)
|
||||
sub savePortraitPageStyle(pageStyleName As String)
|
||||
createPageStyleByExample("portrait_" & pageStyleName)
|
||||
hidePageStyle("portrait_" & pageStyleName)
|
||||
End Sub
|
||||
|
@ -141,12 +138,23 @@ Sub hidePageStyle(pageStyleName As String)
|
|||
pageStyle.Hidden = true
|
||||
End Sub
|
||||
|
||||
Sub rotatePageClockwise(pageStyleName)
|
||||
Sub rotatePageClockwise(pageStyleName As String)
|
||||
Dim pageStyles As Object
|
||||
Dim pageStyle As Object
|
||||
Dim tmpDimension As Long
|
||||
Dim frame As Object
|
||||
Dim frameName As String
|
||||
Dim oViewCursor As Object
|
||||
Dim pageNumber As Long
|
||||
Dim headerFrameW As Long
|
||||
Dim headerFrameH As Long
|
||||
Dim headerFrameYOffset As Long
|
||||
Dim headerFrameXOffset As Long
|
||||
Dim footerFrameW As Long
|
||||
Dim footerFrameH As Long
|
||||
Dim footerFrameYOffset As Long
|
||||
Dim footerFrameXOffset As Long
|
||||
Dim textElement As Object
|
||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||
pageNumber = oViewCursor.getPage()
|
||||
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
||||
|
@ -241,8 +249,11 @@ Sub rotatePageOrientation(pageStyle)
|
|||
pageStyle.IsLandscape = Not pageStyle.IsLandscape
|
||||
End Sub
|
||||
|
||||
Function checkPageSettings(pageStyleName)
|
||||
Function checkPageSettings(pageStyleName As String) As Boolean
|
||||
Dim pageStyles As Object
|
||||
Dim pageStyle As Object
|
||||
checkPageSettings = false
|
||||
|
||||
pageStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
||||
pageStyle = pageStyles.getByName(pageStyleName)
|
||||
If pageStyle.HeaderIsOn Then
|
||||
|
@ -278,7 +289,17 @@ Function checkPageSettings(pageStyleName)
|
|||
End Function
|
||||
|
||||
|
||||
Sub copyTextToFrame(textElement,frameXOffset,frameYOffset,frameW,frameH,frameName)
|
||||
Sub copyTextToFrame(textElement As Object,frameXOffset As Long,frameYOffset As Long,frameW As Long,frameH As Long,frameName As String)
|
||||
Dim oViewCursor As Object
|
||||
Dim initialCursorPosition As Object
|
||||
Dim frame As Object
|
||||
Dim enumeration As Object
|
||||
Dim firstElement As Boolean
|
||||
Dim element As Object
|
||||
Dim cellNames() As String
|
||||
Dim firstCellAnchor As Object
|
||||
Dim lastCellAnchor As Object
|
||||
|
||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||
initialCursorPosition = oViewCursor.Text.createTextCursorByRange(oViewCursor.End)
|
||||
frame = createFrame(frameXOffset,frameYOffset,frameW,frameH,frameName)
|
||||
|
@ -310,20 +331,19 @@ Sub copyTextToFrame(textElement,frameXOffset,frameYOffset,frameW,frameH,frameNam
|
|||
oViewCursor.goToRange(initialCursorPosition,false)
|
||||
End Sub
|
||||
|
||||
Sub removePageHeader(pageStyle)
|
||||
Sub removePageHeader(pageStyle As Object)
|
||||
pageStyle.headerIsOn = false
|
||||
End Sub
|
||||
|
||||
Sub removePageFooter(pageStyle)
|
||||
Sub removePageFooter(pageStyle As Object)
|
||||
pageStyle.FooterIsOn = false
|
||||
End Sub
|
||||
|
||||
Function getCurPageStyleName()
|
||||
Function getCurPageStyleName() As String
|
||||
dim curPageStyleName as String
|
||||
dim oViewCursor as Object
|
||||
dim oTextCursor as Object
|
||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||
'Mri oViewCursor
|
||||
If Not oViewCursor.isAtEndOfLine() And Not oViewCursor.isAtStartOfLine() Then
|
||||
oViewCursor.goToStartOfLine(false)
|
||||
EndIf
|
||||
|
@ -363,10 +383,12 @@ sub unoPaste
|
|||
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
|
||||
end sub
|
||||
|
||||
Function createFrame(posX,posY,width,height,frameName)
|
||||
Function createFrame(posX As Long,posY As Long,width As Long,height As Long,frameName As String) As Object
|
||||
Dim oViewCursor as Object
|
||||
Dim oTextCursor as Object
|
||||
Dim oText As Object
|
||||
Dim frame As Object
|
||||
Dim border As Object
|
||||
oViewCursor = ThisComponent.CurrentController.getViewCursor()
|
||||
oText = oViewCursor.Text
|
||||
oTextCursor = oText.createTextCursorByRange(oViewCursor.End)
|
||||
|
|
|
@ -45,7 +45,7 @@ Private sub disableAutoHyph()
|
|||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub convertHyphInText(textElement)
|
||||
Private Sub convertHyphInText(textElement As Object)
|
||||
Dim enum1Element As Object
|
||||
Dim enum1 As Object
|
||||
Dim i As Integer
|
||||
|
@ -422,4 +422,5 @@ End Function
|
|||
|
||||
Sub Macro1
|
||||
|
||||
End Sub</script:module>
|
||||
End Sub
|
||||
</script:module>
|
Loading…
Add table
Reference in a new issue