1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 * export of all text fields
25 #include <comphelper/propertyvalue.hxx>
26 #include <txtflde.hxx>
28 #include <xmloff/XMLEventExport.hxx>
29 #include <xmloff/families.hxx>
30 #include <xmloff/namespacemap.hxx>
31 #include <xmloff/numehelp.hxx>
32 #include <xmloff/xmlement.hxx>
33 #include <xmloff/xmlexp.hxx>
34 #include <xmloff/xmltoken.hxx>
35 #include <xmloff/xmluconv.hxx>
36 #include <xmloff/maptype.hxx>
38 #include "XMLTextCharStyleNamesElementExport.hxx"
39 #include <sax/tools/converter.hxx>
40 #include <com/sun/star/frame/XModel.hpp>
41 #include <com/sun/star/util/DateTime.hpp>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/text/UserDataPart.hpp>
44 #include <com/sun/star/text/PageNumberType.hpp>
45 #include <com/sun/star/style/NumberingType.hpp>
46 #include <com/sun/star/text/ReferenceFieldPart.hpp>
47 #include <com/sun/star/text/ReferenceFieldSource.hpp>
48 #include <com/sun/star/beans/XPropertySet.hpp>
49 #include <com/sun/star/text/XTextField.hpp>
50 #include <com/sun/star/text/XDependentTextField.hpp>
51 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
53 #include <com/sun/star/text/SetVariableType.hpp>
54 #include <com/sun/star/text/PlaceholderType.hpp>
55 #include <com/sun/star/text/FilenameDisplayFormat.hpp>
56 #include <com/sun/star/text/ChapterFormat.hpp>
57 #include <com/sun/star/text/TemplateDisplayFormat.hpp>
58 #include <com/sun/star/uno/Sequence.h>
59 #include <com/sun/star/text/BibliographyDataType.hpp>
60 #include <com/sun/star/sdb/CommandType.hpp>
61 #include <com/sun/star/rdf/XMetadatable.hpp>
62 #include <comphelper/sequence.hxx>
63 #include <o3tl/any.hxx>
64 #include <o3tl/safeint.hxx>
65 #include <rtl/ustrbuf.hxx>
66 #include <tools/debug.hxx>
67 #include <rtl/math.hxx>
68 #include <sal/log.hxx>
73 using namespace ::com::sun::star
;
74 using namespace ::com::sun::star::uno
;
75 using namespace ::com::sun::star::text
;
76 using namespace ::com::sun::star::lang
;
77 using namespace ::com::sun::star::beans
;
78 using namespace ::com::sun::star::util
;
79 using namespace ::com::sun::star::style
;
80 using namespace ::com::sun::star::document
;
81 using namespace ::com::sun::star::container
;
82 using namespace ::xmloff::token
;
85 char const FIELD_SERVICE_SENDER
[] = "ExtendedUser";
86 char const FIELD_SERVICE_AUTHOR
[] = "Author";
87 char const FIELD_SERVICE_JUMPEDIT
[] = "JumpEdit";
88 char const FIELD_SERVICE_GETEXP
[] = "GetExpression";
89 char const FIELD_SERVICE_SETEXP
[] = "SetExpression";
90 char const FIELD_SERVICE_USER
[] = "User";
91 char const FIELD_SERVICE_INPUT
[] = "Input";
92 char const FIELD_SERVICE_USERINPUT
[] = "InputUser";
93 char const FIELD_SERVICE_DATETIME
[] = "DateTime";
94 char const FIELD_SERVICE_PAGENUMBER
[] = "PageNumber";
95 char const FIELD_SERVICE_DB_NEXT
[] = "DatabaseNextSet";
96 char const FIELD_SERVICE_DB_SELECT
[] = "DatabaseNumberOfSet";
97 char const FIELD_SERVICE_DB_NUMBER
[] = "DatabaseSetNumber";
98 char const FIELD_SERVICE_DB_DISPLAY
[] = "Database";
99 char const FIELD_SERVICE_DB_NAME
[] = "DatabaseName";
100 char const FIELD_SERVICE_CONDITIONAL_TEXT
[] = "ConditionalText";
101 char const FIELD_SERVICE_HIDDEN_TEXT
[] = "HiddenText";
102 char const FIELD_SERVICE_HIDDEN_PARAGRAPH
[] = "HiddenParagraph";
103 char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR
[] = "DocInfo.ChangeAuthor";
104 char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2
[] = "docinfo.ChangeAuthor";
105 char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME
[] = "DocInfo.ChangeDateTime";
106 char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2
[] = "docinfo.ChangeDateTime";
107 char const FIELD_SERVICE_DOC_INFO_EDIT_TIME
[] = "DocInfo.EditTime";
108 char const FIELD_SERVICE_DOC_INFO_EDIT_TIME2
[] = "docinfo.EditTime";
109 char const FIELD_SERVICE_DOC_INFO_DESCRIPTION
[] = "DocInfo.Description";
110 char const FIELD_SERVICE_DOC_INFO_DESCRIPTION2
[] = "docinfo.Description";
111 char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR
[] = "DocInfo.CreateAuthor";
112 char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2
[] = "docinfo.CreateAuthor";
113 char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME
[] = "DocInfo.CreateDateTime";
114 char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2
[] = "docinfo.CreateDateTime";
115 char const FIELD_SERVICE_DOC_INFO_CUSTOM
[] = "DocInfo.Custom";
116 char const FIELD_SERVICE_DOC_INFO_CUSTOM2
[] = "docinfo.Custom";
117 char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR
[] = "DocInfo.PrintAuthor";
118 char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2
[] = "docinfo.PrintAuthor";
119 char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME
[] = "DocInfo.PrintDateTime";
120 char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2
[] = "docinfo.PrintDateTime";
121 char const FIELD_SERVICE_DOC_INFO_KEY_WORDS
[] = "DocInfo.KeyWords";
122 char const FIELD_SERVICE_DOC_INFO_KEY_WORDS2
[] = "docinfo.KeyWords";
123 char const FIELD_SERVICE_DOC_INFO_SUBJECT
[] = "DocInfo.Subject";
124 char const FIELD_SERVICE_DOC_INFO_SUBJECT2
[] = "docinfo.Subject";
125 char const FIELD_SERVICE_DOC_INFO_TITLE
[] = "DocInfo.Title";
126 char const FIELD_SERVICE_DOC_INFO_TITLE2
[] = "docinfo.Title";
127 char const FIELD_SERVICE_DOC_INFO_REVISION
[] = "DocInfo.Revision";
128 char const FIELD_SERVICE_DOC_INFO_REVISION2
[] = "docinfo.Revision";
129 char const FIELD_SERVICE_FILE_NAME
[] = "FileName";
130 char const FIELD_SERVICE_CHAPTER
[] = "Chapter";
131 char const FIELD_SERVICE_TEMPLATE_NAME
[] = "TemplateName";
132 char const FIELD_SERVICE_PAGE_COUNT
[] = "PageCount";
133 char const FIELD_SERVICE_PARAGRAPH_COUNT
[] = "ParagraphCount";
134 char const FIELD_SERVICE_WORD_COUNT
[] = "WordCount";
135 char const FIELD_SERVICE_CHARACTER_COUNT
[] = "CharacterCount";
136 char const FIELD_SERVICE_TABLE_COUNT
[] = "TableCount";
137 char const FIELD_SERVICE_GRAPHIC_COUNT
[] = "GraphicObjectCount";
138 char const FIELD_SERVICE_OBJECT_COUNT
[] = "EmbeddedObjectCount";
139 char const FIELD_SERVICE_REFERENCE_PAGE_SET
[] = "ReferencePageSet";
140 char const FIELD_SERVICE_REFERENCE_PAGE_GET
[] = "ReferencePageGet";
141 char const FIELD_SERVICE_SHEET_NAME
[] = "SheetName";
142 char const FIELD_SERVICE_PAGE_NAME
[] = "PageName";
143 char const FIELD_SERVICE_MACRO
[] = "Macro";
144 char const FIELD_SERVICE_GET_REFERENCE
[] = "GetReference";
145 char const FIELD_SERVICE_DDE
[] = "DDE";
146 char const FIELD_SERVICE_URL
[] = "URL";
147 char const FIELD_SERVICE_BIBLIOGRAPHY
[] = "Bibliography";
148 char const FIELD_SERVICE_SCRIPT
[] = "Script";
149 char const FIELD_SERVICE_ANNOTATION
[] = "Annotation";
150 char const FIELD_SERVICE_COMBINED_CHARACTERS
[] = "CombinedCharacters";
151 char const FIELD_SERVICE_META
[] = "MetadataField";
152 char const FIELD_SERVICE_MEASURE
[] = "Measure";
153 char const FIELD_SERVICE_TABLE_FORMULA
[] = "TableFormula";
154 char const FIELD_SERVICE_DROP_DOWN
[] = "DropDown";
158 /// Walks up the parent chain of xText and returns the topmost text.
159 uno::Reference
<text::XText
> GetToplevelText(const uno::Reference
<text::XText
>& xText
)
161 uno::Reference
<text::XText
> xRet
= xText
;
164 uno::Reference
<beans::XPropertySet
> xPropertySet(xRet
, uno::UNO_QUERY
);
165 if (!xPropertySet
.is())
168 if (!xPropertySet
->getPropertySetInfo()->hasPropertyByName(u
"ParentText"_ustr
))
171 uno::Reference
<text::XText
> xParent
;
172 if (xPropertySet
->getPropertyValue(u
"ParentText"_ustr
) >>= xParent
)
173 xRet
= std::move(xParent
);
180 uno::Reference
<css::text::XText
> XTextFromTextRangeProp(const Reference
<XPropertySet
>& xPropSet
)
184 return xPropSet
->getPropertyValue(u
"TextRange"_ustr
).query
<css::text::XText
>();
186 catch (css::uno::Exception
&)
193 SvXMLEnumStringMapEntry
<FieldIdEnum
> const aFieldServiceNameMapping
[] =
195 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SENDER
, FIELD_ID_SENDER
),
196 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_AUTHOR
, FIELD_ID_AUTHOR
),
197 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_JUMPEDIT
, FIELD_ID_PLACEHOLDER
),
198 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GETEXP
, FIELD_ID_VARIABLE_GET
),
199 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SETEXP
, FIELD_ID_VARIABLE_SET
),
200 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USER
, FIELD_ID_USER_GET
),
201 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_INPUT
, FIELD_ID_TEXT_INPUT
),
202 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USERINPUT
, FIELD_ID_USER_INPUT
),
203 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DATETIME
, FIELD_ID_TIME
),
204 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGENUMBER
, FIELD_ID_PAGENUMBER
),
205 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_SET
, FIELD_ID_REFPAGE_SET
),
206 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_GET
, FIELD_ID_REFPAGE_GET
),
208 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NEXT
, FIELD_ID_DATABASE_NEXT
),
209 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_SELECT
, FIELD_ID_DATABASE_SELECT
),
210 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NUMBER
, FIELD_ID_DATABASE_NUMBER
),
211 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_DISPLAY
, FIELD_ID_DATABASE_DISPLAY
),
212 // workaround for #no-bug#: Database/DataBase
213 ENUM_STRING_MAP_ENTRY( "DataBase", FIELD_ID_DATABASE_DISPLAY
),
214 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NAME
, FIELD_ID_DATABASE_NAME
),
216 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR
, FIELD_ID_DOCINFO_CREATION_AUTHOR
),
217 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2
, FIELD_ID_DOCINFO_CREATION_AUTHOR
),
218 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME
, FIELD_ID_DOCINFO_CREATION_TIME
),
219 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2
, FIELD_ID_DOCINFO_CREATION_TIME
),
220 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR
, FIELD_ID_DOCINFO_SAVE_AUTHOR
),
221 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2
, FIELD_ID_DOCINFO_SAVE_AUTHOR
),
222 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME
, FIELD_ID_DOCINFO_SAVE_TIME
),
223 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2
, FIELD_ID_DOCINFO_SAVE_TIME
),
224 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME
, FIELD_ID_DOCINFO_EDIT_DURATION
),
225 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME2
, FIELD_ID_DOCINFO_EDIT_DURATION
),
226 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION
, FIELD_ID_DOCINFO_DESCRIPTION
),
227 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION2
, FIELD_ID_DOCINFO_DESCRIPTION
),
228 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM
, FIELD_ID_DOCINFO_CUSTOM
),
229 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM2
, FIELD_ID_DOCINFO_CUSTOM
),
230 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR
, FIELD_ID_DOCINFO_PRINT_AUTHOR
),
231 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2
, FIELD_ID_DOCINFO_PRINT_AUTHOR
),
232 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME
, FIELD_ID_DOCINFO_PRINT_TIME
),
233 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2
, FIELD_ID_DOCINFO_PRINT_TIME
),
234 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS
, FIELD_ID_DOCINFO_KEYWORDS
),
235 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS2
, FIELD_ID_DOCINFO_KEYWORDS
),
236 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT
, FIELD_ID_DOCINFO_SUBJECT
),
237 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT2
, FIELD_ID_DOCINFO_SUBJECT
),
238 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE
, FIELD_ID_DOCINFO_TITLE
),
239 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE2
, FIELD_ID_DOCINFO_TITLE
),
240 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION
, FIELD_ID_DOCINFO_REVISION
),
241 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION2
, FIELD_ID_DOCINFO_REVISION
),
243 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CONDITIONAL_TEXT
, FIELD_ID_CONDITIONAL_TEXT
),
244 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_TEXT
, FIELD_ID_HIDDEN_TEXT
),
245 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_PARAGRAPH
, FIELD_ID_HIDDEN_PARAGRAPH
),
247 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_FILE_NAME
, FIELD_ID_FILE_NAME
),
248 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHAPTER
, FIELD_ID_CHAPTER
),
249 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TEMPLATE_NAME
, FIELD_ID_TEMPLATE_NAME
),
251 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGE_COUNT
, FIELD_ID_COUNT_PAGES
),
252 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PARAGRAPH_COUNT
, FIELD_ID_COUNT_PARAGRAPHS
),
253 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_WORD_COUNT
, FIELD_ID_COUNT_WORDS
),
254 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHARACTER_COUNT
, FIELD_ID_COUNT_CHARACTERS
),
255 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_COUNT
, FIELD_ID_COUNT_TABLES
),
256 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GRAPHIC_COUNT
, FIELD_ID_COUNT_GRAPHICS
),
257 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_OBJECT_COUNT
, FIELD_ID_COUNT_OBJECTS
),
259 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MACRO
, FIELD_ID_MACRO
),
260 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GET_REFERENCE
, FIELD_ID_REF_REFERENCE
),
261 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DDE
, FIELD_ID_DDE
),
263 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_BIBLIOGRAPHY
, FIELD_ID_BIBLIOGRAPHY
),
265 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SCRIPT
, FIELD_ID_SCRIPT
),
266 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_ANNOTATION
, FIELD_ID_ANNOTATION
),
268 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_COMBINED_CHARACTERS
, FIELD_ID_COMBINED_CHARACTERS
),
269 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_META
, FIELD_ID_META
),
272 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SHEET_NAME
, FIELD_ID_SHEET_NAME
),
273 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGE_NAME
, FIELD_ID_PAGENAME
),
274 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_URL
, FIELD_ID_URL
),
275 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MEASURE
, FIELD_ID_MEASURE
),
278 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_FORMULA
, FIELD_ID_TABLE_FORMULA
),
279 ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DROP_DOWN
, FIELD_ID_DROP_DOWN
),
281 { nullptr, 0, FieldIdEnum(0) }
285 // property accessor helper functions
286 static bool GetBoolProperty(const OUString
&,
287 const Reference
<XPropertySet
> &);
288 static bool GetOptionalBoolProperty(const OUString
&,
289 const Reference
<XPropertySet
> &,
290 const Reference
<XPropertySetInfo
> &,
292 static double GetDoubleProperty(const OUString
&,
293 const Reference
<XPropertySet
> &);
294 static OUString
GetStringProperty(const OUString
&,
295 const Reference
<XPropertySet
> &);
296 static sal_Int32
GetIntProperty(const OUString
&,
297 const Reference
<XPropertySet
> &);
298 static sal_Int16
GetInt16Property(const OUString
&,
299 const Reference
<XPropertySet
> &);
300 static sal_Int8
GetInt8Property(const OUString
&,
301 const Reference
<XPropertySet
> &);
302 static util::DateTime
GetDateTimeProperty( const OUString
& sPropName
,
303 const Reference
<XPropertySet
> & xPropSet
);
304 static Sequence
<OUString
> GetStringSequenceProperty(
305 const OUString
& sPropName
,
306 const Reference
<XPropertySet
> & xPropSet
);
310 constexpr OUString
gsServicePrefix(u
"com.sun.star.text.textfield."_ustr
);
311 constexpr OUStringLiteral
gsFieldMasterPrefix(u
"com.sun.star.text.FieldMaster.");
312 constexpr OUString
gsPresentationServicePrefix(u
"com.sun.star.presentation.TextField."_ustr
);
315 constexpr OUString
gsPropertyAdjust(u
"Adjust"_ustr
);
316 constexpr OUStringLiteral
gsPropertyAuthor(u
"Author");
317 constexpr OUStringLiteral
gsPropertyChapterFormat(u
"ChapterFormat");
318 constexpr OUStringLiteral
gsPropertyChapterNumberingLevel(u
"ChapterNumberingLevel");
319 constexpr OUStringLiteral
gsPropertyCharStyleNames(u
"CharStyleNames");
320 constexpr OUString
gsPropertyCondition(u
"Condition"_ustr
);
321 constexpr OUString
gsPropertyContent(u
"Content"_ustr
);
322 constexpr OUStringLiteral
gsPropertyDataBaseName(u
"DataBaseName");
323 constexpr OUString
gsPropertyDataBaseURL(u
"DataBaseURL"_ustr
);
324 constexpr OUStringLiteral
gsPropertyDataColumnName(u
"DataColumnName");
325 constexpr OUString
gsPropertyDataCommandType(u
"DataCommandType"_ustr
);
326 constexpr OUString
gsPropertyDataTableName(u
"DataTableName"_ustr
);
327 constexpr OUString
gsPropertyDateTime(u
"DateTime"_ustr
);
328 constexpr OUString
gsPropertyDateTimeValue(u
"DateTimeValue"_ustr
);
329 constexpr OUStringLiteral
gsPropertyDDECommandElement(u
"DDECommandElement");
330 constexpr OUStringLiteral
gsPropertyDDECommandFile(u
"DDECommandFile");
331 constexpr OUStringLiteral
gsPropertyDDECommandType(u
"DDECommandType");
332 constexpr OUStringLiteral
gsPropertyDependentTextFields(u
"DependentTextFields");
333 constexpr OUStringLiteral
gsPropertyFalseContent(u
"FalseContent");
334 constexpr OUStringLiteral
gsPropertyFields(u
"Fields");
335 constexpr OUStringLiteral
gsPropertyFieldSubType(u
"UserDataType");
336 constexpr OUString
gsPropertyFileFormat(u
"FileFormat"_ustr
);
337 constexpr OUStringLiteral
gsPropertyFullName(u
"FullName");
338 constexpr OUString
gsPropertyHint(u
"Hint"_ustr
);
339 constexpr OUStringLiteral
gsPropertyInitials(u
"Initials");
340 constexpr OUStringLiteral
gsPropertyInstanceName(u
"InstanceName");
341 constexpr OUStringLiteral
gsPropertyIsAutomaticUpdate(u
"IsAutomaticUpdate");
342 constexpr OUStringLiteral
gsPropertyIsConditionTrue(u
"IsConditionTrue");
343 constexpr OUString
gsPropertyIsDataBaseFormat(u
"DataBaseFormat"_ustr
);
344 constexpr OUString
gsPropertyIsDate(u
"IsDate"_ustr
);
345 constexpr OUString
gsPropertyIsExpression(u
"IsExpression"_ustr
);
346 constexpr OUString
gsPropertyIsFixed(u
"IsFixed"_ustr
);
347 constexpr OUString
gsPropertyIsFixedLanguage(u
"IsFixedLanguage"_ustr
);
348 constexpr OUString
gsPropertyIsHidden(u
"IsHidden"_ustr
);
349 constexpr OUStringLiteral
gsPropertyIsInput(u
"Input");
350 constexpr OUString
gsPropertyIsShowFormula(u
"IsShowFormula"_ustr
);
351 constexpr OUString
gsPropertyIsVisible(u
"IsVisible"_ustr
);
352 constexpr OUStringLiteral
gsPropertyItems(u
"Items");
353 constexpr OUStringLiteral
gsPropertyLevel(u
"Level");
354 constexpr OUStringLiteral
gsPropertyMeasureKind(u
"Kind");
355 constexpr OUString
gsPropertyName(u
"Name"_ustr
);
356 constexpr OUStringLiteral
gsPropertyParentName(u
"ParentName");
357 constexpr OUString
gsPropertyNumberFormat(u
"NumberFormat"_ustr
);
358 constexpr OUStringLiteral
gsPropertyNumberingSeparator(u
"NumberingSeparator");
359 constexpr OUString
gsPropertyNumberingType(u
"NumberingType"_ustr
);
360 constexpr OUString
gsPropertyOffset(u
"Offset"_ustr
);
361 constexpr OUStringLiteral
gsPropertyOn(u
"On");
362 constexpr OUStringLiteral
gsPropertyPlaceholderType(u
"PlaceHolderType");
363 constexpr OUString
gsPropertyReferenceFieldFlags(u
"ReferenceFieldFlags"_ustr
);
364 constexpr OUString
gsPropertyReferenceFieldPart(u
"ReferenceFieldPart"_ustr
);
365 constexpr OUString
gsPropertyReferenceFieldSource(u
"ReferenceFieldSource"_ustr
);
366 constexpr OUString
gsPropertyReferenceFieldLanguage(u
"ReferenceFieldLanguage"_ustr
);
367 constexpr OUStringLiteral
gsPropertyScriptType(u
"ScriptType");
368 constexpr OUStringLiteral
gsPropertySelectedItem(u
"SelectedItem");
369 constexpr OUString
gsPropertySequenceNumber(u
"SequenceNumber"_ustr
);
370 constexpr OUStringLiteral
gsPropertySequenceValue(u
"SequenceValue");
371 constexpr OUString
gsPropertySetNumber(u
"SetNumber"_ustr
);
372 constexpr OUString
gsPropertySourceName(u
"SourceName"_ustr
);
373 constexpr OUString
gsPropertySubType(u
"SubType"_ustr
);
374 constexpr OUStringLiteral
gsPropertyTargetFrame(u
"TargetFrame");
375 constexpr OUStringLiteral
gsPropertyTrueContent(u
"TrueContent");
376 constexpr OUStringLiteral
gsPropertyURL(u
"URL");
377 constexpr OUStringLiteral
gsPropertyURLContent(u
"URLContent");
378 constexpr OUStringLiteral
gsPropertyUserText(u
"UserText");
379 constexpr OUString
gsPropertyValue(u
"Value"_ustr
);
380 constexpr OUString
gsPropertyVariableName(u
"VariableName"_ustr
);
381 constexpr OUString
gsPropertyHelp(u
"Help"_ustr
);
382 constexpr OUString
gsPropertyTooltip(u
"Tooltip"_ustr
);
384 XMLTextFieldExport::XMLTextFieldExport( SvXMLExport
& rExp
,
385 std::unique_ptr
<XMLPropertyState
> pCombinedCharState
)
387 pCombinedCharactersPropertyState(std::move(pCombinedCharState
))
389 SetExportOnlyUsedFieldDeclarations();
392 XMLTextFieldExport::~XMLTextFieldExport()
396 /// get the field ID (as in FieldIDEnum) from XTextField
397 enum FieldIdEnum
XMLTextFieldExport::GetFieldID(
398 const Reference
<XTextField
> & rTextField
,
399 const Reference
<XPropertySet
> & xPropSet
)
401 // get service names for rTextField (via XServiceInfo service)
402 Reference
<XServiceInfo
> xService(rTextField
, UNO_QUERY
);
403 const Sequence
<OUString
> aServices
= xService
->getSupportedServiceNames();
405 OUString sFieldName
; // service name postfix of current field
407 // search for TextField service name
408 const OUString
* pNames
= std::find_if(aServices
.begin(), aServices
.end(),
409 [](const OUString
& rName
) { return rName
.matchIgnoreAsciiCase(gsServicePrefix
); });
410 if (pNames
!= aServices
.end())
412 // TextField found => postfix is field type!
413 sFieldName
= pNames
->copy(gsServicePrefix
.getLength());
416 // if this is not a normal text field, check if it's a presentation text field
417 if( sFieldName
.isEmpty() )
419 // search for TextField service name
420 pNames
= std::find_if(aServices
.begin(), aServices
.end(),
421 [](const OUString
& rName
) { return rName
.startsWith(gsPresentationServicePrefix
); });
422 if (pNames
!= aServices
.end())
424 // TextField found => postfix is field type!
425 sFieldName
= pNames
->copy(gsPresentationServicePrefix
.getLength());
428 if( !sFieldName
.isEmpty() )
430 if( sFieldName
== "Header" )
432 return FIELD_ID_DRAW_HEADER
;
434 else if( sFieldName
== "Footer" )
436 return FIELD_ID_DRAW_FOOTER
;
438 else if( sFieldName
== "DateTime" )
440 return FIELD_ID_DRAW_DATE_TIME
;
445 // map postfix of service name to field ID
446 DBG_ASSERT(!sFieldName
.isEmpty(), "no TextField service found!");
447 return MapFieldName(sFieldName
, xPropSet
);
450 enum FieldIdEnum
XMLTextFieldExport::MapFieldName(
451 std::u16string_view sFieldName
, // field (master) name
452 const Reference
<XPropertySet
> & xPropSet
) // for subtype
454 // we'll proceed in 2 steps:
455 // a) map service name to preliminary FIELD_ID
456 // b) map those prelim. FIELD_IDs that correspond to several field types
457 // (in our (XML) world) to final FIELD IDs
460 // a) find prelim. FIELD_ID via aFieldServiceMapping
462 // check for non-empty service name
463 DBG_ASSERT(!sFieldName
.empty(), "no valid service name!");
464 enum FieldIdEnum nToken
= FIELD_ID_UNKNOWN
;
465 if (!sFieldName
.empty())
467 // map name to prelim. ID
468 bool bRet
= SvXMLUnitConverter::convertEnum(
469 nToken
, sFieldName
, aFieldServiceNameMapping
);
472 DBG_ASSERT(bRet
, "Unknown field service name encountered!");
475 // b) map prelim. to final FIELD_IDs
477 case FIELD_ID_VARIABLE_SET
:
478 if (GetBoolProperty(gsPropertyIsInput
, xPropSet
))
480 nToken
= FIELD_ID_VARIABLE_INPUT
;
484 switch (GetIntProperty(gsPropertySubType
, xPropSet
))
486 case SetVariableType::STRING
: // text field
487 case SetVariableType::VAR
: // num field
488 nToken
= FIELD_ID_VARIABLE_SET
;
490 case SetVariableType::SEQUENCE
:
491 nToken
= FIELD_ID_SEQUENCE
;
493 case SetVariableType::FORMULA
:
495 nToken
= FIELD_ID_UNKNOWN
;
501 case FIELD_ID_VARIABLE_GET
:
502 switch (GetIntProperty(gsPropertySubType
, xPropSet
))
504 case SetVariableType::STRING
: // text field
505 case SetVariableType::VAR
: // num field
506 nToken
= FIELD_ID_VARIABLE_GET
;
508 case SetVariableType::FORMULA
:
509 nToken
= FIELD_ID_EXPRESSION
;
511 case SetVariableType::SEQUENCE
:
513 nToken
= FIELD_ID_UNKNOWN
;
519 if (GetBoolProperty(gsPropertyIsDate
, xPropSet
))
521 nToken
= FIELD_ID_DATE
;
525 case FIELD_ID_PAGENUMBER
:
526 // NumberingType not available in non-Writer apps
527 if (xPropSet
->getPropertySetInfo()->
528 hasPropertyByName(gsPropertyNumberingType
))
530 if (NumberingType::CHAR_SPECIAL
== GetIntProperty(
531 gsPropertyNumberingType
, xPropSet
))
533 nToken
= FIELD_ID_PAGESTRING
;
538 case FIELD_ID_DOCINFO_CREATION_TIME
:
539 if (GetBoolProperty(gsPropertyIsDate
, xPropSet
))
541 nToken
= FIELD_ID_DOCINFO_CREATION_DATE
;
545 case FIELD_ID_DOCINFO_PRINT_TIME
:
546 if (GetBoolProperty(gsPropertyIsDate
, xPropSet
))
548 nToken
= FIELD_ID_DOCINFO_PRINT_DATE
;
552 case FIELD_ID_DOCINFO_SAVE_TIME
:
553 if (GetBoolProperty(gsPropertyIsDate
, xPropSet
))
555 nToken
= FIELD_ID_DOCINFO_SAVE_DATE
;
559 case FIELD_ID_REF_REFERENCE
:
560 switch (GetInt16Property(gsPropertyReferenceFieldSource
, xPropSet
))
562 case ReferenceFieldSource::REFERENCE_MARK
:
563 nToken
= FIELD_ID_REF_REFERENCE
;
565 case ReferenceFieldSource::SEQUENCE_FIELD
:
566 nToken
= FIELD_ID_REF_SEQUENCE
;
568 case ReferenceFieldSource::BOOKMARK
:
569 nToken
= FIELD_ID_REF_BOOKMARK
;
571 case ReferenceFieldSource::FOOTNOTE
:
572 nToken
= FIELD_ID_REF_FOOTNOTE
;
574 case ReferenceFieldSource::ENDNOTE
:
575 nToken
= FIELD_ID_REF_ENDNOTE
;
577 case ReferenceFieldSource::STYLE
:
578 nToken
= FIELD_ID_REF_STYLE
;
581 nToken
= FIELD_ID_UNKNOWN
;
586 case FIELD_ID_COMBINED_CHARACTERS
:
587 case FIELD_ID_SCRIPT
:
588 case FIELD_ID_ANNOTATION
:
589 case FIELD_ID_BIBLIOGRAPHY
:
592 case FIELD_ID_REFPAGE_SET
:
593 case FIELD_ID_REFPAGE_GET
:
594 case FIELD_ID_COUNT_PAGES
:
595 case FIELD_ID_COUNT_PARAGRAPHS
:
596 case FIELD_ID_COUNT_WORDS
:
597 case FIELD_ID_COUNT_CHARACTERS
:
598 case FIELD_ID_COUNT_TABLES
:
599 case FIELD_ID_COUNT_GRAPHICS
:
600 case FIELD_ID_COUNT_OBJECTS
:
601 case FIELD_ID_CONDITIONAL_TEXT
:
602 case FIELD_ID_HIDDEN_TEXT
:
603 case FIELD_ID_HIDDEN_PARAGRAPH
:
604 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
605 case FIELD_ID_DOCINFO_DESCRIPTION
:
606 case FIELD_ID_DOCINFO_CUSTOM
:
607 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
608 case FIELD_ID_DOCINFO_TITLE
:
609 case FIELD_ID_DOCINFO_SUBJECT
:
610 case FIELD_ID_DOCINFO_KEYWORDS
:
611 case FIELD_ID_DOCINFO_REVISION
:
612 case FIELD_ID_DOCINFO_EDIT_DURATION
:
613 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
614 case FIELD_ID_TEXT_INPUT
:
615 case FIELD_ID_USER_INPUT
:
616 case FIELD_ID_AUTHOR
:
617 case FIELD_ID_SENDER
:
618 case FIELD_ID_PLACEHOLDER
:
619 case FIELD_ID_USER_GET
:
620 case FIELD_ID_DATABASE_NEXT
:
621 case FIELD_ID_DATABASE_SELECT
:
622 case FIELD_ID_DATABASE_DISPLAY
:
623 case FIELD_ID_DATABASE_NAME
:
624 case FIELD_ID_DATABASE_NUMBER
:
625 case FIELD_ID_TEMPLATE_NAME
:
626 case FIELD_ID_CHAPTER
:
627 case FIELD_ID_FILE_NAME
:
629 case FIELD_ID_SHEET_NAME
:
630 case FIELD_ID_PAGENAME
:
631 case FIELD_ID_MEASURE
:
633 case FIELD_ID_TABLE_FORMULA
:
634 case FIELD_ID_DROP_DOWN
:
635 ; // these field IDs are final
639 nToken
= FIELD_ID_UNKNOWN
;
642 // ... and return final FIELD_ID
646 // is string or numeric field?
647 bool XMLTextFieldExport::IsStringField(
648 FieldIdEnum nFieldType
,
649 const Reference
<XPropertySet
> & xPropSet
)
651 switch (nFieldType
) {
653 case FIELD_ID_VARIABLE_GET
:
654 case FIELD_ID_VARIABLE_SET
:
655 case FIELD_ID_VARIABLE_INPUT
:
657 // depends on field sub type
658 return ( GetIntProperty(gsPropertySubType
, xPropSet
) ==
659 SetVariableType::STRING
);
662 case FIELD_ID_USER_GET
:
663 case FIELD_ID_USER_INPUT
:
665 Reference
<XTextField
> xTextField(xPropSet
, UNO_QUERY
);
666 DBG_ASSERT(xTextField
.is(), "field is no XTextField!");
667 bool bRet
= GetBoolProperty(gsPropertyIsExpression
,
668 GetMasterPropertySet(xTextField
));
673 return 0 > GetIntProperty(gsPropertyNumberFormat
, xPropSet
);
675 case FIELD_ID_DATABASE_DISPLAY
:
676 // TODO: depends on... ???
677 // workaround #no-bug#: no data type
678 return 5100 == GetIntProperty(gsPropertyNumberFormat
, xPropSet
);
680 case FIELD_ID_TABLE_FORMULA
:
681 // legacy field: always a number field (because it always has
685 case FIELD_ID_COUNT_PAGES
:
686 case FIELD_ID_COUNT_PARAGRAPHS
:
687 case FIELD_ID_COUNT_WORDS
:
688 case FIELD_ID_COUNT_CHARACTERS
:
689 case FIELD_ID_COUNT_TABLES
:
690 case FIELD_ID_COUNT_GRAPHICS
:
691 case FIELD_ID_COUNT_OBJECTS
:
692 case FIELD_ID_DOCINFO_SAVE_TIME
:
693 case FIELD_ID_DOCINFO_SAVE_DATE
:
694 case FIELD_ID_DOCINFO_CREATION_DATE
:
695 case FIELD_ID_DOCINFO_CREATION_TIME
:
696 case FIELD_ID_DOCINFO_PRINT_TIME
:
697 case FIELD_ID_DOCINFO_PRINT_DATE
:
698 case FIELD_ID_DOCINFO_EDIT_DURATION
:
699 case FIELD_ID_DOCINFO_REVISION
:
700 case FIELD_ID_DATABASE_NUMBER
:
701 case FIELD_ID_EXPRESSION
:
702 case FIELD_ID_SEQUENCE
:
705 case FIELD_ID_PAGENUMBER
:
706 case FIELD_ID_REFPAGE_SET
:
707 case FIELD_ID_REFPAGE_GET
:
708 case FIELD_ID_DOCINFO_CUSTOM
:
712 case FIELD_ID_COMBINED_CHARACTERS
:
713 case FIELD_ID_BIBLIOGRAPHY
:
715 case FIELD_ID_REF_REFERENCE
:
716 case FIELD_ID_REF_SEQUENCE
:
717 case FIELD_ID_REF_BOOKMARK
:
718 case FIELD_ID_REF_FOOTNOTE
:
719 case FIELD_ID_REF_ENDNOTE
:
720 case FIELD_ID_REF_STYLE
:
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_PRINT_AUTHOR
:
731 case FIELD_ID_DOCINFO_TITLE
:
732 case FIELD_ID_DOCINFO_SUBJECT
:
733 case FIELD_ID_DOCINFO_KEYWORDS
:
734 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
735 case FIELD_ID_DATABASE_NAME
:
736 case FIELD_ID_TEXT_INPUT
:
737 case FIELD_ID_SENDER
:
738 case FIELD_ID_AUTHOR
:
739 case FIELD_ID_PAGENAME
:
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_PLACEHOLDER
:
753 case FIELD_ID_UNKNOWN
:
754 case FIELD_ID_DRAW_HEADER
:
755 case FIELD_ID_DRAW_FOOTER
:
756 case FIELD_ID_DRAW_DATE_TIME
:
758 OSL_FAIL("unknown field type/field has no content");
759 return true; // invalid info; string in case of doubt
763 /// export the styles needed by the given field. Called on first pass
765 void XMLTextFieldExport::ExportFieldAutoStyle(
766 const Reference
<XTextField
> & rTextField
, const bool bProgress
,
767 const bool bRecursive
)
770 Reference
<XPropertySet
> xPropSet(rTextField
, UNO_QUERY
);
772 // add field master to list of used field masters (if desired)
775 Reference
<XDependentTextField
> xDepField(rTextField
, UNO_QUERY
);
778 // The direct parent may be just the table cell, while we want the topmost parent, e.g.
780 Reference
<XText
> xOurText
= GetToplevelText(rTextField
->getAnchor()->getText());
782 // insert a list for our XText (if necessary)
783 auto aMapIter
= moUsedMasters
->try_emplace(xOurText
).first
;
784 assert(aMapIter
!= moUsedMasters
->end());
786 // insert this text field master
787 OUString sFieldMasterName
= GetStringProperty(
788 gsPropertyInstanceName
, xDepField
->getTextFieldMaster());
789 if (!sFieldMasterName
.isEmpty())
790 aMapIter
->second
.insert( sFieldMasterName
);
792 // else: no dependent field -> no master -> ignore
796 FieldIdEnum nToken
= GetFieldID(rTextField
, xPropSet
);
798 // export the character style for all fields
799 // with one exception: combined character fields export their own
801 Reference
<XPropertySet
> xRangePropSet(rTextField
->getAnchor(), UNO_QUERY
);
802 if (FIELD_ID_COMBINED_CHARACTERS
!= nToken
)
804 GetExport().GetTextParagraphExport()->Add(
805 XmlStyleFamily::TEXT_TEXT
, xRangePropSet
);
808 // process special styles for each field (e.g. data styles)
811 case FIELD_ID_DATABASE_DISPLAY
:
813 sal_Int32 nFormat
= GetIntProperty(gsPropertyNumberFormat
, xPropSet
);
814 // workaround: #no-bug#; see IsStringField(...)
815 if ( (5100 != nFormat
) &&
816 !GetBoolProperty(gsPropertyIsDataBaseFormat
, xPropSet
) )
818 GetExport().addDataStyle(nFormat
);
826 // date and time fields are always number fields, but the
827 // NumberFormat property is optional (e.g. Calc doesn't
829 Reference
<XPropertySetInfo
> xPropSetInfo(
830 xPropSet
->getPropertySetInfo() );
831 if ( xPropSetInfo
->hasPropertyByName( gsPropertyNumberFormat
) )
834 GetIntProperty(gsPropertyNumberFormat
, xPropSet
);
836 // nFormat may be -1 for numeric fields that display their
837 // variable name. (Maybe this should be a field type, then?)
840 if( ! GetOptionalBoolProperty(
841 gsPropertyIsFixedLanguage
,
842 xPropSet
, xPropSetInfo
, false ) )
845 GetExport().dataStyleForceSystemLanguage(nFormat
);
848 GetExport().addDataStyle( nFormat
,
849 nToken
== FIELD_ID_TIME
);
856 // recurse into content (does not export element, so can be done first)
859 bool dummy_for_autostyles(true);
860 ExportMetaField(xPropSet
, true, bProgress
, dummy_for_autostyles
);
863 case FIELD_ID_DOCINFO_PRINT_TIME
:
864 case FIELD_ID_DOCINFO_PRINT_DATE
:
865 case FIELD_ID_DOCINFO_CREATION_DATE
:
866 case FIELD_ID_DOCINFO_CREATION_TIME
:
867 case FIELD_ID_DOCINFO_SAVE_TIME
:
868 case FIELD_ID_DOCINFO_SAVE_DATE
:
869 case FIELD_ID_DOCINFO_EDIT_DURATION
:
870 case FIELD_ID_VARIABLE_SET
:
871 case FIELD_ID_VARIABLE_GET
:
872 case FIELD_ID_VARIABLE_INPUT
:
873 case FIELD_ID_USER_GET
:
874 case FIELD_ID_EXPRESSION
:
875 case FIELD_ID_TABLE_FORMULA
:
876 case FIELD_ID_DOCINFO_CUSTOM
:
877 // register number format, if this is a numeric field
878 if (! IsStringField(nToken
, xPropSet
)) {
881 GetIntProperty(gsPropertyNumberFormat
, xPropSet
);
883 // nFormat may be -1 for numeric fields that display their
884 // variable name. (Maybe this should be a field type, then?)
887 // handle formats for fixed language fields
888 // for all these fields (except table formula)
889 if( ( nToken
!= FIELD_ID_TABLE_FORMULA
) &&
890 ! GetOptionalBoolProperty(
891 gsPropertyIsFixedLanguage
,
892 xPropSet
, xPropSet
->getPropertySetInfo(),
896 GetExport().dataStyleForceSystemLanguage(nFormat
);
899 GetExport().addDataStyle(nFormat
);
904 case FIELD_ID_COMBINED_CHARACTERS
:
906 // export text style with the addition of the combined characters
907 DBG_ASSERT(nullptr != pCombinedCharactersPropertyState
,
908 "need proper PropertyState for combined characters");
909 std::span
<XMLPropertyState
> aStates( pCombinedCharactersPropertyState
.get(), 1 );
910 GetExport().GetTextParagraphExport()->Add(
911 XmlStyleFamily::TEXT_TEXT
, xRangePropSet
,
916 case FIELD_ID_ANNOTATION
:
917 if (auto xText
= XTextFromTextRangeProp(xPropSet
))
918 GetExport().GetTextParagraphExport()->collectTextAutoStyles(xText
, bProgress
);
921 case FIELD_ID_SCRIPT
:
922 case FIELD_ID_BIBLIOGRAPHY
:
924 case FIELD_ID_REF_REFERENCE
:
925 case FIELD_ID_REF_SEQUENCE
:
926 case FIELD_ID_REF_BOOKMARK
:
927 case FIELD_ID_REF_FOOTNOTE
:
928 case FIELD_ID_REF_ENDNOTE
:
929 case FIELD_ID_REF_STYLE
:
931 case FIELD_ID_REFPAGE_SET
:
932 case FIELD_ID_REFPAGE_GET
:
933 case FIELD_ID_COUNT_PAGES
:
934 case FIELD_ID_COUNT_PARAGRAPHS
:
935 case FIELD_ID_COUNT_WORDS
:
936 case FIELD_ID_COUNT_CHARACTERS
:
937 case FIELD_ID_COUNT_TABLES
:
938 case FIELD_ID_COUNT_GRAPHICS
:
939 case FIELD_ID_COUNT_OBJECTS
:
940 case FIELD_ID_CONDITIONAL_TEXT
:
941 case FIELD_ID_HIDDEN_TEXT
:
942 case FIELD_ID_HIDDEN_PARAGRAPH
:
943 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
944 case FIELD_ID_DOCINFO_DESCRIPTION
:
945 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
946 case FIELD_ID_DOCINFO_TITLE
:
947 case FIELD_ID_DOCINFO_SUBJECT
:
948 case FIELD_ID_DOCINFO_KEYWORDS
:
949 case FIELD_ID_DOCINFO_REVISION
:
950 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
951 case FIELD_ID_SEQUENCE
:
952 case FIELD_ID_PAGENAME
:
953 case FIELD_ID_PAGENUMBER
:
954 case FIELD_ID_PAGESTRING
:
955 case FIELD_ID_AUTHOR
:
956 case FIELD_ID_SENDER
:
957 case FIELD_ID_PLACEHOLDER
:
958 case FIELD_ID_USER_INPUT
:
959 case FIELD_ID_TEXT_INPUT
:
960 case FIELD_ID_DATABASE_NEXT
:
961 case FIELD_ID_DATABASE_SELECT
:
962 case FIELD_ID_DATABASE_NAME
:
963 case FIELD_ID_DATABASE_NUMBER
:
964 case FIELD_ID_TEMPLATE_NAME
:
965 case FIELD_ID_CHAPTER
:
966 case FIELD_ID_FILE_NAME
:
967 case FIELD_ID_SHEET_NAME
:
968 case FIELD_ID_MEASURE
:
970 case FIELD_ID_DROP_DOWN
:
971 case FIELD_ID_DRAW_DATE_TIME
:
972 case FIELD_ID_DRAW_FOOTER
:
973 case FIELD_ID_DRAW_HEADER
:
974 ; // no formats for these fields!
977 case FIELD_ID_UNKNOWN
:
979 OSL_FAIL("unknown field type!");
980 // ignore -> no format for unknown
985 /// export the given field to XML. Called on second pass through document
986 void XMLTextFieldExport::ExportField(
987 const Reference
<XTextField
> & rTextField
, bool bProgress
,
988 bool & rPrevCharIsSpace
)
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
.get(), nullptr };
1002 const XMLPropertyState
**pStates
=
1003 FIELD_ID_COMBINED_CHARACTERS
== nToken
1007 // find out whether we need to set the style
1008 bool bIsUICharStyle
;
1010 OUString sStyle
= GetExport().GetTextParagraphExport()->
1011 FindTextStyle( xRangePropSet
, bIsUICharStyle
, bHasAutoStyle
, pStates
);
1012 bool bHasStyle
= !sStyle
.isEmpty();
1015 Reference
<XPropertySetInfo
> xRangePropSetInfo
;
1016 XMLTextCharStyleNamesElementExport
aCharStylesExport(
1017 GetExport(), bIsUICharStyle
&&
1018 GetExport().GetTextParagraphExport()
1019 ->GetCharStyleNamesPropInfoCache().hasProperty(
1020 xRangePropSet
, xRangePropSetInfo
), bHasAutoStyle
,
1021 xRangePropSet
, gsPropertyCharStyleNames
);
1023 // export span with style (if necessary)
1024 // (except for combined characters field)
1027 // export <text:span> element
1028 GetExport().AddAttribute( XML_NAMESPACE_TEXT
, XML_STYLE_NAME
,
1029 GetExport().EncodeStyleName( sStyle
) );
1031 SvXMLElementExport
aSpan( GetExport(), bHasStyle
,
1032 XML_NAMESPACE_TEXT
, XML_SPAN
,
1035 // finally, export the field itself
1036 ExportFieldHelper( rTextField
, xPropSet
, xRangePropSet
, nToken
,
1037 bProgress
, rPrevCharIsSpace
);
1041 /// export the given field to XML. Called on second pass through document
1042 void XMLTextFieldExport::ExportFieldHelper(
1043 const Reference
<XTextField
> & rTextField
,
1044 const Reference
<XPropertySet
> & rPropSet
,
1045 const Reference
<XPropertySet
> &,
1046 enum FieldIdEnum nToken
,
1048 bool & rPrevCharIsSpace
)
1050 // get property set info (because some attributes are not support
1051 // in all implementations)
1052 Reference
<XPropertySetInfo
> xPropSetInfo(rPropSet
->getPropertySetInfo());
1054 OUString sPresentation
= rTextField
->getPresentation(false);
1056 // process each field type
1058 case FIELD_ID_AUTHOR
:
1059 // author field: fixed, field (sub-)type
1060 if (xPropSetInfo
->hasPropertyByName(gsPropertyIsFixed
))
1062 GetExport().AddAttribute(XML_NAMESPACE_TEXT
, XML_FIXED
,
1063 (GetBoolProperty(gsPropertyIsFixed
, rPropSet
) ? XML_TRUE
: XML_FALSE
) );
1065 ExportElement(MapAuthorFieldName(rPropSet
), sPresentation
);
1068 case FIELD_ID_SENDER
:
1069 // sender field: fixed, field (sub-)type
1070 ProcessBoolean(XML_FIXED
,
1071 GetBoolProperty(gsPropertyIsFixed
, rPropSet
), true);
1072 ExportElement(MapSenderFieldName(rPropSet
), sPresentation
);
1075 case FIELD_ID_PLACEHOLDER
:
1076 // placeholder field: type, name, description
1077 ProcessString(XML_PLACEHOLDER_TYPE
,
1079 GetInt16Property(gsPropertyPlaceholderType
, rPropSet
)));
1080 ProcessString(XML_DESCRIPTION
,
1081 GetStringProperty(gsPropertyHint
,rPropSet
), true);
1082 ExportElement(XML_PLACEHOLDER
, sPresentation
);
1085 case FIELD_ID_VARIABLE_SET
:
1087 // variable set field: name, visible, format&value
1088 ProcessString(XML_NAME
,
1089 GetStringProperty(gsPropertyVariableName
, rPropSet
));
1090 ProcessDisplay(GetBoolProperty(gsPropertyIsVisible
, rPropSet
),
1092 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1093 GetStringProperty(gsPropertyContent
, rPropSet
),
1095 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1096 GetIntProperty(gsPropertyNumberFormat
, rPropSet
),
1097 GetStringProperty(gsPropertyContent
, rPropSet
),
1099 GetDoubleProperty(gsPropertyValue
, rPropSet
),
1101 ! GetOptionalBoolProperty(
1102 gsPropertyIsFixedLanguage
,
1103 rPropSet
, xPropSetInfo
, false ) );
1104 ExportElement(XML_VARIABLE_SET
, sPresentation
);
1107 case FIELD_ID_VARIABLE_GET
:
1109 // variable get field: name, format&value
1110 ProcessString(XML_NAME
,
1111 GetStringProperty(gsPropertyContent
, rPropSet
));
1112 bool bCmd
= GetBoolProperty(gsPropertyIsShowFormula
, rPropSet
);
1113 ProcessDisplay(true, bCmd
);
1114 // show style, unless name will be shown
1115 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1116 GetIntProperty(gsPropertyNumberFormat
, rPropSet
),
1117 u
""_ustr
, u
"", 0.0, // values not used
1121 ! GetOptionalBoolProperty(
1122 gsPropertyIsFixedLanguage
,
1123 rPropSet
, xPropSetInfo
, false ) );
1124 ExportElement(XML_VARIABLE_GET
, sPresentation
);
1127 case FIELD_ID_VARIABLE_INPUT
:
1128 // variable input field: name, description, format&value
1129 ProcessString(XML_NAME
,
1130 GetStringProperty(gsPropertyVariableName
, rPropSet
));
1131 ProcessString(XML_DESCRIPTION
,
1132 GetStringProperty(gsPropertyHint
, rPropSet
));
1133 ProcessDisplay(GetBoolProperty(gsPropertyIsVisible
, rPropSet
),
1135 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1136 GetStringProperty(gsPropertyContent
, rPropSet
),
1138 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1139 GetIntProperty(gsPropertyNumberFormat
, rPropSet
),
1140 GetStringProperty(gsPropertyContent
, rPropSet
),
1142 GetDoubleProperty(gsPropertyValue
, rPropSet
),
1144 ! GetOptionalBoolProperty(
1145 gsPropertyIsFixedLanguage
,
1146 rPropSet
, xPropSetInfo
, false ) );
1147 ExportElement(XML_VARIABLE_INPUT
, sPresentation
);
1150 case FIELD_ID_USER_GET
:
1151 // user field: name, hidden, style
1153 bool bCmd
= GetBoolProperty(gsPropertyIsShowFormula
, rPropSet
);
1154 ProcessDisplay(GetBoolProperty(gsPropertyIsVisible
, rPropSet
),
1156 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1157 GetIntProperty(gsPropertyNumberFormat
, rPropSet
),
1158 u
""_ustr
, u
"", 0.0, // values not used
1159 false, false, !bCmd
,
1160 ! GetOptionalBoolProperty(
1161 gsPropertyIsFixedLanguage
,
1162 rPropSet
, xPropSetInfo
, false ) );
1164 // name from FieldMaster
1165 ProcessString(XML_NAME
,
1166 GetStringProperty(gsPropertyName
,
1167 GetMasterPropertySet(rTextField
)));
1168 ExportElement(XML_USER_FIELD_GET
, sPresentation
);
1172 case FIELD_ID_USER_INPUT
:
1173 // user input field: name (from FieldMaster), description
1174 // ProcessString(XML_NAME,
1175 // GetStringProperty(sPropertyName,
1176 // GetMasterPropertySet(rTextField)));
1177 ProcessString(XML_NAME
,
1178 GetStringProperty(gsPropertyContent
, rPropSet
));
1179 ProcessString(XML_DESCRIPTION
,
1180 GetStringProperty(gsPropertyHint
, rPropSet
));
1181 ExportElement(XML_USER_FIELD_INPUT
, sPresentation
);
1184 case FIELD_ID_SEQUENCE
:
1186 // sequence field: name, formula, seq-format
1187 OUString sName
= GetStringProperty(gsPropertyVariableName
, rPropSet
);
1188 // TODO: use reference name only if actually being referenced.
1189 ProcessString(XML_REF_NAME
,
1190 MakeSequenceRefName(
1191 GetInt16Property(gsPropertySequenceValue
, rPropSet
),
1193 ProcessString(XML_NAME
, sName
);
1194 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1195 GetStringProperty(gsPropertyContent
, rPropSet
),
1197 ProcessNumberingType(GetInt16Property(gsPropertyNumberingType
,
1199 ExportElement(XML_SEQUENCE
, sPresentation
);
1203 case FIELD_ID_EXPRESSION
:
1205 // formula field: formula, format&value
1206 bool bCmd
= GetBoolProperty(gsPropertyIsShowFormula
, rPropSet
);
1207 ProcessString(XML_FORMULA
, XML_NAMESPACE_OOOW
,
1208 GetStringProperty(gsPropertyContent
, rPropSet
),
1210 ProcessDisplay(true, bCmd
);
1211 ProcessValueAndType(IsStringField(nToken
, rPropSet
),
1212 GetIntProperty(gsPropertyNumberFormat
, rPropSet
),
1213 GetStringProperty(gsPropertyContent
, rPropSet
),
1215 GetDoubleProperty(gsPropertyValue
, rPropSet
),
1216 !bCmd
, !bCmd
, !bCmd
,
1217 ! GetOptionalBoolProperty(
1218 gsPropertyIsFixedLanguage
,
1219 rPropSet
, xPropSetInfo
, false ) );
1220 ExportElement(XML_EXPRESSION
, sPresentation
);
1224 case FIELD_ID_TEXT_INPUT
:
1225 // text input field: description and string-value
1226 ProcessString(XML_DESCRIPTION
,
1227 GetStringProperty(gsPropertyHint
, rPropSet
));
1228 ProcessString(XML_HELP
,
1229 GetStringProperty(gsPropertyHelp
, rPropSet
), true);
1230 ProcessString(XML_HINT
,
1231 GetStringProperty(gsPropertyTooltip
, rPropSet
), true);
1232 ExportElement(XML_TEXT_INPUT
, sPresentation
);
1236 // all properties (except IsDate) are optional!
1237 if (xPropSetInfo
->hasPropertyByName(gsPropertyNumberFormat
))
1239 ProcessValueAndType(false,
1240 GetIntProperty(gsPropertyNumberFormat
,rPropSet
),
1241 u
""_ustr
, u
"", 0.0, // not used
1243 ! GetOptionalBoolProperty(
1244 gsPropertyIsFixedLanguage
,
1245 rPropSet
, xPropSetInfo
, false ),
1248 if (xPropSetInfo
->hasPropertyByName(gsPropertyDateTimeValue
))
1250 // no value -> current time
1251 ProcessTimeOrDateTime(XML_TIME_VALUE
,
1252 GetDateTimeProperty(gsPropertyDateTimeValue
,
1255 if (xPropSetInfo
->hasPropertyByName(gsPropertyDateTime
))
1257 // no value -> current time
1258 ProcessTimeOrDateTime(XML_TIME_VALUE
,
1259 GetDateTimeProperty(gsPropertyDateTime
,rPropSet
));
1261 if (xPropSetInfo
->hasPropertyByName(gsPropertyIsFixed
))
1263 ProcessBoolean(XML_FIXED
,
1264 GetBoolProperty(gsPropertyIsFixed
, rPropSet
),
1267 if (xPropSetInfo
->hasPropertyByName(gsPropertyAdjust
))
1269 // adjust value given as integer in minutes
1270 ProcessDateTime(XML_TIME_ADJUST
,
1271 GetIntProperty(gsPropertyAdjust
, rPropSet
),
1274 ExportElement(XML_TIME
, sPresentation
);
1278 // all properties (except IsDate) are optional!
1279 if (xPropSetInfo
->hasPropertyByName(gsPropertyNumberFormat
))
1281 ProcessValueAndType(false,
1282 GetIntProperty(gsPropertyNumberFormat
,rPropSet
),
1283 u
""_ustr
, u
"", 0.0, // not used
1285 ! GetOptionalBoolProperty(
1286 gsPropertyIsFixedLanguage
,
1287 rPropSet
, xPropSetInfo
, false ) );
1289 if (xPropSetInfo
->hasPropertyByName(gsPropertyDateTimeValue
))
1291 // no value -> current date
1292 ProcessDateTime(XML_DATE_VALUE
,
1293 GetDateTimeProperty(gsPropertyDateTimeValue
,
1296 // TODO: remove double-handling after SRC614
1297 else if (xPropSetInfo
->hasPropertyByName(gsPropertyDateTime
))
1299 ProcessDateTime(XML_DATE_VALUE
,
1300 GetDateTimeProperty(gsPropertyDateTime
,rPropSet
));
1302 if (xPropSetInfo
->hasPropertyByName(gsPropertyIsFixed
))
1304 ProcessBoolean(XML_FIXED
,
1305 GetBoolProperty(gsPropertyIsFixed
, rPropSet
),
1308 if (xPropSetInfo
->hasPropertyByName(gsPropertyAdjust
))
1310 // adjust value given as number of days
1311 ProcessDateTime(XML_DATE_ADJUST
,
1312 GetIntProperty(gsPropertyAdjust
, rPropSet
),
1315 ExportElement(XML_DATE
, sPresentation
);
1318 case FIELD_ID_PAGENUMBER
:
1319 // all properties are optional
1320 if (xPropSetInfo
->hasPropertyByName(gsPropertyNumberingType
))
1322 ProcessNumberingType(GetInt16Property(gsPropertyNumberingType
,
1325 if (xPropSetInfo
->hasPropertyByName(gsPropertyOffset
))
1327 sal_Int32 nAdjust
= GetIntProperty(gsPropertyOffset
, rPropSet
);
1329 if (xPropSetInfo
->hasPropertyByName(gsPropertySubType
))
1331 // property SubType used in MapPageNumberName
1332 ProcessString(XML_SELECT_PAGE
,
1333 MapPageNumberName(rPropSet
, nAdjust
));
1335 ProcessIntegerDef(XML_PAGE_ADJUST
, nAdjust
, 0);
1337 ExportElement(XML_PAGE_NUMBER
, sPresentation
);
1340 case FIELD_ID_PAGESTRING
:
1342 ProcessString(XML_STRING_VALUE
,
1343 GetStringProperty(gsPropertyUserText
, rPropSet
),
1345 sal_Int32 nDummy
= 0; // MapPageNumberName need int
1346 ProcessString(XML_SELECT_PAGE
, MapPageNumberName(rPropSet
, nDummy
));
1347 ExportElement(XML_PAGE_CONTINUATION
, sPresentation
);
1351 case FIELD_ID_DATABASE_NAME
:
1352 ProcessString(XML_TABLE_NAME
,
1353 GetStringProperty(gsPropertyDataTableName
, rPropSet
));
1354 ProcessCommandType(GetIntProperty(gsPropertyDataCommandType
, rPropSet
));
1355 ProcessDisplay(GetBoolProperty(gsPropertyIsVisible
, rPropSet
),
1357 ExportDataBaseElement(XML_DATABASE_NAME
, sPresentation
,
1358 rPropSet
, xPropSetInfo
);
1361 case FIELD_ID_DATABASE_NUMBER
:
1362 ProcessString(XML_TABLE_NAME
,
1363 GetStringProperty(gsPropertyDataTableName
, rPropSet
));
1364 ProcessCommandType(GetIntProperty(gsPropertyDataCommandType
, rPropSet
));
1365 ProcessNumberingType(
1366 GetInt16Property(gsPropertyNumberingType
,rPropSet
));
1367 ProcessInteger(XML_VALUE
,
1368 GetIntProperty(gsPropertySetNumber
, rPropSet
));
1369 ProcessDisplay(GetBoolProperty(gsPropertyIsVisible
, rPropSet
),
1371 ExportDataBaseElement(XML_DATABASE_ROW_NUMBER
, sPresentation
,
1372 rPropSet
, xPropSetInfo
);
1375 case FIELD_ID_DATABASE_NEXT
:
1376 ProcessString(XML_TABLE_NAME
,
1377 GetStringProperty(gsPropertyDataTableName
, rPropSet
));
1378 ProcessCommandType(GetIntProperty(gsPropertyDataCommandType
, rPropSet
));
1379 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1380 GetStringProperty(gsPropertyCondition
, rPropSet
));
1381 DBG_ASSERT(sPresentation
.isEmpty(),
1382 "Unexpected presentation for database next field");
1383 ExportDataBaseElement(XML_DATABASE_NEXT
, OUString(),
1384 rPropSet
, xPropSetInfo
);
1387 case FIELD_ID_DATABASE_SELECT
:
1388 ProcessString(XML_TABLE_NAME
,
1389 GetStringProperty(gsPropertyDataTableName
, rPropSet
));
1390 ProcessCommandType(GetIntProperty(gsPropertyDataCommandType
, rPropSet
));
1391 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1392 GetStringProperty(gsPropertyCondition
, rPropSet
));
1393 ProcessInteger(XML_ROW_NUMBER
,
1394 GetIntProperty(gsPropertySetNumber
, rPropSet
));
1395 DBG_ASSERT(sPresentation
.isEmpty(),
1396 "Unexpected presentation for database select field");
1397 ExportDataBaseElement(XML_DATABASE_ROW_SELECT
, OUString(),
1398 rPropSet
, xPropSetInfo
);
1401 case FIELD_ID_DATABASE_DISPLAY
:
1403 // get database, table and column name from field master
1404 const Reference
<XPropertySet
> xMaster
= GetMasterPropertySet(rTextField
);
1405 ProcessString(XML_TABLE_NAME
,
1406 GetStringProperty(gsPropertyDataTableName
, xMaster
));
1407 ProcessCommandType(GetIntProperty(gsPropertyDataCommandType
, xMaster
));
1408 ProcessString(XML_COLUMN_NAME
,
1409 GetStringProperty(gsPropertyDataColumnName
, xMaster
));
1410 // export number format if available (happens only for numbers!)
1411 if (!GetBoolProperty(gsPropertyIsDataBaseFormat
, rPropSet
))
1413 ProcessValueAndType(false, // doesn't happen for text
1414 GetIntProperty(gsPropertyNumberFormat
,rPropSet
),
1415 u
""_ustr
, u
"", 0.0, // not used
1416 false, false, true, false);
1418 ProcessDisplay(GetBoolProperty(gsPropertyIsVisible
, rPropSet
),
1420 ExportDataBaseElement(XML_DATABASE_DISPLAY
, sPresentation
,
1421 xMaster
, xMaster
->getPropertySetInfo());
1425 case FIELD_ID_DOCINFO_REVISION
:
1426 ProcessBoolean(XML_FIXED
,
1427 GetBoolProperty(gsPropertyIsFixed
, rPropSet
), false);
1428 ExportElement(MapDocInfoFieldName(nToken
), sPresentation
);
1431 case FIELD_ID_DOCINFO_EDIT_DURATION
:
1432 case FIELD_ID_DOCINFO_SAVE_TIME
:
1433 case FIELD_ID_DOCINFO_CREATION_TIME
:
1434 case FIELD_ID_DOCINFO_PRINT_TIME
:
1435 case FIELD_ID_DOCINFO_SAVE_DATE
:
1436 case FIELD_ID_DOCINFO_CREATION_DATE
:
1437 case FIELD_ID_DOCINFO_PRINT_DATE
:
1438 ProcessValueAndType(false,
1439 GetIntProperty(gsPropertyNumberFormat
, rPropSet
),
1442 ! GetOptionalBoolProperty(
1443 gsPropertyIsFixedLanguage
,
1444 rPropSet
, xPropSetInfo
, false ) );
1446 // todo: export date/time value, but values not available -> core bug
1447 ProcessBoolean(XML_FIXED
,
1448 GetBoolProperty(gsPropertyIsFixed
, rPropSet
), false);
1449 ExportElement(MapDocInfoFieldName(nToken
), sPresentation
);
1452 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
1453 case FIELD_ID_DOCINFO_DESCRIPTION
:
1454 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
1455 case FIELD_ID_DOCINFO_TITLE
:
1456 case FIELD_ID_DOCINFO_SUBJECT
:
1457 case FIELD_ID_DOCINFO_KEYWORDS
:
1458 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
1459 if (xPropSetInfo
->hasPropertyByName(gsPropertyIsFixed
))
1461 ProcessBoolean(XML_FIXED
,
1462 GetBoolProperty(gsPropertyIsFixed
, rPropSet
), false);
1464 ExportElement(MapDocInfoFieldName(nToken
), sPresentation
);
1467 case FIELD_ID_DOCINFO_CUSTOM
:
1469 ProcessValueAndType(false, // doesn't happen for text
1470 GetIntProperty(gsPropertyNumberFormat
,rPropSet
),
1471 u
""_ustr
, u
"", 0.0, // not used
1473 ! GetOptionalBoolProperty(
1474 gsPropertyIsFixedLanguage
,
1475 rPropSet
, xPropSetInfo
, false ));
1476 uno::Any aAny
= rPropSet
->getPropertyValue( gsPropertyName
);
1479 ProcessString(XML_NAME
, sName
);
1480 ProcessBoolean(XML_FIXED
, GetBoolProperty(gsPropertyIsFixed
, rPropSet
), false);
1481 ExportElement(XML_USER_DEFINED
, sPresentation
);
1485 case FIELD_ID_COUNT_PAGES
:
1486 case FIELD_ID_COUNT_PARAGRAPHS
:
1487 case FIELD_ID_COUNT_WORDS
:
1488 case FIELD_ID_COUNT_CHARACTERS
:
1489 case FIELD_ID_COUNT_TABLES
:
1490 case FIELD_ID_COUNT_GRAPHICS
:
1491 case FIELD_ID_COUNT_OBJECTS
:
1492 // all properties optional (applies to pages only, but I'll do
1493 // it for all for sake of common implementation)
1494 if (xPropSetInfo
->hasPropertyByName(gsPropertyNumberingType
))
1496 ProcessNumberingType(GetInt16Property(gsPropertyNumberingType
,
1499 ExportElement(MapCountFieldName(nToken
), sPresentation
);
1502 case FIELD_ID_CONDITIONAL_TEXT
:
1503 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1504 GetStringProperty(gsPropertyCondition
, rPropSet
));
1505 ProcessString(XML_STRING_VALUE_IF_TRUE
,
1506 GetStringProperty(gsPropertyTrueContent
, rPropSet
));
1507 ProcessString(XML_STRING_VALUE_IF_FALSE
,
1508 GetStringProperty(gsPropertyFalseContent
, rPropSet
));
1509 ProcessBoolean(XML_CURRENT_VALUE
,
1510 GetBoolProperty(gsPropertyIsConditionTrue
, rPropSet
),
1512 ExportElement(XML_CONDITIONAL_TEXT
, sPresentation
);
1515 case FIELD_ID_HIDDEN_TEXT
:
1516 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1517 GetStringProperty(gsPropertyCondition
, rPropSet
));
1518 ProcessString(XML_STRING_VALUE
,
1519 GetStringProperty(gsPropertyContent
, rPropSet
));
1520 ProcessBoolean(XML_IS_HIDDEN
,
1521 GetBoolProperty(gsPropertyIsHidden
, rPropSet
),
1523 ExportElement(XML_HIDDEN_TEXT
, sPresentation
);
1526 case FIELD_ID_HIDDEN_PARAGRAPH
:
1527 ProcessString(XML_CONDITION
, XML_NAMESPACE_OOOW
,
1528 GetStringProperty(gsPropertyCondition
, rPropSet
));
1529 ProcessBoolean(XML_IS_HIDDEN
,
1530 GetBoolProperty(gsPropertyIsHidden
, rPropSet
),
1532 DBG_ASSERT(sPresentation
.isEmpty(),
1533 "Unexpected presentation for hidden paragraph field");
1534 ExportElement(XML_HIDDEN_PARAGRAPH
);
1537 case FIELD_ID_TEMPLATE_NAME
:
1538 ProcessString(XML_DISPLAY
,
1539 MapTemplateDisplayFormat(
1540 GetInt16Property(gsPropertyFileFormat
, rPropSet
)));
1541 ExportElement(XML_TEMPLATE_NAME
, sPresentation
);
1544 case FIELD_ID_CHAPTER
:
1545 ProcessString(XML_DISPLAY
,
1546 MapChapterDisplayFormat(
1547 GetInt16Property(gsPropertyChapterFormat
, rPropSet
)));
1548 // API numbers 0..9, we number 1..10
1549 ProcessInteger(XML_OUTLINE_LEVEL
,
1550 GetInt8Property(gsPropertyLevel
, rPropSet
) + 1);
1551 ExportElement(XML_CHAPTER
, sPresentation
);
1554 case FIELD_ID_FILE_NAME
:
1555 // all properties are optional
1556 if (xPropSetInfo
->hasPropertyByName(gsPropertyFileFormat
))
1558 ProcessString(XML_DISPLAY
,
1559 MapFilenameDisplayFormat(
1560 GetInt16Property(gsPropertyFileFormat
, rPropSet
)));
1562 if (xPropSetInfo
->hasPropertyByName(gsPropertyIsFixed
))
1564 ProcessBoolean(XML_FIXED
,
1565 GetBoolProperty(gsPropertyIsFixed
, rPropSet
),
1568 ExportElement(XML_FILE_NAME
, sPresentation
);
1571 case FIELD_ID_REFPAGE_SET
:
1572 ProcessBoolean(XML_ACTIVE
,
1573 GetBoolProperty(gsPropertyOn
, rPropSet
), true);
1574 ProcessIntegerDef(XML_PAGE_ADJUST
,
1575 GetInt16Property(gsPropertyOffset
, rPropSet
), 0);
1576 DBG_ASSERT(sPresentation
.isEmpty(),
1577 "Unexpected presentation page variable field");
1578 ExportElement(XML_PAGE_VARIABLE_SET
);
1581 case FIELD_ID_REFPAGE_GET
:
1582 ProcessNumberingType(
1583 GetInt16Property(gsPropertyNumberingType
, rPropSet
));
1584 ExportElement(XML_PAGE_VARIABLE_GET
, sPresentation
);
1587 case FIELD_ID_MACRO
:
1588 ExportMacro( rPropSet
, sPresentation
);
1591 case FIELD_ID_REF_SEQUENCE
:
1592 // reference to sequence: format, name, find value (and element)
1593 // was: if (nSeqNumber != -1) ...
1594 ProcessString(XML_REFERENCE_FORMAT
,
1595 MapReferenceType(GetInt16Property(
1596 gsPropertyReferenceFieldPart
, rPropSet
)),
1598 ProcessString(XML_REF_NAME
,
1599 MakeSequenceRefName(
1600 GetInt16Property(gsPropertySequenceNumber
, rPropSet
),
1601 GetStringProperty(gsPropertySourceName
, rPropSet
) ) );
1602 if (xPropSetInfo
->hasPropertyByName(gsPropertyReferenceFieldLanguage
) &&
1603 GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED
)
1605 // export text:reference-language attribute, if not empty
1606 ProcessString(XML_REFERENCE_LANGUAGE
,
1607 GetStringProperty(gsPropertyReferenceFieldLanguage
, rPropSet
), true, XML_NAMESPACE_LO_EXT
);
1611 GetInt16Property(gsPropertyReferenceFieldSource
, rPropSet
)),
1615 case FIELD_ID_REF_REFERENCE
:
1616 case FIELD_ID_REF_BOOKMARK
:
1617 // reference to bookmarks, references: format, name (and element)
1618 ProcessString(XML_REFERENCE_FORMAT
,
1619 MapReferenceType(GetInt16Property(
1620 gsPropertyReferenceFieldPart
, rPropSet
)),
1622 ProcessString(XML_REF_NAME
,
1623 GetStringProperty(gsPropertySourceName
, rPropSet
));
1624 if (xPropSetInfo
->hasPropertyByName(gsPropertyReferenceFieldLanguage
) &&
1625 GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED
)
1627 // export text:reference-language attribute, if not empty
1628 ProcessString(XML_REFERENCE_LANGUAGE
,
1629 GetStringProperty(gsPropertyReferenceFieldLanguage
, rPropSet
), true, XML_NAMESPACE_LO_EXT
);
1632 MapReferenceSource(GetInt16Property(
1633 gsPropertyReferenceFieldSource
, rPropSet
)),
1637 case FIELD_ID_REF_FOOTNOTE
:
1638 case FIELD_ID_REF_ENDNOTE
:
1639 // reference to end-/footnote: format, generate name, (and element)
1640 GetExport().AddAttribute( XML_NAMESPACE_TEXT
, XML_NOTE_CLASS
,
1641 FIELD_ID_REF_ENDNOTE
==nToken
? XML_ENDNOTE
: XML_FOOTNOTE
);
1642 ProcessString(XML_REFERENCE_FORMAT
,
1643 MapReferenceType(GetInt16Property(
1644 gsPropertyReferenceFieldPart
, rPropSet
)),
1646 ProcessString(XML_REF_NAME
,
1647 MakeFootnoteRefName(GetInt16Property(
1648 gsPropertySequenceNumber
, rPropSet
)));
1649 if (xPropSetInfo
->hasPropertyByName(gsPropertyReferenceFieldLanguage
) &&
1650 GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED
)
1652 // export text:reference-language attribute, if not empty
1653 ProcessString(XML_REFERENCE_LANGUAGE
,
1654 GetStringProperty(gsPropertyReferenceFieldLanguage
, rPropSet
), true, XML_NAMESPACE_LO_EXT
);
1657 MapReferenceSource(GetInt16Property(
1658 gsPropertyReferenceFieldSource
, rPropSet
)),
1662 case FIELD_ID_REF_STYLE
:
1664 ProcessString(XML_REFERENCE_FORMAT
,
1665 MapReferenceType(GetInt16Property(gsPropertyReferenceFieldPart
, rPropSet
)),
1667 ProcessString(XML_REF_NAME
, GetStringProperty(gsPropertySourceName
, rPropSet
));
1669 sal_uInt16 referenceFieldFlags
= GetIntProperty(gsPropertyReferenceFieldFlags
, rPropSet
);
1670 // In reality gsPropertyReferenceFieldFlags is a uInt16... but there is no GetUInt16Property
1672 bool fromBottom
= (referenceFieldFlags
& REFFLDFLAG_STYLE_FROM_BOTTOM
) == REFFLDFLAG_STYLE_FROM_BOTTOM
;
1673 bool hideNonNumerical
= (referenceFieldFlags
& REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL
) == REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL
;
1675 ProcessBoolean(XML_REFERENCE_FROM_BOTTOM
, fromBottom
, false, XML_NAMESPACE_LO_EXT
);
1676 ProcessBoolean(XML_REFERENCE_HIDE_NON_NUMERICAL
, hideNonNumerical
, false, XML_NAMESPACE_LO_EXT
);
1678 if (xPropSetInfo
->hasPropertyByName(gsPropertyReferenceFieldLanguage
)
1679 && GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED
)
1681 // export text:reference-language attribute, if not empty
1682 ProcessString(XML_REFERENCE_LANGUAGE
,
1683 GetStringProperty(gsPropertyReferenceFieldLanguage
, rPropSet
), true,
1684 XML_NAMESPACE_LO_EXT
);
1686 SvXMLElementExport
aElem(
1688 XML_NAMESPACE_LO_EXT
,
1689 MapReferenceSource(GetInt16Property(gsPropertyReferenceFieldSource
, rPropSet
)),
1692 GetExport().Characters(sPresentation
);
1697 // name from field master
1698 ProcessString(XML_CONNECTION_NAME
,
1700 GetStringProperty(gsPropertyName
,
1701 GetMasterPropertySet(rTextField
)));
1702 ExportElement(XML_DDE_CONNECTION
, sPresentation
);
1705 case FIELD_ID_SHEET_NAME
:
1706 // name of spreadsheet (Calc only)
1707 ExportElement(XML_SHEET_NAME
, sPresentation
);
1710 case FIELD_ID_PAGENAME
:
1712 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED
)
1714 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_LO_EXT
, XML_PAGE_NAME
, false, false );
1715 GetExport().Characters( sPresentation
);
1722 // this field is a special case because it gets mapped onto a
1723 // hyperlink, rather than one of the regular text field.
1724 ProcessString(XML_HREF
, GetExport().GetRelativeReference(GetStringProperty(gsPropertyURL
, rPropSet
)),
1725 false, XML_NAMESPACE_XLINK
);
1726 ProcessString(XML_TARGET_FRAME_NAME
,
1727 GetStringProperty(gsPropertyTargetFrame
,rPropSet
),
1728 true, XML_NAMESPACE_OFFICE
);
1729 GetExport().AddAttribute( XML_NAMESPACE_XLINK
, XML_TYPE
, XML_SIMPLE
);
1730 SvXMLElementExport
aUrlField(rExport
, XML_NAMESPACE_TEXT
, XML_A
,
1732 GetExport().Characters(sPresentation
);
1736 case FIELD_ID_BIBLIOGRAPHY
:
1738 ProcessBibliographyData(rPropSet
);
1739 ExportElement(XML_BIBLIOGRAPHY_MARK
, sPresentation
);
1743 case FIELD_ID_SCRIPT
:
1744 ProcessString(XML_LANGUAGE
,
1745 GetStringProperty(gsPropertyScriptType
, rPropSet
),
1746 true, XML_NAMESPACE_SCRIPT
);
1747 DBG_ASSERT(sPresentation
.isEmpty(),
1748 "Unexpected presentation for script field");
1749 if (GetBoolProperty(gsPropertyURLContent
, rPropSet
))
1751 ProcessString(XML_HREF
,
1752 GetExport().GetRelativeReference(GetStringProperty(gsPropertyContent
, rPropSet
)),
1753 false, XML_NAMESPACE_XLINK
);
1754 ExportElement(XML_SCRIPT
);
1758 ExportElement(XML_SCRIPT
,
1759 GetStringProperty(gsPropertyContent
, rPropSet
));
1763 case FIELD_ID_ANNOTATION
:
1765 // check for empty presentation (just in case)
1766 DBG_ASSERT(sPresentation
.isEmpty(),
1767 "Unexpected presentation for annotation field");
1769 bool bRemovePersonalInfo
= SvtSecurityOptions::IsOptionSet(
1770 SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo
) && !SvtSecurityOptions::IsOptionSet(
1771 SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo
);
1773 // annotation element + content
1775 rPropSet
->getPropertyValue(gsPropertyName
) >>= aName
;
1776 if (!aName
.isEmpty())
1778 GetExport().AddAttribute(XML_NAMESPACE_OFFICE
, XML_NAME
, aName
);
1781 OUString aParentName
;
1782 rPropSet
->getPropertyValue(gsPropertyParentName
) >>= aParentName
;
1783 if (!aParentName
.isEmpty())
1785 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT
, XML_PARENT_NAME
, aParentName
);
1788 SvtSaveOptions::ODFSaneDefaultVersion eVersion
= rExport
.getSaneDefaultVersion();
1789 if (eVersion
& SvtSaveOptions::ODFSVER_EXTENDED
)
1791 bool b
= GetBoolProperty(u
"Resolved"_ustr
, rPropSet
);
1792 OUString aResolvedText
;
1793 OUStringBuffer aResolvedTextBuffer
;
1794 ::sax::Converter::convertBool(aResolvedTextBuffer
, b
);
1795 aResolvedText
= aResolvedTextBuffer
.makeStringAndClear();
1797 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT
, XML_RESOLVED
, aResolvedText
);
1799 SvXMLElementExport
aElem(GetExport(), XML_NAMESPACE_OFFICE
,
1800 XML_ANNOTATION
, false, true);
1803 OUString
aAuthor( GetStringProperty(gsPropertyAuthor
, rPropSet
) );
1804 if( !aAuthor
.isEmpty() )
1806 SvXMLElementExport
aCreatorElem( GetExport(), XML_NAMESPACE_DC
,
1809 GetExport().Characters( bRemovePersonalInfo
1810 ? "Author" + OUString::number( rExport
.GetInfoID(aAuthor
) )
1815 util::DateTime
aDate( GetDateTimeProperty(gsPropertyDateTimeValue
, rPropSet
) );
1816 if ( !bRemovePersonalInfo
)
1818 OUStringBuffer aBuffer
;
1819 ::sax::Converter::convertDateTime(aBuffer
, aDate
, nullptr, true);
1820 SvXMLElementExport
aDateElem( GetExport(), XML_NAMESPACE_DC
,
1823 GetExport().Characters(aBuffer
.makeStringAndClear());
1826 if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012
)
1829 OUString
aInitials( GetStringProperty(gsPropertyInitials
, rPropSet
) );
1830 if( !aInitials
.isEmpty() )
1832 // ODF 1.3 OFFICE-3776 export meta:creator-initials for ODF 1.3
1833 SvXMLElementExport
aCreatorElem( GetExport(),
1834 (SvtSaveOptions::ODFSVER_013
<= GetExport().getSaneDefaultVersion())
1835 ? XML_NAMESPACE_META
1836 : XML_NAMESPACE_LO_EXT
,
1838 (SvtSaveOptions::ODFSVER_013
<= GetExport().getSaneDefaultVersion())
1839 ? XML_CREATOR_INITIALS
1840 : XML_SENDER_INITIALS
,
1842 GetExport().Characters( bRemovePersonalInfo
1843 ? OUString::number( rExport
.GetInfoID(aInitials
) )
1848 if (auto xText
= XTextFromTextRangeProp(rPropSet
))
1849 GetExport().GetTextParagraphExport()->exportText( xText
);
1851 ProcessParagraphSequence(GetStringProperty(gsPropertyContent
,rPropSet
));
1855 case FIELD_ID_COMBINED_CHARACTERS
:
1857 // The style with the combined characters attribute has
1858 // already been handled in the ExportField method. So all that
1859 // is left to do now is to export the characters.
1860 GetExport().Characters(sPresentation
);
1866 ExportMetaField(rPropSet
, false, bProgress
, rPrevCharIsSpace
);
1870 case FIELD_ID_MEASURE
:
1872 ProcessString(XML_KIND
, MapMeasureKind(GetInt16Property(gsPropertyMeasureKind
, rPropSet
)));
1873 ExportElement( XML_MEASURE
, sPresentation
);
1877 case FIELD_ID_TABLE_FORMULA
:
1878 ProcessString( XML_FORMULA
, XML_NAMESPACE_OOOW
,
1879 GetStringProperty(gsPropertyContent
, rPropSet
) );
1880 ProcessDisplay( true,
1881 GetBoolProperty(gsPropertyIsShowFormula
, rPropSet
) );
1882 ProcessValueAndType( false,
1883 GetIntProperty(gsPropertyNumberFormat
, rPropSet
),
1884 u
""_ustr
, u
"", 0.0f
,
1887 ExportElement( XML_TABLE_FORMULA
, sPresentation
);
1890 case FIELD_ID_DROP_DOWN
:
1892 // tdf#133555 don't export in strict ODF versions that don't have it
1893 if (GetExport().getSaneDefaultVersion() <= SvtSaveOptions::ODFSVER_012
)
1897 ProcessString(XML_NAME
, GetStringProperty(gsPropertyName
, rPropSet
));
1898 ProcessString(XML_HELP
,
1899 GetStringProperty(gsPropertyHelp
, rPropSet
), true);
1900 ProcessString(XML_HINT
,
1901 GetStringProperty(gsPropertyTooltip
, rPropSet
), true);
1902 SvXMLElementExport
aElem( GetExport(),
1903 XML_NAMESPACE_TEXT
, XML_DROP_DOWN
,
1905 ProcessStringSequence
1906 (GetStringSequenceProperty( gsPropertyItems
, rPropSet
),
1907 GetStringProperty( gsPropertySelectedItem
, rPropSet
) );
1909 GetExport().Characters( sPresentation
);
1913 case FIELD_ID_DRAW_HEADER
:
1915 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_PRESENTATION
, XML_HEADER
, false, false );
1919 case FIELD_ID_DRAW_FOOTER
:
1921 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_PRESENTATION
, XML_FOOTER
, false, false );
1925 case FIELD_ID_DRAW_DATE_TIME
:
1927 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_PRESENTATION
, XML_DATE_TIME
, false, false );
1932 case FIELD_ID_UNKNOWN
:
1934 OSL_FAIL("unknown field type encountered!");
1935 // always export content
1936 GetExport().Characters(sPresentation
);
1941 /// export field declarations / field masters
1942 void XMLTextFieldExport::ExportFieldDeclarations()
1944 Reference
<XText
> xEmptyText
;
1945 ExportFieldDeclarations(xEmptyText
);
1948 /// export field declarations / field masters
1949 void XMLTextFieldExport::ExportFieldDeclarations(
1950 const Reference
<XText
> & rText
)
1952 // store lists for decl elements
1953 std::vector
<OUString
> aVarName
;
1954 std::vector
<OUString
> aUserName
;
1955 std::vector
<OUString
> aSeqName
;
1956 std::vector
<OUString
> aDdeName
;
1958 // get text fields supplier and field master name access
1959 Reference
<XTextFieldsSupplier
> xTextFieldsSupp(GetExport().GetModel(),
1961 if( !xTextFieldsSupp
.is() )
1964 Reference
<container::XNameAccess
> xFieldMasterNameAccess
=
1965 xTextFieldsSupp
->getTextFieldMasters();
1967 // where to get the text field masters from?
1968 // a) we get a specific XText: then use pUsedMasters
1969 // b) the XText is empty: then export all text fields
1970 Sequence
<OUString
> aFieldMasters
;
1973 // export only used masters
1974 DBG_ASSERT(moUsedMasters
.has_value(),
1975 "field masters must be recorded in order to be "
1976 "written out separately" );
1979 std::map
<Reference
<XText
>, std::set
<OUString
> > ::iterator aMapIter
=
1980 moUsedMasters
->find(rText
);
1981 if (aMapIter
!= moUsedMasters
->end())
1983 // found the set of used field masters
1984 aFieldMasters
= comphelper::containerToSequence(aMapIter
->second
);
1985 moUsedMasters
->erase(rText
);
1987 // else: XText not found -> ignore
1989 // else: no field masters have been recorded -> ignore
1993 // no XText: export all!
1994 aFieldMasters
= xFieldMasterNameAccess
->getElementNames();
1997 for(const OUString
& sFieldMaster
: aFieldMasters
) {
1999 // workaround for #no-bug#
2000 if ( sFieldMaster
.startsWithIgnoreAsciiCase(
2001 "com.sun.star.text.FieldMaster.DataBase.") )
2007 OUString sFieldMasterType
;
2009 ExplodeFieldMasterName(sFieldMaster
, sFieldMasterType
, sVarName
);
2011 // get XPropertySet of this field master
2012 Reference
<XPropertySet
> xPropSet
;
2013 Any aAny
= xFieldMasterNameAccess
->getByName(sFieldMaster
);
2016 // save interesting field masters
2017 if (sFieldMasterType
== FIELD_SERVICE_SETEXP
)
2019 sal_Int32 nType
= GetIntProperty(gsPropertySubType
, xPropSet
);
2021 // sequence or variable?
2022 if ( SetVariableType::SEQUENCE
== nType
)
2024 aSeqName
.push_back( sFieldMaster
);
2028 aVarName
.push_back( sFieldMaster
);
2031 else if (sFieldMasterType
== FIELD_SERVICE_USER
)
2033 aUserName
.push_back( sFieldMaster
);
2035 else if (sFieldMasterType
== FIELD_SERVICE_DDE
)
2037 aDdeName
.push_back( sFieldMaster
);
2045 // now process fields:
2047 // variable field masters:
2048 if ( !aVarName
.empty() )
2050 SvXMLElementExport
aElem( GetExport(),
2055 for (const auto& sName
: aVarName
)
2057 // get field master property set
2058 Reference
<XPropertySet
> xPropSet
;
2059 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
2062 // field name and type
2063 OUString sFieldMasterType
;
2065 ExplodeFieldMasterName(sName
, sFieldMasterType
, sVarName
);
2067 // determine string/numeric field
2068 bool bIsString
= ( GetIntProperty(gsPropertySubType
, xPropSet
)
2069 == SetVariableType::STRING
);
2071 // get dependent field property set
2072 Reference
<XPropertySet
> xFieldPropSet
;
2073 if (GetDependentFieldPropertySet(xPropSet
, xFieldPropSet
))
2075 // process value and type.
2076 ProcessValueAndType(
2078 GetIntProperty(gsPropertyNumberFormat
, xFieldPropSet
),
2080 false, true, false, false);
2084 // If no dependent field is found, only string and
2085 // float types can be supported
2087 // number format: 0 is default number format for 1st
2088 // language. should be: getDefaultNumberFormat(Locale)
2089 // from NumberFormats
2090 ProcessValueAndType(
2092 0, u
""_ustr
, u
"", 0.0,
2093 false, true, false, false);
2096 ProcessString(XML_NAME
, sVarName
);
2097 ExportElement(XML_VARIABLE_DECL
, true);
2100 // else: no declarations element
2102 // sequence field masters:
2103 if ( !aSeqName
.empty() )
2105 SvXMLElementExport
aElem( GetExport(),
2110 for (const auto& sName
: aSeqName
)
2112 // get field master property set
2113 Reference
<XPropertySet
> xPropSet
;
2114 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
2117 // field name and type
2118 OUString sFieldMasterType
;
2120 ExplodeFieldMasterName(sName
, sFieldMasterType
, sVarName
);
2123 sal_Int32 nLevel
= 1 + GetIntProperty(
2124 gsPropertyChapterNumberingLevel
, xPropSet
);
2125 DBG_ASSERT(nLevel
>= 0, "illegal outline level");
2126 DBG_ASSERT(nLevel
< 127, "possible illegal outline level");
2127 ProcessInteger(XML_DISPLAY_OUTLINE_LEVEL
, nLevel
);
2129 // separation character
2131 ProcessString(XML_SEPARATION_CHARACTER
, GetStringProperty(
2132 gsPropertyNumberingSeparator
, xPropSet
));
2134 ProcessString(XML_NAME
, sVarName
);
2135 ExportElement(XML_SEQUENCE_DECL
, true);
2138 // else: no declarations element
2140 // user field masters:
2141 if ( !aUserName
.empty() )
2143 SvXMLElementExport
aElem( GetExport(),
2145 XML_USER_FIELD_DECLS
,
2148 for (const auto& sName
: aUserName
)
2150 // get field master property set
2151 Reference
<XPropertySet
> xPropSet
;
2152 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
2155 // field name and type
2156 OUString sFieldMasterType
;
2158 ExplodeFieldMasterName(sName
, sFieldMasterType
, sVarName
);
2160 if (GetBoolProperty(gsPropertyIsExpression
, xPropSet
))
2163 ProcessValueAndType(
2166 GetDoubleProperty(gsPropertyValue
, xPropSet
),
2174 // string: write regardless of default
2175 ProcessString(XML_VALUE_TYPE
, XML_STRING
,
2176 XML_NAMESPACE_OFFICE
);
2177 ProcessString(XML_STRING_VALUE
,
2178 GetStringProperty(gsPropertyContent
, xPropSet
),
2179 false, XML_NAMESPACE_OFFICE
);
2181 ProcessString(XML_NAME
, sVarName
);
2182 ExportElement(XML_USER_FIELD_DECL
, true);
2185 // else: no declarations element
2187 // DDE field masters:
2188 if ( aDdeName
.empty() )
2191 SvXMLElementExport
aElem( GetExport(),
2193 XML_DDE_CONNECTION_DECLS
,
2196 for (const auto& sName
: aDdeName
)
2198 // get field master property set
2199 Reference
<XPropertySet
> xPropSet
;
2200 Any aAny
= xFieldMasterNameAccess
->getByName(sName
);
2203 // check if this connection is being used by a field
2204 Reference
<XPropertySet
> xDummy
;
2205 if (GetDependentFieldPropertySet(xPropSet
, xDummy
))
2208 ProcessString(XML_NAME
,
2209 GetStringProperty(gsPropertyName
, xPropSet
),
2210 false, XML_NAMESPACE_OFFICE
);
2212 // export elements; can't use ProcessString because
2213 // elements are in office namespace
2214 ProcessString(XML_DDE_APPLICATION
,
2215 GetStringProperty(gsPropertyDDECommandType
,
2217 false, XML_NAMESPACE_OFFICE
);
2218 ProcessString(XML_DDE_TOPIC
,
2219 GetStringProperty(gsPropertyDDECommandFile
,
2221 false, XML_NAMESPACE_OFFICE
);
2222 ProcessString(XML_DDE_ITEM
,
2223 GetStringProperty(gsPropertyDDECommandElement
,
2225 false, XML_NAMESPACE_OFFICE
);
2226 bool bIsAutomaticUpdate
= GetBoolProperty(
2227 gsPropertyIsAutomaticUpdate
, xPropSet
);
2228 if (bIsAutomaticUpdate
)
2230 GetExport().AddAttribute(XML_NAMESPACE_OFFICE
,
2231 XML_AUTOMATIC_UPDATE
,
2235 ExportElement(XML_DDE_CONNECTION_DECL
, true);
2237 // else: no dependent field -> no export of field declaration
2239 // else: no declarations element
2242 void XMLTextFieldExport::SetExportOnlyUsedFieldDeclarations(
2243 bool bExportOnlyUsed
)
2245 moUsedMasters
.reset();
2247 // create used masters set (if none is used)
2248 if (bExportOnlyUsed
)
2249 #if defined __GNUC__ && !defined __clang__ && __GNUC__ == 14
2250 #pragma GCC diagnostic push
2251 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
2253 moUsedMasters
.emplace();
2254 #if defined __GNUC__ && !defined __clang__ && __GNUC__ == 14
2255 #pragma GCC diagnostic pop
2259 void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName
,
2262 // can't call ExportElement(eElementName, const OUString&) with empty
2263 // string because xmlprinter only uses empty tags if no content
2264 // (not even empty content) was written.
2266 DBG_ASSERT(XML_TOKEN_INVALID
!= eElementName
, "invalid element name!");
2267 if (XML_TOKEN_INVALID
!= eElementName
)
2270 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_TEXT
,
2271 eElementName
, bAddSpace
, bAddSpace
);
2275 void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName
,
2276 const OUString
& sContent
)
2278 DBG_ASSERT(eElementName
!= XML_TOKEN_INVALID
, "invalid element name!");
2279 if (eElementName
!= XML_TOKEN_INVALID
)
2282 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_TEXT
,
2283 eElementName
, false, false );
2285 GetExport().Characters(sContent
);
2287 // always export content
2288 GetExport().Characters(sContent
);
2292 void XMLTextFieldExport::ExportMacro(
2293 const Reference
<XPropertySet
> & rPropSet
,
2294 const OUString
& rContent
)
2296 // some strings we'll need
2297 OUString
sEventType( u
"EventType"_ustr
);
2300 // the description attribute
2301 ProcessString(XML_DESCRIPTION
,
2302 GetStringProperty(gsPropertyHint
, rPropSet
),
2306 SvXMLElementExport
aElem( GetExport(), XML_NAMESPACE_TEXT
,
2307 XML_EXECUTE_MACRO
, false, false );
2309 // the <office:events>-macro:
2311 // 1) build sequence of PropertyValues
2312 Sequence
<PropertyValue
> aSeq
;
2314 rPropSet
->getPropertyValue(u
"ScriptURL"_ustr
) >>= sName
;
2316 // if the ScriptURL property is not empty then this is a Scripting
2317 // Framework URL, otherwise treat it as a Basic Macro
2318 if (!sName
.isEmpty())
2320 OUString
sScript( u
"Script"_ustr
);
2321 aSeq
= Sequence
<PropertyValue
>
2323 comphelper::makePropertyValue(sEventType
, sScript
),
2324 comphelper::makePropertyValue(sScript
, sName
)
2329 aSeq
= Sequence
<PropertyValue
>
2331 comphelper::makePropertyValue(sEventType
, u
"StarBasic"_ustr
),
2332 comphelper::makePropertyValue(u
"Library"_ustr
, rPropSet
->getPropertyValue( u
"MacroLibrary"_ustr
)),
2333 comphelper::makePropertyValue(u
"MacroName"_ustr
, rPropSet
->getPropertyValue( u
"MacroName"_ustr
))
2337 // 2) export the sequence
2338 GetExport().GetEventExport().ExportSingleEvent( aSeq
, u
"OnClick"_ustr
, false );
2340 // and finally, the field presentation
2341 GetExport().Characters(rContent
);
2344 void XMLTextFieldExport::ExportMetaField(
2345 const Reference
<XPropertySet
> & i_xMeta
,
2346 bool i_bAutoStyles
, bool i_bProgress
,
2347 bool & rPrevCharIsSpace
)
2349 bool doExport(!i_bAutoStyles
); // do not export element if autostyles
2350 // check version >= 1.2
2351 switch (GetExport().getSaneDefaultVersion()) {
2352 case SvtSaveOptions::ODFSVER_011
: // fall through
2353 case SvtSaveOptions::ODFSVER_010
: doExport
= false; break;
2357 const Reference
< XEnumerationAccess
> xEA( i_xMeta
, UNO_QUERY_THROW
);
2358 const Reference
< XEnumeration
> xTextEnum( xEA
->createEnumeration() );
2362 const Reference
<rdf::XMetadatable
> xMeta( i_xMeta
, UNO_QUERY_THROW
);
2364 // style:data-style-name
2365 ProcessValueAndType(false,
2366 GetIntProperty(gsPropertyNumberFormat
, i_xMeta
),
2367 u
""_ustr
, u
"", 0.0, false, false, true,
2370 // text:meta-field without xml:id is invalid
2371 xMeta
->ensureMetadataReference();
2373 // xml:id for RDF metadata
2374 GetExport().AddAttributeXmlId(xMeta
);
2377 SvXMLElementExport
aElem( GetExport(), doExport
,
2378 XML_NAMESPACE_TEXT
, XML_META_FIELD
, false, false );
2380 // recurse to export content
2381 GetExport().GetTextParagraphExport()->
2382 exportTextRangeEnumeration(xTextEnum
, i_bAutoStyles
, i_bProgress
, rPrevCharIsSpace
);
2385 /// export all data-style related attributes
2386 void XMLTextFieldExport::ProcessValueAndType(
2387 bool bIsString
, /// do we process a string or a number?
2388 sal_Int32 nFormatKey
, /// format key for NumberFormatter; inv. if string
2389 const OUString
& sContent
, /// string content; possibly invalid
2390 std::u16string_view sDefault
, /// default string
2391 double fValue
, /// float content; possibly invalid
2392 bool bExportValue
, /// export value attribute?
2393 bool bExportValueType
, /// export value-type attribute?
2394 bool bExportStyle
, /// export style-attribute?
2395 bool bForceSystemLanguage
, /// export language attributes?
2396 bool bTimeStyle
) // exporting a time style?
2398 // String or number?
2402 // string: attributes value-type=string, string-value=...
2404 if (bExportValue
|| bExportValueType
)
2406 XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(
2407 GetExport(), sContent
, sDefault
, bExportValue
);
2414 // number: value-type=..., value...=..., data-style-name=...
2416 DBG_ASSERT(bExportValueType
|| !bExportValue
, "value w/o value type not supported!");
2418 // take care of illegal formats
2419 // (shouldn't happen, but does if document is corrupted)
2420 if (-1 != nFormatKey
)
2422 if (bExportValue
|| bExportValueType
)
2424 XMLNumberFormatAttributesExportHelper::
2425 SetNumberFormatAttributes(
2426 GetExport(), nFormatKey
, fValue
, bExportValue
);
2431 // don't export language (if desired)
2432 if( bForceSystemLanguage
)
2434 GetExport().dataStyleForceSystemLanguage( nFormatKey
);
2436 OUString sDataStyleName
=
2437 GetExport().getDataStyleName(nFormatKey
, bTimeStyle
);
2438 if( !sDataStyleName
.isEmpty() )
2440 GetExport().AddAttribute( XML_NAMESPACE_STYLE
,
2441 XML_DATA_STYLE_NAME
,
2443 } // else: ignore (no valid number format)
2444 } // else: ignore (no number format)
2450 /// process display related properties
2451 void XMLTextFieldExport::ProcessDisplay(bool bIsVisible
,
2454 enum XMLTokenEnum eValue
;
2458 eValue
= bIsCommand
? XML_FORMULA
: XML_VALUE
;
2465 // omit attribute if default
2466 if (eValue
!= XML_VALUE
)
2468 GetExport().AddAttribute(XML_NAMESPACE_TEXT
, XML_DISPLAY
, eValue
);
2473 void XMLTextFieldExport::ProcessBoolean(enum XMLTokenEnum eName
,
2474 bool bBool
, bool bDefault
)
2476 ProcessBoolean(eName
, bBool
, bDefault
, XML_NAMESPACE_TEXT
);
2479 /// export boolean property
2480 void XMLTextFieldExport::ProcessBoolean(enum XMLTokenEnum eName
,
2481 bool bBool
, bool bDefault
, sal_uInt16 nPrefix
)
2483 SAL_WARN_IF( eName
== XML_TOKEN_INVALID
, "xmloff.text", "invalid element token");
2484 if ( XML_TOKEN_INVALID
== eName
)
2487 // write attribute (if different than default)
2488 // negate to force 0/1 values (and make sal_Bool comparable)
2489 if ((!bBool
) != (!bDefault
)) {
2490 GetExport().AddAttribute(nPrefix
, eName
,
2491 (bBool
? XML_TRUE
: XML_FALSE
) );
2495 /// export string attribute
2496 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2497 const OUString
& sValue
,
2501 SAL_WARN_IF( eName
== XML_TOKEN_INVALID
, "xmloff.text", "invalid element token");
2502 if ( XML_TOKEN_INVALID
== eName
)
2505 // check for empty string, if applicable
2506 if ( bOmitEmpty
&& sValue
.isEmpty() )
2510 GetExport().AddAttribute(nPrefix
, eName
, sValue
);
2513 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2514 sal_uInt16 nValuePrefix
,
2515 const OUString
& sValue
)
2518 GetExport().GetNamespaceMap().GetQNameByKey( nValuePrefix
, sValue
, false );
2519 ProcessString( eName
, sQValue
);
2522 /// export a string attribute
2523 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2524 const OUString
& sValue
,
2525 std::u16string_view sDefault
)
2527 if (sValue
!= sDefault
)
2529 ProcessString(eName
, sValue
);
2533 /// export a string attribute
2534 void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName
,
2535 sal_uInt16 nValuePrefix
,
2536 const OUString
& sValue
,
2537 std::u16string_view sDefault
)
2539 if (sValue
!= sDefault
)
2541 ProcessString(eName
, nValuePrefix
, sValue
);
2546 /// export string attribute
2547 void XMLTextFieldExport::ProcessString(
2548 enum XMLTokenEnum eName
,
2549 enum XMLTokenEnum eValue
,
2552 SAL_WARN_IF( eName
== XML_TOKEN_INVALID
, "xmloff.text", "invalid element token" );
2553 SAL_WARN_IF( eValue
== XML_TOKEN_INVALID
, "xmloff.text", "invalid value token" );
2554 if ( XML_TOKEN_INVALID
== eName
)
2557 GetExport().AddAttribute(nPrefix
, eName
, eValue
);
2560 /// export a string attribute
2561 void XMLTextFieldExport::ProcessString(
2562 enum XMLTokenEnum eName
,
2563 enum XMLTokenEnum eValue
,
2564 enum XMLTokenEnum eDefault
)
2566 if ( eValue
!= eDefault
)
2567 ProcessString( eName
, eValue
);
2571 /// export a string as a sequence of paragraphs
2572 void XMLTextFieldExport::ProcessParagraphSequence(
2573 std::u16string_view sParagraphSequence
)
2575 // iterate over all string-pieces separated by return (0x0a) and
2576 // put each inside a paragraph element.
2577 SvXMLTokenEnumerator
aEnumerator(sParagraphSequence
, char(0x0a));
2578 std::u16string_view aSubString
;
2579 while (aEnumerator
.getNextToken(aSubString
))
2581 SvXMLElementExport
aParagraph(
2582 GetExport(), XML_NAMESPACE_TEXT
, XML_P
, true, false);
2583 GetExport().Characters(OUString(aSubString
));
2587 // export an integer attribute
2588 void XMLTextFieldExport::ProcessInteger(enum XMLTokenEnum eName
,
2591 SAL_WARN_IF( eName
== XML_TOKEN_INVALID
, "xmloff.text", "invalid element token");
2592 if ( XML_TOKEN_INVALID
== eName
)
2595 GetExport().AddAttribute(XML_NAMESPACE_TEXT
, eName
,
2596 OUString::number(nNum
));
2599 /// export an integer attribute, omit if default
2600 void XMLTextFieldExport::ProcessIntegerDef(enum XMLTokenEnum eName
,
2601 sal_Int32 nNum
, sal_Int32 nDefault
)
2603 if (nNum
!= nDefault
)
2604 ProcessInteger(eName
, nNum
);
2608 /// export a numbering type
2609 void XMLTextFieldExport::ProcessNumberingType(sal_Int16 nNumberingType
)
2611 // process only if real format (not: like page descriptor)
2612 if (NumberingType::PAGE_DESCRIPTOR
== nNumberingType
)
2615 OUStringBuffer
sTmp( 10 );
2616 // number type: num format
2617 GetExport().GetMM100UnitConverter().convertNumFormat( sTmp
,
2619 GetExport().AddAttribute(XML_NAMESPACE_STYLE
, XML_NUM_FORMAT
,
2620 sTmp
.makeStringAndClear() );
2621 // and letter sync, if applicable
2622 SvXMLUnitConverter::convertNumLetterSync( sTmp
, nNumberingType
);
2624 if (!sTmp
.isEmpty())
2626 GetExport().AddAttribute(XML_NAMESPACE_STYLE
, XML_NUM_LETTER_SYNC
,
2627 sTmp
.makeStringAndClear() );
2629 // else: like page descriptor => ignore
2633 /// export a date, time, or duration
2634 void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName
,
2638 bool bOmitDurationIfZero
,
2641 // truncate for date granularity
2644 dValue
= ::rtl::math::approxFloor(dValue
);
2647 OUStringBuffer aBuffer
;
2650 // date/time duration handle bOmitDurationIfZero
2651 if (!bOmitDurationIfZero
|| dValue
!= 0.0)
2653 ::sax::Converter::convertDuration(aBuffer
, dValue
);
2659 rExport
.GetMM100UnitConverter().convertDateTime(aBuffer
, dValue
);
2663 ProcessString(eName
, aBuffer
.makeStringAndClear(), true, nPrefix
);
2666 /// export a date or time
2667 void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName
,
2668 const util::DateTime
& rTime
)
2670 OUStringBuffer aBuffer
;
2672 util::DateTime
aDateTime(rTime
);
2675 ::sax::Converter::convertDateTime(aBuffer
, aDateTime
, nullptr);
2678 ProcessString(eName
, aBuffer
.makeStringAndClear(), true);
2681 /// export a date, time, or duration
2682 void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName
,
2687 // handle bOmitDurationIfZero here, because we can precisely compare ints
2688 if (!(bIsDuration
&& (nMinutes
==0)))
2690 ProcessDateTime(eName
, static_cast<double>(nMinutes
) / double(24*60),
2691 bIsDate
, bIsDuration
);
2695 /// export a time or dateTime
2696 void XMLTextFieldExport::ProcessTimeOrDateTime(enum XMLTokenEnum eName
,
2697 const util::DateTime
& rTime
)
2699 OUStringBuffer aBuffer
;
2702 ::sax::Converter::convertTimeOrDateTime(aBuffer
, rTime
);
2705 ProcessString(eName
, aBuffer
.makeStringAndClear(), true);
2709 SvXMLEnumMapEntry
<sal_Int16
> const aBibliographyDataTypeMap
[] =
2711 { XML_ARTICLE
, BibliographyDataType::ARTICLE
},
2712 { XML_BOOK
, BibliographyDataType::BOOK
},
2713 { XML_BOOKLET
, BibliographyDataType::BOOKLET
},
2714 { XML_CONFERENCE
, BibliographyDataType::CONFERENCE
},
2715 { XML_CUSTOM1
, BibliographyDataType::CUSTOM1
},
2716 { XML_CUSTOM2
, BibliographyDataType::CUSTOM2
},
2717 { XML_CUSTOM3
, BibliographyDataType::CUSTOM3
},
2718 { XML_CUSTOM4
, BibliographyDataType::CUSTOM4
},
2719 { XML_CUSTOM5
, BibliographyDataType::CUSTOM5
},
2720 { XML_EMAIL
, BibliographyDataType::EMAIL
},
2721 { XML_INBOOK
, BibliographyDataType::INBOOK
},
2722 { XML_INCOLLECTION
, BibliographyDataType::INCOLLECTION
},
2723 { XML_INPROCEEDINGS
, BibliographyDataType::INPROCEEDINGS
},
2724 { XML_JOURNAL
, BibliographyDataType::JOURNAL
},
2725 { XML_MANUAL
, BibliographyDataType::MANUAL
},
2726 { XML_MASTERSTHESIS
, BibliographyDataType::MASTERSTHESIS
},
2727 { XML_MISC
, BibliographyDataType::MISC
},
2728 { XML_PHDTHESIS
, BibliographyDataType::PHDTHESIS
},
2729 { XML_PROCEEDINGS
, BibliographyDataType::PROCEEDINGS
},
2730 { XML_TECHREPORT
, BibliographyDataType::TECHREPORT
},
2731 { XML_UNPUBLISHED
, BibliographyDataType::UNPUBLISHED
},
2732 { XML_WWW
, BibliographyDataType::WWW
},
2733 { XML_TOKEN_INVALID
, 0 }
2737 void XMLTextFieldExport::ProcessBibliographyData(
2738 const Reference
<XPropertySet
>& rPropSet
)
2741 Any aAny
= rPropSet
->getPropertyValue(gsPropertyFields
);
2742 Sequence
<PropertyValue
> aValues
;
2745 // one attribute per value (unless empty)
2746 for (const auto& rProp
: aValues
)
2748 if( rProp
.Name
== "BibiliographicType" )
2750 sal_Int16 nTypeId
= 0;
2751 rProp
.Value
>>= nTypeId
;
2752 OUStringBuffer sBuf
;
2754 if (SvXMLUnitConverter::convertEnum(sBuf
, nTypeId
,
2755 aBibliographyDataTypeMap
))
2757 rExport
.AddAttribute(XML_NAMESPACE_TEXT
,
2758 XML_BIBLIOGRAPHY_TYPE
,
2759 sBuf
.makeStringAndClear());
2761 // else: ignore this argument
2766 rProp
.Value
>>= sStr
;
2768 if (!sStr
.isEmpty())
2770 XMLTokenEnum eElement
= MapBibliographyFieldName(rProp
.Name
);
2771 if (eElement
== XML_URL
|| eElement
== XML_LOCAL_URL
|| eElement
== XML_TARGET_URL
)
2773 sStr
= GetExport().GetRelativeReference(sStr
);
2775 sal_uInt16 nPrefix
= XML_NAMESPACE_TEXT
;
2776 if (eElement
== XML_LOCAL_URL
|| eElement
== XML_TARGET_TYPE
2777 || eElement
== XML_TARGET_URL
)
2779 nPrefix
= XML_NAMESPACE_LO_EXT
;
2781 rExport
.AddAttribute(nPrefix
, eElement
, sStr
);
2787 /// export CommandTypeAttribute
2788 void XMLTextFieldExport::ProcessCommandType(
2789 sal_Int32 nCommandType
)
2791 enum XMLTokenEnum eToken
= XML_TOKEN_INVALID
;
2792 switch( nCommandType
)
2794 case sdb::CommandType::TABLE
: eToken
= XML_TABLE
; break;
2795 case sdb::CommandType::QUERY
: eToken
= XML_QUERY
; break;
2796 case sdb::CommandType::COMMAND
: eToken
= XML_COMMAND
; break;
2799 if( eToken
!= XML_TOKEN_INVALID
)
2800 rExport
.AddAttribute( XML_NAMESPACE_TEXT
, XML_TABLE_TYPE
, eToken
);
2804 void XMLTextFieldExport::ProcessStringSequence(
2805 const Sequence
<OUString
>& rSequence
,
2806 const OUString
& sSelected
)
2808 // find selected element
2809 sal_Int32 nSelected
= comphelper::findValue(rSequence
, sSelected
);
2811 // delegate to ProcessStringSequence(OUString,sal_Int32)
2812 ProcessStringSequence( rSequence
, nSelected
);
2815 void XMLTextFieldExport::ProcessStringSequence(
2816 const Sequence
<OUString
>& rSequence
,
2817 sal_Int32 nSelected
)
2819 sal_Int32 nLength
= rSequence
.getLength();
2820 const OUString
* pSequence
= rSequence
.getConstArray();
2821 for( sal_Int32 i
= 0; i
< nLength
; i
++ )
2823 if( i
== nSelected
)
2824 rExport
.AddAttribute( XML_NAMESPACE_TEXT
,
2825 XML_CURRENT_SELECTED
, XML_TRUE
);
2826 rExport
.AddAttribute( XML_NAMESPACE_TEXT
, XML_VALUE
, pSequence
[i
] );
2827 SvXMLElementExport
aElement( rExport
, XML_NAMESPACE_TEXT
, XML_LABEL
,
2832 void XMLTextFieldExport::ExportDataBaseElement(
2833 enum XMLTokenEnum eElementName
,
2834 const OUString
& sPresentation
,
2835 const Reference
<XPropertySet
>& rPropertySet
,
2836 const Reference
<XPropertySetInfo
>& rPropertySetInfo
)
2838 SAL_WARN_IF( eElementName
== XML_TOKEN_INVALID
, "xmloff.text", "need token" );
2839 SAL_WARN_IF( !rPropertySet
.is(), "xmloff.text", "need property set" );
2840 SAL_WARN_IF( !rPropertySetInfo
.is(), "xmloff.text", "need property set info" );
2842 // get database properties
2843 OUString sDataBaseName
;
2844 OUString sDataBaseURL
;
2846 if( ( rPropertySet
->getPropertyValue( gsPropertyDataBaseName
) >>= sStr
)
2847 && !sStr
.isEmpty() )
2849 sDataBaseName
= sStr
;
2851 else if( rPropertySetInfo
->hasPropertyByName( gsPropertyDataBaseURL
) &&
2852 (rPropertySet
->getPropertyValue( gsPropertyDataBaseURL
) >>= sStr
) &&
2855 sDataBaseURL
= sStr
;
2858 // add database name property (if present)
2859 if( !sDataBaseName
.isEmpty() )
2860 rExport
.AddAttribute( XML_NAMESPACE_TEXT
, XML_DATABASE_NAME
,
2862 SvXMLElementExport
aDataBaseElement( GetExport(),
2863 XML_NAMESPACE_TEXT
, eElementName
,
2866 // write URL as children
2867 if( !sDataBaseURL
.isEmpty() )
2869 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_HREF
, sDataBaseURL
);
2870 SvXMLElementExport
aDataSourceElement(
2871 GetExport(), XML_NAMESPACE_FORM
, XML_CONNECTION_RESOURCE
,
2875 // write presentation
2876 rExport
.Characters( sPresentation
);
2880 // explode a field master name into field type and field name
2881 void XMLTextFieldExport::ExplodeFieldMasterName(
2882 std::u16string_view sMasterName
, OUString
& sFieldType
, OUString
& sVarName
)
2884 sal_Int32 nLength
= gsFieldMasterPrefix
.getLength();
2885 size_t nSeparator
= sMasterName
.find('.', nLength
);
2888 if (nSeparator
== o3tl::make_unsigned(nLength
) || nSeparator
== std::u16string_view::npos
) {
2889 SAL_WARN("xmloff.text", "no field var name!");
2893 sFieldType
= sMasterName
.substr(nLength
, nSeparator
-nLength
);
2894 sVarName
= sMasterName
.substr(nSeparator
+1);
2899 // for XDependentTextFields, get PropertySet of FieldMaster
2900 Reference
<XPropertySet
> XMLTextFieldExport::GetMasterPropertySet(
2901 const Reference
<XTextField
> & rTextField
)
2903 // name, value => get Property set of TextFieldMaster
2904 Reference
<XDependentTextField
> xDep(rTextField
, UNO_QUERY
);
2905 return xDep
->getTextFieldMaster();
2908 // get PropertySet of (any; the first) dependent field
2909 bool XMLTextFieldExport::GetDependentFieldPropertySet(
2910 const Reference
<XPropertySet
> & xMaster
,
2911 Reference
<XPropertySet
> & xField
)
2914 Sequence
<Reference
<XDependentTextField
> > aFields
;
2915 aAny
= xMaster
->getPropertyValue(gsPropertyDependentTextFields
);
2919 if (aFields
.hasElements())
2921 // get first one and return
2922 const Reference
<XDependentTextField
>& xTField
= aFields
[0];
2923 xField
.set(xTField
, UNO_QUERY
);
2924 DBG_ASSERT(xField
.is(),
2925 "Surprisingly, this TextField refuses to be a PropertySet!");
2935 /// map placeholder type
2936 enum XMLTokenEnum
XMLTextFieldExport::MapPlaceholderType(sal_uInt16 nType
)
2938 enum XMLTokenEnum eType
= XML_TEXT
;
2942 case PlaceholderType::TEXT
:
2946 case PlaceholderType::TABLE
:
2950 case PlaceholderType::TEXTFRAME
:
2951 eType
= XML_TEXT_BOX
;
2954 case PlaceholderType::GRAPHIC
:
2958 case PlaceholderType::OBJECT
:
2963 // unknown placeholder: XML_TEXT
2964 OSL_FAIL("unknown placeholder type");
2971 /// element name for author fields
2972 enum XMLTokenEnum
XMLTextFieldExport::MapAuthorFieldName(
2973 const Reference
<XPropertySet
> & xPropSet
)
2975 // Initials or full name?
2976 return GetBoolProperty(gsPropertyFullName
, xPropSet
)
2977 ? XML_AUTHOR_NAME
: XML_AUTHOR_INITIALS
;
2980 enum XMLTokenEnum
XMLTextFieldExport::MapPageNumberName(
2981 const Reference
<XPropertySet
> & xPropSet
,
2984 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
2985 PageNumberType ePage
;
2986 Any aAny
= xPropSet
->getPropertyValue(gsPropertySubType
);
2987 ePage
= *o3tl::doAccess
<PageNumberType
>(aAny
);
2991 case PageNumberType_PREV
:
2992 eName
= XML_PREVIOUS
;
2995 case PageNumberType_CURRENT
:
2996 eName
= XML_CURRENT
;
2998 case PageNumberType_NEXT
:
3003 OSL_FAIL("unknown page number type");
3004 eName
= XML_TOKEN_INVALID
;
3011 /// map TemplateDisplayFormat to XML
3012 enum XMLTokenEnum
XMLTextFieldExport::MapTemplateDisplayFormat(sal_Int16 nFormat
)
3014 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3018 case TemplateDisplayFormat::FULL
:
3021 case TemplateDisplayFormat::PATH
:
3024 case TemplateDisplayFormat::NAME
:
3027 case TemplateDisplayFormat::NAME_AND_EXT
:
3028 eName
= XML_NAME_AND_EXTENSION
;
3030 case TemplateDisplayFormat::AREA
:
3033 case TemplateDisplayFormat::TITLE
:
3037 OSL_FAIL("unknown template display format");
3038 eName
= XML_TOKEN_INVALID
;
3045 /// map count/statistics field token to XML name
3046 enum XMLTokenEnum
XMLTextFieldExport::MapCountFieldName(FieldIdEnum nToken
)
3048 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3052 case FIELD_ID_COUNT_PAGES
:
3053 eElement
= XML_PAGE_COUNT
;
3055 case FIELD_ID_COUNT_PARAGRAPHS
:
3056 eElement
= XML_PARAGRAPH_COUNT
;
3058 case FIELD_ID_COUNT_WORDS
:
3059 eElement
= XML_WORD_COUNT
;
3061 case FIELD_ID_COUNT_CHARACTERS
:
3062 eElement
= XML_CHARACTER_COUNT
;
3064 case FIELD_ID_COUNT_TABLES
:
3065 eElement
= XML_TABLE_COUNT
;
3067 case FIELD_ID_COUNT_GRAPHICS
:
3068 eElement
= XML_IMAGE_COUNT
;
3070 case FIELD_ID_COUNT_OBJECTS
:
3071 eElement
= XML_OBJECT_COUNT
;
3074 OSL_FAIL("no count field token");
3075 eElement
= XML_TOKEN_INVALID
;
3082 /// map ChapterDisplayFormat to XML string
3083 enum XMLTokenEnum
XMLTextFieldExport::MapChapterDisplayFormat(sal_Int16 nFormat
)
3085 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3089 case ChapterFormat::NAME
:
3092 case ChapterFormat::NUMBER
:
3095 case ChapterFormat::NAME_NUMBER
:
3096 eName
= XML_NUMBER_AND_NAME
;
3098 case ChapterFormat::NO_PREFIX_SUFFIX
:
3099 eName
= XML_PLAIN_NUMBER_AND_NAME
;
3101 case ChapterFormat::DIGIT
:
3102 eName
= XML_PLAIN_NUMBER
;
3105 OSL_FAIL("unknown chapter display format");
3106 eName
= XML_TOKEN_INVALID
;
3114 /// map FilenameDisplayFormat to XML attribute names
3115 enum XMLTokenEnum
XMLTextFieldExport::MapFilenameDisplayFormat(sal_Int16 nFormat
)
3117 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3121 case FilenameDisplayFormat::FULL
:
3124 case FilenameDisplayFormat::PATH
:
3127 case FilenameDisplayFormat::NAME
:
3130 case FilenameDisplayFormat::NAME_AND_EXT
:
3131 eName
= XML_NAME_AND_EXTENSION
;
3134 OSL_FAIL("unknown filename display format");
3141 /// map ReferenceFieldPart to XML string
3142 enum XMLTokenEnum
XMLTextFieldExport::MapReferenceType(sal_Int16 nType
)
3144 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3148 case ReferenceFieldPart::PAGE
:
3149 eElement
= XML_PAGE
;
3151 case ReferenceFieldPart::CHAPTER
:
3152 eElement
= XML_CHAPTER
;
3154 case ReferenceFieldPart::TEXT
:
3155 eElement
= XML_TEXT
;
3157 case ReferenceFieldPart::UP_DOWN
:
3158 eElement
= XML_DIRECTION
;
3160 case ReferenceFieldPart::CATEGORY_AND_NUMBER
:
3161 eElement
= XML_CATEGORY_AND_VALUE
;
3163 case ReferenceFieldPart::ONLY_CAPTION
:
3164 eElement
= XML_CAPTION
;
3166 case ReferenceFieldPart::ONLY_SEQUENCE_NUMBER
:
3167 eElement
= XML_VALUE
;
3169 case ReferenceFieldPart::PAGE_DESC
:
3170 // small hack: this value never gets written, because
3171 // XML_TEMPLATE is default
3172 eElement
= XML_TEMPLATE
;
3174 // Core implementation for direct cross-references (#i81002#)
3175 case ReferenceFieldPart::NUMBER
:
3176 eElement
= XML_NUMBER
;
3178 case ReferenceFieldPart::NUMBER_NO_CONTEXT
:
3179 eElement
= XML_NUMBER_NO_SUPERIOR
;
3181 case ReferenceFieldPart::NUMBER_FULL_CONTEXT
:
3182 eElement
= XML_NUMBER_ALL_SUPERIOR
;
3185 OSL_FAIL("unknown reference type");
3186 eElement
= XML_TEMPLATE
;
3193 /// map ReferenceFieldPart to XML string
3194 enum XMLTokenEnum
XMLTextFieldExport::MapReferenceSource(sal_Int16 nType
)
3196 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3200 case ReferenceFieldSource::REFERENCE_MARK
:
3201 eElement
= XML_REFERENCE_REF
;
3203 case ReferenceFieldSource::SEQUENCE_FIELD
:
3204 eElement
= XML_SEQUENCE_REF
;
3206 case ReferenceFieldSource::BOOKMARK
:
3207 eElement
= XML_BOOKMARK_REF
;
3209 case ReferenceFieldSource::FOOTNOTE
:
3210 case ReferenceFieldSource::ENDNOTE
:
3211 eElement
= XML_NOTE_REF
;
3213 case ReferenceFieldSource::STYLE
:
3214 eElement
= XML_STYLE_REF
;
3217 OSL_FAIL("unknown reference source");
3225 /// element name for sender fields
3226 enum XMLTokenEnum
XMLTextFieldExport::MapSenderFieldName(
3227 const Reference
<XPropertySet
> & xPropSet
)
3229 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3232 switch (GetInt16Property(gsPropertyFieldSubType
, xPropSet
))
3234 case UserDataPart::COMPANY
:
3235 eName
= XML_SENDER_COMPANY
;
3237 case UserDataPart::FIRSTNAME
:
3238 eName
= XML_SENDER_FIRSTNAME
;
3240 case UserDataPart::NAME
:
3241 eName
= XML_SENDER_LASTNAME
;
3243 case UserDataPart::SHORTCUT
:
3244 eName
= XML_SENDER_INITIALS
;
3246 case UserDataPart::STREET
:
3247 eName
= XML_SENDER_STREET
;
3249 case UserDataPart::COUNTRY
:
3250 eName
= XML_SENDER_COUNTRY
;
3252 case UserDataPart::ZIP
:
3253 eName
= XML_SENDER_POSTAL_CODE
;
3255 case UserDataPart::CITY
:
3256 eName
= XML_SENDER_CITY
;
3258 case UserDataPart::TITLE
:
3259 eName
= XML_SENDER_TITLE
;
3261 case UserDataPart::POSITION
:
3262 eName
= XML_SENDER_POSITION
;
3264 case UserDataPart::PHONE_PRIVATE
:
3265 eName
= XML_SENDER_PHONE_PRIVATE
;
3267 case UserDataPart::PHONE_COMPANY
:
3268 eName
= XML_SENDER_PHONE_WORK
;
3270 case UserDataPart::FAX
:
3271 eName
= XML_SENDER_FAX
;
3273 case UserDataPart::EMAIL
:
3274 eName
= XML_SENDER_EMAIL
;
3276 case UserDataPart::STATE
:
3277 eName
= XML_SENDER_STATE_OR_PROVINCE
;
3280 SAL_WARN("xmloff.text", "unknown sender type");
3281 eName
= XML_TOKEN_INVALID
;
3288 enum XMLTokenEnum
XMLTextFieldExport::MapDocInfoFieldName(
3289 enum FieldIdEnum nToken
)
3291 enum XMLTokenEnum eElement
= XML_TOKEN_INVALID
;
3295 case FIELD_ID_DOCINFO_CREATION_AUTHOR
:
3296 eElement
= XML_INITIAL_CREATOR
;
3298 case FIELD_ID_DOCINFO_CREATION_DATE
:
3299 eElement
= XML_CREATION_DATE
;
3301 case FIELD_ID_DOCINFO_CREATION_TIME
:
3302 eElement
= XML_CREATION_TIME
;
3304 case FIELD_ID_DOCINFO_DESCRIPTION
:
3305 eElement
= XML_DESCRIPTION
;
3307 case FIELD_ID_DOCINFO_PRINT_TIME
:
3308 eElement
= XML_PRINT_TIME
;
3310 case FIELD_ID_DOCINFO_PRINT_DATE
:
3311 eElement
= XML_PRINT_DATE
;
3313 case FIELD_ID_DOCINFO_PRINT_AUTHOR
:
3314 eElement
= XML_PRINTED_BY
;
3316 case FIELD_ID_DOCINFO_TITLE
:
3317 eElement
= XML_TITLE
;
3319 case FIELD_ID_DOCINFO_SUBJECT
:
3320 eElement
= XML_SUBJECT
;
3322 case FIELD_ID_DOCINFO_KEYWORDS
:
3323 eElement
= XML_KEYWORDS
;
3325 case FIELD_ID_DOCINFO_REVISION
:
3326 eElement
= XML_EDITING_CYCLES
;
3328 case FIELD_ID_DOCINFO_EDIT_DURATION
:
3329 eElement
= XML_EDITING_DURATION
;
3331 case FIELD_ID_DOCINFO_SAVE_TIME
:
3332 eElement
= XML_MODIFICATION_TIME
;
3334 case FIELD_ID_DOCINFO_SAVE_DATE
:
3335 eElement
= XML_MODIFICATION_DATE
;
3337 case FIELD_ID_DOCINFO_SAVE_AUTHOR
:
3338 eElement
= XML_CREATOR
;
3341 SAL_WARN("xmloff.text", "unknown docinfo field type!");
3342 eElement
= XML_TOKEN_INVALID
;
3349 enum XMLTokenEnum
XMLTextFieldExport::MapBibliographyFieldName(std::u16string_view sName
)
3351 enum XMLTokenEnum eName
= XML_TOKEN_INVALID
;
3353 if( sName
== u
"Identifier" )
3355 eName
= XML_IDENTIFIER
;
3357 else if( sName
== u
"BibiliographicType" )
3359 eName
= XML_BIBLIOGRAPHY_TYPE
;
3361 else if( sName
== u
"Address" )
3363 eName
= XML_ADDRESS
;
3365 else if( sName
== u
"Annote" )
3369 else if( sName
== u
"Author" )
3373 else if( sName
== u
"Booktitle" )
3375 eName
= XML_BOOKTITLE
;
3377 else if( sName
== u
"Chapter" )
3379 eName
= XML_CHAPTER
;
3381 else if( sName
== u
"Edition" )
3383 eName
= XML_EDITION
;
3385 else if( sName
== u
"Editor" )
3389 else if( sName
== u
"Howpublished" )
3391 eName
= XML_HOWPUBLISHED
;
3393 else if( sName
== u
"Institution" )
3395 eName
= XML_INSTITUTION
;
3397 else if( sName
== u
"Journal" )
3399 eName
= XML_JOURNAL
;
3401 else if( sName
== u
"Month" )
3405 else if( sName
== u
"Note" )
3409 else if( sName
== u
"Number" )
3413 else if( sName
== u
"Organizations" )
3415 eName
= XML_ORGANIZATIONS
;
3417 else if( sName
== u
"Pages" )
3421 else if( sName
== u
"Publisher" )
3423 eName
= XML_PUBLISHER
;
3425 else if( sName
== u
"School" )
3429 else if( sName
== u
"Series" )
3433 else if( sName
== u
"Title" )
3437 else if( sName
== u
"Report_Type" )
3439 eName
= XML_REPORT_TYPE
;
3441 else if( sName
== u
"Volume" )
3445 else if( sName
== u
"Year" )
3449 else if( sName
== u
"URL" )
3453 else if( sName
== u
"Custom1" )
3455 eName
= XML_CUSTOM1
;
3457 else if( sName
== u
"Custom2" )
3459 eName
= XML_CUSTOM2
;
3461 else if( sName
== u
"Custom3" )
3463 eName
= XML_CUSTOM3
;
3465 else if( sName
== u
"Custom4" )
3467 eName
= XML_CUSTOM4
;
3469 else if( sName
== u
"Custom5" )
3471 eName
= XML_CUSTOM5
;
3473 else if( sName
== u
"ISBN" )
3477 else if (sName
== u
"LocalURL")
3479 eName
= XML_LOCAL_URL
;
3481 else if (sName
== u
"TargetType")
3483 eName
= XML_TARGET_TYPE
;
3485 else if (sName
== u
"TargetURL")
3487 eName
= XML_TARGET_URL
;
3491 SAL_WARN("xmloff.text", "Unknown bibliography info data");
3492 eName
= XML_TOKEN_INVALID
;
3498 enum XMLTokenEnum
XMLTextFieldExport::MapMeasureKind(sal_Int16 nKind
)
3510 OUString
XMLTextFieldExport::MakeFootnoteRefName(
3513 // generate foot-/endnote ID
3514 return "ftn" + OUString::number(static_cast<sal_Int32
>(nSeqNo
));
3517 OUString
XMLTextFieldExport::MakeSequenceRefName(
3519 std::u16string_view rSeqName
)
3521 // generate foot-/endnote ID
3522 return OUString::Concat("ref") +rSeqName
+ OUString::number(static_cast<sal_Int32
>(nSeqNo
));
3526 // Property accessor helper functions
3529 // to be relegated (does that word exist?) to a more appropriate place
3532 bool GetBoolProperty(
3533 const OUString
& sPropName
,
3534 const Reference
<XPropertySet
> & xPropSet
)
3536 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3537 bool bBool
= *o3tl::doAccess
<bool>(aAny
);
3541 bool GetOptionalBoolProperty(
3542 const OUString
& sPropName
,
3543 const Reference
<XPropertySet
> & xPropSet
,
3544 const Reference
<XPropertySetInfo
> & xPropSetInfo
,
3547 return xPropSetInfo
->hasPropertyByName( sPropName
)
3548 ? GetBoolProperty( sPropName
, xPropSet
) : bDefault
;
3551 double GetDoubleProperty(
3552 const OUString
& sPropName
,
3553 const Reference
<XPropertySet
> & xPropSet
)
3555 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3556 double fDouble
= 0.0;
3561 OUString
GetStringProperty(
3562 const OUString
& sPropName
,
3563 const Reference
<XPropertySet
> & xPropSet
)
3565 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3571 sal_Int32
GetIntProperty(
3572 const OUString
& sPropName
,
3573 const Reference
<XPropertySet
> & xPropSet
)
3575 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3581 sal_Int16
GetInt16Property(
3582 const OUString
& sPropName
,
3583 const Reference
<XPropertySet
> & xPropSet
)
3585 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3591 sal_Int8
GetInt8Property(
3592 const OUString
& sPropName
,
3593 const Reference
<XPropertySet
> & xPropSet
)
3595 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3601 util::DateTime
GetDateTimeProperty(
3602 const OUString
& sPropName
,
3603 const Reference
<XPropertySet
> & xPropSet
)
3605 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3606 util::DateTime aTime
;
3611 Sequence
<OUString
> GetStringSequenceProperty(
3612 const OUString
& sPropName
,
3613 const Reference
<XPropertySet
> & xPropSet
)
3615 Any aAny
= xPropSet
->getPropertyValue(sPropName
);
3616 Sequence
<OUString
> aSequence
;
3621 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */