LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/text - txtflde.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 299 1266 23.6 %
Date: 2012-12-27 Functions: 26 64 40.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10