LCOV - code coverage report
Current view: top level - xmloff/source/text - txtfldi.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 356 1608 22.1 %
Date: 2012-08-25 Functions: 41 344 11.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 331 2416 13.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : /** @#file
      31                 :            :  *
      32                 :            :  *  Import of all text fields except those from txtvfldi.cxx
      33                 :            :  *  (variable related text fields and database display fields)
      34                 :            :  */
      35                 :            : #include "txtfldi.hxx"
      36                 :            : #include "txtvfldi.hxx"
      37                 :            : #include <xmloff/xmlimp.hxx>
      38                 :            : #include <xmloff/xmlnumi.hxx>
      39                 :            : #include <xmloff/txtimp.hxx>
      40                 :            : #include "xmloff/xmlnmspe.hxx"
      41                 :            : #include <xmloff/nmspmap.hxx>
      42                 :            : #include <xmloff/xmltoken.hxx>
      43                 :            : #include <xmloff/xmluconv.hxx>
      44                 :            : #include <xmloff/xmlement.hxx>
      45                 :            : #include "XMLStringBufferImportContext.hxx"
      46                 :            : #include <xmloff/XMLEventsImportContext.hxx>
      47                 :            : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      48                 :            : #include <com/sun/star/text/UserDataPart.hpp>
      49                 :            : #include <com/sun/star/style/NumberingType.hpp>
      50                 :            : #include <com/sun/star/text/PlaceholderType.hpp>
      51                 :            : #include <com/sun/star/text/ReferenceFieldPart.hpp>
      52                 :            : #include <com/sun/star/text/ReferenceFieldSource.hpp>
      53                 :            : #include <com/sun/star/text/XTextField.hpp>
      54                 :            : #include <com/sun/star/text/XTextContent.hpp>
      55                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      56                 :            : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      57                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      58                 :            : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
      59                 :            : #include <com/sun/star/text/XDependentTextField.hpp>
      60                 :            : #include <com/sun/star/text/SetVariableType.hpp>
      61                 :            : #include <com/sun/star/text/FilenameDisplayFormat.hpp>
      62                 :            : #include <com/sun/star/text/ChapterFormat.hpp>
      63                 :            : #include <com/sun/star/text/TemplateDisplayFormat.hpp>
      64                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      65                 :            : #include <com/sun/star/text/BibliographyDataType.hpp>
      66                 :            : #include <com/sun/star/text/BibliographyDataField.hpp>
      67                 :            : #include <com/sun/star/util/XUpdatable.hpp>
      68                 :            : #include <com/sun/star/sdb/CommandType.hpp>
      69                 :            : 
      70                 :            : #include <sax/tools/converter.hxx>
      71                 :            : 
      72                 :            : #include <rtl/ustring.hxx>
      73                 :            : #include <rtl/ustrbuf.hxx>
      74                 :            : #include <rtl/math.hxx>
      75                 :            : #include <tools/debug.hxx>
      76                 :            : 
      77                 :            : 
      78                 :            : using ::rtl::OUString;
      79                 :            : using ::rtl::OUStringBuffer;
      80                 :            : 
      81                 :            : using namespace ::com::sun::star;
      82                 :            : using namespace ::com::sun::star::uno;
      83                 :            : using namespace ::com::sun::star::text;
      84                 :            : using namespace ::com::sun::star::lang;
      85                 :            : using namespace ::com::sun::star::beans;
      86                 :            : using namespace ::com::sun::star::document;
      87                 :            : using namespace ::com::sun::star::util;
      88                 :            : using namespace ::com::sun::star::xml::sax;
      89                 :            : using namespace ::xmloff::token;
      90                 :            : 
      91                 :            : 
      92                 :            : //
      93                 :            : // SO API string constants
      94                 :            : //
      95                 :            : 
      96                 :            : // service prefix and service anems
      97                 :            : const sal_Char sAPI_textfield_prefix[]  = "com.sun.star.text.TextField.";
      98                 :            : const sal_Char sAPI_fieldmaster_prefix[] = "com.sun.star.text.FieldMaster.";
      99                 :            : const sal_Char sAPI_presentation_prefix[] = "com.sun.star.presentation.TextField.";
     100                 :            : 
     101                 :            : const sal_Char sAPI_extended_user[]             = "ExtendedUser";
     102                 :            : const sal_Char sAPI_user_data_type[]            = "UserDataType";
     103                 :            : const sal_Char sAPI_jump_edit[]                 = "JumpEdit";
     104                 :            : const sal_Char sAPI_get_expression[]            = "GetExpression";
     105                 :            : const sal_Char sAPI_set_expression[]            = "SetExpression";
     106                 :            : const sal_Char sAPI_user[]                      = "User";
     107                 :            : const sal_Char sAPI_date_time[]                 = "DateTime";
     108                 :            : const sal_Char sAPI_page_number[]               = "PageNumber";
     109                 :            : const sal_Char sAPI_database_next[]             = "DatabaseNextSet";
     110                 :            : const sal_Char sAPI_database_select[]           = "DatabaseNumberOfSet";
     111                 :            : const sal_Char sAPI_database_number[]           = "DatabaseSetNumber";
     112                 :            : const sal_Char sAPI_database[]                  = "Database";
     113                 :            : const sal_Char sAPI_database_name[]             = "DatabaseName";
     114                 :            : const sal_Char sAPI_docinfo_change_author[]     = "DocInfo.ChangeAuthor";
     115                 :            : const sal_Char sAPI_docinfo_change_date_time[]  = "DocInfo.ChangeDateTime";
     116                 :            : const sal_Char sAPI_docinfo_edit_time[]         = "DocInfo.EditTime";
     117                 :            : const sal_Char sAPI_docinfo_description[]       = "DocInfo.Description";
     118                 :            : const sal_Char sAPI_docinfo_create_author[]     = "DocInfo.CreateAuthor";
     119                 :            : const sal_Char sAPI_docinfo_create_date_time[]  = "DocInfo.CreateDateTime";
     120                 :            : const sal_Char sAPI_docinfo_custom[]            = "DocInfo.Custom";
     121                 :            : const sal_Char sAPI_docinfo_print_author[]      = "DocInfo.PrintAuthor";
     122                 :            : const sal_Char sAPI_docinfo_print_date_time[]   = "DocInfo.PrintDateTime";
     123                 :            : const sal_Char sAPI_docinfo_keywords[]          = "DocInfo.KeyWords";
     124                 :            : const sal_Char sAPI_docinfo_subject[]           = "DocInfo.Subject";
     125                 :            : const sal_Char sAPI_docinfo_title[]             = "DocInfo.Title";
     126                 :            : const sal_Char sAPI_docinfo_revision[]          = "DocInfo.Revision";
     127                 :            : const sal_Char sAPI_hidden_paragraph[]          = "HiddenParagraph";
     128                 :            : const sal_Char sAPI_hidden_text[]               = "HiddenText";
     129                 :            : const sal_Char sAPI_conditional_text[]          = "ConditionalText";
     130                 :            : const sal_Char sAPI_file_name[]                 = "FileName";
     131                 :            : const sal_Char sAPI_chapter[]                   = "Chapter";
     132                 :            : const sal_Char sAPI_template_name[]             = "TemplateName";
     133                 :            : const sal_Char sAPI_page_count[]                = "PageCount";
     134                 :            : const sal_Char sAPI_paragraph_count[]           = "ParagraphCount";
     135                 :            : const sal_Char sAPI_word_count[]                = "WordCount";
     136                 :            : const sal_Char sAPI_character_count[]           = "CharacterCount";
     137                 :            : const sal_Char sAPI_table_count[]               = "TableCount";
     138                 :            : const sal_Char sAPI_graphic_object_count[]      = "GraphicObjectCount";
     139                 :            : const sal_Char sAPI_embedded_object_count[]     = "EmbeddedObjectCount";
     140                 :            : const sal_Char sAPI_reference_page_set[]        = "ReferencePageSet";
     141                 :            : const sal_Char sAPI_reference_page_get[]        = "ReferencePageGet";
     142                 :            : const sal_Char sAPI_macro[]                     = "Macro";
     143                 :            : const sal_Char sAPI_dde[]                       = "DDE";
     144                 :            : const sal_Char sAPI_get_reference[]             = "GetReference";
     145                 :            : const sal_Char sAPI_sheet_name[]                = "SheetName";
     146                 :            : const sal_Char sAPI_url[]                       = "URL";
     147                 :            : const sal_Char sAPI_bibliography[]              = "Bibliography";
     148                 :            : const sal_Char sAPI_annotation[]                = "Annotation";
     149                 :            : const sal_Char sAPI_script[]                    = "Script";
     150                 :            : const sal_Char sAPI_measure[]                   = "Measure";
     151                 :            : const sal_Char sAPI_drop_down[]                 = "DropDown";
     152                 :            : const sal_Char sAPI_header[]                    = "Header";
     153                 :            : const sal_Char sAPI_footer[]                    = "Footer";
     154                 :            : const sal_Char sAPI_datetime[]                  = "DateTime";
     155                 :            : 
     156                 :            : // property names
     157                 :            : const sal_Char sAPI_is_fixed[]          = "IsFixed";
     158                 :            : const sal_Char sAPI_content[]           = "Content";
     159                 :            : const sal_Char sAPI_value[]             = "Value";
     160                 :            : const sal_Char sAPI_author[]            = "Author";
     161                 :            : const sal_Char sAPI_initials[]          = "Initials";
     162                 :            : const sal_Char sAPI_full_name[]         = "FullName";
     163                 :            : const sal_Char sAPI_place_holder_type[] = "PlaceHolderType";
     164                 :            : const sal_Char sAPI_place_holder[]      = "PlaceHolder";
     165                 :            : const sal_Char sAPI_hint[]              = "Hint";
     166                 :            : const sal_Char sAPI_variable_name[]     = "VariableName";
     167                 :            : const sal_Char sAPI_name[]              = "Name";
     168                 :            : const sal_Char sAPI_sub_type[]          = "SubType";
     169                 :            : const sal_Char sAPI_numbering_separator[] = "NumberingSeparator";
     170                 :            : const sal_Char sAPI_chapter_numbering_level[] = "ChapterNumberingLevel";
     171                 :            : const sal_Char sAPI_variable_subtype[]  = "VariableSubtype";
     172                 :            : const sal_Char sAPI_formula[]           = "Formula";
     173                 :            : const sal_Char sAPI_date_time_value[]   = "DateTimeValue";
     174                 :            : const sal_Char sAPI_number_format[]     = "NumberFormat";
     175                 :            : const sal_Char sAPI_user_text[]         = "UserText";
     176                 :            : const sal_Char sAPI_numbering_type[]    = "NumberingType";
     177                 :            : const sal_Char sAPI_offset[]            = "Offset";
     178                 :            : const sal_Char sAPI_data_base_name[]    = "DataBaseName";
     179                 :            : const sal_Char sAPI_data_base_u_r_l[]   = "DataBaseURL";
     180                 :            : const sal_Char sAPI_data_table_name[]   = "DataTableName";
     181                 :            : const sal_Char sAPI_condition[]         = "Condition";
     182                 :            : const sal_Char sAPI_set_number[]        = "SetNumber";
     183                 :            : const sal_Char sAPI_is_data_base_format[] = "DataBaseFormat";
     184                 :            : const sal_Char sAPI_true_content[]      = "TrueContent";
     185                 :            : const sal_Char sAPI_false_content[]     = "FalseContent";
     186                 :            : const sal_Char sAPI_revision[]          = "Revision";
     187                 :            : const sal_Char sAPI_file_format[]       = "FileFormat";
     188                 :            : const sal_Char sAPI_chapter_format[]    = "ChapterFormat";
     189                 :            : const sal_Char sAPI_level[]             = "Level";
     190                 :            : const sal_Char sAPI_is_date[]           = "IsDate";
     191                 :            : const sal_Char sAPI_adjust[]            = "Adjust";
     192                 :            : const sal_Char sAPI_on[]                = "On";
     193                 :            : const sal_Char sAPI_is_automatic_update[] = "IsAutomaticUpdate";
     194                 :            : const sal_Char sAPI_source_name[]       = "SourceName";
     195                 :            : const sal_Char sAPI_current_presentation[] = "CurrentPresentation";
     196                 :            : const sal_Char sAPI_reference_field_part[] = "ReferenceFieldPart";
     197                 :            : const sal_Char sAPI_reference_field_source[] = "ReferenceFieldSource";
     198                 :            : const sal_Char sAPI_dde_command_type[]  = "DDECommandType";
     199                 :            : const sal_Char sAPI_dde_command_file[]  = "DDECommandFile";
     200                 :            : const sal_Char sAPI_dde_command_element[] = "DDECommandElement";
     201                 :            : // sAPI_url: also used as service name
     202                 :            : const sal_Char sAPI_target_frame[]      = "TargetFrame";
     203                 :            : const sal_Char sAPI_representation[]    = "Representation";
     204                 :            : const sal_Char sAPI_date[]              = "Date";
     205                 :            : const sal_Char sAPI_url_content[]       = "URLContent";
     206                 :            : const sal_Char sAPI_script_type[]       = "ScriptType";
     207                 :            : const sal_Char sAPI_is_hidden[]         = "IsHidden";
     208                 :            : const sal_Char sAPI_is_condition_true[] = "IsConditionTrue";
     209                 :            : const sal_Char sAPI_data_command_type[] = "DataCommandType";
     210                 :            : const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage";
     211                 :            : const sal_Char sAPI_is_visible[]        = "IsVisible";
     212                 :            : const sal_Char sAPI_TextRange[]         = "TextRange";
     213                 :            : 
     214                 :            : const sal_Char sAPI_true[] = "TRUE";
     215                 :            : 
     216                 :            : 
     217 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLTextFieldImportContext, SvXMLImportContext);
     218                 :            : 
     219                 :        865 : XMLTextFieldImportContext::XMLTextFieldImportContext(
     220                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
     221                 :            :     const sal_Char* pService,
     222                 :            :     sal_uInt16 nPrefix, const OUString& rElementName)
     223                 :            : :   SvXMLImportContext( rImport, nPrefix, rElementName )
     224                 :            : ,   sIsFixed(sAPI_is_fixed)
     225                 :            : ,   rTextImportHelper(rHlp)
     226                 :            : ,   sServicePrefix(sAPI_textfield_prefix)
     227                 :        865 : ,   bValid(sal_False)
     228                 :            : {
     229                 :            :     DBG_ASSERT(NULL != pService, "Need service name!");
     230                 :        865 :     sServiceName = OUString::createFromAscii(pService);
     231                 :        865 : }
     232                 :            : 
     233                 :        865 : void XMLTextFieldImportContext::StartElement(
     234                 :            :     const Reference<XAttributeList> & xAttrList)
     235                 :            : {
     236                 :            :     // process attributes
     237                 :        865 :     sal_Int16 nLength = xAttrList->getLength();
     238         [ +  + ]:       1139 :     for(sal_Int16 i=0; i<nLength; i++) {
     239                 :            : 
     240                 :        274 :         OUString sLocalName;
     241                 :        274 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
     242   [ +  -  +  - ]:        548 :             GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
                 [ +  - ]
     243                 :            : 
     244         [ +  - ]:        274 :         ProcessAttribute(rTextImportHelper.GetTextFieldAttrTokenMap().
     245         [ +  - ]:        274 :                              Get(nPrefix, sLocalName),
     246 [ +  - ][ +  - ]:        548 :                          xAttrList->getValueByIndex(i) );
                 [ +  - ]
     247                 :        274 :     }
     248                 :        865 : }
     249                 :            : 
     250                 :        865 : XMLTextFieldImportContext::~XMLTextFieldImportContext() {
     251         [ -  + ]:        865 : }
     252                 :            : 
     253                 :         26 : OUString XMLTextFieldImportContext::GetContent()
     254                 :            : {
     255         [ +  - ]:         26 :     if (sContent.isEmpty())
     256                 :            :     {
     257                 :         26 :         sContent = sContentBuffer.makeStringAndClear();
     258                 :            :     }
     259                 :            : 
     260                 :         26 :     return sContent;
     261                 :            : }
     262                 :            : 
     263                 :        853 : void XMLTextFieldImportContext::EndElement()
     264                 :            : {
     265                 :            :     DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
     266         [ +  - ]:        853 :     if (bValid)
     267                 :            :     {
     268                 :            : 
     269                 :            :         // create field/Service
     270                 :        853 :         Reference<XPropertySet> xPropSet;
     271   [ +  -  #  # ]:        853 :         if (CreateField(xPropSet, sServicePrefix + GetServiceName()))
                 [ +  - ]
     272                 :            :         {
     273                 :            :             // set field properties
     274         [ +  - ]:        853 :             PrepareField(xPropSet);
     275                 :            : 
     276                 :            :             // attach field to document
     277         [ +  - ]:        853 :             Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
     278                 :            : 
     279                 :            :             // workaround for #80606#
     280                 :            :             try
     281                 :            :             {
     282         [ +  - ]:        853 :                 rTextImportHelper.InsertTextContent(xTextContent);
     283                 :            :             }
     284         [ #  # ]:          0 :             catch (const lang::IllegalArgumentException&)
     285                 :            :             {
     286                 :            :                 // ignore
     287                 :            :             }
     288                 :       1706 :             return;
     289         [ -  + ]:        853 :         }
     290                 :            :     }
     291                 :            : 
     292                 :            :     // in case of error: write element content
     293         [ #  # ]:          0 :     rTextImportHelper.InsertString(GetContent());
     294                 :            : }
     295                 :            : 
     296                 :        871 : void XMLTextFieldImportContext::Characters(const OUString& rContent)
     297                 :            : {
     298                 :        871 :     sContentBuffer.append(rContent);
     299                 :        871 : }
     300                 :            : 
     301                 :        865 : sal_Bool XMLTextFieldImportContext::CreateField(
     302                 :            :     Reference<XPropertySet> & xField,
     303                 :            :     const OUString& rServiceName)
     304                 :            : {
     305                 :            :     // instantiate new XTextField:
     306                 :            :     // ask import for model, model is factory, ask factory to create service
     307                 :            : 
     308         [ +  - ]:        865 :     Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
     309         [ +  - ]:        865 :     if( xFactory.is() )
     310                 :            :     {
     311 [ +  - ][ +  - ]:        865 :         Reference<XInterface> xIfc = xFactory->createInstance(rServiceName);
     312         [ +  - ]:        865 :         if( xIfc.is() )
     313                 :            :         {
     314         [ +  - ]:        865 :             Reference<XPropertySet> xTmp( xIfc, UNO_QUERY );
     315                 :            : 
     316         [ +  - ]:        865 :             xField = xTmp;
     317                 :            :         } else {
     318                 :          0 :             return sal_False;   // can't create instance
     319         [ +  - ]:        865 :         }
     320                 :            :     } else {
     321                 :          0 :         return sal_False;   // can't get MultiServiceFactory
     322                 :            :     }
     323                 :            : 
     324                 :        865 :     return sal_True;
     325                 :            : }
     326                 :            : 
     327                 :            : /// create the appropriate field context from
     328                 :            : XMLTextFieldImportContext*
     329                 :        892 : XMLTextFieldImportContext::CreateTextFieldImportContext(
     330                 :            :     SvXMLImport& rImport,
     331                 :            :     XMLTextImportHelper& rHlp,
     332                 :            :     sal_uInt16 nPrefix,
     333                 :            :     const OUString& rName,
     334                 :            :     sal_uInt16 nToken)
     335                 :            : {
     336                 :        892 :     XMLTextFieldImportContext* pContext = NULL;
     337                 :            : 
     338   [ -  -  +  -  :        892 :     switch (nToken)
          -  -  -  -  -  
          -  -  +  -  +  
          +  -  -  -  -  
          -  -  -  -  +  
          -  -  -  -  -  
          -  -  +  -  -  
          -  -  +  +  -  
          +  -  -  -  -  
             +  +  +  + ]
     339                 :            :     {
     340                 :            :         case XML_TOK_TEXT_SENDER_FIRSTNAME:
     341                 :            :         case XML_TOK_TEXT_SENDER_LASTNAME:
     342                 :            :         case XML_TOK_TEXT_SENDER_INITIALS:
     343                 :            :         case XML_TOK_TEXT_SENDER_TITLE:
     344                 :            :         case XML_TOK_TEXT_SENDER_POSITION:
     345                 :            :         case XML_TOK_TEXT_SENDER_EMAIL:
     346                 :            :         case XML_TOK_TEXT_SENDER_PHONE_PRIVATE:
     347                 :            :         case XML_TOK_TEXT_SENDER_FAX:
     348                 :            :         case XML_TOK_TEXT_SENDER_COMPANY:
     349                 :            :         case XML_TOK_TEXT_SENDER_PHONE_WORK:
     350                 :            :         case XML_TOK_TEXT_SENDER_STREET:
     351                 :            :         case XML_TOK_TEXT_SENDER_CITY:
     352                 :            :         case XML_TOK_TEXT_SENDER_POSTAL_CODE:
     353                 :            :         case XML_TOK_TEXT_SENDER_COUNTRY:
     354                 :            :         case XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE:
     355                 :            :             pContext =
     356                 :            :                 new XMLSenderFieldImportContext( rImport, rHlp,
     357         [ #  # ]:          0 :                                                  nPrefix, rName, nToken );
     358                 :          0 :             break;
     359                 :            : 
     360                 :            :         case XML_TOK_TEXT_AUTHOR_NAME:
     361                 :            :         case XML_TOK_TEXT_AUTHOR_INITIALS:
     362                 :            :             pContext =
     363                 :            :                 new XMLAuthorFieldImportContext( rImport, rHlp,
     364         [ #  # ]:          0 :                                                  nPrefix, rName, nToken );
     365                 :          0 :             break;
     366                 :            : 
     367                 :            :         case XML_TOK_TEXT_PLACEHOLDER:
     368                 :            :             pContext =
     369                 :            :                 new XMLPlaceholderFieldImportContext( rImport, rHlp,
     370         [ +  - ]:         14 :                                                       nPrefix, rName);
     371                 :         14 :             break;
     372                 :            :         case XML_TOK_TEXT_SEQUENCE:
     373                 :            :             pContext =
     374                 :            :                 new XMLSequenceFieldImportContext( rImport, rHlp,
     375         [ #  # ]:          0 :                                                    nPrefix, rName );
     376                 :          0 :             break;
     377                 :            :         case XML_TOK_TEXT_TEXT_INPUT:
     378                 :            :             pContext =
     379                 :            :                 new XMLTextInputFieldImportContext( rImport, rHlp,
     380         [ #  # ]:          0 :                                                     nPrefix, rName );
     381                 :          0 :             break;
     382                 :            :         case XML_TOK_TEXT_EXPRESSION:
     383                 :            :             pContext =
     384                 :            :                 new XMLExpressionFieldImportContext( rImport, rHlp,
     385         [ #  # ]:          0 :                                                      nPrefix, rName );
     386                 :          0 :             break;
     387                 :            :         case XML_TOK_TEXT_VARIABLE_SET:
     388                 :            :             pContext =
     389                 :            :                 new XMLVariableSetFieldImportContext( rImport, rHlp,
     390         [ #  # ]:          0 :                                                       nPrefix, rName );
     391                 :          0 :             break;
     392                 :            :         case XML_TOK_TEXT_VARIABLE_INPUT:
     393                 :            :             pContext =
     394                 :            :                 new XMLVariableInputFieldImportContext( rImport, rHlp,
     395         [ #  # ]:          0 :                                                         nPrefix, rName );
     396                 :          0 :             break;
     397                 :            :         case XML_TOK_TEXT_VARIABLE_GET:
     398                 :            :             pContext =
     399                 :            :                 new XMLVariableGetFieldImportContext( rImport, rHlp,
     400         [ #  # ]:          0 :                                                       nPrefix, rName );
     401                 :          0 :             break;
     402                 :            :         case XML_TOK_TEXT_USER_FIELD_GET:
     403                 :            :             pContext = new XMLUserFieldImportContext( rImport, rHlp,
     404         [ #  # ]:          0 :                                                       nPrefix, rName );
     405                 :          0 :             break;
     406                 :            :         case XML_TOK_TEXT_USER_FIELD_INPUT:
     407                 :            :             pContext = new XMLUserFieldInputImportContext( rImport, rHlp,
     408         [ #  # ]:          0 :                                                            nPrefix, rName );
     409                 :          0 :             break;
     410                 :            :         case XML_TOK_TEXT_TIME:
     411                 :            :             pContext = new XMLTimeFieldImportContext( rImport, rHlp,
     412         [ +  - ]:         93 :                                                       nPrefix, rName );
     413                 :         93 :             break;
     414                 :            :         case XML_TOK_TEXT_PAGE_CONTINUATION_STRING:
     415                 :            :         case XML_TOK_TEXT_PAGE_CONTINUATION:
     416                 :            :             pContext = new XMLPageContinuationImportContext( rImport, rHlp,
     417         [ #  # ]:          0 :                                                              nPrefix, rName );
     418                 :          0 :             break;
     419                 :            : 
     420                 :            :         case XML_TOK_TEXT_PAGE_NUMBER:
     421                 :            :             pContext = new XMLPageNumberImportContext( rImport, rHlp,
     422         [ +  - ]:        213 :                                                        nPrefix, rName );
     423                 :        213 :             break;
     424                 :            : 
     425                 :            :         case XML_TOK_TEXT_DATE:
     426                 :            :             pContext = new XMLDateFieldImportContext( rImport, rHlp,
     427         [ +  - ]:         97 :                                                       nPrefix, rName );
     428                 :         97 :             break;
     429                 :            : 
     430                 :            :         case XML_TOK_TEXT_DATABASE_NAME:
     431                 :            :             pContext = new XMLDatabaseNameImportContext( rImport, rHlp,
     432         [ #  # ]:          0 :                                                          nPrefix, rName );
     433                 :          0 :             break;
     434                 :            :         case XML_TOK_TEXT_DATABASE_NEXT:
     435                 :            :             pContext = new XMLDatabaseNextImportContext( rImport, rHlp,
     436         [ #  # ]:          0 :                                                          nPrefix, rName );
     437                 :          0 :             break;
     438                 :            :         case XML_TOK_TEXT_DATABASE_SELECT:
     439                 :            :             pContext = new XMLDatabaseSelectImportContext( rImport, rHlp,
     440         [ #  # ]:          0 :                                                            nPrefix, rName );
     441                 :          0 :             break;
     442                 :            :         case XML_TOK_TEXT_DATABASE_ROW_NUMBER:
     443                 :            :             pContext = new XMLDatabaseNumberImportContext( rImport, rHlp,
     444         [ #  # ]:          0 :                                                            nPrefix, rName );
     445                 :          0 :             break;
     446                 :            :         case XML_TOK_TEXT_DATABASE_DISPLAY:
     447                 :            :             pContext = new XMLDatabaseDisplayImportContext( rImport, rHlp,
     448         [ #  # ]:          0 :                                                             nPrefix, rName );
     449                 :          0 :             break;
     450                 :            :         case XML_TOK_TEXT_CONDITIONAL_TEXT:
     451                 :            :             pContext = new XMLConditionalTextImportContext( rImport, rHlp,
     452         [ #  # ]:          0 :                                                             nPrefix, rName );
     453                 :          0 :             break;
     454                 :            :         case XML_TOK_TEXT_HIDDEN_TEXT:
     455                 :            :             pContext = new XMLHiddenTextImportContext( rImport, rHlp,
     456         [ #  # ]:          0 :                                                        nPrefix, rName );
     457                 :          0 :             break;
     458                 :            :         case XML_TOK_TEXT_HIDDEN_PARAGRAPH:
     459                 :            :             pContext = new XMLHiddenParagraphImportContext( rImport, rHlp,
     460         [ #  # ]:          0 :                                                             nPrefix, rName );
     461                 :          0 :             break;
     462                 :            :         case XML_TOK_TEXT_DOCUMENT_DESCRIPTION:
     463                 :            :         case XML_TOK_TEXT_DOCUMENT_TITLE:
     464                 :            :         case XML_TOK_TEXT_DOCUMENT_SUBJECT:
     465                 :            :         case XML_TOK_TEXT_DOCUMENT_KEYWORDS:
     466                 :            :             pContext = new XMLSimpleDocInfoImportContext( rImport, rHlp,
     467                 :            :                                                           nPrefix, rName,
     468                 :            :                                                           nToken, sal_True,
     469         [ +  - ]:         93 :                                                           sal_False );
     470                 :         93 :             break;
     471                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR:
     472                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR:
     473                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR:
     474                 :            :             pContext = new XMLSimpleDocInfoImportContext( rImport, rHlp,
     475                 :            :                                                           nPrefix, rName,
     476                 :            :                                                           nToken, sal_False,
     477         [ #  # ]:          0 :                                                           sal_True );
     478                 :          0 :             break;
     479                 :            : 
     480                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_DATE:
     481                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_TIME:
     482                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_DATE:
     483                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_TIME:
     484                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_DATE:
     485                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_TIME:
     486                 :            :         case XML_TOK_TEXT_DOCUMENT_EDIT_DURATION:
     487                 :            :             pContext = new XMLDateTimeDocInfoImportContext( rImport, rHlp,
     488                 :            :                                                             nPrefix, rName,
     489         [ #  # ]:          0 :                                                             nToken );
     490                 :          0 :             break;
     491                 :            : 
     492                 :            :         case XML_TOK_TEXT_DOCUMENT_REVISION:
     493                 :            :             pContext = new XMLRevisionDocInfoImportContext( rImport, rHlp,
     494                 :            :                                                             nPrefix, rName,
     495         [ #  # ]:          0 :                                                             nToken );
     496                 :          0 :             break;
     497                 :            : 
     498                 :            :         case XML_TOK_TEXT_DOCUMENT_USER_DEFINED:
     499                 :            :             pContext = new XMLUserDocInfoImportContext( rImport, rHlp,
     500                 :            :                                                         nPrefix, rName,
     501         [ #  # ]:          0 :                                                         nToken );
     502                 :          0 :             break;
     503                 :            : 
     504                 :            :         case XML_TOK_TEXT_FILENAME:
     505                 :            :             pContext = new XMLFileNameImportContext( rImport, rHlp,
     506         [ #  # ]:          0 :                                                      nPrefix, rName );
     507                 :          0 :             break;
     508                 :            : 
     509                 :            :         case XML_TOK_TEXT_CHAPTER:
     510                 :            :             pContext = new XMLChapterImportContext( rImport, rHlp,
     511         [ #  # ]:          0 :                                                     nPrefix, rName );
     512                 :          0 :             break;
     513                 :            : 
     514                 :            :         case XML_TOK_TEXT_TEMPLATENAME:
     515                 :            :             pContext = new XMLTemplateNameImportContext( rImport, rHlp,
     516         [ #  # ]:          0 :                                                          nPrefix, rName );
     517                 :          0 :             break;
     518                 :            : 
     519                 :            :         case XML_TOK_TEXT_WORD_COUNT:
     520                 :            :         case XML_TOK_TEXT_PARAGRAPH_COUNT:
     521                 :            :         case XML_TOK_TEXT_TABLE_COUNT:
     522                 :            :         case XML_TOK_TEXT_CHARACTER_COUNT:
     523                 :            :         case XML_TOK_TEXT_IMAGE_COUNT:
     524                 :            :         case XML_TOK_TEXT_OBJECT_COUNT:
     525                 :            :         case XML_TOK_TEXT_PAGE_COUNT:
     526                 :            :             pContext = new XMLCountFieldImportContext( rImport, rHlp,
     527         [ +  - ]:         93 :                                                        nPrefix, rName, nToken);
     528                 :         93 :             break;
     529                 :            : 
     530                 :            :         case XML_TOK_TEXT_GET_PAGE_VAR:
     531                 :            :             pContext = new XMLPageVarGetFieldImportContext( rImport, rHlp,
     532         [ #  # ]:          0 :                                                             nPrefix, rName );
     533                 :          0 :             break;
     534                 :            : 
     535                 :            :         case XML_TOK_TEXT_SET_PAGE_VAR:
     536                 :            :             pContext = new XMLPageVarSetFieldImportContext( rImport, rHlp,
     537         [ #  # ]:          0 :                                                             nPrefix, rName );
     538                 :          0 :             break;
     539                 :            : 
     540                 :            :         case XML_TOK_TEXT_MACRO:
     541                 :            :             pContext = new XMLMacroFieldImportContext( rImport, rHlp,
     542         [ #  # ]:          0 :                                                        nPrefix, rName );
     543                 :          0 :             break;
     544                 :            : 
     545                 :            :         case XML_TOK_TEXT_DDE:
     546                 :            :             pContext = new XMLDdeFieldImportContext( rImport, rHlp,
     547         [ #  # ]:          0 :                                                      nPrefix, rName );
     548                 :          0 :             break;
     549                 :            : 
     550                 :            :         case XML_TOK_TEXT_REFERENCE_REF:
     551                 :            :         case XML_TOK_TEXT_BOOKMARK_REF:
     552                 :            :         case XML_TOK_TEXT_NOTE_REF:
     553                 :            :         case XML_TOK_TEXT_SEQUENCE_REF:
     554                 :            :             pContext = new XMLReferenceFieldImportContext( rImport, rHlp,
     555                 :            :                                                            nToken,
     556         [ +  - ]:         12 :                                                            nPrefix, rName );
     557                 :         12 :             break;
     558                 :            : 
     559                 :            :         case XML_TOK_TEXT_SHEET_NAME:
     560                 :            :             pContext = new XMLSheetNameImportContext( rImport, rHlp,
     561         [ +  - ]:        198 :                                                       nPrefix, rName );
     562                 :        198 :             break;
     563                 :            : 
     564                 :            :         case XML_TOK_TEXT_BIBLIOGRAPHY_MARK:
     565                 :            :             pContext = new XMLBibliographyFieldImportContext( rImport, rHlp,
     566         [ #  # ]:          0 :                                                               nPrefix, rName );
     567                 :          0 :             break;
     568                 :            : 
     569                 :            :         case XML_TOK_TEXT_ANNOTATION:
     570                 :            :         case XML_TOK_TEXT_ANNOTATION_END:
     571                 :            :             pContext = new XMLAnnotationImportContext( rImport, rHlp,
     572                 :            :                                                        nToken,
     573         [ +  - ]:         12 :                                                        nPrefix, rName);
     574                 :         12 :             break;
     575                 :            : 
     576                 :            :         case XML_TOK_TEXT_SCRIPT:
     577                 :            :             pContext = new XMLScriptImportContext( rImport, rHlp,
     578         [ #  # ]:          0 :                                                    nPrefix, rName);
     579                 :          0 :             break;
     580                 :            : 
     581                 :            :         case XML_TOK_TEXT_MEASURE:
     582                 :            :             pContext = new XMLMeasureFieldImportContext( rImport, rHlp,
     583         [ #  # ]:          0 :                                                          nPrefix, rName );
     584                 :          0 :             break;
     585                 :            : 
     586                 :            :         case XML_TOK_TEXT_TABLE_FORMULA:
     587                 :            :             pContext = new XMLTableFormulaImportContext( rImport, rHlp,
     588         [ #  # ]:          0 :                                                          nPrefix, rName );
     589                 :          0 :             break;
     590                 :            :         case XML_TOK_TEXT_DROPDOWN:
     591                 :            :             pContext = new XMLDropDownFieldImportContext( rImport, rHlp,
     592         [ #  # ]:          0 :                                                           nPrefix, rName );
     593                 :          0 :             break;
     594                 :            :         case XML_TOK_DRAW_HEADER:
     595                 :            :             pContext = new XMLHeaderFieldImportContext( rImport, rHlp,
     596         [ +  - ]:         10 :                                                           nPrefix, rName );
     597                 :         10 :             break;
     598                 :            :         case XML_TOK_DRAW_FOOTER:
     599                 :            :             pContext = new XMLFooterFieldImportContext( rImport, rHlp,
     600         [ +  - ]:         15 :                                                           nPrefix, rName );
     601                 :         15 :             break;
     602                 :            :         case XML_TOK_DRAW_DATE_TIME:
     603                 :            :             pContext = new XMLDateTimeFieldImportContext( rImport, rHlp,
     604         [ +  - ]:         15 :                                                           nPrefix, rName );
     605                 :         15 :             break;
     606                 :            : 
     607                 :            :         default:
     608                 :            :             // ignore! May not even be a textfield.
     609                 :            :             // (Reminder: This method is called inside default:-branch)
     610                 :         27 :             pContext = NULL;
     611                 :         27 :             break;
     612                 :            :     }
     613                 :            : 
     614                 :        892 :     return pContext;
     615                 :            : }
     616                 :            : 
     617                 :            : 
     618                 :          0 : void XMLTextFieldImportContext::ForceUpdate(
     619                 :            :     const Reference<XPropertySet> & rPropertySet)
     620                 :            : {
     621                 :            :     // force update
     622         [ #  # ]:          0 :     Reference<XUpdatable> xUpdate(rPropertySet, UNO_QUERY);
     623         [ #  # ]:          0 :     if (xUpdate.is())
     624                 :            :     {
     625 [ #  # ][ #  # ]:          0 :         xUpdate->update();
     626                 :            :     }
     627                 :            :     else
     628                 :            :     {
     629                 :            :         OSL_FAIL("Expected XUpdatable support!");
     630                 :          0 :     }
     631                 :          0 : }
     632                 :            : 
     633                 :            : 
     634                 :            : 
     635                 :            : //
     636                 :            : // XMLSenderFieldImportContext
     637                 :            : //
     638                 :            : 
     639 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLSenderFieldImportContext, XMLTextFieldImportContext);
     640                 :            : 
     641                 :          0 : XMLSenderFieldImportContext::XMLSenderFieldImportContext(
     642                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
     643                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName,
     644                 :            :     sal_uInt16 nToken)
     645                 :            : :   XMLTextFieldImportContext(rImport, rHlp, sAPI_extended_user,nPrfx, sLocalName)
     646                 :            : ,   sPropertyFixed(sAPI_is_fixed)
     647                 :            : ,   sPropertyFieldSubType(sAPI_user_data_type)
     648                 :            : ,   sPropertyContent(sAPI_content)
     649                 :            : ,   bFixed(sal_True)
     650                 :          0 : ,   nElementToken(nToken)
     651                 :            : {
     652                 :          0 : }
     653                 :            : 
     654                 :          0 : void XMLSenderFieldImportContext::StartElement(
     655                 :            :     const Reference<XAttributeList> & xAttrList)
     656                 :            : {
     657                 :          0 :     bValid = sal_True;
     658   [ #  #  #  #  :          0 :     switch (nElementToken) {
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     659                 :            :     case XML_TOK_TEXT_SENDER_FIRSTNAME:
     660                 :          0 :         nSubType = UserDataPart::FIRSTNAME;
     661                 :          0 :         break;
     662                 :            :     case XML_TOK_TEXT_SENDER_LASTNAME:
     663                 :          0 :         nSubType = UserDataPart::NAME;
     664                 :          0 :         break;
     665                 :            :     case XML_TOK_TEXT_SENDER_INITIALS:
     666                 :          0 :         nSubType = UserDataPart::SHORTCUT;
     667                 :          0 :         break;
     668                 :            :     case XML_TOK_TEXT_SENDER_TITLE:
     669                 :          0 :         nSubType = UserDataPart::TITLE;
     670                 :          0 :         break;
     671                 :            :     case XML_TOK_TEXT_SENDER_POSITION:
     672                 :          0 :         nSubType = UserDataPart::POSITION;
     673                 :          0 :         break;
     674                 :            :     case XML_TOK_TEXT_SENDER_EMAIL:
     675                 :          0 :         nSubType = UserDataPart::EMAIL;
     676                 :          0 :         break;
     677                 :            :     case XML_TOK_TEXT_SENDER_PHONE_PRIVATE:
     678                 :          0 :         nSubType = UserDataPart::PHONE_PRIVATE;
     679                 :          0 :         break;
     680                 :            :     case XML_TOK_TEXT_SENDER_FAX:
     681                 :          0 :         nSubType = UserDataPart::FAX;
     682                 :          0 :         break;
     683                 :            :     case XML_TOK_TEXT_SENDER_COMPANY:
     684                 :          0 :         nSubType = UserDataPart::COMPANY;
     685                 :          0 :         break;
     686                 :            :     case XML_TOK_TEXT_SENDER_PHONE_WORK:
     687                 :          0 :         nSubType = UserDataPart::PHONE_COMPANY;
     688                 :          0 :         break;
     689                 :            :     case XML_TOK_TEXT_SENDER_STREET:
     690                 :          0 :         nSubType = UserDataPart::STREET;
     691                 :          0 :         break;
     692                 :            :     case XML_TOK_TEXT_SENDER_CITY:
     693                 :          0 :         nSubType = UserDataPart::CITY;
     694                 :          0 :         break;
     695                 :            :     case XML_TOK_TEXT_SENDER_POSTAL_CODE:
     696                 :          0 :         nSubType = UserDataPart::ZIP;
     697                 :          0 :         break;
     698                 :            :     case XML_TOK_TEXT_SENDER_COUNTRY:
     699                 :          0 :         nSubType = UserDataPart::COUNTRY;
     700                 :          0 :         break;
     701                 :            :     case XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE:
     702                 :          0 :         nSubType = UserDataPart::STATE;
     703                 :          0 :         break;
     704                 :            :     default:
     705                 :          0 :         bValid = sal_False;
     706                 :          0 :         break;
     707                 :            :     }
     708                 :            : 
     709                 :            :     // process Attributes
     710                 :          0 :     XMLTextFieldImportContext::StartElement(xAttrList);
     711                 :          0 : }
     712                 :            : 
     713                 :          0 : void XMLSenderFieldImportContext::ProcessAttribute(
     714                 :            :     sal_uInt16 nAttrToken,
     715                 :            :     const OUString& sAttrValue)
     716                 :            : {
     717         [ #  # ]:          0 :     if (XML_TOK_TEXTFIELD_FIXED == nAttrToken) {
     718                 :            : 
     719                 :            :         // set bVal
     720                 :          0 :         bool bVal(false);
     721         [ #  # ]:          0 :         bool const bRet = ::sax::Converter::convertBool(bVal, sAttrValue);
     722                 :            : 
     723                 :            :         // set bFixed if successfull
     724         [ #  # ]:          0 :         if (bRet) {
     725                 :          0 :             bFixed = bVal;
     726                 :            :         }
     727                 :            :     }
     728                 :          0 : }
     729                 :            : 
     730                 :          0 : void XMLSenderFieldImportContext::PrepareField(
     731                 :            :     const Reference<XPropertySet> & rPropSet)
     732                 :            : {
     733                 :            :     // set members
     734                 :          0 :     Any aAny;
     735         [ #  # ]:          0 :     aAny <<= nSubType;
     736 [ #  # ][ #  # ]:          0 :     rPropSet->setPropertyValue(sPropertyFieldSubType, aAny);
     737                 :            : 
     738                 :            :     // set fixed
     739         [ #  # ]:          0 :     aAny.setValue( &bFixed, ::getBooleanCppuType() );
     740 [ #  # ][ #  # ]:          0 :     rPropSet->setPropertyValue(sPropertyFixed, aAny);
     741                 :            : 
     742                 :            :     // set content if fixed
     743         [ #  # ]:          0 :     if (bFixed)
     744                 :            :     {
     745                 :            :         // in organizer or styles-only mode: force update
     746 [ #  # ][ #  # ]:          0 :         if (GetImport().GetTextImport()->IsOrganizerMode() ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     747 [ #  # ][ #  # ]:          0 :             GetImport().GetTextImport()->IsStylesOnlyMode()   )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     748                 :            :         {
     749         [ #  # ]:          0 :             ForceUpdate(rPropSet);
     750                 :            :         }
     751                 :            :         else
     752                 :            :         {
     753 [ #  # ][ #  # ]:          0 :             aAny <<= GetContent();
     754 [ #  # ][ #  # ]:          0 :             rPropSet->setPropertyValue(sPropertyContent, aAny);
     755                 :            :         }
     756                 :          0 :     }
     757                 :          0 : }
     758                 :            : 
     759                 :            : 
     760                 :            : 
     761                 :            : //
     762                 :            : // XMLAuthorFieldImportContext
     763                 :            : //
     764                 :            : 
     765 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLAuthorFieldImportContext, XMLSenderFieldImportContext);
     766                 :            : 
     767                 :          0 : XMLAuthorFieldImportContext::XMLAuthorFieldImportContext(
     768                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
     769                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName,
     770                 :            :     sal_uInt16 nToken)
     771                 :            : :   XMLSenderFieldImportContext(rImport, rHlp, nPrfx, sLocalName, nToken)
     772                 :            : ,   bAuthorFullName(sal_True)
     773                 :            : ,   sServiceAuthor(sAPI_author)
     774                 :            : ,   sPropertyAuthorFullName(sAPI_full_name)
     775                 :            : ,   sPropertyFixed(sAPI_is_fixed)
     776                 :          0 : ,   sPropertyContent(sAPI_content)
     777                 :            : {
     778                 :            :     // overwrite service name from XMLSenderFieldImportContext
     779                 :          0 :     SetServiceName(sServiceAuthor);
     780                 :          0 : }
     781                 :            : 
     782                 :          0 : void XMLAuthorFieldImportContext::StartElement(
     783                 :            :     const Reference<XAttributeList> & xAttrList) {
     784                 :            : 
     785                 :          0 :     bAuthorFullName = (XML_TOK_TEXT_AUTHOR_INITIALS != nElementToken);
     786                 :          0 :     bValid = sal_True;
     787                 :            : 
     788                 :            :     // process Attributes
     789                 :          0 :     XMLTextFieldImportContext::StartElement(xAttrList);
     790                 :          0 : }
     791                 :            : 
     792                 :          0 : void XMLAuthorFieldImportContext::PrepareField(
     793                 :            :     const Reference<XPropertySet> & rPropSet)
     794                 :            : {
     795                 :            :     // set members
     796                 :          0 :     Any aAny;
     797         [ #  # ]:          0 :     aAny.setValue( &bAuthorFullName, ::getBooleanCppuType() );
     798 [ #  # ][ #  # ]:          0 :     rPropSet->setPropertyValue(sPropertyAuthorFullName, aAny);
     799                 :            : 
     800         [ #  # ]:          0 :     aAny.setValue( &bFixed, ::getBooleanCppuType() );
     801 [ #  # ][ #  # ]:          0 :     rPropSet->setPropertyValue(sPropertyFixed, aAny);
     802                 :            : 
     803                 :            :     // set content if fixed
     804         [ #  # ]:          0 :     if (bFixed)
     805                 :            :     {
     806                 :            :         // organizer or styles-only mode: force update
     807 [ #  # ][ #  # ]:          0 :         if (GetImport().GetTextImport()->IsOrganizerMode() ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     808 [ #  # ][ #  # ]:          0 :             GetImport().GetTextImport()->IsStylesOnlyMode()   )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     809                 :            :         {
     810         [ #  # ]:          0 :             ForceUpdate(rPropSet);
     811                 :            :         }
     812                 :            :         else
     813                 :            :         {
     814 [ #  # ][ #  # ]:          0 :             aAny <<= GetContent();
     815 [ #  # ][ #  # ]:          0 :             rPropSet->setPropertyValue(sPropertyContent, aAny);
     816                 :            :         }
     817                 :          0 :     }
     818                 :          0 : }
     819                 :            : 
     820                 :            : 
     821                 :            : //
     822                 :            : // page continuation string
     823                 :            : //
     824                 :            : 
     825 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLPageContinuationImportContext, XMLTextFieldImportContext );
     826                 :            : 
     827                 :            : static SvXMLEnumMapEntry const lcl_aSelectPageAttrMap[] =
     828                 :            : {
     829                 :            :     { XML_PREVIOUS,     PageNumberType_PREV },
     830                 :            :     { XML_CURRENT,      PageNumberType_CURRENT },
     831                 :            :     { XML_NEXT,         PageNumberType_NEXT },
     832                 :            :     { XML_TOKEN_INVALID, 0 },
     833                 :            : };
     834                 :            : 
     835                 :          0 : XMLPageContinuationImportContext::XMLPageContinuationImportContext(
     836                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
     837                 :            :     const OUString& sLocalName)
     838                 :            : :   XMLTextFieldImportContext(rImport, rHlp, sAPI_page_number, nPrfx, sLocalName)
     839                 :            : ,   sPropertySubType(sAPI_sub_type)
     840                 :            : ,   sPropertyUserText(sAPI_user_text)
     841                 :            : ,   sPropertyNumberingType(sAPI_numbering_type)
     842                 :            : ,   eSelectPage(PageNumberType_CURRENT)
     843                 :          0 : ,   sStringOK(sal_False)
     844                 :            : {
     845                 :          0 :     bValid = sal_True;
     846                 :          0 : }
     847                 :            : 
     848                 :          0 : void XMLPageContinuationImportContext::ProcessAttribute(
     849                 :            :     sal_uInt16 nAttrToken, const OUString& sAttrValue )
     850                 :            : {
     851      [ #  #  # ]:          0 :     switch(nAttrToken)
     852                 :            :     {
     853                 :            :         case XML_TOK_TEXTFIELD_SELECT_PAGE:
     854                 :            :         {
     855                 :            :             sal_uInt16 nTmp;
     856 [ #  # ][ #  # ]:          0 :             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
                 [ #  # ]
     857         [ #  # ]:          0 :                                                 lcl_aSelectPageAttrMap)
     858                 :            :                 && (PageNumberType_CURRENT != nTmp) )
     859                 :            :             {
     860                 :          0 :                 eSelectPage = (PageNumberType)nTmp;
     861                 :            :             }
     862                 :            :             break;
     863                 :            :         }
     864                 :            :         case XML_TOK_TEXTFIELD_STRING_VALUE:
     865                 :          0 :             sString = sAttrValue;
     866                 :          0 :             sStringOK = sal_True;
     867                 :          0 :             break;
     868                 :            :     }
     869                 :          0 : }
     870                 :            : 
     871                 :          0 : void XMLPageContinuationImportContext::PrepareField(
     872                 :            :     const Reference<XPropertySet> & xPropertySet)
     873                 :            : {
     874                 :          0 :     Any aAny;
     875                 :            : 
     876         [ #  # ]:          0 :     aAny <<= eSelectPage;
     877 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertySubType, aAny);
     878                 :            : 
     879 [ #  # ][ #  # ]:          0 :     aAny <<= (sStringOK ? sString : GetContent());
                 [ #  # ]
     880 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyUserText, aAny);
     881                 :            : 
     882         [ #  # ]:          0 :     aAny <<= style::NumberingType::CHAR_SPECIAL;
     883 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
     884                 :          0 : }
     885                 :            : 
     886                 :            : 
     887                 :            : 
     888                 :            : //
     889                 :            : // page number field
     890                 :            : //
     891                 :            : 
     892 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLPageNumberImportContext, XMLTextFieldImportContext );
     893                 :            : 
     894                 :        213 : XMLPageNumberImportContext::XMLPageNumberImportContext(
     895                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
     896                 :            :     const OUString& sLocalName)
     897                 :            : :   XMLTextFieldImportContext(rImport, rHlp, sAPI_page_number, nPrfx, sLocalName)
     898                 :            : ,   sPropertySubType(sAPI_sub_type)
     899                 :            : ,   sPropertyNumberingType(sAPI_numbering_type)
     900                 :            : ,   sPropertyOffset(sAPI_offset)
     901         [ +  - ]:        213 : ,   sNumberSync(GetXMLToken(XML_FALSE))
     902                 :            : ,   nPageAdjust(0)
     903                 :            : ,   eSelectPage(PageNumberType_CURRENT)
     904                 :        426 : ,   sNumberFormatOK(sal_False)
     905                 :            : {
     906                 :        213 :     bValid = sal_True;
     907                 :        213 : }
     908                 :            : 
     909                 :          0 : void XMLPageNumberImportContext::ProcessAttribute(
     910                 :            :     sal_uInt16 nAttrToken,
     911                 :            :     const OUString& sAttrValue )
     912                 :            : {
     913   [ #  #  #  #  :          0 :     switch (nAttrToken)
                      # ]
     914                 :            :     {
     915                 :            :         case XML_TOK_TEXTFIELD_NUM_FORMAT:
     916                 :          0 :             sNumberFormat = sAttrValue;
     917                 :          0 :             sNumberFormatOK = sal_True;
     918                 :          0 :             break;
     919                 :            :         case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
     920                 :          0 :             sNumberSync = sAttrValue;
     921                 :          0 :             break;
     922                 :            :         case XML_TOK_TEXTFIELD_SELECT_PAGE:
     923                 :            :         {
     924                 :            :             sal_uInt16 nTmp;
     925         [ #  # ]:          0 :             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
     926         [ #  # ]:          0 :                                                 lcl_aSelectPageAttrMap))
     927                 :            :             {
     928                 :          0 :                 eSelectPage = (PageNumberType)nTmp;
     929                 :            :             }
     930                 :            :             break;
     931                 :            :         }
     932                 :            :         case XML_TOK_TEXTFIELD_PAGE_ADJUST:
     933                 :            :         {
     934                 :            :             sal_Int32 nTmp;
     935 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertNumber(nTmp, sAttrValue))
     936                 :            :             {
     937                 :          0 :                 nPageAdjust = (sal_Int16)nTmp;
     938                 :            :             }
     939                 :            :             break;
     940                 :            :         }
     941                 :            :     }
     942                 :          0 : }
     943                 :            : 
     944                 :        213 : void XMLPageNumberImportContext::PrepareField(
     945                 :            :         const Reference<XPropertySet> & xPropertySet)
     946                 :            : {
     947                 :        213 :     Any aAny;
     948                 :            : 
     949                 :            :     // all properties are optional
     950                 :            :     Reference<XPropertySetInfo> xPropertySetInfo(
     951 [ +  - ][ +  - ]:        213 :         xPropertySet->getPropertySetInfo());
     952                 :            : 
     953 [ +  - ][ +  - ]:        213 :     if (xPropertySetInfo->hasPropertyByName(sPropertyNumberingType))
                 [ -  + ]
     954                 :            :     {
     955                 :            :         sal_Int16 nNumType;
     956         [ #  # ]:          0 :         if( sNumberFormatOK )
     957                 :            :         {
     958                 :          0 :             nNumType= style::NumberingType::ARABIC;
     959                 :          0 :             GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
     960                 :            :                                                     sNumberFormat,
     961         [ #  # ]:          0 :                                                     sNumberSync );
     962                 :            :         }
     963                 :            :         else
     964                 :          0 :             nNumType = style::NumberingType::PAGE_DESCRIPTOR;
     965                 :            : 
     966         [ #  # ]:          0 :         aAny <<= nNumType;
     967 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
     968                 :            :     }
     969                 :            : 
     970 [ +  - ][ +  - ]:        213 :     if (xPropertySetInfo->hasPropertyByName(sPropertyOffset))
                 [ -  + ]
     971                 :            :     {
     972                 :            :         // adjust offset
     973   [ #  #  #  # ]:          0 :         switch (eSelectPage)
     974                 :            :         {
     975                 :            :             case PageNumberType_PREV:
     976                 :          0 :                 nPageAdjust--;
     977                 :          0 :                 break;
     978                 :            :             case PageNumberType_CURRENT:
     979                 :          0 :                 break;
     980                 :            :             case PageNumberType_NEXT:
     981                 :          0 :                 nPageAdjust++;
     982                 :          0 :                 break;
     983                 :            :             default:
     984                 :            :                 DBG_WARNING("unknown page number type");
     985                 :            :         }
     986         [ #  # ]:          0 :         aAny <<= nPageAdjust;
     987 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyOffset, aAny);
     988                 :            :     }
     989                 :            : 
     990 [ +  - ][ +  - ]:        213 :     if (xPropertySetInfo->hasPropertyByName(sPropertySubType))
                 [ -  + ]
     991                 :            :     {
     992         [ #  # ]:          0 :         aAny <<= eSelectPage;
     993 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertySubType, aAny);
     994                 :        213 :     }
     995                 :        213 : }
     996                 :            : 
     997                 :            : 
     998                 :            : 
     999                 :            : //
    1000                 :            : // Placeholder
    1001                 :            : //
    1002                 :            : 
    1003 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLPlaceholderFieldImportContext, XMLTextFieldImportContext);
    1004                 :            : 
    1005                 :         14 : XMLPlaceholderFieldImportContext::XMLPlaceholderFieldImportContext(
    1006                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1007                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName)
    1008                 :            : :   XMLTextFieldImportContext(rImport, rHlp, sAPI_jump_edit,nPrfx, sLocalName)
    1009                 :            : ,   sPropertyPlaceholderType(sAPI_place_holder_type)
    1010                 :            : ,   sPropertyPlaceholder(sAPI_place_holder)
    1011                 :         14 : ,   sPropertyHint(sAPI_hint)
    1012                 :            : {
    1013                 :         14 : }
    1014                 :            : 
    1015                 :            : /// process attribute values
    1016                 :         14 : void XMLPlaceholderFieldImportContext::ProcessAttribute(
    1017                 :            :     sal_uInt16 nAttrToken, const OUString& sAttrValue )
    1018                 :            : {
    1019      [ -  +  - ]:         14 :     switch (nAttrToken) {
    1020                 :            :     case XML_TOK_TEXTFIELD_DESCRIPTION:
    1021                 :          0 :         sDescription = sAttrValue;
    1022                 :          0 :         break;
    1023                 :            : 
    1024                 :            :     case XML_TOK_TEXTFIELD_PLACEHOLDER_TYPE:
    1025                 :         14 :         bValid = sal_True;
    1026         [ -  + ]:         14 :         if (IsXMLToken(sAttrValue, XML_TABLE))
    1027                 :            :         {
    1028                 :          0 :             nPlaceholderType = PlaceholderType::TABLE;
    1029                 :            :         }
    1030         [ +  - ]:         14 :         else if (IsXMLToken(sAttrValue, XML_TEXT))
    1031                 :            :         {
    1032                 :         14 :             nPlaceholderType = PlaceholderType::TEXT;
    1033                 :            :         }
    1034         [ #  # ]:          0 :         else if (IsXMLToken(sAttrValue, XML_TEXT_BOX))
    1035                 :            :         {
    1036                 :          0 :             nPlaceholderType = PlaceholderType::TEXTFRAME;
    1037                 :            :         }
    1038         [ #  # ]:          0 :         else if (IsXMLToken(sAttrValue, XML_IMAGE))
    1039                 :            :         {
    1040                 :          0 :             nPlaceholderType = PlaceholderType::GRAPHIC;
    1041                 :            :         }
    1042         [ #  # ]:          0 :         else if (IsXMLToken(sAttrValue, XML_OBJECT))
    1043                 :            :         {
    1044                 :          0 :             nPlaceholderType = PlaceholderType::OBJECT;
    1045                 :            :         }
    1046                 :            :         else
    1047                 :            :         {
    1048                 :          0 :             bValid = sal_False;
    1049                 :            :         }
    1050                 :         14 :         break;
    1051                 :            : 
    1052                 :            :     default:
    1053                 :            :         ; // ignore
    1054                 :            :     }
    1055                 :         14 : }
    1056                 :            : 
    1057                 :         14 : void XMLPlaceholderFieldImportContext::PrepareField(
    1058                 :            :     const Reference<XPropertySet> & xPropertySet) {
    1059                 :            : 
    1060                 :         14 :     Any aAny;
    1061         [ +  - ]:         14 :     aAny <<= sDescription;
    1062 [ +  - ][ +  - ]:         14 :     xPropertySet->setPropertyValue(sPropertyHint, aAny);
    1063                 :            : 
    1064                 :            :     // remove <...> around content (if present)
    1065         [ +  - ]:         14 :     OUString aContent = GetContent();
    1066                 :         14 :     sal_Int32 nStart = 0;
    1067                 :         14 :     sal_Int32 nLength = aContent.getLength();
    1068 [ +  - ][ +  - ]:         14 :     if ((nLength > 0) && (aContent.getStr()[0] == '<'))
                 [ +  - ]
    1069                 :            :     {
    1070                 :         14 :         --nLength;
    1071                 :         14 :         ++nStart;
    1072                 :            :     }
    1073 [ +  - ][ +  - ]:         14 :     if ((nLength > 0) && (aContent.getStr()[aContent.getLength()-1] == '>'))
                 [ +  - ]
    1074                 :            :     {
    1075                 :         14 :         --nLength;
    1076                 :            :     }
    1077         [ +  - ]:         14 :     aAny <<= aContent.copy(nStart, nLength);
    1078 [ +  - ][ +  - ]:         14 :     xPropertySet->setPropertyValue(sPropertyPlaceholder, aAny);
    1079                 :            : 
    1080         [ +  - ]:         14 :     aAny <<= nPlaceholderType;
    1081 [ +  - ][ +  - ]:         14 :     xPropertySet->setPropertyValue(sPropertyPlaceholderType, aAny);
    1082                 :         14 : }
    1083                 :            : 
    1084                 :            : 
    1085                 :            : //
    1086                 :            : // time field
    1087                 :            : //
    1088                 :            : 
    1089 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLTimeFieldImportContext, XMLTextFieldImportContext);
    1090                 :            : 
    1091                 :        190 : XMLTimeFieldImportContext::XMLTimeFieldImportContext(
    1092                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1093                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName)
    1094                 :            : :   XMLTextFieldImportContext(rImport, rHlp, sAPI_date_time, nPrfx, sLocalName)
    1095                 :            : ,   sPropertyNumberFormat(sAPI_number_format)
    1096                 :            : ,   sPropertyFixed(sAPI_is_fixed)
    1097                 :            : ,   sPropertyDateTimeValue(sAPI_date_time_value)
    1098                 :            : ,   sPropertyDateTime(sAPI_date_time)
    1099                 :            : ,   sPropertyAdjust(sAPI_adjust)
    1100                 :            : ,   sPropertyIsDate(sAPI_is_date)
    1101                 :            : ,   sPropertyIsFixedLanguage(sAPI_is_fixed_language)
    1102                 :            : ,   fTimeValue(0.0)
    1103                 :            : ,   nAdjust(0)
    1104                 :            : ,   nFormatKey(0)
    1105                 :            : ,   bTimeOK(sal_False)
    1106                 :            : ,   bFormatOK(sal_False)
    1107                 :            : ,   bFixed(sal_False)
    1108                 :            : ,   bIsDate(sal_False)
    1109                 :        190 : ,   bIsDefaultLanguage( sal_True )
    1110                 :            : {
    1111                 :        190 :     bValid = sal_True;  // always valid!
    1112                 :        190 : }
    1113                 :            : 
    1114                 :        127 : void XMLTimeFieldImportContext::ProcessAttribute(
    1115                 :            :     sal_uInt16 nAttrToken, const OUString& sAttrValue )
    1116                 :            : {
    1117   [ +  -  +  -  :        127 :     switch (nAttrToken)
                      - ]
    1118                 :            :     {
    1119                 :            :         case XML_TOK_TEXTFIELD_TIME_VALUE:
    1120                 :            :         {
    1121                 :            :             double fTmp;
    1122 [ +  - ][ -  + ]:         15 :             if (GetImport().GetMM100UnitConverter().
    1123                 :            :                 convertDateTime(fTmp, sAttrValue))
    1124                 :            :             {
    1125                 :          0 :                 fTimeValue = fTmp;
    1126                 :          0 :                 bTimeOK = sal_True;
    1127                 :            :             }
    1128                 :            : 
    1129 [ +  - ][ -  + ]:         15 :             if (::sax::Converter::convertDateTime(aDateTimeValue, sAttrValue))
    1130                 :            :             {
    1131                 :         15 :                 bTimeOK = sal_True;
    1132                 :            :             }
    1133                 :            :             break;
    1134                 :            :         }
    1135                 :            :         case XML_TOK_TEXTFIELD_FIXED:
    1136                 :            :         {
    1137                 :          0 :             bool bTmp(false);
    1138 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertBool(bTmp, sAttrValue))
    1139                 :            :             {
    1140                 :          0 :                 bFixed = bTmp;
    1141                 :            :             }
    1142                 :            :             break;
    1143                 :            :         }
    1144                 :            :         case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
    1145                 :            :         {
    1146                 :        112 :             sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
    1147                 :        112 :                                                sAttrValue, &bIsDefaultLanguage);
    1148         [ +  + ]:        112 :             if (-1 != nKey)
    1149                 :            :             {
    1150                 :          4 :                 nFormatKey = nKey;
    1151                 :          4 :                 bFormatOK = sal_True;
    1152                 :            :             }
    1153                 :        112 :             break;
    1154                 :            :         }
    1155                 :            :         case XML_TOK_TEXTFIELD_TIME_ADJUST:
    1156                 :            :         {
    1157                 :            :             double fTmp;
    1158                 :            : 
    1159 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertDuration(fTmp, sAttrValue))
    1160                 :            :             {
    1161                 :            :                 // convert to minutes
    1162                 :          0 :                 nAdjust = (sal_Int32)::rtl::math::approxFloor(fTmp * 60 * 24);
    1163                 :            :             }
    1164                 :            :             break;
    1165                 :            :         }
    1166                 :            :     }
    1167                 :        127 : }
    1168                 :            : 
    1169                 :        190 : void XMLTimeFieldImportContext::PrepareField(
    1170                 :            :     const Reference<XPropertySet> & rPropertySet)
    1171                 :            : {
    1172                 :        190 :     Any aAny;
    1173                 :            : 
    1174                 :            :     // all properties are optional (except IsDate)
    1175                 :            :     Reference<XPropertySetInfo> xPropertySetInfo(
    1176 [ +  - ][ +  - ]:        190 :         rPropertySet->getPropertySetInfo());
    1177                 :            : 
    1178 [ +  - ][ +  - ]:        190 :     if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
                 [ +  - ]
    1179                 :            :     {
    1180         [ +  - ]:        190 :         aAny.setValue( &bFixed, ::getBooleanCppuType() );
    1181 [ +  - ][ +  - ]:        190 :         rPropertySet->setPropertyValue(sPropertyFixed, aAny);
    1182                 :            :     }
    1183                 :            : 
    1184         [ +  - ]:        190 :     aAny.setValue( &bIsDate, ::getBooleanCppuType() );
    1185 [ +  - ][ +  - ]:        190 :     rPropertySet->setPropertyValue(sPropertyIsDate, aAny);
    1186                 :            : 
    1187 [ +  - ][ +  - ]:        190 :     if (xPropertySetInfo->hasPropertyByName(sPropertyAdjust))
                 [ +  + ]
    1188                 :            :     {
    1189         [ +  - ]:          4 :         aAny <<= nAdjust;
    1190 [ +  - ][ +  - ]:          4 :         rPropertySet->setPropertyValue(sPropertyAdjust, aAny);
    1191                 :            :     }
    1192                 :            : 
    1193                 :            :     // set value
    1194         [ -  + ]:        190 :     if (bFixed)
    1195                 :            :     {
    1196                 :            :         // organizer or styles-only mode: force update
    1197 [ #  # ][ #  # ]:          0 :         if (GetImport().GetTextImport()->IsOrganizerMode() ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1198 [ #  # ][ #  # ]:          0 :             GetImport().GetTextImport()->IsStylesOnlyMode()   )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1199                 :            :         {
    1200         [ #  # ]:          0 :             ForceUpdate(rPropertySet);
    1201                 :            :         }
    1202                 :            :         else
    1203                 :            :         {
    1204                 :            :             // normal mode: set value (if present)
    1205         [ #  # ]:          0 :             if (bTimeOK)
    1206                 :            :             {
    1207 [ #  # ][ #  # ]:          0 :                if (xPropertySetInfo->hasPropertyByName(sPropertyDateTimeValue))
                 [ #  # ]
    1208                 :            :                {
    1209         [ #  # ]:          0 :                    aAny <<= aDateTimeValue;
    1210 [ #  # ][ #  # ]:          0 :                    rPropertySet->setPropertyValue(sPropertyDateTimeValue,aAny);
    1211                 :            :                }
    1212 [ #  # ][ #  # ]:          0 :                else if (xPropertySetInfo->hasPropertyByName(sPropertyDateTime))
                 [ #  # ]
    1213                 :            :                {
    1214         [ #  # ]:          0 :                    aAny <<= aDateTimeValue;
    1215 [ #  # ][ #  # ]:          0 :                    rPropertySet->setPropertyValue(sPropertyDateTime, aAny);
    1216                 :            :                }
    1217                 :            :             }
    1218                 :            :         }
    1219                 :            :     }
    1220                 :            : 
    1221 [ +  + ][ +  - ]:        194 :     if (bFormatOK &&
                 [ +  + ]
    1222 [ +  - ][ +  - ]:          4 :         xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
    1223                 :            :     {
    1224         [ +  - ]:          4 :         aAny <<= nFormatKey;
    1225 [ +  - ][ +  - ]:          4 :         rPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
    1226                 :            : 
    1227 [ +  - ][ +  - ]:          4 :         if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
                 [ +  - ]
    1228                 :            :         {
    1229                 :          4 :             sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
    1230         [ +  - ]:          4 :             aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
    1231 [ +  - ][ +  - ]:          4 :             rPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
    1232                 :            :         }
    1233                 :        190 :     }
    1234                 :        190 : }
    1235                 :            : 
    1236                 :            : 
    1237                 :            : 
    1238                 :            : //
    1239                 :            : // date field
    1240                 :            : //
    1241                 :            : 
    1242 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDateFieldImportContext, XMLTimeFieldImportContext );
    1243                 :            : 
    1244                 :         97 : XMLDateFieldImportContext::XMLDateFieldImportContext(
    1245                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1246                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    1247                 :         97 :         XMLTimeFieldImportContext(rImport, rHlp, nPrfx, sLocalName)
    1248                 :            : {
    1249                 :         97 :     bIsDate = sal_True; // always a date!
    1250                 :         97 : }
    1251                 :            : 
    1252                 :        194 : void XMLDateFieldImportContext::ProcessAttribute(
    1253                 :            :     sal_uInt16 nAttrToken,
    1254                 :            :     const ::rtl::OUString& sAttrValue )
    1255                 :            : {
    1256   [ +  -  -  + ]:        194 :     switch (nAttrToken)
    1257                 :            :     {
    1258                 :            :         case XML_TOK_TEXTFIELD_DATE_VALUE:
    1259                 :            :         {
    1260                 :            :             double fTmp;
    1261                 :            : 
    1262 [ +  - ][ +  + ]:         97 :             if (GetImport().GetMM100UnitConverter().
    1263                 :            :                 convertDateTime(fTmp, sAttrValue))
    1264                 :            :             {
    1265                 :            :                 // #96457#: don't truncate in order to read date+time
    1266                 :         92 :                 fTimeValue = fTmp;
    1267                 :         92 :                 bTimeOK = sal_True;
    1268                 :            :             }
    1269                 :            : 
    1270 [ +  - ][ +  + ]:         97 :             if (::sax::Converter::convertDateTime(aDateTimeValue, sAttrValue))
    1271                 :            :             {
    1272                 :         97 :                 bTimeOK = sal_True;
    1273                 :            :             }
    1274                 :            :             break;
    1275                 :            :         }
    1276                 :            :         case XML_TOK_TEXTFIELD_DATE_ADJUST:
    1277                 :            :             // delegate to superclass, pretending it was a time-adjust attr.
    1278                 :            :             XMLTimeFieldImportContext::ProcessAttribute(
    1279                 :            :                 XML_TOK_TEXTFIELD_TIME_ADJUST,
    1280                 :          0 :                 sAttrValue);
    1281                 :          0 :             break;
    1282                 :            :         case XML_TOK_TEXTFIELD_TIME_VALUE:
    1283                 :            :         case XML_TOK_TEXTFIELD_TIME_ADJUST:
    1284                 :            :             ; // ignore time-adjust and time-value attributes
    1285                 :          0 :             break;
    1286                 :            :         default:
    1287                 :            :             // all others: delegate to super-class
    1288                 :            :             XMLTimeFieldImportContext::ProcessAttribute(nAttrToken,
    1289                 :         97 :                                                         sAttrValue);
    1290                 :         97 :             break;
    1291                 :            :     }
    1292                 :        194 : }
    1293                 :            : 
    1294                 :            : 
    1295                 :            : 
    1296                 :            : 
    1297                 :            : //
    1298                 :            : // database field superclass
    1299                 :            : //
    1300                 :            : 
    1301 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDatabaseFieldImportContext, XMLTextFieldImportContext );
    1302                 :            : 
    1303                 :          0 : XMLDatabaseFieldImportContext::XMLDatabaseFieldImportContext(
    1304                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1305                 :            :     const sal_Char* pServiceName, sal_uInt16 nPrfx,
    1306                 :            :     const OUString& sLocalName, bool bUseDisply)
    1307                 :            : :   XMLTextFieldImportContext(rImport, rHlp, pServiceName, nPrfx, sLocalName)
    1308                 :            : ,   sPropertyDataBaseName(sAPI_data_base_name)
    1309                 :            : ,   sPropertyDataBaseURL(sAPI_data_base_u_r_l)
    1310                 :            : ,   sPropertyTableName(sAPI_data_table_name)
    1311                 :            : ,   sPropertyDataCommandType(sAPI_data_command_type)
    1312                 :            : ,   sPropertyIsVisible(sAPI_is_visible)
    1313                 :            : ,   nCommandType( sdb::CommandType::TABLE )
    1314                 :            : ,   bCommandTypeOK(sal_False)
    1315                 :            : ,   bDisplay( sal_True )
    1316                 :            : ,   bDisplayOK( false )
    1317                 :            : ,   bUseDisplay( bUseDisply )
    1318                 :            : ,   bDatabaseOK(sal_False)
    1319                 :            : ,   bDatabaseNameOK(sal_False)
    1320                 :            : ,   bDatabaseURLOK(sal_False)
    1321                 :          0 : ,   bTableOK(sal_False)
    1322                 :            : {
    1323                 :          0 : }
    1324                 :            : 
    1325                 :          0 : void XMLDatabaseFieldImportContext::ProcessAttribute(
    1326                 :            :     sal_uInt16 nAttrToken, const OUString& sAttrValue )
    1327                 :            : {
    1328   [ #  #  #  #  :          0 :     switch (nAttrToken)
                      # ]
    1329                 :            :     {
    1330                 :            :         case XML_TOK_TEXTFIELD_DATABASE_NAME:
    1331                 :          0 :             sDatabaseName = sAttrValue;
    1332                 :          0 :             bDatabaseOK = sal_True;
    1333                 :          0 :             bDatabaseNameOK = sal_True;
    1334                 :          0 :             break;
    1335                 :            :         case XML_TOK_TEXTFIELD_TABLE_NAME:
    1336                 :          0 :             sTableName = sAttrValue;
    1337                 :          0 :             bTableOK = sal_True;
    1338                 :          0 :             break;
    1339                 :            :         case XML_TOK_TEXTFIELD_TABLE_TYPE:
    1340         [ #  # ]:          0 :             if( IsXMLToken( sAttrValue, XML_TABLE ) )
    1341                 :            :             {
    1342                 :          0 :                 nCommandType = sdb::CommandType::TABLE;
    1343                 :          0 :                 bCommandTypeOK = sal_True;
    1344                 :            :             }
    1345         [ #  # ]:          0 :             else if( IsXMLToken( sAttrValue, XML_QUERY ) )
    1346                 :            :             {
    1347                 :          0 :                 nCommandType = sdb::CommandType::QUERY;
    1348                 :          0 :                 bCommandTypeOK = sal_True;
    1349                 :            :             }
    1350         [ #  # ]:          0 :             else if( IsXMLToken( sAttrValue, XML_COMMAND ) )
    1351                 :            :             {
    1352                 :          0 :                 nCommandType = sdb::CommandType::COMMAND;
    1353                 :          0 :                 bCommandTypeOK = sal_True;
    1354                 :            :             }
    1355                 :          0 :             break;
    1356                 :            :         case XML_TOK_TEXTFIELD_DISPLAY:
    1357         [ #  # ]:          0 :             if( IsXMLToken( sAttrValue, XML_NONE ) )
    1358                 :            :             {
    1359                 :          0 :                 bDisplay = sal_False;
    1360                 :          0 :                 bDisplayOK = true;
    1361                 :            :             }
    1362         [ #  # ]:          0 :             else if( IsXMLToken( sAttrValue, XML_VALUE ) )
    1363                 :            :             {
    1364                 :          0 :                 bDisplay = sal_True;
    1365                 :          0 :                 bDisplayOK = true;
    1366                 :            :             }
    1367                 :          0 :             break;
    1368                 :            :     }
    1369                 :          0 : }
    1370                 :            : 
    1371                 :          0 : SvXMLImportContext* XMLDatabaseFieldImportContext::CreateChildContext(
    1372                 :            :     sal_uInt16 p_nPrefix,
    1373                 :            :     const OUString& rLocalName,
    1374                 :            :     const Reference<XAttributeList>& xAttrList )
    1375                 :            : {
    1376   [ #  #  #  # ]:          0 :     if( ( p_nPrefix == XML_NAMESPACE_FORM ) &&
                 [ #  # ]
    1377                 :          0 :         IsXMLToken( rLocalName, XML_CONNECTION_RESOURCE ) )
    1378                 :            :     {
    1379                 :            :         // process attribute list directly
    1380                 :          0 :         sal_Int16 nLength = xAttrList->getLength();
    1381         [ #  # ]:          0 :         for( sal_Int16 n = 0; n < nLength; n++ )
    1382                 :            :         {
    1383                 :          0 :             OUString sLocalName;
    1384                 :          0 :             sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
    1385   [ #  #  #  # ]:          0 :                 GetKeyByAttrName( xAttrList->getNameByIndex(n), &sLocalName );
                 [ #  # ]
    1386                 :            : 
    1387 [ #  # ][ #  # ]:          0 :             if( ( nPrefix == XML_NAMESPACE_XLINK ) &&
                 [ #  # ]
    1388         [ #  # ]:          0 :                 IsXMLToken( sLocalName, XML_HREF ) )
    1389                 :            :             {
    1390 [ #  # ][ #  # ]:          0 :                 sDatabaseURL = xAttrList->getValueByIndex(n);
    1391                 :          0 :                 bDatabaseOK = sal_True;
    1392                 :          0 :                 bDatabaseURLOK = sal_True;
    1393                 :            :             }
    1394                 :          0 :         }
    1395                 :            : 
    1396                 :            :         // we call ProcessAttribute in order to set bValid appropriatly
    1397         [ #  # ]:          0 :         ProcessAttribute( XML_TOKEN_INVALID, OUString() );
    1398                 :            :     }
    1399                 :            : 
    1400                 :            :     return SvXMLImportContext::CreateChildContext(p_nPrefix, rLocalName,
    1401                 :          0 :                                                   xAttrList);
    1402                 :            : }
    1403                 :            : 
    1404                 :            : 
    1405                 :          0 : void XMLDatabaseFieldImportContext::PrepareField(
    1406                 :            :         const Reference<XPropertySet> & xPropertySet)
    1407                 :            : {
    1408                 :          0 :     Any aAny;
    1409                 :            : 
    1410         [ #  # ]:          0 :     aAny <<= sTableName;
    1411 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyTableName, aAny);
    1412                 :            : 
    1413         [ #  # ]:          0 :     if( bDatabaseNameOK )
    1414                 :            :     {
    1415         [ #  # ]:          0 :         aAny <<= sDatabaseName;
    1416 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyDataBaseName, aAny);
    1417                 :            :     }
    1418         [ #  # ]:          0 :     else if( bDatabaseURLOK )
    1419                 :            :     {
    1420         [ #  # ]:          0 :         aAny <<= sDatabaseURL;
    1421 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyDataBaseURL, aAny);
    1422                 :            :     }
    1423                 :            : 
    1424                 :            :     // #99980# load/save command type for all fields; also load
    1425                 :            :     //         old documents without command type
    1426         [ #  # ]:          0 :     if( bCommandTypeOK )
    1427                 :            :     {
    1428         [ #  # ]:          0 :         aAny <<= nCommandType;
    1429 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue( sPropertyDataCommandType, aAny );
    1430                 :            :     }
    1431                 :            : 
    1432 [ #  # ][ #  # ]:          0 :     if( bUseDisplay && bDisplayOK )
    1433                 :            :     {
    1434         [ #  # ]:          0 :         aAny.setValue( &bDisplay, ::getBooleanCppuType() );
    1435 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue( sPropertyIsVisible, aAny );
    1436                 :          0 :     }
    1437                 :          0 : }
    1438                 :            : 
    1439                 :            : 
    1440                 :            : 
    1441                 :            : //
    1442                 :            : // database name field
    1443                 :            : //
    1444                 :            : 
    1445 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDatabaseNameImportContext, XMLDatabaseFieldImportContext );
    1446                 :            : 
    1447                 :          0 : XMLDatabaseNameImportContext::XMLDatabaseNameImportContext(
    1448                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1449                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    1450                 :            :         XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database_name,
    1451                 :          0 :                                       nPrfx, sLocalName, true)
    1452                 :            : {
    1453                 :          0 : }
    1454                 :            : 
    1455                 :          0 : void XMLDatabaseNameImportContext::ProcessAttribute(
    1456                 :            :     sal_uInt16 nAttrToken, const OUString& sAttrValue )
    1457                 :            : {
    1458                 :            :     // delegate to superclass and check for success
    1459                 :          0 :     XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken, sAttrValue);
    1460 [ #  # ][ #  # ]:          0 :     bValid = bDatabaseOK && bTableOK;
    1461                 :          0 : }
    1462                 :            : 
    1463                 :            : 
    1464                 :            : 
    1465                 :            : //
    1466                 :            : // database next field
    1467                 :            : //
    1468                 :            : 
    1469 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDatabaseNextImportContext, XMLDatabaseFieldImportContext );
    1470                 :            : 
    1471                 :          0 : XMLDatabaseNextImportContext::XMLDatabaseNextImportContext(
    1472                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1473                 :            :     const sal_Char* pServiceName, sal_uInt16 nPrfx,
    1474                 :            :     const OUString& sLocalName) :
    1475                 :            :         XMLDatabaseFieldImportContext(rImport, rHlp, pServiceName,
    1476                 :            :                                       nPrfx, sLocalName, false),
    1477                 :            :         sPropertyCondition(sAPI_condition),
    1478                 :            :         sTrue(sAPI_true),
    1479                 :            :         sCondition(),
    1480                 :          0 :         bConditionOK(sal_False)
    1481                 :            : {
    1482                 :          0 : }
    1483                 :            : 
    1484                 :          0 : XMLDatabaseNextImportContext::XMLDatabaseNextImportContext(
    1485                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1486                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName)
    1487                 :            : : XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database_next, nPrfx, sLocalName, false)
    1488                 :            : ,   sPropertyCondition(sAPI_condition)
    1489                 :            : ,   sTrue(sAPI_true)
    1490                 :          0 : ,   bConditionOK(sal_False)
    1491                 :            : {
    1492                 :          0 : }
    1493                 :            : 
    1494                 :          0 : void XMLDatabaseNextImportContext::ProcessAttribute(
    1495                 :            :     sal_uInt16 nAttrToken, const OUString& sAttrValue )
    1496                 :            : {
    1497         [ #  # ]:          0 :     if (XML_TOK_TEXTFIELD_CONDITION == nAttrToken)
    1498                 :            :     {
    1499                 :          0 :         OUString sTmp;
    1500                 :          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap()._GetKeyByAttrName(
    1501         [ #  # ]:          0 :                                     sAttrValue, &sTmp, sal_False );
    1502         [ #  # ]:          0 :         if( XML_NAMESPACE_OOOW == nPrefix )
    1503                 :            :         {
    1504                 :          0 :             sCondition = sTmp;
    1505                 :          0 :             bConditionOK = sal_True;
    1506                 :            :         }
    1507                 :            :         else
    1508                 :          0 :             sCondition = sAttrValue;
    1509                 :            :     }
    1510                 :            :     else
    1511                 :            :     {
    1512                 :            :         XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
    1513                 :          0 :                                                         sAttrValue);
    1514                 :            :     }
    1515                 :            : 
    1516 [ #  # ][ #  # ]:          0 :     bValid = bDatabaseOK && bTableOK;
    1517                 :          0 : }
    1518                 :            : 
    1519                 :          0 : void XMLDatabaseNextImportContext::PrepareField(
    1520                 :            :     const Reference<XPropertySet> & xPropertySet)
    1521                 :            : {
    1522                 :          0 :     Any aAny;
    1523                 :            : 
    1524 [ #  # ][ #  # ]:          0 :     aAny <<= bConditionOK ? sCondition : sTrue;
    1525 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyCondition, aAny);
    1526                 :            : 
    1527         [ #  # ]:          0 :     XMLDatabaseFieldImportContext::PrepareField(xPropertySet);
    1528                 :          0 : }
    1529                 :            : 
    1530                 :            : 
    1531                 :            : 
    1532                 :            : //
    1533                 :            : // database select field
    1534                 :            : //
    1535                 :            : 
    1536 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDatabaseSelectImportContext, XMLDatabaseNextImportContext );
    1537                 :            : 
    1538                 :          0 : XMLDatabaseSelectImportContext::XMLDatabaseSelectImportContext(
    1539                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1540                 :            :     sal_uInt16 nPrfx, const ::rtl::OUString& sLocalName) :
    1541                 :            :         XMLDatabaseNextImportContext(rImport, rHlp, sAPI_database_select,
    1542                 :            :                                      nPrfx, sLocalName),
    1543                 :            :         sPropertySetNumber(sAPI_set_number),
    1544                 :            :         nNumber(0),
    1545                 :          0 :         bNumberOK(sal_False)
    1546                 :            : {
    1547                 :          0 : }
    1548                 :            : 
    1549                 :          0 : void XMLDatabaseSelectImportContext::ProcessAttribute(
    1550                 :            :     sal_uInt16 nAttrToken,
    1551                 :            :     const ::rtl::OUString& sAttrValue )
    1552                 :            : {
    1553         [ #  # ]:          0 :     if (XML_TOK_TEXTFIELD_ROW_NUMBER == nAttrToken)
    1554                 :            :     {
    1555                 :            :         sal_Int32 nTmp;
    1556 [ #  # ][ #  # ]:          0 :         if (::sax::Converter::convertNumber( nTmp, sAttrValue
    1557                 :            :                                                /* , nMin, nMax ??? */ ))
    1558                 :            :         {
    1559                 :          0 :             nNumber = nTmp;
    1560                 :          0 :             bNumberOK = sal_True;
    1561                 :            :         }
    1562                 :            :     }
    1563                 :            :     else
    1564                 :            :     {
    1565                 :          0 :         XMLDatabaseNextImportContext::ProcessAttribute(nAttrToken, sAttrValue);
    1566                 :            :     }
    1567                 :            : 
    1568 [ #  # ][ #  # ]:          0 :     bValid = bTableOK && bDatabaseOK && bNumberOK;
                 [ #  # ]
    1569                 :          0 : }
    1570                 :            : 
    1571                 :          0 : void XMLDatabaseSelectImportContext::PrepareField(
    1572                 :            :     const Reference<XPropertySet> & xPropertySet)
    1573                 :            : {
    1574                 :          0 :     Any aAny;
    1575                 :            : 
    1576         [ #  # ]:          0 :     aAny <<= nNumber;
    1577 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertySetNumber, aAny);
    1578                 :            : 
    1579         [ #  # ]:          0 :     XMLDatabaseNextImportContext::PrepareField(xPropertySet);
    1580                 :          0 : }
    1581                 :            : 
    1582                 :            : 
    1583                 :            : 
    1584                 :            : //
    1585                 :            : // database display row number field
    1586                 :            : //
    1587                 :            : 
    1588 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDatabaseNumberImportContext, XMLDatabaseFieldImportContext );
    1589                 :            : 
    1590                 :          0 : XMLDatabaseNumberImportContext::XMLDatabaseNumberImportContext(
    1591                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1592                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    1593                 :            :         XMLDatabaseFieldImportContext(rImport, rHlp, sAPI_database_number,
    1594                 :            :                                       nPrfx, sLocalName, true),
    1595                 :            :         sPropertyNumberingType(
    1596                 :            :             sAPI_numbering_type),
    1597                 :            :         sPropertySetNumber(sAPI_set_number),
    1598                 :            :         sNumberFormat("1"),
    1599         [ #  # ]:          0 :         sNumberSync(GetXMLToken(XML_FALSE)),
    1600                 :            :         nValue(0),
    1601                 :          0 :         bValueOK(sal_False)
    1602                 :            : {
    1603                 :          0 : }
    1604                 :            : 
    1605                 :          0 : void XMLDatabaseNumberImportContext::ProcessAttribute(
    1606                 :            :     sal_uInt16 nAttrToken,
    1607                 :            :     const OUString& sAttrValue )
    1608                 :            : {
    1609   [ #  #  #  # ]:          0 :     switch (nAttrToken)
    1610                 :            :     {
    1611                 :            :         case XML_TOK_TEXTFIELD_NUM_FORMAT:
    1612                 :          0 :             sNumberFormat = sAttrValue;
    1613                 :          0 :             break;
    1614                 :            :         case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
    1615                 :          0 :             sNumberSync = sAttrValue;
    1616                 :          0 :             break;
    1617                 :            :         case XML_TOK_TEXTFIELD_VALUE:
    1618                 :            :         {
    1619                 :            :             sal_Int32 nTmp;
    1620 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertNumber( nTmp, sAttrValue ))
    1621                 :            :             {
    1622                 :          0 :                 nValue = nTmp;
    1623                 :          0 :                 bValueOK = sal_True;
    1624                 :            :             }
    1625                 :            :             break;
    1626                 :            :         }
    1627                 :            :         default:
    1628                 :            :             XMLDatabaseFieldImportContext::ProcessAttribute(nAttrToken,
    1629                 :          0 :                                                             sAttrValue);
    1630                 :          0 :             break;
    1631                 :            :     }
    1632                 :            : 
    1633 [ #  # ][ #  # ]:          0 :     bValid = bTableOK && bDatabaseOK;
    1634                 :          0 : }
    1635                 :            : 
    1636                 :          0 : void XMLDatabaseNumberImportContext::PrepareField(
    1637                 :            :     const Reference<XPropertySet> & xPropertySet)
    1638                 :            : {
    1639                 :          0 :     Any aAny;
    1640                 :            : 
    1641                 :          0 :     sal_Int16 nNumType = style::NumberingType::ARABIC;
    1642                 :          0 :     GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
    1643                 :            :                                                     sNumberFormat,
    1644         [ #  # ]:          0 :                                                     sNumberSync );
    1645         [ #  # ]:          0 :     aAny <<= nNumType;
    1646 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
    1647                 :            : 
    1648         [ #  # ]:          0 :     if (bValueOK)
    1649                 :            :     {
    1650         [ #  # ]:          0 :         aAny <<= nValue;
    1651 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertySetNumber, aAny);
    1652                 :            :     }
    1653                 :            : 
    1654         [ #  # ]:          0 :     XMLDatabaseFieldImportContext::PrepareField(xPropertySet);
    1655                 :          0 : }
    1656                 :            : 
    1657                 :            : 
    1658                 :            : 
    1659                 :            : //
    1660                 :            : // Simple doc info fields
    1661                 :            : //
    1662                 :            : 
    1663 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLSimpleDocInfoImportContext, XMLTextFieldImportContext );
    1664                 :            : 
    1665                 :         93 : XMLSimpleDocInfoImportContext::XMLSimpleDocInfoImportContext(
    1666                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1667                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName, sal_uInt16 nToken,
    1668                 :            :     sal_Bool bContent, sal_Bool bAuthor)
    1669                 :            : :   XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nToken),nPrfx, sLocalName)
    1670                 :            : ,   sPropertyFixed(sAPI_is_fixed)
    1671                 :            : ,   sPropertyContent(sAPI_content)
    1672                 :            : ,   sPropertyAuthor(sAPI_author)
    1673                 :            : ,   sPropertyCurrentPresentation(sAPI_current_presentation)
    1674                 :            : ,   bFixed(sal_False)
    1675                 :            : ,   bHasAuthor(bAuthor)
    1676                 :         93 : ,   bHasContent(bContent)
    1677                 :            : {
    1678                 :         93 :     bValid = sal_True;
    1679                 :         93 : }
    1680                 :            : 
    1681                 :          0 : void XMLSimpleDocInfoImportContext::ProcessAttribute(
    1682                 :            :     sal_uInt16 nAttrToken,
    1683                 :            :     const OUString& sAttrValue )
    1684                 :            : {
    1685         [ #  # ]:          0 :     if (XML_TOK_TEXTFIELD_FIXED == nAttrToken)
    1686                 :            :     {
    1687                 :          0 :         bool bTmp(false);
    1688 [ #  # ][ #  # ]:          0 :         if (::sax::Converter::convertBool(bTmp, sAttrValue))
    1689                 :            :         {
    1690                 :          0 :             bFixed = bTmp;
    1691                 :            :         }
    1692                 :            :     }
    1693                 :          0 : }
    1694                 :            : 
    1695                 :         93 : void XMLSimpleDocInfoImportContext::PrepareField(
    1696                 :            :     const Reference<XPropertySet> & rPropertySet)
    1697                 :            : {
    1698                 :            :     //  title field in Calc has no Fixed property
    1699 [ +  - ][ +  - ]:         93 :     Reference<XPropertySetInfo> xPropertySetInfo(rPropertySet->getPropertySetInfo());
    1700 [ +  - ][ +  - ]:         93 :     if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
                 [ -  + ]
    1701                 :            :     {
    1702                 :          0 :         Any aAny;
    1703         [ #  # ]:          0 :         aAny.setValue(&bFixed, ::getBooleanCppuType() );
    1704 [ #  # ][ #  # ]:          0 :         rPropertySet->setPropertyValue(sPropertyFixed, aAny);
    1705                 :            : 
    1706                 :            :         // set Content and CurrentPresentation (if fixed)
    1707         [ #  # ]:          0 :         if (bFixed)
    1708                 :            :         {
    1709                 :            :             // in organizer-mode or styles-only-mode, only force update
    1710 [ #  # ][ #  # ]:          0 :             if (GetImport().GetTextImport()->IsOrganizerMode() ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1711 [ #  # ][ #  # ]:          0 :                 GetImport().GetTextImport()->IsStylesOnlyMode()   )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1712                 :            :             {
    1713         [ #  # ]:          0 :                 ForceUpdate(rPropertySet);
    1714                 :            :             }
    1715                 :            :             else
    1716                 :            :             {
    1717                 :            :                 // set content (author, if that's the name) and current
    1718                 :            :                 // presentation
    1719 [ #  # ][ #  # ]:          0 :                 aAny <<= GetContent();
    1720                 :            : 
    1721 [ #  # ][ #  # ]:          0 :                 if (bFixed && bHasAuthor)
    1722                 :            :                 {
    1723 [ #  # ][ #  # ]:          0 :                     rPropertySet->setPropertyValue(sPropertyAuthor, aAny);
    1724                 :            :                 }
    1725                 :            : 
    1726 [ #  # ][ #  # ]:          0 :                 if (bFixed && bHasContent)
    1727                 :            :                 {
    1728 [ #  # ][ #  # ]:          0 :                     rPropertySet->setPropertyValue(sPropertyContent, aAny);
    1729                 :            :                 }
    1730                 :            : 
    1731 [ #  # ][ #  # ]:          0 :                 rPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
    1732                 :            :             }
    1733                 :          0 :         }
    1734                 :         93 :     }
    1735                 :         93 : }
    1736                 :            : 
    1737                 :         93 : const sal_Char* XMLSimpleDocInfoImportContext::MapTokenToServiceName(
    1738                 :            :     sal_uInt16 nToken)
    1739                 :            : {
    1740                 :         93 :     const sal_Char* pServiceName = NULL;
    1741                 :            : 
    1742   [ -  -  -  -  :         93 :     switch(nToken)
          -  -  -  -  -  
          -  -  -  -  -  
                -  +  - ]
    1743                 :            :     {
    1744                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR:
    1745                 :          0 :             pServiceName = sAPI_docinfo_create_author;
    1746                 :          0 :             break;
    1747                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_DATE:
    1748                 :          0 :             pServiceName = sAPI_docinfo_create_date_time;
    1749                 :          0 :             break;
    1750                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_TIME:
    1751                 :          0 :             pServiceName = sAPI_docinfo_create_date_time;
    1752                 :          0 :             break;
    1753                 :            :         case XML_TOK_TEXT_DOCUMENT_DESCRIPTION:
    1754                 :          0 :             pServiceName = sAPI_docinfo_description;
    1755                 :          0 :             break;
    1756                 :            :         case XML_TOK_TEXT_DOCUMENT_EDIT_DURATION:
    1757                 :          0 :             pServiceName = sAPI_docinfo_edit_time;
    1758                 :          0 :             break;
    1759                 :            :         case XML_TOK_TEXT_DOCUMENT_USER_DEFINED:
    1760                 :          0 :             pServiceName = sAPI_docinfo_custom;
    1761                 :          0 :             break;
    1762                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR:
    1763                 :          0 :             pServiceName = sAPI_docinfo_print_author;
    1764                 :          0 :             break;
    1765                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_DATE:
    1766                 :          0 :             pServiceName = sAPI_docinfo_print_date_time;
    1767                 :          0 :             break;
    1768                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_TIME:
    1769                 :          0 :             pServiceName = sAPI_docinfo_print_date_time;
    1770                 :          0 :             break;
    1771                 :            :         case XML_TOK_TEXT_DOCUMENT_KEYWORDS:
    1772                 :          0 :             pServiceName = sAPI_docinfo_keywords;
    1773                 :          0 :             break;
    1774                 :            :         case XML_TOK_TEXT_DOCUMENT_SUBJECT:
    1775                 :          0 :             pServiceName = sAPI_docinfo_subject;
    1776                 :          0 :             break;
    1777                 :            :         case XML_TOK_TEXT_DOCUMENT_REVISION:
    1778                 :          0 :             pServiceName = sAPI_docinfo_revision;
    1779                 :          0 :             break;
    1780                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR:
    1781                 :          0 :             pServiceName = sAPI_docinfo_change_author;
    1782                 :          0 :             break;
    1783                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_DATE:
    1784                 :          0 :             pServiceName = sAPI_docinfo_change_date_time;
    1785                 :          0 :             break;
    1786                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_TIME:
    1787                 :          0 :             pServiceName = sAPI_docinfo_change_date_time;
    1788                 :          0 :             break;
    1789                 :            :         case XML_TOK_TEXT_DOCUMENT_TITLE:
    1790                 :         93 :             pServiceName = sAPI_docinfo_title;
    1791                 :         93 :             break;
    1792                 :            : 
    1793                 :            :         default:
    1794                 :            :             OSL_FAIL("no docinfo field token");
    1795                 :          0 :             pServiceName = NULL;
    1796                 :          0 :             break;
    1797                 :            :     }
    1798                 :            : 
    1799                 :         93 :     return pServiceName;
    1800                 :            : }
    1801                 :            : 
    1802                 :            : 
    1803                 :            : //
    1804                 :            : // revision field
    1805                 :            : //
    1806                 :            : 
    1807 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLRevisionDocInfoImportContext, XMLSimpleDocInfoImportContext );
    1808                 :            : 
    1809                 :          0 : XMLRevisionDocInfoImportContext::XMLRevisionDocInfoImportContext(
    1810                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
    1811                 :            :     const OUString& sLocalName, sal_uInt16 nToken) :
    1812                 :            :         XMLSimpleDocInfoImportContext(rImport, rHlp, nPrfx, sLocalName,
    1813                 :            :                                       nToken, sal_False, sal_False),
    1814                 :          0 :         sPropertyRevision(sAPI_revision)
    1815                 :            : {
    1816                 :          0 :     bValid = sal_True;
    1817                 :          0 : }
    1818                 :            : 
    1819                 :          0 : void XMLRevisionDocInfoImportContext::PrepareField(
    1820                 :            :     const Reference<XPropertySet> & rPropertySet)
    1821                 :            : {
    1822                 :          0 :     XMLSimpleDocInfoImportContext::PrepareField(rPropertySet);
    1823                 :            : 
    1824                 :            :     // set revision number
    1825                 :            :     // if fixed, if not in organizer-mode, if not in styles-only-mode
    1826         [ #  # ]:          0 :     if (bFixed)
    1827                 :            :     {
    1828 [ #  # ][ #  # ]:          0 :         if ( GetImport().GetTextImport()->IsOrganizerMode() ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1829 [ #  # ][ #  # ]:          0 :              GetImport().GetTextImport()->IsStylesOnlyMode()   )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1830                 :            :         {
    1831                 :          0 :             ForceUpdate(rPropertySet);
    1832                 :            :         }
    1833                 :            :         else
    1834                 :            :         {
    1835                 :            :             sal_Int32 nTmp;
    1836 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertNumber(nTmp, GetContent()))
                 [ #  # ]
    1837                 :            :             {
    1838                 :          0 :                 Any aAny;
    1839         [ #  # ]:          0 :                 aAny <<= nTmp;
    1840 [ #  # ][ #  # ]:          0 :                 rPropertySet->setPropertyValue(sPropertyRevision, aAny);
    1841                 :            :             }
    1842                 :            :         }
    1843                 :            :     }
    1844                 :          0 : }
    1845                 :            : 
    1846                 :            : 
    1847                 :            : 
    1848                 :            : //
    1849                 :            : // DocInfo fields with date/time attributes
    1850                 :            : //
    1851                 :            : 
    1852 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDateTimeDocInfoImportContext, XMLSimpleDocInfoImportContext );
    1853                 :            : 
    1854                 :          0 : XMLDateTimeDocInfoImportContext::XMLDateTimeDocInfoImportContext(
    1855                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
    1856                 :            :     const OUString& sLocalName, sal_uInt16 nToken)
    1857                 :            : :   XMLSimpleDocInfoImportContext(rImport, rHlp, nPrfx, sLocalName,nToken, sal_False, sal_False)
    1858                 :            : ,   sPropertyNumberFormat(sAPI_number_format)
    1859                 :            : ,   sPropertyIsDate(sAPI_is_date)
    1860                 :            : ,   sPropertyIsFixedLanguage(sAPI_is_fixed_language)
    1861                 :            : ,   nFormat(0)
    1862                 :            : ,   bFormatOK(sal_False)
    1863                 :          0 : ,   bIsDefaultLanguage(sal_True)
    1864                 :            : {
    1865                 :            :     // we allow processing of EDIT_DURATION here, because import of actual
    1866                 :            :     // is not supported anyway. If it was, we'd need an extra import class
    1867                 :            :     // because times and time durations are presented differently!
    1868                 :            : 
    1869                 :          0 :     bValid = sal_True;
    1870   [ #  #  #  # ]:          0 :     switch (nToken)
    1871                 :            :     {
    1872                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_DATE:
    1873                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_DATE:
    1874                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_DATE:
    1875                 :          0 :             bIsDate = sal_True;
    1876                 :          0 :             bHasDateTime = sal_True;
    1877                 :          0 :             break;
    1878                 :            :         case XML_TOK_TEXT_DOCUMENT_CREATION_TIME:
    1879                 :            :         case XML_TOK_TEXT_DOCUMENT_PRINT_TIME:
    1880                 :            :         case XML_TOK_TEXT_DOCUMENT_SAVE_TIME:
    1881                 :          0 :             bIsDate = sal_False;
    1882                 :          0 :             bHasDateTime = sal_True;
    1883                 :          0 :             break;
    1884                 :            :         case XML_TOK_TEXT_DOCUMENT_EDIT_DURATION:
    1885                 :          0 :             bIsDate = sal_False;
    1886                 :          0 :             bHasDateTime = sal_False;
    1887                 :          0 :             break;
    1888                 :            :         default:
    1889                 :            :             OSL_FAIL(
    1890                 :            :                 "XMLDateTimeDocInfoImportContext needs date/time doc. fields");
    1891                 :          0 :             bValid = sal_False;
    1892                 :          0 :             break;
    1893                 :            :     }
    1894                 :          0 : }
    1895                 :            : 
    1896                 :          0 : void XMLDateTimeDocInfoImportContext::ProcessAttribute(
    1897                 :            :     sal_uInt16 nAttrToken,
    1898                 :            :     const OUString& sAttrValue )
    1899                 :            : {
    1900      [ #  #  # ]:          0 :     switch (nAttrToken)
    1901                 :            :     {
    1902                 :            :         case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
    1903                 :            :         {
    1904                 :          0 :             sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
    1905                 :          0 :                                                sAttrValue, &bIsDefaultLanguage);
    1906         [ #  # ]:          0 :             if (-1 != nKey)
    1907                 :            :             {
    1908                 :          0 :                 nFormat = nKey;
    1909                 :          0 :                 bFormatOK = sal_True;
    1910                 :            :             }
    1911                 :          0 :             break;
    1912                 :            :         }
    1913                 :            :         case XML_TOK_TEXTFIELD_FIXED:
    1914                 :            :             XMLSimpleDocInfoImportContext::ProcessAttribute(nAttrToken,
    1915                 :          0 :                                                             sAttrValue);
    1916                 :          0 :             break;
    1917                 :            :         default:
    1918                 :            :             // ignore -> we can't set date/time value anyway!
    1919                 :          0 :             break;
    1920                 :            :     }
    1921                 :          0 : }
    1922                 :            : 
    1923                 :          0 : void XMLDateTimeDocInfoImportContext::PrepareField(
    1924                 :            :     const Reference<XPropertySet> & xPropertySet)
    1925                 :            : {
    1926                 :            :     // process fixed and presentation
    1927         [ #  # ]:          0 :     XMLSimpleDocInfoImportContext::PrepareField(xPropertySet);
    1928                 :            : 
    1929                 :          0 :     Any aAny;
    1930                 :            : 
    1931         [ #  # ]:          0 :     if (bHasDateTime)
    1932                 :            :     {
    1933         [ #  # ]:          0 :         aAny.setValue( &bIsDate, ::getBooleanCppuType());
    1934 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyIsDate, aAny);
    1935                 :            :     }
    1936                 :            : 
    1937         [ #  # ]:          0 :     if (bFormatOK)
    1938                 :            :     {
    1939         [ #  # ]:          0 :         aAny <<= nFormat;
    1940 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
    1941                 :            : 
    1942 [ #  # ][ #  # ]:          0 :         if( xPropertySet->getPropertySetInfo()->
         [ #  # ][ #  # ]
    1943         [ #  # ]:          0 :                 hasPropertyByName( sPropertyIsFixedLanguage ) )
    1944                 :            :         {
    1945                 :          0 :             sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
    1946         [ #  # ]:          0 :             aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
    1947 [ #  # ][ #  # ]:          0 :             xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
    1948                 :            :         }
    1949                 :          0 :     }
    1950                 :            : 
    1951                 :            :     // can't set date/time/duration value! Sorry.
    1952                 :          0 : }
    1953                 :            : 
    1954                 :            : 
    1955                 :            : //
    1956                 :            : // user defined docinfo fields
    1957                 :            : //
    1958                 :            : 
    1959 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLUserDocInfoImportContext, XMLSimpleDocInfoImportContext );
    1960                 :            : 
    1961                 :          0 : XMLUserDocInfoImportContext::XMLUserDocInfoImportContext(
    1962                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    1963                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName, sal_uInt16 nToken) :
    1964                 :            :         XMLSimpleDocInfoImportContext(rImport, rHlp, nPrfx,
    1965                 :            :                                       sLocalName, nToken,
    1966                 :            :                                       sal_False, sal_False)
    1967                 :            :     , sPropertyName(sAPI_name)
    1968                 :            :     , sPropertyNumberFormat(sAPI_number_format)
    1969                 :            :     , sPropertyIsFixedLanguage(sAPI_is_fixed_language)
    1970                 :            :     , nFormat(0)
    1971                 :            :     , bFormatOK(sal_False)
    1972                 :          0 :     , bIsDefaultLanguage( sal_True )
    1973                 :            : {
    1974                 :          0 :     bValid = sal_False;
    1975                 :          0 : }
    1976                 :            : 
    1977                 :          0 : void XMLUserDocInfoImportContext::ProcessAttribute(
    1978                 :            :     sal_uInt16 nAttrToken,
    1979                 :            :     const OUString& sAttrValue )
    1980                 :            : {
    1981      [ #  #  # ]:          0 :     switch (nAttrToken)
    1982                 :            :     {
    1983                 :            :         case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
    1984                 :            :         {
    1985                 :          0 :             sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
    1986                 :          0 :                                                sAttrValue, &bIsDefaultLanguage);
    1987         [ #  # ]:          0 :             if (-1 != nKey)
    1988                 :            :             {
    1989                 :          0 :                 nFormat = nKey;
    1990                 :          0 :                 bFormatOK = sal_True;
    1991                 :            :             }
    1992                 :          0 :             break;
    1993                 :            :         }
    1994                 :            :         case XML_TOK_TEXTFIELD_NAME:
    1995                 :            :         {
    1996         [ #  # ]:          0 :             if (!bValid)
    1997                 :            :             {
    1998                 :          0 :                 SetServiceName(OUString(sAPI_docinfo_custom ) );
    1999                 :          0 :                 aName = sAttrValue;
    2000                 :          0 :                 bValid = sal_True;
    2001                 :            :             }
    2002                 :          0 :             break;
    2003                 :            :         }
    2004                 :            : 
    2005                 :            :         default:
    2006                 :            :             XMLSimpleDocInfoImportContext::ProcessAttribute(nAttrToken,
    2007                 :          0 :                                                             sAttrValue);
    2008                 :          0 :             break;
    2009                 :            :     }
    2010                 :          0 : }
    2011                 :            : 
    2012                 :          0 : void XMLUserDocInfoImportContext::PrepareField(
    2013                 :            :         const ::com::sun::star::uno::Reference<
    2014                 :            :         ::com::sun::star::beans::XPropertySet> & xPropertySet)
    2015                 :            : {
    2016                 :          0 :     uno::Any aAny;
    2017         [ #  # ]:          0 :     if ( !aName.isEmpty() )
    2018                 :            :     {
    2019         [ #  # ]:          0 :         aAny <<= aName;
    2020 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyName, aAny);
    2021                 :            :     }
    2022                 :            :     Reference<XPropertySetInfo> xPropertySetInfo(
    2023 [ #  # ][ #  # ]:          0 :         xPropertySet->getPropertySetInfo());
    2024 [ #  # ][ #  # ]:          0 :     if (bFormatOK &&
                 [ #  # ]
    2025 [ #  # ][ #  # ]:          0 :         xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
    2026                 :            :     {
    2027         [ #  # ]:          0 :         aAny <<= nFormat;
    2028 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
    2029                 :            : 
    2030 [ #  # ][ #  # ]:          0 :         if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
                 [ #  # ]
    2031                 :            :         {
    2032                 :          0 :             sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
    2033         [ #  # ]:          0 :             aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
    2034 [ #  # ][ #  # ]:          0 :             xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
    2035                 :            :         }
    2036                 :            :     }
    2037                 :            : 
    2038                 :            :     // call superclass to handle "fixed"
    2039         [ #  # ]:          0 :     XMLSimpleDocInfoImportContext::PrepareField(xPropertySet);
    2040                 :          0 : }
    2041                 :            : 
    2042                 :            : 
    2043                 :            : //
    2044                 :            : // import hidden paragraph fields
    2045                 :            : //
    2046                 :            : 
    2047 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLHiddenParagraphImportContext, XMLTextFieldImportContext );
    2048                 :            : 
    2049                 :          0 : XMLHiddenParagraphImportContext::XMLHiddenParagraphImportContext(
    2050                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    2051                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    2052                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_hidden_paragraph,
    2053                 :            :                                   nPrfx, sLocalName),
    2054                 :            :         sPropertyCondition(sAPI_condition),
    2055                 :            :         sPropertyIsHidden(sAPI_is_hidden),
    2056                 :            :         sCondition(),
    2057                 :          0 :         bIsHidden(sal_False)
    2058                 :            : {
    2059                 :          0 : }
    2060                 :            : 
    2061                 :          0 : void XMLHiddenParagraphImportContext::ProcessAttribute(
    2062                 :            :     sal_uInt16 nAttrToken,
    2063                 :            :     const OUString& sAttrValue )
    2064                 :            : {
    2065         [ #  # ]:          0 :     if (XML_TOK_TEXTFIELD_CONDITION == nAttrToken)
    2066                 :            :     {
    2067                 :          0 :         OUString sTmp;
    2068                 :          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap()._GetKeyByAttrName(
    2069         [ #  # ]:          0 :                                     sAttrValue, &sTmp, sal_False );
    2070         [ #  # ]:          0 :         if( XML_NAMESPACE_OOOW == nPrefix )
    2071                 :            :         {
    2072                 :          0 :             sCondition = sTmp;
    2073                 :          0 :             bValid = sal_True;
    2074                 :            :         }
    2075                 :            :         else
    2076                 :          0 :             sCondition = sAttrValue;
    2077                 :            :     }
    2078         [ #  # ]:          0 :     else if (XML_TOK_TEXTFIELD_IS_HIDDEN == nAttrToken)
    2079                 :            :     {
    2080                 :          0 :         bool bTmp(false);
    2081 [ #  # ][ #  # ]:          0 :         if (::sax::Converter::convertBool(bTmp, sAttrValue))
    2082                 :            :         {
    2083                 :          0 :             bIsHidden = bTmp;
    2084                 :            :         }
    2085                 :            :     }
    2086                 :          0 : }
    2087                 :            : 
    2088                 :          0 : void XMLHiddenParagraphImportContext::PrepareField(
    2089                 :            :     const Reference<XPropertySet> & xPropertySet)
    2090                 :            : {
    2091                 :          0 :     Any aAny;
    2092         [ #  # ]:          0 :     aAny <<= sCondition;
    2093 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyCondition, aAny);
    2094                 :            : 
    2095         [ #  # ]:          0 :     aAny.setValue( &bIsHidden, ::getBooleanCppuType() );
    2096 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyIsHidden, aAny);
    2097                 :          0 : }
    2098                 :            : 
    2099                 :            : 
    2100                 :            : 
    2101                 :            : //
    2102                 :            : // import conditional text (<text:conditional-text>)
    2103                 :            : //
    2104                 :            : 
    2105 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLConditionalTextImportContext, XMLTextFieldImportContext );
    2106                 :            : 
    2107                 :          0 : XMLConditionalTextImportContext::XMLConditionalTextImportContext(
    2108                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    2109                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    2110                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_conditional_text,
    2111                 :            :                                   nPrfx, sLocalName),
    2112                 :            :         sPropertyCondition(sAPI_condition),
    2113                 :            :         sPropertyTrueContent(sAPI_true_content),
    2114                 :            :         sPropertyFalseContent(sAPI_false_content),
    2115                 :            :         sPropertyIsConditionTrue(sAPI_is_condition_true),
    2116                 :            :         sPropertyCurrentPresentation(sAPI_current_presentation),
    2117                 :            :         bConditionOK(sal_False),
    2118                 :            :         bTrueOK(sal_False),
    2119                 :            :         bFalseOK(sal_False),
    2120                 :          0 :         bCurrentValue(sal_False)
    2121                 :            : {
    2122                 :          0 : }
    2123                 :            : 
    2124                 :          0 : void XMLConditionalTextImportContext::ProcessAttribute(
    2125                 :            :     sal_uInt16 nAttrToken,
    2126                 :            :     const OUString& sAttrValue )
    2127                 :            : {
    2128   [ #  #  #  #  :          0 :     switch (nAttrToken)
                      # ]
    2129                 :            :     {
    2130                 :            :         case XML_TOK_TEXTFIELD_CONDITION:
    2131                 :            :             {
    2132                 :          0 :                 OUString sTmp;
    2133                 :          0 :                 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
    2134         [ #  # ]:          0 :                         _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
    2135         [ #  # ]:          0 :                 if( XML_NAMESPACE_OOOW == nPrefix )
    2136                 :            :                 {
    2137                 :          0 :                     sCondition = sTmp;
    2138                 :          0 :                     bConditionOK = sal_True;
    2139                 :            :                 }
    2140                 :            :                 else
    2141                 :          0 :                     sCondition = sAttrValue;
    2142                 :            :             }
    2143                 :          0 :             break;
    2144                 :            :         case XML_TOK_TEXTFIELD_STRING_VALUE_IF_FALSE:
    2145                 :          0 :             sFalseContent = sAttrValue;
    2146                 :          0 :             bFalseOK = sal_True;
    2147                 :          0 :             break;
    2148                 :            :         case XML_TOK_TEXTFIELD_STRING_VALUE_IF_TRUE:
    2149                 :          0 :             sTrueContent = sAttrValue;
    2150                 :          0 :             bTrueOK = sal_True;
    2151                 :          0 :             break;
    2152                 :            :         case XML_TOK_TEXTFIELD_CURRENT_VALUE:
    2153                 :            :         {
    2154                 :          0 :             bool bTmp(false);
    2155 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertBool(bTmp, sAttrValue))
    2156                 :            :             {
    2157                 :          0 :                 bCurrentValue = bTmp;
    2158                 :            :             }
    2159                 :            :             break;
    2160                 :            :         }
    2161                 :            :     }
    2162                 :            : 
    2163 [ #  # ][ #  # ]:          0 :     bValid = bConditionOK && bFalseOK && bTrueOK;
                 [ #  # ]
    2164                 :          0 : }
    2165                 :            : 
    2166                 :          0 : void XMLConditionalTextImportContext::PrepareField(
    2167                 :            :     const Reference<XPropertySet> & xPropertySet)
    2168                 :            : {
    2169                 :          0 :     Any aAny;
    2170                 :            : 
    2171         [ #  # ]:          0 :     aAny <<= sCondition;
    2172 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyCondition, aAny);
    2173                 :            : 
    2174         [ #  # ]:          0 :     aAny <<= sFalseContent;
    2175 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyFalseContent, aAny);
    2176                 :            : 
    2177         [ #  # ]:          0 :     aAny <<= sTrueContent;
    2178 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyTrueContent, aAny);
    2179                 :            : 
    2180         [ #  # ]:          0 :     aAny.setValue( &bCurrentValue, ::getBooleanCppuType() );
    2181 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyIsConditionTrue, aAny);
    2182                 :            : 
    2183 [ #  # ][ #  # ]:          0 :     aAny <<= GetContent();
    2184 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
    2185                 :          0 : }
    2186                 :            : 
    2187                 :            : 
    2188                 :            : 
    2189                 :            : //
    2190                 :            : // hidden text
    2191                 :            : //
    2192                 :            : 
    2193 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLHiddenTextImportContext, XMLTextFieldImportContext);
    2194                 :            : 
    2195                 :          0 : XMLHiddenTextImportContext::XMLHiddenTextImportContext(
    2196                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    2197                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    2198                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_hidden_text,
    2199                 :            :                                   nPrfx, sLocalName),
    2200                 :            :         sPropertyCondition(sAPI_condition),
    2201                 :            :         sPropertyContent(sAPI_content),
    2202                 :            :         sPropertyIsHidden(sAPI_is_hidden),
    2203                 :            :         bConditionOK(sal_False),
    2204                 :            :         bStringOK(sal_False),
    2205                 :          0 :         bIsHidden(sal_False)
    2206                 :            : {
    2207                 :          0 : }
    2208                 :            : 
    2209                 :          0 : void XMLHiddenTextImportContext::ProcessAttribute(
    2210                 :            :     sal_uInt16 nAttrToken,
    2211                 :            :     const OUString& sAttrValue )
    2212                 :            : {
    2213   [ #  #  #  # ]:          0 :     switch (nAttrToken)
    2214                 :            :     {
    2215                 :            :         case XML_TOK_TEXTFIELD_CONDITION:
    2216                 :            :             {
    2217                 :          0 :                 OUString sTmp;
    2218                 :          0 :                 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
    2219         [ #  # ]:          0 :                                         _GetKeyByAttrName( sAttrValue, &sTmp, sal_False );
    2220         [ #  # ]:          0 :                 if( XML_NAMESPACE_OOOW == nPrefix )
    2221                 :            :                 {
    2222                 :          0 :                     sCondition = sTmp;
    2223                 :          0 :                     bConditionOK = sal_True;
    2224                 :            :                 }
    2225                 :            :                 else
    2226                 :          0 :                     sCondition = sAttrValue;
    2227                 :            :             }
    2228                 :          0 :             break;
    2229                 :            :         case XML_TOK_TEXTFIELD_STRING_VALUE:
    2230                 :          0 :             sString = sAttrValue;
    2231                 :          0 :             bStringOK = sal_True;
    2232                 :          0 :             break;
    2233                 :            :         case XML_TOK_TEXTFIELD_IS_HIDDEN:
    2234                 :            :         {
    2235                 :          0 :             bool bTmp(false);
    2236 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertBool(bTmp, sAttrValue))
    2237                 :            :             {
    2238                 :          0 :                 bIsHidden = bTmp;
    2239                 :            :             }
    2240                 :            :             break;
    2241                 :            :         }
    2242                 :            :     }
    2243                 :            : 
    2244 [ #  # ][ #  # ]:          0 :     bValid = bConditionOK && bStringOK;
    2245                 :          0 : }
    2246                 :            : 
    2247                 :          0 : void XMLHiddenTextImportContext::PrepareField(
    2248                 :            :         const Reference<XPropertySet> & xPropertySet)
    2249                 :            : {
    2250                 :          0 :     Any aAny;
    2251                 :            : 
    2252         [ #  # ]:          0 :     aAny <<= sCondition;
    2253 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyCondition, aAny);
    2254                 :            : 
    2255         [ #  # ]:          0 :     aAny <<= sString;
    2256 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyContent, aAny);
    2257                 :            : 
    2258         [ #  # ]:          0 :     aAny.setValue( &bIsHidden, ::getBooleanCppuType() );
    2259 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyIsHidden, aAny);
    2260                 :          0 : }
    2261                 :            : 
    2262                 :            : 
    2263                 :            : 
    2264                 :            : //
    2265                 :            : // file name fields
    2266                 :            : //
    2267                 :            : 
    2268 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLFileNameImportContext, XMLTextFieldImportContext );
    2269                 :            : 
    2270                 :            : static const SvXMLEnumMapEntry aFilenameDisplayMap[] =
    2271                 :            : {
    2272                 :            :     { XML_PATH,                 FilenameDisplayFormat::PATH },
    2273                 :            :     { XML_NAME,                 FilenameDisplayFormat::NAME },
    2274                 :            :     { XML_NAME_AND_EXTENSION,   FilenameDisplayFormat::NAME_AND_EXT },
    2275                 :            :     { XML_FULL,                 FilenameDisplayFormat::FULL },
    2276                 :            :     { XML_TOKEN_INVALID, 0 }
    2277                 :            : };
    2278                 :            : 
    2279                 :          0 : XMLFileNameImportContext::XMLFileNameImportContext(
    2280                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
    2281                 :            :     const OUString& sLocalName) :
    2282                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_file_name,
    2283                 :            :                                   nPrfx, sLocalName),
    2284                 :            :         sPropertyFixed(sAPI_is_fixed),
    2285                 :            :         sPropertyFileFormat(sAPI_file_format),
    2286                 :            :         sPropertyCurrentPresentation(
    2287                 :            :             sAPI_current_presentation),
    2288                 :            :         nFormat(FilenameDisplayFormat::FULL),
    2289                 :          0 :         bFixed(sal_False)
    2290                 :            : {
    2291                 :          0 :     bValid = sal_True;
    2292                 :          0 : }
    2293                 :            : 
    2294                 :          0 : void XMLFileNameImportContext::ProcessAttribute(
    2295                 :            :     sal_uInt16 nAttrToken,
    2296                 :            :     const ::rtl::OUString& sAttrValue )
    2297                 :            : {
    2298      [ #  #  # ]:          0 :     switch (nAttrToken)
    2299                 :            :     {
    2300                 :            :         case XML_TOK_TEXTFIELD_FIXED:
    2301                 :            :         {
    2302                 :          0 :             bool bTmp(false);
    2303 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertBool(bTmp, sAttrValue))
    2304                 :            :             {
    2305                 :          0 :                 bFixed = bTmp;
    2306                 :            :             }
    2307                 :            :             break;
    2308                 :            :         }
    2309                 :            :         case XML_TOK_TEXTFIELD_DISPLAY:
    2310                 :            :         {
    2311                 :            :             sal_uInt16 nTmp;
    2312         [ #  # ]:          0 :             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
    2313         [ #  # ]:          0 :                                                 aFilenameDisplayMap))
    2314                 :            :             {
    2315                 :          0 :                 nFormat = (sal_uInt16)nTmp;
    2316                 :            :             }
    2317                 :            :             break;
    2318                 :            :         }
    2319                 :            :         default:
    2320                 :            :             ; // unkown attribute: ignore
    2321                 :          0 :             break;
    2322                 :            :     }
    2323                 :          0 : }
    2324                 :            : 
    2325                 :          0 : void XMLFileNameImportContext::PrepareField(
    2326                 :            :     const Reference<XPropertySet> & xPropertySet)
    2327                 :            : {
    2328                 :          0 :     Any aAny;
    2329                 :            : 
    2330                 :            :     // properties are optional
    2331                 :            :     Reference<XPropertySetInfo> xPropertySetInfo(
    2332 [ #  # ][ #  # ]:          0 :         xPropertySet->getPropertySetInfo());
    2333                 :            : 
    2334 [ #  # ][ #  # ]:          0 :      if (xPropertySetInfo->hasPropertyByName(sPropertyFixed))
                 [ #  # ]
    2335                 :            :      {
    2336         [ #  # ]:          0 :          aAny <<= bFixed;
    2337 [ #  # ][ #  # ]:          0 :          xPropertySet->setPropertyValue(sPropertyFixed, aAny);
    2338                 :            :      }
    2339                 :            : 
    2340 [ #  # ][ #  # ]:          0 :     if (xPropertySetInfo->hasPropertyByName(sPropertyFileFormat))
                 [ #  # ]
    2341                 :            :     {
    2342         [ #  # ]:          0 :         aAny <<= nFormat;
    2343 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyFileFormat, aAny);
    2344                 :            :     }
    2345                 :            : 
    2346 [ #  # ][ #  # ]:          0 :     if (xPropertySetInfo->hasPropertyByName(sPropertyCurrentPresentation))
                 [ #  # ]
    2347                 :            :     {
    2348 [ #  # ][ #  # ]:          0 :         aAny <<= GetContent();
    2349 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
    2350                 :          0 :     }
    2351                 :          0 : }
    2352                 :            : 
    2353                 :            : 
    2354                 :            : //
    2355                 :            : // template name field
    2356                 :            : //
    2357                 :            : 
    2358                 :            : static const SvXMLEnumMapEntry aTemplateDisplayMap[] =
    2359                 :            : {
    2360                 :            :     { XML_FULL,                 TemplateDisplayFormat::FULL },
    2361                 :            :     { XML_PATH,                 TemplateDisplayFormat::PATH },
    2362                 :            :     { XML_NAME,                 TemplateDisplayFormat::NAME },
    2363                 :            :     { XML_NAME_AND_EXTENSION,   TemplateDisplayFormat::NAME_AND_EXT },
    2364                 :            :     { XML_AREA,                 TemplateDisplayFormat::AREA },
    2365                 :            :     { XML_TITLE,                TemplateDisplayFormat::TITLE },
    2366                 :            :     { XML_TOKEN_INVALID, 0 }
    2367                 :            : };
    2368                 :            : 
    2369 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLTemplateNameImportContext, XMLTextFieldImportContext );
    2370                 :            : 
    2371                 :          0 : XMLTemplateNameImportContext::XMLTemplateNameImportContext(
    2372                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
    2373                 :            :     const OUString& sLocalName) :
    2374                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_template_name,
    2375                 :            :                                   nPrfx, sLocalName),
    2376                 :            :         sPropertyFileFormat(sAPI_file_format),
    2377                 :          0 :         nFormat(TemplateDisplayFormat::FULL)
    2378                 :            : {
    2379                 :          0 :     bValid = sal_True;
    2380                 :          0 : }
    2381                 :            : 
    2382                 :          0 : void XMLTemplateNameImportContext::ProcessAttribute(
    2383                 :            :     sal_uInt16 nAttrToken,
    2384                 :            :     const OUString& sAttrValue )
    2385                 :            : {
    2386         [ #  # ]:          0 :     switch (nAttrToken)
    2387                 :            :     {
    2388                 :            :         case XML_TOK_TEXTFIELD_DISPLAY:
    2389                 :            :         {
    2390                 :            :             sal_uInt16 nTmp;
    2391         [ #  # ]:          0 :             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
    2392         [ #  # ]:          0 :                                                 aTemplateDisplayMap))
    2393                 :            :             {
    2394                 :          0 :                 nFormat = (sal_uInt16)nTmp;
    2395                 :            :             }
    2396                 :            :             break;
    2397                 :            :         }
    2398                 :            :         default:
    2399                 :            :             ; // unknown attribute: ignore
    2400                 :          0 :             break;
    2401                 :            :     }
    2402                 :          0 : }
    2403                 :            : 
    2404                 :          0 : void XMLTemplateNameImportContext::PrepareField(
    2405                 :            :     const Reference<XPropertySet> & xPropertySet)
    2406                 :            : {
    2407                 :          0 :     Any aAny;
    2408                 :            : 
    2409         [ #  # ]:          0 :     aAny <<= nFormat;
    2410 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyFileFormat, aAny);
    2411                 :          0 : }
    2412                 :            : 
    2413                 :            : 
    2414                 :            : //
    2415                 :            : // import chapter fields
    2416                 :            : //
    2417                 :            : 
    2418 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLChapterImportContext, XMLTextFieldImportContext );
    2419                 :            : 
    2420                 :            : static const SvXMLEnumMapEntry aChapterDisplayMap[] =
    2421                 :            : {
    2422                 :            :     { XML_NAME,                     ChapterFormat::NAME },
    2423                 :            :     { XML_NUMBER,                   ChapterFormat::NUMBER },
    2424                 :            :     { XML_NUMBER_AND_NAME,          ChapterFormat::NAME_NUMBER },
    2425                 :            :     { XML_PLAIN_NUMBER_AND_NAME,    ChapterFormat::NO_PREFIX_SUFFIX },
    2426                 :            :     { XML_PLAIN_NUMBER,             ChapterFormat::DIGIT },
    2427                 :            :     { XML_TOKEN_INVALID, 0 }
    2428                 :            : };
    2429                 :            : 
    2430                 :          0 : XMLChapterImportContext::XMLChapterImportContext(
    2431                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    2432                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    2433                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_chapter,
    2434                 :            :                                   nPrfx, sLocalName),
    2435                 :            :         sPropertyChapterFormat(
    2436                 :            :             sAPI_chapter_format),
    2437                 :            :         sPropertyLevel(sAPI_level),
    2438                 :            :         nFormat(ChapterFormat::NAME_NUMBER),
    2439                 :          0 :         nLevel(0)
    2440                 :            : {
    2441                 :          0 :     bValid = sal_True;
    2442                 :          0 : }
    2443                 :            : 
    2444                 :          0 : void XMLChapterImportContext::ProcessAttribute(
    2445                 :            :     sal_uInt16 nAttrToken,
    2446                 :            :     const OUString& sAttrValue )
    2447                 :            : {
    2448      [ #  #  # ]:          0 :     switch (nAttrToken)
    2449                 :            :     {
    2450                 :            :         case XML_TOK_TEXTFIELD_DISPLAY:
    2451                 :            :         {
    2452                 :            :             sal_uInt16 nTmp;
    2453         [ #  # ]:          0 :             if (SvXMLUnitConverter::convertEnum(nTmp, sAttrValue,
    2454         [ #  # ]:          0 :                                                 aChapterDisplayMap))
    2455                 :            :             {
    2456                 :          0 :                 nFormat = (sal_Int16)nTmp;
    2457                 :            :             }
    2458                 :            :             break;
    2459                 :            :         }
    2460                 :            :         case XML_TOK_TEXTFIELD_OUTLINE_LEVEL:
    2461                 :            :         {
    2462                 :            :             sal_Int32 nTmp;
    2463 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertNumber(
    2464                 :            :                 nTmp, sAttrValue, 1,
    2465 [ #  # ][ #  # ]:          0 :                 GetImport().GetTextImport()->GetChapterNumbering()->getCount()
         [ #  # ][ #  # ]
                 [ #  # ]
    2466         [ #  # ]:          0 :                 ))
    2467                 :            :             {
    2468                 :            :                 // API numbers 0..9, we number 1..10
    2469                 :          0 :                 nLevel = (sal_Int8)nTmp;
    2470                 :          0 :                 nLevel--;
    2471                 :            :             }
    2472                 :            :             break;
    2473                 :            :         }
    2474                 :            :         default:
    2475                 :            :             ; // unknown attribute: ignore
    2476                 :          0 :             break;
    2477                 :            :     }
    2478                 :          0 : }
    2479                 :            : 
    2480                 :          0 : void XMLChapterImportContext::PrepareField(
    2481                 :            :         const Reference<XPropertySet> & xPropertySet)
    2482                 :            : {
    2483                 :          0 :     Any aAny;
    2484                 :            : 
    2485         [ #  # ]:          0 :     aAny <<= nFormat;
    2486 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyChapterFormat, aAny);
    2487                 :            : 
    2488         [ #  # ]:          0 :     aAny <<= nLevel;
    2489 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyLevel, aAny);
    2490                 :          0 : }
    2491                 :            : 
    2492                 :            : 
    2493                 :            : //
    2494                 :            : // counting fields
    2495                 :            : //
    2496                 :            : 
    2497 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLCountFieldImportContext, XMLTextFieldImportContext );
    2498                 :            : 
    2499                 :         93 : XMLCountFieldImportContext::XMLCountFieldImportContext(
    2500                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    2501                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName, sal_uInt16 nToken) :
    2502                 :            :         XMLTextFieldImportContext(rImport, rHlp, MapTokenToServiceName(nToken),
    2503                 :            :                                   nPrfx, sLocalName),
    2504                 :            :         sPropertyNumberingType(
    2505                 :            :             sAPI_numbering_type),
    2506                 :            :         sNumberFormat(),
    2507                 :            :         sLetterSync(),
    2508                 :         93 :         bNumberFormatOK(sal_False)
    2509                 :            : {
    2510                 :         93 :     bValid = sal_True;
    2511                 :         93 : }
    2512                 :            : 
    2513                 :          0 : void XMLCountFieldImportContext::ProcessAttribute(
    2514                 :            :     sal_uInt16 nAttrToken,
    2515                 :            :     const OUString& sAttrValue )
    2516                 :            : {
    2517      [ #  #  # ]:          0 :     switch (nAttrToken)
    2518                 :            :     {
    2519                 :            :         case XML_TOK_TEXTFIELD_NUM_FORMAT:
    2520                 :          0 :             sNumberFormat = sAttrValue;
    2521                 :          0 :             bNumberFormatOK = sal_True;
    2522                 :          0 :             break;
    2523                 :            :         case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
    2524                 :          0 :             sLetterSync = sAttrValue;
    2525                 :          0 :             break;
    2526                 :            :     }
    2527                 :          0 : }
    2528                 :            : 
    2529                 :         93 : void XMLCountFieldImportContext::PrepareField(
    2530                 :            :     const Reference<XPropertySet> & xPropertySet)
    2531                 :            : {
    2532                 :         93 :     Any aAny;
    2533                 :            : 
    2534                 :            :     // properties optional
    2535                 :            :     // (only page count, but do for all to save common implementation)
    2536                 :            : 
    2537 [ +  - ][ +  - ]:        186 :     if (xPropertySet->getPropertySetInfo()->
         [ -  + ][ +  - ]
    2538         [ +  - ]:         93 :         hasPropertyByName(sPropertyNumberingType))
    2539                 :            :     {
    2540                 :            :         sal_Int16 nNumType;
    2541         [ #  # ]:          0 :         if( bNumberFormatOK )
    2542                 :            :         {
    2543                 :          0 :             nNumType= style::NumberingType::ARABIC;
    2544                 :          0 :             GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
    2545                 :            :                                                     sNumberFormat,
    2546         [ #  # ]:          0 :                                                     sLetterSync );
    2547                 :            :         }
    2548                 :            :         else
    2549                 :          0 :             nNumType = style::NumberingType::PAGE_DESCRIPTOR;
    2550         [ #  # ]:          0 :         aAny <<= nNumType;
    2551 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
    2552                 :         93 :     }
    2553                 :         93 : }
    2554                 :            : 
    2555                 :         93 : const sal_Char* XMLCountFieldImportContext::MapTokenToServiceName(
    2556                 :            :     sal_uInt16 nToken)
    2557                 :            : {
    2558                 :         93 :     const sal_Char* pServiceName = NULL;
    2559                 :            : 
    2560   [ -  -  -  -  :         93 :     switch (nToken)
             -  -  +  - ]
    2561                 :            :     {
    2562                 :            :         case XML_TOK_TEXT_WORD_COUNT:
    2563                 :          0 :             pServiceName = sAPI_word_count;
    2564                 :          0 :             break;
    2565                 :            :         case XML_TOK_TEXT_PARAGRAPH_COUNT:
    2566                 :          0 :             pServiceName = sAPI_paragraph_count;
    2567                 :          0 :             break;
    2568                 :            :         case XML_TOK_TEXT_TABLE_COUNT:
    2569                 :          0 :             pServiceName = sAPI_table_count;
    2570                 :          0 :             break;
    2571                 :            :         case XML_TOK_TEXT_CHARACTER_COUNT:
    2572                 :          0 :             pServiceName = sAPI_character_count;
    2573                 :          0 :             break;
    2574                 :            :         case XML_TOK_TEXT_IMAGE_COUNT:
    2575                 :          0 :             pServiceName = sAPI_graphic_object_count;
    2576                 :          0 :             break;
    2577                 :            :         case XML_TOK_TEXT_OBJECT_COUNT:
    2578                 :          0 :             pServiceName = sAPI_embedded_object_count;
    2579                 :          0 :             break;
    2580                 :            :         case XML_TOK_TEXT_PAGE_COUNT:
    2581                 :         93 :             pServiceName = sAPI_page_count;
    2582                 :         93 :             break;
    2583                 :            :         default:
    2584                 :          0 :             pServiceName = NULL;
    2585                 :            :             OSL_FAIL("unknown count field!");
    2586                 :          0 :             break;
    2587                 :            :     }
    2588                 :            : 
    2589                 :         93 :     return pServiceName;
    2590                 :            : }
    2591                 :            : 
    2592                 :            : 
    2593                 :            : 
    2594                 :            : //
    2595                 :            : // page variable import
    2596                 :            : //
    2597                 :            : 
    2598 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLPageVarGetFieldImportContext, XMLTextFieldImportContext );
    2599                 :            : 
    2600                 :          0 : XMLPageVarGetFieldImportContext::XMLPageVarGetFieldImportContext(
    2601                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    2602                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    2603                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_reference_page_get,
    2604                 :            :                                   nPrfx, sLocalName),
    2605                 :            :         sPropertyNumberingType(
    2606                 :            :             sAPI_numbering_type),
    2607                 :            :         sNumberFormat(),
    2608                 :            :         sLetterSync(),
    2609                 :          0 :         bNumberFormatOK(sal_False)
    2610                 :            : {
    2611                 :          0 :     bValid = sal_True;
    2612                 :          0 : }
    2613                 :            : 
    2614                 :          0 : void XMLPageVarGetFieldImportContext::ProcessAttribute(
    2615                 :            :     sal_uInt16 nAttrToken,
    2616                 :            :     const OUString& sAttrValue )
    2617                 :            : {
    2618      [ #  #  # ]:          0 :     switch (nAttrToken)
    2619                 :            :     {
    2620                 :            :         case XML_TOK_TEXTFIELD_NUM_FORMAT:
    2621                 :          0 :             sNumberFormat = sAttrValue;
    2622                 :          0 :             bNumberFormatOK = sal_True;
    2623                 :          0 :             break;
    2624                 :            :         case XML_TOK_TEXTFIELD_NUM_LETTER_SYNC:
    2625                 :          0 :             sLetterSync = sAttrValue;
    2626                 :          0 :             break;
    2627                 :            :     }
    2628                 :          0 : }
    2629                 :            : 
    2630                 :          0 : void XMLPageVarGetFieldImportContext::PrepareField(
    2631                 :            :     const Reference<XPropertySet> & xPropertySet)
    2632                 :            : {
    2633                 :          0 :     Any aAny;
    2634                 :            : 
    2635                 :            :     sal_Int16 nNumType;
    2636         [ #  # ]:          0 :     if( bNumberFormatOK )
    2637                 :            :     {
    2638                 :          0 :         nNumType= style::NumberingType::ARABIC;
    2639                 :          0 :         GetImport().GetMM100UnitConverter().convertNumFormat( nNumType,
    2640                 :            :                                                     sNumberFormat,
    2641         [ #  # ]:          0 :                                                     sLetterSync );
    2642                 :            :     }
    2643                 :            :     else
    2644                 :          0 :         nNumType = style::NumberingType::PAGE_DESCRIPTOR;
    2645         [ #  # ]:          0 :     aAny <<= nNumType;
    2646 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyNumberingType, aAny);
    2647                 :            : 
    2648                 :            :     // display old content (#96657#)
    2649 [ #  # ][ #  # ]:          0 :     aAny <<= GetContent();
    2650         [ #  # ]:          0 :     xPropertySet->setPropertyValue(
    2651                 :            :         OUString(sAPI_current_presentation),
    2652         [ #  # ]:          0 :         aAny );
    2653                 :          0 : }
    2654                 :            : 
    2655                 :            : 
    2656                 :            : 
    2657                 :            : //
    2658                 :            : // page variable set fields
    2659                 :            : //
    2660                 :            : 
    2661 [ #  # ][ #  # ]:          0 : TYPEINIT1(XMLPageVarSetFieldImportContext, XMLTextFieldImportContext);
    2662                 :            : 
    2663                 :          0 : XMLPageVarSetFieldImportContext::XMLPageVarSetFieldImportContext(
    2664                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
    2665                 :            :     const OUString& sLocalName) :
    2666                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_reference_page_set,
    2667                 :            :                                   nPrfx, sLocalName),
    2668                 :            :         sPropertyOn(sAPI_on),
    2669                 :            :         sPropertyOffset(sAPI_offset),
    2670                 :            :         nAdjust(0),
    2671                 :          0 :         bActive(sal_True)
    2672                 :            : {
    2673                 :          0 :     bValid = sal_True;
    2674                 :          0 : }
    2675                 :            : 
    2676                 :          0 : void XMLPageVarSetFieldImportContext::ProcessAttribute(
    2677                 :            :     sal_uInt16 nAttrToken,
    2678                 :            :     const ::rtl::OUString& sAttrValue )
    2679                 :            : {
    2680      [ #  #  # ]:          0 :     switch (nAttrToken)
    2681                 :            :     {
    2682                 :            :         case XML_TOK_TEXTFIELD_ACTIVE:
    2683                 :            :         {
    2684                 :          0 :             bool bTmp(false);
    2685 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertBool(bTmp, sAttrValue))
    2686                 :            :             {
    2687                 :          0 :                 bActive = bTmp;
    2688                 :            :             }
    2689                 :            :         }
    2690                 :            :         case XML_TOK_TEXTFIELD_PAGE_ADJUST:
    2691                 :            :         {
    2692                 :            :             sal_Int32 nTmp;
    2693 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertNumber(nTmp, sAttrValue))
    2694                 :            :             {
    2695                 :          0 :                 nAdjust = (sal_Int16)nTmp;
    2696                 :            :             }
    2697                 :            :         }
    2698                 :            :     }
    2699                 :          0 : }
    2700                 :            : 
    2701                 :          0 : void XMLPageVarSetFieldImportContext::PrepareField(
    2702                 :            :     const Reference<XPropertySet> & xPropertySet)
    2703                 :            : {
    2704                 :          0 :     Any aAny;
    2705                 :            : 
    2706         [ #  # ]:          0 :     aAny.setValue(&bActive, ::getBooleanCppuType());
    2707 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyOn, aAny);
    2708                 :            : 
    2709         [ #  # ]:          0 :     aAny <<= nAdjust;
    2710 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyOffset, aAny);
    2711                 :          0 : }
    2712                 :            : 
    2713                 :            : 
    2714                 :            : 
    2715                 :            : //
    2716                 :            : // macro fields
    2717                 :            : //
    2718                 :            : 
    2719 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLMacroFieldImportContext, XMLTextFieldImportContext );
    2720                 :            : 
    2721                 :          0 : XMLMacroFieldImportContext::XMLMacroFieldImportContext(
    2722                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp, sal_uInt16 nPrfx,
    2723                 :            :     const OUString& sLocalName) :
    2724                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_macro,
    2725                 :            :                                   nPrfx, sLocalName),
    2726                 :            :         sPropertyHint(sAPI_hint),
    2727                 :            :         sPropertyMacroName("MacroName"),
    2728                 :            :         sPropertyScriptURL("ScriptURL"),
    2729                 :          0 :         bDescriptionOK(sal_False)
    2730                 :            : {
    2731                 :          0 : }
    2732                 :            : 
    2733                 :          0 : SvXMLImportContext* XMLMacroFieldImportContext::CreateChildContext(
    2734                 :            :     sal_uInt16 nPrefix,
    2735                 :            :     const OUString& rLocalName,
    2736                 :            :     const Reference<XAttributeList> & xAttrList )
    2737                 :            : {
    2738                 :          0 :     SvXMLImportContext* pContext = NULL;
    2739                 :            : 
    2740   [ #  #  #  # ]:          0 :     if ( (nPrefix == XML_NAMESPACE_OFFICE) &&
                 [ #  # ]
    2741                 :          0 :          IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
    2742                 :            :     {
    2743                 :            :         // create events context and remember it!
    2744                 :            :         pContext = new XMLEventsImportContext(
    2745         [ #  # ]:          0 :             GetImport(), nPrefix, rLocalName );
    2746                 :          0 :         xEventContext = pContext;
    2747                 :          0 :         bValid = sal_True;
    2748                 :            :     }
    2749                 :            :     else
    2750                 :            :         pContext = SvXMLImportContext::CreateChildContext(
    2751                 :          0 :             nPrefix, rLocalName, xAttrList);
    2752                 :            : 
    2753                 :          0 :     return pContext;
    2754                 :            : }
    2755                 :            : 
    2756                 :            : 
    2757                 :          0 : void XMLMacroFieldImportContext::ProcessAttribute(
    2758                 :            :     sal_uInt16 nAttrToken,
    2759                 :            :     const OUString& sAttrValue )
    2760                 :            : {
    2761      [ #  #  # ]:          0 :     switch (nAttrToken)
    2762                 :            :     {
    2763                 :            :         case XML_TOK_TEXTFIELD_DESCRIPTION:
    2764                 :          0 :             sDescription = sAttrValue;
    2765                 :          0 :             bDescriptionOK = sal_True;
    2766                 :          0 :             break;
    2767                 :            :         case XML_TOK_TEXTFIELD_NAME:
    2768                 :          0 :             sMacro = sAttrValue;
    2769                 :          0 :             bValid = sal_True;
    2770                 :          0 :             break;
    2771                 :            :     }
    2772                 :          0 : }
    2773                 :            : 
    2774                 :          0 : void XMLMacroFieldImportContext::PrepareField(
    2775                 :            :     const Reference<XPropertySet> & xPropertySet)
    2776                 :            : {
    2777                 :          0 :     Any aAny;
    2778                 :            : 
    2779                 :          0 :     OUString sOnClick("OnClick");
    2780                 :          0 :     OUString sPropertyMacroLibrary("MacroLibrary");
    2781                 :            : 
    2782 [ #  # ][ #  # ]:          0 :     aAny <<= (bDescriptionOK ? sDescription : GetContent());
                 [ #  # ]
    2783 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyHint, aAny);
    2784                 :            : 
    2785                 :            :     // if we have an events child element, we'll look for the OnClick
    2786                 :            :     // event if not, it may be an old (pre-638i) document. Then, we'll
    2787                 :            :     // have to look at the name attribute.
    2788                 :          0 :     OUString sMacroName;
    2789                 :          0 :     OUString sLibraryName;
    2790                 :          0 :     OUString sScriptURL;
    2791                 :            : 
    2792         [ #  # ]:          0 :     if ( xEventContext.Is() )
    2793                 :            :     {
    2794                 :            :         // get event sequence
    2795                 :            :         XMLEventsImportContext* pEvents =
    2796                 :          0 :             (XMLEventsImportContext*)&xEventContext;
    2797         [ #  # ]:          0 :         Sequence<PropertyValue> aValues;
    2798         [ #  # ]:          0 :         pEvents->GetEventSequence( sOnClick, aValues );
    2799                 :            : 
    2800                 :          0 :         sal_Int32 nLength = aValues.getLength();
    2801         [ #  # ]:          0 :         for( sal_Int32 i = 0; i < nLength; i++ )
    2802                 :            :         {
    2803 [ #  # ][ #  # ]:          0 :             if ( aValues[i].Name == "ScriptType" )
    2804                 :            :             {
    2805                 :            :                 // ignore ScriptType
    2806                 :            :             }
    2807 [ #  # ][ #  # ]:          0 :             else if ( aValues[i].Name == "Library" )
    2808                 :            :             {
    2809         [ #  # ]:          0 :                 aValues[i].Value >>= sLibraryName;
    2810                 :            :             }
    2811 [ #  # ][ #  # ]:          0 :             else if ( aValues[i].Name == "MacroName" )
    2812                 :            :             {
    2813         [ #  # ]:          0 :                 aValues[i].Value >>= sMacroName;
    2814                 :            :             }
    2815 [ #  # ][ #  # ]:          0 :             if ( aValues[i].Name == "Script" )
    2816                 :            :             {
    2817         [ #  # ]:          0 :                 aValues[i].Value >>= sScriptURL;
    2818                 :            :             }
    2819         [ #  # ]:          0 :         }
    2820                 :            :     }
    2821                 :            :     else
    2822                 :            :     {
    2823                 :            :         // disassemble old-style macro-name: Everything before the
    2824                 :            :         // third-last dot is the library
    2825                 :          0 :         sal_Int32 nPos = sMacro.getLength() + 1;    // the loop starts with nPos--
    2826                 :          0 :         const sal_Unicode* pBuf = sMacro.getStr();
    2827 [ #  # ][ #  # ]:          0 :         for( sal_Int32 i = 0; (i < 3) && (nPos > 0); i++ )
                 [ #  # ]
    2828                 :            :         {
    2829                 :          0 :             nPos--;
    2830 [ #  # ][ #  # ]:          0 :             while ( (pBuf[nPos] != '.') && (nPos > 0) )
                 [ #  # ]
    2831                 :          0 :                 nPos--;
    2832                 :            :         }
    2833                 :            : 
    2834         [ #  # ]:          0 :         if (nPos > 0)
    2835                 :            :         {
    2836                 :          0 :             sLibraryName = sMacro.copy(0, nPos);
    2837                 :          0 :             sMacroName = sMacro.copy(nPos+1);
    2838                 :            :         }
    2839                 :            :         else
    2840                 :          0 :             sMacroName = sMacro;
    2841                 :            :     }
    2842                 :            : 
    2843         [ #  # ]:          0 :     aAny <<= sScriptURL;
    2844 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyScriptURL, aAny);
    2845                 :            : 
    2846         [ #  # ]:          0 :     aAny <<= sMacroName;
    2847 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyMacroName, aAny);
    2848                 :            : 
    2849         [ #  # ]:          0 :     aAny <<= sLibraryName;
    2850 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyMacroLibrary, aAny);
    2851                 :          0 : }
    2852                 :            : 
    2853                 :            : 
    2854                 :            : 
    2855                 :            : //
    2856                 :            : // reference field import
    2857                 :            : //
    2858                 :            : 
    2859 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLReferenceFieldImportContext, XMLTextFieldImportContext );
    2860                 :            : 
    2861                 :         12 : XMLReferenceFieldImportContext::XMLReferenceFieldImportContext(
    2862                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    2863                 :            :     sal_uInt16 nToken, sal_uInt16 nPrfx, const OUString& sLocalName)
    2864                 :            : :   XMLTextFieldImportContext(rImport, rHlp, sAPI_get_reference, nPrfx, sLocalName)
    2865                 :            : ,   sPropertyReferenceFieldPart(sAPI_reference_field_part)
    2866                 :            : ,   sPropertyReferenceFieldSource(sAPI_reference_field_source)
    2867                 :            : ,   sPropertySourceName(sAPI_source_name)
    2868                 :            : ,   sPropertyCurrentPresentation(sAPI_current_presentation)
    2869                 :            : ,   nElementToken(nToken)
    2870                 :            : ,   nType(ReferenceFieldPart::PAGE_DESC)
    2871                 :            : ,   bNameOK(sal_False)
    2872                 :         12 : ,   bTypeOK(sal_False)
    2873                 :            : {
    2874                 :         12 : }
    2875                 :            : 
    2876                 :            : static SvXMLEnumMapEntry const lcl_aReferenceTypeTokenMap[] =
    2877                 :            : {
    2878                 :            :     { XML_PAGE,         ReferenceFieldPart::PAGE},
    2879                 :            :     { XML_CHAPTER,      ReferenceFieldPart::CHAPTER },
    2880                 :            :     { XML_TEXT,         ReferenceFieldPart::TEXT },
    2881                 :            :     { XML_DIRECTION,    ReferenceFieldPart::UP_DOWN },
    2882                 :            :     { XML_CATEGORY_AND_VALUE, ReferenceFieldPart::CATEGORY_AND_NUMBER },
    2883                 :            :     { XML_CAPTION,      ReferenceFieldPart::ONLY_CAPTION },
    2884                 :            :     { XML_VALUE,        ReferenceFieldPart::ONLY_SEQUENCE_NUMBER },
    2885                 :            :     // Core implementation for direct cross-references (#i81002#)
    2886                 :            :     { XML_NUMBER,               ReferenceFieldPart::NUMBER },
    2887                 :            :     { XML_NUMBER_NO_SUPERIOR,   ReferenceFieldPart::NUMBER_NO_CONTEXT },
    2888                 :            :     { XML_NUMBER_ALL_SUPERIOR,  ReferenceFieldPart::NUMBER_FULL_CONTEXT },
    2889                 :            :     { XML_TOKEN_INVALID, 0 }
    2890                 :            : };
    2891                 :            : 
    2892                 :         12 : void XMLReferenceFieldImportContext::StartElement(
    2893                 :            :     const Reference<XAttributeList> & xAttrList)
    2894                 :            : {
    2895                 :         12 :     bTypeOK = sal_True;
    2896   [ -  +  -  -  :         12 :     switch (nElementToken)
                      - ]
    2897                 :            :     {
    2898                 :            :         case XML_TOK_TEXT_REFERENCE_REF:
    2899                 :          0 :             nSource = ReferenceFieldSource::REFERENCE_MARK;
    2900                 :          0 :             break;
    2901                 :            :         case XML_TOK_TEXT_BOOKMARK_REF:
    2902                 :         12 :             nSource = ReferenceFieldSource::BOOKMARK;
    2903                 :         12 :             break;
    2904                 :            :         case XML_TOK_TEXT_NOTE_REF:
    2905                 :          0 :             nSource = ReferenceFieldSource::FOOTNOTE;
    2906                 :          0 :             break;
    2907                 :            :         case XML_TOK_TEXT_SEQUENCE_REF:
    2908                 :          0 :             nSource = ReferenceFieldSource::SEQUENCE_FIELD;
    2909                 :          0 :             break;
    2910                 :            :         default:
    2911                 :          0 :             bTypeOK = sal_False;
    2912                 :            :             OSL_FAIL("unknown reference field");
    2913                 :          0 :             break;
    2914                 :            :     }
    2915                 :            : 
    2916                 :         12 :     XMLTextFieldImportContext::StartElement(xAttrList);
    2917                 :         12 : }
    2918                 :            : 
    2919                 :            : 
    2920                 :         24 : void XMLReferenceFieldImportContext::ProcessAttribute(
    2921                 :            :     sal_uInt16 nAttrToken,
    2922                 :            :     const OUString& sAttrValue )
    2923                 :            : {
    2924   [ -  +  +  - ]:         24 :     switch (nAttrToken)
    2925                 :            :     {
    2926                 :            :         case XML_TOK_TEXTFIELD_NOTE_CLASS:
    2927         [ #  # ]:          0 :             if( IsXMLToken( sAttrValue, XML_ENDNOTE ) )
    2928                 :          0 :                 nSource = ReferenceFieldSource::ENDNOTE;
    2929                 :          0 :             break;
    2930                 :            :         case XML_TOK_TEXTFIELD_REF_NAME:
    2931                 :         12 :             sName = sAttrValue;
    2932                 :         12 :             bNameOK = sal_True;
    2933                 :         12 :             break;
    2934                 :            :         case XML_TOK_TEXTFIELD_REFERENCE_FORMAT:
    2935                 :            :         {
    2936                 :            :             sal_uInt16 nToken;
    2937         [ +  - ]:         12 :             if (SvXMLUnitConverter::convertEnum(nToken, sAttrValue,
    2938         [ +  - ]:         12 :                                                 lcl_aReferenceTypeTokenMap))
    2939                 :            :             {
    2940                 :         12 :                 nType = nToken;
    2941                 :            :             }
    2942                 :            : 
    2943                 :            :             // check for sequence-only-attributes
    2944 [ +  - ][ +  - ]:         12 :             if ( (XML_TOK_TEXT_SEQUENCE_REF != nElementToken) &&
         [ +  - ][ -  + ]
    2945                 :            :                  ( (nType == ReferenceFieldPart::CATEGORY_AND_NUMBER) ||
    2946                 :            :                    (nType == ReferenceFieldPart::ONLY_CAPTION) ||
    2947                 :            :                    (nType == ReferenceFieldPart::ONLY_SEQUENCE_NUMBER) ) )
    2948                 :            :             {
    2949                 :         12 :                 nType = ReferenceFieldPart::PAGE_DESC;
    2950                 :            :             }
    2951                 :            : 
    2952                 :            :             break;
    2953                 :            :         }
    2954                 :            :     }
    2955                 :            : 
    2956                 :            :     // bValid: we need proper element type and name
    2957 [ +  - ][ +  + ]:         24 :     bValid = bTypeOK && bNameOK;
    2958                 :         24 : }
    2959                 :            : 
    2960                 :         12 : void XMLReferenceFieldImportContext::PrepareField(
    2961                 :            :     const Reference<XPropertySet> & xPropertySet)
    2962                 :            : {
    2963                 :         12 :     Any aAny;
    2964                 :            : 
    2965         [ +  - ]:         12 :     aAny <<= nType;
    2966 [ +  - ][ +  - ]:         12 :     xPropertySet->setPropertyValue(sPropertyReferenceFieldPart, aAny);
    2967                 :            : 
    2968         [ +  - ]:         12 :     aAny <<= nSource;
    2969 [ +  - ][ +  - ]:         12 :     xPropertySet->setPropertyValue(sPropertyReferenceFieldSource, aAny);
    2970                 :            : 
    2971   [ +  -  -  - ]:         12 :     switch (nElementToken)
    2972                 :            :     {
    2973                 :            :         case XML_TOK_TEXT_REFERENCE_REF:
    2974                 :            :         case XML_TOK_TEXT_BOOKMARK_REF:
    2975         [ +  - ]:         12 :             aAny <<= sName;
    2976 [ +  - ][ +  - ]:         12 :             xPropertySet->setPropertyValue(sPropertySourceName, aAny);
    2977                 :         12 :             break;
    2978                 :            : 
    2979                 :            :         case XML_TOK_TEXT_NOTE_REF:
    2980         [ #  # ]:          0 :             GetImportHelper().ProcessFootnoteReference(sName, xPropertySet);
    2981                 :          0 :             break;
    2982                 :            : 
    2983                 :            :         case XML_TOK_TEXT_SEQUENCE_REF:
    2984         [ #  # ]:          0 :             GetImportHelper().ProcessSequenceReference(sName, xPropertySet);
    2985                 :          0 :             break;
    2986                 :            :     }
    2987                 :            : 
    2988 [ +  - ][ +  - ]:         12 :     aAny <<= GetContent();
    2989 [ +  - ][ +  - ]:         12 :     xPropertySet->setPropertyValue(sPropertyCurrentPresentation, aAny);
    2990                 :         12 : }
    2991                 :            : 
    2992                 :            : 
    2993                 :            : 
    2994                 :            : //
    2995                 :            : // field declarations container
    2996                 :            : //
    2997                 :            : 
    2998                 :            : enum DdeFieldDeclAttrs
    2999                 :            : {
    3000                 :            :     XML_TOK_DDEFIELD_NAME,
    3001                 :            :     XML_TOK_DDEFIELD_APPLICATION,
    3002                 :            :     XML_TOK_DDEFIELD_TOPIC,
    3003                 :            :     XML_TOK_DDEFIELD_ITEM,
    3004                 :            :     XML_TOK_DDEFIELD_UPDATE
    3005                 :            : };
    3006                 :            : 
    3007                 :            : static SvXMLTokenMapEntry aDdeDeclAttrTokenMap[] =
    3008                 :            : {
    3009                 :            :     { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_DDEFIELD_NAME },
    3010                 :            :     { XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION, XML_TOK_DDEFIELD_APPLICATION },
    3011                 :            :     { XML_NAMESPACE_OFFICE, XML_DDE_TOPIC, XML_TOK_DDEFIELD_TOPIC },
    3012                 :            :     { XML_NAMESPACE_OFFICE, XML_DDE_ITEM, XML_TOK_DDEFIELD_ITEM },
    3013                 :            :     { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE, XML_TOK_DDEFIELD_UPDATE },
    3014                 :            :     XML_TOKEN_MAP_END
    3015                 :            : };
    3016                 :            : 
    3017 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDdeFieldDeclsImportContext, SvXMLImportContext );
    3018                 :            : 
    3019                 :          0 : XMLDdeFieldDeclsImportContext::XMLDdeFieldDeclsImportContext(
    3020                 :            :     SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& sLocalName) :
    3021                 :            :         SvXMLImportContext(rImport, nPrfx, sLocalName),
    3022         [ #  # ]:          0 :         aTokenMap(aDdeDeclAttrTokenMap)
    3023                 :            : {
    3024                 :          0 : }
    3025                 :            : 
    3026                 :          0 : SvXMLImportContext * XMLDdeFieldDeclsImportContext::CreateChildContext(
    3027                 :            :     sal_uInt16 nPrefix,
    3028                 :            :     const OUString& rLocalName,
    3029                 :            :     const Reference<XAttributeList> & xAttrList )
    3030                 :            : {
    3031   [ #  #  #  # ]:          0 :     if ( (XML_NAMESPACE_TEXT == nPrefix) &&
                 [ #  # ]
    3032                 :          0 :          (IsXMLToken(rLocalName, XML_DDE_CONNECTION_DECL)) )
    3033                 :            :     {
    3034                 :          0 :         return new XMLDdeFieldDeclImportContext(GetImport(), nPrefix,
    3035         [ #  # ]:          0 :                                                 rLocalName, aTokenMap);
    3036                 :            :     }
    3037                 :            :     else
    3038                 :            :     {
    3039                 :            :         return SvXMLImportContext::CreateChildContext(nPrefix,
    3040                 :            :                                                       rLocalName,
    3041                 :          0 :                                                       xAttrList);
    3042                 :            :     }
    3043                 :            : }
    3044                 :            : 
    3045                 :            : 
    3046                 :            : 
    3047                 :            : //
    3048                 :            : // import dde field declaration
    3049                 :            : //
    3050                 :            : 
    3051 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDdeFieldDeclImportContext, SvXMLImportContext );
    3052                 :            : 
    3053                 :          0 : XMLDdeFieldDeclImportContext::XMLDdeFieldDeclImportContext(
    3054                 :            :     SvXMLImport& rImport, sal_uInt16 nPrfx,
    3055                 :            :     const OUString& sLocalName, const SvXMLTokenMap& rMap)
    3056                 :            : :   SvXMLImportContext(rImport, nPrfx, sLocalName)
    3057                 :            : ,   sPropertyIsAutomaticUpdate(sAPI_is_automatic_update)
    3058                 :            : ,   sPropertyName(sAPI_name)
    3059                 :            : ,   sPropertyDDECommandType(sAPI_dde_command_type)
    3060                 :            : ,   sPropertyDDECommandFile(sAPI_dde_command_file)
    3061                 :            : ,   sPropertyDDECommandElement(sAPI_dde_command_element)
    3062                 :          0 : ,   rTokenMap(rMap)
    3063                 :            : {
    3064                 :            :     DBG_ASSERT(XML_NAMESPACE_TEXT == nPrfx, "wrong prefix");
    3065                 :            :     DBG_ASSERT(IsXMLToken(sLocalName, XML_DDE_CONNECTION_DECL), "wrong name");
    3066                 :          0 : }
    3067                 :            : 
    3068                 :          0 : void XMLDdeFieldDeclImportContext::StartElement(
    3069                 :            :     const Reference<XAttributeList> & xAttrList)
    3070                 :            : {
    3071                 :          0 :     OUString sName;
    3072                 :          0 :     OUString sCommandApplication;
    3073                 :          0 :     OUString sCommandTopic;
    3074                 :          0 :     OUString sCommandItem;
    3075                 :            : 
    3076                 :          0 :     sal_Bool bUpdate = sal_False;
    3077                 :          0 :     sal_Bool bNameOK = sal_False;
    3078                 :          0 :     sal_Bool bCommandApplicationOK = sal_False;
    3079                 :          0 :     sal_Bool bCommandTopicOK = sal_False;
    3080                 :          0 :     sal_Bool bCommandItemOK = sal_False;
    3081                 :            : 
    3082                 :            :     // process attributes
    3083 [ #  # ][ #  # ]:          0 :     sal_Int16 nLength = xAttrList->getLength();
    3084         [ #  # ]:          0 :     for(sal_Int16 i=0; i<nLength; i++)
    3085                 :            :     {
    3086                 :            : 
    3087                 :          0 :         OUString sLocalName;
    3088                 :          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
    3089   [ #  #  #  # ]:          0 :             GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
                 [ #  # ]
    3090                 :            : 
    3091   [ #  #  #  #  :          0 :         switch (rTokenMap.Get(nPrefix, sLocalName))
           #  # ][ #  # ]
    3092                 :            :         {
    3093                 :            :             case XML_TOK_DDEFIELD_NAME:
    3094 [ #  # ][ #  # ]:          0 :                 sName = xAttrList->getValueByIndex(i);
    3095                 :          0 :                 bNameOK = sal_True;
    3096                 :          0 :                 break;
    3097                 :            :             case XML_TOK_DDEFIELD_APPLICATION:
    3098 [ #  # ][ #  # ]:          0 :                 sCommandApplication = xAttrList->getValueByIndex(i);
    3099                 :          0 :                 bCommandApplicationOK = sal_True;
    3100                 :          0 :                 break;
    3101                 :            :             case XML_TOK_DDEFIELD_TOPIC:
    3102 [ #  # ][ #  # ]:          0 :                 sCommandTopic = xAttrList->getValueByIndex(i);
    3103                 :          0 :                 bCommandTopicOK = sal_True;
    3104                 :          0 :                 break;
    3105                 :            :             case XML_TOK_DDEFIELD_ITEM:
    3106 [ #  # ][ #  # ]:          0 :                 sCommandItem = xAttrList->getValueByIndex(i);
    3107                 :          0 :                 bCommandItemOK = sal_True;
    3108                 :          0 :                 break;
    3109                 :            :             case XML_TOK_DDEFIELD_UPDATE:
    3110                 :            :             {
    3111                 :          0 :                 bool bTmp(false);
    3112   [ #  #  #  # ]:          0 :                 if (::sax::Converter::convertBool(
    3113 [ #  # ][ #  # ]:          0 :                     bTmp, xAttrList->getValueByIndex(i)) )
    3114                 :            :                 {
    3115                 :          0 :                     bUpdate = bTmp;
    3116                 :            :                 }
    3117                 :            :                 break;
    3118                 :            :             }
    3119                 :            :         }
    3120                 :          0 :     }
    3121                 :            : 
    3122                 :            :     // valid data?
    3123 [ #  # ][ #  # ]:          0 :     if (bNameOK && bCommandApplicationOK && bCommandTopicOK && bCommandItemOK)
         [ #  # ][ #  # ]
    3124                 :            :     {
    3125                 :            :         // make service name
    3126                 :          0 :         OUStringBuffer sBuf;
    3127         [ #  # ]:          0 :         sBuf.appendAscii(sAPI_fieldmaster_prefix);
    3128         [ #  # ]:          0 :         sBuf.appendAscii(sAPI_dde);
    3129                 :            : 
    3130                 :            :         // create DDE TextFieldMaster
    3131                 :          0 :         Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),
    3132         [ #  # ]:          0 :                                                  UNO_QUERY);
    3133         [ #  # ]:          0 :         if( xFactory.is() )
    3134                 :            :         {
    3135                 :            :             /* #i6432# There might be multiple occurrences of one DDE
    3136                 :            :                declaration if it is used in more than one of
    3137                 :            :                header/footer/body. createInstance will throw an exception if we
    3138                 :            :                try to create the second, third, etc. instance of such a
    3139                 :            :                declaration. Thus we ignore the exception. Otherwise this will
    3140                 :            :                lead to an unloadable document. */
    3141                 :            :             try
    3142                 :            :             {
    3143                 :            :                 Reference<XInterface> xIfc =
    3144 [ #  # ][ #  # ]:          0 :                     xFactory->createInstance(sBuf.makeStringAndClear());
                 [ #  # ]
    3145         [ #  # ]:          0 :                 if( xIfc.is() )
    3146                 :            :                 {
    3147         [ #  # ]:          0 :                     Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY );
    3148 [ #  # ][ #  # ]:          0 :                     if (xPropSet.is() &&
                 [ #  # ]
    3149 [ #  # ][ #  # ]:          0 :                         xPropSet->getPropertySetInfo()->hasPropertyByName(
         [ #  # ][ #  # ]
                 [ #  # ]
    3150         [ #  # ]:          0 :                                                                           sPropertyDDECommandType))
    3151                 :            :                     {
    3152                 :          0 :                         Any aAny;
    3153                 :            : 
    3154         [ #  # ]:          0 :                         aAny <<= sName;
    3155 [ #  # ][ #  # ]:          0 :                         xPropSet->setPropertyValue(sPropertyName, aAny);
    3156                 :            : 
    3157         [ #  # ]:          0 :                         aAny <<= sCommandApplication;
    3158 [ #  # ][ #  # ]:          0 :                         xPropSet->setPropertyValue(sPropertyDDECommandType, aAny);
    3159                 :            : 
    3160         [ #  # ]:          0 :                         aAny <<= sCommandTopic;
    3161 [ #  # ][ #  # ]:          0 :                         xPropSet->setPropertyValue(sPropertyDDECommandFile, aAny);
    3162                 :            : 
    3163         [ #  # ]:          0 :                         aAny <<= sCommandItem;
    3164         [ #  # ]:          0 :                         xPropSet->setPropertyValue(sPropertyDDECommandElement,
    3165         [ #  # ]:          0 :                                                    aAny);
    3166                 :            : 
    3167         [ #  # ]:          0 :                         aAny.setValue(&bUpdate, ::getBooleanCppuType());
    3168         [ #  # ]:          0 :                         xPropSet->setPropertyValue(sPropertyIsAutomaticUpdate,
    3169         [ #  # ]:          0 :                                                    aAny);
    3170                 :          0 :                     }
    3171                 :            :                     // else: ignore (can't get XPropertySet, or DDE
    3172                 :            :                     //               properties are not supported)
    3173         [ #  # ]:          0 :                 }
    3174                 :            :                 // else: ignore
    3175                 :            :             }
    3176         [ #  # ]:          0 :             catch (const Exception&)
    3177                 :            :             {
    3178                 :            :                 //ignore
    3179                 :            :             }
    3180                 :          0 :         }
    3181                 :            :         // else: ignore
    3182                 :          0 :     }
    3183                 :            :     // else: ignore
    3184                 :          0 : }
    3185                 :            : 
    3186                 :            : 
    3187                 :            : 
    3188                 :            : //
    3189                 :            : // DDE field import
    3190                 :            : //
    3191                 :            : 
    3192 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDdeFieldImportContext, XMLTextFieldImportContext );
    3193                 :            : 
    3194                 :          0 : XMLDdeFieldImportContext::XMLDdeFieldImportContext(
    3195                 :            :     SvXMLImport& rImport, XMLTextImportHelper& rHlp,
    3196                 :            :     sal_uInt16 nPrfx, const OUString& sLocalName) :
    3197                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_dde,
    3198                 :            :                                   nPrfx, sLocalName),
    3199                 :            :         sName()
    3200                 :          0 :         ,sPropertyContent(sAPI_content)
    3201                 :            : {
    3202                 :          0 : }
    3203                 :            : 
    3204                 :          0 : void XMLDdeFieldImportContext::ProcessAttribute(
    3205                 :            :     sal_uInt16 nAttrToken,
    3206                 :            :     const ::rtl::OUString& sAttrValue )
    3207                 :            : {
    3208         [ #  # ]:          0 :     if (XML_TOK_TEXTFIELD_CONNECTION_NAME == nAttrToken)
    3209                 :            :     {
    3210                 :          0 :         sName = sAttrValue;
    3211                 :          0 :         bValid = sal_True;
    3212                 :            :     }
    3213                 :          0 : }
    3214                 :            : 
    3215                 :          0 : void XMLDdeFieldImportContext::EndElement()
    3216                 :            : {
    3217         [ #  # ]:          0 :     if (bValid)
    3218                 :            :     {
    3219                 :            :         // find master
    3220                 :          0 :         OUStringBuffer sBuf;
    3221         [ #  # ]:          0 :         sBuf.appendAscii(sAPI_fieldmaster_prefix);
    3222         [ #  # ]:          0 :         sBuf.appendAscii(sAPI_dde);
    3223         [ #  # ]:          0 :         sBuf.append(sal_Unicode('.'));
    3224         [ #  # ]:          0 :         sBuf.append(sName);
    3225         [ #  # ]:          0 :         OUString sMasterName = sBuf.makeStringAndClear();
    3226                 :            : 
    3227                 :          0 :         Reference<XTextFieldsSupplier> xTextFieldsSupp(GetImport().GetModel(),
    3228         [ #  # ]:          0 :                                                        UNO_QUERY);
    3229                 :            :         Reference<container::XNameAccess> xFieldMasterNameAccess(
    3230 [ #  # ][ #  # ]:          0 :             xTextFieldsSupp->getTextFieldMasters(), UNO_QUERY);
                 [ #  # ]
    3231                 :            : 
    3232 [ #  # ][ #  # ]:          0 :         if (xFieldMasterNameAccess->hasByName(sMasterName))
                 [ #  # ]
    3233                 :            :         {
    3234                 :          0 :             Reference<XPropertySet> xMaster;
    3235 [ #  # ][ #  # ]:          0 :             Any aAny = xFieldMasterNameAccess->getByName(sMasterName);
    3236         [ #  # ]:          0 :             aAny >>= xMaster;
    3237                 :            :             //apply the content to the master
    3238 [ #  # ][ #  # ]:          0 :             xMaster->setPropertyValue( sPropertyContent, uno::makeAny( GetContent()));
         [ #  # ][ #  # ]
    3239                 :            :             // master exists: create text field and attach
    3240                 :          0 :             Reference<XPropertySet> xField;
    3241         [ #  # ]:          0 :             sBuf.appendAscii(sAPI_textfield_prefix);
    3242         [ #  # ]:          0 :             sBuf.appendAscii(sAPI_dde);
    3243 [ #  # ][ #  # ]:          0 :             if (CreateField(xField, sBuf.makeStringAndClear()))
                 [ #  # ]
    3244                 :            :             {
    3245         [ #  # ]:          0 :                 Reference<XDependentTextField> xDepTextField(xField,UNO_QUERY);
    3246 [ #  # ][ #  # ]:          0 :                 xDepTextField->attachTextFieldMaster(xMaster);
    3247                 :            : 
    3248                 :            :                 // attach field to document
    3249         [ #  # ]:          0 :                 Reference<XTextContent> xTextContent(xField, UNO_QUERY);
    3250         [ #  # ]:          0 :                 if (xTextContent.is())
    3251                 :            :                 {
    3252         [ #  # ]:          0 :                     GetImportHelper().InsertTextContent(xTextContent);
    3253                 :            : 
    3254                 :            :                     // we're lucky. nothing else to prepare.
    3255                 :          0 :                 }
    3256                 :            :                 // else: fail, because text content could not be created
    3257                 :          0 :             }
    3258                 :            :             // else: fail, because field could not be created
    3259                 :          0 :         }
    3260                 :            :         // else: fail, because no master was found (faulty document?!)
    3261                 :            :     }
    3262                 :            :     // not valid: ignore
    3263                 :          0 : }
    3264                 :            : 
    3265                 :          0 : void XMLDdeFieldImportContext::PrepareField(
    3266                 :            :     const Reference<XPropertySet> &)
    3267                 :            : {
    3268                 :            :     // empty, since not needed.
    3269                 :          0 : }
    3270                 :            : 
    3271                 :            : 
    3272                 :            : //
    3273                 :            : // sheet name fields
    3274                 :            : //
    3275                 :            : 
    3276 [ #  # ][ #  # ]:          0 : TYPEINIT1(XMLSheetNameImportContext, XMLTextFieldImportContext);
    3277                 :            : 
    3278                 :        198 : XMLSheetNameImportContext::XMLSheetNameImportContext(
    3279                 :            :     SvXMLImport& rImport,
    3280                 :            :     XMLTextImportHelper& rHlp,
    3281                 :            :     sal_uInt16 nPrfx,
    3282                 :            :     const OUString& sLocalName) :
    3283                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_sheet_name,
    3284                 :        198 :                                   nPrfx, sLocalName)
    3285                 :            : {
    3286                 :        198 :     bValid = sal_True;  // always valid!
    3287                 :        198 : }
    3288                 :            : 
    3289                 :          0 : void XMLSheetNameImportContext::ProcessAttribute(
    3290                 :            :     sal_uInt16,
    3291                 :            :     const ::rtl::OUString& )
    3292                 :            : {
    3293                 :            :     // no attributes -> nothing to be done
    3294                 :          0 : }
    3295                 :            : 
    3296                 :        198 : void XMLSheetNameImportContext::PrepareField(
    3297                 :            :     const Reference<XPropertySet> &)
    3298                 :            : {
    3299                 :            :     // no attributes -> nothing to be done
    3300                 :        198 : }
    3301                 :            : 
    3302                 :            : 
    3303                 :            : //
    3304                 :            : // URL fields (Calc, Impress, Draw)
    3305                 :            : //
    3306                 :            : 
    3307 [ #  # ][ #  # ]:          0 : TYPEINIT1(XMLUrlFieldImportContext, XMLTextFieldImportContext);
    3308                 :            : 
    3309                 :          0 : XMLUrlFieldImportContext::XMLUrlFieldImportContext(
    3310                 :            :     SvXMLImport& rImport,
    3311                 :            :     XMLTextImportHelper& rHlp,
    3312                 :            :     sal_uInt16 nPrfx,
    3313                 :            :     const OUString& sLocalName) :
    3314                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_url,
    3315                 :            :                                   nPrfx, sLocalName),
    3316                 :            :         sPropertyURL(sAPI_url),
    3317                 :            :         sPropertyTargetFrame(sAPI_target_frame),
    3318                 :            :         sPropertyRepresentation(
    3319                 :            :             sAPI_representation),
    3320                 :          0 :         bFrameOK(sal_False)
    3321                 :            : {
    3322                 :          0 : }
    3323                 :            : 
    3324                 :          0 : void XMLUrlFieldImportContext::ProcessAttribute(
    3325                 :            :     sal_uInt16 nAttrToken,
    3326                 :            :     const OUString& sAttrValue )
    3327                 :            : {
    3328      [ #  #  # ]:          0 :     switch (nAttrToken)
    3329                 :            :     {
    3330                 :            :         case XML_TOK_TEXTFIELD_HREF:
    3331                 :          0 :             sURL = GetImport().GetAbsoluteReference( sAttrValue );
    3332                 :          0 :             bValid = sal_True;
    3333                 :          0 :             break;
    3334                 :            :         case XML_TOK_TEXTFIELD_TARGET_FRAME:
    3335                 :          0 :             sFrame = sAttrValue;
    3336                 :          0 :             bFrameOK = sal_True;
    3337                 :          0 :             break;
    3338                 :            :         default:
    3339                 :            :             // ignore
    3340                 :          0 :             break;
    3341                 :            :     }
    3342                 :          0 : }
    3343                 :            : 
    3344                 :          0 : void XMLUrlFieldImportContext::PrepareField(
    3345                 :            :     const Reference<XPropertySet> & xPropertySet)
    3346                 :            : {
    3347                 :          0 :     Any aAny;
    3348                 :            : 
    3349         [ #  # ]:          0 :     aAny <<= sURL;
    3350 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyURL, aAny);
    3351                 :            : 
    3352         [ #  # ]:          0 :     if (bFrameOK)
    3353                 :            :     {
    3354         [ #  # ]:          0 :         aAny <<= sFrame;
    3355 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyTargetFrame, aAny);
    3356                 :            :     }
    3357                 :            : 
    3358 [ #  # ][ #  # ]:          0 :     aAny <<= GetContent();
    3359 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyRepresentation, aAny);
    3360                 :          0 : }
    3361                 :            : 
    3362                 :            : 
    3363 [ #  # ][ #  # ]:          0 : TYPEINIT1(XMLBibliographyFieldImportContext, XMLTextFieldImportContext);
    3364                 :            : 
    3365                 :            : 
    3366                 :          0 : XMLBibliographyFieldImportContext::XMLBibliographyFieldImportContext(
    3367                 :            :     SvXMLImport& rImport,
    3368                 :            :     XMLTextImportHelper& rHlp,
    3369                 :            :     sal_uInt16 nPrfx,
    3370                 :            :     const OUString& sLocalName) :
    3371                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_bibliography,
    3372                 :            :                                   nPrfx, sLocalName),
    3373                 :            :         sPropertyFields("Fields"),
    3374         [ #  # ]:          0 :         aValues()
    3375                 :            : {
    3376                 :          0 :     bValid = sal_True;
    3377                 :          0 : }
    3378                 :            : 
    3379                 :            : // TODO: this is the same map as is used in the text field export
    3380                 :            : SvXMLEnumMapEntry const aBibliographyDataTypeMap[] =
    3381                 :            : {
    3382                 :            :     { XML_ARTICLE,          BibliographyDataType::ARTICLE },
    3383                 :            :     { XML_BOOK,             BibliographyDataType::BOOK },
    3384                 :            :     { XML_BOOKLET,          BibliographyDataType::BOOKLET },
    3385                 :            :     { XML_CONFERENCE,       BibliographyDataType::CONFERENCE },
    3386                 :            :     { XML_CUSTOM1,          BibliographyDataType::CUSTOM1 },
    3387                 :            :     { XML_CUSTOM2,          BibliographyDataType::CUSTOM2 },
    3388                 :            :     { XML_CUSTOM3,          BibliographyDataType::CUSTOM3 },
    3389                 :            :     { XML_CUSTOM4,          BibliographyDataType::CUSTOM4 },
    3390                 :            :     { XML_CUSTOM5,          BibliographyDataType::CUSTOM5 },
    3391                 :            :     { XML_EMAIL,            BibliographyDataType::EMAIL },
    3392                 :            :     { XML_INBOOK,           BibliographyDataType::INBOOK },
    3393                 :            :     { XML_INCOLLECTION,     BibliographyDataType::INCOLLECTION },
    3394                 :            :     { XML_INPROCEEDINGS,    BibliographyDataType::INPROCEEDINGS },
    3395                 :            :     { XML_JOURNAL,          BibliographyDataType::JOURNAL },
    3396                 :            :     { XML_MANUAL,           BibliographyDataType::MANUAL },
    3397                 :            :     { XML_MASTERSTHESIS,    BibliographyDataType::MASTERSTHESIS },
    3398                 :            :     { XML_MISC,             BibliographyDataType::MISC },
    3399                 :            :     { XML_PHDTHESIS,        BibliographyDataType::PHDTHESIS },
    3400                 :            :     { XML_PROCEEDINGS,      BibliographyDataType::PROCEEDINGS },
    3401                 :            :     { XML_TECHREPORT,       BibliographyDataType::TECHREPORT },
    3402                 :            :     { XML_UNPUBLISHED,      BibliographyDataType::UNPUBLISHED },
    3403                 :            :     { XML_WWW,              BibliographyDataType::WWW },
    3404                 :            :     { XML_TOKEN_INVALID, 0 }
    3405                 :            : };
    3406                 :            : 
    3407                 :            : 
    3408                 :            : // we'll process attributes on our own and forfit the standard
    3409                 :            : // tecfield mechanism, because our attributes have zero overlp with
    3410                 :            : // all the oher textfields.
    3411                 :          0 : void XMLBibliographyFieldImportContext::StartElement(
    3412                 :            :         const Reference<XAttributeList> & xAttrList)
    3413                 :            : {
    3414                 :            :     // iterate over attributes
    3415                 :          0 :     sal_Int16 nLength = xAttrList->getLength();
    3416         [ #  # ]:          0 :     for(sal_Int16 i=0; i<nLength; i++) {
    3417                 :            : 
    3418                 :          0 :         OUString sLocalName;
    3419                 :          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
    3420   [ #  #  #  # ]:          0 :             GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
                 [ #  # ]
    3421                 :            : 
    3422         [ #  # ]:          0 :         if (nPrefix == XML_NAMESPACE_TEXT)
    3423                 :            :         {
    3424                 :          0 :             PropertyValue aValue;
    3425                 :            :             aValue.Name = OUString::createFromAscii(
    3426         [ #  # ]:          0 :                 MapBibliographyFieldName(sLocalName));
    3427                 :          0 :             Any aAny;
    3428                 :            : 
    3429                 :            :             // special treatment for bibliography type
    3430                 :            :             // biblio vs bibilio: #96658#; also read old documents
    3431 [ #  # ][ #  # ]:          0 :             if (IsXMLToken(sLocalName, XML_BIBILIOGRAPHIC_TYPE) ||
         [ #  # ][ #  # ]
    3432         [ #  # ]:          0 :                 IsXMLToken(sLocalName, XML_BIBLIOGRAPHY_TYPE)    )
    3433                 :            :             {
    3434                 :            :                 sal_uInt16 nTmp;
    3435         [ #  # ]:          0 :                 if (SvXMLUnitConverter::convertEnum(
    3436         [ #  # ]:          0 :                     nTmp, xAttrList->getValueByIndex(i),
    3437 [ #  # ][ #  # ]:          0 :                     aBibliographyDataTypeMap))
    3438                 :            :                 {
    3439         [ #  # ]:          0 :                     aAny <<= (sal_Int16)nTmp;
    3440                 :          0 :                     aValue.Value = aAny;
    3441                 :            : 
    3442         [ #  # ]:          0 :                     aValues.push_back(aValue);
    3443                 :            :                 }
    3444                 :            :             }
    3445                 :            :             else
    3446                 :            :             {
    3447 [ #  # ][ #  # ]:          0 :                 aAny <<= xAttrList->getValueByIndex(i);
                 [ #  # ]
    3448                 :          0 :                 aValue.Value = aAny;
    3449                 :            : 
    3450         [ #  # ]:          0 :                 aValues.push_back(aValue);
    3451                 :          0 :             }
    3452                 :            :         }
    3453                 :            :         // else: unknown namespace -> ignore
    3454                 :          0 :     }
    3455                 :          0 : }
    3456                 :            : 
    3457                 :          0 : void XMLBibliographyFieldImportContext::ProcessAttribute(
    3458                 :            :     sal_uInt16,
    3459                 :            :     const OUString& )
    3460                 :            : {
    3461                 :            :     // attributes are handled in StartElement
    3462                 :            :     OSL_FAIL("This should not have happened.");
    3463                 :          0 : }
    3464                 :            : 
    3465                 :            : 
    3466                 :          0 : void XMLBibliographyFieldImportContext::PrepareField(
    3467                 :            :     const Reference<XPropertySet> & xPropertySet)
    3468                 :            : {
    3469                 :            :     // convert vector into sequence
    3470                 :          0 :     sal_Int32 nCount = aValues.size();
    3471         [ #  # ]:          0 :     Sequence<PropertyValue> aValueSequence(nCount);
    3472         [ #  # ]:          0 :     for(sal_Int32 i = 0; i < nCount; i++)
    3473                 :            :     {
    3474         [ #  # ]:          0 :         aValueSequence[i] = aValues[i];
    3475                 :            :     }
    3476                 :            : 
    3477                 :            :     // set sequence
    3478                 :          0 :     Any aAny;
    3479         [ #  # ]:          0 :     aAny <<= aValueSequence;
    3480 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyFields, aAny);
                 [ #  # ]
    3481                 :          0 : }
    3482                 :            : 
    3483                 :          0 : const sal_Char* XMLBibliographyFieldImportContext::MapBibliographyFieldName(
    3484                 :            :     OUString sName)
    3485                 :            : {
    3486                 :          0 :     const sal_Char* pName = NULL;
    3487                 :            : 
    3488         [ #  # ]:          0 :     if (IsXMLToken(sName, XML_IDENTIFIER))
    3489                 :            :     {
    3490                 :          0 :         pName = "Identifier";
    3491                 :            :     }
    3492   [ #  #  #  # ]:          0 :     else if (IsXMLToken(sName, XML_BIBILIOGRAPHIC_TYPE) ||
                 [ #  # ]
    3493                 :          0 :              IsXMLToken(sName, XML_BIBLIOGRAPHY_TYPE)     )
    3494                 :            :     {
    3495                 :            :         // biblio... vs bibilio...: #96658#: also read old documents
    3496                 :          0 :         pName = "BibiliographicType";
    3497                 :            :     }
    3498         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_ADDRESS))
    3499                 :            :     {
    3500                 :          0 :         pName = "Address";
    3501                 :            :     }
    3502         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_ANNOTE))
    3503                 :            :     {
    3504                 :          0 :         pName = "Annote";
    3505                 :            :     }
    3506         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_AUTHOR))
    3507                 :            :     {
    3508                 :          0 :         pName = "Author";
    3509                 :            :     }
    3510         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_BOOKTITLE))
    3511                 :            :     {
    3512                 :          0 :         pName = "Booktitle";
    3513                 :            :     }
    3514         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_CHAPTER))
    3515                 :            :     {
    3516                 :          0 :         pName = "Chapter";
    3517                 :            :     }
    3518         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_EDITION))
    3519                 :            :     {
    3520                 :          0 :         pName = "Edition";
    3521                 :            :     }
    3522         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_EDITOR))
    3523                 :            :     {
    3524                 :          0 :         pName = "Editor";
    3525                 :            :     }
    3526         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_HOWPUBLISHED))
    3527                 :            :     {
    3528                 :          0 :         pName = "Howpublished";
    3529                 :            :     }
    3530         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_INSTITUTION))
    3531                 :            :     {
    3532                 :          0 :         pName = "Institution";
    3533                 :            :     }
    3534         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_JOURNAL))
    3535                 :            :     {
    3536                 :          0 :         pName = "Journal";
    3537                 :            :     }
    3538         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_MONTH))
    3539                 :            :     {
    3540                 :          0 :         pName = "Month";
    3541                 :            :     }
    3542         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_NOTE))
    3543                 :            :     {
    3544                 :          0 :         pName = "Note";
    3545                 :            :     }
    3546         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_NUMBER))
    3547                 :            :     {
    3548                 :          0 :         pName = "Number";
    3549                 :            :     }
    3550         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_ORGANIZATIONS))
    3551                 :            :     {
    3552                 :          0 :         pName = "Organizations";
    3553                 :            :     }
    3554         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_PAGES))
    3555                 :            :     {
    3556                 :          0 :         pName = "Pages";
    3557                 :            :     }
    3558         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_PUBLISHER))
    3559                 :            :     {
    3560                 :          0 :         pName = "Publisher";
    3561                 :            :     }
    3562         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_SCHOOL))
    3563                 :            :     {
    3564                 :          0 :         pName = "School";
    3565                 :            :     }
    3566         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_SERIES))
    3567                 :            :     {
    3568                 :          0 :         pName = "Series";
    3569                 :            :     }
    3570         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_TITLE))
    3571                 :            :     {
    3572                 :          0 :         pName = "Title";
    3573                 :            :     }
    3574         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_REPORT_TYPE))
    3575                 :            :     {
    3576                 :          0 :         pName = "Report_Type";
    3577                 :            :     }
    3578         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_VOLUME))
    3579                 :            :     {
    3580                 :          0 :         pName = "Volume";
    3581                 :            :     }
    3582         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_YEAR))
    3583                 :            :     {
    3584                 :          0 :         pName = "Year";
    3585                 :            :     }
    3586         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_URL))
    3587                 :            :     {
    3588                 :          0 :         pName = "URL";
    3589                 :            :     }
    3590         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_CUSTOM1))
    3591                 :            :     {
    3592                 :          0 :         pName = "Custom1";
    3593                 :            :     }
    3594         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_CUSTOM2))
    3595                 :            :     {
    3596                 :          0 :         pName = "Custom2";
    3597                 :            :     }
    3598         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_CUSTOM3))
    3599                 :            :     {
    3600                 :          0 :         pName = "Custom3";
    3601                 :            :     }
    3602         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_CUSTOM4))
    3603                 :            :     {
    3604                 :          0 :         pName = "Custom4";
    3605                 :            :     }
    3606         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_CUSTOM5))
    3607                 :            :     {
    3608                 :          0 :         pName = "Custom5";
    3609                 :            :     }
    3610         [ #  # ]:          0 :     else if (IsXMLToken(sName, XML_ISBN))
    3611                 :            :     {
    3612                 :          0 :         pName = "ISBN";
    3613                 :            :     }
    3614                 :            :     else
    3615                 :            :     {
    3616                 :            :         OSL_FAIL("Unknown bibliography info data");
    3617                 :          0 :         pName = NULL;
    3618                 :            :     }
    3619                 :            : 
    3620                 :          0 :     return pName;
    3621                 :            : }
    3622                 :            : 
    3623                 :            : 
    3624                 :            : //
    3625                 :            : // Annotation Field
    3626                 :            : //
    3627                 :            : 
    3628 [ #  # ][ #  # ]:          0 : TYPEINIT1(XMLAnnotationImportContext, XMLTextFieldImportContext);
    3629                 :            : 
    3630                 :         12 : XMLAnnotationImportContext::XMLAnnotationImportContext(
    3631                 :            :     SvXMLImport& rImport,
    3632                 :            :     XMLTextImportHelper& rHlp,
    3633                 :            :     sal_uInt16 nToken,
    3634                 :            :     sal_uInt16 nPrfx,
    3635                 :            :     const OUString& sLocalName) :
    3636                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_annotation,
    3637                 :            :                                   nPrfx, sLocalName),
    3638                 :            :         sPropertyAuthor(sAPI_author),
    3639                 :            :         sPropertyInitials(sAPI_initials),
    3640                 :            :         sPropertyContent(sAPI_content),
    3641                 :            :         // why is there no UNO_NAME_DATE_TIME, but only UNO_NAME_DATE_TIME_VALUE?
    3642                 :            :         sPropertyDate(sAPI_date_time_value),
    3643                 :            :         sPropertyTextRange(sAPI_TextRange),
    3644                 :            :         sPropertyName(sAPI_name),
    3645                 :         12 :         m_nToken(nToken)
    3646                 :            : {
    3647                 :         12 :     bValid = sal_True;
    3648                 :            : 
    3649                 :            :     // remember old list item and block (#91964#) and reset them
    3650                 :            :     // for the text frame
    3651                 :            :     // do this in the constructor, not in CreateChildContext (#i93392#)
    3652 [ +  - ][ +  - ]:         12 :     GetImport().GetTextImport()->PushListContext();
         [ +  - ][ +  - ]
    3653                 :         12 : }
    3654                 :            : 
    3655                 :         12 : void XMLAnnotationImportContext::ProcessAttribute(
    3656                 :            :     sal_uInt16 nToken,
    3657                 :            :     const OUString& rValue )
    3658                 :            : {
    3659         [ +  - ]:         12 :     if (nToken == XML_TOK_TEXT_NAME)
    3660                 :         12 :         aName = rValue;
    3661                 :         12 : }
    3662                 :            : 
    3663                 :         24 : SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext(
    3664                 :            :     sal_uInt16 nPrefix,
    3665                 :            :     const OUString& rLocalName,
    3666                 :            :     const Reference<XAttributeList >& xAttrList )
    3667                 :            : {
    3668                 :         24 :     SvXMLImportContext *pContext = 0;
    3669         [ +  + ]:         24 :     if( XML_NAMESPACE_DC == nPrefix )
    3670                 :            :     {
    3671         [ +  + ]:         12 :         if( IsXMLToken( rLocalName, XML_CREATOR ) )
    3672                 :          6 :             pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
    3673         [ +  - ]:          6 :                                             rLocalName, aAuthorBuffer);
    3674         [ +  - ]:          6 :         else if( IsXMLToken( rLocalName, XML_DATE ) )
    3675                 :          6 :             pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
    3676         [ +  - ]:          6 :                                             rLocalName, aDateBuffer);
    3677                 :            :     }
    3678         [ +  - ]:         12 :     else if( XML_NAMESPACE_TEXT == nPrefix )
    3679                 :            :     {
    3680         [ +  + ]:         12 :         if( IsXMLToken( rLocalName, XML_SENDER_INITIALS ) )
    3681                 :          6 :             pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
    3682         [ +  - ]:          6 :                                             rLocalName, aInitialsBuffer);
    3683                 :            :     }
    3684                 :            : 
    3685         [ +  + ]:         24 :     if( !pContext )
    3686                 :            :     {
    3687                 :            :         try
    3688                 :            :         {
    3689         [ +  - ]:          6 :             if ( !mxField.is() )
    3690         [ +  - ]:          6 :                 CreateField( mxField, sServicePrefix + GetServiceName() );
    3691 [ +  - ][ +  - ]:          6 :             Any aAny = mxField->getPropertyValue( sPropertyTextRange );
    3692                 :          6 :             Reference< XText > xText;
    3693         [ +  - ]:          6 :             aAny >>= xText;
    3694         [ +  - ]:          6 :             if( xText.is() )
    3695                 :            :             {
    3696         [ +  - ]:          6 :                 UniReference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport();
    3697         [ +  - ]:          6 :                 if( !mxCursor.is() )
    3698                 :            :                 {
    3699 [ +  - ][ +  - ]:          6 :                     mxOldCursor = xTxtImport->GetCursor();
                 [ +  - ]
    3700 [ +  - ][ +  - ]:          6 :                     mxCursor = xText->createTextCursor();
                 [ +  - ]
    3701                 :            :                 }
    3702                 :            : 
    3703         [ +  - ]:          6 :                 if( mxCursor.is() )
    3704                 :            :                 {
    3705 [ +  - ][ +  - ]:          6 :                     xTxtImport->SetCursor( mxCursor );
    3706 [ +  - ][ +  - ]:          6 :                     pContext = xTxtImport->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
    3707         [ +  - ]:          6 :                 }
    3708         [ #  # ]:          6 :             }
    3709                 :            :         }
    3710                 :          0 :         catch (const Exception&)
    3711                 :            :         {
    3712                 :            :         }
    3713                 :            : 
    3714         [ -  + ]:          6 :         if( !pContext )
    3715         [ #  # ]:          0 :             pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,  rLocalName, aTextBuffer);
    3716                 :            :     }
    3717                 :            : 
    3718                 :         24 :     return pContext;
    3719                 :            : }
    3720                 :            : 
    3721                 :         12 : void XMLAnnotationImportContext::EndElement()
    3722                 :            : {
    3723                 :            :     DBG_ASSERT(!GetServiceName().isEmpty(), "no service name for element!");
    3724         [ +  + ]:         12 :     if( mxCursor.is() )
    3725                 :            :     {
    3726                 :            :         // delete addition newline
    3727                 :          6 :         const OUString aEmpty;
    3728 [ +  - ][ +  - ]:          6 :         mxCursor->gotoEnd( sal_False );
    3729 [ +  - ][ +  - ]:          6 :         mxCursor->goLeft( 1, sal_True );
    3730 [ +  - ][ +  - ]:          6 :         mxCursor->setString( aEmpty );
    3731                 :            : 
    3732                 :            :         // reset cursor
    3733 [ +  - ][ +  - ]:          6 :         GetImport().GetTextImport()->ResetCursor();
         [ +  - ][ +  - ]
    3734                 :            :     }
    3735                 :            : 
    3736         [ +  + ]:         12 :     if( mxOldCursor.is() )
    3737 [ +  - ][ +  - ]:          6 :         GetImport().GetTextImport()->SetCursor( mxOldCursor );
    3738                 :            : 
    3739                 :            :     // reinstall old list item #91964#
    3740 [ +  - ][ +  - ]:         12 :     GetImport().GetTextImport()->PopListContext();
    3741                 :            : 
    3742         [ +  - ]:         12 :     if ( bValid )
    3743                 :            :     {
    3744 [ +  + ][ +  - ]:         12 :         if ( mxField.is() || CreateField( mxField, sServicePrefix + GetServiceName() ) )
         [ +  - ][ +  + ]
         [ +  + ][ +  -  
             #  #  #  # ]
    3745                 :            :         {
    3746                 :            :             // set field properties
    3747         [ +  - ]:         12 :             PrepareField( mxField );
    3748                 :            : 
    3749                 :            :             // attach field to document
    3750         [ +  - ]:         12 :             Reference < XTextContent > xTextContent( mxField, UNO_QUERY );
    3751                 :            : 
    3752                 :            :             // workaround for #80606#
    3753                 :            :             try
    3754                 :            :             {
    3755 [ +  + ][ +  - ]:         12 :                 if (m_nToken == XML_TOK_TEXT_ANNOTATION_END && m_xStart.is())
                 [ +  + ]
    3756                 :            :                 {
    3757                 :            :                     // So we are ending a previous annotation, let's create a
    3758                 :            :                     // text range covering the old and the current position.
    3759         [ +  - ]:          6 :                     uno::Reference<text::XText> xText = GetImportHelper().GetText();
    3760 [ +  - ][ +  - ]:          6 :                     uno::Reference<text::XTextCursor> xCursor = xText->createTextCursorByRange(m_xStart->getAnchor());
         [ +  - ][ +  - ]
    3761 [ +  - ][ +  - ]:          6 :                     xCursor->gotoRange(GetImportHelper().GetCursorAsRange(), true);
                 [ +  - ]
    3762         [ +  - ]:          6 :                     uno::Reference<text::XTextRange> xTextRange(xCursor, uno::UNO_QUERY);
    3763 [ +  - ][ +  - ]:          6 :                     xText->insertTextContent(xTextRange, xTextContent, !xCursor->isCollapsed());
         [ +  - ][ +  - ]
    3764                 :            : 
    3765                 :            :                     // Now we can delete the old annotation with the incorrect position.
    3766 [ +  - ][ +  - ]:          6 :                     uno::Reference<lang::XComponent>(m_xStart, uno::UNO_QUERY)->dispose();
         [ +  - ][ #  # ]
    3767                 :            :                 }
    3768                 :            :                 else
    3769         [ +  - ]:          6 :                     GetImportHelper().InsertTextContent( xTextContent );
    3770                 :            :             }
    3771         [ #  # ]:          0 :             catch (const lang::IllegalArgumentException&)
    3772                 :            :             {
    3773                 :            :                 // ignore
    3774                 :         12 :             }
    3775                 :            :         }
    3776                 :            :     }
    3777                 :            :     else
    3778         [ #  # ]:          0 :         GetImportHelper().InsertString(GetContent());
    3779                 :         12 : }
    3780                 :            : 
    3781                 :         12 : void XMLAnnotationImportContext::PrepareField(
    3782                 :            :     const Reference<XPropertySet> & xPropertySet)
    3783                 :            : {
    3784 [ +  + ][ +  - ]:         12 :     if (m_nToken == XML_TOK_TEXT_ANNOTATION_END && !aName.isEmpty())
                 [ +  + ]
    3785                 :            :     {
    3786                 :            :         // Search for a previous annotation with the same name.
    3787         [ +  - ]:          6 :         Reference<XTextFieldsSupplier> xTextFieldsSupplier(GetImport().GetModel(), UNO_QUERY);
    3788 [ +  - ][ +  - ]:          6 :         uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
    3789 [ +  - ][ +  - ]:          6 :         uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
    3790                 :          6 :         uno::Reference<beans::XPropertySet> xPrevField;
    3791 [ +  - ][ +  - ]:          6 :         while (xFields->hasMoreElements())
                 [ +  - ]
    3792                 :            :         {
    3793 [ +  - ][ +  - ]:          6 :             uno::Reference<beans::XPropertySet> xCurrField(xFields->nextElement(), uno::UNO_QUERY);
                 [ +  - ]
    3794                 :          6 :             OUString aFieldName;
    3795 [ +  - ][ +  - ]:          6 :             xCurrField->getPropertyValue(sPropertyName) >>= aFieldName;
    3796         [ +  - ]:          6 :             if (aFieldName == aName)
    3797                 :            :             {
    3798         [ +  - ]:          6 :                 xPrevField = xCurrField;
    3799                 :            :                 break;
    3800                 :            :             }
    3801 [ +  - ][ -  + ]:          6 :         }
    3802         [ +  - ]:          6 :         if (xPrevField.is())
    3803                 :            :         {
    3804                 :            :             // Found? Then copy over the properties.
    3805 [ +  - ][ +  - ]:          6 :             xPropertySet->setPropertyValue(sPropertyAuthor, xPrevField->getPropertyValue(sPropertyAuthor));
         [ +  - ][ +  - ]
    3806 [ +  - ][ +  - ]:          6 :             xPropertySet->setPropertyValue(sPropertyInitials, xPrevField->getPropertyValue(sPropertyInitials));
         [ +  - ][ +  - ]
    3807 [ +  - ][ +  - ]:          6 :             xPropertySet->setPropertyValue(sPropertyDate, xPrevField->getPropertyValue(sPropertyDate));
         [ +  - ][ +  - ]
    3808 [ +  - ][ +  - ]:          6 :             xPropertySet->setPropertyValue(sPropertyName, xPrevField->getPropertyValue(sPropertyName));
         [ +  - ][ +  - ]
    3809 [ +  - ][ +  - ]:          6 :             xPropertySet->setPropertyValue(sPropertyContent, xPrevField->getPropertyValue(sPropertyContent));
         [ +  - ][ +  - ]
    3810                 :            : 
    3811                 :            :             // And save a reference to it, so we can delete it later.
    3812         [ +  - ]:          6 :             m_xStart.set(xPrevField, uno::UNO_QUERY);
    3813                 :         12 :             return;
    3814 [ +  - ][ +  - ]:          6 :         }
         [ +  - ][ -  + ]
    3815                 :            :     }
    3816                 :            : 
    3817                 :            :     // import (possibly empty) author
    3818         [ +  - ]:          6 :     OUString sAuthor( aAuthorBuffer.makeStringAndClear() );
    3819 [ +  - ][ +  - ]:          6 :     xPropertySet->setPropertyValue(sPropertyAuthor, makeAny(sAuthor));
                 [ +  - ]
    3820                 :            : 
    3821                 :            :     // import (possibly empty) initials
    3822         [ +  - ]:          6 :     OUString sInitials( aInitialsBuffer.makeStringAndClear() );
    3823 [ +  - ][ +  - ]:          6 :     xPropertySet->setPropertyValue(sPropertyInitials, makeAny(sInitials));
                 [ +  - ]
    3824                 :            : 
    3825                 :          6 :     DateTime aDateTime;
    3826   [ +  -  +  - ]:         12 :     if (::sax::Converter::convertDateTime(aDateTime,
    3827         [ +  - ]:         12 :                                             aDateBuffer.makeStringAndClear()))
    3828                 :            :     {
    3829                 :            :         /*
    3830                 :            :         Date aDate;
    3831                 :            :         aDate.Year = aDateTime.Year;
    3832                 :            :         aDate.Month = aDateTime.Month;
    3833                 :            :         aDate.Day = aDateTime.Day;
    3834                 :            :         xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDate));
    3835                 :            :         */
    3836 [ +  - ][ +  - ]:          6 :         xPropertySet->setPropertyValue(sPropertyDate, makeAny(aDateTime));
                 [ +  - ]
    3837                 :            :     }
    3838                 :            : 
    3839         [ +  - ]:          6 :     OUString sBuffer = aTextBuffer.makeStringAndClear();
    3840         [ -  + ]:          6 :     if ( sBuffer.getLength() )
    3841                 :            :     {
    3842                 :            :         // delete last paragraph mark (if necessary)
    3843         [ #  # ]:          0 :         if (sal_Char(0x0a) == sBuffer.getStr()[sBuffer.getLength()-1])
    3844                 :          0 :             sBuffer = sBuffer.copy(0, sBuffer.getLength()-1);
    3845 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue(sPropertyContent, makeAny(sBuffer));
                 [ #  # ]
    3846                 :            :     }
    3847                 :            : 
    3848         [ +  - ]:          6 :     if (!aName.isEmpty())
    3849 [ +  - ][ +  - ]:          6 :         xPropertySet->setPropertyValue(sPropertyName, makeAny(aName));
                 [ +  - ]
    3850                 :            : }
    3851                 :            : 
    3852                 :            : 
    3853                 :            : 
    3854                 :            : //
    3855                 :            : // script field
    3856                 :            : //
    3857                 :            : 
    3858 [ #  # ][ #  # ]:          0 : TYPEINIT1(XMLScriptImportContext, XMLTextFieldImportContext);
    3859                 :            : 
    3860                 :          0 : XMLScriptImportContext::XMLScriptImportContext(
    3861                 :            :     SvXMLImport& rImport,
    3862                 :            :     XMLTextImportHelper& rHlp,
    3863                 :            :     sal_uInt16 nPrfx,
    3864                 :            :     const OUString& sLocalName)
    3865                 :            : :   XMLTextFieldImportContext(rImport, rHlp, sAPI_script, nPrfx, sLocalName)
    3866                 :            : ,   sPropertyScriptType(sAPI_script_type)
    3867                 :            : ,   sPropertyURLContent(sAPI_url_content)
    3868                 :            : ,   sPropertyContent(sAPI_content)
    3869                 :            : ,   bContentOK(sal_False)
    3870                 :          0 : ,   bScriptTypeOK(sal_False)
    3871                 :            : {
    3872                 :          0 : }
    3873                 :            : 
    3874                 :          0 : void XMLScriptImportContext::ProcessAttribute(
    3875                 :            :     sal_uInt16 nAttrToken,
    3876                 :            :     const OUString& sAttrValue )
    3877                 :            : {
    3878      [ #  #  # ]:          0 :     switch (nAttrToken)
    3879                 :            :     {
    3880                 :            :         case XML_TOK_TEXTFIELD_HREF:
    3881                 :          0 :             sContent = GetImport().GetAbsoluteReference( sAttrValue );
    3882                 :          0 :             bContentOK = sal_True;
    3883                 :          0 :             break;
    3884                 :            : 
    3885                 :            :         case XML_TOK_TEXTFIELD_LANGUAGE:
    3886                 :          0 :             sScriptType = sAttrValue;
    3887                 :          0 :             bScriptTypeOK = sal_True;
    3888                 :          0 :             break;
    3889                 :            : 
    3890                 :            :         default:
    3891                 :            :             // ignore
    3892                 :          0 :             break;
    3893                 :            :     }
    3894                 :            : 
    3895                 :            :     // always valid (even without ScriptType; cf- #96531#)
    3896                 :          0 :     bValid = sal_True;
    3897                 :          0 : }
    3898                 :            : 
    3899                 :          0 : void XMLScriptImportContext::PrepareField(
    3900                 :            :     const Reference<XPropertySet> & xPropertySet)
    3901                 :            : {
    3902                 :          0 :     Any aAny;
    3903                 :            : 
    3904                 :            :     // if href attribute was present, we use it. Else we use element content
    3905         [ #  # ]:          0 :     if (! bContentOK)
    3906                 :            :     {
    3907         [ #  # ]:          0 :         sContent = GetContent();
    3908                 :            :     }
    3909         [ #  # ]:          0 :     aAny <<= sContent;
    3910 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyContent, aAny);
    3911                 :            : 
    3912                 :            :     // URL or script text? We use URL if we have an href-attribute
    3913         [ #  # ]:          0 :     aAny.setValue(&bContentOK, ::getBooleanCppuType());
    3914 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyURLContent, aAny);
    3915                 :            : 
    3916         [ #  # ]:          0 :     aAny <<= sScriptType;
    3917 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(sPropertyScriptType, aAny);
    3918                 :          0 : }
    3919                 :            : 
    3920                 :            : //
    3921                 :            : // measure field
    3922                 :            : //
    3923                 :            : 
    3924 [ #  # ][ #  # ]:          0 : TYPEINIT1(XMLMeasureFieldImportContext, XMLTextFieldImportContext);
    3925                 :            : 
    3926                 :          0 : XMLMeasureFieldImportContext::XMLMeasureFieldImportContext(
    3927                 :            :     SvXMLImport& rImport,
    3928                 :            :     XMLTextImportHelper& rHlp,
    3929                 :            :     sal_uInt16 nPrfx,
    3930                 :            :     const OUString& sLocalName) :
    3931                 :            :         XMLTextFieldImportContext(rImport, rHlp, sAPI_measure,
    3932                 :            :                                   nPrfx, sLocalName),
    3933                 :          0 :         mnKind( 0 )
    3934                 :            : {
    3935                 :          0 : }
    3936                 :            : 
    3937                 :          0 : void XMLMeasureFieldImportContext::ProcessAttribute(
    3938                 :            :     sal_uInt16 nAttrToken,
    3939                 :            :     const OUString& sAttrValue )
    3940                 :            : {
    3941         [ #  # ]:          0 :     switch (nAttrToken)
    3942                 :            :     {
    3943                 :            :         case XML_TOK_TEXTFIELD_MEASURE_KIND:
    3944         [ #  # ]:          0 :             if( IsXMLToken( sAttrValue, XML_VALUE ) )
    3945                 :            :             {
    3946                 :          0 :                 mnKind = 0; bValid = sal_True;
    3947                 :            :             }
    3948         [ #  # ]:          0 :             else if( IsXMLToken( sAttrValue, XML_UNIT ) )
    3949                 :            :             {
    3950                 :          0 :                 mnKind = 1; bValid = sal_True;
    3951                 :            :             }
    3952         [ #  # ]:          0 :             else if( IsXMLToken( sAttrValue, XML_GAP ) )
    3953                 :            :             {
    3954                 :          0 :                 mnKind = 2; bValid = sal_True;
    3955                 :            :             }
    3956                 :          0 :             break;
    3957                 :            :     }
    3958                 :          0 : }
    3959                 :            : 
    3960                 :          0 : void XMLMeasureFieldImportContext::PrepareField(
    3961                 :            :     const Reference<XPropertySet> & xPropertySet)
    3962                 :            : {
    3963                 :          0 :     Any aAny;
    3964         [ #  # ]:          0 :     aAny <<= mnKind;
    3965 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue(OUString("Kind"), aAny);
    3966                 :          0 : }
    3967                 :            : 
    3968                 :            : 
    3969                 :            : 
    3970                 :            : //
    3971                 :            : // dropdown field
    3972                 :            : //
    3973                 :            : 
    3974                 :            : 
    3975 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDropDownFieldImportContext, XMLTextFieldImportContext );
    3976                 :            : 
    3977                 :          0 : XMLDropDownFieldImportContext::XMLDropDownFieldImportContext(
    3978                 :            :         SvXMLImport& rImport,
    3979                 :            :         XMLTextImportHelper& rHlp,
    3980                 :            :         sal_uInt16 nPrfx,
    3981                 :            :         const ::rtl::OUString& sLocalName) :
    3982                 :            :     XMLTextFieldImportContext( rImport, rHlp, sAPI_drop_down,
    3983                 :            :                                nPrfx, sLocalName ),
    3984                 :            :     aLabels(),
    3985                 :            :     sName(),
    3986                 :            :     nSelected( -1 ),
    3987                 :            :     bNameOK( false ),
    3988                 :            :     bHelpOK(false),
    3989                 :            :     bHintOK(false),
    3990                 :            :     sPropertyItems( "Items"  ),
    3991                 :            :     sPropertySelectedItem( "SelectedItem"  ),
    3992                 :            :     sPropertyName( "Name"  ),
    3993                 :            :     sPropertyHelp( "Help"  ),
    3994         [ #  # ]:          0 :     sPropertyToolTip( "Tooltip"  )
    3995                 :            : {
    3996                 :          0 :     bValid = sal_True;
    3997                 :          0 : }
    3998                 :            : 
    3999                 :          0 : bool lcl_ProcessLabel( const SvXMLImport& rImport,
    4000                 :            :                        const Reference<XAttributeList>& xAttrList,
    4001                 :            :                        OUString& rLabel,
    4002                 :            :                        bool& rIsSelected )
    4003                 :            : {
    4004                 :          0 :     bool bValid = false;
    4005                 :          0 :     sal_Int16 nLength = xAttrList->getLength();
    4006         [ #  # ]:          0 :     for( sal_Int16 n = 0; n < nLength; n++ )
    4007                 :            :     {
    4008                 :          0 :         OUString sLocalName;
    4009                 :          0 :         sal_uInt16 nPrefix = rImport.GetNamespaceMap().
    4010   [ #  #  #  # ]:          0 :             GetKeyByAttrName( xAttrList->getNameByIndex(n), &sLocalName );
                 [ #  # ]
    4011 [ #  # ][ #  # ]:          0 :         OUString sValue = xAttrList->getValueByIndex(n);
    4012                 :            : 
    4013         [ #  # ]:          0 :         if( nPrefix == XML_NAMESPACE_TEXT )
    4014                 :            :         {
    4015 [ #  # ][ #  # ]:          0 :             if( IsXMLToken( sLocalName, XML_VALUE ) )
    4016                 :            :             {
    4017                 :          0 :                 rLabel = sValue;
    4018                 :          0 :                 bValid = true;
    4019                 :            :             }
    4020 [ #  # ][ #  # ]:          0 :             else if( IsXMLToken( sLocalName, XML_CURRENT_SELECTED ) )
    4021                 :            :             {
    4022                 :          0 :                 bool bTmp(false);
    4023 [ #  # ][ #  # ]:          0 :                 if (::sax::Converter::convertBool( bTmp, sValue ))
    4024                 :          0 :                     rIsSelected = bTmp;
    4025                 :            :             }
    4026                 :            :         }
    4027                 :          0 :     }
    4028                 :          0 :     return bValid;
    4029                 :            : }
    4030                 :            : 
    4031                 :          0 : SvXMLImportContext* XMLDropDownFieldImportContext::CreateChildContext(
    4032                 :            :     sal_uInt16 nPrefix,
    4033                 :            :     const OUString& rLocalName,
    4034                 :            :     const Reference<XAttributeList>& xAttrList )
    4035                 :            : {
    4036   [ #  #  #  # ]:          0 :     if( nPrefix == XML_NAMESPACE_TEXT  &&
                 [ #  # ]
    4037                 :          0 :         IsXMLToken( rLocalName, XML_LABEL ) )
    4038                 :            :     {
    4039                 :          0 :         OUString sLabel;
    4040                 :          0 :         bool bIsSelected = sal_False;
    4041 [ #  # ][ #  # ]:          0 :         if( lcl_ProcessLabel( GetImport(), xAttrList, sLabel, bIsSelected ) )
    4042                 :            :         {
    4043         [ #  # ]:          0 :             if( bIsSelected )
    4044                 :          0 :                 nSelected = static_cast<sal_Int32>( aLabels.size() );
    4045         [ #  # ]:          0 :             aLabels.push_back( sLabel );
    4046                 :          0 :         }
    4047                 :            :     }
    4048         [ #  # ]:          0 :     return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
    4049                 :            : }
    4050                 :            : 
    4051                 :          0 : void XMLDropDownFieldImportContext::ProcessAttribute(
    4052                 :            :     sal_uInt16 nAttrToken,
    4053                 :            :     const ::rtl::OUString& sAttrValue )
    4054                 :            : {
    4055         [ #  # ]:          0 :     if( nAttrToken == XML_TOK_TEXTFIELD_NAME )
    4056                 :            :     {
    4057                 :          0 :         sName = sAttrValue;
    4058                 :          0 :         bNameOK = true;
    4059                 :            :     }
    4060         [ #  # ]:          0 :     else if (nAttrToken == XML_TOK_TEXTFIELD_HELP)
    4061                 :            :     {
    4062                 :          0 :         sHelp = sAttrValue;
    4063                 :          0 :         bHelpOK = true;
    4064                 :            :     }
    4065         [ #  # ]:          0 :     else if (nAttrToken == XML_TOK_TEXTFIELD_HINT)
    4066                 :            :     {
    4067                 :          0 :         sHint = sAttrValue;
    4068                 :          0 :         bHintOK = true;
    4069                 :            :     }
    4070                 :          0 : }
    4071                 :            : 
    4072                 :          0 : void XMLDropDownFieldImportContext::PrepareField(
    4073                 :            :     const Reference<XPropertySet>& xPropertySet)
    4074                 :            : {
    4075                 :            :     // create sequence
    4076                 :          0 :     sal_Int32 nLength = static_cast<sal_Int32>( aLabels.size() );
    4077         [ #  # ]:          0 :     Sequence<OUString> aSequence( nLength );
    4078         [ #  # ]:          0 :     OUString* pSequence = aSequence.getArray();
    4079         [ #  # ]:          0 :     for( sal_Int32 n = 0; n < nLength; n++ )
    4080                 :          0 :         pSequence[n] = aLabels[n];
    4081                 :            : 
    4082                 :            :     // now set values:
    4083                 :          0 :     Any aAny;
    4084                 :            : 
    4085         [ #  # ]:          0 :     aAny <<= aSequence;
    4086 [ #  # ][ #  # ]:          0 :     xPropertySet->setPropertyValue( sPropertyItems, aAny );
    4087                 :            : 
    4088 [ #  # ][ #  # ]:          0 :     if( nSelected >= 0  &&  nSelected < nLength )
    4089                 :            :     {
    4090         [ #  # ]:          0 :         aAny <<= pSequence[nSelected];
    4091 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue( sPropertySelectedItem, aAny );
    4092                 :            :     }
    4093                 :            : 
    4094                 :            :     // set name
    4095         [ #  # ]:          0 :     if( bNameOK )
    4096                 :            :     {
    4097         [ #  # ]:          0 :         aAny <<= sName;
    4098 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue( sPropertyName, aAny );
    4099                 :            :     }
    4100                 :            :     // set help
    4101         [ #  # ]:          0 :     if( bHelpOK )
    4102                 :            :     {
    4103         [ #  # ]:          0 :         aAny <<= sHelp;
    4104 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue( sPropertyHelp, aAny );
    4105                 :            :     }
    4106                 :            :     // set hint
    4107         [ #  # ]:          0 :     if( bHintOK )
    4108                 :            :     {
    4109         [ #  # ]:          0 :         aAny <<= sHint;
    4110 [ #  # ][ #  # ]:          0 :         xPropertySet->setPropertyValue( sPropertyToolTip, aAny );
    4111         [ #  # ]:          0 :     }
    4112                 :            : 
    4113                 :          0 : }
    4114                 :            : 
    4115                 :            : /** import header fields (<draw:header>) */
    4116 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLHeaderFieldImportContext, XMLTextFieldImportContext );
    4117                 :            : 
    4118                 :         10 : XMLHeaderFieldImportContext::XMLHeaderFieldImportContext(
    4119                 :            :         SvXMLImport& rImport,                   /// XML Import
    4120                 :            :         XMLTextImportHelper& rHlp,              /// Text import helper
    4121                 :            :         sal_uInt16 nPrfx,                       /// namespace prefix
    4122                 :            :         const ::rtl::OUString& sLocalName)      /// element name w/o prefix
    4123                 :         10 : : XMLTextFieldImportContext(rImport, rHlp, sAPI_header, nPrfx, sLocalName )
    4124                 :            : {
    4125                 :         10 :     sServicePrefix = OUString(sAPI_presentation_prefix );
    4126                 :         10 :     bValid = sal_True;
    4127                 :         10 : }
    4128                 :            : 
    4129                 :            : /// process attribute values
    4130                 :          0 : void XMLHeaderFieldImportContext::ProcessAttribute( sal_uInt16, const ::rtl::OUString& )
    4131                 :            : {
    4132                 :          0 : }
    4133                 :            : 
    4134                 :            : /// prepare XTextField for insertion into document
    4135                 :         10 : void XMLHeaderFieldImportContext::PrepareField(const Reference<XPropertySet> &)
    4136                 :            : {
    4137                 :         10 : }
    4138                 :            : 
    4139                 :            : /** import footer fields (<draw:footer>) */
    4140 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLFooterFieldImportContext, XMLTextFieldImportContext );
    4141                 :            : 
    4142                 :         15 : XMLFooterFieldImportContext::XMLFooterFieldImportContext(
    4143                 :            :         SvXMLImport& rImport,                   /// XML Import
    4144                 :            :         XMLTextImportHelper& rHlp,              /// Text import helper
    4145                 :            :         sal_uInt16 nPrfx,                       /// namespace prefix
    4146                 :            :         const ::rtl::OUString& sLocalName)      /// element name w/o prefix
    4147                 :         15 : : XMLTextFieldImportContext(rImport, rHlp, sAPI_footer, nPrfx, sLocalName )
    4148                 :            : {
    4149                 :         15 :     sServicePrefix = OUString(sAPI_presentation_prefix );
    4150                 :         15 :     bValid = sal_True;
    4151                 :         15 : }
    4152                 :            : 
    4153                 :            : /// process attribute values
    4154                 :          0 : void XMLFooterFieldImportContext::ProcessAttribute( sal_uInt16, const ::rtl::OUString& )
    4155                 :            : {
    4156                 :          0 : }
    4157                 :            : 
    4158                 :            : /// prepare XTextField for insertion into document
    4159                 :         15 : void XMLFooterFieldImportContext::PrepareField(const Reference<XPropertySet> &)
    4160                 :            : {
    4161                 :         15 : }
    4162                 :            : 
    4163                 :            : 
    4164                 :            : /** import footer fields (<draw:date-and-time>) */
    4165 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLDateTimeFieldImportContext, XMLTextFieldImportContext );
    4166                 :            : 
    4167                 :         15 : XMLDateTimeFieldImportContext::XMLDateTimeFieldImportContext(
    4168                 :            :         SvXMLImport& rImport,                   /// XML Import
    4169                 :            :         XMLTextImportHelper& rHlp,              /// Text import helper
    4170                 :            :         sal_uInt16 nPrfx,                       /// namespace prefix
    4171                 :            :         const ::rtl::OUString& sLocalName)      /// element name w/o prefix
    4172                 :         15 : : XMLTextFieldImportContext(rImport, rHlp, sAPI_datetime, nPrfx, sLocalName )
    4173                 :            : {
    4174                 :         15 :     sServicePrefix = OUString(sAPI_presentation_prefix );
    4175                 :         15 :     bValid = sal_True;
    4176                 :         15 : }
    4177                 :            : 
    4178                 :            : /// process attribute values
    4179                 :          0 : void XMLDateTimeFieldImportContext::ProcessAttribute( sal_uInt16,
    4180                 :            :                                    const ::rtl::OUString& )
    4181                 :            : {
    4182                 :          0 : }
    4183                 :            : 
    4184                 :            : /// prepare XTextField for insertion into document
    4185                 :         15 : void XMLDateTimeFieldImportContext::PrepareField(
    4186                 :            :         const ::com::sun::star::uno::Reference<
    4187                 :            :         ::com::sun::star::beans::XPropertySet> &)
    4188                 :            : {
    4189                 :         15 : }
    4190                 :            : 
    4191                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10