nss: upgrade to release 3.73
[LibreOffice.git] / xmloff / source / text / XMLSectionExport.hxx
blob72c6247bcd2c44f240b6306a30de44dcafa95df6
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_XMLOFF_SOURCE_TEXT_XMLSECTIONEXPORT_HXX
21 #define INCLUDED_XMLOFF_SOURCE_TEXT_XMLSECTIONEXPORT_HXX
23 #include <rtl/ustring.hxx>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <com/sun/star/beans/PropertyValue.hpp>
27 #include <xmloff/xmltoken.hxx>
29 class SvXMLExport;
30 class XMLTextParagraphExport;
31 namespace com::sun::star {
32 namespace text
34 class XTextSection;
35 class XDocumentIndex;
36 class XTextContent;
38 namespace beans
40 class XPropertySet;
42 namespace container
44 class XIndexReplace;
49 enum SectionTypeEnum
51 TEXT_SECTION_TYPE_TOC,
52 TEXT_SECTION_TYPE_TABLE,
53 TEXT_SECTION_TYPE_ILLUSTRATION,
54 TEXT_SECTION_TYPE_OBJECT,
55 TEXT_SECTION_TYPE_USER,
56 TEXT_SECTION_TYPE_ALPHABETICAL,
57 TEXT_SECTION_TYPE_BIBLIOGRAPHY,
58 TEXT_SECTION_TYPE_UNKNOWN
62 /**
63 * This class handles the export of sections and indices (which are,
64 * internally, just sections). It is intended to be used only from
65 * within the XMLTextParagraphExport class.
67 class XMLSectionExport
69 SvXMLExport& rExport;
70 XMLTextParagraphExport& rParaExport;
72 bool bHeadingDummiesExported;
74 public:
75 XMLSectionExport(SvXMLExport& rExp,
76 XMLTextParagraphExport& rParaExp);
78 /**
79 * export section or index start and source elements. This
80 * method handles the section styles, and delegates to the
81 * appropriate section or index method.
83 void ExportSectionStart(
84 const css::uno::Reference < css::text::XTextSection > & rSection,
85 bool bAutoStyles);
87 /**
88 * export section or index end elements
90 void ExportSectionEnd(
91 const css::uno::Reference < css::text::XTextSection > & rSection,
92 bool bAutoStyles);
94 /**
95 * Should the content of this section be exported?
96 * (E.g. linked sections in global documents are not always exported)
98 bool IsMuteSection(
99 const css::uno::Reference < css::text::XTextSection > & rSection) const;
102 * XTextContent-version of IsMuteSection(Reference<XTextSection>&)
103 * returns *true* for all non-section elements
105 bool IsMuteSection(
106 const css::uno::Reference < css::text::XTextContent > & rSection,
107 /// return value if this content doesn't support the section property
108 bool bDefault) const;
111 * Determine whether rContent is contained in rEnclosingSection. If the
112 * current section of rContent can not be determined, return bDefault.
114 static bool IsInSection(
115 const css::uno::Reference < css::text::XTextSection > & rEnclosingSection,
116 const css::uno::Reference < css::text::XTextContent > & rContent,
117 /// return value if this content doesn't support the section property
118 bool bDefault);
121 * Export the configuration element for bibliography indices.
123 * (This is part of XMLSectionExport because all section- and
124 * index-related items are handled here.)
126 static void ExportBibliographyConfiguration(SvXMLExport& rExport);
128 /** export a heading for every level. This is used by master documents
129 * to not lose the heading information if master documents are exported
130 * without section contents
132 void ExportMasterDocHeadingDummies();
135 private:
137 SvXMLExport& GetExport() { return rExport; }
138 XMLTextParagraphExport& GetParaExport() { return rParaExport; }
140 // export methods for section and index start:
142 /// export an index start element.
143 void ExportIndexStart(
144 const css::uno::Reference < css::text::XDocumentIndex > & rSection);
146 /// export an index header start element.
147 void ExportIndexHeaderStart(
148 const css::uno::Reference < css::text::XTextSection > & rSection);
150 /// export a proper section (and source elements)
151 void ExportRegularSectionStart(
152 const css::uno::Reference < css::text::XTextSection > & rSection);
154 /// export a table of content (and source element)
155 void ExportTableOfContentStart(
156 const css::uno::Reference < css::beans::XPropertySet > & rSection);
158 /// export a table index (and source element)
159 void ExportTableIndexStart(
160 const css::uno::Reference < css::beans::XPropertySet > & rSection);
162 /// export an object index (and source element)
163 void ExportObjectIndexStart(
164 const css::uno::Reference < css::beans::XPropertySet > & rSection);
166 /// export an illustration index (and source element)
167 void ExportIllustrationIndexStart(
168 const css::uno::Reference < css::beans::XPropertySet > & rSection);
170 /// export an alphabetical/keyword index (and source element)
171 void ExportAlphabeticalIndexStart(
172 const css::uno::Reference < css::beans::XPropertySet > & rSection);
174 /// export a user index (and source element)
175 void ExportUserIndexStart(
176 const css::uno::Reference < css::beans::XPropertySet > & rSection);
178 /// export the bibliography (and source element)
179 void ExportBibliographyStart(
180 const css::uno::Reference < css::beans::XPropertySet > & rIndex);
182 // helper methods:
185 * If this section is an index, the index is written in the
186 * rIndex parameter. The return value is sal_True for all "special"
187 * sections.
189 * Thus we have:
190 * return sal_False: regular section
191 * return sal_True, xIndex is empty: index header section
192 * return sal_True, xIndex is set: index section */
193 static bool GetIndex(
194 const css::uno::Reference < css::text::XTextSection > & rSection,
195 css::uno::Reference < css::text::XDocumentIndex > & rIndex);
197 /// map service name to section type
198 static enum SectionTypeEnum MapSectionType(const OUString& rSectionName);
201 * Export the index element start (for all index types).
203 * All additional attributes (usually none) for the index element
204 * should have been set at GetExport() before calling this method.
206 void ExportBaseIndexStart(
207 ::xmloff::token::XMLTokenEnum eElement,
208 const css::uno::Reference < css::beans::XPropertySet > & rSection);
211 * Export the index source element (common for all index types).
213 * All additional attributes for the source element should have
214 * been set at the GetExport() before calling this method.
216 void ExportBaseIndexSource(
217 SectionTypeEnum eType, /// index type
218 const css::uno::Reference <
219 css::beans::XPropertySet > & rSection);
222 * Export the index body (common for all index types).
224 void ExportBaseIndexBody(
225 SectionTypeEnum eType, /// index type
226 const css::uno::Reference < css::beans::XPropertySet > & rSection);
230 * Helper method to export common attributes for table and
231 * illustration indices
233 void ExportTableAndIllustrationIndexSourceAttributes(
234 const css::uno::Reference < css::beans::XPropertySet > & rSection);
236 /// export one template for the specific index type
237 bool ExportIndexTemplate(
238 SectionTypeEnum eType, /// index type
239 sal_Int32 nLevel, /// outline level (if applicable)
240 const css::uno::Reference< css::beans::XPropertySet> & rPropSet,
241 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue> > & rValues);
243 /// export a single template element (e.g. span or tab-stop)
244 void ExportIndexTemplateElement(
245 SectionTypeEnum eType, //i90246, needed for ODF 1.0, 1.0 and 1.2 management
246 const css::uno::Sequence<
247 css::beans::PropertyValue> & rValues);
249 /// export level paragraph styles
250 void ExportLevelParagraphStyles(
251 css::uno::Reference< css::container::XIndexReplace> const & xStyles);
254 /// helper to export boolean properties
255 void ExportBoolean(
256 const css::uno::Reference<css::beans::XPropertySet> & rPropSet,
257 const OUString& sPropertyName,
258 enum ::xmloff::token::XMLTokenEnum eAttributeName,
259 bool bDefault,
260 bool bInvert = false);
263 #endif
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */