1 '**************************************************************************
2 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* Copyright 2008 by Sun Microsystems, Inc.
6 '* OpenOffice.org - a multi-platform office productivity suite
8 '* $RCSfile: w_tool4.inc,v $
12 '* last change: $Author: vg $ $Date: 2008-08-18 12:43:40 $
14 '* This file is part of OpenOffice.org.
16 '* OpenOffice.org is free software: you can redistribute it and/or modify
17 '* it under the terms of the GNU Lesser General Public License version 3
18 '* only, as published by the Free Software Foundation.
20 '* OpenOffice.org is distributed in the hope that it will be useful,
21 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
22 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 '* GNU Lesser General Public License version 3 for more details
24 '* (a copy is included in the LICENSE file that accompanied this code).
26 '* You should have received a copy of the GNU Lesser General Public License
27 '* version 3 along with OpenOffice.org. If not, see
28 '* <http://www.openoffice.org/license.html>
29 '* for a copy of the LGPLv3 License.
31 '/************************************************************************
33 '* owner : helge.delfs@sun.com **
35 '* short description : Misc tools for writer tests **
37 '*******************************************************************
39 ' #1 CountItemsInNavigatorGroup(Group as integer) as Integer
42 ' #1 wGetSpellcheckDocumentName
43 ' #1 wToolsSpellcheckCheckWriter
44 ' #1 wEnableAutoSpellcheck
45 ' #1 wEnableHyphenation
47 '\******************************************************************
49 function CountItemsInNavigatorGroup(Group as integer) as Integer
50 Dim j as integer,SelectInNavigator as integer
51 'First, select the Navigator depending on the application
53 If Not Navigator.Exists then ViewNavigator
54 Kontext "NavigatorWriter"
56 'In Navigator, close all groups and set focus to first group
58 if Auswahlliste.GetItemCount<12 then Inhaltsansicht.Click
60 'Close all groups in Navigator
61 if Auswahlliste.GetItemCount >12 then
64 Auswahlliste.TypeKeys "-"
69 'Select group given by the function
70 Auswahlliste.Select Group
72 Auswahlliste.TypeKeys "+"
74 CountItemsInNavigatorGroup = Auswahlliste.GetItemCount - 1
79 '*******************************************************************
81 function wCheckOutline(WhatToFind as string) as boolean
82 '/// This function checks the Outline in level 1 test.
83 '/// Purpose is to have a little tolerance, because when resolution changes, the
84 '/// line breaks are different
86 Kontext "DocumentImpressOutlineView"
87 DocumentImpressOutlineView.TypeKeys "<Home><Down>" ,1
88 DocumentImpressOutlineView.TypeKeys "<Home><Shift End>"
90 if GetClipboardText <> WhatToFind then
91 DocumentImpressOutlineView.TypeKeys "<Home><Up>" ,2
92 DocumentImpressOutlineView.TypeKeys "<Home><Shift End>"
94 if GetClipboardText = WhatToFind then
102 '*******************************************************************
104 function wSetZoom ( )
105 '/// This function sets the zoom size to 100% in a text document
109 Vergroesserung100.Check
116 '*******************************************************************
118 function wGetSpellcheckDocumentName(xCategory as integer) as string
119 Dim sTemp as string, sReturn as string
120 '/// This function is to return the document to load in spellcheck test
121 select case xCategory
127 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\spellcheck\st1_2_01.odt")
129 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\spellcheck\st1_2_03.odt")
131 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\spellcheck\st1_2_07.odt")
133 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\spellcheck\st1_2_" & iSprache & ".odt")
141 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\linguistik\001.odt")
143 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\linguistik\003.odt")
145 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\linguistik\007.odt")
147 sTemp = Convertpath(gTesttoolpath + "writer\optional\input\linguistik\0" & iSprache & ".odt")
151 if sReturn <> "None" then
152 if hFileExists(sTemp) then
159 wGetSpellcheckDocumentName = sReturn
163 '*******************************************************************
165 sub wToolsSpellcheckCheckWriter
166 '/// This function opens the spellcheck-dialog in all applications
167 Select Case Ucase(gApplication)
168 Case "WRITER" : ToolsSpellcheckWriter
169 Case "MASTERDOCUMENT" : ToolsSpellcheckWriter
170 Case "HTML" : ToolsSpellcheckWriter
171 case "DRAW" : ToolsSpellcheck
172 case "IMPRESS" : ToolsSpellcheck
176 '*******************************************************************
178 sub wEnableAutoSpellcheck(sEnable as boolean)
179 '/// This function checks option 'AutoCheck' in Options
180 '/// requires a bool to indicate state
181 '/// from 680m61 on it is checked by default
183 Kontext "ExtrasOptionenDLG"
184 Call hToolsOptions("LanguageSettings","WritingAids")
192 Kontext "ExtrasOptionenDLG"
197 '*******************************************************************
199 sub wEnableHyphenation(sEnable as boolean)
200 '/// This function enables/disables hyphenation
201 '/// through Format / Paragraph / Textflow
205 Active.SetPage TabTextfluss
206 kontext "TabTextfluss"