Remove files coming from maint.
This commit is contained in:
parent
df82832fb7
commit
6c911234ac
Binary file not shown.
|
@ -1,213 +0,0 @@
|
||||||
REM ***** BASIC *****
|
|
||||||
|
|
||||||
Dim DocTypes
|
|
||||||
|
|
||||||
Private DocTypeToFiltersMap As New Collection
|
|
||||||
Private WriterExportFilters As New Collection
|
|
||||||
Private WriterWebExportFilters As New Collection
|
|
||||||
Private CalcExportFilters As New Collection
|
|
||||||
Private ImpressExportFilters As New Collection
|
|
||||||
Private DrawExportFilters As New Collection
|
|
||||||
|
|
||||||
|
|
||||||
Private ExportFiltersInited As Boolean
|
|
||||||
|
|
||||||
Sub InitExportFilters
|
|
||||||
If ExportFiltersInited Then
|
|
||||||
Exit Sub
|
|
||||||
End If
|
|
||||||
|
|
||||||
DocTypes = Array(_
|
|
||||||
"com.sun.star.text.TextDocument", _
|
|
||||||
"com.sun.star.sheet.SpreadsheetDocument", _
|
|
||||||
"com.sun.star.presentation.PresentationDocument", _
|
|
||||||
"com.sun.star.drawing.DrawingDocument",_
|
|
||||||
"com.sun.star.text.WebDocument"_
|
|
||||||
)
|
|
||||||
With WriterExportFilters
|
|
||||||
.Add Key := "bib" , Item :=Array("bib" , "BibTeX" , "BibTeX_Writer ")
|
|
||||||
.Add Key := "doc" , Item :=Array("doc" , "Microsoft Word 97/2000/XP" , "MS Word 97 ")
|
|
||||||
.Add Key := "doc6" , Item :=Array("doc" , "Microsoft Word 6.0" , "MS WinWord 6.0 ")
|
|
||||||
.Add Key := "doc95" , Item :=Array("doc" , "Microsoft Word 95" , "MS Word 95 ")
|
|
||||||
.Add Key := "docbook" , Item :=Array("xml" , "DocBook" , "DocBook File ")
|
|
||||||
.Add Key := "html" , Item :=Array("html" , "HTML Document (OpenOffice.org Writer)" , "HTML (StarWriter) ")
|
|
||||||
.Add Key := "latex" , Item :=Array("ltx" , "LaTeX 2e" , "LaTeX_Writer ")
|
|
||||||
.Add Key := "mediawiki" , Item :=Array("txt" , "MediaWiki" , "MediaWiki ")
|
|
||||||
.Add Key := "odt" , Item :=Array("odt" , "ODF Text Document" , "writer8 ")
|
|
||||||
.Add Key := "ooxml" , Item :=Array("xml" , "Microsoft Office Open XML" , "MS Word 2003 XML ")
|
|
||||||
.Add Key := "ott" , Item :=Array("ott" , "Open Document Text" , "writer8_template ")
|
|
||||||
.Add Key := "pdf" , Item :=Array("pdf" , "Portable Document Format" , "writer_pdf_Export ")
|
|
||||||
.Add Key := "rtf" , Item :=Array("rtf" , "Rich Text Format" , "Rich Text Format ")
|
|
||||||
.Add Key := "sdw" , Item :=Array("sdw" , "StarWriter 5.0" , "StarWriter 5.0 ")
|
|
||||||
.Add Key := "sdw3" , Item :=Array("sdw" , "StarWriter 3.0" , "StarWriter 3.0 ")
|
|
||||||
.Add Key := "sdw4" , Item :=Array("sdw" , "StarWriter 4.0" , "StarWriter 4.0 ")
|
|
||||||
.Add Key := "stw" , Item :=Array("stw" , "Open Office.org 1.0 Text Document Template" , "writer_StarOffice_XML_Writer_Template ")
|
|
||||||
.Add Key := "sxw" , Item :=Array("sxw" , "Open Office.org 1.0 Text Document" , "StarOffice XML (Writer) ")
|
|
||||||
.Add Key := "text" , Item :=Array("txt" , "Text Encoded" , "Text (encoded) ")
|
|
||||||
.Add Key := "txt" , Item :=Array("txt" , "Text" , "Text ")
|
|
||||||
.Add Key := "uot" , Item :=Array("uot" , "Unified Office Format text" , "UOF text ")
|
|
||||||
.Add Key := "vor" , Item :=Array("vor" , "StarWriter 5.0 Template" , "StarWriter 5.0 Vorlage/Template ")
|
|
||||||
.Add Key := "vor3" , Item :=Array("vor" , "StarWriter 3.0 Template" , "StarWriter 3.0 Vorlage/Template ")
|
|
||||||
.Add Key := "vor4" , Item :=Array("vor" , "StarWriter 4.0 Template" , "StarWriter 4.0 Vorlage/Template ")
|
|
||||||
.Add Key := "xhtml" , Item :=Array("html" , "XHTML Document" , "XHTML Writer File ")
|
|
||||||
End With
|
|
||||||
|
|
||||||
With DrawExportFilters
|
|
||||||
.Add Key := "bmp" , Item :=Array("bmp" , "Windows Bitmap" , "draw_bmp_Export ")
|
|
||||||
.Add Key := "emf" , Item :=Array("emf" , "Enhanced Metafile" , "draw_emf_Export ")
|
|
||||||
.Add Key := "eps" , Item :=Array("eps" , "Encapsulated PostScript" , "draw_eps_Export ")
|
|
||||||
.Add Key := "gif" , Item :=Array("gif" , "Graphics Interchange Format" , "draw_gif_Export ")
|
|
||||||
.Add Key := "html" , Item :=Array("html" , "HTML Document (OpenOffice.org Draw)" , "draw_html_Export ")
|
|
||||||
.Add Key := "jpg" , Item :=Array("jpg" , "Joint Photographic Experts Group" , "draw_jpg_Export ")
|
|
||||||
.Add Key := "met" , Item :=Array("met" , "OS/2 Metafile" , "draw_met_Export ")
|
|
||||||
.Add Key := "odd" , Item :=Array("odd" , "OpenDocument Drawing" , "draw8 ")
|
|
||||||
.Add Key := "otg" , Item :=Array("otg" , "OpenDocument Drawing Template" , "draw8_template ")
|
|
||||||
.Add Key := "pbm" , Item :=Array("pbm" , "Portable Bitmap" , "draw_pbm_Export ")
|
|
||||||
.Add Key := "pct" , Item :=Array("pct" , "Mac Pict" , "draw_pct_Export ")
|
|
||||||
.Add Key := "pdf" , Item :=Array("pdf" , "Portable Document Format" , "draw_pdf_Export ")
|
|
||||||
.Add Key := "pgm" , Item :=Array("pgm" , "Portable Graymap" , "draw_pgm_Export ")
|
|
||||||
.Add Key := "png" , Item :=Array("png" , "Portable Network Graphic" , "draw_png_Export ")
|
|
||||||
.Add Key := "ppm" , Item :=Array("ppm" , "Portable Pixelmap" , "draw_ppm_Export ")
|
|
||||||
.Add Key := "ras" , Item :=Array("ras" , "Sun Raster Image" , "draw_ras_Export ")
|
|
||||||
.Add Key := "std" , Item :=Array("std" , "OpenOffice.org 1.0 Drawing Template" , "draw_StarOffice_XML_Draw_Template ")
|
|
||||||
.Add Key := "svg" , Item :=Array("svg" , "Scalable Vector Graphics" , "draw_svg_Export ")
|
|
||||||
.Add Key := "svm" , Item :=Array("svm" , "StarView Metafile" , "draw_svm_Export ")
|
|
||||||
.Add Key := "swf" , Item :=Array("swf" , "Macromedia Flash (SWF)" , "draw_flash_Export ")
|
|
||||||
.Add Key := "sxd" , Item :=Array("sxd" , "OpenOffice.org 1.0 Drawing" , "StarOffice XML (Draw) ")
|
|
||||||
.Add Key := "sxd3" , Item :=Array("sxd" , "StarDraw 3.0" , "StarDraw 3.0 ")
|
|
||||||
.Add Key := "sxd5" , Item :=Array("sxd" , "StarDraw 5.0" , "StarDraw 5.0 ")
|
|
||||||
.Add Key := "tiff" , Item :=Array("tiff" , "Tagged Image File Format" , "draw_tif_Export ")
|
|
||||||
.Add Key := "vor" , Item :=Array("vor" , "StarDraw 5.0 Template" , "StarDraw 5.0 Vorlage ")
|
|
||||||
.Add Key := "vor3" , Item :=Array("vor" , "StarDraw 3.0 Template" , "StarDraw 3.0 Vorlage ")
|
|
||||||
.Add Key := "wmf" , Item :=Array("wmf" , "Windows Metafile" , "draw_wmf_Export ")
|
|
||||||
.Add Key := "xhtml" , Item :=Array("xhtml" , "XHTML" , "XHTML Draw File ")
|
|
||||||
.Add Key := "xpm" , Item :=Array("xpm" , "X PixMap" , "draw_xpm_Export ")
|
|
||||||
|
|
||||||
|
|
||||||
End With
|
|
||||||
|
|
||||||
With ImpressExportFilters
|
|
||||||
.Add Key := "bmp" , Item :=Array("bmp" , "Windows Bitmap" , "impress_bmp_Export ")
|
|
||||||
.Add Key := "emf" , Item :=Array("emf" , "Enhanced Metafile" , "impress_emf_Export ")
|
|
||||||
.Add Key := "eps" , Item :=Array("eps" , "Encapsulated PostScript" , "impress_eps_Export ")
|
|
||||||
.Add Key := "gif" , Item :=Array("gif" , "Graphics Interchange Format" , "impress_gif_Export ")
|
|
||||||
.Add Key := "html" , Item :=Array("html" , "HTML Document (OpenOffice.org Impress)" , "impress_html_Export ")
|
|
||||||
.Add Key := "jpg" , Item :=Array("jpg" , "Joint Photographic Experts Group" , "impress_jpg_Export ")
|
|
||||||
.Add Key := "met" , Item :=Array("met" , "OS/2 Metafile" , "impress_met_Export ")
|
|
||||||
.Add Key := "odg" , Item :=Array("odg" , "ODF Drawing (Impress)" , "impress8_draw ")
|
|
||||||
.Add Key := "odp" , Item :=Array("odp" , "ODF Presentation" , "impress8 ")
|
|
||||||
.Add Key := "otp" , Item :=Array("otp" , "ODF Presentation Template" , "impress8_template ")
|
|
||||||
.Add Key := "pbm" , Item :=Array("pbm" , "Portable Bitmap" , "impress_pbm_Export ")
|
|
||||||
.Add Key := "pct" , Item :=Array("pct" , "Mac Pict" , "impress_pct_Export ")
|
|
||||||
.Add Key := "pdf" , Item :=Array("pdf" , "Portable Document Format" , "impress_pdf_Export ")
|
|
||||||
.Add Key := "pgm" , Item :=Array("pgm" , "Portable Graymap" , "impress_pgm_Export ")
|
|
||||||
.Add Key := "png" , Item :=Array("png" , "Portable Network Graphic" , "impress_png_Export ")
|
|
||||||
.Add Key := "pot" , Item :=Array("pot" , "Microsoft PowerPoint 97/2000/XP Template" , "MS PowerPoint 97 Vorlage ")
|
|
||||||
.Add Key := "ppm" , Item :=Array("ppm" , "Portable Pixelmap" , "impress_ppm_Export ")
|
|
||||||
.Add Key := "ppt" , Item :=Array("ppt" , "Microsoft PowerPoint 97/2000/XP" , "MS PowerPoint 97 ")
|
|
||||||
.Add Key := "pwp" , Item :=Array("pwp" , "PlaceWare" , "placeware_Export ")
|
|
||||||
.Add Key := "ras" , Item :=Array("ras" , "Sun Raster Image" , "impress_ras_Export ")
|
|
||||||
.Add Key := "sda" , Item :=Array("sda" , "StarDraw 5.0 (OpenOffice.org Impress)" , "StarDraw 5.0 (StarImpress) ")
|
|
||||||
.Add Key := "sdd" , Item :=Array("sdd" , "StarImpress 5.0" , "StarImpress 5.0 ")
|
|
||||||
.Add Key := "sdd3" , Item :=Array("sdd" , "StarDraw 3.0 (OpenOffice.org Impress)" , "StarDraw 3.0 (StarImpress) ")
|
|
||||||
.Add Key := "sdd4" , Item :=Array("sdd" , "StarImpress 4.0" , "StarImpress 4.0 ")
|
|
||||||
.Add Key := "sti" , Item :=Array("sti" , "OpenOffice.org 1.0 Presentation Template" , "impress_StarOffice_XML_Impress_Template ")
|
|
||||||
.Add Key := "svg" , Item :=Array("svg" , "Scalable Vector Graphics" , "impress_svg_Export ")
|
|
||||||
.Add Key := "svm" , Item :=Array("svm" , "StarView Metafile" , "impress_svm_Export ")
|
|
||||||
.Add Key := "swf" , Item :=Array("swf" , "Macromedia Flash (SWF)" , "impress_flash_Export ")
|
|
||||||
.Add Key := "sxd" , Item :=Array("sxd" , "OpenOffice.org 1.0 Drawing (OpenOffice.org Impress)" , "impress_StarOffice_XML_Draw ")
|
|
||||||
.Add Key := "sxi" , Item :=Array("sxi" , "OpenOffice.org 1.0 Presentation" , "StarOffice XML (Impress) ")
|
|
||||||
.Add Key := "tiff" , Item :=Array("tiff" , "Tagged Image File Format" , "impress_tif_Export ")
|
|
||||||
.Add Key := "uop" , Item :=Array("uop" , "Unified Office Format presentation" , "UOF presentation ")
|
|
||||||
.Add Key := "vor" , Item :=Array("vor" , "StarImpress 5.0 Template" , "StarImpress 5.0 Vorlage ")
|
|
||||||
.Add Key := "vor3" , Item :=Array("vor" , "StarDraw 3.0 Template (OpenOffice.org Impress)" , "StarDraw 3.0 Vorlage (StarImpress) ")
|
|
||||||
.Add Key := "vor4" , Item :=Array("vor" , "StarImpress 4.0 Template" , "StarImpress 4.0 Vorlage ")
|
|
||||||
.Add Key := "vor5" , Item :=Array("vor" , "StarDraw 5.0 Template (OpenOffice.org Impress)" , "StarDraw 5.0 Vorlage (StarImpress) ")
|
|
||||||
.Add Key := "wmf" , Item :=Array("wmf" , "Windows Metafile" , "impress_wmf_Export ")
|
|
||||||
.Add Key := "xhtml" , Item :=Array("xml" , "XHTML" , "XHTML Impress File ")
|
|
||||||
.Add Key := "xpm" , Item :=Array("xpm" , "X PixMap" , "impress_xpm_Export ")
|
|
||||||
|
|
||||||
End With
|
|
||||||
|
|
||||||
With CalcExportFilters
|
|
||||||
.Add Key := "csv" , Item :=Array("csv" , "Text CSV" , "Text - txt - csv (StarCalc) ")
|
|
||||||
.Add Key := "dbf" , Item :=Array("dbf" , "dBASE" , "dBase ")
|
|
||||||
.Add Key := "dif" , Item :=Array("dif" , "Data Interchange Format" , "DIF ")
|
|
||||||
.Add Key := "html" , Item :=Array("html" , "HTML Document (OpenOffice.org Calc)" , "HTML (StarCalc) ")
|
|
||||||
.Add Key := "ods" , Item :=Array("ods" , "ODF Spreadsheet" , "calc8 ")
|
|
||||||
.Add Key := "ooxml" , Item :=Array("xml" , "Microsoft Excel 2003 XML" , "MS Excel 2003 XML ")
|
|
||||||
.Add Key := "ots" , Item :=Array("ots" , "ODF Spreadsheet Template" , "calc8_template ")
|
|
||||||
.Add Key := "pdf" , Item :=Array("pdf" , "Portable Document Format" , "calc_pdf_Export ")
|
|
||||||
.Add Key := "sdc" , Item :=Array("sdc" , "StarCalc 5.0" , "StarCalc 5.0 ")
|
|
||||||
.Add Key := "sdc3" , Item :=Array("sdc" , "StarCalc 3.0" , "StarCalc 3.0 ")
|
|
||||||
.Add Key := "sdc4" , Item :=Array("sdc" , "StarCalc 4.0" , "StarCalc 4.0 ")
|
|
||||||
.Add Key := "slk" , Item :=Array("slk" , "SYLK" , "SYLK ")
|
|
||||||
.Add Key := "stc" , Item :=Array("stc" , "OpenOffice.org 1.0 Spreadsheet Template" , "calc_StarOffice_XML_Calc_Template ")
|
|
||||||
.Add Key := "sxc" , Item :=Array("sxc" , "OpenOffice.org 1.0 Spreadsheet" , "StarOffice XML (Calc) ")
|
|
||||||
.Add Key := "uos" , Item :=Array("uos" , "Unified Office Format spreadsheet" , "UOF spreadsheet ")
|
|
||||||
.Add Key := "vor" , Item :=Array("vor" , "StarCalc 5.0 Template" , "StarCalc 5.0 Vorlage/Template ")
|
|
||||||
.Add Key := "vor3" , Item :=Array("vor" , "StarCalc 3.0 Template" , "StarCalc 3.0 Vorlage/Template ")
|
|
||||||
.Add Key := "vor4" , Item :=Array("vor" , "StarCalc 4.0 Template" , "StarCalc 4.0 Vorlage/Template ")
|
|
||||||
.Add Key := "xhtml" , Item :=Array("xhtml" , "XHTML" , "XHTML Calc File ")
|
|
||||||
.Add Key := "xls" , Item :=Array("xls" , "Microsoft Excel 97/2000/XP" , "MS Excel 97 ")
|
|
||||||
.Add Key := "xls5" , Item :=Array("xls" , "Microsoft Excel 5.0" , "MS Excel 5.0/95 ")
|
|
||||||
.Add Key := "xls95" , Item :=Array("xls" , "Microsoft Excel 95" , "MS Excel 95 ")
|
|
||||||
.Add Key := "xlt" , Item :=Array("xlt" , "Microsoft Excel 97/2000/XP Template" , "MS Excel 97 Vorlage/Template ")
|
|
||||||
.Add Key := "xlt5" , Item :=Array("xlt" , "Microsoft Excel 5.0 Template" , "MS Excel 5.0/95 Vorlage/Template ")
|
|
||||||
.Add Key := "xlt95" , Item :=Array("xlt" , "Microsoft Excel 95 Template" , "MS Excel 95 Vorlage/Template ")
|
|
||||||
|
|
||||||
End With
|
|
||||||
|
|
||||||
With WriterWebExportFilters
|
|
||||||
.Add Key := "etext" , Item :=Array("txt" , "Text Encoded (OpenOffice.org Writer/Web)" , "Text (encoded) (StarWriter/Web) ")
|
|
||||||
.Add Key := "html" , Item :=Array("html" , "HTML Document" , "HTML ")
|
|
||||||
'.Add Key := "html" , Item :=Array("html" , "HTML Document Template" , "writerweb8_writer_template ")
|
|
||||||
.Add Key := "html10" , Item :=Array("html" , "OpenOffice.org 1.0 HTML Template" , "writer_web_StarOffice_XML_Writer_Web_Template ")
|
|
||||||
.Add Key := "mediawiki" , Item :=Array("txt" , "MediaWiki" , "MediaWiki_Web ")
|
|
||||||
.Add Key := "pdf" , Item :=Array("pdf" , "PDF - Portable Document Format" , "writer_web_pdf_Export ")
|
|
||||||
.Add Key := "sdw" , Item :=Array("sdw" , "StarWriter 5.0 (OpenOffice.org Writer/Web)" , "StarWriter 5.0 (StarWriter/Web) ")
|
|
||||||
.Add Key := "sdw3" , Item :=Array("sdw" , "StarWriter 3.0 (OpenOffice.org Writer/Web)" , "StarWriter 3.0 (StarWriter/Web) ")
|
|
||||||
.Add Key := "sdw4" , Item :=Array("sdw" , "StarWriter 4.0 (OpenOffice.org Writer/Web)" , "StarWriter 4.0 (StarWriter/Web) ")
|
|
||||||
.Add Key := "text" , Item :=Array("txt" , "Text (OpenOffice.org Writer/Web)" , "Text (StarWriter/Web) ")
|
|
||||||
.Add Key := "text10" , Item :=Array("txt" , "OpenOffice.org 1.0 Text Document (OpenOffice.org Writer/Web)" , "writer_web_StarOffice_XML_Writer ")
|
|
||||||
.Add Key := "odt" , Item :=Array("txt" , "OpenOffice.org Text (OpenOffice.org Writer/Web)" , "writerweb8_writer ")
|
|
||||||
.Add Key := "vor" , Item :=Array("vor" , "StarWriter/Web 5.0 Template" , "StarWriter/Web 5.0 Vorlage/Template ")
|
|
||||||
.Add Key := "vor4" , Item :=Array("vor" , "StarWriter/Web 4.0 Template" , "StarWriter/Web 4.0 Vorlage/Template ")
|
|
||||||
|
|
||||||
End With
|
|
||||||
|
|
||||||
With DocTypeToFiltersMap
|
|
||||||
.Add Key := "com.sun.star.text.TextDocument", Item := WriterExportFilters
|
|
||||||
.Add Key := "com.sun.star.sheet.SpreadsheetDocument", Item := CalcExportFilters
|
|
||||||
.Add Key := "com.sun.star.presentation.PresentationDocument", Item :=ImpressExportFilters
|
|
||||||
.Add Key := "com.sun.star.drawing.DrawingDocument", Item := DrawExportFilters
|
|
||||||
.Add Key := "com.sun.star.text.WebDocument", Item := WriterWebExportFilters
|
|
||||||
End With
|
|
||||||
ExportFiltersInited = True
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Function FilterSaveExtension(filterDescriptor ())
|
|
||||||
FilterSaveExtension = Trim(filterDescriptor(0))
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Function FilterHandler(filterDescriptor ())
|
|
||||||
FilterHandler = Trim(filterDescriptor(2))
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Function GetFilter(docType, outputFormat)
|
|
||||||
Dim filters
|
|
||||||
|
|
||||||
On Error Goto MissingFilter
|
|
||||||
filters = DocTypeToFiltersMap(docType)
|
|
||||||
LogMessage "output format is " & outputFormat
|
|
||||||
GetFilter = filters(outputFormat)
|
|
||||||
|
|
||||||
Done:
|
|
||||||
Exit Function
|
|
||||||
|
|
||||||
MissingFilter:
|
|
||||||
LogMessage("No existing filters for exporting " & docType & " to " & outputFormat)
|
|
||||||
GetFilter = Null
|
|
||||||
Resume Done
|
|
||||||
End Function
|
|
||||||
|
|
|
@ -1,201 +0,0 @@
|
||||||
REM ***** BASIC *****
|
|
||||||
|
|
||||||
Dim Interactive As Boolean
|
|
||||||
Dim WaitFor
|
|
||||||
|
|
||||||
Function Convert(Optional inFileURL, Optional filterSpec, Optional outFileURL)
|
|
||||||
Dim inDoc, inDocType, openParams, closeInDoc, presentationDoc
|
|
||||||
|
|
||||||
' Set Interactivity i.e., LogMessage pops up a message.
|
|
||||||
Interactive = False
|
|
||||||
|
|
||||||
WaitFor = 10
|
|
||||||
|
|
||||||
' Init dependencies
|
|
||||||
BasicLibraries.LoadLibrary("Tools")
|
|
||||||
' BasicLibraries.LoadLibrary("XrayTool")
|
|
||||||
|
|
||||||
' Setup Export filters
|
|
||||||
InitExportFilters
|
|
||||||
|
|
||||||
' Export to doc format by default
|
|
||||||
If IsMissing(filterSpec) Then
|
|
||||||
If Interactive Then
|
|
||||||
filterSpec = InputBox("Export to: ")
|
|
||||||
Else
|
|
||||||
filterSpec = "doc"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
filterSpec = Trim(filterSpec)
|
|
||||||
|
|
||||||
closeInDoc = False
|
|
||||||
If IsMissing(inFileURL) Then
|
|
||||||
' Most likely, the Macro is run interactively. Act on
|
|
||||||
' the current document
|
|
||||||
If Not ThisComponent.HasLocation() Then
|
|
||||||
LogMessage("Document doesn't have a location")
|
|
||||||
Goto Failure
|
|
||||||
End If
|
|
||||||
|
|
||||||
inDoc = ThisComponent
|
|
||||||
inFileURL = inDoc.GetLocation()
|
|
||||||
closeInDoc = False
|
|
||||||
|
|
||||||
Else
|
|
||||||
' Load the document
|
|
||||||
On Error Goto Failure
|
|
||||||
openParams = Array(MakePropertyValue("Hidden", True),MakePropertyValue("ReadOnly", True),)
|
|
||||||
|
|
||||||
'openParams = Array()
|
|
||||||
inDoc = StarDesktop.loadComponentFromURL(inFileURL, "_blank", 0, OpenParams())
|
|
||||||
closeInDoc = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
If IsMissing(outFileURL) Then
|
|
||||||
outFileURL = GetURLWithoutExtension(inFileURL)
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ExportDocument(inDoc, filterSpec, outFileURL) Then
|
|
||||||
Goto Success
|
|
||||||
End If
|
|
||||||
|
|
||||||
LogMessage("filterSpec1 is " & filterSpec)
|
|
||||||
|
|
||||||
' Export didn't go through. Maybe didn't find a valid filter.
|
|
||||||
|
|
||||||
' Check whether the request is to convert a Text or a Web
|
|
||||||
' Document to a Presentation Document
|
|
||||||
|
|
||||||
inDocType = GetDocumentType(inDoc)
|
|
||||||
If (inDocType = "com.sun.star.text.TextDocument" Or _
|
|
||||||
inDocType = "com.sun.star.text.WebDocument") Then
|
|
||||||
LogMessage("Filterspec2 is " & filterSpec)
|
|
||||||
filter = GetFilter("com.sun.star.presentation.PresentationDocument", filterSpec)
|
|
||||||
If IsNull(filter) Then
|
|
||||||
LogMessage("We tried our best. Nothing more to do"
|
|
||||||
Goto Failure
|
|
||||||
Else
|
|
||||||
LogMessage("Trying to create presentation document. Found valid filter for " & filterSpec)
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
Goto Failure
|
|
||||||
End If
|
|
||||||
|
|
||||||
' Export Outline to Presentation
|
|
||||||
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
|
|
||||||
dispatcher.executeDispatch(inDoc.CurrentController.Frame, ".uno:SendOutlineToStarImpress", "", 0, Array())
|
|
||||||
|
|
||||||
' Dispatch event above is aynchronous. Wait for a few seconds for the above event to finish
|
|
||||||
Wait(WaitFor * 1000)
|
|
||||||
|
|
||||||
' After the dispatch, the current component is a presentation
|
|
||||||
' document. Note that it doesn't have a location
|
|
||||||
|
|
||||||
presentationDoc = ThisComponent
|
|
||||||
If IsNull(ExportDocument(presentationDoc, filter, outFileURL)) Then
|
|
||||||
Goto Failure
|
|
||||||
Else
|
|
||||||
presentationDoc.Close(True)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Success:
|
|
||||||
LogMessage("Successfully exported to " & outFileURL )
|
|
||||||
Goto Done
|
|
||||||
|
|
||||||
Failure:
|
|
||||||
LogMessage("Export failed " & outFileURL )
|
|
||||||
Goto Done
|
|
||||||
|
|
||||||
Done:
|
|
||||||
If closeInDoc Then
|
|
||||||
inDoc.Close(True)
|
|
||||||
End If
|
|
||||||
End Function
|
|
||||||
|
|
||||||
' http://codesnippets.services.openoffice.org/Writer/Writer.MergeDocs.snip
|
|
||||||
' http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&t=39983
|
|
||||||
' http://user.services.openoffice.org/en/forum/viewtopic.php?f=21&t=23531
|
|
||||||
|
|
||||||
' http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/Files_and_Directories_%28Runtime_Library%29
|
|
||||||
|
|
||||||
|
|
||||||
Function ExportDocument(inputDoc, filterSpec, outFileURL) As Boolean
|
|
||||||
Dim inputDocType, filter
|
|
||||||
ExportDocument = False
|
|
||||||
|
|
||||||
On Error Goto Failure
|
|
||||||
inputDocType = GetDocumentType(inputDoc)
|
|
||||||
|
|
||||||
If IsArray(filterSpec) Then
|
|
||||||
' Filter is fully specified
|
|
||||||
filter = filterSpec
|
|
||||||
Else
|
|
||||||
' Filter is specified by it's name
|
|
||||||
filter = GetFilter(inputDocType, filterSpec)
|
|
||||||
End If
|
|
||||||
|
|
||||||
If InStr(outFileURL, ".") = 0 Then
|
|
||||||
outFileURL = outFileURL & "." & FilterSaveExtension(filter)
|
|
||||||
End If
|
|
||||||
|
|
||||||
LogMessage("outFileURL is " & outFileURL)
|
|
||||||
|
|
||||||
inputDoc.storeToUrl(outFileURL, Array(MakePropertyValue("FilterName", FilterHandler(filter))))
|
|
||||||
|
|
||||||
ExportDocument = True
|
|
||||||
LogMessage("Export to " & outFileURL & " succeeded")
|
|
||||||
Done:
|
|
||||||
Exit Function
|
|
||||||
|
|
||||||
Failure:
|
|
||||||
LogMessage("Export to " & outFileURL & " failed")
|
|
||||||
Resume Done
|
|
||||||
End Function
|
|
||||||
|
|
||||||
|
|
||||||
Function GetURLWithoutExtension(s As String)
|
|
||||||
Dim pos
|
|
||||||
pos = Instr(s, ".")
|
|
||||||
If pos = 0 Then
|
|
||||||
GetURLWithoutExtension = s
|
|
||||||
Else
|
|
||||||
GetURLWithoutExtension = Left(s, pos - 1)
|
|
||||||
End If
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Function GetDocumentType(oDoc)
|
|
||||||
For Each docType in DocTypes
|
|
||||||
If (oDoc.supportsService(docType)) Then
|
|
||||||
GetDocumentType = docType
|
|
||||||
Exit Function
|
|
||||||
End If
|
|
||||||
Next docType
|
|
||||||
GetDocumentType = Nothing
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Function MakePropertyValue(Optional sName As String, Optional sValue) As com.sun.star.beans.PropertyValue
|
|
||||||
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
|
|
||||||
|
|
||||||
If Not IsMissing(sName) Then
|
|
||||||
oPropertyValue.Name = sName
|
|
||||||
EndIf
|
|
||||||
|
|
||||||
If Not IsMissing(sValue) Then
|
|
||||||
oPropertyValue.Value = sValue
|
|
||||||
EndIf
|
|
||||||
|
|
||||||
MakePropertyValue() = oPropertyValue
|
|
||||||
|
|
||||||
End Function
|
|
||||||
|
|
||||||
|
|
||||||
Sub LogMessage(message)
|
|
||||||
If Interactive Then
|
|
||||||
If Err <> 0 Then
|
|
||||||
Print "Error " & Err & ": " & Error$ & " (line : " & Erl & ")"
|
|
||||||
End If
|
|
||||||
Print message
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
|
|
|
@ -1,115 +0,0 @@
|
||||||
#+Title: Org-mode Testing
|
|
||||||
#+Babel: results silent
|
|
||||||
|
|
||||||
The following instructions describe how to get started using the
|
|
||||||
Org-mode test framework.
|
|
||||||
|
|
||||||
* To run the tests interactively
|
|
||||||
:PROPERTIES:
|
|
||||||
:tangle: no
|
|
||||||
:END:
|
|
||||||
1) Install the jump.el testing dependency which is included as a git
|
|
||||||
submodule in the org-mode repository. To do so run the following
|
|
||||||
git submodule commands from inside the base of the Org-mode
|
|
||||||
directory (or just execute the following code block).
|
|
||||||
|
|
||||||
#+begin_src sh
|
|
||||||
cd ..
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
2) Load the [[file:org-test.el][org-test.el]] file
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(load-file "org-test.el")
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
3) The =org-test-jump= command is now bound to =M-C-j= in all
|
|
||||||
emacs-lisp files. Call this command from any file in the =lisp/=
|
|
||||||
directory of the org-mode repository to jump to the related test
|
|
||||||
file in the =testing/= directory. Call this functions with a
|
|
||||||
prefix argument, and the corresponding test file will be stubbed
|
|
||||||
out if it doesn't already exist.
|
|
||||||
|
|
||||||
4) Ingest the library-of-babel.org file since some tests require this.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(org-babel-lob-ingest "../contrib/babel/library-of-babel.org")
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
5) [[info:ert#Top][Review the ERT documentation]]
|
|
||||||
|
|
||||||
6) A number of org-mode-specific functions and macros are provided in
|
|
||||||
=org-test.el= see the [[file:org-test.el::%3B%3B%3B%20Functions%20for%20writing%20tests][;;; Functions for Writing Tests]] subsection of
|
|
||||||
that file. Some of these functions make use of example org-mode
|
|
||||||
files located in the [[file:examples][examples/]] directory.
|
|
||||||
|
|
||||||
7) Functions for loading and running the Org-mode tests are provided
|
|
||||||
in the [[file:org-test.el::%3B%3B%3B%20Load%20and%20Run%20tests][;;; Load and Run Tests]] subsection, the most important of
|
|
||||||
which are
|
|
||||||
- =org-test-load= which loads the entire Org-mode test suite
|
|
||||||
- =org-test-current-defun= which runs all tests for the current
|
|
||||||
function around point (should be called from inside of an
|
|
||||||
Org-mode elisp file)
|
|
||||||
- =org-test-run-all-tests= which runs the entire Org-mode test suite
|
|
||||||
- also note that the =ert= command can also be used to run tests
|
|
||||||
|
|
||||||
8) Load and run all tests
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(load-file "org-test.el")
|
|
||||||
(org-babel-lob-ingest "../contrib/babel/library-of-babel.org")
|
|
||||||
(org-test-load)
|
|
||||||
(org-test-run-all-tests)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
* To run the tests in batch mode
|
|
||||||
First tangle this file out to your desktop.
|
|
||||||
#+headers: :tangle ~/Desktop/run-org-tests.el
|
|
||||||
#+begin_src emacs-lisp :var org-dir=(expand-file-name ".." (file-name-directory (or load-file-name (buffer-file-name))))
|
|
||||||
;; add to the load path
|
|
||||||
(add-to-list 'load-path (concat org-dir "/lisp/"))
|
|
||||||
(add-to-list 'load-path (concat org-dir "/lisp/testing/"))
|
|
||||||
(add-to-list 'load-path (concat org-dir "/lisp/testing/ert/"))
|
|
||||||
|
|
||||||
;; load Org-mode
|
|
||||||
(require 'org)
|
|
||||||
|
|
||||||
;; setup the ID locations used in tests
|
|
||||||
(require 'org-id)
|
|
||||||
(org-id-update-id-locations
|
|
||||||
(list (concat org-dir "/testing/examples/babel.org")
|
|
||||||
(concat org-dir "/testing/examples/ob-C-test.org")
|
|
||||||
(concat org-dir "/testing/examples/normal.org")
|
|
||||||
(concat org-dir "/testing/examples/ob-awk-test.org")
|
|
||||||
(concat org-dir "/testing/examples/ob-octave.org")
|
|
||||||
(concat org-dir "/testing/examples/ob-fortran-test.org")
|
|
||||||
(concat org-dir "/testing/examples/ob-maxima-test.org")
|
|
||||||
(concat org-dir "/testing/examples/link-in-heading.org")
|
|
||||||
(concat org-dir "/testing/examples/links.org")))
|
|
||||||
|
|
||||||
;; ensure that the latest Org-mode is loaded
|
|
||||||
(org-reload)
|
|
||||||
|
|
||||||
;; load the test suite
|
|
||||||
(load-file (concat org-dir "/testing/org-test.el"))
|
|
||||||
|
|
||||||
;; configure Babel
|
|
||||||
(org-babel-lob-ingest (concat org-dir "/contrib/babel/library-of-babel.org"))
|
|
||||||
(org-babel-do-load-languages
|
|
||||||
'org-babel-load-languages
|
|
||||||
'((emacs-lisp . t)
|
|
||||||
(sh . t)))
|
|
||||||
(setq org-confirm-babel-evaluate nil)
|
|
||||||
|
|
||||||
;; run the test suite
|
|
||||||
(org-test-run-all-tests)
|
|
||||||
|
|
||||||
;; print the results
|
|
||||||
(with-current-buffer "*ert*"
|
|
||||||
(print (buffer-string)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Then run the test suite with the following command which could use any
|
|
||||||
version of Emacs.
|
|
||||||
#+begin_src sh :results output silent
|
|
||||||
emacs --batch -Q -l ~/Desktop/run-org-tests.el
|
|
||||||
#+end_src
|
|
|
@ -1 +0,0 @@
|
||||||
# this file ensures that the testing/contrib/lisp directory is created by git
|
|
|
@ -1,19 +0,0 @@
|
||||||
#+TITLE: example file with tables
|
|
||||||
#+OPTIONS: num:nil ^:nil
|
|
||||||
|
|
||||||
This is an example file for use by the Org-mode tests defined in
|
|
||||||
file:../lisp/test-org-table.el.
|
|
||||||
|
|
||||||
* simple formula
|
|
||||||
:PROPERTIES:
|
|
||||||
:ID: 563523f7-3f3e-49c9-9622-9216cc9a5d95
|
|
||||||
:END:
|
|
||||||
|
|
||||||
#+tblname: simple-formula
|
|
||||||
| 1 |
|
|
||||||
| 2 |
|
|
||||||
| 3 |
|
|
||||||
| 4 |
|
|
||||||
|----|
|
|
||||||
| 10 |
|
|
||||||
#+TBLFM: $1=vsum(@1..@-1)
|
|
Loading…
Reference in New Issue