merge the formfield patch from ooo-build
[ooovba.git] / shell / source / all / ooofilereader / autostyletag.cxx
bloba334ab3a58bb401f413c682eb5959a2c7e5376b6
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: autostyletag.cxx,v $
10 * $Revision: 1.6 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_shell.hxx"
33 #include "autostyletag.hxx"
35 /*********************** CAutoStyleTag ***********************/
37 CAutoStyleTag::CAutoStyleTag( const XmlTagAttributes_t& attributes ):
38 m_CurrentStyleLocalePair( EMPTY_STYLELOCALE_PAIR )
40 addAttributes( attributes);
43 void CAutoStyleTag::startTag()
47 void CAutoStyleTag::endTag()
51 void CAutoStyleTag::addCharacters(const std::wstring&)
55 void CAutoStyleTag::addAttributes(const XmlTagAttributes_t& attributes)
57 if ( EMPTY_STYLELOCALE_PAIR == m_CurrentStyleLocalePair )
59 // the style-locale pair should be empty when entering STYLE_STYLE
60 // tag, and otherwise should be STYLE_PROPERTIES.
62 XmlTagAttributes_t::const_iterator iter = attributes.find(CONTENT_STYLE_STYLE_NAME);
64 if ( iter != attributes.end())
65 setStyle( iter->second );
67 else
69 // tag STYLE_PROPERTIES entered.
71 XmlTagAttributes_t::const_iterator iter_lan = attributes.find(CONTENT_STYLE_PROPERTIES_LANGUAGE);
72 XmlTagAttributes_t::const_iterator iter_con = attributes.find(CONTENT_STYLE_PROPERTIES_COUNTRY);
73 XmlTagAttributes_t::const_iterator iter_lan_asain = attributes.find(CONTENT_STYLE_PROPERTIES_LANGUAGEASIAN);
74 XmlTagAttributes_t::const_iterator iter_con_asain = attributes.find(CONTENT_STYLE_PROPERTIES_COUNTRYASIAN);
76 // if style:properties | fo:language or style:language-asian is exist,
77 // set the locale field, otherwise clear the style-locale pair;
78 if ( ( iter_lan!= attributes.end() ) && ( iter_con != attributes.end() ) )
79 setLocale( ::std::make_pair( iter_lan->second,iter_con->second ) );
80 else if ( ( iter_lan_asain!= attributes.end() ) && ( iter_con_asain != attributes.end() ) )
81 setLocale( ::std::make_pair( iter_lan_asain->second,iter_con_asain->second ) );
82 else
83 clearStyleLocalePair();
88 void CAutoStyleTag::setStyle( ::std::wstring const & Style )
90 m_CurrentStyleLocalePair.first = Style;
93 void CAutoStyleTag::setLocale( LocaleSet_t Locale )
95 m_CurrentStyleLocalePair.second = Locale;
98 void CAutoStyleTag::clearStyleLocalePair( )
100 m_CurrentStyleLocalePair = EMPTY_STYLELOCALE_PAIR;