1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir package convwatch; 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 31*cdf0e10cSrcweir import lib.TestParameters; 32*cdf0e10cSrcweir import java.io.File; 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir import com.sun.star.container.XNameAccess; 35*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir /** 38*cdf0e10cSrcweir * This class object is more a Helper or Controller. 39*cdf0e10cSrcweir * It stores information like: 40*cdf0e10cSrcweir * - How to create a document (with a OpenOffice.org method, or with MS Word, or with OpenOffice.org as pdf) 41*cdf0e10cSrcweir * - some more infos for OpenOffice.org method 42*cdf0e10cSrcweir * - a service factory pointer 43*cdf0e10cSrcweir * - if hidden mode should use 44*cdf0e10cSrcweir * - target name 45*cdf0e10cSrcweir * 46*cdf0e10cSrcweir * - printer name 47*cdf0e10cSrcweir * 48*cdf0e10cSrcweir * - how to handle .xml files, which in Microsoft could be Excel or Word documents 49*cdf0e10cSrcweir * 50*cdf0e10cSrcweir * HOWTO USE: 51*cdf0e10cSrcweir * For OOo, 52*cdf0e10cSrcweir * create an GraphicalTestArguments with a set of TestParameters 53*cdf0e10cSrcweir * GraphicalTestArguments a = new GraphicalTestArguments(params); 54*cdf0e10cSrcweir * 55*cdf0e10cSrcweir * If you wish to use pdf export instead of normal printer output, set also the reference type to 'pdf' 56*cdf0e10cSrcweir * a.setReferenceType("pdf"); 57*cdf0e10cSrcweir * 58*cdf0e10cSrcweir * 59*cdf0e10cSrcweir * For MS Office: 60*cdf0e10cSrcweir * create an GraphicalTestArguments and set the reference type to 'msoffice' 61*cdf0e10cSrcweir * GraphicalTestArguments a = new GraphicalTestArguments(params); 62*cdf0e10cSrcweir * a.setReferenceType("msoffice"); 63*cdf0e10cSrcweir * 64*cdf0e10cSrcweir * within windows it's better to set also a printer name so it's simply possible to use for normal work the default printer 65*cdf0e10cSrcweir * and for such tests with ConvWatch a extra printer. 66*cdf0e10cSrcweir * a.setPrinterName("CrossOffice Printer"); 67*cdf0e10cSrcweir * 68*cdf0e10cSrcweir */ 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir public class GraphicalTestArguments 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir /** 73*cdf0e10cSrcweir 2DO: 74*cdf0e10cSrcweir Possible reference types are currently 75*cdf0e10cSrcweir // ooo 76*cdf0e10cSrcweir // pdf 77*cdf0e10cSrcweir // msoffice 78*cdf0e10cSrcweir */ 79*cdf0e10cSrcweir String m_sReferenceType = "OOo"; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir String m_sTargetFrameName = "_blank"; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir String m_sPrinterName = null; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir // Hidden = true hiddes a used OpenOffice.org, all code is executed in the background 86*cdf0e10cSrcweir // This parameter is not used for RefType: msoffice 87*cdf0e10cSrcweir boolean m_bHidden = true; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir String m_sDefaultXMLFormatApplication = null; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir boolean m_bIncludeSubdirectories; 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir TestParameters m_aCurrentParams; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir int m_nMaxPages = 0; // default is 0 (print all pages) 96*cdf0e10cSrcweir String m_sOnlyPage = ""; // default is "", there is no page which we want to print only. 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir int m_nResolutionInDPI = 0; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir boolean m_bStoreFile = true; 101*cdf0e10cSrcweir boolean m_bResuseOffice = false; 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir boolean m_bDebugMode = false; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir String m_sLeaveOutNames = null; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir String m_sDistinct = null; 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir boolean m_bCreateDefaultReference = false; 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // CONSTRUCTOR 112*cdf0e10cSrcweir private GraphicalTestArguments(){} 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir public GraphicalTestArguments(TestParameters param) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir m_aCurrentParams = param; 117*cdf0e10cSrcweir // collect interesting information from the ComplexTestCase 118*cdf0e10cSrcweir // .... 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // REFERENCE_TYPE ---------- 121*cdf0e10cSrcweir String sReferenceType = (String)param.get( PropertyName.DOC_COMPARATOR_REFERENCE_TYPE ); 122*cdf0e10cSrcweir if (sReferenceType == null || sReferenceType.length() == 0) 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir else 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir // log.println("found REFERENCE_TYPE " + sReferenceType ); 128*cdf0e10cSrcweir setReferenceType(sReferenceType); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir // PRINTER_NAME ---------- 132*cdf0e10cSrcweir String sPrinterName = (String)param.get( PropertyName.DOC_COMPARATOR_PRINTER_NAME ); 133*cdf0e10cSrcweir if (sPrinterName == null || sPrinterName.length() == 0) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir else 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir // log.println("found PRINTER_NAME " + sPrinterName ); 139*cdf0e10cSrcweir setPrinterName(sPrinterName); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir // DEFAULT_XML_FORMAT_APP ------ 142*cdf0e10cSrcweir String sDefaultXMLFormatApp = (String)param.get( PropertyName.DOC_COMPARATOR_DEFAULT_XML_FORMAT_APP ); 143*cdf0e10cSrcweir if (sDefaultXMLFormatApp == null || sDefaultXMLFormatApp.length() == 0) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir else 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir setDefaultXMLFormatApp(sDefaultXMLFormatApp); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir m_bIncludeSubdirectories = true; 152*cdf0e10cSrcweir String sRECURSIVE = (String)param.get( PropertyName.DOC_COMPARATOR_INCLUDE_SUBDIRS ); 153*cdf0e10cSrcweir // TODO: I need to get the boolean value with get("name") because, if it is not given getBool() returns 154*cdf0e10cSrcweir // with a default of 'false' which is not very helpful if the default should be 'true' 155*cdf0e10cSrcweir // maybe a getBoolean("name", true) could be a better choise. 156*cdf0e10cSrcweir if (sRECURSIVE == null) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir sRECURSIVE = "true"; 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir if (sRECURSIVE.toLowerCase().equals("no") || 161*cdf0e10cSrcweir sRECURSIVE.toLowerCase().equals("false")) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir m_bIncludeSubdirectories = false; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // ---------------------------------------- 167*cdf0e10cSrcweir m_nMaxPages = param.getInt( PropertyName.DOC_COMPARATOR_PRINT_MAX_PAGE ); 168*cdf0e10cSrcweir m_sOnlyPage = (String)param.get(PropertyName.DOC_COMPARATOR_PRINT_ONLY_PAGE); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir m_nResolutionInDPI = param.getInt( PropertyName.DOC_COMPARATOR_GFX_OUTPUT_DPI_RESOLUTION ); 171*cdf0e10cSrcweir if (m_nResolutionInDPI == 0) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir // 212 DPI is 1754 x 2474 pixel for DIN A4 174*cdf0e10cSrcweir m_nResolutionInDPI = 212; 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir // ---------------------------------------- 178*cdf0e10cSrcweir String sImportFilterName = (String)param.get(PropertyName.DOC_CONVERTER_IMPORT_FILTER_NAME); 179*cdf0e10cSrcweir if (sImportFilterName != null && sImportFilterName.length() > 0) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir // System.out.println("found " + PropertyName.DOC_CONVERTER_IMPORT_FILTER_NAME + " " + sImportFilterName ); 182*cdf0e10cSrcweir m_sImportFilterName = sImportFilterName; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir if (sImportFilterName.toLowerCase().equals("help")) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir showInternalFilterName(sImportFilterName, getMultiServiceFactory() ); 187*cdf0e10cSrcweir GlobalLogWriter.get().println("Must quit."); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir // ---------------------------------------- 191*cdf0e10cSrcweir String sExportFilterName = (String)param.get(PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME); 192*cdf0e10cSrcweir if (sExportFilterName != null && sExportFilterName.length() > 0) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir // System.out.println("found " + PropertyName.DOC_CONVERTER_EXPORT_FILTER_NAME + " " + sExportFilterName ); 195*cdf0e10cSrcweir m_sExportFilterName = sExportFilterName; 196*cdf0e10cSrcweir if (sExportFilterName.toLowerCase().equals("help")) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir showInternalFilterName(sExportFilterName, getMultiServiceFactory() ); 199*cdf0e10cSrcweir GlobalLogWriter.get().println("Must quit."); 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir // ---------------------------------------- 204*cdf0e10cSrcweir String sOfficeProgram = (String)param.get(PropertyName.DOC_CONVERTER_OFFICE_PROGRAM); 205*cdf0e10cSrcweir if (sOfficeProgram != null && sOfficeProgram.length() > 0) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir m_sOfficeProgram = sOfficeProgram; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir // ---------------------------------------- 210*cdf0e10cSrcweir String sREUSE_OFFICE = (String)param.get( PropertyName.DOC_CONVERTER_REUSE_OFFICE); 211*cdf0e10cSrcweir if (sREUSE_OFFICE == null) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir sREUSE_OFFICE = "false"; 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir if (sREUSE_OFFICE.toLowerCase().equals("yes") || 216*cdf0e10cSrcweir sREUSE_OFFICE.toLowerCase().equals("true")) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir m_bResuseOffice = true; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir else 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir m_bResuseOffice = false; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir String sHTMLOutputPrefix = (String)param.get( PropertyName.DOC_COMPARATOR_HTML_OUTPUT_PREFIX); 227*cdf0e10cSrcweir if (sHTMLOutputPrefix == null) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir m_sHTMLOutputPrefix = ""; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir else 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir m_sHTMLOutputPrefix = sHTMLOutputPrefix; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir String sWithBorderMove = (String)param.get( PropertyName.DOC_COMPARATOR_GFXCMP_WITH_BORDERMOVE); 237*cdf0e10cSrcweir if (sWithBorderMove == null) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir sWithBorderMove = ""; 240*cdf0e10cSrcweir // m_tWithBorderMove = TriState.UNSET; 241*cdf0e10cSrcweir m_tWithBorderMove = TriState.FALSE; 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir if (sWithBorderMove.toLowerCase().equals("yes") || 244*cdf0e10cSrcweir sWithBorderMove.toLowerCase().equals("true")) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir m_tWithBorderMove = TriState.TRUE; 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir else if (sWithBorderMove.toLowerCase().equals("no") || 249*cdf0e10cSrcweir sWithBorderMove.toLowerCase().equals("false")) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir m_tWithBorderMove = TriState.FALSE; 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir else 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir m_tWithBorderMove = TriState.FALSE; 256*cdf0e10cSrcweir // m_tWithBorderMove = TriState.UNSET; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir String sLeaveOutNames = (String)param.get(PropertyName.DOC_COMPARATOR_LEAVE_OUT_FILES); 260*cdf0e10cSrcweir if (sLeaveOutNames != null) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir m_sLeaveOutNames = sLeaveOutNames; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir String sDBInfoString = (String)param.get(PropertyName.DOC_COMPARATOR_DB_INFO_STRING); 266*cdf0e10cSrcweir if (sDBInfoString != null) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir m_sDBInfoString = sDBInfoString; 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir // DISTINCT ---------- 272*cdf0e10cSrcweir String sDistinct = (String)param.get( "DISTINCT" ); 273*cdf0e10cSrcweir if (sDistinct == null || sDistinct.length() == 0) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir sDistinct = ""; 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir else 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir m_sDistinct = sDistinct; 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir // HIDDEN 282*cdf0e10cSrcweir String sOfficeViewable = (String)param.get(PropertyName.OFFICE_VIEWABLE); 283*cdf0e10cSrcweir if (sOfficeViewable != null) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir if (sOfficeViewable.toLowerCase().equals("yes") || 286*cdf0e10cSrcweir sOfficeViewable.toLowerCase().equals("true")) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir setViewable(); 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir else 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir setHidden(); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir // CREATE_DEFAULT 296*cdf0e10cSrcweir String sCreateDefault = (String)param.get(PropertyName.CREATE_DEFAULT); 297*cdf0e10cSrcweir if (sCreateDefault != null) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir if (sCreateDefault.toLowerCase().equals("yes") || 300*cdf0e10cSrcweir sCreateDefault.toLowerCase().equals("true")) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir m_bCreateDefaultReference = true; 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir else 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir m_bCreateDefaultReference = false; 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir public boolean checkIfUsableDocumentType(String _sName) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir // @todo 315*cdf0e10cSrcweir // check if the name is in the leave out list and then return 'false' 316*cdf0e10cSrcweir if (_sName.toLowerCase().endsWith(".jpg") || 317*cdf0e10cSrcweir _sName.toLowerCase().endsWith(".png") || 318*cdf0e10cSrcweir _sName.toLowerCase().endsWith(".gif") || 319*cdf0e10cSrcweir _sName.toLowerCase().endsWith(".bmp") || 320*cdf0e10cSrcweir _sName.toLowerCase().endsWith(".prn") || 321*cdf0e10cSrcweir _sName.toLowerCase().endsWith(".ps")) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir return false; 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir return true; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir static void showInternalFilterName(String _sFilterName, XMultiServiceFactory _xMSF) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir if (_sFilterName.length() == 0) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir // System.out.println("No FilterName set."); 334*cdf0e10cSrcweir return; 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir if (_xMSF == null) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir GlobalLogWriter.get().println("MultiServiceFactory not set."); 340*cdf0e10cSrcweir return; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir // XFilterFactory aFilterFactory = null; 343*cdf0e10cSrcweir Object aObj = null; 344*cdf0e10cSrcweir try 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir aObj = _xMSF.createInstance("com.sun.star.document.FilterFactory"); 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir catch(com.sun.star.uno.Exception e) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir GlobalLogWriter.get().println("Can't get com.sun.star.document.FilterFactory."); 351*cdf0e10cSrcweir return; 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir if (aObj != null) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj); 356*cdf0e10cSrcweir if (aNameAccess != null) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir if (_sFilterName.toLowerCase().equals("help")) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir GlobalLogWriter.get().println("Show all possible ElementNames from current version." ); 362*cdf0e10cSrcweir String[] aElementNames = aNameAccess.getElementNames(); 363*cdf0e10cSrcweir for (int i = 0; i<aElementNames.length; i++) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir GlobalLogWriter.get().println(aElementNames[i]); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir /* 373*cdf0e10cSrcweir public GraphicalTestArguments(TestParameters param, Log xxx) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir // collect interesting information from the ComplexTestCase 376*cdf0e10cSrcweir // .... 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir */ 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // set methods 381*cdf0e10cSrcweir public void setReferenceType(String _sType) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir // special casse, null is not allowed, set to default. 384*cdf0e10cSrcweir if (_sType == null) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir m_sReferenceType = "OOo"; 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir else 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir m_sReferenceType = _sType; 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir public void setTargetFrameName(String _sTargetFrameName) {m_sTargetFrameName = _sTargetFrameName;} 394*cdf0e10cSrcweir public void setPrinterName(String _sName) {m_sPrinterName = _sName;} 395*cdf0e10cSrcweir public void setHidden() { m_bHidden = true;} 396*cdf0e10cSrcweir public void setViewable() {m_bHidden = false;} 397*cdf0e10cSrcweir public void setDefaultXMLFormatApp(String _sNameOfApp) {m_sDefaultXMLFormatApplication = _sNameOfApp;} 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir // get methods 400*cdf0e10cSrcweir public XMultiServiceFactory getMultiServiceFactory() 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir XMultiServiceFactory xMSF = (XMultiServiceFactory)m_aCurrentParams.getMSF(); 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir // check if MultiServiceFactory is given 405*cdf0e10cSrcweir if (getReferenceType().toLowerCase().equals("pdf") || 406*cdf0e10cSrcweir getReferenceType().toLowerCase().equals("ooo")) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir if (xMSF == null) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir GlobalLogWriter.get().println("ERROR! MultiServiceFactory not given."); 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir return xMSF; 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir public String getReferenceType() {return m_sReferenceType;} 417*cdf0e10cSrcweir public String getTargetFrameName() {return m_sTargetFrameName;} 418*cdf0e10cSrcweir public String getPrinterName() {return m_sPrinterName;} 419*cdf0e10cSrcweir public boolean isHidden() {return m_bHidden;} 420*cdf0e10cSrcweir public String getDefaultXMLFormatApp() {return m_sDefaultXMLFormatApplication;} 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir /** 424*cdf0e10cSrcweir * @return true, if subdirectories should run through 425*cdf0e10cSrcweir */ 426*cdf0e10cSrcweir public boolean includeSubDirectories() {return m_bIncludeSubdirectories;} 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir /** 429*cdf0e10cSrcweir * @return the number of pages to be print 430*cdf0e10cSrcweir */ 431*cdf0e10cSrcweir public int getMaxPages() {return m_nMaxPages;} 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir /** 434*cdf0e10cSrcweir * @return as string, which pages should be print, e.g. '1-4;6' here, page 1 to 4 and page 6. 435*cdf0e10cSrcweir */ 436*cdf0e10cSrcweir public String getOnlyPages() 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir if (m_sOnlyPage == null) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir return ""; 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir return m_sOnlyPage; 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir /** 446*cdf0e10cSrcweir * @return true, if there should not print all pages at all, use getMaxPages() and or getOnlyPages() to get which pages to print 447*cdf0e10cSrcweir */ 448*cdf0e10cSrcweir public boolean printAllPages() 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir if ( (getMaxPages() > 0) || 451*cdf0e10cSrcweir (getOnlyPages().length() != 0)) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir return false; 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir return true; 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir /** 459*cdf0e10cSrcweir * @return integer value, which contain resolution in DPI. 460*cdf0e10cSrcweir */ 461*cdf0e10cSrcweir public int getResolutionInDPI() {return m_nResolutionInDPI;} 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir public static void checkIfMSWindowsConformPath(String _sPath) 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir if (_sPath != null && _sPath.length() > 1) 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir if (_sPath.charAt(1) == ':') 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir if (_sPath.charAt(2) != '\\') 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir GlobalLogWriter.get().println("This is not a Microsoft Windows conform path: '" + _sPath + "' please fix."); 472*cdf0e10cSrcweir System.exit(1); 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir /** 480*cdf0e10cSrcweir * @return the INPUT_PATH out of the TestParameters 481*cdf0e10cSrcweir */ 482*cdf0e10cSrcweir public String getInputPath() 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir String sInputPath; 485*cdf0e10cSrcweir sInputPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_INPUT_PATH); 486*cdf0e10cSrcweir checkIfMSWindowsConformPath(sInputPath); 487*cdf0e10cSrcweir return sInputPath; 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir /** 490*cdf0e10cSrcweir * @return the OUTPUT_PATH out of the TestParameters 491*cdf0e10cSrcweir */ 492*cdf0e10cSrcweir public String getOutputPath() 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir String sOutputPath; 495*cdf0e10cSrcweir sOutputPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_OUTPUT_PATH); 496*cdf0e10cSrcweir checkIfMSWindowsConformPath(sOutputPath); 497*cdf0e10cSrcweir return sOutputPath; 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir /** 500*cdf0e10cSrcweir * @return the REFERENCE_PATH out of the TestParameters 501*cdf0e10cSrcweir */ 502*cdf0e10cSrcweir public String getReferencePath() 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir String sReferencePath; 505*cdf0e10cSrcweir sReferencePath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_REFERENCE_PATH); 506*cdf0e10cSrcweir checkIfMSWindowsConformPath(sReferencePath); 507*cdf0e10cSrcweir return sReferencePath; 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir /** 510*cdf0e10cSrcweir * @return the DIFF_PATH out of the TestParameters 511*cdf0e10cSrcweir */ 512*cdf0e10cSrcweir public String getDiffPath() 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir String sDiffPath; 515*cdf0e10cSrcweir sDiffPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_DIFF_PATH); 516*cdf0e10cSrcweir checkIfMSWindowsConformPath(sDiffPath); 517*cdf0e10cSrcweir return sDiffPath; 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir public boolean getOverwrite() 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir boolean bOverwrite = m_aCurrentParams.getBool( PropertyName.DOC_COMPARATOR_OVERWRITE_REFERENCE); 523*cdf0e10cSrcweir return bOverwrite; 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir public String getReferenceInputPath() 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir String sReferenceInputPath; 528*cdf0e10cSrcweir sReferenceInputPath = (String)m_aCurrentParams.get(PropertyName.DOC_COMPARATOR_REFERENCE_INPUT_PATH); 529*cdf0e10cSrcweir return sReferenceInputPath; 530*cdf0e10cSrcweir } 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir /** 533*cdf0e10cSrcweir * Helper function to get the buildid of the current used OpenOffice.org 534*cdf0e10cSrcweir * out of the AppExecutionCommand the build ID 535*cdf0e10cSrcweir */ 536*cdf0e10cSrcweir public String getBuildID() 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir String sAPP = (String)m_aCurrentParams.get(util.PropertyName.APP_EXECUTION_COMMAND); 539*cdf0e10cSrcweir // return getBuildID(sAPP); 540*cdf0e10cSrcweir // TODO: here we need the getBuildID(string) method 541*cdf0e10cSrcweir String sBuildID = convwatch.BuildID.getBuildID(sAPP); 542*cdf0e10cSrcweir return sBuildID; 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir public boolean shouldOfficeStart() 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir String sNoOffice = (String)m_aCurrentParams.get( "NoOffice" ); 548*cdf0e10cSrcweir if (sNoOffice != null) 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir if (sNoOffice.toLowerCase().startsWith("t") || sNoOffice.toLowerCase().startsWith("y")) 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir return false; 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir return true; 556*cdf0e10cSrcweir } 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir // Handle for Reference Build ID, is set in ConvWatch.createPostscriptStartCheck() 559*cdf0e10cSrcweir private String m_sRefBuildID; 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir public void setRefBuildID(String _sRef) 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir m_sRefBuildID = _sRef; 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir public String getRefBuildID() 566*cdf0e10cSrcweir { 567*cdf0e10cSrcweir return m_sRefBuildID; 568*cdf0e10cSrcweir } 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir public void disallowStore() 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir m_bStoreFile = false; 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir public void allowStore() 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir m_bStoreFile = true; 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir public boolean isStoreAllowed() 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir return m_bStoreFile; 581*cdf0e10cSrcweir } 582*cdf0e10cSrcweir public boolean createDefaultReference() 583*cdf0e10cSrcweir { 584*cdf0e10cSrcweir return m_bCreateDefaultReference; 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir 588*cdf0e10cSrcweir // get/set for FilterName 589*cdf0e10cSrcweir // get the right Filtername (internal Name) from 590*cdf0e10cSrcweir // http://framework.openoffice.org/files/documents/25/897/filter_description.html 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir String m_sImportFilterName = ""; 593*cdf0e10cSrcweir String m_sExportFilterName = ""; 594*cdf0e10cSrcweir public void setImportFilterName(String _sImportFilterName) 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir m_sImportFilterName = _sImportFilterName; 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir public String getImportFilterName() 599*cdf0e10cSrcweir { 600*cdf0e10cSrcweir return m_sImportFilterName; 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir public void setExportFilterName(String _sExportFilterName) 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir m_sExportFilterName = _sExportFilterName; 605*cdf0e10cSrcweir } 606*cdf0e10cSrcweir public String getExportFilterName() 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir return m_sExportFilterName; 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir String m_sOfficeProgram = ""; 612*cdf0e10cSrcweir public void setOfficeProgram(String _sName) 613*cdf0e10cSrcweir { 614*cdf0e10cSrcweir m_sOfficeProgram = _sName; 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir public String getOfficeProgram() 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir return m_sOfficeProgram; 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir public boolean restartOffice() 622*cdf0e10cSrcweir { 623*cdf0e10cSrcweir if (m_bResuseOffice == false) 624*cdf0e10cSrcweir { 625*cdf0e10cSrcweir return true; 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir return false; 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir String m_sHTMLOutputPrefix = ""; 631*cdf0e10cSrcweir public String getHTMLOutputPrefix() 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir return m_sHTMLOutputPrefix; 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir TriState m_tWithBorderMove = TriState.UNSET; 637*cdf0e10cSrcweir // public TriState isBorderMove() 638*cdf0e10cSrcweir // { 639*cdf0e10cSrcweir // return m_tWithBorderMove; 640*cdf0e10cSrcweir // } 641*cdf0e10cSrcweir public TriState getBorderMove() 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir return m_tWithBorderMove; 644*cdf0e10cSrcweir } 645*cdf0e10cSrcweir public void setBorderMove(TriState _tBorderMove) 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir m_tWithBorderMove = _tBorderMove; 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir String m_sDocumentType = ""; 651*cdf0e10cSrcweir public void setDocumentType(String _sName) 652*cdf0e10cSrcweir { 653*cdf0e10cSrcweir m_sDocumentType = _sName; 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir public String getDocumentType() 656*cdf0e10cSrcweir { 657*cdf0e10cSrcweir return m_sDocumentType; 658*cdf0e10cSrcweir } 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir /* 661*cdf0e10cSrcweir helper class for performance analyser features 662*cdf0e10cSrcweir */ 663*cdf0e10cSrcweir PerformanceContainer m_aPerformanceContainer = null; 664*cdf0e10cSrcweir public PerformanceContainer getPerformance() 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir if (m_aPerformanceContainer == null) 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir m_aPerformanceContainer = new PerformanceContainer(); 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir return m_aPerformanceContainer; 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir private String m_aInputFile; 674*cdf0e10cSrcweir public void setInputFile(String _sInputFile) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir m_aInputFile = _sInputFile; 677*cdf0e10cSrcweir } 678*cdf0e10cSrcweir public String getInputFile() 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir return m_aInputFile; 681*cdf0e10cSrcweir } 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir private String m_sDBInfoString; 684*cdf0e10cSrcweir public String getDBInfoString() 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir if (m_sDBInfoString != null) 687*cdf0e10cSrcweir { 688*cdf0e10cSrcweir if (m_sDBInfoString.length() == 0) 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir return null; 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir return m_sDBInfoString; 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir public boolean cancelRequest() 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir File aCancelFile = null; 700*cdf0e10cSrcweir String fs; 701*cdf0e10cSrcweir fs = System.getProperty("file.separator"); 702*cdf0e10cSrcweir String sTempPath = (String)m_aCurrentParams.get( PropertyName.TEMPPATH ); 703*cdf0e10cSrcweir if (sTempPath != null) 704*cdf0e10cSrcweir { 705*cdf0e10cSrcweir String sGDC_Dir = sTempPath; 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir if (m_sDistinct.length() > 0) 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir sGDC_Dir = sGDC_Dir + fs + m_sDistinct; 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir String sCancelFile = sGDC_Dir + fs + "cancel_compare.txt"; 713*cdf0e10cSrcweir aCancelFile = new File(sCancelFile); 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir if (aCancelFile.exists()) 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir GlobalLogWriter.get().println("ATTENTION: Found file: '" + sCancelFile + "'."); 718*cdf0e10cSrcweir GlobalLogWriter.get().println("User has canceled the program flow."); 719*cdf0e10cSrcweir return true; 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir return false; 723*cdf0e10cSrcweir } 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir /* 729*cdf0e10cSrcweir public class MSGraphicalTestArguments extends GraphicalTestArguments 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir MSGraphicalTestArguments() 732*cdf0e10cSrcweir { 733*cdf0e10cSrcweir setReferenceType("msoffice"); 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir } 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir public class OOoGraphicalTestArguments extends GraphicalTestArguments 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir OOoGraphicalTestArguments(XMultiServiceFactory _aFactory) 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir setMultiServiceFactory(_aFactory); 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir */ 745