更新windows内置office目录名, 适配jodconverter

This commit is contained in:
陈精华
2022-12-19 14:45:45 +08:00
parent 7d3a4ebc4e
commit d761d0cc88
12504 changed files with 3 additions and 3 deletions

View File

@@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="API" script:language="StarBasic">Declare Function RegOpenKeyEx Lib &quot;advapi32.dll&quot; Alias &quot;RegOpenKeyExA&quot; _
(ByVal hKey As Long, _
ByVal lpSubKey As String, _
ByVal ulOptions As Long, _
ByVal samDesired As Long, _
phkResult As Long) As Long
Declare Function RegQueryValueExString Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; _
(ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As String, _
lpcbData As Long) As Long
Declare Function RegQueryValueExLong Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; _
(ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As Long, _
lpcbData As Long) As Long
Declare Function RegQueryValueExNULL Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; _
(ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
ByVal lpData As Long, _
lpcbData As Long) As Long
Declare Function RegCloseKeyA Lib &quot;advapi32.dll&quot; Alias &quot;RegCloseKey&quot; _
(ByVal hKey As Long) As Long
Public Const HKEY_CLASSES_ROOT = &amp;H80000000
Public Const HKEY_CURRENT_USER = &amp;H80000001
Public Const HKEY_LOCAL_MACHINE = &amp;H80000002
Public Const HKEY_USERS = &amp;H80000003
Public Const KEY_ALL_ACCESS = &amp;H3F
Public Const REG_OPTION_NON_VOLATILE = 0
Public Const REG_SZ As Long = 1
Public Const REG_DWORD As Long = 4
Public Const ERROR_NONE = 0
Public Const ERROR_BADDB = 1
Public Const ERROR_BADKEY = 2
Public Const ERROR_CANTOPEN = 3
Public Const ERROR_CANTREAD = 4
Public Const ERROR_CANTWRITE = 5
Public Const ERROR_OUTOFMEMORY = 6
Public Const ERROR_INVALID_PARAMETER = 7
Public Const ERROR_ACCESS_DENIED = 8
Public Const ERROR_INVALID_PARAMETERS = 87
Public Const ERROR_NO_MORE_ITEMS = 259
&apos;Public Const KEY_READ = &amp;H20019
Function OpenRegKey(lBaseKey As Long, sKeyName As String) As Variant
Dim LocKeyValue
Dim hKey as Long
Dim lRetValue as Long
lRetValue = RegOpenKeyEx(lBaseKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
&apos; lRetValue = QueryValue(HKEY_LOCAL_MACHINE, &quot;SOFTWARE\Microsoft\Outlook Express\5.0\Default Settings&quot;, &quot;Revocation Checking&quot;)
If hKey &lt;&gt; 0 Then
RegCloseKeyA (hKey)
End If
OpenRegKey() = lRetValue
End Function
Function GetDefaultPath(CurOffice as Integer) As String
Dim sPath as String
Dim Index as Integer
Select Case Wizardmode
Case SBMICROSOFTMODE
Index = Applications(CurOffice,SBAPPLKEY)
If GetGUIType = 1 Then &apos; Windows
sPath = QueryValue(HKEY_LOCAL_MACHINE, sKeyName(Index), sValueName(Index))
Else
sPath = &quot;&quot;
End If
If sPath = &quot;&quot; Then
sPath = SOWorkPath
End If
GetDefaultPath = sPath
End Select
End Function
Function GetTemplateDefaultPath(Index as Integer) As String
Dim sLocTemplatePath as String
Dim sLocProgrampath as String
Dim Progstring as String
Dim PathList()as String
Dim Maxindex as Integer
Dim OldsLocTemplatePath
Dim sTemplateKeyName as String
Dim sTemplateValueName as String
On Local Error Goto NOVAlIDSYSTEMPATH
Select Case WizardMode
Case SBMICROSOFTMODE
If GetGUIType = 1 Then &apos; Windows
&apos; Template directory of Office 97
sTemplateKeyName = &quot;Software\Microsoft\Office\8.0\Common\FileNew\LocalTemplates&quot;
sTemplateValueName = &quot;&quot;
sLocTemplatePath = QueryValue(HKEY_LOCAL_MACHINE, sTemplateKeyName, sTemplateValueName)
If sLocTemplatePath = &quot;&quot; Then
&apos; Retrieve the template directory of Office 2000
&apos; Unfortunately there is no existing note about the template directory in
&apos; the whole registry.
&apos; Programdirectory of Office 2000
sTemplateKeyName = &quot;Software\Microsoft\Office\9.0\Common\InstallRoot&quot;
sTemplateValueName = &quot;Path&quot;
sLocProgrampath = QueryValue(HKEY_LOCAL_MACHINE, sTemplateKeyName, sTemplateValueName)
If sLocProgrampath &lt;&gt; &quot;&quot; Then
If Right(sLocProgrampath, 1) &lt;&gt; &quot;\&quot; Then
sLocProgrampath = sLocProgrampath &amp; &quot;\&quot;
End If
PathList() = ArrayoutofString(sLocProgrampath,&quot;\&quot;,Maxindex)
Progstring = &quot;\&quot; &amp; PathList(Maxindex-1) &amp; &quot;\&quot;
OldsLocTemplatePath = DeleteStr(sLocProgramPath,Progstring)
sLocTemplatePath = OldsLocTemplatePath &amp; &quot;\&quot; &amp; &quot;Templates&quot;
&apos; Does this subdirectory &quot;templates&quot; exist at all
If oUcb.Exists(sLocTemplatePath) Then
&apos; If Not the main directory of the office is the base
sLocTemplatePath = OldsLocTemplatePath
End If
Else
sLocTemplatePath = SOWorkPath
End If
End If
GetTemplateDefaultPath = ConvertToUrl(sLocTemplatePath)
Else
GetTemplateDefaultPath = SOWorkPath
End If
End Select
NOVALIDSYSTEMPATH:
If Err &lt;&gt; 0 Then
GetTemplateDefaultPath() = SOWorkPath
Resume ONITGOES
ONITGOES:
End If
End Function
Function QueryValueEx(ByVal lhKey, ByVal szValueName As String, vValue As String) As Long
Dim cch As Long
Dim lrc As Long
Dim lType As Long
Dim lValue As Long
Dim sValue As String
Dim Empty
On Error GoTo QueryValueExError
lrc = RegQueryValueExNULL(lhKey, szValueName, 0&amp;, lType, 0&amp;, cch)
If lrc &lt;&gt; ERROR_NONE Then Error 5
Select Case lType
Case REG_SZ:
sValue = String(cch, 0)
lrc = RegQueryValueExString(lhKey, szValueName, 0&amp;, lType, sValue, cch)
If lrc = ERROR_NONE Then
vValue = Left$(sValue, cch)
Else
vValue = Empty
End If
Case REG_DWORD:
lrc = RegQueryValueExLong(lhKey, szValueName, 0&amp;, lType, lValue, cch)
If lrc = ERROR_NONE Then
vValue = lValue
End If
Case Else
lrc = -1
End Select
QueryValueExExit:
QueryValueEx = lrc
Exit Function
QueryValueExError:
Resume QueryValueExExit
End Function
Function QueryValue(BaseKey As Long, sKeyName As String, sValueName As String) As Variant
Dim lRetVal As Long &apos; Returnvalue API-Call
Dim hKey As Long &apos; One key handle
Dim vValue As String &apos; Key value
lRetVal = RegOpenKeyEx(BaseKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
lRetVal = QueryValueEx(hKey, sValueName, vValue)
RegCloseKeyA (hKey)
QueryValue = vValue
End Function
</script:module>

View File

@@ -0,0 +1,484 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DialogModul" script:language="StarBasic">Option Explicit
Public Const bDebugWizard = True
Public Const SBFIRSTAPPLCHECKED = 0
Public Const SBSECONDAPPLCHECKED = 1
Public Const SBTHIRDAPPLCHECKED = 2
Public Const SBFOURTHAPPLCHECKED = 3
Public WizardMode as String
Public Const SBMICROSOFTMODE = &quot;MS&quot;
&apos; The absolute maximal Number of possible Applications
Public Const SBMAXAPPLCOUNT = 4
Public Const Twip = 425
Public MaxApplCount as Integer
Public CurOffice As Integer
Public SOBitmapPath As String
Public SOWorkPath As String
Public SOTemplatePath as String
Public bCancelTask As Boolean
Public bDoKeepApplValues as Boolean
Public oUcb as Object
Public PathSeparator as String
Public ApplCount as Integer
Public sKeyName(SBMAXAPPLCOUNT-1) as String
Public sValueName(SBMAXAPPLCOUNT-1) as String
Public sCRLF as String
Public MSFilterName(5,4) as String
Public Applications(SBMAXAPPLCOUNT-1,9)
Public Const SBAPPLCONVERT = 0
Public Const SBDOCCONVERT = 1
Public Const SBDOCRECURSIVE = 2
Public Const SBDOCSOURCE = 3
Public Const SBDOCTARGET = 4
Public Const SBTEMPLCONVERT = 5
Public Const SBTEMPLRECURSIVE = 6
Public Const SBTEMPLSOURCE = 7
Public Const SBTEMPLTARGET = 8
Public Const SBAPPLKEY = 9
Public XMLTemplateList()
&apos; Application-relating Data are stored in this Array
&apos; according to the following structure:
&apos; Applications(X,0) = True/False (Application is to be converted)
&apos; Applications(X,1) = True/False (Documents are to be converted)
&apos; Applications(X,2) = True/False (Including Subdirectories)
&apos; Applications(X,3) = &quot;File:///...&quot; (SourceUrl of the documents)
&apos; Applications(X,4) = &quot;File///:...&quot; (TargetUrl of the documents)
&apos; Applications(X,5) = True/False (Templates are to be converted)
&apos; Applications(X,6) = True/False (Including Subdirectories)
&apos; Applications(X,7) = &quot;File:///...&quot; (SourceUrl of the templates)
&apos; Applications(X,8) = &quot;File:///...&quot; (TargetUrl of the templates)
&apos; Applications(X,9) = 0 (Key to the original Index of the Applications)
Sub FillStep_Welcome()
Dim i as Integer
&apos; bDoKeepApplValues = False
ImportDialogArea.Title = sTitle
With ImportDialog
.cmdHelp.Label = sHelpButton
.cmdCancel.Label = sCancelButton
.cmdBack.Label = sBackButton
.cmdGoOn.Label = sNextButton
.WelcomeTextLabel.Label = sWelcomeTextLabel1
.WelcomeTextLabel3.Label = sWelcomeTextLabel3
.optMSDocuments.Label = sContainerName(0)
.chkMSApplication1.Label = sMsDocumentCheckbox(0)
.chkMSApplication2.Label = sMsDocumentCheckbox(1)
.chkMSApplication3.Label = sMsDocumentCheckbox(2)
.cmdBack.Enabled = False
.Step = 1
If Not oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;) Then
.chkLogfile.State = 0
.chkLogfile.Enabled = False
End If
End With
CheckModuleInstallation()
ToggleNextButton()
End Sub
Sub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean)
Dim Index as Integer
Dim oNullObject as Object
If bStartup And Not bDoKeepApplValues Then
If ImportDialog.optMSDocuments.State = 1 Then
SetupMSConfiguration()
Else
&apos;Not supposed to happen - is there an assert in BASIC...
End If
FillUpApplicationList()
End If
CurOffice = OfficeIndex
Index = Applications(CurOffice,SBAPPLKEY)
InitializePathsforCurrentApplication(Index)
With ImportDialog
.chkTemplatePath.Label = sTemplateCheckbox(Index)
.chkDocumentPath.State = Abs(Applications(CurOffice,SBDOCCONVERT))
.chkDocumentSearchSubDir.State = Abs(Applications(CurOffice,SBDOCRECURSIVE))
.txtDocumentImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCSOURCE))
.txtDocumentExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCTARGET))
.hlnDocuments.Label = sProgressMoreDocs
If WizardMode = SBMICROSOFTMODE Then
ImportDialogArea.Title = sTitle &amp; &quot; - &quot; &amp; sMSDocumentCheckBox(Index)
End If
.chkTemplatePath.Enabled = True
.chkDocumentPath.Enabled = True
.chkTemplatePath.Label = sTemplateCheckbox(Index)
.chkDocumentPath.Label = sDocumentCheckbox(Index)
.hlnTemplates.Label = sProgressMoreTemplates
.chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT))
ToggleInputPaths(oNullObject,&quot;Template&quot;)
ToggleInputPaths(oNullObject,&quot;Document&quot;)
.chkTemplateSearchSubDir.State = Abs(Applications(CurOffice,SBTEMPLRECURSIVE))
.txtTemplateImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLSOURCE))
.txtTemplateExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLTARGET))
.cmdGoOn.Label = sNextButton
.cmdBack.Enabled = True
ImportDialog.Step = 2
End With
ImportDialogArea.GetControl(&quot;chkTemplatePath&quot;).SetFocus()
ToggleNextButton()
End Sub
Sub FillUpApplicationList()
Dim i as Integer
Dim a as Integer
Dim BoolValue as Boolean
If Not bDoKeepApplValues Then
a = 0
For i = 1 To ApplCount
If ImportDialog.optMSDocuments.State = 1 Then
BoolValue = ImportDialogArea.GetControl(&quot;chkMSApplication&quot; &amp; i).Model.State = 1
End If
Applications(a,SBAPPLCONVERT) = BoolValue
Applications(a,SBDOCCONVERT) = BoolValue
Applications(a,SBDOCRECURSIVE) = BoolValue
Applications(a,SBDOCSOURCE) = &quot;&quot; &apos; GetDefaultPath(i)
Applications(a,SBDOCTARGET) = &quot;&quot; &apos; SOWorkPath
Applications(a,SBTEMPLCONVERT) = BoolValue
Applications(a,SBTEMPLRECURSIVE) = BoolValue
Applications(a,SBTEMPLSOURCE) = &quot;&quot; &apos; GetTemplateDefaultPath(i)
Applications(a,SBTEMPLTARGET) = &quot;&quot; &apos; GetTargetTemplatePath(i)
Applications(a,SBAPPLKEY) = i-1
If BoolValue Then
a = a + 1
End If
Next i
ApplCount = a
End If
End Sub
Sub InitializePathsforCurrentApplication(i as Integer)
AssignPathToCurrentApplication(SBDOCSOURCE, GetDefaultPath(i))
AssignPathToCurrentApplication(SBDOCTARGET, SOWorkPath)
AssignPathToCurrentApplication(SBTEMPLSOURCE, GetTemplateDefaultPath(i))
AssignPathToCurrentApplication(SBTEMPLTARGET, GetTargetTemplatePath(i))
End Sub
Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String)
If Applications(CurOffice,Index) = &quot;&quot; Then
If CurOffice &gt; 0 Then
Applications(CurOffice,Index) = Applications(CurOffice-1,Index)
Else
Applications(CurOffice,Index) = NewPath
End If
End If
End Sub
Sub SaveStep_InputPath()
Applications(CurOffice,SBDOCCONVERT) = ImportDialog.chkDocumentPath.State = 1
Applications(CurOffice,SBDOCRECURSIVE) = ImportDialog.chkDocumentSearchSubDir.State = 1
Applications(CurOffice,SBDOCSOURCE) = ConvertToURL(ImportDialog.txtDocumentImportPath.Text)
Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.txtDocumentExportPath.Text)
Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.chkTemplatePath.State = 1
Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.chkTemplateSearchSubDir.State = 1
Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.txtTemplateImportPath.Text)
Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.txtTemplateExportPath.Text)
End Sub
Sub ToggleInputPaths(aEvent as Object, Optional sDocType)
Dim bDoEnable as Boolean
Dim sLocDocType as String
Dim oCheckBox as Object
If Not IsNull(aEvent) Then
sLocDocType = aEvent.Source.Model.Tag
Else
sLocDocType = sDocType
End If
With ImportDialogArea
oCheckBox = .GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;Path&quot;).Model
bDoEnable = oCheckBox.State = 1 And oCheckBox.Enabled
.GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
.GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
.GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ImportPath&quot;).Model.Enabled = bDoEnable
.GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ExportPath&quot;).Model.Enabled = bDoEnable
.GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;SearchSubDir&quot;).Model.Enabled = bDoEnable
.GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
.GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
End With
ToggleNextButton()
End Sub
Function MakeSummaryString()
Dim sTmpText As String
Dim i as Integer
Dim Index as Integer
Dim sAddText as String
For i = 0 To ApplCount -1
Index = Applications(i,SBAPPLKEY)
If Applications(i,SBTEMPLCONVERT) Then
&apos; Templates are to be converted
sAddText = &quot;&quot;
If WizardMode = SBMICROSOFTMODE Then
sAddText = sSumMSTemplates(Index) &amp; sCRLF
End If
sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBTEMPLSOURCE)) &amp; sCRLF
If Applications(i,SBTEMPLRECURSIVE) Then
&apos; Including Subdirectories
sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
End If
sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBTEMPLTARGET)) &amp; sCRLF
sTmpText = sTmpText &amp; sCRLF
End If
If Applications(i,SBDOCCONVERT) Then
&apos; Documents are to be converted
If WizardMode = SBMICROSOFTMODE Then
sAddText = sSumMSDocuments(Index) &amp; sCRLF
End If
sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBDOCSOURCE)) &amp; sCRLF
If Applications(i,SBDOCRECURSIVE) Then
&apos; Including Subdirectories
sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
End If
sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBDOCTARGET)) &amp; sCRLF
sTmpText = sTmpText &amp; sCRLF
End If
Next i
MakeSummaryString = sTmpText
End Function
Sub FillStep_Summary()
ImportDialogArea.Title = sTitle
With ImportDialog
.SummaryTextbox.Text = MakeSummaryString()
.cmdGoOn.Enabled = .SummaryTextbox.Text &lt;&gt; &quot;&quot;
.cmdGoOn.Label = sBeginButton
.SummaryHeaderLabel.Label = sSummaryHeader
.Step = 3
End With
ImportDialogArea.GetControl(&quot;SummaryHeaderLabel&quot;).SetFocus()
End Sub
Sub FillStep_Progress()
With ImportDialog
.cmdBack.Enabled = False
.cmdGoOn.Enabled = False
.hlnProgress.Label = sProgressPage_1
.LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD
.LabelRetrieval.Label = sProgressPage_2
.LabelCurProgress.Label = sProgressPage_3
.LabelCurDocumentRetrieval.Label = &quot;&quot;
.LabelCurTemplateRetrieval.Label = &quot;&quot;
.LabelCurDocument.Label = &quot;&quot;
.Step = 4
End With
ImportDialogArea.GetControl(&quot;LabelRetrieval&quot;).SetFocus()
If ImportDialog.chkLogfile.State = 1 Then
ImportDialog.cmdShowLogFile.DefaultButton = True
End If
End Sub
Sub SetupMSConfiguration()
Wizardmode = SBMICROSOFTMODE
MaxApplCount = 3
ApplCount = 3
&apos; chkTemplatePath-Captions
sTemplateCheckBox(0) = GetResText(&quot;MSTemplateCheckbox_1_&quot;)
sTemplateCheckBox(1) = GetResText(&quot;MSTemplateCheckbox_2_&quot;)
sTemplateCheckBox(2) = GetResText(&quot;MSTemplateCheckbox_3_&quot;)
&apos; DocumentCheckbox- Captions
sDocumentCheckBox(0) = GetResText(&quot;MSDocumentCheckbox_1_&quot;)
sDocumentCheckBox(1) = GetResText(&quot;MSDocumentCheckbox_2_&quot;)
sDocumentCheckBox(2) = GetResText(&quot;MSDocumentCheckbox_3_&quot;)
sKeyName(0) = &quot;Software\Microsoft\Office\8.0\Word\Options&quot;
sKeyName(1) = &quot;Software\Microsoft\Office\8.0\Excel\Microsoft Excel&quot;
sKeyName(2) = &quot;Software\Microsoft\Office\8.0\PowerPoint\Recent Folder List\Default&quot;
sValueName(0) = &quot;DOC-PATH&quot;
sValueName(1) = &quot;DefaultPath&quot;
sValueName(2) = &quot;&quot;
&apos; See definition of Filtername-Array about meaning of fields
MSFilterName(0,0) = &quot;doc|docx|docm&quot;
MSFilterName(0,1) = &quot;writer8|writer8|writer8&quot;
MSFilterName(0,2) = &quot;odt|odt|odt&quot;
MSFilterName(0,3) = sMSDocumentCheckBox(0)
MSFilterName(0,4) = &quot;Word&quot;
MSFilterName(1,0) = &quot;xls|xlsx|xlsm&quot;
MSFilterName(1,1) = &quot;calc8|calc8|calc8&quot;
MSFilterName(1,2) = &quot;ods|ods|ods&quot;
MSFilterName(1,3) = sMSDocumentCheckBox(1)
MSFilterName(1,4) = &quot;Excel&quot;
MSFilterName(2,0) = &quot;ppt|pps|pptx|pub|pptm|ppsx|ppsm&quot;
MSFilterName(2,1) = &quot;impress8|impress8|impress8|impress8|impress8|impress8|impress8&quot;
MSFilterName(2,2) = &quot;odp|odp|odp|odp|odp|odp|odp&quot;
MSFilterName(2,3) = sMSDocumentCheckBox(2)
MSFilterName(2,4) = &quot;PowerPoint/Publisher&quot;
MSFilterName(3,0) = &quot;dot|dotx|dotm&quot;
MSFilterName(3,1) = &quot;writer8_template|writer8_template|writer8_template&quot;
MSFilterName(3,2) = &quot;ott|ott|ott&quot;
MSFilterName(3,3) = sMSTemplateCheckBox(0)
MSFilterName(3,4) = &quot;Word&quot;
MSFilterName(4,0) = &quot;xlt|xltx|xltm&quot;
MSFilterName(4,1) = &quot;calc8_template|calc8_template|calc8_template&quot;
MSFilterName(4,2) = &quot;ots|ots|ots&quot;
MSFilterName(4,3) = sMSTemplateCheckBox(1)
MSFilterName(4,4) = &quot;Excel&quot;
MSFilterName(5,0) = &quot;pot|potx|potm&quot;
MSFilterName(5,1) = &quot;impress8_template|impress8_template|impress8_template&quot;
MSFilterName(5,2) = &quot;otp|otp|otp&quot;
MSFilterName(5,3) = sMSTemplateCheckBox(2)
MSFilterName(5,4) = &quot;PowerPoint&quot;
End Sub
Function CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean)
Dim sPath as String
If Not bDoEnable Then
CheckControlPath = False
ElseIf oCheckbox.State = 0 Then
CheckControlPath = True
Else
sPath = ConvertToUrl(Trim(oTextBox.Text))
CheckControlPath = oUcb.Exists(sPath)
End If
End Function
Function CheckInputPaths() as Boolean
Dim bChangePage as Boolean
bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateImportPath, True, False, sTitle, False)
bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateExportPath, bChangePage, True, sTitle, False)
bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentImportPath, bChangePage, False, sTitle, False)
bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentExportPath, bChangePage, True, sTitle, False)
CheckInputPaths = bChangePage
End Function
Function CheckTextBoxPath(oTextBox as Object, ByVal bCheck as Boolean, bCreateNew as Boolean, sTitle as String, bgetResources as Boolean) as Boolean
Dim iCreate as Integer
Dim sQueryMessage as String
Dim sUrlPath as String
Dim sMessageNoDir as String
Dim sShowPath as String
Dim oLocUcb as Object
oLocUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
If bGetResources Then
If InitResources(&quot;ImportWizard&quot;) then
sNoDirCreation = GetResText(&quot;NoDirCreation&quot;)
sMsgDirNotThere = GetResText(&quot;MsgDirNotThere&quot;)
sQueryForNewCreation = GetResText(&quot;QueryfornewCreation&quot;)
Else
CheckTextBoxPath() = False
Exit Function
End If
End If
If oTextBox.Enabled Then
If bCheck Then
sShowPath = oTextBox.Text
sUrlPath = ConvertToUrl(sShowPath)
If Not oLocUcb.Exists(sUrlPath) Then
If Not bCreateNew Then
&apos; Sourcedirectories must be existing, Targetdirectories may be created new
sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
Msgbox(sQueryMessage,16,sTitle)
CheckTextBoxPath() = False
Exit Function
Else
sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
sQueryMessage = sQueryMessage &amp; Chr(13) &amp; sQueryForNewCreation
iCreate = Msgbox (sQueryMessage, 36, sTitle)
If iCreate = 6 Then
On Local Error Goto NOVALIDPATH
CreateFolder(sUrlPath)
If Not oLocUcb.Exists(sUrlPath) Then
Goto NOVALIDPATH
End If
Else
CheckTextBoxPath() = False
Exit Function
End If
End If
End If
CheckTextBoxPath() = True
Else
CheckTextBoxPath() = False
End If
Else
CheckTextBoxPath() = True
End If
Exit Function
NOVALIDPATH:
sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath, &quot;%1&quot;)
Msgbox(sMessageNoDir, 16, sTitle)
CheckTextBoxPath() = False
End Function
Sub InitializeProgressPage(oDialog as Object)
oDialog.LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL
oDialog.LabelCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD
End Sub
Sub SetProgressDisplay(AbsFound as Integer)
ImportDialog.LabelRetrieval.Label = sProgressPage_2 &amp; &quot; &quot; &amp; ReplaceString(sProgressPage_5, Str(AbsFound) &amp; &quot; &quot;, &quot;%1&quot;)
ImportDialog.LabelCurDocumentRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsDocuFound) &amp; &quot; &quot; &amp; sProgressMoreDocs
ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsTemplateFound) &amp; &quot; &quot; &amp; sProgressMoreTemplates
End Sub
Sub TakoverFolderName(aEvent as Object)
Dim RefControlName as String
Dim oRefControl
RefControlName = aEvent.Source.Model.Tag
oRefControl = ImportDialogArea.GetControl(RefControlName)
GetFolderName(oRefControl.Model)
ToggleNextButton()
End Sub
Sub FinalizeDialogButtons()
ImportDialog.cmdShowLogFile.Enabled = ((Isnull(oLogDocument) = False) And (ImportDialog.chkLogfile.State = 1))
ImportDialog.cmdCancel.Enabled = False
ImportDialog.cmdGoOn.Label = sCloseButton
ImportDialog.cmdGoOn.Enabled = True
End Sub
</script:module>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ImportDialog" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="4" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_DIALOG" dlg:closeable="true" dlg:moveable="true" dlg:title="ImportDialog">
<dlg:bulletinboard>
<dlg:text dlg:id="lblTemplateExport" dlg:tab-index="0" dlg:left="12" dlg:top="94" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblTemplateExport"/>
<dlg:textfield dlg:id="txtTemplateImportPath" dlg:tab-index="1" dlg:left="73" dlg:top="76" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_LBTEMPLATEPATH">
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
</dlg:textfield>
<dlg:textfield dlg:id="txtTemplateExportPath" dlg:tab-index="2" dlg:left="73" dlg:top="92" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_EDTEMPLATEPATH"/>
<dlg:checkbox dlg:id="chkDocumentPath" dlg:tab-index="3" dlg:left="12" dlg:top="121" dlg:width="240" dlg:height="10" dlg:page="2" dlg:tag="Document" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CBDOCUMENT" dlg:value="chkDocumentPath" dlg:checked="true">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.ToggleInputPaths?language=Basic&amp;location=application" script:language="Script"/>
</dlg:checkbox>
<dlg:checkbox dlg:id="chkDocumentSearchSubDir" dlg:tab-index="4" dlg:left="12" dlg:top="134" dlg:width="240" dlg:height="10" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CBDOCUMENTRECURSE" dlg:value="chkDocumentSearchSubDir" dlg:checked="false"/>
<dlg:text dlg:id="lblDocumentImport" dlg:tab-index="5" dlg:left="10" dlg:top="151" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblDocumentImport"/>
<dlg:text dlg:id="lblDocumentExport" dlg:tab-index="6" dlg:left="10" dlg:top="167" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblDocumentExport"/>
<dlg:textfield dlg:id="txtDocumentImportPath" dlg:tab-index="7" dlg:left="73" dlg:top="149" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_LBDOCUMENTPATH">
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
</dlg:textfield>
<dlg:textfield dlg:id="txtDocumentExportPath" dlg:tab-index="8" dlg:left="73" dlg:top="165" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_EDDOCUMENTPATH"/>
<dlg:text dlg:id="SummaryHeaderLabel" dlg:tab-index="9" dlg:left="6" dlg:top="37" dlg:width="258" dlg:height="8" dlg:page="3" dlg:value="SummaryHeaderLabel"/>
<dlg:textfield dlg:id="SummaryTextbox" dlg:tab-index="10" dlg:left="5" dlg:top="48" dlg:width="259" dlg:height="125" dlg:page="3" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_3_TBSUMMARY" dlg:vscroll="true" dlg:multiline="true" dlg:readonly="true"/>
<dlg:text dlg:id="LabelRetrieval" dlg:tab-index="11" dlg:left="10" dlg:top="67" dlg:width="255" dlg:height="8" dlg:page="4" dlg:value="LabelRetrieval"/>
<dlg:text dlg:id="LabelCurTemplateRetrieval" dlg:tab-index="12" dlg:left="15" dlg:top="79" dlg:width="249" dlg:height="8" dlg:page="4" dlg:value="LabelCurTemplateRetrieval"/>
<dlg:text dlg:id="LabelCurDocumentRetrieval" dlg:tab-index="13" dlg:left="15" dlg:top="91" dlg:width="249" dlg:height="8" dlg:page="4" dlg:value="LabelCurDocumentRetrieval"/>
<dlg:text dlg:id="LabelCurProgress" dlg:tab-index="14" dlg:left="10" dlg:top="106" dlg:width="255" dlg:height="8" dlg:page="4" dlg:value="LabelCurProgress"/>
<dlg:text dlg:id="LabelCurDocument" dlg:tab-index="15" dlg:left="15" dlg:top="118" dlg:width="249" dlg:height="20" dlg:page="4" dlg:value="LabelCurDocument" dlg:multiline="true"/>
<dlg:img dlg:id="ImportPreview" dlg:tab-index="16" dlg:left="6" dlg:top="6" dlg:width="258" dlg:height="26" dlg:scale-image="false"/>
<dlg:button dlg:id="cmdBack" dlg:tab-index="17" dlg:left="155" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_0_CMDPREV" dlg:value="cmdBack">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.PrevStep?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdCancel" dlg:tab-index="18" dlg:left="6" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_0_CMDCANCEL" dlg:value="cmdCancel">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.CancelTask?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdHelp" dlg:tab-index="19" dlg:left="65" dlg:top="190" dlg:width="50" dlg:height="14" dlg:value="cmdHelp" dlg:button-type="help"/>
<dlg:button dlg:id="cmdGoOn" dlg:tab-index="20" dlg:left="214" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_0_CMDNEXT" dlg:value="cmdGoOn">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.NextStep?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:text dlg:id="WelcomeTextLabel" dlg:tab-index="21" dlg:left="6" dlg:top="38" dlg:width="258" dlg:height="20" dlg:page="1" dlg:value="WelcomeTextLabel" dlg:multiline="true"/>
<dlg:text dlg:id="WelcomeTextLabel3" dlg:tab-index="22" dlg:left="6" dlg:top="58" dlg:width="258" dlg:height="12" dlg:page="1" dlg:value="WelcomeTextLabel3"/>
<dlg:button dlg:id="cmdTemplateImport" dlg:tab-index="23" dlg:left="248" dlg:top="75" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtTemplateImportPath" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT" dlg:value="...">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdTemplateExport" dlg:tab-index="24" dlg:left="248" dlg:top="91" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtTemplateExportPath" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT2" dlg:value="...">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdDocumentImport" dlg:tab-index="25" dlg:left="248" dlg:top="148" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtDocumentImportPath" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT" dlg:value="...">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdDocumentExport" dlg:tab-index="26" dlg:left="248" dlg:top="164" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtDocumentExportPath" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT2" dlg:value="...">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:radiogroup>
<dlg:radio dlg:id="optMSDocuments" dlg:tab-index="27" dlg:left="6" dlg:top="72" dlg:width="258" dlg:height="9" dlg:page="1" dlg:tag="MS" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_0_OPTMSDOCUMENTS" dlg:value="optMSDocuments" dlg:checked="true">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleCheckboxes?language=Basic&amp;location=application" script:language="Script"/>
</dlg:radio>
</dlg:radiogroup>
<dlg:checkbox dlg:id="chkMSApplication1" dlg:tab-index="29" dlg:disabled="true" dlg:left="12" dlg:top="85" dlg:width="141" dlg:height="9" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CHKWORD" dlg:value="chkMSApplication1" dlg:checked="false">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
</dlg:checkbox>
<dlg:checkbox dlg:id="chkMSApplication2" dlg:tab-index="30" dlg:disabled="true" dlg:left="155" dlg:top="85" dlg:width="109" dlg:height="9" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CHKEXCEL" dlg:value="chkMSApplication2" dlg:checked="false">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
</dlg:checkbox>
<dlg:checkbox dlg:id="chkMSApplication3" dlg:tab-index="31" dlg:disabled="true" dlg:left="12" dlg:top="98" dlg:width="141" dlg:height="9" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CHKPOWERPOINT" dlg:value="chkMSApplication3" dlg:checked="false">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
</dlg:checkbox>
<dlg:checkbox dlg:id="chkTemplatePath" dlg:tab-index="36" dlg:left="12" dlg:top="48" dlg:width="240" dlg:height="10" dlg:page="2" dlg:tag="Template" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CBTEMPLATE" dlg:value="chkTemplatePath" dlg:checked="true">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.ToggleInputPaths?language=Basic&amp;location=application" script:language="Script"/>
</dlg:checkbox>
<dlg:checkbox dlg:id="chkTemplateSearchSubDir" dlg:tab-index="37" dlg:left="12" dlg:top="61" dlg:width="240" dlg:height="10" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_2_CBTEMPLATERECURSE" dlg:value="chkTemplateSearchSubDir" dlg:checked="false"/>
<dlg:text dlg:id="lblTemplateImport" dlg:tab-index="38" dlg:left="12" dlg:top="78" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblTemplateImport"/>
<dlg:checkbox dlg:id="chkLogfile" dlg:tab-index="39" dlg:left="6" dlg:top="171" dlg:width="136" dlg:height="9" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGIMPORT_0_CHKLOGFILE" dlg:value="chkLogfile" dlg:checked="true"/>
<dlg:fixedline dlg:id="hlnTemplates" dlg:tab-index="40" dlg:left="6" dlg:top="37" dlg:width="258" dlg:height="8" dlg:page="2" dlg:value="hlnTemplates"/>
<dlg:fixedline dlg:id="hlnDocuments" dlg:tab-index="41" dlg:left="6" dlg:top="110" dlg:width="258" dlg:height="8" dlg:page="2" dlg:value="hlnDocuments"/>
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="42" dlg:left="6" dlg:top="181" dlg:width="258" dlg:height="6"/>
<dlg:fixedline dlg:id="hlnProgress" dlg:tab-index="43" dlg:left="6" dlg:top="55" dlg:width="258" dlg:height="8" dlg:page="4" dlg:value="hlnProgress"/>
<dlg:button dlg:id="cmdShowLogFile" dlg:tab-index="44" dlg:disabled="true" dlg:left="75" dlg:top="142" dlg:width="120" dlg:height="14" dlg:page="4" dlg:value="cmdShowLogFile">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.FilesModul.OpenLogDocument?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
</dlg:bulletinboard>
</dlg:window>

