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