46
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
|
|
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 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: SVG Implementation source file
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "SVGClrCssValueImpl.h"
|
|
20 |
#include "SVGElementImpl.h"
|
|
21 |
|
|
22 |
|
|
23 |
// *******************************************************
|
|
24 |
// Constructor/deconstructor
|
|
25 |
|
|
26 |
|
|
27 |
// ---------------------------------------------------------------------------
|
|
28 |
//
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
CClrCssValueImpl::~CClrCssValueImpl()
|
|
31 |
{
|
|
32 |
if(iValue)
|
|
33 |
{
|
|
34 |
delete iValue;
|
|
35 |
iValue = NULL;
|
|
36 |
}
|
|
37 |
}
|
|
38 |
|
|
39 |
// ---------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
// ---------------------------------------------------------------------------
|
|
42 |
|
|
43 |
TSvgColor* CClrCssValueImpl::Value()
|
|
44 |
{
|
|
45 |
return iValue;
|
|
46 |
}
|
|
47 |
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
TInt CClrCssValueImpl::SetValueL( const TDesC& aValue )
|
|
53 |
{
|
|
54 |
|
|
55 |
if(iValue)
|
|
56 |
{
|
|
57 |
delete iValue;
|
|
58 |
iValue=NULL;
|
|
59 |
}
|
|
60 |
|
|
61 |
_LIT( KNone, "none" );
|
|
62 |
_LIT( KCurrentColor, "currentColor" );
|
|
63 |
|
|
64 |
TUint32 tempVal;
|
|
65 |
if ( aValue == KNone )
|
|
66 |
{
|
|
67 |
tempVal = KGfxColorNull;
|
|
68 |
}
|
|
69 |
else if ( aValue == KCurrentColor )
|
|
70 |
{
|
|
71 |
tempVal = KSvgCurrentColor;
|
|
72 |
}
|
|
73 |
else
|
|
74 |
{
|
|
75 |
TSvgColor tColor(KGfxColorNull);
|
|
76 |
if( tColor.GetStringL( aValue,tempVal) != EFalse )
|
|
77 |
{
|
|
78 |
}
|
|
79 |
else
|
|
80 |
{
|
|
81 |
tempVal = 0;
|
|
82 |
}
|
|
83 |
|
|
84 |
}
|
|
85 |
|
|
86 |
iValue = new (ELeave) TSvgColor(tempVal);
|
|
87 |
return KErrNone;
|
|
88 |
}
|
|
89 |
|
|
90 |
|
|
91 |
// ---------------------------------------------------------------------------
|
|
92 |
//
|
|
93 |
// ---------------------------------------------------------------------------
|
|
94 |
TInt CClrCssValueImpl::SetValueL( const TInt& aValue )
|
|
95 |
{
|
|
96 |
if(iValue)
|
|
97 |
{
|
|
98 |
delete iValue;
|
|
99 |
iValue=NULL;
|
|
100 |
}
|
|
101 |
|
|
102 |
iValue = new (ELeave)TSvgColor (aValue);
|
|
103 |
return KErrNone;
|
|
104 |
}
|
|
105 |
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
|
|
110 |
void CClrCssValueImpl::SetL(CClrCssValueImpl* aValueToMimic)
|
|
111 |
{
|
|
112 |
CloneRGBValueL(aValueToMimic->iValue->GetColor());
|
|
113 |
}
|
|
114 |
|
|
115 |
// *******************************************************
|
|
116 |
// Private
|
|
117 |
|
|
118 |
|
|
119 |
// ---------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
CClrCssValueImpl::CClrCssValueImpl( ):iValue(NULL)
|
|
123 |
{
|
|
124 |
|
|
125 |
}
|
|
126 |
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
// ---------------------------------------------------------------------------
|
|
130 |
TInt CClrCssValueImpl::CloneRGBValueL(const TInt& aValue)
|
|
131 |
{
|
|
132 |
if ( iValue )
|
|
133 |
{
|
|
134 |
delete ( TSvgColor * ) iValue;
|
|
135 |
iValue = NULL;
|
|
136 |
}
|
|
137 |
|
|
138 |
iValue = new ( ELeave ) TSvgColor( (TUint32)aValue );
|
|
139 |
return KErrNone;
|
|
140 |
}
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
//
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
TBool CClrCssValueImpl::IsEqual( CCssValue* aValue )
|
|
146 |
{
|
|
147 |
if (((CClrCssValueImpl*)aValue)->iValue == iValue)
|
|
148 |
{
|
|
149 |
return ETrue;
|
|
150 |
}
|
|
151 |
|
|
152 |
return EFalse;
|
|
153 |
}
|
|
154 |
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
// ---------------------------------------------------------------------------
|
|
158 |
void CClrCssValueImpl::Print()
|
|
159 |
{
|
|
160 |
#ifdef _DEBUG
|
|
161 |
if (iValue)
|
|
162 |
RDebug::Printf("%x", iValue->GetColor());
|
|
163 |
#endif
|
|
164 |
}
|