Page styles config working

This commit is contained in:
Georgy Litvinov 2020-05-06 16:20:51 +02:00
parent 23f8834361
commit c3f28049e7
6 changed files with 1665 additions and 1557 deletions

View file

@ -5,24 +5,25 @@
<dlg:style dlg:style-id="0" dlg:border="none"/> <dlg:style dlg:style-id="0" dlg:border="none"/>
</dlg:styles> </dlg:styles>
<dlg:bulletinboard> <dlg:bulletinboard>
<dlg:textfield dlg:style-id="0" dlg:id="pageHeight" dlg:tab-index="11" dlg:left="11" dlg:top="141" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="pageHeight" dlg:tab-index="12" dlg:left="11" dlg:top="141" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="pageWidth" dlg:tab-index="7" dlg:left="99" dlg:top="281" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="pageWidth" dlg:tab-index="8" dlg:left="99" dlg:top="281" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="leftPageMargin" dlg:tab-index="6" dlg:left="32" dlg:top="1" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="leftPageMargin" dlg:tab-index="7" dlg:left="32" dlg:top="1" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="topPageMargin" dlg:tab-index="2" dlg:left="193" dlg:top="29" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="topPageMargin" dlg:tab-index="3" dlg:left="193" dlg:top="29" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="headerHeight" dlg:tab-index="3" dlg:left="193" dlg:top="42" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="headerHeight" dlg:tab-index="4" dlg:left="193" dlg:top="42" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="headerOffset" dlg:tab-index="4" dlg:left="193" dlg:top="59" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="headerOffset" dlg:tab-index="5" dlg:left="193" dlg:top="59" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="footerHeight" dlg:tab-index="9" dlg:left="193" dlg:top="259" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="footerHeight" dlg:tab-index="10" dlg:left="193" dlg:top="259" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="footerOffset" dlg:tab-index="8" dlg:left="193" dlg:top="242" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="footerOffset" dlg:tab-index="9" dlg:left="193" dlg:top="242" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="footnoteAreaHeight" dlg:tab-index="5" dlg:left="193" dlg:top="229" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="footnoteAreaHeight" dlg:tab-index="6" dlg:left="193" dlg:top="229" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="footnoteAreaOffset" dlg:tab-index="1" dlg:left="193" dlg:top="202" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="footnoteAreaOffset" dlg:tab-index="2" dlg:left="193" dlg:top="202" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:text dlg:id="description" dlg:tab-index="12" dlg:left="229" dlg:top="6" dlg:width="155" dlg:height="42" dlg:value="Label1"/> <dlg:text dlg:id="description" dlg:tab-index="13" dlg:left="229" dlg:top="6" dlg:width="155" dlg:height="42" dlg:value="Label1" dlg:multiline="true"/>
<dlg:button dlg:id="Cancel" dlg:tab-index="14" dlg:left="314" dlg:top="290" dlg:width="58" dlg:height="13" dlg:value="Cancel" dlg:button-type="cancel"/> <dlg:button dlg:id="Cancel" dlg:tab-index="15" dlg:left="314" dlg:top="290" dlg:width="60" dlg:height="13" dlg:value="Cancel" dlg:button-type="cancel"/>
<dlg:button dlg:id="Ok" dlg:tab-index="13" dlg:left="241" dlg:top="290" dlg:width="58" dlg:height="13" dlg:value="Ok" dlg:button-type="cancel"/> <dlg:button dlg:id="Ok" dlg:tab-index="14" dlg:left="241" dlg:top="290" dlg:width="60" dlg:height="13" dlg:value="Ok" dlg:toggled="1">
<dlg:menulist dlg:id="ListBox2" dlg:tab-index="16" dlg:left="286" dlg:top="15" dlg:width="2" dlg:height="0"/> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ePublishing.PageStyles.applyPageStyleConfiguration?language=Basic&amp;location=application" script:language="Script"/>
<dlg:menulist dlg:id="slylesList" dlg:tab-index="17" dlg:left="293" dlg:top="95" dlg:width="0" dlg:height="2"/> </dlg:button>
<dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="18" dlg:left="11" dlg:top="8" dlg:width="214" dlg:height="291" dlg:scale-mode="isotropic"/> <dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="17" dlg:left="11" dlg:top="8" dlg:width="214" dlg:height="291" dlg:scale-mode="isotropic"/>
<dlg:menulist dlg:id="pageStyles" dlg:tab-index="15" dlg:left="229" dlg:top="50" dlg:width="155" dlg:height="230" dlg:multiselection="true"/> <dlg:menulist dlg:id="pageStyles" dlg:tab-index="16" dlg:left="229" dlg:top="50" dlg:width="155" dlg:height="230" dlg:multiselection="true"/>
<dlg:textfield dlg:style-id="0" dlg:id="rightPageMargin" dlg:tab-index="0" dlg:left="168" dlg:top="1" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="rightPageMargin" dlg:tab-index="1" dlg:left="168" dlg:top="1" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="bottomPageMargin" dlg:tab-index="10" dlg:left="193" dlg:top="277" dlg:width="16" dlg:height="10" dlg:value="1000"/> <dlg:textfield dlg:style-id="0" dlg:id="bottomPageMargin" dlg:tab-index="11" dlg:left="193" dlg:top="277" dlg:width="16" dlg:height="10" dlg:value="1000"/>
<dlg:textfield dlg:style-id="0" dlg:id="textToLine" dlg:tab-index="0" dlg:left="193" dlg:top="186" dlg:width="16" dlg:height="10" dlg:value="1000"/>
</dlg:bulletinboard> </dlg:bulletinboard>
</dlg:window> </dlg:window>

