InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ILanguage Class Referenceabstract

#include <ILanguage.h>

Inheritance diagram for ILanguage:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ILANGUAGE }
 
enum  QuotationType { kSingle, kDouble }
 
enum  QuotationPosition { kLeft, kRight }
 

Public Member Functions

virtual const PMStringGetLanguageName () const =0
 
virtual const PMStringGetPrimaryLanguageName () const =0
 
virtual const PMStringGetSubLanguageName () const =0
 
virtual LanguageID GetLanguageID () const =0
 
virtual void SetLanguageName (const PMString &rName)=0
 
virtual void SetPrimaryLanguageName (const PMString &rName)=0
 
virtual void SetSubLanguageName (const PMString &rName)=0
 
virtual void SetLanguageID (const LanguageID nLanguage)=0
 
virtual void CopyFrom (const ILanguage *pLanguage)=0
 
virtual bool16 IsEqual (const ILanguage *pLanguage) const =0
 
virtual UTF32TextChar GetQuotationMark (ILanguage::QuotationType nType, ILanguage::QuotationPosition nPosition)=0
 
virtual bool16 SetQuotationMarks (const QuoteEntry &newQuoteEntry)=0
 
virtual bool16 GetQuotationMarks (QuoteEntry &qe) const =0
 
virtual TextIndex FindSurroundingWord (const ITextModel *pModel, TextIndex nPosition, int32 *pLength, FuncIsWordChar aFunction) const =0
 
virtual TextIndex FindSurroundingWordUsingWordCharFuncOnly (const ITextModel *pModel, TextIndex nPosition, int32 *pLength, FuncIsWordChar aFunction) const =0
 
virtual int16 GetWritingScript () const =0
 
virtual const char * GetOpenTypeScriptTag () const =0
 
virtual const char * GetOpenTypeLanguageTag () const =0
 
virtual bool16 AfterHyphenationCanChange () const =0
 
virtual int32 LinguisticCompare (const WideString &a, const WideString &b, LanguageID aLang=0, LanguageID bLang=0, bool16 usePrefixPunctuation=kFalse) const =0
 
virtual const OpenTypeFeatureListGetRequiredOTFeatureList () const =0
 
virtual const
ID_ICU_NAMESPACE::Locale & 
GetICULocale () const =0
 
virtual std::string GetICULocaleString () const =0
 
virtual void SetICULocale (const ID_ICU_NAMESPACE::Locale &newLocale)=0
 
virtual void SetICULocale (std::string newLocale)=0
 
virtual void SetSpellingService (ISpellingService *spellingService)=0
 
virtual ISpellingServiceQuerySpellingService (PMString *error=nil) const =0
 
virtual void SetHyphenationService (IHyphenationService *hyphenationService)=0
 
virtual IHyphenationServiceQueryHyphenationService (PMString *error=nil) const =0
 
virtual void GetHyphenString (WideString &hyphenString) const =0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

The ILanguage is a persistent interface of the kLanguageBoss. It is used and referenced by the ILanguageList which is an interface of the application's and document's workspace.

Member Function Documentation

virtual bool16 ILanguage::AfterHyphenationCanChange () const
pure virtual

AfterHyphenationCanChange returns information about hyphenation behavior for a language. Currently, only Dutch return kTrue – meaning that some words hyphenate and the piece of the word AFTER the hyphenation break can change spelling. More languages change spelling before the break, but this is only for AFTER the break.

Returns
whether the language can change spelling after the hyphenation break.
virtual void ILanguage::CopyFrom (const ILanguagepLanguage)
pure virtual

Copies the values from a different language

Parameters
pLanguagelangauge to copy
virtual TextIndex ILanguage::FindSurroundingWord (const ITextModelpModel,
TextIndex nPosition,
int32 * pLength,
FuncIsWordChar aFunction 
) const
pure virtual

Find the word at a text location.

See Also
IComposeScanner.
ITextUtils.
Parameters
pModelThe text model in question.
nPositionThe text location in question.
pLengthOUT the length of the word.
aFunctiona function that determines what characters are considered word breaking.
Returns
the beginning location of the surrounding word.
virtual TextIndex ILanguage::FindSurroundingWordUsingWordCharFuncOnly (const ITextModelpModel,
TextIndex nPosition,
int32 * pLength,
FuncIsWordChar aFunction 
) const
pure virtual

Find the word at a text location.

See Also
IComposeScanner.
ITextUtils.
Parameters
pModelThe text model in question.
nPositionThe text location in question.
pLengthOUT the length of the word.
aFunctiona function that determines what characters are considered word breaking.
Returns
the beginning location of the surrounding word.
virtual void ILanguage::GetHyphenString (WideStringhyphenString) const
pure virtual

Get string to use when hyphenating word. For most languages this is just kTextChar_HyphenMinus

Parameters
hyphenStringstring to use when hyphenating a word
virtual const ID_ICU_NAMESPACE::Locale& ILanguage::GetICULocale () const
pure virtual

Get locale to pass to ICU routines. See - http://icu.sourceforge.net/userguide/locale.html

Returns
Locale ICU locale
virtual std::string ILanguage::GetICULocaleString () const
pure virtual

Get ICU locale string by calling Locale.getName().

Returns
std::string ICU locale string
virtual LanguageID ILanguage::GetLanguageID () const
pure virtual

Returns the LanguageID that classifies this language.

If you need a unique identifier use GetLanguageName(). Language IDs are a convience to check things like - GetPrimaryLanguageID(language->GetLanguageID()) == kLanguageDutch

Returns
LanguageID lanaguage id.
virtual const PMString& ILanguage::GetLanguageName () const
pure virtual

Gets the full language name i.e.: "English: US". This name needs to be unique. It is the identifier for a language.

