Toolbars work

This commit is contained in:
Georgy Litvinov 2020-03-16 17:15:53 +01:00
parent 0fff36fa88
commit 5bb2605b42
5 changed files with 123 additions and 1 deletions

View file

@ -50,6 +50,72 @@
</node>
</node>
</node>
<node oor:name="OfficeToolBar">
<node oor:name="pro.litvinovg.ePublishing.makeuppanel" oor:op="replace">
<node oor:name="percentPlus" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument,com.sun.star.text.WebDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="ru">%+</value>
<value xml:lang="en">%+</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>macro:///ePublishing.MakeUp.incrementCharWidth</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
<node oor:name="percentMinus" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument,com.sun.star.text.WebDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="ru">%-</value>
<value xml:lang="en">%-</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>macro:///ePublishing.MakeUp.decrementCharWidth</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
<node oor:name="kernPlus" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument,com.sun.star.text.WebDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="ru">K+</value>
<value xml:lang="en">K+</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>macro:///ePublishing.MakeUp.incrementKern</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
<node oor:name="kernMinus" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument,com.sun.star.text.WebDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="ru">K-</value>
<value xml:lang="en">K-</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>macro:///ePublishing.MakeUp.decrementKern</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
</node>
</node>
<node oor:name="Images">
<node oor:name="replace-para-button" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">

View file

@ -8,6 +8,12 @@
<value xml:lang="ru">Основная панель ePublishing</value>
</prop>
</node>
<node oor:name="private:resource/toolbar/addon_pro.litvinovg.ePublishing.makeuppanel" oor:op="replace">
<prop oor:name="UIName" oor:type="xs:string">
<value xml:lang="en">ePublishing make-up</value>
<value xml:lang="ru">Панель верстки ePublishing</value>
</prop>
</node>
</node>
</node>
</oor:component-data>

View file

@ -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.1.9" />
<version value="0.1.10" />
<platform value="all" />
<display-name>
<name lang="ru">Инструменты для создания электронных изданий</name>

49
ePublishing/MakeUp.xba Normal file
View file

@ -0,0 +1,49 @@
<?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="MakeUp" script:language="StarBasic" script:moduleType="normal">Sub markMakeUp1
End Sub
Sub incrementCharWidth()
changeCharWidth(1)
End Sub
Sub decrementCharWidth()
changeCharWidth(-1)
End Sub
Sub incrementKern()
changeKern(2)
End Sub
Sub decrementKern()
changeKern(-2)
End Sub
Function changeCharWidth(delta) As Boolean
Dim oViewCursor As Object
Dim oTextCursor As Object
Dim charScale As Integer
oViewCursor = ThisComponent.CurrentController.getViewCursor()
If(IsEmpty(oViewCursor.charScaleWidth)) Then
charScale = 100
Else
charScale = oViewCursor.charScaleWidth
End If
oViewCursor = ThisComponent.CurrentController.getViewCursor()
oViewCursor.charScaleWidth = charScale + delta
End Function
Function changeKern(delta) As Boolean
Dim oViewCursor As Object
Dim oTextCursor As Object
Dim kerning As Integer
oViewCursor = ThisComponent.CurrentController.getViewCursor()
If(IsEmpty(oViewCursor.CharKerning)) Then
kerning = 0
Else
kerning = oViewCursor.CharKerning
End If
oViewCursor.CharKerning = kerning + delta
End Function
</script:module>

View file

@ -8,4 +8,5 @@
<library:element library:name="TOCLinks"/>
<library:element library:name="Album"/>
<library:element library:name="Archive"/>
<library:element library:name="MakeUp"/>
</library:library>