24
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Sony Ericsson Mobile Communications AB
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Sony Ericsson Mobile Communications AB - initial contribution.
|
|
11 |
* Nokia Corporation - additional changes.
|
|
12 |
*
|
|
13 |
* Contributors:
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
* Implements the Enhanced SMS Format Information Element. Includes
|
|
17 |
* Version 5 Color information.
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
/**
|
|
22 |
* @file
|
|
23 |
* @internalComponent
|
|
24 |
* Defines CEmsFormatIE class
|
|
25 |
*/
|
|
26 |
|
|
27 |
#ifndef __EMSFormatIE_H__
|
|
28 |
#define __EMSFormatIE_H__
|
|
29 |
|
|
30 |
#include <emsinformationelement.h>
|
|
31 |
|
|
32 |
|
|
33 |
class CEmsFormatIE : public CEmsInformationElement
|
|
34 |
/**
|
|
35 |
* CEmsFormatIE wraps the creation & modification of an EMS format
|
|
36 |
* information element into a single class.
|
|
37 |
* Format of Extended Object.
|
|
38 |
* ----------------------------
|
|
39 |
*
|
|
40 |
* Position (Octet) Bit Description
|
|
41 |
* 1 Start Position
|
|
42 |
* 2 Text Formatting Length
|
|
43 |
* 3 Formatting mode
|
|
44 |
* 3 1..0 Alignment
|
|
45 |
* 1..0 0 0 Left
|
|
46 |
* 1..0 0 1 Center
|
|
47 |
* 1..0 1 0 Right
|
|
48 |
* 1..0 1 1 Lang depend (default)
|
|
49 |
*
|
|
50 |
* 3..2 FontSize
|
|
51 |
* 3..2 0 0 Normal
|
|
52 |
* 3..2 0 1 Large
|
|
53 |
* 3..2 1 0 Small
|
|
54 |
* 3..2 1 1 reserved
|
|
55 |
*
|
|
56 |
* 4 Style Bold (1=on)
|
|
57 |
* 5 Style Italic (1=on)
|
|
58 |
* 6 Style Underline (1=on)
|
|
59 |
* 7 Style Strikethrough (1=on)
|
|
60 |
*
|
|
61 |
* 4 3..0 Text Color (See header for values) 3gpp Vrs 5
|
|
62 |
* 7..4 Background Text Color (See header for values) 3gpp Vrs 5
|
|
63 |
*
|
|
64 |
* @see 3gpp Spec V5 section 9.2.3.24.10.1.1
|
|
65 |
* @internalComponent
|
|
66 |
*/
|
|
67 |
{
|
|
68 |
public:
|
|
69 |
// Note that sizes do NOT include start position
|
|
70 |
enum {EEnhancedFormatSizeV4=0x02, EEnhancedFormatSizeV5=0x03};
|
|
71 |
|
|
72 |
enum TEmsFormat {
|
|
73 |
EAlignmentMask = 0x03,
|
|
74 |
EFontSizeMask = 0x0c,
|
|
75 |
EBold = 0x10,
|
|
76 |
EItalic = 0x20,
|
|
77 |
EUnderline = 0x40,
|
|
78 |
EStrikethrough = 0x80
|
|
79 |
};
|
|
80 |
|
|
81 |
enum TAlignment {
|
|
82 |
ELeft = 0x00,
|
|
83 |
ECenter = 0x01,
|
|
84 |
ERight = 0x02,
|
|
85 |
ELangDepend = 0x03
|
|
86 |
};
|
|
87 |
|
|
88 |
enum TFontSize {
|
|
89 |
ENormal = 0x00,
|
|
90 |
ELarge = 0x01,
|
|
91 |
ESmall = 0x02,
|
|
92 |
EReserved = 0x03
|
|
93 |
};
|
|
94 |
|
|
95 |
enum TColor {
|
|
96 |
EBlack = 0x00,
|
|
97 |
EDarkGrey = 0x01,
|
|
98 |
EDarkRed = 0x02,
|
|
99 |
EDarkYellow = 0x03,
|
|
100 |
EDarkGreen = 0x04,
|
|
101 |
EDarkCyan = 0x05,
|
|
102 |
EDarkBlue = 0x06,
|
|
103 |
EDarkMagenta = 0x07,
|
|
104 |
EGrey = 0x08,
|
|
105 |
EWhite = 0x09,
|
|
106 |
EBrightRed = 0x0A,
|
|
107 |
EBrightYellow = 0x0B,
|
|
108 |
EBrightGreen = 0x0C,
|
|
109 |
EBrightCyan = 0x0D,
|
|
110 |
EBrightBlue = 0x0E,
|
|
111 |
EBrightMagenta = 0x0F
|
|
112 |
};
|
|
113 |
|
|
114 |
IMPORT_C static CEmsFormatIE* NewL();
|
|
115 |
IMPORT_C CEmsInformationElement* DuplicateL() const;
|
|
116 |
IMPORT_C void CopyL(const CEmsFormatIE& aSrc);
|
|
117 |
|
|
118 |
IMPORT_C void SetFormatLength(TUint aLength) ;
|
|
119 |
IMPORT_C TUint FormatLength() const;
|
|
120 |
|
|
121 |
IMPORT_C void SetBold(TBool aBold);
|
|
122 |
IMPORT_C TBool Bold() const;
|
|
123 |
|
|
124 |
IMPORT_C void SetItalic(TBool aItalic) ;
|
|
125 |
IMPORT_C TBool Italic() const ;
|
|
126 |
|
|
127 |
IMPORT_C void SetUnderline(TBool aUnderline) ;
|
|
128 |
IMPORT_C TBool Underline() const ;
|
|
129 |
|
|
130 |
IMPORT_C void SetStrikethrough(TBool aStrikethrough) ;
|
|
131 |
IMPORT_C TBool Strikethrough() const ;
|
|
132 |
|
|
133 |
IMPORT_C void SetAlignment(TAlignment aAlignment) ;
|
|
134 |
IMPORT_C TAlignment Alignment() const ;
|
|
135 |
|
|
136 |
IMPORT_C void SetFontSize(TFontSize aSize) ;
|
|
137 |
IMPORT_C TFontSize FontSize() const ;
|
|
138 |
|
|
139 |
|
|
140 |
private:
|
|
141 |
CEmsFormatIE();
|
|
142 |
virtual void EncodeBodyL(TPtr8 aPtr, TBool aIsForSerialisation) const;
|
|
143 |
virtual void DecodeBodyL(const TPtrC8 aPtr, TBool aIsFromSerialisation);
|
|
144 |
|
|
145 |
// Overriden function since there is one extra byte to be stored when
|
|
146 |
// serialised compared to when encoded
|
|
147 |
virtual TInt SerialisedBodyLength() const;
|
|
148 |
|
|
149 |
TUint iFormatLength;
|
|
150 |
TUint8 iFormat;
|
|
151 |
};
|
|
152 |
|
|
153 |
|
|
154 |
#endif // __EMSFormatIE_H__
|