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