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: extras_preview.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:14 $
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 : joerg.skottke@sun.com
36 '* short description : Perform standard operations on all samples/templates etc.
38 '\***********************************************************************
40 private const MAX_FILE_COUNT = 3000 ' the max number of templates or samples
42 ' NOTE: Usually we have only about a 100 templates but in multi-language
43 ' installations there are more than 2100. You should not run these
44 ' tests on multi language installations. Really.
46 testcase tShowAllObjectsAsPreview( cCategory as string )
48 '///<h1>Show documents in the preview pane of the teplates-dialog</h1>
50 dim iObjectFolder as Integer ' the current folder in loops
51 dim iObjectFolders as integer ' the number of template/sample-folders
53 dim iObject as Integer ' the current template/sample within loops
54 dim iObjectCount( 20 ) as integer ' number of templates/samples in the folders
61 '///+<li>Open File->New->Templates and documents</li>
63 if ( TemplateAndDocuments.exists( 1 ) ) then
66 '///+<li>find the category we want to work with (TEMPLATES/SAMPLES...)</li>
67 hSelectCategory( cCategory )
69 '///+<li>Count the folders in the root of cCategory</li>
70 iObjectFolders = FileList.getItemCount()
72 '///+</li>Now go through every folder and count the number of objects</li>
73 for iObject = 1 to iObjectFolders
75 '//<li>grab a folder below cCategory and open it</li>
76 hSelectFileFolder( iObject , true )
78 '<li>get the number of items</li>
79 iObjectCount( iObject ) = FileList.getItemCount()
81 '<li>step up one level to the root of cCategory</li>
86 '///+<li>Click the preview button</li>
90 printlog( "Displaying documents in preview pane" )
93 '///+<li>Step through all folders and templates/samples</li>
95 for iObjectFolder = 1 to iObjectFolders
97 kontext "TemplateAndDocuments"
99 '///+<li>Select the category (samples, templates ...)</li>
100 hSelectCategory( cCategory )
102 '///+<li>Select the current folder</li>
103 hSelectFileFolder( iObjectFolder , false )
105 for iObject = 1 to iObjectCount( iObjectFolder )
107 printlog( "Object-Folder: " & iObjectFolder & " Entry: " & iObject )
109 '///+<li>Select the desired template</li>
110 hSelectDocumentObject( iObject , 0 )
112 '///+<li>Wait for the preview to be loaded and displayed</li>
113 'Problem: Cannot verify the content of preview window.
116 '///+<li>Next document</li>
125 Kontext "TemplateAndDocuments"
126 TemplateAndDocuments.cancel()
129 warnlog( "Failed to open Templates And Documents dialog" )