2011年7月3日 星期日

Basic for OpenOffice Writer

Const I_total = 154



Sub Sj2Uni



Dim I As Long

Dim Doc As Object

Dim Replace As Object

Dim SjWords(I_total) As String

Dim UniWords(I_total) As String

SjWords() = Array("oa2","oa3","oa5","oa7","oe2","oe3","oe5","oe7", _

"ainn2","ainn3","ainn5","ainn7","ai2","ai3","ai5","ai7", _

"am2","am3","am5","am7","ap8","ang2","ang3","ang5","ang7","ak8","an2","an3","an5","an7","at8", _

"ann2","ann3","ann5","ann7","aunn2","aunn5","aunn7","aunnh8","au2","au3","au5","au7","auh8", _

"enn2","enn3","enn5","enn7","ennh8", "ing2","ing3","ing5","ing7","ik8",_

"im2","im3","im5","im7","ip8","in2","in3","in5","in7","it8", _

"eng2","eng3","eng5","eng7","ek8","inn2","inn3","inn5","inn7","innh8","iunn2","iunn3","iunn5","iunn7", _

"ong2","ong3","ong5","ong7","ok8","nng2","nng3","nng5","nng7","ng2","ng3","ng5","ng7","ngh8",_

"onn2","onn3","onn5","onn7","onnh8", "ou1","ou2","ou3","ou5","ou7","oo2","oo3","oo5","oo7","oainn2","oainn3","oainn5","oainn7", _

"ui2","ui3","ui5","ui7","uih8","uinn2","uinn3","uinn5","uinn7","un2","un3","un5","un7","ut8",_

"m2","m5","m7","mh8","u2","u3","u5","u7","uh8","o2","o3","o5","o7","oh8","e2","e3","e5","e7","eh8", _

"i2","i3","i5","i7","ih8","a2","a3","a5","a7","ah8","u9","e9","a9","i9","o9","A9","E9","I9","O9","U9","nn")

UniWords() = Array("óa","òa","ôa","ōa","óe","òe","ôe","ōe","áiⁿ","àiⁿ","âiⁿ","āiⁿ","ái","ài","âi","āi", _

"ám","àm","âm","ām","a̍p","áng","àng","âng","āng","a̍k","án","àn","ân","ān","a̍t", _

"áⁿ","àⁿ","âⁿ","āⁿ","áuⁿ","âuⁿ","āuⁿ","a̍uⁿh","áu","àu","âu","āu","a̍uh", _

"éⁿ","èⁿ","êⁿ","ēⁿ","e̍ⁿh", "íng","ìng","îng","īng","i̍k",_

"ím","ìm","îm","īm","i̍p","ín","ìn","în","īn","i̍t", _

"éng","èng","êng","ēng","e̍k","íⁿ","ìⁿ","îⁿ","īⁿ","i̍ⁿh","iúⁿ","iùⁿ","iûⁿ","iūⁿ", _

"óng","òng","ông","ōng","o̍k","nńg","nǹg","nn̂g","nn̄g", "ńg","ǹg","n̂g","n̄g","n̍gh",_

"óⁿ","òⁿ","ôⁿ","ōⁿ","o̍ⁿh", "o͘","ó͘","ò͘","ô͘","ō͘","óo","òo","ôo","ōo","oáiⁿ","oàiⁿ","oâiⁿ","oāiⁿ", _

"úi","ùi","ûi","ūi","ui̍h","úiⁿ","ùiⁿ","ûiⁿ","ūiⁿ","ún","ùn","ûn","ūn","u̍t", _

"ḿ","m̂","m̄","m̍h","ú","ù","û","ū","u̍h","ó","ò","ô","ō","o̍h","é","è","ê","ē","e̍h", _

"í","ì","î","ī","i̍h","á","à","â","ā","a̍h","ű","e̋","a̋","i̋","ő","A̋","E̋","I̋","Ő","Ű","ⁿ" ) '10



Doc = ThisComponent

Replace = Doc.createReplaceDescriptor



For I = 0 To I_total

Replace.SearchString = SjWords(I)

Replace.ReplaceString = UniWords(I)

Doc.replaceAll(Replace)

Next I

Replace.SearchString = "ⁿg"

Replace.ReplaceString = "nng"

Doc.replaceAll(Replace)

End Sub



Sub Uni2Sj



