1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--**********************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 **********************************************************************-->
28 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
29 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_10er" script:language="StarBasic">REM 10er Test
31 const sSWLogFileName = "swlog.dat", sSCLogFileName = "sclog.dat"
32 const sSDLogFileName = "sdlog.dat", sSMathLogFileName = "smalog.dat"
33 const sSImDLogFileName = "simlog.dat", sSChartLogFileName = "schlog.dat"
34 const sSHptLogFileName = "shptlog.dat", sSMessageLogFileName = "smeslog.dat"
35 const sSDrawLogFileName = "sdrwlog.dat", sJavaLogFileName = "javalog.dat"
36 const sSDBLogFileName = "dblog.dat", sExtLogFileName = "extlog.dat"
37 const sLogFileName = "log.dat"
38 const cTempFileName = "ttt"
40 const cMessageSaveOpen8Doc = "Save/Open open Documents (8.0)"
41 const cMessageSaveOpenXMLDoc = "Save/Open Document XML (6/7)"
42 const cMessageNewDoc = "New Document"
43 const cMessageCloseDoc = "Close Document"
48 Global MainFileChannel%
54 Sub DeleteAllSavedFiles()
55 Dim sFileName as String
56 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter)
57 If FileExists (sFileName) then
60 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc)
61 If FileExists (sFileName) then
64 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress)
65 If FileExists (sFileName) then
68 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw)
69 If FileExists (sFileName) then
72 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmHyperText)
73 If FileExists (sFileName) then
76 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmWriter or cFltXML)
77 If FileExists (sFileName) then
80 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmCalc or cFltXML)
81 If FileExists (sFileName) then
84 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmImpress or cFltXML)
85 If FileExists (sFileName) then
88 sFileName = sWorkPath+cTempFileName+"."+GetDocEndings(frmDraw or cFltXML)
89 If FileExists (sFileName) then
94 Sub DeleteAllLogFiles()
95 If FileExists (sWorkPath+sLogFileName) then
96 Kill (sWorkPath+sLogFileName)
98 If FileExists (sWorkPath+sSWLogFileName) then
99 Kill (sWorkPath+sSWLogFileName)
101 If FileExists (sWorkPath+sSCLogFileName) then
102 Kill (sWorkPath+sSCLogFileName)
104 If FileExists (sWorkPath+sSDLogFileName) then
105 Kill (sWorkPath+sSDLogFileName)
107 If FileExists (sWorkPath+sSMathLogFileName) then
108 Kill (sWorkPath+sSMathLogFileName)
110 If FileExists (sWorkPath+sSImDLogFileName) then
111 Kill (sWorkPath+sSImDLogFileName)
113 If FileExists (sWorkPath+sSChartLogFileName) then
114 Kill (sWorkPath+sSChartLogFileName)
116 If FileExists (sWorkPath+sSHptLogFileName) then
117 Kill (sWorkPath+sSHptLogFileName)
119 If FileExists (sWorkPath+sSMessageLogFileName) then
120 Kill (sWorkPath+sSMessageLogFileName)
122 If FileExists (sWorkPath+sSDrawLogFileName) then
123 Kill (sWorkPath+sSDrawLogFileName)
125 If FileExists (sWorkPath+sJavaLogFileName) then
126 Kill (sWorkPath+sJavaLogFileName)
128 If FileExists (sWorkPath+sSDBLogFileName) then
129 Kill (sWorkPath+sSDBLogFileName)
131 If FileExists (sWorkPath+sExtLogFileName) then
132 Kill (sWorkPath+sExtLogFileName)
136 Function OpenLogDat (sFileName as String) as Integer
137 Dim LocaleFileChannel%
138 If FileExists (sWorkPath+sFileName) then
139 Kill (sWorkPath+sFileName)
141 LocaleFileChannel% = Freefile
142 Open sWorkPath+sFileName For Output As LocaleFileChannel%
143 OpenLogDat = LocaleFileChannel%
146 Function GetWorkPath as string
147 sTemp = "$(userpath)/temp/"
148 GetWorkPath = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp)
151 Function GetWorkURL as string
152 sTemp = "$(userurl)/temp/"
153 GetWorkURL = CreateUnoService("com.sun.star.config.SpecialConfigManager").SubstituteVariables(sTemp)
156 Function GetSystem (sTmpWorkPath as string) as string
157 GetSystem = ""
158 if InStr (sTmpWorkPath, ":") then
159 GetSystem = "windows"
161 GetSystem = "unix"
165 Function ConvertPathToWin (sTmpWorkPath as string) as string
166 for i%=1 to Len(sTmpWorkPath)
167 sTemp = Mid (sTmpWorkPath, i%, 1)
168 if sTemp = "/" then
169 sTmpWorkPath = Left (sTmpWorkPath, i%-1) + "\" + Right (sTmpWorkPath, Len(sTmpWorkPath)-i%)
171 if sTemp = "|" then
172 sTmpWorkPath = Left (sTmpWorkPath, i%-1) + ":" + Right (sTmpWorkPath, Len(sTmpWorkPath)-i%)
176 ConvertPathToWin = sTmpWorkPath
180 DIM sDocURL as String, sDocPath as String
183 sWorkPath = GetWorkPath
184 sWorkPathURL = GetWorkURL
186 if GetSystem (sWorkPath) = "windows" then
187 sWorkPath = ConvertPathToWin (sWorkPath)
190 'search ExtensionURL
191 sDocURL = gOutPutDoc.URL
192 CompatibilityMode(true)
193 nStrPos = InStrRev (sDocURL, "/" )
194 CompatibilityMode(false)
195 sExtensionURL = Left (sDocURL, nStrPos)
197 call DeleteAllSavedFiles()
198 call DeleteAllLogFiles()
199 MainFileChannel = OpenLogDat (sLogFileName)
200 call WriteTestSequence (MainFileChannel)
201 if bMakeWriterTest then
202 call MakeDocTest (frmWriter)
204 if bMakeCalcTest then
205 call MakeDocTest (frmCalc)
207 if bMakeImpressTest then
208 call MakeDocTest (frmImpress)
210 if bMakeDrawTest then
211 call MakeDocTest (frmDraw)
213 if bMakeHTMLTest then
214 call MakeDocTest (frmHyperText)
216 if bMakeChartTest then
217 call MakeChartTest (frmChart)
219 if bMakeMathTest then
220 call MakeNewDoc (frmMath)
222 if bMakeJavaTest then
223 call TestJava (frmJava)
226 call Test_DB.TestDB (frmDataBase)
228 if bMakeExtensionTest then
229 call Test_Ext.TestExtensions (frmExtension)
232 Close #MainFileChannel
235 Sub WriteTestSequence (FileChannel as integer)
236 Print #FileChannel, "Sequence of testing"
238 if bMakeWriterTest then
239 WriteTests ("writer : ", true, FileChannel)
241 if bMakeCalcTest then
242 WriteTests ("calc : ", true, FileChannel)
244 if bMakeImpressTest then
245 WriteTests ("impress : ", true, FileChannel)
247 if bMakeDrawTest then
248 WriteTests ("draw : ", true, FileChannel)
250 if bMakeHTMLTest then
251 WriteTests ("HTML : ", true, FileChannel)
253 if bMakeChartTest then
254 WriteTests ("chart : ", false, FileChannel)
256 if bMakeMathTest then
257 WriteTests ("math : ", false, FileChannel)
259 if bMakeJavaTest then
260 WriteTests ("Java : ", false, FileChannel)
263 WriteDBTests ("Database : ", FileChannel)
265 if bMakeExtensionTest then
266 WriteExtensionTests ("Extension : ", FileChannel)
272 Sub WriteTests (sText as string, bTestAll as boolean, nFileChannel as integer)
273 Dim sWriteStr as string
276 sWriteStr = sWriteStr + "new"
278 if bMakeSaveOpen8Test then
279 sWriteStr = sWriteStr + ", save 8.0"
281 if bMakeSaveOpenXMLTest then
282 sWriteStr = sWriteStr + ", save XML"
284 if bMakeSaveOpen8Test then
285 sWriteStr = sWriteStr + ", open 8.0"
287 if bMakeSaveOpenXMLTest then
288 sWriteStr = sWriteStr + ", open XML"
292 sWriteStr = sWriteStr + ", close"
294 Print #nFileChannel, sWriteStr
297 Sub WriteDBTests (sText as string, nFileChannel as integer)
298 Dim sWriteStr as string
301 sWriteStr = sWriteStr + "open / services"
302 sWriteStr = sWriteStr + ", insert"
303 sWriteStr = sWriteStr + ", delete"
304 sWriteStr = sWriteStr + ", seek"
305 sWriteStr = sWriteStr + ", close"
307 Print #nFileChannel, sWriteStr
310 Sub WriteExtensionTests (sText as string, nFileChannel as integer)
311 Dim sWriteStr as string
314 sWriteStr = sWriteStr + "services"
315 sWriteStr = sWriteStr + ", install"
316 sWriteStr = sWriteStr + ", uninstall"
318 Print #nFileChannel, sWriteStr
321 Sub MakeDocTest (FilterType as Integer)
323 Dim sFileNameXML$, sFileName8$
324 Dim bError as Boolean
325 Dim nCurrentAction as Integer
327 On Local Error GoTo DOCTESTERROR
328 nCurrentAction = cLogfileFailed
329 FileChannel% = OpenLogDat (GetLogFileName(FilterType))
330 nCurrentAction = cDocNew
331 oDoc = LoadDoc ("private:factory/" + GetDocFilter(FilterType or cFltNewDoc))
332 LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel)
333 LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel)
334 SetStatus (FilterType, cDocNew, not IsNull (oDoc))
335 if not IsNull (oDoc) then
336 nCurrentAction = cDocSaveOpen8
337 if bMakeSaveOpen8Test and IsFilterAvailable (FilterType or cFlt8) then
338 sFileName8 = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFlt8)
339 SaveDoc (sFileName8, oDoc, GetDocFilter(FilterType or cFlt8))
341 nCurrentAction = cDocSaveOpenXML
342 if bMakeSaveOpenXMLTest and IsFilterAvailable (FilterType or cFltXML) then
343 sFileNameXML = sWorkPathURL+cTempFileName+"."+GetDocEndings(FilterType or cFltXML)
344 SaveDoc (sFileNameXML, oDoc, GetDocFilter(FilterType or cFltXML))
347 nCurrentAction = cDocClose
349 ' bError = true ' nur zum ¦bergang, weil bError = oDoc.CurrentController.frame.close nicht geht
350 ' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel)
351 ' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel)
352 ' SetStatus (FilterType, cDocClose, bError)
353 nCurrentAction = cDocSaveOpen8
354 if bMakeSaveOpen8Test and IsFilterAvailable (FilterType or cFlt8) then
355 oDoc = LoadDoc (sFileName8)
357 ' oDoc = Documents.open(sFileName)
358 LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, FileChannel)
359 LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpen8Doc, MainFileChannel)
360 SetStatus (FilterType, cDocSaveOpen8, not IsNull (oDoc))
362 if not IsNull (oDoc) then
364 nCurrentAction = cDocClose
369 nCurrentAction = cDocSaveOpenXML
370 if bMakeSaveOpenXMLTest and IsFilterAvailable (FilterType or cFltXML) then
371 oDoc = LoadDoc (sFileNameXML)
373 ' oDoc = Documents.open(sFileName)
374 LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, FileChannel)
375 LogState (not IsNull (oDoc),GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageSaveOpenXMLDoc, MainFileChannel)
376 SetStatus (FilterType, cDocSaveOpenXML, not IsNull (oDoc))
378 if not IsNull (oDoc) then
380 nCurrentAction = cDocClose
386 Print #FileChannel, "---"
388 Exit Sub ' Without error
391 If (nCurrentAction = cLogfileFailed) then
392 SetStatus (FilterType, cDocNew, False)
395 LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel)
396 LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel)
397 SetStatus (FilterType, nCurrentAction, False)
400 Exit Sub ' With error
403 Sub MakeNewDoc (FilterType as Integer)
405 Dim bError as Boolean
406 Dim nCurrentAction as Integer
407 On Local Error GoTo DOCTESTERROR2
408 nCurrentAction = cLogfileFailed
409 FileChannel% = OpenLogDat (GetLogFileName(FilterType))
410 nCurrentAction = cDocNew
411 ' oDoc = Documents.Add(GetDocFilter(FilterType))
412 oDoc = LoadDoc ("private:factory/" + GetDocFilter(FilterType or cFltNewDoc))
413 LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel)
414 LogState (not IsNull (oDoc), GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel)
415 SetStatus (FilterType, cDocNew, not IsNull (oDoc))
416 if not IsNull (oDoc) then
417 nCurrentAction = cDocClose
420 ' bError = true ' nur zum ¦bergang, weil bError = oDoc.CurrentController.frame.close nicht geht
421 ' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, FileChannel)
422 ' LogState (bError, GetDocFilter(FilterType)+" "+ cMessageCloseDoc, MainFileChannel)
423 ' SetStatus (FilterType, cDocClose, bError)
425 Print #FileChannel, "---"
427 Exit Sub ' Without error
430 If (nCurrentAction = cLogfileFailed) then
431 SetStatus (FilterType, cDocNew, False)
434 LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel)
435 LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel)
436 SetStatus (FilterType, nCurrentAction, False)
439 Exit Sub ' With error
442 Sub MakeChartTest (FilterType as Integer)
443 Dim oCharts as Object
445 Dim oRange(0) as New com.sun.star.table.CellRangeAddress
446 Dim oRect as New com.sun.star.awt.Rectangle
447 const cChartName="TestChart"
448 Dim bError as Boolean
449 Dim nCurrentAction as Integer
450 On Local Error GoTo CHARTTESTERROR
451 nCurrentAction = cLogfileFailed
452 FileChannel% = OpenLogDat (GetLogFileName(FilterType))
453 nCurrentAction = cDocNew
454 oDoc = LoadDoc ("private:factory/" + GetDocFilter(frmCalc or cFltNewDoc))
455 if not IsNull (oDoc) then
456 oCharts = oDoc.sheets(0).Charts
457 oCharts.AddNewByName (cChartName, oRect, oRange(), true, true)
458 bError=oCharts.HasByName(cChartName)
459 LogState (bError, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel)
460 LogState (bError, GetDocFilter(FilterType or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel)
461 SetStatus (FilterType, cDocNew, bError)
463 nCurrentAction = cDocClose
466 LogState (not IsNull (oDoc), GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, FileChannel)
467 LogState (not IsNull (oDoc), GetDocFilter(frmCalc or cFltNewDoc)+" "+ cMessageNewDoc, MainFileChannel)
468 SetStatus (frmCalc, cDocNew, not IsNull (oDoc))
470 Print #FileChannel, "---"
472 Exit Sub ' Without error
475 If (nCurrentAction = cLogfileFailed) then
476 SetStatus (FilterType, cDocNew, False)
479 LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), FileChannel)
480 LogState (False, GetDocFilter(FilterType or cFltNewDoc)+" "+ GetErrorMessage(nCurrentAction), MainFileChannel)
481 SetStatus (FilterType, nCurrentAction, False)
484 Exit Sub ' With error
487 Sub LogState (bState as Boolean, sText as String, nLocaleFileChannel as integer)
489 Print #nLocaleFileChannel, sText+" -> ok"
491 Print #nLocaleFileChannel, sText+" -> error"
495 Function GetDocEndings (DocType as Integer) as String
496 Select Case ( DocType )
497 case frmWriter or cFlt8
498 GetDocEndings = "odt" ' Textdokument
499 case frmCalc or cFlt8
500 GetDocEndings = "ods" 'Tabellendokument
501 case frmImpress or cFlt8
502 GetDocEndings = "odp" 'PrÕsentation
503 case frmDraw or cFlt8
504 GetDocEndings = "odg" 'Zeichen
505 case frmHyperText, frmHyperText or cFltXML
506 GetDocEndings = "html" 'Hypertext-Dokument
507 case frmWriter or cFltXML
508 GetDocEndings = "sxw" ' Textdokument
509 case frmCalc or cFltXML
510 GetDocEndings = "sxc" 'Tabellendokument
511 case frmImpress or cFltXML
512 GetDocEndings = "sxi" 'PrÕsentation
513 case frmDraw or cFltXML
514 GetDocEndings = "sxd" 'Zeichen
516 GetDocEndings = ""
520 Function GetDocFilter (DocType as Integer) as String
521 Select Case ( DocType )
522 case frmWriter or cFlt8
523 GetDocFilter = "writer8" ' Textdokument
524 case frmCalc or cFlt8
525 GetDocFilter = "calc8" 'Tabellendokument
526 case frmImpress or cFlt8
527 GetDocFilter = "impress8" 'Präsentation
528 case frmDraw or cFlt8
529 GetDocFilter = "draw8" 'Zeichen
530 case frmMath or cFlt8
531 GetDocFilter = "math8" 'Formel
533 case frmWriter or cFltXML
534 GetDocFilter = "StarOffice XML (Writer)" ' Textdokument
535 case frmCalc or cFltXML
536 GetDocFilter = "StarOffice XML (Calc)" 'Tabellendokument
537 case frmImpress or cFltXML
538 GetDocFilter = "StarOffice XML (Impress)" 'Präsentation
539 case frmDraw or cFltXML
540 GetDocFilter = "StarOffice XML (Draw)" 'Zeichen
541 case frmMath or cFltXML
542 GetDocFilter = "StarOffice XML (Math)" 'Formel
544 case frmHyperText, frmHyperText or cFltXML
545 GetDocFilter = "HTML" 'Hypertext-Dokument
547 case frmWriter or cFltNewDoc
548 GetDocFilter = "swriter" ' Textdokument
549 case frmCalc or cFltNewDoc
550 GetDocFilter = "scalc" 'Tabellendokument
551 case frmMessage or cFltNewDoc
552 GetDocFilter = "Message" 'Nachricht
553 case frmImpress or cFltNewDoc
554 GetDocFilter = "simpress" 'Präsentation
555 case frmDraw or cFltNewDoc
556 GetDocFilter = "sdraw" 'Zeichen
557 case frmMath or cFltNewDoc
558 GetDocFilter = "smath" 'Formel
559 case frmImage or cFltNewDoc
560 GetDocFilter = "simage" 'Bild
561 case frmHyperText or cFltNewDoc
562 GetDocFilter = "swriter/web" 'Hypertext-Dokument
563 case frmChart or cFltNewDoc
564 GetDocFilter = "schart" 'Diagramm
566 GetDocFilter = ""
570 Function GetLogFileName (DocType as Integer) as String
571 Select Case ( DocType )
573 GetLogFileName = sSWLogFileName ' Textdokument
575 GetLogFileName = sSCLogFileName 'Tabellendokument
577 GetLogFileName = sSMessageLogFileName 'Nachricht
579 GetLogFileName = sSDLogFileName 'PrÕsentation
581 GetLogFileName = sSDrawLogFileName 'Zeichnen
583 GetLogFileName = sSMathLogFileName 'Formel
585 GetLogFileName = sSImDLogFileName 'Bild
587 GetLogFileName = sSHptLogFileName 'Hypertext-Dokument
589 GetLogFileName = sSChartLogFileName 'Diagramm
591 GetLogFileName = sJavaLogFileName 'Java
593 GetLogFileName = sSDBLogFileName 'Database
595 GetLogFileName = sExtLogFileName 'Extension
597 GetLogFileName = ""
601 Function GetErrorMessageOnAction (nAction as Integer) as String
602 Select Case ( nAction )
604 GetErrorMessageOnAction = cMessageNewDoc
606 GetErrorMessageOnAction = cMessageSaveOpen8Doc
608 GetErrorMessageOnAction = cMessageSaveOpenXMLDoc
610 GetErrorMessageOnAction = cMessageCloseDoc
612 GetErrorMessageOnAction = ""
616 Function IsFilterAvailable (FilterType as Integer) as boolean
617 IsFilterAvailable = true
618 if ((FilterType = (frmHyperText or cFltXML))) then
619 IsFilterAvailable = false
623 Function TestJava (FilterType as Integer) as boolean
625 FileChannel% = OpenLogDat (GetLogFileName(FilterType))
626 oObj = createUnoService(cUnoJavaLoader)
627 LogState (not IsNull (oObj), "Java "+ cMessageNewDoc, FileChannel)
628 LogState (not IsNull (oObj), "Java "+ cMessageNewDoc, MainFileChannel)
629 SetStatus (FilterType, cDocNew, not IsNull (oObj))
631 Print #FileChannel, "---"
634 TestJava = not IsNull (oObj)
637 Sub LoadLibrary( LibName as String )
640 dim arg as new com.sun.star.beans.PropertyValue
641 arg.Name = "LibraryName"
645 dim url as new com.sun.star.util.URL
647 trans = createUnoService("com.sun.star.util.URLTransformer" )
648 url.Complete = "slot:6517"
649 trans.parsestrict( url )
652 disp = StarDesktop.currentFrame.queryDispatch( url, "", 0 )
653 disp.dispatch( url, args() )
657 Sub LoadDoc (DocName as String) as Object
659 trans = createUnoService("com.sun.star.util.URLTransformer" )
660 url = createUnoStruct("com.sun.star.util.URL" )
661 url.Complete = DocName
662 if Left(DocName, 5 ) <> "file:" then
663 trans.parsestrict( url )
666 Dim aPropArray(0) as Object
667 aPropArray(0) = CreateUnoStruct("com.sun.star.beans.PropertyValue")
668 aPropArray(0).Name = "OpenFlags"
669 aPropArray(0).Value = "S"
673 doc = StarDesktop.loadComponentFromURL( url.Complete, "_blank", 0, aPropArray() ) ' XModel
677 Sub SaveDoc (DocName as String, oDoc as Object, sFilterName as string )
679 trans = createUnoService("com.sun.star.util.URLTransformer" )
680 url = createUnoStruct("com.sun.star.util.URL" )
681 url.Complete = DocName
682 if Left(DocName, 5 ) <> "file:" then
683 trans.parsestrict( url )
686 if not (sFilterName = "") then
687 Dim aPropArray(0) as Object
688 aPropArray(0) = CreateUnoStruct("com.sun.star.beans.PropertyValue")
689 aPropArray(0).Name = "FilterName"
690 aPropArray(0).Value = sFilterName
692 oDoc.storeAsURL( url.Complete, aPropArray() )
694 MessageBox "Filtername is unknown!"