1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtflde.cxx,v $
10 * $Revision: 1.84.102.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
36 * export of all text fields
38 #include "txtflde.hxx"
39 #include <xmloff/xmlexp.hxx>
40 #include <xmloff/xmlnumfe.hxx>
41 #include <xmloff/xmltoken.hxx>
42 #include <xmloff/xmlement.hxx>
43 #include <xmloff/xmluconv.hxx>
44 #include <xmloff/xmlnume.hxx>
45 #include "numehelp.hxx"
47 #include <xmloff/families.hxx>
48 #include <xmloff/XMLEventExport.hxx>
49 #include "XMLTextCharStyleNamesElementExport.hxx"
50 #include <xmloff/nmspmap.hxx>
51 #include <com/sun/star/util/DateTime.hpp>
52 #include <com/sun/star/util/Date.hpp>
53 #include <com/sun/star/lang/XServiceInfo.hpp>
54 #include <com/sun/star/text/UserDataPart.hpp>
55 #include <com/sun/star/text/PageNumberType.hpp>
56 #include <com/sun/star/style/NumberingType.hpp>
57 #include <com/sun/star/text/ReferenceFieldPart.hpp>
58 #include <com/sun/star/text/ReferenceFieldSource.hpp>
59 #include <com/sun/star/beans/XPropertySet.hpp>
60 #include <com/sun/star/beans/XPropertyState.hpp>
61 #include <com/sun/star/text/XTextField.hpp>
62 #include <com/sun/star/text/XDependentTextField.hpp>
63 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
65 #include <com/sun/star/text/SetVariableType.hpp>
66 #include <com/sun/star/text/PlaceholderType.hpp>
67 #include <com/sun/star/text/FilenameDisplayFormat.hpp>
68 #include <com/sun/star/text/ChapterFormat.hpp>
69 #include <com/sun/star/text/TemplateDisplayFormat.hpp>
70 #include <com/sun/star/frame/XModel.hpp>
71 #include <com/sun/star/container/XNameReplace.hpp>
72 #include <com/sun/star/uno/Sequence.h>
73 #include <com/sun/star/util/NumberFormat.hpp>
74 #include <com/sun/star/text/BibliographyDataType.hpp>
75 #include <com/sun/star/sdb/CommandType.hpp>
76 #include <com/sun/star/rdf/XMetadatable.hpp>
77 #include <rtl/ustrbuf.hxx>
78 #include <tools/debug.hxx>
79 #include <rtl/math.hxx>
83 using ::rtl::OUString
;
84 using ::rtl::OUStringBuffer
;
86 using namespace ::std
;
87 using namespace ::com::sun::star
;
88 using namespace ::com::sun::star::uno
;
89 using namespace ::com::sun::star::text
;
90 using namespace ::com::sun::star::lang
;
91 using namespace ::com::sun::star::beans
;
92 using namespace ::com::sun::star::util
;
93 using namespace ::com::sun::star::style
;
94 using namespace ::com::sun::star::document
;
95 using namespace ::com::sun::star::container
;
96 using namespace ::xmloff::token
;
99 static sal_Char __READONLY_DATA FIELD_SERVICE_SENDER
[] = "ExtendedUser";
100 static sal_Char __READONLY_DATA FIELD_SERVICE_AUTHOR
[] = "Author";
101 static sal_Char __READONLY_DATA FIELD_SERVICE_JUMPEDIT
[] = "JumpEdit";
102 static sal_Char __READONLY_DATA FIELD_SERVICE_GETEXP
[] = "GetExpression";
103 static sal_Char __READONLY_DATA FIELD_SERVICE_SETEXP
[] = "SetExpression";
104 static sal_Char __READONLY_DATA FIELD_SERVICE_USER
[] = "User";
105 static sal_Char __READONLY_DATA FIELD_SERVICE_INPUT
[] = "Input";
106 static sal_Char __READONLY_DATA FIELD_SERVICE_USERINPUT
[] = "InputUser";
107 static sal_Char __READONLY_DATA FIELD_SERVICE_DATETIME
[] = "DateTime";
108 static sal_Char __READONLY_DATA FIELD_SERVICE_PAGENUMBER
[] = "PageNumber";
109 static sal_Char __READONLY_DATA FIELD_SERVICE_DB_NEXT
[] = "DatabaseNextSet";
110 static sal_Char __READONLY_DATA FIELD_SERVICE_DB_SELECT
[] = "DatabaseNumberOfSet";
111 static sal_Char __READONLY_DATA FIELD_SERVICE_DB_NUMBER
[] = "DatabaseSetNumber";
112 static sal_Char __READONLY_DATA FIELD_SERVICE_DB_DISPLAY
[] = "Database";
113 static sal_Char __READONLY_DATA FIELD_SERVICE_DB_NAME
[] = "DatabaseName";
114 static sal_Char __READONLY_DATA FIELD_SERVICE_CONDITIONAL_TEXT
[] = "ConditionalText";
115 static sal_Char __READONLY_DATA FIELD_SERVICE_HIDDEN_TEXT
[] = "HiddenText";
116 static sal_Char __READONLY_DATA FIELD_SERVICE_HIDDEN_PARAGRAPH
[] = "HiddenParagraph";
117 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR
[] = "DocInfo.ChangeAuthor";
118 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2
[] = "docinfo.ChangeAuthor";
119 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME
[] = "DocInfo.ChangeDateTime";
120 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2
[] = "docinfo.ChangeDateTime";
121 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_EDIT_TIME
[] = "DocInfo.EditTime";
122 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_EDIT_TIME2
[] = "docinfo.EditTime";
123 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_DESCRIPTION
[] = "DocInfo.Description";
124 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_DESCRIPTION2
[] = "docinfo.Description";
125 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR
[] = "DocInfo.CreateAuthor";
126 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2
[] = "docinfo.CreateAuthor";
127 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME
[] = "DocInfo.CreateDateTime";
128 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2
[] = "docinfo.CreateDateTime";
129 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CUSTOM
[] = "DocInfo.Custom";
130 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_CUSTOM2
[] = "docinfo.Custom";
131 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR
[] = "DocInfo.PrintAuthor";
132 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2
[] = "docinfo.PrintAuthor";
133 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME
[] = "DocInfo.PrintDateTime";
134 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2
[] = "docinfo.PrintDateTime";
135 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_KEY_WORDS
[] = "DocInfo.KeyWords";
136 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_KEY_WORDS2
[] = "docinfo.KeyWords";
137 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_SUBJECT
[] = "DocInfo.Subject";
138 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_SUBJECT2
[] = "docinfo.Subject";
139 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_TITLE
[] = "DocInfo.Title";
140 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_TITLE2
[] = "docinfo.Title";
141 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_REVISION
[] = "DocInfo.Revision";
142 static sal_Char __READONLY_DATA FIELD_SERVICE_DOC_INFO_REVISION2
[] = "docinfo.Revision";
143 static sal_Char __READONLY_DATA FIELD_SERVICE_FILE_NAME
[] = "FileName";
144 static sal_Char __READONLY_DATA FIELD_SERVICE_CHAPTER
[] = "Chapter";
145 static sal_Char __READONLY_DATA FIELD_SERVICE_TEMPLATE_NAME
[] = "TemplateName";
146 static sal_Char __READONLY_DATA FIELD_SERVICE_PAGE_COUNT
[] = "PageCount";
147 static sal_Char __READONLY_DATA FIELD_SERVICE_PARAGRAPH_COUNT
[] = "ParagraphCount";
148 static sal_Char __READONLY_DATA FIELD_SERVICE_WORD_COUNT
[] = "WordCount";
149 static sal_Char __READONLY_DATA FIELD_SERVICE_CHARACTER_COUNT
[] = "CharacterCount";
150 static sal_Char __READONLY_DATA FIELD_SERVICE_TABLE_COUNT
[] = "TableCount";
151 static sal_Char __READONLY_DATA FIELD_SERVICE_GRAPHIC_COUNT
[] = "GraphicObjectCount";
152 static sal_Char __READONLY_DATA FIELD_SERVICE_OBJECT_COUNT
[] = "EmbeddedObjectCount";
153 static sal_Char __READONLY_DATA FIELD_SERVICE_REFERENCE_PAGE_SET
[] = "ReferencePageSet";
154 static sal_Char __READONLY_DATA FIELD_SERVICE_REFERENCE_PAGE_GET
[] = "ReferencePageGet";
155 static sal_Char __READONLY_DATA FIELD_SERVICE_SHEET_NAME
[] = "SheetName";
156 static sal_Char __READONLY_DATA FIELD_SERVICE_MACRO
[] = "Macro";
157 static sal_Char __READONLY_DATA FIELD_SERVICE_GET_REFERENCE
[] = "GetReference";
158 static sal_Char __READONLY_DATA FIELD_SERVICE_DDE
[] = "DDE";
159 static sal_Char __READONLY_DATA FIELD_SERVICE_URL
[] = "URL";
160 static sal_Char __READONLY_DATA FIELD_SERVICE_BIBLIOGRAPHY
[] = "Bibliography";
161 static sal_Char __READONLY_DATA FIELD_SERVICE_SCRIPT
[] = "Script";
162 static sal_Char __READONLY_DATA FIELD_SERVICE_ANNOTATION
[] = "Annotation";
163 static sal_Char __READONLY_DATA FIELD_SERVICE_COMBINED_CHARACTERS
[] = "CombinedCharacters";
164 static sal_Char __READONLY_DATA FIELD_SERVICE_META
[] = "MetadataField";
165 static sal_Char __READONLY_DATA FIELD_SERVICE_MEASURE
[] = "Measure";
166 static sal_Char __READONLY_DATA FIELD_SERVICE_TABLE_FORMULA
[] = "TableFormula";
167 static sal_Char __READONLY_DATA FIELD_SERVICE_DROP_DOWN
[] = "DropDown";
169 SvXMLEnumStringMapEntry __READONLY_DATA aFieldServiceNameMapping
[] =
171 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SENDER
, FIELD_ID_SENDER
),
172 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_AUTHOR
, FIELD_ID_AUTHOR
),
173 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_JUMPEDIT
, FIELD_ID_PLACEHOLDER
),
174 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GETEXP
, FIELD_ID_VARIABLE_GET
),
175 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SETEXP
, FIELD_ID_VARIABLE_SET
),
176 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USER
, FIELD_ID_USER_GET
),
177 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_INPUT
, FIELD_ID_TEXT_INPUT
),
178 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USERINPUT
, FIELD_ID_USER_INPUT
),
179 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DATETIME
, FIELD_ID_TIME
),
180 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGENUMBER
, FIELD_ID_PAGENUMBER
),
181 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_SET
, FIELD_ID_REFPAGE_SET
),
182 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_GET
, FIELD_ID_REFPAGE_GET
),
184 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NEXT
, FIELD_ID_DATABASE_NEXT
),
185 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_SELECT
, FIELD_ID_DATABASE_SELECT
),
186 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NUMBER
, FIELD_ID_DATABASE_NUMBER
),
187 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_DISPLAY
, FIELD_ID_DATABASE_DISPLAY
),
188 // workaround for #no-bug#: Database/DataBase
189 ENUM_STRING_MAP_ENTRY( "DataBase", FIELD_ID_DATABASE_DISPLAY
),
190 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NAME
, FIELD_ID_DATABASE_NAME
),
192 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR
, FIELD_ID_DOCINFO_CREATION_AUTHOR
),
193 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2
, FIELD_ID_DOCINFO_CREATION_AUTHOR
),
194 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME
, FIELD_ID_DOCINFO_CREATION_TIME
),
195 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2
, FIELD_ID_DOCINFO_CREATION_TIME
),
196 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR
, FIELD_ID_DOCINFO_SAVE_AUTHOR
),
197 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2
, FIELD_ID_DOCINFO_SAVE_AUTHOR
),
198 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME
, FIELD_ID_DOCINFO_SAVE_TIME
),
199 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2
, FIELD_ID_DOCINFO_SAVE_TIME
),
200 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME
, FIELD_ID_DOCINFO_EDIT_DURATION
),
201 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME2
, FIELD_ID_DOCINFO_EDIT_DURATION
),
202 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION
, FIELD_ID_DOCINFO_DESCRIPTION
),
203 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION2
, FIELD_ID_DOCINFO_DESCRIPTION
),
204 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM
, FIELD_ID_DOCINFO_CUSTOM
),
205 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM2
, FIELD_ID_DOCINFO_CUSTOM
),
206 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR
, FIELD_ID_DOCINFO_PRINT_AUTHOR
),
207 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2
, FIELD_ID_DOCINFO_PRINT_AUTHOR
),
208 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME
, FIELD_ID_DOCINFO_PRINT_TIME
),
209 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2
, FIELD_ID_DOCINFO_PRINT_TIME
),
210 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS
, FIELD_ID_DOCINFO_KEYWORDS
),
211 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS2
, FIELD_ID_DOCINFO_KEYWORDS
),
212 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT
, FIELD_ID_DOCINFO_SUBJECT
),
213 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT2
, FIELD_ID_DOCINFO_SUBJECT
),
214 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE
, FIELD_ID_DOCINFO_TITLE
),
215 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE2
, FIELD_ID_DOCINFO_TITLE
),
216 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION
, FIELD_ID_DOCINFO_REVISION
),
217 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION2
, FIELD_ID_DOCINFO_REVISION
),
219 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CONDITIONAL_TEXT
, FIELD_ID_CONDITIONAL_TEXT
),
220 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_TEXT
, FIELD_ID_HIDDEN_TEXT
),
221 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_PARAGRAPH
, FIELD_ID_HIDDEN_PARAGRAPH
),
223 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_FILE_NAME
, FIELD_ID_FILE_NAME
),
224 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHAPTER
, FIELD_ID_CHAPTER
),
225 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TEMPLATE_NAME
, FIELD_ID_TEMPLATE_NAME
),
227 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGE_COUNT
, FIELD_ID_COUNT_PAGES
),
228 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PARAGRAPH_COUNT
, FIELD_ID_COUNT_PARAGRAPHS
),
229 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_WORD_COUNT
, FIELD_ID_COUNT_WORDS
),
230 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHARACTER_COUNT
, FIELD_ID_COUNT_CHARACTERS
),
231 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_COUNT
, FIELD_ID_COUNT_TABLES
),
232 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GRAPHIC_COUNT
, FIELD_ID_COUNT_GRAPHICS
),
233 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_OBJECT_COUNT
, FIELD_ID_COUNT_OBJECTS
),
235 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MACRO
, FIELD_ID_MACRO
),
236 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GET_REFERENCE
, FIELD_ID_REF_REFERENCE
),
237 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DDE
, FIELD_ID_DDE
),
239 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_BIBLIOGRAPHY
, FIELD_ID_BIBLIOGRAPHY
),
241 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SCRIPT
, FIELD_ID_SCRIPT
),
242 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_ANNOTATION
, FIELD_ID_ANNOTATION
),
244 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_COMBINED_CHARACTERS
, FIELD_ID_COMBINED_CHARACTERS
),
245 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_META
, FIELD_ID_META
),
248 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SHEET_NAME
, FIELD_ID_SHEET_NAME
),
249 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_URL
, FIELD_ID_URL
),
250 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MEASURE
, FIELD_ID_MEASURE
),
253 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_FORMULA
, FIELD_ID_TABLE_FORMULA
),
254 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DROP_DOWN
, FIELD_ID_DROP_DOWN
),
256 ENUM_STRING_MAP_END()
261 // property accessor helper functions
262 inline sal_Bool
GetBoolProperty(const OUString
&,
263 const Reference
<XPropertySet
> &);
264 inline sal_Bool
GetOptionalBoolProperty(const OUString
&,
265 const Reference
<XPropertySet
> &,
266 const Reference
<XPropertySetInfo
> &,
268 inline double GetDoubleProperty(const OUString
&,
269 const Reference
<XPropertySet
> &);
270 inline OUString
const GetStringProperty(const OUString
&,
271 const Reference
<XPropertySet
> &);
272 inline sal_Int32
GetIntProperty(const OUString
&,
273 const Reference
<XPropertySet
> &);
274 inline sal_Int16
GetInt16Property(const OUString
&,
275 const Reference
<XPropertySet
> &);
276 inline sal_Int8
GetInt8Property(const OUString
&,
277 const Reference
<XPropertySet
> &);
278 inline DateTime
const GetDateTimeProperty( const OUString
& sPropName
,
279 const Reference
<XPropertySet
> & xPropSet
);
280 inline Date
const GetDateProperty( const OUString
& sPropName
,
281 const Reference
<XPropertySet
> & xPropSet
);
282 inline Sequence
<OUString
> const GetStringSequenceProperty(
283 const OUString
& sPropName
,
284 const Reference
<XPropertySet
> & xPropSet
);
288 XMLTextFieldExport::XMLTextFieldExport( SvXMLExport
& rExp
,
289 XMLPropertyState
* pCombinedCharState
)
292 sServicePrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.")),
293 sFieldMasterPrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.FieldMaster.")),
294 sPresentationServicePrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TextField.")),
296 sPropertyAdjust(RTL_CONSTASCII_USTRINGPARAM("Adjust")),
297 sPropertyAuthor(RTL_CONSTASCII_USTRINGPARAM("Author")),
298 sPropertyChapterFormat(RTL_CONSTASCII_USTRINGPARAM("ChapterFormat")),
299 sPropertyChapterNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("ChapterNumberingLevel")),
300 sPropertyCharStyleNames(RTL_CONSTASCII_USTRINGPARAM("CharStyleNames")),
301 sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM("Condition")),
302 sPropertyContent(RTL_CONSTASCII_USTRINGPARAM("Content")),
303 sPropertyDataBaseName(RTL_CONSTASCII_USTRINGPARAM("DataBaseName")),
304 sPropertyDataBaseURL(RTL_CONSTASCII_USTRINGPARAM("DataBaseURL")),
305 sPropertyDataColumnName(RTL_CONSTASCII_USTRINGPARAM("DataColumnName")),
306 sPropertyDataCommandType(RTL_CONSTASCII_USTRINGPARAM("DataCommandType")),
307 sPropertyDataTableName(RTL_CONSTASCII_USTRINGPARAM("DataTableName")),
308 sPropertyDate(RTL_CONSTASCII_USTRINGPARAM("Date")),
309 sPropertyDateTime(RTL_CONSTASCII_USTRINGPARAM("DateTime")),
310 sPropertyDateTimeValue(RTL_CONSTASCII_USTRINGPARAM("DateTimeValue")),
311 sPropertyDDECommandElement(RTL_CONSTASCII_USTRINGPARAM("DDECommandElement")),
312 sPropertyDDECommandFile(RTL_CONSTASCII_USTRINGPARAM("DDECommandFile")),
313 sPropertyDDECommandType(RTL_CONSTASCII_USTRINGPARAM("DDECommandType")),
314 sPropertyDependentTextFields(RTL_CONSTASCII_USTRINGPARAM("DependentTextFields")),
315 sPropertyFalseContent(RTL_CONSTASCII_USTRINGPARAM("FalseContent")),
316 sPropertyFields(RTL_CONSTASCII_USTRINGPARAM("Fields")),
317 sPropertyFieldSubType(RTL_CONSTASCII_USTRINGPARAM("UserDataType")),
318 sPropertyFileFormat(RTL_CONSTASCII_USTRINGPARAM("FileFormat")),
319 sPropertyFullName(RTL_CONSTASCII_USTRINGPARAM("FullName")),
320 sPropertyHint(RTL_CONSTASCII_USTRINGPARAM("Hint")),
321 sPropertyInstanceName(RTL_CONSTASCII_USTRINGPARAM("InstanceName")),
322 sPropertyIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticUpdate")),
323 sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM("IsConditionTrue")),
324 sPropertyIsDataBaseFormat(RTL_CONSTASCII_USTRINGPARAM("DataBaseFormat")),
325 sPropertyIsDate(RTL_CONSTASCII_USTRINGPARAM("IsDate")),
326 sPropertyIsExpression(RTL_CONSTASCII_USTRINGPARAM("IsExpression")),
327 sPropertyIsFixed(RTL_CONSTASCII_USTRINGPARAM("IsFixed")),
328 sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM("IsFixedLanguage")),
329 sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM("IsHidden")),
330 sPropertyIsInput(RTL_CONSTASCII_USTRINGPARAM("Input")),
331 sPropertyIsShowFormula(RTL_CONSTASCII_USTRINGPARAM("IsShowFormula")),
332 sPropertyIsVisible(RTL_CONSTASCII_USTRINGPARAM("IsVisible")),
333 sPropertyItems(RTL_CONSTASCII_USTRINGPARAM("Items")),
334 sPropertyLevel(RTL_CONSTASCII_USTRINGPARAM("Level")),
335 sPropertyMacro(RTL_CONSTASCII_USTRINGPARAM("Macro")),
336 sPropertyMeasureKind(RTL_CONSTASCII_USTRINGPARAM("Kind")),
337 sPropertyName(RTL_CONSTASCII_USTRINGPARAM("Name")),
338 sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
339 sPropertyNumberingSeparator(RTL_CONSTASCII_USTRINGPARAM("NumberingSeparator")),
340 sPropertyNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType")),
341 sPropertyOffset(RTL_CONSTASCII_USTRINGPARAM("Offset")),
342 sPropertyOn(RTL_CONSTASCII_USTRINGPARAM("On")),
343 sPropertyPlaceholder(RTL_CONSTASCII_USTRINGPARAM("PlaceHolder")),
344 sPropertyPlaceholderType(RTL_CONSTASCII_USTRINGPARAM("PlaceHolderType")),
345 sPropertyReferenceFieldPart(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldPart")),
346 sPropertyReferenceFieldSource(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldSource")),
347 sPropertyReferenceFieldType(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldType")),
348 sPropertyRevision(RTL_CONSTASCII_USTRINGPARAM("Revision")),
349 sPropertyScriptType(RTL_CONSTASCII_USTRINGPARAM("ScriptType")),
350 sPropertySelectedItem(RTL_CONSTASCII_USTRINGPARAM("SelectedItem")),
351 sPropertySequenceNumber(RTL_CONSTASCII_USTRINGPARAM("SequenceNumber")),
352 sPropertySequenceValue(RTL_CONSTASCII_USTRINGPARAM("SequenceValue")),
353 sPropertySetNumber(RTL_CONSTASCII_USTRINGPARAM("SetNumber")),
354 sPropertySourceName(RTL_CONSTASCII_USTRINGPARAM("SourceName")),
355 sPropertySubType(RTL_CONSTASCII_USTRINGPARAM("SubType")),
356 sPropertyTargetFrame(RTL_CONSTASCII_USTRINGPARAM("TargetFrame")),
357 sPropertyTrueContent(RTL_CONSTASCII_USTRINGPARAM("TrueContent")),
358 sPropertyURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
359 sPropertyURLContent(RTL_CONSTASCII_USTRINGPARAM("URLContent")),
360 sPropertyUserText(RTL_CONSTASCII_USTRINGPARAM("UserText")),
361 sPropertyValue(RTL_CONSTASCII_USTRINGPARAM("Value")),
362 sPropertyVariableName(RTL_CONSTASCII_USTRINGPARAM("VariableName")),
363 sPropertyVariableSubType(RTL_CONSTASCII_USTRINGPARAM("VariableSubtype")),
364 sPropertyHelp(RTL_CONSTASCII_USTRINGPARAM("Help")),
365 sPropertyTooltip(RTL_CONSTASCII_USTRINGPARAM("Tooltip")),
366 sPropertyTextRange(RTL_CONSTASCII_USTRINGPARAM("TextRange")),
367 pCombinedCharactersPropertyState(pCombinedCharState
)
369 SetExportOnlyUsedFieldDeclarations();
372 XMLTextFieldExport::~XMLTextFieldExport()
374 delete pCombinedCharactersPropertyState
;
378 /// get the field ID (as in FieldIDEnum) from XTextField
379 enum FieldIdEnum
XMLTextFieldExport::GetFieldID(
380 const Reference
<XTextField
> & rTextField
,
381 const Reference
<XPropertySet
> & xPropSet
)
383 // get service names for rTextField (via XServiceInfo service)
384 Reference
<XServiceInfo
> xService(rTextField
, UNO_QUERY
);
385 const Sequence
<OUString
> aServices
= xService
->getSupportedServiceNames();
386 const OUString
* pNames
= aServices
.getConstArray();
387 sal_Int32 nCount
= aServices
.getLength();
389 OUString sFieldName
; // service name postfix of current field
391 // search for TextField service name
394 if (pNames
->matchIgnoreAsciiCase(sServicePrefix
))
396 // TextField found => postfix is field type!
397 sFieldName
= pNames
->copy(sServicePrefix
.getLength());
404 // if this is not a normal text field, check if its a presentation text field
405 if( sFieldName
.getLength() == 0 )
407 const OUString
* pNames2
= aServices
.getConstArray();
408 sal_Int32 nCount2
= aServices
.getLength();
409 // search for TextField service name
412 if( 0 == pNames2
->compareTo(sPresentationServicePrefix
, sPresentationServicePrefix
.getLength()))
414 // TextField found => postfix is field type!
415 sFieldName
= pNames2
->copy(sPresentationServicePrefix
.getLength());
422 if( sFieldName
.getLength() != 0 )
424 if( sFieldName
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "Header" ) ) == 0 )
426 return FIELD_ID_DRAW_HEADER
;
428 else if( sFieldName
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "Footer" ) ) == 0 )
430 return FIELD_ID_DRAW_FOOTER
;
432 else if( sFieldName
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateTime" ) ) == 0 )
434 return FIELD_ID_DRAW_DATE_TIME
;
439 // map postfix of service name to field ID
440 DBG_ASSERT(sFieldName
.getLength()>0, "no TextField service found!");
441 return MapFieldName(sFieldName
, xPropSet
);
444 enum FieldIdEnum
XMLTextFieldExport::MapFieldName(
445 const OUString
& sFieldName
, // field (master) name
446 const Reference
<XPropertySet
> & xPropSet
) // for subtype
448 // we'll proceed in 2 steps:
449 // a) map service name to preliminary FIELD_ID
450 // b) map those prelim. FIELD_IDs that correspond to several field types
451 // (in our (XML) world) to final FIELD IDs
454 // a) find prelim. FIELD_ID via aFieldServiceMapping
456 // check for non-empty service name
457 DBG_ASSERT(sFieldName
.getLength()>0, "no valid service name!");
458 enum FieldIdEnum nToken
= FIELD_ID_UNKNOWN
;
459 if (sFieldName
.getLength() > 0)
461 // map name to prelim. ID
463 sal_Bool bRet
= GetExport().GetMM100UnitConverter().convertEnum(
464 nTmp
, sFieldName
, aFieldServiceNameMapping
);
467 DBG_ASSERT(bRet
, "Unknown field service name encountered!");
470 nToken
= FIELD_ID_UNKNOWN
;
474 nToken
= (enum FieldIdEnum
)nTmp
;
477 // invalid service name
478 nToken
= FIELD_ID_UNKNOWN
;
481 // b) map prelim. to final FIELD_IDs
483 case FIELD_ID_VARIABLE_SET
:
484 if (GetBoolProperty(sPropertyIsInput
, xPropSet
))
486 nToken
= FIELD_ID_VARIABLE_INPUT
;
490 switch (GetIntProperty(sPropertySubType
, xPropSet
))
492 case SetVariableType::STRING
: // text field
493 case SetVariableType::VAR
: // num field
494 nToken
= FIELD_ID_VARIABLE_SET
;
496 case SetVariableType::SEQUENCE
:
497 nToken
= FIELD_ID_SEQUENCE
;
499 case SetVariableType::FORMULA
:
501 nToken
= FIELD_ID_UNKNOWN
;
507 case FIELD_ID_VARIABLE_GET
:
508 switch (GetIntProperty(sPropertySubType
, xPropSet
))
510 case SetVariableType::STRING
: // text field
511 case SetVariableType::VAR
: // num field
512 nToken
= FIELD_ID_VARIABLE_GET
;
514 case SetVariableType::FORMULA
:
515 nToken
= FIELD_ID_EXPRESSION
;
517 case SetVariableType::SEQUENCE
:
519 nToken
= FIELD_ID_UNKNOWN
;
525 if (GetBoolProperty(sPropertyIsDate
, xPropSet
))
527 nToken
= FIELD_ID_DATE
;
531 case FIELD_ID_PAGENUMBER
:
532 // NumberingType not available in non-Writer apps
533 if (xPropSet
->getPropertySetInfo()->
534 hasPropertyByName(sPropertyNumberingType
))
536 if (NumberingType::CHAR_SPECIAL
== GetIntProperty(
537 sPropertyNumberingType
, xPropSet
))
539 nToken
= FIELD_ID_PAGESTRING
;
544 case FIELD_ID_DOCINFO_CREATION_TIME
:
545 if (GetBoolProperty(sPropertyIsDate
, xPropSet
))
547 nToken
= FIELD_ID_DOCINFO_CREATION_DATE
;
551 case FIELD_ID_DOCINFO_PRINT_TIME
:
552 if (GetBoolProperty(sPropertyIsDate
, xPropSet
))
554 nToken
= FIELD_ID_DOCINFO_PRINT_DATE
;
558 case FIELD_ID_DOCINFO_SAVE_TIME
:
559 if (GetBoolProperty(sPropertyIsDate
, xPropSet
))
561 nToken
= FIELD_ID_DOCINFO_SAVE_DATE
;
565 case FIELD_ID_REF_REFERENCE
:
566 switch (GetInt16Property(sPropertyReferenceFieldSource
, xPropSet
))
568 case ReferenceFieldSource::REFERENCE_MARK
:
569 nToken
= FIELD_ID_REF_REFERENCE
;
571 case ReferenceFieldSource::SEQUENCE_FIELD
:
572 nToken
= FIELD_ID_REF_SEQUENCE
;
574 case ReferenceFieldSource::BOOKMARK
:
575 nToken
= FIELD_ID_REF_BOOKMARK
;
577 case ReferenceFieldSource::FOOTNOTE
:
578 nToken
= FIELD_ID_REF_FOOTNOTE
;
580 case ReferenceFieldSource::ENDNOTE
:
581 nToken
= FIELD_ID_REF_ENDNOTE
;
584 nToken
= FIELD_ID_UNKNOWN
;
589 case FIELD_ID_COMBINED_CHARACTERS
:
590 case FIELD_ID_SCRIPT
:
591 case FIELD_ID_ANNOTATION
:
592 case FIELD_ID_BIBLIOGRAPHY
:
595 case FIELD_ID_REFPAGE_SET
:
596 case FIELD_ID_REFPAGE_GET
:
597 case FIELD_ID_COUNT_PAGES
:
598 case FIELD_ID_COUNT_PARAGRAPHS
:
599 case FIELD_ID_COUNT_WORDS
:
600 case FIELD_ID_COUNT_CHARACTERS
:
601 case FIELD_ID_COUNT_TABLES
:
602 case FIELD_ID_COUNT_GRAPHICS
:
603 case FIELD_ID_COUNT_OBJECTS
:
604 case FIELD_ID_CONDITIONAL_TEXT
:
605 case FIELD_ID_HIDDEN_TEXT
:
606 case FIELD_ID_HIDDEN_PARAGRAPH
:
607 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
608 case FIELD_ID_DOCINFO_DESCRIPTION
:
609 case FIELD_ID_DOCINFO_CUSTOM
:
610 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
611 case FIELD_ID_DOCINFO_TITLE
:
612 case FIELD_ID_DOCINFO_SUBJECT
:
613 case FIELD_ID_DOCINFO_KEYWORDS
:
614 case FIELD_ID_DOCINFO_REVISION
:
615 case FIELD_ID_DOCINFO_EDIT_DURATION
:
616 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
617 case FIELD_ID_TEXT_INPUT
:
618 case FIELD_ID_USER_INPUT
:
619 case FIELD_ID_AUTHOR
:
620 case FIELD_ID_SENDER
:
621 case FIELD_ID_PLACEHOLDER
:
622 case FIELD_ID_USER_GET
:
623 case FIELD_ID_DATABASE_NEXT
:
624 case FIELD_ID_DATABASE_SELECT
:
625 case FIELD_ID_DATABASE_DISPLAY
:
626 case FIELD_ID_DATABASE_NAME
:
627 case FIELD_ID_DATABASE_NUMBER
:
628 case FIELD_ID_TEMPLATE_NAME
:
629 case FIELD_ID_CHAPTER
:
630 case FIELD_ID_FILE_NAME
:
632 case FIELD_ID_SHEET_NAME
:
633 case FIELD_ID_MEASURE
:
635 case FIELD_ID_TABLE_FORMULA
:
636 case FIELD_ID_DROP_DOWN
:
637 ; // these field IDs are final
641 nToken
= FIELD_ID_UNKNOWN
;
644 // ... and return final FIELD_ID
648 // is string or numeric field?
649 sal_Bool
XMLTextFieldExport::IsStringField(
650 FieldIdEnum nFieldType
,
651 const Reference
<XPropertySet
> & xPropSet
)
653 switch (nFieldType
) {
655 case FIELD_ID_VARIABLE_GET
:
656 case FIELD_ID_VARIABLE_SET
:
657 case FIELD_ID_VARIABLE_INPUT
:
659 // depends on field sub type
660 return ( GetIntProperty(sPropertySubType
, xPropSet
) ==
661 SetVariableType::STRING
);
664 case FIELD_ID_USER_GET
:
665 case FIELD_ID_USER_INPUT
:
667 Reference
<XTextField
> xTextField(xPropSet
, UNO_QUERY
);
668 DBG_ASSERT(xTextField
.is(), "field is no XTextField!");
669 sal_Bool bRet
= GetBoolProperty(sPropertyIsExpression
,
670 GetMasterPropertySet(xTextField
));
675 return 0 > GetIntProperty(sPropertyNumberFormat
, xPropSet
);
677 case FIELD_ID_DATABASE_DISPLAY
:
678 // TODO: depends on... ???
679 // workaround #no-bug#: no data type
680 return 5100 == GetIntProperty(sPropertyNumberFormat
, xPropSet
);
682 case FIELD_ID_TABLE_FORMULA
:
683 // legacy field: always a number field (because it always has
687 case FIELD_ID_COUNT_PAGES
:
688 case FIELD_ID_COUNT_PARAGRAPHS
:
689 case FIELD_ID_COUNT_WORDS
:
690 case FIELD_ID_COUNT_CHARACTERS
:
691 case FIELD_ID_COUNT_TABLES
:
692 case FIELD_ID_COUNT_GRAPHICS
:
693 case FIELD_ID_COUNT_OBJECTS
:
694 case FIELD_ID_DOCINFO_SAVE_TIME
:
695 case FIELD_ID_DOCINFO_SAVE_DATE
:
696 case FIELD_ID_DOCINFO_CREATION_DATE
:
697 case FIELD_ID_DOCINFO_CREATION_TIME
:
698 case FIELD_ID_DOCINFO_PRINT_TIME
:
699 case FIELD_ID_DOCINFO_PRINT_DATE
:
700 case FIELD_ID_DOCINFO_EDIT_DURATION
:
701 case FIELD_ID_DOCINFO_REVISION
:
702 case FIELD_ID_DATABASE_NUMBER
:
703 case FIELD_ID_EXPRESSION
:
704 case FIELD_ID_SEQUENCE
:
707 case FIELD_ID_PAGENUMBER
:
708 case FIELD_ID_REFPAGE_SET
:
709 case FIELD_ID_REFPAGE_GET
:
713 case FIELD_ID_COMBINED_CHARACTERS
:
714 case FIELD_ID_BIBLIOGRAPHY
:
716 case FIELD_ID_REF_REFERENCE
:
717 case FIELD_ID_REF_SEQUENCE
:
718 case FIELD_ID_REF_BOOKMARK
:
719 case FIELD_ID_REF_FOOTNOTE
:
720 case FIELD_ID_REF_ENDNOTE
:
722 case FIELD_ID_TEMPLATE_NAME
:
723 case FIELD_ID_CHAPTER
:
724 case FIELD_ID_FILE_NAME
:
725 case FIELD_ID_CONDITIONAL_TEXT
:
726 case FIELD_ID_HIDDEN_TEXT
:
727 case FIELD_ID_HIDDEN_PARAGRAPH
:
728 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
729 case FIELD_ID_DOCINFO_DESCRIPTION
:
730 case FIELD_ID_DOCINFO_CUSTOM
:
731 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
732 case FIELD_ID_DOCINFO_TITLE
:
733 case FIELD_ID_DOCINFO_SUBJECT
:
734 case FIELD_ID_DOCINFO_KEYWORDS
:
735 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
736 case FIELD_ID_DATABASE_NAME
:
737 case FIELD_ID_TEXT_INPUT
:
738 case FIELD_ID_SENDER
:
739 case FIELD_ID_AUTHOR
:
740 case FIELD_ID_PAGESTRING
:
741 case FIELD_ID_SHEET_NAME
:
742 case FIELD_ID_MEASURE
:
744 case FIELD_ID_DROP_DOWN
:
748 case FIELD_ID_SCRIPT
:
749 case FIELD_ID_ANNOTATION
:
750 case FIELD_ID_DATABASE_NEXT
:
751 case FIELD_ID_DATABASE_SELECT
:
752 case FIELD_ID_VARIABLE_DECL
:
753 case FIELD_ID_USER_DECL
:
754 case FIELD_ID_SEQUENCE_DECL
:
755 case FIELD_ID_PLACEHOLDER
:
756 case FIELD_ID_UNKNOWN
:
757 case FIELD_ID_DRAW_HEADER
:
758 case FIELD_ID_DRAW_FOOTER
:
759 case FIELD_ID_DRAW_DATE_TIME
:
761 DBG_ERROR("unkown field type/field has no content");
762 return sal_True
; // invalid info; string in case of doubt
766 /// export the styles needed by the given field. Called on first pass
768 void XMLTextFieldExport::ExportFieldAutoStyle(
769 const Reference
<XTextField
> & rTextField
, const sal_Bool bProgress
,
770 const sal_Bool bRecursive
)
773 Reference
<XPropertySet
> xPropSet(rTextField
, UNO_QUERY
);
775 // add field master to list of used field masters (if desired)
776 if (NULL
!= pUsedMasters
)
778 Reference
<XDependentTextField
> xDepField(rTextField
, UNO_QUERY
);
781 Reference
<XText
> xOurText
= rTextField
->getAnchor()->getText();
783 map
<Reference
<XText
>, set
<OUString
> >::iterator aMapIter
=
784 pUsedMasters
->find(xOurText
);
786 // insert a list for our XText (if necessary)
787 if (aMapIter
== pUsedMasters
->end())
790 (*pUsedMasters
)[xOurText
] = aSet
;
791 aMapIter
= pUsedMasters
->find(xOurText
);
794 // insert this text field master
795 OUString sFieldMasterName
= GetStringProperty(
796 sPropertyInstanceName
, xDepField
->getTextFieldMaster());
797 if (sFieldMasterName
.getLength() > 0)
798 aMapIter
->second
.insert( sFieldMasterName
);
800 // else: no dependent field -> no master -> ignore
804 FieldIdEnum nToken
= GetFieldID(rTextField
, xPropSet
);
806 // export the character style for all fields
807 // with one exception: combined character fields export their own
809 Reference
<XPropertySet
> xRangePropSet(rTextField
->getAnchor(), UNO_QUERY
);
810 if (FIELD_ID_COMBINED_CHARACTERS
!= nToken
)
812 GetExport().GetTextParagraphExport()->Add(
813 XML_STYLE_FAMILY_TEXT_TEXT
, xRangePropSet
);
816 // process special styles for each field (e.g. data styles)
819 case FIELD_ID_DATABASE_DISPLAY
:
821 sal_Int32 nFormat
= GetIntProperty(sPropertyNumberFormat
, xPropSet
);
822 // workaround: #no-bug#; see IsStringField(...)
823 if ( (5100 != nFormat
) &&
824 !GetBoolProperty(sPropertyIsDataBaseFormat
, xPropSet
) )
826 GetExport().addDataStyle(nFormat
);
834 // date and time fields are always number fields, but the
835 // NumberFormat property is optional (e.g. Calc doesn't
837 Reference
<XPropertySetInfo
> xPropSetInfo(
838 xPropSet
->getPropertySetInfo() );
839 if ( xPropSetInfo
->hasPropertyByName( sPropertyNumberFormat
) )
842 GetIntProperty(sPropertyNumberFormat
, xPropSet
);
844 // nFormat may be -1 for numeric fields that display their
845 // variable name. (Maybe this should be a field type, then?)
848 if( ! GetOptionalBoolProperty(
849 sPropertyIsFixedLanguage
,
850 xPropSet
, xPropSetInfo
, sal_False
) )
853 GetExport().dataStyleForceSystemLanguage(nFormat
);
856 GetExport().addDataStyle( nFormat
,
857 nToken
== FIELD_ID_TIME
);
864 // recurse into content (does not export element, so can be done first)
867 ExportMetaField(xPropSet
, true, bProgress
);
869 // fall-through: for the meta-field itself!
870 case FIELD_ID_DOCINFO_PRINT_TIME
:
871 case FIELD_ID_DOCINFO_PRINT_DATE
:
872 case FIELD_ID_DOCINFO_CREATION_DATE
:
873 case FIELD_ID_DOCINFO_CREATION_TIME
:
874 case FIELD_ID_DOCINFO_SAVE_TIME
:
875 case FIELD_ID_DOCINFO_SAVE_DATE
:
876 case FIELD_ID_DOCINFO_EDIT_DURATION
:
877 case FIELD_ID_VARIABLE_SET
:
878 case FIELD_ID_VARIABLE_GET
:
879 case FIELD_ID_VARIABLE_INPUT
:
880 case FIELD_ID_USER_GET
:
881 case FIELD_ID_EXPRESSION
:
882 case FIELD_ID_TABLE_FORMULA
:
883 // register number format, if this is a numeric field
884 if (! IsStringField(nToken
, xPropSet
)) {
887 GetIntProperty(sPropertyNumberFormat
, xPropSet
);
889 // nFormat may be -1 for numeric fields that display their
890 // variable name. (Maybe this should be a field type, then?)
893 // handle formats for fixed language fields
894 // for all these fields (except table formula)
895 if( ( nToken
!= FIELD_ID_TABLE_FORMULA
) &&
896 ! GetOptionalBoolProperty(
897 sPropertyIsFixedLanguage
,
898 xPropSet
, xPropSet
->getPropertySetInfo(),
902 GetExport().dataStyleForceSystemLanguage(nFormat
);
905 GetExport().addDataStyle(nFormat
);
910 case FIELD_ID_COMBINED_CHARACTERS
:
912 // export text style with the addition of the combined characters
913 DBG_ASSERT(NULL
!= pCombinedCharactersPropertyState
,
914 "need proper PropertyState for combined characters");
915 const XMLPropertyState
*aStates
[] = { pCombinedCharactersPropertyState
, 0 };
916 GetExport().GetTextParagraphExport()->Add(
917 XML_STYLE_FAMILY_TEXT_TEXT
, xRangePropSet
,
922 case FIELD_ID_SCRIPT
:
923 case FIELD_ID_ANNOTATION
:
924 case FIELD_ID_BIBLIOGRAPHY
:
926 case FIELD_ID_REF_REFERENCE
:
927 case FIELD_ID_REF_SEQUENCE
:
928 case FIELD_ID_REF_BOOKMARK
:
929 case FIELD_ID_REF_FOOTNOTE
:
930 case FIELD_ID_REF_ENDNOTE
:
932 case FIELD_ID_REFPAGE_SET
:
933 case FIELD_ID_REFPAGE_GET
:
934 case FIELD_ID_COUNT_PAGES
:
935 case FIELD_ID_COUNT_PARAGRAPHS
:
936 case FIELD_ID_COUNT_WORDS
:
937 case FIELD_ID_COUNT_CHARACTERS
:
938 case FIELD_ID_COUNT_TABLES
:
939 case FIELD_ID_COUNT_GRAPHICS
:
940 case FIELD_ID_COUNT_OBJECTS
:
941 case FIELD_ID_CONDITIONAL_TEXT
:
942 case FIELD_ID_HIDDEN_TEXT
:
943 case FIELD_ID_HIDDEN_PARAGRAPH
:
944 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
945 case FIELD_ID_DOCINFO_DESCRIPTION
:
946 case FIELD_ID_DOCINFO_CUSTOM
:
947 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
948 case FIELD_ID_DOCINFO_TITLE
:
949 case FIELD_ID_DOCINFO_SUBJECT
:
950 case FIELD_ID_DOCINFO_KEYWORDS
:
951 case FIELD_ID_DOCINFO_REVISION
:
952 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
953 case FIELD_ID_SEQUENCE
:
954 case FIELD_ID_PAGENUMBER
:
955 case FIELD_ID_PAGESTRING
:
956 case FIELD_ID_AUTHOR
:
957 case FIELD_ID_SENDER
:
958 case FIELD_ID_PLACEHOLDER
:
959 case FIELD_ID_USER_INPUT
:
960 case FIELD_ID_TEXT_INPUT
:
961 case FIELD_ID_DATABASE_NEXT
:
962 case FIELD_ID_DATABASE_SELECT
:
963 case FIELD_ID_DATABASE_NAME
:
964 case FIELD_ID_DATABASE_NUMBER
:
965 case FIELD_ID_TEMPLATE_NAME
:
966 case FIELD_ID_CHAPTER
:
967 case FIELD_ID_FILE_NAME
:
968 case FIELD_ID_SHEET_NAME
:
969 case FIELD_ID_MEASURE
:
971 case FIELD_ID_DROP_DOWN
:
972 case FIELD_ID_DRAW_DATE_TIME
:
973 case FIELD_ID_DRAW_FOOTER
:
974 case FIELD_ID_DRAW_HEADER
:
975 ; // no formats for these fields!
978 case FIELD_ID_UNKNOWN
:
980 DBG_ERROR("unkown field type!");
981 // ignore -> no format for unkowns
986 /// export the given field to XML. Called on second pass through document
987 void XMLTextFieldExport::ExportField(
988 const Reference
<XTextField
> & rTextField
, sal_Bool bProgress
)
991 Reference
<XPropertySet
> xPropSet(rTextField
, UNO_QUERY
);
993 // get property set of range (for the attributes)
994 Reference
<XPropertySet
> xRangePropSet(rTextField
->getAnchor(), UNO_QUERY
);
997 enum FieldIdEnum nToken
= GetFieldID(rTextField
, xPropSet
);
999 // special treatment for combined characters field, because it is
1000 // exported as a style
1001 const XMLPropertyState
* aStates
[] = { pCombinedCharactersPropertyState
, 0 };
1002 const XMLPropertyState
**pStates
=
1003 FIELD_ID_COMBINED_CHARACTERS
== nToken
1007 // find out whether we need to set the style or hyperlink
1008 sal_Bool bHasHyperlink
;
1009 sal_Bool bIsUICharStyle
;
1010 sal_Bool bHasAutoStyle
;
1011 OUString sStyle
= GetExport().GetTextParagraphExport()->
1012 FindTextStyleAndHyperlink( xRangePropSet
, bHasHyperlink
, bIsUICharStyle
,
1013 bHasAutoStyle
, pStates
);
1014 sal_Bool bHasStyle
= (sStyle
.getLength() > 0);
1016 // export hyperlink (if we have one)
1017 Reference
< XPropertySetInfo
> xRangePropSetInfo
;
1020 Reference
<XPropertyState
> xRangePropState( xRangePropSet
, UNO_QUERY
);
1021 xRangePropSetInfo
= xRangePropSet
->getPropertySetInfo();
1023 GetExport().GetTextParagraphExport()->addHyperlinkAttributes(
1024 xRangePropSet
, xRangePropState
,
1025 xRangePropSetInfo
);
1027 SvXMLElementExport
aHyperlink( GetExport(), bHasHyperlink
,
1028 XML_NAMESPACE_TEXT
, XML_A
,
1029 sal_False
, sal_False
);
1033 // export events (if supported)
1034 OUString
sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM(
1035 "HyperLinkEvents"));
1036 if (xRangePropSetInfo
->hasPropertyByName(sHyperLinkEvents
))
1038 Any aAny
= xRangePropSet
->getPropertyValue(sHyperLinkEvents
);
1039 Reference
<XNameReplace
> xName
;
1041 GetExport().GetEventExport().Export(xName
, sal_False
);
1046 XMLTextCharStyleNamesElementExport
aCharStylesExport(
1047 GetExport(), bIsUICharStyle
&&
1048 GetExport().GetTextParagraphExport()
1049 ->GetCharStyleNamesPropInfoCache().hasProperty(
1050 xRangePropSet
, xRangePropSetInfo
), bHasAutoStyle
,
1051 xRangePropSet
, sPropertyCharStyleNames
);
1053 // export span with style (if necessary)
1054 // (except for combined characters field)
1057 // export <text:span> element
1058 GetExport().AddAttribute( XML_NAMESPACE_TEXT
, XML_STYLE_NAME
,
1059 GetExport().EncodeStyleName( sStyle
) );
1061 SvXMLElementExport
aSpan( GetExport(), bHasStyle
,
1062 XML_NAMESPACE_TEXT
, XML_SPAN
,
1063 sal_False
, sal_False
);
1065 // finally, export the field itself
1066 ExportFieldHelper( rTextField
, xPropSet
, xRangePropSet
, nToken
,
1071 /// export the given field to XML. Called on second pass through document
1072 void XMLTextFieldExport::ExportFieldHelper(
1073 const Reference
<XTextField
> & rTextField
,
1074 const Reference
<XPropertySet
> & rPropSet
,
1075 const Reference
<XPropertySet
> &,
1076 enum FieldIdEnum nToken
,
1077 sal_Bool bProgress
)
1079 // get property set info (because some attributes are not support
1080 // in all implementations)
1081 Reference
<XPropertySetInfo
> xPropSetInfo(rPropSet
->getPropertySetInfo());
1083 OUString sPresentation
= rTextField
->getPresentation(sal_False
);
1085 // process each field type
1087 case FIELD_ID_AUTHOR
:
1088 // author field: fixed, field (sub-)type
1089 ProcessBoolean(XML_FIXED
,
1090 GetBoolProperty(sPropertyIsFixed
, rPropSet
), sal_True
);
1091 ExportElement(MapAuthorFieldName(rPropSet
), sPresentation
);
1094 case FIELD_ID_SENDER
:
1095 // sender field: fixed, field (sub-)type
1096 ProcessBoolean(XML_FIXED
,
1097 GetBoolProperty(sPropertyIsFixed
, rPropSet
), sal_True
);
1098 ExportElement(MapSenderFieldName(rPropSet
), sPresentation
);
1101 case FIELD_ID_PLACEHOLDER
:
1102 // placeholder field: type, name, description
1103 ProcessString(XML_PLACEHOLDER_TYPE
,
1105 GetInt16Property(sPropertyPlaceholderType
, rPropSet
)));
1106 ProcessString(XML_DESCRIPTION
,
1107 GetStringProperty(sPropertyHint
,rPropSet
), sal_True
);
1108 ExportElement(XML_PLACEHOLDER
, sPresentation
);
1111 case FIELD_ID_VARIABLE_SET
:
1113 // variable set field: name, visible, format&value
1114 ProcessString(XML_NAME
,
1115 GetStringProperty(sPropertyVariableName
, rPropSet
));
1116 ProcessDisplay(GetBoolProperty(sPropertyIsVisible
, rPropSet
),
1118 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1119 GetStringProperty(sPropertyContent
, rPropSet
),
1121 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1122 GetIntProperty(sPropertyNumberFormat
, rPropSet
),
1123 GetStringProperty(sPropertyContent
, rPropSet
),
1125 GetDoubleProperty(sPropertyValue
, rPropSet
),
1126 sal_True
, sal_True
, sal_True
,
1127 ! GetOptionalBoolProperty(
1128 sPropertyIsFixedLanguage
,
1129 rPropSet
, xPropSetInfo
, sal_False
) );
1130 ExportElement(XML_VARIABLE_SET
, sPresentation
);
1133 case FIELD_ID_VARIABLE_GET
:
1135 // variable get field: name, format&value
1136 ProcessString(XML_NAME
,
1137 GetStringProperty(sPropertyContent
, rPropSet
));
1138 sal_Bool bCmd
= GetBoolProperty(sPropertyIsShowFormula
, rPropSet
);
1139 ProcessDisplay(sal_True
, bCmd
);
1140 // #i81766# for older versions export of the value-type
1141 sal_Bool bExportValueType
= !bCmd
&& ( GetExport().getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE
);
1142 // show style, unless name will be shown
1143 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1144 GetIntProperty(sPropertyNumberFormat
, rPropSet
),
1145 sEmpty
, sEmpty
, 0.0, // values not used
1149 ! GetOptionalBoolProperty(
1150 sPropertyIsFixedLanguage
,
1151 rPropSet
, xPropSetInfo
, sal_False
) );
1152 ExportElement(XML_VARIABLE_GET
, sPresentation
);
1155 case FIELD_ID_VARIABLE_INPUT
:
1156 // variable input field: name, description, format&value
1157 ProcessString(XML_NAME
,
1158 GetStringProperty(sPropertyVariableName
, rPropSet
));
1159 ProcessString(XML_DESCRIPTION
,
1160 GetStringProperty(sPropertyHint
, rPropSet
));
1161 ProcessDisplay(GetBoolProperty(sPropertyIsVisible
, rPropSet
),
1163 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1164 GetStringProperty(sPropertyContent
, rPropSet
),
1166 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1167 GetIntProperty(sPropertyNumberFormat
, rPropSet
),
1168 GetStringProperty(sPropertyContent
, rPropSet
),
1170 GetDoubleProperty(sPropertyValue
, rPropSet
),
1171 sal_True
, sal_True
, sal_True
,
1172 ! GetOptionalBoolProperty(
1173 sPropertyIsFixedLanguage
,
1174 rPropSet
, xPropSetInfo
, sal_False
) );
1175 ExportElement(XML_VARIABLE_INPUT
, sPresentation
);
1178 case FIELD_ID_USER_GET
:
1179 // user field: name, hidden, style
1181 sal_Bool bCmd
= GetBoolProperty(sPropertyIsShowFormula
, rPropSet
);
1182 ProcessDisplay(GetBoolProperty(sPropertyIsVisible
, rPropSet
),
1184 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1185 GetIntProperty(sPropertyNumberFormat
, rPropSet
),
1186 sEmpty
, sEmpty
, 0.0, // values not used
1187 sal_False
, sal_False
, !bCmd
,
1188 ! GetOptionalBoolProperty(
1189 sPropertyIsFixedLanguage
,
1190 rPropSet
, xPropSetInfo
, sal_False
) );
1192 // name from FieldMaster
1193 ProcessString(XML_NAME
,
1194 GetStringProperty(sPropertyName
,
1195 GetMasterPropertySet(rTextField
)));
1196 ExportElement(XML_USER_FIELD_GET
, sPresentation
);
1200 case FIELD_ID_USER_INPUT
:
1201 // user input field: name (from FieldMaster), description
1202 // ProcessString(XML_NAME,
1203 // GetStringProperty(sPropertyName,
1204 // GetMasterPropertySet(rTextField)));
1205 ProcessString(XML_NAME
,
1206 GetStringProperty(sPropertyContent
, rPropSet
));
1207 ProcessString(XML_DESCRIPTION
,
1208 GetStringProperty(sPropertyHint
, rPropSet
));
1209 ExportElement(XML_USER_FIELD_INPUT
, sPresentation
);
1212 case FIELD_ID_SEQUENCE
:
1214 // sequence field: name, formula, seq-format
1215 OUString sName
= GetStringProperty(sPropertyVariableName
, rPropSet
);
1216 // TODO: use reference name only if actually beeing referenced.
1217 ProcessString(XML_REF_NAME
,
1218 MakeSequenceRefName(
1219 GetInt16Property(sPropertySequenceValue
, rPropSet
),
1221 ProcessString(XML_NAME
, sName
);
1222 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1223 GetStringProperty(sPropertyContent
, rPropSet
),
1225 ProcessNumberingType(GetInt16Property(sPropertyNumberingType
,
1227 ExportElement(XML_SEQUENCE
, sPresentation
);
1231 case FIELD_ID_EXPRESSION
:
1233 // formula field: formula, format&value
1234 sal_Bool bCmd
= GetBoolProperty(sPropertyIsShowFormula
, rPropSet
);
1235 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1236 GetStringProperty(sPropertyContent
, rPropSet
),
1238 ProcessDisplay(sal_True
, bCmd
);
1239 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1240 GetIntProperty(sPropertyNumberFormat
, rPropSet
),
1241 GetStringProperty(sPropertyContent
, rPropSet
),
1243 GetDoubleProperty(sPropertyValue
, rPropSet
),
1244 !bCmd
, !bCmd
, !bCmd
,
1245 ! GetOptionalBoolProperty(
1246 sPropertyIsFixedLanguage
,
1247 rPropSet
, xPropSetInfo
, sal_False
) );
1248 ExportElement(XML_EXPRESSION
, sPresentation
);
1252 case FIELD_ID_TEXT_INPUT
:
1253 // text input field: description and string-value
1254 ProcessString(XML_DESCRIPTION
,
1255 GetStringProperty(sPropertyHint
, rPropSet
));
1256 ProcessString(XML_HELP
,
1257 GetStringProperty(sPropertyHelp
, rPropSet
), true);
1258 ProcessString(XML_HINT
,
1259 GetStringProperty(sPropertyTooltip
, rPropSet
), true);
1260 ExportElement(XML_TEXT_INPUT
, sPresentation
);
1264 // all properties (except IsDate) are optional!
1265 if (xPropSetInfo
->hasPropertyByName(sPropertyNumberFormat
))
1267 ProcessValueAndType(sal_False
,
1268 GetIntProperty(sPropertyNumberFormat
,rPropSet
),
1269 sEmpty
, sEmpty
, 0.0, // not used
1270 sal_False
, sal_False
, sal_True
,
1271 ! GetOptionalBoolProperty(
1272 sPropertyIsFixedLanguage
,
1273 rPropSet
, xPropSetInfo
, sal_False
),
1276 if (xPropSetInfo
->hasPropertyByName(sPropertyDateTimeValue
))
1278 // no value -> current time
1279 ProcessDateTime(XML_TIME_VALUE
,
1280 GetDateTimeProperty(sPropertyDateTimeValue
,
1284 if (xPropSetInfo
->hasPropertyByName(sPropertyDateTime
))
1286 // no value -> current time
1287 ProcessDateTime(XML_TIME_VALUE
,
1288 GetDateTimeProperty(sPropertyDateTime
,rPropSet
),
1291 if (xPropSetInfo
->hasPropertyByName(sPropertyIsFixed
))
1293 ProcessBoolean(XML_FIXED
,
1294 GetBoolProperty(sPropertyIsFixed
, rPropSet
),
1297 if (xPropSetInfo
->hasPropertyByName(sPropertyAdjust
))
1299 // adjust value given as integer in minutes
1300 ProcessDateTime(XML_TIME_ADJUST
,
1301 GetIntProperty(sPropertyAdjust
, rPropSet
),
1302 sal_False
, sal_True
, sal_True
);
1304 ExportElement(XML_TIME
, sPresentation
);
1308 // all properties (except IsDate) are optional!
1309 if (xPropSetInfo
->hasPropertyByName(sPropertyNumberFormat
))
1311 ProcessValueAndType(sal_False
,
1312 GetIntProperty(sPropertyNumberFormat
,rPropSet
),
1313 sEmpty
, sEmpty
, 0.0, // not used
1314 sal_False
, sal_False
, sal_True
,
1315 ! GetOptionalBoolProperty(
1316 sPropertyIsFixedLanguage
,
1317 rPropSet
, xPropSetInfo
, sal_False
) );
1319 if (xPropSetInfo
->hasPropertyByName(sPropertyDateTimeValue
))
1321 // no value -> current date
1322 ProcessDateTime(XML_DATE_VALUE
,
1323 GetDateTimeProperty(sPropertyDateTimeValue
,
1325 // #96457#: date fields should also save time
1328 // TODO: remove double-handling after SRC614
1329 else if (xPropSetInfo
->hasPropertyByName(sPropertyDateTime
))
1331 ProcessDateTime(XML_DATE_VALUE
,
1332 GetDateTimeProperty(sPropertyDateTime
,rPropSet
),
1333 // #96457#: date fields should also save time
1336 if (xPropSetInfo
->hasPropertyByName(sPropertyIsFixed
))
1338 ProcessBoolean(XML_FIXED
,
1339 GetBoolProperty(sPropertyIsFixed
, rPropSet
),
1342 if (xPropSetInfo
->hasPropertyByName(sPropertyAdjust
))
1344 // adjust value given as number of days
1345 ProcessDateTime(XML_DATE_ADJUST
,
1346 GetIntProperty(sPropertyAdjust
, rPropSet
),
1347 sal_True
, sal_True
, sal_True
);
1349 ExportElement(XML_DATE
, sPresentation
);
1352 case FIELD_ID_PAGENUMBER
:
1353 // all properties are optional
1354 if (xPropSetInfo
->hasPropertyByName(sPropertyNumberingType
))
1356 ProcessNumberingType(GetInt16Property(sPropertyNumberingType
,
1359 if (xPropSetInfo
->hasPropertyByName(sPropertyOffset
))
1361 sal_Int32 nAdjust
= GetIntProperty(sPropertyOffset
, rPropSet
);
1363 if (xPropSetInfo
->hasPropertyByName(sPropertySubType
))
1365 // property SubType used in MapPageNumebrName
1366 ProcessString(XML_SELECT_PAGE
,
1367 MapPageNumberName(rPropSet
, nAdjust
));
1369 ProcessIntegerDef(XML_PAGE_ADJUST
, nAdjust
, 0);
1371 ExportElement(XML_PAGE_NUMBER
, sPresentation
);
1374 case FIELD_ID_PAGESTRING
:
1376 ProcessString(XML_STRING_VALUE
,
1377 GetStringProperty(sPropertyUserText
, rPropSet
),
1379 sal_Int32 nDummy
= 0; // MapPageNumberName need int
1380 ProcessString(XML_SELECT_PAGE
, MapPageNumberName(rPropSet
, nDummy
));
1381 if( 0 == ( GetExport().getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE
) )
1382 ExportElement(XML_PAGE_CONTINUATION
, sPresentation
);
1384 ExportElement(XML_PAGE_CONTINUATION_STRING
, sPresentation
);
1388 case FIELD_ID_DATABASE_NAME
:
1389 ProcessString(XML_TABLE_NAME
,
1390 GetStringProperty(sPropertyDataTableName
, rPropSet
));
1391 ProcessCommandType(GetIntProperty(sPropertyDataCommandType
, rPropSet
));
1392 ProcessDisplay(GetBoolProperty(sPropertyIsVisible
, rPropSet
),
1394 ExportDataBaseElement(XML_DATABASE_NAME
, sPresentation
,
1395 rPropSet
, xPropSetInfo
);
1398 case FIELD_ID_DATABASE_NUMBER
:
1399 ProcessString(XML_TABLE_NAME
,
1400 GetStringProperty(sPropertyDataTableName
, rPropSet
));
1401 ProcessCommandType(GetIntProperty(sPropertyDataCommandType
, rPropSet
));
1402 ProcessNumberingType(
1403 GetInt16Property(sPropertyNumberingType
,rPropSet
));
1404 ProcessInteger(XML_VALUE
,
1405 GetIntProperty(sPropertySetNumber
, rPropSet
));
1406 ProcessDisplay(GetBoolProperty(sPropertyIsVisible
, rPropSet
),
1408 ExportDataBaseElement(XML_DATABASE_ROW_NUMBER
, sPresentation
,
1409 rPropSet
, xPropSetInfo
);
1412 case FIELD_ID_DATABASE_NEXT
:
1413 ProcessString(XML_TABLE_NAME
,
1414 GetStringProperty(sPropertyDataTableName
, rPropSet
));
1415 ProcessCommandType(GetIntProperty(sPropertyDataCommandType
, rPropSet
));
1416 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1417 GetStringProperty(sPropertyCondition
, rPropSet
));
1418 DBG_ASSERT(sPresentation
.equals(sEmpty
),
1419 "Unexpected presentation for database next field");
1420 ExportDataBaseElement(XML_DATABASE_NEXT
, OUString(),
1421 rPropSet
, xPropSetInfo
);
1424 case FIELD_ID_DATABASE_SELECT
:
1425 ProcessString(XML_TABLE_NAME
,
1426 GetStringProperty(sPropertyDataTableName
, rPropSet
));
1427 ProcessCommandType(GetIntProperty(sPropertyDataCommandType
, rPropSet
));
1428 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1429 GetStringProperty(sPropertyCondition
, rPropSet
));
1430 ProcessInteger(XML_ROW_NUMBER
,
1431 GetIntProperty(sPropertySetNumber
, rPropSet
));
1432 DBG_ASSERT(sPresentation
.equals(sEmpty
),
1433 "Unexpected presentation for database select field");
1434 ExportDataBaseElement(XML_DATABASE_ROW_SELECT
, OUString(),
1435 rPropSet
, xPropSetInfo
);
1438 case FIELD_ID_DATABASE_DISPLAY
:
1440 // get database, table and column name from field master
1441 const Reference
<XPropertySet
> & xMaster
= GetMasterPropertySet(rTextField
);
1442 ProcessString(XML_TABLE_NAME
,
1443 GetStringProperty(sPropertyDataTableName
, xMaster
));
1444 ProcessCommandType(GetIntProperty(sPropertyDataCommandType
, xMaster
));
1445 ProcessString(XML_COLUMN_NAME
,
1446 GetStringProperty(sPropertyDataColumnName
, xMaster
));
1447 // export number format if available (happens only for numbers!)
1448 if (!GetBoolProperty(sPropertyIsDataBaseFormat
, rPropSet
))
1450 ProcessValueAndType(sal_False
, // doesn't happen for text
1451 GetIntProperty(sPropertyNumberFormat
,rPropSet
),
1452 sEmpty
, sEmpty
, 0.0, // not used
1453 sal_False
, sal_False
, sal_True
, sal_False
);
1455 ProcessDisplay(GetBoolProperty(sPropertyIsVisible
, rPropSet
),
1457 ExportDataBaseElement(XML_DATABASE_DISPLAY
, sPresentation
,
1458 xMaster
, xMaster
->getPropertySetInfo());
1462 case FIELD_ID_DOCINFO_REVISION
:
1463 ProcessBoolean(XML_FIXED
,
1464 GetBoolProperty(sPropertyIsFixed
, rPropSet
), sal_False
);
1465 ExportElement(MapDocInfoFieldName(nToken
), sPresentation
);
1468 case FIELD_ID_DOCINFO_EDIT_DURATION
:
1469 case FIELD_ID_DOCINFO_SAVE_TIME
:
1470 case FIELD_ID_DOCINFO_CREATION_TIME
:
1471 case FIELD_ID_DOCINFO_PRINT_TIME
:
1472 case FIELD_ID_DOCINFO_SAVE_DATE
:
1473 case FIELD_ID_DOCINFO_CREATION_DATE
:
1474 case FIELD_ID_DOCINFO_PRINT_DATE
:
1475 ProcessValueAndType(sal_False
,
1476 GetIntProperty(sPropertyNumberFormat
, rPropSet
),
1477 sEmpty
, sEmpty
, 0.0,
1478 sal_False
, sal_False
, sal_True
,
1479 ! GetOptionalBoolProperty(
1480 sPropertyIsFixedLanguage
,
1481 rPropSet
, xPropSetInfo
, sal_False
) );
1483 // todo: export date/time value, but values not available -> core bug
1484 ProcessBoolean(XML_FIXED
,
1485 GetBoolProperty(sPropertyIsFixed
, rPropSet
), sal_False
);
1486 ExportElement(MapDocInfoFieldName(nToken
), sPresentation
);
1489 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
1490 case FIELD_ID_DOCINFO_DESCRIPTION
:
1491 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
1492 case FIELD_ID_DOCINFO_TITLE
:
1493 case FIELD_ID_DOCINFO_SUBJECT
:
1494 case FIELD_ID_DOCINFO_KEYWORDS
:
1495 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
1496 if (xPropSetInfo
->hasPropertyByName(sPropertyIsFixed
))
1498 ProcessBoolean(XML_FIXED
,
1499 GetBoolProperty(sPropertyIsFixed
, rPropSet
), sal_False
);
1501 ExportElement(MapDocInfoFieldName(nToken
), sPresentation
);
1504 case FIELD_ID_DOCINFO_CUSTOM
:
1506 uno::Any aAny
= rPropSet
->getPropertyValue( sPropertyName
);
1507 ::rtl::OUString sName
;
1509 ProcessString(XML_NAME
, sName
);
1510 ProcessBoolean(XML_FIXED
, GetBoolProperty(sPropertyIsFixed
, rPropSet
), sal_False
);
1511 ExportElement(XML_USER_DEFINED
, sPresentation
);
1515 case FIELD_ID_COUNT_PAGES
:
1516 case FIELD_ID_COUNT_PARAGRAPHS
:
1517 case FIELD_ID_COUNT_WORDS
:
1518 case FIELD_ID_COUNT_CHARACTERS
:
1519 case FIELD_ID_COUNT_TABLES
:
1520 case FIELD_ID_COUNT_GRAPHICS
:
1521 case FIELD_ID_COUNT_OBJECTS
:
1522 // all properties optional (applies to pages only, but I'll do
1523 // it for all for sake of common implementation)
1524 if (xPropSetInfo
->hasPropertyByName(sPropertyNumberingType
))
1526 ProcessNumberingType(GetInt16Property(sPropertyNumberingType
,
1529 ExportElement(MapCountFieldName(nToken
), sPresentation
);
1532 case FIELD_ID_CONDITIONAL_TEXT
:
1533 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1534 GetStringProperty(sPropertyCondition
, rPropSet
));
1535 ProcessString(XML_STRING_VALUE_IF_TRUE
,
1536 GetStringProperty(sPropertyTrueContent
, rPropSet
));
1537 ProcessString(XML_STRING_VALUE_IF_FALSE
,
1538 GetStringProperty(sPropertyFalseContent
, rPropSet
));
1539 ProcessBoolean(XML_CURRENT_VALUE
,
1540 GetBoolProperty(sPropertyIsConditionTrue
, rPropSet
),
1542 ExportElement(XML_CONDITIONAL_TEXT
, sPresentation
);
1545 case FIELD_ID_HIDDEN_TEXT
:
1546 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1547 GetStringProperty(sPropertyCondition
, rPropSet
));
1548 ProcessString(XML_STRING_VALUE
,
1549 GetStringProperty(sPropertyContent
, rPropSet
));
1550 ProcessBoolean(XML_IS_HIDDEN
,
1551 GetBoolProperty(sPropertyIsHidden
, rPropSet
),
1553 ExportElement(XML_HIDDEN_TEXT
, sPresentation
);
1556 case FIELD_ID_HIDDEN_PARAGRAPH
:
1557 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1558 GetStringProperty(sPropertyCondition
, rPropSet
));
1559 ProcessBoolean(XML_IS_HIDDEN
,
1560 GetBoolProperty(sPropertyIsHidden
, rPropSet
),
1562 DBG_ASSERT(sPresentation
.equals(sEmpty
),
1563 "Unexpected presentation for hidden paragraph field");
1564 ExportElement(XML_HIDDEN_PARAGRAPH
);
1567 case FIELD_ID_TEMPLATE_NAME
:
1568 ProcessString(XML_DISPLAY
,
1569 MapTemplateDisplayFormat(
1570 GetInt16Property(sPropertyFileFormat
, rPropSet
)));
1571 ExportElement(XML_TEMPLATE_NAME
, sPresentation
);
1574 case FIELD_ID_CHAPTER
:
1575 ProcessString(XML_DISPLAY
,
1576 MapChapterDisplayFormat(
1577 GetInt16Property(sPropertyChapterFormat
, rPropSet
)));
1578 // API numbers 0..9, we number 1..10
1579 ProcessInteger(XML_OUTLINE_LEVEL
,
1580 GetInt8Property(sPropertyLevel
, rPropSet
) + 1);
1581 ExportElement(XML_CHAPTER
, sPresentation
);
1584 case FIELD_ID_FILE_NAME
:
1585 // all properties are optional
1586 if (xPropSetInfo
->hasPropertyByName(sPropertyFileFormat
))
1588 ProcessString(XML_DISPLAY
,
1589 MapFilenameDisplayFormat(
1590 GetInt16Property(sPropertyFileFormat
, rPropSet
)));
1592 if (xPropSetInfo
->hasPropertyByName(sPropertyIsFixed
))
1594 ProcessBoolean(XML_FIXED
,
1595 GetBoolProperty(sPropertyIsFixed
, rPropSet
),
1598 ExportElement(XML_FILE_NAME
, sPresentation
);
1601 case FIELD_ID_REFPAGE_SET
:
1602 ProcessBoolean(XML_ACTIVE
,
1603 GetBoolProperty(sPropertyOn
, rPropSet
), sal_True
);
1604 ProcessIntegerDef(XML_PAGE_ADJUST
,
1605 GetInt16Property(sPropertyOffset
, rPropSet
), 0);
1606 DBG_ASSERT(sPresentation
.equals(sEmpty
),
1607 "Unexpected presentation page variable field");
1608 ExportElement(XML_PAGE_VARIABLE_SET
);
1611 case FIELD_ID_REFPAGE_GET
:
1612 ProcessNumberingType(
1613 GetInt16Property(sPropertyNumberingType
, rPropSet
));
1614 ExportElement(XML_PAGE_VARIABLE_GET
, sPresentation
);
1617 case FIELD_ID_MACRO
:
1618 ExportMacro( rPropSet
, sPresentation
);
1621 case FIELD_ID_REF_SEQUENCE
:
1622 // reference to sequence: format, name, find value (and element)
1623 // was: if (nSeqNumber != -1) ...
1624 ProcessString(XML_REFERENCE_FORMAT
,
1625 MapReferenceType(GetInt16Property(
1626 sPropertyReferenceFieldPart
, rPropSet
)),
1628 ProcessString(XML_REF_NAME
,
1629 MakeSequenceRefName(
1630 GetInt16Property(sPropertySequenceNumber
, rPropSet
),
1631 GetStringProperty(sPropertySourceName
, rPropSet
) ) );
1634 GetInt16Property(sPropertyReferenceFieldSource
, rPropSet
)),
1638 case FIELD_ID_REF_REFERENCE
:
1639 case FIELD_ID_REF_BOOKMARK
:
1640 // reference to bookmarks, references: format, name (and element)
1641 ProcessString(XML_REFERENCE_FORMAT
,
1642 MapReferenceType(GetInt16Property(
1643 sPropertyReferenceFieldPart
, rPropSet
)),
1645 ProcessString(XML_REF_NAME
,
1646 GetStringProperty(sPropertySourceName
, rPropSet
));
1648 MapReferenceSource(GetInt16Property(
1649 sPropertyReferenceFieldSource
, rPropSet
)),
1653 case FIELD_ID_REF_FOOTNOTE
:
1654 case FIELD_ID_REF_ENDNOTE
:
1655 // reference to end-/footnote: format, generate name, (and element)
1656 GetExport().AddAttribute( XML_NAMESPACE_TEXT
, XML_NOTE_CLASS
,
1657 FIELD_ID_REF_ENDNOTE
==nToken
? XML_ENDNOTE
: XML_FOOTNOTE
);
1658 ProcessString(XML_REFERENCE_FORMAT
,
1659 MapReferenceType(GetInt16Property(
1660 sPropertyReferenceFieldPart
, rPropSet
)),
1662 ProcessString(XML_REF_NAME
,
1663 MakeFootnoteRefName(GetInt16Property(
1664 sPropertySequenceNumber
, rPropSet
)));
1666 MapReferenceSource(GetInt16Property(
1667 sPropertyReferenceFieldSource
, rPropSet
)),
1672 // name from field master
1673 ProcessString(XML_CONNECTION_NAME
,
1675 GetStringProperty(sPropertyName
,
1676 GetMasterPropertySet(rTextField
)));
1677 ExportElement(XML_DDE_CONNECTION
, sPresentation
);
1680 case FIELD_ID_SHEET_NAME
:
1681 // name of spreadsheet (Calc only)
1682 ExportElement(XML_SHEET_NAME
, sPresentation
);
1687 // this field is a special case because it gets mapped onto a
1688 // hyperlink, rather than one of the regular text field.
1689 ProcessString(XML_HREF
, GetExport().GetRelativeReference(GetStringProperty(sPropertyURL
, rPropSet
)),
1690 sal_False
, XML_NAMESPACE_XLINK
);
1691 ProcessString(XML_TARGET_FRAME_NAME
,
1692 GetStringProperty(sPropertyTargetFrame
,rPropSet
),
1693 sal_True
, XML_NAMESPACE_OFFICE
);
1694 SvXMLElementExport
aUrlField(rExport
, XML_NAMESPACE_TEXT
, XML_A
,
1695 sal_False
, sal_False
);
1696 GetExport().Characters(sPresentation
);
1700 case FIELD_ID_BIBLIOGRAPHY
:
1702 ProcessBibliographyData(rPropSet
);
1703 ExportElement(XML_BIBLIOGRAPHY_MARK
, sPresentation
);
1707 case FIELD_ID_SCRIPT
:
1708 ProcessString(XML_LANGUAGE
,
1709 GetStringProperty(sPropertyScriptType
, rPropSet
),
1710 sal_True
, XML_NAMESPACE_SCRIPT
);
1711 DBG_ASSERT(sPresentation
.equals(sEmpty
),
1712 "Unexpected presentation for script field");
1713 if (GetBoolProperty(sPropertyURLContent
, rPropSet
))
1715 ProcessString(XML_HREF
,
1716 GetExport().GetRelativeReference(GetStringProperty(sPropertyContent
, rPropSet
)),
1717 sal_False
, XML_NAMESPACE_XLINK
);
1718 ExportElement(XML_SCRIPT
);
1722 ExportElement(XML_SCRIPT
,
1723 GetStringProperty(sPropertyContent
, rPropSet
));
1727 case FIELD_ID_ANNOTATION
:
1729 // check for empty presentation (just in case)
1730 DBG_ASSERT(sPresentation
.equals(sEmpty
),
1731 "Unexpected presentation for annotation field");
1733 // annotation element + content
1734 SvXMLElementExport
aElem(GetExport(), XML_NAMESPACE_OFFICE
,
1735 XML_ANNOTATION
, sal_False
, sal_True
);
1738 OUString
aAuthor( GetStringProperty(sPropertyAuthor
, rPropSet
) );
1739 if( aAuthor
.getLength() )
1741 SvXMLElementExport
aCreatorElem( GetExport(), XML_NAMESPACE_DC
,
1742 XML_CREATOR
, sal_True
,
1744 GetExport().Characters(aAuthor
);
1748 DateTime
aDate( GetDateTimeProperty(sPropertyDateTimeValue
, rPropSet
) );
1750 OUStringBuffer aBuffer
;
1751 GetExport().GetMM100UnitConverter().convertDateTime(aBuffer
,
1754 SvXMLElementExport
aDateElem( GetExport(), XML_NAMESPACE_DC
,
1757 GetExport().Characters(aBuffer
.makeStringAndClear());
1760 com::sun::star::uno::Reference
< com::sun::star::text::XText
> xText
;
1763 com::sun::star::uno::Any aRet
= rPropSet
->getPropertyValue(sPropertyTextRange
);
1766 catch ( com::sun::star::uno::Exception
& )
1770 GetExport().GetTextParagraphExport()->exportText( xText
);
1772 ProcessParagraphSequence(GetStringProperty(sPropertyContent
,rPropSet
));
1776 case FIELD_ID_COMBINED_CHARACTERS
:
1778 // The style with the combined characters attribute has
1779 // already been handled in the ExportField method. So all that
1780 // is left to do now is to export the characters.
1781 GetExport().Characters(sPresentation
);
1787 ExportMetaField(rPropSet
, false, bProgress
);
1791 case FIELD_ID_MEASURE
:
1793 ProcessString(XML_KIND
, MapMeasureKind(GetInt16Property(sPropertyMeasureKind
, rPropSet
)));
1794 ExportElement( XML_MEASURE
, sPresentation
);
1798 case FIELD_ID_TABLE_FORMULA
:
1799 ProcessString( XML_FORMULA
, XML_NAMESPACE_OOOW
,
1800 GetStringProperty(sPropertyContent
, rPropSet
) );
1801 ProcessDisplay( sal_True
,
1802 GetBoolProperty(sPropertyIsShowFormula
, rPropSet
),
1804 ProcessValueAndType( sal_False
,
1805 GetIntProperty(sPropertyNumberFormat
, rPropSet
),
1806 sEmpty
, sEmpty
, 0.0f
,
1807 sal_False
, sal_False
, sal_True
,
1808 sal_False
, sal_False
);
1809 ExportElement( XML_TABLE_FORMULA
, sPresentation
);
1812 case FIELD_ID_DROP_DOWN
:
1814 ProcessString(XML_NAME
, GetStringProperty(sPropertyName
, rPropSet
));
1815 ProcessString(XML_HELP
,
1816 GetStringProperty(sPropertyHelp
, rPropSet
), true);
1817 ProcessString(XML_HINT
,
1818 GetStringProperty(sPropertyTooltip
, rPropSet
), true);
1819 SvXMLElementExport
aElem( GetExport(),
1820 XML_NAMESPACE_TEXT
, XML_DROPDOWN
,
1821 sal_False
, sal_False
);
1822 ProcessStringSequence
1823 (GetStringSequenceProperty( sPropertyItems
, rPropSet
),
1824 GetStringProperty( sPropertySelectedItem
, rPropSet
) );
1826 GetExport().Characters( sPresentation
);
1830 case FIELD_ID_DRAW_HEADER
:
1832 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_PRESENTATION
, XML_HEADER
, sal_False
, sal_False
);
1836 case FIELD_ID_DRAW_FOOTER
:
1838 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_PRESENTATION
, XML_FOOTER
, sal_False
, sal_False
);
1842 case FIELD_ID_DRAW_DATE_TIME
:
1844 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_PRESENTATION
, XML_DATE_TIME
, sal_False
, sal_False
);
1848 case FIELD_ID_UNKNOWN
:
1850 DBG_ERROR("unkown field type encountered!");
1851 // always export content
1852 GetExport().Characters(sPresentation
);
1857 /// export field declarations / field masters
1858 void XMLTextFieldExport::ExportFieldDeclarations()
1860 Reference
<XText
> xEmptyText
;
1861 ExportFieldDeclarations(xEmptyText
);
1864 /// export field declarations / field masters
1865 void XMLTextFieldExport::ExportFieldDeclarations(
1866 const Reference
<XText
> & rText
)
1868 // store lists for decl elements
1869 vector
<OUString
> aVarName
;
1870 vector
<OUString
> aUserName
;
1871 vector
<OUString
> aSeqName
;
1872 vector
<OUString
> aDdeName
;
1874 // get text fields supplier and field master name access
1875 Reference
<XTextFieldsSupplier
> xTextFieldsSupp(GetExport().GetModel(),
1877 if( !xTextFieldsSupp
.is() )
1880 Reference
<container::XNameAccess
> xFieldMasterNameAccess(
1881 xTextFieldsSupp
->getTextFieldMasters(), UNO_QUERY
);
1883 // where to get the text field masters from?
1884 // a) we get a specific XText: then use pUsedMasters
1885 // b) the XText is empty: then export all text fields
1886 Sequence
<OUString
> aFieldMasters
;
1889 // export only used masters
1890 DBG_ASSERT(NULL
!= pUsedMasters
,
1891 "field masters must be recorded in order to be "
1892 "written out separatly" );
1893 if (NULL
!= pUsedMasters
)
1895 map
<Reference
<XText
>, set
<OUString
> > ::iterator aMapIter
=
1896 pUsedMasters
->find(rText
);
1897 if (aMapIter
!= pUsedMasters
->end())
1899 // found the set of used field masters
1900 set
<OUString
> & rOurMasters
= aMapIter
->second
;
1902 // copy set to sequence
1903 aFieldMasters
.realloc( rOurMasters
.size() );
1905 for( set
<OUString
>::iterator aSetIter
= rOurMasters
.begin();
1906 aSetIter
!= rOurMasters
.end();
1909 aFieldMasters
[i
] = *aSetIter
;
1912 pUsedMasters
->erase(rText
);
1914 // else: XText not found -> ignore
1916 // else: no field masters have been recorded -> ignore
1920 // no XText: export all!
1921 aFieldMasters
= xFieldMasterNameAccess
->getElementNames();
1924 for(sal_Int32 i
=0; i
<aFieldMasters
.getLength(); i
++) {
1926 // get field master name
1927 OUString sFieldMaster
= aFieldMasters
[i
];
1929 // workaround for #no-bug#
1930 static const sal_Char sDB
[] =
1931 "com.sun.star.text.FieldMaster.DataBase.";
1932 if ( sFieldMaster
.matchIgnoreAsciiCaseAsciiL( sDB
, sizeof(sDB
)-1) )
1938 OUString sFieldMasterType
;
1940 ExplodeFieldMasterName(sFieldMaster
, sFieldMasterType
, sVarName
);
1942 // get XPropertySet of this field master
1943 Reference
<XPropertySet
> xPropSet
;
1944 Any aAny
= xFieldMasterNameAccess
->getByName(sFieldMaster
);
1947 // save interesting field masters
1948 if (0 == sFieldMasterType
.compareToAscii(FIELD_SERVICE_SETEXP
))
1950 sal_Int32 nType
= GetIntProperty(sPropertySubType
, xPropSet
);
1952 // sequence or variable?
1953 if ( SetVariableType::SEQUENCE
== nType
)
1955 aSeqName
.push_back( sFieldMaster
);
1959 aVarName
.push_back( sFieldMaster
);
1962 else if (0 == sFieldMasterType
.compareToAscii(FIELD_SERVICE_USER
))
1964 aUserName
.push_back( sFieldMaster
);
1966 else if (0 == sFieldMasterType
.compareToAscii(FIELD_SERVICE_DDE
))
1968 aDdeName
.push_back( sFieldMaster
);
1976 // now process fields:
1978 // variable field masters:
1979 if ( !aVarName
.empty() )
1981 SvXMLElementExport
aElem( GetExport(),
1984 sal_True
, sal_True
);
1986 for (vector
<OUString
>::iterator aVarIter
= aVarName
.begin();
1987 aVarIter
!= aVarName
.end();
1990 OUString sName
= *aVarIter
;
1992 // get field master property set
1993 Reference
<XPropertySet
> xPropSet
;
1994 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
1997 // field name and type
1998 OUString sFieldMasterType
;
2000 ExplodeFieldMasterName(sName
, sFieldMasterType
, sVarName
);
2002 // determine string/numeric field
2003 sal_Bool bIsString
= ( GetIntProperty(sPropertySubType
, xPropSet
)
2004 == SetVariableType::STRING
);
2006 // get dependent field property set
2007 Reference
<XPropertySet
> xFieldPropSet
;
2008 if (GetDependentFieldPropertySet(xPropSet
, xFieldPropSet
))
2010 // process value and type.
2011 ProcessValueAndType(
2013 GetIntProperty(sPropertyNumberFormat
, xFieldPropSet
),
2014 sEmpty
, sEmpty
, 0.0,
2015 sal_False
, sal_True
, sal_False
, sal_False
);
2019 // If no dependent field is found, only string and
2020 // float types can be supported
2022 // number format: 0 is default number format for 1st
2023 // language. should be: getDefaultNumberFormat(Locale)
2024 // from NumberFormats
2025 ProcessValueAndType(
2027 0, sEmpty
, sEmpty
, 0.0,
2028 sal_False
, sal_True
, sal_False
, sal_False
);
2031 ProcessString(XML_NAME
, sVarName
);
2032 ExportElement(XML_VARIABLE_DECL
, sal_True
);
2035 // else: no declarations element
2037 // sequence field masters:
2038 if ( !aSeqName
.empty() )
2040 SvXMLElementExport
aElem( GetExport(),
2043 sal_True
, sal_True
);
2045 for (vector
<OUString
>::iterator aSeqIter
= aSeqName
.begin();
2046 aSeqIter
!= aSeqName
.end();
2049 OUString sName
= *aSeqIter
;
2051 // get field master property set
2052 Reference
<XPropertySet
> xPropSet
;
2053 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
2056 // field name and type
2057 OUString sFieldMasterType
;
2059 ExplodeFieldMasterName(sName
, sFieldMasterType
, sVarName
);
2062 sal_Int32 nLevel
= 1 + GetIntProperty(
2063 sPropertyChapterNumberingLevel
, xPropSet
);
2064 DBG_ASSERT(nLevel
>= 0, "illegal outline level");
2065 DBG_ASSERT(nLevel
< 127, "possible illegal outline level");
2066 ProcessInteger(XML_DISPLAY_OUTLINE_LEVEL
, nLevel
);
2068 // separation character
2070 ProcessString(XML_SEPARATION_CHARACTER
, GetStringProperty(
2071 sPropertyNumberingSeparator
, xPropSet
));
2073 ProcessString(XML_NAME
, sVarName
);
2074 ExportElement(XML_SEQUENCE_DECL
, sal_True
);
2077 // else: no declarations element
2079 // user field field masters:
2080 if ( !aUserName
.empty() )
2082 SvXMLElementExport
aElem( GetExport(),
2084 XML_USER_FIELD_DECLS
,
2085 sal_True
, sal_True
);
2087 for (vector
<OUString
>::iterator aUserIter
= aUserName
.begin();
2088 aUserIter
!= aUserName
.end();
2091 OUString sName
= *aUserIter
;
2093 // get field master property set
2094 Reference
<XPropertySet
> xPropSet
;
2095 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
2098 // field name and type
2099 OUString sFieldMasterType
;
2101 ExplodeFieldMasterName(sName
, sFieldMasterType
, sVarName
);
2103 if (GetBoolProperty(sPropertyIsExpression
, xPropSet
))
2106 ProcessValueAndType(
2109 GetDoubleProperty(sPropertyValue
, xPropSet
),
2117 // string: write regardless of default
2118 ProcessString(XML_VALUE_TYPE
, XML_STRING
, sal_False
,
2119 XML_NAMESPACE_OFFICE
);
2120 ProcessString(XML_STRING_VALUE
,
2121 GetStringProperty(sPropertyContent
, xPropSet
),
2122 sal_False
, XML_NAMESPACE_OFFICE
);
2124 ProcessString(XML_NAME
, sVarName
);
2125 ExportElement(XML_USER_FIELD_DECL
, sal_True
);
2128 // else: no declarations element
2130 // DDE field field masters:
2131 if ( !aDdeName
.empty() )
2133 SvXMLElementExport
aElem( GetExport(),
2135 XML_DDE_CONNECTION_DECLS
,
2136 sal_True
, sal_True
);
2138 for (vector
<OUString
>::iterator aDdeIter
= aDdeName
.begin();
2139 aDdeIter
!= aDdeName
.end();
2142 OUString sName
= *aDdeIter
;
2144 // get field master property set
2145 Reference
<XPropertySet
> xPropSet
;
2146 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
2149 // check if this connection is being used by a field
2150 Reference
<XPropertySet
> xDummy
;
2151 if (GetDependentFieldPropertySet(xPropSet
, xDummy
))
2154 ProcessString(XML_NAME
,
2155 GetStringProperty(sPropertyName
, xPropSet
),
2156 sal_False
, XML_NAMESPACE_OFFICE
);
2158 // export elements; can't use ProcessString because
2159 // elements are in office namespace
2160 ProcessString(XML_DDE_APPLICATION
,
2161 GetStringProperty(sPropertyDDECommandType
,
2163 sal_False
, XML_NAMESPACE_OFFICE
);
2164 ProcessString(XML_DDE_TOPIC
,
2165 GetStringProperty(sPropertyDDECommandFile
,
2167 sal_False
, XML_NAMESPACE_OFFICE
);
2168 ProcessString(XML_DDE_ITEM
,
2169 GetStringProperty(sPropertyDDECommandElement
,
2171 sal_False
, XML_NAMESPACE_OFFICE
);
2172 sal_Bool bIsAutomaticUpdate
= GetBoolProperty(
2173 sPropertyIsAutomaticUpdate
, xPropSet
);
2174 if (bIsAutomaticUpdate
)
2176 GetExport().AddAttribute(XML_NAMESPACE_OFFICE
,
2177 XML_AUTOMATIC_UPDATE
,
2181 ExportElement(XML_DDE_CONNECTION_DECL
, sal_True
);
2183 // else: no dependent field -> no export of field declaration
2186 // else: no declarations element
2189 void XMLTextFieldExport::SetExportOnlyUsedFieldDeclarations(
2190 sal_Bool bExportOnlyUsed
)
2192 delete pUsedMasters
;
2193 pUsedMasters
= NULL
;
2195 // create used masters set (if none is used)
2196 if (bExportOnlyUsed
)
2197 pUsedMasters
= new map
<Reference
<XText
>, set
<OUString
> > ;
2200 void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName
,
2203 // can't call ExportElement(eElementName, const OUString&) with empty
2204 // string because xmlprinter only uses empty tags if no content
2205 // (not even empty content) was written.
2207 DBG_ASSERT(XML_TOKEN_INVALID
!= eElementName
, "invalid element name!");
2208 if (XML_TOKEN_INVALID
!= eElementName
)
2211 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_TEXT
,
2212 eElementName
, bAddSpace
, bAddSpace
);
2216 void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName
,
2217 const OUString
& sContent
,
2220 DBG_ASSERT(eElementName
!= XML_TOKEN_INVALID
, "invalid element name!");
2221 if (eElementName
!= XML_TOKEN_INVALID
)
2224 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_TEXT
,
2225 eElementName
, bAddSpace
, bAddSpace
);
2227 GetExport().Characters(sContent
);
2229 // always export content
2230 GetExport().Characters(sContent
);
2234 void XMLTextFieldExport::ExportMacro(
2235 const Reference
<XPropertySet
> & rPropSet
,
2236 const OUString
& rContent
)
2238 // some strings we'll need
2239 OUString
sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ));
2240 OUString
sStarBasic( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ));
2241 OUString
sScript( RTL_CONSTASCII_USTRINGPARAM( "Script" ));
2242 OUString
sLibrary( RTL_CONSTASCII_USTRINGPARAM( "Library" ));
2243 OUString
sMacroName( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ));
2244 OUString
sOnClick( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ));
2245 OUString
sPropertyMacroLibrary( RTL_CONSTASCII_USTRINGPARAM( "MacroLibrary" ));
2246 OUString
sPropertyMacroName( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ));
2247 OUString
sPropertyScriptURL( RTL_CONSTASCII_USTRINGPARAM( "ScriptURL" ));
2250 // the description attribute
2251 ProcessString(XML_DESCRIPTION
,
2252 GetStringProperty(sPropertyHint
, rPropSet
),
2256 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_TEXT
,
2257 XML_EXECUTE_MACRO
, sal_False
, sal_False
);
2259 // the <office:events>-macro:
2261 // 1) build sequence of PropertyValues
2262 Sequence
<PropertyValue
> aSeq
;
2264 rPropSet
->getPropertyValue( sPropertyScriptURL
) >>= sName
;
2266 // if the ScriptURL property is not empty then this is a Scripting
2267 // Framework URL, otherwise treat it as a Basic Macro
2268 if (sName
.getLength() != 0)
2270 aSeq
= Sequence
<PropertyValue
> (2);
2271 PropertyValue
* pArr
= aSeq
.getArray();
2272 pArr
[0].Name
= sEventType
;
2273 pArr
[0].Value
<<= sScript
;
2274 pArr
[1].Name
= sScript
;
2275 pArr
[1].Value
= rPropSet
->getPropertyValue( sPropertyScriptURL
);
2279 aSeq
= Sequence
<PropertyValue
> (3);
2280 PropertyValue
* pArr
= aSeq
.getArray();
2281 pArr
[0].Name
= sEventType
;
2282 pArr
[0].Value
<<= sStarBasic
;
2283 pArr
[1].Name
= sLibrary
;
2284 pArr
[1].Value
= rPropSet
->getPropertyValue( sPropertyMacroLibrary
);
2285 pArr
[2].Name
= sMacroName
;
2286 pArr
[2].Value
= rPropSet
->getPropertyValue( sPropertyMacroName
);
2289 // 2) export the sequence
2290 GetExport().GetEventExport().ExportSingleEvent( aSeq
, sOnClick
, sal_False
);
2292 // and finally, the field presentation
2293 GetExport().Characters(rContent
);
2296 void XMLTextFieldExport::ExportMetaField(
2297 const Reference
<XPropertySet
> & i_xMeta
,
2298 bool i_bAutoStyles
, sal_Bool i_bProgress
)
2300 bool doExport(!i_bAutoStyles
); // do not export element if autostyles
2301 // check version >= 1.2
2302 switch (GetExport().getDefaultVersion()) {
2303 case SvtSaveOptions::ODFVER_011
: // fall thru
2304 case SvtSaveOptions::ODFVER_010
: doExport
= false; break;
2308 const Reference
< XEnumerationAccess
> xEA( i_xMeta
, UNO_QUERY_THROW
);
2309 const Reference
< XEnumeration
> xTextEnum( xEA
->createEnumeration() );
2313 const Reference
<rdf::XMetadatable
> xMeta( i_xMeta
, UNO_QUERY_THROW
);
2315 // style:data-style-name
2316 ProcessValueAndType(sal_False
,
2317 GetIntProperty(sPropertyNumberFormat
, i_xMeta
),
2318 sEmpty
, sEmpty
, 0.0, sal_False
, sal_False
, sal_True
,
2319 sal_False
, sal_False
/*, sal_False*/ );
2321 // text:meta-field without xml:id is invalid
2322 xMeta
->ensureMetadataReference();
2324 // xml:id for RDF metadata
2325 GetExport().AddAttributeXmlId(xMeta
);
2328 SvXMLElementExport
aElem( GetExport(), doExport
,
2329 XML_NAMESPACE_TEXT
, XML_META_FIELD
, sal_False
, sal_False
);
2331 // recurse to export content
2332 GetExport().GetTextParagraphExport()->
2333 exportTextRangeEnumeration( xTextEnum
, i_bAutoStyles
, i_bProgress
);
2336 /// export all data-style related attributes
2337 void XMLTextFieldExport::ProcessValueAndType(
2338 sal_Bool bIsString
, /// do we process a string or a number?
2339 sal_Int32 nFormatKey
, /// format key for NumberFormatter; inv. if string
2340 const OUString
& sContent
, /// string content; possibly invalid
2341 const OUString
& sDefault
, /// default string
2342 double fValue
, /// float content; possibly invalid
2343 sal_Bool bExportValue
, /// export value attribute?
2344 sal_Bool bExportValueType
, /// export value-type attribute?
2345 sal_Bool bExportStyle
, /// export style-sttribute?
2346 sal_Bool bForceSystemLanguage
, /// export language attributes?
2347 sal_Bool bTimeStyle
) // exporting a time style?
2349 // String or number?
2353 // string: attributes value-type=string, string-value=...
2355 if (bExportValue
|| bExportValueType
)
2357 XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(
2358 GetExport(), sContent
, sDefault
, bExportValue
);
2365 // number: value-type=..., value...=..., data-style-name=...
2367 DBG_ASSERT(bExportValueType
|| !bExportValue
, "value w/o value type not supported!");
2369 // take care of illegal formats
2370 // (shouldn't happen, but does if document is corrupted)
2371 if (-1 != nFormatKey
)
2373 if (bExportValue
|| bExportValueType
)
2375 XMLNumberFormatAttributesExportHelper::
2376 SetNumberFormatAttributes(
2377 GetExport(), nFormatKey
, fValue
, bExportValue
);
2382 // don't export language (if desired)
2383 if( bForceSystemLanguage
)
2385 GetExport().dataStyleForceSystemLanguage( nFormatKey
);
2387 OUString sDataStyleName
=
2388 GetExport().getDataStyleName(nFormatKey
, bTimeStyle
);
2389 if( sDataStyleName
.getLength() > 0 )
2391 GetExport().AddAttribute( XML_NAMESPACE_STYLE
,
2392 XML_DATA_STYLE_NAME
,
2394 } // else: ignore (no valid number format)
2395 } // else: ignore (no number format)
2402 /// process display related properties
2403 void XMLTextFieldExport::ProcessDisplay(sal_Bool bIsVisible
,
2404 sal_Bool bIsCommand
,
2405 sal_Bool bValueDefault
)
2407 enum XMLTokenEnum eValue
;
2411 eValue
= bIsCommand
? XML_FORMULA
: XML_VALUE
;
2418 // omit attribute if default
2419 if (!bValueDefault
|| (eValue
!= XML_VALUE
))
2421 GetExport().AddAttribute(XML_NAMESPACE_TEXT
, XML_DISPLAY
, eValue
);
2427 /// export boolean property
2428 void XMLTextFieldExport::ProcessBoolean(enum XMLTokenEnum eName
,
2429 sal_Bool bBool
, sal_Bool bDefault
)
2431 DBG_ASSERT( eName
!= XML_TOKEN_INVALID
, "invalid element token");
2432 if ( XML_TOKEN_INVALID
== eName
)
2435 // write attribute (if different than default)
2436 // negate to force 0/1 values (and make sal_Bool comparable)
2437 if ((!bBool
) != (!bDefault
)) {
2438 GetExport().AddAttribute(XML_NAMESPACE_TEXT
, eName
,
2439 (bBool
? XML_TRUE
: XML_FALSE
) );
2446 /// export string attribute
2447 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2448 const OUString
& sValue
,
2449 sal_Bool bOmitEmpty
,
2452 DBG_ASSERT( eName
!= XML_TOKEN_INVALID
, "invalid element token");
2453 if ( XML_TOKEN_INVALID
== eName
)
2456 // check for empty string, if applicable
2457 if ( bOmitEmpty
&& (sValue
.getLength()==0) )
2461 GetExport().AddAttribute(nPrefix
, eName
, sValue
);
2464 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2465 sal_uInt16 nValuePrefix
,
2466 const OUString
& sValue
,
2467 sal_Bool bOmitEmpty
,
2471 GetExport().GetNamespaceMap().GetQNameByKey( nValuePrefix
, sValue
, sal_False
);
2472 ProcessString( eName
, sQValue
, bOmitEmpty
, nPrefix
);
2475 /// export a string attribute
2476 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2477 const ::rtl::OUString
& sValue
,
2478 const ::rtl::OUString
& sDefault
,
2481 if (sValue
!= sDefault
)
2483 ProcessString(eName
, sValue
, sal_False
, nPrefix
);
2487 /// export a string attribute
2488 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2489 sal_uInt16 nValuePrefix
,
2490 const ::rtl::OUString
& sValue
,
2491 const ::rtl::OUString
& sDefault
,
2494 if (sValue
!= sDefault
)
2496 ProcessString(eName
, nValuePrefix
, sValue
, sal_False
, nPrefix
);
2501 /// export string attribute
2502 void XMLTextFieldExport::ProcessString(
2503 enum XMLTokenEnum eName
,
2504 enum XMLTokenEnum eValue
,
2505 sal_Bool bOmitEmpty
,
2508 DBG_ASSERT( eName
!= XML_TOKEN_INVALID
, "invalid element token" );
2509 DBG_ASSERT( bOmitEmpty
|| (eValue
!= XML_TOKEN_INVALID
),
2510 "invalid value token" );
2511 if ( XML_TOKEN_INVALID
== eName
)
2514 // check for empty string, if applicable
2515 if (bOmitEmpty
&& (eValue
== XML_TOKEN_INVALID
))
2518 GetExport().AddAttribute(nPrefix
, eName
, eValue
);
2521 /// export a string attribute
2522 void XMLTextFieldExport::ProcessString(
2523 enum XMLTokenEnum eName
,
2524 enum XMLTokenEnum eValue
,
2525 enum XMLTokenEnum eDefault
,
2528 if ( eValue
!= eDefault
)
2529 ProcessString( eName
, eValue
, sal_False
, nPrefix
);
2533 /// export a string as a sequence of paragraphs
2534 void XMLTextFieldExport::ProcessParagraphSequence(
2535 const ::rtl::OUString
& sParagraphSequence
)
2537 // iterate over all string-pieces separated by return (0x0a) and
2538 // put each inside a paragraph element.
2539 SvXMLTokenEnumerator
aEnumerator(sParagraphSequence
, sal_Char(0x0a));
2540 OUString aSubString
;
2541 while (aEnumerator
.getNextToken(aSubString
))
2543 SvXMLElementExport
aParagraph(
2544 GetExport(), XML_NAMESPACE_TEXT
, XML_P
, sal_True
, sal_False
);
2545 GetExport().Characters(aSubString
);
2549 // export an integer attribute
2550 void XMLTextFieldExport::ProcessInteger(enum XMLTokenEnum eName
,
2553 DBG_ASSERT( eName
!= XML_TOKEN_INVALID
, "invalid element token");
2554 if ( XML_TOKEN_INVALID
== eName
)
2557 GetExport().AddAttribute(XML_NAMESPACE_TEXT
, eName
,
2558 OUString::valueOf(nNum
));
2561 /// export an integer attribute, omit if default
2562 void XMLTextFieldExport::ProcessIntegerDef(enum XMLTokenEnum eName
,
2563 sal_Int32 nNum
, sal_Int32 nDefault
)
2565 if (nNum
!= nDefault
)
2566 ProcessInteger(eName
, nNum
);
2571 /// export a numbering type
2572 void XMLTextFieldExport::ProcessNumberingType(sal_Int16 nNumberingType
)
2574 // process only if real format (not: like page descriptor)
2575 if (NumberingType::PAGE_DESCRIPTOR
!= nNumberingType
)
2577 OUStringBuffer
sTmp( 10 );
2578 // number type: num format
2579 GetExport().GetMM100UnitConverter().convertNumFormat( sTmp
,
2581 GetExport().AddAttribute(XML_NAMESPACE_STYLE
, XML_NUM_FORMAT
,
2582 sTmp
.makeStringAndClear() );
2583 // and letter sync, if applicable
2584 GetExport().GetMM100UnitConverter().convertNumLetterSync( sTmp
,
2587 if (sTmp
.getLength())
2589 GetExport().AddAttribute(XML_NAMESPACE_STYLE
, XML_NUM_LETTER_SYNC
,
2590 sTmp
.makeStringAndClear() );
2593 // else: like page descriptor => ignore
2597 /// export a date, time, or duration
2598 void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName
,
2601 sal_Bool bIsDuration
,
2602 sal_Bool bOmitDurationIfZero
,
2605 // truncate for date granularity
2608 dValue
= ::rtl::math::approxFloor(dValue
);
2611 OUStringBuffer aBuffer
;
2614 // date/time durationM handle bOmitDurationIfZero
2615 if (!bOmitDurationIfZero
|| !::rtl::math::approxEqual(dValue
, 0.0))
2617 rExport
.GetMM100UnitConverter().convertTime(aBuffer
, dValue
);
2623 rExport
.GetMM100UnitConverter().convertDateTime(aBuffer
, dValue
);
2627 ProcessString(eName
, aBuffer
.makeStringAndClear(), sal_True
, nPrefix
);
2630 /// export a date or time
2631 void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName
,
2632 const DateTime
& rTime
,
2636 OUStringBuffer aBuffer
;
2638 DateTime
aDateTime(rTime
);
2643 aDateTime
.HundredthSeconds
= 0;
2644 aDateTime
.Seconds
= 0;
2645 aDateTime
.Minutes
= 0;
2646 aDateTime
.Hours
= 0;
2650 rExport
.GetMM100UnitConverter().convertDateTime(aBuffer
, aDateTime
);
2653 ProcessString(eName
, aBuffer
.makeStringAndClear(), sal_True
, nPrefix
);
2656 /// export date according to ISO 8601
2657 void XMLTextFieldExport::ProcessDate(
2658 enum XMLTokenEnum eName
,
2659 const ::com::sun::star::util::Date
& rDate
,
2662 // the easiest way: delegate to ProcessDateTime (as date)
2664 aDateTime
.Day
= rDate
.Day
;
2665 aDateTime
.Month
= rDate
.Month
;
2666 aDateTime
.Year
= rDate
.Year
;
2667 ProcessDateTime(eName
, aDateTime
, sal_True
, nPrefix
);
2671 /// export a date, time, or duration
2672 void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName
,
2675 sal_Bool bIsDuration
,
2676 sal_Bool bOmitDurationIfZero
,
2679 // handle bOmitDurationIfZero here, because we can precisely compare ints
2680 if (!(bIsDuration
&& bOmitDurationIfZero
&& (nMinutes
==0)))
2682 ProcessDateTime(eName
, (double)nMinutes
/ (double)(24*60),
2683 bIsDate
, bIsDuration
, bOmitDurationIfZero
, nPrefix
);
2688 SvXMLEnumMapEntry __READONLY_DATA aBibliographyDataTypeMap
[] =
2690 { XML_ARTICLE
, BibliographyDataType::ARTICLE
},
2691 { XML_BOOK
, BibliographyDataType::BOOK
},
2692 { XML_BOOKLET
, BibliographyDataType::BOOKLET
},
2693 { XML_CONFERENCE
, BibliographyDataType::CONFERENCE
},
2694 { XML_CUSTOM1
, BibliographyDataType::CUSTOM1
},
2695 { XML_CUSTOM2
, BibliographyDataType::CUSTOM2
},
2696 { XML_CUSTOM3
, BibliographyDataType::CUSTOM3
},
2697 { XML_CUSTOM4
, BibliographyDataType::CUSTOM4
},
2698 { XML_CUSTOM5
, BibliographyDataType::CUSTOM5
},
2699 { XML_EMAIL
, BibliographyDataType::EMAIL
},
2700 { XML_INBOOK
, BibliographyDataType::INBOOK
},
2701 { XML_INCOLLECTION
, BibliographyDataType::INCOLLECTION
},
2702 { XML_INPROCEEDINGS
, BibliographyDataType::INPROCEEDINGS
},
2703 { XML_JOURNAL
, BibliographyDataType::JOURNAL
},
2704 { XML_MANUAL
, BibliographyDataType::MANUAL
},
2705 { XML_MASTERSTHESIS
, BibliographyDataType::MASTERSTHESIS
},
2706 { XML_MISC
, BibliographyDataType::MISC
},
2707 { XML_PHDTHESIS
, BibliographyDataType::PHDTHESIS
},
2708 { XML_PROCEEDINGS
, BibliographyDataType::PROCEEDINGS
},
2709 { XML_TECHREPORT
, BibliographyDataType::TECHREPORT
},
2710 { XML_UNPUBLISHED
, BibliographyDataType::UNPUBLISHED
},
2711 { XML_WWW
, BibliographyDataType::WWW
},
2712 { XML_TOKEN_INVALID
, 0 }
2717 void XMLTextFieldExport::ProcessBibliographyData(
2718 const Reference
<XPropertySet
>& rPropSet
)
2721 Any aAny
= rPropSet
->getPropertyValue(sPropertyFields
);
2722 Sequence
<PropertyValue
> aValues
;
2725 // one attribute per value (unless empty)
2726 sal_Int32 nLength
= aValues
.getLength();
2727 for (sal_Int32 i
= 0; i
< nLength
; i
++)
2729 if (aValues
[i
].Name
.equalsAsciiL("BibiliographicType",
2730 sizeof("BibiliographicType")-1))
2732 sal_Int16 nTypeId
= 0;
2733 aValues
[i
].Value
>>= nTypeId
;
2734 OUStringBuffer sBuf
;
2736 if (SvXMLUnitConverter::convertEnum(sBuf
, nTypeId
,
2737 aBibliographyDataTypeMap
))
2739 rExport
.AddAttribute(XML_NAMESPACE_TEXT
,
2740 XML_BIBLIOGRAPHY_TYPE
,
2741 sBuf
.makeStringAndClear());
2743 // else: ignore this argument
2748 aValues
[i
].Value
>>= sStr
;
2750 if (sStr
.getLength() > 0)
2752 rExport
.AddAttribute(XML_NAMESPACE_TEXT
,
2753 MapBibliographyFieldName(aValues
[i
].Name
),
2760 /// export CommandTypeAttribute
2761 void XMLTextFieldExport::ProcessCommandType(
2762 sal_Int32 nCommandType
)
2764 enum XMLTokenEnum eToken
= XML_TOKEN_INVALID
;
2765 switch( nCommandType
)
2767 case sdb::CommandType::TABLE
: eToken
= XML_TABLE
; break;
2768 case sdb::CommandType::QUERY
: eToken
= XML_QUERY
; break;
2769 case sdb::CommandType::COMMAND
: eToken
= XML_COMMAND
; break;
2772 if( eToken
!= XML_TOKEN_INVALID
)
2773 rExport
.AddAttribute( XML_NAMESPACE_TEXT
, XML_TABLE_TYPE
, eToken
);
2777 void XMLTextFieldExport::ProcessStringSequence(
2778 const Sequence
<OUString
>& rSequence
,
2779 const OUString sSelected
)
2781 // find selected element
2782 sal_Int32 nSelected
= -1;
2783 sal_Int32 nLength
= rSequence
.getLength();
2784 const OUString
* pSequence
= rSequence
.getConstArray();
2785 for( sal_Int32 i
= 0; i
< nLength
; i
++ )
2787 if( pSequence
[i
] == sSelected
)
2791 // delegate to ProcessStringSequence(OUString,sal_Int32)
2792 ProcessStringSequence( rSequence
, nSelected
);
2795 void XMLTextFieldExport::ProcessStringSequence(
2796 const Sequence
<OUString
>& rSequence
,
2797 sal_Int32 nSelected
)
2799 sal_Int32 nLength
= rSequence
.getLength();
2800 const OUString
* pSequence
= rSequence
.getConstArray();
2801 for( sal_Int32 i
= 0; i
< nLength
; i
++ )
2803 if( i
== nSelected
)
2804 rExport
.AddAttribute( XML_NAMESPACE_TEXT
,
2805 XML_CURRENT_SELECTED
, XML_TRUE
);
2806 rExport
.AddAttribute( XML_NAMESPACE_TEXT
, XML_VALUE
, pSequence
[i
] );
2807 SvXMLElementExport
aElement( rExport
, XML_NAMESPACE_TEXT
, XML_LABEL
,
2808 sal_False
, sal_False
);
2812 void XMLTextFieldExport::ExportDataBaseElement(
2813 enum XMLTokenEnum eElementName
,
2814 const OUString
& sPresentation
,
2815 const Reference
<XPropertySet
>& rPropertySet
,
2816 const Reference
<XPropertySetInfo
>& rPropertySetInfo
)
2818 DBG_ASSERT( eElementName
!= XML_TOKEN_INVALID
, "need token" );
2819 DBG_ASSERT( rPropertySet
.is(), "need property set" );
2820 DBG_ASSERT( rPropertySetInfo
.is(), "need property set info" );
2822 // get database properties
2823 OUString sDataBaseName
;
2824 OUString sDataBaseURL
;
2826 if( ( rPropertySet
->getPropertyValue( sPropertyDataBaseName
) >>= sStr
)
2827 && ( sStr
.getLength() > 0 ) )
2829 sDataBaseName
= sStr
;
2831 else if( rPropertySetInfo
->hasPropertyByName( sPropertyDataBaseURL
) &&
2832 (rPropertySet
->getPropertyValue( sPropertyDataBaseURL
) >>= sStr
) &&
2833 (sStr
.getLength() > 0) )
2835 sDataBaseURL
= sStr
;
2838 // add database name property (if present)
2839 if( sDataBaseName
.getLength() > 0 )
2840 rExport
.AddAttribute( XML_NAMESPACE_TEXT
, XML_DATABASE_NAME
,
2842 SvXMLElementExport
aDataBaseElement( GetExport(),
2843 XML_NAMESPACE_TEXT
, eElementName
,
2844 sal_False
, sal_False
);
2846 // write URL as children
2847 if( sDataBaseURL
.getLength() > 0 )
2849 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_HREF
, sDataBaseURL
);
2850 SvXMLElementExport
aDataSourceElement(
2851 GetExport(), XML_NAMESPACE_FORM
, XML_CONNECTION_RESOURCE
,
2852 sal_False
, sal_False
);
2855 // write presentation
2856 rExport
.Characters( sPresentation
);
2861 // explode a field master name into field type and field name
2862 sal_Bool
XMLTextFieldExport::ExplodeFieldMasterName(
2863 const OUString
& sMasterName
, OUString
& sFieldType
, OUString
& sVarName
)
2865 sal_Int32 nLength
= sFieldMasterPrefix
.getLength();
2866 sal_Int32 nSeparator
= sMasterName
.indexOf('.', nLength
);
2867 sal_Bool bReturn
= sal_True
;
2870 // check for service name
2871 bReturn
&= (0 == sFieldMasterPrefix
.compareTo(sMasterName
, nLength
));
2875 if (nSeparator
<= nLength
) {
2876 nSeparator
= sMasterName
.getLength();
2877 DBG_WARNING("no field var name!");
2878 bReturn
= sal_False
;
2882 sFieldType
= sMasterName
.copy(nLength
, nSeparator
-nLength
);
2883 sVarName
= sMasterName
.copy(nSeparator
+1);
2890 // for XDependentTextFields, get PropertySet of FieldMaster
2891 Reference
<XPropertySet
> XMLTextFieldExport::GetMasterPropertySet(
2892 const Reference
<XTextField
> & rTextField
)
2894 // name, value => get Property set of TextFieldMaster
2895 Reference
<XDependentTextField
> xDep(rTextField
, UNO_QUERY
);
2896 return xDep
->getTextFieldMaster();
2899 // get PropertySet of (any; the first) dependent field
2900 sal_Bool
XMLTextFieldExport::GetDependentFieldPropertySet(
2901 const Reference
<XPropertySet
> & xMaster
,
2902 Reference
<XPropertySet
> & xField
)
2905 Sequence
<Reference
<XDependentTextField
> > aFields
;
2906 aAny
= xMaster
->getPropertyValue(sPropertyDependentTextFields
);
2910 if (aFields
.getLength() > 0)
2912 // get first one and return
2913 Reference
<XDependentTextField
> xTField
= aFields
[0];
2914 xField
= Reference
<XPropertySet
>(xTField
, UNO_QUERY
);
2915 DBG_ASSERT(xField
.is(),
2916 "Surprisinlgy, this TextField refuses to be a PropertySet!");
2926 /// map placeholder type
2927 enum XMLTokenEnum
XMLTextFieldExport::MapPlaceholderType(sal_uInt16 nType
)
2929 enum XMLTokenEnum eType
= XML_TEXT
;
2933 case PlaceholderType::TEXT
:
2937 case PlaceholderType::TABLE
:
2941 case PlaceholderType::TEXTFRAME
:
2942 eType
= XML_TEXT_BOX
;
2945 case PlaceholderType::GRAPHIC
:
2949 case PlaceholderType::OBJECT
:
2954 // unkown placeholder: XML_TEXT
2955 DBG_ERROR("unkown placeholder type");
2962 /// element name for author fields
2963 enum XMLTokenEnum
XMLTextFieldExport::MapAuthorFieldName(
2964 const Reference
<XPropertySet
> & xPropSet
)
2966 // Initalen oder voller Name?
2967 return GetBoolProperty(sPropertyFullName
, xPropSet
)
2968 ? XML_AUTHOR_NAME
: XML_AUTHOR_INITIALS
;
2971 enum XMLTokenEnum
XMLTextFieldExport::MapPageNumberName(
2972 const Reference
<XPropertySet
> & xPropSet
,
2975 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
2976 PageNumberType ePage
;
2977 Any aAny
= xPropSet
->getPropertyValue(sPropertySubType
);
2978 ePage
= *(PageNumberType
*)aAny
.getValue();
2982 case PageNumberType_PREV
:
2983 eName
= XML_PREVIOUS
;
2986 case PageNumberType_CURRENT
:
2987 eName
= XML_CURRENT
;
2989 case PageNumberType_NEXT
:
2994 DBG_ERROR("unknown page number type");
2995 eName
= XML_TOKEN_INVALID
;
3002 /// map TemplateDisplayFormat to XML
3003 enum XMLTokenEnum
XMLTextFieldExport::MapTemplateDisplayFormat(sal_Int16 nFormat
)
3005 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3009 case TemplateDisplayFormat::FULL
:
3012 case TemplateDisplayFormat::PATH
:
3015 case TemplateDisplayFormat::NAME
:
3018 case TemplateDisplayFormat::NAME_AND_EXT
:
3019 eName
= XML_NAME_AND_EXTENSION
;
3021 case TemplateDisplayFormat::AREA
:
3024 case TemplateDisplayFormat::TITLE
:
3028 DBG_ERROR("unknown template display format");
3029 eName
= XML_TOKEN_INVALID
;
3036 /// map count/statistics field token to XML name
3037 enum XMLTokenEnum
XMLTextFieldExport::MapCountFieldName(FieldIdEnum nToken
)
3039 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3043 case FIELD_ID_COUNT_PAGES
:
3044 eElement
= XML_PAGE_COUNT
;
3046 case FIELD_ID_COUNT_PARAGRAPHS
:
3047 eElement
= XML_PARAGRAPH_COUNT
;
3049 case FIELD_ID_COUNT_WORDS
:
3050 eElement
= XML_WORD_COUNT
;
3052 case FIELD_ID_COUNT_CHARACTERS
:
3053 eElement
= XML_CHARACTER_COUNT
;
3055 case FIELD_ID_COUNT_TABLES
:
3056 eElement
= XML_TABLE_COUNT
;
3058 case FIELD_ID_COUNT_GRAPHICS
:
3059 eElement
= XML_IMAGE_COUNT
;
3061 case FIELD_ID_COUNT_OBJECTS
:
3062 eElement
= XML_OBJECT_COUNT
;
3065 DBG_ERROR("no count field token");
3066 eElement
= XML_TOKEN_INVALID
;
3073 /// map ChapterDisplayFormat to XML string
3074 enum XMLTokenEnum
XMLTextFieldExport::MapChapterDisplayFormat(sal_Int16 nFormat
)
3076 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3080 case ChapterFormat::NAME
:
3083 case ChapterFormat::NUMBER
:
3086 case ChapterFormat::NAME_NUMBER
:
3087 eName
= XML_NUMBER_AND_NAME
;
3089 case ChapterFormat::NO_PREFIX_SUFFIX
:
3090 eName
= XML_PLAIN_NUMBER_AND_NAME
;
3092 case ChapterFormat::DIGIT
:
3093 eName
= XML_PLAIN_NUMBER
;
3096 DBG_ERROR("unkown chapter display format");
3097 eName
= XML_TOKEN_INVALID
;
3105 /// map FilenameDisplayFormat to XML attribute names
3106 enum XMLTokenEnum
XMLTextFieldExport::MapFilenameDisplayFormat(sal_Int16 nFormat
)
3108 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3112 case FilenameDisplayFormat::FULL
:
3115 case FilenameDisplayFormat::PATH
:
3118 case FilenameDisplayFormat::NAME
:
3121 case FilenameDisplayFormat::NAME_AND_EXT
:
3122 eName
= XML_NAME_AND_EXTENSION
;
3125 DBG_ERROR("unknown filename display format");
3132 /// map ReferenceFieldPart to XML string
3133 enum XMLTokenEnum
XMLTextFieldExport::MapReferenceType(sal_Int16 nType
)
3135 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3139 case ReferenceFieldPart::PAGE
:
3140 eElement
= XML_PAGE
;
3142 case ReferenceFieldPart::CHAPTER
:
3143 eElement
= XML_CHAPTER
;
3145 case ReferenceFieldPart::TEXT
:
3146 eElement
= XML_TEXT
;
3148 case ReferenceFieldPart::UP_DOWN
:
3149 eElement
= XML_DIRECTION
;
3151 case ReferenceFieldPart::CATEGORY_AND_NUMBER
:
3152 eElement
= XML_CATEGORY_AND_VALUE
;
3154 case ReferenceFieldPart::ONLY_CAPTION
:
3155 eElement
= XML_CAPTION
;
3157 case ReferenceFieldPart::ONLY_SEQUENCE_NUMBER
:
3158 eElement
= XML_VALUE
;
3160 case ReferenceFieldPart::PAGE_DESC
:
3161 // small hack: this value never gets written, because
3162 // XML_TEMPLATE is default
3163 eElement
= XML_TEMPLATE
;
3165 // --> OD 2007-09-14 #i81002#
3166 case ReferenceFieldPart::NUMBER
:
3167 eElement
= XML_NUMBER
;
3169 case ReferenceFieldPart::NUMBER_NO_CONTEXT
:
3170 eElement
= XML_NUMBER_NO_SUPERIOR
;
3172 case ReferenceFieldPart::NUMBER_FULL_CONTEXT
:
3173 eElement
= XML_NUMBER_ALL_SUPERIOR
;
3177 DBG_ERROR("unknown reference type");
3178 eElement
= XML_TEMPLATE
;
3185 /// map ReferenceFieldPart to XML string
3186 enum XMLTokenEnum
XMLTextFieldExport::MapReferenceSource(sal_Int16 nType
)
3188 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3192 case ReferenceFieldSource::REFERENCE_MARK
:
3193 eElement
= XML_REFERENCE_REF
;
3195 case ReferenceFieldSource::SEQUENCE_FIELD
:
3196 eElement
= XML_SEQUENCE_REF
;
3198 case ReferenceFieldSource::BOOKMARK
:
3199 eElement
= XML_BOOKMARK_REF
;
3201 case ReferenceFieldSource::FOOTNOTE
:
3202 case ReferenceFieldSource::ENDNOTE
:
3203 eElement
= XML_NOTE_REF
;
3206 DBG_ERROR("unkown reference source");
3214 /// element name for sender fields
3215 enum XMLTokenEnum
XMLTextFieldExport::MapSenderFieldName(
3216 const Reference
<XPropertySet
> & xPropSet
)
3218 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3221 switch (GetInt16Property(sPropertyFieldSubType
, xPropSet
))
3223 case UserDataPart::COMPANY
:
3224 eName
= XML_SENDER_COMPANY
;
3226 case UserDataPart::FIRSTNAME
:
3227 eName
= XML_SENDER_FIRSTNAME
;
3229 case UserDataPart::NAME
:
3230 eName
= XML_SENDER_LASTNAME
;
3232 case UserDataPart::SHORTCUT
:
3233 eName
= XML_SENDER_INITIALS
;
3235 case UserDataPart::STREET
:
3236 eName
= XML_SENDER_STREET
;
3238 case UserDataPart::COUNTRY
:
3239 eName
= XML_SENDER_COUNTRY
;
3241 case UserDataPart::ZIP
:
3242 eName
= XML_SENDER_POSTAL_CODE
;
3244 case UserDataPart::CITY
:
3245 eName
= XML_SENDER_CITY
;
3247 case UserDataPart::TITLE
:
3248 eName
= XML_SENDER_TITLE
;
3250 case UserDataPart::POSITION
:
3251 eName
= XML_SENDER_POSITION
;
3253 case UserDataPart::PHONE_PRIVATE
:
3254 eName
= XML_SENDER_PHONE_PRIVATE
;
3256 case UserDataPart::PHONE_COMPANY
:
3257 eName
= XML_SENDER_PHONE_WORK
;
3259 case UserDataPart::FAX
:
3260 eName
= XML_SENDER_FAX
;
3262 case UserDataPart::EMAIL
:
3263 eName
= XML_SENDER_EMAIL
;
3265 case UserDataPart::STATE
:
3266 eName
= XML_SENDER_STATE_OR_PROVINCE
;
3269 DBG_WARNING("unknown sender type");
3270 eName
= XML_TOKEN_INVALID
;
3277 enum XMLTokenEnum
XMLTextFieldExport::MapDocInfoFieldName(
3278 enum FieldIdEnum nToken
)
3280 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3284 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
3285 eElement
= XML_INITIAL_CREATOR
;
3287 case FIELD_ID_DOCINFO_CREATION_DATE
:
3288 eElement
= XML_CREATION_DATE
;
3290 case FIELD_ID_DOCINFO_CREATION_TIME
:
3291 eElement
= XML_CREATION_TIME
;
3293 case FIELD_ID_DOCINFO_DESCRIPTION
:
3294 eElement
= XML_DESCRIPTION
;
3296 case FIELD_ID_DOCINFO_PRINT_TIME
:
3297 eElement
= XML_PRINT_TIME
;
3299 case FIELD_ID_DOCINFO_PRINT_DATE
:
3300 eElement
= XML_PRINT_DATE
;
3302 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
3303 eElement
= XML_PRINTED_BY
;
3305 case FIELD_ID_DOCINFO_TITLE
:
3306 eElement
= XML_TITLE
;
3308 case FIELD_ID_DOCINFO_SUBJECT
:
3309 eElement
= XML_SUBJECT
;
3311 case FIELD_ID_DOCINFO_KEYWORDS
:
3312 eElement
= XML_KEYWORDS
;
3314 case FIELD_ID_DOCINFO_REVISION
:
3315 eElement
= XML_EDITING_CYCLES
;
3317 case FIELD_ID_DOCINFO_EDIT_DURATION
:
3318 eElement
= XML_EDITING_DURATION
;
3320 case FIELD_ID_DOCINFO_SAVE_TIME
:
3321 eElement
= XML_MODIFICATION_TIME
;
3323 case FIELD_ID_DOCINFO_SAVE_DATE
:
3324 eElement
= XML_MODIFICATION_DATE
;
3326 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
3327 eElement
= XML_CREATOR
;
3330 DBG_WARNING("unknown docinfo field type!");
3331 eElement
= XML_TOKEN_INVALID
;
3338 enum XMLTokenEnum
XMLTextFieldExport::MapBibliographyFieldName(OUString sName
)
3340 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3342 if (sName
.equalsAsciiL("Identifier", sizeof("Identifier")-1))
3344 eName
= XML_IDENTIFIER
;
3346 else if (sName
.equalsAsciiL("BibiliographicType",
3347 sizeof("BibiliographicType")-1))
3349 eName
= XML_BIBLIOGRAPHY_TYPE
;
3351 else if (sName
.equalsAsciiL("Address", sizeof("Address")-1))
3353 eName
= XML_ADDRESS
;
3355 else if (sName
.equalsAsciiL("Annote", sizeof("Annote")-1))
3359 else if (sName
.equalsAsciiL("Author", sizeof("Author")-1))
3363 else if (sName
.equalsAsciiL("Booktitle", sizeof("Booktitle")-1))
3365 eName
= XML_BOOKTITLE
;
3367 else if (sName
.equalsAsciiL("Chapter", sizeof("Chapter")-1))
3369 eName
= XML_CHAPTER
;
3371 else if (sName
.equalsAsciiL("Edition", sizeof("Edition")-1))
3373 eName
= XML_EDITION
;
3375 else if (sName
.equalsAsciiL("Editor", sizeof("Editor")-1))
3379 else if (sName
.equalsAsciiL("Howpublished", sizeof("Howpublished")-1))
3381 eName
= XML_HOWPUBLISHED
;
3383 else if (sName
.equalsAsciiL("Institution", sizeof("Institution")-1))
3385 eName
= XML_INSTITUTION
;
3387 else if (sName
.equalsAsciiL("Journal", sizeof("Journal")-1))
3389 eName
= XML_JOURNAL
;
3391 else if (sName
.equalsAsciiL("Month", sizeof("Month")-1))
3395 else if (sName
.equalsAsciiL("Note", sizeof("Note")-1))
3399 else if (sName
.equalsAsciiL("Number", sizeof("Number")-1))
3403 else if (sName
.equalsAsciiL("Organizations", sizeof("Organizations")-1))
3405 eName
= XML_ORGANIZATIONS
;
3407 else if (sName
.equalsAsciiL("Pages", sizeof("Pages")-1))
3411 else if (sName
.equalsAsciiL("Publisher", sizeof("Publisher")-1))
3413 eName
= XML_PUBLISHER
;
3415 else if (sName
.equalsAsciiL("School", sizeof("School")-1))
3419 else if (sName
.equalsAsciiL("Series", sizeof("Series")-1))
3423 else if (sName
.equalsAsciiL("Title", sizeof("Title")-1))
3427 else if (sName
.equalsAsciiL("Report_Type", sizeof("Report_Type")-1))
3429 eName
= XML_REPORT_TYPE
;
3431 else if (sName
.equalsAsciiL("Volume", sizeof("Volume")-1))
3435 else if (sName
.equalsAsciiL("Year", sizeof("Year")-1))
3439 else if (sName
.equalsAsciiL("URL", sizeof("URL")-1))
3443 else if (sName
.equalsAsciiL("Custom1", sizeof("Custom1")-1))
3445 eName
= XML_CUSTOM1
;
3447 else if (sName
.equalsAsciiL("Custom2", sizeof("Custom2")-1))
3449 eName
= XML_CUSTOM2
;
3451 else if (sName
.equalsAsciiL("Custom3", sizeof("Custom3")-1))
3453 eName
= XML_CUSTOM3
;
3455 else if (sName
.equalsAsciiL("Custom4", sizeof("Custom4")-1))
3457 eName
= XML_CUSTOM4
;
3459 else if (sName
.equalsAsciiL("Custom5", sizeof("Custom5")-1))
3461 eName
= XML_CUSTOM5
;
3463 else if (sName
.equalsAsciiL("ISBN", sizeof("ISBN")-1))
3469 DBG_ERROR("Unknown bibliography info data");
3470 eName
= XML_TOKEN_INVALID
;
3476 enum XMLTokenEnum
XMLTextFieldExport::MapMeasureKind(sal_Int16 nKind
)
3488 OUString
XMLTextFieldExport::MakeFootnoteRefName(
3491 // generate foot-/endnote ID
3492 OUStringBuffer aBuf
;
3493 aBuf
.appendAscii("ftn");
3494 aBuf
.append((sal_Int32
)nSeqNo
);
3495 return aBuf
.makeStringAndClear();
3498 OUString
XMLTextFieldExport::MakeSequenceRefName(
3500 const OUString
& rSeqName
)
3502 // generate foot-/endnote ID
3503 OUStringBuffer aBuf
;
3504 aBuf
.appendAscii("ref");
3505 aBuf
.append(rSeqName
);
3506 aBuf
.append((sal_Int32
)nSeqNo
);
3507 return aBuf
.makeStringAndClear();
3511 // Property accessor helper functions
3514 // to be relegated (does that word exist?) to a more appropriate place
3518 inline sal_Bool
GetBoolProperty(
3519 const OUString
& sPropName
,
3520 const Reference
<XPropertySet
> & xPropSet
)
3522 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3523 sal_Bool bBool
= *(sal_Bool
*)aAny
.getValue();
3527 inline sal_Bool
GetOptionalBoolProperty(
3528 const OUString
& sPropName
,
3529 const Reference
<XPropertySet
> & xPropSet
,
3530 const Reference
<XPropertySetInfo
> & xPropSetInfo
,
3533 return xPropSetInfo
->hasPropertyByName( sPropName
)
3534 ? GetBoolProperty( sPropName
, xPropSet
) : bDefault
;
3537 inline double GetDoubleProperty(
3538 const OUString
& sPropName
,
3539 const Reference
<XPropertySet
> & xPropSet
)
3541 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3542 double fDouble
= 0.0;
3547 inline OUString
const GetStringProperty(
3548 const OUString
& sPropName
,
3549 const Reference
<XPropertySet
> & xPropSet
)
3551 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3557 inline sal_Int32
GetIntProperty(
3558 const OUString
& sPropName
,
3559 const Reference
<XPropertySet
> & xPropSet
)
3561 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3567 inline sal_Int16
GetInt16Property(
3568 const OUString
& sPropName
,
3569 const Reference
<XPropertySet
> & xPropSet
)
3571 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3577 inline sal_Int8
GetInt8Property(
3578 const OUString
& sPropName
,
3579 const Reference
<XPropertySet
> & xPropSet
)
3581 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3587 inline DateTime
const GetDateTimeProperty(
3588 const OUString
& sPropName
,
3589 const Reference
<XPropertySet
> & xPropSet
)
3591 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3597 inline Date
const GetDateProperty(
3598 const OUString
& sPropName
,
3599 const Reference
<XPropertySet
> & xPropSet
)
3601 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3607 inline Sequence
<OUString
> const GetStringSequenceProperty(
3608 const OUString
& sPropName
,
3609 const Reference
<XPropertySet
> & xPropSet
)
3611 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3612 Sequence
<OUString
> aSequence
;