Const I_total1 = 169

Dim I As Long

Dim Doc As Object

Dim Replace As Object

Dim SjWords(I_total) As String

Dim UniWords(I_total) As String

SjWords() = Array("oah8","oat8","oan2","oan3","oan5","oan7","oa2","oa3","oa5","oa7","oe2","oe3","oe5","oe7", _

"ainn2","ainn3","ainn5","ainn7","ai2","ai3","ai5","ai7", _

"am2","am3","am5","am7","ap8","ang2","ang3","ang5","ang7","ak8","an2","an3","an5","an7","at8", _

"ann2","ann3","ann5","ann7","aunn2","aunn5","aunn7","aunnh8","au2","au3","au5","au7","auh8", _

"enn2","enn3","enn5","enn7","ennh8", "ing2","ing3","ing5","ing7","ik8",_

"im2","im3","im5","im7","ip8","in2","in3","in5","in7","it8", _

"eng2","eng3","eng5","eng7","ek8","inn2","inn3","inn5","inn7","innh8","iunn2","iunn3","iunn5","iunn7", _

"ong2","ong3","ong5","ong7","ok8","nng2","nng3","nng5","nng7","ng2","ng3","ng5","ng7","ngh8",_

"onn2","onn3","onn5","onn7","onnh8", "ou1","ou2","ou3","ou5","ou7","oainn2","oainn3","oainn5","oainn7", _

"ui2","ui3","ui5","ui7","uih8","uinn2","uinn3","uinn5","uinn7","un2","un3","un5","un7","ut8",_

"m2","m5","m7","mh8","u2","u3","u5","u7","uh8","o2","o3","o5","o7","oh8","e2","e3","e5","e7","eh8", _

"i2","i3","i5","i7","ih8","a2","a3","a5","a7","ah8","u9","e9","a9","i9","o9","A9","E9","I9","O9","U9","ann","inn","unn","onn","enn")

UniWords() = Array("o̍ah","o̍at","oán","oàn","oân","oān","óa","òa","ôa","ōa","óe","òe","ôe","ōe", _

"áiⁿ","àiⁿ","âiⁿ","āiⁿ","ái","ài","âi","āi", _

"ám","àm","âm","ām","a̍p","áng","àng","âng","āng","a̍k","án","àn","ân","ān","a̍t", _

"áⁿ","àⁿ","âⁿ","āⁿ","áuⁿ","âuⁿ","āuⁿ","a̍uⁿh","áu","àu","âu","āu","a̍uh", _

"éⁿ","èⁿ","êⁿ","ēⁿ","e̍ⁿh", "íng","ìng","îng","īng","i̍k",_

"ím","ìm","îm","īm","i̍p","ín","ìn","în","īn","i̍t", _

"éng","èng","êng","ēng","e̍k","íⁿ","ìⁿ","îⁿ","īⁿ","i̍ⁿh","iúⁿ","iùⁿ","iûⁿ","iūⁿ", _

"óng","òng","ông","ōng","o̍k","nńg","nǹg","nn̂g","nn̄g", "ńg","ǹg","n̂g","n̄g","n̍gh",_

"óⁿ","òⁿ","ôⁿ","ōⁿ","o̍ⁿh", "o͘","ó͘","ò͘","ô͘","ō͘","oáiⁿ","oàiⁿ","oâiⁿ","oāiⁿ", _

"úi","ùi","ûi","ūi","u̍ih","úiⁿ","ùiⁿ","ûiⁿ","ūiⁿ","ún","ùn","ûn","ūn","u̍t", _

"ḿ","m̂","m̄","m̍h","ú","ù","û","ū","u̍h","ó","ò","ô","ō","o̍h","é","è","ê","ē","e̍h", _

"í","ì","î","ī","i̍h","á","à","â","ā","a̍h","ű","e̋","a̋","i̋","ő","A̋","E̋","I̋","Ő","Ű","aⁿ","iⁿ","uⁿ","oⁿ","eⁿ")

Doc = ThisComponent

Replace = Doc.createReplaceDescriptor



For I = 0 To I_total1

Replace.SearchString = UniWords(I)

Replace.ReplaceString = SjWords(I)

Doc.replaceAll(Replace)

Next I

End Sub



Const I_TTL = 20

Sub Poj2TL_TT ' 白話字 轉成 台羅 傳統



