1 '/*************************************************************************
\r
3 ' * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
\r
5 ' * Copyright 2008 by Sun Microsystems, Inc.
\r
7 ' * OpenOffice.org - a multi-platform office productivity suite
\r
9 ' * $RCSfile: CreateDriverDocs.wsf,v $
\r
10 ' * $Revision: 1.2.140.3 $
\r
12 ' * This file is part of OpenOffice.org.
\r
14 ' * OpenOffice.org is free software: you can redistribute it and/or modify
\r
15 ' * it under the terms of the GNU Lesser General Public License version 3
\r
16 ' * only, as published by the Free Software Foundation.
\r
18 ' * OpenOffice.org is distributed in the hope that it will be useful,
\r
19 ' * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
20 ' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
21 ' * GNU Lesser General Public License version 3 for more details
\r
22 ' * (a copy is included in the LICENSE file that accompanied this code).
\r
24 ' * You should have received a copy of the GNU Lesser General Public License
\r
25 ' * version 3 along with OpenOffice.org. If not, see
\r
26 ' * http://www.openoffice.org/license.html
\r
27 ' * for a copy of the LGPLv3 License.
\r
29 ' ************************************************************************/
\r
30 '### Build Support Module for running commands to export and import
\r
31 '### modules from Word, Excel and PowerPoint Document Analysis driver documents
\r
34 <job id="DocAnalysisBuildCmd" error="true" debug="true">
\r
35 <script language="VBScript" src="DocAnalysisRunMacro.vbs"/>
\r
36 <script language="VBScript">
\r
38 Const CTITLE = "Document Analysis Command"
\r
40 Const CWORD_DRIVER = "_OOoDocAnalysisWordDriver.doc"
\r
41 Const CEXCEL_DRIVER = "_OOoDocAnalysisExcelDriver.xls"
\r
42 Const CPP_DRIVER = "_OOoDocAnalysisPPTDriver.ppt"
\r
43 Const CStub = "Stripped"
\r
45 Const CUTIL_APPNAME_WORD = "Word"
\r
46 Const CUTIL_APPNAME_EXCEL = "Excel"
\r
47 Const CUTIL_APPNAME_POWERPOINT = "Powerpoint"
\r
49 Const CDIAG_STD_DELAY = 2
\r
51 Const CDEFAULT_SOURCE_DIR = ".\sources\"
\r
52 Const CDEFAULT_TARGET_DIR = "."
\r
54 Const CSOURCE_DIR_ARG = "X"
\r
55 Const CTARGET_DIR_ARG = "T"
\r
56 Const CUSAGE_ARG = "?"
\r
58 Const CSTR_PAW = "\PAW\"
\r
60 '######### Doc Analysis Build - Main Script Body #############
\r
61 Dim mArgsNamed, mArgsUnnamed
\r
65 On Error Resume Next
\r
67 '### Process Arguments ###
\r
68 Set mArgsNamed = WScript.Arguments.Named
\r
69 Set mArgsUnnamed = WScript.Arguments.Unnamed
\r
71 If mArgsNamed.Exists(CUSAGE_ARG) Then
\r
77 if mArgsNamed.Exists(CSOURCE_DIR_ARG) Then
\r
78 mSourceDir = mArgsNamed.Item(CSOURCE_DIR_ARG)
\r
80 mSourceDir = CDEFAULT_SOURCE_DIR
\r
84 if mArgsNamed.Exists(CTARGET_DIR_ARG ) Then
\r
85 mTargetDir = mArgsNamed.Item(CTARGET_DIR_ARG )
\r
87 mTargetDir = CDEFAULT_TARGET_DIR
\r
90 mSourceDir = daFso.GetAbsolutePathName(mSourceDir )
\r
91 mTargetDir = daFso.GetAbsolutePathName(mTargetDir )
\r
93 '# Check source and target dirs exist
\r
94 If Not daFso.FolderExists(mSourceDir) Then
\r
95 DAErrMsg "Source directory does not exist: " & mSourceDir, CDA_ERR_STD_DELAY
\r
98 If Not daFso.FolderExists(mTargetDir) Then
\r
99 DAErrMsg "Target directory does not exist: " & mTargetDir, CDA_ERR_STD_DELAY
\r
103 Set mArgsNamed = Nothing
\r
104 Set mArgsUnnamed = Nothing
\r
106 '#### then continue with PAW
\r
107 ImportAll mTargetDir & CSTR_PAW
\r
113 '######### End - Main Script Body #############
\r
116 '#### Doc Analysis Build - Support Functions ####
\r
119 DAdiagMsg "Build command line tool to create Document Analysis driver documents" & vbLf & vbLf &_
\r
120 "DocAnalysisBuildCmd [/X:<sourceDir>] [/T:<targetDir>]" & vbLf & vbLf &_
\r
121 "/X:<sourceDir> base <source> directory " & vbLf & _
\r
122 " The <sourceDir> is the base dir under which all the " & vbLf & _
\r
123 " _res.bas files are located to import from" & vbLf & vbLf & _
\r
124 "/T:<targetDir> target directory " & vbLf & _
\r
125 " <targetDir> is where the new Driver docs" & vbLf & _
\r
126 " will be created", 30
\r
129 '######################
\r
135 '######################
\r
136 Sub ImportAll( aTargetDir )
\r
138 '#### Create automation servers ####
\r
143 If Not daFso.FolderExists( aTargetDir ) Then
\r
144 daFso.CreateFolder( aTargetDir )
\r
147 BackupDrivers aTargetDir
\r
149 DAOpenWrdDriver mSourceDir & "\" & CSTUB & CWORD_DRIVER
\r
150 DAOpenExcelDriver mSourceDir & "\" & CSTUB & CEXCEL_DRIVER
\r
151 DAOpenPPDriver mSourceDir & "\" & CSTUB & CPP_DRIVER
\r
153 DASetTitle CTITLE & " - Import"
\r
155 ImportSelectedProjectFiles mSourceDir, CUTIL_APPNAME_WORD
\r
156 ImportSelectedProjectFiles mSourceDir, CUTIL_APPNAME_EXCEL
\r
157 ImportSelectedProjectFiles mSourceDir, CUTIL_APPNAME_POWERPOINT
\r
159 DAsaveWrdDriver aTargetDir & "\" & CWORD_DRIVER
\r
160 DAsaveExcelDriver aTargetDir & "\" & CEXCEL_DRIVER
\r
161 DAsavePPDriver aTargetDir & "\" & CPP_DRIVER
\r
166 '######################
\r
167 Sub BackupDrivers(importdir)
\r
168 On Error Resume Next
\r
174 wrdPath = daFso.GetAbsolutePathName(importdir & "\" & CWORD_DRIVER)
\r
175 xlsPath= daFso.GetAbsolutePathName(importdir & "\" & CEXCEL_DRIVER)
\r
176 ppPath= daFso.GetAbsolutePathName(importdir & "\" & CPP_DRIVER)
\r
178 If daFso.FileExists( wrdPath ) Then daFso.CopyFile wrdPath, wrdPath & ".bak"
\r
179 If daFso.FileExists( xlsPath ) Then daFso.CopyFile xlsPath, xlsPath & ".bak"
\r
180 If daFso.FileExists( ppPath ) Then daFso.CopyFile ppPath, ppPath & ".bak"
\r
183 '######################
\r
184 Sub ImportSelectedProjectFiles(dir, app_name)
\r
185 On Error Resume Next
\r
189 lcApp_name = LCase(app_name)
\r
192 base = dir & "\" & lcApp_name & "\"
\r
194 DAImportFile base & "ApplicationSpecific.bas", "ApplicationSpecific", app_name
\r
195 DAImportFile base & "MigrationAnalyser.cls", "MigrationAnalyser", app_name
\r
197 DAImportFile base & "Preparation.bas", "Preparation", app_name
\r
200 DAImportFile base & lcApp_name & "_res.bas", lcApp_name & "_res", app_name
\r
204 DAImportFile base & "AnalysisDriver.bas", "AnalysisDriver", app_name
\r
205 DAImportFile base & "CommonMigrationAnalyser.bas", "CommonMigrationAnalyser", app_name
\r
206 DAImportFile base & "CollectedFiles.cls", "CollectedFiles", app_name
\r
207 DAImportFile base & "DocumentAnalysis.cls", "DocumentAnalysis", app_name
\r
208 DAImportFile base & "FileTypeAssociation.cls", "FileTypeAssociation", app_name
\r
209 DAImportFile base & "IssueInfo.cls", "IssueInfo", app_name
\r
210 DAImportFile base & "PrepareInfo.cls", "PrepareInfo", app_name
\r
211 DAImportFile base & "StringDataManager.cls", "StringDataManager", app_name
\r
212 DAImportFile base & "LocalizeResults.bas", "LocalizeResults", app_name
\r
214 DAImportFile base & "CommonPreparation.bas", "CommonPreparation", app_name
\r
217 DAImportFile base & "common_res.bas", "common_res", app_name
\r
218 DAImportFile base & "results_res.bas", "results_res", app_name
\r