Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
1d95cee96c | |||
4d70244041 | |||
5e9a36bbfd | |||
7e8fd76cb3 | |||
3123de95c8 | |||
8bef4474ae | |||
907c483775 |
10 changed files with 135 additions and 52 deletions
|
@ -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 mark93
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Clean" script:language="StarBasic">Sub mark96
|
||||
|
||||
End Sub
|
||||
|
||||
|
@ -50,6 +50,7 @@ Private Sub makerUpMenu
|
|||
advancedCleaningDialog.getControl("convertFontsToCharStyles").Label = getTranslation("advancedMenuconvertFontsToCharStyles")
|
||||
advancedCleaningDialog.getControl("fixBrokenCharBackTransparent").Label = getTranslation("fixBrokenCharBackTransparentMenuItem")
|
||||
advancedCleaningDialog.getControl("removeNotTransparentBackgrounds").Label = getTranslation("removeNotTransparentBackgrounds")
|
||||
advancedCleaningDialog.getControl("fixDiacriticKerning").Label = getTranslation("fixDiacriticKerning")
|
||||
advancedCleaningDialog.getControl("Cancel").Label = getTranslation("buttonCancel")
|
||||
advancedCleaningDialog.getControl("OK").Label = getTranslation("buttonOK")
|
||||
advancedCleaningDialog.getControl("buttonLoad").Label = getTranslation("buttonLoad")
|
||||
|
@ -164,7 +165,9 @@ Private Sub cleanAccordingTo(dialog As Object)
|
|||
If dialog.getControl("removeNotTransparentBackgrounds").state = 1 Then
|
||||
fixColoredBackgroundInDoc()
|
||||
EndIf
|
||||
|
||||
If dialog.getControl("fixDiacriticKerning").state = 1 Then
|
||||
fixDiacriticKerning()
|
||||
EndIf
|
||||
|
||||
statusIndicator.end()
|
||||
saveAndreload()
|
||||
|
@ -203,6 +206,8 @@ Private Sub quietCleaning
|
|||
saveAndreload()
|
||||
statusIndicator = ThisComponent.getCurrentController.statusIndicator
|
||||
unicodeSymbolsConversion
|
||||
statusIndicator.Start(getTranslation("statusFixingDiacriticCharactersKerning"),100)
|
||||
fixDiacriticKerning
|
||||
statusIndicator.Start(getTranslation("statusCleaningManualFormatting"),100)
|
||||
cleanFormatting
|
||||
statusIndicator.Start(getTranslation("statusReplaceWhiteBackground"),100)
|
||||
|
@ -330,7 +335,7 @@ Private Sub unicodeSymbolsConversion
|
|||
'Cyrillic unicode block range \u0400-\u04FF
|
||||
'Basic Latin \u0020-\u007E
|
||||
'Combining diacritical marks 0301 0304 0303 0323 032e 0331 035f
|
||||
combiningDiacritic_Astra = "\u0301\u0303\u0304\u0323\u032e\u0331\u0341\u035f"
|
||||
combiningDiacritic_Astra = "\u0301\u0303\u0304\u0308\u0323\u032e\u0331\u0341\u035f"
|
||||
Dim extendedLatinA_Astra As String
|
||||
extendedLatinA_Astra = "\u1e15\u1e17\u1e53\u0129\u0169"
|
||||
'
|
||||
|
@ -2118,4 +2123,67 @@ Function fixColoredBackgroundInDoc() As Boolean
|
|||
EndIf
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Sub fixDiacriticKerning
|
||||
Dim oSearch As Object
|
||||
Dim oFound As Object
|
||||
Dim oPara As Object
|
||||
oSearch = ThisComponent.createSearchDescriptor()
|
||||
oSearch.SearchString = "[\u0300-\u036F]"
|
||||
oSearch.SearchRegularExpression=True
|
||||
oSearch.searchAll=True
|
||||
oFound = ThisComponent.findFirst(oSearch)
|
||||
Do While Not IsNull(oFound)
|
||||
oPara = oFound.TextParagraph
|
||||
fixDiacriticKerningInPara(oPara)
|
||||
oFound = ThisComponent.findNext(oFound.End, oSearch)
|
||||
Loop
|
||||
End Sub
|
||||
|
||||
Sub fixDiacriticKerningInPara(oPara As Object)
|
||||
Dim paraEnum As Object
|
||||
Dim portion As Object
|
||||
Dim prevPortion As Object
|
||||
paraEnum = oPara.createEnumeration
|
||||
If paraEnum.hasMoreElements Then
|
||||
prevPortion = paraEnum.nextElement
|
||||
While paraEnum.hasMoreElements
|
||||
portion = paraEnum.nextElement
|
||||
While isFirstCharDiacritic(portion)
|
||||
moveFirstCharacter(portion, prevPortion)
|
||||
Wend
|
||||
prevPortion = portion
|
||||
Wend
|
||||
EndIf
|
||||
End Sub
|
||||
|
||||
Function isFirstCharDiacritic(portion As Object) As Boolean
|
||||
isFirstCharDiacritic = false
|
||||
Dim portionText As String
|
||||
Dim diaLowBound As Long
|
||||
Dim diaHighBound As Long
|
||||
Dim charNum As Long
|
||||
diaLowBound = 768
|
||||
diaHighBound = 879
|
||||
portionText = portion.String
|
||||
If Len(portionText) = 0 Then
|
||||
Exit Function
|
||||
EndIf
|
||||
charNum = Asc(portionText)
|
||||
If charNum >= diaLowBound And charNum <= diaHighBound Then
|
||||
isFirstCharDiacritic = true
|
||||
EndIf
|
||||
End Function
|
||||
|
||||
Sub moveFirstCharacter(portion As Object, prevPortion As Object)
|
||||
Dim prevEnd As Object
|
||||
Dim nextStart As Object
|
||||
prevEnd = prevPortion.getEnd()
|
||||
prevEnd.String = Left(portion.String,1)
|
||||
nextStart = portion.Text.createTextCursorByRange(portion.Start)
|
||||
nextStart.goRight(1,true)
|
||||
nextStart.setString("")
|
||||
End Sub
|
||||
|
||||
</script:module>
|
|
@ -1,10 +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="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="265" dlg:help-text="&21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&22.CleaningDialog.Title">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="CleaningDialog" dlg:left="107" dlg:top="22" dlg:width="237" dlg:height="285" dlg:help-text="&21.CleaningDialog.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&22.CleaningDialog.Title">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="251" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/>
|
||||
<dlg:button dlg:id="Cancel" dlg:tab-index="0" dlg:left="28" dlg:top="271" dlg:width="40" dlg:height="12" dlg:value="Отмена" dlg:button-type="cancel"/>
|
||||
<dlg:button dlg:id="CommandButton1" dlg:tab-index="1" dlg:left="24" dlg:top="180" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
|
||||
<dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="251" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
|
||||
<dlg:button dlg:id="OK" dlg:tab-index="2" dlg:left="92" dlg:top="271" dlg:width="40" dlg:height="12" dlg:value="OK" dlg:button-type="ok"/>
|
||||
<dlg:checkbox dlg:id="fontsInStyles" dlg:tab-index="3" dlg:left="11" dlg:top="10" dlg:width="218" dlg:height="7" dlg:value="Заменить названия шрифтов в стилях" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="removeLinks" dlg:tab-index="6" dlg:left="11" dlg:top="60" dlg:width="218" dlg:height="7" dlg:value="Удалить гиперссылки" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="cleanFormatting" dlg:tab-index="5" dlg:left="11" dlg:top="30" dlg:width="218" dlg:height="7" dlg:value="Очистить форматирование" dlg:checked="false"/>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<dlg:checkbox dlg:id="removeManualPageBreaks" dlg:tab-index="15" dlg:left="11" dlg:top="160" dlg:width="218" dlg:height="7" dlg:value="Удалить все разрывы страниц" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="replaceWhiteBackground" dlg:tab-index="16" dlg:left="11" dlg:top="40" dlg:width="218" dlg:height="7" dlg:value="Заменить белый фон символов на прозрачный" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="removeBasic" dlg:tab-index="17" dlg:left="11" dlg:top="170" dlg:width="218" dlg:height="7" dlg:value="Удалить макросы" dlg:checked="false"/>
|
||||
<dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="251" dlg:width="65" dlg:height="12" dlg:value="loadTemplate">
|
||||
<dlg:button dlg:id="buttonLoad" dlg:tab-index="18" dlg:left="158" dlg:top="271" dlg:width="65" dlg:height="12" dlg:value="loadTemplate">
|
||||
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Redaction.Configuration.configureStyleFileDialog?language=Basic&location=application" script:language="Script"/>
|
||||
</dlg:button>
|
||||
<dlg:checkbox dlg:id="removeAllFields" dlg:tab-index="19" dlg:left="11" dlg:top="180" dlg:width="218" dlg:height="7" dlg:value="Удалить все поля" dlg:checked="false"/>
|
||||
|
@ -30,6 +30,7 @@
|
|||
<dlg:checkbox dlg:id="convertFontsToCharStyles" dlg:tab-index="23" dlg:left="11" dlg:top="210" dlg:width="218" dlg:height="7" dlg:value="Конвертировать шрифты в стили символов" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="fixBrokenCharBackTransparent" dlg:tab-index="24" dlg:left="11" dlg:top="220" dlg:width="218" dlg:height="7" dlg:value="fixBrokenCharBackTransparent" dlg:checked="false"/>
|
||||
<dlg:checkbox dlg:id="removeNotTransparentBackgrounds" dlg:tab-index="25" dlg:left="11" dlg:top="50" dlg:width="218" dlg:height="7" dlg:value="Удалить непрозрачные фоны в тексте" dlg:checked="false"/>
|
||||
<dlg:text dlg:id="description" dlg:tab-index="26" dlg:left="11" dlg:top="231" dlg:width="217" dlg:height="16" dlg:value="Label1" dlg:multiline="true"/>
|
||||
<dlg:text dlg:id="description" dlg:tab-index="26" dlg:left="11" dlg:top="251" dlg:width="217" dlg:height="16" dlg:value="Label1" dlg:multiline="true"/>
|
||||
<dlg:checkbox dlg:id="fixDiacriticKerning" dlg:tab-index="27" dlg:left="11" dlg:top="230" dlg:width="218" dlg:height="7" dlg:value="Fix diacritic kerning" dlg:checked="false"/>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
|
@ -1,7 +1,7 @@
|
|||
<?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 redactionExtensionName = "cleanAndValidate"
|
||||
Public Const redactionExtensionVersion = "0.10.5"
|
||||
Public Const redactionExtensionVersion = "0.10.11"
|
||||
Public Const template_name_monography = "Монография"
|
||||
Public Const template_name_pj = "Философский журнал"
|
||||
Public Const template_name_pq = "Вопросы философии"
|
||||
|
|
|
@ -344,6 +344,12 @@ Function getRussian(identifier As String) As String
|
|||
Case "templateChosen"
|
||||
getRussian = "Выбран шаблон"
|
||||
Exit Function
|
||||
Case "statusFixingDiacriticCharactersKerning"
|
||||
getRussian = "Исправляем комбинирование с диакритическими символами"
|
||||
Exit Function
|
||||
Case "fixDiacriticKerning"
|
||||
getRussian = "Исправить комбинирование с диакритическими символами"
|
||||
Exit Function
|
||||
Case Else
|
||||
getRussian = "Перевод не найден"
|
||||
End Select
|
||||
|
@ -670,6 +676,12 @@ Function getEnglish(identifier As String) As String
|
|||
Case "templateChosen"
|
||||
getEnglish = "Selected template"
|
||||
Exit Function
|
||||
Case "statusFixingDiacriticCharactersKerning"
|
||||
getEnglish = "Fixing the combination with diacritics "
|
||||
Exit Function
|
||||
Case "fixDiacriticKerning"
|
||||
getEnglish = "Fix combining with diacritic characters"
|
||||
Exit Function
|
||||
Case Else
|
||||
getEnglish = "No translation"
|
||||
End Select
|
||||
|
@ -995,6 +1007,12 @@ Function getCroatian(identifier As String) As String
|
|||
Case "templateChosen"
|
||||
getCroatian = "Izabrani šablon"
|
||||
Exit Function
|
||||
Case "statusFixingDiacriticCharactersKerning"
|
||||
getCroatian = "Popravljanje kombinacije s dijakritičkim znakovima"
|
||||
Exit Function
|
||||
Case "fixDiacriticKerning"
|
||||
getCroatian = "Ispravite kombiniranje s naglašenim likovima"
|
||||
Exit Function
|
||||
Case Else
|
||||
getCroatian = "No translation"
|
||||
End Select
|
||||
|
@ -1320,6 +1338,12 @@ Function getSerbian(identifier As String) As String
|
|||
Case "templateChosen"
|
||||
getSerbian = "Изабрани шаблон"
|
||||
Exit Function
|
||||
Case "statusFixingDiacriticCharactersKerning"
|
||||
getSerbian = "Ispravljanje kombinacije sa dijakritičkim znacima "
|
||||
Exit Function
|
||||
Case "fixDiacriticKerning"
|
||||
getSerbian = "Ispravite kombiniranje s naglašenim likovima"
|
||||
Exit Function
|
||||
Case Else
|
||||
getSerbian = "No translation"
|
||||
End Select
|
||||
|
@ -1645,6 +1669,12 @@ Function getBosnian(identifier As String) As String
|
|||
Case "templateChosen"
|
||||
getBosnian = "Izabrani šablon"
|
||||
Exit Function
|
||||
Case "statusFixingDiacriticCharactersKerning"
|
||||
getBosnian = "Popravljanje kombinacije s dijakritičkim znakovima"
|
||||
Exit Function
|
||||
Case "fixDiacriticKerning"
|
||||
getBosnian = "Ispravite kombiniranje s naglašenim likovima"
|
||||
Exit Function
|
||||
Case Else
|
||||
getBosnian = "No translation"
|
||||
End Select
|
||||
|
|
|
@ -1,7 +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="Validation" script:language="StarBasic">Sub markval30
|
||||
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Validation" script:language="StarBasic">Sub markval31
|
||||
End Sub
|
||||
|
||||
|
||||
|
@ -770,11 +769,9 @@ Sub fontReportButton
|
|||
Exit sub
|
||||
EndIf
|
||||
Dim FileName As String
|
||||
FileName = getCharsInFont(targetFontName)
|
||||
getCharsInFont(targetFontName)
|
||||
statusIndicator.end()
|
||||
If FileName <> "" Then
|
||||
openReport(FileName)
|
||||
EndIf
|
||||
|
||||
End Sub
|
||||
|
||||
Sub onSelectFont(oEvent)
|
||||
|
@ -914,7 +911,7 @@ Sub addToArray(xArray(),vNextElement)
|
|||
xArray(iUB) = vNextElement
|
||||
End Sub
|
||||
|
||||
Function getCharsInFont(fontName As String) As String
|
||||
Sub getCharsInFont(fontName As String)
|
||||
Dim resultArray() As String
|
||||
Dim pageNums() As Long
|
||||
Dim firstPages() As Long
|
||||
|
@ -1000,43 +997,30 @@ Function getCharsInFont(fontName As String) As String
|
|||
EndIf
|
||||
Next j
|
||||
Next i
|
||||
resultString = ""
|
||||
For i = LBound(resultArray) To UBound(resultArray)
|
||||
resultString = resultString & "<a href='https://unicode-table.com/ru/" & resultArray(i) & "'" & ">https://unicode-table.com/ru/" & resultArray(i) & "</a> " & getTranslation("charFirstPage") & " " & pageNums(i) & "<br>" & Chr(10)
|
||||
Next i
|
||||
|
||||
If resultString <> "" Then
|
||||
'MsgBox "Символы в шрифте "& fontName &Chr(10)&resultString
|
||||
Dim FileName As String 'Holds the file name
|
||||
Dim n As Integer 'Holds the file number
|
||||
Dim f As Integer 'Index variable
|
||||
Dim s As String 'Temporary string for input
|
||||
Dim fileaccess As Object
|
||||
Dim outtextstream As Object
|
||||
Dim out As Object
|
||||
|
||||
Dim sTemp$
|
||||
GlobalScope.BasicLibraries.loadLibrary("Tools")
|
||||
path=DirectoryNameoutofPath(ThisComponent.getURL(),"/")
|
||||
FileName = path & "/symbolsInFont" & fontName & ".html"
|
||||
'n = FreeFile() 'Next free file number
|
||||
'Open FileName For Output Access Read Write As #n 'Open for read/write
|
||||
fileaccess = createUnoService ("com.sun.star.ucb.SimpleFileAccess")
|
||||
outtextstream = createUnoService ("com.sun.star.io.TextOutputStream")
|
||||
outtextstream.setEncoding( "UTF-8" )
|
||||
out = fileaccess.openFileWrite( FileName )
|
||||
outtextstream.setOutputStream( out )
|
||||
outtextstream.writeString( "<html><head><title>" & getTranslation("symbolsInFontHeading") & " "& fontName & "</title></head><body><h2>" & getTranslation("symbolsInFontHeading") & " "& fontName &":</h2>"&resultString &"</body></html>" )
|
||||
outtextstream.closeOutput()
|
||||
getCharsInFont = FileName
|
||||
Exit Function
|
||||
Dim newDocCursor As Object
|
||||
Dim newDoc As Object
|
||||
newDoc = starDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, Array())
|
||||
newDocCursor = newDoc.getCurrentController().getViewCursor()
|
||||
newDocCursor.String = getTranslation("symbolsInFontHeading") & " " & fontName
|
||||
newDocCursor.ParaStyleName = "Heading 1"
|
||||
newDocCursor.collapseToEnd()
|
||||
newDocCursor.Text.insertControlCharacter(newDocCursor.End,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
|
||||
For i = LBound(resultArray) To UBound(resultArray)
|
||||
newDocCursor.ParaStyleName = "Text body"
|
||||
newDocCursor.String = "https://unicode-table.com/ru/" & resultArray(i)
|
||||
newDocCursor.HyperLinkURL = "https://unicode-table.com/ru/" & resultArray(i)
|
||||
newDocCursor.collapseToEnd()
|
||||
newDocCursor.String = " " & getTranslation("charFirstPage") & " " & pageNums(i)
|
||||
newDocCursor.collapseToEnd()
|
||||
newDocCursor.Text.insertControlCharacter(newDocCursor.End,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
|
||||
Next i
|
||||
Exit Sub
|
||||
|
||||
Else
|
||||
MsgBox getTranslation("symbolsInFontNotFound1") & " " & fontName & " " & getTranslation("symbolsInFontNotFound2")
|
||||
getCharsInFont = ""
|
||||
Exit Function
|
||||
EndIf
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
|
||||
Function findBadCharacters() As Boolean
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<description xmlns="http://openoffice.org/extensions/update/2006"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<identifier value="pro.litvinovg.Redaction"/>
|
||||
<version value="0.10.6" />
|
||||
<version value="0.10.11" />
|
||||
<update-download>
|
||||
<src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/uploads/2b71def6e0a91a02dbee2b8c73fda880/cleanAndValidate.oxt" />
|
||||
<src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/uploads/330066acb026243a8a0eab002de1a1f3/cleanAndValidate.oxt" />
|
||||
</update-download>
|
||||
<release-notes>
|
||||
<src xlink:href="https://dev.litvinovg.pro/litvinovg/cleanandvalidate/-/raw/master/releasenotes.txt" lang="en" />
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
|
||||
|
||||
<version value="0.10.5"/>
|
||||
<version value="0.10.11"/>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
version=0.10.6
|
||||
version=0.10.11
|
||||
|
|
Binary file not shown.
BIN
translations.ods
BIN
translations.ods
Binary file not shown.
Loading…
Add table
Reference in a new issue