LCOV - code coverage report
Current view: top level - xmloff/source/text - txtparai.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 404 825 49.0 %
Date: 2012-08-25 Functions: 53 175 30.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 482 1653 29.2 %

           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                 :            : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
      30                 :            : #include <rtl/ustring.hxx>
      31                 :            : #include <rtl/ustrbuf.hxx>
      32                 :            : #include <tools/debug.hxx>
      33                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      34                 :            : 
      35                 :            : #include <com/sun/star/text/XTextFrame.hpp>
      36                 :            : #include <com/sun/star/text/XTextCursor.hpp>
      37                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      38                 :            : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      39                 :            : #include <com/sun/star/text/ControlCharacter.hpp>
      40                 :            : #include <com/sun/star/container/XIndexReplace.hpp>
      41                 :            : #include <com/sun/star/drawing/XShapes.hpp>
      42                 :            : #include <com/sun/star/container/XEnumerationAccess.hpp>
      43                 :            : #include <com/sun/star/rdf/XMetadatable.hpp>
      44                 :            : 
      45                 :            : #include <sax/tools/converter.hxx>
      46                 :            : 
      47                 :            : #include <xmloff/xmlictxt.hxx>
      48                 :            : #include <xmloff/xmlimp.hxx>
      49                 :            : #include <xmloff/xmltoken.hxx>
      50                 :            : #include <xmloff/nmspmap.hxx>
      51                 :            : #include "xmloff/xmlnmspe.hxx"
      52                 :            : #include <xmloff/txtimp.hxx>
      53                 :            : #include "txtparai.hxx"
      54                 :            : #include "txtfldi.hxx"
      55                 :            : #include "XMLFootnoteImportContext.hxx"
      56                 :            : #include "XMLTextMarkImportContext.hxx"
      57                 :            : #include "XMLTextFrameContext.hxx"
      58                 :            : #include <xmloff/XMLCharContext.hxx>
      59                 :            : #include "XMLTextFrameHyperlinkContext.hxx"
      60                 :            : #include <xmloff/XMLEventsImportContext.hxx>
      61                 :            : #include "XMLChangeImportContext.hxx"
      62                 :            : #include "txtlists.hxx"
      63                 :            : 
      64                 :            : 
      65                 :            : // OD 2004-04-21 #i26791#
      66                 :            : #include <txtparaimphint.hxx>
      67                 :       1422 : class XMLHints_Impl : public boost::ptr_vector<XMLHint_Impl> {};
      68                 :            : // OD 2004-04-21 #i26791#
      69                 :            : 
      70                 :            : using ::rtl::OUString;
      71                 :            : using ::rtl::OUStringBuffer;
      72                 :            : 
      73                 :            : using namespace ::com::sun::star;
      74                 :            : using namespace ::com::sun::star::uno;
      75                 :            : using namespace ::com::sun::star::text;
      76                 :            : using namespace ::com::sun::star::drawing;
      77                 :            : using namespace ::com::sun::star::beans;
      78                 :            : using namespace ::xmloff::token;
      79                 :            : using ::com::sun::star::container::XEnumerationAccess;
      80                 :            : using ::com::sun::star::container::XEnumeration;
      81                 :            : 
      82                 :            : 
      83 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLCharContext, SvXMLImportContext );
      84                 :            : 
      85                 :         21 : XMLCharContext::XMLCharContext(
      86                 :            :         SvXMLImport& rImport,
      87                 :            :         sal_uInt16 nPrfx,
      88                 :            :         const OUString& rLName,
      89                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList,
      90                 :            :         sal_Unicode c,
      91                 :            :         sal_Bool bCount ) :
      92                 :            :     SvXMLImportContext( rImport, nPrfx, rLName )
      93                 :            :     ,m_nControl(0)
      94                 :            :     ,m_nCount(1)
      95                 :         21 :     ,m_c(c)
      96                 :            : {
      97         [ +  + ]:         21 :     if( bCount )
      98                 :            :     {
      99                 :         19 :         const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
     100 [ +  - ][ +  - ]:         19 :         sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     101         [ -  + ]:         19 :         for( sal_Int16 i=0; i < nAttrCount; i++ )
     102                 :            :         {
     103 [ #  # ][ #  # ]:          0 :             const OUString& rAttrName = xAttrList->getNameByIndex( i );
     104                 :            : 
     105                 :          0 :             OUString aLocalName;
     106         [ #  # ]:          0 :             sal_uInt16 nPrefix =rMap.GetKeyByAttrName( rAttrName,&aLocalName );
     107 [ #  # ][ #  # ]:          0 :             if( XML_NAMESPACE_TEXT == nPrefix &&
                 [ #  # ]
     108         [ #  # ]:          0 :                 IsXMLToken( aLocalName, XML_C ) )
     109                 :            :             {
     110 [ #  # ][ #  # ]:          0 :                 sal_Int32 nTmp = xAttrList->getValueByIndex(i).toInt32();
     111         [ #  # ]:          0 :                 if( nTmp > 0L )
     112                 :            :                 {
     113         [ #  # ]:          0 :                     if( nTmp > USHRT_MAX )
     114                 :          0 :                         m_nCount = USHRT_MAX;
     115                 :            :                     else
     116                 :          0 :                         m_nCount = (sal_uInt16)nTmp;
     117                 :            :                 }
     118                 :            :             }
     119                 :          0 :         }
     120                 :            :     }
     121                 :         21 : }
     122                 :            : 
     123                 :          0 : XMLCharContext::XMLCharContext(
     124                 :            :         SvXMLImport& rImp,
     125                 :            :         sal_uInt16 nPrfx,
     126                 :            :         const OUString& rLName,
     127                 :            :         const Reference< xml::sax::XAttributeList > &,
     128                 :            :         sal_Int16 nControl ) :
     129                 :            :     SvXMLImportContext( rImp, nPrfx, rLName )
     130                 :            :     ,m_nControl(nControl)
     131                 :          0 :     ,m_nCount(0)
     132                 :            : {
     133                 :          0 : }
     134                 :            : 
     135                 :         21 : XMLCharContext::~XMLCharContext()
     136                 :            : {
     137         [ -  + ]:         42 : }
     138                 :            : // -----------------------------------------------------------------------------
     139                 :         21 : void XMLCharContext::EndElement()
     140                 :            : {
     141         [ -  + ]:         21 :     if ( !m_nCount )
     142                 :          0 :         InsertControlCharacter( m_nControl );
     143                 :            :     else
     144                 :            :     {
     145         [ +  - ]:         21 :         if( 1U == m_nCount )
     146                 :            :         {
     147                 :         21 :             OUString sBuff( &m_c, 1 );
     148         [ +  - ]:         21 :             InsertString(sBuff);
     149                 :            :         }
     150                 :            :         else
     151                 :            :         {
     152                 :          0 :             OUStringBuffer sBuff( m_nCount );
     153         [ #  # ]:          0 :             while( m_nCount-- )
     154         [ #  # ]:          0 :                 sBuff.append( &m_c, 1 );
     155                 :            : 
     156 [ #  # ][ #  # ]:          0 :             InsertString(sBuff.makeStringAndClear() );
     157                 :            :         }
     158                 :            :     }
     159                 :         21 : }
     160                 :            : // -----------------------------------------------------------------------------
     161                 :          0 : void XMLCharContext::InsertControlCharacter(sal_Int16   _nControl)
     162                 :            : {
     163 [ #  # ][ #  # ]:          0 :     GetImport().GetTextImport()->InsertControlCharacter( _nControl );
     164                 :          0 : }
     165                 :         21 : void XMLCharContext::InsertString(const ::rtl::OUString& _sString)
     166                 :            : {
     167 [ +  - ][ +  - ]:         21 :     GetImport().GetTextImport()->InsertString( _sString );
     168                 :         21 : }
     169                 :            : 
     170                 :            : // ---------------------------------------------------------------------
     171                 :            : 
     172                 :            : /** import start of reference (<text:reference-start>) */
     173         [ #  # ]:          0 : class XMLStartReferenceContext_Impl : public SvXMLImportContext
     174                 :            : {
     175                 :            : public:
     176                 :            :     TYPEINFO();
     177                 :            : 
     178                 :            :     // Do everything in constructor. Well ...
     179                 :            :     XMLStartReferenceContext_Impl (
     180                 :            :         SvXMLImport& rImport,
     181                 :            :         sal_uInt16 nPrefix,
     182                 :            :         const OUString& rLocalName,
     183                 :            :         XMLHints_Impl& rHnts,
     184                 :            :         const Reference<xml::sax::XAttributeList> & xAttrList);
     185                 :            : 
     186                 :            :     static sal_Bool FindName(
     187                 :            :         SvXMLImport& rImport,
     188                 :            :         const Reference<xml::sax::XAttributeList> & xAttrList,
     189                 :            :         OUString& rName);
     190                 :            : };
     191                 :            : 
     192 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLStartReferenceContext_Impl, SvXMLImportContext );
     193                 :            : 
     194                 :          0 : XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl(
     195                 :            :     SvXMLImport& rImport,
     196                 :            :     sal_uInt16 nPrefix,
     197                 :            :     const OUString& rLocalName,
     198                 :            :     XMLHints_Impl& rHints,
     199                 :            :     const Reference<xml::sax::XAttributeList> & xAttrList) :
     200                 :          0 :         SvXMLImportContext(rImport, nPrefix, rLocalName)
     201                 :            : {
     202                 :          0 :     OUString sName;
     203                 :            : 
     204 [ #  # ][ #  # ]:          0 :     if (FindName(GetImport(), xAttrList, sName))
     205                 :            :     {
     206                 :            :         XMLHint_Impl* pHint = new XMLReferenceHint_Impl(
     207 [ #  # ][ #  # ]:          0 :             sName, rImport.GetTextImport()->GetCursor()->getStart() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     208                 :            : 
     209                 :            :         // degenerates to point reference, if no end is found!
     210 [ #  # ][ #  # ]:          0 :         pHint->SetEnd(rImport.GetTextImport()->GetCursor()->getStart() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     211                 :            : 
     212         [ #  # ]:          0 :         rHints.push_back(pHint);
     213                 :          0 :     }
     214                 :          0 : }
     215                 :            : 
     216                 :          0 : sal_Bool XMLStartReferenceContext_Impl::FindName(
     217                 :            :     SvXMLImport& rImport,
     218                 :            :     const Reference<xml::sax::XAttributeList> & xAttrList,
     219                 :            :     OUString& rName)
     220                 :            : {
     221                 :          0 :     sal_Bool bNameOK( sal_False );
     222                 :            : 
     223                 :            :     // find name attribute first
     224                 :          0 :     const sal_Int16 nLength( xAttrList->getLength() );
     225         [ #  # ]:          0 :     for (sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
     226                 :            :     {
     227                 :          0 :         OUString sLocalName;
     228                 :          0 :         const sal_uInt16 nPrefix = rImport.GetNamespaceMap().
     229         [ #  # ]:          0 :             GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
     230   [ #  #  #  # ]:          0 :                               &sLocalName );
     231                 :            : 
     232 [ #  # ][ #  # ]:          0 :         if ( (XML_NAMESPACE_TEXT == nPrefix) &&
                 [ #  # ]
     233         [ #  # ]:          0 :              IsXMLToken(sLocalName, XML_NAME)   )
     234                 :            :         {
     235 [ #  # ][ #  # ]:          0 :             rName = xAttrList->getValueByIndex(nAttr);
     236                 :          0 :             bNameOK = sal_True;
     237                 :            :         }
     238                 :          0 :     }
     239                 :            : 
     240                 :          0 :     return bNameOK;
     241                 :            : }
     242                 :            : 
     243                 :            : // ---------------------------------------------------------------------
     244                 :            : 
     245                 :            : /** import end of reference (<text:reference-end>) */
     246         [ #  # ]:          0 : class XMLEndReferenceContext_Impl : public SvXMLImportContext
     247                 :            : {
     248                 :            : public:
     249                 :            :     TYPEINFO();
     250                 :            : 
     251                 :            :     // Do everything in constructor. Well ...
     252                 :            :     XMLEndReferenceContext_Impl(
     253                 :            :         SvXMLImport& rImport,
     254                 :            :         sal_uInt16 nPrefix,
     255                 :            :         const OUString& rLocalName,
     256                 :            :         XMLHints_Impl& rHnts,
     257                 :            :         const Reference<xml::sax::XAttributeList> & xAttrList);
     258                 :            : };
     259                 :            : 
     260 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLEndReferenceContext_Impl, SvXMLImportContext );
     261                 :            : 
     262                 :          0 : XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl(
     263                 :            :     SvXMLImport& rImport,
     264                 :            :     sal_uInt16 nPrefix,
     265                 :            :     const OUString& rLocalName,
     266                 :            :     XMLHints_Impl& rHints,
     267                 :            :     const Reference<xml::sax::XAttributeList> & xAttrList) :
     268                 :          0 :         SvXMLImportContext(rImport, nPrefix, rLocalName)
     269                 :            : {
     270                 :          0 :     OUString sName;
     271                 :            : 
     272                 :            :     // borrow from XMLStartReferenceContext_Impl
     273 [ #  # ][ #  # ]:          0 :     if (XMLStartReferenceContext_Impl::FindName(GetImport(), xAttrList, sName))
     274                 :            :     {
     275                 :            :         // search for reference start
     276                 :          0 :         sal_uInt16 nCount = rHints.size();
     277         [ #  # ]:          0 :         for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
     278                 :            :         {
     279         [ #  # ]:          0 :             XMLHint_Impl *pHint = &rHints[nPos];
     280   [ #  #  #  # ]:          0 :             if ( pHint->IsReference() &&
                 [ #  # ]
     281                 :          0 :                  sName.equals( ((XMLReferenceHint_Impl *)pHint)->GetRefName()) )
     282                 :            :             {
     283                 :            :                 // set end and stop searching
     284                 :          0 :                 pHint->SetEnd(GetImport().GetTextImport()->
     285 [ #  # ][ #  # ]:          0 :                                      GetCursor()->getStart() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     286                 :          0 :                 break;
     287                 :            :             }
     288                 :            :         }
     289                 :            :         // else: no start (in this paragraph) -> ignore
     290                 :          0 :     }
     291                 :          0 : }
     292                 :            : 
     293                 :            : // ---------------------------------------------------------------------
     294                 :            : 
     295                 :            : class XMLImpSpanContext_Impl : public SvXMLImportContext
     296                 :            : {
     297                 :            :     const OUString sTextFrame;
     298                 :            : 
     299                 :            :     XMLHints_Impl&  rHints;
     300                 :            :     XMLStyleHint_Impl   *pHint;
     301                 :            : 
     302                 :            :     sal_Bool&       rIgnoreLeadingSpace;
     303                 :            : 
     304                 :            :     sal_uInt8               nStarFontsConvFlags;
     305                 :            : 
     306                 :            : public:
     307                 :            : 
     308                 :            :     TYPEINFO();
     309                 :            : 
     310                 :            :     XMLImpSpanContext_Impl(
     311                 :            :             SvXMLImport& rImport,
     312                 :            :             sal_uInt16 nPrfx,
     313                 :            :             const OUString& rLName,
     314                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList,
     315                 :            :             XMLHints_Impl& rHnts,
     316                 :            :             sal_Bool& rIgnLeadSpace
     317                 :            :     ,sal_uInt8              nSFConvFlags
     318                 :            :                           );
     319                 :            : 
     320                 :            :     virtual ~XMLImpSpanContext_Impl();
     321                 :            : 
     322                 :            :     static SvXMLImportContext *CreateChildContext(
     323                 :            :             SvXMLImport& rImport,
     324                 :            :             sal_uInt16 nPrefix, const OUString& rLocalName,
     325                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList,
     326                 :            :             sal_uInt16 nToken, XMLHints_Impl& rHnts,
     327                 :            :             sal_Bool& rIgnLeadSpace
     328                 :            :     ,sal_uInt8              nStarFontsConvFlags = 0
     329                 :            :              );
     330                 :            :     virtual SvXMLImportContext *CreateChildContext(
     331                 :            :             sal_uInt16 nPrefix, const OUString& rLocalName,
     332                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList );
     333                 :            : 
     334                 :            :     virtual void Characters( const OUString& rChars );
     335                 :            : };
     336                 :            : // ---------------------------------------------------------------------
     337                 :            : 
     338                 :            : class XMLImpHyperlinkContext_Impl : public SvXMLImportContext
     339                 :            : {
     340                 :            :     XMLHints_Impl&  rHints;
     341                 :            :     XMLHyperlinkHint_Impl   *pHint;
     342                 :            : 
     343                 :            :     sal_Bool&       rIgnoreLeadingSpace;
     344                 :            : 
     345                 :            : public:
     346                 :            : 
     347                 :            :     TYPEINFO();
     348                 :            : 
     349                 :            :     XMLImpHyperlinkContext_Impl(
     350                 :            :             SvXMLImport& rImport,
     351                 :            :             sal_uInt16 nPrfx,
     352                 :            :             const OUString& rLName,
     353                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList,
     354                 :            :             XMLHints_Impl& rHnts,
     355                 :            :             sal_Bool& rIgnLeadSpace );
     356                 :            : 
     357                 :            :     virtual ~XMLImpHyperlinkContext_Impl();
     358                 :            : 
     359                 :            :     virtual SvXMLImportContext *CreateChildContext(
     360                 :            :             sal_uInt16 nPrefix, const OUString& rLocalName,
     361                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList );
     362                 :            : 
     363                 :            :     virtual void Characters( const OUString& rChars );
     364                 :            : };
     365                 :            : 
     366 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLImpHyperlinkContext_Impl, SvXMLImportContext );
     367                 :            : 
     368                 :          3 : XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl(
     369                 :            :         SvXMLImport& rImport,
     370                 :            :         sal_uInt16 nPrfx,
     371                 :            :         const OUString& rLName,
     372                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList,
     373                 :            :         XMLHints_Impl& rHnts,
     374                 :            :         sal_Bool& rIgnLeadSpace ) :
     375                 :            :     SvXMLImportContext( rImport, nPrfx, rLName ),
     376                 :            :     rHints( rHnts ),
     377                 :            :     pHint( new XMLHyperlinkHint_Impl(
     378 [ +  - ][ +  - ]:          9 :               GetImport().GetTextImport()->GetCursorAsRange()->getStart() ) ),
                 [ +  - ]
           [ +  -  +  - ]
                 [ +  - ]
     379 [ +  - ][ +  - ]:          9 :     rIgnoreLeadingSpace( rIgnLeadSpace )
     380                 :            : {
     381                 :          3 :     OUString sShow;
     382                 :            :     const SvXMLTokenMap& rTokenMap =
     383 [ +  - ][ +  - ]:          3 :         GetImport().GetTextImport()->GetTextHyperlinkAttrTokenMap();
         [ +  - ][ +  - ]
     384                 :            : 
     385 [ +  - ][ +  - ]:          3 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     386         [ +  + ]:          9 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
     387                 :            :     {
     388 [ +  - ][ +  - ]:          6 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
     389 [ +  - ][ +  - ]:          6 :         const OUString& rValue = xAttrList->getValueByIndex( i );
     390                 :            : 
     391                 :          6 :         OUString aLocalName;
     392                 :            :         sal_uInt16 nPrefix =
     393                 :          6 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
     394         [ +  - ]:          6 :                                                             &aLocalName );
     395 [ +  - ][ +  -  :          6 :         switch( rTokenMap.Get( nPrefix, aLocalName ) )
             -  -  -  -  
                      + ]
     396                 :            :         {
     397                 :            :         case XML_TOK_TEXT_HYPERLINK_HREF:
     398         [ +  - ]:          3 :             pHint->SetHRef( GetImport().GetAbsoluteReference( rValue ) );
     399                 :          3 :             break;
     400                 :            :         case XML_TOK_TEXT_HYPERLINK_NAME:
     401                 :          0 :             pHint->SetName( rValue );
     402                 :          0 :             break;
     403                 :            :         case XML_TOK_TEXT_HYPERLINK_TARGET_FRAME:
     404                 :          0 :             pHint->SetTargetFrameName( rValue );
     405                 :          0 :             break;
     406                 :            :         case XML_TOK_TEXT_HYPERLINK_SHOW:
     407                 :          0 :             sShow = rValue;
     408                 :          0 :             break;
     409                 :            :         case XML_TOK_TEXT_HYPERLINK_STYLE_NAME:
     410                 :          0 :             pHint->SetStyleName( rValue );
     411                 :          0 :             break;
     412                 :            :         case XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME:
     413                 :          0 :             pHint->SetVisitedStyleName( rValue );
     414                 :          0 :             break;
     415                 :            :         }
     416                 :          6 :     }
     417                 :            : 
     418 [ -  + ][ #  # ]:          3 :     if( !sShow.isEmpty() && pHint->GetTargetFrameName().isEmpty() )
                 [ -  + ]
     419                 :            :     {
     420 [ #  # ][ #  # ]:          0 :         if( IsXMLToken( sShow, XML_NEW ) )
     421                 :            :             pHint->SetTargetFrameName(
     422                 :          0 :                     OUString( "_blank"  ) );
     423 [ #  # ][ #  # ]:          0 :         else if( IsXMLToken( sShow, XML_REPLACE ) )
     424                 :            :             pHint->SetTargetFrameName(
     425                 :          0 :                     OUString( "_self"  ) );
     426                 :            :     }
     427         [ +  - ]:          3 :     rHints.push_back( pHint );
     428                 :          3 : }
     429                 :            : 
     430                 :          3 : XMLImpHyperlinkContext_Impl::~XMLImpHyperlinkContext_Impl()
     431                 :            : {
     432         [ +  - ]:          3 :     if( pHint )
     433                 :          3 :         pHint->SetEnd( GetImport().GetTextImport()
     434 [ +  - ][ +  - ]:          3 :                             ->GetCursorAsRange()->getStart() );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     435         [ -  + ]:          6 : }
     436                 :            : 
     437                 :          0 : SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext(
     438                 :            :         sal_uInt16 nPrefix, const OUString& rLocalName,
     439                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList )
     440                 :            : {
     441   [ #  #  #  # ]:          0 :     if ( (nPrefix == XML_NAMESPACE_OFFICE) &&
                 [ #  # ]
     442                 :          0 :          IsXMLToken(rLocalName, XML_EVENT_LISTENERS) )
     443                 :            :     {
     444                 :            :         XMLEventsImportContext* pCtxt = new XMLEventsImportContext(
     445         [ #  # ]:          0 :             GetImport(), nPrefix, rLocalName);
     446                 :          0 :         pHint->SetEventsContext(pCtxt);
     447                 :          0 :         return pCtxt;
     448                 :            :     }
     449                 :            :     else
     450                 :            :     {
     451                 :            :         const SvXMLTokenMap& rTokenMap =
     452 [ #  # ][ #  # ]:          0 :             GetImport().GetTextImport()->GetTextPElemTokenMap();
     453                 :          0 :         sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
     454                 :            : 
     455                 :            :         return XMLImpSpanContext_Impl::CreateChildContext(
     456                 :          0 :             GetImport(), nPrefix, rLocalName, xAttrList,
     457                 :          0 :             nToken, rHints, rIgnoreLeadingSpace );
     458                 :            :     }
     459                 :            : }
     460                 :            : 
     461                 :          3 : void XMLImpHyperlinkContext_Impl::Characters( const OUString& rChars )
     462                 :            : {
     463 [ +  - ][ +  - ]:          3 :     GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace );
     464                 :          3 : }
     465                 :            : 
     466                 :            : // ---------------------------------------------------------------------
     467                 :            : 
     468                 :            : class XMLImpRubyBaseContext_Impl : public SvXMLImportContext
     469                 :            : {
     470                 :            :     XMLHints_Impl&  rHints;
     471                 :            : 
     472                 :            :     sal_Bool&       rIgnoreLeadingSpace;
     473                 :            : 
     474                 :            : public:
     475                 :            : 
     476                 :            :     TYPEINFO();
     477                 :            : 
     478                 :            :     XMLImpRubyBaseContext_Impl(
     479                 :            :             SvXMLImport& rImport,
     480                 :            :             sal_uInt16 nPrfx,
     481                 :            :             const OUString& rLName,
     482                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList,
     483                 :            :             XMLHints_Impl& rHnts,
     484                 :            :             sal_Bool& rIgnLeadSpace );
     485                 :            : 
     486                 :            :     virtual ~XMLImpRubyBaseContext_Impl();
     487                 :            : 
     488                 :            :     virtual SvXMLImportContext *CreateChildContext(
     489                 :            :             sal_uInt16 nPrefix, const OUString& rLocalName,
     490                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList );
     491                 :            : 
     492                 :            :     virtual void Characters( const OUString& rChars );
     493                 :            : };
     494                 :            : 
     495 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLImpRubyBaseContext_Impl, SvXMLImportContext );
     496                 :            : 
     497                 :         24 : XMLImpRubyBaseContext_Impl::XMLImpRubyBaseContext_Impl(
     498                 :            :         SvXMLImport& rImport,
     499                 :            :         sal_uInt16 nPrfx,
     500                 :            :         const OUString& rLName,
     501                 :            :         const Reference< xml::sax::XAttributeList > &,
     502                 :            :         XMLHints_Impl& rHnts,
     503                 :            :         sal_Bool& rIgnLeadSpace ) :
     504                 :            :     SvXMLImportContext( rImport, nPrfx, rLName ),
     505                 :            :     rHints( rHnts ),
     506                 :         24 :     rIgnoreLeadingSpace( rIgnLeadSpace )
     507                 :            : {
     508                 :         24 : }
     509                 :            : 
     510                 :         24 : XMLImpRubyBaseContext_Impl::~XMLImpRubyBaseContext_Impl()
     511                 :            : {
     512         [ -  + ]:         48 : }
     513                 :            : 
     514                 :         12 : SvXMLImportContext *XMLImpRubyBaseContext_Impl::CreateChildContext(
     515                 :            :         sal_uInt16 nPrefix, const OUString& rLocalName,
     516                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList )
     517                 :            : {
     518                 :            :     const SvXMLTokenMap& rTokenMap =
     519 [ +  - ][ +  - ]:         12 :         GetImport().GetTextImport()->GetTextPElemTokenMap();
     520                 :         12 :     sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
     521                 :            : 
     522                 :         12 :     return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), nPrefix,
     523                 :            :                                                        rLocalName, xAttrList,
     524                 :         12 :                                nToken, rHints, rIgnoreLeadingSpace );
     525                 :            : }
     526                 :            : 
     527                 :         12 : void XMLImpRubyBaseContext_Impl::Characters( const OUString& rChars )
     528                 :            : {
     529 [ +  - ][ +  - ]:         12 :     GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace );
     530                 :         12 : }
     531                 :            : 
     532                 :            : // ---------------------------------------------------------------------
     533                 :            : 
     534                 :            : class XMLImpRubyContext_Impl : public SvXMLImportContext
     535                 :            : {
     536                 :            :     XMLHints_Impl&  rHints;
     537                 :            : 
     538                 :            :     sal_Bool&       rIgnoreLeadingSpace;
     539                 :            : 
     540                 :            :     Reference < XTextRange > m_xStart;
     541                 :            :     OUString        m_sStyleName;
     542                 :            :     OUString        m_sTextStyleName;
     543                 :            :     OUString        m_sText;
     544                 :            : 
     545                 :            : public:
     546                 :            : 
     547                 :            :     TYPEINFO();
     548                 :            : 
     549                 :            :     XMLImpRubyContext_Impl(
     550                 :            :             SvXMLImport& rImport,
     551                 :            :             sal_uInt16 nPrfx,
     552                 :            :             const OUString& rLName,
     553                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList,
     554                 :            :             XMLHints_Impl& rHnts,
     555                 :            :             sal_Bool& rIgnLeadSpace );
     556                 :            : 
     557                 :            :     virtual ~XMLImpRubyContext_Impl();
     558                 :            : 
     559                 :            :     virtual SvXMLImportContext *CreateChildContext(
     560                 :            :             sal_uInt16 nPrefix, const OUString& rLocalName,
     561                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList );
     562                 :            : 
     563                 :          0 :     void SetTextStyleName( const OUString& s ) { m_sTextStyleName = s; }
     564                 :         24 :     void AppendText( const OUString& s ) { m_sText += s; }
     565                 :            : };
     566                 :            : 
     567                 :            : // ---------------------------------------------------------------------
     568                 :            : 
     569                 :            : class XMLImpRubyTextContext_Impl : public SvXMLImportContext
     570                 :            : {
     571                 :            :     XMLImpRubyContext_Impl & m_rRubyContext;
     572                 :            : 
     573                 :            : public:
     574                 :            : 
     575                 :            :     TYPEINFO();
     576                 :            : 
     577                 :            :     XMLImpRubyTextContext_Impl(
     578                 :            :             SvXMLImport& rImport,
     579                 :            :             sal_uInt16 nPrfx,
     580                 :            :             const OUString& rLName,
     581                 :            :             const Reference< xml::sax::XAttributeList > & xAttrList,
     582                 :            :             XMLImpRubyContext_Impl & rParent );
     583                 :            : 
     584                 :            :     virtual ~XMLImpRubyTextContext_Impl();
     585                 :            : 
     586                 :            :     virtual void Characters( const OUString& rChars );
     587                 :            : };
     588                 :            : 
     589 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLImpRubyTextContext_Impl, SvXMLImportContext );
     590                 :            : 
     591                 :         24 : XMLImpRubyTextContext_Impl::XMLImpRubyTextContext_Impl(
     592                 :            :         SvXMLImport& rImport,
     593                 :            :         sal_uInt16 nPrfx,
     594                 :            :         const OUString& rLName,
     595                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList,
     596                 :            :         XMLImpRubyContext_Impl & rParent )
     597                 :            :     : SvXMLImportContext( rImport, nPrfx, rLName )
     598                 :         24 :     , m_rRubyContext( rParent )
     599                 :            : {
     600 [ +  - ][ +  - ]:         24 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     601         [ -  + ]:         24 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
     602                 :            :     {
     603 [ #  # ][ #  # ]:          0 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
     604 [ #  # ][ #  # ]:          0 :         const OUString& rValue = xAttrList->getValueByIndex( i );
     605                 :            : 
     606                 :          0 :         OUString aLocalName;
     607                 :            :         sal_uInt16 nPrefix =
     608                 :          0 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
     609         [ #  # ]:          0 :                                                             &aLocalName );
     610 [ #  # ][ #  # ]:          0 :         if( XML_NAMESPACE_TEXT == nPrefix &&
                 [ #  # ]
     611         [ #  # ]:          0 :             IsXMLToken( aLocalName, XML_STYLE_NAME ) )
     612                 :            :         {
     613                 :          0 :             m_rRubyContext.SetTextStyleName( rValue );
     614                 :            :             break;
     615                 :            :         }
     616 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
     617                 :         24 : }
     618                 :            : 
     619                 :         24 : XMLImpRubyTextContext_Impl::~XMLImpRubyTextContext_Impl()
     620                 :            : {
     621         [ -  + ]:         48 : }
     622                 :            : 
     623                 :         24 : void XMLImpRubyTextContext_Impl::Characters( const OUString& rChars )
     624                 :            : {
     625                 :         24 :     m_rRubyContext.AppendText( rChars );
     626                 :         24 : }
     627                 :            : 
     628                 :            : // ---------------------------------------------------------------------
     629                 :            : 
     630 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLImpRubyContext_Impl, SvXMLImportContext );
     631                 :            : 
     632                 :         24 : XMLImpRubyContext_Impl::XMLImpRubyContext_Impl(
     633                 :            :         SvXMLImport& rImport,
     634                 :            :         sal_uInt16 nPrfx,
     635                 :            :         const OUString& rLName,
     636                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList,
     637                 :            :         XMLHints_Impl& rHnts,
     638                 :            :         sal_Bool& rIgnLeadSpace ) :
     639                 :            :     SvXMLImportContext( rImport, nPrfx, rLName ),
     640                 :            :     rHints( rHnts ),
     641                 :            :     rIgnoreLeadingSpace( rIgnLeadSpace )
     642 [ +  - ][ +  - ]:         24 :     , m_xStart( GetImport().GetTextImport()->GetCursorAsRange()->getStart() )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     643                 :            : {
     644 [ +  - ][ +  - ]:         24 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
     645         [ +  - ]:         48 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
     646                 :            :     {
     647 [ +  - ][ +  - ]:         24 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
     648 [ +  - ][ +  - ]:         24 :         const OUString& rValue = xAttrList->getValueByIndex( i );
     649                 :            : 
     650                 :         24 :         OUString aLocalName;
     651                 :            :         sal_uInt16 nPrefix =
     652                 :         24 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
     653         [ +  - ]:         24 :                                                             &aLocalName );
     654 [ +  - ][ +  - ]:         48 :         if( XML_NAMESPACE_TEXT == nPrefix &&
                 [ +  - ]
     655         [ +  - ]:         24 :             IsXMLToken( aLocalName, XML_STYLE_NAME ) )
     656                 :            :         {
     657                 :         24 :             m_sStyleName = rValue;
     658                 :            :             break;
     659                 :            :         }
     660 [ +  - ][ +  - ]:         24 :     }
                 [ -  + ]
     661                 :         24 : }
     662                 :            : 
     663                 :         24 : XMLImpRubyContext_Impl::~XMLImpRubyContext_Impl()
     664                 :            : {
     665                 :            :     const UniReference < XMLTextImportHelper > xTextImport(
     666         [ +  - ]:         24 :         GetImport().GetTextImport());
     667                 :            :     const Reference < XTextCursor > xAttrCursor(
     668 [ +  - ][ +  - ]:         24 :         xTextImport->GetText()->createTextCursorByRange( m_xStart ));
         [ +  - ][ +  - ]
     669 [ +  - ][ +  - ]:         24 :     xAttrCursor->gotoRange(xTextImport->GetCursorAsRange()->getStart(),
         [ +  - ][ +  - ]
     670 [ +  - ][ +  - ]:         24 :             sal_True);
     671                 :         24 :     xTextImport->SetRuby( GetImport(), xAttrCursor,
     672 [ +  - ][ +  - ]:         24 :          m_sStyleName, m_sTextStyleName, m_sText );
                 [ +  - ]
     673         [ -  + ]:         48 : }
     674                 :            : 
     675                 :         48 : SvXMLImportContext *XMLImpRubyContext_Impl::CreateChildContext(
     676                 :            :         sal_uInt16 nPrefix, const OUString& rLocalName,
     677                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList )
     678                 :            : {
     679                 :            :     SvXMLImportContext *pContext;
     680         [ +  - ]:         48 :     if( XML_NAMESPACE_TEXT == nPrefix )
     681                 :            :     {
     682         [ +  + ]:         48 :         if( IsXMLToken( rLocalName, XML_RUBY_BASE ) )
     683                 :         24 :             pContext = new XMLImpRubyBaseContext_Impl( GetImport(), nPrefix,
     684                 :            :                                                        rLocalName,
     685                 :            :                                                        xAttrList,
     686                 :            :                                                        rHints,
     687         [ +  - ]:         24 :                                                        rIgnoreLeadingSpace );
     688         [ +  - ]:         24 :         else if( IsXMLToken( rLocalName, XML_RUBY_TEXT ) )
     689                 :         24 :             pContext = new XMLImpRubyTextContext_Impl( GetImport(), nPrefix,
     690                 :            :                                                        rLocalName,
     691                 :            :                                                        xAttrList,
     692         [ +  - ]:         24 :                                                        *this );
     693                 :            :         else
     694                 :            :             pContext = new SvXMLImportContext(
     695         [ #  # ]:          0 :                 GetImport(), nPrefix, rLocalName );
     696                 :            :     }
     697                 :            :     else
     698                 :            :         pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName,
     699                 :          0 :                                                             xAttrList );
     700                 :            : 
     701                 :         48 :     return pContext;
     702                 :            : }
     703                 :            : 
     704                 :            : // ---------------------------------------------------------------------
     705                 :            : 
     706                 :            : /** for text:meta and text:meta-field
     707                 :            :  */
     708                 :            : class XMLMetaImportContextBase : public SvXMLImportContext
     709                 :            : {
     710                 :            :     XMLHints_Impl&    m_rHints;
     711                 :            : 
     712                 :            :     sal_Bool& m_rIgnoreLeadingSpace;
     713                 :            : 
     714                 :            :     /// start position
     715                 :            :     Reference<XTextRange> m_xStart;
     716                 :            : 
     717                 :            : protected:
     718                 :            :     OUString m_XmlId;
     719                 :            : 
     720                 :            : public:
     721                 :            :     TYPEINFO();
     722                 :            : 
     723                 :            :     XMLMetaImportContextBase(
     724                 :            :         SvXMLImport& i_rImport,
     725                 :            :         const sal_uInt16 i_nPrefix,
     726                 :            :         const OUString& i_rLocalName,
     727                 :            :         XMLHints_Impl& i_rHints,
     728                 :            :         sal_Bool & i_rIgnoreLeadingSpace );
     729                 :            : 
     730                 :            :     virtual ~XMLMetaImportContextBase();
     731                 :            : 
     732                 :            :     virtual void StartElement(
     733                 :            :             const Reference<xml::sax::XAttributeList> & i_xAttrList);
     734                 :            : 
     735                 :            :     virtual void EndElement();
     736                 :            : 
     737                 :            :     virtual SvXMLImportContext *CreateChildContext(
     738                 :            :             sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
     739                 :            :             const Reference< xml::sax::XAttributeList > & i_xAttrList);
     740                 :            : 
     741                 :            :     virtual void Characters( const OUString& i_rChars );
     742                 :            : 
     743                 :            :     virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
     744                 :            :         OUString const & i_rLocalName, OUString const & i_rValue);
     745                 :            : 
     746                 :            :     virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange)
     747                 :            :         = 0;
     748                 :            : };
     749                 :            : 
     750 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLMetaImportContextBase, SvXMLImportContext );
     751                 :            : 
     752                 :         80 : XMLMetaImportContextBase::XMLMetaImportContextBase(
     753                 :            :         SvXMLImport& i_rImport,
     754                 :            :         const sal_uInt16 i_nPrefix,
     755                 :            :         const OUString& i_rLocalName,
     756                 :            :         XMLHints_Impl& i_rHints,
     757                 :            :         sal_Bool & i_rIgnoreLeadingSpace )
     758                 :            :     : SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName )
     759                 :            :     , m_rHints( i_rHints )
     760                 :            :     , m_rIgnoreLeadingSpace( i_rIgnoreLeadingSpace )
     761 [ +  - ][ +  - ]:         80 :     , m_xStart( GetImport().GetTextImport()->GetCursorAsRange()->getStart() )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     762                 :            : {
     763                 :         80 : }
     764                 :            : 
     765                 :         80 : XMLMetaImportContextBase::~XMLMetaImportContextBase()
     766                 :            : {
     767         [ -  + ]:         80 : }
     768                 :            : 
     769                 :         80 : void XMLMetaImportContextBase::StartElement(
     770                 :            :         const Reference<xml::sax::XAttributeList> & i_xAttrList)
     771                 :            : {
     772         [ +  - ]:         80 :     const sal_Int16 nAttrCount(i_xAttrList.is() ? i_xAttrList->getLength() : 0);
     773         [ +  + ]:        182 :     for ( sal_Int16 i = 0; i < nAttrCount; ++i )
     774                 :            :     {
     775 [ +  - ][ +  - ]:        102 :         const OUString& rAttrName( i_xAttrList->getNameByIndex( i ) );
     776 [ +  - ][ +  - ]:        102 :         const OUString& rValue( i_xAttrList->getValueByIndex( i ) );
     777                 :            : 
     778                 :        102 :         OUString sLocalName;
     779                 :            :         const sal_uInt16 nPrefix(
     780                 :        102 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
     781         [ +  - ]:        102 :                                                             &sLocalName ));
     782         [ +  - ]:        102 :         ProcessAttribute(nPrefix, sLocalName, rValue);
     783                 :        102 :     }
     784                 :         80 : }
     785                 :            : 
     786                 :         80 : void XMLMetaImportContextBase::EndElement()
     787                 :            : {
     788                 :            :     OSL_ENSURE(m_xStart.is(), "no mxStart?");
     789         [ +  - ]:        160 :     if (!m_xStart.is()) return;
     790                 :            : 
     791                 :            :     const Reference<XTextRange> xEndRange(
     792 [ +  - ][ +  - ]:         80 :         GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     793                 :            : 
     794                 :            :     // create range for insertion
     795                 :            :     const Reference<XTextCursor> xInsertionCursor(
     796 [ +  - ][ +  - ]:        160 :         GetImport().GetTextImport()->GetText()->createTextCursorByRange(
         [ +  - ][ +  - ]
                 [ +  - ]
     797         [ +  - ]:         80 :             xEndRange) );
     798 [ +  - ][ +  - ]:         80 :     xInsertionCursor->gotoRange(m_xStart, sal_True);
     799                 :            : 
     800         [ +  - ]:         80 :     const Reference<XTextRange> xInsertionRange(xInsertionCursor, UNO_QUERY);
     801                 :            : 
     802         [ +  - ]:         80 :     InsertMeta(xInsertionRange);
     803                 :            : }
     804                 :            : 
     805                 :         28 : SvXMLImportContext * XMLMetaImportContextBase::CreateChildContext(
     806                 :            :             sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
     807                 :            :             const Reference< xml::sax::XAttributeList > & i_xAttrList )
     808                 :            : {
     809                 :            :     const SvXMLTokenMap& rTokenMap(
     810 [ +  - ][ +  - ]:         28 :         GetImport().GetTextImport()->GetTextPElemTokenMap() );
     811                 :         28 :     const sal_uInt16 nToken( rTokenMap.Get( i_nPrefix, i_rLocalName ) );
     812                 :            : 
     813                 :         28 :     return XMLImpSpanContext_Impl::CreateChildContext( GetImport(), i_nPrefix,
     814                 :         28 :         i_rLocalName, i_xAttrList, nToken, m_rHints, m_rIgnoreLeadingSpace );
     815                 :            : }
     816                 :            : 
     817                 :         52 : void XMLMetaImportContextBase::Characters( const OUString& i_rChars )
     818                 :            : {
     819 [ +  - ][ +  - ]:         52 :     GetImport().GetTextImport()->InsertString(i_rChars, m_rIgnoreLeadingSpace);
     820                 :         52 : }
     821                 :            : 
     822                 :         78 : void XMLMetaImportContextBase::ProcessAttribute(sal_uInt16 const i_nPrefix,
     823                 :            :     OUString const & i_rLocalName, OUString const & i_rValue)
     824                 :            : {
     825 [ +  + ][ +  - ]:         78 :     if ( (XML_NAMESPACE_XML == i_nPrefix) && IsXMLToken(i_rLocalName, XML_ID) )
                 [ +  + ]
     826                 :            :     {
     827                 :         74 :         m_XmlId = i_rValue;
     828                 :            :     }
     829                 :         78 : }
     830                 :            : 
     831                 :            : 
     832                 :            : // ---------------------------------------------------------------------
     833                 :            : 
     834                 :            : /** text:meta */
     835         [ -  + ]:         76 : class XMLMetaImportContext : public XMLMetaImportContextBase
     836                 :            : {
     837                 :            :     // RDFa
     838                 :            :     bool m_bHaveAbout;
     839                 :            :     ::rtl::OUString m_sAbout;
     840                 :            :     ::rtl::OUString m_sProperty;
     841                 :            :     ::rtl::OUString m_sContent;
     842                 :            :     ::rtl::OUString m_sDatatype;
     843                 :            : 
     844                 :            : public:
     845                 :            :     TYPEINFO();
     846                 :            : 
     847                 :            :     XMLMetaImportContext(
     848                 :            :         SvXMLImport& i_rImport,
     849                 :            :         const sal_uInt16 i_nPrefix,
     850                 :            :         const OUString& i_rLocalName,
     851                 :            :         XMLHints_Impl& i_rHints,
     852                 :            :         sal_Bool & i_rIgnoreLeadingSpace );
     853                 :            : 
     854                 :            :     virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
     855                 :            :         OUString const & i_rLocalName, OUString const & i_rValue);
     856                 :            : 
     857                 :            :     virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
     858                 :            : };
     859                 :            : 
     860 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLMetaImportContext, XMLMetaImportContextBase );
     861                 :            : 
     862                 :         38 : XMLMetaImportContext::XMLMetaImportContext(
     863                 :            :         SvXMLImport& i_rImport,
     864                 :            :         const sal_uInt16 i_nPrefix,
     865                 :            :         const OUString& i_rLocalName,
     866                 :            :         XMLHints_Impl& i_rHints,
     867                 :            :         sal_Bool & i_rIgnoreLeadingSpace )
     868                 :            :     : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
     869                 :            :             i_rHints, i_rIgnoreLeadingSpace )
     870                 :         38 :     , m_bHaveAbout(false)
     871                 :            : {
     872                 :         38 : }
     873                 :            : 
     874                 :         54 : void XMLMetaImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
     875                 :            :     OUString const & i_rLocalName, OUString const & i_rValue)
     876                 :            : {
     877         [ +  + ]:         54 :     if ( XML_NAMESPACE_XHTML == i_nPrefix )
     878                 :            :     {
     879                 :            :         // RDFa
     880         [ +  + ]:         16 :         if ( IsXMLToken( i_rLocalName, XML_ABOUT) )
     881                 :            :         {
     882                 :          4 :             m_sAbout = i_rValue;
     883                 :          4 :             m_bHaveAbout = true;
     884                 :            :         }
     885         [ +  + ]:         12 :         else if ( IsXMLToken( i_rLocalName, XML_PROPERTY) )
     886                 :            :         {
     887                 :          4 :             m_sProperty = i_rValue;
     888                 :            :         }
     889         [ +  + ]:          8 :         else if ( IsXMLToken( i_rLocalName, XML_CONTENT) )
     890                 :            :         {
     891                 :          4 :             m_sContent = i_rValue;
     892                 :            :         }
     893         [ +  - ]:          4 :         else if ( IsXMLToken( i_rLocalName, XML_DATATYPE) )
     894                 :            :         {
     895                 :          4 :             m_sDatatype = i_rValue;
     896                 :            :         }
     897                 :            :     }
     898                 :            :     else
     899                 :            :     {
     900                 :            :         XMLMetaImportContextBase::ProcessAttribute(
     901                 :         38 :             i_nPrefix, i_rLocalName, i_rValue);
     902                 :            :     }
     903                 :         54 : }
     904                 :            : 
     905                 :         38 : void XMLMetaImportContext::InsertMeta(
     906                 :            :     const Reference<XTextRange> & i_xInsertionRange)
     907                 :            : {
     908                 :            :     OSL_ENSURE(!m_bHaveAbout == !m_sProperty.getLength(),
     909                 :            :         "XMLMetaImportContext::InsertMeta: invalid RDFa?");
     910 [ +  + ][ +  + ]:         38 :     if (!m_XmlId.isEmpty() || (m_bHaveAbout && !m_sProperty.isEmpty()))
         [ +  - ][ +  + ]
     911                 :            :     {
     912                 :            :         // insert mark
     913                 :            :         const uno::Reference<rdf::XMetadatable> xMeta(
     914                 :            :             XMLTextMarkImportContext::CreateAndInsertMark(
     915                 :         36 :                 GetImport(),
     916                 :            :                 OUString(
     917                 :            :                     "com.sun.star.text.InContentMetadata"),
     918                 :            :                 OUString(),
     919                 :            :                 i_xInsertionRange, m_XmlId),
     920 [ +  - ][ +  - ]:         72 :             uno::UNO_QUERY);
     921                 :            :         OSL_ENSURE(xMeta.is(), "cannot insert Meta?");
     922                 :            : 
     923 [ +  + ][ +  + ]:         36 :         if (xMeta.is() && m_bHaveAbout)
                 [ +  - ]
     924                 :            :         {
     925                 :          4 :             GetImport().AddRDFa(xMeta,
     926         [ +  - ]:          8 :                 m_sAbout, m_sProperty, m_sContent, m_sDatatype);
     927                 :         36 :         }
     928                 :            :     }
     929                 :            :     else
     930                 :            :     {
     931                 :            :         OSL_TRACE("invalid <text:meta>: no xml:id, no valid RDFa");
     932                 :            :     }
     933                 :         38 : }
     934                 :            : 
     935                 :            : // ---------------------------------------------------------------------
     936                 :            : 
     937                 :            : /** text:meta-field */
     938         [ -  + ]:         84 : class XMLMetaFieldImportContext : public XMLMetaImportContextBase
     939                 :            : {
     940                 :            :     OUString m_DataStyleName;
     941                 :            : 
     942                 :            : public:
     943                 :            :     TYPEINFO();
     944                 :            : 
     945                 :            :     XMLMetaFieldImportContext(
     946                 :            :         SvXMLImport& i_rImport,
     947                 :            :         const sal_uInt16 i_nPrefix,
     948                 :            :         const OUString& i_rLocalName,
     949                 :            :         XMLHints_Impl& i_rHints,
     950                 :            :         sal_Bool & i_rIgnoreLeadingSpace );
     951                 :            : 
     952                 :            :     virtual void ProcessAttribute(sal_uInt16 const i_nPrefix,
     953                 :            :         OUString const & i_rLocalName, OUString const & i_rValue);
     954                 :            : 
     955                 :            :     virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange);
     956                 :            : };
     957                 :            : 
     958 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLMetaFieldImportContext, XMLMetaImportContextBase );
     959                 :            : 
     960                 :         42 : XMLMetaFieldImportContext::XMLMetaFieldImportContext(
     961                 :            :         SvXMLImport& i_rImport,
     962                 :            :         const sal_uInt16 i_nPrefix,
     963                 :            :         const OUString& i_rLocalName,
     964                 :            :         XMLHints_Impl& i_rHints,
     965                 :            :         sal_Bool & i_rIgnoreLeadingSpace )
     966                 :            :     : XMLMetaImportContextBase( i_rImport, i_nPrefix, i_rLocalName,
     967                 :         42 :             i_rHints, i_rIgnoreLeadingSpace )
     968                 :            : {
     969                 :         42 : }
     970                 :            : 
     971                 :         48 : void XMLMetaFieldImportContext::ProcessAttribute(sal_uInt16 const i_nPrefix,
     972                 :            :     OUString const & i_rLocalName, OUString const & i_rValue)
     973                 :            : {
     974   [ +  +  +  - ]:         56 :     if ( XML_NAMESPACE_STYLE == i_nPrefix &&
                 [ +  + ]
     975                 :          8 :          IsXMLToken( i_rLocalName, XML_DATA_STYLE_NAME ) )
     976                 :            :     {
     977                 :          8 :         m_DataStyleName = i_rValue;
     978                 :            :     }
     979                 :            :     else
     980                 :            :     {
     981                 :            :         XMLMetaImportContextBase::ProcessAttribute(
     982                 :         40 :             i_nPrefix, i_rLocalName, i_rValue);
     983                 :            :     }
     984                 :         48 : }
     985                 :            : 
     986                 :         42 : void XMLMetaFieldImportContext::InsertMeta(
     987                 :            :     const Reference<XTextRange> & i_xInsertionRange)
     988                 :            : {
     989         [ +  + ]:         42 :     if (!m_XmlId.isEmpty()) // valid?
     990                 :            :     {
     991                 :            :         // insert mark
     992                 :            :         const Reference<XPropertySet> xPropertySet(
     993                 :            :             XMLTextMarkImportContext::CreateAndInsertMark(
     994                 :         40 :                 GetImport(),
     995                 :            :                 OUString(
     996                 :            :                     "com.sun.star.text.textfield.MetadataField"),
     997                 :            :                 OUString(),
     998                 :            :                 i_xInsertionRange, m_XmlId),
     999 [ +  - ][ +  - ]:         80 :             UNO_QUERY);
    1000                 :            :         OSL_ENSURE(xPropertySet.is(), "cannot insert MetaField?");
    1001         [ -  + ]:         82 :         if (!xPropertySet.is()) return;
    1002                 :            : 
    1003         [ +  + ]:         40 :         if (!m_DataStyleName.isEmpty())
    1004                 :            :         {
    1005                 :          8 :             sal_Bool isDefaultLanguage(sal_True);
    1006                 :            : 
    1007                 :          8 :             const sal_Int32 nKey( GetImport().GetTextImport()->GetDataStyleKey(
    1008 [ +  - ][ +  - ]:          8 :                                    m_DataStyleName, & isDefaultLanguage) );
         [ +  - ][ +  - ]
    1009                 :            : 
    1010         [ +  - ]:          8 :             if (-1 != nKey)
    1011                 :            :             {
    1012                 :            :                 static ::rtl::OUString sPropertyIsFixedLanguage(
    1013 [ +  + ][ +  - ]:          8 :                     ::rtl::OUString("IsFixedLanguage") );
    1014                 :          8 :                 Any any;
    1015         [ +  - ]:          8 :                 any <<= nKey;
    1016         [ +  - ]:          8 :                 xPropertySet->setPropertyValue(
    1017         [ +  - ]:          8 :                     OUString("NumberFormat"), any);
    1018 [ +  - ][ +  - ]:         16 :                 if ( xPropertySet->getPropertySetInfo()->
         [ +  - ][ +  - ]
    1019         [ +  - ]:          8 :                         hasPropertyByName( sPropertyIsFixedLanguage ) )
    1020                 :            :                 {
    1021         [ +  - ]:          8 :                     any <<= static_cast<bool>(!isDefaultLanguage);
    1022         [ +  - ]:          8 :                     xPropertySet->setPropertyValue( sPropertyIsFixedLanguage,
    1023         [ +  - ]:          8 :                         any );
    1024                 :         40 :                 }
    1025                 :            :             }
    1026         [ +  - ]:         40 :         }
    1027                 :            :     }
    1028                 :            :     else
    1029                 :            :     {
    1030                 :            :         OSL_TRACE("invalid <text:meta-field>: no xml:id");
    1031                 :            :     }
    1032                 :            : }
    1033                 :            : 
    1034                 :            : 
    1035                 :            : // ---------------------------------------------------------------------
    1036                 :            : 
    1037                 :            : 
    1038                 :            : /**
    1039                 :            :  * Process index marks.
    1040                 :            :  *
    1041                 :            :  * All *-mark-end index marks should instantiate *this* class (because
    1042                 :            :  * it doesn't process attributes other than ID), while the *-mark and
    1043                 :            :  * *-mark-start classes should instantiate the apporpiate subclasses.
    1044                 :            :  */
    1045         [ #  # ]:          0 : class XMLIndexMarkImportContext_Impl : public SvXMLImportContext
    1046                 :            : {
    1047                 :            :     const OUString sAlternativeText;
    1048                 :            : 
    1049                 :            :     XMLHints_Impl& rHints;
    1050                 :            :     const enum XMLTextPElemTokens eToken;
    1051                 :            :     OUString sID;
    1052                 :            : 
    1053                 :            : public:
    1054                 :            :     TYPEINFO();
    1055                 :            : 
    1056                 :            :     XMLIndexMarkImportContext_Impl(
    1057                 :            :         SvXMLImport& rImport,
    1058                 :            :         sal_uInt16 nPrefix,
    1059                 :            :         const OUString& rLocalName,
    1060                 :            :         enum XMLTextPElemTokens nTok,
    1061                 :            :         XMLHints_Impl& rHnts);
    1062                 :            : 
    1063                 :            :     void StartElement(const Reference<xml::sax::XAttributeList> & xAttrList);
    1064                 :            : 
    1065                 :            : protected:
    1066                 :            : 
    1067                 :            :     /// process all attributes
    1068                 :            :     void ProcessAttributes(const Reference<xml::sax::XAttributeList> & xAttrList,
    1069                 :            :                            Reference<beans::XPropertySet>& rPropSet);
    1070                 :            : 
    1071                 :            :     /**
    1072                 :            :      * All marks can be created immediatly. Since we don't care about
    1073                 :            :      * the element content, ProcessAttribute should set the properties
    1074                 :            :      * immediatly.
    1075                 :            :      *
    1076                 :            :      * This method tolerates an empty PropertySet; subclasses however
    1077                 :            :      * are not expected to.
    1078                 :            :      */
    1079                 :            :     virtual void ProcessAttribute(sal_uInt16 nNamespace,
    1080                 :            :                                   OUString sLocalName,
    1081                 :            :                                   OUString sValue,
    1082                 :            :                                   Reference<beans::XPropertySet>& rPropSet);
    1083                 :            : 
    1084                 :            :     static void GetServiceName(OUString& sServiceName,
    1085                 :            :                                enum XMLTextPElemTokens nToken);
    1086                 :            : 
    1087                 :            :     sal_Bool CreateMark(Reference<beans::XPropertySet>& rPropSet,
    1088                 :            :                         const OUString& rServiceName);
    1089                 :            : };
    1090                 :            : 
    1091                 :            : 
    1092 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLIndexMarkImportContext_Impl, SvXMLImportContext );
    1093                 :            : 
    1094                 :          0 : XMLIndexMarkImportContext_Impl::XMLIndexMarkImportContext_Impl(
    1095                 :            :     SvXMLImport& rImport,
    1096                 :            :     sal_uInt16 nPrefix,
    1097                 :            :     const OUString& rLocalName,
    1098                 :            :     enum XMLTextPElemTokens eTok,
    1099                 :            :     XMLHints_Impl& rHnts) :
    1100                 :            :         SvXMLImportContext(rImport, nPrefix, rLocalName),
    1101                 :            :         sAlternativeText("AlternativeText"),
    1102                 :            :         rHints(rHnts),
    1103                 :          0 :         eToken(eTok)
    1104                 :            : {
    1105                 :          0 : }
    1106                 :            : 
    1107                 :          0 : void XMLIndexMarkImportContext_Impl::StartElement(
    1108                 :            :     const Reference<xml::sax::XAttributeList> & xAttrList)
    1109                 :            : {
    1110                 :            :     // get Cursor position (needed for all cases)
    1111                 :            :     Reference<XTextRange> xPos(
    1112 [ #  # ][ #  # ]:          0 :         GetImport().GetTextImport()->GetCursor()->getStart());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1113                 :          0 :     Reference<beans::XPropertySet> xMark;
    1114                 :            : 
    1115   [ #  #  #  # ]:          0 :     switch (eToken)
    1116                 :            :     {
    1117                 :            :         case XML_TOK_TEXT_TOC_MARK:
    1118                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK:
    1119                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK:
    1120                 :            :         {
    1121                 :            :             // single mark: create mark and insert
    1122                 :          0 :             OUString sService;
    1123         [ #  # ]:          0 :             GetServiceName(sService, eToken);
    1124 [ #  # ][ #  # ]:          0 :             if (CreateMark(xMark, sService))
    1125                 :            :             {
    1126         [ #  # ]:          0 :                 ProcessAttributes(xAttrList, xMark);
    1127 [ #  # ][ #  # ]:          0 :                 XMLHint_Impl* pHint = new XMLIndexMarkHint_Impl(xMark, xPos);
    1128         [ #  # ]:          0 :                 rHints.push_back(pHint);
    1129                 :            :             }
    1130                 :            :             // else: can't create mark -> ignore
    1131                 :          0 :             break;
    1132                 :            :         }
    1133                 :            : 
    1134                 :            :         case XML_TOK_TEXT_TOC_MARK_START:
    1135                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK_START:
    1136                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
    1137                 :            :         {
    1138                 :            :             // start: create mark and insert (if ID is found)
    1139                 :          0 :             OUString sService;
    1140         [ #  # ]:          0 :             GetServiceName(sService, eToken);
    1141 [ #  # ][ #  # ]:          0 :             if (CreateMark(xMark, sService))
    1142                 :            :             {
    1143         [ #  # ]:          0 :                 ProcessAttributes(xAttrList, xMark);
    1144         [ #  # ]:          0 :                 if (!sID.isEmpty())
    1145                 :            :                 {
    1146                 :            :                     // process only if we find an ID
    1147                 :            :                     XMLHint_Impl* pHint =
    1148 [ #  # ][ #  # ]:          0 :                         new XMLIndexMarkHint_Impl(xMark, xPos, sID);
    1149         [ #  # ]:          0 :                     rHints.push_back(pHint);
    1150                 :            :                 }
    1151                 :            :                 // else: no ID -> we'll never find the end -> ignore
    1152                 :            :             }
    1153                 :            :             // else: can't create mark -> ignore
    1154                 :          0 :             break;
    1155                 :            :         }
    1156                 :            : 
    1157                 :            :         case XML_TOK_TEXT_TOC_MARK_END:
    1158                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK_END:
    1159                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
    1160                 :            :         {
    1161                 :            :             // end: search for ID and set end of mark
    1162                 :            : 
    1163                 :            :             // call process attributes with empty XPropertySet:
    1164         [ #  # ]:          0 :             ProcessAttributes(xAttrList, xMark);
    1165         [ #  # ]:          0 :             if (!sID.isEmpty())
    1166                 :            :             {
    1167                 :            :                 // if we have an ID, find the hint and set the end position
    1168                 :          0 :                 sal_uInt16 nCount = rHints.size();
    1169         [ #  # ]:          0 :                 for(sal_uInt16 nPos = 0; nPos < nCount; nPos++)
    1170                 :            :                 {
    1171         [ #  # ]:          0 :                     XMLHint_Impl *pHint = &rHints[nPos];
    1172   [ #  #  #  # ]:          0 :                     if ( pHint->IsIndexMark() &&
                 [ #  # ]
    1173                 :            :                          sID.equals(
    1174                 :          0 :                              ((XMLIndexMarkHint_Impl *)pHint)->GetID()) )
    1175                 :            :                     {
    1176                 :            :                         // set end and stop searching
    1177         [ #  # ]:          0 :                         pHint->SetEnd(xPos);
    1178                 :          0 :                         break;
    1179                 :            :                     }
    1180                 :            :                 }
    1181                 :            :             }
    1182                 :            :             // else: no ID -> ignore
    1183                 :          0 :             break;
    1184                 :            :         }
    1185                 :            : 
    1186                 :            :         default:
    1187                 :            :             OSL_FAIL("unknown index mark type!");
    1188                 :          0 :             break;
    1189                 :          0 :     }
    1190                 :          0 : }
    1191                 :            : 
    1192                 :          0 : void XMLIndexMarkImportContext_Impl::ProcessAttributes(
    1193                 :            :     const Reference<xml::sax::XAttributeList> & xAttrList,
    1194                 :            :     Reference<beans::XPropertySet>& rPropSet)
    1195                 :            : {
    1196                 :            :     // process attributes
    1197                 :          0 :     sal_Int16 nLength = xAttrList->getLength();
    1198         [ #  # ]:          0 :     for(sal_Int16 i=0; i<nLength; i++)
    1199                 :            :     {
    1200                 :          0 :         OUString sLocalName;
    1201                 :          0 :         sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
    1202   [ #  #  #  # ]:          0 :             GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName );
                 [ #  # ]
    1203                 :            : 
    1204                 :            :         ProcessAttribute(nPrefix, sLocalName,
    1205         [ #  # ]:          0 :                          xAttrList->getValueByIndex(i),
    1206 [ #  # ][ #  # ]:          0 :                          rPropSet);
    1207                 :          0 :     }
    1208                 :          0 : }
    1209                 :            : 
    1210                 :          0 : void XMLIndexMarkImportContext_Impl::ProcessAttribute(
    1211                 :            :     sal_uInt16 nNamespace,
    1212                 :            :     OUString sLocalName,
    1213                 :            :     OUString sValue,
    1214                 :            :     Reference<beans::XPropertySet>& rPropSet)
    1215                 :            : {
    1216                 :            :     // we only know ID + string-value attribute;
    1217                 :            :     // (former: marks, latter: -start + -end-marks)
    1218                 :            :     // the remainder is handled in sub-classes
    1219      [ #  #  # ]:          0 :     switch (eToken)
    1220                 :            :     {
    1221                 :            :         case XML_TOK_TEXT_TOC_MARK:
    1222                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK:
    1223                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK:
    1224   [ #  #  #  # ]:          0 :             if ( (XML_NAMESPACE_TEXT == nNamespace) &&
                 [ #  # ]
    1225                 :          0 :                  IsXMLToken( sLocalName, XML_STRING_VALUE ) )
    1226                 :            :             {
    1227         [ #  # ]:          0 :                 rPropSet->setPropertyValue(sAlternativeText, uno::makeAny(sValue));
    1228                 :            :             }
    1229                 :            :             // else: ignore!
    1230                 :          0 :             break;
    1231                 :            : 
    1232                 :            :         case XML_TOK_TEXT_TOC_MARK_START:
    1233                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK_START:
    1234                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
    1235                 :            :         case XML_TOK_TEXT_TOC_MARK_END:
    1236                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK_END:
    1237                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
    1238   [ #  #  #  # ]:          0 :             if ( (XML_NAMESPACE_TEXT == nNamespace) &&
                 [ #  # ]
    1239                 :          0 :                  IsXMLToken( sLocalName, XML_ID ) )
    1240                 :            :             {
    1241                 :          0 :                 sID = sValue;
    1242                 :            :             }
    1243                 :            :             // else: ignore
    1244                 :          0 :             break;
    1245                 :            : 
    1246                 :            :         default:
    1247                 :            :             OSL_FAIL("unknown index mark type!");
    1248                 :          0 :             break;
    1249                 :            :     }
    1250                 :          0 : }
    1251                 :            : 
    1252                 :            : static const sal_Char sAPI_com_sun_star_text_ContentIndexMark[] =
    1253                 :            :         "com.sun.star.text.ContentIndexMark";
    1254                 :            : static const sal_Char sAPI_com_sun_star_text_UserIndexMark[] =
    1255                 :            :         "com.sun.star.text.UserIndexMark";
    1256                 :            : static const sal_Char sAPI_com_sun_star_text_DocumentIndexMark[] =
    1257                 :            :         "com.sun.star.text.DocumentIndexMark";
    1258                 :            : 
    1259                 :            : 
    1260                 :          0 : void XMLIndexMarkImportContext_Impl::GetServiceName(
    1261                 :            :     OUString& sServiceName,
    1262                 :            :     enum XMLTextPElemTokens eToken)
    1263                 :            : {
    1264   [ #  #  #  # ]:          0 :     switch (eToken)
    1265                 :            :     {
    1266                 :            :         case XML_TOK_TEXT_TOC_MARK:
    1267                 :            :         case XML_TOK_TEXT_TOC_MARK_START:
    1268                 :            :         case XML_TOK_TEXT_TOC_MARK_END:
    1269                 :            :         {
    1270                 :            :             OUString sTmp(
    1271                 :          0 :                 sAPI_com_sun_star_text_ContentIndexMark);
    1272                 :          0 :             sServiceName = sTmp;
    1273                 :          0 :             break;
    1274                 :            :         }
    1275                 :            : 
    1276                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK:
    1277                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK_START:
    1278                 :            :         case XML_TOK_TEXT_USER_INDEX_MARK_END:
    1279                 :            :         {
    1280                 :            :             OUString sTmp(
    1281                 :          0 :                 sAPI_com_sun_star_text_UserIndexMark);
    1282                 :          0 :             sServiceName = sTmp;
    1283                 :          0 :             break;
    1284                 :            :         }
    1285                 :            : 
    1286                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK:
    1287                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
    1288                 :            :         case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
    1289                 :            :         {
    1290                 :            :             OUString sTmp(
    1291                 :          0 :                 sAPI_com_sun_star_text_DocumentIndexMark);
    1292                 :          0 :             sServiceName = sTmp;
    1293                 :          0 :             break;
    1294                 :            :         }
    1295                 :            : 
    1296                 :            :         default:
    1297                 :            :         {
    1298                 :            :             OSL_FAIL("unknown index mark type!");
    1299                 :          0 :             OUString sTmp;
    1300                 :          0 :             sServiceName = sTmp;
    1301                 :          0 :             break;
    1302                 :            :         }
    1303                 :            :     }
    1304                 :          0 : }
    1305                 :            : 
    1306                 :            : 
    1307                 :          0 : sal_Bool XMLIndexMarkImportContext_Impl::CreateMark(
    1308                 :            :     Reference<beans::XPropertySet>& rPropSet,
    1309                 :            :     const OUString& rServiceName)
    1310                 :            : {
    1311                 :            :     Reference<lang::XMultiServiceFactory>
    1312         [ #  # ]:          0 :         xFactory(GetImport().GetModel(), UNO_QUERY);
    1313                 :            : 
    1314         [ #  # ]:          0 :     if( xFactory.is() )
    1315                 :            :     {
    1316 [ #  # ][ #  # ]:          0 :         Reference<beans::XPropertySet> xPropSet( xFactory->createInstance(rServiceName), UNO_QUERY );
                 [ #  # ]
    1317         [ #  # ]:          0 :         if (xPropSet.is())
    1318         [ #  # ]:          0 :             rPropSet = xPropSet;
    1319                 :          0 :         return sal_True;
    1320                 :            :     }
    1321                 :            : 
    1322                 :          0 :     return sal_False;
    1323                 :            : }
    1324                 :            : 
    1325                 :            : 
    1326         [ #  # ]:          0 : class XMLTOCMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl
    1327                 :            : {
    1328                 :            :     const OUString sLevel;
    1329                 :            : 
    1330                 :            : public:
    1331                 :            :     TYPEINFO();
    1332                 :            : 
    1333                 :            :     XMLTOCMarkImportContext_Impl(
    1334                 :            :         SvXMLImport& rImport,
    1335                 :            :         sal_uInt16 nPrefix,
    1336                 :            :         const OUString& rLocalName,
    1337                 :            :         enum XMLTextPElemTokens nTok,
    1338                 :            :         XMLHints_Impl& rHnts);
    1339                 :            : 
    1340                 :            : protected:
    1341                 :            : 
    1342                 :            :     /** process outline level */
    1343                 :            :     virtual void ProcessAttribute(sal_uInt16 nNamespace,
    1344                 :            :                                   OUString sLocalName,
    1345                 :            :                                   OUString sValue,
    1346                 :            :                                   Reference<beans::XPropertySet>& rPropSet);
    1347                 :            : };
    1348                 :            : 
    1349 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLTOCMarkImportContext_Impl, XMLIndexMarkImportContext_Impl );
    1350                 :            : 
    1351                 :            : 
    1352                 :          0 : XMLTOCMarkImportContext_Impl::XMLTOCMarkImportContext_Impl(
    1353                 :            :     SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
    1354                 :            :     enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
    1355                 :            :         XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
    1356                 :            :                                        nTok, rHnts),
    1357                 :          0 :         sLevel("Level")
    1358                 :            : {
    1359                 :          0 : }
    1360                 :            : 
    1361                 :          0 : void XMLTOCMarkImportContext_Impl::ProcessAttribute(
    1362                 :            :     sal_uInt16 nNamespace,
    1363                 :            :     OUString sLocalName,
    1364                 :            :     OUString sValue,
    1365                 :            :     Reference<beans::XPropertySet>& rPropSet)
    1366                 :            : {
    1367                 :            :     DBG_ASSERT(rPropSet.is(), "need PropertySet");
    1368                 :            : 
    1369   [ #  #  #  # ]:          0 :     if ((XML_NAMESPACE_TEXT == nNamespace) &&
                 [ #  # ]
    1370                 :          0 :         IsXMLToken( sLocalName, XML_OUTLINE_LEVEL ) )
    1371                 :            :     {
    1372                 :            :         // ouline level: set Level property
    1373                 :            :         sal_Int32 nTmp;
    1374 [ #  # ][ #  # ]:          0 :         if (::sax::Converter::convertNumber( nTmp, sValue )
         [ #  # ][ #  # ]
                 [ #  # ]
    1375                 :            :              && nTmp >= 1
    1376                 :          0 :              && nTmp < GetImport().GetTextImport()->
    1377 [ #  # ][ #  # ]:          0 :                               GetChapterNumbering()->getCount() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1378                 :            :         {
    1379 [ #  # ][ #  # ]:          0 :             rPropSet->setPropertyValue(sLevel, uno::makeAny((sal_Int16)(nTmp - 1)));
                 [ #  # ]
    1380                 :            :         }
    1381                 :            :         // else: value out of range -> ignore
    1382                 :            :     }
    1383                 :            :     else
    1384                 :            :     {
    1385                 :            :         // else: delegate to superclass
    1386                 :            :         XMLIndexMarkImportContext_Impl::ProcessAttribute(
    1387         [ #  # ]:          0 :             nNamespace, sLocalName, sValue, rPropSet);
    1388                 :            :     }
    1389                 :          0 : }
    1390                 :            : 
    1391         [ #  # ]:          0 : class XMLUserIndexMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl
    1392                 :            : {
    1393                 :            :     const OUString sUserIndexName;
    1394                 :            :     const OUString sLevel;
    1395                 :            : 
    1396                 :            : public:
    1397                 :            :     TYPEINFO();
    1398                 :            : 
    1399                 :            :     XMLUserIndexMarkImportContext_Impl(
    1400                 :            :         SvXMLImport& rImport,
    1401                 :            :         sal_uInt16 nPrefix,
    1402                 :            :         const OUString& rLocalName,
    1403                 :            :         enum XMLTextPElemTokens nTok,
    1404                 :            :         XMLHints_Impl& rHnts);
    1405                 :            : 
    1406                 :            : protected:
    1407                 :            : 
    1408                 :            :     /** process index name */
    1409                 :            :     virtual void ProcessAttribute(sal_uInt16 nNamespace,
    1410                 :            :                                   OUString sLocalName,
    1411                 :            :                                   OUString sValue,
    1412                 :            :                                   Reference<beans::XPropertySet>& rPropSet);
    1413                 :            : };
    1414                 :            : 
    1415 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLUserIndexMarkImportContext_Impl, XMLIndexMarkImportContext_Impl);
    1416                 :            : 
    1417                 :          0 : XMLUserIndexMarkImportContext_Impl::XMLUserIndexMarkImportContext_Impl(
    1418                 :            :     SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
    1419                 :            :     enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
    1420                 :            :         XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
    1421                 :            :                                        nTok, rHnts),
    1422                 :            :         sUserIndexName("UserIndexName"),
    1423                 :          0 :         sLevel("Level")
    1424                 :            : {
    1425                 :          0 : }
    1426                 :            : 
    1427                 :          0 : void XMLUserIndexMarkImportContext_Impl::ProcessAttribute(
    1428                 :            :     sal_uInt16 nNamespace, OUString sLocalName, OUString sValue,
    1429                 :            :     Reference<beans::XPropertySet>& rPropSet)
    1430                 :            : {
    1431         [ #  # ]:          0 :     if ( XML_NAMESPACE_TEXT == nNamespace )
    1432                 :            :     {
    1433         [ #  # ]:          0 :         if ( IsXMLToken( sLocalName, XML_INDEX_NAME ) )
    1434                 :            :         {
    1435         [ #  # ]:          0 :             rPropSet->setPropertyValue(sUserIndexName, uno::makeAny(sValue));
    1436                 :            :         }
    1437         [ #  # ]:          0 :         else if ( IsXMLToken( sLocalName, XML_OUTLINE_LEVEL ) )
    1438                 :            :         {
    1439                 :            :             // ouline level: set Level property
    1440                 :            :             sal_Int32 nTmp;
    1441 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertNumber(
    1442                 :            :                 nTmp, sValue, 0,
    1443 [ #  # ][ #  # ]:          0 :                GetImport().GetTextImport()->GetChapterNumbering()->getCount()))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1444                 :            :             {
    1445 [ #  # ][ #  # ]:          0 :                 rPropSet->setPropertyValue(sLevel, uno::makeAny(static_cast<sal_Int16>(nTmp - 1)));
                 [ #  # ]
    1446                 :            :             }
    1447                 :            :             // else: value out of range -> ignore
    1448                 :            :         }
    1449                 :            :         else
    1450                 :            :         {
    1451                 :            :             // else: unknown text property: delegate to super class
    1452                 :            :             XMLIndexMarkImportContext_Impl::ProcessAttribute(
    1453         [ #  # ]:          0 :                 nNamespace, sLocalName, sValue, rPropSet);
    1454                 :            :         }
    1455                 :            :     }
    1456                 :            :     else
    1457                 :            :     {
    1458                 :            :         // else: unknown namespace: delegate to super class
    1459                 :            :         XMLIndexMarkImportContext_Impl::ProcessAttribute(
    1460         [ #  # ]:          0 :             nNamespace, sLocalName, sValue, rPropSet);
    1461                 :            :     }
    1462                 :          0 : }
    1463                 :            : 
    1464                 :            : 
    1465         [ #  # ]:          0 : class XMLAlphaIndexMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl
    1466                 :            : {
    1467                 :            :     const OUString sPrimaryKey;
    1468                 :            :     const OUString sSecondaryKey;
    1469                 :            :     const OUString sTextReading;
    1470                 :            :     const OUString sPrimaryKeyReading;
    1471                 :            :     const OUString sSecondaryKeyReading;
    1472                 :            :     const OUString sMainEntry;
    1473                 :            : 
    1474                 :            : public:
    1475                 :            :     TYPEINFO();
    1476                 :            : 
    1477                 :            :     XMLAlphaIndexMarkImportContext_Impl(
    1478                 :            :         SvXMLImport& rImport,
    1479                 :            :         sal_uInt16 nPrefix,
    1480                 :            :         const OUString& rLocalName,
    1481                 :            :         enum XMLTextPElemTokens nTok,
    1482                 :            :         XMLHints_Impl& rHnts);
    1483                 :            : 
    1484                 :            : protected:
    1485                 :            : 
    1486                 :            :     /** process primary + secondary keys */
    1487                 :            :     virtual void ProcessAttribute(sal_uInt16 nNamespace,
    1488                 :            :                                   OUString sLocalName,
    1489                 :            :                                   OUString sValue,
    1490                 :            :                                   Reference<beans::XPropertySet>& rPropSet);
    1491                 :            : };
    1492                 :            : 
    1493 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLAlphaIndexMarkImportContext_Impl,
    1494                 :            :            XMLIndexMarkImportContext_Impl );
    1495                 :            : 
    1496                 :          0 : XMLAlphaIndexMarkImportContext_Impl::XMLAlphaIndexMarkImportContext_Impl(
    1497                 :            :     SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName,
    1498                 :            :     enum XMLTextPElemTokens nTok, XMLHints_Impl& rHnts) :
    1499                 :            :         XMLIndexMarkImportContext_Impl(rImport, nPrefix, rLocalName,
    1500                 :            :                                        nTok, rHnts),
    1501                 :            :         sPrimaryKey("PrimaryKey"),
    1502                 :            :         sSecondaryKey("SecondaryKey"),
    1503                 :            :         sTextReading("TextReading"),
    1504                 :            :         sPrimaryKeyReading("PrimaryKeyReading"),
    1505                 :            :         sSecondaryKeyReading("SecondaryKeyReading"),
    1506                 :          0 :         sMainEntry("IsMainEntry")
    1507                 :            : {
    1508                 :          0 : }
    1509                 :            : 
    1510                 :          0 : void XMLAlphaIndexMarkImportContext_Impl::ProcessAttribute(
    1511                 :            :     sal_uInt16 nNamespace, OUString sLocalName, OUString sValue,
    1512                 :            :     Reference<beans::XPropertySet>& rPropSet)
    1513                 :            : {
    1514         [ #  # ]:          0 :     if (XML_NAMESPACE_TEXT == nNamespace)
    1515                 :            :     {
    1516         [ #  # ]:          0 :         if ( IsXMLToken( sLocalName, XML_KEY1 ) )
    1517                 :            :         {
    1518         [ #  # ]:          0 :             rPropSet->setPropertyValue(sPrimaryKey, uno::makeAny(sValue));
    1519                 :            :         }
    1520         [ #  # ]:          0 :         else if ( IsXMLToken( sLocalName, XML_KEY2 ) )
    1521                 :            :         {
    1522         [ #  # ]:          0 :             rPropSet->setPropertyValue(sSecondaryKey, uno::makeAny(sValue));
    1523                 :            :         }
    1524         [ #  # ]:          0 :         else if ( IsXMLToken( sLocalName, XML_KEY1_PHONETIC ) )
    1525                 :            :         {
    1526         [ #  # ]:          0 :             rPropSet->setPropertyValue(sPrimaryKeyReading, uno::makeAny(sValue));
    1527                 :            :         }
    1528         [ #  # ]:          0 :         else if ( IsXMLToken( sLocalName, XML_KEY2_PHONETIC ) )
    1529                 :            :         {
    1530         [ #  # ]:          0 :             rPropSet->setPropertyValue(sSecondaryKeyReading, uno::makeAny(sValue));
    1531                 :            :         }
    1532         [ #  # ]:          0 :         else if ( IsXMLToken( sLocalName, XML_STRING_VALUE_PHONETIC ) )
    1533                 :            :         {
    1534         [ #  # ]:          0 :             rPropSet->setPropertyValue(sTextReading, uno::makeAny(sValue));
    1535                 :            :         }
    1536         [ #  # ]:          0 :         else if ( IsXMLToken( sLocalName, XML_MAIN_ENTRY ) )
    1537                 :            :         {
    1538                 :          0 :             sal_Bool bMainEntry = sal_False;
    1539                 :          0 :             bool bTmp(false);
    1540                 :            : 
    1541 [ #  # ][ #  # ]:          0 :             if (::sax::Converter::convertBool(bTmp, sValue))
    1542                 :          0 :                 bMainEntry = bTmp;
    1543                 :            : 
    1544 [ #  # ][ #  # ]:          0 :             rPropSet->setPropertyValue(sMainEntry, uno::makeAny(bMainEntry));
                 [ #  # ]
    1545                 :            :         }
    1546                 :            :         else
    1547                 :            :         {
    1548                 :            :             XMLIndexMarkImportContext_Impl::ProcessAttribute(
    1549         [ #  # ]:          0 :                 nNamespace, sLocalName, sValue, rPropSet);
    1550                 :            :         }
    1551                 :            :     }
    1552                 :            :     else
    1553                 :            :     {
    1554                 :            :         XMLIndexMarkImportContext_Impl::ProcessAttribute(
    1555         [ #  # ]:          0 :             nNamespace, sLocalName, sValue, rPropSet);
    1556                 :            :     }
    1557                 :          0 : }
    1558                 :            : 
    1559                 :            : 
    1560                 :            : // ---------------------------------------------------------------------
    1561                 :            : 
    1562 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLImpSpanContext_Impl, SvXMLImportContext );
    1563                 :            : 
    1564                 :         91 : XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
    1565                 :            :         SvXMLImport& rImport,
    1566                 :            :         sal_uInt16 nPrfx,
    1567                 :            :         const OUString& rLName,
    1568                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList,
    1569                 :            :         XMLHints_Impl& rHnts,
    1570                 :            :         sal_Bool& rIgnLeadSpace
    1571                 :            :     ,sal_uInt8              nSFConvFlags
    1572                 :            :                                               )
    1573                 :            : :   SvXMLImportContext( rImport, nPrfx, rLName )
    1574                 :            : ,   sTextFrame("TextFrame")
    1575                 :            : ,   rHints( rHnts )
    1576                 :            : ,   pHint( 0  )
    1577                 :            : ,   rIgnoreLeadingSpace( rIgnLeadSpace )
    1578                 :         91 : ,   nStarFontsConvFlags( nSFConvFlags & (CONV_FROM_STAR_BATS|CONV_FROM_STAR_MATH) )
    1579                 :            : {
    1580                 :         91 :     OUString aStyleName;
    1581                 :            : 
    1582 [ +  - ][ +  - ]:         91 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
    1583         [ +  + ]:        182 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
    1584                 :            :     {
    1585 [ +  - ][ +  - ]:         91 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
    1586                 :            : 
    1587                 :         91 :         OUString aLocalName;
    1588                 :            :         sal_uInt16 nPrefix =
    1589                 :         91 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
    1590         [ +  - ]:         91 :                                                             &aLocalName );
    1591 [ +  - ][ +  - ]:        182 :         if( XML_NAMESPACE_TEXT == nPrefix &&
                 [ +  - ]
    1592         [ +  - ]:         91 :             IsXMLToken( aLocalName, XML_STYLE_NAME ) )
    1593 [ +  - ][ +  - ]:         91 :             aStyleName = xAttrList->getValueByIndex( i );
    1594                 :         91 :     }
    1595                 :            : 
    1596         [ +  - ]:         91 :     if( !aStyleName.isEmpty() )
    1597                 :            :     {
    1598                 :            :         pHint = new XMLStyleHint_Impl( aStyleName,
    1599 [ +  - ][ +  - ]:         91 :                   GetImport().GetTextImport()->GetCursorAsRange()->getStart() );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1600         [ +  - ]:         91 :             rHints.push_back( pHint );
    1601                 :         91 :     }
    1602                 :         91 : }
    1603                 :            : 
    1604                 :         91 : XMLImpSpanContext_Impl::~XMLImpSpanContext_Impl()
    1605                 :            : {
    1606         [ +  - ]:         91 :     if( pHint )
    1607                 :         91 :         pHint->SetEnd( GetImport().GetTextImport()
    1608 [ +  - ][ +  - ]:         91 :                             ->GetCursorAsRange()->getStart() );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1609         [ -  + ]:        182 : }
    1610                 :            : 
    1611                 :       4955 : SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
    1612                 :            :         SvXMLImport& rImport,
    1613                 :            :         sal_uInt16 nPrefix, const OUString& rLocalName,
    1614                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList,
    1615                 :            :         sal_uInt16 nToken,
    1616                 :            :         XMLHints_Impl& rHints,
    1617                 :            :         sal_Bool& rIgnoreLeadingSpace
    1618                 :            :     ,sal_uInt8              nStarFontsConvFlags
    1619                 :            :      )
    1620                 :            : {
    1621                 :       4955 :     SvXMLImportContext *pContext = 0;
    1622                 :            : 
    1623   [ +  +  -  +  :       4955 :     switch( nToken )
          +  +  +  +  -  
          -  -  +  -  -  
          -  -  -  -  +  
                   +  + ]
    1624                 :            :     {
    1625                 :            :     case XML_TOK_TEXT_SPAN:
    1626                 :            :         pContext = new XMLImpSpanContext_Impl( rImport, nPrefix,
    1627                 :            :                                                rLocalName, xAttrList,
    1628                 :            :                                                rHints,
    1629                 :            :                                                rIgnoreLeadingSpace
    1630                 :            :                                                ,nStarFontsConvFlags
    1631         [ +  - ]:         91 :                                              );
    1632                 :         91 :         break;
    1633                 :            : 
    1634                 :            :     case XML_TOK_TEXT_TAB_STOP:
    1635                 :            :         pContext = new XMLCharContext( rImport, nPrefix,
    1636                 :            :                                                rLocalName, xAttrList,
    1637         [ +  - ]:          2 :                                                0x0009, sal_False );
    1638                 :          2 :         rIgnoreLeadingSpace = sal_False;
    1639                 :          2 :         break;
    1640                 :            : 
    1641                 :            :     case XML_TOK_TEXT_LINE_BREAK:
    1642                 :            :         pContext = new XMLCharContext( rImport, nPrefix,
    1643                 :            :                                                rLocalName, xAttrList,
    1644         [ #  # ]:          0 :                                                ControlCharacter::LINE_BREAK );
    1645                 :          0 :         rIgnoreLeadingSpace = sal_False;
    1646                 :          0 :         break;
    1647                 :            : 
    1648                 :            :     case XML_TOK_TEXT_S:
    1649                 :            :         pContext = new XMLCharContext( rImport, nPrefix,
    1650                 :            :                                                rLocalName, xAttrList,
    1651         [ +  - ]:         19 :                                                0x0020, sal_True );
    1652                 :         19 :         break;
    1653                 :            : 
    1654                 :            :     case XML_TOK_TEXT_HYPERLINK:
    1655                 :            :     {
    1656                 :            :         // test for HyperLinkURL property. If present, insert link as
    1657                 :            :         // text property (StarWriter), else try to insert as text
    1658                 :            :         // field (StarCalc, StarDraw, ...)
    1659                 :            :         Reference<beans::XPropertySet> xPropSet(
    1660 [ +  - ][ +  - ]:          6 :             rImport.GetTextImport()->GetCursor(),
         [ +  - ][ +  - ]
    1661         [ +  - ]:          3 :             UNO_QUERY );
    1662                 :            : 
    1663                 :            :         const OUString sHyperLinkURL(
    1664                 :          3 :             "HyperLinkURL");
    1665                 :            : 
    1666 [ +  - ][ +  - ]:          3 :         if (xPropSet->getPropertySetInfo()->hasPropertyByName(sHyperLinkURL))
         [ +  - ][ +  - ]
                 [ +  - ]
    1667                 :            :         {
    1668                 :            :             pContext = new XMLImpHyperlinkContext_Impl( rImport, nPrefix,
    1669                 :            :                                                         rLocalName, xAttrList,
    1670                 :            :                                                         rHints,
    1671 [ +  - ][ +  - ]:          3 :                                                         rIgnoreLeadingSpace );
    1672                 :            :         }
    1673                 :            :         else
    1674                 :            :         {
    1675                 :            :             pContext = new XMLUrlFieldImportContext( rImport,
    1676 [ #  # ][ #  # ]:          0 :                                               *rImport.GetTextImport().get(),
    1677 [ #  # ][ #  # ]:          0 :                                                      nPrefix, rLocalName);
    1678                 :            :             //whitespace handling like other fields
    1679                 :          0 :             rIgnoreLeadingSpace = sal_False;
    1680                 :            : 
    1681                 :            :         }
    1682                 :          3 :         break;
    1683                 :            :     }
    1684                 :            : 
    1685                 :            :     case XML_TOK_TEXT_RUBY:
    1686                 :            :         pContext = new XMLImpRubyContext_Impl( rImport, nPrefix,
    1687                 :            :                                                rLocalName, xAttrList,
    1688                 :            :                                                rHints,
    1689         [ +  - ]:         24 :                                                rIgnoreLeadingSpace );
    1690                 :         24 :         break;
    1691                 :            : 
    1692                 :            :     case XML_TOK_TEXT_NOTE:
    1693 [ +  - ][ +  - ]:          3 :         if (rImport.GetTextImport()->IsInFrame())
                 [ -  + ]
    1694                 :            :         {
    1695                 :            :             // we must not insert footnotes into text frames
    1696                 :            :             pContext = new SvXMLImportContext( rImport, nPrefix,
    1697         [ #  # ]:          0 :                                                rLocalName );
    1698                 :            :         }
    1699                 :            :         else
    1700                 :            :         {
    1701                 :            :             pContext = new XMLFootnoteImportContext( rImport,
    1702                 :          6 :                                                      *rImport.GetTextImport().get(),
    1703 [ +  - ][ +  - ]:          3 :                                                      nPrefix, rLocalName );
    1704                 :            :         }
    1705                 :          3 :         rIgnoreLeadingSpace = sal_False;
    1706                 :          3 :         break;
    1707                 :            : 
    1708                 :            :     case XML_TOK_TEXT_REFERENCE:
    1709                 :            :     case XML_TOK_TEXT_BOOKMARK:
    1710                 :            :     case XML_TOK_TEXT_BOOKMARK_START:
    1711                 :            :     case XML_TOK_TEXT_BOOKMARK_END:
    1712                 :            :         pContext = new XMLTextMarkImportContext( rImport,
    1713                 :       7670 :                                                  *rImport.GetTextImport().get(),
    1714 [ +  - ][ +  - ]:       3835 :                                                  nPrefix, rLocalName );
    1715                 :       3835 :         break;
    1716                 :            : 
    1717                 :            :     case XML_TOK_TEXT_FIELDMARK:
    1718                 :            :     case XML_TOK_TEXT_FIELDMARK_START:
    1719                 :            :     case XML_TOK_TEXT_FIELDMARK_END:
    1720                 :            :         pContext = new XMLTextMarkImportContext( rImport,
    1721                 :          0 :                                                  *rImport.GetTextImport().get(),
    1722 [ #  # ][ #  # ]:          0 :                                                  nPrefix, rLocalName );
    1723                 :          0 :         break;
    1724                 :            : 
    1725                 :            :     case XML_TOK_TEXT_REFERENCE_START:
    1726                 :            :         pContext = new XMLStartReferenceContext_Impl( rImport,
    1727                 :            :                                                       nPrefix, rLocalName,
    1728         [ #  # ]:          0 :                                                       rHints, xAttrList );
    1729                 :          0 :         break;
    1730                 :            : 
    1731                 :            :     case XML_TOK_TEXT_REFERENCE_END:
    1732                 :            :         pContext = new XMLEndReferenceContext_Impl( rImport,
    1733                 :            :                                                     nPrefix, rLocalName,
    1734         [ #  # ]:          0 :                                                     rHints, xAttrList );
    1735                 :          0 :         break;
    1736                 :            : 
    1737                 :            :     case XML_TOK_TEXT_FRAME:
    1738                 :            :         {
    1739                 :            :             Reference < XTextRange > xAnchorPos =
    1740 [ +  - ][ +  - ]:          6 :                 rImport.GetTextImport()->GetCursor()->getStart();
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1741                 :            :             XMLTextFrameContext *pTextFrameContext =
    1742                 :            :                 new XMLTextFrameContext( rImport, nPrefix,
    1743                 :            :                                          rLocalName, xAttrList,
    1744 [ +  - ][ +  - ]:          6 :                                          TextContentAnchorType_AS_CHARACTER );
    1745                 :            :             // Remove check for text content. (#i33242#)
    1746                 :            :             // Check for text content is done on the processing of the hint
    1747         [ -  + ]:          6 :             if( TextContentAnchorType_AT_CHARACTER ==
    1748         [ +  - ]:          6 :                                             pTextFrameContext->GetAnchorType() )
    1749                 :            :             {
    1750                 :            :                 rHints.push_back( new XMLTextFrameHint_Impl(
    1751 [ #  # ][ #  # ]:          0 :                     pTextFrameContext, xAnchorPos ) );
                 [ #  # ]
    1752                 :            :             }
    1753                 :          6 :             pContext = pTextFrameContext;
    1754                 :          6 :             rIgnoreLeadingSpace = sal_False;
    1755                 :            :         }
    1756                 :          6 :         break;
    1757                 :            :     case XML_TOK_DRAW_A:
    1758                 :            :         {
    1759 [ #  # ][ #  # ]:          0 :             Reference < XTextRange > xAnchorPos(rImport.GetTextImport()->GetCursor()->getStart());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1760                 :            :             pContext =
    1761                 :            :                 new XMLTextFrameHyperlinkContext( rImport, nPrefix,
    1762                 :            :                                         rLocalName, xAttrList,
    1763 [ #  # ][ #  # ]:          0 :                                         TextContentAnchorType_AS_CHARACTER );
    1764                 :            :             XMLTextFrameHint_Impl *pHint =
    1765 [ #  # ][ #  # ]:          0 :                 new XMLTextFrameHint_Impl( pContext, xAnchorPos);
    1766         [ #  # ]:          0 :             rHints.push_back( pHint );
    1767                 :            :         }
    1768                 :          0 :         break;
    1769                 :            : 
    1770                 :            :     case XML_TOK_TEXT_TOC_MARK:
    1771                 :            :     case XML_TOK_TEXT_TOC_MARK_START:
    1772                 :            :         pContext = new XMLTOCMarkImportContext_Impl(
    1773                 :            :             rImport, nPrefix, rLocalName,
    1774         [ #  # ]:          0 :             (enum XMLTextPElemTokens)nToken, rHints);
    1775                 :          0 :         break;
    1776                 :            : 
    1777                 :            :     case XML_TOK_TEXT_USER_INDEX_MARK:
    1778                 :            :     case XML_TOK_TEXT_USER_INDEX_MARK_START:
    1779                 :            :         pContext = new XMLUserIndexMarkImportContext_Impl(
    1780                 :            :             rImport, nPrefix, rLocalName,
    1781         [ #  # ]:          0 :             (enum XMLTextPElemTokens)nToken, rHints);
    1782                 :          0 :         break;
    1783                 :            : 
    1784                 :            :     case XML_TOK_TEXT_ALPHA_INDEX_MARK:
    1785                 :            :     case XML_TOK_TEXT_ALPHA_INDEX_MARK_START:
    1786                 :            :         pContext = new XMLAlphaIndexMarkImportContext_Impl(
    1787                 :            :             rImport, nPrefix, rLocalName,
    1788         [ #  # ]:          0 :             (enum XMLTextPElemTokens)nToken, rHints);
    1789                 :          0 :         break;
    1790                 :            : 
    1791                 :            :     case XML_TOK_TEXT_TOC_MARK_END:
    1792                 :            :     case XML_TOK_TEXT_USER_INDEX_MARK_END:
    1793                 :            :     case XML_TOK_TEXT_ALPHA_INDEX_MARK_END:
    1794                 :            :         pContext = new XMLIndexMarkImportContext_Impl(
    1795                 :            :             rImport, nPrefix, rLocalName, (enum XMLTextPElemTokens)nToken,
    1796         [ #  # ]:          0 :             rHints);
    1797                 :          0 :         break;
    1798                 :            : 
    1799                 :            :     case XML_TOK_TEXTP_CHANGE_START:
    1800                 :            :     case XML_TOK_TEXTP_CHANGE_END:
    1801                 :            :     case XML_TOK_TEXTP_CHANGE:
    1802                 :            :         pContext = new XMLChangeImportContext(
    1803                 :            :             rImport, nPrefix, rLocalName,
    1804                 :            :             (nToken != XML_TOK_TEXTP_CHANGE_END),
    1805                 :            :             (nToken != XML_TOK_TEXTP_CHANGE_START),
    1806         [ #  # ]:          0 :             sal_False);
    1807                 :          0 :         break;
    1808                 :            : 
    1809                 :            :     case XML_TOK_TEXT_META:
    1810                 :            :         pContext = new XMLMetaImportContext(rImport, nPrefix, rLocalName,
    1811         [ +  - ]:         38 :             rHints, rIgnoreLeadingSpace );
    1812                 :         38 :         break;
    1813                 :            : 
    1814                 :            :     case XML_TOK_TEXT_META_FIELD:
    1815                 :            :         pContext = new XMLMetaFieldImportContext(rImport, nPrefix, rLocalName,
    1816         [ +  - ]:         42 :             rHints, rIgnoreLeadingSpace );
    1817                 :         42 :         break;
    1818                 :            : 
    1819                 :            :     default:
    1820                 :            :         // none of the above? then it's probably  a text field!
    1821                 :            :         pContext =
    1822                 :            :             XMLTextFieldImportContext::CreateTextFieldImportContext(
    1823                 :       1784 :                 rImport, *rImport.GetTextImport().get(), nPrefix, rLocalName,
    1824         [ +  - ]:        892 :                 nToken);
    1825                 :            :         // #108784# import draw elements (except control shapes in headers)
    1826 [ -  + ][ +  + ]:       1811 :         if( pContext == NULL &&
                 [ +  + ]
    1827 [ +  - ][ +  - ]:        919 :             !( rImport.GetTextImport()->IsInHeaderFooter() &&
         [ +  - ][ +  + ]
                 [ #  # ]
    1828                 :            :                nPrefix == XML_NAMESPACE_DRAW &&
    1829 [ #  # ][ #  # ]:          0 :                IsXMLToken( rLocalName, XML_CONTROL ) ) )
                 [ #  # ]
    1830                 :            :         {
    1831                 :         27 :             Reference < XShapes > xShapes;
    1832                 :            :             SvXMLShapeContext* pShapeContext = rImport.GetShapeImport()->CreateGroupChildContext(
    1833 [ +  - ][ +  - ]:         27 :                 rImport, nPrefix, rLocalName, xAttrList, xShapes );
         [ +  - ][ +  - ]
    1834                 :         27 :             pContext = pShapeContext;
    1835                 :            :             // OD 2004-04-20 #i26791# - keep shape in a text frame hint to
    1836                 :            :             // adjust its anchor position, if its at-character anchored
    1837                 :            :             Reference < XTextRange > xAnchorPos =
    1838 [ +  - ][ +  - ]:         27 :                 rImport.GetTextImport()->GetCursor()->getStart();
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1839 [ +  - ][ +  - ]:         27 :             rHints.push_back( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ) );
                 [ +  - ]
    1840                 :            :         }
    1841         [ -  + ]:        892 :         if( !pContext )
    1842                 :            :         {
    1843                 :            :             // ignore unknown content
    1844                 :            :             pContext =
    1845         [ #  # ]:          0 :                 new SvXMLImportContext( rImport, nPrefix, rLocalName );
    1846                 :            :         }
    1847                 :            :         // Behind fields, shapes and any unknown content blanks aren't ignored
    1848                 :        892 :         rIgnoreLeadingSpace = sal_False;
    1849                 :            :     }
    1850                 :            : 
    1851                 :       4955 :     return pContext;
    1852                 :            : }
    1853                 :            : 
    1854                 :         63 : SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
    1855                 :            :         sal_uInt16 nPrefix, const OUString& rLocalName,
    1856                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList )
    1857                 :            : {
    1858                 :            :     const SvXMLTokenMap& rTokenMap =
    1859 [ +  - ][ +  - ]:         63 :         GetImport().GetTextImport()->GetTextPElemTokenMap();
    1860                 :         63 :     sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
    1861                 :            : 
    1862                 :         63 :     return CreateChildContext( GetImport(), nPrefix, rLocalName, xAttrList,
    1863                 :            :                                nToken, rHints, rIgnoreLeadingSpace
    1864                 :            :                                ,nStarFontsConvFlags
    1865                 :         63 :                              );
    1866                 :            : }
    1867                 :            : 
    1868                 :         28 : void XMLImpSpanContext_Impl::Characters( const OUString& rChars )
    1869                 :            : {
    1870                 :         28 :     OUString sStyleName;
    1871         [ +  - ]:         28 :     if( pHint )
    1872                 :         28 :         sStyleName = pHint->GetStyleName();
    1873                 :            :     OUString sChars =
    1874                 :         28 :         GetImport().GetTextImport()->ConvertStarFonts( rChars, sStyleName,
    1875                 :            :                                                        nStarFontsConvFlags,
    1876 [ +  - ][ +  - ]:         56 :                                                        sal_False, GetImport() );
         [ +  - ][ +  - ]
    1877 [ +  - ][ +  - ]:         28 :     GetImport().GetTextImport()->InsertString( sChars, rIgnoreLeadingSpace );
         [ +  - ][ +  - ]
    1878                 :         28 : }
    1879                 :            : 
    1880                 :            : // ---------------------------------------------------------------------
    1881                 :            : 
    1882 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLParaContext, SvXMLImportContext );
    1883                 :            : 
    1884                 :       1680 : XMLParaContext::XMLParaContext(
    1885                 :            :         SvXMLImport& rImport,
    1886                 :            :         sal_uInt16 nPrfx,
    1887                 :            :         const OUString& rLName,
    1888                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList,
    1889                 :            :         sal_Bool bHead ) :
    1890                 :            :     SvXMLImportContext( rImport, nPrfx, rLName ),
    1891 [ +  - ][ +  - ]:       3360 :     xStart( rImport.GetTextImport()->GetCursorAsRange()->getStart() ),
         [ +  - ][ +  - ]
                 [ +  - ]
    1892                 :            :     m_bHaveAbout(false),
    1893         [ +  - ]:       1680 :     nOutlineLevel( IsXMLToken( rLName, XML_H ) ? 1 : -1 ),
    1894                 :            :     pHints( 0 ),
    1895                 :            :     // Lost outline numbering in master document (#i73509#)
    1896                 :            :     mbOutlineLevelAttrFound( sal_False ),
    1897                 :            :     bIgnoreLeadingSpace( sal_True ),
    1898                 :            :     bHeading( bHead ),
    1899                 :            :     bIsListHeader( false ),
    1900                 :            :     bIsRestart (false),
    1901                 :            :     nStartValue(0),
    1902 [ +  - ][ +  + ]:       6720 :     nStarFontsConvFlags( 0 )
    1903                 :            : {
    1904                 :            :     const SvXMLTokenMap& rTokenMap =
    1905 [ +  - ][ +  - ]:       1680 :         GetImport().GetTextImport()->GetTextPAttrTokenMap();
         [ +  - ][ +  - ]
    1906                 :            : 
    1907                 :       1680 :     bool bHaveXmlId( false );
    1908                 :       1680 :     OUString aCondStyleName, sClassNames;
    1909                 :            : 
    1910 [ +  - ][ +  - ]:       1680 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
                 [ +  - ]
    1911         [ +  + ]:       2846 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
    1912                 :            :     {
    1913 [ +  - ][ +  - ]:       1166 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
    1914 [ +  - ][ +  - ]:       1166 :         const OUString& rValue = xAttrList->getValueByIndex( i );
    1915                 :            : 
    1916                 :       1166 :         OUString aLocalName;
    1917                 :            :         sal_uInt16 nPrefix =
    1918                 :       1166 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
    1919         [ +  - ]:       1166 :                                                             &aLocalName );
    1920 [ +  - ][ +  +  :       1166 :         switch( rTokenMap.Get( nPrefix, aLocalName ) )
          +  +  +  -  +  
          -  -  +  -  -  
                   -  + ]
    1921                 :            :         {
    1922                 :            :         case XML_TOK_TEXT_P_XMLID:
    1923                 :         30 :             m_sXmlId = rValue;
    1924                 :         30 :             bHaveXmlId = true;
    1925                 :         30 :             break;
    1926                 :            :         case XML_TOK_TEXT_P_ABOUT:
    1927                 :         68 :             m_sAbout = rValue;
    1928                 :         68 :             m_bHaveAbout = true;
    1929                 :         68 :             break;
    1930                 :            :         case XML_TOK_TEXT_P_PROPERTY:
    1931                 :         68 :             m_sProperty = rValue;
    1932                 :         68 :             break;
    1933                 :            :         case XML_TOK_TEXT_P_CONTENT:
    1934                 :         20 :             m_sContent = rValue;
    1935                 :         20 :             break;
    1936                 :            :         case XML_TOK_TEXT_P_DATATYPE:
    1937                 :         14 :             m_sDatatype = rValue;
    1938                 :         14 :             break;
    1939                 :            :         case XML_TOK_TEXT_P_TEXTID:
    1940         [ #  # ]:          0 :             if (!bHaveXmlId) { m_sXmlId = rValue; }
    1941                 :          0 :             break;
    1942                 :            :         case XML_TOK_TEXT_P_STYLE_NAME:
    1943                 :        894 :             sStyleName = rValue;
    1944                 :        894 :             break;
    1945                 :            :         case XML_TOK_TEXT_P_CLASS_NAMES:
    1946                 :          0 :             sClassNames = rValue;
    1947                 :          0 :             break;
    1948                 :            :         case XML_TOK_TEXT_P_COND_STYLE_NAME:
    1949                 :          0 :             aCondStyleName = rValue;
    1950                 :          0 :             break;
    1951                 :            :         case XML_TOK_TEXT_P_LEVEL:
    1952                 :            :             {
    1953                 :          6 :                 sal_Int32 nTmp = rValue.toInt32();
    1954         [ +  - ]:          6 :                 if( nTmp > 0L )
    1955                 :            :                 {
    1956         [ -  + ]:          6 :                     if( nTmp > 127 )
    1957                 :          0 :                         nTmp = 127;
    1958                 :          6 :                     nOutlineLevel = (sal_Int8)nTmp;
    1959                 :            :                 }
    1960                 :            :                 // Lost outline numbering in master document (#i73509#)
    1961                 :          6 :                 mbOutlineLevelAttrFound = sal_True;
    1962                 :            :             }
    1963                 :          6 :             break;
    1964                 :            :         case XML_TOK_TEXT_P_IS_LIST_HEADER:
    1965                 :            :             {
    1966                 :          0 :                 bool bBool(false);
    1967 [ #  # ][ #  # ]:          0 :                 if( ::sax::Converter::convertBool( bBool, rValue ) )
    1968                 :            :                 {
    1969                 :          0 :                     bIsListHeader = bBool;
    1970                 :            :                 }
    1971                 :            :             }
    1972                 :          0 :             break;
    1973                 :            :         case XML_TOK_TEXT_P_RESTART_NUMBERING:
    1974                 :            :             {
    1975                 :          0 :                 bool bBool(false);
    1976 [ #  # ][ #  # ]:          0 :                 if (::sax::Converter::convertBool(bBool, rValue))
    1977                 :            :                 {
    1978                 :          0 :                     bIsRestart = bBool;
    1979                 :            :                 }
    1980                 :            :             }
    1981                 :          0 :             break;
    1982                 :            :         case XML_TOK_TEXT_P_START_VALUE:
    1983                 :            :             {
    1984                 :            :                 nStartValue = sal::static_int_cast< sal_Int16 >(
    1985                 :          0 :                     rValue.toInt32());
    1986                 :            :             }
    1987                 :          0 :             break;
    1988                 :            :         }
    1989                 :       1166 :     }
    1990                 :            : 
    1991         [ -  + ]:       1680 :     if( !aCondStyleName.isEmpty() )
    1992                 :          0 :         sStyleName = aCondStyleName;
    1993         [ -  + ]:       1680 :     else if( !sClassNames.isEmpty() )
    1994                 :            :     {
    1995                 :          0 :         sal_Int32 nDummy = 0;
    1996                 :          0 :         sStyleName = sClassNames.getToken( 0, ' ', nDummy );
    1997                 :       1680 :     }
    1998                 :       1680 : }
    1999                 :            : 
    2000 [ -  + ][ -  + ]:       1680 : XMLParaContext::~XMLParaContext()
         [ -  + ][ -  + ]
         [ -  + ][ -  + ]
                 [ -  + ]
    2001                 :            : {
    2002                 :            :     UniReference < XMLTextImportHelper > xTxtImport(
    2003         [ +  - ]:       1680 :         GetImport().GetTextImport());
    2004 [ +  - ][ +  - ]:       1680 :     Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
    2005         [ -  + ]:       1680 :     if( !xCrsrRange.is() )
    2006                 :            :         return; // Robust (defect file)
    2007 [ +  - ][ +  - ]:       1680 :     Reference < XTextRange > xEnd(xCrsrRange->getStart());
    2008                 :            : 
    2009                 :            :     // if we have an id set for this paragraph, get a cursor for this
    2010                 :            :     // paragraph and register it with the given identifier
    2011                 :            :     // FIXME: this is just temporary, and should be removed when
    2012                 :            :     // EditEngine paragraphs implement XMetadatable!
    2013         [ +  + ]:       1680 :     if (!m_sXmlId.isEmpty())
    2014                 :            :     {
    2015 [ +  - ][ +  - ]:         30 :         Reference < XTextCursor > xIdCursor( xTxtImport->GetText()->createTextCursorByRange( xStart ) );
         [ +  - ][ +  - ]
    2016         [ +  - ]:         30 :         if( xIdCursor.is() )
    2017                 :            :         {
    2018 [ +  - ][ +  - ]:         30 :             xIdCursor->gotoRange( xEnd, sal_True );
    2019         [ +  - ]:         30 :             Reference< XInterface > xRef( xIdCursor, UNO_QUERY );
    2020         [ +  - ]:         30 :             GetImport().getInterfaceToIdentifierMapper().registerReference(
    2021         [ +  - ]:         30 :                 m_sXmlId, xRef);
    2022                 :         30 :         }
    2023                 :            :     }
    2024                 :            : 
    2025                 :            :     // insert a paragraph break
    2026 [ +  - ][ +  - ]:       1680 :     xTxtImport->InsertControlCharacter( ControlCharacter::APPEND_PARAGRAPH );
    2027                 :            : 
    2028                 :            :     // create a cursor that select the whole last paragraph
    2029                 :       1680 :     Reference < XTextCursor > xAttrCursor;
    2030                 :            :     try {
    2031 [ +  - ][ +  - ]:       1680 :         xAttrCursor = xTxtImport->GetText()->createTextCursorByRange( xStart );
         [ +  - ][ +  - ]
         [ #  # ][ +  - ]
    2032         [ -  + ]:       1680 :         if( !xAttrCursor.is() )
    2033                 :            :             return; // Robust (defect file)
    2034         [ #  # ]:          0 :     } catch (const uno::Exception &) {
    2035                 :            :         // createTextCursorByRange() likes to throw runtime exception, even
    2036                 :            :         // though it just means 'we were unable to create the cursor'
    2037                 :            :         return;
    2038                 :            :     }
    2039 [ +  - ][ +  - ]:       1680 :     xAttrCursor->gotoRange( xEnd, sal_True );
    2040                 :            : 
    2041                 :            :     // xml:id for RDF metadata
    2042 [ +  + ][ +  + ]:       1680 :     if (!m_sXmlId.isEmpty() || m_bHaveAbout || !m_sProperty.isEmpty())
         [ +  + ][ +  + ]
    2043                 :            :     {
    2044                 :            :         try {
    2045                 :            :             const uno::Reference<container::XEnumerationAccess> xEA
    2046         [ +  - ]:         72 :                 (xAttrCursor, uno::UNO_QUERY_THROW);
    2047                 :            :             const uno::Reference<container::XEnumeration> xEnum(
    2048 [ +  - ][ +  - ]:         72 :                 xEA->createEnumeration(), uno::UNO_QUERY_THROW);
                 [ +  - ]
    2049                 :            :             OSL_ENSURE(xEnum->hasMoreElements(), "xml:id: no paragraph?");
    2050 [ +  - ][ +  - ]:         72 :             if (xEnum->hasMoreElements()) {
                 [ +  - ]
    2051                 :         72 :                 uno::Reference<rdf::XMetadatable> xMeta;
    2052 [ +  - ][ +  - ]:         72 :                 xEnum->nextElement() >>= xMeta;
                 [ +  - ]
    2053                 :            :                 OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
    2054         [ +  - ]:         72 :                 GetImport().SetXmlId(xMeta, m_sXmlId);
    2055         [ +  + ]:         72 :                 if (m_bHaveAbout)
    2056                 :            :                 {
    2057                 :         68 :                     GetImport().AddRDFa(xMeta,
    2058         [ +  - ]:        136 :                         m_sAbout, m_sProperty, m_sContent, m_sDatatype);
    2059                 :            :                 }
    2060                 :         72 :                 OSL_ENSURE(!xEnum->hasMoreElements(), "xml:id: > 1 paragraph?");
    2061         [ #  # ]:         72 :             }
    2062         [ #  # ]:          0 :         } catch (const uno::Exception &) {
    2063                 :            :             OSL_TRACE("XMLParaContext::~XMLParaContext: exception");
    2064                 :            :         }
    2065                 :            :     }
    2066                 :            : 
    2067 [ +  - ][ +  - ]:       1680 :     OUString const sCellParaStyleName(xTxtImport->GetCellParaStyleDefault());
    2068         [ +  + ]:       1680 :     if( !sCellParaStyleName.isEmpty() )
    2069                 :            :     {
    2070                 :            :         /* Suppress handling of outline and list attributes,
    2071                 :            :            because of side effects of method <SetStyleAndAttrs(..)> (#i80724#)
    2072                 :            :         */
    2073                 :         51 :         xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
    2074                 :            :                                       sCellParaStyleName,
    2075                 :            :                                       sal_True,
    2076                 :            :                                       sal_False, -1, // suppress outline handling
    2077 [ +  - ][ +  - ]:         51 :                                       sal_False );   // suppress list attributes handling
    2078                 :            :     }
    2079                 :            : 
    2080                 :            :     // #103445# for headings without style name, find the proper style
    2081 [ +  + ][ -  + ]:       1680 :     if( bHeading && sStyleName.isEmpty() )
                 [ -  + ]
    2082 [ #  # ][ #  # ]:          0 :         xTxtImport->FindOutlineStyleName( sStyleName, nOutlineLevel );
    2083                 :            : 
    2084                 :            :     // set style and hard attributes at the previous paragraph
    2085                 :            :     // Add paramter <mbOutlineLevelAttrFound> (#i73509#)
    2086                 :       1680 :     sStyleName = xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
    2087                 :            :                                                sStyleName,
    2088                 :            :                                                sal_True,
    2089                 :            :                                                mbOutlineLevelAttrFound,
    2090 [ +  + ][ +  - ]:       3360 :                                                bHeading ? nOutlineLevel : -1 );
                 [ +  - ]
    2091                 :            : 
    2092                 :            :     // handle list style header
    2093 [ +  - ][ -  + ]:       1680 :     if (bHeading && (bIsListHeader || bIsRestart))
                 [ +  + ]
    2094                 :            :     {
    2095         [ #  # ]:          0 :         Reference<XPropertySet> xPropSet( xAttrCursor, UNO_QUERY );
    2096                 :            : 
    2097         [ #  # ]:          0 :         if (xPropSet.is())
    2098                 :            :         {
    2099         [ #  # ]:          0 :             if (bIsListHeader)
    2100                 :            :             {
    2101                 :            :                 OUString sNumberingIsNumber
    2102                 :          0 :                     ("NumberingIsNumber");
    2103 [ #  # ][ #  # ]:          0 :                 if(xPropSet->getPropertySetInfo()->
         [ #  # ][ #  # ]
    2104         [ #  # ]:          0 :                    hasPropertyByName(sNumberingIsNumber))
    2105                 :            :                 {
    2106         [ #  # ]:          0 :                     xPropSet->setPropertyValue
    2107 [ #  # ][ #  # ]:          0 :                         (sNumberingIsNumber, makeAny( false ) );
    2108                 :          0 :                 }
    2109                 :            :             }
    2110         [ #  # ]:          0 :             if (bIsRestart)
    2111                 :            :             {
    2112                 :            :                 OUString sParaIsNumberingRestart
    2113                 :          0 :                     ("ParaIsNumberingRestart");
    2114                 :            :                 OUString sNumberingStartValue
    2115                 :          0 :                     ("NumberingStartValue");
    2116 [ #  # ][ #  # ]:          0 :                 if (xPropSet->getPropertySetInfo()->
         [ #  # ][ #  # ]
    2117         [ #  # ]:          0 :                     hasPropertyByName(sParaIsNumberingRestart))
    2118                 :            :                 {
    2119         [ #  # ]:          0 :                     xPropSet->setPropertyValue
    2120 [ #  # ][ #  # ]:          0 :                         (sParaIsNumberingRestart, makeAny(true));
    2121                 :            :                 }
    2122                 :            : 
    2123 [ #  # ][ #  # ]:          0 :                 if (xPropSet->getPropertySetInfo()->
         [ #  # ][ #  # ]
    2124         [ #  # ]:          0 :                     hasPropertyByName(sNumberingStartValue))
    2125                 :            :                 {
    2126         [ #  # ]:          0 :                     xPropSet->setPropertyValue
    2127 [ #  # ][ #  # ]:          0 :                         (sNumberingStartValue, makeAny(nStartValue));
    2128                 :          0 :                 }
    2129                 :            :             }
    2130                 :            : 
    2131                 :          0 :         }
    2132                 :            :     }
    2133                 :            : 
    2134 [ +  + ][ +  + ]:       1680 :     if( pHints && !pHints->empty() )
                 [ +  + ]
    2135                 :            :     {
    2136         [ +  + ]:        220 :         for( sal_uInt16 i=0; i<pHints->size(); i++ )
    2137                 :            :         {
    2138         [ +  - ]:        121 :             XMLHint_Impl *pHint = &(*pHints)[i];
    2139 [ +  - ][ +  - ]:        121 :             xAttrCursor->gotoRange( pHint->GetStart(), sal_False );
    2140 [ +  - ][ +  - ]:        121 :             xAttrCursor->gotoRange( pHint->GetEnd(), sal_True );
    2141   [ +  -  +  -  :        121 :             switch( pHint->GetType() )
                -  +  - ]
    2142                 :            :             {
    2143                 :            :             case XML_HINT_STYLE:
    2144                 :            :                 {
    2145                 :            :                     const OUString& rStyleName =
    2146                 :         91 :                             ((XMLStyleHint_Impl *)pHint)->GetStyleName();
    2147         [ +  - ]:         91 :                     if( !rStyleName.isEmpty() )
    2148                 :         91 :                         xTxtImport->SetStyleAndAttrs( GetImport(),
    2149                 :            :                                                       xAttrCursor, rStyleName,
    2150 [ +  - ][ +  - ]:         91 :                                                       sal_False );
    2151                 :            :                 }
    2152                 :         91 :                 break;
    2153                 :            :             case XML_HINT_REFERENCE:
    2154                 :            :                 {
    2155                 :            :                     const OUString& rRefName =
    2156                 :          0 :                             ((XMLReferenceHint_Impl *)pHint)->GetRefName();
    2157         [ #  # ]:          0 :                     if( !rRefName.isEmpty() )
    2158                 :            :                     {
    2159         [ #  # ]:          0 :                         if( !pHint->GetEnd().is() )
    2160         [ #  # ]:          0 :                             pHint->SetEnd(xEnd);
    2161                 :            : 
    2162                 :            :                         // convert XCursor to XTextRange
    2163         [ #  # ]:          0 :                         Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
    2164                 :            : 
    2165                 :            :                         // reference name uses rStyleName member
    2166                 :            :                         // borrow from XMLTextMarkImportContext
    2167                 :            :                         XMLTextMarkImportContext::CreateAndInsertMark(
    2168                 :          0 :                             GetImport(),
    2169                 :            :                             OUString( "com.sun.star.text.ReferenceMark"),
    2170                 :            :                             rRefName,
    2171         [ #  # ]:          0 :                             xRange);
    2172                 :            :                     }
    2173                 :            :                 }
    2174                 :          0 :                 break;
    2175                 :            :             case XML_HINT_HYPERLINK:
    2176                 :            :                 {
    2177                 :            :                     const XMLHyperlinkHint_Impl *pHHint =
    2178                 :          3 :                         (const XMLHyperlinkHint_Impl *)pHint;
    2179                 :          3 :                     xTxtImport->SetHyperlink( GetImport(),
    2180                 :            :                                               xAttrCursor,
    2181                 :          3 :                                               pHHint->GetHRef(),
    2182                 :          3 :                                               pHHint->GetName(),
    2183                 :          3 :                                               pHHint->GetTargetFrameName(),
    2184                 :          3 :                                               pHHint->GetStyleName(),
    2185                 :          3 :                                               pHHint->GetVisitedStyleName(),
    2186 [ +  - ][ +  - ]:          6 :                                               pHHint->GetEventsContext() );
    2187                 :            :                 }
    2188                 :          3 :                 break;
    2189                 :            :             case XML_HINT_INDEX_MARK:
    2190                 :            :                 {
    2191                 :            :                     Reference<beans::XPropertySet> xMark(
    2192                 :          0 :                         ((const XMLIndexMarkHint_Impl *)pHint)->GetMark());
    2193         [ #  # ]:          0 :                     Reference<XTextContent> xContent(xMark, UNO_QUERY);
    2194         [ #  # ]:          0 :                     Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
    2195 [ #  # ][ #  # ]:          0 :                     xTxtImport->GetText()->insertTextContent(
                 [ #  # ]
    2196         [ #  # ]:          0 :                         xRange, xContent, sal_True );
    2197                 :            :                 }
    2198                 :          0 :                 break;
    2199                 :            :             case XML_HINT_TEXT_FRAME:
    2200                 :            :                 {
    2201                 :            :                     const XMLTextFrameHint_Impl *pFHint =
    2202                 :          0 :                         (const XMLTextFrameHint_Impl *)pHint;
    2203                 :            :                     // Check for text content (#i33242#)
    2204                 :            :                     Reference < XTextContent > xTextContent =
    2205         [ #  # ]:          0 :                                                     pFHint->GetTextContent();
    2206         [ #  # ]:          0 :                     if ( xTextContent.is() )
    2207                 :            :                     {
    2208                 :            :                         /* Core impl. of the unification of drawing objects and
    2209                 :            :                            Writer fly frames (#i26791#)
    2210                 :            :                         */
    2211         [ #  # ]:          0 :                         Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
    2212 [ #  # ][ #  # ]:          0 :                         if ( pFHint->IsBoundAtChar() )
    2213                 :            :                         {
    2214 [ #  # ][ #  # ]:          0 :                             xTextContent->attach( xRange );
    2215                 :          0 :                         }
    2216                 :            :                     }
    2217                 :            :                     /* Consider, that hint can also contain a shape -
    2218                 :            :                        e.g. drawing object of type 'Text'. (#i33242#)
    2219                 :            :                     */
    2220                 :            :                     else
    2221                 :            :                     {
    2222         [ #  # ]:          0 :                         Reference < XShape > xShape = pFHint->GetShape();
    2223         [ #  # ]:          0 :                         if ( xShape.is() )
    2224                 :            :                         {
    2225                 :            :                             // determine anchor type
    2226         [ #  # ]:          0 :                             Reference < XPropertySet > xPropSet( xShape, UNO_QUERY );
    2227                 :            :                             TextContentAnchorType eAnchorType =
    2228                 :          0 :                                             TextContentAnchorType_AT_PARAGRAPH;
    2229                 :            :                             {
    2230                 :          0 :                                 OUString sAnchorType( "AnchorType"  );
    2231 [ #  # ][ #  # ]:          0 :                                 Any aAny = xPropSet->getPropertyValue( sAnchorType );
    2232         [ #  # ]:          0 :                                 aAny >>= eAnchorType;
    2233                 :            :                             }
    2234         [ #  # ]:          0 :                             if ( TextContentAnchorType_AT_CHARACTER == eAnchorType )
    2235                 :            :                             {
    2236                 :            :                                 // set anchor position for at-character anchored objects
    2237         [ #  # ]:          0 :                                 Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
    2238                 :          0 :                                 Any aPos;
    2239         [ #  # ]:          0 :                                 aPos <<= xRange;
    2240                 :          0 :                                 OUString sTextRange( "TextRange"  );
    2241 [ #  # ][ #  # ]:          0 :                                 xPropSet->setPropertyValue(sTextRange, aPos);
    2242                 :          0 :                             }
    2243                 :          0 :                         }
    2244                 :          0 :                     }
    2245                 :            :                 }
    2246                 :          0 :                 break;
    2247                 :            :             /* Core impl. of the unification of drawing objects and
    2248                 :            :                Writer fly frames (#i26791#)
    2249                 :            :             */
    2250                 :            :             case XML_HINT_DRAW:
    2251                 :            :                 {
    2252                 :            :                     const XMLDrawHint_Impl *pDHint =
    2253                 :         27 :                         static_cast<const XMLDrawHint_Impl*>(pHint);
    2254                 :            :                     // Improvement: hint directly provides the shape. (#i33242#)
    2255         [ +  - ]:         27 :                     Reference < XShape > xShape = pDHint->GetShape();
    2256         [ +  + ]:         27 :                     if ( xShape.is() )
    2257                 :            :                     {
    2258                 :            :                         // determine anchor type
    2259         [ +  - ]:         12 :                         Reference < XPropertySet > xPropSet( xShape, UNO_QUERY );
    2260                 :         12 :                         TextContentAnchorType eAnchorType = TextContentAnchorType_AT_PARAGRAPH;
    2261                 :            :                         {
    2262                 :         12 :                             OUString sAnchorType( "AnchorType"  );
    2263 [ +  - ][ +  - ]:         12 :                             Any aAny = xPropSet->getPropertyValue( sAnchorType );
    2264         [ +  - ]:         12 :                             aAny >>= eAnchorType;
    2265                 :            :                         }
    2266         [ -  + ]:         12 :                         if ( TextContentAnchorType_AT_CHARACTER == eAnchorType )
    2267                 :            :                         {
    2268                 :            :                             // set anchor position for at-character anchored objects
    2269         [ #  # ]:          0 :                             Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
    2270                 :          0 :                             Any aPos;
    2271         [ #  # ]:          0 :                             aPos <<= xRange;
    2272                 :          0 :                             OUString sTextRange( "TextRange"  );
    2273 [ #  # ][ #  # ]:          0 :                             xPropSet->setPropertyValue(sTextRange, aPos);
    2274                 :         12 :                         }
    2275                 :         27 :                     }
    2276                 :            :                 }
    2277                 :         27 :                 break;
    2278                 :            :             default:
    2279                 :            :                 DBG_ASSERT( !this, "What's this" );
    2280                 :          0 :                 break;
    2281                 :            :             }
    2282                 :            :         }
    2283                 :            :     }
    2284 [ +  + ][ +  - ]:       1680 :     delete pHints;
         [ -  + ][ -  + ]
         [ -  + ][ +  - ]
                 [ +  - ]
    2285         [ -  + ]:       3360 : }
    2286                 :            : 
    2287                 :       4852 : SvXMLImportContext *XMLParaContext::CreateChildContext(
    2288                 :            :         sal_uInt16 nPrefix, const OUString& rLocalName,
    2289                 :            :         const Reference< xml::sax::XAttributeList > & xAttrList )
    2290                 :            : {
    2291                 :            :     const SvXMLTokenMap& rTokenMap =
    2292 [ +  - ][ +  - ]:       4852 :         GetImport().GetTextImport()->GetTextPElemTokenMap();
    2293                 :       4852 :     sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
    2294         [ +  + ]:       4852 :     if( !pHints )
    2295         [ +  - ]:        711 :         pHints = new XMLHints_Impl;
    2296                 :            :     return XMLImpSpanContext_Impl::CreateChildContext(
    2297                 :       4852 :                                 GetImport(), nPrefix, rLocalName, xAttrList,
    2298                 :            :                                    nToken, *pHints, bIgnoreLeadingSpace
    2299                 :            :                                 , nStarFontsConvFlags
    2300                 :       4852 :                                                      );
    2301                 :            : }
    2302                 :            : 
    2303                 :       4716 : void XMLParaContext::Characters( const OUString& rChars )
    2304                 :            : {
    2305                 :            :     OUString sChars =
    2306                 :       4716 :         GetImport().GetTextImport()->ConvertStarFonts( rChars, sStyleName,
    2307                 :            :                                                        nStarFontsConvFlags,
    2308 [ +  - ][ +  - ]:       9432 :                                                        sal_True, GetImport() );
         [ +  - ][ +  - ]
    2309 [ +  - ][ +  - ]:       4716 :     GetImport().GetTextImport()->InsertString( sChars, bIgnoreLeadingSpace );
         [ +  - ][ +  - ]
    2310                 :       4716 : }
    2311                 :            : 
    2312                 :            : 
    2313                 :            : 
    2314 [ #  # ][ #  # ]:          0 : TYPEINIT1( XMLNumberedParaContext, SvXMLImportContext );
    2315                 :            : 
    2316                 :          0 : XMLNumberedParaContext::XMLNumberedParaContext(
    2317                 :            :         SvXMLImport& i_rImport,
    2318                 :            :         sal_uInt16 i_nPrefix,
    2319                 :            :         const OUString& i_rLocalName,
    2320                 :            :         const Reference< xml::sax::XAttributeList > & i_xAttrList ) :
    2321                 :            :     SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName ),
    2322                 :            :     m_Level(0),
    2323                 :            :     m_StartValue(-1),
    2324                 :            :     m_ListId(),
    2325                 :          0 :     m_xNumRules()
    2326                 :            : {
    2327                 :          0 :     ::rtl::OUString StyleName;
    2328                 :            : 
    2329                 :            :     const SvXMLTokenMap& rTokenMap(
    2330 [ #  # ][ #  # ]:          0 :         i_rImport.GetTextImport()->GetTextNumberedParagraphAttrTokenMap() );
         [ #  # ][ #  # ]
    2331                 :            : 
    2332                 :          0 :     const sal_Int16 nAttrCount( i_xAttrList.is() ?
    2333 [ #  # ][ #  # ]:          0 :         i_xAttrList->getLength() : 0 );
                 [ #  # ]
    2334         [ #  # ]:          0 :     for ( sal_Int16 i=0; i < nAttrCount; i++ )
    2335                 :            :     {
    2336 [ #  # ][ #  # ]:          0 :         const ::rtl::OUString& rAttrName( i_xAttrList->getNameByIndex( i )  );
    2337 [ #  # ][ #  # ]:          0 :         const ::rtl::OUString& rValue   ( i_xAttrList->getValueByIndex( i ) );
    2338                 :            : 
    2339                 :          0 :         ::rtl::OUString aLocalName;
    2340                 :            :         const sal_uInt16 nPrefix(
    2341                 :          0 :             GetImport().GetNamespaceMap().GetKeyByAttrName(
    2342         [ #  # ]:          0 :                 rAttrName, &aLocalName ) );
    2343 [ #  # ][ #  #  :          0 :         switch( rTokenMap.Get( nPrefix, aLocalName ) )
             #  #  #  #  
                      # ]
    2344                 :            :         {
    2345                 :            :             case XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID:
    2346                 :          0 :                 m_XmlId = rValue;
    2347                 :            : //FIXME: there is no UNO API for lists
    2348                 :          0 :                 break;
    2349                 :            :             case XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID:
    2350                 :          0 :                 m_ListId = rValue;
    2351                 :          0 :                 break;
    2352                 :            :             case XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL:
    2353                 :            :                 {
    2354                 :          0 :                     sal_Int32 nTmp = rValue.toInt32();
    2355 [ #  # ][ #  # ]:          0 :                     if ( nTmp >= 1 && nTmp <= SHRT_MAX ) {
    2356                 :          0 :                         m_Level = static_cast<sal_uInt16>(nTmp) - 1;
    2357                 :            :                     }
    2358                 :            :                 }
    2359                 :          0 :                 break;
    2360                 :            :             case XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME:
    2361                 :          0 :                 StyleName = rValue;
    2362                 :          0 :                 break;
    2363                 :            :             case XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING:
    2364                 :            :                 // this attribute is deprecated
    2365                 :            : //                ContinuteNumbering = IsXMLToken(rValue, XML_TRUE);
    2366                 :          0 :                 break;
    2367                 :            :             case XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE:
    2368                 :            :                 {
    2369                 :          0 :                     sal_Int32 nTmp = rValue.toInt32();
    2370 [ #  # ][ #  # ]:          0 :                     if ( nTmp >= 0 && nTmp <= SHRT_MAX ) {
    2371                 :          0 :                         m_StartValue = static_cast<sal_Int16>(nTmp);
    2372                 :            :                     }
    2373                 :            :                 }
    2374                 :          0 :                 break;
    2375                 :            :         }
    2376                 :          0 :     }
    2377                 :            : 
    2378                 :            :     XMLTextListsHelper& rTextListsHelper(
    2379 [ #  # ][ #  # ]:          0 :         i_rImport.GetTextImport()->GetTextListHelper() );
         [ #  # ][ #  # ]
    2380         [ #  # ]:          0 :     if (m_ListId.isEmpty())
    2381                 :            :       {
    2382                 :            :         OSL_ENSURE( i_rImport.GetODFVersion() != "1.2", "invalid numbered-paragraph: no list-id (1.2)" );
    2383                 :            :         m_ListId = rTextListsHelper.GetNumberedParagraphListId(m_Level,
    2384         [ #  # ]:          0 :             StyleName);
    2385                 :            :         OSL_ENSURE(!m_ListId.isEmpty(), "numbered-paragraph: no ListId");
    2386         [ #  # ]:          0 :         if (m_ListId.isEmpty()) {
    2387                 :          0 :             return;
    2388                 :            :         }
    2389                 :            :     }
    2390                 :            :     m_xNumRules = rTextListsHelper.EnsureNumberedParagraph( i_rImport,
    2391 [ #  # ][ #  # ]:          0 :         m_ListId, m_Level, StyleName);
    2392                 :            : 
    2393                 :            :     OSL_ENSURE(m_xNumRules.is(), "numbered-paragraph: no NumRules");
    2394                 :            : 
    2395 [ #  # ][ #  # ]:          0 :     i_rImport.GetTextImport()->GetTextListHelper().PushListContext( this );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2396                 :            : }
    2397                 :            : 
    2398                 :          0 : XMLNumberedParaContext::~XMLNumberedParaContext()
    2399                 :            : {
    2400         [ #  # ]:          0 : }
    2401                 :            : 
    2402                 :          0 : void XMLNumberedParaContext::EndElement()
    2403                 :            : {
    2404         [ #  # ]:          0 :     if (!m_ListId.isEmpty()) {
    2405 [ #  # ][ #  # ]:          0 :         GetImport().GetTextImport()->PopListContext();
    2406                 :            :     }
    2407                 :          0 : }
    2408                 :            : 
    2409                 :          0 : SvXMLImportContext *XMLNumberedParaContext::CreateChildContext(
    2410                 :            :     sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
    2411                 :            :     const Reference< xml::sax::XAttributeList > & i_xAttrList )
    2412                 :            : {
    2413                 :          0 :     SvXMLImportContext *pContext( 0 );
    2414                 :            : 
    2415         [ #  # ]:          0 :     if ( XML_NAMESPACE_TEXT == i_nPrefix )
    2416                 :            :     {
    2417                 :          0 :         bool bIsHeader( IsXMLToken( i_rLocalName, XML_H ) );
    2418 [ #  # ][ #  # ]:          0 :         if ( bIsHeader || IsXMLToken( i_rLocalName, XML_P ) )
                 [ #  # ]
    2419                 :            :         {
    2420                 :          0 :             pContext = new XMLParaContext( GetImport(),
    2421         [ #  # ]:          0 :                 i_nPrefix, i_rLocalName, i_xAttrList, bIsHeader );
    2422                 :            : // ignore text:number       } else if (IsXMLToken( i_rLocalName, XML_NUMBER )) {
    2423                 :            :         }
    2424                 :            :     }
    2425                 :            : 
    2426         [ #  # ]:          0 :     if (!pContext) {
    2427                 :            :         pContext = SvXMLImportContext::CreateChildContext(
    2428                 :          0 :             i_nPrefix, i_rLocalName, i_xAttrList );
    2429                 :            :     }
    2430                 :            : 
    2431                 :          0 :     return pContext;
    2432                 :            : }
    2433                 :            : 
    2434                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10