1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?> 2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*b1cdbd2cSJim Jagielski<!--*********************************************************** 4*b1cdbd2cSJim Jagielski * 5*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 6*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 7*b1cdbd2cSJim Jagielski * distributed with this work for additional information 8*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 9*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 10*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 11*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 14*b1cdbd2cSJim Jagielski * 15*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 16*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 17*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 19*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 20*b1cdbd2cSJim Jagielski * under the License. 21*b1cdbd2cSJim Jagielski * 22*b1cdbd2cSJim Jagielski ***********************************************************--> 23*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DialogModul" script:language="StarBasic">Option Explicit 24*b1cdbd2cSJim Jagielski 25*b1cdbd2cSJim JagielskiPublic Const bDebugWizard = True 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim JagielskiPublic Const SBFIRSTAPPLCHECKED = 0 28*b1cdbd2cSJim JagielskiPublic Const SBSECONDAPPLCHECKED = 1 29*b1cdbd2cSJim JagielskiPublic Const SBTHIRDAPPLCHECKED = 2 30*b1cdbd2cSJim JagielskiPublic Const SBFOURTHAPPLCHECKED = 3 31*b1cdbd2cSJim JagielskiPublic bFilterTracingAvailable as Boolean 32*b1cdbd2cSJim JagielskiPublic WizardMode as String 33*b1cdbd2cSJim JagielskiPublic Const SBMICROSOFTMODE = "MS" 34*b1cdbd2cSJim JagielskiPublic Const SBXMLMODE = "SO" 35*b1cdbd2cSJim Jagielski' The absolute maximal Number of possible Applications 36*b1cdbd2cSJim JagielskiPublic Const Twip = 425 37*b1cdbd2cSJim JagielskiPublic Const SBMAXAPPLCOUNT = 4 38*b1cdbd2cSJim JagielskiPublic MaxApplCount as Integer 39*b1cdbd2cSJim JagielskiPublic CurOffice As Integer 40*b1cdbd2cSJim JagielskiPublic SOBitmapPath As String 41*b1cdbd2cSJim JagielskiPublic SOWorkPath As String 42*b1cdbd2cSJim JagielskiPublic SOTemplatePath as String 43*b1cdbd2cSJim JagielskiPublic bCancelTask As Boolean 44*b1cdbd2cSJim JagielskiPublic bDoKeepApplValues as Boolean 45*b1cdbd2cSJim JagielskiPublic iApplSection as Integer 46*b1cdbd2cSJim JagielskiPublic oUcb as Object 47*b1cdbd2cSJim JagielskiPublic PathSeparator as String 48*b1cdbd2cSJim Jagielski 49*b1cdbd2cSJim JagielskiPublic ApplCount as Integer 50*b1cdbd2cSJim JagielskiPublic sKeyName(SBMAXAPPLCOUNT-1) as String 51*b1cdbd2cSJim JagielskiPublic sValueName(SBMAXAPPLCOUNT-1) as String 52*b1cdbd2cSJim JagielskiPublic sCRLF as String 53*b1cdbd2cSJim JagielskiPublic MSFilterName(5,4) as String 54*b1cdbd2cSJim JagielskiPublic XMLFilterName(7,3) as String 'Number of different formats 55*b1cdbd2cSJim JagielskiPublic FilterTracingLogPath(2) as String 56*b1cdbd2cSJim JagielskiPublic bMSApplFilterTracingAvailable(2) as String 57*b1cdbd2cSJim JagielskiPublic bTakeOverTargetName(2) as Boolean 58*b1cdbd2cSJim JagielskiPublic bTakeOverPathName(2) as Boolean 59*b1cdbd2cSJim Jagielski 60*b1cdbd2cSJim Jagielski' e.g.: 61*b1cdbd2cSJim Jagielski' XMLFilterName(x,0) = "sdw" ' in documents we take the extensions; in SO-templates the appropriate Filtername 62*b1cdbd2cSJim Jagielski' XMLFilterName(x,1) = "swriter: StarWriter 5.0" ' the filtername of the target-format 63*b1cdbd2cSJim Jagielski' XMLFilterName(x,2) = "sxw" ' the target extension 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim JagielskiPublic Applications(SBMAXAPPLCOUNT-1,9) 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim JagielskiPublic Const SBAPPLCONVERT = 0 68*b1cdbd2cSJim JagielskiPublic Const SBDOCCONVERT = 1 69*b1cdbd2cSJim JagielskiPublic Const SBDOCRECURSIVE = 2 70*b1cdbd2cSJim JagielskiPublic Const SBDOCSOURCE = 3 71*b1cdbd2cSJim JagielskiPublic Const SBDOCTARGET = 4 72*b1cdbd2cSJim JagielskiPublic Const SBTEMPLCONVERT = 5 73*b1cdbd2cSJim JagielskiPublic Const SBTEMPLRECURSIVE = 6 74*b1cdbd2cSJim JagielskiPublic Const SBTEMPLSOURCE = 7 75*b1cdbd2cSJim JagielskiPublic Const SBTEMPLTARGET = 8 76*b1cdbd2cSJim JagielskiPublic Const SBAPPLKEY = 9 77*b1cdbd2cSJim JagielskiPublic XMLTemplateList() 78*b1cdbd2cSJim Jagielski 79*b1cdbd2cSJim Jagielski' Application-relating Data are stored in this Array 80*b1cdbd2cSJim Jagielski' according to the following structure: 81*b1cdbd2cSJim Jagielski' Applications(X,0) = True/False (Application is to be converted) 82*b1cdbd2cSJim Jagielski' Applications(X,1) = True/False (Documents are to be converted) 83*b1cdbd2cSJim Jagielski' Applications(X,2) = True/False (Including Subdirectories) 84*b1cdbd2cSJim Jagielski' Applications(X,3) = "File:///..." (SourceUrl of the documents) 85*b1cdbd2cSJim Jagielski' Applications(X,4) = "File///:..." (TargetUrl of the documents) 86*b1cdbd2cSJim Jagielski' Applications(X,5) = True/False (Templates are to be converted) 87*b1cdbd2cSJim Jagielski' Applications(X,6) = True/False (Including Subdirectories) 88*b1cdbd2cSJim Jagielski' Applications(X,7) = "File:///..." (SourceUrl of the templates) 89*b1cdbd2cSJim Jagielski' Applications(X,8) = "File:///..." (TargetUrl of the templates) 90*b1cdbd2cSJim Jagielski' Applications(X,9) = 0 (Key to the original Index of the Applications) 91*b1cdbd2cSJim Jagielski 92*b1cdbd2cSJim JagielskiPublic Const SBMAXEXTENSIONLENGTH = 17 93*b1cdbd2cSJim Jagielski 94*b1cdbd2cSJim Jagielski 95*b1cdbd2cSJim JagielskiSub FillStep_Welcome() 96*b1cdbd2cSJim JagielskiDim i as Integer 97*b1cdbd2cSJim Jagielski' bDoKeepApplValues = False 98*b1cdbd2cSJim Jagielski ImportDialogArea.Title = sTitle 99*b1cdbd2cSJim Jagielski With ImportDialog 100*b1cdbd2cSJim Jagielski .cmdHelp.Label = sHelpButton 101*b1cdbd2cSJim Jagielski .cmdCancel.Label = sCancelButton 102*b1cdbd2cSJim Jagielski .cmdBack.Label = sBackButton 103*b1cdbd2cSJim Jagielski .cmdGoOn.Label = sNextButton 104*b1cdbd2cSJim Jagielski .WelcomeTextLabel.Label = sWelcomeTextLabel1 105*b1cdbd2cSJim Jagielski .WelcomeTextLabel2.Label = sWelcomeTextLabel2 106*b1cdbd2cSJim Jagielski .WelcomeTextLabel3.Label = sWelcomeTextLabel3 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski .optMSDocuments.Label = sContainerName(0) 109*b1cdbd2cSJim Jagielski .chkMSApplication1.Label = sMsDocumentCheckbox(0) 110*b1cdbd2cSJim Jagielski .chkMSApplication2.Label = sMsDocumentCheckbox(1) 111*b1cdbd2cSJim Jagielski .chkMSApplication3.Label = sMsDocumentCheckbox(2) 112*b1cdbd2cSJim Jagielski 113*b1cdbd2cSJim Jagielski .optSODocuments.Label = sContainerName(1) 114*b1cdbd2cSJim Jagielski .chkSOApplication1.Label = sSODocumentCheckbox(0) 115*b1cdbd2cSJim Jagielski .chkSOApplication2.Label = sSODocumentCheckbox(1) 116*b1cdbd2cSJim Jagielski .chkSOApplication3.Label = sSODocumentCheckbox(2) 117*b1cdbd2cSJim Jagielski .chkSOApplication4.Label = sSODocumentCheckbox(3) 118*b1cdbd2cSJim Jagielski .cmdBack.Enabled = False 119*b1cdbd2cSJim Jagielski .Step = 1 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski If Not oFactoryKey.hasbyName("com.sun.star.text.TextDocument") Then 122*b1cdbd2cSJim Jagielski .chkLogfile.State = 0 123*b1cdbd2cSJim Jagielski .chkLogfile.Enabled = False 124*b1cdbd2cSJim Jagielski End If 125*b1cdbd2cSJim Jagielski End With 126*b1cdbd2cSJim Jagielski CheckModuleInstallation() 127*b1cdbd2cSJim Jagielski ToggleNextButton() 128*b1cdbd2cSJim JagielskiEnd Sub 129*b1cdbd2cSJim Jagielski 130*b1cdbd2cSJim Jagielski 131*b1cdbd2cSJim JagielskiSub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean) 132*b1cdbd2cSJim JagielskiDim Index as Integer 133*b1cdbd2cSJim JagielskiDim oNullObject as Object 134*b1cdbd2cSJim Jagielski If bStartup And Not bDoKeepApplValues Then 135*b1cdbd2cSJim Jagielski If ImportDialog.optMSDocuments.State = 1 Then 136*b1cdbd2cSJim Jagielski SetupMSConfiguration() 137*b1cdbd2cSJim Jagielski Else 138*b1cdbd2cSJim Jagielski SetupXMLConfiguration() 139*b1cdbd2cSJim Jagielski End If 140*b1cdbd2cSJim Jagielski FillUpApplicationList() 141*b1cdbd2cSJim Jagielski End If 142*b1cdbd2cSJim Jagielski CurOffice = OfficeIndex 143*b1cdbd2cSJim Jagielski Index = Applications(CurOffice,SBAPPLKEY) 144*b1cdbd2cSJim Jagielski InitializePathsforCurrentApplication(Index) 145*b1cdbd2cSJim Jagielski With ImportDialog 146*b1cdbd2cSJim Jagielski .chkTemplatePath.Label = sTemplateCheckbox(Index) 147*b1cdbd2cSJim Jagielski .chkDocumentPath.State = Abs(Applications(CurOffice,SBDOCCONVERT)) 148*b1cdbd2cSJim Jagielski .chkDocumentSearchSubDir.State = Abs(Applications(CurOffice,SBDOCRECURSIVE)) 149*b1cdbd2cSJim Jagielski .txtDocumentImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCSOURCE)) 150*b1cdbd2cSJim Jagielski .txtDocumentExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCTARGET)) 151*b1cdbd2cSJim Jagielski .hlnDocuments.Label = sProgressMoreDocs 152*b1cdbd2cSJim Jagielski If WizardMode = SBXMLMODE Then 153*b1cdbd2cSJim Jagielski ImportDialogArea.Title = sTitle & " - " & sSODocumentCheckBox(Index) 154*b1cdbd2cSJim Jagielski Else 155*b1cdbd2cSJim Jagielski ImportDialogArea.Title = sTitle & " - " & sMSDocumentCheckBox(Index) 156*b1cdbd2cSJim Jagielski End If 157*b1cdbd2cSJim Jagielski If WizardMode = SBXMLMODE AND Index = 3 Then 158*b1cdbd2cSJim Jagielski ' Note: SO-Helper Applications are partly treated like templates although they only have documents 159*b1cdbd2cSJim Jagielski .hlnTemplates.Label = sProgressMoreDocs 160*b1cdbd2cSJim Jagielski .chkTemplatePath.Label = sSOHelperDocuments(0,0) 161*b1cdbd2cSJim Jagielski .chkTemplatePath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(0,1)) 162*b1cdbd2cSJim Jagielski .chkDocumentPath.Label = sSOHelperDocuments(1,0) 163*b1cdbd2cSJim Jagielski .chkDocumentPath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(1,1)) 164*b1cdbd2cSJim Jagielski Else 165*b1cdbd2cSJim Jagielski .chkTemplatePath.Enabled = True 166*b1cdbd2cSJim Jagielski .chkDocumentPath.Enabled = True 167*b1cdbd2cSJim Jagielski .chkTemplatePath.Label = sTemplateCheckbox(Index) 168*b1cdbd2cSJim Jagielski .chkDocumentPath.Label = sDocumentCheckbox(Index) 169*b1cdbd2cSJim Jagielski .hlnTemplates.Label = sProgressMoreTemplates 170*b1cdbd2cSJim Jagielski End If 171*b1cdbd2cSJim Jagielski .chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT)) 172*b1cdbd2cSJim Jagielski ToggleInputPaths(oNullObject,"Template") 173*b1cdbd2cSJim Jagielski ToggleInputPaths(oNullObject,"Document") 174*b1cdbd2cSJim Jagielski .chkTemplateSearchSubDir.State = Abs(Applications(CurOffice,SBTEMPLRECURSIVE)) 175*b1cdbd2cSJim Jagielski .txtTemplateImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLSOURCE)) 176*b1cdbd2cSJim Jagielski .txtTemplateExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLTARGET)) 177*b1cdbd2cSJim Jagielski .cmdGoOn.Label = sNextButton 178*b1cdbd2cSJim Jagielski .cmdBack.Enabled = True 179*b1cdbd2cSJim Jagielski ImportDialog.Step = 2 180*b1cdbd2cSJim Jagielski End With 181*b1cdbd2cSJim Jagielski ImportDialogArea.GetControl("chkTemplatePath").SetFocus() 182*b1cdbd2cSJim Jagielski ToggleNextButton() 183*b1cdbd2cSJim JagielskiEnd Sub 184*b1cdbd2cSJim Jagielski 185*b1cdbd2cSJim Jagielski 186*b1cdbd2cSJim JagielskiSub FillUpApplicationList() 187*b1cdbd2cSJim JagielskiDim i as Integer 188*b1cdbd2cSJim JagielskiDim a as Integer 189*b1cdbd2cSJim JagielskiDim BoolValue as Boolean 190*b1cdbd2cSJim Jagielski If Not bDoKeepApplValues Then 191*b1cdbd2cSJim Jagielski a = 0 192*b1cdbd2cSJim Jagielski For i = 1 To ApplCount 193*b1cdbd2cSJim Jagielski If ImportDialog.optMSDocuments.State = 1 Then 194*b1cdbd2cSJim Jagielski BoolValue = ImportDialogArea.GetControl("chkMSApplication" & i).Model.State = 1 195*b1cdbd2cSJim Jagielski Else 196*b1cdbd2cSJim Jagielski BoolValue = ImportDialogArea.GetControl("chkSOApplication" & i).Model.State = 1 197*b1cdbd2cSJim Jagielski End If 198*b1cdbd2cSJim Jagielski Applications(a,SBAPPLCONVERT) = BoolValue 199*b1cdbd2cSJim Jagielski Applications(a,SBDOCCONVERT) = BoolValue 200*b1cdbd2cSJim Jagielski Applications(a,SBDOCRECURSIVE) = BoolValue 201*b1cdbd2cSJim Jagielski Applications(a,SBDOCSOURCE) = "" ' GetDefaultPath(i) 202*b1cdbd2cSJim Jagielski Applications(a,SBDOCTARGET) = "" ' SOWorkPath 203*b1cdbd2cSJim Jagielski Applications(a,SBTEMPLCONVERT) = BoolValue 204*b1cdbd2cSJim Jagielski Applications(a,SBTEMPLRECURSIVE) = BoolValue 205*b1cdbd2cSJim Jagielski Applications(a,SBTEMPLSOURCE) = "" ' GetTemplateDefaultPath(i) 206*b1cdbd2cSJim Jagielski Applications(a,SBTEMPLTARGET) = "" ' GetTargetTemplatePath(i) 207*b1cdbd2cSJim Jagielski Applications(a,SBAPPLKEY) = i-1 208*b1cdbd2cSJim Jagielski If BoolValue Then 209*b1cdbd2cSJim Jagielski a = a + 1 210*b1cdbd2cSJim Jagielski End If 211*b1cdbd2cSJim Jagielski Next i 212*b1cdbd2cSJim Jagielski ApplCount = a 213*b1cdbd2cSJim Jagielski End If 214*b1cdbd2cSJim JagielskiEnd Sub 215*b1cdbd2cSJim Jagielski 216*b1cdbd2cSJim Jagielski 217*b1cdbd2cSJim JagielskiSub InitializePathsforCurrentApplication(i as Integer) 218*b1cdbd2cSJim Jagielski AssignPathToCurrentApplication(SBDOCSOURCE, GetDefaultPath(i)) 219*b1cdbd2cSJim Jagielski AssignPathToCurrentApplication(SBDOCTARGET, SOWorkPath) 220*b1cdbd2cSJim Jagielski AssignPathToCurrentApplication(SBTEMPLSOURCE, GetTemplateDefaultPath(i)) 221*b1cdbd2cSJim Jagielski AssignPathToCurrentApplication(SBTEMPLTARGET, GetTargetTemplatePath(i)) 222*b1cdbd2cSJim JagielskiEnd Sub 223*b1cdbd2cSJim Jagielski 224*b1cdbd2cSJim Jagielski 225*b1cdbd2cSJim JagielskiSub AssignPathToCurrentApplication(Index as Integer, NewPath as String) 226*b1cdbd2cSJim Jagielski If Applications(CurOffice,Index) = "" Then 227*b1cdbd2cSJim Jagielski If CurOffice > 0 Then 228*b1cdbd2cSJim Jagielski Applications(CurOffice,Index) = Applications(CurOffice-1,Index) 229*b1cdbd2cSJim Jagielski Else 230*b1cdbd2cSJim Jagielski Applications(CurOffice,Index) = NewPath 231*b1cdbd2cSJim Jagielski End If 232*b1cdbd2cSJim Jagielski End If 233*b1cdbd2cSJim JagielskiEnd Sub 234*b1cdbd2cSJim Jagielski 235*b1cdbd2cSJim Jagielski 236*b1cdbd2cSJim JagielskiSub SaveStep_InputPath() 237*b1cdbd2cSJim Jagielski Applications(CurOffice,SBDOCCONVERT) = ImportDialog.chkDocumentPath.State = 1 238*b1cdbd2cSJim Jagielski Applications(CurOffice,SBDOCRECURSIVE) = ImportDialog.chkDocumentSearchSubDir.State = 1 239*b1cdbd2cSJim Jagielski Applications(CurOffice,SBDOCSOURCE) = ConvertToURL(ImportDialog.txtDocumentImportPath.Text) 240*b1cdbd2cSJim Jagielski Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.txtDocumentExportPath.Text) 241*b1cdbd2cSJim Jagielski Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.chkTemplatePath.State = 1 242*b1cdbd2cSJim Jagielski Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.chkTemplateSearchSubDir.State = 1 243*b1cdbd2cSJim Jagielski Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.txtTemplateImportPath.Text) 244*b1cdbd2cSJim Jagielski Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.txtTemplateExportPath.Text) 245*b1cdbd2cSJim JagielskiEnd Sub 246*b1cdbd2cSJim Jagielski 247*b1cdbd2cSJim Jagielski 248*b1cdbd2cSJim JagielskiSub ToggleInputPaths(aEvent as Object, Optional sDocType) 249*b1cdbd2cSJim JagielskiDim bDoEnable as Boolean 250*b1cdbd2cSJim JagielskiDim sLocDocType as String 251*b1cdbd2cSJim JagielskiDim oCheckBox as Object 252*b1cdbd2cSJim Jagielski If Not IsNull(aEvent) Then 253*b1cdbd2cSJim Jagielski sLocDocType = aEvent.Source.Model.Tag 254*b1cdbd2cSJim Jagielski Else 255*b1cdbd2cSJim Jagielski sLocDocType = sDocType 256*b1cdbd2cSJim Jagielski End If 257*b1cdbd2cSJim Jagielski With ImportDialogArea 258*b1cdbd2cSJim Jagielski oCheckBox = .GetControl("chk" & sLocDocType & "Path").Model 259*b1cdbd2cSJim Jagielski bDoEnable = oCheckBox.State = 1 And oCheckBox.Enabled 260*b1cdbd2cSJim Jagielski .GetControl("lbl" & sLocDocType & "Import").Model.Enabled = bDoEnable 261*b1cdbd2cSJim Jagielski .GetControl("lbl" & sLocDocType & "Export").Model.Enabled = bDoEnable 262*b1cdbd2cSJim Jagielski .GetControl("txt" & sLocDocType & "ImportPath").Model.Enabled = bDoEnable 263*b1cdbd2cSJim Jagielski .GetControl("txt" & sLocDocType & "ExportPath").Model.Enabled = bDoEnable 264*b1cdbd2cSJim Jagielski .GetControl("chk" & sLocDocType & "SearchSubDir").Model.Enabled = bDoEnable 265*b1cdbd2cSJim Jagielski .GetControl("cmd" & sLocDocType & "Import").Model.Enabled = bDoEnable 266*b1cdbd2cSJim Jagielski .GetControl("cmd" & sLocDocType & "Export").Model.Enabled = bDoEnable 267*b1cdbd2cSJim Jagielski End With 268*b1cdbd2cSJim Jagielski ToggleNextButton() 269*b1cdbd2cSJim JagielskiEnd Sub 270*b1cdbd2cSJim Jagielski 271*b1cdbd2cSJim Jagielski 272*b1cdbd2cSJim JagielskiFunction MakeSummaryString() 273*b1cdbd2cSJim JagielskiDim sTmpText As String 274*b1cdbd2cSJim JagielskiDim i as Integer 275*b1cdbd2cSJim JagielskiDim Index as Integer 276*b1cdbd2cSJim JagielskiDim sAddText as String 277*b1cdbd2cSJim Jagielski For i = 0 To ApplCount -1 278*b1cdbd2cSJim Jagielski Index = Applications(i,SBAPPLKEY) 279*b1cdbd2cSJim Jagielski GetFilterTracingLogPath(i, Index) 280*b1cdbd2cSJim Jagielski If Applications(i,SBTEMPLCONVERT) Then 281*b1cdbd2cSJim Jagielski ' Templates are to be converted 282*b1cdbd2cSJim Jagielski sAddText = "" 283*b1cdbd2cSJim Jagielski If WizardMode = SBMICROSOFTMODE Then 284*b1cdbd2cSJim Jagielski sAddText = sSumMSTemplates(Index) & sCRLF 285*b1cdbd2cSJim Jagielski Else 286*b1cdbd2cSJim Jagielski sAddText = sSumSOTemplates(Index) & sCRLF 287*b1cdbd2cSJim Jagielski End If 288*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sAddText & ConvertFromUrl(Applications(i,SBTEMPLSOURCE)) & sCRLF 289*b1cdbd2cSJim Jagielski If Applications(i,SBTEMPLRECURSIVE) Then 290*b1cdbd2cSJim Jagielski ' Including Subdirectories 291*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sSumInclusiveSubDir & sCRLF 292*b1cdbd2cSJim Jagielski End If 293*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sSumSaveDocuments & sCRLF 294*b1cdbd2cSJim Jagielski sTmpText = sTmpText & ConvertFromUrl(Applications(i,SBTEMPLTARGET)) & sCRLF 295*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sCRLF 296*b1cdbd2cSJim Jagielski End If 297*b1cdbd2cSJim Jagielski 298*b1cdbd2cSJim Jagielski If Applications(i,SBDOCCONVERT) Then 299*b1cdbd2cSJim Jagielski ' Documents are to be converted 300*b1cdbd2cSJim Jagielski If WizardMode = SBMICROSOFTMODE Then 301*b1cdbd2cSJim Jagielski sAddText = sSumMSDocuments(Index) & sCRLF 302*b1cdbd2cSJim Jagielski Else 303*b1cdbd2cSJim Jagielski sAddText = sSumSODocuments(Index) & sCRLF 304*b1cdbd2cSJim Jagielski End If 305*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sAddText & ConvertFromUrl(Applications(i,SBDOCSOURCE)) & sCRLF 306*b1cdbd2cSJim Jagielski 307*b1cdbd2cSJim Jagielski If Applications(i,SBDOCRECURSIVE) Then 308*b1cdbd2cSJim Jagielski ' Including Subdirectories 309*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sSumInclusiveSubDir & sCRLF 310*b1cdbd2cSJim Jagielski End If 311*b1cdbd2cSJim Jagielski 312*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sSumSaveDocuments & sCRLF 313*b1cdbd2cSJim Jagielski sTmpText = sTmpText & ConvertFromUrl(Applications(i,SBDOCTARGET)) & sCRLF 314*b1cdbd2cSJim Jagielski sTmpText = sTmpText & sCRLF 315*b1cdbd2cSJim Jagielski End If 316*b1cdbd2cSJim Jagielski Next i 317*b1cdbd2cSJim Jagielski MakeSummaryString = sTmpText 318*b1cdbd2cSJim JagielskiEnd Function 319*b1cdbd2cSJim Jagielski 320*b1cdbd2cSJim Jagielski 321*b1cdbd2cSJim JagielskiSub FillStep_Summary() 322*b1cdbd2cSJim Jagielski ImportDialogArea.Title = sTitle 323*b1cdbd2cSJim Jagielski With ImportDialog 324*b1cdbd2cSJim Jagielski .SummaryTextbox.Text = MakeSummaryString() 325*b1cdbd2cSJim Jagielski .cmdGoOn.Enabled = .SummaryTextbox.Text <> "" 326*b1cdbd2cSJim Jagielski .cmdGoOn.Label = sBeginButton 327*b1cdbd2cSJim Jagielski .SummaryHeaderLabel.Label = sSummaryHeader 328*b1cdbd2cSJim Jagielski .Step = 3 329*b1cdbd2cSJim Jagielski End With 330*b1cdbd2cSJim Jagielski ImportDialogArea.GetControl("SummaryHeaderLabel").SetFocus() 331*b1cdbd2cSJim JagielskiEnd Sub 332*b1cdbd2cSJim Jagielski 333*b1cdbd2cSJim Jagielski 334*b1cdbd2cSJim JagielskiSub FillStep_Progress() 335*b1cdbd2cSJim Jagielski With ImportDialog 336*b1cdbd2cSJim Jagielski .cmdBack.Enabled = False 337*b1cdbd2cSJim Jagielski .cmdGoOn.Enabled = False 338*b1cdbd2cSJim Jagielski .hlnProgress.Label = sProgressPage_1 339*b1cdbd2cSJim Jagielski .LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD 340*b1cdbd2cSJim Jagielski .LabelRetrieval.Label = sProgressPage_2 341*b1cdbd2cSJim Jagielski .LabelCurProgress.Label = sProgressPage_3 342*b1cdbd2cSJim Jagielski .LabelCurDocumentRetrieval.Label = "" 343*b1cdbd2cSJim Jagielski .LabelCurTemplateRetrieval.Label = "" 344*b1cdbd2cSJim Jagielski .LabelCurDocument.Label = "" 345*b1cdbd2cSJim Jagielski .Step = 4 346*b1cdbd2cSJim Jagielski End With 347*b1cdbd2cSJim Jagielski ImportDialogArea.GetControl("LabelRetrieval").SetFocus() 348*b1cdbd2cSJim Jagielski If ImportDialog.chkLogfile.State = 1 Then 349*b1cdbd2cSJim Jagielski ImportDialog.cmdShowLogFile.DefaultButton = True 350*b1cdbd2cSJim Jagielski End If 351*b1cdbd2cSJim JagielskiEnd Sub 352*b1cdbd2cSJim Jagielski 353*b1cdbd2cSJim Jagielski 354*b1cdbd2cSJim JagielskiSub GetFilterTracingLogPath(i as Integer, Index as Integer) 355*b1cdbd2cSJim JagielskiDim aNodePath(0) as new com.sun.star.beans.PropertyValue 356*b1cdbd2cSJim JagielskiDim oMasterKey 357*b1cdbd2cSJim JagielskiDim oImportKey 358*b1cdbd2cSJim JagielskiDim oWordKey 359*b1cdbd2cSJim JagielskiDim oExcelkey 360*b1cdbd2cSJim JagielskiDim oPowerpointKey 361*b1cdbd2cSJim JagielskiDim oFilterService 362*b1cdbd2cSJim Jagielski aNodePath(0).Name = "nodepath" 363*b1cdbd2cSJim Jagielski aNodePath(0).Value = "org.openoffice.Office.Tracing" 364*b1cdbd2cSJim Jagielski oFilterService = createUnoService("com.sun.star.util.FilterTracer") 365*b1cdbd2cSJim Jagielski bFilterTracingAvailable = Not IsNull(oFilterService) 366*b1cdbd2cSJim Jagielski If bFilterTracingAvailable Then 367*b1cdbd2cSJim Jagielski oMasterkey = GetRegistryKeyContent("org.openoffice.Office.Tracing/") 368*b1cdbd2cSJim Jagielski If oMasterKey.hasbyName("Import") Then 369*b1cdbd2cSJim Jagielski oImportKey = GetRegistryKeyContent("org.openoffice.Office.Tracing/Import") 370*b1cdbd2cSJim Jagielski bMSApplFilterTracingAvailable(i) = CheckMSImportAvailability(oImportkey, MSFiltername(Index, 4), FilterTracingLogPath(i), bTakeOverTargetName(i), bTakeOverPathName(i)) 371*b1cdbd2cSJim Jagielski End If 372*b1cdbd2cSJim Jagielski End If 373*b1cdbd2cSJim JagielskiEnd Sub 374*b1cdbd2cSJim Jagielski 375*b1cdbd2cSJim Jagielski 376*b1cdbd2cSJim JagielskiFunction CheckMSImportAvailability(oImportkey, MSApplName as String, MSLogPath as String, bTakeOverTargetname as String, bTakeOverpathName as String) as Boolean 377*b1cdbd2cSJim JagielskiDim bApplIsAvailable as Boolean 378*b1cdbd2cSJim JagielskiDim oApplKey 379*b1cdbd2cSJim JagielskiDim LocApplName as String 380*b1cdbd2cSJim JagielskiDim LocApplPath as String 381*b1cdbd2cSJim Jagielski bApplIsAvailable = oImportKey.hasbyName(MSApplName) 382*b1cdbd2cSJim Jagielski If bApplIsAvailable Then 383*b1cdbd2cSJim Jagielski oApplKey = oImportKey.getByName(MSApplName) 384*b1cdbd2cSJim Jagielski bApplIsAvailable = oApplKey.On 385*b1cdbd2cSJim Jagielski LocApplName = oApplKey.Name 386*b1cdbd2cSJim Jagielski LocApplPath = oApplKey.Path 387*b1cdbd2cSJim Jagielski bTakeOverTargetName = (LocApplName = "") 388*b1cdbd2cSJim Jagielski bTakeOverPathName = (LocApplPath = "") 389*b1cdbd2cSJim Jagielski MSLogPath = LocApplPath & "/" & LocApplName & ".log" 390*b1cdbd2cSJim Jagielski End If 391*b1cdbd2cSJim Jagielski CheckMSImportAvailability() = bApplIsAvailable 392*b1cdbd2cSJim JagielskiEnd Function 393*b1cdbd2cSJim Jagielski 394*b1cdbd2cSJim Jagielski 395*b1cdbd2cSJim Jagielski 396*b1cdbd2cSJim JagielskiSub SetupMSConfiguration() 397*b1cdbd2cSJim Jagielski iApplSection = 0 398*b1cdbd2cSJim Jagielski Wizardmode = SBMICROSOFTMODE 399*b1cdbd2cSJim Jagielski MaxApplCount = 3 400*b1cdbd2cSJim Jagielski ApplCount = 3 401*b1cdbd2cSJim Jagielski ' chkTemplatePath-Captions 402*b1cdbd2cSJim Jagielski GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox()) 403*b1cdbd2cSJim Jagielski ' DocumentCheckbox- Captions 404*b1cdbd2cSJim Jagielski GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox()) 405*b1cdbd2cSJim Jagielski 406*b1cdbd2cSJim Jagielski sKeyName(0) = "Software\Microsoft\Office\8.0\Word\Options" 407*b1cdbd2cSJim Jagielski sKeyName(1) = "Software\Microsoft\Office\8.0\Excel\Microsoft Excel" 408*b1cdbd2cSJim Jagielski sKeyName(2) = "Software\Microsoft\Office\8.0\PowerPoint\Recent Folder List\Default" 409*b1cdbd2cSJim Jagielski 410*b1cdbd2cSJim Jagielski sValueName(0) = "DOC-PATH" 411*b1cdbd2cSJim Jagielski sValueName(1) = "DefaultPath" 412*b1cdbd2cSJim Jagielski sValueName(2) = "" 413*b1cdbd2cSJim Jagielski 414*b1cdbd2cSJim Jagielski' See definition of Filtername-Array about meaning of fields 415*b1cdbd2cSJim Jagielski MSFilterName(0,0) = "doc|docx|docm" 416*b1cdbd2cSJim Jagielski MSFilterName(0,1) = "writer8|writer8|writer8" 417*b1cdbd2cSJim Jagielski MSFilterName(0,2) = "odt|odt|odt" 418*b1cdbd2cSJim Jagielski MSFilterName(0,3) = sMSDocumentCheckBox(0) 419*b1cdbd2cSJim Jagielski MSFilterName(0,4) = "Word" 420*b1cdbd2cSJim Jagielski 421*b1cdbd2cSJim Jagielski 422*b1cdbd2cSJim Jagielski MSFilterName(1,0) = "xls|xlsx|xlsm" 423*b1cdbd2cSJim Jagielski MSFilterName(1,1) = "calc8|calc8|calc8" 424*b1cdbd2cSJim Jagielski MSFilterName(1,2) = "ods|ods|ods" 425*b1cdbd2cSJim Jagielski MSFilterName(1,3) = sMSDocumentCheckBox(1) 426*b1cdbd2cSJim Jagielski MSFilterName(1,4) = "Excel" 427*b1cdbd2cSJim Jagielski 428*b1cdbd2cSJim Jagielski MSFilterName(2,0) = "ppt|pps|pptx|pptm" 429*b1cdbd2cSJim Jagielski MSFilterName(2,1) = "impress8|impress8|impress8|impress8" 430*b1cdbd2cSJim Jagielski MSFilterName(2,2) = "odp|odp|odp|odp" 431*b1cdbd2cSJim Jagielski MSFilterName(2,3) = sMSDocumentCheckBox(2) 432*b1cdbd2cSJim Jagielski MSFilterName(2,4) = "PowerPoint" 433*b1cdbd2cSJim Jagielski 434*b1cdbd2cSJim Jagielski MSFilterName(3,0) = "dot|dotx|dotm" 435*b1cdbd2cSJim Jagielski MSFilterName(3,1) = "writer8_template|writer8_template|writer8_template" 436*b1cdbd2cSJim Jagielski MSFilterName(3,2) = "ott|ott|ott" 437*b1cdbd2cSJim Jagielski MSFilterName(3,3) = sMSTemplateCheckBox(0) 438*b1cdbd2cSJim Jagielski MSFilterName(3,4) = "Word" 439*b1cdbd2cSJim Jagielski 440*b1cdbd2cSJim Jagielski MSFilterName(4,0) = "xlt|xltx|xltm" 441*b1cdbd2cSJim Jagielski MSFilterName(4,1) = "calc8_template|calc8_template|calc8_template" 442*b1cdbd2cSJim Jagielski MSFilterName(4,2) = "ots|ots|ots" 443*b1cdbd2cSJim Jagielski MSFilterName(4,3) = sMSTemplateCheckBox(1) 444*b1cdbd2cSJim Jagielski MSFilterName(4,4) = "Excel" 445*b1cdbd2cSJim Jagielski 446*b1cdbd2cSJim Jagielski MSFilterName(5,0) = "pot|potx|potm" 447*b1cdbd2cSJim Jagielski MSFilterName(5,1) = "impress8_template|impress8_template|impress8_template" 448*b1cdbd2cSJim Jagielski MSFilterName(5,2) = "otp|otp|otp" 449*b1cdbd2cSJim Jagielski MSFilterName(5,3) = sMSTemplateCheckBox(2) 450*b1cdbd2cSJim Jagielski MSFilterName(5,4) = "PowerPoint" 451*b1cdbd2cSJim JagielskiEnd Sub 452*b1cdbd2cSJim Jagielski 453*b1cdbd2cSJim Jagielski 454*b1cdbd2cSJim Jagielski 455*b1cdbd2cSJim Jagielski' This is an extract from "http://util.openoffice.org/source/browse/util/sot/source/base/exchange.cxx?rev=1.25&content-type=text/x-cvsweb-markup" 456*b1cdbd2cSJim Jagielski' about the listed defined mimetypes that are required to define binary StarOffice templates that have for all applications the same extension ".vor" 457*b1cdbd2cSJim Jagielski 458*b1cdbd2cSJim Jagielski' 26 SOT_FORMATSTR_ID_STARWRITER_30*/ { "application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\"", "StarWriter 3.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 459*b1cdbd2cSJim Jagielski' 27 SOT_FORMATSTR_ID_STARWRITER_40*/ { "application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\"", "StarWriter 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 460*b1cdbd2cSJim Jagielski' 28 SOT_FORMATSTR_ID_STARWRITER_50*/ { "application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\"", "StarWriter 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 461*b1cdbd2cSJim Jagielski 462*b1cdbd2cSJim Jagielski' 29 SOT_FORMATSTR_ID_STARWRITERWEB_40*/ { "application/x-openoffice-starwriterweb-40;windows_formatname=\"StarWriter/Web 4.0\"", "StarWriter/Web 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 463*b1cdbd2cSJim Jagielski' 30 SOT_FORMATSTR_ID_STARWRITERWEB_50*/ { "application/x-openoffice-starwriterweb-50;windows_formatname=\"StarWriter/Web 5.0\"", "StarWriter/Web 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 464*b1cdbd2cSJim Jagielski 465*b1cdbd2cSJim Jagielski' 31 SOT_FORMATSTR_ID_STARWRITERGLOB_40*/ { "application/x-openoffice-starwriterglob-40;windows_formatname=\"StarWriter/Global 4.0\"", "StarWriter/Global 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 466*b1cdbd2cSJim Jagielski' 32 SOT_FORMATSTR_ID_STARWRITERGLOB_50*/ { "application/x-openoffice-starwriterglob-50;windows_formatname=\"StarWriter/Global 5.0\"", "StarWriter/Global 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 467*b1cdbd2cSJim Jagielski 468*b1cdbd2cSJim Jagielski' 33 SOT_FORMATSTR_ID_STARDRAW*/ { "application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\"", "StarDrawDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 469*b1cdbd2cSJim Jagielski' 34 SOT_FORMATSTR_ID_STARDRAW_40*/ { "application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\"", "StarDrawDocument 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 470*b1cdbd2cSJim Jagielski' 36 SOT_FORMATSTR_ID_STARDRAW_50*/ { "application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\"", "StarDraw 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 471*b1cdbd2cSJim Jagielski 472*b1cdbd2cSJim Jagielski' 35 SOT_FORMATSTR_ID_STARIMPRESS_50*/ { "application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\"", "StarImpress 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 473*b1cdbd2cSJim Jagielski 474*b1cdbd2cSJim Jagielski' 37 SOT_FORMATSTR_ID_STARCALC*/ { "application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\"", "StarCalcDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 475*b1cdbd2cSJim Jagielski' 38 SOT_FORMATSTR_ID_STARCALC_40*/ { "application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\"", "StarCalc 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 476*b1cdbd2cSJim Jagielski' 39 SOT_FORMATSTR_ID_STARCALC_50*/ { "application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\"", "StarCalc 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 477*b1cdbd2cSJim Jagielski 478*b1cdbd2cSJim Jagielski' 40 SOT_FORMATSTR_ID_STARCHART*/ { "application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\"", "StarChartDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 479*b1cdbd2cSJim Jagielski' 41 SOT_FORMATSTR_ID_STARCHART_40*/ { "application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\"", "StarChartDocument 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 480*b1cdbd2cSJim Jagielski' 42 SOT_FORMATSTR_ID_STARCHART_50*/ { "application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\"", "StarChart 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 481*b1cdbd2cSJim Jagielski 482*b1cdbd2cSJim Jagielski' 46 SOT_FORMATSTR_ID_STARMATH*/ { "application/x-openoffice-starmath;windows_formatname=\"StarMath\"", "StarMath", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 483*b1cdbd2cSJim Jagielski' 47 SOT_FORMATSTR_ID_STARMATH_40*/ { "application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\"", "StarMathDocument 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 484*b1cdbd2cSJim Jagielski' 48 SOT_FORMATSTR_ID_STARMATH_50*/ { "application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\"", "StarMath 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) }, 485*b1cdbd2cSJim Jagielski 486*b1cdbd2cSJim Jagielski 487*b1cdbd2cSJim JagielskiSub SetupXMLConfiguration() 488*b1cdbd2cSJim Jagielski iApplSection = 1000 489*b1cdbd2cSJim Jagielski Wizardmode = SBXMLMODE 490*b1cdbd2cSJim Jagielski ApplCount = 4 491*b1cdbd2cSJim Jagielski MaxApplCount = 4 492*b1cdbd2cSJim Jagielski XMLTemplateList = Array("vor", "sti", "stw" , "stc" , "std") 493*b1cdbd2cSJim Jagielski ' chkTemplatePath-Captions 494*b1cdbd2cSJim Jagielski GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox()) 495*b1cdbd2cSJim Jagielski ' DocumentCheckbox- Captions 496*b1cdbd2cSJim Jagielski GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox()) 497*b1cdbd2cSJim Jagielski 498*b1cdbd2cSJim Jagielski XMLFilterName(0,0) = "sdw|sxw" 499*b1cdbd2cSJim Jagielski XMLFilterName(0,1) = "writer8|writer8" 500*b1cdbd2cSJim Jagielski XMLFilterName(0,2) = "odt|odt" 501*b1cdbd2cSJim Jagielski XMLFilterName(0,3) = sDocumentCheckBox(0) 502*b1cdbd2cSJim Jagielski 503*b1cdbd2cSJim Jagielski XMLFilterName(1,0) = "sdc|sxc" 504*b1cdbd2cSJim Jagielski XMLFilterName(1,1) = "calc8|calc8" 505*b1cdbd2cSJim Jagielski XMLFilterName(1,2) = "ods|ods" 506*b1cdbd2cSJim Jagielski XMLFilterName(1,3) = sDocumentCheckBox(1) 507*b1cdbd2cSJim Jagielski 508*b1cdbd2cSJim Jagielski If oFactoryKey.HasByName("com.sun.star.drawing.DrawingDocument") and oFactoryKey.HasByName("com.sun.star.presentation.PresentationDocument") Then 509*b1cdbd2cSJim Jagielski XMLFilterName(2,0) = "sdd|sda|sxi|sxd" 510*b1cdbd2cSJim Jagielski XMLFilterName(2,1) = "impress8|draw8|impress8|draw8" 511*b1cdbd2cSJim Jagielski XMLFilterName(2,2) = "odp|odg|odp|odg" 512*b1cdbd2cSJim Jagielski Elseif oFactoryKey.HasByName("com.sun.star.drawing.DrawingDocument") Then 513*b1cdbd2cSJim Jagielski XMLFilterName(2,0) = "sda|sxd" 514*b1cdbd2cSJim Jagielski XMLFilterName(2,1) = "draw8|draw8" 515*b1cdbd2cSJim Jagielski XMLFilterName(2,2) = "odg|odg" 516*b1cdbd2cSJim Jagielski Elseif oFactoryKey.HasByName("com.sun.star.presentation.PresentationDocument") Then 517*b1cdbd2cSJim Jagielski XMLFilterName(2,0) = "sdd|sxi" 518*b1cdbd2cSJim Jagielski XMLFilterName(2,1) = "impress8|impress8" 519*b1cdbd2cSJim Jagielski XMLFilterName(2,2) = "odp|odp" 520*b1cdbd2cSJim Jagielski End If 521*b1cdbd2cSJim Jagielski XMLFilterName(2,3) = sDocumentCheckBox(2) 522*b1cdbd2cSJim Jagielski 523*b1cdbd2cSJim Jagielski 524*b1cdbd2cSJim Jagielski XMLFilterName(3,0) = "smf|sxm" 525*b1cdbd2cSJim Jagielski XMLFilterName(3,1) = "math8|math8" 526*b1cdbd2cSJim Jagielski XMLFilterName(3,2) = "odf|odf" 527*b1cdbd2cSJim Jagielski XMLFilterName(3,3) = sDocumentCheckBox(3) 528*b1cdbd2cSJim Jagielski 529*b1cdbd2cSJim Jagielski XMLFilterName(4,0) = "application/x-openoffice-starwriter|application/vnd.stardivision.writer/web|application/vnd.sun.xml.writer|application/vnd.sun.xml.writerweb" 530*b1cdbd2cSJim Jagielski XMLFilterName(4,1) = "writer8_template|writerweb8_writer_template|writer8_template|writerweb8_writer_template" 531*b1cdbd2cSJim Jagielski XMLFilterName(4,2) = "ott|oth|ott|oth" 532*b1cdbd2cSJim Jagielski XMLFilterName(4,3) = sTemplateCheckBox(0) 533*b1cdbd2cSJim Jagielski 534*b1cdbd2cSJim Jagielski 535*b1cdbd2cSJim Jagielski XMLFilterName(5,0) = "application/x-openoffice-starcalc|application/vnd.sun.xml.calc" 536*b1cdbd2cSJim Jagielski XMLFilterName(5,1) = "calc8_template|calc8_template" 537*b1cdbd2cSJim Jagielski XMLFilterName(5,2) = "ots|ots" 538*b1cdbd2cSJim Jagielski XMLFilterName(5,3) = sTemplateCheckBox(1) 539*b1cdbd2cSJim Jagielski 540*b1cdbd2cSJim Jagielski ' due to bug #108942# impress templates of the version 4.0 have to be handled in a special way because their mimetype 541*b1cdbd2cSJim Jagielski ' falsely points to the draw application. 542*b1cdbd2cSJim Jagielski If oFactoryKey.HasByName("com.sun.star.drawing.DrawingDocument") and oFactoryKey.HasByName("com.sun.star.presentation.PresentationDocument") Then 543*b1cdbd2cSJim Jagielski XMLFilterName(6,0) = "application/x-openoffice-starimpress|application/x-openoffice-stardraw-40|application/x-openoffice-stardraw|application/vnd.sun.xml.impress|application/vnd.sun.xml.draw" 544*b1cdbd2cSJim Jagielski XMLFilterName(6,1) = "impress8_template|impress8_template|draw8_template|impress8_template|draw8_template" 545*b1cdbd2cSJim Jagielski XMLFilterName(6,2) = "otp|otp|otg|otp|otg" 546*b1cdbd2cSJim Jagielski Elseif oFactoryKey.HasByName("com.sun.star.drawing.DrawingDocument") Then 547*b1cdbd2cSJim Jagielski XMLFilterName(6,0) = "application/x-openoffice-stardraw|application/vnd.sun.xml.draw" 548*b1cdbd2cSJim Jagielski XMLFilterName(6,1) = "draw8_template|draw8_template" 549*b1cdbd2cSJim Jagielski XMLFilterName(6,2) = "otg|otg" 550*b1cdbd2cSJim Jagielski Elseif oFactoryKey.HasByName("com.sun.star.presentation.PresentationDocument") Then 551*b1cdbd2cSJim Jagielski XMLFilterName(6,0) = "application/x-openoffice-starimpress|application/x-openoffice-stardraw-40|application/vnd.sun.xml.impress" 552*b1cdbd2cSJim Jagielski XMLFilterName(6,1) = "impress8_template|impress8_template|impress8_template" 553*b1cdbd2cSJim Jagielski XMLFilterName(6,2) = "otp|otp|otp" 554*b1cdbd2cSJim Jagielski End If 555*b1cdbd2cSJim Jagielski XMLFilterName(6,3) = sTemplateCheckBox(2) 556*b1cdbd2cSJim Jagielski 557*b1cdbd2cSJim Jagielski If oFactoryKey.HasByName("com.sun.star.text.GlobalDocument") Then 558*b1cdbd2cSJim Jagielski XMLFilterName(7,0) = "sgl|sxg" 559*b1cdbd2cSJim Jagielski XMLFilterName(7,1) = "writerglobal8|writerglobal8" 560*b1cdbd2cSJim Jagielski XMLFilterName(7,2) = "odm|odm" 561*b1cdbd2cSJim Jagielski XMLFilterName(7,3) = sTemplateCheckBox(3) 562*b1cdbd2cSJim Jagielski End If 563*b1cdbd2cSJim JagielskiEnd Sub 564*b1cdbd2cSJim Jagielski 565*b1cdbd2cSJim Jagielski 566*b1cdbd2cSJim JagielskiFunction CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean) 567*b1cdbd2cSJim JagielskiDim sPath as String 568*b1cdbd2cSJim Jagielski If Not bDoEnable Then 569*b1cdbd2cSJim Jagielski CheckControlPath = False 570*b1cdbd2cSJim Jagielski ElseIf oCheckbox.State = 0 Then 571*b1cdbd2cSJim Jagielski CheckControlPath = True 572*b1cdbd2cSJim Jagielski Else 573*b1cdbd2cSJim Jagielski sPath = ConvertToUrl(Trim(oTextBox.Text) 574*b1cdbd2cSJim Jagielski CheckControlPath = oUcb.Exists(sPath) 575*b1cdbd2cSJim Jagielski End If 576*b1cdbd2cSJim JagielskiEnd Function 577*b1cdbd2cSJim Jagielski 578*b1cdbd2cSJim Jagielski 579*b1cdbd2cSJim JagielskiFunction CheckInputPaths() as Boolean 580*b1cdbd2cSJim JagielskiDim bChangePage as Boolean 581*b1cdbd2cSJim Jagielski bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateImportPath, True, False, sTitle, False) 582*b1cdbd2cSJim Jagielski bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateExportPath, bChangePage, True, sTitle, False) 583*b1cdbd2cSJim Jagielski bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentImportPath, bChangePage, False, sTitle, False) 584*b1cdbd2cSJim Jagielski bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentExportPath, bChangePage, True, sTitle, False) 585*b1cdbd2cSJim Jagielski CheckInputPaths = bChangePage 586*b1cdbd2cSJim JagielskiEnd Function 587*b1cdbd2cSJim Jagielski 588*b1cdbd2cSJim Jagielski 589*b1cdbd2cSJim JagielskiFunction CheckTextBoxPath(oTextBox as Object, ByVal bCheck as Boolean, bCreateNew as Boolean, sTitle as String, bgetResources as Boolean) as Boolean 590*b1cdbd2cSJim JagielskiDim iCreate as Integer 591*b1cdbd2cSJim JagielskiDim sQueryMessage as String 592*b1cdbd2cSJim JagielskiDim sUrlPath as String 593*b1cdbd2cSJim JagielskiDim sMessageNoDir as String 594*b1cdbd2cSJim JagielskiDim sShowPath as String 595*b1cdbd2cSJim JagielskiDim oLocUcb as Object 596*b1cdbd2cSJim Jagielski oLocUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") 597*b1cdbd2cSJim Jagielski If bGetResources Then 598*b1cdbd2cSJim Jagielski If InitResources("ImportWizard","imp") then 599*b1cdbd2cSJim Jagielski sNoDirCreation = GetResText(1050) 600*b1cdbd2cSJim Jagielski sMsgDirNotThere = GetResText(1051) 601*b1cdbd2cSJim Jagielski sQueryForNewCreation = GetResText(1052) 602*b1cdbd2cSJim Jagielski Else 603*b1cdbd2cSJim Jagielski CheckTextBoxPath() = False 604*b1cdbd2cSJim Jagielski Exit Function 605*b1cdbd2cSJim Jagielski End If 606*b1cdbd2cSJim Jagielski End If 607*b1cdbd2cSJim Jagielski If oTextBox.Enabled Then 608*b1cdbd2cSJim Jagielski If bCheck Then 609*b1cdbd2cSJim Jagielski sShowPath = oTextBox.Text 610*b1cdbd2cSJim Jagielski sUrlPath = ConvertToUrl(sShowPath) 611*b1cdbd2cSJim Jagielski If Not oLocUcb.Exists(sUrlPath) Then 612*b1cdbd2cSJim Jagielski If Not bCreateNew Then 613*b1cdbd2cSJim Jagielski ' Sourcedirectories must be existing, Targetdirectories may be created new 614*b1cdbd2cSJim Jagielski sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,"%1") 615*b1cdbd2cSJim Jagielski Msgbox(sQueryMessage,16,sTitle) 616*b1cdbd2cSJim Jagielski CheckTextBoxPath() = False 617*b1cdbd2cSJim Jagielski Exit Function 618*b1cdbd2cSJim Jagielski Else 619*b1cdbd2cSJim Jagielski sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,"%1") 620*b1cdbd2cSJim Jagielski sQueryMessage = sQueryMessage & Chr(13) & sQueryForNewCreation 621*b1cdbd2cSJim Jagielski iCreate = Msgbox (sQueryMessage, 36, sTitle) 622*b1cdbd2cSJim Jagielski If iCreate = 6 Then 623*b1cdbd2cSJim Jagielski On Local Error Goto NOVALIDPATH 624*b1cdbd2cSJim Jagielski CreateFolder(sUrlPath) 625*b1cdbd2cSJim Jagielski If Not oLocUcb.Exists(sUrlPath) Then 626*b1cdbd2cSJim Jagielski Goto NOVALIDPATH 627*b1cdbd2cSJim Jagielski End If 628*b1cdbd2cSJim Jagielski Else 629*b1cdbd2cSJim Jagielski CheckTextBoxPath() = False 630*b1cdbd2cSJim Jagielski Exit Function 631*b1cdbd2cSJim Jagielski End If 632*b1cdbd2cSJim Jagielski End If 633*b1cdbd2cSJim Jagielski End If 634*b1cdbd2cSJim Jagielski CheckTextBoxPath() = True 635*b1cdbd2cSJim Jagielski Else 636*b1cdbd2cSJim Jagielski CheckTextBoxPath() = False 637*b1cdbd2cSJim Jagielski End If 638*b1cdbd2cSJim Jagielski Else 639*b1cdbd2cSJim Jagielski CheckTextBoxPath() = True 640*b1cdbd2cSJim Jagielski End If 641*b1cdbd2cSJim Jagielski Exit Function 642*b1cdbd2cSJim JagielskiNOVALIDPATH: 643*b1cdbd2cSJim Jagielski sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath, "%1") 644*b1cdbd2cSJim Jagielski Msgbox(sMessageNoDir, 16, sTitle) 645*b1cdbd2cSJim Jagielski CheckTextBoxPath() = False 646*b1cdbd2cSJim JagielskiEnd Function 647*b1cdbd2cSJim Jagielski 648*b1cdbd2cSJim Jagielski 649*b1cdbd2cSJim JagielskiSub InitializeProgressPage(oDialog as Object) 650*b1cdbd2cSJim Jagielski oDialog.LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL 651*b1cdbd2cSJim Jagielski oDialog.LabelCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD 652*b1cdbd2cSJim JagielskiEnd Sub 653*b1cdbd2cSJim Jagielski 654*b1cdbd2cSJim Jagielski 655*b1cdbd2cSJim JagielskiSub SetProgressDisplay(AbsFound as Integer) 656*b1cdbd2cSJim Jagielski ImportDialog.LabelRetrieval.Label = sProgressPage_2 & " " & ReplaceString(sProgressPage_5, Str(AbsFound) & " ", "%1") 657*b1cdbd2cSJim Jagielski ImportDialog.LabelCurDocumentRetrieval.Label = sProgressFound & " " & CStr(AbsDocuFound) & " " & sProgressMoreDocs 658*b1cdbd2cSJim Jagielski ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound & " " & CStr(AbsTemplateFound) & " " & sProgressMoreTemplates 659*b1cdbd2cSJim JagielskiEnd Sub 660*b1cdbd2cSJim Jagielski 661*b1cdbd2cSJim JagielskiSub TakoverFolderName(aEvent as Object) 662*b1cdbd2cSJim JagielskiDim RefControlName as String 663*b1cdbd2cSJim JagielskiDim oRefControl 664*b1cdbd2cSJim Jagielski RefControlName = aEvent.Source.Model.Tag 665*b1cdbd2cSJim Jagielski oRefControl = ImportDialogArea.GetControl(RefControlName) 666*b1cdbd2cSJim Jagielski GetFolderName(oRefControl.Model) 667*b1cdbd2cSJim Jagielski ToggleNextButton() 668*b1cdbd2cSJim JagielskiEnd Sub 669*b1cdbd2cSJim Jagielski 670*b1cdbd2cSJim Jagielski 671*b1cdbd2cSJim JagielskiSub FinalizeDialogButtons() 672*b1cdbd2cSJim Jagielski ImportDialog.cmdShowLogFile.Enabled = ((Isnull(oLogDocument) = False) And (ImportDialog.chkLogfile.State = 1)) 673*b1cdbd2cSJim Jagielski ImportDialog.cmdCancel.Enabled = False 674*b1cdbd2cSJim Jagielski ImportDialog.cmdGoOn.Label = sCloseButton 675*b1cdbd2cSJim Jagielski ImportDialog.cmdGoOn.Enabled = True 676*b1cdbd2cSJim JagielskiEnd Sub 677*b1cdbd2cSJim Jagielski</script:module> 678