LibreOffice Module shell (master) 1
contentreader.hxx
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#ifndef INCLUDED_SHELL_INC_INTERNAL_CONTENTREADER_HXX
21#define INCLUDED_SHELL_INC_INTERNAL_CONTENTREADER_HXX
22
23#include "basereader.hxx"
24#include <stack>
25#include "filepath.hxx"
26
27class ITag;
28class StreamInterface;
29
31{
32public:
33 virtual ~CContentReader() override;
34
35 CContentReader( const Filepath_t& DocumentName, LocaleSet_t const & DocumentLocale );
36
37 CContentReader( StreamInterface* stream, LocaleSet_t const & DocumentLocale );
38
39
45 ChunkBuffer_t const & getChunkBuffer( ) const{ return m_ChunkBuffer; };
46
47protected: // protected because its only an implementation relevant class
48
58 virtual void start_element(
59 const string_t& raw_name,
60 const string_t& local_name,
61 const xml_tag_attribute_container_t& attributes) override;
62
70 virtual void end_element(
71 const string_t& raw_name, const string_t& local_name) override;
72
78 virtual void characters(const string_t& character) override;
79
80protected:
89 const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes );
90
96 StyleLocaleMap_t const & getStyleMap( ) const{ return m_StyleMap; };
97
102 ::std::wstring getCurrentContentStyle();
103
106 void addChunk( LocaleSet_t const & Locale, Content_t const & Content );
107
110 LocaleSet_t const & getLocale( const StyleName_t& Style );
111
112private:
113 std::stack<ITag*> m_TagBuilderStack;
114
118};
119
120#endif
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void end_element(const string_t &raw_name, const string_t &local_name) override
end_element occurs when a tag is closed
std::stack< ITag * > m_TagBuilderStack
ChunkBuffer_t m_ChunkBuffer
virtual ~CContentReader() override
destructor.
virtual void start_element(const string_t &raw_name, const string_t &local_name, const xml_tag_attribute_container_t &attributes) override
start_element occurs when a tag is start.
void addChunk(LocaleSet_t const &Locale, Content_t const &Content)
add chunk into Chunk Buffer.
StyleLocaleMap_t const & getStyleMap() const
Get the list of style locale pair.
StyleLocaleMap_t m_StyleMap
CContentReader(const Filepath_t &DocumentName, LocaleSet_t const &DocumentLocale)
constructor.
ChunkBuffer_t const & getChunkBuffer() const
Get the chunkbuffer.
LocaleSet_t const & getLocale(const StyleName_t &Style)
get a style's locale field.
ITag * chooseTagReader(const std::wstring &tag_name, const XmlTagAttributes_t &XmlAttributes)
choose an appropriate tag reader to handle the tag.
LocaleSet_t m_DefaultLocale
::std::wstring getCurrentContentStyle()
get style of the current content.
virtual void characters(const string_t &character) override
characters occurs when receiving characters
Interface for a xml tag character builder.
Definition: itag.hxx:32
Reference< XOutputStream > stream
std::string Filepath_t
Definition: filepath.hxx:22
std::string string_t
std::map< string_t, string_t > xml_tag_attribute_container_t
::std::vector< Chunk_t > ChunkBuffer_t
Definition: types.hxx:52
::std::map< StyleName_t, LocaleSet_t > StyleLocaleMap_t
Definition: types.hxx:64
::std::wstring StyleName_t
Definition: types.hxx:62
::std::pair< Language_t, Country_t > LocaleSet_t
Definition: types.hxx:48
::std::wstring Content_t
Definition: types.hxx:50
std::map< std::wstring, std::wstring > XmlTagAttributes_t
Definition: types.hxx:34