mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-06-18 20:07:07 +00:00
集成OpenOffice替换为LibreOffice
This commit is contained in:
@@ -1,35 +1,32 @@
|
||||
<?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="Main" script:language="StarBasic">Option Explicit
|
||||
REM ***** BASIC *****
|
||||
|
||||
' ***** BASIC *****
|
||||
Public HeaderPreviews(4) as Object
|
||||
Public ImportDialog as Object
|
||||
Public ImportDialogArea as Object
|
||||
Public oFactoryKey as Object
|
||||
Public bShowLogFile as Boolean
|
||||
|
||||
' If the ProgressPage ist already on Top The Dialog will be immediately closed when this flag is
|
||||
' If the ProgressPage is already on Top The Dialog will be immediately closed when this flag is
|
||||
' set to False
|
||||
Public bConversionIsRunning as Boolean
|
||||
Public RetValue as Integer
|
||||
@@ -50,22 +47,23 @@ Sub Main()
|
||||
If GetImportWizardPaths() = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
bCancelTask = False
|
||||
bDoKeepApplValues = False
|
||||
bCancelTask = False
|
||||
bDoKeepApplValues = False
|
||||
CurOffice = 0
|
||||
ImportDialogArea = LoadDialog("ImportWizard","ImportDialog")
|
||||
ImportDialog = ImportDialogArea.Model
|
||||
LoadLanguage()
|
||||
WizardMode = SBXMLMODE
|
||||
MaxApplCount = 4
|
||||
WizardMode = SBMICROSOFTMODE
|
||||
MaxApplCount = 3
|
||||
FillStep_Welcome()
|
||||
RepaintHeaderPreview()
|
||||
ImportDialog.ImportPreview.BackGroundColor = RGB(0,60,126)
|
||||
ImportDialog.ImportPreview.BackGroundColor = RGB(0,60,126)
|
||||
ImportDialog.cmdGoOn.DefaultButton = True
|
||||
ImportDialogArea.GetControl("optSODocuments").SetFocus()
|
||||
ToggleCheckboxesWithBoolean(False)
|
||||
ImportDialogArea.GetControl("optMSDocuments").SetFocus()
|
||||
ToggleCheckboxesWithBoolean(True)
|
||||
|
||||
RetValue = ImportDialogArea.Execute()
|
||||
If bShowLogFile=TRUE Then
|
||||
If bShowLogFile=TRUE Then
|
||||
OpenDocument(sLogUrl, NoArgs())
|
||||
End if
|
||||
If RetValue = 0 Then
|
||||
@@ -79,7 +77,6 @@ RTError:
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub NextStep()
|
||||
Dim iCurStep as Integer
|
||||
If Not bDebugWizard Then
|
||||
@@ -106,8 +103,6 @@ Dim iCurStep as Integer
|
||||
Select Case WizardMode
|
||||
Case SBMICROSOFTMODE
|
||||
Call ConvertAllDocuments(MSFilterName())
|
||||
CASE SBXMLMODE
|
||||
Call ConvertAllDocuments(XMLFilterName())
|
||||
End Select
|
||||
Case 4
|
||||
CancelTask(True)
|
||||
@@ -116,15 +111,14 @@ Dim iCurStep as Integer
|
||||
If ((ImportDialog.chkLogfile.State <> 1) OR (iCurStep <> 3)) Then
|
||||
ImportDialog.cmdGoOn.DefaultButton = True
|
||||
End If
|
||||
|
||||
RepaintHeaderPreview()
|
||||
|
||||
RepaintHeaderPreview()
|
||||
Exit Sub
|
||||
RTError:
|
||||
Msgbox sRTErrorDesc, 16, sRTErrorHeader
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub PrevStep()
|
||||
Dim iCurStep as Integer
|
||||
If Not bDebugWizard Then
|
||||
@@ -145,18 +139,18 @@ Dim iCurStep as Integer
|
||||
FillStep_InputPaths(CurOffice, False)
|
||||
Else
|
||||
FillStep_Welcome()
|
||||
ToggleCheckboxesWithBoolean(True)
|
||||
bDoKeepApplValues = True
|
||||
End If
|
||||
End Select
|
||||
ImportDialog.cmdGoOn.DefaultButton = True
|
||||
RepaintHeaderPreview()
|
||||
RepaintHeaderPreview()
|
||||
Exit Sub
|
||||
RTError:
|
||||
Msgbox sRTErrorDesc, 16, sRTErrorHeader
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub CancelTask()
|
||||
If bConversionIsRunning Then
|
||||
If Msgbox(sConvertError1, 36, sConvertError2) = 6 Then
|
||||
@@ -186,9 +180,9 @@ Dim LocPrefix as String
|
||||
LocPrefix = WizardMode
|
||||
LocPrefix = ReplaceString(LocPrefix,"XML", "SO")
|
||||
If CurStep = 2 Then
|
||||
sBitmapPath = SOBitmapPath & LocPrefix & "-Import_" & CurStep & "-" & Applications(CurOffice,SBAPPLKEY) + 1 & ".bmp"
|
||||
sBitmapPath = SOBitmapPath & LocPrefix & "-Import_" & CurStep & "-" & Applications(CurOffice,SBAPPLKEY) + 1 & ".png"
|
||||
Else
|
||||
sBitmapPath = SOBitmapPath & "Import_" & CurStep & ".bmp"
|
||||
sBitmapPath = SOBitmapPath & "Import_" & CurStep & ".png"
|
||||
End If
|
||||
ImportDialog.ImportPreview.ImageURL = sBitmapPath
|
||||
End Sub
|
||||
@@ -206,7 +200,7 @@ Function CheckInstalledModule(Index as Integer) as Boolean
|
||||
Dim ModuleName as String
|
||||
Dim NameList() as String
|
||||
Dim MaxIndex as Integer
|
||||
Dim i as Integer
|
||||
Dim i as Integer
|
||||
ModuleName = ModuleList(Index)
|
||||
If Instr(1,ModuleName,"/") <> 0 Then
|
||||
CheckInstalledModule() = False
|
||||
@@ -226,7 +220,7 @@ Sub ToggleCheckboxes(oEvent as Object)
|
||||
Dim bMSEnable as Boolean
|
||||
WizardMode = oEvent.Source.Model.Tag
|
||||
bMSEnable = WizardMode = "MS"
|
||||
ToggleCheckBoxesWithBoolean(bMSEnable)
|
||||
ToggleCheckboxesWithBoolean(bMSEnable)
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -235,20 +229,14 @@ Sub ToggleCheckboxesWithBoolean(bMSEnable as Boolean)
|
||||
WizardMode = SBMICROSOFTMODE
|
||||
MaxApplCount = 3
|
||||
Else
|
||||
WizardMode = SBXMLMODE
|
||||
MaxApplCount = 4
|
||||
'Not supposed to happen - is there an assert in BASIC...
|
||||
End If
|
||||
With ImportDialogArea
|
||||
.GetControl("chkSOApplication1").Model.Enabled = Not bMSEnable
|
||||
.GetControl("chkSOApplication2").Model.Enabled = Not bMSEnable
|
||||
.GetControl("chkSOApplication3").Model.Enabled = Not bMSEnable
|
||||
.GetControl("chkSOApplication4").Model.Enabled = Not bMSEnable
|
||||
.GetControl("chkMSApplication1").Model.Enabled = bMSEnable
|
||||
.GetControl("chkMSApplication2").Model.Enabled = bMSEnable
|
||||
.GetControl("chkMSApplication3").Model.Enabled = bMSEnable
|
||||
End With
|
||||
CheckModuleInstallation()
|
||||
ImportDialog.WelcomeTextLabel2.Enabled = bMSEnable
|
||||
bDoKeepApplValues = False
|
||||
ToggleNextButton()
|
||||
End Sub
|
||||
@@ -264,8 +252,6 @@ Dim i as Integer
|
||||
With ImportDialog
|
||||
If .optMSDocuments.State = 1 Then
|
||||
bDoEnable = .chkMSApplication1.State = 1 Or .chkMSApplication2.State = 1 Or .chkMSApplication3.State = 1
|
||||
Else
|
||||
bDoEnable = .chkSOApplication1.State = 1 Or .chkSOApplication2.State = 1 Or .chkSOApplication3.State = 1 Or .chkSOApplication4.State = 1
|
||||
End If
|
||||
End With
|
||||
bDoKeepApplValues = False
|
||||
@@ -277,18 +263,13 @@ Dim i as Integer
|
||||
End Sub
|
||||
|
||||
|
||||
Sub TakeOverPathSettings()
|
||||
Sub TakeOverPathSettings()
|
||||
'Takes over the Pathsettings from the first selected application to the next applications
|
||||
If Applications(CurOffice,SBDOCSOURCE) = "" Then
|
||||
Applications(CurOffice,SBDOCSOURCE) = Applications(0,SBDOCSOURCE)
|
||||
Applications(CurOffice,SBDOCTARGET) = Applications(0,SBDOCTARGET)
|
||||
If WizardMode = SBXMLMODE AND Applications(CurOffice,SBAPPLKEY) = 3 Then
|
||||
Applications(CurOffice,SBTEMPLSOURCE) = Applications(CurOffice,SBDOCSOURCE)
|
||||
Applications(CurOffice,SBTEMPLTARGET) = Applications(CurOffice,SBDOCTARGET)
|
||||
Else
|
||||
Applications(CurOffice,SBTEMPLSOURCE) = Applications(0,SBTEMPLSOURCE)
|
||||
Applications(CurOffice,SBTEMPLTARGET) = Applications(0,SBTEMPLTARGET)
|
||||
End If
|
||||
Applications(CurOffice,SBTEMPLSOURCE) = Applications(0,SBTEMPLSOURCE)
|
||||
Applications(CurOffice,SBTEMPLTARGET) = Applications(0,SBTEMPLTARGET)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -304,7 +285,7 @@ Function GetImportWizardPaths() as Boolean
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
GetImportWizardPaths() = False
|
||||
End Function
|
||||
</script:module>
|
||||
|
||||
Reference in New Issue
Block a user