1 'encoding UTF-8 Do not remove or change this line!
2 '*******************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: id_tools.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:43:16 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* Owner : wolfram.garten@sun.com
36 '* short description : some tools (Functions)
38 '\******************************************************************************
41 ' #1 hFindSpellHypLanguage
42 ' #1 GetDecimalSeperator
43 ' #1 LiberalMeasurement
47 ' #1 setStartCurrentPage
48 ' #1 fIsDocumentWritable
49 ' #1 fIsDocumentWritable
52 ' #1 checkexppdfwaitmax10sec
53 ' #1 fCompareTwoValues
54 ' #1 fConvertBackslashToSlash
55 ' #1 hScreenFontAntialiasing
56 ' #1 fSaveLoadAllFormats
57 ' #1 setCharacterLanguage
58 ' #1 toggleGermanSpellchecking
59 ' #1 sAnalyseContextMenu
62 ' #1 fGetIntoDictionary
68 ' #1 fGetSetPageBackground
69 ' #1 CreateTextSetEffectAndAngle
70 ' #1 fGetPresentationStyle
71 ' #1 hPrepareSearchBUG
73 ' #1 wIgnorierenlisteLoeschen
78 '\*****************************************************************
79 function hFindSpellHypLanguage (optional sBooks()) as string
80 printlog "print all available languages that have a language module"
81 dim iListLength as integer
85 printlog "only necessary for asian languages"
86 if (bAsianLan or (iSprache=55)) then
87 printlog "Tools->Options"
89 printlog "select from section 'Language Settings' the item 'Writing Aids'"
90 hToolsOptions ("LANGUAGESETTINGS","WRITINGAIDS")
91 printlog "click button 'Edit...' in section 'Available language modules'"
92 SprachmoduleBearbeiten.click
93 kontext "ModuleBearbeiten"
94 printlog "print all entries from listbox 'Language'"
95 for i = 1 to Sprache.GetItemCount
96 sTemp = Sprache.GetItemText(i)
97 if (NOT isMissing(sBooks())) then
98 listAppend(sBooks(), sTemp)
100 printlog " return the first entry in the listbox "
101 if i = 1 then hFindSpellHypLanguage = sTemp
103 printlog "close dialog 'Edit Modules'"
104 ModuleBearbeiten.Close
105 Kontext "ExtrasOptionenDlg"
106 printlog "close dialog 'Options - '"
112 '-------------------------------------------------------------------------------
113 function GetDecimalSeperator ( sDummy$ ) as String
115 printlog "Input : number with fractionmark from 'NumericField' as String "
116 printlog "+ Output: '.' or ',' as String "
117 dim i1, i2 as integer
119 printlog "get position of fraction mark / get IT"
120 i1 = instr (sDummy$, ",")
121 i2 = instr (sDummy$, ".")
122 if i1 > i2 then GetDecimalSeperator = "," else GetDecimalSeperator = "."
125 '-------------------------------------------------------------------------------
126 function LiberalMeasurement ( sShould$, sActual$) as Boolean
128 printlog " Input : (1. Should, 2. Actual) as Number with or without MeasurementUnit 'NumericField' as String "
129 printlog "+ if input has no MeasurementUnit i take it as 'cm' (was the default in old tests) "
130 printlog "+ Output: Boolean are they likely the same?"
131 printlog " NEEDED: mathematical proofment of iTolerance, by now just some guesses :-| "
132 printlog " reason for this function:"
133 printlog "+ because SO counts internaly in 'twip???s' 'twentieth of a point' there are some rounding errors "
134 printlog "+ there are also some rounding errors because of the internal representatio of floating point numbers in computers "
135 printlog "+ now lets try to get rid of them and have a nicer output in tests... "
136 printlog " measurement units are defined in http://gsl.openoffice.org/source/browse/gsl/vcl/source/src/units.src "
138 dim iTolerance as Double
140 LiberalMeasurement = False
142 if (sShould$ = sActual$) then
143 LiberalMeasurement = True
145 printlog "check if measunit is the same"
146 if (GetMeasUnit(sShould$) <> GetMeasUnit(sActual$) ) then
147 warnlog "In function LiberalMeasurement the measUnit is different, compare not possible yet"
149 printlog "set factor for liberality"
150 printlog "took units from http://gsl.openoffice.org/source/browse/gsl/vcl/source/src/units.src"
151 select case GetMeasUnit(sShould$)
152 case "mm", "ミリ", "公厘" : iTolerance = 2.0 '01, 81, 88
153 case "cm","センチ","厘米","公分" : iTolerance = 0.5 '01, 81, 86, 88
154 case chr$(34) : iTolerance = 2.5
155 case "pi","ピクセル" : iTolerance = 2.5 '01, 81
156 case "pt", "ポイント" : iTolerance = 2.5 '01, 81
157 case "" : iTolerance = 1.5 ' cm is presubposition in old functions
160 qaErrorLog "This Unit is not available in this function. '" + GetMeasUnit(sShould$) + "'"
162 printlog "have to get the measurem unit, cause the offset is different for each"
163 printlog "!!! val(str()) is important because of double calculating actions !!! #110996#"
164 if ( val(str(StrToDouble(sShould$)+iTolerance)) >= StrToDouble(sActual$) ) AND (val(str(StrToDouble ( sShould$ )-iTolerance)) <= StrToDouble ( sActual$ )) then
165 LiberalMeasurement = True
167 LiberalMeasurement = False
173 '-------------------------------------------------------------------------------
174 function GetMeasUnit ( sWert$ ) as String
176 dim iBounder as integer
177 printlog " Input : Number with or without MeasurementUnit 'NumericField' as String "
178 printlog "+ Output: Initials of MeasurementUnit as String or "" when only a number "
183 loop until ( isNumeric(mid (sWert$, len(sWert$)-iBounder, 1)) OR (len(sWert$) <= (iBounder + 1)) )
185 if (len(sWert$) <= (iBounder + 1)) then
186 if isNumeric(left (sWert$, 1)) then
187 GetMeasUnit = right (sWert$, iBounder)
192 GetMeasUnit = right (sWert$, iBounder)
196 '-------------------------------------------------------------------------------
197 function StrToDouble ( sWert$ ) as Double
200 dim i, i1, i2 as integer
206 printlog " Input : {'a[. ,]b[mm cm pi pt]' with a, b as integer} as String "
207 printlog "+ Output: a[. , ]b as double "
209 printlog "get rid of measure unit, the only single character is '' all others are two chars"
210 printlog "there was a problem, if there is NO meas.unit!!"
211 if (isNumeric (sWert$) = FALSE) then
212 if ( StrComp (right (sWert$, 1), chr$(34) ) = 0 ) then
213 sDummy$ = Left ( sWert$, Len(sWert$)-1 )
215 sDummy$ = Left ( sWert$, Len(sWert$)-2 )
220 printlog "get position of fraction mark"
221 i1 = instr (sDummy$, ",") ' wrong output
222 i2 = instr (sDummy$, ".")
223 if i1 > i2 then i = i1 else i = i2
224 printlog " in front of decimal seperator:"
226 a = val (left (sDummy$,i-1))
228 'printlog sWert$ + ":" + sDummy$ + ":" + i + ":" + i1+ ":" + i2
230 printlog "after the decimal seperator"
231 n = (len (sDummy$)-i)
232 b = val (right (sDummy$, n) )
234 'printlog "-------------- :"+sWert$ +" :'"+a+"' :"+n+" :"+b+" :'"+c+"':"
235 ' !!! val(str()) is important because of double calculating actions !!! #110996#
236 StrToDouble = val(str(a + c))
239 '-------------------------------------------------------------------------------
240 function fGetPositionX () as string
244 ContextPositionAndSize
246 warnlog "couldn't call 'ContextPositionAndSize' no object selected ?"
249 active.SetPage TabPositionAndSize
250 kontext "TabPositionAndSize"
251 if TabPositionAndSize.exists (5) then
252 fGetPositionX = PositionX.GetText
253 TabPositionAndSize.OK
255 warnlog "Couldn't switch tab page :-( "
259 '-------------------------------------------------------------------------------
260 function setStartCurrentPage(optional bState as boolean) as boolean
262 printlog " tools->options "
264 printlog "+ select in section 'Presentation' tabpage 'general' "
265 hToolsOptions ("IMPRESS","General")
266 printlog "+ check the checkbox 'Always with current page' "
267 setStartCurrentPage = MitAktuellerSeite.isChecked
269 MitAktuellerSeite.Check
271 MitAktuellerSeite.UnCheck
273 Kontext "ExtrasOptionenDlg"
274 printlog "+ close dialog 'Options - Presenation - General' with OK "
278 '-------------------------------------------------------------------------------
279 function fIsDocumentWritable() as boolean
281 printlog " check if a document is writeable"
282 printlog " <u>parameter:</u>"
283 printlog " <u>return:</u>"
284 printlog " true if the document is writeable otherwise false"
286 Kontext "Standardbar"
287 if Bearbeiten.GetState(2) <> 1 then
288 fIsDocumentWritable = false
290 fIsDocumentWritable = true
295 '-------------------------------------------------------------------------------
296 function fMakeDocumentWritable() as boolean
298 printlog " make a document is writeable"
299 printlog " <u>parameter:</u>"
300 printlog " <u>return:</u>"
301 printlog " true if the document can make writeable otherwise false"
303 Kontext "Standardbar"
305 if Bearbeiten.GetState(2) <> 1 then
308 if Active.Exists(1) then
310 fMakeDocumentWritable = true
312 warnlog "No messagebox after making document editable?"
313 fMakeDocumentWritable = false
316 printlog "Document is allready writable."
317 fMakeDocumentWritable = true
322 '-------------------------------------------------------------------------------
324 function fGetSizeXY (sX as string, sY as string, bGet as boolean) as Boolean
327 dim bReturn as boolean
331 ContextPositionAndSize
333 warnlog "couldn't call 'ContextPositionAndSize' no object selected ?"
336 active.SetPage TabPositionAndSize
337 kontext "TabPositionAndSize"
338 if TabPositionAndSize.exists (5) then
341 TabPositionAndSize.OK
343 warnlog "Couldn't switch tab page :-( "
345 if bGet then ' Get the Values only
348 else ' Get the Values and COMPARE them
349 if (LiberalMeasurement (sX,sTx) <> TRUE) then
350 warnlog "width is different :-( should: '"+sX+"' is: '"+sTx+"'" + "eventually a result of i35519"
353 if (LiberalMeasurement (sY,sTy) <> TRUE) then
354 warnlog "hight is different :-( should: '"+sY+"' is: '"+sTy+"'" + "eventually a result of i35519"
361 '-------------------------------------------------------------------------
363 function hCallExport ( HyWhatsYourName as String , sFilter as String, optional bSelection as boolean ) as Boolean
365 Printlog "Will try to select export filter: '" + sFilter + "'" + ""
370 Warnlog "It takes to much time to export the graphic (>10 sec.). Please check the problem, maybe it's a bug!"
375 Kontext "ExportierenDlg"
377 Dateityp.Select sFilter
379 Warnlog "'" + sFilter + "' is missing!"
380 dim iAll, counter as integer
381 iAll = Dateityp.GetItemCount
382 printlog " List of entries in the menu:"
383 for counter = 1 to iAll
384 printlog " " + counter + "/" + iAll + ": " + Dateityp.GetItemText(counter)
387 ExportierenDlg.Cancel
390 if ((IsMissing(bSelection) = FALSE) AND (bSelection = TRUE)) then
394 if (Selektion.isEnabled) then
399 if AutomatischeDateinamenserweiterung.Exists then
400 QAErrorLog "OBSOLETE: Automatic file extension check-box in file dialog will be removed soon!"
401 AutomatischeDateinamenserweiterung.check
404 Dateiname.SetText ( HyWhatsYourName )
408 kontext "AlienWarning"
409 if AlienWarning.exists(5) then
410 warnlog "#i41983# Alien Warning on export not allowed"
414 if Active.Exists then Active.Yes
418 '-------------------------------------------------------------------------
419 function checkexppdfwaitmax10sec
422 kontext "Standardbar"
427 if (ExportAsPDF.isEnabled = TRUE) then i = 15
428 loop while ((i < 15))
429 if (ExportAsPDF.isEnabled = FALSE) then
430 Warnlog "ExportAsPDF was NOT ok. Waited " + i + " seconds."
435 '-------------------------------------------------------------------------------
436 function fCompareTwoValues(a as string, b as string) as boolean
440 c = val(str(StrToDouble(a))) <> val(str(StrToDouble(b)))
441 c = c AND (GetMeasUnit(a) <> GetMeasUnit(b))
442 fCompareTwoValues = c
445 '-------------------------------------------------------------------------------
446 function fConvertBackslashToSlash (sInput as string) as string
456 sI = mid(sInput, i, 1)
462 fConvertBackslashToSlash = sTemp
465 '-------------------------------------------------------------------------------
466 function hScreenFontAntialiasing (bEnable as boolean) as boolean
469 hToolsOptions ("STAROFFICE", "VIEW")
470 hScreenFontAntialiasing = FontAntiAliasing.IsChecked
472 FontAntiAliasing.Check
474 FontAntiAliasing.Uncheck
476 Kontext "ExtrasOptionenDlg"
480 '-------------------------------------------------------------------------------
481 function fSaveLoadAllFormats (NewFileDir as String)
483 Dim iFileTypeCounter as Integer
484 Dim SavedFile(30) as String
485 Dim iCounter as Integer
487 printlog "Save the document in different formats..."
489 kontext "ExportierenDlg"
490 For iFileTypeCounter = 1 to Dateityp.GetItemCount
492 if iFileTypeCounter > 1 then
495 kontext "ExportierenDlg"
497 Dateiname.SetText (ConvertPath (NewFileDir) + "file" + iFileTypeCounter)
498 Dateityp.Select (iFileTypeCounter)
500 Printlog " Saving file: " + (ConvertPath (NewFileDir) + ("file" + (iFileTypeCounter) + "." + left(right(Dateityp.GetSelText,4),3)))
501 SavedFile(iFileTypeCounter) = ("file" + (iFileTypeCounter) + "." + left(right(Dateityp.GetSelText,4),3))
504 if Active.Exists(2) then Active.Yes ' File already exists, overwrite?
505 'printlog " Saved file ( SavedFile(" + iFileTypeCounter + ") ) as: '" + SavedFile(iFileTypeCounter) +"'."
506 Kontext "AlienWarning"
507 if AlienWarning.Exists(2) then AlienWarning.OK
508 kontext "DocumentImpress"
509 Next iFileTypeCounter
510 printlog "Close the file."
513 printlog "Load the different files."
515 For iCounter = 1 to (iFileTypeCounter-1)
516 Printlog " Will try to open: " + (ConvertPath (NewFileDir) + SavedFile(iCounter))
517 CALL hFileOpen(ConvertPath (NewFileDir) + SavedFile(iCounter))
519 printlog " Will try to delete: " + (ConvertPath (NewFileDir) + SavedFile(iCounter))
520 app.Kill (ConvertPath (NewFileDir) + SavedFile(iCounter))
524 '-------------------------------------------------------------------------------
525 function setCharacterLanguage(sLanguage as string) as boolean
527 setCharacterLanguage = FALSE
531 Messagebox.SetPage TabFont
534 printlog "sLanguage = " + sLanguage
535 if (bAsianLan) then 'Eastern languages 'OR
537 printlog "LanguageWest.GetSelText = " + LanguageWest.GetSelText
538 LanguageWest.select (sLanguage) 'East
540 printlog "Language.GetSelText = " + Language.GetSelText
541 Language.select (sLanguage) 'East
544 setCharacterLanguage = TRUE
545 elseif (iSprache = 07) then
546 printlog "LanguageWest.GetSelText = " + LanguageWest.GetSelText
547 LanguageWest.select (sLanguage)
550 printlog "LanguageWest.GetSelText = " + LanguageWest.GetSelText
551 LanguageWest.select (sLanguage)
553 printlog "Language.GetSelText = " + Language.GetSelText
554 Language.select (sLanguage)
556 setCharacterLanguage = TRUE
562 '-------------------------------------------------------------------------------
563 function toggleGermanSpellchecking as string
565 printlog " activate old german spellchecking "
566 printlog "+ Tools->Options "
568 printlog "+ select tabpage 'writing aids' in category 'Languagesettings' "
569 hToolsOptions("LANGUAGESETTINGS","WRITINGAIDS")
570 kontext "TabLinguistik"
571 printlog "+ hopefully it never changes for any reason between the languages!: select the 8th entry 'German spelling - old' "
572 printlog " - 'German Spelling - old' ?= " + Optionen.getItemText(8)
574 printlog "+ default is 'unselected' - i can't check it automatically - so i depend on it! "
575 printlog "+ press [space] to select it"
576 Optionen.typeKeys "<space>"
577 Kontext "ExtrasOptionenDlg"
578 printlog "+ close options with OK button "
582 '-------------------------------------------------------------------------------
583 function sAnalyseContextMenu(iItems as integer, optional iError as long) as integer
592 dim iSpecialCharacterEntry as integer
593 dim bNoContextMenu as boolean
595 dim sCandidates(5) as string
596 dim bDifferent as boolean
597 dim iInternError as long
598 dim iError1 as long ' misplaced
599 'i22192: context menu opens not on cursor position
600 dim iError2 as long ' no context menu
602 printlog "goto start of textbox "
603 call hTypeKeys "<mod1 home>"
604 printlog "for every word, check the context menu to get suggestions for correction "
605 for i = 0 to (iItems-1)
606 printlog " copy current word to clipboard "
607 call hTypeKeys "<Shift mod1 right>"
609 sCandidates(1) = getClipboardText()
610 if (" " = right(sCandidates(1),1)) then
611 sCandidates(1) = left(sCandidates(1),len(sCandidates(1))-1)
613 call hTypeKeys "<mod1 left>"
614 printlog " open context menu "
615 printlog " About to call the ContextMenu."
616 call hOpenContextMenu()
618 printlog " Just opened ContextMenu."
619 ' collecting criteria for underlining:
620 ' 1st one: is word selected? yes: underlined;
622 printlog " If the string vnd.sun.search:SubMenu (the SunSearch-menu) is found in the menu, we'll skip that word. "
625 f = MenuGetItemCommand (MenuGetItemID (1))
626 printlog "f = '" + f + "'."
627 'If it's "vnd.sun.search:SubMenu" , then skip the word. Printlog "Word not underlined, Search-Toolbar active."
628 if f <> "vnd.sun.search:SubMenu" then
631 sCandidates(2) = getClipboardText()
632 ' printlog "******************* " + getclipboardtext()
635 ' printlog "###################################################"
637 ' if (1) is different from nonempty (2) then the wrong word is selected
638 if (sCandidates(1) <> sCandidates(2)) then
639 if ("" <> sCandidates(2)) then
640 ' printlog "############ " + sCandidates(1) + " ################## " + sCandidates(2) + " #####################"
642 iError1 = iError1 + (2^i)
645 ' no word is selected... a) not underlined b) no context menu open
648 ' printlog "******************* " + sCandidates(1)
651 ' check if context menu opened
653 x = hMenuItemGetCount
654 ' successfully opened context menu
655 bNoContextMenu = false
657 ' context menu not open
658 bNoContextMenu = true
659 iError2 = iError2 + (2^i)
660 ' in writer it would work... :-( #i23568#
661 ' warnlog ""+i+" C: " + x + ";------ " + getClipboardText + " -------- "
663 ' if context menu open do....
664 if (not bNoContextMenu) then
665 ' printlog ""+i+" C: " + x + ";------ " + getClipboardText + " -------- " + hMenuItemGetText(1)
666 printlog " analyze context menu entries "
668 z = hMenuGetItemId(y)
669 if (1 = y) then iSlot = z ' criteria for WorkAround
670 if (z = 27019) then iSpecialCharacterEntry = y ' entry to select for WorkAround
671 Printlog ("---i: "+ y +"; " + z + " ; " +hMenuItemGetText(y) + " ; " + hMenuGetItemCommand(y))
673 printlog " if first slot not a spelling suggestion -> WorkAround 112919 "
674 printlog " close Context Menu "
675 if (iSlot <> 10456) then
676 if (not bDifferent) then ' WorkAround ##
677 ' qaerrorlog "" + iSlot + " UNDERLINED"
678 iTemp = iTemp + (2^i)
682 ' printlog "" + iSlot + " not underlined"
683 'InsertSpecialCharacterDraw
684 hMenuSelectNr(iSpecialCharacterEntry) ' because of bug #112919#
685 kontext "Sonderzeichen"
686 Sonderzeichen.Cancel '
690 Printlog "Word not underlined, Search-Toolbar active."
694 printlog " goto next word with keys [strg]+[right] "
695 call hTypeKeys "<mod1 right>"
697 printlog " leave textbox edit mode "
699 iInternError = iError1 OR iError2
700 if (iError1 > 0) then
701 qaErrorLog "#i22192#: context menu opens not on cursor position"
702 printlog "" + sLongToBinary(iError1, 11)
704 if (iError2 > 0) then
705 qaErrorLog "#i23568# context menu doesn't open in redlining mode before a punctuation mark"
706 printlog "" + sLongToBinary(iError2, 11)
708 if (not isMissing(iError)) then
709 iError = iInternError
711 sAnalyseContextMenu = iTemp
714 '-------------------------------------------------------------------------------
715 function sLongToBinary(iTempIn as long, iCount as integer) as string
726 iMask = iMask + (2^(i-1))
730 iTemp = Itemp AND iMask
732 if ((iTemp MOD 2) = 1) then
737 iTemp = INT (iTemp / 2)
739 sLongToBinary = sTemp
742 '-------------------------------------------------------------------------------
743 function sBinaryToLong(sTempIn as String) as long
752 for i = 1 to len(sTemp)
753 if (mid(sTemp, i, 1) = "1") then
754 iTemp = itemp + (2^(i-1))
757 sBinaryToLong = iTemp
760 '-------------------------------------------------------------------------------
761 function fGetIntoDictionary as boolean
762 dim bFound as boolean
763 dim iBooks as integer
766 iBooks = Benutzerwoerterbuch.GetItemCount
769 while (bFound AND (i < iBooks))
771 Benutzerwoerterbuch.select i
772 printlog Benutzerwoerterbuch.getSelText + i
780 fGetIntoDictionary = bFound
783 '-------------------------------------------------------------------------------
784 function hSelectInList (window, sEntry as String) as Boolean
786 printlog " alternativ method to 'hDoubleClickInList' (without mouse) "
787 printlog "+ window: name of list "
788 printlog "+ sEntry: string to find in list "
789 printlog "+ ReturnValue: if found: TRUE; else FALSE "
792 Dim sLastTemp as String
794 printlog " go through list from bottom and stop on the entry sEntry "
795 window.TypeKeys "<End>"
799 sTemp = window.GetText
800 window.TypeKeys "<Up>"
801 loop while ((sEntry <> sTemp) AND (sLastTemp <> sTemp))
802 printlog " press key [Return] "
803 if (sEntry = sTemp) then
804 window.TypeKeys "<Return>"
807 hSelectInList = FALSE
811 '-------------------------------------------------------------------------------
812 function hWalkTheStyles2 (atemp)
814 'function hWalkTheStyles2 (bSet as boolean, aSettings(), atemp as variant) as string
822 printlog " Organizer "
825 printlog aSettings(i,3)
826 printlog aSettings(i,2)
827 printlog val(aSettings(i,1))
829 Messagebox.SetPage TabArea
834 if aSettings(i,3) then
835 itemp = val(aSettings(i,1))
836 printlog isobject(atemp)
837 printlog isNumeric(atemp)
842 ' aSettings(i,1).Uncheck
846 Messagebox.SetPage TabSchatten
847 kontext "TabSchatten"
850 Messagebox.SetPage TabVerwalten
851 kontext "TabVerwalten"
855 Messagebox.SetPage TabLinie
857 'Context: *Line; Line Styles; Arrow Styles
861 Messagebox.SetPage TabArea
863 'Context: *Area; *Shadow; Transparency; Colors; Gradients; Hatching; Bitmaps
864 printlog " Shadowing "
867 Messagebox.SetPage TabSchatten
868 kontext "TabSchatten"
869 printlog " Transparency "
872 Messagebox.SetPage TabTransparenz
873 kontext "TabTransparenz"
877 Messagebox.SetPage TabFont
879 'Context: *Font; *Font Effect; Position
880 printlog " Font Effect "
883 Messagebox.SetPage TabFontEffects
884 kontext "TabFontEffects"
885 printlog " Indents & Spacing "
888 Messagebox.SetPage TabEinzuegeUndAbstaende
889 kontext "TabEinzuegeUndAbstaende"
890 'Context: *Indents & Spacing; *Alignment; *Tabs
894 Messagebox.SetPage TabText
896 'Context: *Text; *Text Animation
897 printlog " Text Animation "
900 Messagebox.SetPage TabLauftext
901 Kontext "TabLauftext"
902 printlog " Dimensioning "
905 Messagebox.SetPage TabBemassung
906 Kontext "TabBemassung"
907 printlog " Connector "
910 Messagebox.setpage TabVerbinder
911 Kontext "TabVerbinder"
912 printlog " Alignment "
915 Messagebox.setpage TabAusrichtungAbsatz
916 Kontext "TabAusrichtungAbsatz"
920 Messagebox.setpage TabTabulator
921 Kontext "TabTabulator"
923 ' printlog " switch to tabpage 'Bullets' "
924 ' Messagebox.SetPage TabBullet
925 ' Kontext "TabBullet"
927 ' Call DialogTest (TabBullet)
930 ' printlog " switch to tabpage 'Numbering Type' "
931 ' Messagebox.SetPage TabNumerierungsart
932 ' Kontext "TabNumerierungsart"
934 ' Call DialogTest (TabNumerierungsart)
937 ' printlog " switch to tabpage 'Graphics' "
938 ' Messagebox.SetPage TabGrafiken
939 ' Kontext "TabGrafiken"
941 ' Call DialogTest (TabGrafiken)
944 ' printlog " switch to tabpage 'Customize' "
945 ' Messagebox.SetPage TabOptionenNumerierung
946 ' Kontext "TabOptionenNumerierung"
948 ' Call DialogTest (TabOptionenNumerierung)
952 '-------------------------------------------------------------------------------
953 function fGetSlideNumber (optional sCompare as integer) as integer
955 printlog " PRESUPPOSITION: open Navigator "
956 printlog "+ ENTRY: with or without a string "
957 printlog "+ if string is given, it is compared with the actual selected slidename in the navigator, if not equal print warnlog "
958 printlog "+ RETURN: selected slidename in the navigator / empty string if navvigator is not open "
959 printlog "+ EXIT: kontext on DocumentPresentation "
961 Kontext "NavigatorDraw"
962 printlog "Checking if navigator is open, closing and opening for updating.."
963 if NavigatorDraw.exists (5) then
964 ViewNavigator ' to Workaround not updated navi :-(
968 printlog " check in list, if the page changed "
971 printlog "If Navigator is not open, opening it now."
975 printlog "Getting current slide number from navigator."
976 fGetSlideNumber = val (right (Liste.GetSelText, 1))
977 printlog "fGetSlideNumber has the value " & fGetSlideNumber
978 printlog "Checking if slidenumber fits to Compare number, if this is given behind procedure call."
979 if (isMissing (sCompare) = False) then ' if optional parameter exists
980 if fGetSlideNumber <> sCompare then
981 printlog "Warnlog if Slidenumber is not what it should be."
982 Warnlog "Slide Number is '" + fGetSlideNumber + "'; should: '" + sCompare + "'"
985 Kontext "DocumentPresentation"
988 '-------------------------------------------------------------------------------
989 function fGetSlideCount (optional iCount as integer) as integer
991 printlog " purpose: open navigator in impress and check/get number of slides from listbox "
992 printlog "+ input : optional number of slides, to compare to: if different warnlog "
993 printlog "+ output : number of slides in presentation "
996 printlog " open navigator "
998 if Navigator.exists then
999 Printlog "Navigator: open :-)"
1001 Printlog "Navigator: NOT available :-( will be opened now!"
1005 printlog " count rows in list of navigator: usually number of slides "
1006 Kontext "NavigatorDraw"
1007 i = Liste.GetItemCount
1008 if (isMissing(iCount) = FALSE) then
1009 if (i <> iCount) then
1010 Warnlog "Error! Expected slides: '" + iCount + "'; but are '" + i +"'"
1015 printlog " close navigator "
1020 '-------------------------------------------------------------------------------
1021 function fGetSlideName (optional sCompare as string) as string
1023 printlog " PRESUPPOSITION: open Navigator "
1024 printlog "+ ENTRY: with or without a string "
1025 printlog "+ if string is given, it is compared with the actual selected slidename in the navigator, if not equal print warnlog "
1026 printlog "+ RETURN: selected slidename in the navigator / empty string if navvigator is not open "
1027 printlog "+ EXIT: kontext on DocumentPresentation "
1029 Kontext "NavigatorDraw"
1030 if NavigatorDraw.exists (5) then
1032 printlog "check in list, if the page changed"
1033 fGetSlideName = Liste.GetSelText
1035 warnlog "Navigator not open! in function fGetSlideName TBO"
1036 Kontext "NavigatorDraw"
1039 if (isMissing (sCompare) = False) then ' if optional parameter exists
1040 printlog "fGetSlideName is: " & fGetSlideName
1041 printlog "sCompare is: " & sCompare
1042 if fGetSlideName <> sCompare then
1043 warnlog " Slide Name is '" + fGetSlideName + "'; should be: '" + sCompare + "'"
1046 Kontext "DocumentPresentation"
1049 '------------------------------------------------------------------------------
1050 function fGetSetPageBackground (iSelect as integer, iWhere as integer) as integer
1052 printlog " Get or Set the Page Background via stylist (iWhere = 0) or format menue (...= 1) "
1053 printlog "+ if iSelect > 0 then set, else get "
1054 printlog "+ return selected color number or -1 on error "
1056 if (iWhere = 0) then
1057 printlog " Stylist -> Background -> Kontext menu -> modify -> Area -> Color "
1058 fGetSetPageBackground = -1 ' worst case
1060 if Stylist.NotExists (5) then
1063 if Stylist.NotExists (5) then warnlog "Could not open stylist :-("
1065 Praesentationsvorlagen.Click
1067 Vorlagenliste.TypeKeys "<PAGEDOWN>"
1068 hDoubleClickInList (vorlagenliste, glLocale(5), TRUE)
1070 vorlagenliste.OpenContextMenu
1074 printlog " Format -> Page -> Background -> Color "'FormatPage
1076 try ' this was just paranoia to find a not mentioned messagebox
1079 warnlog "slooooow slot TBO :-("
1084 if (active.getrt = 373) then
1085 Active.SetPage TabArea
1087 warnlog active.getrt
1088 if (active.getrt = 304) then
1089 warnlog active.gettext
1091 endif ' paranoia end ----------------------------------------------
1095 if TabArea.exists then
1096 FillOptions.Select 2 ' Select "Colour"
1097 if (iSelect > 1) then ' Select the entry
1099 if (iSelect < ColourList.GetItemCount) then
1100 ColourList.Select iSelect
1102 warnlog "Select entry is larger than list :-("
1104 fGetSetPageBackground = ColourList.GetSelIndex
1105 if fGetSetPageBackground = 0 then
1106 warnlog "There were no color selected in the list."
1111 if (active.exists (2)) then
1112 warnlog "active about <changing the background for all pages ?>: '" + active.gettext + "'"
1115 printlog "No message about 'changing the background for all pages ?' :-("
1117 else ' yust read the selected entry
1118 if FillOptions.GetSelIndex = 2 then
1119 fGetSetPageBackground = ColourList.GetSelIndex
1122 warnlog "Can't get value, because something different than color is selected :-("
1127 if TabFont.exists then
1128 Warnlog "Something wrong with the word " + glLocale(5) + ". It was either not found or wrong."
1130 warnlog "Error: Can't get context menu ?"
1134 if (iWhere = 0) then
1135 sleep 1 ' ABSOLUT NECESSARY !!! (TBO) else crash on UNIX on following command!!!!
1136 FormatStylist ' closing
1141 '------------------------------------------------------------------------------
1142 function CreateTextSetEffectAndAngle
1144 kontext "DocumentImpress"
1145 SetClipBoard "Revenue"
1146 DocumentImpress.TypeKeys "<MOD1 V>"
1147 SlideShowCustomAnimation
1152 printlog " Switch to TabPage: Entrance "
1153 active.setPage(TabEntrance)
1154 kontext "TabEntrance"
1155 if TabEntrance.exists(5) then
1156 printlog " select in the listbox 'Effects' the second entry"
1158 printlog " select speed 'Fast' -> fourth item in list "
1163 EffectStart.TypeKeys "<HOME><DOWN>" 'Select the second entry.
1165 kontext "DocumentImpress"
1166 FormatPositionAndSize
1169 active.setPage(TabDrehung)
1170 kontext "TabDrehung"
1172 Winkel.TypeKeys "45"
1175 kontext "DocumentImpress"
1178 '-------------------------------------------------------------------------------
1179 function fGetPresentationStyle (optional sCompare as integer) as integer
1181 printlog "+ ENTRY: with or without a string "
1182 printlog "+ if string is given, it is compared with the LAST CHARACTER of the actual selected style in the stylist, if not equal print warnlog "
1183 printlog "+ RETURN: LAST CHARACTER of the actual selected style in the stylist "
1184 dim sTemp as integer
1185 dim sTemp0 as string
1188 printlog " open stylist if not already open: Format->Stylist "
1190 if (Stylist.exists = FALSE) then
1198 if Stylist.exists(5) then
1199 sTemp0 = Vorlagenliste.GetSeltext
1200 sTemp = val(right (sTemp0, 1))
1201 if (isMissing (sCompare) = False) then ' if optional parameter exists
1202 if sTemp <> sCompare then
1203 Warnlog "Style Name's last character is '" + sTemp + "'; should be: '" + sCompare + "'"
1208 Warnlog "The Stylist could not be opened for unknown reasons :-("
1210 fGetPresentationStyle = sTemp
1213 '-------------------------------------------------------------------------------
1214 function hPrepareSearchBUG
1216 ' warnlog "TBO: WA for bug #101974#"
1217 ' Kontext "DocumentImpressOutlineView"
1218 ' DocumentImpressOutlineView.TypeKeys ("<mod1 home>")
1221 '-------------------------------------------------------------------------------
1222 function makeNumOutOfText ( sNum as String ) as String
1224 Dim sDummy as String
1225 Dim iComma as Integer
1227 iComma = Instr ( sNum, "," )
1229 sDummy = Left ( sNum, iComma-1 ) + "." + Mid ( sNum, iComma+1, len ( sNum )-2 )
1231 sDummy = Left ( sNum, len (sNum)-2 )
1233 makeNumOutOfText = sDummy
1236 '-------------------------------------------------------------------------
1237 function wIgnorierenlisteLoeschen as boolean
1241 dim iBooks as integer
1244 Call hToolsOptions("LANGUAGESETTINGS","WRITINGAIDS")
1246 if (fGetIntoDictionary) then
1248 wIgnorierenlisteLoeschen = FALSE
1251 Kontext "BenutzerwoerterbuchBearbeiten"
1253 iBooks = Buch.GetItemCount
1256 if Left$(Buch.GetSelText,13)="IgnoreAllList" then
1258 while (Loeschen.IsEnabled)
1264 Kontext "BenutzerwoerterbuchBearbeiten"
1265 BenutzerwoerterbuchBearbeiten.Cancel
1266 Kontext "ExtrasOptionenDlg"
1267 ExtrasOptionenDlg.OK
1268 wIgnorierenlisteLoeschen = TRUE
1271 '-------------------------------------------------------------------------------
1272 function optionstest
1274 dim filedialogue as boolean
1276 dim optsound as integer
1282 dim etspeed as integer
1283 dim etrep as integer
1284 dim etshap as integer
1290 if TabEffect.Exists(5) then
1291 optsound = Sound.GetItemCount
1292 for os = 1 to optsound
1294 kontext "OeffnenDlg"
1295 if OeffnenDlg.Exists (5) then
1303 if AfterAnimation.isEnabled AND AfterAnimation.isVisible then
1304 for oa = 1 to AfterAnimation.GetItemCount
1305 AfterAnimation.Select oa
1306 if DimColor.isEnabled then
1307 for odc = 1 to DimColor.GetItemCount
1311 if DelayBetweenCharacters.isEnabled then
1312 for odc = 1 to DelayBetweenCharacters.GetItemCount
1313 DelayBetweenCharacters.Select odc
1318 if DelayBetweenCharacters.isEnabled then
1319 for odc = 1 to DelayBetweenCharacters.GetItemCount
1320 DelayBetweenCharacters.Select odc
1324 for ota = 1 to TextAnimation.GetItemCount
1325 TextAnimation.Select ota
1327 printlog " switch to TabPage 'Timing' "
1329 Active.SetPage TabTiming
1331 if TabTiming.Exists(5) then
1332 for ets = 1 to TimingStart.GetItemCount
1333 TimingStart.Select ets
1335 if Delay.isVisible AND Delay.isEnabled then
1338 Warnlog "Delay in Effect Options were not to be found."
1340 if Speed.isVisible AND Speed.isEnabled then
1341 for etspeed = 1 to Speed.GetItemCount
1342 Speed.Select etspeed
1345 printlog " No Speed-entry for this effect."
1347 if Repeat.isVisible AND Repeat.isEnabled then
1348 for etrep = 1 to Speed.GetItemCount
1352 Printlog "Repeat in Effect Options were not to be found."
1356 TriggerAnimate.IsChecked
1357 TriggerStart.IsChecked
1358 if Shape.isVisible AND Shape.isEnabled then
1359 for etshap = 1 to Shape.GetItemCount
1363 Warnlog "Shape in Effect Options were not to be found."
1366 warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: Timing TabPage didn't work."
1368 printlog " switch to TabPage 'Timing' "
1370 active.setPage TabTextAnimation
1371 kontext "TabTextAnimation"
1372 if TabTextAnimation.Exists(5) then
1373 lala = GroupText.GetItemCount
1374 for etgt = 1 to lala
1375 GroupText.Select etgt
1376 if AutomaticallyAfter.IsEnabled then
1377 AutomaticallyAfter.Check
1378 AutomaticallyAfter.TypeKeys "<UP>"
1380 if AnimateAttachedShape.IsEnabled then
1381 AnimateAttachedShape.Check
1382 if AnimateAttachedShape.IsChecked = FALSE then
1383 Warnlog "AnimateAttachedShape should have been checked"
1386 if InreverseOrder.IsEnabled then
1387 InreverseOrder.Check
1388 if InreverseOrder.IsChecked = FALSE then
1389 Warnlog "InreverseOrder should have been checked"
1393 TabTextAnimation.Cancel
1395 warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: TextAnimation TabPage didn't work."
1398 warnlog "Impress:Tasks Pane:Custom Animation:... button didn't work."
1404 '-------------------------------------------------------------------------------
1405 function optionstest2
1407 dim filedialogue as boolean
1409 dim optsound as integer
1415 dim etspeed as integer
1416 dim etrep as integer
1417 dim etshap as integer
1423 if TabEffect.Exists(5) then
1426 if Play.IsEnabled then
1429 warnlog "Play should have been enabled after selecting a sound."
1431 AfterAnimation.Select 2
1432 if DimColor.isEnabled then
1435 Warnlog "DimColor should have been enabled"
1437 TextAnimation.Select 3
1438 if DelayBetweenCharacters.isEnabled then
1439 DelayBetweenCharacters.More 5
1441 Warnlog "DelayBetweenCharacters should have been enabled"
1443 printlog " switch to TabPage 'Timing' "
1445 Active.SetPage TabTiming
1447 if TabTiming.Exists(5) then
1448 TimingStart.Select 2
1449 if Delay.isVisible AND Delay.isEnabled then
1452 Warnlog "Delay in Effect Options were not to be found."
1454 if Speed.isVisible AND Speed.isEnabled then
1457 Printlog "Speed in Effect Options were not to be found."
1459 if Repeat.isVisible then
1460 if Repeat.isEnabled then
1461 for etrep = 1 to Speed.GetItemCount
1465 Warnlog "Repeat in Effect Options were not enabled."
1468 Warnlog "Repeat in Effect Options were not visible."
1470 if Rewind.isVisible then
1471 if Rewind.isEnabled then
1474 Printlog "Rewind in Effect Options were not to be found."
1477 Printlog "Rewind in Effect Options were not to be found."
1479 if Rewind.isVisible then
1480 if Rewind.isEnabled then
1484 Warnlog "Rewind in Effect Options were not enabled."
1487 Warnlog "Rewind in Effect Options were not visible."
1489 TriggerAnimate.IsChecked
1490 TriggerStart.IsChecked
1491 if Shape.isVisible then
1492 if Shape.isEnabled then
1493 for etshap = 1 to Shape.GetItemCount
1497 Warnlog "Shape in Effect Options were not to be found."
1500 Warnlog "Shape in Effect Options were not to be found."
1503 warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: Timing TabPage didn't work."
1505 printlog " switch to TabPage 'Timing' "
1507 active.setPage TabTextAnimation
1508 kontext "TabTextAnimation"
1509 if TabTextAnimation.Exists(5) then
1510 lala = GroupText.GetItemCount
1511 for etgt = 1 to lala
1512 GroupText.Select etgt
1513 if AutomaticallyAfter.IsEnabled then
1514 AutomaticallyAfter.Check
1515 AutomaticallyAfter.TypeKeys "<UP>"
1517 if AnimateAttachedShape.IsEnabled then
1518 AnimateAttachedShape.Check
1519 if AnimateAttachedShape.IsChecked = FALSE then
1520 Warnlog "AnimateAttachedShape should have been checked"
1523 if InreverseOrder.IsEnabled then
1524 InreverseOrder.Check
1525 if InreverseOrder.IsChecked = FALSE then
1526 Warnlog "InreverseOrder should have been checked"
1530 TabTextAnimation.Cancel
1532 warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: TextAnimation TabPage didn't work."
1535 warnlog "Impress:Tasks Pane:Custom Animation:... button didn't work."
1540 '-------------------------------------------------------------------------------