集成OpenOffice替换为LibreOffice

This commit is contained in:
陈精华
2021-06-23 10:26:22 +08:00
parent 8a1eebb9b0
commit 79341b2c8e
14724 changed files with 2184695 additions and 551131 deletions

View File

@@ -1,25 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* 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
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<!--
* 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="AutoPilotRun" script:language="StarBasic">Option Explicit
Public SourceDir as String
@@ -31,7 +28,7 @@ Public Source as String
Public SubstFile as String
Public SubstDir as String
Public NoArgs()
Public TypeList(14) as String
Public TypeList(6) as String
Public GoOn as Boolean
Public DoUnprotect as Integer
Public Password as String
@@ -48,13 +45,13 @@ Dim i As Integer
Dim oFactoryKey as Object
BasicLibraries.LoadLibrary(&quot;Tools&quot;)
BasicLibraries.LoadLibrary(&quot;ImportWizard&quot;)
If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then
If InitResources(&quot;Euro Converter&quot;) Then
oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
oLocale = GetStarOfficeLocale()
InitializeConverter(oLocale, 2)
ToggleGoOnButton()
oFactoryKey = GetRegistryKeyContent(&quot;org.openoffice.Setup/Office/Factories&quot;)
DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;)
DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;)
DialogModel.cmdGoOn.DefaultButton = True
DialogModel.lstCurrencies.TabIndex = 12
DialogConvert.GetControl(&quot;optWholeDir&quot;).SetFocus()
@@ -77,21 +74,13 @@ Dim bDisposable as Boolean
TargetStemDir = TargetDir
TypeList(0) = &quot;calc8&quot;
TypeList(1) = &quot;calc_StarOffice_XML_Calc&quot;
TypeList(2) = &quot;calc_StarCalc_30&quot;
TypeList(3) = &quot;calc_StarCalc_40&quot;
TypeList(4) = &quot;calc_StarCalc_50&quot;
If DialogModel.chkTextDocuments.State = 1 Then
ReDim Preserve TypeList(13) as String
ReDim Preserve TypeList(5) as String
TypeList(5) = &quot;writer8&quot;
TypeList(6) = &quot;writerglobal8&quot;
TypeList(7) = &quot;writer_StarOffice_XML_Writer&quot;
TypeList(8) = &quot;writer_globaldocument_StarOffice_XML_Writer_GlobalDocument&quot;
TypeList(9) = &quot;writer_StarWriter_30&quot;
TypeList(10) = &quot;writer_StarWriter_40&quot;
TypeList(11) = &quot;writer_globaldocument_StarWriter_40GlobalDocument&quot;
TypeList(12) = &quot;writer_StarWriter_50&quot;
TypeList(13) = &quot;writer_globaldocument_StarWriter_50GlobalDocument&quot;
TypeList(2) = &quot;writer8&quot;
TypeList(3) = &quot;writerglobal8&quot;
TypeList(4) = &quot;writer_StarOffice_XML_Writer&quot;
TypeList(5) = &quot;writer_globaldocument_StarOffice_XML_Writer_GlobalDocument&quot;
End If
FilesList() = ReadDirectories(SourceDir, bRecursive, True, False, TypeList())
TotDocCount = Ubound(FilesList(),1) + 1
@@ -147,7 +136,7 @@ Dim sExtension as String
bIsReadOnly = False
RetrieveDocumentObjects()
sViewPath = CutPathView(SourceFile, 60)
DialogModel.lblCurDocument.Label = Str(DocIndex+1) &amp; &quot;/&quot; &amp; sTotDocCount &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
DialogModel.lblCurDocument.Label = Str(DocIndex+1) &amp; &quot;/&quot; &amp; sTotDocCount &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
End If
InitializeDocument() = Not bIsReadOnly
Else
@@ -246,7 +235,7 @@ Dim TextBoxText as String
TextBoxText = TextBoxText &amp; DeleteStr(sInclusiveSubDir,&quot;~&quot;) &amp; chr(13)
End If
Else
TextBoxText = sSOURCEFILE &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
TextBoxText = sSOURCEFILE &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
End If
TextBoxText = TextBoxText &amp; sTARGETDIR &amp; &quot; &quot; &amp; ConvertFromUrl(TargetDir) &amp; chr(13)
If DialogModel.chkProtect.State = 1 Then
@@ -254,8 +243,8 @@ Dim TextBoxText as String
End If
DialogModel.txtConfig.Text = TextBoxText
ToggleProgressStep()
DialogModel.cmdGoOn.Enabled = False
InitializeThirdStep() = True
DialogModel.cmdGoOn.Enabled = False
InitializeThirdStep() = True
Else
InitializeThirdStep() = False
End If
@@ -276,7 +265,7 @@ Dim LocStep as Integer
DialogConvert.GetControl(&quot;lstCurrencies&quot;).Visible = Not bMakeVisible
DialogConvert.GetControl(&quot;cmdBack&quot;).Visible = bMakeVisible
DialogConvert.GetControl(&quot;cmdGoOn&quot;).Visible = bMakeVisible
DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.bmp&quot;
DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.png&quot;
End Sub
@@ -330,8 +319,8 @@ Dim sNoDirMessage as String
If DialogModel.chkTextDocuments.State = 1 Then
If (Instr(1, sLocMimeType, &quot;text&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;) = 0) Then
Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
bIsValid = False
End If
bIsValid = False
End If
Else
If (Instr(1, sLocMimeType, &quot;spreadsheet&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;)) = 0 Then
Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
@@ -350,7 +339,7 @@ Dim sNoDirMessage as String
End If
End if
Else
Msgbox(HeaderString &amp; &quot; &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos; &quot; &amp; sMsgNOTTHERE,48, sMsgDLGTITLE)
Msgbox(HeaderString &amp; &quot; &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos; &quot; &amp; sMsgNOTTHERE,48, sMsgDLGTITLE)
End If
If bIsValid Then
AssignFileName() = sPath
@@ -361,7 +350,7 @@ End Function
Sub ToggleGoOnButton()
Dim bDoEnable as Boolean
Dim bDoEnable as Boolean
Dim sLocMimeType as String
Dim sPath as String
bDoEnable = Ubound(DialogModel.lstCurrencies.SelectedItems()) &gt; -1
@@ -376,7 +365,7 @@ End Sub
Sub CallFolderPicker()
GetFolderName(DialogModel.txtTarget)
ToggleGoOnButton()
ToggleGoOnButton()
End Sub
@@ -385,39 +374,31 @@ Sub CallFilePicker()
Dim oMasterKey as Object
Dim oTypes() as Object
Dim oUIKey() as Object
oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types&quot;)
oTypes() = oMasterKey.Types
oUIKey = GetRegistryKeyContent(&quot;org.openoffice.Office.UI/FilterClassification/LocalFilters&quot;)
If DialogModel.chkTextDocuments.State = 1 Then
Dim FilterNames(11,1) as String
FilterNames(6,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer&quot;).UIName
FilterNames(6,1) = &quot;*.sxw&quot;
FilterNames(7,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer_Template&quot;).UIName
FilterNames(7,1) = &quot;*.stw&quot;
FilterNames(8,0) = oUIKey.Classes.GetByName(&quot;sw3to5&quot;).DisplayName
FilterNames(8,1) = &quot;*.sdw&quot;
FilterNames(9,0) = oUIKey.Classes.GetByName(&quot;sw3to5templ&quot;).DisplayName
Filternames(9,1) = &quot;*.vor&quot;
FilterNames(10,0) = oTypes.GetByName(&quot;writer8&quot;).UIName
FilterNames(10,1) = &quot;*.odt&quot;
FilterNames(11,0) = oTypes.GetByName(&quot;writer8_template&quot;).UIName
FilterNames(11,1) = &quot;*.ott&quot;
Dim FilterNames(7,1) as String
FilterNames(4,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer&quot;).UIName
FilterNames(4,1) = &quot;*.sxw&quot;
FilterNames(5,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer_Template&quot;).UIName
FilterNames(5,1) = &quot;*.stw&quot;
FilterNames(6,0) = oTypes.GetByName(&quot;writer8&quot;).UIName
FilterNames(6,1) = &quot;*.odt&quot;
FilterNames(7,0) = oTypes.GetByName(&quot;writer8_template&quot;).UIName
FilterNames(7,1) = &quot;*.ott&quot;
Else
ReDim FilterNames(5,1) as String
ReDim FilterNames(3,1) as String
End If
FilterNames(0,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc&quot;).UIName
Filternames(0,1) = &quot;*.sxc&quot;
FilterNames(1,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc_Template&quot;).UIName
Filternames(1,1) = &quot;*.stc&quot;
FilterNames(2,0) = oUIKey.Classes.GetByName(&quot;sc345&quot;).DisplayName
FilterNames(2,1) = &quot;*.sdc&quot;
FilterNames(3,0) = oUIKey.Classes.GetByName(&quot;sc345templ&quot;).DisplayName
Filternames(3,1) = &quot;*.vor&quot;
FilterNames(4,0) = oTypes.GetByName(&quot;calc8&quot;).UIName
Filternames(4,1) = &quot;*.ods&quot;
FilterNames(5,0) = oTypes.GetByName(&quot;calc8_template&quot;).UIName
Filternames(5,1) = &quot;*.ots&quot;
FilterNames(0,0) = oTypes.GetByName(&quot;calc8&quot;).UIName
Filternames(0,1) = &quot;*.ods&quot;
FilterNames(1,0) = oTypes.GetByName(&quot;calc8_template&quot;).UIName
Filternames(1,1) = &quot;*.ots&quot;
FilterNames(2,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc&quot;).UIName
Filternames(2,1) = &quot;*.sxc&quot;
FilterNames(3,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc_Template&quot;).UIName
Filternames(3,1) = &quot;*.stc&quot;
GetFileName(DialogModel.txtSource, Filternames())
Else
GetFolderName(DialogModel.txtSource)
@@ -428,7 +409,7 @@ End Sub
Sub PreviousStep()
DialogModel.Step = 2
DialogModel.cmdGoOn.Label = sGOON
DialogModel.cmdGoOn.Label = sGOON
DialogModel.cmdCancel.Label = sCANCEL
End Sub
</script:module>