Bump version to 5.0-14
[LibreOffice.git] / shell / source / win32 / ooofilereader / autostyletag.cxx
blobf2220d91549ac5181a890ad4b460537c35e6d71c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "autostyletag.hxx"
22 /*********************** CAutoStyleTag ***********************/
24 CAutoStyleTag::CAutoStyleTag( const XmlTagAttributes_t& attributes ):
25 m_CurrentStyleLocalePair( EMPTY_STYLELOCALE_PAIR )
27 addAttributes( attributes);
30 void CAutoStyleTag::startTag()
34 void CAutoStyleTag::endTag()
38 void CAutoStyleTag::addCharacters(const std::wstring&)
42 void CAutoStyleTag::addAttributes(const XmlTagAttributes_t& attributes)
44 if ( EMPTY_STYLELOCALE_PAIR == m_CurrentStyleLocalePair )
46 // the style-locale pair should be empty when entering STYLE_STYLE
47 // tag, and otherwise should be STYLE_PROPERTIES.
49 XmlTagAttributes_t::const_iterator iter = attributes.find(CONTENT_STYLE_STYLE_NAME);
51 if ( iter != attributes.end())
52 setStyle( iter->second );
54 else
56 // tag STYLE_PROPERTIES entered.
58 XmlTagAttributes_t::const_iterator iter_lan = attributes.find(CONTENT_STYLE_PROPERTIES_LANGUAGE);
59 XmlTagAttributes_t::const_iterator iter_con = attributes.find(CONTENT_STYLE_PROPERTIES_COUNTRY);
60 XmlTagAttributes_t::const_iterator iter_lan_asain = attributes.find(CONTENT_STYLE_PROPERTIES_LANGUAGEASIAN);
61 XmlTagAttributes_t::const_iterator iter_con_asain = attributes.find(CONTENT_STYLE_PROPERTIES_COUNTRYASIAN);
63 // if style:properties | fo:language or style:language-asian is exist,
64 // set the locale field, otherwise clear the style-locale pair;
65 if ( ( iter_lan!= attributes.end() ) && ( iter_con != attributes.end() ) )
66 setLocale( ::std::make_pair( iter_lan->second,iter_con->second ) );
67 else if ( ( iter_lan_asain!= attributes.end() ) && ( iter_con_asain != attributes.end() ) )
68 setLocale( ::std::make_pair( iter_lan_asain->second,iter_con_asain->second ) );
69 else
70 clearStyleLocalePair();
75 void CAutoStyleTag::setStyle( ::std::wstring const & Style )
77 m_CurrentStyleLocalePair.first = Style;
80 void CAutoStyleTag::setLocale(const LocaleSet_t& Locale)
82 m_CurrentStyleLocalePair.second = Locale;
85 void CAutoStyleTag::clearStyleLocalePair( )
87 m_CurrentStyleLocalePair = EMPTY_STYLELOCALE_PAIR;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */