Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / shell / inc / metainforeader.hxx
blob7ff0a734fc3f21dd761184f30a869d5d653395c3
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_METAINFOREADER_HXX
21 #define INCLUDED_SHELL_INC_INTERNAL_METAINFOREADER_HXX
23 #include "basereader.hxx"
24 #include "types.hxx"
25 #include <stack>
26 #include "filepath.hxx"
28 class ITag;
29 class CKeywordsTag;
30 class CSimpleTag;
31 class CDummyTag;
33 class CMetaInfoReader : public CBaseReader
35 public:
36 virtual ~CMetaInfoReader() override;
38 CMetaInfoReader( const Filepath_t& DocumentName );
40 CMetaInfoReader( StreamInterface* stream );
42 /** check if the Tag is in the target meta.xml file.
44 @param TagName
45 the name of the tag that will be retrieved.
47 bool hasTag(const std::wstring& TagName) const;
50 /** Get a specific tag content, compound tags will be returned as comma separated list.
52 @param TagName
53 the name of the tag that will be retrieved.
55 std::wstring getTagData(const std::wstring& TagName);
57 /** check if the a tag has the specific attribute.
59 @param TagName
60 the name of the tag.
61 @param AttributeName
62 the name of the attribute.
64 bool hasTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName);
66 /** Get a specific attribute content.
68 @param TagName
69 the name of the tag.
70 @param AttributeName
71 the name of the attribute.
73 std::wstring getTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName);
75 /** Get the default language of the whole document.
77 LocaleSet_t getDefaultLocale( );
79 protected: // protected because its only an implementation relevant class
81 /** start_element occurs when a tag is start.
83 @param raw_name
84 raw name of the tag.
85 @param local_name
86 local name of the tag.
87 @param attributes
88 attribute structure.
90 virtual void start_element(
91 const string_t& raw_name,
92 const string_t& local_name,
93 const xml_tag_attribute_container_t& attributes) override;
95 /** end_element occurs when a tag is closed
97 @param raw_name
98 raw name of the tag.
99 @param local_name
100 local name of the tag.
102 virtual void end_element(
103 const string_t& raw_name, const string_t& local_name) override;
105 /** characters occurs when receiving characters
107 @param character
108 content of the information received.
110 virtual void characters(const string_t& character) override;
112 protected:
113 /** choose an appropriate tag reader to handle the tag.
115 @param tag_name
116 the name of the tag.
117 @param XmlAttributes
118 attribute structure of the tag to save in.
120 ITag* chooseTagReader(
121 const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes );
123 /** save the received content into structure.
125 @param tag_name
126 the name of the tag.
128 void saveTagContent( const std::wstring& tag_name );
130 private:
131 XmlTags_t m_AllMetaInfo;
133 private:
134 std::stack<ITag*> m_TagBuilderStack;
136 private:
137 CKeywordsTag* m_pKeywords_Builder;
138 CDummyTag* m_pDummy_Builder;
139 CSimpleTag* m_pSimple_Builder;
142 #endif
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */