1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: textcharacterpropertiescontext.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/drawingml/textcharacterpropertiescontext.hxx"
33 #include "oox/helper/attributelist.hxx"
34 #include "oox/drawingml/drawingmltypes.hxx"
35 #include "oox/drawingml/colorchoicecontext.hxx"
36 #include "oox/drawingml/lineproperties.hxx"
37 #include "oox/drawingml/textparagraphproperties.hxx"
38 #include "oox/core/namespaces.hxx"
39 #include "oox/core/relations.hxx"
40 #include "hyperlinkcontext.hxx"
43 using ::rtl::OUString
;
44 using namespace ::oox::core
;
45 using namespace ::com::sun::star::uno
;
46 using namespace ::com::sun::star::xml::sax
;
47 using namespace ::com::sun::star::awt
;
49 namespace oox
{ namespace drawingml
{
51 // --------------------------------------------------------------------
53 // CT_TextCharacterProperties
54 TextCharacterPropertiesContext::TextCharacterPropertiesContext(
55 ContextHandler
& rParent
,
56 const Reference
< XFastAttributeList
>& rXAttributes
,
57 TextCharacterProperties
& rTextCharacterProperties
)
58 : ContextHandler( rParent
)
59 , mrTextCharacterProperties( rTextCharacterProperties
)
61 AttributeList
aAttribs( rXAttributes
);
62 mrTextCharacterProperties
.moLang
= aAttribs
.getString( XML_lang
);
63 mrTextCharacterProperties
.moHeight
= aAttribs
.getInteger( XML_sz
);
64 mrTextCharacterProperties
.moUnderline
= aAttribs
.getToken( XML_u
);
65 mrTextCharacterProperties
.moStrikeout
= aAttribs
.getToken( XML_strike
);
66 // mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap );
67 mrTextCharacterProperties
.moBold
= aAttribs
.getBool( XML_b
);
68 mrTextCharacterProperties
.moItalic
= aAttribs
.getBool( XML_i
);
71 /* todo: we need to be able to iterate over the XFastAttributes
73 // ST_TextNonNegativePoint
74 const OUString sCharKerning( CREATE_OUSTRING( "CharKerning" ) );
75 //case NMSP_DRAWINGML|XML_kern:
78 OUString sAltLang = rXAttributes->getOptionalValue( XML_altLang );
80 case NMSP_DRAWINGML|XML_kumimoji: // xsd:boolean
82 case NMSP_DRAWINGML|XML_spc: // ST_TextPoint
83 case NMSP_DRAWINGML|XML_normalizeH: // xsd:boolean
84 case NMSP_DRAWINGML|XML_baseline: // ST_Percentage
85 case NMSP_DRAWINGML|XML_noProof: // xsd:boolean
86 case NMSP_DRAWINGML|XML_dirty: // xsd:boolean
87 case NMSP_DRAWINGML|XML_err: // xsd:boolean
88 case NMSP_DRAWINGML|XML_smtClean: // xsd:boolean
89 case NMSP_DRAWINGML|XML_smtId: // xsd:unsignedInt
95 TextCharacterPropertiesContext::~TextCharacterPropertiesContext()
99 // --------------------------------------------------------------------
101 void TextCharacterPropertiesContext::endFastElement( sal_Int32
) throw (SAXException
, RuntimeException
)
105 // --------------------------------------------------------------------
107 Reference
< XFastContextHandler
> TextCharacterPropertiesContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& xAttributes
) throw (SAXException
, RuntimeException
)
109 AttributeList
aAttribs( xAttributes
);
110 Reference
< XFastContextHandler
> xRet
;
111 switch( aElementToken
)
113 // TODO unsupported yet
114 // case NMSP_DRAWINGML|XML_ln: // CT_LineProperties
115 // xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maTextOutlineProperties ) );
118 case NMSP_DRAWINGML
|XML_solidFill
: // EG_FillProperties
119 xRet
.set( new ColorContext( *this, mrTextCharacterProperties
.maCharColor
) );
122 // EG_EffectProperties
123 case NMSP_DRAWINGML
|XML_effectDag
: // CT_EffectContainer 5.1.10.25
124 case NMSP_DRAWINGML
|XML_effectLst
: // CT_EffectList 5.1.10.26
127 case NMSP_DRAWINGML
|XML_highlight
: // CT_Color
128 xRet
.set( new ColorContext( *this, mrTextCharacterProperties
.maHighlightColor
) );
131 // EG_TextUnderlineLine
132 case NMSP_DRAWINGML
|XML_uLnTx
: // CT_TextUnderlineLineFollowText
133 mrTextCharacterProperties
.moUnderlineLineFollowText
= true;
135 // TODO unsupported yet
136 // case NMSP_DRAWINGML|XML_uLn: // CT_LineProperties
137 // xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maUnderlineProperties ) );
140 // EG_TextUnderlineFill
141 case NMSP_DRAWINGML
|XML_uFillTx
: // CT_TextUnderlineFillFollowText
142 mrTextCharacterProperties
.moUnderlineFillFollowText
= true;
144 case NMSP_DRAWINGML
|XML_uFill
: // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported)
145 xRet
.set( new SimpleFillPropertiesContext( *this, mrTextCharacterProperties
.maUnderlineColor
) );
149 case NMSP_DRAWINGML
|XML_latin
: // CT_TextFont
150 mrTextCharacterProperties
.maLatinFont
.setAttributes( aAttribs
);
152 case NMSP_DRAWINGML
|XML_ea
: // CT_TextFont
153 mrTextCharacterProperties
.maAsianFont
.setAttributes( aAttribs
);
155 case NMSP_DRAWINGML
|XML_cs
: // CT_TextFont
156 mrTextCharacterProperties
.maComplexFont
.setAttributes( aAttribs
);
158 case NMSP_DRAWINGML
|XML_sym
: // CT_TextFont
159 mrTextCharacterProperties
.maSymbolFont
.setAttributes( aAttribs
);
162 case NMSP_DRAWINGML
|XML_hlinkClick
: // CT_Hyperlink
163 case NMSP_DRAWINGML
|XML_hlinkMouseOver
: // CT_Hyperlink
164 xRet
.set( new HyperLinkContext( *this, xAttributes
, mrTextCharacterProperties
.maHyperlinkPropertyMap
) );
172 // --------------------------------------------------------------------