LibreOffice Module shell (master) 1
autostyletag.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "autostyletag.hxx"
21
22/*********************** CAutoStyleTag ***********************/
23
25 m_CurrentStyleLocalePair( EMPTY_STYLELOCALE_PAIR )
26{
27 addAttributes( attributes);
28};
29
31{
32}
33
35{
36}
37
38void CAutoStyleTag::addCharacters(const std::wstring&)
39{
40}
41
43{
45 {
46 // the style-locale pair should be empty when entering STYLE_STYLE
47 // tag, and otherwise should be STYLE_PROPERTIES.
48
49 XmlTagAttributes_t::const_iterator iter = attributes.find(CONTENT_STYLE_STYLE_NAME);
50
51 if ( iter != attributes.end())
52 setStyle( iter->second );
53 }
54 else
55 {
56 // tag STYLE_PROPERTIES entered.
57
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);
62
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
71 }
72
73}
74
75void CAutoStyleTag::setStyle( ::std::wstring const & Style )
76{
78}
79
81{
83}
84
86{
88}
89
90
91/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void addAttributes(const XmlTagAttributes_t &attributes) override
void setLocale(const LocaleSet_t &Locale)
void setStyle(::std::wstring const &Style)
virtual void endTag() override
virtual void addCharacters(const std::wstring &characters) override
StyleLocalePair_t m_CurrentStyleLocalePair
virtual void startTag() override
void clearStyleLocalePair()
#define CONTENT_STYLE_PROPERTIES_LANGUAGEASIAN
Definition: config.hxx:75
#define CONTENT_STYLE_PROPERTIES_COUNTRY
Definition: config.hxx:74
#define CONTENT_STYLE_PROPERTIES_COUNTRYASIAN
Definition: config.hxx:76
#define CONTENT_STYLE_PROPERTIES_LANGUAGE
Definition: config.hxx:73
#define CONTENT_STYLE_STYLE_NAME
Definition: config.hxx:70
::std::pair< Language_t, Country_t > LocaleSet_t
Definition: types.hxx:48
std::map< std::wstring, std::wstring > XmlTagAttributes_t
Definition: types.hxx:34
const StyleLocalePair_t EMPTY_STYLELOCALE_PAIR
Definition: types.hxx:66