View File

@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
Public sMSTemplateCheckbox(2) As String
Public sMSDocumentCheckbox(2) As String
Public sTemplateCheckbox(SBMAXAPPLCOUNT-1) As String
Public sDocumentCheckbox(SBMAXAPPLCOUNT-1) As String
Public sTemplateGroupName As String
Public sSearchInSubDir as String
Public sPathErrorTemplates(SBMAXAPPLCOUNT-1) As String
Public sPathErrorDocument(SBMAXAPPLCOUNT-1) As String
Public sPathErrorStarDoc(SBMAXAPPLCOUNT-1) As String
Public sStarDocLabel(SBMAXAPPLCOUNT-1) As String
Public sImportLabel As String, sExportLabel As String
Public SOApplicationName(5) As String
Public sHelpButton As String, sCancelButton As String, sBackButton As String, sNextButton As String
Public sSumInclusiveSubDir As String, sSumSaveDocuments As String
Public sSummaryHeader As String
Public sWelcometextLabel1 As String, sWelcometextLabel3 As String
Public sBeginButton As String, sMsgDirNotThere As String
Public sQueryForNewCreation As String, sPathError3 As String
Public sNoDirCreation As String
Public sProgressMoreDocs As String, sProgressMoreTemplates as String
Public sFileExists As String, sMorePathsError3 As String
Public sConvertError1 As String, sConvertError2 As String, sPathDialogMessage As String
Public sRTErrorDesc As String, sRTErrorHeader As String
Public sProgressPage_1 As String, sProgressPage_2 As String, sProgressPage_3 as String
Public sProgressFound as String, sProgresspage_5 as String
Public sContainerName(1) as String
Public sReady as String, sTitle as String
Public sCloseButton as String
Public sSourceDocuments as String
Public sTargetDocuments as String
Public sSumMSDocuments(3) as String
Public sSumMSTemplates(3) as String
Public ModuleList(3) as String
Public sLogSummary as String
Public sReeditMacro as String
Public sOverwriteallFiles as String
Public sCouldnotopenDocument as String
Public sCurcouldnotopenDocument as String
Public sCouldnotsaveDocument as String
Public sCurcouldnotsaveDocument as String
Sub LoadLanguage()
If InitResources(&quot;ImportWizard&quot;) then
sHelpButton = GetResText(&quot;HelpButton&quot;)
sCancelButton = GetResText(&quot;CancelButton&quot;)
sBackButton = GetResText(&quot;BackButton&quot;)
sNextButton = GetResText(&quot;NextButton&quot;)
sBeginButton = GetResText(&quot;BeginButton&quot;)
sCloseButton = GetResText(&quot;CloseButton&quot;)
sWelcometextLabel1 = ReplaceString(GetResText(&quot;WelcometextLabel1&quot;), GetProductName(),&quot;%PRODUCTNAME&quot;)
sWelcometextLabel3 = GetResText(&quot;WelcometextLabel3&quot;)
&apos; Microsoft Documents
sMSTemplateCheckBox(0) = GetResText(&quot;MSTemplateCheckbox_1_&quot;)
sMSTemplateCheckBox(1) = GetResText(&quot;MSTemplateCheckbox_2_&quot;)
sMSTemplateCheckBox(2) = GetResText(&quot;MSTemplateCheckbox_3_&quot;)
&apos; DocumentCheckbox- Captions
sMSDocumentCheckBox(0) = GetResText(&quot;MSDocumentCheckbox_1_&quot;)
sMSDocumentCheckBox(1) = GetResText(&quot;MSDocumentCheckbox_2_&quot;)
sMSDocumentCheckBox(2) = GetResText(&quot;MSDocumentCheckbox_3_&quot;)
&apos;StarOffice Applicationnames
sContainerName(0) = GetResText(&quot;MSContainerName&quot;)
sSummaryHeader = GetResText(&quot;SummaryHeader&quot;)
sTemplateGroupName = GetResText(&quot;GroupnameDefault&quot;)
sProgressMoreDocs = GetResText(&quot;ProgressMoreDocs&quot;)
sProgressMoreTemplates = GetResText(&quot;ProgressMoreTemplates&quot;)
sNoDirCreation = GetResText(&quot;NoDirCreation&quot;)
sMsgDirNotThere = GetResText(&quot;MsgDirNotThere&quot;)
sQueryForNewCreation = GetResText(&quot;QueryfornewCreation&quot;)
sFileExists = GetResText(&quot;FileExists&quot;)
sMorePathsError3 = GetResText(&quot;MorePathsError3&quot;)
sConvertError1 = GetResText(&quot;ConvertError1&quot;)
sConvertError2 = GetResText(&quot;ConvertError2&quot;)
sRTErrorDesc = GetResText(&quot;RTErrorDesc&quot;)
sRTErrorHeader = GetResText(&quot;RTErrorHeader&quot;)
sOverwriteallFiles = GetResText(&quot;OverwriteallFiles&quot;)
sReeditMacro = GetResText(&quot;ReeditMacro&quot;)
sCouldnotsaveDocument = GetResText(&quot;CouldNotsaveDocument&quot;)
sCouldnotopenDocument = GetResText(&quot;CouldNotopenDocument&quot;)
sPathDialogMessage = GetResText(&quot;PathDialogMessage&quot;)
sTitle = GetResText(&quot;DialogTitle&quot;)
sProgressPage_1 = GetResText(&quot;ProgressPage1&quot;)
sProgressPage_2 = GetResText(&quot;ProgressPage2&quot;)
sProgressPage_3 = GetResText(&quot;ProgressPage3&quot;)
sProgressFound = GetResText(&quot;ProgressFound&quot;)
sProgressPage_5 = GetResText(&quot;ProgressPage5&quot;)
sReady = GetResText(&quot;Ready&quot;)
sSourceDocuments = GetResText(&quot;SourceDocuments&quot;)
sTargetDocuments = GetResText(&quot;TargetDocuments&quot;)
sLogSummary = GetResText(&quot;LogfileSummary&quot;)
sSumInclusiveSubDir = GetResText(&quot;SumInclusiveSubDir&quot;)
sSumSaveDocuments = GetResText(&quot;SumSaveDokumente&quot;)
sSumMSDocuments(0) = GetResText(&quot;SumMSTextDocuments&quot;)
sSumMSDocuments(1) = GetResText(&quot;SumMSTableDocuments&quot;)
sSumMSDocuments(2) = GetResText(&quot;SumMSDrawDocuments&quot;)
sSumMSTemplates(0) = GetResText(&quot;SumMSTextTemplates&quot;)
sSumMSTemplates(1) = GetResText(&quot;SumMSTableTemplates&quot;)
sSumMSTemplates(2) = GetResText(&quot;SumMSDrawTemplates&quot;)
With ImportDialog
sImportLabel = GetResText(&quot;TextImportLabel&quot;)
sExportLabel = GetResText(&quot;TextExportLabel&quot;)
sSearchInSubDir = GetResText(&quot;SearchInSubDir&quot;)
.chkTemplateSearchSubDir.Label = sSearchInSubDir
.lblDocumentImport.Label = sImportLabel
.lblDocumentExport.Label = sExportLabel
.chkDocumentSearchSubDir.Label = sSearchInSubDir
.lblTemplateImport.Label = sImportLabel
.lblTemplateExport.Label = sExportLabel
.chkLogfile.Label = GetResText(&quot;CreateLogfile&quot;)
.chkLogfile.Helptext = GetResText(&quot;LogfileHelpText&quot;)
.cmdShowLogFile.Label = GetResText(&quot;ShowLogfile&quot;)
End With
ModuleList(0) = &quot;com.sun.star.text.TextDocument&quot;
ModuleList(1) = &quot;com.sun.star.sheet.SpreadsheetDocument&quot;
ModuleList(2) = &quot;com.sun.star.drawing.DrawingDocument/com.sun.star.presentation.PresentationDocument&quot;
ModuleList(3) = &quot;com.sun.star.formula.FormulaProperties/com.sun.star.text.GlobalDocument&quot;
End If
End Sub
</script:module>

