xref: /aoo41x/main/xmloff/inc/txtflde.hxx (revision 3b32dd21)
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 
GetExport()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 
285cdf0e10cSrcweir 	/// export a string attribute taht 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 
437*3b32dd21SOliver-Rainer Wittmann     /// explode a field master name into field type and field name
438*3b32dd21SOliver-Rainer Wittmann     sal_Bool ExplodeFieldMasterName(
439*3b32dd21SOliver-Rainer Wittmann         const ::rtl::OUString& sMasterName,	/// name as returned by SO API
440*3b32dd21SOliver-Rainer Wittmann         ::rtl::OUString& sFieldType,		/// out: field type
441*3b32dd21SOliver-Rainer Wittmann         ::rtl::OUString& sVarName);			/// out: variable name
442*3b32dd21SOliver-Rainer Wittmann 
443*3b32dd21SOliver-Rainer Wittmann     /// make reference name for a foot- or endnote
444*3b32dd21SOliver-Rainer Wittmann     static ::rtl::OUString MakeFootnoteRefName(sal_Int16 nSeqNo);
445*3b32dd21SOliver-Rainer Wittmann 
446*3b32dd21SOliver-Rainer Wittmann     /// make reference name for a sequence field
447*3b32dd21SOliver-Rainer Wittmann     static ::rtl::OUString MakeSequenceRefName(
448*3b32dd21SOliver-Rainer Wittmann         sal_Int16 nSeqNo,
449*3b32dd21SOliver-Rainer Wittmann         const ::rtl::OUString& rSeqName );
450*3b32dd21SOliver-Rainer Wittmann 
451*3b32dd21SOliver-Rainer Wittmann private:
452*3b32dd21SOliver-Rainer Wittmann     // service names
453*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sServicePrefix;
454*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sFieldMasterPrefix;
455*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPresentationServicePrefix;
456*3b32dd21SOliver-Rainer Wittmann 
457*3b32dd21SOliver-Rainer Wittmann     // property names
458*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyAdjust;
459*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyAuthor;
460*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyChapterFormat;
461*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyChapterNumberingLevel;
462*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyCharStyleNames;
463*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyCondition;
464*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyContent;
465*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataBaseName;
466*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataBaseURL;
467*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataColumnName;
468*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataCommandType;
469*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDataTableName;
470*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDate;
471*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDateTime;
472*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDateTimeValue;
473*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDDECommandElement;
474*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDDECommandFile;
475*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDDECommandType;
476*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyDependentTextFields;
477*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFalseContent;
478*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFields;
479*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFieldSubType;
480*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFileFormat;
481*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyFullName;
482*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyHint;
483*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyInitials;
484*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyInstanceName;
485*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsAutomaticUpdate;
486*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsConditionTrue;
487*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsDataBaseFormat;
488*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsDate;
489*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsExpression;
490*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsFixed;
491*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsFixedLanguage;
492*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsHidden;
493*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsInput;
494*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsShowFormula;
495*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyIsVisible;
496*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyItems;
497*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyLevel;
498*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyMacro;
499*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyMeasureKind;
500*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyName;
501*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyNumberFormat;
502*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyNumberingSeparator;
503*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyNumberingType;
504*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyOffset;
505*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyOn;
506*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyPlaceholder;
507*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyPlaceholderType;
508*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyReferenceFieldPart;
509*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyReferenceFieldSource;
510*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyReferenceFieldType;
511*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyRevision;
512*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyScriptType;
513*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySelectedItem;
514*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySequenceNumber;
515*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySequenceValue;
516*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySetNumber;
517*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySourceName;
518*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertySubType;
519*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyTargetFrame;
520*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyTrueContent;
521*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyURL;
522*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyURLContent;
523*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyUserText;
524*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyValue;
525*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyVariableName;
526*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sPropertyVariableSubType;
527cdf0e10cSrcweir     const ::rtl::OUString sPropertyHelp;
528cdf0e10cSrcweir     const ::rtl::OUString sPropertyTooltip;
529cdf0e10cSrcweir     const ::rtl::OUString sPropertyTextRange;
530cdf0e10cSrcweir 
531*3b32dd21SOliver-Rainer Wittmann     const ::rtl::OUString sEmpty;
532cdf0e10cSrcweir 
533*3b32dd21SOliver-Rainer Wittmann     XMLPropertyState* pCombinedCharactersPropertyState;
534cdf0e10cSrcweir 
535cdf0e10cSrcweir };
536cdf0e10cSrcweir 
537cdf0e10cSrcweir #endif
538