Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / shell / inc / contentreader.hxx
bloba8af703dd9826f15d113075283ca48d4aa4ca94e
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 #ifndef INCLUDED_SHELL_INC_INTERNAL_CONTENTREADER_HXX
21 #define INCLUDED_SHELL_INC_INTERNAL_CONTENTREADER_HXX
23 #include "basereader.hxx"
24 #include <stack>
25 #include "filepath.hxx"
27 class ITag;
28 class StreamInterface;
30 class CContentReader : public CBaseReader
32 public:
33 virtual ~CContentReader() override;
35 CContentReader( const Filepath_t& DocumentName, LocaleSet_t const & DocumentLocale );
37 CContentReader( StreamInterface* stream, LocaleSet_t const & DocumentLocale );
40 /** Get the chunkbuffer.
42 @return
43 the chunkbuffer of the document.
45 ChunkBuffer_t const & getChunkBuffer( ) const{ return m_ChunkBuffer; };
47 protected: // protected because its only an implementation relevant class
49 /** start_element occurs when a tag is start.
51 @param raw_name
52 raw name of the tag.
53 @param local_name
54 local name of the tag.
55 @param attributes
56 attribute structure.
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;
63 /** end_element occurs when a tag is closed
65 @param raw_name
66 raw name of the tag.
67 @param local_name
68 local name of the tag.
70 virtual void end_element(
71 const string_t& raw_name, const string_t& local_name) override;
73 /** characters occurs when receiving characters
75 @param character
76 content of the information received.
78 virtual void characters(const string_t& character) override;
80 protected:
81 /** choose an appropriate tag reader to handle the tag.
83 @param tag_name
84 the name of the tag.
85 @param XmlAttributes
86 attribute structure of the tag to save in.
88 ITag* chooseTagReader(
89 const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes );
91 /** Get the list of style locale pair.
93 @return
94 the Style-Locale map
96 StyleLocaleMap_t const & getStyleMap( ) const{ return m_StyleMap; };
98 /** get style of the current content.
100 @return style of the current content.
102 ::std::wstring getCurrentContentStyle();
104 /** add chunk into Chunk Buffer.
106 void addChunk( LocaleSet_t const & Locale, Content_t const & Content );
108 /** get a style's locale field.
110 LocaleSet_t const & getLocale( const StyleName_t& Style );
112 private:
113 std::stack<ITag*> m_TagBuilderStack;
115 ChunkBuffer_t m_ChunkBuffer;
116 StyleLocaleMap_t m_StyleMap;
117 LocaleSet_t m_DefaultLocale;
120 #endif
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */