11ecadb57SMathias Bauer<?xml version="1.0" encoding="UTF-8"?>
21ecadb57SMathias Bauer<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*3e02b54dSAndrew Rist<!--***********************************************************
4*3e02b54dSAndrew Rist *
5*3e02b54dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
6*3e02b54dSAndrew Rist * or more contributor license agreements.  See the NOTICE file
7*3e02b54dSAndrew Rist * distributed with this work for additional information
8*3e02b54dSAndrew Rist * regarding copyright ownership.  The ASF licenses this file
9*3e02b54dSAndrew Rist * to you under the Apache License, Version 2.0 (the
10*3e02b54dSAndrew Rist * "License"); you may not use this file except in compliance
11*3e02b54dSAndrew Rist * with the License.  You may obtain a copy of the License at
12*3e02b54dSAndrew Rist *
13*3e02b54dSAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
14*3e02b54dSAndrew Rist *
15*3e02b54dSAndrew Rist * Unless required by applicable law or agreed to in writing,
16*3e02b54dSAndrew Rist * software distributed under the License is distributed on an
17*3e02b54dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18*3e02b54dSAndrew Rist * KIND, either express or implied.  See the License for the
19*3e02b54dSAndrew Rist * specific language governing permissions and limitations
20*3e02b54dSAndrew Rist * under the License.
21*3e02b54dSAndrew Rist *
22*3e02b54dSAndrew Rist ***********************************************************-->
231ecadb57SMathias Bauer<script:module xmlns:script="http://openoffice.org/2000/script" script:name="OtherElements" script:language="StarBasic">REM  *****  BASIC  *****
241ecadb57SMathias Bauer
251ecadb57SMathias BauerSub Main
261ecadb57SMathias Bauer
271ecadb57SMathias BauerEnd Sub
281ecadb57SMathias Bauer
291ecadb57SMathias BauerSub InsertVariable
301ecadb57SMathias Bauer
311ecadb57SMathias Bauer	If not IsHelpFile Then
321ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
331ecadb57SMathias Bauer		Exit Sub
341ecadb57SMathias Bauer	End If
351ecadb57SMathias Bauer
361ecadb57SMathias Bauer	oSel = thiscomponent.getcurrentcontroller.getselection
371ecadb57SMathias Bauer	oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
381ecadb57SMathias Bauer	oStart = oCur.getStart
391ecadb57SMathias Bauer	oCurStart = oStart.getText.createTextCursorByRange(oStart)
401ecadb57SMathias Bauer	oEnd = oCur.getEnd
411ecadb57SMathias Bauer	oCurEnd = oEnd.getText.createTextCursorByRange(oEnd)
421ecadb57SMathias Bauer
431ecadb57SMathias Bauer	ID = inputbox(&quot;Enter an identifier for the variable element:&quot;,&quot;Enter Variable ID&quot;)
441ecadb57SMathias Bauer
451ecadb57SMathias Bauer	If ID=&quot;&quot; Then
461ecadb57SMathias Bauer		Exit Sub
471ecadb57SMathias Bauer	End If
481ecadb57SMathias Bauer
491ecadb57SMathias Bauer	thiscomponent.getcurrentcontroller.select(oCurStart)
501ecadb57SMathias Bauer	InsertTag(&quot;VAR_&quot;,&quot;&lt;VAR ID=&quot;&quot;&quot;+ID+&quot;&quot;&quot;&gt;&quot;)
511ecadb57SMathias Bauer	thiscomponent.getcurrentcontroller.select(oCurEnd)
521ecadb57SMathias Bauer	InsertTag(&quot;_VAR&quot;,&quot;&lt;/VAR&gt;&quot;)
531ecadb57SMathias BauerEnd Sub
541ecadb57SMathias Bauer
551ecadb57SMathias BauerSub InsertInlineGraphic
561ecadb57SMathias Bauer	If not IsHelpFile Then
571ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
581ecadb57SMathias Bauer		Exit Sub
591ecadb57SMathias Bauer	End If
601ecadb57SMathias Bauer	sFName = OpenGraphics
611ecadb57SMathias Bauer	If sFName &lt;&gt; &quot;&quot; Then
621ecadb57SMathias Bauer		sAlt = InputBox(&quot;Enter an alternative Text for the graphical element.&quot;+chr(13)+&quot;This can be changed later in the image properties.&quot;,&quot;ALT description&quot;,&quot;&lt;ALT DESCRIPTION&gt;&quot;)
631ecadb57SMathias Bauer		sID = &quot;img_id&quot;+CreateID
641ecadb57SMathias Bauer		InsertTag(&quot;IMG_&quot;,&quot;&lt;IMG ID=&quot;&quot;&quot;+sID+&quot;&quot;&quot;&gt;&quot;)
651ecadb57SMathias Bauer		InsertGraphicFile(sFName,sID,sAlt)
661ecadb57SMathias Bauer		InsertTag(&quot;_IMG&quot;,&quot;&lt;/IMG&gt;&quot;)
671ecadb57SMathias Bauer	End If
681ecadb57SMathias BauerEnd Sub
691ecadb57SMathias Bauer
701ecadb57SMathias BauerSub InsertGraphic
711ecadb57SMathias Bauer
721ecadb57SMathias Bauer	If not IsHelpFile Then
731ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
741ecadb57SMathias Bauer		Exit Sub
751ecadb57SMathias Bauer	End If
761ecadb57SMathias Bauer
771ecadb57SMathias Bauer	GlobalScope.BasicLibraries.loadLibrary(&quot;Tools&quot;)
781ecadb57SMathias Bauer	sFName = OpenGraphics
791ecadb57SMathias Bauer	If sFName &lt;&gt; &quot;&quot; Then
801ecadb57SMathias Bauer		DocRoot = ReadConfig(&quot;HelpPrefix&quot;)
811ecadb57SMathias Bauer&apos;		msgbox(&quot;DocRoot &quot;+DocRoot+chr(13)+&quot;FName &quot;+sFName)
821ecadb57SMathias Bauer
831ecadb57SMathias Bauer		If not(IsSubDir(sFName,DocRoot)) Then
841ecadb57SMathias Bauer			msgbox(&quot;Image is located outside of your Document Root&quot;+chr(13)+DocRoot,48,&quot;Warning&quot;)
851ecadb57SMathias Bauer		End If
861ecadb57SMathias Bauer
871ecadb57SMathias Bauer		sAlt = InputBox(&quot;Enter an alternative Text for the graphical element.&quot;+chr(13)+&quot;This can be changed later in the image properties.&quot;,&quot;ALT description&quot;,&quot;&lt;ALT DESCRIPTION&gt;&quot;)
881ecadb57SMathias Bauer&apos;		sCap = InputBox(&quot;Enter a caption for the image (optional)&quot;,&quot;Caption&quot;,&quot;&quot;)
891ecadb57SMathias Bauer		sID = CreateID
901ecadb57SMathias Bauer		CR
911ecadb57SMathias Bauer		InsertTag(&quot;IMG_&quot;,&quot;&lt;IMG ID=&quot;&quot;&quot;+&quot;img_id&quot;+sID+&quot;&quot;&quot;&gt;&quot;)
921ecadb57SMathias Bauer		InsertGraphicFile(sFName,&quot;img_id&quot;+sID,sAlt)
931ecadb57SMathias Bauer&apos;		If sCap &lt;&gt; &quot;&quot; Then
941ecadb57SMathias Bauer&apos;			InsertCaption(sCap,&quot;cap_id&quot;+sID)
951ecadb57SMathias Bauer&apos;		End If
961ecadb57SMathias Bauer		InsertTag(&quot;_IMG&quot;,&quot;&lt;/IMG&gt;&quot;)
971ecadb57SMathias Bauer	End If
981ecadb57SMathias BauerEnd Sub
991ecadb57SMathias Bauer
1001ecadb57SMathias Bauer
1011ecadb57SMathias BauerSub InsertGraphicFile(sURL As String, sName As String, sAlt As String)
1021ecadb57SMathias Bauer	oSel = thiscomponent.getcurrentcontroller.getselection
1031ecadb57SMathias Bauer	oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
1041ecadb57SMathias Bauer	oDoc = StarDesktop.CurrentComponent
1051ecadb57SMathias Bauer	oGrp = oDoc.createInstance(&quot;com.sun.star.text.GraphicObject&quot;)
1061ecadb57SMathias Bauer	oGrp.GraphicURL = sURL
1071ecadb57SMathias Bauer	oGrp.AnchorType = 1
1081ecadb57SMathias Bauer	oGrp.Name = sName
1091ecadb57SMathias Bauer	oGrp.Title = sAlt
1101ecadb57SMathias Bauer	oCur.Text.InsertTextContent(oCur,oGrp,true)
1111ecadb57SMathias BauerEnd Sub
1121ecadb57SMathias Bauer
1131ecadb57SMathias BauerSub SpecifyCaption
1141ecadb57SMathias Bauer	&apos;check if the image allows captions
1151ecadb57SMathias Bauer	If thiscomponent.getcurrentcontroller.getselection.ImplementationName = &quot;SwXTextGraphicObject&quot; Then
1161ecadb57SMathias Bauer		msgbox &quot;Please press ESCAPE to deselect the image and recall the menu item&quot;
1171ecadb57SMathias Bauer		Exit Sub
1181ecadb57SMathias Bauer	End If
1191ecadb57SMathias Bauer	If IsBlockImage Then
1201ecadb57SMathias Bauer		If not(HasCaption) Then
1211ecadb57SMathias Bauer			sCap = InputBox(&quot;Enter a caption for the image (optional)&quot;,&quot;Caption&quot;,&quot;&quot;)
1221ecadb57SMathias Bauer			If sCap &lt;&gt; &quot;&quot; Then
1231ecadb57SMathias Bauer				sID = GetImageID
1241ecadb57SMathias Bauer				sID = &quot;cap&quot;+right(sID, Len(sID)-3)
1251ecadb57SMathias Bauer				GoLeft(1)
1261ecadb57SMathias Bauer				InsertCaption(sCap, sID)
1271ecadb57SMathias Bauer			End If
1281ecadb57SMathias Bauer		Else
1291ecadb57SMathias Bauer			msgbox &quot;Image has a caption already.&quot;,0,&quot;D&apos;oh!&quot;
1301ecadb57SMathias Bauer		End If
1311ecadb57SMathias Bauer	Else
1321ecadb57SMathias Bauer		msgbox &quot;Only block images may have captions.&quot;,0,&quot;D&apos;oh!&quot;
1331ecadb57SMathias Bauer	End If
1341ecadb57SMathias BauerEnd Sub
1351ecadb57SMathias Bauer
1361ecadb57SMathias BauerSub InsertCaption(sCap As String, sID as String)
1371ecadb57SMathias Bauer		InsertTag(&quot;IMGCAPTION_&quot;,&quot;&lt;IMGCAPTION id=&quot;&quot;&quot;+sID+&quot;&quot;&quot;&gt;&quot;)
1381ecadb57SMathias Bauer		InsertText(sCap)
1391ecadb57SMathias Bauer		InsertTag(&quot;_IMGCAPTION&quot;,&quot;&lt;/IMGCAPTION&gt;&quot;)
1401ecadb57SMathias BauerEnd Sub
1411ecadb57SMathias Bauer
1421ecadb57SMathias BauerSub InsertExtendedTip
1431ecadb57SMathias Bauer
1441ecadb57SMathias Bauer	If not IsHelpFile Then
1451ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
1461ecadb57SMathias Bauer		Exit Sub
1471ecadb57SMathias Bauer	End If
1481ecadb57SMathias Bauer
1491ecadb57SMathias Bauer	oSel = thiscomponent.getcurrentcontroller.getselection
1501ecadb57SMathias Bauer	oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
1511ecadb57SMathias Bauer	oStart = oCur.getStart
1521ecadb57SMathias Bauer	oCurStart = oStart.getText.createTextCursorByRange(oStart)
1531ecadb57SMathias Bauer	oEnd = oCur.getEnd
1541ecadb57SMathias Bauer	oCurEnd = oEnd.getText.createTextCursorByRange(oEnd)
1551ecadb57SMathias Bauer
1561ecadb57SMathias Bauer	Ret = msgbox (&quot;Create a hidden tip?&quot;,3+32,&quot;Extended Tip&quot;)
1571ecadb57SMathias Bauer
1581ecadb57SMathias Bauer	If Ret=2 or Ret=3 Then
1591ecadb57SMathias Bauer		Exit Sub
1601ecadb57SMathias Bauer	End If
1611ecadb57SMathias Bauer
1621ecadb57SMathias Bauer	thiscomponent.getcurrentcontroller.select(oCurStart)
1631ecadb57SMathias Bauer	If Ret=6 Then
1641ecadb57SMathias Bauer		InsertTag(&quot;AHID_&quot;,&quot;&lt;AHID hid=&quot;&quot;&quot;+ID+&quot;&quot;&quot;&gt;&quot;)
1651ecadb57SMathias Bauer	ElseIf Ret=7 Then
1661ecadb57SMathias Bauer		InsertTag(&quot;AVIS_&quot;,&quot;&lt;AVIS hid=&quot;&quot;&quot;+ID+&quot;&quot;&quot;&gt;&quot;)
1671ecadb57SMathias Bauer	End If
1681ecadb57SMathias Bauer	thiscomponent.getcurrentcontroller.select(oCurEnd)
1691ecadb57SMathias Bauer	If Ret=6 Then
1701ecadb57SMathias Bauer		InsertTag(&quot;_AHID&quot;,&quot;&lt;/AHID&gt;&quot;)
1711ecadb57SMathias Bauer	ElseIf Ret=7 Then
1721ecadb57SMathias Bauer		InsertTag(&quot;_AVIS&quot;,&quot;&lt;/AVIS&gt;&quot;)
1731ecadb57SMathias Bauer	End If
1741ecadb57SMathias BauerEnd Sub
1751ecadb57SMathias Bauer
1761ecadb57SMathias BauerSub InsertSort
1771ecadb57SMathias Bauer	CR
1781ecadb57SMathias Bauer	SetParaStyle(&quot;hlp_aux_sort&quot;)
1791ecadb57SMathias Bauer	InsertTag(&quot;SORT_&quot;,&quot;&lt;SORT order=&quot;&quot;asc&quot;&quot;&gt;&quot;,&quot;hlp_aux_sort&quot;)
1801ecadb57SMathias Bauer	GoLeft(1)
1811ecadb57SMathias Bauer	GoDown(1)
1821ecadb57SMathias Bauer	msgbox &quot;Remember to also specify the closing SORT tag!&quot;,48,&quot;Don&apos;t forget to close the tag&quot;
1831ecadb57SMathias BauerEnd Sub
1841ecadb57SMathias Bauer
1851ecadb57SMathias BauerSub CloseSort
1861ecadb57SMathias Bauer	CR
1871ecadb57SMathias Bauer	SetParaStyle(&quot;hlp_aux_sort&quot;)
1881ecadb57SMathias Bauer	InsertTag(&quot;_SORT&quot;,&quot;&lt;/SORT&gt;&quot;,&quot;hlp_aux_sort&quot;)
1891ecadb57SMathias Bauer	GoLeft(1)
1901ecadb57SMathias Bauer	GoDown(1)
1911ecadb57SMathias BauerEnd Sub
1921ecadb57SMathias Bauer
1931ecadb57SMathias Bauersub InsertSection
1941ecadb57SMathias Bauer
1951ecadb57SMathias Bauer
1961ecadb57SMathias Bauer	If not IsHelpFile Then
1971ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
1981ecadb57SMathias Bauer		Exit Sub
1991ecadb57SMathias Bauer	End If
2001ecadb57SMathias Bauer
2011ecadb57SMathias Bauer	dim document   as object
2021ecadb57SMathias Bauer	dim dispatcher as object
2031ecadb57SMathias Bauer
2041ecadb57SMathias Bauer	oSel = thiscomponent.getcurrentcontroller.getselection
2051ecadb57SMathias Bauer	oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
2061ecadb57SMathias Bauer	oStart = oCur.getStart
2071ecadb57SMathias Bauer	oCurStart = oStart.getText.createTextCursorByRange(oStart)
2081ecadb57SMathias Bauer	oEnd = oCur.getEnd
2091ecadb57SMathias Bauer	oCurEnd = oEnd.getText.createTextCursorByRange(oEnd)
2101ecadb57SMathias Bauer
2111ecadb57SMathias Bauer	sSectionName = AlphaNum(inputbox(&quot;Please specify a section name/identifier:&quot;))
2121ecadb57SMathias Bauer
2131ecadb57SMathias Bauer	If sSectionName = &quot;&quot; Then
2141ecadb57SMathias Bauer		Exit Sub
2151ecadb57SMathias Bauer	End If
2161ecadb57SMathias Bauer
2171ecadb57SMathias Bauer	If sSectionName = &quot;&quot; Then
2181ecadb57SMathias Bauer		msgbox &quot;No (valid) identifier -- no section.&quot;+chr(13)+&quot;Hint: Use only A-Z,a-z,0-9 and _&quot;,48,&quot;D&apos;oh!&quot;
2191ecadb57SMathias Bauer		Exit Sub
2201ecadb57SMathias Bauer	End If
2211ecadb57SMathias Bauer
2221ecadb57SMathias Bauer	document   = ThisComponent.CurrentController.Frame
2231ecadb57SMathias Bauer	dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
2241ecadb57SMathias Bauer
2251ecadb57SMathias Bauer	dim args(6) as new com.sun.star.beans.PropertyValue
2261ecadb57SMathias Bauer	args(0).Name = &quot;RegionName&quot;
2271ecadb57SMathias Bauer	args(0).Value = sSectionName
2281ecadb57SMathias Bauer	args(1).Name = &quot;RegionCondition&quot;
2291ecadb57SMathias Bauer	args(1).Value = &quot;&quot;
2301ecadb57SMathias Bauer	args(2).Name = &quot;RegionHidden&quot;
2311ecadb57SMathias Bauer	args(2).Value = false
2321ecadb57SMathias Bauer	args(3).Name = &quot;RegionProtect&quot;
2331ecadb57SMathias Bauer	args(3).Value = false
2341ecadb57SMathias Bauer	args(4).Name = &quot;LinkName&quot;
2351ecadb57SMathias Bauer	args(4).Value = &quot;&quot;
2361ecadb57SMathias Bauer	args(5).Name = &quot;FilterName&quot;
2371ecadb57SMathias Bauer	args(5).Value = &quot;&quot;
2381ecadb57SMathias Bauer	args(6).Name = &quot;SubRegion&quot;
2391ecadb57SMathias Bauer	args(6).Value = &quot;&quot;
2401ecadb57SMathias Bauer
2411ecadb57SMathias Bauer	dispatcher.executeDispatch(document, &quot;.uno:InsertSection&quot;, &quot;&quot;, 0, args())
2421ecadb57SMathias Bauer
2431ecadb57SMathias Bauer	If oCur.GetString &lt;&gt; &quot;&quot; Then
2441ecadb57SMathias Bauer		thiscomponent.getcurrentcontroller.select(oCurStart)
2451ecadb57SMathias Bauer		CR_before
2461ecadb57SMathias Bauer		GoUp(1)
2471ecadb57SMathias Bauer		InsertTag(&quot;SECTION_&quot;,&quot;&lt;SECTION id=&quot;&quot;&quot;+sSectionName+&quot;&quot;&quot;&gt;&quot;)
2481ecadb57SMathias Bauer		SetParaStyle(&quot;hlp_aux_section&quot;)
2491ecadb57SMathias Bauer
2501ecadb57SMathias Bauer		thiscomponent.getcurrentcontroller.select(oCurEnd)
2511ecadb57SMathias Bauer		CR
2521ecadb57SMathias Bauer		SetParaStyle(&quot;hlp_aux_section&quot;)
2531ecadb57SMathias Bauer		InsertTag(&quot;_SECTION&quot;,&quot;&lt;/SECTION&gt;&quot;)
2541ecadb57SMathias Bauer	Else
2551ecadb57SMathias Bauer		GoUp(1)
2561ecadb57SMathias Bauer		InsertTagCR(&quot;SECTION_&quot;,&quot;&lt;SECTION id=&quot;&quot;&quot;+sSectionName+&quot;&quot;&quot;&gt;&quot;,&quot;hlp_aux_section&quot;)
2571ecadb57SMathias Bauer		CR
2581ecadb57SMathias Bauer		SetParaStyle(&quot;hlp_aux_section&quot;)
2591ecadb57SMathias Bauer		InsertTag(&quot;_SECTION&quot;,&quot;&lt;/SECTION&gt;&quot;)
2601ecadb57SMathias Bauer		GoUp(1)
2611ecadb57SMathias Bauer		SetParaStyle(&quot;hlp_default&quot;)
2621ecadb57SMathias Bauer	End If
2631ecadb57SMathias Bauer
2641ecadb57SMathias Bauerend sub
2651ecadb57SMathias Bauer
2661ecadb57SMathias BauerSub ToggleParaL10NStatus
2671ecadb57SMathias Bauer
2681ecadb57SMathias Bauer	If not IsHelpFile Then
2691ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
2701ecadb57SMathias Bauer		Exit Sub
2711ecadb57SMathias Bauer	End If
2721ecadb57SMathias Bauer
2731ecadb57SMathias Bauer	oSel = thiscomponent.getcurrentcontroller.getselection
2741ecadb57SMathias Bauer	oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
2751ecadb57SMathias Bauer
2761ecadb57SMathias Bauer	oCur.gotoStartOfParagraph(0)
2771ecadb57SMathias Bauer	CharStyle = oCur.charStyleName
2781ecadb57SMathias Bauer
2791ecadb57SMathias Bauer	arParaData = GetParaData
2801ecadb57SMathias Bauer	sID = arParaData(0)
2811ecadb57SMathias Bauer	slocalize = arParaData(1)
2821ecadb57SMathias Bauer	sMsg = arParaData(2)
2831ecadb57SMathias Bauer
2841ecadb57SMathias Bauer	If sMsg &lt;&gt; &quot;&quot; Then
2851ecadb57SMathias Bauer		msgbox &quot;Error in paragraph status:&quot;+chr(13)+sMsg,48,&quot;Error&quot;
2861ecadb57SMathias Bauer		Exit Sub
2871ecadb57SMathias Bauer	End If
2881ecadb57SMathias Bauer
2891ecadb57SMathias Bauer
2901ecadb57SMathias Bauer	If (sID = &quot;&quot;) Then
2911ecadb57SMathias Bauer		msgbox &quot;Paragraph has no ID. Assigning ID.&quot;,48,&quot;Info&quot;
2921ecadb57SMathias Bauer		InsertNewParaData
2931ecadb57SMathias Bauer		thiscomponent.getcurrentcontroller.select(oSel(0))
2941ecadb57SMathias Bauer		arParaData = GetParaData
2951ecadb57SMathias Bauer		sID = arParaData(0)
2961ecadb57SMathias Bauer		slocalize = arParaData(1)
2971ecadb57SMathias Bauer		sMsg = arParaData(2)
2981ecadb57SMathias Bauer	End If
2991ecadb57SMathias Bauer
3001ecadb57SMathias Bauer	If slocalize = &quot;no&quot; Then
3011ecadb57SMathias Bauer		SetParaData(sID,&quot;yes&quot;)
3021ecadb57SMathias Bauer	Else
3031ecadb57SMathias Bauer		SetParaData(sID,&quot;no&quot;)
3041ecadb57SMathias Bauer	End If
3051ecadb57SMathias Bauer
3061ecadb57SMathias Bauer	thiscomponent.getcurrentcontroller.select(oSel(0))
3071ecadb57SMathias Bauer
3081ecadb57SMathias BauerEnd Sub
3091ecadb57SMathias Bauer
3101ecadb57SMathias Bauer
3111ecadb57SMathias BauerSub LocalizeImage
3121ecadb57SMathias Bauer	oSel = thiscomponent.getcurrentcontroller.getselection
3131ecadb57SMathias Bauer	If oSel(0).ImplementationName &lt;&gt; &quot;SwXTextGraphicObject&quot; Then
3141ecadb57SMathias Bauer		msgbox &quot;Please select an image&quot;
3151ecadb57SMathias Bauer	Else
3161ecadb57SMathias Bauer		If Instr(oSel(0).Name,&quot; &quot;)&gt;0 Then
3171ecadb57SMathias Bauer			oSel(0).Name = Left(oSel(0).Name,Instr(oSel(0).Name,&quot; &quot;)-1)
3181ecadb57SMathias Bauer		End If
3191ecadb57SMathias Bauer		oSel(0).Name = oSel(0).Name + &quot; localize=&quot;&quot;true&quot;&quot;&quot;
3201ecadb57SMathias Bauer	End If
3211ecadb57SMathias Bauer	SetBorder
3221ecadb57SMathias BauerEnd Sub
3231ecadb57SMathias Bauer
3241ecadb57SMathias Bauer
3251ecadb57SMathias BauerSub UnLocalizeImage
3261ecadb57SMathias Bauer	oSel = thiscomponent.getcurrentcontroller.getselection
3271ecadb57SMathias Bauer	If oSel(0).ImplementationName &lt;&gt; &quot;SwXTextGraphicObject&quot; Then
3281ecadb57SMathias Bauer		msgbox &quot;Please select an image&quot;
3291ecadb57SMathias Bauer	Else
3301ecadb57SMathias Bauer
3311ecadb57SMathias Bauer		If Instr(oSel(0).Name,&quot; &quot;)&gt;0 Then
3321ecadb57SMathias Bauer			oSel(0).Name = Left(oSel(0).Name,Instr(oSel(0).Name,&quot; &quot;)-1)
3331ecadb57SMathias Bauer		End If
3341ecadb57SMathias Bauer		UnsetBorder
3351ecadb57SMathias Bauer	End If
3361ecadb57SMathias Bauer
3371ecadb57SMathias BauerEnd Sub
3381ecadb57SMathias Bauer
3391ecadb57SMathias Bauer
3401ecadb57SMathias BauerSub ResetAllParaStatusValues
3411ecadb57SMathias Bauer	REM ... to be done
3421ecadb57SMathias BauerEnd Sub
3431ecadb57SMathias Bauer
3441ecadb57SMathias BauerSub InsertHowToGet
3451ecadb57SMathias Bauer
3461ecadb57SMathias Bauer	If not IsHelpFile Then
3471ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
3481ecadb57SMathias Bauer		Exit Sub
3491ecadb57SMathias Bauer	End If
3501ecadb57SMathias Bauer
3511ecadb57SMathias Bauer	document   = ThisComponent.CurrentController.Frame
3521ecadb57SMathias Bauer	dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
3531ecadb57SMathias Bauer
3541ecadb57SMathias Bauer	dim args(6) as new com.sun.star.beans.PropertyValue
3551ecadb57SMathias Bauer	args(0).Name = &quot;RegionName&quot;
3561ecadb57SMathias Bauer	args(0).Value = &quot;howtoget&quot;
3571ecadb57SMathias Bauer	args(1).Name = &quot;RegionCondition&quot;
3581ecadb57SMathias Bauer	args(1).Value = &quot;&quot;
3591ecadb57SMathias Bauer	args(2).Name = &quot;RegionHidden&quot;
3601ecadb57SMathias Bauer	args(2).Value = false
3611ecadb57SMathias Bauer	args(3).Name = &quot;RegionProtect&quot;
3621ecadb57SMathias Bauer	args(3).Value = false
3631ecadb57SMathias Bauer	args(4).Name = &quot;LinkName&quot;
3641ecadb57SMathias Bauer	args(4).Value = &quot;&quot;
3651ecadb57SMathias Bauer	args(5).Name = &quot;FilterName&quot;
3661ecadb57SMathias Bauer	args(5).Value = &quot;&quot;
3671ecadb57SMathias Bauer	args(6).Name = &quot;SubRegion&quot;
3681ecadb57SMathias Bauer	args(6).Value = &quot;&quot;
3691ecadb57SMathias Bauer
3701ecadb57SMathias Bauer	dispatcher.executeDispatch(document, &quot;.uno:InsertSection&quot;, &quot;&quot;, 0, args())
3711ecadb57SMathias Bauer	GoUp(1)
3721ecadb57SMathias Bauer	InsertTagCR(&quot;SECTION_&quot;,&quot;&lt;SECTION id=&quot;&quot;howtoget&quot;&quot;&gt;&quot;,&quot;hlp_aux_section&quot;)
3731ecadb57SMathias Bauer	CR
3741ecadb57SMathias Bauer	SetParaStyle(&quot;hlp_aux_section&quot;)
3751ecadb57SMathias Bauer	InsertTag(&quot;_SECTION&quot;,&quot;&lt;/SECTION&gt;&quot;)
3761ecadb57SMathias Bauer	GoUp(1)
3771ecadb57SMathias Bauer	SetParaStyle(&quot;hlp_default&quot;)
3781ecadb57SMathias Bauer&apos;	Embed.Main(false)
3791ecadb57SMathias BauerEnd Sub
3801ecadb57SMathias Bauer
3811ecadb57SMathias BauerSub InsertRelatedTopics
3821ecadb57SMathias Bauer
3831ecadb57SMathias Bauer	If not IsHelpFile Then
3841ecadb57SMathias Bauer		msgbox(strErr_NoHelpFile)
3851ecadb57SMathias Bauer		Exit Sub
3861ecadb57SMathias Bauer	End If
3871ecadb57SMathias Bauer
3881ecadb57SMathias Bauer	document   = ThisComponent.CurrentController.Frame
3891ecadb57SMathias Bauer	dispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
3901ecadb57SMathias Bauer
3911ecadb57SMathias Bauer	dim args(6) as new com.sun.star.beans.PropertyValue
3921ecadb57SMathias Bauer	args(0).Name = &quot;RegionName&quot;
3931ecadb57SMathias Bauer	args(0).Value = &quot;relatedtopics&quot;
3941ecadb57SMathias Bauer	args(1).Name = &quot;RegionCondition&quot;
3951ecadb57SMathias Bauer	args(1).Value = &quot;&quot;
3961ecadb57SMathias Bauer	args(2).Name = &quot;RegionHidden&quot;
3971ecadb57SMathias Bauer	args(2).Value = false
3981ecadb57SMathias Bauer	args(3).Name = &quot;RegionProtect&quot;
3991ecadb57SMathias Bauer	args(3).Value = false
4001ecadb57SMathias Bauer	args(4).Name = &quot;LinkName&quot;
4011ecadb57SMathias Bauer	args(4).Value = &quot;&quot;
4021ecadb57SMathias Bauer	args(5).Name = &quot;FilterName&quot;
4031ecadb57SMathias Bauer	args(5).Value = &quot;&quot;
4041ecadb57SMathias Bauer	args(6).Name = &quot;SubRegion&quot;
4051ecadb57SMathias Bauer	args(6).Value = &quot;&quot;
4061ecadb57SMathias Bauer
4071ecadb57SMathias Bauer	dispatcher.executeDispatch(document, &quot;.uno:InsertSection&quot;, &quot;&quot;, 0, args())
4081ecadb57SMathias Bauer	GoUp(1)
4091ecadb57SMathias Bauer	InsertTagCR(&quot;SECTION_&quot;,&quot;&lt;SECTION id=&quot;&quot;relatedtopics&quot;&quot;&gt;&quot;,&quot;hlp_aux_section&quot;)
4101ecadb57SMathias Bauer	CR
4111ecadb57SMathias Bauer	SetParaStyle(&quot;hlp_aux_section&quot;)
4121ecadb57SMathias Bauer	InsertTag(&quot;_SECTION&quot;,&quot;&lt;/SECTION&gt;&quot;)
4131ecadb57SMathias Bauer	GoUp(1)
4141ecadb57SMathias Bauer	SetParaStyle(&quot;hlp_default&quot;)
4151ecadb57SMathias BauerEnd Sub
4161ecadb57SMathias Bauer
4171ecadb57SMathias Bauer
4181ecadb57SMathias Bauersub UnsetBorder
4191ecadb57SMathias Bauerrem ----------------------------------------------------------------------
4201ecadb57SMathias Bauerrem define variables
4211ecadb57SMathias Bauerdim document   as object
4221ecadb57SMathias Bauerdim dispatcher as object
4231ecadb57SMathias Bauerrem ----------------------------------------------------------------------
4241ecadb57SMathias Bauerrem get access to the document
4251ecadb57SMathias Bauerdocument   = ThisComponent.CurrentController.Frame
4261ecadb57SMathias Bauerdispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
4271ecadb57SMathias Bauer
4281ecadb57SMathias Bauerrem ----------------------------------------------------------------------
4291ecadb57SMathias Bauerdim args1(7) as new com.sun.star.beans.PropertyValue
4301ecadb57SMathias Bauerargs1(0).Name = &quot;BorderOuter.LeftBorder&quot;
4311ecadb57SMathias Bauerargs1(0).Value = Array(0,0,0,0)
4321ecadb57SMathias Bauerargs1(1).Name = &quot;BorderOuter.LeftDistance&quot;
4331ecadb57SMathias Bauerargs1(1).Value = 10
4341ecadb57SMathias Bauerargs1(2).Name = &quot;BorderOuter.RightBorder&quot;
4351ecadb57SMathias Bauerargs1(2).Value = Array(0,0,0,0)
4361ecadb57SMathias Bauerargs1(3).Name = &quot;BorderOuter.RightDistance&quot;
4371ecadb57SMathias Bauerargs1(3).Value = 0
4381ecadb57SMathias Bauerargs1(4).Name = &quot;BorderOuter.TopBorder&quot;
4391ecadb57SMathias Bauerargs1(4).Value = Array(0,0,0,0)
4401ecadb57SMathias Bauerargs1(5).Name = &quot;BorderOuter.TopDistance&quot;
4411ecadb57SMathias Bauerargs1(5).Value = 0
4421ecadb57SMathias Bauerargs1(6).Name = &quot;BorderOuter.BottomBorder&quot;
4431ecadb57SMathias Bauerargs1(6).Value = Array(0,0,0,0)
4441ecadb57SMathias Bauerargs1(7).Name = &quot;BorderOuter.BottomDistance&quot;
4451ecadb57SMathias Bauerargs1(7).Value = 0
4461ecadb57SMathias Bauer
4471ecadb57SMathias Bauerdispatcher.executeDispatch(document, &quot;.uno:BorderOuter&quot;, &quot;&quot;, 0, args1())
4481ecadb57SMathias Bauer
4491ecadb57SMathias Bauerrem ----------------------------------------------------------------------
4501ecadb57SMathias Bauerdim args2(4) as new com.sun.star.beans.PropertyValue
4511ecadb57SMathias Bauerargs2(0).Name = &quot;BorderInner.Horizontal&quot;
4521ecadb57SMathias Bauerargs2(0).Value = Array(0,0,0,0)
4531ecadb57SMathias Bauerargs2(1).Name = &quot;BorderInner.Vertical&quot;
4541ecadb57SMathias Bauerargs2(1).Value = Array(0,0,0,0)
4551ecadb57SMathias Bauerargs2(2).Name = &quot;BorderInner.Flags&quot;
4561ecadb57SMathias Bauerargs2(2).Value = 2
4571ecadb57SMathias Bauerargs2(3).Name = &quot;BorderInner.ValidFlags&quot;
4581ecadb57SMathias Bauerargs2(3).Value = 63
4591ecadb57SMathias Bauerargs2(4).Name = &quot;BorderInner.DefaultDistance&quot;
4601ecadb57SMathias Bauerargs2(4).Value = 0
4611ecadb57SMathias Bauer
4621ecadb57SMathias Bauerdispatcher.executeDispatch(document, &quot;.uno:BorderInner&quot;, &quot;&quot;, 0, args2())
4631ecadb57SMathias Bauer
4641ecadb57SMathias Bauer
4651ecadb57SMathias Bauerend sub
4661ecadb57SMathias Bauer
4671ecadb57SMathias Bauer
4681ecadb57SMathias Bauer
4691ecadb57SMathias Bauersub SetBorder
4701ecadb57SMathias Bauerrem ----------------------------------------------------------------------
4711ecadb57SMathias Bauerrem define variables
4721ecadb57SMathias Bauerdim document   as object
4731ecadb57SMathias Bauerdim dispatcher as object
4741ecadb57SMathias Bauerrem ----------------------------------------------------------------------
4751ecadb57SMathias Bauerrem get access to the document
4761ecadb57SMathias Bauerdocument   = ThisComponent.CurrentController.Frame
4771ecadb57SMathias Bauerdispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
4781ecadb57SMathias Bauer
4791ecadb57SMathias Bauerrem ----------------------------------------------------------------------
4801ecadb57SMathias Bauerdim args1(7) as new com.sun.star.beans.PropertyValue
4811ecadb57SMathias Bauerargs1(0).Name = &quot;BorderOuter.LeftBorder&quot;
4821ecadb57SMathias Bauerargs1(0).Value = Array(15167232,0,88,0)
4831ecadb57SMathias Bauerargs1(1).Name = &quot;BorderOuter.LeftDistance&quot;
4841ecadb57SMathias Bauerargs1(1).Value = 101
4851ecadb57SMathias Bauerargs1(2).Name = &quot;BorderOuter.RightBorder&quot;
4861ecadb57SMathias Bauerargs1(2).Value = Array(15167232,0,88,0)
4871ecadb57SMathias Bauerargs1(3).Name = &quot;BorderOuter.RightDistance&quot;
4881ecadb57SMathias Bauerargs1(3).Value = 101
4891ecadb57SMathias Bauerargs1(4).Name = &quot;BorderOuter.TopBorder&quot;
4901ecadb57SMathias Bauerargs1(4).Value = Array(15167232,0,88,0)
4911ecadb57SMathias Bauerargs1(5).Name = &quot;BorderOuter.TopDistance&quot;
4921ecadb57SMathias Bauerargs1(5).Value = 101
4931ecadb57SMathias Bauerargs1(6).Name = &quot;BorderOuter.BottomBorder&quot;
4941ecadb57SMathias Bauerargs1(6).Value = Array(15167232,0,88,0)
4951ecadb57SMathias Bauerargs1(7).Name = &quot;BorderOuter.BottomDistance&quot;
4961ecadb57SMathias Bauerargs1(7).Value = 101
4971ecadb57SMathias Bauer
4981ecadb57SMathias Bauerdispatcher.executeDispatch(document, &quot;.uno:BorderOuter&quot;, &quot;&quot;, 0, args1())
4991ecadb57SMathias Bauer
5001ecadb57SMathias Bauerrem ----------------------------------------------------------------------
5011ecadb57SMathias Bauerdim args2(4) as new com.sun.star.beans.PropertyValue
5021ecadb57SMathias Bauerargs2(0).Name = &quot;BorderInner.Horizontal&quot;
5031ecadb57SMathias Bauerargs2(0).Value = Array(0,0,0,0)
5041ecadb57SMathias Bauerargs2(1).Name = &quot;BorderInner.Vertical&quot;
5051ecadb57SMathias Bauerargs2(1).Value = Array(0,0,0,0)
5061ecadb57SMathias Bauerargs2(2).Name = &quot;BorderInner.Flags&quot;
5071ecadb57SMathias Bauerargs2(2).Value = 2
5081ecadb57SMathias Bauerargs2(3).Name = &quot;BorderInner.ValidFlags&quot;
5091ecadb57SMathias Bauerargs2(3).Value = 127
5101ecadb57SMathias Bauerargs2(4).Name = &quot;BorderInner.DefaultDistance&quot;
5111ecadb57SMathias Bauerargs2(4).Value = 0
5121ecadb57SMathias Bauer
5131ecadb57SMathias Bauerdispatcher.executeDispatch(document, &quot;.uno:BorderInner&quot;, &quot;&quot;, 0, args2())
5141ecadb57SMathias Bauer
5151ecadb57SMathias Bauer
5161ecadb57SMathias Bauerend sub
517*3e02b54dSAndrew Rist</script:module>
518