1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski #include "oox/drawingml/textcharacterpropertiescontext.hxx"
25*b1cdbd2cSJim Jagielski
26*b1cdbd2cSJim Jagielski #include "oox/helper/attributelist.hxx"
27*b1cdbd2cSJim Jagielski #include "oox/drawingml/drawingmltypes.hxx"
28*b1cdbd2cSJim Jagielski #include "oox/drawingml/colorchoicecontext.hxx"
29*b1cdbd2cSJim Jagielski #include "oox/drawingml/lineproperties.hxx"
30*b1cdbd2cSJim Jagielski #include "oox/drawingml/textparagraphproperties.hxx"
31*b1cdbd2cSJim Jagielski #include "oox/core/relations.hxx"
32*b1cdbd2cSJim Jagielski #include "hyperlinkcontext.hxx"
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski using ::rtl::OUString;
35*b1cdbd2cSJim Jagielski using namespace ::oox::core;
36*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::uno;
37*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::xml::sax;
38*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::awt;
39*b1cdbd2cSJim Jagielski
40*b1cdbd2cSJim Jagielski namespace oox { namespace drawingml {
41*b1cdbd2cSJim Jagielski
42*b1cdbd2cSJim Jagielski // --------------------------------------------------------------------
43*b1cdbd2cSJim Jagielski
44*b1cdbd2cSJim Jagielski // CT_TextCharacterProperties
TextCharacterPropertiesContext(ContextHandler & rParent,const Reference<XFastAttributeList> & rXAttributes,TextCharacterProperties & rTextCharacterProperties)45*b1cdbd2cSJim Jagielski TextCharacterPropertiesContext::TextCharacterPropertiesContext(
46*b1cdbd2cSJim Jagielski ContextHandler& rParent,
47*b1cdbd2cSJim Jagielski const Reference< XFastAttributeList >& rXAttributes,
48*b1cdbd2cSJim Jagielski TextCharacterProperties& rTextCharacterProperties )
49*b1cdbd2cSJim Jagielski : ContextHandler( rParent )
50*b1cdbd2cSJim Jagielski , mrTextCharacterProperties( rTextCharacterProperties )
51*b1cdbd2cSJim Jagielski {
52*b1cdbd2cSJim Jagielski AttributeList aAttribs( rXAttributes );
53*b1cdbd2cSJim Jagielski if ( aAttribs.hasAttribute( XML_lang ) )
54*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang );
55*b1cdbd2cSJim Jagielski if ( aAttribs.hasAttribute( XML_sz ) )
56*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz );
57*b1cdbd2cSJim Jagielski if ( aAttribs.hasAttribute( XML_u ) )
58*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u );
59*b1cdbd2cSJim Jagielski if ( aAttribs.hasAttribute( XML_strike ) )
60*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike );
61*b1cdbd2cSJim Jagielski
62*b1cdbd2cSJim Jagielski // mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap );
63*b1cdbd2cSJim Jagielski if ( aAttribs.hasAttribute( XML_b ) )
64*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b );
65*b1cdbd2cSJim Jagielski if ( aAttribs.hasAttribute( XML_i ) )
66*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i );
67*b1cdbd2cSJim Jagielski
68*b1cdbd2cSJim Jagielski // TODO
69*b1cdbd2cSJim Jagielski /* todo: we need to be able to iterate over the XFastAttributes
70*b1cdbd2cSJim Jagielski
71*b1cdbd2cSJim Jagielski // ST_TextNonNegativePoint
72*b1cdbd2cSJim Jagielski const OUString sCharKerning( CREATE_OUSTRING( "CharKerning" ) );
73*b1cdbd2cSJim Jagielski //case A_TOKEN( kern ):
74*b1cdbd2cSJim Jagielski
75*b1cdbd2cSJim Jagielski // ST_TextLanguageID
76*b1cdbd2cSJim Jagielski OUString sAltLang = rXAttributes->getOptionalValue( XML_altLang );
77*b1cdbd2cSJim Jagielski
78*b1cdbd2cSJim Jagielski case A_TOKEN( kumimoji ): // xsd:boolean
79*b1cdbd2cSJim Jagielski break;
80*b1cdbd2cSJim Jagielski case A_TOKEN( spc ): // ST_TextPoint
81*b1cdbd2cSJim Jagielski case A_TOKEN( normalizeH ): // xsd:boolean
82*b1cdbd2cSJim Jagielski case A_TOKEN( baseline ): // ST_Percentage
83*b1cdbd2cSJim Jagielski case A_TOKEN( noProof ): // xsd:boolean
84*b1cdbd2cSJim Jagielski case A_TOKEN( dirty ): // xsd:boolean
85*b1cdbd2cSJim Jagielski case A_TOKEN( err ): // xsd:boolean
86*b1cdbd2cSJim Jagielski case A_TOKEN( smtClean ): // xsd:boolean
87*b1cdbd2cSJim Jagielski case A_TOKEN( smtId ): // xsd:unsignedInt
88*b1cdbd2cSJim Jagielski break;
89*b1cdbd2cSJim Jagielski */
90*b1cdbd2cSJim Jagielski
91*b1cdbd2cSJim Jagielski }
92*b1cdbd2cSJim Jagielski
~TextCharacterPropertiesContext()93*b1cdbd2cSJim Jagielski TextCharacterPropertiesContext::~TextCharacterPropertiesContext()
94*b1cdbd2cSJim Jagielski {
95*b1cdbd2cSJim Jagielski }
96*b1cdbd2cSJim Jagielski
97*b1cdbd2cSJim Jagielski // --------------------------------------------------------------------
98*b1cdbd2cSJim Jagielski
endFastElement(sal_Int32)99*b1cdbd2cSJim Jagielski void TextCharacterPropertiesContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException)
100*b1cdbd2cSJim Jagielski {
101*b1cdbd2cSJim Jagielski }
102*b1cdbd2cSJim Jagielski
103*b1cdbd2cSJim Jagielski // --------------------------------------------------------------------
104*b1cdbd2cSJim Jagielski
createFastChildContext(sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttributes)105*b1cdbd2cSJim Jagielski Reference< XFastContextHandler > TextCharacterPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttributes ) throw (SAXException, RuntimeException)
106*b1cdbd2cSJim Jagielski {
107*b1cdbd2cSJim Jagielski AttributeList aAttribs( xAttributes );
108*b1cdbd2cSJim Jagielski Reference< XFastContextHandler > xRet;
109*b1cdbd2cSJim Jagielski switch( aElementToken )
110*b1cdbd2cSJim Jagielski {
111*b1cdbd2cSJim Jagielski // TODO unsupported yet
112*b1cdbd2cSJim Jagielski // case A_TOKEN( ln ): // CT_LineProperties
113*b1cdbd2cSJim Jagielski // xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maTextOutlineProperties ) );
114*b1cdbd2cSJim Jagielski // break;
115*b1cdbd2cSJim Jagielski
116*b1cdbd2cSJim Jagielski case A_TOKEN( solidFill ): // EG_FillProperties
117*b1cdbd2cSJim Jagielski xRet.set( new ColorContext( *this, mrTextCharacterProperties.maCharColor ) );
118*b1cdbd2cSJim Jagielski break;
119*b1cdbd2cSJim Jagielski
120*b1cdbd2cSJim Jagielski // EG_EffectProperties
121*b1cdbd2cSJim Jagielski case A_TOKEN( effectDag ): // CT_EffectContainer 5.1.10.25
122*b1cdbd2cSJim Jagielski case A_TOKEN( effectLst ): // CT_EffectList 5.1.10.26
123*b1cdbd2cSJim Jagielski break;
124*b1cdbd2cSJim Jagielski
125*b1cdbd2cSJim Jagielski case A_TOKEN( highlight ): // CT_Color
126*b1cdbd2cSJim Jagielski xRet.set( new ColorContext( *this, mrTextCharacterProperties.maHighlightColor ) );
127*b1cdbd2cSJim Jagielski break;
128*b1cdbd2cSJim Jagielski
129*b1cdbd2cSJim Jagielski // EG_TextUnderlineLine
130*b1cdbd2cSJim Jagielski case A_TOKEN( uLnTx ): // CT_TextUnderlineLineFollowText
131*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moUnderlineLineFollowText = true;
132*b1cdbd2cSJim Jagielski break;
133*b1cdbd2cSJim Jagielski // TODO unsupported yet
134*b1cdbd2cSJim Jagielski // case A_TOKEN( uLn ): // CT_LineProperties
135*b1cdbd2cSJim Jagielski // xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maUnderlineProperties ) );
136*b1cdbd2cSJim Jagielski // break;
137*b1cdbd2cSJim Jagielski
138*b1cdbd2cSJim Jagielski // EG_TextUnderlineFill
139*b1cdbd2cSJim Jagielski case A_TOKEN( uFillTx ): // CT_TextUnderlineFillFollowText
140*b1cdbd2cSJim Jagielski mrTextCharacterProperties.moUnderlineFillFollowText = true;
141*b1cdbd2cSJim Jagielski break;
142*b1cdbd2cSJim Jagielski case A_TOKEN( uFill ): // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported)
143*b1cdbd2cSJim Jagielski xRet.set( new SimpleFillPropertiesContext( *this, mrTextCharacterProperties.maUnderlineColor ) );
144*b1cdbd2cSJim Jagielski break;
145*b1cdbd2cSJim Jagielski
146*b1cdbd2cSJim Jagielski // CT_FontCollection
147*b1cdbd2cSJim Jagielski case A_TOKEN( latin ): // CT_TextFont
148*b1cdbd2cSJim Jagielski mrTextCharacterProperties.maLatinFont.setAttributes( aAttribs );
149*b1cdbd2cSJim Jagielski break;
150*b1cdbd2cSJim Jagielski case A_TOKEN( ea ): // CT_TextFont
151*b1cdbd2cSJim Jagielski mrTextCharacterProperties.maAsianFont.setAttributes( aAttribs );
152*b1cdbd2cSJim Jagielski break;
153*b1cdbd2cSJim Jagielski case A_TOKEN( cs ): // CT_TextFont
154*b1cdbd2cSJim Jagielski mrTextCharacterProperties.maComplexFont.setAttributes( aAttribs );
155*b1cdbd2cSJim Jagielski break;
156*b1cdbd2cSJim Jagielski case A_TOKEN( sym ): // CT_TextFont
157*b1cdbd2cSJim Jagielski mrTextCharacterProperties.maSymbolFont.setAttributes( aAttribs );
158*b1cdbd2cSJim Jagielski break;
159*b1cdbd2cSJim Jagielski
160*b1cdbd2cSJim Jagielski case A_TOKEN( hlinkClick ): // CT_Hyperlink
161*b1cdbd2cSJim Jagielski case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink
162*b1cdbd2cSJim Jagielski xRet.set( new HyperLinkContext( *this, xAttributes, mrTextCharacterProperties.maHyperlinkPropertyMap ) );
163*b1cdbd2cSJim Jagielski break;
164*b1cdbd2cSJim Jagielski }
165*b1cdbd2cSJim Jagielski if( !xRet.is() )
166*b1cdbd2cSJim Jagielski xRet.set( this );
167*b1cdbd2cSJim Jagielski return xRet;
168*b1cdbd2cSJim Jagielski }
169*b1cdbd2cSJim Jagielski
170*b1cdbd2cSJim Jagielski // --------------------------------------------------------------------
171*b1cdbd2cSJim Jagielski
172*b1cdbd2cSJim Jagielski } }
173*b1cdbd2cSJim Jagielski
174