Dim I As Long

Dim Doc As Object

Dim Replace As Object

PojWords() = Array("ch","Ch","oa","óa","òa","ôa","ōa","óe","òe","ôe","ōe", _

"éng","èng","êng","ēng","e̍k","úi","ùi","ûi","ūi","u̍ih")

TlWords() = Array("ts","Ts","ua","uá","uà","uâ","uā","ué","uè","uê","uē", _

"íng","ìng","îng","īng","i̍k","uí","uì","uî","uī","ui̍h")

Doc = ThisComponent

Replace = Doc.createReplaceDescriptor



For I = 0 To I_TTL

Replace.SearchString = PojWords(I)

Replace.ReplaceString = TlWords(I)

Doc.replaceAll(Replace)

Next I

End Sub



Const I_TLP = 25

Sub Poj2TL_KIP ' 白話字 轉成 台羅教育部版

Dim I As Long

Dim Doc As Object

Dim Replace As Object

PojWords() = Array("ch","Ch","óa","òa","ôa","ōa","óe","òe","ôe","ōe","o͘","ó͘","ò͘","ô͘", _

"ō͘","éng","èng","êng","ēng","e̍k","úi","ùi","ûi","ūi","u̍ih","ⁿ",)

TlWords() = Array("ts","Ts","uá","uà","uâ","uā","ué","uè","uê","uē", "oo","óo","òo","ôo", _

"ōo", "íng","ìng","îng","īng","i̍k","uí","uì","uî","uī","ui̍h","nn")

Doc = ThisComponent

Replace = Doc.createReplaceDescriptor



For I = 0 To I_TLP

Replace.SearchString = PojWords(I)

Replace.ReplaceString = TlWords(I)

Doc.replaceAll(Replace)

Next I

End Sub



Const I_TLKIP = 5

Sub KIP2TT ' 白話字 轉成 台羅教育部版 轉 傳統

Dim I As Long

Dim Doc As Object

Dim Replace As Object

TL_TTWords() = Array("o͘","ó͘","ò͘","ô͘", "ō͘","ⁿ")

TL_KIPWords() = Array("oo","óo","òo","ôo", "ōo", "nn")

Doc = ThisComponent

Replace = Doc.createReplaceDescriptor



For I = 0 To I_TLKIP

Replace.SearchString = TL_KIPWords(I)

Replace.ReplaceString = TL_TTWords(I)

Doc.replaceAll(Replace)

Next I

Replace.SearchString = "ⁿg"

Replace.ReplaceString = "nng"

Doc.replaceAll(Replace)

Replace.SearchString = "ⁿ̂g"

Replace.ReplaceString = "nn̂g"

Doc.replaceAll(Replace)

Replace.SearchString = "ⁿ̄g"

Replace.ReplaceString = "nn̄g"

Doc.replaceAll(Replace)

Replace.SearchString = "ⁿ̍g"

Replace.ReplaceString = "nn̍g"

Doc.replaceAll(Replace)

End Sub



Const I_TL = 25

Sub TL2POJ

Dim I As Long

Dim Doc As Object

Dim Replace As Object

PojWords() = Array("ch","Ch","óa","òa","ôa","ōa","óe","òe","ôe","ōe","o͘","ó͘","ò͘","ô͘", _

"ō͘","éng","èng","êng","ēng","e̍k","ⁿ","úi","ùi","ûi","ūi","u̍ih")

TlWords() = Array("ts","Ts","uá","uà","uâ","uā","ué","uè","uê","uē", "oo","óo","òo","ôo", _

"ōo", "íng","ìng","îng","īng","i̍k","nn","uí","uì","uî","uī","ui̍h")

Doc = ThisComponent

Replace = Doc.createReplaceDescriptor



For I = 0 To I_TL

Replace.SearchString = TlWords(I)

Replace.ReplaceString = PojWords(I)

Doc.replaceAll(Replace)

Next I

End Sub

沒有留言:

張貼留言

Tn̂g-bóe-soaⁿ-niû koh lâi ah

 Kin-á-ji̍t, lâng iah lám-lám, tio̍h chham-ka ha̍k-hāu ūn-tōng-hōe bē-tàng cháu, tām-po̍h-á bē sóng. Châng-ng mn̄g in kám beh lâi, lóng chhé...