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 { 52 } 53 54 createFastChildContext(::sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs)55 Reference< ::XFastContextHandler > TextTabStopListContext::createFastChildContext( ::sal_Int32 aElement, 56 const Reference< XFastAttributeList >& xAttribs ) 57 { 58 Reference< XFastContextHandler > xRet; 59 switch( aElement ) 60 { 61 case A_TOKEN( tab ): 62 { 63 OUString sValue; 64 TabStop aTabStop; 65 sValue = xAttribs->getOptionalValue( XML_pos ); 66 if( sValue.getLength() ) 67 { 68 aTabStop.Position = GetCoordinate( sValue ); 69 } 70 sal_Int32 aToken = xAttribs->getOptionalValueToken( XML_algn, 0 ); 71 if( aToken != 0 ) 72 { 73 aTabStop.Alignment = GetTabAlign( aToken ); 74 } 75 maTabList.push_back(aTabStop); 76 break; 77 } 78 default: 79 break; 80 } 81 if ( !xRet.is() ) 82 xRet.set( this ); 83 return xRet; 84 } 85 86 87 } } 88