InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SnpPerformKinsokuTable Class Reference

Public Member Functions

 SnpPerformKinsokuTable ()
 
virtual ~SnpPerformKinsokuTable ()
 
ErrorCode CreateKinsokuTable (IWorkspace *ws, const SnpKinsokuTableSettings &data, const UID &baseKinsokuTableUID, UID &newKinsokuTableUID)
 
ErrorCode DeleteKinsokuTable (IWorkspace *ws, const UID &kinsokuTableUIDToDelete)
 
ErrorCode InspectKinsokuTable (IWorkspace *ws, const UID &kinsokuTableUIDToInspect, SnpKinsokuTableSettings &data)
 
void SetKinsokuTableSettings (const PMString &kinsokuTableName, SnpKinsokuTableSettings &data)
 
void FilterDuplicateSettings (IWorkspace *ws, const UID &basedOnUID, SnpKinsokuTableSettings &data)
 
int32 RemoveDuplicates (const WideString &baseString, WideString &addString)
 
bool16 CanBeDeleted (IWorkspace *ws, const UID &kinsokuTableUIDToDelete)
 
void ReportKinsokuTableData (const SnpKinsokuTableSettings &data)
 
void ReportWideString (const WideString &s)
 
K2Vector< PMStringGetKinsokuTableNames (IStyleNameTable *kinsokuNameTable)
 

Detailed Description

  • Inspects a kinsoku table,,
  • Creates a new kinsoku table (either based on an existing one or from scratch), and
  • Deletes an existing kinsoku table.

(1) Inspecting a kinsoku table: Select one of the existing kinsoku tables to inspect. The data associated with the kinsoku table will be written to the SNIPLOG.

(2) Creating a kinsoku table: Enter the name of your new kinsoku table, and select which existing kinsoku table you want to base it on. If you choose <none>, then a brand new kinsoku table will be made based on the root style. After creating a kinsoku table, you can apply the new kinsoku table on your text selection by simply using the Paragraph Panel If you want to do it programmatically, you can apply the kTAKinsokuTableBoss attribute on the text model.

(3) Deleting a kinsoku table: Select one of the existing kinsoku to delete. After deleting, go to the Paragraph Panel to verify that the kinsoku table is gone.

About Kinsoku tables:

"Kinsoku tables" are tables that contain a set of characters that define line break rules for the Japanese text composers. There are 4 kinds of line break rule classifications:

  • The list of characters that cannot be placed before the end of a line.(Gyoumatsu kinshi moji)
  • The list of characters that cannot be placed after the beginning of a line. (Gyoutou kinshi moji)
  • The list of characters that cannot be hanging at the end of a line. (Burasagari kinshi moji)
  • The list of characters that must not be separated at the end of a line. (Bunri kinshi moji)

While you do not need the Japanese version of InDesign to run this snippet, you will need the Japanese version of InDesign to create a kinsoku table and apply to text, using the application user interface.

Constructor & Destructor Documentation

SnpPerformKinsokuTable::SnpPerformKinsokuTable ()
inline

Constructor.

virtual SnpPerformKinsokuTable::~SnpPerformKinsokuTable ()
inlinevirtual

Destructor.

Member Function Documentation

bool16 SnpPerformKinsokuTable::CanBeDeleted (IWorkspacews,
const UIDkinsokuTableUIDToDelete 
)

Determines if a kinsoku table is one that could be deleted.

Parameters
wsIN The workspace that contains the kinsoku table to be deleted.
kinsokuTableUIDToDeleteIN The UID for the kinsoku table to be deleted.
Returns
kTrue if it can be deleted, kFalse otherwise.
ErrorCode SnpPerformKinsokuTable::CreateKinsokuTable (IWorkspacews,
const SnpKinsokuTableSettingsdata,
const UIDbaseKinsokuTableUID,
UIDnewKinsokuTableUID 
)

Creates a new kinsoku table.

If the name of the new kinsoku table already exists in the kinsoku name table, then this method will point kinsokuTableUIDRef to the existing entry, and the characters will NOT be modified.

The additional characters are hardcoded in this snippet - modify them to suit your needs.