View file

@ -1,14 +1,15 @@
<?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="PageStyles" script:language="StarBasic" script:moduleType="normal">Sub pageStylesDialog <script:module xmlns:script="http://openoffice.org/2000/script" script:name="PageStyles" script:language="StarBasic" script:moduleType="normal"> Dim pDialog As Object
DialogLibraries.LoadLibrary(&quot;ePublishing&quot;) Sub pageStylesDialog
Dim dialog As Object
Dim listBox As Object Dim listBox As Object
Dim oStyles As Object Dim oStyles As Object
Dim pageStyles As Object Dim pageStyles As Object
Dim pageStyleNames() As String Dim pageStyleNames() As String
Dim imageURL As String Dim imageURL As String
Dim pageStyle As Object Dim pageStyle As Object
Dim i As Integer
oStyles = ThisComponent.StyleFamilies oStyles = ThisComponent.StyleFamilies
pageStyles = oStyles.getByName(oStyles.elementNames(2)) pageStyles = oStyles.getByName(oStyles.elementNames(2))
pageStyleNames = pageStyles.getElementNames pageStyleNames = pageStyles.getElementNames
@ -18,31 +19,19 @@
displayPageStyleNames(i) = pageStyle.displayName displayPageStyleNames(i) = pageStyle.displayName
Next i Next i
subShellSort(displayPageStyleNames) subShellSort(displayPageStyleNames)
DialogLibraries.LoadLibrary(&quot;ePublishing&quot;)
dialog = CreateUnoDialog( DialogLibraries.ePublishing.PageConfig ) pDialog = CreateUnoDialog( DialogLibraries.ePublishing.PageConfig )
Globalscope.BasicLibraries.LoadLibrary( &quot;MRILib&quot; )
imageURL = convertToURL(getExtensionPath() + &quot;/images/panel.svg&quot;) imageURL = convertToURL(getExtensionPath() + &quot;/images/panel.svg&quot;)
dialog.getControl(&quot;ImageControl1&quot;).model.imageURL = imageURL pDialog.getControl(&quot;ImageControl1&quot;).model.imageURL = imageURL
dialog.getControl(&quot;description&quot;).setText(getTranslation(&quot;PageConfigDialogTranslations&quot;)) pDialog.getControl(&quot;description&quot;).setText(getTranslation(&quot;PageConfigDialogTranslations&quot;))
cleanPageSettings()
dialog.getControl(&quot;pageHeight&quot;).setText(&quot;&quot;) pDialog.getControl(&quot;Cancel&quot;).Label = getTranslation(&quot;PageConfigDialogCancelButton&quot;)
dialog.getControl(&quot;pageWidth&quot;).setText(&quot;&quot;) pDialog.getControl(&quot;Ok&quot;).Label = getTranslation(&quot;PageConfigDialogOkButton&quot;)
dialog.getControl(&quot;leftPageMargin&quot;).setText(&quot;&quot;) listBox = pDialog.getControl(&quot;pageStyles&quot;)
dialog.getControl(&quot;topPageMargin&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;rightPageMargin&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;bottomPageMargin&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;headerHeight&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;headerOffset&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;footerHeight&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;footerOffset&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;footnoteAreaHeight&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;footnoteAreaOffset&quot;).setText(&quot;&quot;)
dialog.getControl(&quot;Cancel&quot;).Label = getTranslation(&quot;PageConfigDialogCancelButton&quot;)
dialog.getControl(&quot;Ok&quot;).Label = getTranslation(&quot;PageConfigDialogOkButton&quot;)
listBox = dialog.getControl(&quot;pageStyles&quot;)
listBox.addItems(displayPageStyleNames, 0) listBox.addItems(displayPageStyleNames, 0)
dialog.Title = getTranslation(&quot;PageConfigDialogTitle&quot;) pDialog.Title = getTranslation(&quot;PageConfigDialogTitle&quot;)
dialog.Execute() pDialog.Execute()
pDialog.dispose()
End Sub End Sub
Function getExtensionPath As String Function getExtensionPath As String
@ -54,7 +43,128 @@ Function getExtensionPath As String
End Function End Function
Sub setDimensions Sub applyPageStyleConfiguration()
Dim styles As Object
Dim selectedItems() As String
Dim oStyles As Object
Dim pageStyles As Object
Dim pageStyleNames() As String
Dim pageStyleName As String
Dim pageStyleDisplayName As String
Dim pageStyle As Object
Dim style As Object
Dim i As Integer
Dim foundIndex As Integer
pDialog.getControl(&quot;Ok&quot;).Model.State = 0
styles = pDialog.getControl(&quot;pageStyles&quot;)
&apos;Mri styles
selectedItems = styles.getSelectedItems
If Ubound(selectedItems) &lt; 0 Then
MsgBox getTranslation(&quot;pageStylesNoStyleSelected&quot;)
Exit sub
EndIf
If noPageSettings() Then
MsgBox getTranslation(&quot;pageStylesNoSettingsSet&quot;)
Exit sub
EndIf
oStyles = ThisComponent.StyleFamilies
pageStyles = oStyles.getByName(oStyles.elementNames(2))
pageStyleNames = pageStyles.getElementNames
Dim displayPageStyleNames(Ubound(pageStyleNames))
For i = LBound(displayPageStyleNames) To Ubound(displayPageStyleNames)
pageStyle = pageStyles.getByName(pageStyleNames(i))
displayPageStyleNames(i) = pageStyle.displayName
Next i
For i = LBound(selectedItems) To Ubound(selectedItems)
pageStyleDisplayName = selectedItems(i)
foundIndex = getIndex(displayPageStyleNames, pageStyleDisplayName)
pageStyleName = pageStyleNames(foundIndex)
pageStyle = pageStyles.getByName(pageStyleName)
applyPageSettings(pageStyle)
Next i
MsgBox getTranslation(&quot;PageConfigSettingsApplied&quot;)
cleanPageSettings()
End Sub
Sub cleanPageSettings()
pDialog.getControl(&quot;pageHeight&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;pageWidth&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;leftPageMargin&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;topPageMargin&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;rightPageMargin&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;bottomPageMargin&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;headerHeight&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;headerOffset&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;footerHeight&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;footerOffset&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;footnoteAreaHeight&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;footnoteAreaOffset&quot;).setText(&quot;&quot;)
pDialog.getControl(&quot;textToLine&quot;).setText(&quot;&quot;)
&apos;Globalscope.BasicLibraries.LoadLibrary( &quot;MRILib&quot; )
End Sub
Function noPageSettings() As Boolean
Dim setting As String
noPageSettings = true
setting = pDialog.getControl(&quot;pageHeight&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;pageWidth&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;leftPageMargin&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;topPageMargin&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;rightPageMargin&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;bottomPageMargin&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;headerHeight&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;headerOffset&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;footerHeight&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;footerOffset&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;footnoteAreaHeight&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;footnoteAreaOffset&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
setting = pDialog.getControl(&quot;textToLine&quot;).getText()
If Len(setting) &gt; 0 Then
noPageSettings = false
EndIf
End Function
Sub applyPageSettings(targetStyle As Object)
Dim oStyles As Object Dim oStyles As Object
Dim curStyle As Object Dim curStyle As Object
Dim inputHeight As String Dim inputHeight As String
@ -66,6 +176,9 @@ Sub setDimensions
Dim inputFooterBodyDistance As String Dim inputFooterBodyDistance As String
Dim inputFootnoteLineDistance As String Dim inputFootnoteLineDistance As String
Dim inputFootnoteLineTextDistance As String Dim inputFootnoteLineTextDistance As String
Dim inputFooterHeight As String
Dim inputHeaderHeight As String
Dim inputFootnoteArea As String
Dim newWidth As Long Dim newWidth As Long
Dim newHeight As Long Dim newHeight As Long
@ -81,85 +194,112 @@ Sub setDimensions
Dim footnoteLineTextDistance As Long Dim footnoteLineTextDistance As Long
oStyles = ThisComponent.StyleFamilies.getByName(&quot;PageStyles&quot;) oStyles = ThisComponent.StyleFamilies.getByName(&quot;PageStyles&quot;)
inputWidth = InputBox(&quot;Введите ширину страниц (в мм):&quot;, &quot;Установка ширины всех страниц документа&quot;, &quot;&quot;) inputWidth = pDialog.getControl(&quot;pageWidth&quot;).getText()
inputHeight = InputBox(&quot;Введите высоту страниц (в мм):&quot;, &quot;Установка высоты всех страниц документа&quot;, &quot;&quot;) inputHeight = pDialog.getControl(&quot;pageHeight&quot;).getText()
inputTopMargin = InputBox(&quot;Введите размер верхнего поля (в мм):&quot;, &quot;Установка размера верхнего поля для всех страниц&quot;, &quot;&quot;) inputTopMargin = pDialog.getControl(&quot;topPageMargin&quot;).getText()
inputBottomMargin = InputBox(&quot;Введите резмер нижнего поля (в мм):&quot;, &quot;Установка размера нижнего поля для всех страниц&quot;, &quot;&quot;) inputBottomMargin = pDialog.getControl(&quot;bottomPageMargin&quot;).getText()
inputLeftMargin = InputBox(&quot;Введите размер левого поля (в мм):&quot;, &quot;Установка размера левого поля для всех страниц&quot;, &quot;&quot;) inputLeftMargin = pDialog.getControl(&quot;leftPageMargin&quot;).getText()
inputRightMargin = InputBox(&quot;Введите размер правого поля (в мм):&quot;, &quot;Установка размера правого поля для всех страниц&quot;, &quot;&quot;) inputRightMargin = pDialog.getControl(&quot;rightPageMargin&quot;).getText()
inputHeaderBodyDistance = InputBox(&quot;Введите расстояние от верхнего колонтитула до текста (в сотых долях мм):&quot;, &quot;Установка расстояния от верхнего колонтитула до текста&quot;, &quot;&quot;) inputHeaderBodyDistance = pDialog.getControl(&quot;headerOffset&quot;).getText()
inputFooterBodyDistance = InputBox(&quot;Введите расстояние от нижнего колонтитула до текста (в сотых долях мм):&quot;, &quot;Установка расстояния от нижнего колонтитула до текста &quot;, &quot;&quot;) inputFooterBodyDistance = pDialog.getControl(&quot;footerOffset&quot;).getText()
inputFootnoteLineTextDistance = InputBox(&quot;Введите расстояние от текста страницы до линии сноски (в сотых долях мм):&quot;, &quot;Установка расстояния от текста страницы до линии сноски &quot;, &quot;&quot;)
inputFootnoteLineDistance = InputBox(&quot;Введите расстояние от линии сноски до текста сноски (в сотых долях мм):&quot;, &quot;Установка расстояния от линии сноски до текста сноски &quot;, &quot;&quot;) inputFooterHeight = pDialog.getControl(&quot;footerHeight&quot;).getText()
inputHeaderHeight = pDialog.getControl(&quot;headerHeight&quot;).getText()
inputFootnoteArea = pDialog.getControl(&quot;footnoteAreaHeight&quot;).getText()
For i = 0 to oStyles.Count - 1 inputFootnoteLineTextDistance = pDialog.getControl(&quot;textToLine&quot;).getText()
curStyle = oStyles.getByIndex(i) &apos;InputBox(&quot;Введите расстояние от текста страницы до линии сноски (в сотых долях мм):&quot;, &quot;Установка расстояния от текста страницы до линии сноски &quot;, &quot;&quot;)
inputFootnoteLineDistance = pDialog.getControl(&quot;footnoteAreaOffset&quot;).getText()
&apos;InputBox(&quot;Введите расстояние от линии сноски до текста сноски (в сотых долях мм):&quot;, &quot;Установка расстояния от линии сноски до текста сноски &quot;, &quot;&quot;)
curStyle = targetStyle
&apos;Mri curStyle
newWidth = curStyle.Width newWidth = curStyle.Width
newHeight = curStyle.height newHeight = curStyle.height
newTopMargin = curStyle.TopMargin newTopMargin = curStyle.TopMargin
newBottomMargin = curStyle.BottomMargin newBottomMargin = curStyle.BottomMargin
newLeftMargin = curStyle.LeftMargin newLeftMargin = curStyle.LeftMargin
newRightMargin = curStyle.RightMargin newRightMargin = curStyle.RightMargin
If covertMMtoLong(inputFootnoteArea) &gt; 0 Then
Dim footnoteArea As Long
footnoteArea = covertMMtoLong(inputFootnoteArea)
curStyle.FootnoteHeight = footnoteArea
EndIf
If CLng(inputHeaderBodyDistance) &gt; 0 Then If covertMMtoLong(inputHeaderBodyDistance) &gt; 0 Then
headerBodyDistance = CLng(inputHeaderBodyDistance) headerBodyDistance = covertMMtoLong(inputHeaderBodyDistance)
curStyle.HeaderBodyDistance = headerBodyDistance curStyle.HeaderBodyDistance = headerBodyDistance
EndIf EndIf
If CLng(inputFooterBodyDistance) &gt; 0 Then If covertMMtoLong(inputFooterBodyDistance) &gt; 0 Then
footerBodyDistance = CLng(inputFooterBodyDistance) footerBodyDistance = covertMMtoLong(inputFooterBodyDistance)
curStyle.FooterBodyDistance = footerBodyDistance curStyle.FooterBodyDistance = footerBodyDistance
EndIf EndIf
If covertMMtoLong(inputFootnoteLineDistance) &gt; 0 Then
If CLng(inputFootnoteLineDistance) &gt; 0 Then footnoteLineDistance = covertMMtoLong(inputFootnoteLineDistance)
footnoteLineDistance = CLng(inputFootnoteLineDistance)
curStyle.FootnoteLineDistance = footnoteLineDistance curStyle.FootnoteLineDistance = footnoteLineDistance
EndIf EndIf
If CLng(inputFootnoteLineTextDistance) &gt; 0 Then If covertMMtoLong(inputFootnoteLineTextDistance) &gt; 0 Then
footnoteLineTextDistance = CLng(inputFootnoteLineTextDistance) footnoteLineTextDistance = covertMMtoLong(inputFootnoteLineTextDistance)
curStyle.FootnoteLineTextDistance = footnoteLineTextDistance curStyle.FootnoteLineTextDistance = footnoteLineTextDistance
EndIf EndIf
&apos;Globalscope.BasicLibraries.LoadLibrary( &quot;MRILib&quot; )
&apos;Mri curStyle If covertMMtoLong(inputFooterHeight) &gt; 0 Then
Dim footerHeight As Long
footerHeight = covertMMtoLong(inputFooterHeight)
curStyle.FooterIsOn = true
curStyle.FooterIsDynamicHeight = false
curStyle.FooterHeight = footerHeight + curStyle.FooterBodyDistance
EndIf
If covertMMtoLong(inputHeaderHeight) &gt; 0 Then
Dim headerHeight As Long
headerHeight = covertMMtoLong(inputHeaderHeight)
curStyle.HeaderIsOn = true
curStyle.HeaderIsDynamicHeight = false
curStyle.HeaderHeight = headerHeight + curStyle.HeaderBodyDistance
EndIf
If curstyle.IsLandscape Then If curstyle.IsLandscape Then
If CLng(inputHeight) &gt; 0 Then If covertMMtoLong(inputHeight) &gt; 0 Then
newWidth = CLng(inputHeight + &quot;00&quot;) newWidth = covertMMtoLong(inputHeight)
EndIf EndIf
If CLng(inputWidth) &gt; 0 Then If covertMMtoLong(inputWidth) &gt; 0 Then
newHeight = CLng(inputWidth + &quot;00&quot;) newHeight = covertMMtoLong(inputWidth)
EndIf EndIf
If CLng(inputLeftMargin) &gt; 0 Then If covertMMtoLong(inputLeftMargin) &gt; 0 Then
newTopMargin = CLng(inputLeftMargin + &quot;00&quot;) newTopMargin = covertMMtoLong(inputLeftMargin)
EndIf EndIf
If CLng(inputRightMargin) &gt; 0 Then If covertMMtoLong(inputRightMargin) &gt; 0 Then
newBottomMargin = CLng(inputRightMargin + &quot;00&quot;) newBottomMargin = covertMMtoLong(inputRightMargin)
EndIf EndIf
If CLng(inputTopMargin) &gt; 0 Then If covertMMtoLong(inputTopMargin) &gt; 0 Then
newLeftMargin = CLng(inputTopMargin + &quot;00&quot;) newLeftMargin = covertMMtoLong(inputTopMargin)
EndIf EndIf
If CLng(inputBottomMargin) &gt; 0 Then If covertMMtoLong(inputBottomMargin) &gt; 0 Then
newRightMargin = CLng(inputBottomMargin + &quot;00&quot;) newRightMargin = covertMMtoLong(inputBottomMargin)
EndIf EndIf
Else Else
If CLng(inputWidth) &gt; 0 Then If covertMMtoLong(inputWidth) &gt; 0 Then
newWidth = CLng(inputWidth + &quot;00&quot;) newWidth = covertMMtoLong(inputWidth)
EndIf EndIf
If CLng(inputHeight) &gt; 0 Then If covertMMtoLong(inputHeight) &gt; 0 Then
newHeight = CLng(inputHeight + &quot;00&quot;) newHeight = covertMMtoLong(inputHeight)
EndIf EndIf
If CLng(inputTopMargin) &gt; 0 Then If covertMMtoLong(inputTopMargin) &gt; 0 Then
newTopMargin = CLng(inputTopMargin + &quot;00&quot;) newTopMargin = covertMMtoLong(inputTopMargin)
EndIf EndIf
If CLng(inputBottomMargin) &gt; 0 Then If covertMMtoLong(inputBottomMargin) &gt; 0 Then
newBottomMargin = CLng(inputBottomMargin + &quot;00&quot;) newBottomMargin = covertMMtoLong(inputBottomMargin)
EndIf EndIf
If CLng(inputLeftMargin) &gt; 0 Then If covertMMtoLong(inputLeftMargin) &gt; 0 Then
newLeftMargin = CLng(inputLeftMargin + &quot;00&quot;) newLeftMargin = covertMMtoLong(inputLeftMargin)
EndIf EndIf
If CLng(inputRightMargin) &gt; 0 Then If covertMMtoLong(inputRightMargin) &gt; 0 Then
newRightMargin = CLng(inputRightMargin + &quot;00&quot;) newRightMargin = covertMMtoLong(inputRightMargin)
EndIf EndIf
End If End If
textFieldWidth = newWidth - newLeftMargin - newRightMargin textFieldWidth = newWidth - newLeftMargin - newRightMargin
@ -175,8 +315,35 @@ Sub setDimensions
curStyle.TopMargin = newTopMargin curStyle.TopMargin = newTopMargin
curStyle.BottomMargin = newBottomMargin curStyle.BottomMargin = newBottomMargin
EndIf EndIf
Next
Exit Sub Exit Sub
End Sub End Sub
Function covertMMtoLong(dimension As String) As Long
If Len(dimension) &lt; 1 Then
convertMMtoLong = -1
Exit Function
EndIf
dimension = customReplace(dimension, &quot;,&quot;, &quot;.&quot;)
If Not IsNumeric(dimension) Then
convertMMtoLong = -1
Exit Function
EndIf
Dim value As Double
value = CDbl(dimension)
If value &lt; 0 Then
convertMMtoLong = -1
Exit Function
EndIf
value = value * 100
covertMMtoLong = CLng(value)
End Function
Function customReplace(Source As String, Search As String, NewPart As String) As String
Dim Result As String
Result = join(split(Source, Search), NewPart)
customReplace = Result
End Function
</script:module> </script:module>

View file

@ -172,6 +172,27 @@ Function getRussian(identifier As String) As String
Case &quot;compileJournalIssueInitialsAuthorDummyText&quot; Case &quot;compileJournalIssueInitialsAuthorDummyText&quot;
getRussian = &quot;И.О. Фамилия&quot; getRussian = &quot;И.О. Фамилия&quot;
Exit Function Exit Function
Case &quot;PageConfigDialogTranslations&quot;
getRussian = &quot;Размеры задаются в мм. Выберите стили страниц для изменения и укажите в целевых полях размеры в формате 12.34&quot;
Exit Function
Case &quot;PageConfigDialogTitle&quot;
getRussian = &quot;Массовая настройка стилей страниц&quot;
Exit Function
Case &quot;PageConfigDialogCancelButton&quot;
getRussian = &quot;Закрыть&quot;
Exit Function
Case &quot;PageConfigDialogOkButton&quot;
getRussian = &quot;Применить&quot;
Exit Function
Case &quot;pageStylesNoStyleSelected&quot;
getRussian = &quot;Ни одного стиля страниц не выбрано&quot;
Exit Function
Case &quot;pageStylesNoSettingsSet&quot;
getRussian = &quot;Настройки не заданы&quot;
Exit Function
Case &quot;PageConfigSettingsApplied&quot;
getRussian = &quot;Настройки применены&quot;
Exit Function
Case Else Case Else
getRussian = &quot;Перевод не найден&quot; getRussian = &quot;Перевод не найден&quot;
End Select End Select
@ -336,6 +357,27 @@ Function getEnglish(identifier As String) As String
Case &quot;compileJournalIssueInitialsAuthorDummyText&quot; Case &quot;compileJournalIssueInitialsAuthorDummyText&quot;
getEnglish = &quot;И.О. Фамилия&quot; getEnglish = &quot;И.О. Фамилия&quot;
Exit Function Exit Function
Case &quot;PageConfigDialogTranslations&quot;
getEnglish = &quot;Dimensions are set in mm. Choose page styles and fill in target fields in format 12.34&quot;
Exit Function
Case &quot;PageConfigDialogTitle&quot;
getEnglish = &quot;Page styles batch settings&quot;
Exit Function
Case &quot;PageConfigDialogCancelButton&quot;
getEnglish = &quot;Cancel&quot;
Exit Function
Case &quot;PageConfigDialogOkButton&quot;
getEnglish = &quot;Ok&quot;
Exit Function
Case &quot;pageStylesNoStyleSelected&quot;
getEnglish = &quot;No page styles selected. Select at least one.&quot;
Exit Function
Case &quot;pageStylesNoSettingsSet&quot;
getEnglish = &quot;No settings set. Set at least one.&quot;
Exit Function
Case &quot;PageConfigSettingsApplied&quot;
getEnglish = &quot;Settings saved.&quot;
Exit Function
Case Else Case Else
getEnglish = &quot;No translation&quot; getEnglish = &quot;No translation&quot;
End Select End Select

View file

@ -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 journalsMark16 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="journals" script:language="StarBasic">Private sub journalsMark18
End sub End sub
Dim templateName As String Dim templateName As String

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.