Added page styles lib
This commit is contained in:
parent
df0aed0390
commit
4c94a4486b
3 changed files with 144 additions and 1 deletions
14
ePublishing/PageConfig.xdl
Normal file
14
ePublishing/PageConfig.xdl
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||||
|
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="PageConfig" dlg:left="133" dlg:top="45" dlg:width="250" dlg:height="251" dlg:closeable="true" dlg:moveable="true">
|
||||||
|
<dlg:styles>
|
||||||
|
<dlg:style dlg:style-id="0" dlg:background-color="0xb4c7dc"/>
|
||||||
|
<dlg:style dlg:style-id="1" dlg:background-color="0x3faf46"/>
|
||||||
|
</dlg:styles>
|
||||||
|
<dlg:bulletinboard>
|
||||||
|
<dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="0" dlg:left="74" dlg:top="18" dlg:width="135" dlg:height="215"/>
|
||||||
|
<dlg:img dlg:style-id="1" dlg:id="ImageControl2" dlg:tab-index="1" dlg:left="91" dlg:top="48" dlg:width="98" dlg:height="155"/>
|
||||||
|
<dlg:img dlg:id="ImageControl3" dlg:tab-index="2" dlg:left="90" dlg:top="25" dlg:width="99" dlg:height="15"/>
|
||||||
|
<dlg:img dlg:id="ImageControl4" dlg:tab-index="3" dlg:left="91" dlg:top="209" dlg:width="98" dlg:height="13"/>
|
||||||
|
</dlg:bulletinboard>
|
||||||
|
</dlg:window>
|
128
ePublishing/PageStyles.xba
Normal file
128
ePublishing/PageStyles.xba
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
<?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="PageStyles" script:language="StarBasic" script:moduleType="normal">Sub setDimensions
|
||||||
|
Dim oStyles As Object
|
||||||
|
Dim curStyle As Object
|
||||||
|
Dim inputHeight As String
|
||||||
|
Dim inputTopMargin As String
|
||||||
|
Dim inputBottomMargin As String
|
||||||
|
Dim inputLeftMargin As String
|
||||||
|
Dim inputRightMargin As String
|
||||||
|
Dim inputHeaderBodyDistance As String
|
||||||
|
Dim inputFooterBodyDistance As String
|
||||||
|
Dim inputFootnoteLineDistance As String
|
||||||
|
Dim inputFootnoteLineTextDistance As String
|
||||||
|
|
||||||
|
Dim newWidth As Long
|
||||||
|
Dim newHeight As Long
|
||||||
|
Dim newTopMargin As Long
|
||||||
|
Dim newBottomMargin As Long
|
||||||
|
Dim newLeftMargin As Long
|
||||||
|
Dim newRightMargin As Long
|
||||||
|
Dim textFieldHeight As Long
|
||||||
|
Dim textFieldWidth As Long
|
||||||
|
Dim headerBodyDistance As Long
|
||||||
|
Dim footerBodyDistance As Long
|
||||||
|
Dim footnoteLineDistance As Long
|
||||||
|
Dim footnoteLineTextDistance As Long
|
||||||
|
|
||||||
|
oStyles = ThisComponent.StyleFamilies.getByName("PageStyles")
|
||||||
|
inputWidth = InputBox("Введите ширину страниц (в мм):", "Установка ширины всех страниц документа", "")
|
||||||
|
inputHeight = InputBox("Введите высоту страниц (в мм):", "Установка высоты всех страниц документа", "")
|
||||||
|
inputTopMargin = InputBox("Введите размер верхнего поля (в мм):", "Установка размера верхнего поля для всех страниц", "")
|
||||||
|
inputBottomMargin = InputBox("Введите резмер нижнего поля (в мм):", "Установка размера нижнего поля для всех страниц", "")
|
||||||
|
inputLeftMargin = InputBox("Введите размер левого поля (в мм):", "Установка размера левого поля для всех страниц", "")
|
||||||
|
inputRightMargin = InputBox("Введите размер правого поля (в мм):", "Установка размера правого поля для всех страниц", "")
|
||||||
|
inputHeaderBodyDistance = InputBox("Введите расстояние от верхнего колонтитула до текста (в сотых долях мм):", "Установка расстояния от верхнего колонтитула до текста", "")
|
||||||
|
inputFooterBodyDistance = InputBox("Введите расстояние от нижнего колонтитула до текста (в сотых долях мм):", "Установка расстояния от нижнего колонтитула до текста ", "")
|
||||||
|
inputFootnoteLineTextDistance = InputBox("Введите расстояние от текста страницы до линии сноски (в сотых долях мм):", "Установка расстояния от текста страницы до линии сноски ", "")
|
||||||
|
inputFootnoteLineDistance = InputBox("Введите расстояние от линии сноски до текста сноски (в сотых долях мм):", "Установка расстояния от линии сноски до текста сноски ", "")
|
||||||
|
|
||||||
|
For i = 0 to oStyles.Count - 1
|
||||||
|
curStyle = oStyles.getByIndex(i)
|
||||||
|
newWidth = curStyle.Width
|
||||||
|
newHeight = curStyle.height
|
||||||
|
newTopMargin = curStyle.TopMargin
|
||||||
|
newBottomMargin = curStyle.BottomMargin
|
||||||
|
newLeftMargin = curStyle.LeftMargin
|
||||||
|
newRightMargin = curStyle.RightMargin
|
||||||
|
|
||||||
|
If CLng(inputHeaderBodyDistance) > 0 Then
|
||||||
|
headerBodyDistance = CLng(inputHeaderBodyDistance)
|
||||||
|
curStyle.HeaderBodyDistance = headerBodyDistance
|
||||||
|
EndIf
|
||||||
|
If CLng(inputFooterBodyDistance) > 0 Then
|
||||||
|
footerBodyDistance = CLng(inputFooterBodyDistance)
|
||||||
|
curStyle.FooterBodyDistance = footerBodyDistance
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If CLng(inputFootnoteLineDistance) > 0 Then
|
||||||
|
footnoteLineDistance = CLng(inputFootnoteLineDistance)
|
||||||
|
curStyle.FootnoteLineDistance = footnoteLineDistance
|
||||||
|
EndIf
|
||||||
|
If CLng(inputFootnoteLineTextDistance) > 0 Then
|
||||||
|
footnoteLineTextDistance = CLng(inputFootnoteLineTextDistance)
|
||||||
|
curStyle.FootnoteLineTextDistance = footnoteLineTextDistance
|
||||||
|
EndIf
|
||||||
|
'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
||||||
|
'Mri curStyle
|
||||||
|
|
||||||
|
If curstyle.IsLandscape Then
|
||||||
|
If CLng(inputHeight) > 0 Then
|
||||||
|
newWidth = CLng(inputHeight + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputWidth) > 0 Then
|
||||||
|
newHeight = CLng(inputWidth + "00")
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If CLng(inputLeftMargin) > 0 Then
|
||||||
|
newTopMargin = CLng(inputLeftMargin + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputRightMargin) > 0 Then
|
||||||
|
newBottomMargin = CLng(inputRightMargin + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputTopMargin) > 0 Then
|
||||||
|
newLeftMargin = CLng(inputTopMargin + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputBottomMargin) > 0 Then
|
||||||
|
newRightMargin = CLng(inputBottomMargin + "00")
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
Else
|
||||||
|
If CLng(inputWidth) > 0 Then
|
||||||
|
newWidth = CLng(inputWidth + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputHeight) > 0 Then
|
||||||
|
newHeight = CLng(inputHeight + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputTopMargin) > 0 Then
|
||||||
|
newTopMargin = CLng(inputTopMargin + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputBottomMargin) > 0 Then
|
||||||
|
newBottomMargin = CLng(inputBottomMargin + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputLeftMargin) > 0 Then
|
||||||
|
newLeftMargin = CLng(inputLeftMargin + "00")
|
||||||
|
EndIf
|
||||||
|
If CLng(inputRightMargin) > 0 Then
|
||||||
|
newRightMargin = CLng(inputRightMargin + "00")
|
||||||
|
EndIf
|
||||||
|
End If
|
||||||
|
textFieldWidth = newWidth - newLeftMargin - newRightMargin
|
||||||
|
textFieldHeight = newHeight - newTopMargin - newBottomMargin
|
||||||
|
If textFieldWidth > 5000 Then
|
||||||
|
curStyle.Width = newWidth
|
||||||
|
curStyle.LeftMargin = newLeftMargin
|
||||||
|
curStyle.RightMargin = newRightMargin
|
||||||
|
EndIf
|
||||||
|
|
||||||
|
If textFieldHeight > 5000 Then
|
||||||
|
curStyle.Height = newHeight
|
||||||
|
curStyle.TopMargin = newTopMargin
|
||||||
|
curStyle.BottomMargin = newBottomMargin
|
||||||
|
EndIf
|
||||||
|
Next
|
||||||
|
|
||||||
|
Exit Sub
|
||||||
|
End Sub
|
||||||
|
</script:module>
|
|
@ -3,4 +3,5 @@
|
||||||
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ePublishing" library:readonly="false" library:passwordprotected="false">
|
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ePublishing" library:readonly="false" library:passwordprotected="false">
|
||||||
<library:element library:name="FootnotesConfig"/>
|
<library:element library:name="FootnotesConfig"/>
|
||||||
<library:element library:name="replaceParaStyle"/>
|
<library:element library:name="replaceParaStyle"/>
|
||||||
</library:library>
|
<library:element library:name="PageConfig"/>
|
||||||
|
</library:library>
|
Loading…
Add table
Reference in a new issue