Update ooo320-m1
[ooovba.git] / oox / source / drawingml / texttabstoplistcontext.cxx
blobaa0dccdbc41d358e5c7cfaabb1cac25c0d4be8f3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: texttabstoplistcontext.cxx,v $
10 * $Revision: 1.4 $
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 <list>
32 #include <algorithm>
34 #include <rtl/ustring.hxx>
36 #include "oox/core/namespaces.hxx"
37 #include "oox/drawingml/drawingmltypes.hxx"
38 #include "texttabstoplistcontext.hxx"
39 #include "tokens.hxx"
41 using ::rtl::OUString;
42 using namespace ::oox::core;
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::style;
45 using namespace ::com::sun::star::xml::sax;
47 namespace oox { namespace drawingml {
49 TextTabStopListContext::TextTabStopListContext( ContextHandler& rParent, std::list< TabStop > & aTabList )
50 : ContextHandler( rParent )
51 , maTabList( aTabList )
55 TextTabStopListContext::~TextTabStopListContext()
59 void SAL_CALL TextTabStopListContext::endFastElement( ::sal_Int32 /*Element*/ )
60 throw ( SAXException, RuntimeException)
65 Reference< ::XFastContextHandler > TextTabStopListContext::createFastChildContext( ::sal_Int32 aElement,
66 const Reference< XFastAttributeList >& xAttribs )
67 throw (SAXException, RuntimeException)
69 Reference< XFastContextHandler > xRet;
70 switch( aElement )
72 case NMSP_DRAWINGML|XML_tab:
74 OUString sValue;
75 TabStop aTabStop;
76 sValue = xAttribs->getOptionalValue( XML_pos );
77 if( sValue.getLength() )
79 aTabStop.Position = GetCoordinate( sValue );
81 sal_Int32 aToken = xAttribs->getOptionalValueToken( XML_algn, 0 );
82 if( aToken != 0 )
84 aTabStop.Alignment = GetTabAlign( aToken );
86 maTabList.push_back(aTabStop);
87 break;
89 default:
90 break;
92 if ( !xRet.is() )
93 xRet.set( this );
94 return xRet;
98 } }