1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef CONTENTREADER_HXX_INCLUDED 29 #define CONTENTREADER_HXX_INCLUDED 30 31 #include "internal/basereader.hxx" 32 33 class ITag; 34 35 class CContentReader : public CBaseReader 36 { 37 public: 38 virtual ~CContentReader(); 39 40 //CContentReader( const std::string& DocumentName ); 41 CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale ); 42 43 CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ); 44 45 46 /** Get the chunkbuffer. 47 48 @return 49 the chunkbuffer of the document. 50 */ 51 inline ChunkBuffer_t const & getChunkBuffer( ) const{ return m_ChunkBuffer; }; 52 53 protected: // protected because its only an implementation relevant class 54 55 /** start_element occurs when a tag is start. 56 57 @param raw_name 58 raw name of the tag. 59 @param local_name 60 local name of the tag. 61 @param attributes 62 attribute structure. 63 */ 64 virtual void start_element( 65 const std::wstring& raw_name, 66 const std::wstring& local_name, 67 const XmlTagAttributes_t& attributes); 68 69 /** end_element occurs when a tag is closed 70 71 @param raw_name 72 raw name of the tag. 73 @param local_name 74 local name of the tag. 75 */ 76 virtual void end_element( 77 const std::wstring& raw_name, const std::wstring& local_name); 78 79 /** characters occurs when receiving characters 80 81 @param character 82 content of the information received. 83 */ 84 virtual void characters(const std::wstring& character); 85 86 protected: 87 /** choose an appropriate tag reader to handle the tag. 88 89 @param tag_name 90 the name of the tag. 91 @param XmlAttributes 92 attribute structure of the tag to save in. 93 */ 94 ITag* chooseTagReader( 95 const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes ); 96 97 /** Get the list of style locale pair. 98 99 @return 100 the Style-Locale map 101 */ 102 inline StyleLocaleMap_t const & getStyleMap( ) const{ return m_StyleMap; }; 103 104 /** get style of the current content. 105 106 @return style of the current content. 107 */ 108 ::std::wstring getCurrentContentStyle( void ); 109 110 /** add chunk into Chunk Buffer. 111 */ 112 void addChunk( LocaleSet_t const & Locale, Content_t const & Content ); 113 114 /** get a style's locale field. 115 */ 116 LocaleSet_t const & getLocale( const StyleName_t Style ); 117 118 private: 119 std::stack<ITag*> m_TagBuilderStack; 120 121 ChunkBuffer_t m_ChunkBuffer; 122 StyleLocaleMap_t m_StyleMap; 123 LocaleSet_t m_DefaultLocale; 124 }; 125 126 #endif 127