View File

@@ -0,0 +1,291 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Main" script:language="StarBasic">Option Explicit
REM ***** BASIC *****
Public HeaderPreviews(4) as Object
Public ImportDialog as Object
Public ImportDialogArea as Object
Public oFactoryKey as Object
Public bShowLogFile as Boolean
&apos; If the ProgressPage is already on Top The Dialog will be immediately closed when this flag is
&apos; set to False
Public bConversionIsRunning as Boolean
Public RetValue as Integer
Sub Main()
Dim NoArgs() as New com.sun.star.beans.PropertyValue
bShowLogFile=FALSE
If Not bDebugWizard Then
On Local Error Goto RTError
End If
BasicLibraries.LoadLibrary(&quot;Tools&quot;)
RetValue = 10
bIsFirstLogTable = True
bConversionIsRunning = False
sCRLF = CHR(13) &amp; CHR(10)
oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
oFactoryKey = GetRegistryKeyContent(&quot;org.openoffice.Setup/Office/Factories&quot;)
If GetImportWizardPaths() = False Then
Exit Sub
End If
bCancelTask = False
bDoKeepApplValues = False
CurOffice = 0
ImportDialogArea = LoadDialog(&quot;ImportWizard&quot;,&quot;ImportDialog&quot;)
ImportDialog = ImportDialogArea.Model
LoadLanguage()
WizardMode = SBMICROSOFTMODE
MaxApplCount = 3
FillStep_Welcome()
RepaintHeaderPreview()
ImportDialog.ImportPreview.BackGroundColor = RGB(0,60,126)
ImportDialog.cmdGoOn.DefaultButton = True
ImportDialogArea.GetControl(&quot;optMSDocuments&quot;).SetFocus()
ToggleCheckboxesWithBoolean(True)
RetValue = ImportDialogArea.Execute()
If bShowLogFile=TRUE Then
OpenDocument(sLogUrl, NoArgs())
End if
If RetValue = 0 Then
CancelTask()
End If
ImportDialogArea.Dispose()
End
Exit Sub
RTError:
Msgbox sRTErrorDesc, 16, sRTErrorHeader
End Sub
Sub NextStep()
Dim iCurStep as Integer
If Not bDebugWizard Then
On Error Goto RTError
End If
bConversionIsRunning = False
iCurStep = ImportDialog.Step
Select Case iCurStep
Case 1
FillStep_InputPaths(0, True)
Case 2
If CheckInputPaths Then
SaveStep_InputPath
If CurOffice &lt; ApplCount - 1 Then
CurOffice = CurOffice + 1
TakeOverPathSettings()
FillStep_InputPaths(CurOffice, False)
Else
FillStep_Summary()
End If
End If
Case 3
FillStep_Progress()
Select Case WizardMode
Case SBMICROSOFTMODE
Call ConvertAllDocuments(MSFilterName())
End Select
Case 4
CancelTask(True)
End Select
If ((ImportDialog.chkLogfile.State &lt;&gt; 1) OR (iCurStep &lt;&gt; 3)) Then
ImportDialog.cmdGoOn.DefaultButton = True
End If
RepaintHeaderPreview()
Exit Sub
RTError:
Msgbox sRTErrorDesc, 16, sRTErrorHeader
End Sub
Sub PrevStep()
Dim iCurStep as Integer
If Not bDebugWizard Then
On Error Goto RTError
End If
bConversionIsRunning = False
iCurStep = ImportDialog.Step
Select Case iCurStep
Case 4
ImportDialog.cmdCancel.Label = sCancelButton
FillStep_Summary()
Case 3
FillStep_InputPaths(Applcount-1, False)
Case 2
SaveStep_InputPath
If CurOffice &gt; 0 Then
CurOffice = CurOffice - 1
FillStep_InputPaths(CurOffice, False)
Else
FillStep_Welcome()
ToggleCheckboxesWithBoolean(True)
bDoKeepApplValues = True
End If
End Select
ImportDialog.cmdGoOn.DefaultButton = True
RepaintHeaderPreview()
Exit Sub
RTError:
Msgbox sRTErrorDesc, 16, sRTErrorHeader
End Sub
Sub CancelTask()
If bConversionIsRunning Then
If Msgbox(sConvertError1, 36, sConvertError2) = 6 Then
bCancelTask = True
bInterruptSearch = True
Else
bCancelTask = False
ImportDialog.cmdCancel.Enabled = True
End If
Else
ImportDialogArea.EndExecute()
End If
End Sub
Sub TemplateDirSearchDialog()
CallDirSearchDialog(ImportDialog.TemplateImportPath)
End Sub
Sub RepaintHeaderPreview()
Dim Bitmap As Object
Dim CurStep as Integer
Dim sBitmapPath as String
Dim LocPrefix as String
CurStep = ImportDialog.Step
LocPrefix = WizardMode
LocPrefix = ReplaceString(LocPrefix,&quot;XML&quot;, &quot;SO&quot;)
If CurStep = 2 Then
sBitmapPath = SOBitmapPath &amp; LocPrefix &amp; &quot;-Import_&quot; &amp; CurStep &amp; &quot;-&quot; &amp; Applications(CurOffice,SBAPPLKEY) + 1 &amp; &quot;.png&quot;
Else
sBitmapPath = SOBitmapPath &amp; &quot;Import_&quot; &amp; CurStep &amp; &quot;.png&quot;
End If
ImportDialog.ImportPreview.ImageURL = sBitmapPath
End Sub
Sub CheckModuleInstallation()
Dim i as Integer
For i = 1 To MaxApplCount
ImportDialogArea.GetControl(&quot;chk&quot; &amp; WizardMode &amp; &quot;Application&quot; &amp; i).Model.Enabled = Abs(CheckInstalledModule(i-1))
Next i
End Sub
Function CheckInstalledModule(Index as Integer) as Boolean
Dim ModuleName as String
Dim NameList() as String
Dim MaxIndex as Integer
Dim i as Integer
ModuleName = ModuleList(Index)
If Instr(1,ModuleName,&quot;/&quot;) &lt;&gt; 0 Then
CheckInstalledModule() = False
NameList() = ArrayoutOfString(ModuleName,&quot;/&quot;, MaxIndex)
For i = 0 To MaxIndex
If oFactoryKey.HasByName(NameList(i)) Then
CheckInstalledModule() = True
End If
Next i
Else
CheckInstalledModule() = oFactoryKey.HasByName(ModuleName)
End If
End Function
Sub ToggleCheckboxes(oEvent as Object)
Dim bMSEnable as Boolean
WizardMode = oEvent.Source.Model.Tag
bMSEnable = WizardMode = &quot;MS&quot;
ToggleCheckboxesWithBoolean(bMSEnable)
End Sub
Sub ToggleCheckboxesWithBoolean(bMSEnable as Boolean)
If bMSEnable = True Then
WizardMode = SBMICROSOFTMODE
MaxApplCount = 3
Else
&apos;Not supposed to happen - is there an assert in BASIC...
End If
With ImportDialogArea
.GetControl(&quot;chkMSApplication1&quot;).Model.Enabled = bMSEnable
.GetControl(&quot;chkMSApplication2&quot;).Model.Enabled = bMSEnable
.GetControl(&quot;chkMSApplication3&quot;).Model.Enabled = bMSEnable
End With
CheckModuleInstallation()
bDoKeepApplValues = False
ToggleNextButton()
End Sub
Sub ToggleNextButton()
Dim iCurStep as Integer
Dim bDoEnable as Boolean
Dim i as Integer
iCurStep = ImportDialog.Step
Select Case iCurStep
Case 1
With ImportDialog
If .optMSDocuments.State = 1 Then
bDoEnable = .chkMSApplication1.State = 1 Or .chkMSApplication2.State = 1 Or .chkMSApplication3.State = 1
End If
End With
bDoKeepApplValues = False
Case 2
bDoEnable = CheckControlPath(ImportDialog.chkTemplatePath, ImportDialog.txtTemplateImportPath, True)
bDoEnable = CheckControlPath(ImportDialog.chkDocumentPath, ImportDialog.txtDocumentImportPath, bDoEnable)
End Select
ImportDialog.cmdGoOn.Enabled = bDoEnable
End Sub
Sub TakeOverPathSettings()
&apos;Takes over the Pathsettings from the first selected application to the next applications
If Applications(CurOffice,SBDOCSOURCE) = &quot;&quot; Then
Applications(CurOffice,SBDOCSOURCE) = Applications(0,SBDOCSOURCE)
Applications(CurOffice,SBDOCTARGET) = Applications(0,SBDOCTARGET)
Applications(CurOffice,SBTEMPLSOURCE) = Applications(0,SBTEMPLSOURCE)
Applications(CurOffice,SBTEMPLTARGET) = Applications(0,SBTEMPLTARGET)
End If
End Sub
Function GetImportWizardPaths() as Boolean
SOBitmapPath = GetOfficeSubPath(&quot;Template&quot;, &quot;../wizard/bitmap&quot;)
If SOBitmapPath &lt;&gt; &quot;&quot; Then
SOWorkPath = GetPathSettings(&quot;Work&quot;, False)
If SOWorkPath &lt;&gt; &quot;&quot; Then
SOTemplatePath = GetPathSettings(&quot;Template_writable&quot;,False,0)
If SOTemplatePath &lt;&gt; &quot;&quot; Then
GetImportWizardPaths() = True
Exit Function
End If
End If
End If
GetImportWizardPaths() = False
End Function
</script:module>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ImportWizard" library:readonly="true" library:passwordprotected="false">
<library:element library:name="ImportDialog"/>
</library:library>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ImportWizard" library:readonly="true" library:passwordprotected="false">
<library:element library:name="Main"/>
<library:element library:name="DialogModul"/>
<library:element library:name="Language"/>
<library:element library:name="FilesModul"/>
<library:element library:name="API"/>
</library:library>