lib

KoHyphenator Class Reference

#include <kohyphen.h>

List of all members.


Detailed Description

The KoHyphenator class provides an interface to the libhnj hyphenation library.

Author:
Alexander Dymo (cloudtemple@mksat.net)

Lukas Tinkl (lukas.tinkl@suse.cz)

The KoHyphenator class provides an interface to the libhnj hyphenation library.

Libhnj library was written for TeX and adopted to use with OpenOffice. This library tries to adopt it for KDE.

It handles the hyphenation dictionary loading for the specified language. QString -> char* conversion is done by using of settings in dicts.xml file in datadir/koffice/hyphdicts (dictionaries are also located there).

The hyphenate() functions returns QString containing hyphenation chars (0xad) or char* in format of hnj_hyphen_hyphenate() function from libhnj library.

Definition at line 56 of file kohyphen.h.


Public Member Functions

 ~KoHyphenator ()
bool checkHyphenPos (const QString &str, int pos, const QString &lang) const
char * hyphens (const QString &str, const QString &lang) const
QString hyphenate (const QString &str, const QString &lang) const

Static Public Member Functions

static KoHyphenatorself ()

Member Function Documentation

bool KoHyphenator::checkHyphenPos ( const QString &  str,
int  pos,
const QString &  lang 
) const

Checks if the letter in position pos is placed before the hyphen.

Can be used to check if the line break at given position should be forced and automatic hyphen added.

Definition at line 153 of file kohyphen.cpp.

QString KoHyphenator::hyphenate ( const QString &  str,
const QString &  lang 
) const

Hyphenates the string str and returns the string with hyphenation marks in it.

Parameters:
str String to be hyphenated.
lang Language for the hyphenation dictionary to be loaded. Language: two chars containing the ISO 639-1 code (for example "en", "uk", etc.) (could be lang_COUNTRY as well).

Definition at line 118 of file kohyphen.cpp.

char * KoHyphenator::hyphens ( const QString &  str,
const QString &  lang 
) const

Returns the pointer to the string in hnj_hyphen_hyphenate() format (that is hyphenation function from underlying libhnj library).

The string is array of integer numbers. Each odd number marks that hyphen can be added after the character in the position of that number. The returned string must be deleted with "delete[] x;"

For example, for the string "example" the returning value is "01224400".

Parameters:
str String to be hyphenated.
lang Language for the hyphenation dictionary to be loaded. Language: two chars containing the ISO 639-1 code (for example "en", "uk", etc.) (could be lang_COUNTRY as well).

Definition at line 98 of file kohyphen.cpp.

KoHyphenator * KoHyphenator::self (  )  [static]

Returns the single KoHyphenator instance (singleton pattern) Beware that this might throw an exception in case of an installation problem! Catch KoHyphenatorExceptions!

Definition at line 41 of file kohyphen.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys