DocScript SVN
Status: Beta
Brought to you by:
ah8
<?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="Export" script:language="StarBasic">REM ***** BASIC *****
' DocScript export script
' Copyright (C) 2009
' Andreas Harnack (ah8 at freenet dot de)
' This software is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
' You should have received a copy of the GNU General Public License along
' with this library; see the file COPYING. If not, write to the Free
' Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
' USA.
' As a special exception, you may use this file as part of a free software
' library without restriction. Specifically, if other files instantiate
' templates or use macros or inline functions from this file, or you compile
' this file and link it with other files to produce an executable, this
' file does not by itself cause the resulting executable to be covered by
' the GNU General Public License. This exception does not however
' invalidate any other reasons why the executable file might be covered by
' the GNU General Public License.
Function shift(sShift as String) as String
shift = sShift & " "
End Function
Function quoteStr(str as String) as String
quoteStr = "'" & join(split(str, "'"), "'"&CHR(34)&"'"&CHR(34)&"'") & "'"
End Function
Function ooVersion() As String
'Retrieves the running OOo version
'Author : Laurent Godard
'e-mail : listes.godard@laposte.net
Dim oSet, oConfigProvider
Dim sProvider$, sAccess$
Dim oParm(0) As New com.sun.star.beans.PropertyValue
sProvider = "com.sun.star.configuration.ConfigurationProvider"
sAccess = "com.sun.star.configuration.ConfigurationAccess"
oParm(0).Name = "nodepath"
oParm(0).Value = "/org.openoffice.Setup/Product"
oConfigProvider = createUnoService(sProvider)
oSet = oConfigProvider.createInstanceWithArguments(sAccess, oParm())
ooVersion=oSet.getByName("ooSetupVersion")
End Function
Function charStyle(oText as Objec, oPara as Object) as String
Dim sStyle as String
REM get the character style properties
If oText.CharStyleName <> "" Then
REM check for style name first
sStyle = " '" + join(split(oText.CharStyleName),"_") +"'"
Else
Dim iItalic, iBold, iFixed as Integer
iItalic = com.sun.star.awt.FontSlant.ITALIC
iBold = com.sun.star.awt.FontWeight.BOLD
iFixed = com.sun.star.awt.FontPitch.FIXED
sStyle = ""
If oText.CharPosture=iItalic And oPara.CharPosture <> iItalic Then
sStyle = sStyle + " italic"
End If
If oText.CharWeight =iBold And oPara.CharWeight <> iBold Then
sStyle = sStyle + " bold"
End If
If oText.CharFontPitch = iFixed And oPara.CharFontPitch <> iFixed Then
sStyle = sStyle + " fixedfont"
End If
End If
charStyle = sStyle
End Function
Function href(oText as Object) As String
If oText.HyperLinkName <> "" Then
href="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26amp%3Bquot%3B%2520%26amp%3Bapos%3BhrefName%2520%26amp%3Bquot%3B%2520%2B%2520CHR(34)%2520%2B%2520oText.HyperLinkName%2520%2B%2520CHR(34)%2520%2B%2520%26amp%3Bquot%3B%26amp%3Bapos%3B%26amp%3Bquot%3B%2520%2520%2520%2520ElseIf%2520oText.HyperLinkURL%2520%26amp%3Blt%3B%26amp%3Bgt%3B%2520%26amp%3Bquot%3B%26amp%3Bquot%3B%2520Then%2520%2520%2520%2520%2520%2520%2520%2520href%2520%3D%2520%26amp%3Bquot%3B%2520%26amp%3Bapos%3BhrefURL%2520%26amp%3Bquot%3B%2520%2B%2520CHR(34)%2520%2B%2520oText.HyperLinkURL%2520%2B%2520CHR(34)%2520%2B%2520%26amp%3Bquot%3B%26amp%3Bapos%3B%26amp%3Bquot%3B%2520%2520%2520%2520Else%2520%2520%2520%2520%2520%2520%2520%2520href%2520%3D%2520%26amp%3Bquot%3B%26amp%3Bquot%3B%2520%2520%2520%2520End%2520If%2520End%2520FunctionSub%2520exportText(iFile%25%2C%2520oPara%2520as%2520Object%2C%2520oText%2520as%2520Object%2C%2520sShift%24)%2520%2520%2520%2520If%2520len(%2520oText.getString())%2520%26amp%3Bgt%3B%25200%2520Then%2520%2520%2520%2520%2520%2520%2520%2520Dim%2520sText%2C%2520sAttributes%2520as%2520String%2520%2520%2520%2520%2520%2520%2520%2520sText%2520%3D%2520quoteStr(oText.getString())%2520%2520%2520%2520%2520%2520%2520%2520sAttributes%2520%3D%2520href(oText)%2520%2B%2520charStyle(oText%2C%2520oPara)%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3Btext%26amp%3Bquot%3B%2520%26amp%3Bamp%3B%2520sAttributes%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B%2520%26amp%3Bapos%3B%26amp%3Bapos%3B%2520%26amp%3Bquot%3B%2520%26amp%3Bamp%3B%2520sText%2520%2520%2520%2520End%2520IfEnd%2520SubSub%2520exportParagraphContent(iFile%25%2C%2520oPara%2520as%2520Object%2C%2520sShift%24)%2520%2520%2520%2520Dim%2520oTextEnum%2520%2520%2520%2520otextEnum%2520%3D%2520oPara.createEnumeration()%2520%2520%2520%2520REM%2520iterat%2520through%2520all%2520text%2520portions%2520of%2520a%2520paragraph%2520%2520%2520%2520Do%2520While%2520otextEnum.hasMoreElements()%2520%2520%2520%2520%2520%2520%2520%2520Dim%2520oText%2520as%2520Object%2520%2520%2520%2520%2520%2520%2520%2520Dim%2520sType%2520as%2520String%2520%2520%2520%2520%2520%2520%2520%2520REM%2520get%2520next%2520portion%2520%2520%2520%2520%2520%2520%2520%2520oText%2520%3D%2520oTextEnum.nextElement()%2520%2520%2520%2520%2520%2520%2520%2520REM%2520get%2520portion%2520type%2520%2520%2520%2520%2520%2520%2520%2520sType%2520%3D%2520LCase(oText.TextPortionType)%2520%2520%2520%2520%2520%2520%2520%2520If%2520sType%2520%3D%2520%26amp%3Bquot%3Btext%26amp%3Bquot%3B%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520exportText(iFile%2C%2520oPara%2C%2520oText%2C%2520sShift)%2520%2520%2520%2520%2520%2520%2520%2520Else%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3Bdebug%2520%26amp%3Bquot%3B%2520%2B%2520stype%2520%2B%2520%26amp%3Bquot%3B%2520%26amp%3Blt%3B%26amp%3Blt%3B%2520_END_%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520join(oText.SupportedServiceNames%2C%2520CHR(10))%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3B_END_%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520%2520%2520%2520%2520%2520%2520%2520End%2520If%2520%2520%2520%2520LoopEnd%2520SubFunction%2520listType(iType%2520as%2520Integer)%2520as%2520String%2520%2520%2520%2520Select%2520Case%2520iType%2520%2520%2520%2520%2520%2520%2520%2520Case%2520com.sun.star.style.NumberingType.ARABIC%3A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520%26amp%3Bquot%3Barabic%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Case%2520com.sun.star.style.NumberingType.ROMAN_UPPER%3A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520%26amp%3Bquot%3Broman_upper%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Case%2520com.sun.star.style.NumberingType.ROMAN_LOWER%3A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520%26amp%3Bquot%3Broman_lower%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Case%2520com.sun.star.style.NumberingType.CHARS_UPPER_LETTER%3A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520%26amp%3Bquot%3Bletter_upper%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Case%2520com.sun.star.style.NumberingType.CHARS_LOWER_LETTER%3A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520%26amp%3Bquot%3Bletter_lower%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Case%2520com.sun.star.style.NumberingType.CHAR_SPECIAL%3A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520%26amp%3Bquot%3Bchar_special%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Case%2520com.sun.star.style.NumberingType.BITMAP%3A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520%26amp%3Bquot%3Bbitmap%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Case%2520Else%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520listType%2520%3D%2520str(iType)%2520%2520%2520%2520End%2520SelectEnd%2520FunctionFunction%2520paragraphListType(oPara%2520as%2520Object)%2520as%2520Integer%2520%2520%2520%2520paragraphListType%2520%3D%25200%2520%2520%2520%2520If%2520oPara.supportsService(%26amp%3Bquot%3Bcom.sun.star.text.Paragraph%26amp%3Bquot%3B)%2520Then%2520%2520%2520%2520%2520%2520%2520%2520If%2520Not%2520isEmpty(oPara.NumberingRules)%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520Dim%2520oRules%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520oRules%2520%3D%2520oPara.NumberingRules%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520If%2520Not%2520oRules.NumberingIsOutline%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520Dim%2520oRule()%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520Dim%2520i%2520As%2520Integer%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520oRule()%2520%3D%2520oRules.getByIndex(oPara.NumberingLevel%2520)%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520For%2520i%2520%3D%2520LBound(oRule())%2520To%2520Ubound(oRule())%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520If%2520oRule(i).Name%2520%3D%2520%26amp%3Bquot%3BNumberingType%26amp%3Bquot%3B%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520paragraphListType%2520%3D%2520oRule(i).Value%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520End%2520If%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520Next%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520End%2520If%2520%2520%2520%2520%2520%2520%2520%2520End%2520If%2520%2520%2520%2520End%2520IfEnd%2520FunctionFunction%2520paragraphListLevel(oPara%2520as%2520Object%2C%2520iListType%2520as%2520Integer)%2520as%2520Integer%2520%2520%2520%2520If%2520(%2520iListType%2520%26amp%3Bgt%3B%25200%2520)%2520Then%2520%2520%2520%2520%2520%2520%2520%2520paragraphListLevel%2520%3D%2520oPara.NumberingLevel%2520%2B%25201%2520%2520%2520%2520Else%2520%2520%2520%2520%2520%2520%2520%2520paragraphListLevel%2520%3D%25200%2520%2520%2520%2520End%2520IfEnd%2520FunctionFunction%2520paragraphStyle(oPara%2520as%2520Object)%2520as%2520String%2520%2520%2520%2520Dim%2520oOptions%2520as%2520String%2520%2520%2520%2520Dim%2520oStyles%2C%2520oStyle%2520as%2520Object%2520%2520%2520%2520oOptions%2520%3D%2520%26amp%3Bquot%3B%26amp%3Bapos%3B%26amp%3Bquot%3B%2520%2B%2520join(split(oPara.ParaStyleName)%2C%26amp%3Bquot%3B_%26amp%3Bquot%3B)%2520%2B%2520%26amp%3Bquot%3B%26amp%3Bapos%3B%26amp%3Bquot%3B%2520%2520%2520%2520oStyles%2520%3D%2520ThisComponent.StyleFamilies.getByName(%26amp%3Bquot%3BParagraphStyles%26amp%3Bquot%3B)%2520%2520%2520%2520oStyle%2520%3D%2520oStyles.getByName(oPara.ParaStyleName)%2520%2520%2520%2520If%2520oPara.ParaAdjust%2520%26amp%3Blt%3B%26amp%3Bgt%3B%2520oStyle.ParaAdjust%2520Then%2520%2520%2520%2520%2520%2520%2520%2520If%2520oPara.ParaAdjust%2520%3D%2520com.sun.star.style.ParagraphAdjust.CENTER%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520oOptions%2520%3D%2520oOptions%2520%2B%2520%26amp%3Bquot%3B%2520%2560align%2520center%2560%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520ElseIf%2520oPara.ParaAdjust%2520%3D%2520com.sun.star.style.ParagraphAdjust.LEFT%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520oOptions%2520%3D%2520oOptions%2520%2B%2520%26amp%3Bquot%3B%2520%2560align%2520left%2560%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520ElseIf%2520oPara.ParaAdjust%2520%3D%2520com.sun.star.style.ParagraphAdjust.RIGHT%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520oOptions%2520%3D%2520oOptions%2520%2B%2520%26amp%3Bquot%3B%2520%2560align%2520right%2560%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520End%2520If%2520%2520%2520%2520End%2520If%2520%2520%2520%2520paragraphStyle%2520%3D%2520oOptionsEnd%2520FunctionSub%2520exportParagraph(iFile%25%2C%2520oPara%2520as%2520Object%2C%2520sShift%24)%2520%2520%2520%2520If%2520len(trim(oPara.getString()))%2520%26amp%3Bgt%3B%25200%2520Then%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B(%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520exportParagraphContent(iFile%2C%2520oPara%2C%2520shift(sShift))%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B)%2520%7C%2520paragraph%2520%26amp%3Bquot%3B%2520%2B%2520paragraphStyle(oPara)%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520%2520%2520%2520End%2520IfEnd%2520SubSub%2520exportTable(iFile%25%2C%2520oTable%2520as%2520Object%2C%2520sShift0%24)%2520%2520%2520%2520iRows%25%2520%3D%2520oTable.getRows().getCount()%2520%2520%2520%2520iColumns%25%2520%3D%2520oTable.getColumns().getCount()%2520%2520%2520%2520sShift1%24%2520%3D%2520shift(sShift0)%2520%2520%2520%2520sShift2%24%2520%3D%2520shift(sShift1)%2520%2520%2520%2520sShift3%24%2520%3D%2520shift(sShift2)%2520%2520%2520%2520print%2520%23iFile%2520sShift0%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B(%2520%3A%26amp%3Bquot%3B%2520%2520%2520%2520For%2520i%2520%3D%25200%2520to%2520iRows-1%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift1%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B(%2520%3A%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520For%2520j%2520%3D%25200%2520to%2520iColumns-1%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift2%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B(%2520%3A%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520exportContent(iFile%2C%2520oTable.getCellByPosition(j%2Ci)%2C%2520sShift3)%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift2%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B)%2520%7C%2520column%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520Next%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift1%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B)%2520%7C%2520row%26amp%3Bquot%3B%2520%2520%2520%2520Next%2520%2520%2520%2520print%2520%23iFile%2520sShift0%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B)%2520%7C%2520table%26amp%3Bquot%3B%2520%2520%2520%2520print%2520%23iFileEnd%2520SubSub%2520exportContent(iFile%25%2C%2520oContent%2520as%2520Object%2C%2520sShift%24)%2520%2520%2520%2520Dim%2520oParaEnum%2C%2520oPara%2520as%2520Object%2520%2520%2520%2520oParaEnum%2520%3D%2520oContent.getText().createEnumeration()%2520%2520%2520%2520Dim%2520iListLevel%2520as%2520Integer%2520%2520%2520%2520Dim%2520iListType(32)%2520as%2520Integer%2520%2520%2520%2520Dim%2520sListShift(32)%2520as%2520String%2520%2520%2520%2520Dim%2520sListType%2520as%2520String%2520%2520%2520%2520REM%2520iterate%2520through%2520all%2520paragraphs%2520%2520%2520%2520iListLevel%2520%3D%25200%2520%2520%2520%2520sListShift(0)%2520%3D%2520sShift%2520%2520%2520%2520Do%2520While%2520oParaEnum.hasMoreElements()%2520%2520%2520%2520%2520%2520%2520%2520Dim%2520iParagarphListLevel%2C%2520iParagraphListType%2520as%2520Integer%2520%2520%2520%2520%2520%2520%2520%2520oPara%2520%3D%2520oParaEnum.nextElement()%2520%2520%2520%2520%2520%2520%2520%2520iParagraphListType%2520%3D%2520paragraphListType(oPara)%2520%2520%2520%2520%2520%2520%2520%2520iParagarphListLevel%2520%3D%2520paragraphListLevel(oPara%2C%2520iParagraphListType)%2520%2520%2520%2520%2520%2520%2520%2520While%2520iListLevel%2520%26amp%3Blt%3B%2520iParagarphListLevel%2520%26amp%3Bapos%3Bopen%2520a%2520new%2520list%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sListShift(iListLevel)%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B(%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520iListType(iListLevel)%2520%3D%2520iParagraphListType%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520iListLevel%2520%3D%2520iListLevel%2520%2B%25201%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520sListShift(iListLevel)%2520%3D%2520shift(sListShift(iListLevel-1))%2520%2520%2520%2520%2520%2520%2520%2520Wend%2520%2520%2520%2520%2520%2520%2520%2520While%2520iListLevel%2520%26amp%3Bgt%3B%2520iParagarphListLevel%2520%26amp%3Bapos%3Bclose%2520current%2520list%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520iListLevel%2520%3D%2520iListLevel%2520-%25201%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520sListType%2520%3D%2520%2520listType(iListType(iListLevel))%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sListShift(iListLevel)%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B)%2520%7C%2520list%2520%26amp%3Bquot%3B%2520%2B%2520sListType%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520%2520%2520%2520%2520%2520%2520%2520Wend%2520%2520%2520%2520%2520%2520%2520%2520If%2520iListLevel%2520%26amp%3Bgt%3B%25200%2520Then%2520%26amp%3Bapos%3Bwe%2520are%2520still%2520in%2520a%2520list%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520If%2520iListType(iListLevel-1)%2520%26amp%3Blt%3B%26amp%3Bgt%3B%2520iParagraphListType%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520sListType%2520%3D%2520listType(iListType(iListLevel-1))%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sListShift(iListLevel-1)%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B)%2520%7C%2520list%2520%26amp%3Bquot%3B%2520%26amp%3Bamp%3B%2520sListType%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520iListType(iListLevel-1)%2520%3D%2520iParagraphListType%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sListShift(iListLevel-1)%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B(%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520End%2520If%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift%2520%26amp%3Bamp%3B%2520sListShift(iListLevel)%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B(%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520exportParagraphContent(iFile%2C%2520oPara%2C%2520shift(sListShift(iListLevel)))%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%2520%23iFile%2520sShift%2520%26amp%3Bamp%3B%2520sListShift(iListLevel)%2520%26amp%3Bamp%3B%2520%26amp%3Bquot%3B)%2520%7C%2520item%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520ElseIf%2520oPara.supportsService(%26amp%3Bquot%3Bcom.sun.star.text.Paragraph%26amp%3Bquot%3B)%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520REM%2520normal%2520paragraphs%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520exportParagraph(iFile%2C%2520oPara%2C%2520sShift)%2520%2520%2520%2520%2520%2520%2520%2520ElseIf%2520oPara.supportsService(%26amp%3Bquot%3Bcom.sun.star.text.TextTable%26amp%3Bquot%3B)%2520Then%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520REM%2520Tables%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520exportTable(iFile%2C%2520oPara%2C%2520sShift)%2520%2520%2520%2520%2520%2520%2520%2520Else%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520REM%2520anything%2520else%2C%2520should%2520not%2520happen%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520MsgBox%2520%26amp%3Bquot%3BUnsupported%2520Text%2520Element%26amp%3Bquot%3B%2520%2520%2520%2520%2520%2520%2520%2520End%2520If%2520%2520%2520%2520LoopEnd%2520SubSub%2520exportDocument(iFile%25%2C%2520oDoc%2520as%2520Object)%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3B%23!%2Fbin%2Fbash%26amp%3Bquot%3B%2520%2520%2520%2520print%2520%23iFile%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3Bsource%2520oo2html.styles%26amp%3Bquot%3B%2520%2520%2520%2520print%2520%23iFile%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3Bexport%2520OPENOFFICE_SOLAR_VERSION%3D%26amp%3Bquot%3B%2520%2B%2520GetSolarVersion()%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3Bexport%2520OPENOFFICE_VERSION%3D%26amp%3Bquot%3B%2520%2B%2520ooVersion()%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3Bexport%2520OPENOFFICE_GUI%3D%26amp%3Bquot%3B%2520%2B%2520GetGUIType()%2520%2520%2520%2520print%2520%23iFile%2520%26amp%3Bquot%3Bexport%2520LANG%3D%26amp%3Bquot%3B%2520%2B%2520Environ(%26amp%3Bquot%3BLANG%26amp%3Bquot%3B)%2520%2520%2520%2520print%2520%23iFile%2520%2520%2520%2520REM%2520export%2520document%2520content%2520%2520%2520%2520exportContent(iFile%2C%2520oDoc%2C%2520%26amp%3Bquot%3B%26amp%3Bquot%3B)%2520%2520%2520%2520print%2520%23iFileEnd%2520SubSub%2520exportToFile(sFileName%2520as%2520String%2C%2520oDoc%2520as%2520Object)%2520%2520%2520%2520Dim%2520iFile%2520as%2520Integer%2520%2520%2520%2520iFileNumber%2520%3D%2520FreeFile%2520%2520%2520%2520Open%2520sFileName%2520for%2520Output%2520as%2520%23iFileNumber%2520%2520%2520%2520exportDocument(iFileNumber%2C%2520oDoc)%2520%2520%2520%2520Close%2520%23iFileNumberEnd%2520SubFunction%2520fileName(sDocName%2520as%2520String%2C%2520sExtension%2520as%2520String)%2520as%2520String%2520%2520%2520%2520Dim%2520vPath%2520as%2520Variant%2520%2520%2520%2520Dim%2520vName%2520as%2520Variant%2520%2520%2520%2520vPath%2520%3D%2520split(sDocName%2C%2520%26amp%3Bquot%3B%2F%26amp%3Bquot%3B)%2520%2520%2520%2520vName%2520%3D%2520split(vPath(UBound(vPath()))%2C%2520%26amp%3Bquot%3B.%26amp%3Bquot%3B)%2520%2520%2520%2520If%2520LBound(vName)%2520%26amp%3Blt%3B%2520UBound(vName)%2520Then%2520%2520%2520%2520%2520%2520%2520%2520vName(UBound(vName))%2520%3D%2520sExtension%2520%2520%2520%2520Else%2520%2520%2520%2520%2520%2520%2520%2520vName(LBound(vName))%2520%3D%2520vName(LBound(vName))%2520%26amp%3Bamp%3B%2520sExtension%2520%2520%2520%2520End%2520If%2520%2520%2520%2520vPath(UBound(vPath()))%2520%3D%2520join(vName%2C%2520%26amp%3Bquot%3B.%26amp%3Bquot%3B)%2520%2520%2520%2520fileName%2520%3D%2520join(vPath%2C%2520%26amp%3Bquot%3B%2F%26amp%3Bquot%3B)End%2520FunctionSub%2520Batch(sDocName%2520as%2520String)%2520%2520%2520%2520Dim%2520sURL%2520as%2520String%2520%2520%2520%2520Dim%2520oDoc%2520as%2520Object%2520%2520%2520%2520sURL%2520%3D%2520ConvertToURL(sDocName)%2520%2520%2520%2520oDoc%2520%3D%2520StarDesktop.LoadComponentFromURL(sURL%2C%2520%26amp%3Bquot%3B_blank%26amp%3Bquot%3B%2C%25200%2C%2520Array())%2520%2520%2520%2520exportToFile(fileName(sDocName%2C%2520%26amp%3Bquot%3Bsh%26amp%3Bquot%3B)%2C%2520oDoc)%2520%2520%2520%2520oDoc.close(true)End%2520SubSub%2520Main%2520%2520%2520%2520Dim%2520sDocName%2C%2520sFileName%2520as%2520String%2520%2520%2520%2520Dim%2520oDialog%2520as%2520Object%2520%2520%2520%2520DialogLibraries.LoadLibrary(%26amp%3Bquot%3BDocScript%26amp%3Bquot%3B)%2520%2520%2520%2520sDocName%2520%3D%2520convertFromURL(ThisComponent.URL)%2520%2520%2520%2520if%2520len(sDocName)%2520%26amp%3Bgt%3B%25200%2520then%2520%2520%2520%2520%2520%2520%2520%2520sFileName%2520%3D%2520fileName(sDocName%2C%2520%26amp%3Bquot%3Bsh%26amp%3Bquot%3B)%2520%2520%2520%2520end%2520if%2520%2520%2520%2520oDialog%2520%3D%2520createUnoDialog(DialogLibraries.DocScript.FileOpen)%2520%2520%2520%2520oDialog.getControl(%26amp%3Bquot%3BFileName%26amp%3Bquot%3B).text%2520%3D%2520sFileName%2520%2520%2520%2520If%2520oDialog.execute()%2520%3D%25201%2520Then%2520%2520%2520%2520%2520%2520%2520%2520exportToFile(oDialog.getControl(%26amp%3Bquot%3BFileName%26amp%3Bquot%3B).text%2C%2520ThisComponent)%2520%2520%2520%2520End%2520IfEnd%2520Sub%26lt%3B%2Fscript%3Amodule%26gt%3B%253C%2Fpre">