mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-06-18 11:57:07 +00:00
集成OpenOffice替换为LibreOffice
This commit is contained in:
@@ -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("Tools")
|
||||
BasicLibraries.LoadLibrary("ImportWizard")
|
||||
If InitResources("Euro Converter", "eur") Then
|
||||
If InitResources("Euro Converter") Then
|
||||
oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
|
||||
oLocale = GetStarOfficeLocale()
|
||||
InitializeConverter(oLocale, 2)
|
||||
ToggleGoOnButton()
|
||||
oFactoryKey = GetRegistryKeyContent("org.openoffice.Setup/Office/Factories")
|
||||
DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName("com.sun.star.text.TextDocument")
|
||||
DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName("com.sun.star.text.TextDocument")
|
||||
DialogModel.cmdGoOn.DefaultButton = True
|
||||
DialogModel.lstCurrencies.TabIndex = 12
|
||||
DialogConvert.GetControl("optWholeDir").SetFocus()
|
||||
@@ -77,21 +74,13 @@ Dim bDisposable as Boolean
|
||||
TargetStemDir = TargetDir
|
||||
TypeList(0) = "calc8"
|
||||
TypeList(1) = "calc_StarOffice_XML_Calc"
|
||||
TypeList(2) = "calc_StarCalc_30"
|
||||
TypeList(3) = "calc_StarCalc_40"
|
||||
TypeList(4) = "calc_StarCalc_50"
|
||||
If DialogModel.chkTextDocuments.State = 1 Then
|
||||
ReDim Preserve TypeList(13) as String
|
||||
ReDim Preserve TypeList(5) as String
|
||||
|
||||
TypeList(5) = "writer8"
|
||||
TypeList(6) = "writerglobal8"
|
||||
TypeList(7) = "writer_StarOffice_XML_Writer"
|
||||
TypeList(8) = "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument"
|
||||
TypeList(9) = "writer_StarWriter_30"
|
||||
TypeList(10) = "writer_StarWriter_40"
|
||||
TypeList(11) = "writer_globaldocument_StarWriter_40GlobalDocument"
|
||||
TypeList(12) = "writer_StarWriter_50"
|
||||
TypeList(13) = "writer_globaldocument_StarWriter_50GlobalDocument"
|
||||
TypeList(2) = "writer8"
|
||||
TypeList(3) = "writerglobal8"
|
||||
TypeList(4) = "writer_StarOffice_XML_Writer"
|
||||
TypeList(5) = "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument"
|
||||
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) & "/" & sTotDocCount & " (" & sViewPath & ")"
|
||||
DialogModel.lblCurDocument.Label = Str(DocIndex+1) & "/" & sTotDocCount & " (" & sViewPath & ")"
|
||||
End If
|
||||
InitializeDocument() = Not bIsReadOnly
|
||||
Else
|
||||
@@ -246,7 +235,7 @@ Dim TextBoxText as String
|
||||
TextBoxText = TextBoxText & DeleteStr(sInclusiveSubDir,"~") & chr(13)
|
||||
End If
|
||||
Else
|
||||
TextBoxText = sSOURCEFILE & " " & ConvertFromUrl(Source) & chr(13)
|
||||
TextBoxText = sSOURCEFILE & " " & ConvertFromUrl(Source) & chr(13)
|
||||
End If
|
||||
TextBoxText = TextBoxText & sTARGETDIR & " " & ConvertFromUrl(TargetDir) & 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("lstCurrencies").Visible = Not bMakeVisible
|
||||
DialogConvert.GetControl("cmdBack").Visible = bMakeVisible
|
||||
DialogConvert.GetControl("cmdGoOn").Visible = bMakeVisible
|
||||
DialogModel.imgPreview.ImageUrl = BitmapDir & "euro_" & DialogModel.Step & ".bmp"
|
||||
DialogModel.imgPreview.ImageUrl = BitmapDir & "euro_" & DialogModel.Step & ".png"
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -330,8 +319,8 @@ Dim sNoDirMessage as String
|
||||
If DialogModel.chkTextDocuments.State = 1 Then
|
||||
If (Instr(1, sLocMimeType, "text") = 0) And (Instr(1, sLocMimeType, "calc") = 0) Then
|
||||
Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
|
||||
bIsValid = False
|
||||
End If
|
||||
bIsValid = False
|
||||
End If
|
||||
Else
|
||||
If (Instr(1, sLocMimeType, "spreadsheet") = 0) And (Instr(1, sLocMimeType, "calc")) = 0 Then
|
||||
Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
|
||||
@@ -350,7 +339,7 @@ Dim sNoDirMessage as String
|
||||
End If
|
||||
End if
|
||||
Else
|
||||
Msgbox(HeaderString & " '" & ConvertFromUrl(sPath) & "' " & sMsgNOTTHERE,48, sMsgDLGTITLE)
|
||||
Msgbox(HeaderString & " '" & ConvertFromUrl(sPath) & "' " & 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()) > -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("org.openoffice.TypeDetection.Types")
|
||||
oTypes() = oMasterKey.Types
|
||||
oUIKey = GetRegistryKeyContent("org.openoffice.Office.UI/FilterClassification/LocalFilters")
|
||||
If DialogModel.chkTextDocuments.State = 1 Then
|
||||
Dim FilterNames(11,1) as String
|
||||
FilterNames(6,0) = oTypes.GetByName("writer_StarOffice_XML_Writer").UIName
|
||||
FilterNames(6,1) = "*.sxw"
|
||||
FilterNames(7,0) = oTypes.GetByName("writer_StarOffice_XML_Writer_Template").UIName
|
||||
FilterNames(7,1) = "*.stw"
|
||||
FilterNames(8,0) = oUIKey.Classes.GetByName("sw3to5").DisplayName
|
||||
FilterNames(8,1) = "*.sdw"
|
||||
FilterNames(9,0) = oUIKey.Classes.GetByName("sw3to5templ").DisplayName
|
||||
Filternames(9,1) = "*.vor"
|
||||
FilterNames(10,0) = oTypes.GetByName("writer8").UIName
|
||||
FilterNames(10,1) = "*.odt"
|
||||
FilterNames(11,0) = oTypes.GetByName("writer8_template").UIName
|
||||
FilterNames(11,1) = "*.ott"
|
||||
Dim FilterNames(7,1) as String
|
||||
FilterNames(4,0) = oTypes.GetByName("writer_StarOffice_XML_Writer").UIName
|
||||
FilterNames(4,1) = "*.sxw"
|
||||
FilterNames(5,0) = oTypes.GetByName("writer_StarOffice_XML_Writer_Template").UIName
|
||||
FilterNames(5,1) = "*.stw"
|
||||
FilterNames(6,0) = oTypes.GetByName("writer8").UIName
|
||||
FilterNames(6,1) = "*.odt"
|
||||
FilterNames(7,0) = oTypes.GetByName("writer8_template").UIName
|
||||
FilterNames(7,1) = "*.ott"
|
||||
Else
|
||||
ReDim FilterNames(5,1) as String
|
||||
ReDim FilterNames(3,1) as String
|
||||
End If
|
||||
FilterNames(0,0) = oTypes.GetByName("calc_StarOffice_XML_Calc").UIName
|
||||
Filternames(0,1) = "*.sxc"
|
||||
FilterNames(1,0) = oTypes.GetByName("calc_StarOffice_XML_Calc_Template").UIName
|
||||
Filternames(1,1) = "*.stc"
|
||||
FilterNames(2,0) = oUIKey.Classes.GetByName("sc345").DisplayName
|
||||
FilterNames(2,1) = "*.sdc"
|
||||
FilterNames(3,0) = oUIKey.Classes.GetByName("sc345templ").DisplayName
|
||||
Filternames(3,1) = "*.vor"
|
||||
FilterNames(4,0) = oTypes.GetByName("calc8").UIName
|
||||
Filternames(4,1) = "*.ods"
|
||||
FilterNames(5,0) = oTypes.GetByName("calc8_template").UIName
|
||||
Filternames(5,1) = "*.ots"
|
||||
FilterNames(0,0) = oTypes.GetByName("calc8").UIName
|
||||
Filternames(0,1) = "*.ods"
|
||||
FilterNames(1,0) = oTypes.GetByName("calc8_template").UIName
|
||||
Filternames(1,1) = "*.ots"
|
||||
FilterNames(2,0) = oTypes.GetByName("calc_StarOffice_XML_Calc").UIName
|
||||
Filternames(2,1) = "*.sxc"
|
||||
FilterNames(3,0) = oTypes.GetByName("calc_StarOffice_XML_Calc_Template").UIName
|
||||
Filternames(3,1) = "*.stc"
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user