Translations and load template dialog
This commit is contained in:
parent
bd3b7706d8
commit
75fd6c8192
11 changed files with 221 additions and 15 deletions
|
@ -14,9 +14,12 @@ Function initRedactionConfiguration()
|
|||
|
||||
redactionProps = reg.openPropertySet(redactionExtensionName, TRUE)
|
||||
redactionProps.addProperty("complexity", 128, "user")
|
||||
initRedactionConfiguration = redactionProps
|
||||
exceptionHandler:
|
||||
exceptionHandler:
|
||||
Resume Next
|
||||
On Error Goto exceptionHandler2
|
||||
redactionProps.addProperty("defaultTemplate", 128, "Статья.ott")
|
||||
exceptionHandler2:
|
||||
Resume Next
|
||||
initRedactionConfiguration = redactionProps
|
||||
End Function
|
||||
|
||||
|
@ -56,4 +59,111 @@ Private Sub configurationDialog
|
|||
dialog.dispose()
|
||||
Exit sub
|
||||
End Sub
|
||||
|
||||
Private Sub quietStartDialog
|
||||
'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
||||
Dim dialog As Object
|
||||
DialogLibraries.LoadLibrary("Redaction")
|
||||
dialog = CreateUnoDialog(DialogLibraries.Redaction.StartQuietCleaning)
|
||||
Dim lang As String
|
||||
lang = GetStarOfficeLocale().Language
|
||||
Dim description As String
|
||||
Dim buttonNameOk As String
|
||||
Dim buttonNameStop As String
|
||||
Dim buttonNameLoad As String
|
||||
description = getTranslation(lang,"startQuietCleaningDescription")
|
||||
buttonNameOk = getTranslation(lang,"buttonOk")
|
||||
buttonNameStop = getTranslation(lang,"buttonStop")
|
||||
buttonNameLoad = getTranslation(lang,"buttonLoad")
|
||||
dialog.getControl("Description").setText(description)
|
||||
dialog.getControl("buttonOk").Label = buttonNameOk
|
||||
dialog.getControl("buttonStop").Label = buttonNameStop
|
||||
dialog.getControl("buttonLoad").Label = buttonNameLoad
|
||||
dialog.setVisible(true)
|
||||
Select Case dialog.Execute()
|
||||
Case 1
|
||||
dialog.setVisible(false)
|
||||
dialog.dispose()
|
||||
quietCleaning
|
||||
Case 0
|
||||
dialog.setVisible(false)
|
||||
dialog.dispose()
|
||||
End Select
|
||||
|
||||
Exit sub
|
||||
End Sub
|
||||
|
||||
Private Sub noStylesFileDialog
|
||||
'Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
|
||||
Dim dialog As Object
|
||||
DialogLibraries.LoadLibrary("Redaction")
|
||||
dialog = CreateUnoDialog(DialogLibraries.Redaction.NoStyleFile)
|
||||
Dim lang As String
|
||||
lang = GetStarOfficeLocale().Language
|
||||
Dim description As String
|
||||
Dim buttonName As String
|
||||
description = getTranslation(lang,"noFileWithStylesFound")
|
||||
buttonName = getTranslation(lang,"buttonNameToSelectFileWithStyles")
|
||||
dialog.getControl("Description").setText(description)
|
||||
dialog.getControl("FileSelection").Label = buttonName
|
||||
dialog.setVisible(true)
|
||||
Select Case dialog.Execute()
|
||||
Case 1
|
||||
setDeafultTemplate(selectedTemplate)
|
||||
Case 0
|
||||
|
||||
End Select
|
||||
dialog.setVisible(false)
|
||||
dialog.dispose()
|
||||
Exit sub
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub setDeafultTemplate()
|
||||
Dim selectedTemplate As String
|
||||
selectedTemplate = getFileURLDialog()
|
||||
If IsEmpty(selectedTemplate) Then
|
||||
Exit sub
|
||||
EndIf
|
||||
Dim fileName As String
|
||||
Dim config As Object
|
||||
config = initRedactionConfiguration()
|
||||
fileName = Dir(selectedTemplate)
|
||||
config.setPropertyValue("defaultTemplate",fileName)
|
||||
Dim templatePath As String
|
||||
templatePath = getTemplatePath()
|
||||
FileCopy(selectedTemplate, templatePath & "/" & fileName)
|
||||
End Sub
|
||||
|
||||
Function getFileURLDialog() As String
|
||||
Dim oFilePicker As Object, oSimpleFileAccess As Object
|
||||
Dim oSettings As Object, oPathSettings As Object
|
||||
Dim oTextField As Object, oTextFieldModel As Object
|
||||
Dim sFileURL As String
|
||||
Dim sFiles As Variant
|
||||
oFilePicker = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
|
||||
oFilePicker.AppendFilter( "All files (*.*)", "*.*" )
|
||||
oFilePicker.AppendFilter( "Open Document Text", "*.odt;*.ott" )
|
||||
oFilePicker.SetCurrentFilter( "Open Document Text" )
|
||||
If sFileURL = "" Then
|
||||
oPathSettings = CreateUnoService( "com.sun.star.util.PathSettings" )
|
||||
sFileURL = oPathSettings.Work
|
||||
End If
|
||||
REM set display directory
|
||||
oSimpleFileAccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" )
|
||||
If oSimpleFileAccess.exists( sFileURL ) And oSimpleFileAccess.isFolder( sFileURL ) Then
|
||||
oFilePicker.setDisplayDirectory( sFileURL )
|
||||
End If
|
||||
|
||||
If oFilePicker.execute() Then
|
||||
sFiles = oFilePicker.getFiles()
|
||||
sFileURL = sFiles(0)
|
||||
If oSimpleFileAccess.exists( sFileURL ) Then
|
||||
getFileURLDialog = sFileURL
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
getFileURLDialog = ""
|
||||
End Function
|
||||
</script:module>
|
Loading…
Add table
Add a link
Reference in a new issue