Use Cases:

  • Create a completely new kinsoku table from scratch: Specify 'kinsokuTableName'. Leave 'baseKinsokuTableUID' blank.
  • Create a new kinsoku table based on an existing kinsoku table, but with additional characters.: The same as (1), but specify 'baseKinsokuTableUID'.
  • Create a copy of an existing kinsoku table, with no additional characters.: Only specify 'kinsokuTableName' and 'baseKinsokuTableUID'.
Parameters
wsIN The workspace on which the new kinsoku table should be created.
dataIN The kinsoku table data settings for the new kinsoku table. SnpKinsokuTableSettings is modelled after IKinsokuTable.
baseKinsokuTableUIDIN The UID of the kinsoku table to base the new one on. If you want to base the new kinsoku table on the Root style (empty), set this to kInvalidUID.
newKinsokuTableUIDOUT The newly created kinsoku table UID.
Returns
kSuccess on success, other ErrorCode otherwise.
ErrorCode SnpPerformKinsokuTable::DeleteKinsokuTable (IWorkspacews,
const UIDkinsokuTableUIDToDelete 
)

Delete a kinsoku table.

Parameters
wsIN The workspace that contains the kinsoku table to be deleted.
kinsokuTableUIDToDeleteIN The UID for the kinsoku table that should be deleted.
Returns
kSuccess on success, other ErrorCode otherwise.
void SnpPerformKinsokuTable::FilterDuplicateSettings (IWorkspacews,
const UIDbasedOnUID,
SnpKinsokuTableSettingsdata 
)

Filter out any duplicates in the settings before creating a new kinsoku table.

If we are basing the new kinsoku table on an existing one, the WideStrings in 'data' will simply be added on, but we are not supposed to have duplicates, or the Japanese text composer might get confused. This will remove duplicates.

Parameters
wsIN The workspace on which the new kinsoku table should be created.
baseKinsokuTableUIDIN The UID of the kinsoku table to base the new one on. If you want to base the new kinsoku table on the Root style (empty), set this to kInvalidUID.
dataIN/OUT The kinsoku table data settings for the new kinsoku table. Pass IN what you want to add to the existing kinsoku table (identified by basedOnUID), and what you get OUT is only what needs to be added.
K2Vector< PMString > SnpPerformKinsokuTable::GetKinsokuTableNames (IStyleNameTablekinsokuNameTable)

Gets the names of the kinsoku tables.

Parameters
kinsokuNameTableIN The IStyleNameTable interface for kinsoku tables on a specific workspace.
Returns
A list of kinsoku table names.
ErrorCode SnpPerformKinsokuTable::InspectKinsokuTable (IWorkspacews,
const UIDkinsokuTableUIDToInspect,
SnpKinsokuTableSettingsdata 
)

Inspect a kinsoku table.

Parameters
wsIN The workspace that contains the kinsoku table to be inspected.
kinsokuTableUIDToInspectIN The UID for the kinsoku table that is to be inspected.
dataOUT The kinsoku table settings for the given UID.
Returns
kSuccess on success, other ErrorCode otherwise.
int32 SnpPerformKinsokuTable::RemoveDuplicates (const WideStringbaseString,
WideStringaddString 
)

Removes duplicate characters from WideStrings, so that the addString is left only with characters that don't belong in the baseString.

Parameters
baseStringIN The original string.
addStringIN/OUT The string with potentially duplicated characters. After this method is complete, addString should only contain characters that don't belong in baseString.
Returns
Number of characters stripped from addString.
void SnpPerformKinsokuTable::ReportKinsokuTableData (const SnpKinsokuTableSettingsdata)

Reports the kinsoku table data to SNIPLOG.

Parameters
dataIN The kinsoku table settings to report.
void SnpPerformKinsokuTable::ReportWideString (const WideStrings)

Reports characters in a WideString one by one to SNIPLOG.

Parameters
sIN The WideString to report.
void SnpPerformKinsokuTable::SetKinsokuTableSettings (const PMStringkinsokuTableName,
SnpKinsokuTableSettingsdata 
)

Sets the kinsoku table data structure with sensible defaults. Call this method before calling the CreateKinsokuTable() method.

NOTE: You can modify the contents to suite your needs.

Parameters
kinsokuTableNameIN The name of the new kinsoku table.
dataOUT SnpKinsokuTableSettings struct. This method fills out the structure.