xref: /AOO41X/main/oox/source/drawingml/texttabstoplistcontext.cxx (revision ca5ec2004b000a7d9aaa8381be8ac2853e3b1dc7)
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 <list>
25 #include <algorithm>
26 
27 #include <rtl/ustring.hxx>
28 
29 #include "oox/drawingml/drawingmltypes.hxx"
30 #include "texttabstoplistcontext.hxx"
31 
32 using ::rtl::OUString;
33 using namespace ::oox::core;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::style;
36 using namespace ::com::sun::star::xml::sax;
37 
38 namespace oox { namespace drawingml {
39 
TextTabStopListContext(ContextHandler & rParent,std::list<TabStop> & aTabList)40         TextTabStopListContext::TextTabStopListContext( ContextHandler& rParent, std::list< TabStop >  & aTabList )
41             : ContextHandler( rParent )
42             , maTabList( aTabList )
43         {
44         }
45 
~TextTabStopListContext()46         TextTabStopListContext::~TextTabStopListContext()
47         {
48         }
49 
endFastElement(::sal_Int32)50         void SAL_CALL TextTabStopListContext::endFastElement( ::sal_Int32 /*Element*/ )
51             throw ( SAXException, RuntimeException)
52         {
53         }
54 
55 
createFastChildContext(::sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs)56     Reference< ::XFastContextHandler > TextTabStopListContext::createFastChildContext( ::sal_Int32 aElement,
57                                                                                                                                                                              const Reference< XFastAttributeList >& xAttribs )
58             throw (SAXException, RuntimeException)
59         {
60             Reference< XFastContextHandler > xRet;
61             switch( aElement )
62             {
63             case A_TOKEN( tab ):
64             {
65                 OUString sValue;
66                 TabStop aTabStop;
67                 sValue = xAttribs->getOptionalValue( XML_pos );
68                 if( sValue.getLength() )
69                 {
70                     aTabStop.Position = GetCoordinate( sValue );
71                 }
72                 sal_Int32 aToken = xAttribs->getOptionalValueToken( XML_algn, 0 );
73                 if( aToken != 0 )
74                 {
75                     aTabStop.Alignment = GetTabAlign( aToken );
76                 }
77                 maTabList.push_back(aTabStop);
78                 break;
79             }
80             default:
81                 break;
82             }
83             if ( !xRet.is() )
84                 xRet.set( this );
85             return xRet;
86         }
87 
88 
89 } }
90 
91 
92