I’m trying to write an extension, providing a button beside “Justified” in the Formatting toolbar, making the paragraph aligned justified but the last line is justified as well, instead of align to the left. So far the button of “Justified” in Formatting toolbar only makes paragraph justified with the last line align to the left.
No problem with the macro and created the extension. However, I couldn’t put a button in the Formatting toolbar. I could add a button in the end of standardbar with the following code in Addons.xcu:
<node oor:name="N001" oor:op="replace">
<prop oor:name="MergeContext" oor:type="xs:string">
<value/>
</prop>
<prop oor:name="MergeToolBar" oor:type="xs:string">
<value>standardbar</value>
</prop>
<prop oor:name="MergePoint" oor:type="xs:string">
<value>.uno:ExtendedHelp</value>
</prop>
<prop oor:name="MergeCommand" oor:type="xs:string">
<value>AddAfter</value>
</prop>
<prop oor:name="MergeFallback" oor:type="xs:string">
<value>AddFirst</value>
</prop>
<node oor:name="ToolBarItems">
<node oor:name="N002" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value/>
</prop>
<prop oor:name="Title">
<value xml:lang="en-US">Distributed Justified</value>
<value xml:lang="zh-TW">分散對齊</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>vnd.sun.star.script:DistributedJustified.distributed-justified.main?language=Basic&location=application</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node> <!-- N002 -->
</node> <!-- ToolBarItems -->
</node> <!-- N001 -->
The button is created and can perform what I want.
However I didn’t find any document telling me the name of other toolbars.
I dug into the code, and found that the standardbar.xml
is in sw/uiconfig/swriter/toolbar/
. Then I found the “Justified” button is defined in textstylebar.xml
:
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:RightPara" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:JustifyPara" toolbar:visible="false"/>
So I tried to change my code in Addons.xcu as:
<prop oor:name="MergeContext" oor:type="xs:string">
<value/>
</prop>
<prop oor:name="MergeToolBar" oor:type="xs:string">
<value>textstylebar</value>
</prop>
<prop oor:name="MergePoint" oor:type="xs:string">
<value>.uno:JustifyPara</value>
</prop>
<prop oor:name="MergeCommand" oor:type="xs:string">
<value>AddAfter</value>
</prop>
But it didn’t work. The button was not there.
So my question here is:
- Where can I find out the name of other toolbars, used in
MergeToolBar
? Any document talking about it? I didn’t find one. - If the name follows the filename defined in uiconfig/swriter/toolbar, why did my change not work? Anything I missed?