1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "oox/drawingml/textliststylecontext.hxx"
25 #include "oox/drawingml/textparagraphpropertiescontext.hxx"
26 #include "oox/helper/attributelist.hxx"
27 
28 using ::rtl::OUString;
29 using namespace ::oox::core;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::xml::sax;
32 
33 namespace oox { namespace drawingml {
34 
35 // --------------------------------------------------------------------
36 
37 // CT_TextListStyle
TextListStyleContext(ContextHandler & rParent,TextListStyle & rTextListStyle)38 TextListStyleContext::TextListStyleContext( ContextHandler& rParent, TextListStyle& rTextListStyle )
39 : ContextHandler( rParent )
40 , mrTextListStyle( rTextListStyle )
41 {
42 }
43 
~TextListStyleContext()44 TextListStyleContext::~TextListStyleContext()
45 {
46 }
47 
48 // --------------------------------------------------------------------
49 
endFastElement(sal_Int32)50 void TextListStyleContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException)
51 {
52 }
53 
54 // --------------------------------------------------------------------
55 
createFastChildContext(sal_Int32 aElementToken,const Reference<XFastAttributeList> & rxAttributes)56 Reference< XFastContextHandler > TextListStyleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& rxAttributes ) throw (SAXException, RuntimeException)
57 {
58 	Reference< XFastContextHandler > xRet;
59 	switch( aElementToken )
60 	{
61 		case A_TOKEN( defPPr ):		// CT_TextParagraphProperties
62             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 0 ] ) );
63 			break;
64 		case A_TOKEN( outline1pPr ):
65             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getAggregationListStyle()[ 0 ] ) );
66 			break;
67 		case A_TOKEN( outline2pPr ):
68             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getAggregationListStyle()[ 1 ] ) );
69 			break;
70 		case A_TOKEN( lvl1pPr ):
71             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 0 ] ) );
72 			break;
73 		case A_TOKEN( lvl2pPr ):
74             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 1 ] ) );
75 			break;
76 		case A_TOKEN( lvl3pPr ):
77             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 2 ] ) );
78 			break;
79 		case A_TOKEN( lvl4pPr ):
80             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 3 ] ) );
81 			break;
82 		case A_TOKEN( lvl5pPr ):
83             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 4 ] ) );
84 			break;
85 		case A_TOKEN( lvl6pPr ):
86             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 5 ] ) );
87 			break;
88 		case A_TOKEN( lvl7pPr ):
89             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 6 ] ) );
90 			break;
91 		case A_TOKEN( lvl8pPr ):
92             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 7 ] ) );
93 			break;
94 		case A_TOKEN( lvl9pPr ):
95             xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 8 ] ) );
96 			break;
97 	}
98 	if ( !xRet.is() )
99 		xRet.set( this );
100 	return xRet;
101 }
102 
103 // --------------------------------------------------------------------
104 
105 } }
106 
107