Returns
PMString The full language name i.e.: "English: US"
virtual const char* ILanguage::GetOpenTypeLanguageTag () const
pure virtual

Gets the OpenType language tag for the language.

See - http://partners.adobe.com/public/developer/opentype/index_tag2.html

Returns
const char* returns the OpenType language tag for the language
virtual const char* ILanguage::GetOpenTypeScriptTag () const
pure virtual

Gets the OpenType script tag for the language.

See - http://partners.adobe.com/public/developer/opentype/index_tag1.html

Returns
const char* returns the OpenType script tag for the language
virtual const PMString& ILanguage::GetPrimaryLanguageName () const
pure virtual

Gets the primary language name i.e.: "English".

Returns
PMString The primary language name i.e.: "English".
virtual UTF32TextChar ILanguage::GetQuotationMark (ILanguage::QuotationType nType,
ILanguage::QuotationPosition nPosition 
)
pure virtual

Returns the unicode value corresponding to the quote given the type and position.

Parameters
nTypeQuotationType (kDouble/kSingle),
nPositionQuotationPosition (kLeft/kRight)
Returns
UTF32TextChar the unicode value of quote
virtual bool16 ILanguage::GetQuotationMarks (QuoteEntryqe) const
pure virtual

Returns the Quote Entry object which contains four quotes. This uses the IQuotes interface on the same boss if the interface exists.

Parameters
qequote entry
Returns
bool16 kTrue if IQuotes interface was found on boss
virtual const OpenTypeFeatureList& ILanguage::GetRequiredOTFeatureList () const
pure virtual

Get OpenType features required to render this language.

Returns
OpenTypeFeatureList features required for language
virtual const PMString& ILanguage::GetSubLanguageName () const
pure virtual

Gets the sub language name i.e.: "US".

Returns
PMString The sub language name i.e.: "US".
virtual int16 ILanguage::GetWritingScript () const
pure virtual

Gets the writing script of the language

Returns
int16 returns the writing script of the language like kCTRomanScript, see RealCoolType.h
virtual bool16 ILanguage::IsEqual (const ILanguagepLanguage) const
pure virtual

Language names are equal. Does not compare settings in the language like quotes

Returns
bool16 kTrue if languge names are equal
virtual int32 ILanguage::LinguisticCompare (const WideStringa,
const WideStringb,
LanguageID aLang = 0,
LanguageID bLang = 0,
bool16 usePrefixPunctuation = kFalse 
) const
pure virtual

Compares using language. Uses ICU locale and ICU collator to compare. See - http://icu.sourceforge.net/userguide/Collate_Intro.html

Parameters
astring to compare
bstring to compare
usePrefixPunctuationcontrols whether "!B" sorts before "A" or after. Before = use punctuation.
aLanglanguage of a. currently not used
bLanglanguage of b. currently not used
Returns
int32 0 then a=b. 1 then a>b. -1 then a<b.
virtual IHyphenationService* ILanguage::QueryHyphenationService (PMStringerror = nil) const
pure virtual

Query for hyphenation service for this language

Parameters
errorName of missing hyphenation Provider. If this sting is empty and return in nil then this language did not have a hyphenation service and should not be considered an error. For example Japanese does not have a hyphenation service.
Returns
IHyphenationService hyphenation service to use for language
virtual ISpellingService* ILanguage::QuerySpellingService (PMStringerror = nil) const
pure virtual

Query for spelling service for this language

Parameters
errorName of missing spelling Provider. If this sting is empty and return in nil then this language did not have a spelling service and should not be considered an error. For example Japanese does not have a spelling service.
Returns
ISpellingService spelling service to use for language
virtual void ILanguage::SetHyphenationService (IHyphenationServicehyphenationService)
pure virtual

Set for hyphenation service for this language

Parameters
hyphenationServicehyphenation service to set for language
virtual void ILanguage::SetICULocale (const ID_ICU_NAMESPACE::Locale & newLocale)
pure virtual

Set locale to be used by routines like LinguisticCompare. SetLanguageID will overwrite the ICULocale so make sure you set it after calling SetLanguageID.

Parameters
LocaleICU locale
virtual void ILanguage::SetICULocale (std::string newLocale)
pure virtual

Set locale to be used by routines like LinguisticCompare. SetLanguageID will overwrite the ICULocale so make sure you set it after calling SetLanguageID.

Parameters
LocaleICU locale
virtual void ILanguage::SetLanguageID (const LanguageID nLanguage)
pure virtual

Sets the LanguageID that classifies this language.

Language IDs should not be used as an unique identifier. Use language name.

Parameters
nLanguagelanaguage id.
virtual void ILanguage::SetLanguageName (const PMStringrName)
pure virtual

Sets the full language name i.e.: "English: US"

Parameters
rNameThe full language name i.e.: "English: US"
virtual void ILanguage::SetPrimaryLanguageName (const PMStringrName)
pure virtual

Sets the primary language name i.e.: "English".

Parameters
rNameThe primary language name i.e.: "English".
virtual bool16 ILanguage::SetQuotationMarks (const QuoteEntrynewQuoteEntry)
pure virtual

Sets the Quote Entry. This uses the IQuotes interface on the same boss if the interface exists.

Parameters
newQuoteEntryentry
Returns
bool16 kTrue if IQuotes interface was found on boss
virtual void ILanguage::SetSpellingService (ISpellingServicespellingService)
pure virtual

Set for spelling service for this language

Parameters
spellingServicespelling service to set for language
virtual void ILanguage::SetSubLanguageName (const PMStringrName)
pure virtual

Sets the sub language name i.e.: "US".

Parameters
rNameThe sub language name i.e.: "US".