Added configuration dialog

This commit is contained in:
Georgy Litvinov 2020-03-05 20:55:14 +01:00
parent 1045e9c871
commit 95f8ad6769
5 changed files with 57 additions and 8 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark23
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark24
End Sub
@ -15,6 +15,9 @@ Sub cleanButton
End Sub
Sub makerUpMenu()
End Sub
Private Sub quietCleaning
Dim description As String
Dim statusIndicator as Object

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ConfigDialog" dlg:left="196" dlg:top="109" dlg:width="157" dlg:height="64" dlg:closeable="true" dlg:moveable="true">
<dlg:bulletinboard>
<dlg:checkbox dlg:id="CB_complexity" dlg:tab-index="0" dlg:left="5" dlg:top="13" dlg:width="150" dlg:height="19" dlg:value="Включить расширенное управление чисткой" dlg:checked="false"/>
<dlg:button dlg:id="OK" dlg:tab-index="1" dlg:left="9" dlg:top="45" dlg:width="59" dlg:height="13" dlg:value="Сохранить" dlg:button-type="ok"/>
<dlg:button dlg:id="CommandButton1" dlg:tab-index="2" dlg:left="-132" dlg:top="41" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
<dlg:button dlg:id="CANCEL" dlg:tab-index="3" dlg:left="77" dlg:top="45" dlg:width="59" dlg:height="13" dlg:value="Отмена" dlg:button-type="cancel"/>
</dlg:bulletinboard>
</dlg:window>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Configuration" script:language="StarBasic" script:moduleType="normal">Public Const redactionExtenstionName As String = &quot;cleanAndValidate&quot;
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Configuration" script:language="StarBasic" script:moduleType="normal">Public Const redactionExtensionName As String = &quot;cleanAndValidate&quot;
Function initRedactionConfiguration()
On Error Goto exceptionHandler
@ -9,9 +9,9 @@ Function initRedactionConfiguration()
Dim props(2) As New com.sun.star.beans.PropertyValue
regFactory = CreateUnoService(&quot;com.sun.star.ucb.Store&quot;)
reg = regFactory.createPropertySetRegistry(redactionExtenstionName)
reg = regFactory.createPropertySetRegistry(redactionExtensionName)
redactionProps = reg.openPropertySet(redactionExtenstionName, TRUE)
redactionProps = reg.openPropertySet(redactionExtensionName, TRUE)
redactionProps.addProperty(&quot;complexity&quot;, 128, &quot;user&quot;)
initConfigureation = redactionProps
exceptionHandler:
@ -19,9 +19,43 @@ Function initRedactionConfiguration()
initRedactionConfiguration = redactionProps
End Function
Sub setRedactionComplexity(complexityLevel)
Private Sub setConfigFromDialog(dialog)
Dim config As Object
config = initRedactionConfiguration()
config.setPropertyValue(&quot;complexity&quot;, complexityLevel)
If dialog.getControl(&quot;CB_complexity&quot;).state = 1 Then
config.setPropertyValue(&quot;complexity&quot;, &quot;makerUp&quot;)
Else
config.setPropertyValue(&quot;complexity&quot;, &quot;user&quot;)
EndIf
End Sub
Private Sub loadConfigToDialog(dialog)
Dim config As Object
config = initRedactionConfiguration()
If config.getPropertyValue(&quot;complexity&quot;) = &quot;makerUp&quot; Then
dialog.getControl(&quot;CB_complexity&quot;).state = 1
Else
dialog.getControl(&quot;CB_complexity&quot;).state = 0
EndIf
End Sub
Private Sub configurationDialog
Dim dialog As Object
DialogLibraries.LoadLibrary(&quot;Redaction&quot;)
dialog = CreateUnoDialog(DialogLibraries.Redaction.ConfigDialog)
loadConfigToDialog(dialog)
dialog.setVisible(true)
Select Case dialog.Execute()
Case 1
setConfigFromDialog(dialog)
Case 0
End Select
dialog.setVisible(false)
dialog.dispose()
Exit sub
End Sub
</script:module>

View file

@ -1,3 +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="Redaction" library:readonly="false" library:passwordprotected="false"/>
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Redaction" library:readonly="false" library:passwordprotected="false">
<library:element library:name="ConfigDialog"/>
</library:library>