Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : /** @#file
31 : : *
32 : : * export of all text fields
33 : : */
34 : : #include "txtflde.hxx"
35 : : #include <xmloff/xmlexp.hxx>
36 : : #include <xmloff/xmlnumfe.hxx>
37 : : #include <xmloff/xmltoken.hxx>
38 : : #include <xmloff/xmlement.hxx>
39 : : #include <xmloff/xmluconv.hxx>
40 : : #include <xmloff/xmlnume.hxx>
41 : : #include "xmloff/numehelp.hxx"
42 : :
43 : : #include <xmloff/families.hxx>
44 : : #include <xmloff/XMLEventExport.hxx>
45 : : #include "XMLTextCharStyleNamesElementExport.hxx"
46 : : #include <xmloff/nmspmap.hxx>
47 : : #include <sax/tools/converter.hxx>
48 : :
49 : : #include <com/sun/star/util/DateTime.hpp>
50 : : #include <com/sun/star/util/Date.hpp>
51 : : #include <com/sun/star/lang/XServiceInfo.hpp>
52 : : #include <com/sun/star/text/UserDataPart.hpp>
53 : : #include <com/sun/star/text/PageNumberType.hpp>
54 : : #include <com/sun/star/style/NumberingType.hpp>
55 : : #include <com/sun/star/text/ReferenceFieldPart.hpp>
56 : : #include <com/sun/star/text/ReferenceFieldSource.hpp>
57 : : #include <com/sun/star/beans/XPropertySet.hpp>
58 : : #include <com/sun/star/beans/XPropertyState.hpp>
59 : : #include <com/sun/star/text/XTextField.hpp>
60 : : #include <com/sun/star/text/XDependentTextField.hpp>
61 : : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
62 : :
63 : : #include <com/sun/star/text/SetVariableType.hpp>
64 : : #include <com/sun/star/text/PlaceholderType.hpp>
65 : : #include <com/sun/star/text/FilenameDisplayFormat.hpp>
66 : : #include <com/sun/star/text/ChapterFormat.hpp>
67 : : #include <com/sun/star/text/TemplateDisplayFormat.hpp>
68 : : #include <com/sun/star/frame/XModel.hpp>
69 : : #include <com/sun/star/container/XNameReplace.hpp>
70 : : #include <com/sun/star/uno/Sequence.h>
71 : : #include <com/sun/star/util/NumberFormat.hpp>
72 : : #include <com/sun/star/text/BibliographyDataType.hpp>
73 : : #include <com/sun/star/sdb/CommandType.hpp>
74 : : #include <com/sun/star/rdf/XMetadatable.hpp>
75 : : #include <rtl/ustrbuf.hxx>
76 : : #include <tools/debug.hxx>
77 : : #include <rtl/math.hxx>
78 : :
79 : : #include <vector>
80 : :
81 : : using ::rtl::OUString;
82 : : using ::rtl::OUStringBuffer;
83 : :
84 : : using namespace ::std;
85 : : using namespace ::com::sun::star;
86 : : using namespace ::com::sun::star::uno;
87 : : using namespace ::com::sun::star::text;
88 : : using namespace ::com::sun::star::lang;
89 : : using namespace ::com::sun::star::beans;
90 : : using namespace ::com::sun::star::util;
91 : : using namespace ::com::sun::star::style;
92 : : using namespace ::com::sun::star::document;
93 : : using namespace ::com::sun::star::container;
94 : : using namespace ::xmloff::token;
95 : :
96 : :
97 : : static sal_Char const FIELD_SERVICE_SENDER[] = "ExtendedUser";
98 : : static sal_Char const FIELD_SERVICE_AUTHOR[] = "Author";
99 : : static sal_Char const FIELD_SERVICE_JUMPEDIT[] = "JumpEdit";
100 : : static sal_Char const FIELD_SERVICE_GETEXP[] = "GetExpression";
101 : : static sal_Char const FIELD_SERVICE_SETEXP[] = "SetExpression";
102 : : static sal_Char const FIELD_SERVICE_USER[] = "User";
103 : : static sal_Char const FIELD_SERVICE_INPUT[] = "Input";
104 : : static sal_Char const FIELD_SERVICE_USERINPUT[] = "InputUser";
105 : : static sal_Char const FIELD_SERVICE_DATETIME[] = "DateTime";
106 : : static sal_Char const FIELD_SERVICE_PAGENUMBER[] = "PageNumber";
107 : : static sal_Char const FIELD_SERVICE_DB_NEXT[] = "DatabaseNextSet";
108 : : static sal_Char const FIELD_SERVICE_DB_SELECT[] = "DatabaseNumberOfSet";
109 : : static sal_Char const FIELD_SERVICE_DB_NUMBER[] = "DatabaseSetNumber";
110 : : static sal_Char const FIELD_SERVICE_DB_DISPLAY[] = "Database";
111 : : static sal_Char const FIELD_SERVICE_DB_NAME[] = "DatabaseName";
112 : : static sal_Char const FIELD_SERVICE_CONDITIONAL_TEXT[] = "ConditionalText";
113 : : static sal_Char const FIELD_SERVICE_HIDDEN_TEXT[] = "HiddenText";
114 : : static sal_Char const FIELD_SERVICE_HIDDEN_PARAGRAPH[] = "HiddenParagraph";
115 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR[] = "DocInfo.ChangeAuthor";
116 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2[] = "docinfo.ChangeAuthor";
117 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME[] = "DocInfo.ChangeDateTime";
118 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2[] = "docinfo.ChangeDateTime";
119 : : static sal_Char const FIELD_SERVICE_DOC_INFO_EDIT_TIME[] = "DocInfo.EditTime";
120 : : static sal_Char const FIELD_SERVICE_DOC_INFO_EDIT_TIME2[] = "docinfo.EditTime";
121 : : static sal_Char const FIELD_SERVICE_DOC_INFO_DESCRIPTION[] = "DocInfo.Description";
122 : : static sal_Char const FIELD_SERVICE_DOC_INFO_DESCRIPTION2[] = "docinfo.Description";
123 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR[] = "DocInfo.CreateAuthor";
124 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2[] = "docinfo.CreateAuthor";
125 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME[] = "DocInfo.CreateDateTime";
126 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2[] = "docinfo.CreateDateTime";
127 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CUSTOM[] = "DocInfo.Custom";
128 : : static sal_Char const FIELD_SERVICE_DOC_INFO_CUSTOM2[] = "docinfo.Custom";
129 : : static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR[] = "DocInfo.PrintAuthor";
130 : : static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2[] = "docinfo.PrintAuthor";
131 : : static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME[] = "DocInfo.PrintDateTime";
132 : : static sal_Char const FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2[] = "docinfo.PrintDateTime";
133 : : static sal_Char const FIELD_SERVICE_DOC_INFO_KEY_WORDS[] = "DocInfo.KeyWords";
134 : : static sal_Char const FIELD_SERVICE_DOC_INFO_KEY_WORDS2[] = "docinfo.KeyWords";
135 : : static sal_Char const FIELD_SERVICE_DOC_INFO_SUBJECT[] = "DocInfo.Subject";
136 : : static sal_Char const FIELD_SERVICE_DOC_INFO_SUBJECT2[] = "docinfo.Subject";
137 : : static sal_Char const FIELD_SERVICE_DOC_INFO_TITLE[] = "DocInfo.Title";
138 : : static sal_Char const FIELD_SERVICE_DOC_INFO_TITLE2[] = "docinfo.Title";
139 : : static sal_Char const FIELD_SERVICE_DOC_INFO_REVISION[] = "DocInfo.Revision";
140 : : static sal_Char const FIELD_SERVICE_DOC_INFO_REVISION2[] = "docinfo.Revision";
141 : : static sal_Char const FIELD_SERVICE_FILE_NAME[] = "FileName";
142 : : static sal_Char const FIELD_SERVICE_CHAPTER[] = "Chapter";
143 : : static sal_Char const FIELD_SERVICE_TEMPLATE_NAME[] = "TemplateName";
144 : : static sal_Char const FIELD_SERVICE_PAGE_COUNT[] = "PageCount";
145 : : static sal_Char const FIELD_SERVICE_PARAGRAPH_COUNT[] = "ParagraphCount";
146 : : static sal_Char const FIELD_SERVICE_WORD_COUNT[] = "WordCount";
147 : : static sal_Char const FIELD_SERVICE_CHARACTER_COUNT[] = "CharacterCount";
148 : : static sal_Char const FIELD_SERVICE_TABLE_COUNT[] = "TableCount";
149 : : static sal_Char const FIELD_SERVICE_GRAPHIC_COUNT[] = "GraphicObjectCount";
150 : : static sal_Char const FIELD_SERVICE_OBJECT_COUNT[] = "EmbeddedObjectCount";
151 : : static sal_Char const FIELD_SERVICE_REFERENCE_PAGE_SET[] = "ReferencePageSet";
152 : : static sal_Char const FIELD_SERVICE_REFERENCE_PAGE_GET[] = "ReferencePageGet";
153 : : static sal_Char const FIELD_SERVICE_SHEET_NAME[] = "SheetName";
154 : : static sal_Char const FIELD_SERVICE_MACRO[] = "Macro";
155 : : static sal_Char const FIELD_SERVICE_GET_REFERENCE[] = "GetReference";
156 : : static sal_Char const FIELD_SERVICE_DDE[] = "DDE";
157 : : static sal_Char const FIELD_SERVICE_URL[] = "URL";
158 : : static sal_Char const FIELD_SERVICE_BIBLIOGRAPHY[] = "Bibliography";
159 : : static sal_Char const FIELD_SERVICE_SCRIPT[] = "Script";
160 : : static sal_Char const FIELD_SERVICE_ANNOTATION[] = "Annotation";
161 : : static sal_Char const FIELD_SERVICE_COMBINED_CHARACTERS[] = "CombinedCharacters";
162 : : static sal_Char const FIELD_SERVICE_META[] = "MetadataField";
163 : : static sal_Char const FIELD_SERVICE_MEASURE[] = "Measure";
164 : : static sal_Char const FIELD_SERVICE_TABLE_FORMULA[] = "TableFormula";
165 : : static sal_Char const FIELD_SERVICE_DROP_DOWN[] = "DropDown";
166 : :
167 : : SvXMLEnumStringMapEntry const aFieldServiceNameMapping[] =
168 : : {
169 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SENDER, FIELD_ID_SENDER ),
170 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_AUTHOR, FIELD_ID_AUTHOR ),
171 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_JUMPEDIT, FIELD_ID_PLACEHOLDER ),
172 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GETEXP, FIELD_ID_VARIABLE_GET ),
173 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SETEXP, FIELD_ID_VARIABLE_SET ),
174 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USER, FIELD_ID_USER_GET ),
175 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_INPUT, FIELD_ID_TEXT_INPUT ),
176 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_USERINPUT, FIELD_ID_USER_INPUT ),
177 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DATETIME, FIELD_ID_TIME ),
178 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGENUMBER, FIELD_ID_PAGENUMBER ),
179 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_SET, FIELD_ID_REFPAGE_SET ),
180 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_REFERENCE_PAGE_GET, FIELD_ID_REFPAGE_GET ),
181 : :
182 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NEXT, FIELD_ID_DATABASE_NEXT ),
183 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_SELECT, FIELD_ID_DATABASE_SELECT ),
184 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NUMBER, FIELD_ID_DATABASE_NUMBER ),
185 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_DISPLAY, FIELD_ID_DATABASE_DISPLAY ),
186 : : // workaround for #no-bug#: Database/DataBase
187 : : ENUM_STRING_MAP_ENTRY( "DataBase", FIELD_ID_DATABASE_DISPLAY ),
188 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DB_NAME, FIELD_ID_DATABASE_NAME ),
189 : :
190 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR, FIELD_ID_DOCINFO_CREATION_AUTHOR ),
191 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_AUTHOR2, FIELD_ID_DOCINFO_CREATION_AUTHOR ),
192 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME, FIELD_ID_DOCINFO_CREATION_TIME),
193 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CREATE_DATE_TIME2, FIELD_ID_DOCINFO_CREATION_TIME),
194 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR, FIELD_ID_DOCINFO_SAVE_AUTHOR ),
195 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_AUTHOR2, FIELD_ID_DOCINFO_SAVE_AUTHOR ),
196 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME, FIELD_ID_DOCINFO_SAVE_TIME ),
197 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CHANGE_DATE_TIME2, FIELD_ID_DOCINFO_SAVE_TIME ),
198 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME, FIELD_ID_DOCINFO_EDIT_DURATION ),
199 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_EDIT_TIME2, FIELD_ID_DOCINFO_EDIT_DURATION ),
200 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION, FIELD_ID_DOCINFO_DESCRIPTION ),
201 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_DESCRIPTION2, FIELD_ID_DOCINFO_DESCRIPTION ),
202 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM, FIELD_ID_DOCINFO_CUSTOM ),
203 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_CUSTOM2, FIELD_ID_DOCINFO_CUSTOM ),
204 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR, FIELD_ID_DOCINFO_PRINT_AUTHOR ),
205 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_AUTHOR2, FIELD_ID_DOCINFO_PRINT_AUTHOR ),
206 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME, FIELD_ID_DOCINFO_PRINT_TIME ),
207 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_PRINT_DATE_TIME2, FIELD_ID_DOCINFO_PRINT_TIME ),
208 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS, FIELD_ID_DOCINFO_KEYWORDS ),
209 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_KEY_WORDS2, FIELD_ID_DOCINFO_KEYWORDS ),
210 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT, FIELD_ID_DOCINFO_SUBJECT ),
211 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_SUBJECT2, FIELD_ID_DOCINFO_SUBJECT ),
212 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE, FIELD_ID_DOCINFO_TITLE ),
213 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_TITLE2, FIELD_ID_DOCINFO_TITLE ),
214 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION, FIELD_ID_DOCINFO_REVISION ),
215 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DOC_INFO_REVISION2, FIELD_ID_DOCINFO_REVISION ),
216 : :
217 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CONDITIONAL_TEXT, FIELD_ID_CONDITIONAL_TEXT ),
218 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_TEXT, FIELD_ID_HIDDEN_TEXT ),
219 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_HIDDEN_PARAGRAPH, FIELD_ID_HIDDEN_PARAGRAPH ),
220 : :
221 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_FILE_NAME, FIELD_ID_FILE_NAME ),
222 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHAPTER, FIELD_ID_CHAPTER ),
223 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TEMPLATE_NAME, FIELD_ID_TEMPLATE_NAME ),
224 : :
225 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGE_COUNT, FIELD_ID_COUNT_PAGES ),
226 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PARAGRAPH_COUNT, FIELD_ID_COUNT_PARAGRAPHS ),
227 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_WORD_COUNT, FIELD_ID_COUNT_WORDS ),
228 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_CHARACTER_COUNT, FIELD_ID_COUNT_CHARACTERS ),
229 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_COUNT, FIELD_ID_COUNT_TABLES ),
230 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GRAPHIC_COUNT, FIELD_ID_COUNT_GRAPHICS ),
231 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_OBJECT_COUNT, FIELD_ID_COUNT_OBJECTS ),
232 : :
233 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MACRO, FIELD_ID_MACRO ),
234 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_GET_REFERENCE, FIELD_ID_REF_REFERENCE ),
235 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DDE, FIELD_ID_DDE ),
236 : :
237 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_BIBLIOGRAPHY, FIELD_ID_BIBLIOGRAPHY ),
238 : :
239 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SCRIPT, FIELD_ID_SCRIPT ),
240 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_ANNOTATION, FIELD_ID_ANNOTATION ),
241 : :
242 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_COMBINED_CHARACTERS, FIELD_ID_COMBINED_CHARACTERS ),
243 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_META, FIELD_ID_META ),
244 : :
245 : : // non-writer fields
246 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SHEET_NAME, FIELD_ID_SHEET_NAME ),
247 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_URL, FIELD_ID_URL ),
248 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MEASURE, FIELD_ID_MEASURE ),
249 : :
250 : : // deprecated fields
251 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_TABLE_FORMULA, FIELD_ID_TABLE_FORMULA ),
252 : : ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_DROP_DOWN, FIELD_ID_DROP_DOWN ),
253 : :
254 : : ENUM_STRING_MAP_END()
255 : : };
256 : :
257 : :
258 : :
259 : : // property accessor helper functions
260 : : inline sal_Bool GetBoolProperty(const OUString&,
261 : : const Reference<XPropertySet> &);
262 : : inline sal_Bool GetOptionalBoolProperty(const OUString&,
263 : : const Reference<XPropertySet> &,
264 : : const Reference<XPropertySetInfo> &,
265 : : sal_Bool bDefault);
266 : : inline double GetDoubleProperty(const OUString&,
267 : : const Reference<XPropertySet> &);
268 : : inline OUString const GetStringProperty(const OUString&,
269 : : const Reference<XPropertySet> &);
270 : : inline sal_Int32 GetIntProperty(const OUString&,
271 : : const Reference<XPropertySet> &);
272 : : inline sal_Int16 GetInt16Property(const OUString&,
273 : : const Reference<XPropertySet> &);
274 : : inline sal_Int8 GetInt8Property(const OUString&,
275 : : const Reference<XPropertySet> &);
276 : : inline DateTime const GetDateTimeProperty( const OUString& sPropName,
277 : : const Reference<XPropertySet> & xPropSet);
278 : : inline Date const GetDateProperty( const OUString& sPropName,
279 : : const Reference<XPropertySet> & xPropSet);
280 : : inline Sequence<OUString> const GetStringSequenceProperty(
281 : : const OUString& sPropName,
282 : : const Reference<XPropertySet> & xPropSet);
283 : :
284 : :
285 : :
286 : 77 : XMLTextFieldExport::XMLTextFieldExport( SvXMLExport& rExp,
287 : : XMLPropertyState* pCombinedCharState)
288 : : : rExport(rExp),
289 : : pUsedMasters(NULL),
290 : : sServicePrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.")),
291 : : sFieldMasterPrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.FieldMaster.")),
292 : : sPresentationServicePrefix(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TextField.")),
293 : :
294 : : sPropertyAdjust(RTL_CONSTASCII_USTRINGPARAM("Adjust")),
295 : : sPropertyAuthor(RTL_CONSTASCII_USTRINGPARAM("Author")),
296 : : sPropertyChapterFormat(RTL_CONSTASCII_USTRINGPARAM("ChapterFormat")),
297 : : sPropertyChapterNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("ChapterNumberingLevel")),
298 : : sPropertyCharStyleNames(RTL_CONSTASCII_USTRINGPARAM("CharStyleNames")),
299 : : sPropertyCondition(RTL_CONSTASCII_USTRINGPARAM("Condition")),
300 : : sPropertyContent(RTL_CONSTASCII_USTRINGPARAM("Content")),
301 : : sPropertyDataBaseName(RTL_CONSTASCII_USTRINGPARAM("DataBaseName")),
302 : : sPropertyDataBaseURL(RTL_CONSTASCII_USTRINGPARAM("DataBaseURL")),
303 : : sPropertyDataColumnName(RTL_CONSTASCII_USTRINGPARAM("DataColumnName")),
304 : : sPropertyDataCommandType(RTL_CONSTASCII_USTRINGPARAM("DataCommandType")),
305 : : sPropertyDataTableName(RTL_CONSTASCII_USTRINGPARAM("DataTableName")),
306 : : sPropertyDate(RTL_CONSTASCII_USTRINGPARAM("Date")),
307 : : sPropertyDateTime(RTL_CONSTASCII_USTRINGPARAM("DateTime")),
308 : : sPropertyDateTimeValue(RTL_CONSTASCII_USTRINGPARAM("DateTimeValue")),
309 : : sPropertyDDECommandElement(RTL_CONSTASCII_USTRINGPARAM("DDECommandElement")),
310 : : sPropertyDDECommandFile(RTL_CONSTASCII_USTRINGPARAM("DDECommandFile")),
311 : : sPropertyDDECommandType(RTL_CONSTASCII_USTRINGPARAM("DDECommandType")),
312 : : sPropertyDependentTextFields(RTL_CONSTASCII_USTRINGPARAM("DependentTextFields")),
313 : : sPropertyFalseContent(RTL_CONSTASCII_USTRINGPARAM("FalseContent")),
314 : : sPropertyFields(RTL_CONSTASCII_USTRINGPARAM("Fields")),
315 : : sPropertyFieldSubType(RTL_CONSTASCII_USTRINGPARAM("UserDataType")),
316 : : sPropertyFileFormat(RTL_CONSTASCII_USTRINGPARAM("FileFormat")),
317 : : sPropertyFullName(RTL_CONSTASCII_USTRINGPARAM("FullName")),
318 : : sPropertyHint(RTL_CONSTASCII_USTRINGPARAM("Hint")),
319 : : sPropertyInitials("Initials"),
320 : : sPropertyInstanceName(RTL_CONSTASCII_USTRINGPARAM("InstanceName")),
321 : : sPropertyIsAutomaticUpdate(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticUpdate")),
322 : : sPropertyIsConditionTrue(RTL_CONSTASCII_USTRINGPARAM("IsConditionTrue")),
323 : : sPropertyIsDataBaseFormat(RTL_CONSTASCII_USTRINGPARAM("DataBaseFormat")),
324 : : sPropertyIsDate(RTL_CONSTASCII_USTRINGPARAM("IsDate")),
325 : : sPropertyIsExpression(RTL_CONSTASCII_USTRINGPARAM("IsExpression")),
326 : : sPropertyIsFixed(RTL_CONSTASCII_USTRINGPARAM("IsFixed")),
327 : : sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM("IsFixedLanguage")),
328 : : sPropertyIsHidden(RTL_CONSTASCII_USTRINGPARAM("IsHidden")),
329 : : sPropertyIsInput(RTL_CONSTASCII_USTRINGPARAM("Input")),
330 : : sPropertyIsShowFormula(RTL_CONSTASCII_USTRINGPARAM("IsShowFormula")),
331 : : sPropertyIsVisible(RTL_CONSTASCII_USTRINGPARAM("IsVisible")),
332 : : sPropertyItems(RTL_CONSTASCII_USTRINGPARAM("Items")),
333 : : sPropertyLevel(RTL_CONSTASCII_USTRINGPARAM("Level")),
334 : : sPropertyMacro(RTL_CONSTASCII_USTRINGPARAM("Macro")),
335 : : sPropertyMeasureKind(RTL_CONSTASCII_USTRINGPARAM("Kind")),
336 : : sPropertyName(RTL_CONSTASCII_USTRINGPARAM("Name")),
337 : : sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
338 : : sPropertyNumberingSeparator(RTL_CONSTASCII_USTRINGPARAM("NumberingSeparator")),
339 : : sPropertyNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType")),
340 : : sPropertyOffset(RTL_CONSTASCII_USTRINGPARAM("Offset")),
341 : : sPropertyOn(RTL_CONSTASCII_USTRINGPARAM("On")),
342 : : sPropertyPlaceholder(RTL_CONSTASCII_USTRINGPARAM("PlaceHolder")),
343 : : sPropertyPlaceholderType(RTL_CONSTASCII_USTRINGPARAM("PlaceHolderType")),
344 : : sPropertyReferenceFieldPart(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldPart")),
345 : : sPropertyReferenceFieldSource(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldSource")),
346 : : sPropertyReferenceFieldType(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldType")),
347 : : sPropertyRevision(RTL_CONSTASCII_USTRINGPARAM("Revision")),
348 : : sPropertyScriptType(RTL_CONSTASCII_USTRINGPARAM("ScriptType")),
349 : : sPropertySelectedItem(RTL_CONSTASCII_USTRINGPARAM("SelectedItem")),
350 : : sPropertySequenceNumber(RTL_CONSTASCII_USTRINGPARAM("SequenceNumber")),
351 : : sPropertySequenceValue(RTL_CONSTASCII_USTRINGPARAM("SequenceValue")),
352 : : sPropertySetNumber(RTL_CONSTASCII_USTRINGPARAM("SetNumber")),
353 : : sPropertySourceName(RTL_CONSTASCII_USTRINGPARAM("SourceName")),
354 : : sPropertySubType(RTL_CONSTASCII_USTRINGPARAM("SubType")),
355 : : sPropertyTargetFrame(RTL_CONSTASCII_USTRINGPARAM("TargetFrame")),
356 : : sPropertyTrueContent(RTL_CONSTASCII_USTRINGPARAM("TrueContent")),
357 : : sPropertyURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
358 : : sPropertyURLContent(RTL_CONSTASCII_USTRINGPARAM("URLContent")),
359 : : sPropertyUserText(RTL_CONSTASCII_USTRINGPARAM("UserText")),
360 : : sPropertyValue(RTL_CONSTASCII_USTRINGPARAM("Value")),
361 : : sPropertyVariableName(RTL_CONSTASCII_USTRINGPARAM("VariableName")),
362 : : sPropertyVariableSubType(RTL_CONSTASCII_USTRINGPARAM("VariableSubtype")),
363 : : sPropertyHelp(RTL_CONSTASCII_USTRINGPARAM("Help")),
364 : : sPropertyTooltip(RTL_CONSTASCII_USTRINGPARAM("Tooltip")),
365 : : sPropertyTextRange(RTL_CONSTASCII_USTRINGPARAM("TextRange")),
366 [ + - ][ + - ]: 77 : pCombinedCharactersPropertyState(pCombinedCharState)
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
367 : : {
368 [ + - ]: 77 : SetExportOnlyUsedFieldDeclarations();
369 : 77 : }
370 : :
371 : 77 : XMLTextFieldExport::~XMLTextFieldExport()
372 : : {
373 [ + - ]: 77 : delete pCombinedCharactersPropertyState;
374 [ + + ]: 77 : delete pUsedMasters;
375 [ - + ]: 154 : }
376 : :
377 : : /// get the field ID (as in FieldIDEnum) from XTextField
378 : 198 : enum FieldIdEnum XMLTextFieldExport::GetFieldID(
379 : : const Reference<XTextField> & rTextField,
380 : : const Reference<XPropertySet> & xPropSet)
381 : : {
382 : : // get service names for rTextField (via XServiceInfo service)
383 [ + - ]: 198 : Reference<XServiceInfo> xService(rTextField, UNO_QUERY);
384 [ + - ][ + - ]: 198 : const Sequence<OUString> aServices = xService->getSupportedServiceNames();
385 : 198 : const OUString* pNames = aServices.getConstArray();
386 : 198 : sal_Int32 nCount = aServices.getLength();
387 : :
388 : 198 : OUString sFieldName; // service name postfix of current field
389 : :
390 : : // search for TextField service name
391 [ + + ]: 710 : while( nCount-- )
392 : : {
393 [ + + ]: 646 : if (pNames->matchIgnoreAsciiCase(sServicePrefix))
394 : : {
395 : : // TextField found => postfix is field type!
396 : 134 : sFieldName = pNames->copy(sServicePrefix.getLength());
397 : 134 : break;
398 : : }
399 : :
400 : 512 : ++pNames;
401 : : }
402 : :
403 : : // if this is not a normal text field, check if its a presentation text field
404 [ + + ]: 198 : if( sFieldName.isEmpty() )
405 : : {
406 : 64 : const OUString* pNames2 = aServices.getConstArray();
407 : 64 : sal_Int32 nCount2 = aServices.getLength();
408 : : // search for TextField service name
409 [ + - ]: 192 : while( nCount2-- )
410 : : {
411 [ + + ]: 192 : if( 0 == pNames2->compareTo(sPresentationServicePrefix, sPresentationServicePrefix.getLength()))
412 : : {
413 : : // TextField found => postfix is field type!
414 : 64 : sFieldName = pNames2->copy(sPresentationServicePrefix.getLength());
415 : 64 : break;
416 : : }
417 : :
418 : 128 : ++pNames2;
419 : : }
420 : :
421 [ + - ]: 64 : if( !sFieldName.isEmpty() )
422 : : {
423 [ + + ]: 64 : if( sFieldName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "Header" ) ) == 0 )
424 : : {
425 : 16 : return FIELD_ID_DRAW_HEADER;
426 : : }
427 [ + + ]: 48 : else if( sFieldName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "Footer" ) ) == 0 )
428 : : {
429 : 24 : return FIELD_ID_DRAW_FOOTER;
430 : : }
431 [ + - ]: 24 : else if( sFieldName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateTime" ) ) == 0 )
432 : : {
433 : 24 : return FIELD_ID_DRAW_DATE_TIME;
434 : : }
435 : : }
436 : : }
437 : :
438 : : // map postfix of service name to field ID
439 : : DBG_ASSERT(!sFieldName.isEmpty(), "no TextField service found!");
440 [ + - ][ + - ]: 198 : return MapFieldName(sFieldName, xPropSet);
441 : : }
442 : :
443 : 134 : enum FieldIdEnum XMLTextFieldExport::MapFieldName(
444 : : const OUString& sFieldName, // field (master) name
445 : : const Reference<XPropertySet> & xPropSet) // for subtype
446 : : {
447 : : // we'll proceed in 2 steps:
448 : : // a) map service name to preliminary FIELD_ID
449 : : // b) map those prelim. FIELD_IDs that correspond to several field types
450 : : // (in our (XML) world) to final FIELD IDs
451 : :
452 : :
453 : : // a) find prelim. FIELD_ID via aFieldServiceMapping
454 : :
455 : : // check for non-empty service name
456 : : DBG_ASSERT(!sFieldName.isEmpty(), "no valid service name!");
457 : 134 : enum FieldIdEnum nToken = FIELD_ID_UNKNOWN;
458 [ + - ]: 134 : if (!sFieldName.isEmpty())
459 : : {
460 : : // map name to prelim. ID
461 : : sal_uInt16 nTmp;
462 : 134 : sal_Bool bRet = GetExport().GetMM100UnitConverter().convertEnum(
463 [ + - ]: 134 : nTmp, sFieldName, aFieldServiceNameMapping);
464 : :
465 : : // check return
466 : : DBG_ASSERT(bRet, "Unknown field service name encountered!");
467 [ - + ]: 134 : if (! bRet)
468 : : {
469 : 0 : nToken = FIELD_ID_UNKNOWN;
470 : : }
471 : : else
472 : : {
473 : 134 : nToken = (enum FieldIdEnum)nTmp;
474 : : }
475 : : } else {
476 : : // invalid service name
477 : 0 : nToken = FIELD_ID_UNKNOWN;
478 : : }
479 : :
480 : : // b) map prelim. to final FIELD_IDs
481 [ - - + + : 134 : switch (nToken) {
- - - - +
- ]
482 : : case FIELD_ID_VARIABLE_SET:
483 [ # # ]: 0 : if (GetBoolProperty(sPropertyIsInput, xPropSet))
484 : : {
485 : 0 : nToken = FIELD_ID_VARIABLE_INPUT;
486 : : }
487 : : else
488 : : {
489 [ # # # ]: 0 : switch (GetIntProperty(sPropertySubType, xPropSet))
490 : : {
491 : : case SetVariableType::STRING: // text field
492 : : case SetVariableType::VAR: // num field
493 : 0 : nToken = FIELD_ID_VARIABLE_SET;
494 : 0 : break;
495 : : case SetVariableType::SEQUENCE:
496 : 0 : nToken = FIELD_ID_SEQUENCE;
497 : 0 : break;
498 : : case SetVariableType::FORMULA:
499 : : default:
500 : 0 : nToken = FIELD_ID_UNKNOWN;
501 : 0 : break;
502 : : }
503 : : }
504 : 0 : break;
505 : :
506 : : case FIELD_ID_VARIABLE_GET:
507 [ # # # ]: 0 : switch (GetIntProperty(sPropertySubType, xPropSet))
508 : : {
509 : : case SetVariableType::STRING: // text field
510 : : case SetVariableType::VAR: // num field
511 : 0 : nToken = FIELD_ID_VARIABLE_GET;
512 : 0 : break;
513 : : case SetVariableType::FORMULA:
514 : 0 : nToken = FIELD_ID_EXPRESSION;
515 : 0 : break;
516 : : case SetVariableType::SEQUENCE:
517 : : default:
518 : 0 : nToken = FIELD_ID_UNKNOWN;
519 : 0 : break;
520 : : }
521 : 0 : break;
522 : :
523 : : case FIELD_ID_TIME:
524 [ + + ]: 16 : if (GetBoolProperty(sPropertyIsDate, xPropSet))
525 : : {
526 : 8 : nToken = FIELD_ID_DATE;
527 : : }
528 : 16 : break;
529 : :
530 : : case FIELD_ID_PAGENUMBER:
531 : : // NumberingType not available in non-Writer apps
532 [ + - ][ - + ]: 80 : if (xPropSet->getPropertySetInfo()->
533 [ + - ]: 40 : hasPropertyByName(sPropertyNumberingType))
534 : : {
535 [ # # ]: 0 : if (NumberingType::CHAR_SPECIAL == GetIntProperty(
536 : 0 : sPropertyNumberingType, xPropSet))
537 : : {
538 : 0 : nToken = FIELD_ID_PAGESTRING;
539 : : }
540 : : }
541 : 40 : break;
542 : :
543 : : case FIELD_ID_DOCINFO_CREATION_TIME:
544 [ # # ]: 0 : if (GetBoolProperty(sPropertyIsDate, xPropSet))
545 : : {
546 : 0 : nToken = FIELD_ID_DOCINFO_CREATION_DATE;
547 : : }
548 : 0 : break;
549 : :
550 : : case FIELD_ID_DOCINFO_PRINT_TIME:
551 [ # # ]: 0 : if (GetBoolProperty(sPropertyIsDate, xPropSet))
552 : : {
553 : 0 : nToken = FIELD_ID_DOCINFO_PRINT_DATE;
554 : : }
555 : 0 : break;
556 : :
557 : : case FIELD_ID_DOCINFO_SAVE_TIME:
558 [ # # ]: 0 : if (GetBoolProperty(sPropertyIsDate, xPropSet))
559 : : {
560 : 0 : nToken = FIELD_ID_DOCINFO_SAVE_DATE;
561 : : }
562 : 0 : break;
563 : :
564 : : case FIELD_ID_REF_REFERENCE:
565 [ # # # # : 0 : switch (GetInt16Property(sPropertyReferenceFieldSource, xPropSet))
# # ]
566 : : {
567 : : case ReferenceFieldSource::REFERENCE_MARK:
568 : 0 : nToken = FIELD_ID_REF_REFERENCE;
569 : 0 : break;
570 : : case ReferenceFieldSource::SEQUENCE_FIELD:
571 : 0 : nToken = FIELD_ID_REF_SEQUENCE;
572 : 0 : break;
573 : : case ReferenceFieldSource::BOOKMARK:
574 : 0 : nToken = FIELD_ID_REF_BOOKMARK;
575 : 0 : break;
576 : : case ReferenceFieldSource::FOOTNOTE:
577 : 0 : nToken = FIELD_ID_REF_FOOTNOTE;
578 : 0 : break;
579 : : case ReferenceFieldSource::ENDNOTE:
580 : 0 : nToken = FIELD_ID_REF_ENDNOTE;
581 : 0 : break;
582 : : default:
583 : 0 : nToken = FIELD_ID_UNKNOWN;
584 : 0 : break;
585 : : }
586 : 0 : break;
587 : :
588 : : case FIELD_ID_COMBINED_CHARACTERS:
589 : : case FIELD_ID_SCRIPT:
590 : : case FIELD_ID_ANNOTATION:
591 : : case FIELD_ID_BIBLIOGRAPHY:
592 : : case FIELD_ID_DDE:
593 : : case FIELD_ID_MACRO:
594 : : case FIELD_ID_REFPAGE_SET:
595 : : case FIELD_ID_REFPAGE_GET:
596 : : case FIELD_ID_COUNT_PAGES:
597 : : case FIELD_ID_COUNT_PARAGRAPHS:
598 : : case FIELD_ID_COUNT_WORDS:
599 : : case FIELD_ID_COUNT_CHARACTERS:
600 : : case FIELD_ID_COUNT_TABLES:
601 : : case FIELD_ID_COUNT_GRAPHICS:
602 : : case FIELD_ID_COUNT_OBJECTS:
603 : : case FIELD_ID_CONDITIONAL_TEXT:
604 : : case FIELD_ID_HIDDEN_TEXT:
605 : : case FIELD_ID_HIDDEN_PARAGRAPH:
606 : : case FIELD_ID_DOCINFO_CREATION_AUTHOR:
607 : : case FIELD_ID_DOCINFO_DESCRIPTION:
608 : : case FIELD_ID_DOCINFO_CUSTOM:
609 : : case FIELD_ID_DOCINFO_PRINT_AUTHOR:
610 : : case FIELD_ID_DOCINFO_TITLE:
611 : : case FIELD_ID_DOCINFO_SUBJECT:
612 : : case FIELD_ID_DOCINFO_KEYWORDS:
613 : : case FIELD_ID_DOCINFO_REVISION:
614 : : case FIELD_ID_DOCINFO_EDIT_DURATION:
615 : : case FIELD_ID_DOCINFO_SAVE_AUTHOR:
616 : : case FIELD_ID_TEXT_INPUT:
617 : : case FIELD_ID_USER_INPUT:
618 : : case FIELD_ID_AUTHOR:
619 : : case FIELD_ID_SENDER:
620 : : case FIELD_ID_PLACEHOLDER:
621 : : case FIELD_ID_USER_GET:
622 : : case FIELD_ID_DATABASE_NEXT:
623 : : case FIELD_ID_DATABASE_SELECT:
624 : : case FIELD_ID_DATABASE_DISPLAY:
625 : : case FIELD_ID_DATABASE_NAME:
626 : : case FIELD_ID_DATABASE_NUMBER:
627 : : case FIELD_ID_TEMPLATE_NAME:
628 : : case FIELD_ID_CHAPTER:
629 : : case FIELD_ID_FILE_NAME:
630 : : case FIELD_ID_META:
631 : : case FIELD_ID_SHEET_NAME:
632 : : case FIELD_ID_MEASURE:
633 : : case FIELD_ID_URL:
634 : : case FIELD_ID_TABLE_FORMULA:
635 : : case FIELD_ID_DROP_DOWN:
636 : : ; // these field IDs are final
637 : 78 : break;
638 : :
639 : : default:
640 : 0 : nToken = FIELD_ID_UNKNOWN;
641 : : }
642 : :
643 : : // ... and return final FIELD_ID
644 : 134 : return nToken;
645 : : }
646 : :
647 : : // is string or numeric field?
648 : 20 : sal_Bool XMLTextFieldExport::IsStringField(
649 : : FieldIdEnum nFieldType,
650 : : const Reference<XPropertySet> & xPropSet)
651 : : {
652 [ - - + - : 20 : switch (nFieldType) {
- - - - ]
653 : :
654 : : case FIELD_ID_VARIABLE_GET:
655 : : case FIELD_ID_VARIABLE_SET:
656 : : case FIELD_ID_VARIABLE_INPUT:
657 : : {
658 : : // depends on field sub type
659 : 0 : return ( GetIntProperty(sPropertySubType, xPropSet) ==
660 : 0 : SetVariableType::STRING );
661 : : }
662 : :
663 : : case FIELD_ID_USER_GET:
664 : : case FIELD_ID_USER_INPUT:
665 : : {
666 [ # # ]: 0 : Reference<XTextField> xTextField(xPropSet, UNO_QUERY);
667 : : DBG_ASSERT(xTextField.is(), "field is no XTextField!");
668 : : sal_Bool bRet = GetBoolProperty(sPropertyIsExpression,
669 [ # # ][ # # ]: 0 : GetMasterPropertySet(xTextField));
670 : 0 : return !bRet;
671 : : }
672 : :
673 : : case FIELD_ID_META:
674 : 20 : return 0 > GetIntProperty(sPropertyNumberFormat, xPropSet);
675 : :
676 : : case FIELD_ID_DATABASE_DISPLAY:
677 : : // TODO: depends on... ???
678 : : // workaround #no-bug#: no data type
679 : 0 : return 5100 == GetIntProperty(sPropertyNumberFormat, xPropSet);
680 : :
681 : : case FIELD_ID_TABLE_FORMULA:
682 : : // legacy field: always a number field (because it always has
683 : : // a number format)
684 : 0 : return sal_False;
685 : :
686 : : case FIELD_ID_COUNT_PAGES:
687 : : case FIELD_ID_COUNT_PARAGRAPHS:
688 : : case FIELD_ID_COUNT_WORDS:
689 : : case FIELD_ID_COUNT_CHARACTERS:
690 : : case FIELD_ID_COUNT_TABLES:
691 : : case FIELD_ID_COUNT_GRAPHICS:
692 : : case FIELD_ID_COUNT_OBJECTS:
693 : : case FIELD_ID_DOCINFO_SAVE_TIME:
694 : : case FIELD_ID_DOCINFO_SAVE_DATE:
695 : : case FIELD_ID_DOCINFO_CREATION_DATE:
696 : : case FIELD_ID_DOCINFO_CREATION_TIME:
697 : : case FIELD_ID_DOCINFO_PRINT_TIME:
698 : : case FIELD_ID_DOCINFO_PRINT_DATE:
699 : : case FIELD_ID_DOCINFO_EDIT_DURATION:
700 : : case FIELD_ID_DOCINFO_REVISION:
701 : : case FIELD_ID_DATABASE_NUMBER:
702 : : case FIELD_ID_EXPRESSION:
703 : : case FIELD_ID_SEQUENCE:
704 : : case FIELD_ID_DATE:
705 : : case FIELD_ID_TIME:
706 : : case FIELD_ID_PAGENUMBER:
707 : : case FIELD_ID_REFPAGE_SET:
708 : : case FIELD_ID_REFPAGE_GET:
709 : : case FIELD_ID_DOCINFO_CUSTOM:
710 : : // always number
711 : 0 : return sal_False;
712 : :
713 : : case FIELD_ID_COMBINED_CHARACTERS:
714 : : case FIELD_ID_BIBLIOGRAPHY:
715 : : case FIELD_ID_DDE:
716 : : case FIELD_ID_REF_REFERENCE:
717 : : case FIELD_ID_REF_SEQUENCE:
718 : : case FIELD_ID_REF_BOOKMARK:
719 : : case FIELD_ID_REF_FOOTNOTE:
720 : : case FIELD_ID_REF_ENDNOTE:
721 : : case FIELD_ID_MACRO:
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_PAGESTRING:
740 : : case FIELD_ID_SHEET_NAME:
741 : : case FIELD_ID_MEASURE:
742 : : case FIELD_ID_URL:
743 : : case FIELD_ID_DROP_DOWN:
744 : : // always string:
745 : 0 : return sal_True;
746 : :
747 : : case FIELD_ID_SCRIPT:
748 : : case FIELD_ID_ANNOTATION:
749 : : case FIELD_ID_DATABASE_NEXT:
750 : : case FIELD_ID_DATABASE_SELECT:
751 : : case FIELD_ID_VARIABLE_DECL:
752 : : case FIELD_ID_USER_DECL:
753 : : case FIELD_ID_SEQUENCE_DECL:
754 : : case FIELD_ID_PLACEHOLDER:
755 : : case FIELD_ID_UNKNOWN:
756 : : case FIELD_ID_DRAW_HEADER:
757 : : case FIELD_ID_DRAW_FOOTER:
758 : : case FIELD_ID_DRAW_DATE_TIME:
759 : : default:
760 : : OSL_FAIL("unkown field type/field has no content");
761 : 20 : return sal_True; // invalid info; string in case of doubt
762 : : }
763 : : }
764 : :
765 : : /// export the styles needed by the given field. Called on first pass
766 : : /// through document
767 : 99 : void XMLTextFieldExport::ExportFieldAutoStyle(
768 : : const Reference<XTextField> & rTextField, const sal_Bool bProgress,
769 : : const sal_Bool bRecursive )
770 : : {
771 : : // get property set
772 [ + - ]: 99 : Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
773 : :
774 : : // add field master to list of used field masters (if desired)
775 [ + + ]: 99 : if (NULL != pUsedMasters)
776 : : {
777 [ + - ]: 76 : Reference<XDependentTextField> xDepField(rTextField, UNO_QUERY);
778 [ - + ]: 76 : if (xDepField.is())
779 : : {
780 [ # # ][ # # ]: 0 : Reference<XText> xOurText = rTextField->getAnchor()->getText();
[ # # ][ # # ]
781 : :
782 : : map<Reference<XText>, set<OUString> >::iterator aMapIter =
783 [ # # ]: 0 : pUsedMasters->find(xOurText);
784 : :
785 : : // insert a list for our XText (if necessary)
786 [ # # ]: 0 : if (aMapIter == pUsedMasters->end())
787 : : {
788 [ # # ]: 0 : set<OUString> aSet;
789 [ # # ][ # # ]: 0 : (*pUsedMasters)[xOurText] = aSet;
790 [ # # ]: 0 : aMapIter = pUsedMasters->find(xOurText);
791 : : }
792 : :
793 : : // insert this text field master
794 : : OUString sFieldMasterName = GetStringProperty(
795 [ # # ][ # # ]: 0 : sPropertyInstanceName, xDepField->getTextFieldMaster());
[ # # ]
796 [ # # ]: 0 : if (!sFieldMasterName.isEmpty())
797 [ # # ]: 0 : aMapIter->second.insert( sFieldMasterName );
798 : 76 : }
799 : : // else: no dependent field -> no master -> ignore
800 : : }
801 : :
802 : : // get Field ID
803 [ + - ]: 99 : FieldIdEnum nToken = GetFieldID(rTextField, xPropSet);
804 : :
805 : : // export the character style for all fields
806 : : // with one exception: combined character fields export their own
807 : : // text style below
808 [ + - ][ + - ]: 99 : Reference <XPropertySet> xRangePropSet(rTextField->getAnchor(), UNO_QUERY);
[ + - ]
809 [ + - ]: 99 : if (FIELD_ID_COMBINED_CHARACTERS != nToken)
810 : : {
811 : 99 : GetExport().GetTextParagraphExport()->Add(
812 [ + - ][ + - ]: 99 : XML_STYLE_FAMILY_TEXT_TEXT, xRangePropSet);
[ + - ][ + - ]
813 : : }
814 : :
815 : : // process special styles for each field (e.g. data styles)
816 [ - + + - : 99 : switch (nToken) {
- + - ]
817 : :
818 : : case FIELD_ID_DATABASE_DISPLAY:
819 : : {
820 [ # # ]: 0 : sal_Int32 nFormat = GetIntProperty(sPropertyNumberFormat, xPropSet);
821 : : // workaround: #no-bug#; see IsStringField(...)
822 [ # # ][ # # ]: 0 : if ( (5100 != nFormat) &&
[ # # ]
823 [ # # ]: 0 : !GetBoolProperty(sPropertyIsDataBaseFormat, xPropSet) )
824 : : {
825 [ # # ]: 0 : GetExport().addDataStyle(nFormat);
826 : : }
827 : 0 : break;
828 : : }
829 : :
830 : : case FIELD_ID_DATE:
831 : : case FIELD_ID_TIME:
832 : : {
833 : : // date and time fields are always number fields, but the
834 : : // NumberFormat property is optional (e.g. Calc doesn't
835 : : // support it)
836 : : Reference<XPropertySetInfo> xPropSetInfo(
837 [ + - ][ + - ]: 8 : xPropSet->getPropertySetInfo() );
838 [ + - ][ + - ]: 8 : if ( xPropSetInfo->hasPropertyByName( sPropertyNumberFormat ) )
[ + + ]
839 : : {
840 : : sal_Int32 nFormat =
841 [ + - ]: 4 : GetIntProperty(sPropertyNumberFormat, xPropSet);
842 : :
843 : : // nFormat may be -1 for numeric fields that display their
844 : : // variable name. (Maybe this should be a field type, then?)
845 [ + - ]: 4 : if (nFormat != -1)
846 : : {
847 [ + - ]: 4 : if( ! GetOptionalBoolProperty(
848 : : sPropertyIsFixedLanguage,
849 [ + - ]: 4 : xPropSet, xPropSetInfo, sal_False ) )
850 : : {
851 : : nFormat =
852 [ + - ]: 4 : GetExport().dataStyleForceSystemLanguage(nFormat);
853 : : }
854 : :
855 : 4 : GetExport().addDataStyle( nFormat,
856 [ + - ]: 4 : nToken == FIELD_ID_TIME );
857 : : }
858 : 8 : }
859 : : }
860 : 8 : break;
861 : :
862 : : case FIELD_ID_META:
863 : : // recurse into content (does not export element, so can be done first)
864 [ - + ]: 20 : if (bRecursive)
865 : : {
866 [ # # ]: 0 : ExportMetaField(xPropSet, true, bProgress);
867 : : }
868 : : // fall-through: for the meta-field itself!
869 : : case FIELD_ID_DOCINFO_PRINT_TIME:
870 : : case FIELD_ID_DOCINFO_PRINT_DATE:
871 : : case FIELD_ID_DOCINFO_CREATION_DATE:
872 : : case FIELD_ID_DOCINFO_CREATION_TIME:
873 : : case FIELD_ID_DOCINFO_SAVE_TIME:
874 : : case FIELD_ID_DOCINFO_SAVE_DATE:
875 : : case FIELD_ID_DOCINFO_EDIT_DURATION:
876 : : case FIELD_ID_VARIABLE_SET:
877 : : case FIELD_ID_VARIABLE_GET:
878 : : case FIELD_ID_VARIABLE_INPUT:
879 : : case FIELD_ID_USER_GET:
880 : : case FIELD_ID_EXPRESSION:
881 : : case FIELD_ID_TABLE_FORMULA:
882 : : case FIELD_ID_DOCINFO_CUSTOM:
883 : : // register number format, if this is a numeric field
884 [ + - ][ + + ]: 20 : if (! IsStringField(nToken, xPropSet)) {
885 : :
886 : : sal_Int32 nFormat =
887 [ + - ]: 4 : GetIntProperty(sPropertyNumberFormat, xPropSet);
888 : :
889 : : // nFormat may be -1 for numeric fields that display their
890 : : // variable name. (Maybe this should be a field type, then?)
891 [ + - ]: 4 : if (nFormat != -1)
892 : : {
893 : : // handle formats for fixed language fields
894 : : // for all these fields (except table formula)
895 [ + - ][ + + ]: 12 : if( ( nToken != FIELD_ID_TABLE_FORMULA ) &&
[ + + ]
896 : : ! GetOptionalBoolProperty(
897 : : sPropertyIsFixedLanguage,
898 [ + - ]: 4 : xPropSet, xPropSet->getPropertySetInfo(),
899 [ + - ][ + - ]: 8 : sal_False ) )
[ + - ][ # # ]
900 : : {
901 : : nFormat =
902 [ + - ]: 2 : GetExport().dataStyleForceSystemLanguage(nFormat);
903 : : }
904 : :
905 [ + - ]: 4 : GetExport().addDataStyle(nFormat);
906 : : }
907 : : }
908 : 20 : break;
909 : :
910 : : case FIELD_ID_COMBINED_CHARACTERS:
911 : : {
912 : : // export text style with the addition of the combined characters
913 : : DBG_ASSERT(NULL != pCombinedCharactersPropertyState,
914 : : "need proper PropertyState for combined characters");
915 : 0 : const XMLPropertyState *aStates[] = { pCombinedCharactersPropertyState, 0 };
916 : 0 : GetExport().GetTextParagraphExport()->Add(
917 : : XML_STYLE_FAMILY_TEXT_TEXT, xRangePropSet,
918 [ # # ][ # # ]: 0 : aStates);
[ # # ][ # # ]
919 : : break;
920 : : }
921 : :
922 : : case FIELD_ID_SCRIPT:
923 : : case FIELD_ID_ANNOTATION:
924 : : case FIELD_ID_BIBLIOGRAPHY:
925 : : case FIELD_ID_DDE:
926 : : case FIELD_ID_REF_REFERENCE:
927 : : case FIELD_ID_REF_SEQUENCE:
928 : : case FIELD_ID_REF_BOOKMARK:
929 : : case FIELD_ID_REF_FOOTNOTE:
930 : : case FIELD_ID_REF_ENDNOTE:
931 : : case FIELD_ID_MACRO:
932 : : case FIELD_ID_REFPAGE_SET:
933 : : case FIELD_ID_REFPAGE_GET:
934 : : case FIELD_ID_COUNT_PAGES:
935 : : case FIELD_ID_COUNT_PARAGRAPHS:
936 : : case FIELD_ID_COUNT_WORDS:
937 : : case FIELD_ID_COUNT_CHARACTERS:
938 : : case FIELD_ID_COUNT_TABLES:
939 : : case FIELD_ID_COUNT_GRAPHICS:
940 : : case FIELD_ID_COUNT_OBJECTS:
941 : : case FIELD_ID_CONDITIONAL_TEXT:
942 : : case FIELD_ID_HIDDEN_TEXT:
943 : : case FIELD_ID_HIDDEN_PARAGRAPH:
944 : : case FIELD_ID_DOCINFO_CREATION_AUTHOR:
945 : : case FIELD_ID_DOCINFO_DESCRIPTION:
946 : : case FIELD_ID_DOCINFO_PRINT_AUTHOR:
947 : : case FIELD_ID_DOCINFO_TITLE:
948 : : case FIELD_ID_DOCINFO_SUBJECT:
949 : : case FIELD_ID_DOCINFO_KEYWORDS:
950 : : case FIELD_ID_DOCINFO_REVISION:
951 : : case FIELD_ID_DOCINFO_SAVE_AUTHOR:
952 : : case FIELD_ID_SEQUENCE:
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:
969 : : case FIELD_ID_URL:
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!
975 : 71 : break;
976 : :
977 : : case FIELD_ID_UNKNOWN:
978 : : default:
979 : : OSL_FAIL("unkown field type!");
980 : : // ignore -> no format for unkowns
981 : 0 : break;
982 : 99 : }
983 : 99 : }
984 : :
985 : : /// export the given field to XML. Called on second pass through document
986 : 99 : void XMLTextFieldExport::ExportField(
987 : : const Reference<XTextField> & rTextField, sal_Bool bProgress )
988 : : {
989 : : // get property set
990 [ + - ]: 99 : Reference<XPropertySet> xPropSet(rTextField, UNO_QUERY);
991 : :
992 : : // get property set of range (for the attributes)
993 [ + - ][ + - ]: 99 : Reference <XPropertySet> xRangePropSet(rTextField->getAnchor(), UNO_QUERY);
[ + - ]
994 : :
995 : : // get Field ID
996 [ + - ]: 99 : enum FieldIdEnum nToken = GetFieldID(rTextField, xPropSet);
997 : :
998 : : // special treatment for combined characters field, because it is
999 : : // exported as a style
1000 : 99 : const XMLPropertyState* aStates[] = { pCombinedCharactersPropertyState, 0 };
1001 : : const XMLPropertyState **pStates =
1002 : : FIELD_ID_COMBINED_CHARACTERS == nToken
1003 : : ? aStates
1004 [ - + ]: 99 : : 0;
1005 : :
1006 : : // find out whether we need to set the style or hyperlink
1007 : : sal_Bool bHasHyperlink;
1008 : : sal_Bool bIsUICharStyle;
1009 : : sal_Bool bHasAutoStyle;
1010 : 99 : OUString sStyle = GetExport().GetTextParagraphExport()->
1011 : : FindTextStyleAndHyperlink( xRangePropSet, bHasHyperlink, bIsUICharStyle,
1012 [ + - ][ + - ]: 99 : bHasAutoStyle, pStates );
[ + - ][ + - ]
1013 : 99 : sal_Bool bHasStyle = !sStyle.isEmpty();
1014 : :
1015 : : // export hyperlink (if we have one)
1016 : 99 : Reference < XPropertySetInfo > xRangePropSetInfo;
1017 [ - + ]: 99 : if( bHasHyperlink )
1018 : : {
1019 [ # # ]: 0 : Reference<XPropertyState> xRangePropState( xRangePropSet, UNO_QUERY );
1020 [ # # ][ # # ]: 0 : xRangePropSetInfo = xRangePropSet->getPropertySetInfo();
[ # # ]
1021 : : bHasHyperlink =
1022 : 0 : GetExport().GetTextParagraphExport()->addHyperlinkAttributes(
1023 : : xRangePropSet, xRangePropState,
1024 [ # # ][ # # ]: 0 : xRangePropSetInfo );
[ # # ][ # # ]
1025 : : }
1026 : 99 : SvXMLElementExport aHyperlink( GetExport(), bHasHyperlink,
1027 : : XML_NAMESPACE_TEXT, XML_A,
1028 [ + - ]: 99 : sal_False, sal_False );
1029 : :
1030 [ - + ]: 99 : if( bHasHyperlink )
1031 : : {
1032 : : // export events (if supported)
1033 : : OUString sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM(
1034 [ # # ]: 0 : "HyperLinkEvents"));
1035 [ # # ][ # # ]: 0 : if (xRangePropSetInfo->hasPropertyByName(sHyperLinkEvents))
[ # # ]
1036 : : {
1037 [ # # ][ # # ]: 0 : Any aAny = xRangePropSet->getPropertyValue(sHyperLinkEvents);
1038 : 0 : Reference<XNameReplace> xName;
1039 [ # # ]: 0 : aAny >>= xName;
1040 [ # # ][ # # ]: 0 : GetExport().GetEventExport().Export(xName, sal_False);
1041 : 0 : }
1042 : : }
1043 : :
1044 : : {
1045 : : XMLTextCharStyleNamesElementExport aCharStylesExport(
1046 : 99 : GetExport(), bIsUICharStyle &&
1047 : 0 : GetExport().GetTextParagraphExport()
1048 [ # # ][ - + ]: 99 : ->GetCharStyleNamesPropInfoCache().hasProperty(
[ # # ][ # # ]
[ # # ]
1049 [ # # ]: 0 : xRangePropSet, xRangePropSetInfo ), bHasAutoStyle,
1050 [ - + ][ # # ]: 198 : xRangePropSet, sPropertyCharStyleNames );
[ + - ]
1051 : :
1052 : : // export span with style (if necessary)
1053 : : // (except for combined characters field)
1054 [ - + ]: 99 : if( bHasStyle )
1055 : : {
1056 : : // export <text:span> element
1057 : 0 : GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
1058 [ # # # # ]: 0 : GetExport().EncodeStyleName( sStyle ) );
1059 : : }
1060 : 99 : SvXMLElementExport aSpan( GetExport(), bHasStyle,
1061 : : XML_NAMESPACE_TEXT, XML_SPAN,
1062 [ + - ]: 99 : sal_False, sal_False);
1063 : :
1064 : : // finally, export the field itself
1065 : : ExportFieldHelper( rTextField, xPropSet, xRangePropSet, nToken,
1066 [ + - ][ + - ]: 99 : bProgress );
[ + - ]
1067 [ + - ]: 99 : }
1068 : 99 : }
1069 : :
1070 : : /// export the given field to XML. Called on second pass through document
1071 : 99 : void XMLTextFieldExport::ExportFieldHelper(
1072 : : const Reference<XTextField> & rTextField,
1073 : : const Reference<XPropertySet> & rPropSet,
1074 : : const Reference<XPropertySet> &,
1075 : : enum FieldIdEnum nToken,
1076 : : sal_Bool bProgress )
1077 : : {
1078 : : // get property set info (because some attributes are not support
1079 : : // in all implementations)
1080 [ + - ][ + - ]: 99 : Reference<XPropertySetInfo> xPropSetInfo(rPropSet->getPropertySetInfo());
1081 : :
1082 [ + - ][ + - ]: 99 : OUString sPresentation = rTextField->getPresentation(sal_False);
1083 : :
1084 : : // process each field type
1085 [ - - - - : 99 : switch (nToken) {
- - - - -
- - + + +
- - - - -
- - - + -
+ - - - -
- - - - -
- - - - +
- - - + -
+ - - - +
+ + - ]
1086 : : case FIELD_ID_AUTHOR:
1087 : : // author field: fixed, field (sub-)type
1088 : : ProcessBoolean(XML_FIXED,
1089 [ # # ][ # # ]: 0 : GetBoolProperty(sPropertyIsFixed, rPropSet), sal_True);
1090 [ # # ][ # # ]: 0 : ExportElement(MapAuthorFieldName(rPropSet), sPresentation);
1091 : 0 : break;
1092 : :
1093 : : case FIELD_ID_SENDER:
1094 : : // sender field: fixed, field (sub-)type
1095 : : ProcessBoolean(XML_FIXED,
1096 [ # # ][ # # ]: 0 : GetBoolProperty(sPropertyIsFixed, rPropSet), sal_True);
1097 [ # # ][ # # ]: 0 : ExportElement(MapSenderFieldName(rPropSet), sPresentation);
1098 : 0 : break;
1099 : :
1100 : : case FIELD_ID_PLACEHOLDER:
1101 : : // placeholder field: type, name, description
1102 : : ProcessString(XML_PLACEHOLDER_TYPE,
1103 : : MapPlaceholderType(
1104 [ # # ][ # # ]: 0 : GetInt16Property(sPropertyPlaceholderType, rPropSet)));
1105 : : ProcessString(XML_DESCRIPTION,
1106 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyHint,rPropSet), sal_True);
1107 [ # # ]: 0 : ExportElement(XML_PLACEHOLDER, sPresentation);
1108 : 0 : break;
1109 : :
1110 : : case FIELD_ID_VARIABLE_SET:
1111 : : {
1112 : : // variable set field: name, visible, format&value
1113 : : ProcessString(XML_NAME,
1114 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyVariableName, rPropSet));
1115 [ # # ]: 0 : ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
1116 [ # # ]: 0 : sal_False);
1117 : : ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
1118 : : GetStringProperty(sPropertyContent, rPropSet),
1119 [ # # ][ # # ]: 0 : sPresentation);
1120 [ # # ]: 0 : ProcessValueAndType(IsStringField(nToken, rPropSet),
1121 : : GetIntProperty(sPropertyNumberFormat, rPropSet),
1122 : : GetStringProperty(sPropertyContent, rPropSet),
1123 : : sPresentation,
1124 : : GetDoubleProperty(sPropertyValue, rPropSet),
1125 : : sal_True, sal_True, sal_True,
1126 : : ! GetOptionalBoolProperty(
1127 : : sPropertyIsFixedLanguage,
1128 [ # # ][ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ) );
[ # # ][ # # ]
[ # # ]
1129 [ # # ]: 0 : ExportElement(XML_VARIABLE_SET, sPresentation);
1130 : 0 : break;
1131 : : }
1132 : : case FIELD_ID_VARIABLE_GET:
1133 : : {
1134 : : // variable get field: name, format&value
1135 : : ProcessString(XML_NAME,
1136 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyContent, rPropSet));
1137 [ # # ]: 0 : sal_Bool bCmd = GetBoolProperty(sPropertyIsShowFormula, rPropSet);
1138 [ # # ]: 0 : ProcessDisplay(sal_True, bCmd);
1139 : : // #i81766# for older versions export of the value-type
1140 [ # # ][ # # ]: 0 : sal_Bool bExportValueType = !bCmd && ( GetExport().getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
1141 : : // show style, unless name will be shown
1142 [ # # ]: 0 : ProcessValueAndType(IsStringField(nToken, rPropSet),
1143 : : GetIntProperty(sPropertyNumberFormat, rPropSet),
1144 : : sEmpty, sEmpty, 0.0, // values not used
1145 : : sal_False,
1146 : : bExportValueType,
1147 : : !bCmd,
1148 : : ! GetOptionalBoolProperty(
1149 : : sPropertyIsFixedLanguage,
1150 [ # # ][ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ) );
[ # # ]
1151 [ # # ]: 0 : ExportElement(XML_VARIABLE_GET, sPresentation);
1152 : 0 : break;
1153 : : }
1154 : : case FIELD_ID_VARIABLE_INPUT:
1155 : : // variable input field: name, description, format&value
1156 : : ProcessString(XML_NAME,
1157 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyVariableName, rPropSet));
1158 : : ProcessString(XML_DESCRIPTION,
1159 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyHint , rPropSet));
1160 [ # # ]: 0 : ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
1161 [ # # ]: 0 : sal_False);
1162 : : ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
1163 : : GetStringProperty(sPropertyContent, rPropSet),
1164 [ # # ][ # # ]: 0 : sPresentation);
1165 [ # # ]: 0 : ProcessValueAndType(IsStringField(nToken, rPropSet),
1166 : : GetIntProperty(sPropertyNumberFormat, rPropSet),
1167 : : GetStringProperty(sPropertyContent, rPropSet),
1168 : : sPresentation,
1169 : : GetDoubleProperty(sPropertyValue, rPropSet),
1170 : : sal_True, sal_True, sal_True,
1171 : : ! GetOptionalBoolProperty(
1172 : : sPropertyIsFixedLanguage,
1173 [ # # ][ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ) );
[ # # ][ # # ]
[ # # ]
1174 [ # # ]: 0 : ExportElement(XML_VARIABLE_INPUT, sPresentation);
1175 : 0 : break;
1176 : :
1177 : : case FIELD_ID_USER_GET:
1178 : : // user field: name, hidden, style
1179 : : {
1180 [ # # ]: 0 : sal_Bool bCmd = GetBoolProperty(sPropertyIsShowFormula, rPropSet);
1181 [ # # ]: 0 : ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
1182 [ # # ]: 0 : bCmd);
1183 [ # # ]: 0 : ProcessValueAndType(IsStringField(nToken, rPropSet),
1184 : : GetIntProperty(sPropertyNumberFormat, rPropSet),
1185 : : sEmpty, sEmpty, 0.0, // values not used
1186 : : sal_False, sal_False, !bCmd,
1187 : : ! GetOptionalBoolProperty(
1188 : : sPropertyIsFixedLanguage,
1189 [ # # ][ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ) );
[ # # ]
1190 : :
1191 : : // name from FieldMaster
1192 : : ProcessString(XML_NAME,
1193 : : GetStringProperty(sPropertyName,
1194 [ # # ][ # # ]: 0 : GetMasterPropertySet(rTextField)));
[ # # ]
1195 [ # # ]: 0 : ExportElement(XML_USER_FIELD_GET, sPresentation);
1196 : 0 : break;
1197 : : }
1198 : :
1199 : : case FIELD_ID_USER_INPUT:
1200 : : // user input field: name (from FieldMaster), description
1201 : : // ProcessString(XML_NAME,
1202 : : // GetStringProperty(sPropertyName,
1203 : : // GetMasterPropertySet(rTextField)));
1204 : : ProcessString(XML_NAME,
1205 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyContent, rPropSet));
1206 : : ProcessString(XML_DESCRIPTION,
1207 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyHint, rPropSet));
1208 [ # # ]: 0 : ExportElement(XML_USER_FIELD_INPUT, sPresentation);
1209 : 0 : break;
1210 : :
1211 : : case FIELD_ID_SEQUENCE:
1212 : : {
1213 : : // sequence field: name, formula, seq-format
1214 [ # # ]: 0 : OUString sName = GetStringProperty(sPropertyVariableName, rPropSet);
1215 : : // TODO: use reference name only if actually beeing referenced.
1216 : : ProcessString(XML_REF_NAME,
1217 : : MakeSequenceRefName(
1218 [ # # ]: 0 : GetInt16Property(sPropertySequenceValue, rPropSet),
1219 [ # # ][ # # ]: 0 : sName));
1220 [ # # ]: 0 : ProcessString(XML_NAME, sName);
1221 : : ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
1222 : : GetStringProperty(sPropertyContent, rPropSet),
1223 [ # # ][ # # ]: 0 : sPresentation);
1224 : : ProcessNumberingType(GetInt16Property(sPropertyNumberingType,
1225 [ # # ][ # # ]: 0 : rPropSet));
1226 [ # # ]: 0 : ExportElement(XML_SEQUENCE, sPresentation);
1227 : 0 : break;
1228 : : }
1229 : :
1230 : : case FIELD_ID_EXPRESSION:
1231 : : {
1232 : : // formula field: formula, format&value
1233 [ # # ]: 0 : sal_Bool bCmd = GetBoolProperty(sPropertyIsShowFormula, rPropSet);
1234 : : ProcessString(XML_FORMULA, XML_NAMESPACE_OOOW,
1235 : : GetStringProperty(sPropertyContent, rPropSet),
1236 [ # # ][ # # ]: 0 : sPresentation);
1237 [ # # ]: 0 : ProcessDisplay(sal_True, bCmd);
1238 [ # # ]: 0 : ProcessValueAndType(IsStringField(nToken, rPropSet),
1239 : : GetIntProperty(sPropertyNumberFormat, rPropSet),
1240 : : GetStringProperty(sPropertyContent, rPropSet),
1241 : : sPresentation,
1242 : : GetDoubleProperty(sPropertyValue, rPropSet),
1243 : : !bCmd, !bCmd, !bCmd,
1244 : : ! GetOptionalBoolProperty(
1245 : : sPropertyIsFixedLanguage,
1246 [ # # ][ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ) );
[ # # ][ # # ]
[ # # ]
1247 [ # # ]: 0 : ExportElement(XML_EXPRESSION, sPresentation);
1248 : 0 : break;
1249 : : }
1250 : :
1251 : : case FIELD_ID_TEXT_INPUT:
1252 : : // text input field: description and string-value
1253 : : ProcessString(XML_DESCRIPTION,
1254 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyHint, rPropSet));
1255 : : ProcessString(XML_HELP,
1256 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyHelp, rPropSet), true);
1257 : : ProcessString(XML_HINT,
1258 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyTooltip, rPropSet), true);
1259 [ # # ]: 0 : ExportElement(XML_TEXT_INPUT, sPresentation);
1260 : 0 : break;
1261 : :
1262 : : case FIELD_ID_TIME:
1263 : : // all properties (except IsDate) are optional!
1264 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyNumberFormat))
[ - + ]
1265 : : {
1266 : : ProcessValueAndType(sal_False,
1267 : : GetIntProperty(sPropertyNumberFormat,rPropSet),
1268 : : sEmpty, sEmpty, 0.0, // not used
1269 : : sal_False, sal_False, sal_True,
1270 : : ! GetOptionalBoolProperty(
1271 : : sPropertyIsFixedLanguage,
1272 [ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ),
1273 [ # # ][ # # ]: 0 : sal_True);
1274 : : }
1275 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyDateTimeValue))
[ - + ]
1276 : : {
1277 : : // no value -> current time
1278 : : ProcessDateTime(XML_TIME_VALUE,
1279 : : GetDateTimeProperty(sPropertyDateTimeValue,
1280 : 0 : rPropSet),
1281 [ # # ][ # # ]: 0 : sal_False );
1282 : : }
1283 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyDateTime))
[ - + ]
1284 : : {
1285 : : // no value -> current time
1286 : : ProcessDateTime(XML_TIME_VALUE,
1287 : 0 : GetDateTimeProperty(sPropertyDateTime,rPropSet),
1288 [ # # ][ # # ]: 0 : sal_False );
1289 : : }
1290 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
[ - + ]
1291 : : {
1292 : : ProcessBoolean(XML_FIXED,
1293 [ # # ]: 0 : GetBoolProperty(sPropertyIsFixed, rPropSet),
1294 [ # # ]: 0 : sal_False);
1295 : : }
1296 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyAdjust))
[ - + ]
1297 : : {
1298 : : // adjust value given as integer in minutes
1299 : : ProcessDateTime(XML_TIME_ADJUST,
1300 : : GetIntProperty(sPropertyAdjust, rPropSet),
1301 [ # # ][ # # ]: 0 : sal_False, sal_True, sal_True);
1302 : : }
1303 [ + - ]: 4 : ExportElement(XML_TIME, sPresentation);
1304 : 4 : break;
1305 : :
1306 : : case FIELD_ID_DATE:
1307 : : // all properties (except IsDate) are optional!
1308 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyNumberFormat))
[ + - ]
1309 : : {
1310 : : ProcessValueAndType(sal_False,
1311 : : GetIntProperty(sPropertyNumberFormat,rPropSet),
1312 : : sEmpty, sEmpty, 0.0, // not used
1313 : : sal_False, sal_False, sal_True,
1314 : : ! GetOptionalBoolProperty(
1315 : : sPropertyIsFixedLanguage,
1316 [ + - ][ + - ]: 4 : rPropSet, xPropSetInfo, sal_False ) );
[ + - ]
1317 : : }
1318 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyDateTimeValue))
[ - + ]
1319 : : {
1320 : : // no value -> current date
1321 : : ProcessDateTime(XML_DATE_VALUE,
1322 : : GetDateTimeProperty(sPropertyDateTimeValue,
1323 : 0 : rPropSet),
1324 : : // #96457#: date fields should also save time
1325 [ # # ][ # # ]: 0 : sal_False);
1326 : : }
1327 : : // TODO: remove double-handling after SRC614
1328 [ + - ][ + - ]: 4 : else if (xPropSetInfo->hasPropertyByName(sPropertyDateTime))
[ + - ]
1329 : : {
1330 : : ProcessDateTime(XML_DATE_VALUE,
1331 : 4 : GetDateTimeProperty(sPropertyDateTime,rPropSet),
1332 : : // #96457#: date fields should also save time
1333 [ + - ][ + - ]: 4 : sal_False);
1334 : : }
1335 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
[ + - ]
1336 : : {
1337 : : ProcessBoolean(XML_FIXED,
1338 [ + - ]: 4 : GetBoolProperty(sPropertyIsFixed, rPropSet),
1339 [ + - ]: 4 : sal_False);
1340 : : }
1341 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyAdjust))
[ - + ]
1342 : : {
1343 : : // adjust value given as number of days
1344 : : ProcessDateTime(XML_DATE_ADJUST,
1345 : : GetIntProperty(sPropertyAdjust, rPropSet),
1346 [ # # ][ # # ]: 0 : sal_True, sal_True, sal_True);
1347 : : }
1348 [ + - ]: 4 : ExportElement(XML_DATE, sPresentation);
1349 : 4 : break;
1350 : :
1351 : : case FIELD_ID_PAGENUMBER:
1352 : : // all properties are optional
1353 [ + - ][ + - ]: 20 : if (xPropSetInfo->hasPropertyByName(sPropertyNumberingType))
[ - + ]
1354 : : {
1355 : : ProcessNumberingType(GetInt16Property(sPropertyNumberingType,
1356 [ # # ][ # # ]: 0 : rPropSet));
1357 : : }
1358 [ + - ][ + - ]: 20 : if (xPropSetInfo->hasPropertyByName(sPropertyOffset))
[ - + ]
1359 : : {
1360 [ # # ]: 0 : sal_Int32 nAdjust = GetIntProperty(sPropertyOffset, rPropSet);
1361 : :
1362 [ # # ][ # # ]: 0 : if (xPropSetInfo->hasPropertyByName(sPropertySubType))
[ # # ]
1363 : : {
1364 : : // property SubType used in MapPageNumebrName
1365 : : ProcessString(XML_SELECT_PAGE,
1366 [ # # ][ # # ]: 0 : MapPageNumberName(rPropSet, nAdjust));
1367 : : }
1368 [ # # ]: 0 : ProcessIntegerDef(XML_PAGE_ADJUST, nAdjust, 0);
1369 : : }
1370 [ + - ]: 20 : ExportElement(XML_PAGE_NUMBER, sPresentation);
1371 : 20 : break;
1372 : :
1373 : : case FIELD_ID_PAGESTRING:
1374 : : {
1375 : : ProcessString(XML_STRING_VALUE,
1376 : : GetStringProperty(sPropertyUserText, rPropSet),
1377 [ # # ][ # # ]: 0 : sPresentation);
1378 : 0 : sal_Int32 nDummy = 0; // MapPageNumberName need int
1379 [ # # ][ # # ]: 0 : ProcessString(XML_SELECT_PAGE, MapPageNumberName(rPropSet, nDummy));
1380 [ # # ]: 0 : if( 0 == ( GetExport().getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ) )
1381 [ # # ]: 0 : ExportElement(XML_PAGE_CONTINUATION, sPresentation);
1382 : : else
1383 [ # # ]: 0 : ExportElement(XML_PAGE_CONTINUATION_STRING, sPresentation);
1384 : : break;
1385 : : }
1386 : :
1387 : : case FIELD_ID_DATABASE_NAME:
1388 : : ProcessString(XML_TABLE_NAME,
1389 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyDataTableName, rPropSet));
1390 [ # # ][ # # ]: 0 : ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
1391 [ # # ]: 0 : ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
1392 [ # # ]: 0 : sal_False);
1393 : : ExportDataBaseElement(XML_DATABASE_NAME, sPresentation,
1394 [ # # ]: 0 : rPropSet, xPropSetInfo);
1395 : 0 : break;
1396 : :
1397 : : case FIELD_ID_DATABASE_NUMBER:
1398 : : ProcessString(XML_TABLE_NAME,
1399 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyDataTableName, rPropSet));
1400 [ # # ][ # # ]: 0 : ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
1401 : : ProcessNumberingType(
1402 [ # # ][ # # ]: 0 : GetInt16Property(sPropertyNumberingType,rPropSet));
1403 : : ProcessInteger(XML_VALUE,
1404 [ # # ][ # # ]: 0 : GetIntProperty(sPropertySetNumber, rPropSet));
1405 [ # # ]: 0 : ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
1406 [ # # ]: 0 : sal_False);
1407 : : ExportDataBaseElement(XML_DATABASE_ROW_NUMBER, sPresentation,
1408 [ # # ]: 0 : rPropSet, xPropSetInfo);
1409 : 0 : break;
1410 : :
1411 : : case FIELD_ID_DATABASE_NEXT:
1412 : : ProcessString(XML_TABLE_NAME,
1413 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyDataTableName, rPropSet));
1414 [ # # ][ # # ]: 0 : ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
1415 : : ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
1416 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyCondition, rPropSet));
1417 : : DBG_ASSERT(sPresentation.equals(sEmpty),
1418 : : "Unexpected presentation for database next field");
1419 : : ExportDataBaseElement(XML_DATABASE_NEXT, OUString(),
1420 [ # # ]: 0 : rPropSet, xPropSetInfo);
1421 : 0 : break;
1422 : :
1423 : : case FIELD_ID_DATABASE_SELECT:
1424 : : ProcessString(XML_TABLE_NAME,
1425 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyDataTableName, rPropSet));
1426 [ # # ][ # # ]: 0 : ProcessCommandType(GetIntProperty(sPropertyDataCommandType, rPropSet));
1427 : : ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
1428 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyCondition, rPropSet));
1429 : : ProcessInteger(XML_ROW_NUMBER,
1430 [ # # ][ # # ]: 0 : GetIntProperty(sPropertySetNumber, rPropSet));
1431 : : DBG_ASSERT(sPresentation.equals(sEmpty),
1432 : : "Unexpected presentation for database select field");
1433 : : ExportDataBaseElement(XML_DATABASE_ROW_SELECT, OUString(),
1434 [ # # ]: 0 : rPropSet, xPropSetInfo);
1435 : 0 : break;
1436 : :
1437 : : case FIELD_ID_DATABASE_DISPLAY:
1438 : : {
1439 : : // get database, table and column name from field master
1440 [ # # ]: 0 : const Reference<XPropertySet> & xMaster = GetMasterPropertySet(rTextField);
1441 : : ProcessString(XML_TABLE_NAME,
1442 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyDataTableName, xMaster));
1443 [ # # ][ # # ]: 0 : ProcessCommandType(GetIntProperty(sPropertyDataCommandType, xMaster));
1444 : : ProcessString(XML_COLUMN_NAME,
1445 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyDataColumnName, xMaster));
1446 : : // export number format if available (happens only for numbers!)
1447 [ # # ][ # # ]: 0 : if (!GetBoolProperty(sPropertyIsDataBaseFormat, rPropSet))
1448 : : {
1449 : : ProcessValueAndType(sal_False, // doesn't happen for text
1450 : : GetIntProperty(sPropertyNumberFormat,rPropSet),
1451 : : sEmpty, sEmpty, 0.0, // not used
1452 [ # # ][ # # ]: 0 : sal_False, sal_False, sal_True, sal_False);
1453 : : }
1454 [ # # ]: 0 : ProcessDisplay(GetBoolProperty(sPropertyIsVisible, rPropSet),
1455 [ # # ]: 0 : sal_False);
1456 : : ExportDataBaseElement(XML_DATABASE_DISPLAY, sPresentation,
1457 [ # # ][ # # ]: 0 : xMaster, xMaster->getPropertySetInfo());
[ # # ]
1458 : 0 : break;
1459 : : }
1460 : :
1461 : : case FIELD_ID_DOCINFO_REVISION:
1462 : : ProcessBoolean(XML_FIXED,
1463 [ # # ][ # # ]: 0 : GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
1464 [ # # ]: 0 : ExportElement(MapDocInfoFieldName(nToken), sPresentation);
1465 : 0 : break;
1466 : :
1467 : : case FIELD_ID_DOCINFO_EDIT_DURATION:
1468 : : case FIELD_ID_DOCINFO_SAVE_TIME:
1469 : : case FIELD_ID_DOCINFO_CREATION_TIME:
1470 : : case FIELD_ID_DOCINFO_PRINT_TIME:
1471 : : case FIELD_ID_DOCINFO_SAVE_DATE:
1472 : : case FIELD_ID_DOCINFO_CREATION_DATE:
1473 : : case FIELD_ID_DOCINFO_PRINT_DATE:
1474 : : ProcessValueAndType(sal_False,
1475 : : GetIntProperty(sPropertyNumberFormat, rPropSet),
1476 : : sEmpty, sEmpty, 0.0,
1477 : : sal_False, sal_False, sal_True,
1478 : : ! GetOptionalBoolProperty(
1479 : : sPropertyIsFixedLanguage,
1480 [ # # ][ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ) );
[ # # ]
1481 : :
1482 : : // todo: export date/time value, but values not available -> core bug
1483 : : ProcessBoolean(XML_FIXED,
1484 [ # # ][ # # ]: 0 : GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
1485 [ # # ]: 0 : ExportElement(MapDocInfoFieldName(nToken), sPresentation);
1486 : 0 : break;
1487 : :
1488 : : case FIELD_ID_DOCINFO_CREATION_AUTHOR:
1489 : : case FIELD_ID_DOCINFO_DESCRIPTION:
1490 : : case FIELD_ID_DOCINFO_PRINT_AUTHOR:
1491 : : case FIELD_ID_DOCINFO_TITLE:
1492 : : case FIELD_ID_DOCINFO_SUBJECT:
1493 : : case FIELD_ID_DOCINFO_KEYWORDS:
1494 : : case FIELD_ID_DOCINFO_SAVE_AUTHOR:
1495 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
[ - + ]
1496 : : {
1497 : : ProcessBoolean(XML_FIXED,
1498 [ # # ][ # # ]: 0 : GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
1499 : : }
1500 [ + - ]: 4 : ExportElement(MapDocInfoFieldName(nToken), sPresentation);
1501 : 4 : break;
1502 : :
1503 : : case FIELD_ID_DOCINFO_CUSTOM:
1504 : : {
1505 : : ProcessValueAndType(sal_False, // doesn't happen for text
1506 : : GetIntProperty(sPropertyNumberFormat,rPropSet),
1507 : : sEmpty, sEmpty, 0.0, // not used
1508 : : sal_False, sal_False, sal_True,
1509 : : ! GetOptionalBoolProperty(
1510 : : sPropertyIsFixedLanguage,
1511 [ # # ][ # # ]: 0 : rPropSet, xPropSetInfo, sal_False ));
[ # # ]
1512 [ # # ][ # # ]: 0 : uno::Any aAny = rPropSet->getPropertyValue( sPropertyName );
1513 : 0 : ::rtl::OUString sName;
1514 : 0 : aAny >>= sName;
1515 [ # # ]: 0 : ProcessString(XML_NAME, sName);
1516 [ # # ][ # # ]: 0 : ProcessBoolean(XML_FIXED, GetBoolProperty(sPropertyIsFixed, rPropSet), sal_False);
1517 [ # # ]: 0 : ExportElement(XML_USER_DEFINED, sPresentation);
1518 : 0 : break;
1519 : : }
1520 : :
1521 : : case FIELD_ID_COUNT_PAGES:
1522 : : case FIELD_ID_COUNT_PARAGRAPHS:
1523 : : case FIELD_ID_COUNT_WORDS:
1524 : : case FIELD_ID_COUNT_CHARACTERS:
1525 : : case FIELD_ID_COUNT_TABLES:
1526 : : case FIELD_ID_COUNT_GRAPHICS:
1527 : : case FIELD_ID_COUNT_OBJECTS:
1528 : : // all properties optional (applies to pages only, but I'll do
1529 : : // it for all for sake of common implementation)
1530 [ + - ][ + - ]: 4 : if (xPropSetInfo->hasPropertyByName(sPropertyNumberingType))
[ - + ]
1531 : : {
1532 : : ProcessNumberingType(GetInt16Property(sPropertyNumberingType,
1533 [ # # ][ # # ]: 0 : rPropSet));
1534 : : }
1535 [ + - ]: 4 : ExportElement(MapCountFieldName(nToken), sPresentation);
1536 : 4 : break;
1537 : :
1538 : : case FIELD_ID_CONDITIONAL_TEXT:
1539 : : ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
1540 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyCondition, rPropSet));
1541 : : ProcessString(XML_STRING_VALUE_IF_TRUE,
1542 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyTrueContent, rPropSet));
1543 : : ProcessString(XML_STRING_VALUE_IF_FALSE,
1544 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyFalseContent, rPropSet));
1545 : : ProcessBoolean(XML_CURRENT_VALUE,
1546 [ # # ]: 0 : GetBoolProperty(sPropertyIsConditionTrue, rPropSet),
1547 [ # # ]: 0 : sal_False);
1548 [ # # ]: 0 : ExportElement(XML_CONDITIONAL_TEXT, sPresentation);
1549 : 0 : break;
1550 : :
1551 : : case FIELD_ID_HIDDEN_TEXT:
1552 : : ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
1553 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyCondition, rPropSet));
1554 : : ProcessString(XML_STRING_VALUE,
1555 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyContent, rPropSet));
1556 : : ProcessBoolean(XML_IS_HIDDEN,
1557 [ # # ]: 0 : GetBoolProperty(sPropertyIsHidden, rPropSet),
1558 [ # # ]: 0 : sal_False);
1559 [ # # ]: 0 : ExportElement(XML_HIDDEN_TEXT, sPresentation);
1560 : 0 : break;
1561 : :
1562 : : case FIELD_ID_HIDDEN_PARAGRAPH:
1563 : : ProcessString(XML_CONDITION, XML_NAMESPACE_OOOW,
1564 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyCondition, rPropSet));
1565 : : ProcessBoolean(XML_IS_HIDDEN,
1566 [ # # ]: 0 : GetBoolProperty(sPropertyIsHidden, rPropSet),
1567 [ # # ]: 0 : sal_False);
1568 : : DBG_ASSERT(sPresentation.equals(sEmpty),
1569 : : "Unexpected presentation for hidden paragraph field");
1570 [ # # ]: 0 : ExportElement(XML_HIDDEN_PARAGRAPH);
1571 : 0 : break;
1572 : :
1573 : : case FIELD_ID_TEMPLATE_NAME:
1574 : : ProcessString(XML_DISPLAY,
1575 : : MapTemplateDisplayFormat(
1576 [ # # ][ # # ]: 0 : GetInt16Property(sPropertyFileFormat, rPropSet)));
1577 [ # # ]: 0 : ExportElement(XML_TEMPLATE_NAME, sPresentation);
1578 : 0 : break;
1579 : :
1580 : : case FIELD_ID_CHAPTER:
1581 : : ProcessString(XML_DISPLAY,
1582 : : MapChapterDisplayFormat(
1583 [ # # ][ # # ]: 0 : GetInt16Property(sPropertyChapterFormat, rPropSet)));
1584 : : // API numbers 0..9, we number 1..10
1585 : : ProcessInteger(XML_OUTLINE_LEVEL,
1586 [ # # ][ # # ]: 0 : GetInt8Property(sPropertyLevel, rPropSet) + 1);
1587 [ # # ]: 0 : ExportElement(XML_CHAPTER, sPresentation);
1588 : 0 : break;
1589 : :
1590 : : case FIELD_ID_FILE_NAME:
1591 : : // all properties are optional
1592 [ # # ][ # # ]: 0 : if (xPropSetInfo->hasPropertyByName(sPropertyFileFormat))
[ # # ]
1593 : : {
1594 : : ProcessString(XML_DISPLAY,
1595 : : MapFilenameDisplayFormat(
1596 [ # # ][ # # ]: 0 : GetInt16Property(sPropertyFileFormat, rPropSet)));
1597 : : }
1598 [ # # ][ # # ]: 0 : if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
[ # # ]
1599 : : {
1600 : : ProcessBoolean(XML_FIXED,
1601 [ # # ]: 0 : GetBoolProperty(sPropertyIsFixed, rPropSet),
1602 [ # # ]: 0 : sal_False);
1603 : : }
1604 [ # # ]: 0 : ExportElement(XML_FILE_NAME, sPresentation);
1605 : 0 : break;
1606 : :
1607 : : case FIELD_ID_REFPAGE_SET:
1608 : : ProcessBoolean(XML_ACTIVE,
1609 [ # # ][ # # ]: 0 : GetBoolProperty(sPropertyOn, rPropSet), sal_True);
1610 : : ProcessIntegerDef(XML_PAGE_ADJUST,
1611 [ # # ][ # # ]: 0 : GetInt16Property(sPropertyOffset, rPropSet), 0);
1612 : : DBG_ASSERT(sPresentation.equals(sEmpty),
1613 : : "Unexpected presentation page variable field");
1614 [ # # ]: 0 : ExportElement(XML_PAGE_VARIABLE_SET);
1615 : 0 : break;
1616 : :
1617 : : case FIELD_ID_REFPAGE_GET:
1618 : : ProcessNumberingType(
1619 [ # # ][ # # ]: 0 : GetInt16Property(sPropertyNumberingType, rPropSet));
1620 [ # # ]: 0 : ExportElement(XML_PAGE_VARIABLE_GET, sPresentation);
1621 : 0 : break;
1622 : :
1623 : : case FIELD_ID_MACRO:
1624 [ # # ]: 0 : ExportMacro( rPropSet, sPresentation );
1625 : 0 : break;
1626 : :
1627 : : case FIELD_ID_REF_SEQUENCE:
1628 : : // reference to sequence: format, name, find value (and element)
1629 : : // was: if (nSeqNumber != -1) ...
1630 : : ProcessString(XML_REFERENCE_FORMAT,
1631 : : MapReferenceType(GetInt16Property(
1632 [ # # ]: 0 : sPropertyReferenceFieldPart, rPropSet)),
1633 [ # # ]: 0 : XML_TEMPLATE);
1634 : : ProcessString(XML_REF_NAME,
1635 : : MakeSequenceRefName(
1636 [ # # ]: 0 : GetInt16Property(sPropertySequenceNumber, rPropSet),
1637 [ # # ][ # # ]: 0 : GetStringProperty(sPropertySourceName, rPropSet) ) );
[ # # ]
1638 : : ExportElement(
1639 : : MapReferenceSource(
1640 [ # # ]: 0 : GetInt16Property(sPropertyReferenceFieldSource, rPropSet)),
1641 [ # # ]: 0 : sPresentation);
1642 : 0 : break;
1643 : :
1644 : : case FIELD_ID_REF_REFERENCE:
1645 : : case FIELD_ID_REF_BOOKMARK:
1646 : : // reference to bookmarks, references: format, name (and element)
1647 : : ProcessString(XML_REFERENCE_FORMAT,
1648 : : MapReferenceType(GetInt16Property(
1649 [ # # ]: 0 : sPropertyReferenceFieldPart, rPropSet)),
1650 [ # # ]: 0 : XML_TEMPLATE);
1651 : : ProcessString(XML_REF_NAME,
1652 [ # # ][ # # ]: 0 : GetStringProperty(sPropertySourceName, rPropSet));
1653 : : ExportElement(
1654 : : MapReferenceSource(GetInt16Property(
1655 [ # # ]: 0 : sPropertyReferenceFieldSource, rPropSet)),
1656 [ # # ]: 0 : sPresentation);
1657 : 0 : break;
1658 : :
1659 : : case FIELD_ID_REF_FOOTNOTE:
1660 : : case FIELD_ID_REF_ENDNOTE:
1661 : : // reference to end-/footnote: format, generate name, (and element)
1662 : 0 : GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_NOTE_CLASS,
1663 [ # # ][ # # ]: 0 : FIELD_ID_REF_ENDNOTE==nToken ? XML_ENDNOTE : XML_FOOTNOTE );
1664 : : ProcessString(XML_REFERENCE_FORMAT,
1665 : : MapReferenceType(GetInt16Property(
1666 [ # # ]: 0 : sPropertyReferenceFieldPart, rPropSet)),
1667 [ # # ]: 0 : XML_TEMPLATE);
1668 : : ProcessString(XML_REF_NAME,
1669 : : MakeFootnoteRefName(GetInt16Property(
1670 [ # # ][ # # ]: 0 : sPropertySequenceNumber, rPropSet)));
[ # # ]
1671 : : ExportElement(
1672 : : MapReferenceSource(GetInt16Property(
1673 [ # # ]: 0 : sPropertyReferenceFieldSource, rPropSet)),
1674 [ # # ]: 0 : sPresentation);
1675 : 0 : break;
1676 : :
1677 : : case FIELD_ID_DDE:
1678 : : // name from field master
1679 : : ProcessString(XML_CONNECTION_NAME,
1680 : :
1681 : : GetStringProperty(sPropertyName,
1682 [ # # ][ # # ]: 0 : GetMasterPropertySet(rTextField)));
[ # # ]
1683 [ # # ]: 0 : ExportElement(XML_DDE_CONNECTION, sPresentation);
1684 : 0 : break;
1685 : :
1686 : : case FIELD_ID_SHEET_NAME:
1687 : : // name of spreadsheet (Calc only)
1688 [ + - ]: 8 : ExportElement(XML_SHEET_NAME, sPresentation);
1689 : 8 : break;
1690 : :
1691 : : case FIELD_ID_URL:
1692 : : {
1693 : : // this field is a special case because it gets mapped onto a
1694 : : // hyperlink, rather than one of the regular text field.
1695 : 0 : ProcessString(XML_HREF, GetExport().GetRelativeReference(GetStringProperty(sPropertyURL, rPropSet)),
1696 [ # # # # ]: 0 : sal_False, XML_NAMESPACE_XLINK);
[ # # ]
1697 : : ProcessString(XML_TARGET_FRAME_NAME,
1698 : : GetStringProperty(sPropertyTargetFrame,rPropSet),
1699 [ # # ][ # # ]: 0 : sal_True, XML_NAMESPACE_OFFICE);
1700 : : SvXMLElementExport aUrlField(rExport, XML_NAMESPACE_TEXT, XML_A,
1701 [ # # ]: 0 : sal_False, sal_False);
1702 [ # # ]: 0 : GetExport().Characters(sPresentation);
1703 [ # # ]: 0 : break;
1704 : : }
1705 : :
1706 : : case FIELD_ID_BIBLIOGRAPHY:
1707 : : {
1708 [ # # ]: 0 : ProcessBibliographyData(rPropSet);
1709 [ # # ]: 0 : ExportElement(XML_BIBLIOGRAPHY_MARK, sPresentation);
1710 : 0 : break;
1711 : : }
1712 : :
1713 : : case FIELD_ID_SCRIPT:
1714 : : ProcessString(XML_LANGUAGE,
1715 : : GetStringProperty(sPropertyScriptType, rPropSet),
1716 [ # # ][ # # ]: 0 : sal_True, XML_NAMESPACE_SCRIPT);
1717 : : DBG_ASSERT(sPresentation.equals(sEmpty),
1718 : : "Unexpected presentation for script field");
1719 [ # # ][ # # ]: 0 : if (GetBoolProperty(sPropertyURLContent, rPropSet))
1720 : : {
1721 : : ProcessString(XML_HREF,
1722 : 0 : GetExport().GetRelativeReference(GetStringProperty(sPropertyContent, rPropSet)),
1723 [ # # # # ]: 0 : sal_False, XML_NAMESPACE_XLINK);
[ # # ]
1724 [ # # ]: 0 : ExportElement(XML_SCRIPT);
1725 : : }
1726 : : else
1727 : : {
1728 : : ExportElement(XML_SCRIPT,
1729 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyContent, rPropSet));
1730 : : }
1731 : 0 : break;
1732 : :
1733 : : case FIELD_ID_ANNOTATION:
1734 : : {
1735 : : // check for empty presentation (just in case)
1736 : : DBG_ASSERT(sPresentation.equals(sEmpty),
1737 : : "Unexpected presentation for annotation field");
1738 : :
1739 : : // annotation element + content
1740 : 3 : OUString aName;
1741 [ + - ][ + - ]: 3 : rPropSet->getPropertyValue(sPropertyName) >>= aName;
1742 [ + - ]: 3 : if (!aName.isEmpty())
1743 [ + - ]: 3 : GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, aName);
1744 : 3 : SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_OFFICE,
1745 [ + - ]: 3 : XML_ANNOTATION, sal_False, sal_True);
1746 : :
1747 : : // author
1748 [ + - ]: 3 : OUString aAuthor( GetStringProperty(sPropertyAuthor, rPropSet) );
1749 [ + - ]: 3 : if( !aAuthor.isEmpty() )
1750 : : {
1751 : 3 : SvXMLElementExport aCreatorElem( GetExport(), XML_NAMESPACE_DC,
1752 : : XML_CREATOR, sal_True,
1753 [ + - ]: 3 : sal_False );
1754 [ + - ][ + - ]: 3 : GetExport().Characters(aAuthor);
1755 : : }
1756 : :
1757 : : // date time
1758 [ + - ]: 3 : DateTime aDate( GetDateTimeProperty(sPropertyDateTimeValue, rPropSet) );
1759 : : {
1760 : 3 : OUStringBuffer aBuffer;
1761 [ + - ]: 3 : ::sax::Converter::convertDateTime(aBuffer, aDate, true);
1762 : 3 : SvXMLElementExport aDateElem( GetExport(), XML_NAMESPACE_DC,
1763 : : XML_DATE, sal_True,
1764 [ + - ]: 3 : sal_False );
1765 [ + - ][ + - ]: 3 : GetExport().Characters(aBuffer.makeStringAndClear());
[ + - ]
1766 : : }
1767 : :
1768 : : // initials
1769 [ + - ]: 3 : OUString aInitials( GetStringProperty(sPropertyInitials, rPropSet) );
1770 [ + - ]: 3 : if( !aInitials.isEmpty() )
1771 : : {
1772 : 3 : SvXMLElementExport aCreatorElem( GetExport(), XML_NAMESPACE_TEXT,
1773 : : XML_SENDER_INITIALS, sal_True,
1774 [ + - ]: 3 : sal_False );
1775 [ + - ][ + - ]: 3 : GetExport().Characters(aInitials);
1776 : : }
1777 : :
1778 : 3 : com::sun::star::uno::Reference < com::sun::star::text::XText > xText;
1779 : : try
1780 : : {
1781 [ + - ][ + - ]: 3 : com::sun::star::uno::Any aRet = rPropSet->getPropertyValue(sPropertyTextRange);
1782 [ + - ][ # # ]: 3 : aRet >>= xText;
1783 : : }
1784 [ # # ]: 0 : catch ( com::sun::star::uno::Exception& )
1785 : : {}
1786 : :
1787 [ + - ]: 3 : if ( xText.is() )
1788 [ + - ][ + - ]: 3 : GetExport().GetTextParagraphExport()->exportText( xText );
[ + - ][ + - ]
1789 : : else
1790 [ # # ][ # # ]: 0 : ProcessParagraphSequence(GetStringProperty(sPropertyContent,rPropSet));
1791 [ + - ]: 3 : break;
1792 : : }
1793 : :
1794 : : case FIELD_ID_COMBINED_CHARACTERS:
1795 : : {
1796 : : // The style with the combined characters attribute has
1797 : : // already been handled in the ExportField method. So all that
1798 : : // is left to do now is to export the characters.
1799 [ # # ]: 0 : GetExport().Characters(sPresentation);
1800 : 0 : break;
1801 : : }
1802 : :
1803 : : case FIELD_ID_META:
1804 : : {
1805 [ + - ]: 20 : ExportMetaField(rPropSet, false, bProgress);
1806 : 20 : break;
1807 : : }
1808 : :
1809 : : case FIELD_ID_MEASURE:
1810 : : {
1811 [ # # ][ # # ]: 0 : ProcessString(XML_KIND, MapMeasureKind(GetInt16Property(sPropertyMeasureKind, rPropSet)));
1812 [ # # ]: 0 : ExportElement( XML_MEASURE, sPresentation );
1813 : 0 : break;
1814 : : }
1815 : :
1816 : : case FIELD_ID_TABLE_FORMULA:
1817 : : ProcessString( XML_FORMULA, XML_NAMESPACE_OOOW,
1818 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyContent, rPropSet) );
1819 : : ProcessDisplay( sal_True,
1820 [ # # ]: 0 : GetBoolProperty(sPropertyIsShowFormula, rPropSet),
1821 [ # # ]: 0 : sal_True );
1822 : : ProcessValueAndType( sal_False,
1823 : : GetIntProperty(sPropertyNumberFormat, rPropSet),
1824 : : sEmpty, sEmpty, 0.0f,
1825 : : sal_False, sal_False, sal_True,
1826 [ # # ][ # # ]: 0 : sal_False, sal_False );
1827 [ # # ]: 0 : ExportElement( XML_TABLE_FORMULA, sPresentation );
1828 : 0 : break;
1829 : :
1830 : : case FIELD_ID_DROP_DOWN:
1831 : : {
1832 [ # # ][ # # ]: 0 : ProcessString(XML_NAME, GetStringProperty(sPropertyName, rPropSet));
1833 : : ProcessString(XML_HELP,
1834 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyHelp, rPropSet), true);
1835 : : ProcessString(XML_HINT,
1836 [ # # ][ # # ]: 0 : GetStringProperty(sPropertyTooltip, rPropSet), true);
1837 : 0 : SvXMLElementExport aElem( GetExport(),
1838 : : XML_NAMESPACE_TEXT, XML_DROPDOWN,
1839 [ # # ]: 0 : sal_False, sal_False );
1840 : : ProcessStringSequence
1841 : : (GetStringSequenceProperty( sPropertyItems, rPropSet ),
1842 [ # # ][ # # ]: 0 : GetStringProperty( sPropertySelectedItem, rPropSet ) );
[ # # ][ # # ]
1843 : :
1844 [ # # ][ # # ]: 0 : GetExport().Characters( sPresentation );
1845 : : }
1846 : 0 : break;
1847 : :
1848 : : case FIELD_ID_DRAW_HEADER:
1849 : : {
1850 [ + - ][ + - ]: 8 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_PRESENTATION, XML_HEADER, sal_False, sal_False );
1851 : : }
1852 : 8 : break;
1853 : :
1854 : : case FIELD_ID_DRAW_FOOTER:
1855 : : {
1856 [ + - ][ + - ]: 12 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_PRESENTATION, XML_FOOTER, sal_False, sal_False );
1857 : : }
1858 : 12 : break;
1859 : :
1860 : : case FIELD_ID_DRAW_DATE_TIME:
1861 : : {
1862 [ + - ][ + - ]: 12 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_PRESENTATION, XML_DATE_TIME, sal_False, sal_False );
1863 : : }
1864 : 12 : break;
1865 : :
1866 : : case FIELD_ID_UNKNOWN:
1867 : : default:
1868 : : OSL_FAIL("unkown field type encountered!");
1869 : : // always export content
1870 [ # # ]: 0 : GetExport().Characters(sPresentation);
1871 : 99 : }
1872 : 99 : }
1873 : :
1874 : :
1875 : : /// export field declarations / field masters
1876 : 21 : void XMLTextFieldExport::ExportFieldDeclarations()
1877 : : {
1878 : 21 : Reference<XText> xEmptyText;
1879 [ + - ]: 21 : ExportFieldDeclarations(xEmptyText);
1880 : 21 : }
1881 : :
1882 : : /// export field declarations / field masters
1883 : 41 : void XMLTextFieldExport::ExportFieldDeclarations(
1884 : : const Reference<XText> & rText )
1885 : : {
1886 : : // store lists for decl elements
1887 [ + - ]: 41 : vector<OUString> aVarName;
1888 [ + - ]: 41 : vector<OUString> aUserName;
1889 [ + - ]: 41 : vector<OUString> aSeqName;
1890 [ + - ]: 41 : vector<OUString> aDdeName;
1891 : :
1892 : : // get text fields supplier and field master name access
1893 : 41 : Reference<XTextFieldsSupplier> xTextFieldsSupp(GetExport().GetModel(),
1894 [ + - ]: 41 : UNO_QUERY);
1895 [ + + ]: 41 : if( !xTextFieldsSupp.is() )
1896 : 41 : return;
1897 : :
1898 : : Reference<container::XNameAccess> xFieldMasterNameAccess(
1899 [ + - ][ + - ]: 21 : xTextFieldsSupp->getTextFieldMasters(), UNO_QUERY);
[ + - ]
1900 : :
1901 : : // where to get the text field masters from?
1902 : : // a) we get a specific XText: then use pUsedMasters
1903 : : // b) the XText is empty: then export all text fields
1904 [ + - ]: 21 : Sequence<OUString> aFieldMasters;
1905 [ - + ]: 21 : if (rText.is())
1906 : : {
1907 : : // export only used masters
1908 : : DBG_ASSERT(NULL != pUsedMasters,
1909 : : "field masters must be recorded in order to be "
1910 : : "written out separatly" );
1911 [ # # ]: 0 : if (NULL != pUsedMasters)
1912 : : {
1913 : : map<Reference<XText>, set<OUString> > ::iterator aMapIter =
1914 [ # # ]: 0 : pUsedMasters->find(rText);
1915 [ # # ]: 0 : if (aMapIter != pUsedMasters->end())
1916 : : {
1917 : : // found the set of used field masters
1918 : 0 : set<OUString> & rOurMasters = aMapIter->second;
1919 : :
1920 : : // copy set to sequence
1921 [ # # ]: 0 : aFieldMasters.realloc( rOurMasters.size() );
1922 : 0 : sal_Int32 i = 0;
1923 [ # # ]: 0 : for( set<OUString>::iterator aSetIter = rOurMasters.begin();
1924 : 0 : aSetIter != rOurMasters.end();
1925 : : ++aSetIter, ++i )
1926 : : {
1927 [ # # ]: 0 : aFieldMasters[i] = *aSetIter;
1928 : : }
1929 : :
1930 [ # # ]: 0 : pUsedMasters->erase(rText);
1931 : : }
1932 : : // else: XText not found -> ignore
1933 : : }
1934 : : // else: no field masters have been recorded -> ignore
1935 : : }
1936 : : else
1937 : : {
1938 : : // no XText: export all!
1939 [ + - ][ + - ]: 21 : aFieldMasters = xFieldMasterNameAccess->getElementNames();
[ + - ][ + - ]
1940 : : }
1941 : :
1942 [ + + ]: 107 : for(sal_Int32 i=0; i<aFieldMasters.getLength(); i++) {
1943 : :
1944 : : // get field master name
1945 [ + - ]: 86 : OUString sFieldMaster = aFieldMasters[i];
1946 : :
1947 : : // workaround for #no-bug#
1948 : : static const sal_Char sDB[] =
1949 : : "com.sun.star.text.FieldMaster.DataBase.";
1950 [ - + ]: 86 : if ( sFieldMaster.matchIgnoreAsciiCaseAsciiL( sDB, sizeof(sDB)-1) )
1951 : : {
1952 : 0 : continue;
1953 : : }
1954 : :
1955 : :
1956 : 86 : OUString sFieldMasterType;
1957 : 86 : OUString sVarName;
1958 : 86 : ExplodeFieldMasterName(sFieldMaster, sFieldMasterType, sVarName);
1959 : :
1960 : : // get XPropertySet of this field master
1961 : 86 : Reference<XPropertySet> xPropSet;
1962 [ + - ][ + - ]: 86 : Any aAny = xFieldMasterNameAccess->getByName(sFieldMaster);
1963 [ + - ]: 86 : aAny >>= xPropSet;
1964 : :
1965 : : // save interesting field masters
1966 [ + + ]: 86 : if (0 == sFieldMasterType.compareToAscii(FIELD_SERVICE_SETEXP))
1967 : : {
1968 [ + - ]: 84 : sal_Int32 nType = GetIntProperty(sPropertySubType, xPropSet);
1969 : :
1970 : : // sequence or variable?
1971 [ + - ]: 84 : if ( SetVariableType::SEQUENCE == nType )
1972 : : {
1973 [ + - ]: 84 : aSeqName.push_back( sFieldMaster );
1974 : : }
1975 : : else
1976 : : {
1977 [ # # ]: 0 : aVarName.push_back( sFieldMaster );
1978 : : }
1979 : : }
1980 [ - + ]: 2 : else if (0 == sFieldMasterType.compareToAscii(FIELD_SERVICE_USER))
1981 : : {
1982 [ # # ]: 0 : aUserName.push_back( sFieldMaster );
1983 : : }
1984 [ - + ]: 2 : else if (0 == sFieldMasterType.compareToAscii(FIELD_SERVICE_DDE))
1985 : : {
1986 [ # # ]: 0 : aDdeName.push_back( sFieldMaster );
1987 : : }
1988 : : else
1989 : : {
1990 : : ; // ignore
1991 : : }
1992 [ + - ]: 86 : }
1993 : :
1994 : : // now process fields:
1995 : :
1996 : : // variable field masters:
1997 [ - + ]: 21 : if ( !aVarName.empty() )
1998 : : {
1999 : 0 : SvXMLElementExport aElem( GetExport(),
2000 : : XML_NAMESPACE_TEXT,
2001 : : XML_VARIABLE_DECLS,
2002 [ # # ]: 0 : sal_True, sal_True );
2003 : :
2004 [ # # ][ # # ]: 0 : for (vector<OUString>::iterator aVarIter = aVarName.begin();
2005 : 0 : aVarIter != aVarName.end();
2006 : : ++aVarIter) {
2007 : :
2008 : 0 : OUString sName = *aVarIter;
2009 : :
2010 : : // get field master property set
2011 : 0 : Reference<XPropertySet> xPropSet;
2012 [ # # ][ # # ]: 0 : Any aAny = xFieldMasterNameAccess->getByName(sName);
2013 [ # # ]: 0 : aAny >>= xPropSet;
2014 : :
2015 : : // field name and type
2016 : 0 : OUString sFieldMasterType;
2017 : 0 : OUString sVarName;
2018 : 0 : ExplodeFieldMasterName(sName, sFieldMasterType, sVarName);
2019 : :
2020 : : // determine string/numeric field
2021 [ # # ]: 0 : sal_Bool bIsString = ( GetIntProperty(sPropertySubType, xPropSet)
2022 : 0 : == SetVariableType::STRING );
2023 : :
2024 : : // get dependent field property set
2025 : 0 : Reference<XPropertySet> xFieldPropSet;
2026 [ # # ][ # # ]: 0 : if (GetDependentFieldPropertySet(xPropSet, xFieldPropSet))
2027 : : {
2028 : : // process value and type.
2029 : : ProcessValueAndType(
2030 : : bIsString,
2031 : : GetIntProperty(sPropertyNumberFormat, xFieldPropSet),
2032 : : sEmpty, sEmpty, 0.0,
2033 [ # # ][ # # ]: 0 : sal_False, sal_True, sal_False, sal_False);
2034 : : }
2035 : : else
2036 : : {
2037 : : // If no dependent field is found, only string and
2038 : : // float types can be supported
2039 : :
2040 : : // number format: 0 is default number format for 1st
2041 : : // language. should be: getDefaultNumberFormat(Locale)
2042 : : // from NumberFormats
2043 : : ProcessValueAndType(
2044 : : bIsString,
2045 : : 0, sEmpty, sEmpty, 0.0,
2046 [ # # ]: 0 : sal_False, sal_True, sal_False, sal_False);
2047 : : }
2048 : :
2049 [ # # ]: 0 : ProcessString(XML_NAME, sVarName);
2050 [ # # ]: 0 : ExportElement(XML_VARIABLE_DECL, sal_True);
2051 [ # # ]: 0 : }
2052 : : }
2053 : : // else: no declarations element
2054 : :
2055 : : // sequence field masters:
2056 [ + - ]: 21 : if ( !aSeqName.empty() )
2057 : : {
2058 : 21 : SvXMLElementExport aElem( GetExport(),
2059 : : XML_NAMESPACE_TEXT,
2060 : : XML_SEQUENCE_DECLS,
2061 [ + - ]: 21 : sal_True, sal_True );
2062 : :
2063 [ + - ][ + + ]: 210 : for (vector<OUString>::iterator aSeqIter = aSeqName.begin();
2064 : 105 : aSeqIter != aSeqName.end();
2065 : : ++aSeqIter) {
2066 : :
2067 : 84 : OUString sName = *aSeqIter;
2068 : :
2069 : : // get field master property set
2070 : 84 : Reference<XPropertySet> xPropSet;
2071 [ + - ][ + - ]: 84 : Any aAny = xFieldMasterNameAccess->getByName(sName);
2072 [ + - ]: 84 : aAny >>= xPropSet;
2073 : :
2074 : : // field name and type
2075 : 84 : OUString sFieldMasterType;
2076 : 84 : OUString sVarName;
2077 : 84 : ExplodeFieldMasterName(sName, sFieldMasterType, sVarName);
2078 : :
2079 : : // outline level
2080 : : sal_Int32 nLevel = 1 + GetIntProperty(
2081 [ + - ]: 84 : sPropertyChapterNumberingLevel, xPropSet);
2082 : : DBG_ASSERT(nLevel >= 0, "illegal outline level");
2083 : : DBG_ASSERT(nLevel < 127, "possible illegal outline level");
2084 [ + - ]: 84 : ProcessInteger(XML_DISPLAY_OUTLINE_LEVEL, nLevel);
2085 : :
2086 : : // separation character
2087 [ - + ]: 84 : if (nLevel > 0) {
2088 : : ProcessString(XML_SEPARATION_CHARACTER, GetStringProperty(
2089 [ # # ][ # # ]: 0 : sPropertyNumberingSeparator, xPropSet));
2090 : : }
2091 [ + - ]: 84 : ProcessString(XML_NAME, sVarName);
2092 [ + - ]: 84 : ExportElement(XML_SEQUENCE_DECL, sal_True);
2093 [ + - ]: 105 : }
2094 : : }
2095 : : // else: no declarations element
2096 : :
2097 : : // user field field masters:
2098 [ - + ]: 21 : if ( !aUserName.empty() )
2099 : : {
2100 : 0 : SvXMLElementExport aElem( GetExport(),
2101 : : XML_NAMESPACE_TEXT,
2102 : : XML_USER_FIELD_DECLS,
2103 [ # # ]: 0 : sal_True, sal_True );
2104 : :
2105 [ # # ][ # # ]: 0 : for (vector<OUString>::iterator aUserIter = aUserName.begin();
2106 : 0 : aUserIter != aUserName.end();
2107 : : ++aUserIter) {
2108 : :
2109 : 0 : OUString sName = *aUserIter;
2110 : :
2111 : : // get field master property set
2112 : 0 : Reference<XPropertySet> xPropSet;
2113 [ # # ][ # # ]: 0 : Any aAny = xFieldMasterNameAccess->getByName(sName);
2114 [ # # ]: 0 : aAny >>= xPropSet;
2115 : :
2116 : : // field name and type
2117 : 0 : OUString sFieldMasterType;
2118 : 0 : OUString sVarName;
2119 : 0 : ExplodeFieldMasterName(sName, sFieldMasterType, sVarName);
2120 : :
2121 [ # # ][ # # ]: 0 : if (GetBoolProperty(sPropertyIsExpression, xPropSet))
2122 : : {
2123 : : // expression:
2124 : : ProcessValueAndType(
2125 : : sal_False,
2126 : : 0, sEmpty, sEmpty,
2127 : : GetDoubleProperty(sPropertyValue, xPropSet),
2128 : : sal_True,
2129 : : sal_True,
2130 : : sal_False,
2131 [ # # ][ # # ]: 0 : sal_False);
2132 : : }
2133 : : else
2134 : : {
2135 : : // string: write regardless of default
2136 : : ProcessString(XML_VALUE_TYPE, XML_STRING, sal_False,
2137 [ # # ]: 0 : XML_NAMESPACE_OFFICE);
2138 : : ProcessString(XML_STRING_VALUE,
2139 : : GetStringProperty(sPropertyContent, xPropSet),
2140 [ # # ][ # # ]: 0 : sal_False, XML_NAMESPACE_OFFICE );
2141 : : }
2142 [ # # ]: 0 : ProcessString(XML_NAME, sVarName);
2143 [ # # ]: 0 : ExportElement(XML_USER_FIELD_DECL, sal_True);
2144 [ # # ]: 0 : }
2145 : : }
2146 : : // else: no declarations element
2147 : :
2148 : : // DDE field field masters:
2149 [ - + ]: 21 : if ( !aDdeName.empty() )
2150 : : {
2151 : 0 : SvXMLElementExport aElem( GetExport(),
2152 : : XML_NAMESPACE_TEXT,
2153 : : XML_DDE_CONNECTION_DECLS,
2154 [ # # ]: 0 : sal_True, sal_True );
2155 : :
2156 [ # # ][ # # ]: 0 : for (vector<OUString>::iterator aDdeIter = aDdeName.begin();
2157 : 0 : aDdeIter != aDdeName.end();
2158 : : ++aDdeIter)
2159 : : {
2160 : 0 : OUString sName = *aDdeIter;
2161 : :
2162 : : // get field master property set
2163 : 0 : Reference<XPropertySet> xPropSet;
2164 [ # # ][ # # ]: 0 : Any aAny = xFieldMasterNameAccess->getByName(sName);
2165 [ # # ]: 0 : aAny >>= xPropSet;
2166 : :
2167 : : // check if this connection is being used by a field
2168 : 0 : Reference<XPropertySet> xDummy;
2169 [ # # ][ # # ]: 0 : if (GetDependentFieldPropertySet(xPropSet, xDummy))
2170 : : {
2171 : :
2172 : : ProcessString(XML_NAME,
2173 : : GetStringProperty(sPropertyName, xPropSet),
2174 [ # # ][ # # ]: 0 : sal_False, XML_NAMESPACE_OFFICE);
2175 : :
2176 : : // export elements; can't use ProcessString because
2177 : : // elements are in office namespace
2178 : : ProcessString(XML_DDE_APPLICATION,
2179 : : GetStringProperty(sPropertyDDECommandType,
2180 : : xPropSet),
2181 [ # # ][ # # ]: 0 : sal_False, XML_NAMESPACE_OFFICE);
2182 : : ProcessString(XML_DDE_TOPIC,
2183 : : GetStringProperty(sPropertyDDECommandFile,
2184 : : xPropSet),
2185 [ # # ][ # # ]: 0 : sal_False, XML_NAMESPACE_OFFICE);
2186 : : ProcessString(XML_DDE_ITEM,
2187 : : GetStringProperty(sPropertyDDECommandElement,
2188 : : xPropSet),
2189 [ # # ][ # # ]: 0 : sal_False, XML_NAMESPACE_OFFICE);
2190 : : sal_Bool bIsAutomaticUpdate = GetBoolProperty(
2191 [ # # ]: 0 : sPropertyIsAutomaticUpdate, xPropSet);
2192 [ # # ]: 0 : if (bIsAutomaticUpdate)
2193 : : {
2194 : 0 : GetExport().AddAttribute(XML_NAMESPACE_OFFICE,
2195 : : XML_AUTOMATIC_UPDATE,
2196 [ # # ]: 0 : XML_TRUE);
2197 : : }
2198 : :
2199 [ # # ]: 0 : ExportElement(XML_DDE_CONNECTION_DECL, sal_True);
2200 : : }
2201 : : // else: no dependent field -> no export of field declaration
2202 [ # # ]: 0 : }
2203 [ + - ][ + + ]: 41 : }
[ + + ][ + + ]
[ + + ][ + + ]
2204 : : // else: no declarations element
2205 : : }
2206 : :
2207 : 98 : void XMLTextFieldExport::SetExportOnlyUsedFieldDeclarations(
2208 : : sal_Bool bExportOnlyUsed)
2209 : : {
2210 [ + + ]: 98 : delete pUsedMasters;
2211 : 98 : pUsedMasters = NULL;
2212 : :
2213 : : // create used masters set (if none is used)
2214 [ + + ]: 98 : if (bExportOnlyUsed)
2215 [ + - ]: 77 : pUsedMasters = new map<Reference<XText>, set<OUString> > ;
2216 : 98 : }
2217 : :
2218 : 84 : void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName,
2219 : : sal_Bool bAddSpace)
2220 : : {
2221 : : // can't call ExportElement(eElementName, const OUString&) with empty
2222 : : // string because xmlprinter only uses empty tags if no content
2223 : : // (not even empty content) was written.
2224 : :
2225 : : DBG_ASSERT(XML_TOKEN_INVALID != eElementName, "invalid element name!");
2226 [ + - ]: 84 : if (XML_TOKEN_INVALID != eElementName)
2227 : : {
2228 : : // Element
2229 : 84 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
2230 [ + - ][ + - ]: 84 : eElementName, bAddSpace, bAddSpace );
2231 : : } // else: ignore
2232 : 84 : }
2233 : :
2234 : 44 : void XMLTextFieldExport::ExportElement(enum XMLTokenEnum eElementName,
2235 : : const OUString& sContent,
2236 : : sal_Bool bAddSpace)
2237 : : {
2238 : : DBG_ASSERT(eElementName != XML_TOKEN_INVALID, "invalid element name!");
2239 [ + - ]: 44 : if (eElementName != XML_TOKEN_INVALID)
2240 : : {
2241 : : // Element
2242 : 44 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
2243 [ + - ]: 44 : eElementName, bAddSpace, bAddSpace );
2244 : : // export content
2245 [ + - ][ + - ]: 44 : GetExport().Characters(sContent);
2246 : : } else {
2247 : : // always export content
2248 : 0 : GetExport().Characters(sContent);
2249 : : }
2250 : 44 : }
2251 : :
2252 : 0 : void XMLTextFieldExport::ExportMacro(
2253 : : const Reference<XPropertySet> & rPropSet,
2254 : : const OUString& rContent )
2255 : : {
2256 : : // some strings we'll need
2257 [ # # ]: 0 : OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ));
2258 [ # # ]: 0 : OUString sStarBasic( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ));
2259 [ # # ]: 0 : OUString sScript( RTL_CONSTASCII_USTRINGPARAM( "Script" ));
2260 [ # # ]: 0 : OUString sLibrary( RTL_CONSTASCII_USTRINGPARAM( "Library" ));
2261 [ # # ]: 0 : OUString sMacroName( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ));
2262 [ # # ]: 0 : OUString sOnClick( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ));
2263 [ # # ]: 0 : OUString sPropertyMacroLibrary( RTL_CONSTASCII_USTRINGPARAM( "MacroLibrary" ));
2264 [ # # ]: 0 : OUString sPropertyMacroName( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ));
2265 [ # # ]: 0 : OUString sPropertyScriptURL( RTL_CONSTASCII_USTRINGPARAM( "ScriptURL" ));
2266 : :
2267 : :
2268 : : // the description attribute
2269 : : ProcessString(XML_DESCRIPTION,
2270 : : GetStringProperty(sPropertyHint, rPropSet),
2271 [ # # ][ # # ]: 0 : rContent);
2272 : :
2273 : : // the element
2274 : 0 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
2275 [ # # ]: 0 : XML_EXECUTE_MACRO, sal_False, sal_False );
2276 : :
2277 : : // the <office:events>-macro:
2278 : :
2279 : : // 1) build sequence of PropertyValues
2280 [ # # ]: 0 : Sequence<PropertyValue> aSeq;
2281 : 0 : OUString sName;
2282 [ # # ][ # # ]: 0 : rPropSet->getPropertyValue( sPropertyScriptURL ) >>= sName;
2283 : :
2284 : : // if the ScriptURL property is not empty then this is a Scripting
2285 : : // Framework URL, otherwise treat it as a Basic Macro
2286 [ # # ]: 0 : if (!sName.isEmpty())
2287 : : {
2288 [ # # ][ # # ]: 0 : aSeq = Sequence<PropertyValue> (2);
[ # # ]
2289 [ # # ]: 0 : PropertyValue* pArr = aSeq.getArray();
2290 : 0 : pArr[0].Name = sEventType;
2291 [ # # ]: 0 : pArr[0].Value <<= sScript;
2292 : 0 : pArr[1].Name = sScript;
2293 [ # # ][ # # ]: 0 : pArr[1].Value = rPropSet->getPropertyValue( sPropertyScriptURL );
2294 : : }
2295 : : else
2296 : : {
2297 [ # # ][ # # ]: 0 : aSeq = Sequence<PropertyValue> (3);
[ # # ]
2298 [ # # ]: 0 : PropertyValue* pArr = aSeq.getArray();
2299 : 0 : pArr[0].Name = sEventType;
2300 [ # # ]: 0 : pArr[0].Value <<= sStarBasic;
2301 : 0 : pArr[1].Name = sLibrary;
2302 [ # # ][ # # ]: 0 : pArr[1].Value = rPropSet->getPropertyValue( sPropertyMacroLibrary );
2303 : 0 : pArr[2].Name = sMacroName;
2304 [ # # ][ # # ]: 0 : pArr[2].Value = rPropSet->getPropertyValue( sPropertyMacroName );
2305 : : }
2306 : :
2307 : : // 2) export the sequence
2308 [ # # ][ # # ]: 0 : GetExport().GetEventExport().ExportSingleEvent( aSeq, sOnClick, sal_False );
2309 : :
2310 : : // and finally, the field presentation
2311 [ # # ][ # # ]: 0 : GetExport().Characters(rContent);
[ # # ]
2312 : 0 : }
2313 : :
2314 : 20 : void XMLTextFieldExport::ExportMetaField(
2315 : : const Reference<XPropertySet> & i_xMeta,
2316 : : bool i_bAutoStyles, sal_Bool i_bProgress )
2317 : : {
2318 : 20 : bool doExport(!i_bAutoStyles); // do not export element if autostyles
2319 : : // check version >= 1.2
2320 [ + - ][ - + ]: 20 : switch (GetExport().getDefaultVersion()) {
2321 : : case SvtSaveOptions::ODFVER_011: // fall thru
2322 : 0 : case SvtSaveOptions::ODFVER_010: doExport = false; break;
2323 : 20 : default: break;
2324 : : }
2325 : :
2326 [ + - ]: 20 : const Reference < XEnumerationAccess > xEA( i_xMeta, UNO_QUERY_THROW );
2327 [ + - ][ + - ]: 20 : const Reference < XEnumeration > xTextEnum( xEA->createEnumeration() );
2328 : :
2329 [ + - ]: 20 : if (doExport)
2330 : : {
2331 [ + - ]: 20 : const Reference<rdf::XMetadatable> xMeta( i_xMeta, UNO_QUERY_THROW );
2332 : :
2333 : : // style:data-style-name
2334 : : ProcessValueAndType(sal_False,
2335 : : GetIntProperty(sPropertyNumberFormat, i_xMeta),
2336 : : sEmpty, sEmpty, 0.0, sal_False, sal_False, sal_True,
2337 [ + - ][ + - ]: 20 : sal_False, sal_False /*, sal_False*/ );
2338 : :
2339 : : // text:meta-field without xml:id is invalid
2340 [ + - ][ + - ]: 20 : xMeta->ensureMetadataReference();
2341 : :
2342 : : // xml:id for RDF metadata
2343 [ + - ]: 20 : GetExport().AddAttributeXmlId(xMeta);
2344 : : }
2345 : :
2346 : 20 : SvXMLElementExport aElem( GetExport(), doExport,
2347 [ + - ]: 20 : XML_NAMESPACE_TEXT, XML_META_FIELD, sal_False, sal_False );
2348 : :
2349 : : // recurse to export content
2350 : 20 : GetExport().GetTextParagraphExport()->
2351 [ + - ][ + - ]: 20 : exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_bProgress );
[ + - ][ + - ]
[ + - ]
2352 : 20 : }
2353 : :
2354 : : /// export all data-style related attributes
2355 : 24 : void XMLTextFieldExport::ProcessValueAndType(
2356 : : sal_Bool bIsString, /// do we process a string or a number?
2357 : : sal_Int32 nFormatKey, /// format key for NumberFormatter; inv. if string
2358 : : const OUString& sContent, /// string content; possibly invalid
2359 : : const OUString& sDefault, /// default string
2360 : : double fValue, /// float content; possibly invalid
2361 : : sal_Bool bExportValue, /// export value attribute?
2362 : : sal_Bool bExportValueType, /// export value-type attribute?
2363 : : sal_Bool bExportStyle, /// export style-sttribute?
2364 : : sal_Bool bForceSystemLanguage, /// export language attributes?
2365 : : sal_Bool bTimeStyle) // exporting a time style?
2366 : : {
2367 : : // String or number?
2368 [ - + ]: 24 : if (bIsString)
2369 : : {
2370 : :
2371 : : // string: attributes value-type=string, string-value=...
2372 : :
2373 [ # # ][ # # ]: 0 : if (bExportValue || bExportValueType)
2374 : : {
2375 : : XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(
2376 : 0 : GetExport(), sContent, sDefault, bExportValue);
2377 : : }
2378 : :
2379 : : }
2380 : : else
2381 : : {
2382 : :
2383 : : // number: value-type=..., value...=..., data-style-name=...
2384 : :
2385 : : DBG_ASSERT(bExportValueType || !bExportValue, "value w/o value type not supported!");
2386 : :
2387 : : // take care of illegal formats
2388 : : // (shouldn't happen, but does if document is corrupted)
2389 [ + + ]: 24 : if (-1 != nFormatKey)
2390 : : {
2391 [ + - ][ - + ]: 8 : if (bExportValue || bExportValueType)
2392 : : {
2393 : : XMLNumberFormatAttributesExportHelper::
2394 : : SetNumberFormatAttributes(
2395 : 0 : GetExport(), nFormatKey, fValue, bExportValue);
2396 : : }
2397 : :
2398 [ + - ]: 8 : if (bExportStyle)
2399 : : {
2400 : : // don't export language (if desired)
2401 [ + + ]: 8 : if( bForceSystemLanguage )
2402 : : nFormatKey =
2403 [ + - ]: 4 : GetExport().dataStyleForceSystemLanguage( nFormatKey );
2404 : :
2405 : : OUString sDataStyleName =
2406 [ + - ]: 8 : GetExport().getDataStyleName(nFormatKey, bTimeStyle);
2407 [ + - ]: 8 : if( !sDataStyleName.isEmpty() )
2408 : : {
2409 : 8 : GetExport().AddAttribute( XML_NAMESPACE_STYLE,
2410 : : XML_DATA_STYLE_NAME,
2411 [ + - ]: 8 : sDataStyleName );
2412 : 8 : } // else: ignore (no valid number format)
2413 : : } // else: ignore (no number format)
2414 : : }
2415 : : }
2416 : 24 : }
2417 : :
2418 : :
2419 : :
2420 : : /// process display related properties
2421 : 0 : void XMLTextFieldExport::ProcessDisplay(sal_Bool bIsVisible,
2422 : : sal_Bool bIsCommand,
2423 : : sal_Bool bValueDefault)
2424 : : {
2425 : : enum XMLTokenEnum eValue;
2426 : :
2427 [ # # ]: 0 : if (bIsVisible)
2428 : : {
2429 [ # # ]: 0 : eValue = bIsCommand ? XML_FORMULA : XML_VALUE;
2430 : : }
2431 : : else
2432 : : {
2433 : 0 : eValue = XML_NONE;
2434 : : }
2435 : :
2436 : : // omit attribute if default
2437 [ # # ][ # # ]: 0 : if (!bValueDefault || (eValue != XML_VALUE))
2438 : : {
2439 : 0 : GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_DISPLAY, eValue);
2440 : : }
2441 : 0 : }
2442 : :
2443 : :
2444 : :
2445 : : /// export boolean property
2446 : 4 : void XMLTextFieldExport::ProcessBoolean(enum XMLTokenEnum eName,
2447 : : sal_Bool bBool, sal_Bool bDefault)
2448 : : {
2449 : : DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token");
2450 [ - + ]: 4 : if ( XML_TOKEN_INVALID == eName )
2451 : 4 : return;
2452 : :
2453 : : // write attribute (if different than default)
2454 : : // negate to force 0/1 values (and make sal_Bool comparable)
2455 [ - + ]: 4 : if ((!bBool) != (!bDefault)) {
2456 : 0 : GetExport().AddAttribute(XML_NAMESPACE_TEXT, eName,
2457 [ # # ]: 0 : (bBool ? XML_TRUE : XML_FALSE) );
2458 : : }
2459 : : }
2460 : :
2461 : :
2462 : :
2463 : :
2464 : : /// export string attribute
2465 : 88 : void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
2466 : : const OUString& sValue,
2467 : : sal_Bool bOmitEmpty,
2468 : : sal_uInt16 nPrefix)
2469 : : {
2470 : : DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token");
2471 [ - + ]: 88 : if ( XML_TOKEN_INVALID == eName )
2472 : 0 : return;
2473 : :
2474 : : // check for empty string, if applicable
2475 [ + + ][ - + ]: 88 : if ( bOmitEmpty && sValue.isEmpty() )
[ - + ]
2476 : 0 : return;
2477 : :
2478 : : // write attribute
2479 : 88 : GetExport().AddAttribute(nPrefix, eName, sValue);
2480 : : }
2481 : :
2482 : 0 : void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
2483 : : sal_uInt16 nValuePrefix,
2484 : : const OUString& sValue,
2485 : : sal_Bool bOmitEmpty,
2486 : : sal_uInt16 nPrefix)
2487 : : {
2488 : : OUString sQValue =
2489 [ # # ]: 0 : GetExport().GetNamespaceMap().GetQNameByKey( nValuePrefix, sValue, sal_False );
2490 [ # # ]: 0 : ProcessString( eName, sQValue, bOmitEmpty, nPrefix );
2491 : 0 : }
2492 : :
2493 : : /// export a string attribute
2494 : 0 : void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
2495 : : const ::rtl::OUString& sValue,
2496 : : const ::rtl::OUString& sDefault,
2497 : : sal_uInt16 nPrefix)
2498 : : {
2499 [ # # ]: 0 : if (sValue != sDefault)
2500 : : {
2501 : 0 : ProcessString(eName, sValue, sal_False, nPrefix);
2502 : : }
2503 : 0 : }
2504 : :
2505 : : /// export a string attribute
2506 : 0 : void XMLTextFieldExport::ProcessString(enum XMLTokenEnum eName,
2507 : : sal_uInt16 nValuePrefix,
2508 : : const ::rtl::OUString& sValue,
2509 : : const ::rtl::OUString& sDefault,
2510 : : sal_uInt16 nPrefix)
2511 : : {
2512 [ # # ]: 0 : if (sValue != sDefault)
2513 : : {
2514 : 0 : ProcessString(eName, nValuePrefix, sValue, sal_False, nPrefix);
2515 : : }
2516 : 0 : }
2517 : :
2518 : :
2519 : : /// export string attribute
2520 : 0 : void XMLTextFieldExport::ProcessString(
2521 : : enum XMLTokenEnum eName,
2522 : : enum XMLTokenEnum eValue,
2523 : : sal_Bool bOmitEmpty,
2524 : : sal_uInt16 nPrefix)
2525 : : {
2526 : : DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token" );
2527 : : DBG_ASSERT( bOmitEmpty || (eValue != XML_TOKEN_INVALID),
2528 : : "invalid value token" );
2529 [ # # ]: 0 : if ( XML_TOKEN_INVALID == eName )
2530 : 0 : return;
2531 : :
2532 : : // check for empty string, if applicable
2533 [ # # ][ # # ]: 0 : if (bOmitEmpty && (eValue == XML_TOKEN_INVALID))
2534 : 0 : return;
2535 : :
2536 : 0 : GetExport().AddAttribute(nPrefix, eName, eValue);
2537 : : }
2538 : :
2539 : : /// export a string attribute
2540 : 0 : void XMLTextFieldExport::ProcessString(
2541 : : enum XMLTokenEnum eName,
2542 : : enum XMLTokenEnum eValue,
2543 : : enum XMLTokenEnum eDefault,
2544 : : sal_uInt16 nPrefix)
2545 : : {
2546 [ # # ]: 0 : if ( eValue != eDefault )
2547 : 0 : ProcessString( eName, eValue, sal_False, nPrefix);
2548 : 0 : }
2549 : :
2550 : :
2551 : : /// export a string as a sequence of paragraphs
2552 : 0 : void XMLTextFieldExport::ProcessParagraphSequence(
2553 : : const ::rtl::OUString& sParagraphSequence)
2554 : : {
2555 : : // iterate over all string-pieces separated by return (0x0a) and
2556 : : // put each inside a paragraph element.
2557 [ # # ]: 0 : SvXMLTokenEnumerator aEnumerator(sParagraphSequence, sal_Char(0x0a));
2558 : 0 : OUString aSubString;
2559 [ # # ][ # # ]: 0 : while (aEnumerator.getNextToken(aSubString))
2560 : : {
2561 : : SvXMLElementExport aParagraph(
2562 [ # # ]: 0 : GetExport(), XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False);
2563 [ # # ]: 0 : GetExport().Characters(aSubString);
2564 [ # # ]: 0 : }
2565 : 0 : }
2566 : :
2567 : : // export an integer attribute
2568 : 84 : void XMLTextFieldExport::ProcessInteger(enum XMLTokenEnum eName,
2569 : : sal_Int32 nNum)
2570 : : {
2571 : : DBG_ASSERT( eName != XML_TOKEN_INVALID, "invalid element token");
2572 [ - + ]: 84 : if ( XML_TOKEN_INVALID == eName )
2573 : 84 : return;
2574 : :
2575 : 84 : GetExport().AddAttribute(XML_NAMESPACE_TEXT, eName,
2576 [ + - ]: 168 : OUString::valueOf(nNum));
2577 : : }
2578 : :
2579 : : /// export an integer attribute, omit if default
2580 : 0 : void XMLTextFieldExport::ProcessIntegerDef(enum XMLTokenEnum eName,
2581 : : sal_Int32 nNum, sal_Int32 nDefault)
2582 : : {
2583 [ # # ]: 0 : if (nNum != nDefault)
2584 : 0 : ProcessInteger(eName, nNum);
2585 : 0 : }
2586 : :
2587 : :
2588 : :
2589 : : /// export a numbering type
2590 : 0 : void XMLTextFieldExport::ProcessNumberingType(sal_Int16 nNumberingType)
2591 : : {
2592 : : // process only if real format (not: like page descriptor)
2593 [ # # ]: 0 : if (NumberingType::PAGE_DESCRIPTOR != nNumberingType)
2594 : : {
2595 : 0 : OUStringBuffer sTmp( 10 );
2596 : : // number type: num format
2597 : 0 : GetExport().GetMM100UnitConverter().convertNumFormat( sTmp,
2598 [ # # ]: 0 : nNumberingType );
2599 : 0 : GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
2600 [ # # # # ]: 0 : sTmp.makeStringAndClear() );
2601 : : // and letter sync, if applicable
2602 : 0 : GetExport().GetMM100UnitConverter().convertNumLetterSync( sTmp,
2603 [ # # ]: 0 : nNumberingType );
2604 : :
2605 [ # # ]: 0 : if (sTmp.getLength())
2606 : : {
2607 : 0 : GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC,
2608 [ # # # # ]: 0 : sTmp.makeStringAndClear() );
2609 : 0 : }
2610 : : }
2611 : : // else: like page descriptor => ignore
2612 : 0 : }
2613 : :
2614 : :
2615 : : /// export a date, time, or duration
2616 : 0 : void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName,
2617 : : double dValue,
2618 : : sal_Bool bIsDate,
2619 : : sal_Bool bIsDuration,
2620 : : sal_Bool bOmitDurationIfZero,
2621 : : sal_uInt16 nPrefix)
2622 : : {
2623 : : // truncate for date granularity
2624 [ # # ]: 0 : if (bIsDate)
2625 : : {
2626 : 0 : dValue = ::rtl::math::approxFloor(dValue);
2627 : : }
2628 : :
2629 : 0 : OUStringBuffer aBuffer;
2630 [ # # ]: 0 : if (bIsDuration)
2631 : : {
2632 : : // date/time durationM handle bOmitDurationIfZero
2633 [ # # ][ # # ]: 0 : if (!bOmitDurationIfZero || !::rtl::math::approxEqual(dValue, 0.0))
[ # # ]
2634 : : {
2635 [ # # ]: 0 : ::sax::Converter::convertDuration(aBuffer, dValue);
2636 : : }
2637 : : }
2638 : : else
2639 : : {
2640 : : // date/time value
2641 [ # # ]: 0 : rExport.GetMM100UnitConverter().convertDateTime(aBuffer, dValue);
2642 : : }
2643 : :
2644 : : // output attribute
2645 [ # # ][ # # ]: 0 : ProcessString(eName, aBuffer.makeStringAndClear(), sal_True, nPrefix);
2646 : 0 : }
2647 : :
2648 : : /// export a date or time
2649 : 4 : void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName,
2650 : : const DateTime& rTime,
2651 : : sal_Bool bIsDate,
2652 : : sal_uInt16 nPrefix)
2653 : : {
2654 : 4 : OUStringBuffer aBuffer;
2655 : :
2656 : 4 : DateTime aDateTime(rTime);
2657 : :
2658 : : // truncate dates
2659 [ - + ]: 4 : if(bIsDate)
2660 : : {
2661 : 0 : aDateTime.HundredthSeconds = 0;
2662 : 0 : aDateTime.Seconds = 0;
2663 : 0 : aDateTime.Minutes = 0;
2664 : 0 : aDateTime.Hours = 0;
2665 : : }
2666 : :
2667 : : // date/time value
2668 [ + - ]: 4 : ::sax::Converter::convertDateTime(aBuffer, aDateTime);
2669 : :
2670 : : // output attribute
2671 [ + - ][ + - ]: 4 : ProcessString(eName, aBuffer.makeStringAndClear(), sal_True, nPrefix);
2672 : 4 : }
2673 : :
2674 : : /// export a date, time, or duration
2675 : 0 : void XMLTextFieldExport::ProcessDateTime(enum XMLTokenEnum eName,
2676 : : sal_Int32 nMinutes,
2677 : : sal_Bool bIsDate,
2678 : : sal_Bool bIsDuration,
2679 : : sal_Bool bOmitDurationIfZero,
2680 : : sal_uInt16 nPrefix)
2681 : : {
2682 : : // handle bOmitDurationIfZero here, because we can precisely compare ints
2683 [ # # ][ # # ]: 0 : if (!(bIsDuration && bOmitDurationIfZero && (nMinutes==0)))
[ # # ]
2684 : : {
2685 : : ProcessDateTime(eName, (double)nMinutes / (double)(24*60),
2686 : 0 : bIsDate, bIsDuration, bOmitDurationIfZero, nPrefix);
2687 : : }
2688 : 0 : }
2689 : :
2690 : :
2691 : : SvXMLEnumMapEntry const aBibliographyDataTypeMap[] =
2692 : : {
2693 : : { XML_ARTICLE, BibliographyDataType::ARTICLE },
2694 : : { XML_BOOK, BibliographyDataType::BOOK },
2695 : : { XML_BOOKLET, BibliographyDataType::BOOKLET },
2696 : : { XML_CONFERENCE, BibliographyDataType::CONFERENCE },
2697 : : { XML_CUSTOM1, BibliographyDataType::CUSTOM1 },
2698 : : { XML_CUSTOM2, BibliographyDataType::CUSTOM2 },
2699 : : { XML_CUSTOM3, BibliographyDataType::CUSTOM3 },
2700 : : { XML_CUSTOM4, BibliographyDataType::CUSTOM4 },
2701 : : { XML_CUSTOM5, BibliographyDataType::CUSTOM5 },
2702 : : { XML_EMAIL, BibliographyDataType::EMAIL },
2703 : : { XML_INBOOK, BibliographyDataType::INBOOK },
2704 : : { XML_INCOLLECTION, BibliographyDataType::INCOLLECTION },
2705 : : { XML_INPROCEEDINGS, BibliographyDataType::INPROCEEDINGS },
2706 : : { XML_JOURNAL, BibliographyDataType::JOURNAL },
2707 : : { XML_MANUAL, BibliographyDataType::MANUAL },
2708 : : { XML_MASTERSTHESIS, BibliographyDataType::MASTERSTHESIS },
2709 : : { XML_MISC, BibliographyDataType::MISC },
2710 : : { XML_PHDTHESIS, BibliographyDataType::PHDTHESIS },
2711 : : { XML_PROCEEDINGS, BibliographyDataType::PROCEEDINGS },
2712 : : { XML_TECHREPORT, BibliographyDataType::TECHREPORT },
2713 : : { XML_UNPUBLISHED, BibliographyDataType::UNPUBLISHED },
2714 : : { XML_WWW, BibliographyDataType::WWW },
2715 : : { XML_TOKEN_INVALID, 0 }
2716 : : };
2717 : :
2718 : :
2719 : :
2720 : 0 : void XMLTextFieldExport::ProcessBibliographyData(
2721 : : const Reference<XPropertySet>& rPropSet)
2722 : : {
2723 : : // get the values
2724 [ # # ][ # # ]: 0 : Any aAny = rPropSet->getPropertyValue(sPropertyFields);
2725 [ # # ]: 0 : Sequence<PropertyValue> aValues;
2726 [ # # ]: 0 : aAny >>= aValues;
2727 : :
2728 : : // one attribute per value (unless empty)
2729 : 0 : sal_Int32 nLength = aValues.getLength();
2730 [ # # ]: 0 : for (sal_Int32 i = 0; i < nLength; i++)
2731 : : {
2732 [ # # # # ]: 0 : if (aValues[i].Name.equalsAsciiL("BibiliographicType",
2733 : 0 : sizeof("BibiliographicType")-1))
2734 : : {
2735 : 0 : sal_Int16 nTypeId = 0;
2736 [ # # ]: 0 : aValues[i].Value >>= nTypeId;
2737 : 0 : OUStringBuffer sBuf;
2738 : :
2739 [ # # ]: 0 : if (SvXMLUnitConverter::convertEnum(sBuf, nTypeId,
2740 [ # # ]: 0 : aBibliographyDataTypeMap))
2741 : : {
2742 : : rExport.AddAttribute(XML_NAMESPACE_TEXT,
2743 : : XML_BIBLIOGRAPHY_TYPE,
2744 [ # # ][ # # ]: 0 : sBuf.makeStringAndClear());
2745 : 0 : }
2746 : : // else: ignore this argument
2747 : : }
2748 : : else
2749 : : {
2750 : 0 : OUString sStr;
2751 [ # # ]: 0 : aValues[i].Value >>= sStr;
2752 : :
2753 [ # # ]: 0 : if (!sStr.isEmpty())
2754 : : {
2755 : : rExport.AddAttribute(XML_NAMESPACE_TEXT,
2756 [ # # ]: 0 : MapBibliographyFieldName(aValues[i].Name),
2757 [ # # ]: 0 : sStr);
2758 : 0 : }
2759 : : }
2760 [ # # ]: 0 : }
2761 : 0 : }
2762 : :
2763 : : /// export CommandTypeAttribute
2764 : 0 : void XMLTextFieldExport::ProcessCommandType(
2765 : : sal_Int32 nCommandType)
2766 : : {
2767 : 0 : enum XMLTokenEnum eToken = XML_TOKEN_INVALID;
2768 [ # # # # ]: 0 : switch( nCommandType )
2769 : : {
2770 : 0 : case sdb::CommandType::TABLE: eToken = XML_TABLE; break;
2771 : 0 : case sdb::CommandType::QUERY: eToken = XML_QUERY; break;
2772 : 0 : case sdb::CommandType::COMMAND: eToken = XML_COMMAND; break;
2773 : : }
2774 : :
2775 [ # # ]: 0 : if( eToken != XML_TOKEN_INVALID )
2776 : 0 : rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_TABLE_TYPE, eToken );
2777 : 0 : }
2778 : :
2779 : :
2780 : 0 : void XMLTextFieldExport::ProcessStringSequence(
2781 : : const Sequence<OUString>& rSequence,
2782 : : const OUString sSelected )
2783 : : {
2784 : : // find selected element
2785 : 0 : sal_Int32 nSelected = -1;
2786 : 0 : sal_Int32 nLength = rSequence.getLength();
2787 : 0 : const OUString* pSequence = rSequence.getConstArray();
2788 [ # # ]: 0 : for( sal_Int32 i = 0; i < nLength; i++ )
2789 : : {
2790 [ # # ]: 0 : if( pSequence[i] == sSelected )
2791 : 0 : nSelected = i;
2792 : : }
2793 : :
2794 : : // delegate to ProcessStringSequence(OUString,sal_Int32)
2795 : 0 : ProcessStringSequence( rSequence, nSelected );
2796 : 0 : }
2797 : :
2798 : 0 : void XMLTextFieldExport::ProcessStringSequence(
2799 : : const Sequence<OUString>& rSequence,
2800 : : sal_Int32 nSelected )
2801 : : {
2802 : 0 : sal_Int32 nLength = rSequence.getLength();
2803 : 0 : const OUString* pSequence = rSequence.getConstArray();
2804 [ # # ]: 0 : for( sal_Int32 i = 0; i < nLength; i++ )
2805 : : {
2806 [ # # ]: 0 : if( i == nSelected )
2807 : : rExport.AddAttribute( XML_NAMESPACE_TEXT,
2808 [ # # ]: 0 : XML_CURRENT_SELECTED, XML_TRUE );
2809 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_VALUE, pSequence[i] );
2810 : : SvXMLElementExport aElement( rExport, XML_NAMESPACE_TEXT, XML_LABEL,
2811 [ # # ]: 0 : sal_False, sal_False );
2812 [ # # ]: 0 : }
2813 : 0 : }
2814 : :
2815 : 0 : void XMLTextFieldExport::ExportDataBaseElement(
2816 : : enum XMLTokenEnum eElementName,
2817 : : const OUString& sPresentation,
2818 : : const Reference<XPropertySet>& rPropertySet,
2819 : : const Reference<XPropertySetInfo>& rPropertySetInfo )
2820 : : {
2821 : : DBG_ASSERT( eElementName != XML_TOKEN_INVALID, "need token" );
2822 : : DBG_ASSERT( rPropertySet.is(), "need property set" );
2823 : : DBG_ASSERT( rPropertySetInfo.is(), "need property set info" );
2824 : :
2825 : : // get database properties
2826 : 0 : OUString sDataBaseName;
2827 : 0 : OUString sDataBaseURL;
2828 : 0 : OUString sStr;
2829 [ # # ]: 0 : if( ( rPropertySet->getPropertyValue( sPropertyDataBaseName ) >>= sStr )
[ # # # # ]
[ # # ]
[ # # # # ]
[ # # ]
2830 : 0 : && !sStr.isEmpty() )
2831 : : {
2832 : 0 : sDataBaseName = sStr;
2833 : : }
2834 [ # # ][ # # ]: 0 : else if( rPropertySetInfo->hasPropertyByName( sPropertyDataBaseURL ) &&
[ # # # #
# # ][ # # ]
2835 [ # # ][ # # ]: 0 : (rPropertySet->getPropertyValue( sPropertyDataBaseURL ) >>= sStr) &&
[ # # ][ # # ]
2836 : 0 : !sStr.isEmpty() )
2837 : : {
2838 : 0 : sDataBaseURL = sStr;
2839 : : }
2840 : :
2841 : : // add database name property (if present)
2842 [ # # ]: 0 : if( !sDataBaseName.isEmpty() )
2843 : : rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_DATABASE_NAME,
2844 [ # # ]: 0 : sDataBaseName );
2845 : 0 : SvXMLElementExport aDataBaseElement( GetExport(),
2846 : : XML_NAMESPACE_TEXT, eElementName,
2847 [ # # ]: 0 : sal_False, sal_False );
2848 : :
2849 : : // write URL as children
2850 [ # # ]: 0 : if( !sDataBaseURL.isEmpty() )
2851 : : {
2852 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sDataBaseURL );
2853 : : SvXMLElementExport aDataSourceElement(
2854 : 0 : GetExport(), XML_NAMESPACE_FORM, XML_CONNECTION_RESOURCE,
2855 [ # # ][ # # ]: 0 : sal_False, sal_False );
2856 : : }
2857 : :
2858 : : // write presentation
2859 [ # # ][ # # ]: 0 : rExport.Characters( sPresentation );
2860 : 0 : }
2861 : :
2862 : :
2863 : :
2864 : : // explode a field master name into field type and field name
2865 : 170 : sal_Bool XMLTextFieldExport::ExplodeFieldMasterName(
2866 : : const OUString& sMasterName, OUString& sFieldType, OUString& sVarName)
2867 : : {
2868 : 170 : sal_Int32 nLength = sFieldMasterPrefix.getLength();
2869 : 170 : sal_Int32 nSeparator = sMasterName.indexOf('.', nLength);
2870 : 170 : sal_Bool bReturn = sal_True;
2871 : :
2872 : : #ifdef DBG_UTIL
2873 : : // check for service name
2874 : : bReturn &= (0 == sFieldMasterPrefix.compareTo(sMasterName, nLength));
2875 : : #endif
2876 : :
2877 : : // '.' found?
2878 [ + + ]: 170 : if (nSeparator <= nLength) {
2879 : 2 : nSeparator = sMasterName.getLength();
2880 : : DBG_WARNING("no field var name!");
2881 : 2 : bReturn = sal_False;
2882 : : }
2883 : : else
2884 : : {
2885 : 168 : sFieldType = sMasterName.copy(nLength, nSeparator-nLength);
2886 : 168 : sVarName = sMasterName.copy(nSeparator+1);
2887 : : }
2888 : :
2889 : 170 : return bReturn;
2890 : : }
2891 : :
2892 : :
2893 : : // for XDependentTextFields, get PropertySet of FieldMaster
2894 : 0 : Reference<XPropertySet> XMLTextFieldExport::GetMasterPropertySet(
2895 : : const Reference<XTextField> & rTextField)
2896 : : {
2897 : : // name, value => get Property set of TextFieldMaster
2898 [ # # ]: 0 : Reference<XDependentTextField> xDep(rTextField, UNO_QUERY);
2899 [ # # ][ # # ]: 0 : return xDep->getTextFieldMaster();
2900 : : }
2901 : :
2902 : : // get PropertySet of (any; the first) dependent field
2903 : 0 : sal_Bool XMLTextFieldExport::GetDependentFieldPropertySet(
2904 : : const Reference<XPropertySet> & xMaster,
2905 : : Reference<XPropertySet> & xField)
2906 : : {
2907 : 0 : Any aAny;
2908 [ # # ]: 0 : Sequence<Reference<XDependentTextField> > aFields;
2909 [ # # ][ # # ]: 0 : aAny = xMaster->getPropertyValue(sPropertyDependentTextFields);
2910 [ # # ]: 0 : aAny >>= aFields;
2911 : :
2912 : : // any fields?
2913 [ # # ]: 0 : if (aFields.getLength() > 0)
2914 : : {
2915 : : // get first one and return
2916 [ # # ]: 0 : Reference<XDependentTextField> xTField = aFields[0];
2917 [ # # ][ # # ]: 0 : xField = Reference<XPropertySet>(xTField, UNO_QUERY);
2918 : : DBG_ASSERT(xField.is(),
2919 : : "Surprisinlgy, this TextField refuses to be a PropertySet!");
2920 : 0 : return sal_True;
2921 : : }
2922 : : else
2923 : : {
2924 : 0 : return sal_False;
2925 [ # # ]: 0 : }
2926 : : }
2927 : :
2928 : :
2929 : : /// map placeholder type
2930 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapPlaceholderType(sal_uInt16 nType)
2931 : : {
2932 : 0 : enum XMLTokenEnum eType = XML_TEXT;
2933 : :
2934 [ # # # # : 0 : switch (nType)
# # ]
2935 : : {
2936 : : case PlaceholderType::TEXT:
2937 : 0 : eType = XML_TEXT;
2938 : 0 : break;
2939 : :
2940 : : case PlaceholderType::TABLE:
2941 : 0 : eType = XML_TABLE;
2942 : 0 : break;
2943 : :
2944 : : case PlaceholderType::TEXTFRAME:
2945 : 0 : eType = XML_TEXT_BOX;
2946 : 0 : break;
2947 : :
2948 : : case PlaceholderType::GRAPHIC:
2949 : 0 : eType = XML_IMAGE;
2950 : 0 : break;
2951 : :
2952 : : case PlaceholderType::OBJECT:
2953 : 0 : eType = XML_OBJECT;
2954 : 0 : break;
2955 : :
2956 : : default:
2957 : : // unkown placeholder: XML_TEXT
2958 : : OSL_FAIL("unkown placeholder type");
2959 : : }
2960 : :
2961 : 0 : return eType;
2962 : : }
2963 : :
2964 : :
2965 : : /// element name for author fields
2966 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapAuthorFieldName(
2967 : : const Reference<XPropertySet> & xPropSet)
2968 : : {
2969 : : // Initalen oder voller Name?
2970 : 0 : return GetBoolProperty(sPropertyFullName, xPropSet)
2971 [ # # ]: 0 : ? XML_AUTHOR_NAME : XML_AUTHOR_INITIALS;
2972 : : }
2973 : :
2974 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapPageNumberName(
2975 : : const Reference<XPropertySet> & xPropSet,
2976 : : sal_Int32& nOffset)
2977 : : {
2978 : 0 : enum XMLTokenEnum eName = XML_TOKEN_INVALID;
2979 : : PageNumberType ePage;
2980 [ # # ][ # # ]: 0 : Any aAny = xPropSet->getPropertyValue(sPropertySubType);
2981 : 0 : ePage = *(PageNumberType*)aAny.getValue();
2982 : :
2983 [ # # # # ]: 0 : switch (ePage)
2984 : : {
2985 : : case PageNumberType_PREV:
2986 : 0 : eName = XML_PREVIOUS;
2987 : 0 : nOffset += 1;
2988 : 0 : break;
2989 : : case PageNumberType_CURRENT:
2990 : 0 : eName = XML_CURRENT;
2991 : 0 : break;
2992 : : case PageNumberType_NEXT:
2993 : 0 : eName = XML_NEXT;
2994 : 0 : nOffset -= 1;
2995 : 0 : break;
2996 : : default:
2997 : : OSL_FAIL("unknown page number type");
2998 : 0 : eName = XML_TOKEN_INVALID;
2999 : 0 : break;
3000 : : }
3001 : :
3002 : 0 : return eName;
3003 : : }
3004 : :
3005 : : /// map TemplateDisplayFormat to XML
3006 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapTemplateDisplayFormat(sal_Int16 nFormat)
3007 : : {
3008 : 0 : enum XMLTokenEnum eName = XML_TOKEN_INVALID;
3009 : :
3010 [ # # # # : 0 : switch (nFormat)
# # # ]
3011 : : {
3012 : : case TemplateDisplayFormat::FULL:
3013 : 0 : eName = XML_FULL;
3014 : 0 : break;
3015 : : case TemplateDisplayFormat::PATH:
3016 : 0 : eName = XML_PATH;
3017 : 0 : break;
3018 : : case TemplateDisplayFormat::NAME:
3019 : 0 : eName = XML_NAME;
3020 : 0 : break;
3021 : : case TemplateDisplayFormat::NAME_AND_EXT:
3022 : 0 : eName = XML_NAME_AND_EXTENSION;
3023 : 0 : break;
3024 : : case TemplateDisplayFormat::AREA:
3025 : 0 : eName = XML_AREA;
3026 : 0 : break;
3027 : : case TemplateDisplayFormat::TITLE:
3028 : 0 : eName = XML_TITLE;
3029 : 0 : break;
3030 : : default:
3031 : : OSL_FAIL("unknown template display format");
3032 : 0 : eName = XML_TOKEN_INVALID;
3033 : 0 : break;
3034 : : }
3035 : :
3036 : 0 : return eName;
3037 : : }
3038 : :
3039 : : /// map count/statistics field token to XML name
3040 : 4 : enum XMLTokenEnum XMLTextFieldExport::MapCountFieldName(FieldIdEnum nToken)
3041 : : {
3042 : 4 : enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
3043 : :
3044 [ + - - - : 4 : switch (nToken)
- - - - ]
3045 : : {
3046 : : case FIELD_ID_COUNT_PAGES:
3047 : 4 : eElement = XML_PAGE_COUNT;
3048 : 4 : break;
3049 : : case FIELD_ID_COUNT_PARAGRAPHS:
3050 : 0 : eElement = XML_PARAGRAPH_COUNT;
3051 : 0 : break;
3052 : : case FIELD_ID_COUNT_WORDS:
3053 : 0 : eElement = XML_WORD_COUNT;
3054 : 0 : break;
3055 : : case FIELD_ID_COUNT_CHARACTERS:
3056 : 0 : eElement = XML_CHARACTER_COUNT;
3057 : 0 : break;
3058 : : case FIELD_ID_COUNT_TABLES:
3059 : 0 : eElement = XML_TABLE_COUNT;
3060 : 0 : break;
3061 : : case FIELD_ID_COUNT_GRAPHICS:
3062 : 0 : eElement = XML_IMAGE_COUNT;
3063 : 0 : break;
3064 : : case FIELD_ID_COUNT_OBJECTS:
3065 : 0 : eElement = XML_OBJECT_COUNT;
3066 : 0 : break;
3067 : : default:
3068 : : OSL_FAIL("no count field token");
3069 : 0 : eElement = XML_TOKEN_INVALID;
3070 : 0 : break;
3071 : : }
3072 : :
3073 : 4 : return eElement;
3074 : : }
3075 : :
3076 : : /// map ChapterDisplayFormat to XML string
3077 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapChapterDisplayFormat(sal_Int16 nFormat)
3078 : : {
3079 : 0 : enum XMLTokenEnum eName = XML_TOKEN_INVALID;
3080 : :
3081 [ # # # # : 0 : switch (nFormat)
# # ]
3082 : : {
3083 : : case ChapterFormat::NAME:
3084 : 0 : eName = XML_NAME;
3085 : 0 : break;
3086 : : case ChapterFormat::NUMBER:
3087 : 0 : eName = XML_NUMBER;
3088 : 0 : break;
3089 : : case ChapterFormat::NAME_NUMBER:
3090 : 0 : eName = XML_NUMBER_AND_NAME;
3091 : 0 : break;
3092 : : case ChapterFormat::NO_PREFIX_SUFFIX:
3093 : 0 : eName = XML_PLAIN_NUMBER_AND_NAME;
3094 : 0 : break;
3095 : : case ChapterFormat::DIGIT:
3096 : 0 : eName = XML_PLAIN_NUMBER;
3097 : 0 : break;
3098 : : default:
3099 : : OSL_FAIL("unkown chapter display format");
3100 : 0 : eName = XML_TOKEN_INVALID;
3101 : 0 : break;
3102 : : }
3103 : :
3104 : 0 : return eName;
3105 : : }
3106 : :
3107 : :
3108 : : /// map FilenameDisplayFormat to XML attribute names
3109 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapFilenameDisplayFormat(sal_Int16 nFormat)
3110 : : {
3111 : 0 : enum XMLTokenEnum eName = XML_TOKEN_INVALID;
3112 : :
3113 [ # # # # : 0 : switch (nFormat)
# ]
3114 : : {
3115 : : case FilenameDisplayFormat::FULL:
3116 : 0 : eName = XML_FULL;
3117 : 0 : break;
3118 : : case FilenameDisplayFormat::PATH:
3119 : 0 : eName = XML_PATH;
3120 : 0 : break;
3121 : : case FilenameDisplayFormat::NAME:
3122 : 0 : eName = XML_NAME;
3123 : 0 : break;
3124 : : case FilenameDisplayFormat::NAME_AND_EXT:
3125 : 0 : eName = XML_NAME_AND_EXTENSION;
3126 : 0 : break;
3127 : : default:
3128 : : OSL_FAIL("unknown filename display format");
3129 : : }
3130 : :
3131 : 0 : return eName;
3132 : : }
3133 : :
3134 : :
3135 : : /// map ReferenceFieldPart to XML string
3136 : 4 : enum XMLTokenEnum XMLTextFieldExport::MapReferenceType(sal_Int16 nType)
3137 : : {
3138 : 4 : enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
3139 : :
3140 [ - - + - : 4 : switch (nType)
- - - - -
- - - ]
3141 : : {
3142 : : case ReferenceFieldPart::PAGE:
3143 : 0 : eElement = XML_PAGE;
3144 : 0 : break;
3145 : : case ReferenceFieldPart::CHAPTER:
3146 : 0 : eElement = XML_CHAPTER;
3147 : 0 : break;
3148 : : case ReferenceFieldPart::TEXT:
3149 : 4 : eElement = XML_TEXT;
3150 : 4 : break;
3151 : : case ReferenceFieldPart::UP_DOWN:
3152 : 0 : eElement = XML_DIRECTION;
3153 : 0 : break;
3154 : : case ReferenceFieldPart::CATEGORY_AND_NUMBER:
3155 : 0 : eElement = XML_CATEGORY_AND_VALUE;
3156 : 0 : break;
3157 : : case ReferenceFieldPart::ONLY_CAPTION:
3158 : 0 : eElement = XML_CAPTION;
3159 : 0 : break;
3160 : : case ReferenceFieldPart::ONLY_SEQUENCE_NUMBER:
3161 : 0 : eElement = XML_VALUE;
3162 : 0 : break;
3163 : : case ReferenceFieldPart::PAGE_DESC:
3164 : : // small hack: this value never gets written, because
3165 : : // XML_TEMPLATE is default
3166 : 0 : eElement = XML_TEMPLATE;
3167 : 0 : break;
3168 : : // Core implementation for direct cross-references (#i81002#)
3169 : : case ReferenceFieldPart::NUMBER:
3170 : 0 : eElement = XML_NUMBER;
3171 : 0 : break;
3172 : : case ReferenceFieldPart::NUMBER_NO_CONTEXT:
3173 : 0 : eElement = XML_NUMBER_NO_SUPERIOR;
3174 : 0 : break;
3175 : : case ReferenceFieldPart::NUMBER_FULL_CONTEXT:
3176 : 0 : eElement = XML_NUMBER_ALL_SUPERIOR;
3177 : 0 : break;
3178 : : default:
3179 : : OSL_FAIL("unknown reference type");
3180 : 0 : eElement = XML_TEMPLATE;
3181 : 0 : break;
3182 : : }
3183 : :
3184 : 4 : return eElement;
3185 : : }
3186 : :
3187 : : /// map ReferenceFieldPart to XML string
3188 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapReferenceSource(sal_Int16 nType)
3189 : : {
3190 : 0 : enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
3191 : :
3192 [ # # # # : 0 : switch (nType)
# ]
3193 : : {
3194 : : case ReferenceFieldSource::REFERENCE_MARK:
3195 : 0 : eElement = XML_REFERENCE_REF;
3196 : 0 : break;
3197 : : case ReferenceFieldSource::SEQUENCE_FIELD:
3198 : 0 : eElement = XML_SEQUENCE_REF;
3199 : 0 : break;
3200 : : case ReferenceFieldSource::BOOKMARK:
3201 : 0 : eElement = XML_BOOKMARK_REF;
3202 : 0 : break;
3203 : : case ReferenceFieldSource::FOOTNOTE:
3204 : : case ReferenceFieldSource::ENDNOTE:
3205 : 0 : eElement = XML_NOTE_REF;
3206 : 0 : break;
3207 : : default:
3208 : : OSL_FAIL("unkown reference source");
3209 : 0 : break;
3210 : : }
3211 : :
3212 : 0 : return eElement;
3213 : : }
3214 : :
3215 : :
3216 : : /// element name for sender fields
3217 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapSenderFieldName(
3218 : : const Reference<XPropertySet> & xPropSet)
3219 : : {
3220 : 0 : enum XMLTokenEnum eName = XML_TOKEN_INVALID;
3221 : :
3222 : : // sub-field type
3223 [ # # # # : 0 : switch (GetInt16Property(sPropertyFieldSubType, xPropSet))
# # # # #
# # # # #
# # ]
3224 : : {
3225 : : case UserDataPart::COMPANY :
3226 : 0 : eName = XML_SENDER_COMPANY;
3227 : 0 : break;
3228 : : case UserDataPart::FIRSTNAME :
3229 : 0 : eName = XML_SENDER_FIRSTNAME;
3230 : 0 : break;
3231 : : case UserDataPart::NAME :
3232 : 0 : eName = XML_SENDER_LASTNAME;
3233 : 0 : break;
3234 : : case UserDataPart::SHORTCUT :
3235 : 0 : eName = XML_SENDER_INITIALS;
3236 : 0 : break;
3237 : : case UserDataPart::STREET :
3238 : 0 : eName = XML_SENDER_STREET;
3239 : 0 : break;
3240 : : case UserDataPart::COUNTRY :
3241 : 0 : eName = XML_SENDER_COUNTRY;
3242 : 0 : break;
3243 : : case UserDataPart::ZIP :
3244 : 0 : eName = XML_SENDER_POSTAL_CODE;
3245 : 0 : break;
3246 : : case UserDataPart::CITY :
3247 : 0 : eName = XML_SENDER_CITY;
3248 : 0 : break;
3249 : : case UserDataPart::TITLE :
3250 : 0 : eName = XML_SENDER_TITLE;
3251 : 0 : break;
3252 : : case UserDataPart::POSITION :
3253 : 0 : eName = XML_SENDER_POSITION;
3254 : 0 : break;
3255 : : case UserDataPart::PHONE_PRIVATE :
3256 : 0 : eName = XML_SENDER_PHONE_PRIVATE;
3257 : 0 : break;
3258 : : case UserDataPart::PHONE_COMPANY :
3259 : 0 : eName = XML_SENDER_PHONE_WORK;
3260 : 0 : break;
3261 : : case UserDataPart::FAX :
3262 : 0 : eName = XML_SENDER_FAX;
3263 : 0 : break;
3264 : : case UserDataPart::EMAIL :
3265 : 0 : eName = XML_SENDER_EMAIL;
3266 : 0 : break;
3267 : : case UserDataPart::STATE :
3268 : 0 : eName = XML_SENDER_STATE_OR_PROVINCE;
3269 : 0 : break;
3270 : : default:
3271 : : DBG_WARNING("unknown sender type");
3272 : 0 : eName = XML_TOKEN_INVALID;
3273 : 0 : break;
3274 : : }
3275 : :
3276 : 0 : return eName;
3277 : : }
3278 : :
3279 : 4 : enum XMLTokenEnum XMLTextFieldExport::MapDocInfoFieldName(
3280 : : enum FieldIdEnum nToken)
3281 : : {
3282 : 4 : enum XMLTokenEnum eElement = XML_TOKEN_INVALID;
3283 : :
3284 [ - - - - : 4 : switch (nToken)
- - - + -
- - - - -
- - ]
3285 : : {
3286 : : case FIELD_ID_DOCINFO_CREATION_AUTHOR:
3287 : 0 : eElement = XML_INITIAL_CREATOR;
3288 : 0 : break;
3289 : : case FIELD_ID_DOCINFO_CREATION_DATE:
3290 : 0 : eElement = XML_CREATION_DATE;
3291 : 0 : break;
3292 : : case FIELD_ID_DOCINFO_CREATION_TIME:
3293 : 0 : eElement = XML_CREATION_TIME;
3294 : 0 : break;
3295 : : case FIELD_ID_DOCINFO_DESCRIPTION:
3296 : 0 : eElement = XML_DESCRIPTION;
3297 : 0 : break;
3298 : : case FIELD_ID_DOCINFO_PRINT_TIME:
3299 : 0 : eElement = XML_PRINT_TIME;
3300 : 0 : break;
3301 : : case FIELD_ID_DOCINFO_PRINT_DATE:
3302 : 0 : eElement = XML_PRINT_DATE;
3303 : 0 : break;
3304 : : case FIELD_ID_DOCINFO_PRINT_AUTHOR:
3305 : 0 : eElement = XML_PRINTED_BY;
3306 : 0 : break;
3307 : : case FIELD_ID_DOCINFO_TITLE:
3308 : 4 : eElement = XML_TITLE;
3309 : 4 : break;
3310 : : case FIELD_ID_DOCINFO_SUBJECT:
3311 : 0 : eElement = XML_SUBJECT;
3312 : 0 : break;
3313 : : case FIELD_ID_DOCINFO_KEYWORDS:
3314 : 0 : eElement = XML_KEYWORDS;
3315 : 0 : break;
3316 : : case FIELD_ID_DOCINFO_REVISION:
3317 : 0 : eElement = XML_EDITING_CYCLES;
3318 : 0 : break;
3319 : : case FIELD_ID_DOCINFO_EDIT_DURATION:
3320 : 0 : eElement = XML_EDITING_DURATION;
3321 : 0 : break;
3322 : : case FIELD_ID_DOCINFO_SAVE_TIME:
3323 : 0 : eElement = XML_MODIFICATION_TIME;
3324 : 0 : break;
3325 : : case FIELD_ID_DOCINFO_SAVE_DATE:
3326 : 0 : eElement = XML_MODIFICATION_DATE;
3327 : 0 : break;
3328 : : case FIELD_ID_DOCINFO_SAVE_AUTHOR:
3329 : 0 : eElement = XML_CREATOR;
3330 : 0 : break;
3331 : : default:
3332 : : DBG_WARNING("unknown docinfo field type!");
3333 : 0 : eElement = XML_TOKEN_INVALID;
3334 : 0 : break;
3335 : : }
3336 : :
3337 : 4 : return eElement;
3338 : : }
3339 : :
3340 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapBibliographyFieldName(OUString sName)
3341 : : {
3342 : 0 : enum XMLTokenEnum eName = XML_TOKEN_INVALID;
3343 : :
3344 [ # # ]: 0 : if (sName.equalsAsciiL("Identifier", sizeof("Identifier")-1))
3345 : : {
3346 : 0 : eName = XML_IDENTIFIER;
3347 : : }
3348 [ # # ]: 0 : else if (sName.equalsAsciiL("BibiliographicType",
3349 : 0 : sizeof("BibiliographicType")-1))
3350 : : {
3351 : 0 : eName = XML_BIBLIOGRAPHY_TYPE;
3352 : : }
3353 [ # # ]: 0 : else if (sName.equalsAsciiL("Address", sizeof("Address")-1))
3354 : : {
3355 : 0 : eName = XML_ADDRESS;
3356 : : }
3357 [ # # ]: 0 : else if (sName.equalsAsciiL("Annote", sizeof("Annote")-1))
3358 : : {
3359 : 0 : eName = XML_ANNOTE;
3360 : : }
3361 [ # # ]: 0 : else if (sName.equalsAsciiL("Author", sizeof("Author")-1))
3362 : : {
3363 : 0 : eName = XML_AUTHOR;
3364 : : }
3365 [ # # ]: 0 : else if (sName.equalsAsciiL("Booktitle", sizeof("Booktitle")-1))
3366 : : {
3367 : 0 : eName = XML_BOOKTITLE;
3368 : : }
3369 [ # # ]: 0 : else if (sName.equalsAsciiL("Chapter", sizeof("Chapter")-1))
3370 : : {
3371 : 0 : eName = XML_CHAPTER;
3372 : : }
3373 [ # # ]: 0 : else if (sName.equalsAsciiL("Edition", sizeof("Edition")-1))
3374 : : {
3375 : 0 : eName = XML_EDITION;
3376 : : }
3377 [ # # ]: 0 : else if (sName.equalsAsciiL("Editor", sizeof("Editor")-1))
3378 : : {
3379 : 0 : eName = XML_EDITOR;
3380 : : }
3381 [ # # ]: 0 : else if (sName.equalsAsciiL("Howpublished", sizeof("Howpublished")-1))
3382 : : {
3383 : 0 : eName = XML_HOWPUBLISHED;
3384 : : }
3385 [ # # ]: 0 : else if (sName.equalsAsciiL("Institution", sizeof("Institution")-1))
3386 : : {
3387 : 0 : eName = XML_INSTITUTION;
3388 : : }
3389 [ # # ]: 0 : else if (sName.equalsAsciiL("Journal", sizeof("Journal")-1))
3390 : : {
3391 : 0 : eName = XML_JOURNAL;
3392 : : }
3393 [ # # ]: 0 : else if (sName.equalsAsciiL("Month", sizeof("Month")-1))
3394 : : {
3395 : 0 : eName = XML_MONTH;
3396 : : }
3397 [ # # ]: 0 : else if (sName.equalsAsciiL("Note", sizeof("Note")-1))
3398 : : {
3399 : 0 : eName = XML_NOTE;
3400 : : }
3401 [ # # ]: 0 : else if (sName.equalsAsciiL("Number", sizeof("Number")-1))
3402 : : {
3403 : 0 : eName = XML_NUMBER;
3404 : : }
3405 [ # # ]: 0 : else if (sName.equalsAsciiL("Organizations", sizeof("Organizations")-1))
3406 : : {
3407 : 0 : eName = XML_ORGANIZATIONS;
3408 : : }
3409 [ # # ]: 0 : else if (sName.equalsAsciiL("Pages", sizeof("Pages")-1))
3410 : : {
3411 : 0 : eName = XML_PAGES;
3412 : : }
3413 [ # # ]: 0 : else if (sName.equalsAsciiL("Publisher", sizeof("Publisher")-1))
3414 : : {
3415 : 0 : eName = XML_PUBLISHER;
3416 : : }
3417 [ # # ]: 0 : else if (sName.equalsAsciiL("School", sizeof("School")-1))
3418 : : {
3419 : 0 : eName = XML_SCHOOL;
3420 : : }
3421 [ # # ]: 0 : else if (sName.equalsAsciiL("Series", sizeof("Series")-1))
3422 : : {
3423 : 0 : eName = XML_SERIES;
3424 : : }
3425 [ # # ]: 0 : else if (sName.equalsAsciiL("Title", sizeof("Title")-1))
3426 : : {
3427 : 0 : eName = XML_TITLE;
3428 : : }
3429 [ # # ]: 0 : else if (sName.equalsAsciiL("Report_Type", sizeof("Report_Type")-1))
3430 : : {
3431 : 0 : eName = XML_REPORT_TYPE;
3432 : : }
3433 [ # # ]: 0 : else if (sName.equalsAsciiL("Volume", sizeof("Volume")-1))
3434 : : {
3435 : 0 : eName = XML_VOLUME;
3436 : : }
3437 [ # # ]: 0 : else if (sName.equalsAsciiL("Year", sizeof("Year")-1))
3438 : : {
3439 : 0 : eName = XML_YEAR;
3440 : : }
3441 [ # # ]: 0 : else if (sName.equalsAsciiL("URL", sizeof("URL")-1))
3442 : : {
3443 : 0 : eName = XML_URL;
3444 : : }
3445 [ # # ]: 0 : else if (sName.equalsAsciiL("Custom1", sizeof("Custom1")-1))
3446 : : {
3447 : 0 : eName = XML_CUSTOM1;
3448 : : }
3449 [ # # ]: 0 : else if (sName.equalsAsciiL("Custom2", sizeof("Custom2")-1))
3450 : : {
3451 : 0 : eName = XML_CUSTOM2;
3452 : : }
3453 [ # # ]: 0 : else if (sName.equalsAsciiL("Custom3", sizeof("Custom3")-1))
3454 : : {
3455 : 0 : eName = XML_CUSTOM3;
3456 : : }
3457 [ # # ]: 0 : else if (sName.equalsAsciiL("Custom4", sizeof("Custom4")-1))
3458 : : {
3459 : 0 : eName = XML_CUSTOM4;
3460 : : }
3461 [ # # ]: 0 : else if (sName.equalsAsciiL("Custom5", sizeof("Custom5")-1))
3462 : : {
3463 : 0 : eName = XML_CUSTOM5;
3464 : : }
3465 [ # # ]: 0 : else if (sName.equalsAsciiL("ISBN", sizeof("ISBN")-1))
3466 : : {
3467 : 0 : eName = XML_ISBN;
3468 : : }
3469 : : else
3470 : : {
3471 : : OSL_FAIL("Unknown bibliography info data");
3472 : 0 : eName = XML_TOKEN_INVALID;
3473 : : }
3474 : :
3475 : 0 : return eName;
3476 : : }
3477 : :
3478 : 0 : enum XMLTokenEnum XMLTextFieldExport::MapMeasureKind(sal_Int16 nKind)
3479 : : {
3480 [ # # # ]: 0 : switch( nKind )
3481 : : {
3482 : : case 0:
3483 : 0 : return XML_VALUE;
3484 : : case 1:
3485 : 0 : return XML_UNIT;
3486 : : }
3487 : 0 : return XML_GAP;
3488 : : }
3489 : :
3490 : 0 : OUString XMLTextFieldExport::MakeFootnoteRefName(
3491 : : sal_Int16 nSeqNo)
3492 : : {
3493 : : // generate foot-/endnote ID
3494 : 0 : OUStringBuffer aBuf;
3495 [ # # ]: 0 : aBuf.appendAscii("ftn");
3496 [ # # ]: 0 : aBuf.append((sal_Int32)nSeqNo);
3497 [ # # ]: 0 : return aBuf.makeStringAndClear();
3498 : : }
3499 : :
3500 : 0 : OUString XMLTextFieldExport::MakeSequenceRefName(
3501 : : sal_Int16 nSeqNo,
3502 : : const OUString& rSeqName)
3503 : : {
3504 : : // generate foot-/endnote ID
3505 : 0 : OUStringBuffer aBuf;
3506 [ # # ]: 0 : aBuf.appendAscii("ref");
3507 [ # # ]: 0 : aBuf.append(rSeqName);
3508 [ # # ]: 0 : aBuf.append((sal_Int32)nSeqNo);
3509 [ # # ]: 0 : return aBuf.makeStringAndClear();
3510 : : }
3511 : :
3512 : : //
3513 : : // Property accessor helper functions
3514 : : //
3515 : :
3516 : : // to be relegated (does that word exist?) to a more appropriate place
3517 : : //
3518 : :
3519 : :
3520 : 24 : inline sal_Bool GetBoolProperty(
3521 : : const OUString& sPropName,
3522 : : const Reference<XPropertySet> & xPropSet)
3523 : : {
3524 [ + - ][ + - ]: 24 : Any aAny = xPropSet->getPropertyValue(sPropName);
3525 : 24 : sal_Bool bBool = *(sal_Bool *)aAny.getValue();
3526 : 24 : return bBool;
3527 : : }
3528 : :
3529 : 12 : inline sal_Bool GetOptionalBoolProperty(
3530 : : const OUString& sPropName,
3531 : : const Reference<XPropertySet> & xPropSet,
3532 : : const Reference<XPropertySetInfo> & xPropSetInfo,
3533 : : sal_Bool bDefault)
3534 : : {
3535 : 12 : return xPropSetInfo->hasPropertyByName( sPropName )
3536 [ + + ]: 12 : ? GetBoolProperty( sPropName, xPropSet ) : bDefault;
3537 : : }
3538 : :
3539 : 0 : inline double GetDoubleProperty(
3540 : : const OUString& sPropName,
3541 : : const Reference<XPropertySet> & xPropSet)
3542 : : {
3543 [ # # ][ # # ]: 0 : Any aAny = xPropSet->getPropertyValue(sPropName);
3544 : 0 : double fDouble = 0.0;
3545 : 0 : aAny >>= fDouble;
3546 : 0 : return fDouble;
3547 : : }
3548 : :
3549 : 6 : inline OUString const GetStringProperty(
3550 : : const OUString& sPropName,
3551 : : const Reference<XPropertySet> & xPropSet)
3552 : : {
3553 [ + - ][ + - ]: 6 : Any aAny = xPropSet->getPropertyValue(sPropName);
3554 : 6 : OUString sString;
3555 : 6 : aAny >>= sString;
3556 : 6 : return sString;
3557 : : }
3558 : :
3559 : 220 : inline sal_Int32 GetIntProperty(
3560 : : const OUString& sPropName,
3561 : : const Reference<XPropertySet> & xPropSet)
3562 : : {
3563 [ + - ][ + - ]: 220 : Any aAny = xPropSet->getPropertyValue(sPropName);
3564 : 220 : sal_Int32 nInt = 0;
3565 : 220 : aAny >>= nInt;
3566 : 220 : return nInt;
3567 : : }
3568 : :
3569 : 0 : inline sal_Int16 GetInt16Property(
3570 : : const OUString& sPropName,
3571 : : const Reference<XPropertySet> & xPropSet)
3572 : : {
3573 [ # # ][ # # ]: 0 : Any aAny = xPropSet->getPropertyValue(sPropName);
3574 : 0 : sal_Int16 nInt = 0;
3575 : 0 : aAny >>= nInt;
3576 : 0 : return nInt;
3577 : : }
3578 : :
3579 : 0 : inline sal_Int8 GetInt8Property(
3580 : : const OUString& sPropName,
3581 : : const Reference<XPropertySet> & xPropSet)
3582 : : {
3583 [ # # ][ # # ]: 0 : Any aAny = xPropSet->getPropertyValue(sPropName);
3584 : 0 : sal_Int8 nInt = 0;
3585 : 0 : aAny >>= nInt;
3586 : 0 : return nInt;
3587 : : }
3588 : :
3589 : 7 : inline DateTime const GetDateTimeProperty(
3590 : : const OUString& sPropName,
3591 : : const Reference<XPropertySet> & xPropSet)
3592 : : {
3593 [ + - ][ + - ]: 7 : Any aAny = xPropSet->getPropertyValue(sPropName);
3594 : 7 : DateTime aTime;
3595 [ + - ]: 7 : aAny >>= aTime;
3596 : 7 : return aTime;
3597 : : }
3598 : :
3599 : : inline Date const GetDateProperty(
3600 : : const OUString& sPropName,
3601 : : const Reference<XPropertySet> & xPropSet)
3602 : : {
3603 : : Any aAny = xPropSet->getPropertyValue(sPropName);
3604 : : Date aDate;
3605 : : aAny >>= aDate;
3606 : : return aDate;
3607 : : }
3608 : :
3609 : 0 : inline Sequence<OUString> const GetStringSequenceProperty(
3610 : : const OUString& sPropName,
3611 : : const Reference<XPropertySet> & xPropSet)
3612 : : {
3613 [ # # ][ # # ]: 0 : Any aAny = xPropSet->getPropertyValue(sPropName);
3614 [ # # ]: 0 : Sequence<OUString> aSequence;
3615 [ # # ]: 0 : aAny >>= aSequence;
3616 : 0 : return aSequence;
3617 : : }
3618 : :
3619 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|