MHEG5  15.3.0
source/classes/inc/mh5text.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2004 Ocean Blue Software Ltd
00004  * Copyright © 2000 Koninklijke Philips Electronics N.V
00005  *
00006  * This file is part of a DTVKit Software Component
00007  * You are permitted to copy, modify or distribute this file subject to the terms
00008  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00009  * 
00010  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00011  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00012  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00013  * 
00014  * If you or your organisation is not a member of DTVKit then you have access
00015  * to this source code outside of the terms of the licence agreement
00016  * and you are expected to delete this and any associated files immediately.
00017  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00018  *******************************************************************************/
00031 #ifndef _MH5TEXT_H
00032 #define _MH5TEXT_H
00033 
00034 /*---includes for this file--------------------------------------------------*/
00035 #include "mh5visible.h"
00036 
00037 /*---Constant and macro definitions for public use---------------------------*/
00038 
00039 #define HJUSTIFICATION_START        (0)
00040 #define HJUSTIFICATION_END          (1)
00041 #define HJUSTIFICATION_CENTRE       (2)
00042 #define HJUSTIFICATION_JUSTIFIED    (3)
00043 
00044 #define VJUSTIFICATION_START        (0)
00045 #define VJUSTIFICATION_END          (1)
00046 #define VJUSTIFICATION_CENTRE       (2)
00047 #define VJUSTIFICATION_JUSTIFIED    (3)
00048 
00049 #define LINE_ORIENTATION_HORIZONTAL (MHEG5FALSE)
00050 #define LINE_ORIENTATION_VERTICAL   (MHEG5TRUE)
00051 
00052 #define BOM_NONE 0
00053 #define BOM_LITTLE_ENDIAN 1
00054 #define BOM_BIG_ENDIAN 2
00055 
00056 /*---Enumerations for public use---------------------------------------------*/
00057 
00058 /*---Global type defs for public use-----------------------------------------*/
00059 typedef struct
00060 {
00061    /* Base class */
00062    MHEG5Visible visible;
00063 
00064    /* Exchanged attributes */
00065    MHEG5FontBody originalFont;
00066    MHEG5String originalFontAttributes;
00067    MHEG5Colour originalTextColour;
00068    MHEG5Colour originalBackgroundColour;
00069    MHEG5Int characterSet;
00070    MHEG5Int horizontalJustification;
00071    MHEG5Int verticalJustification;
00072    MHEG5Bool verticalLineOrientation;
00073    MHEG5Int startCorner;
00074    MHEG5Bool textWrapping;
00075 
00076    /* Internal attributes */
00077    /* Text data internal attribute is stored in both raw format and adapted
00078     * (unicode) format. The raw format is stored in the textDataRaw attribute
00079     * of the Text class, the adapted format is stored in data attribute of the
00080     * Ingredient class. The two formats are stored to allow invalid UTF-8 data
00081     * to be loaded into a text object, then retrieved by a GetTextData action.
00082     *
00083     * Raw data is only stored for the Text and HyperText classes (not
00084     * EntryField since this can alter the TextData attribute through
00085     * interaction).
00086     */
00087    MHEG5String textDataRaw;
00088    MHEG5FontBody font;
00089    MHEG5String fontAttributes;
00090    MHEG5Colour textColour;
00091    MHEG5Colour backgroundColour;
00092 
00093    /*for engine use*/
00094    MHEG5Bool characterSetEncoded;
00095    MHEG5Int byteOrderMark;
00096 } MHEG5Text;
00097 
00098 
00099 /*---Global variable declarations for public use-----------------------------*/
00100 
00101 /*---Global Function prototypes for public use-------------------------------*/
00102 
00113 void MHEG5textInit(MHEG5Text *text);
00114 
00115 
00123 void MHEG5textFree(MHEG5Text *text);
00124 
00125 
00126 MHEG5Text* MHEG5textClone(MHEG5Text *source);
00127 
00128 
00129 /*
00130     Internal behaviours
00131  */
00132 void MHEG5textPrepare(MHEG5Text *text);
00133 void MHEG5textActivate(MHEG5Text *text);
00134 void MHEG5textDeactivate(MHEG5Text *text);
00135 void MHEG5textDestruct(MHEG5Text *text);
00136 
00137 
00138 MHEG5ErrorCode MHEG5getTextData(MHEG5Root *target, MHEG5GList *params);
00139 MHEG5ErrorCode MHEG5getTextContent(MHEG5Root *target, MHEG5GList *params);
00140 MHEG5ErrorCode MHEG5setFontAttributes(MHEG5Root *target, MHEG5GList *params);
00141 MHEG5ErrorCode MHEG5setTextColour(MHEG5Root *target, MHEG5GList *params);
00142 MHEG5ErrorCode MHEG5setBackgroundColour(MHEG5Root *target, MHEG5GList *params);
00143 MHEG5ErrorCode MHEG5setFontRef(MHEG5Root *target, MHEG5GList *params);
00144 
00145 void MHEG5textRedraw(MHEG5Text *text);
00146 
00155 void MHEG5textUtf8Content(MHEG5Text *text, unsigned char *data, int len);
00156 
00164 void MHEG5textUtf16Content(MHEG5Text *text, unsigned char *data, int len);
00165 
00174 void MHEG5textContentUnadapt(MHEG5Text *text, MHEG5Byte **utf8Data,
00175    MHEG5Int *utf8Len);
00176 
00177 void MHEG5textContentUnadaptUTF16(MHEG5Text *text, MHEG5Byte **utf16Data,
00178    MHEG5Int *utf16Len);
00184 void MHEG5textClearTextData(MHEG5Text *text);
00185 
00186 
00187 /*
00188    Debug
00189  */
00190 #ifdef MH5PRINTOUT
00191 
00197 void MHEG5textPrint(MHEG5Text *text, char *out);
00198 #endif
00199 
00200 #endif /*_MH5TEXT_H*/
 All Data Structures Files Functions Variables Typedefs Defines