Bug 41083

Summary: Hyphenation doesn't honour minimum word length in Basic
Product: LibreOffice Reporter: Stephan Hennig <sh2d>
Component: LibreOfficeAssignee: Not Assigned <libreoffice-bugs>
Status: CLOSED FIXED    
Severity: normal    
Priority: medium    
Version: 3.4.3 release   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
Whiteboard:
Crash report or crash signature: Regression By:

Description Stephan Hennig 2011-09-21 06:47:09 UTC
Hyphenation in Basic doesn't seem to take option (translated from German)

   Options
     Language configuration
       Linguistic
         Options
           Minimum word length for hyphenation

into account.  The word 'radio' is hyphenated whatever value the option is set to.  Options 'Leading characters' and 'Trailing characters' are honoured, though.  Setting them to three or four, resp., prevents hyphenation.

Thanks,
Stephan Hennig


Sub Main
  Dim oHyphen As Object
  Dim oLocale As New com.sun.star.lang.Locale
  Dim emptyArgs() As New com.sun.star.beans.PropertyValue
  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:49:19 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-28 06:14:13 UTC
I sort of suspect that no min/max gets seen by Hyphenator::createPossibleHyphens which might not be a bug, its unclear whose job it is to send the global options down there. Best to start on bug 41128 first
Comment 3 Caolán McNamara 2011-09-29 05:16:34 UTC
lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx

Hyphenator::hyphenate takes MinWordLength into account, while Hyphenator::createPossibleHyphens doesn't
Comment 4 Caolán McNamara 2011-09-29 06:27:12 UTC
http://cgit.freedesktop.org/libreoffice/core/commit/?id=5f04439b17f20ba3b3aeb3432fe90e6d11c34161

should fix it now (for 3.5) I believe
Comment 5 Stephan Hennig 2012-01-26 09:48:26 UTC
Confirmed the problem is fixed in LibO 3.5 RC2 on Windows XP.