/src/libetonyek/src/lib/contexts/IWORKStyleRefContext.cpp
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* |
3 | | * This file is part of the libetonyek 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 | | |
10 | | #include "IWORKStyleRefContext.h" |
11 | | |
12 | | #include "IWORKCollector.h" |
13 | | #include "IWORKDictionary.h" |
14 | | #include "IWORKToken.h" |
15 | | #include "IWORKXMLParserState.h" |
16 | | |
17 | | namespace libetonyek |
18 | | { |
19 | | |
20 | | IWORKStyleRefContext::IWORKStyleRefContext(IWORKXMLParserState &state, const IWORKStyleMap_t &styleMap, const bool nested) |
21 | 0 | : IWORKXMLEmptyContextBase(state) |
22 | 0 | , m_styleMap(styleMap) |
23 | 0 | , m_nested(nested) |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | | void IWORKStyleRefContext::attribute(int name, const char *value) |
28 | 0 | { |
29 | 0 | IWORKXMLEmptyContextBase::attribute(name, value); |
30 | 0 | } |
31 | | |
32 | | void IWORKStyleRefContext::endOfElement() |
33 | 0 | { |
34 | 0 | if (getRef()) |
35 | 0 | { |
36 | 0 | const IWORKStyleMap_t::const_iterator it = m_styleMap.find(get(getRef())); |
37 | 0 | if (m_styleMap.end() != it) |
38 | 0 | { |
39 | 0 | const IWORKStylePtr_t &style = it->second; |
40 | 0 | if (style->getIdent() && getState().m_stylesheet && !m_nested) |
41 | 0 | getState().m_stylesheet->m_styles[get(style->getIdent())] = style; |
42 | 0 | if (isCollector()) |
43 | 0 | getCollector().collectStyle(style); |
44 | 0 | } |
45 | 0 | } |
46 | 0 | } |
47 | | |
48 | | } |
49 | | |
50 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |