1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE script:module PUBLIC
"-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:
script=
"http://openoffice.org/2000/script" script:
name=
"Global" script:
language=
"StarBasic">REM ***** BASIC *****
5 const cMaxErrorStates =
13
7 const cCoGreen =
4057917, cCoRed =
16711680, cCoGrey =
12632256
8 const cParagraphBreak =
0
10 global const cExtensionFileName =
"TestExtension.oxt
"
12 global const cDocNew =
0, cDocCut =
1, cDocPaste =
2, cDocSaveOpen8 =
3, cDocSaveOpenXML =
4, cDocSaveOpen50 =
5, cDocClose =
6, cDocWrite =
7
13 global const cNewsInit =
0, cNewsSend =
1, cNewsRead =
2
14 global const cDBService =
0, cDBOpen =
1, cDBInsert =
2, cDBDelete =
3, cDBSeek =
4, cDBClose =
5
15 global const cEXTService =
0, cEXTInstall =
1, cEXTUninstall =
2
16 global const cScheduleDateRead =
0
17 global const cLogfileFailed =
255
19 global const cStWriter =
0, cStCalc =
1, cStPraesentation =
2, cStZeichnen =
3
20 global const cStMessage =
12, cStHTML =
6, cStChart =
4, cStJava =
7
21 global const cStMath =
5, cStNews =
10, cStSchedule =
8, cStDataBase =
9
22 global const cStExtension =
11
23 global const cStNone = -
1
25 global const cFlt8 =
0, cFlt50 =
32, cFltNewDoc =
64, cFltXML =
128
27 global const frmWriter =
1, frmCalc =
2, frmMessage =
3, frmImpress =
4
28 global const frmMath =
5, frmImage =
6, frmChart =
7, frmHyperText =
8, frmDraw =
9
29 global const frmDataBase =
10, frmSchedule =
11, frmNews =
12, frmJava =
13
30 global const frmExtension =
14
32 global const cLogUnknown =
0, cLogFalse =
1, cLogTrue =
2
34 'UserFieldKennungen
35 Global const cYes =
"y
", cNo =
"n
"
36 Global const cStateNo =
0, cStateYes =
1
39 Global const cFtExtUser =
21, cFtPageNum =
5, cFtStatistic =
8, cFtDateTime =
27, cFtDatabase =
31
42 Global const cUnoSeparator =
".
"
43 Global const cUnoPrefix =
"com.sun.star.
"
44 Global const cUnoUserField = cUnoPrefix +
"text.FieldMaster.User
"
45 Global const cUnoExtUserField = cUnoPrefix +
"text.TextField.ExtendedUser
"
46 Global const cUnoMasterDataBase = cUnoPrefix +
"text.FieldMaster.Database
"
47 Global const cUnoDataBase = cUnoPrefix +
"text.TextField.Database
"
48 Global const cUnoDateTime = cUnoPrefix +
"text.TextField.DateTime
"
49 Global const cUnoTextGraphi2 = cUnoPrefix +
"text.Graphic
"
50 Global const cUnoJavaLoader = cUnoPrefix +
"loader.Java
"
51 Global const cUnoDatabaseContext = cUnoPrefix +
"sdb.DatabaseContext
"
52 Global const cUnoRowSet = cUnoPrefix +
"sdb.RowSet
"
53 Global const cUnoSmoketestTestExtension = cUnoPrefix +
"comp.smoketest.TestExtension
"
54 Global const cUnoSmoketestCommandEnvironment = cUnoPrefix +
"deployment.test.SmoketestCommandEnvironment
"
55 Global const cUnothePackageManagerFactory = cUnoPrefix +
"deployment.thePackageManagerFactory
"
58 Global const cUserFieldTestWriter =
"Writer
", cUserFieldTestCalc =
"Calc
", cUserFieldTestImpress =
"Impress
"
59 Global const cUserFieldTestDraw =
"Draw
", cUserFieldTestMath =
"Math
", cUserFieldTestChart =
"Chart
"
60 Global const cUserFieldTestHTML =
"HTML
", cUserFieldTestJava =
"Java
", cUserFieldTestDatabase =
"Database
"
61 Global const cUserFieldTestExtension =
"Extension
"
62 Global const cUserFieldTestOpenSaveXML =
"SaveOpenXML
", cUserFieldTestOpenSave50 =
"SaveOpen50
", cUserFieldTestCut =
"Cut
"
63 Global const cUserFieldTestPaste =
"Paste
", cUserFieldTestTerminateAfterTest =
"Terminate
", cUserFieldTestOpenSave8 =
"SaveOpen8
"
65 Global const cOptionsDialogName =
"OptionsDlg
", cTest10Modul =
"Standard
"
67 Global const cDlgCancel =
1, cDlgOk =
0, cDlgStartTest =
2
69 global gErrorState (cMaxErrorStates,
5) as integer
71 global gOutputDoc as Object
72 global gOutputDocNotUno as Object
73 global gOptionsDialog as Object
74 Dim bMakeMailAccount as Boolean, bTestMail as Boolean, bTestDocs as Boolean
75 Dim bTestSchedule as Boolean, bTestAdr as Boolean
77 Global bMakeWriterTest as boolean, bMakeCalcTest as boolean, bMakeImpressTest as boolean
78 Global bMakeDrawTest as Boolean, bMakeMathTest as boolean, bMakeChartTest as boolean
79 Global bMakeHTMLTest as boolean, bMakeJavaTest as boolean, bMakeDBTest as boolean
80 Global bMakeExtensionTest as boolean
81 Global bMakeSaveOpenXMLTest as boolean, bMakeSaveOpen50Test as boolean, bMakeCutTest as boolean
82 Global bMakePasteTest as boolean, bMakeTerminateAfterTest as boolean, bShowTable as boolean
83 Global bMakeSaveOpen8Test as boolean
85 global sExtensionURL as string
87 Dim gDlgState as Integer
90 gOutPutDoc = StarDesktop.CurrentComponent
94 for j% =
0 to cMaxErrorStates
96 gErrorState (j%, i%) = cLogUnknown
103 call ClearDoc (gOutPutDoc)
110 call ClearDoc (gOutPutDoc)
118 call CreateStatusTable2
119 call CreateStatusTable
121 call CreateSecondState
122 gOutputDoc.CurrentController.ViewCursor.JumpToFirstPage
126 Sub CreateStatusTable
127 dim tableHeaders(
7) as string
128 tableHeaders(cStWriter) =
"Writer
"
129 tableHeaders(cStCalc) =
"Calc
"
130 tableHeaders(cStPraesentation) =
"Präsen- tation
"
131 tableHeaders(cStZeichnen) =
"Zeichn.
"
132 tableHeaders(cStChart) =
"Diagr.
"
133 tableHeaders(cStMath) =
"Math
"
134 tableHeaders(cStHTML) =
"HTML
"
135 tableHeaders(cStJava) =
"Java
"
137 dim tableColums(
5) as string
138 tableColums(cDocNew) =
"new
"
139 tableColums(cDocCut) =
"cut
"
140 tableColums(cDocPaste) =
"paste
"
141 tableColums(cDocSaveOpen8) =
"V8.0
"
142 tableColums(cDocSaveOpenXML) =
"XML
"
143 tableColums(cDocSaveOpen50) =
"V5.0
"
144 ' tableColums(cDocClose) =
"close
"
149 xCursor = xText.createTextCursor()
151 ' xCursor.gotoStart(FALSE)
152 ' xCursor.GoRight (
2, False)
153 ' SetParagraphBreak (xCursor)
154 ' SetParagraphBreak (xCursor)
155 xCursor.gotoStart(FALSE)
156 xCursor.GoRight (
4, False)
157 SetParagraphBreak (xCursor)
158 xCursor.GoRight (
1, False)
159 SetParagraphBreak (xCursor)
160 xCursor.GoRight (
1, False)
162 table = aDoc.createInstance(
"com.sun.star.text.TextTable
")
163 table.initialize(
7,
9)
164 table.Name =
"StTab1
"
165 xText.insertTextContent(xCursor, table, FALSE)
167 tableCursor = table.createCursorByCellName(table.CellNames(
0))
168 tableCursor.gotoStart(FALSE)
169 tableCursor.goRight(
1,FALSE)
172 cName = tableCursor.getRangeName()
173 xCell = table.getCellByName(cName)
174 xCell.String=tableHeaders(i%)
176 xCell.BackTransparent = False
177 xCell.BackColor = cCoGrey
179 tableCursor.goRight(
1,FALSE)
182 xCursor.gotoStart(FALSE)
183 ' SetParagraphBreak (xCursor)
184 ' SetParagraphBreak (xCursor)
186 tableCursor.gotoStart(FALSE)
187 cName = tableCursor.getRangeName()
188 xCell = table.getCellByName(cName)
189 xCell.BackTransparent = False
190 xCell.BackColor = cCoGrey
193 tableCursor.goDown(
1,FALSE)
194 cName = tableCursor.getRangeName()
195 xCell = table.getCellByName(cName)
196 xCell.String=tableColums(i%)
198 xCell.BackTransparent = False
199 xCell.BackColor = cCoGrey
203 Sub CreateStatusTable2
204 dim tableHeaders(
5) as string
205 tableHeaders(cStDataBase-
9) =
"Database
"
206 tableHeaders(
1) =
""
207 tableHeaders(cStExtension-
9) =
"Extension
"
208 tableHeaders(
3) =
""
209 tableHeaders(
4) =
""
211 dim tableColums(
5) as string
212 tableColums(cDBService ) =
"services
"
213 tableColums(cDBOpen ) =
"open
"
214 tableColums(cDBInsert ) =
"insert
"
215 tableColums(cDBDelete ) =
"delete
"
216 tableColums(cDBSeek ) =
"seek
"
217 tableColums(cDBClose ) =
"close
"
219 dim tableColums2(
3) as string
220 tableColums2(cEXTService ) =
"services
"
221 tableColums2(cEXTInstall ) =
"install
"
222 tableColums2(cEXTUninstall ) =
"uninstall
"
227 xCursor = xText.createTextCursor()
229 xCursor.gotoStart(FALSE)
230 xCursor.GoRight (
4, False)
231 SetParagraphBreak (xCursor)
232 SetParagraphBreak (xCursor)
233 xCursor.gotoEnd(FALSE)
235 table = aDoc.createInstance(
"com.sun.star.text.TextTable
")
236 table.initialize(
7,
6)
237 table.Name =
"StTab2
"
238 'table.RelativeWidth =
500
240 xText.insertTextContent(xCursor, table, FALSE)
242 tableCursor = table.createCursorByCellName(table.CellNames(
0))
243 tableCursor.gotoStart(FALSE)
244 tableCursor.goRight(
1,FALSE)
247 cName = tableCursor.getRangeName()
248 xCell = table.getCellByName(cName)
249 xCell.String=tableHeaders(i%)
251 xCell.BackTransparent = False
252 xCell.BackColor = cCoGrey
254 tableCursor.goRight(
1,FALSE)
257 tableCursor.gotoStart(FALSE)
259 cName = tableCursor.getRangeName()
260 xCell = table.getCellByName(cName)
261 xCell.BackTransparent = False
262 xCell.BackColor = cCoGrey
265 tableCursor.goDown(
1,FALSE)
266 cName = tableCursor.getRangeName()
267 xCell = table.getCellByName(cName)
268 xCell.String=tableColums(i%)
270 xCell.BackTransparent = False
271 xCell.BackColor = cCoGrey
274 tableCursor.gotoStart(FALSE)
275 tableCursor.goRight(
2,FALSE)
278 tableCursor.goDown(
1,FALSE)
279 cName = tableCursor.getRangeName()
280 xCell = table.getCellByName(cName)
281 xCell.String=tableColums2(i%)
283 xCell.BackTransparent = False
284 xCell.BackColor = cCoGrey
291 table = aDoc.TextTables.GetByIndex (
1)
292 'table = aDoc.TextTables.GetByName (
"StTab1
")
296 sRangeName = GetRangeName(j%, i%+
1)
298 tableCursor = table.createCursorByCellName(sRangeName)
300 cName = tableCursor.getRangeName()
301 xCell = table.getCellByName(cName)
303 xCell.BackTransparent = False
305 if gErrorState (j%, i%) = cLogTrue then
306 xCell.BackColor = cCoGreen
307 else if gErrorState (j%, i%) = cLogFalse then
308 xCell.BackColor = cCoRed
310 xCell.BackColor = cCoGrey
318 Sub CreateSecondState
320 table = aDoc.TextTables.GetByIndex (
0)
321 'table = aDoc.TextTables.GetByName (
"StTab2
")
323 for j% =
0 to cMaxErrorStates-
9
325 sRangeName = GetRangeName(j%, i%+
1)
327 tableCursor = table.createCursorByCellName(sRangeName)
329 cName = tableCursor.getRangeName()
330 xCell = table.getCellByName(cName)
332 xCell.BackTransparent = False
334 if gErrorState (j%+
9, i%) = cLogTrue then
335 xCell.BackColor = cCoGreen
336 else if gErrorState (j%+
9, i%) = cLogFalse then
337 xCell.BackColor = cCoRed
339 xCell.BackColor = cCoGrey
347 Function GetRangeName (nColumn as integer, nRow as integer) as string
348 GetRangeName = chr (nColumn+
66) + Trim(Str(nRow+
1))
351 Sub SetStatus (nDocType as Integer, nAction as Integer, bState as Boolean)
352 Dim nStatusType as Integer
353 Dim nState as integer
354 nStatusType = GetStatusType (nDocType)
355 If nStatusType = cStNone then Exit Sub
363 gErrorState (nStatusType, nAction) = nState
366 Function GetStatusType (nDocType as Integer) as Integer
367 Select Case ( nDocType )
369 GetStatusType = cStWriter
' Textdokument
371 GetStatusType = cStCalc
'Tabellendokument
373 GetStatusType = cStMessage
'Nachricht
375 GetStatusType = cStPraesentation
'Präsentation
377 GetStatusType = cStZeichnen
'Zeichnen
379 GetStatusType = cStMath
'Formel
381 GetStatusType = cStBild
'Bild
383 GetStatusType = cStHTML
'Hypertext-Dokument
385 GetStatusType = cStChart
'Diagramm
387 GetStatusType = cStSchedule
'Diagramm
389 GetStatusType = cStJava
'Java
391 GetStatusType = cStNews
'News
393 GetStatusType = cStDataBase
'DataBase
395 GetStatusType = cStExtension
'Extension
397 GetStatusType = cStNone
401 Sub SetParagraphBreak (aCursor as Object)
402 aCursor.Text.InsertControlCharacter (aCursor, cParagraphBreak, True)
405 Sub ClearDoc (aDoc as Object)
408 for i%=
1 to aDoc.TextTables.count
409 aDoc.TextTables.GetByIndex(
0).dispose
412 aText = aDoc.Text.CreateTextCursor
413 aText.GotoStart (False)
414 aText.GoRight (
3, False)
415 SetParagraphBreak (aText)
417 aText.String=
""
420 Sub ClearDocFull (aDoc as Object)
423 for i%=
1 to aDoc.TextTables.count
424 aDoc.TextTables.GetByIndex(
0).dispose
427 aText = aDoc.Text.CreateTextCursor
428 aText.GotoStart (False)
430 aText.String=
""
433 Sub SetGlobalOptionsDialog ()
435 Dim oLibContainer As Object, oLib As Object
436 Dim oInputStreamProvider As Object
437 Dim oDialog As Object
439 Const sLibName = cTest10Modul
440 Const sDialogName = cOptionsDialogName
442 REM get library and input stream provider
443 oLibContainer = DialogLibraries
446 oLibContainer.loadLibrary( sLibName )
448 oLib = oLibContainer.getByName( sLibName )
449 oInputStreamProvider = oLib.getByName( sDialogName )
451 REM create dialog control
452 gOptionsDialog = CreateUnoDialog( oInputStreamProvider )
459 call SetGlobalOptionsDialog
463 gOptionsDialog.execute()
465 ' jetzt läuft der Dialog, bis ein Button gedrückt wird
467 Select Case (gDlgState)
472 call StartTestByOptions ()
475 gOptionsDialog.dispose()
481 SetUserFieldState (cUserFieldTestWriter, -(gOptionsDialog.getControl(
"cbWriterTest
").getState), gOutPutDoc)
482 SetUserFieldState (cUserFieldTestCalc, -(gOptionsDialog.getControl(
"cbCalcTest
").getState), gOutPutDoc)
483 SetUserFieldState (cUserFieldTestImpress, -(gOptionsDialog.getControl(
"cbImpressTest
").getState), gOutPutDoc)
484 SetUserFieldState (cUserFieldTestDraw, -(gOptionsDialog.getControl(
"cbDrawTest
").getState), gOutPutDoc)
485 SetUserFieldState (cUserFieldTestHTML, -(gOptionsDialog.getControl(
"cbHTMLTest
").getState), gOutPutDoc)
486 SetUserFieldState (cUserFieldTestMath, -(gOptionsDialog.getControl(
"cbMathTest
").getState), gOutPutDoc)
487 SetUserFieldState (cUserFieldTestChart, -(gOptionsDialog.getControl(
"cbChartTest
").getState), gOutPutDoc)
488 SetUserFieldState (cUserFieldTestJava, -(gOptionsDialog.getControl(
"cbJavaTest
").getState), gOutPutDoc)
489 SetUserFieldState (cUserFieldTestDatabase, -(gOptionsDialog.getControl(
"cbDatabaseTest
").getState), gOutPutDoc)
490 SetUserFieldState (cUserFieldTestExtension, -(gOptionsDialog.getControl(
"cbExtensionTest
").getState), gOutPutDoc)
491 SetUserFieldState (cUserFieldTestOpenSaveXML, -(gOptionsDialog.getControl(
"cbSaveOpenXMLTest
").getState), gOutPutDoc)
492 SetUserFieldState (cUserFieldTestOpenSave50, -(gOptionsDialog.getControl(
"cbSaveOpen50Test
").getState), gOutPutDoc)
493 SetUserFieldState (cUserFieldTestOpenSave8, -(gOptionsDialog.getControl(
"cbSaveOpen8Test
").getState), gOutPutDoc)
494 SetUserFieldState (cUserFieldTestCut, -(gOptionsDialog.getControl(
"cbCutTest
").getState), gOutPutDoc)
495 SetUserFieldState (cUserFieldTestPaste, -(gOptionsDialog.getControl(
"cbPasteTest
").getState), gOutPutDoc)
496 SetUserFieldState (cUserFieldTestTerminateAfterTest, -(gOptionsDialog.getControl(
"cbTerminateAfterTest
").getState), gOutPutDoc)
501 gOptionsDialog.getControl(
"cbWriterTest
").setState( -( GetUserFieldState (cUserFieldTestWriter, gOutPutDoc)))
502 gOptionsDialog.getControl(
"cbCalcTest
").setState ( -( GetUserFieldState (cUserFieldTestCalc, gOutPutDoc)))
503 gOptionsDialog.getControl(
"cbImpressTest
").setState( -( GetUserFieldState (cUserFieldTestImpress, gOutPutDoc)))
504 gOptionsDialog.getControl(
"cbDrawTest
").setState( -( GetUserFieldState (cUserFieldTestDraw, gOutPutDoc)))
505 gOptionsDialog.getControl(
"cbHTMLTest
").setState( -( GetUserFieldState (cUserFieldTestHTML, gOutPutDoc)))
506 gOptionsDialog.getControl(
"cbMathTest
").setState( -( GetUserFieldState (cUserFieldTestMath, gOutPutDoc)))
507 gOptionsDialog.getControl(
"cbChartTest
").setState( -( GetUserFieldState (cUserFieldTestChart, gOutPutDoc)))
508 gOptionsDialog.getControl(
"cbJavaTest
").setState( -( GetUserFieldState (cUserFieldTestJava, gOutPutDoc)))
509 gOptionsDialog.getControl(
"cbDatabaseTest
").setState( -( GetUserFieldState (cUserFieldTestDatabase, gOutPutDoc)))
510 gOptionsDialog.getControl(
"cbExtensionTest
").setState( -( GetUserFieldState (cUserFieldTestExtension, gOutPutDoc)))
511 gOptionsDialog.getControl(
"cbSaveOpenXMLTest
").setState( -( GetUserFieldState (cUserFieldTestOpenSaveXML, gOutPutDoc)))
512 gOptionsDialog.getControl(
"cbSaveOpen50Test
").setState( -( GetUserFieldState (cUserFieldTestOpenSave50, gOutPutDoc)))
513 gOptionsDialog.getControl(
"cbSaveOpen8Test
").setState( -( GetUserFieldState (cUserFieldTestOpenSave8, gOutPutDoc)))
514 gOptionsDialog.getControl(
"cbCutTest
").setState( -( GetUserFieldState (cUserFieldTestCut, gOutPutDoc)))
515 gOptionsDialog.getControl(
"cbPasteTest
").setState( -( GetUserFieldState (cUserFieldTestPaste, gOutPutDoc)))
516 gOptionsDialog.getControl(
"cbTerminateAfterTest
").setState( -( GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutPutDoc)))
522 bMakeWriterTest = GetUserFieldState (cUserFieldTestWriter, gOutPutDoc)
523 bMakeCalcTest = GetUserFieldState (cUserFieldTestCalc, gOutPutDoc)
524 bMakeImpressTest = GetUserFieldState (cUserFieldTestImpress, gOutPutDoc)
525 bMakeDrawTest = GetUserFieldState (cUserFieldTestDraw, gOutPutDoc)
526 bMakeHTMLTest = GetUserFieldState (cUserFieldTestHTML, gOutPutDoc)
527 bMakeMathTest = GetUserFieldState (cUserFieldTestMath, gOutPutDoc)
528 bMakeChartTest = GetUserFieldState (cUserFieldTestChart, gOutPutDoc)
529 bMakeJavaTest = GetUserFieldState (cUserFieldTestJava, gOutPutDoc)
530 bMakeDBTest = GetUserFieldState (cUserFieldTestDatabase, gOutPutDoc)
531 bMakeExtensionTest = GetUserFieldState (cUserFieldTestExtension, gOutPutDoc)
532 bMakeSaveOpenXMLTest = GetUserFieldState (cUserFieldTestOpenSaveXML, gOutPutDoc)
533 bMakeSaveOpen50Test = GetUserFieldState (cUserFieldTestOpenSave50, gOutPutDoc)
534 bMakeSaveOpen8Test = GetUserFieldState (cUserFieldTestOpenSave8, gOutPutDoc)
535 bMakeCutTest = GetUserFieldState (cUserFieldTestCut, gOutPutDoc)
536 bMakePasteTest = GetUserFieldState (cUserFieldTestPaste, gOutPutDoc)
537 bMakeTerminateAfterTest = GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutPutDoc)
540 Sub SetDefaultOptions
542 bMakeWriterTest = true
544 bMakeImpressTest = true
548 bMakeChartTest = true
551 bMakeExtensionTest = true
552 bMakeSaveOpenXMLTest = true
553 REM Disable StarOffice
5.0 tests in case binfilter has not been included
554 if Environ(
"WITH_BINFILTER
") =
"NO
" then
555 bMakeSaveOpen50Test = false
557 bMakeSaveOpen50Test = true
559 bMakeSaveOpen8Test = true
561 bMakePasteTest = true
562 bMakeTerminateAfterTest = true
565 Sub ShutdownQuickstarter
567 qs = createUnoService(
"com.sun.star.comp.desktop.QuickstartWrapper
" )
568 qs.setFastPropertyValue(
0, false )
571 Sub StartTestByOptions
572 call ShutdownQuickstarter
577 if bMakeTerminateAfterTest then
579 ClearDocFull (gOutPutDoc)
581 'StarDesktop.Terminate
583 'EnableReschedule( false )
584 'DispatchSlot(
5300 )
589 Sub StartTestWithDefaultOptions
590 call ShutdownQuickstarter
592 call SetDefaultOptions
595 if bMakeTerminateAfterTest then
598 ClearDocFull (gOutPutDoc)
600 'StarDesktop.Terminate
601 'EnableReschedule( false )
602 'DispatchSlot(
5300 )
607 Sub DispatchSlot(SlotID as Integer)
608 Dim oArg() as new com.sun.star.beans.PropertyValue
609 Dim oUrl as new com.sun.star.util.URL
613 oTrans = createUNOService(
"com.sun.star.util.URLTransformer
")
614 oUrl.Complete =
"slot:
" & CStr(SlotID)
615 oTrans.parsestrict(oUrl)
617 oDisp = StarDesktop.queryDispatch(oUrl,
"_self
",
0)
618 oDisp.dispatch(oUrl, oArg())
621 Sub LoadLibrary( LibName As String )
624 dim arg as new com.sun.star.beans.PropertyValue
625 arg.Name =
"LibraryName
"
629 dim url as new com.sun.star.util.URL
631 trans = createUnoService(
"com.sun.star.util.URLTransformer
" )
632 url.Complete =
"slot:
6517"
633 trans.parsestrict( url )
636 disp = StarDesktop.currentFrame.queryDispatch( url,
"",
0 )
637 disp.dispatch( url, args() )
641 Sub ExecuteSlot( SlotNr As String, oDoc as Object )
643 dim url as new com.sun.star.util.URL
647 trans = createUnoService(
"com.sun.star.util.URLTransformer
" )
648 url.Complete =
"slot:
" + SlotNr
649 trans.parsestrict( url )
651 disp = oDoc.CurrentController.Frame.queryDispatch( url,
"",
0 )
652 disp.dispatch( url, args() )
656 Sub CutText (oDoc as Object)
657 ExecuteSlot (
"5710", oDoc)
660 Sub PasteText (oDoc as Object)
661 ExecuteSlot (
"5712", oDoc)
664 Sub DelAllUserFields (aDoc as Object)
665 Dim aFieldType as Object
666 Dim aElements as Variant
668 Dim aFieldMasters, aFieldMaster as Object
670 aFieldMasters = aDoc.TextFieldMasters
671 aElements = aFieldMasters.ElementNames
672 for i =
0 to UBound(aElements)
673 sElement$ = aElements(i)
674 if
0 <> instr(sElement$, cUnoUserField ) then
675 aFieldMaster = aFieldMasters.GetByName(sElement$)
681 Function GetUserFieldState (sName as String, aDoc as Object) as boolean
682 Dim sFieldText as String
683 Dim bState as boolean
684 sFieldText = ReadUserField (sName, aDoc)
686 if LCase(sFieldText) = cYes then
692 GetUserFieldState = bState
695 Sub SetUserFieldState (sName as String, nState as boolean, aDoc as Object)
696 Dim sFieldText as String
698 sFieldText = cNo
'default
707 WriteUserField (sFieldText, sName, aDoc)
710 Function ReadUserField(sFieldName as String, aDoc as Object) as String
711 Dim aMasters as Object
712 aMasters = aDoc.TextFieldMasters
713 if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then
714 ReadUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName).Content
716 ReadUserField =
""
720 Sub WriteUserField(sValue as String, sFieldName as String, aDoc as Object, optional aCursor as Object)
721 Dim aMasters, aUserField, aTxtCursor as Object
722 aMasters = aDoc.TextFieldMasters
723 if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then
724 aUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName)
726 aUserField = aDoc.CreateInstance (cUnoUserField)
727 aUserField.Name = sFieldName
729 aUserField.Content = sValue
732 Sub WriteExtUserField(nIndex as Integer, aCursor as Object, aDoc as Object)
733 Dim aUserField as Object
734 aUserField = aDoc.CreateInstance (cUnoExtUserField)
735 aUserField.UserDataType = nIndex
736 aCursor.Text.InsertTextContent (aCursor, aUserField, True)
737 aUserField.Fix = True