Bug 41128 - Hyphenation doesn't honour properties in Basic
Summary: Hyphenation doesn't honour properties in Basic
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-22 11:17 UTC by Stephan Hennig
Modified: 2012-01-26 10:01 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Hennig 2011-09-22 11:17:30 UTC
Symptoms:
The attached code returns 'ra=dio'.

Expected behaviour:
The word 'radio' shouldn't be hyphenated.

Steps to reproduce:
Execute the attached code.

Thanks,
Stephan Hennig

Sub Main
	Dim oHyphen As Object
	Dim oLocale As New com.sun.star.lang.Locale
	Dim emptyArgs(2) As New com.sun.star.beans.PropertyValue
	emptyArgs(0).Name = "HyphMinLeading"
	emptyArgs(0).Value = 4
	emptyArgs(1).Name = "HyphMinTrailing"
	emptyArgs(1).Value = 4
	emptyArgs(2).Name = "HyphMinWordLength"
	emptyArgs(2).Value = 9
	Dim vReturn
	Dim sWord, sHyphWord As String
	Dim msg As String
	
	oHyphen = createUnoService("com.sun.star.linguistic2.Hyphenator")
	oLocale.Language = "en"
	oLocale.Country = "US"
	sWord = "radio"
	
	vReturn = oHyphen.createPossibleHyphens(sWord, oLocale, emptyArgs())
	If IsNull(vReturn) Then
		sHyphWord = "Null"
	Else
		sHyphWord = vReturn.getPossibleHyphens()
	End If
	
	msg = "Hyphenating " & sWord & CHR$(10) & _
		"Result: " & sHyphWord & CHR$(10)
	MsgBox msg, 0, "Hyphenate Words"
End Sub
Comment 1 Caolán McNamara 2011-09-28 05:52:49 UTC
lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
Hyphenator::createPossibleHyphens is the implementation of
createPossibleHyphens and forwards the details to "libhyphen", a standalone
hyphenation project.

Debug to find out if the passed in values are given to
Hyphenator::createPossibleHyphens as expected, more than likely the issue is
either that 

hnj_hyphen_hyphenate3 doesn't honour it, or the dictionary override it, or
something of that nature. The language may matter also.
Comment 2 Caolán McNamara 2011-09-29 07:10:17 UTC
hum, looks like the settings stuff in hyphenation will only use the optimized "name already mapped to number" case, not the "name only" path, or some such, this is fixable anyway
Comment 3 Caolán McNamara 2011-09-29 07:31:20 UTC
here's a hackaround, the "Handle"s 6,7,8 are from my dev build, they may change between versions, i.e. they're an internal speedup. But it might work for you as a temporary workaround

Sub Main
    Dim oHyphen As Object
    Dim oLocale As New com.sun.star.lang.Locale
    Dim emptyArgs(2) As New com.sun.star.beans.PropertyValue
    emptyArgs(0).Name = "HyphMinLeading"
    emptyArgs(0).Value = 4
    emptyArgs(0).Handle = 6
    emptyArgs(1).Name = "HyphMinTrailing"
    emptyArgs(1).Value = 4
    emptyArgs(1).Handle = 7
    emptyArgs(2).Name = "HyphMinWordLength"
    emptyArgs(2).Value = 9
    emptyArgs(2).Handle = 8
    Dim vReturn
    Dim sWord, sHyphWord As String
    Dim msg As String

    oHyphen = createUnoService("com.sun.star.linguistic2.Hyphenator")
    oLocale.Language = "en"
    oLocale.Country = "US"
    sWord = "radio"

    vReturn = oHyphen.createPossibleHyphens(sWord, oLocale, emptyArgs())
    If IsNull(vReturn) Then
        sHyphWord = "Null"
    Else
        sHyphWord = vReturn.getPossibleHyphens()
    End If

    msg = "Hyphenating " & sWord & CHR$(10) & _
        "Result: " & sHyphWord & CHR$(10)
    MsgBox msg, 0, "Hyphenate Words"
End Sub
Comment 4 Caolán McNamara 2011-09-29 08:28:08 UTC
http://cgit.freedesktop.org/libreoffice/core/commit/?id=be26307116092a844ce97115fe7f5a2f0b2bd53d

should fix this specific problem anyway (for 3.5).
Comment 5 Stephan Hennig 2012-01-26 10:01:17 UTC
Confirmed, I cannot reproduce the wrong hyphenation anymore.

LibO 3.5 RC2 on Windows XP

Thanks,
Stephan Hennig