xref: /aoo42x/main/xmloff/inc/txtflde.hxx (revision 86e1cf34)
1ecfe53c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ecfe53c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ecfe53c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ecfe53c5SAndrew Rist  * distributed with this work for additional information
6ecfe53c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ecfe53c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ecfe53c5SAndrew Rist  * "License"); you may not use this file except in compliance
9ecfe53c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10ecfe53c5SAndrew Rist  *
11ecfe53c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ecfe53c5SAndrew Rist  *
13ecfe53c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ecfe53c5SAndrew Rist  * software distributed under the License is distributed on an
15ecfe53c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ecfe53c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17ecfe53c5SAndrew Rist  * specific language governing permissions and limitations
18ecfe53c5SAndrew Rist  * under the License.
19ecfe53c5SAndrew Rist  *
20ecfe53c5SAndrew Rist  *************************************************************/
21ecfe53c5SAndrew Rist 
22ecfe53c5SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir /** @#file
25cdf0e10cSrcweir  *  XML export of all text fields
26cdf0e10cSrcweir  */
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _XMLOFF_TXTFLDE_HXX
29cdf0e10cSrcweir #define _XMLOFF_TXTFLDE_HXX
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
32cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <rtl/ustring.hxx>
35cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <map>
38cdf0e10cSrcweir #include <set>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class SvXMLExport;
42cdf0e10cSrcweir class SvXMLNumFmtExport;
43cdf0e10cSrcweir struct XMLPropertyState;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace com { namespace sun { namespace star {
46cdf0e10cSrcweir 	namespace util { struct DateTime; }
47cdf0e10cSrcweir 	namespace util { struct Date; }
48cdf0e10cSrcweir 	namespace text { class XTextField; }
49cdf0e10cSrcweir 	namespace text { class XText; }
50cdf0e10cSrcweir 	namespace beans { class XPropertySet; }
51cdf0e10cSrcweir 	namespace beans { class XPropertySetInfo; }
52cdf0e10cSrcweir 	namespace frame { class XModel; }
53cdf0e10cSrcweir     namespace uno { template<typename A> class Sequence; }
54cdf0e10cSrcweir } } }
55cdf0e10cSrcweir namespace rtl { class OUString; }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir /// field IDs,
59cdf0e10cSrcweir //   including translation between UNO speak and XML speak if appropriate
60cdf0e10cSrcweir 
61cdf0e10cSrcweir enum FieldIdEnum {
62cdf0e10cSrcweir 	FIELD_ID_SENDER,		// sender == extended user
63cdf0e10cSrcweir 	FIELD_ID_AUTHOR,
64cdf0e10cSrcweir 	FIELD_ID_DATE,			// current date
65cdf0e10cSrcweir 	FIELD_ID_TIME,			// current time (+date)
66cdf0e10cSrcweir 	FIELD_ID_PAGENUMBER,	// page number
67cdf0e10cSrcweir 	FIELD_ID_PAGESTRING,	// page contination string (page number string)
68cdf0e10cSrcweir 	FIELD_ID_REFPAGE_SET,	// set reference page
69cdf0e10cSrcweir 	FIELD_ID_REFPAGE_GET,	// get reference page number
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	FIELD_ID_PLACEHOLDER,	// placeholder field == jump edit field
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	FIELD_ID_VARIABLE_DECL,	// field type for set variable
74cdf0e10cSrcweir 	FIELD_ID_VARIABLE_GET,	// get variable == get expression
75cdf0e10cSrcweir 	FIELD_ID_VARIABLE_SET,	// set variable == set expression
76cdf0e10cSrcweir 	FIELD_ID_VARIABLE_INPUT,	// input field (variable)
77cdf0e10cSrcweir 	FIELD_ID_USER_DECL,		// field type for user field
78cdf0e10cSrcweir 	FIELD_ID_USER_GET,		// user field
79cdf0e10cSrcweir 	FIELD_ID_USER_INPUT,	// input field (user field)
80cdf0e10cSrcweir 	FIELD_ID_TEXT_INPUT,	// input field (text)
81cdf0e10cSrcweir 	FIELD_ID_EXPRESSION,	// expression field = formula field
82cdf0e10cSrcweir 	FIELD_ID_SEQUENCE_DECL,	// field type for sequence
83cdf0e10cSrcweir 	FIELD_ID_SEQUENCE,		// sequence field
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	FIELD_ID_DATABASE_NEXT,		// select next row
86cdf0e10cSrcweir 	FIELD_ID_DATABASE_SELECT,	// select row # (NumSet)
87cdf0e10cSrcweir 	FIELD_ID_DATABASE_DISPLAY,	// display data (form letter field)
88cdf0e10cSrcweir 	FIELD_ID_DATABASE_NAME,		// display current db name (database name)
89cdf0e10cSrcweir 	FIELD_ID_DATABASE_NUMBER,	// display row # (SetNumber)
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	FIELD_ID_DOCINFO_CREATION_AUTHOR,	// docinfo fields
92cdf0e10cSrcweir 	FIELD_ID_DOCINFO_CREATION_TIME,
93cdf0e10cSrcweir 	FIELD_ID_DOCINFO_CREATION_DATE,
94cdf0e10cSrcweir 	FIELD_ID_DOCINFO_DESCRIPTION,
95cdf0e10cSrcweir 	FIELD_ID_DOCINFO_CUSTOM,
96cdf0e10cSrcweir 	FIELD_ID_DOCINFO_PRINT_TIME,
97cdf0e10cSrcweir 	FIELD_ID_DOCINFO_PRINT_DATE,
98cdf0e10cSrcweir 	FIELD_ID_DOCINFO_PRINT_AUTHOR,
99cdf0e10cSrcweir 	FIELD_ID_DOCINFO_TITLE,
100cdf0e10cSrcweir 	FIELD_ID_DOCINFO_SUBJECT,
101cdf0e10cSrcweir 	FIELD_ID_DOCINFO_KEYWORDS,
102cdf0e10cSrcweir 	FIELD_ID_DOCINFO_REVISION,
103cdf0e10cSrcweir 	FIELD_ID_DOCINFO_EDIT_DURATION,
104cdf0e10cSrcweir 	FIELD_ID_DOCINFO_SAVE_TIME,
105cdf0e10cSrcweir 	FIELD_ID_DOCINFO_SAVE_DATE,
106cdf0e10cSrcweir 	FIELD_ID_DOCINFO_SAVE_AUTHOR,
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	FIELD_ID_CONDITIONAL_TEXT,			// conditionally choose between 2 texts
109cdf0e10cSrcweir 	FIELD_ID_HIDDEN_TEXT,				// conditionally hide a text
110cdf0e10cSrcweir 	FIELD_ID_HIDDEN_PARAGRAPH,			// conditionally hide a paragraph
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	FIELD_ID_TEMPLATE_NAME,		// display name of template
113cdf0e10cSrcweir 	FIELD_ID_CHAPTER,			// display name/number of current chapter
114cdf0e10cSrcweir 	FIELD_ID_FILE_NAME,			// display name of current file
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	FIELD_ID_COUNT_PARAGRAPHS,		// statistics fields: - paragraphs
117cdf0e10cSrcweir 	FIELD_ID_COUNT_WORDS,			//					  - words
118cdf0e10cSrcweir 	FIELD_ID_COUNT_CHARACTERS,		//					  - chars
119cdf0e10cSrcweir 	FIELD_ID_COUNT_PAGES,			//					  - pages
120cdf0e10cSrcweir 	FIELD_ID_COUNT_TABLES,			//					  - tables
121cdf0e10cSrcweir 	FIELD_ID_COUNT_GRAPHICS,		//					  - graphics
122cdf0e10cSrcweir 	FIELD_ID_COUNT_OBJECTS,			//					  - objects
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	FIELD_ID_MACRO,					// macro fields
125cdf0e10cSrcweir 	FIELD_ID_REF_REFERENCE,			// get reference field (reference)
126cdf0e10cSrcweir 	FIELD_ID_REF_SEQUENCE,			// get reference field (sequence)
127cdf0e10cSrcweir 	FIELD_ID_REF_BOOKMARK,			// get reference field (bookmark)
128cdf0e10cSrcweir 	FIELD_ID_REF_FOOTNOTE,			// get reference field (footnote)
129cdf0e10cSrcweir 	FIELD_ID_REF_ENDNOTE,			// get reference field (endnote)
130cdf0e10cSrcweir 	FIELD_ID_DDE,					// DDE field
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	FIELD_ID_BIBLIOGRAPHY,			// bibliography index entry
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	FIELD_ID_SHEET_NAME,			// name of current (spread-)sheet
135cdf0e10cSrcweir 	FIELD_ID_URL,					// URL field (only Calc, Draw, Impress)
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	FIELD_ID_SCRIPT,				// script fields (for HTML pages, mostly)
138cdf0e10cSrcweir 	FIELD_ID_ANNOTATION,			// annotation (notice) field
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	FIELD_ID_COMBINED_CHARACTERS,	// combined characters (asian typography)
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     FIELD_ID_META,                  // text:meta-field (RDF metadata)
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	FIELD_ID_MEASURE,				// for measure shapes
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     FIELD_ID_TABLE_FORMULA,         // DEPRECATED: table formulas (Writer 2.0)
147cdf0e10cSrcweir     FIELD_ID_DROP_DOWN,             // DEPRECATED: dropdown fields (WW8)
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	FIELD_ID_DRAW_HEADER,
150cdf0e10cSrcweir 	FIELD_ID_DRAW_FOOTER,
151cdf0e10cSrcweir 	FIELD_ID_DRAW_DATE_TIME,
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	FIELD_ID_UNKNOWN		// invalid or unknown field type!
154cdf0e10cSrcweir };
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 
158cdf0e10cSrcweir class XMLTextFieldExport
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 	SvXMLExport& rExport;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	/// store used text field master names (NULL means: don't collect)
163cdf0e10cSrcweir 	::std::map<
164cdf0e10cSrcweir 			::com::sun::star::uno::Reference< ::com::sun::star::text::XText >,
165cdf0e10cSrcweir 			::std::set< ::rtl::OUString > > *
166cdf0e10cSrcweir 		pUsedMasters;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir public:
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 	XMLTextFieldExport( SvXMLExport& rExp,
171cdf0e10cSrcweir 						/// XMLPropertyState for the combined characters field
172cdf0e10cSrcweir 						XMLPropertyState* pCombinedCharState = NULL );
173cdf0e10cSrcweir 	virtual ~XMLTextFieldExport();
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	/// Export this field and the surrounding span element with the formatting.
176cdf0e10cSrcweir 	/// To be called for every field in the document body.
177cdf0e10cSrcweir 	void ExportField(const ::com::sun::star::uno::Reference <
178cdf0e10cSrcweir                         ::com::sun::star::text::XTextField > & rTextField,
179cdf0e10cSrcweir                      sal_Bool bProgress );
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	/// collect styles (character styles, data styles, ...) for this field
182cdf0e10cSrcweir 	/// (if appropriate).
183cdf0e10cSrcweir 	/// Also collect used field masters (if pUsedMasters is set)
184cdf0e10cSrcweir 	/// to be called for every field during style export.
185cdf0e10cSrcweir 	void ExportFieldAutoStyle(const ::com::sun::star::uno::Reference <
186cdf0e10cSrcweir                         ::com::sun::star::text::XTextField > & rTextField,
187cdf0e10cSrcweir                  const sal_Bool bProgress, const sal_Bool bRecursive );
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	/// export field declarations.
190cdf0e10cSrcweir 	/// to be called once at beginning of document body.
191cdf0e10cSrcweir 	void ExportFieldDeclarations();
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	/// export field declarations for fields used in the the particular XText.
194cdf0e10cSrcweir 	/// (Requires that a list of used field declarations has previously been
195cdf0e10cSrcweir 	///  built-up in ExportFieldAutoStyle() )
196cdf0e10cSrcweir 	void ExportFieldDeclarations(
197cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference <
198cdf0e10cSrcweir 				::com::sun::star::text::XText > & rText);
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 	/// export all field declarations, or only those that have been used?
201cdf0e10cSrcweir 	/// Calling this method will reset the list of used field declataions.
202cdf0e10cSrcweir 	void SetExportOnlyUsedFieldDeclarations(
203cdf0e10cSrcweir 		sal_Bool bExportOnlyUsed = sal_True);
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	// determine element or attribute names
206cdf0e10cSrcweir 	// (public, because they may be useful in related XML export classes)
207cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapPlaceholderType(sal_uInt16 nType);
208cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapTemplateDisplayFormat(sal_Int16 nType);
209cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapChapterDisplayFormat(sal_Int16 nType);
210cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapFilenameDisplayFormat(sal_Int16 nType);
211cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapDocInfoFieldName(enum FieldIdEnum nToken);
212cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapReferenceSource(sal_Int16 nType);
213cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapReferenceType(sal_Int16 nType);
214cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapCountFieldName(FieldIdEnum nToken);
215cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapBibliographyFieldName(::rtl::OUString sName);
216cdf0e10cSrcweir 	static enum ::xmloff::token::XMLTokenEnum MapMeasureKind(sal_Int16 nKind);
217cdf0e10cSrcweir 	enum ::xmloff::token::XMLTokenEnum MapPageNumberName(const ::com::sun::star::uno::Reference<
218cdf0e10cSrcweir 					  ::com::sun::star::beans::XPropertySet> & xPropSet,
219cdf0e10cSrcweir 					  sal_Int32& nOffset);	/// also adjust page offset
220cdf0e10cSrcweir 	enum ::xmloff::token::XMLTokenEnum MapAuthorFieldName(const ::com::sun::star::uno::Reference <
221cdf0e10cSrcweir 					  ::com::sun::star::beans::XPropertySet > & xPropSet);
222cdf0e10cSrcweir 	enum ::xmloff::token::XMLTokenEnum MapSenderFieldName(const ::com::sun::star::uno::Reference <
223cdf0e10cSrcweir 					  ::com::sun::star::beans::XPropertySet > & xPropSet);
224cdf0e10cSrcweir 
225cdf0e10cSrcweir protected:
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	SvXMLExport& GetExport() { return rExport; }
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 	/// export a field after <text:span> is already written
230cdf0e10cSrcweir 	void ExportFieldHelper(
231cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference<
232cdf0e10cSrcweir 				::com::sun::star::text::XTextField> & rTextField,
233cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference<
234cdf0e10cSrcweir 				::com::sun::star::beans::XPropertySet> & rPropSet,
235cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference<
236cdf0e10cSrcweir 				::com::sun::star::beans::XPropertySet> & rRangePropSet,
237cdf0e10cSrcweir         enum FieldIdEnum nToken,
238cdf0e10cSrcweir         sal_Bool bProgress );
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	/// export an empty element
241cdf0e10cSrcweir 	void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement,	/// element token
242cdf0e10cSrcweir 					   sal_Bool bAddSpace = sal_False); /// add blanks around
243cdf0e10cSrcweir 														/// element?
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	/// export an element with string content
246cdf0e10cSrcweir 	void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement,	/// element token
247cdf0e10cSrcweir 					   const ::rtl::OUString& sContent,	/// element content
248cdf0e10cSrcweir 					   sal_Bool bAddSpace = sal_False); /// add blanks around
249cdf0e10cSrcweir 														/// element?
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     /// export a macro (as used in the macro field)
252cdf0e10cSrcweir     void ExportMacro( const ::com::sun::star::uno::Reference<
253cdf0e10cSrcweir                           ::com::sun::star::beans::XPropertySet> & rPropSet,
254cdf0e10cSrcweir                       const ::rtl::OUString& rContent);
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     /// export text:meta-field (RDF metadata)
257cdf0e10cSrcweir     void ExportMetaField( const ::com::sun::star::uno::Reference<
258cdf0e10cSrcweir                               ::com::sun::star::beans::XPropertySet> & i_xMeta,
259cdf0e10cSrcweir                           bool i_bAutoStyles, sal_Bool i_bProgress );
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 	/// export a boolean attribute
262cdf0e10cSrcweir 	void ProcessBoolean(
263cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,	/// attribute token (namespace text)
264cdf0e10cSrcweir 		sal_Bool bBool,		/// attribute value
265cdf0e10cSrcweir 		sal_Bool bDefault);	/// attribute default; omit, if attribute differs
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 	/// export an integer attribute
268cdf0e10cSrcweir 	void ProcessInteger(
269cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,	/// attribute token (namespace text)
270cdf0e10cSrcweir 		sal_Int32 nNum);			/// attribute value
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 	/// export an integer attribute, omit if default
273cdf0e10cSrcweir 	void ProcessIntegerDef(
274cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,	/// attribute token (namespace text)
275cdf0e10cSrcweir 		sal_Int32 nNum,				/// attribute value
276cdf0e10cSrcweir 		sal_Int32 nDefault);		/// default value
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	/// export a string attribute
279cdf0e10cSrcweir 	void ProcessString(
280cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,		/// attribute token (namespace text)
281cdf0e10cSrcweir 		const ::rtl::OUString& sValue,	/// attribute value
282cdf0e10cSrcweir 		sal_Bool bOmitEmpty = sal_False, /// omit attribute, if value is empty
283cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
284cdf0e10cSrcweir 
285*86e1cf34SPedro Giffuni 	/// export a string attribute that gets a QName value
286cdf0e10cSrcweir 	void ProcessString(
287cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,		/// attribute token (namespace text)
288cdf0e10cSrcweir 		sal_uInt16 nValuePrefix,
289cdf0e10cSrcweir 		const ::rtl::OUString& sValue,	/// attribute value
290cdf0e10cSrcweir 		sal_Bool bOmitEmpty = sal_False, /// omit attribute, if value is empty
291cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	/// export a string attribute, omit if default
295cdf0e10cSrcweir 	void ProcessString(
296cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,		/// attribute token (namespace text)
297cdf0e10cSrcweir 		const ::rtl::OUString& sValue,	/// attribute value
298cdf0e10cSrcweir 		const ::rtl::OUString& sDefault, /// default value; omit if equal
299cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	/// export a string attribute, omit if default
302cdf0e10cSrcweir 	void ProcessString(
303cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,		/// attribute token (namespace text)
304cdf0e10cSrcweir 		sal_uInt16 nValuePrefix,
305cdf0e10cSrcweir 		const ::rtl::OUString& sValue,	/// attribute value
306cdf0e10cSrcweir 		const ::rtl::OUString& sDefault, /// default value; omit if equal
307cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 	/// export a string attribute
310cdf0e10cSrcweir 	void ProcessString(
311cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,		/// attribute token (namespace text)
312cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eValue,			/// attribute token
313cdf0e10cSrcweir 		sal_Bool bOmitEmpty = sal_False, /// omit attribute, if value is empty
314cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	/// export a string attribute, omit if default
317cdf0e10cSrcweir 	void ProcessString(
318cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXmlName,		/// attribute token (namespace text)
319cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eValue,			/// attribute value token
320cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eDefault,		/// default value token
321cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	/// export a string as a sequence of paragraphs
324cdf0e10cSrcweir 	void ProcessParagraphSequence(
325cdf0e10cSrcweir 		/// string containing the paragraphs
326cdf0e10cSrcweir 		const ::rtl::OUString& sParagraphSequence);
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	/// export a numbering format (numeric, roman, alphabetic, etc.)
329cdf0e10cSrcweir 	void ProcessNumberingType(
330cdf0e10cSrcweir 		sal_Int16 nNumberingType);		/// numbering type key
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	/// export display attribute (value, formula, none)
333cdf0e10cSrcweir 	void ProcessDisplay(sal_Bool bIsVisible,	/// is visible?
334cdf0e10cSrcweir 						sal_Bool bIsCommand,	/// is show command/show name?
335cdf0e10cSrcweir 						sal_Bool bDefault = sal_True);	/// omit, if default
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 	/// export all data-style related attributes
338cdf0e10cSrcweir 	void ProcessValueAndType(
339cdf0e10cSrcweir 		sal_Bool bIsString,		/// do we process a string or a number?
340cdf0e10cSrcweir 		sal_Int32 nFormatKey,	/// format key for NumberFormatter; possibly -1
341cdf0e10cSrcweir 		const ::rtl::OUString& sContent, /// string content; possibly invalid
342cdf0e10cSrcweir 		const ::rtl::OUString& sDefault, /// default string
343cdf0e10cSrcweir 		double fValue,			/// float content; possibly invalid
344cdf0e10cSrcweir 		sal_Bool bExportValue,	/// export value attribute?
345cdf0e10cSrcweir 		sal_Bool bExportValueType,	/// export value-type attribute?
346cdf0e10cSrcweir 		sal_Bool bExportStyle,	/// export style-sttribute?
347cdf0e10cSrcweir         sal_Bool bForceSystemLanguage, /// no style language export
348cdf0e10cSrcweir 		sal_Bool bTimeStyle = sal_False); /// exporting a time style?
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 	/// export times, dates and durations according to ISO 8601
351cdf0e10cSrcweir 	void ProcessDateTime(
352cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXMLName, 	/// attribute token
353cdf0e10cSrcweir 		double dValue, 				/// date/time value
354cdf0e10cSrcweir 		sal_Bool bIsDate, 			/// export as date (rather than date/time)?
355cdf0e10cSrcweir 		sal_Bool bIsDuration = sal_False,			/// export as duration
356cdf0e10cSrcweir 		sal_Bool bOmitDurationIfZero = sal_True,	/// omit zero-length durat.
357cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	/// export a date, time, or duration
360cdf0e10cSrcweir 	void ProcessDateTime(
361cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXMLName, 	/// attribute token
362cdf0e10cSrcweir 		sal_Int32 nMinutes,				/// date/time value in minutes
363cdf0e10cSrcweir 		sal_Bool bIsDate, 			/// export as date?
364cdf0e10cSrcweir 		sal_Bool bIsDuration,		/// export as duration?
365cdf0e10cSrcweir 		sal_Bool bOmitDurationIfZero,	/// omit zero-length durations
366cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 	/// export times, dates and durations according to ISO 8601
369cdf0e10cSrcweir 	void ProcessDateTime(
370cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXMLName, 	/// attribute token
371cdf0e10cSrcweir 		const ::com::sun::star::util::DateTime& rTime,		/// date/time value
372cdf0e10cSrcweir 		sal_Bool bIsDate,			/// export as date (rather than date/time)?
373cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 	/// export date according to ISO 8601
376cdf0e10cSrcweir 	void ProcessDate(
377cdf0e10cSrcweir 		enum ::xmloff::token::XMLTokenEnum eXMLName, 	/// attribute token
378cdf0e10cSrcweir 		const ::com::sun::star::util::Date& rTime,	/// date value
379cdf0e10cSrcweir 		sal_uInt16 nPrefix = XML_NAMESPACE_TEXT);	/// attribute name prefix
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	/// export all attributes for bibliography data fields
382cdf0e10cSrcweir 	void ProcessBibliographyData(
383cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference <
384cdf0e10cSrcweir 			::com::sun::star::beans::XPropertySet > & rPropertySet);
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 	/// export CommandTypeAttribute
387cdf0e10cSrcweir 	void ProcessCommandType(
388cdf0e10cSrcweir         sal_Int32 nCommandType);		/// com::sun::star::sdb::CommandType
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 	void ProcessStringSequence(
391cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence<rtl::OUString>& rSequence,
392cdf0e10cSrcweir         const rtl::OUString sSelected );
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 	void ProcessStringSequence(
395cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence<rtl::OUString>& rSequence,
396cdf0e10cSrcweir         sal_Int32 nSelected );
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     /// export attributes that describe a data source
399cdf0e10cSrcweir     void ExportDataBaseElement(
400cdf0e10cSrcweir         enum ::xmloff::token::XMLTokenEnum eElement,
401cdf0e10cSrcweir         const ::rtl::OUString& sContent,
402cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference <
403cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet > & rPropertySet,
404cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference <
405cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySetInfo > & rPropertySetInfo );
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 	/// for XDependentTextFields, get PropertySet of FieldMaster
408cdf0e10cSrcweir 	::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >
409cdf0e10cSrcweir 	GetMasterPropertySet(const ::com::sun::star::uno::Reference <
410cdf0e10cSrcweir 						 ::com::sun::star::text::XTextField > & rTextField);
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 	/// get PropertySet of (any) DependentTextField for this FieldMaster
413cdf0e10cSrcweir 	sal_Bool GetDependentFieldPropertySet(
414cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference<
415cdf0e10cSrcweir 		::com::sun::star::beans::XPropertySet> & xmaster,
416cdf0e10cSrcweir 		::com::sun::star::uno::Reference<
417cdf0e10cSrcweir 		::com::sun::star::beans::XPropertySet> & xField);
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 	/// get field ID from XTextField (and it's Property-Set)
421cdf0e10cSrcweir 	enum FieldIdEnum GetFieldID(const ::com::sun::star::uno::Reference <
422cdf0e10cSrcweir 						  ::com::sun::star::text::XTextField > & rTextField,
423cdf0e10cSrcweir 						  const ::com::sun::star::uno::Reference <
424cdf0e10cSrcweir 						  ::com::sun::star::beans::XPropertySet > & xPropSet);
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 	/// get field ID from XTextField service name (and it's PropertySet)
427cdf0e10cSrcweir 	enum FieldIdEnum MapFieldName(const ::rtl::OUString& sFieldName,
428cdf0e10cSrcweir 							const ::com::sun::star::uno::Reference <
429cdf0e10cSrcweir 							::com::sun::star::beans::XPropertySet> & xPropSet);
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 	/// determine, whether field has string or numeric content
432cdf0e10cSrcweir 	sal_Bool IsStringField(FieldIdEnum nFieldType,	/// field ID
433cdf0e10cSrcweir 						   const ::com::sun::star::uno::Reference <
434cdf0e10cSrcweir 						   ::com::sun::star::beans::XPropertySet > & xPropSet);
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 
4373b32dd21SOliver-Rainer Wittmann     /// explode a field master name into field type and field name
4383b32dd21SOliver-Rainer Wittmann     sal_Bool ExplodeFieldMasterName(
4393b32dd21SOliver-Rainer Wittmann         const ::rtl::OUString& sMasterName,	/// name as returned by SO API
4403b32dd21SOliver-Rainer Wittmann         ::rtl::OUString& sFieldType,		/// out: field type
4413b32dd21SOliver-Rainer Wittmann         ::rtl::OUString& sVarName);			/// out: variable name
4423b32dd21SOliver-Rainer Wittmann 
4433b32dd21SOliver-Rainer Wittmann     /// make reference name for a foot- or endnote
4443b32dd21SOliver-Rainer Wittmann     static ::rtl::OUString MakeFootnoteRefName(sal_Int16 nSeqNo);
4453b32dd21SOliver-Rainer Wittmann 
4463b32dd21SOliver-Rainer Wittmann     /// make reference name for a sequence field
4473b32dd21SOliver-Rainer Wittmann     static ::rtl::OUString MakeSequenceRefName(
4483b32dd21SOliver-Rainer Wittmann         sal_Int16 nSeqNo,
4493b32dd21SOliver-Rainer Wittmann         const ::rtl::OUString& rSeqName );
4503b32dd21SOliver-Rainer Wittmann 
4513b32dd21SOliver-Rainer Wittmann private:
4523b32dd21SOliver-Rainer Wittmann     // service names
4533b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sServicePrefix;
4543b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sFieldMasterPrefix;
4553b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPresentationServicePrefix;
4563b32dd21SOliver-Rainer Wittmann 
4573b32dd21SOliver-Rainer Wittmann     // property names
4583b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyAdjust;
4593b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyAuthor;
4603b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyChapterFormat;
4613b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyChapterNumberingLevel;
4623b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyCharStyleNames;
4633b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyCondition;
4643b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyContent;
4653b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataBaseName;
4663b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataBaseURL;
4673b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataColumnName;
4683b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataCommandType;
4693b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataTableName;
4703b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDate;
4713b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDateTime;
4723b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDateTimeValue;
4733b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDDECommandElement;
4743b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDDECommandFile;
4753b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDDECommandType;
4763b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDependentTextFields;
4773b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFalseContent;
4783b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFields;
4793b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFieldSubType;
4803b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFileFormat;
4813b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFullName;
4823b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyHint;
4833b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyInitials;
4843b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyInstanceName;
4853b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsAutomaticUpdate;
4863b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsConditionTrue;
4873b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsDataBaseFormat;
4883b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsDate;
4893b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsExpression;
4903b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsFixed;
4913b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsFixedLanguage;
4923b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsHidden;
4933b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsInput;
4943b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsShowFormula;
4953b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsVisible;
4963b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyItems;
4973b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyLevel;
4983b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyMacro;
4993b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyMeasureKind;
5003b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyName;
5013b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyNumberFormat;
5023b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyNumberingSeparator;
5033b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyNumberingType;
5043b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyOffset;
5053b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyOn;
5063b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyPlaceholder;
5073b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyPlaceholderType;
5083b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyReferenceFieldPart;
5093b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyReferenceFieldSource;
5103b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyReferenceFieldType;
5113b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyRevision;
5123b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyScriptType;
5133b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySelectedItem;
5143b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySequenceNumber;
5153b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySequenceValue;
5163b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySetNumber;
5173b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySourceName;
5183b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySubType;
5193b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyTargetFrame;
5203b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyTrueContent;
5213b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyURL;
5223b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyURLContent;
5233b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyUserText;
5243b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyValue;
5253b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyVariableName;
5263b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyVariableSubType;
527cdf0e10cSrcweir     const ::rtl::OUString sPropertyHelp;
528cdf0e10cSrcweir     const ::rtl::OUString sPropertyTooltip;
529cdf0e10cSrcweir     const ::rtl::OUString sPropertyTextRange;
530cdf0e10cSrcweir 
5313b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sEmpty;
532cdf0e10cSrcweir 
5333b32dd21SOliver-Rainer Wittmann     XMLPropertyState* pCombinedCharactersPropertyState;
534cdf0e10cSrcweir 
535cdf0e10cSrcweir };
536cdf0e10cSrcweir 
537cdf0e10cSrcweir #endif
538