LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLFastContextHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 708 916 77.3 %
Date: 2012-08-25 Functions: 162 210 77.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 606 1404 43.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <stdio.h>
      21                 :            : #include <iostream>
      22                 :            : #include <set>
      23                 :            : #include <comphelper/servicehelper.hxx>
      24                 :            : #include <com/sun/star/drawing/XShapes.hpp>
      25                 :            : #include <resourcemodel/QNameToString.hxx>
      26                 :            : #include <resourcemodel/XPathLogger.hxx>
      27                 :            : #include <resourcemodel/util.hxx>
      28                 :            : #include <ooxml/resourceids.hxx>
      29                 :            : #include <doctok/sprmids.hxx>
      30                 :            : #include <ooxml/OOXMLnamespaceids.hxx>
      31                 :            : #include <dmapper/DomainMapper.hxx>
      32                 :            : #include <dmapper/GraphicHelpers.hxx>
      33                 :            : #include <comphelper/embeddedobjectcontainer.hxx>
      34                 :            : #include <tools/globname.hxx>
      35                 :            : #include <comphelper/classids.hxx>
      36                 :            : #include <sfx2/sfxbasemodel.hxx>
      37                 :            : #include "OOXMLFastContextHandler.hxx"
      38                 :            : #include "OOXMLFactory.hxx"
      39                 :            : #include "Handler.hxx"
      40                 :            : #include "ooxmlLoggers.hxx"
      41                 :            : 
      42                 :            : static const sal_uInt8 s0x7[] = { 0x7, 0x0 };
      43                 :            : static const sal_uInt8 s0xd[] = { 0xd, 0x0 };
      44                 :            : static const sal_uInt8 sCR[] = { 0xd, 0x0 };
      45                 :            : static const sal_uInt8 sFtnEdnRef[] = { 0x2, 0x0 };
      46                 :            : static const sal_uInt8 sFtnEdnSep[] = { 0x3, 0x0 };
      47                 :            : static const sal_uInt8 sFtnEdnCont[] = { 0x4, 0x0 };
      48                 :            : static const sal_uInt8 sTab[] = { 0x9, 0x0 };
      49                 :            : static const sal_uInt8 sPgNum[] = { 0x0, 0x0 };
      50                 :            : static const sal_uInt8 sFieldStart[] = { 0x13  };
      51                 :            : static const sal_uInt8 sFieldSep[] = { 0x14 };
      52                 :            : static const sal_uInt8 sFieldEnd[] = { 0x15 };
      53                 :            : static const sal_uInt8 sNoBreakHyphen[] = { 0x1e, 0x0 };
      54                 :            : static const sal_uInt8 sSoftHyphen[] = { 0x1f, 0x0 };
      55                 :            : 
      56                 :            : namespace writerfilter {
      57                 :            : namespace ooxml
      58                 :            : {
      59                 :            : using ::com::sun::star::lang::XMultiComponentFactory;
      60                 :            : using namespace ::com::sun::star;
      61                 :            : using namespace ::std;
      62                 :            : 
      63                 :            : #if OSL_DEBUG_LEVEL > 1
      64                 :            : static string resourceToString
      65                 :            : (OOXMLFastContextHandler::ResourceEnum_t eResource)
      66                 :            : {
      67                 :            :     string sResult;
      68                 :            : 
      69                 :            :     switch (eResource)
      70                 :            :     {
      71                 :            :     case OOXMLFastContextHandler::STREAM:
      72                 :            :         sResult = "Stream";
      73                 :            :         break;
      74                 :            :     case OOXMLFastContextHandler::PROPERTIES:
      75                 :            :         sResult = "Properties";
      76                 :            :         break;
      77                 :            :     case OOXMLFastContextHandler::TABLE:
      78                 :            :         sResult = "Table";
      79                 :            :         break;
      80                 :            :     case OOXMLFastContextHandler::SHAPE:
      81                 :            :         sResult = "Shape";
      82                 :            :         break;
      83                 :            :     default:
      84                 :            :         sResult = "??";
      85                 :            :     }
      86                 :            : 
      87                 :            :     return sResult;
      88                 :            : }
      89                 :            : #endif
      90                 :            : 
      91                 :         20 : set<OOXMLFastContextHandler *> aSetContexts;
      92                 :            : 
      93                 :            : #if OSL_DEBUG_LEVEL > 1
      94                 :            : class OOXMLIdToString : public IdToString
      95                 :            : {
      96                 :            : public:
      97                 :            :     OOXMLIdToString() : IdToString() {}
      98                 :            :     virtual ~OOXMLIdToString() {}
      99                 :            : 
     100                 :            :     virtual string toString(const Id & rId) const
     101                 :            :     {
     102                 :            :         string s((*QNameToString::Instance())(rId));
     103                 :            : 
     104                 :            :         if (s.empty())
     105                 :            :             s = "(fasttoken)" + fastTokenToId(rId);
     106                 :            :         else
     107                 :            :             s = "(qname)" + s;
     108                 :            : 
     109                 :            :         return s;
     110                 :            :     }
     111                 :            : };
     112                 :            : #endif
     113                 :            : 
     114                 :            : /*
     115                 :            :   class OOXMLFastContextHandler
     116                 :            :  */
     117                 :            : 
     118                 :            : sal_uInt32 OOXMLFastContextHandler::mnInstanceCount = 0;
     119                 :            : 
     120                 :        859 : OOXMLFastContextHandler::OOXMLFastContextHandler
     121                 :            : (uno::Reference< uno::XComponentContext > const & context)
     122                 :            : : mpParent(NULL),
     123                 :            :   mId(0),
     124                 :            :   mnDefine(0),
     125                 :            :   mnToken(OOXML_FAST_TOKENS_END),
     126                 :            :   mpStream(NULL),
     127                 :            :   mnTableDepth(0),
     128                 :            :   mnInstanceNumber(mnInstanceCount),
     129                 :            :   mnRefCount(0),
     130                 :            :   inPositionV(false),
     131         [ +  - ]:        859 :   m_xContext(context)
     132                 :            : {
     133                 :        859 :     mnInstanceCount++;
     134         [ +  - ]:        859 :     aSetContexts.insert(this);
     135                 :            : 
     136         [ +  - ]:        859 :     if (mpParserState.get() == NULL)
     137 [ +  - ][ +  - ]:        859 :         mpParserState.reset(new OOXMLParserState());
                 [ +  - ]
     138                 :            : 
     139         [ +  - ]:        859 :     mpParserState->incContextCount();
     140                 :        859 : }
     141                 :            : 
     142                 :      45374 : OOXMLFastContextHandler::OOXMLFastContextHandler
     143                 :            : (OOXMLFastContextHandler * pContext)
     144                 :            : : cppu::WeakImplHelper1<com::sun::star::xml::sax::XFastContextHandler>(),
     145                 :            :   mpParent(pContext),
     146                 :            :   mId(0),
     147                 :            :   mnDefine(0),
     148                 :            :   mnToken(OOXML_FAST_TOKENS_END),
     149                 :            :   mpStream(NULL),
     150                 :            :   mnTableDepth(0),
     151                 :            :   mnInstanceNumber(mnInstanceCount),
     152                 :            :   mnRefCount(0),
     153                 :            :   inPositionV(pContext->inPositionV),
     154         [ +  - ]:      45374 :   m_xContext(pContext->m_xContext)
     155                 :            : {
     156         [ +  - ]:      45374 :     if (pContext != NULL)
     157                 :            :     {
     158                 :      45374 :         mpStream = pContext->mpStream;
     159         [ +  - ]:      45374 :         mpParserState = pContext->mpParserState;
     160                 :      45374 :         mnTableDepth = pContext->mnTableDepth;
     161         [ +  - ]:      45374 :         m_xContext = pContext->m_xContext;
     162                 :            :     }
     163                 :            : 
     164         [ -  + ]:      45374 :     if (mpParserState.get() == NULL)
     165 [ #  # ][ #  # ]:          0 :         mpParserState.reset(new OOXMLParserState());
                 [ #  # ]
     166                 :            : 
     167                 :      45374 :     mnInstanceCount++;
     168         [ +  - ]:      45374 :     aSetContexts.insert(this);
     169         [ +  - ]:      45374 :     mpParserState->incContextCount();
     170                 :      45374 : }
     171                 :            : 
     172         [ +  - ]:      46242 : OOXMLFastContextHandler::~OOXMLFastContextHandler()
     173                 :            : {
     174         [ +  - ]:      46242 :     aSetContexts.erase(this);
     175         [ -  + ]:      47110 : }
     176                 :            : 
     177                 :            : // ::com::sun::star::xml::sax::XFastContextHandler:
     178                 :      52250 : void SAL_CALL OOXMLFastContextHandler::startFastElement
     179                 :            : (Token_t Element,
     180                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
     181                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
     182                 :            : {
     183                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     184                 :            :     debug_logger->startElement("contexthandler.element");
     185                 :            :     string sToken = fastTokenToId(Element);
     186                 :            :     mpParserState->getXPathLogger().startElement(sToken);
     187                 :            :     debug_logger->attribute("token", sToken);
     188                 :            :     debug_logger->attribute("type", getType());
     189                 :            :     debug_logger->attribute("xpath", mpParserState->getXPathLogger().getXPath());
     190                 :            :     debug_logger->startElement("at-start");
     191                 :            :     dumpXml( debug_logger );
     192                 :            :     debug_logger->endElement();
     193                 :            : #endif
     194                 :      52250 :     attributes(Attribs);
     195                 :      52250 :     lcl_startFastElement(Element, Attribs);
     196                 :      52250 : }
     197                 :            : 
     198                 :          9 : void SAL_CALL OOXMLFastContextHandler::startUnknownElement
     199                 :            : (const OUString & Namespace, const OUString & Name,
     200                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
     201                 :            : throw (uno::RuntimeException, xml::sax::SAXException)
     202                 :            : {
     203                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     204                 :            :     debug_logger->startElement("contexthandler.unknown-element");
     205                 :            :     debug_logger->attribute("namespace", Namespace);
     206                 :            :     debug_logger->attribute("name", Name);
     207                 :            :     mpParserState->getXPathLogger().startElement("unknown");
     208                 :            : #else
     209                 :            :     (void) Namespace;
     210                 :            :     (void) Name;
     211                 :            : #endif
     212                 :          9 : }
     213                 :            : 
     214                 :      52232 : void SAL_CALL OOXMLFastContextHandler::endFastElement(Token_t Element)
     215                 :            : throw (uno::RuntimeException, xml::sax::SAXException)
     216                 :            : {
     217                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     218                 :            :     string sToken = fastTokenToId(Element);
     219                 :            :     (void) sToken;
     220                 :            : #endif
     221                 :            : 
     222                 :      52232 :     lcl_endFastElement(Element);
     223                 :            : 
     224                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     225                 :            :     debug_logger->startElement("at-end");
     226                 :            :     dumpXml( debug_logger );
     227                 :            :     debug_logger->endElement();
     228                 :            :     debug_logger->endElement();
     229                 :            :     mpParserState->getXPathLogger().endElement();
     230                 :            : #endif
     231                 :      52232 : }
     232                 :            : 
     233                 :      44603 : void OOXMLFastContextHandler::lcl_startFastElement
     234                 :            : (Token_t Element,
     235                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
     236                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
     237                 :            : {
     238         [ +  - ]:      44603 :     OOXMLFactory::getInstance()->startAction(this, Element);
     239         [ +  + ]:      44603 :     if( Element == (NS_wordprocessingDrawing|OOXML_positionV) )
     240                 :         12 :         inPositionV = true;
     241         [ +  + ]:      44591 :     else if( Element == (NS_wordprocessingDrawing|OOXML_positionH) )
     242                 :         12 :         inPositionV = false;
     243                 :            : 
     244                 :      44603 : }
     245                 :            : 
     246                 :       3108 : void OOXMLFastContextHandler::lcl_endFastElement
     247                 :            : (Token_t Element)
     248                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
     249                 :            : {
     250         [ +  - ]:       3108 :     OOXMLFactory::getInstance()->endAction(this, Element);
     251                 :       3108 : }
     252                 :            : 
     253                 :          9 : void SAL_CALL OOXMLFastContextHandler::endUnknownElement
     254                 :            : (const OUString & , const OUString & )
     255                 :            : throw (uno::RuntimeException, xml::sax::SAXException)
     256                 :            : {
     257                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     258                 :            :     debug_logger->endElement();
     259                 :            :     mpParserState->getXPathLogger().endElement();
     260                 :            : #endif
     261                 :          9 : }
     262                 :            : 
     263                 :            : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     264                 :      52916 :  OOXMLFastContextHandler::createFastChildContext
     265                 :            : (Token_t Element,
     266                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
     267                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
     268                 :            : {
     269                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     270                 :            :     debug_logger->startElement("contexthandler.createFastChildContext");
     271                 :            :     debug_logger->attribute("token", fastTokenToId(Element));
     272                 :            :     debug_logger->attribute("type", getType());
     273                 :            : #endif
     274                 :            : 
     275                 :            :     uno::Reference< xml::sax::XFastContextHandler > xResult
     276                 :      52916 :         (lcl_createFastChildContext(Element, Attribs));
     277                 :            : 
     278                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     279                 :            :     debug_logger->endElement();
     280                 :            : #endif
     281                 :            : 
     282                 :      52916 :     return xResult;
     283                 :            : }
     284                 :            : 
     285                 :            : uno::Reference< xml::sax::XFastContextHandler >
     286                 :      45587 :  OOXMLFastContextHandler::lcl_createFastChildContext
     287                 :            : (Token_t Element,
     288                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
     289                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
     290                 :            : {
     291         [ +  - ]:      45587 :     return OOXMLFactory::getInstance()->createFastChildContext(this, Element);
     292                 :            : }
     293                 :            : 
     294                 :            : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     295                 :          9 : OOXMLFastContextHandler::createUnknownChildContext
     296                 :            : (const OUString & Namespace,
     297                 :            :  const OUString & Name,
     298                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
     299                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
     300                 :            : {
     301                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     302                 :            :     debug_logger->startElement("contexthandler.createUnknownChildContext");
     303                 :            :     debug_logger->attribute("namespace", Namespace);
     304                 :            :     debug_logger->attribute("name", Name);
     305                 :            :     debug_logger->endElement();
     306                 :            : #else
     307                 :            :     (void) Namespace;
     308                 :            :     (void) Name;
     309                 :            : #endif
     310                 :            : 
     311                 :            :     return uno::Reference< xml::sax::XFastContextHandler >
     312 [ +  - ][ +  - ]:          9 :         (new OOXMLFastContextHandler(*const_cast<const OOXMLFastContextHandler *>(this)));
     313                 :            : }
     314                 :            : 
     315                 :       6742 : void SAL_CALL OOXMLFastContextHandler::characters
     316                 :            : (const OUString & aChars)
     317                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
     318                 :            : {
     319                 :       6742 :     lcl_characters(aChars);
     320                 :       6742 : }
     321                 :            : 
     322                 :       4630 : void OOXMLFastContextHandler::lcl_characters
     323                 :            : (const OUString & rString)
     324                 :            : throw (uno::RuntimeException, xml::sax::SAXException)
     325                 :            : {
     326         [ +  - ]:       4630 :     OOXMLFactory::getInstance()->characters(this, rString);
     327                 :       4630 : }
     328                 :            : 
     329                 :            : namespace
     330                 :            : {
     331                 :            :     class theOOXMLFastContextHandlerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theOOXMLFastContextHandlerUnoTunnelId > {};
     332                 :            : }
     333                 :            : 
     334                 :          0 : const uno::Sequence< sal_Int8 > & OOXMLFastContextHandler::getUnoTunnelId()
     335                 :            : {
     336                 :          0 :     return theOOXMLFastContextHandlerUnoTunnelId::get().getSeq();
     337                 :            : }
     338                 :            : 
     339                 :          0 : sal_Int64 SAL_CALL OOXMLFastContextHandler::getSomething( const uno::Sequence< sal_Int8 >& rId )
     340                 :            :     throw(uno::RuntimeException)
     341                 :            : {
     342   [ #  #  #  # ]:          0 :     if( rId.getLength() == 16
                 [ #  # ]
     343                 :          0 :         && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
     344                 :          0 :                                         rId.getConstArray(), 16 ) )
     345                 :            :     {
     346                 :            :         return sal::static_int_cast<sal_Int64>
     347                 :          0 :             (reinterpret_cast<sal_IntPtr>(this));
     348                 :            :     }
     349                 :            : 
     350                 :          0 :     return 0x0;
     351                 :            : }
     352                 :            : 
     353                 :        859 : void OOXMLFastContextHandler::setStream(Stream * pStream)
     354                 :            : {
     355                 :        859 :     mpStream = pStream;
     356                 :        859 : }
     357                 :            : 
     358                 :          0 : OOXMLValue::Pointer_t OOXMLFastContextHandler::getValue() const
     359                 :            : {
     360                 :          0 :     return OOXMLValue::Pointer_t();
     361                 :            : }
     362                 :            : 
     363                 :      51761 : void OOXMLFastContextHandler::attributes
     364                 :            : (const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
     365                 :            :  throw (uno::RuntimeException, xml::sax::SAXException)
     366                 :            : {
     367         [ +  - ]:      51761 :     OOXMLFactory::getInstance()->attributes(this, Attribs);
     368                 :      51761 : }
     369                 :            : 
     370                 :         99 : void OOXMLFastContextHandler::startAction(Token_t Element)
     371                 :            : {
     372                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     373                 :            :     debug_logger->startElement("contexthandler.startAction");
     374                 :            : #endif
     375                 :         99 :     lcl_startAction(Element);
     376                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     377                 :            :     debug_logger->endElement();
     378                 :            : #endif
     379                 :         99 : }
     380                 :            : 
     381                 :         99 : void OOXMLFastContextHandler::lcl_startAction(Token_t Element)
     382                 :            : {
     383         [ +  - ]:         99 :     OOXMLFactory::getInstance()->startAction(this, Element);
     384                 :         99 : }
     385                 :            : 
     386                 :      41126 : void OOXMLFastContextHandler::endAction(Token_t Element)
     387                 :            : {
     388                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     389                 :            :     debug_logger->startElement("contexthandler.endAction");
     390                 :            : #endif
     391                 :      41126 :     lcl_endAction(Element);
     392                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     393                 :            :     debug_logger->endElement();
     394                 :            : #endif
     395                 :      41126 : }
     396                 :            : 
     397                 :      41126 : void OOXMLFastContextHandler::lcl_endAction(Token_t Element)
     398                 :            : {
     399         [ +  - ]:      41126 :     OOXMLFactory::getInstance()->endAction(this, Element);
     400                 :      41126 : }
     401                 :            : 
     402                 :            : #if OSL_DEBUG_LEVEL > 1
     403                 :            : void OOXMLFastContextHandler::dumpXml( const TagLogger::Pointer_t pLogger ) const
     404                 :            : {
     405                 :            :     pLogger->startElement("context");
     406                 :            : 
     407                 :            :     static char sBuffer[128];
     408                 :            :     snprintf(sBuffer, sizeof(sBuffer), "%p", this);
     409                 :            : 
     410                 :            :     pLogger->attribute("parent", std::string(sBuffer));
     411                 :            :     pLogger->attribute("type", getType());
     412                 :            :     pLogger->attribute("resource", resourceToString(getResource()));
     413                 :            :     pLogger->attribute("token", fastTokenToId(getToken()));
     414                 :            :     pLogger->attribute("id", (*QNameToString::Instance())(getId()));
     415                 :            : 
     416                 :            :     OOXMLValue::Pointer_t pVal(getValue());
     417                 :            : 
     418                 :            :     if (pVal.get() != NULL)
     419                 :            :         pLogger->attribute("value", pVal->toString());
     420                 :            :     else
     421                 :            :         pLogger->attribute("value", std::string("(null)"));
     422                 :            : 
     423                 :            :     pLogger->propertySet(getPropertySet(),
     424                 :            :             IdToString::Pointer_t(new OOXMLIdToString()));
     425                 :            : 
     426                 :            :     mpParserState->dumpXml( pLogger );
     427                 :            : 
     428                 :            :     pLogger->endElement();
     429                 :            : }
     430                 :            : 
     431                 :            : #endif
     432                 :            : 
     433                 :      45374 : void OOXMLFastContextHandler::setId(Id rId)
     434                 :            : {
     435                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     436                 :            :     debug_logger->startElement("contexthandler.setId");
     437                 :            : 
     438                 :            :     static char sBuffer[256];
     439                 :            :     snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIuUINT32, rId);
     440                 :            : 
     441                 :            :     debug_logger->attribute("id", std::string(sBuffer));
     442                 :            :     debug_logger->attribute("name", (*QNameToString::Instance())(rId));
     443                 :            :     debug_logger->endElement();
     444                 :            : #endif
     445                 :            : 
     446                 :      45374 :     mId = rId;
     447                 :      45374 : }
     448                 :            : 
     449                 :      22435 : Id OOXMLFastContextHandler::getId() const
     450                 :            : {
     451                 :      22435 :     return mId;
     452                 :            : }
     453                 :            : 
     454                 :      44957 : void OOXMLFastContextHandler::setDefine(Id nDefine)
     455                 :            : {
     456                 :      44957 :     mnDefine = nDefine;
     457                 :      44957 : }
     458                 :            : 
     459                 :     373005 : Id OOXMLFastContextHandler::getDefine() const
     460                 :            : {
     461                 :     373005 :     return mnDefine;
     462                 :            : }
     463                 :            : 
     464                 :        227 : OOXMLParserState::Pointer_t OOXMLFastContextHandler::getParserState() const
     465                 :            : {
     466                 :        227 :     return mpParserState;
     467                 :            : }
     468                 :            : 
     469                 :      45374 : void OOXMLFastContextHandler::setToken(Token_t nToken)
     470                 :            : {
     471                 :      45374 :     mnToken = nToken;
     472                 :            : 
     473                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     474                 :            :     msTokenString = fastTokenToId(mnToken);
     475                 :            : #endif
     476                 :      45374 : }
     477                 :            : 
     478                 :        417 : Token_t OOXMLFastContextHandler::getToken() const
     479                 :            : {
     480                 :        417 :     return mnToken;
     481                 :            : }
     482                 :            : 
     483                 :          0 : void OOXMLFastContextHandler::mark(const Id & rId, OOXMLValue::Pointer_t pVal)
     484                 :            : {
     485 [ #  # ][ #  # ]:          0 :     OOXMLPropertySetImpl::Pointer_t pPropSet(new OOXMLPropertySetImpl());
                 [ #  # ]
     486                 :            :     OOXMLPropertyImpl::Pointer_t pProperty
     487 [ #  # ][ #  # ]:          0 :         (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE));
         [ #  # ][ #  # ]
                 [ #  # ]
     488                 :            : 
     489 [ #  # ][ #  # ]:          0 :     pPropSet->add(pProperty);
                 [ #  # ]
     490 [ #  # ][ #  # ]:          0 :     mpStream->props(pPropSet);
         [ #  # ][ #  # ]
                 [ #  # ]
     491                 :          0 : }
     492                 :            : 
     493                 :          0 : void OOXMLFastContextHandler::setParent
     494                 :            : (OOXMLFastContextHandler * pParent)
     495                 :            : {
     496                 :          0 :     mpParent = pParent;
     497                 :          0 : }
     498                 :            : 
     499                 :          0 : OOXMLPropertySet * OOXMLFastContextHandler::getPicturePropSet
     500                 :            : (const OUString & rId)
     501                 :            : {
     502                 :          0 :     return dynamic_cast<OOXMLDocumentImpl *>(mpParserState->getDocument())->
     503         [ #  # ]:          0 :         getPicturePropSet(rId);
     504                 :            : }
     505                 :            : 
     506                 :        748 : void OOXMLFastContextHandler::sendTableDepth() const
     507                 :            : {
     508                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     509                 :            :     debug_logger->startElement("contexthandler.sendTableDepth");
     510                 :            : #endif
     511                 :            : 
     512         [ +  + ]:        748 :     if (mnTableDepth > 0)
     513                 :            :     {
     514         [ +  - ]:        229 :         OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
     515                 :            :         {
     516                 :            :             OOXMLValue::Pointer_t pVal
     517 [ +  - ][ +  - ]:        229 :                 (new OOXMLIntegerValue(mnTableDepth));
                 [ +  - ]
     518                 :            :             OOXMLProperty::Pointer_t pProp
     519 [ +  - ][ +  - ]:        229 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PTableDepth, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
     520 [ +  - ][ +  - ]:        229 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
     521                 :            :         }
     522                 :            :         {
     523                 :            :             OOXMLValue::Pointer_t pVal
     524 [ +  - ][ +  - ]:        229 :                 (new OOXMLIntegerValue(1));
                 [ +  - ]
     525                 :            :             OOXMLProperty::Pointer_t pProp
     526 [ +  - ][ +  - ]:        229 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PFInTable, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
     527 [ +  - ][ +  - ]:        229 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
     528                 :            :         }
     529                 :            : 
     530         [ +  - ]:        229 :         mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
     531                 :            :     }
     532                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     533                 :            :     debug_logger->endElement();
     534                 :            : #endif
     535                 :        748 : }
     536                 :            : 
     537                 :        748 : void OOXMLFastContextHandler::setHandle()
     538                 :            : {
     539                 :        748 :     mpParserState->setHandle();
     540         [ +  - ]:        748 :     mpStream->info(mpParserState->getHandle());
     541                 :        748 : }
     542                 :            : 
     543                 :       1227 : void OOXMLFastContextHandler::startCharacterGroup()
     544                 :            : {
     545                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     546                 :            :     debug_logger->element("contexthandler.startCharacterGroup");
     547                 :            : #endif
     548                 :            : 
     549         [ +  - ]:       1227 :     if (isForwardEvents())
     550                 :            :     {
     551         [ +  + ]:       1227 :         if (mpParserState->isInCharacterGroup())
     552                 :        397 :             endCharacterGroup();
     553                 :            : 
     554         [ -  + ]:       1227 :         if (! mpParserState->isInParagraphGroup())
     555                 :          0 :             startParagraphGroup();
     556                 :            : 
     557         [ +  - ]:       1227 :         if (! mpParserState->isInCharacterGroup())
     558                 :            :         {
     559                 :       1227 :             mpStream->startCharacterGroup();
     560                 :       1227 :             mpParserState->setInCharacterGroup(true);
     561                 :       1227 :             mpParserState->resolveCharacterProperties(*mpStream);
     562                 :            :         }
     563                 :            :     }
     564                 :       1227 : }
     565                 :            : 
     566                 :       1194 : void OOXMLFastContextHandler::endCharacterGroup()
     567                 :            : {
     568                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     569                 :            :     debug_logger->element("contexthandler.endCharacterGroup");
     570                 :            : #endif
     571                 :            : 
     572 [ +  - ][ +  - ]:       1194 :     if (isForwardEvents() && mpParserState->isInCharacterGroup())
                 [ +  - ]
     573                 :            :     {
     574                 :       1194 :         mpStream->endCharacterGroup();
     575                 :       1194 :         mpParserState->setInCharacterGroup(false);
     576                 :            :     }
     577                 :       1194 : }
     578                 :            : 
     579                 :        812 : void OOXMLFastContextHandler::startParagraphGroup()
     580                 :            : {
     581                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     582                 :            :     debug_logger->element("contexthandler.startParagraphGroup");
     583                 :            : #endif
     584                 :            : 
     585         [ +  - ]:        812 :     if (isForwardEvents())
     586                 :            :     {
     587         [ +  + ]:        812 :         if (mpParserState->isInParagraphGroup())
     588                 :        268 :             endParagraphGroup();
     589                 :            : 
     590         [ -  + ]:        812 :         if (! mpParserState->isInSectionGroup())
     591                 :          0 :             startSectionGroup();
     592                 :            : 
     593         [ +  - ]:        812 :         if (! mpParserState->isInParagraphGroup())
     594                 :            :         {
     595                 :        812 :             mpStream->startParagraphGroup();
     596                 :        812 :             mpParserState->setInParagraphGroup(true);
     597                 :            :         }
     598                 :            :     }
     599                 :        812 : }
     600                 :            : 
     601                 :        779 : void OOXMLFastContextHandler::endParagraphGroup()
     602                 :            : {
     603                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     604                 :            :     debug_logger->element("contexthandler.endParagraphGroup");
     605                 :            : #endif
     606                 :            : 
     607         [ +  - ]:        779 :     if (isForwardEvents())
     608                 :            :     {
     609         [ +  + ]:        779 :         if (mpParserState->isInCharacterGroup())
     610                 :        527 :             endCharacterGroup();
     611                 :            : 
     612         [ +  - ]:        779 :         if (mpParserState->isInParagraphGroup())
     613                 :            :         {
     614                 :        779 :             mpStream->endParagraphGroup();
     615                 :        779 :             mpParserState->setInParagraphGroup(false);
     616                 :            :         }
     617                 :            :     }
     618                 :        779 : }
     619                 :            : 
     620                 :        221 : void OOXMLFastContextHandler::startSectionGroup()
     621                 :            : {
     622                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     623                 :            :     debug_logger->element("contexthandler.startSectionGroup");
     624                 :            : #endif
     625                 :            : 
     626         [ +  - ]:        221 :     if (isForwardEvents())
     627                 :            :     {
     628         [ +  + ]:        221 :         if (mpParserState->isInSectionGroup())
     629                 :         24 :             endSectionGroup();
     630                 :            : 
     631         [ +  - ]:        221 :         if (! mpParserState->isInSectionGroup())
     632                 :            :         {
     633         [ +  - ]:        221 :             mpStream->info(mpParserState->getHandle());
     634                 :        221 :             mpStream->startSectionGroup();
     635                 :        221 :             mpParserState->setInSectionGroup(true);
     636                 :            :         }
     637                 :            :     }
     638                 :        221 : }
     639                 :            : 
     640                 :        218 : void OOXMLFastContextHandler::endSectionGroup()
     641                 :            : {
     642                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     643                 :            :     debug_logger->element("contexthandler.endSectionGroup");
     644                 :            : #endif
     645                 :            : 
     646         [ +  - ]:        218 :     if (isForwardEvents())
     647                 :            :     {
     648         [ +  + ]:        218 :         if (mpParserState->isInParagraphGroup())
     649                 :         30 :             endParagraphGroup();
     650                 :            : 
     651         [ +  - ]:        218 :         if (mpParserState->isInSectionGroup())
     652                 :            :         {
     653                 :        218 :             mpStream->endSectionGroup();
     654                 :        218 :             mpParserState->setInSectionGroup(false);
     655                 :            :         }
     656                 :            :     }
     657                 :        218 : }
     658                 :            : 
     659                 :        209 : void OOXMLFastContextHandler::setLastParagraphInSection()
     660                 :            : {
     661                 :        209 :     mpParserState->setLastParagraphInSection(true);
     662                 :        209 :     mpStream->markLastParagraphInSection( );
     663                 :        209 : }
     664                 :            : 
     665                 :      12936 : void OOXMLFastContextHandler::newProperty
     666                 :            : (const Id & /*nId*/, OOXMLValue::Pointer_t /*pVal*/)
     667                 :            : {
     668                 :      12936 : }
     669                 :            : 
     670                 :          0 : void OOXMLFastContextHandler::setPropertySet
     671                 :            : (OOXMLPropertySet::Pointer_t /* pPropertySet */)
     672                 :            : {
     673                 :          0 : }
     674                 :            : 
     675                 :       2346 : OOXMLPropertySet::Pointer_t OOXMLFastContextHandler::getPropertySet() const
     676                 :            : {
     677                 :       2346 :     return OOXMLPropertySet::Pointer_t();
     678                 :            : }
     679                 :            : 
     680                 :         15 : void OOXMLFastContextHandler::startField()
     681                 :            : {
     682                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     683                 :            :     debug_logger->element("contexthandler.startField");
     684                 :            : #endif
     685                 :         15 :     startCharacterGroup();
     686         [ +  - ]:         15 :     if (isForwardEvents())
     687                 :         15 :         mpStream->text(sFieldStart, 1);
     688                 :         15 :     endCharacterGroup();
     689                 :         15 : }
     690                 :            : 
     691                 :         12 : void OOXMLFastContextHandler::fieldSeparator()
     692                 :            : {
     693                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     694                 :            :     debug_logger->element("contexthandler.fieldSeparator");
     695                 :            : #endif
     696                 :         12 :     startCharacterGroup();
     697         [ +  - ]:         12 :     if (isForwardEvents())
     698                 :         12 :         mpStream->text(sFieldSep, 1);
     699                 :         12 :     endCharacterGroup();
     700                 :         12 : }
     701                 :            : 
     702                 :         15 : void OOXMLFastContextHandler::endField()
     703                 :            : {
     704                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     705                 :            :     debug_logger->element("contexthandler.endField");
     706                 :            : #endif
     707                 :         15 :     startCharacterGroup();
     708         [ +  - ]:         15 :     if (isForwardEvents())
     709                 :         15 :         mpStream->text(sFieldEnd, 1);
     710                 :         15 :     endCharacterGroup();
     711                 :         15 : }
     712                 :            : 
     713                 :          0 : void OOXMLFastContextHandler::ftnednref()
     714                 :            : {
     715                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     716                 :            :     debug_logger->element("contexthandler.ftnednref");
     717                 :            : #endif
     718         [ #  # ]:          0 :     if (isForwardEvents())
     719                 :          0 :         mpStream->utext(sFtnEdnRef, 1);
     720                 :          0 : }
     721                 :            : 
     722                 :          0 : void OOXMLFastContextHandler::ftnednsep()
     723                 :            : {
     724                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     725                 :            :     debug_logger->element("contexthandler.ftnednsep");
     726                 :            : #endif
     727         [ #  # ]:          0 :     if (isForwardEvents())
     728                 :          0 :         mpStream->utext(sFtnEdnSep, 1);
     729                 :          0 : }
     730                 :            : 
     731                 :          0 : void OOXMLFastContextHandler::ftnedncont()
     732                 :            : {
     733                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     734                 :            :     debug_logger->element("contexthandler.ftnedncont");
     735                 :            : #endif
     736         [ #  # ]:          0 :     if (isForwardEvents())
     737                 :          0 :         mpStream->text(sFtnEdnCont, 1);
     738                 :          0 : }
     739                 :            : 
     740                 :          0 : void OOXMLFastContextHandler::pgNum()
     741                 :            : {
     742                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     743                 :            :     debug_logger->element("contexthandler.pgNum");
     744                 :            : #endif
     745         [ #  # ]:          0 :     if (isForwardEvents())
     746                 :          0 :         mpStream->utext((const sal_uInt8*)sPgNum, 1);
     747                 :          0 : }
     748                 :            : 
     749                 :          0 : void OOXMLFastContextHandler::tab()
     750                 :            : {
     751                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     752                 :            :     debug_logger->element("contexthandler.tab");
     753                 :            : #endif
     754         [ #  # ]:          0 :     if (isForwardEvents())
     755                 :          0 :         mpStream->utext((const sal_uInt8*)sTab, 1);
     756                 :          0 : }
     757                 :            : 
     758                 :          0 : void OOXMLFastContextHandler::cr()
     759                 :            : {
     760                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     761                 :            :     debug_logger->element("contexthandler.cr");
     762                 :            : #endif
     763         [ #  # ]:          0 :     if (isForwardEvents())
     764                 :          0 :         mpStream->utext((const sal_uInt8*)sCR, 1);
     765                 :          0 : }
     766                 :            : 
     767                 :          0 : void OOXMLFastContextHandler::noBreakHyphen()
     768                 :            : {
     769                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     770                 :            :     debug_logger->element("contexthandler.noBreakHyphen");
     771                 :            : #endif
     772         [ #  # ]:          0 :     if (isForwardEvents())
     773                 :          0 :         mpStream->utext((const sal_uInt8*)sNoBreakHyphen, 1);
     774                 :          0 : }
     775                 :            : 
     776                 :          0 : void OOXMLFastContextHandler::softHyphen()
     777                 :            : {
     778                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     779                 :            :     debug_logger->element("contexthandler.softHyphen");
     780                 :            : #endif
     781         [ #  # ]:          0 :     if (isForwardEvents())
     782                 :          0 :         mpStream->utext((const sal_uInt8*)sSoftHyphen, 1);
     783                 :          0 : }
     784                 :            : 
     785                 :        748 : void OOXMLFastContextHandler::handleLastParagraphInSection()
     786                 :            : {
     787                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     788                 :            :     debug_logger->element("contexthandler.handleLastParagraphInSection");
     789                 :            : #endif
     790                 :            : 
     791         [ +  + ]:        748 :     if (mpParserState->isLastParagraphInSection())
     792                 :            :     {
     793                 :         24 :         mpParserState->setLastParagraphInSection(false);
     794                 :         24 :         startSectionGroup();
     795                 :            :     }
     796                 :        748 : }
     797                 :            : 
     798                 :        745 : void OOXMLFastContextHandler::endOfParagraph()
     799                 :            : {
     800                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     801                 :            :     debug_logger->element("contexthandler.endOfParagraph");
     802                 :            : #endif
     803         [ +  + ]:        745 :     if (! mpParserState->isInCharacterGroup())
     804                 :        190 :         startCharacterGroup();
     805         [ +  - ]:        745 :     if (isForwardEvents())
     806                 :        745 :         mpStream->utext((const sal_uInt8*)sCR, 1);
     807                 :        745 : }
     808                 :            : 
     809                 :         24 : void OOXMLFastContextHandler::startTxbxContent()
     810                 :            : {
     811                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     812                 :            :     debug_logger->element("contexthandler.startTxbxContent");
     813                 :            : #endif
     814                 :            : /*
     815                 :            :     This usually means there are recursive <w:p> elements, and the ones
     816                 :            :     inside and outside of w:txbxContent should not interfere (e.g.
     817                 :            :     the lastParagraphInSection setting). So save the whole state
     818                 :            :     and possibly start new groups for the nested content (not section
     819                 :            :     group though, as that'd cause the txbxContent to be moved onto
     820                 :            :     another page, I'm not sure how that should work exactly).
     821                 :            : */
     822                 :         24 :     mpParserState->startTxbxContent();
     823                 :         24 :     startParagraphGroup();
     824                 :         24 : }
     825                 :            : 
     826                 :         24 : void OOXMLFastContextHandler::endTxbxContent()
     827                 :            : {
     828                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     829                 :            :     debug_logger->element("contexthandler.endTxbxContent");
     830                 :            : #endif
     831                 :         24 :     endParagraphGroup();
     832                 :         24 :     mpParserState->endTxbxContent();
     833                 :         24 : }
     834                 :            : 
     835                 :        640 : void OOXMLFastContextHandler::text(const OUString & sText)
     836                 :            : {
     837                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     838                 :            :     debug_logger->startElement("contexthandler.text");
     839                 :            :     debug_logger->chars(sText);
     840                 :            :     debug_logger->endElement();
     841                 :            : #endif
     842         [ +  - ]:        640 :     if (isForwardEvents())
     843                 :            :         mpStream->utext(reinterpret_cast < const sal_uInt8 * >
     844                 :        640 :                         (sText.getStr()),
     845                 :       1280 :                         sText.getLength());
     846                 :        640 : }
     847                 :            : 
     848                 :            : /*
     849                 :            :  HACK. An ugly hack. The problem with wp:positionOffset, wp:alignV and wp:alignH
     850                 :            :  is that they do not work in the usual OOXML way of <tag val="value"/> but instead
     851                 :            :  it's <tag>value</tag>, which is otherwise used only things like <t>. And I really
     852                 :            :  haven't managed to find out how to make this XML parsing monstrosity to handle this
     853                 :            :  on its own, so the code is modelled after <t> handling and does it manually in a hackish
     854                 :            :  way - it reads the value as text and converts itself, moreover the reading of the value
     855                 :            :  is done sooner than lcl_sprms() actually results in processing the tags it is enclosed
     856                 :            :  in, so the values are stored in PositionHandler for later use.
     857                 :            : */
     858                 :         24 : void OOXMLFastContextHandler::positionOffset(const OUString & sText)
     859                 :            : {
     860                 :            : #ifdef DEBUG_ELEMENT
     861                 :            :     debug_logger->startElement("positionOffset");
     862                 :            :     debug_logger->chars(sText);
     863                 :            :     debug_logger->endElement();
     864                 :            : #endif
     865         [ +  - ]:         24 :     if (isForwardEvents())
     866                 :         24 :         ::writerfilter::dmapper::PositionHandler::setPositionOffset( sText, inPositionV );
     867                 :         24 : }
     868                 :            : 
     869                 :          0 : void OOXMLFastContextHandler::alignH(const OUString & sText)
     870                 :            : {
     871                 :            : #ifdef DEBUG_ELEMENT
     872                 :            :     debug_logger->startElement("alignH");
     873                 :            :     debug_logger->chars(sText);
     874                 :            :     debug_logger->endElement();
     875                 :            : #endif
     876         [ #  # ]:          0 :     if (isForwardEvents())
     877                 :          0 :         ::writerfilter::dmapper::PositionHandler::setAlignH( sText );
     878                 :          0 : }
     879                 :            : 
     880                 :          0 : void OOXMLFastContextHandler::alignV(const OUString & sText)
     881                 :            : {
     882                 :            : #ifdef DEBUG_ELEMENT
     883                 :            :     debug_logger->startElement("alignV");
     884                 :            :     debug_logger->chars(sText);
     885                 :            :     debug_logger->endElement();
     886                 :            : #endif
     887         [ #  # ]:          0 :     if (isForwardEvents())
     888                 :          0 :         ::writerfilter::dmapper::PositionHandler::setAlignV( sText );
     889                 :          0 : }
     890                 :            : 
     891                 :          0 : void OOXMLFastContextHandler::propagateCharacterProperties()
     892                 :            : {
     893                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     894                 :            :     debug_logger->startElement("contexthandler.propagateCharacterProperties");
     895                 :            :     debug_logger->propertySet(getPropertySet(),
     896                 :            :             IdToString::Pointer_t(new OOXMLIdToString()));
     897                 :            :     debug_logger->endElement();
     898                 :            : #endif
     899                 :            : 
     900         [ #  # ]:          0 :     mpParserState->setCharacterProperties(getPropertySet());
     901                 :          0 : }
     902                 :            : 
     903                 :          3 : void OOXMLFastContextHandler::propagateCharacterPropertiesAsSet(const Id & rId)
     904                 :            : {
     905                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     906                 :            :     debug_logger->startElement("contexthandler.propagateCharacterPropertiesAsSet");
     907                 :            :     debug_logger->propertySet(getPropertySet(),
     908                 :            :             IdToString::Pointer_t(new OOXMLIdToString()));
     909                 :            :     debug_logger->endElement();
     910                 :            : #endif
     911                 :            : 
     912 [ +  - ][ +  - ]:          3 :     OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet()));
         [ +  - ][ +  - ]
                 [ +  - ]
     913 [ +  - ][ +  - ]:          3 :     OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySetImpl());
                 [ +  - ]
     914                 :            : 
     915                 :            :     OOXMLProperty::Pointer_t pProp
     916 [ +  - ][ +  - ]:          3 :         (new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
     917                 :            : 
     918 [ +  - ][ +  - ]:          3 :     pPropertySet->add(pProp);
                 [ +  - ]
     919 [ +  - ][ +  - ]:          3 :     mpParserState->setCharacterProperties(pPropertySet);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     920                 :          3 : }
     921                 :            : 
     922                 :          0 : bool OOXMLFastContextHandler::propagatesProperties() const
     923                 :            : {
     924                 :          0 :     return false;
     925                 :            : }
     926                 :            : 
     927                 :        229 : void OOXMLFastContextHandler::propagateCellProperties()
     928                 :            : {
     929                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     930                 :            :     debug_logger->element("contexthandler.propagateCellProperties");
     931                 :            : #endif
     932                 :            : 
     933         [ +  - ]:        229 :     mpParserState->setCellProperties(getPropertySet());
     934                 :        229 : }
     935                 :            : 
     936                 :         12 : void OOXMLFastContextHandler::propagateRowProperties()
     937                 :            : {
     938                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     939                 :            :     debug_logger->element("contexthandler.propagateRowProperties");
     940                 :            : #endif
     941                 :            : 
     942         [ +  - ]:         12 :     mpParserState->setRowProperties(getPropertySet());
     943                 :         12 : }
     944                 :            : 
     945                 :         72 : void OOXMLFastContextHandler::propagateTableProperties()
     946                 :            : {
     947         [ +  - ]:         72 :     OOXMLPropertySet::Pointer_t pProps = getPropertySet();
     948                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     949                 :            :     debug_logger->startElement("contexthandler.propagateTableProperties");
     950                 :            :     debug_logger->propertySet(getPropertySet(),
     951                 :            :             IdToString::Pointer_t(new OOXMLIdToString()));
     952                 :            :     debug_logger->endElement();
     953                 :            : #endif
     954                 :            : 
     955 [ +  - ][ +  - ]:         72 :     mpParserState->setTableProperties(pProps);
         [ +  - ][ +  - ]
     956                 :         72 : }
     957                 :            : 
     958                 :        229 : void OOXMLFastContextHandler::sendCellProperties()
     959                 :            : {
     960                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     961                 :            :     debug_logger->startElement("contexthandler.sendCellProperties");
     962                 :            : #endif
     963                 :            : 
     964                 :        229 :     mpParserState->resolveCellProperties(*mpStream);
     965                 :            : 
     966                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     967                 :            :     debug_logger->endElement();
     968                 :            : #endif
     969                 :        229 : }
     970                 :            : 
     971                 :         40 : void OOXMLFastContextHandler::sendRowProperties()
     972                 :            : {
     973                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     974                 :            :     debug_logger->startElement("contexthandler.sendRowProperties");
     975                 :            : #endif
     976                 :            : 
     977                 :         40 :     mpParserState->resolveRowProperties(*mpStream);
     978                 :            : 
     979                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     980                 :            :     debug_logger->endElement();
     981                 :            : #endif
     982                 :         40 : }
     983                 :            : 
     984                 :         40 : void OOXMLFastContextHandler::sendTableProperties()
     985                 :            : {
     986                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     987                 :            :     debug_logger->startElement("contexthandler.sendTableProperties");
     988                 :            : #endif
     989                 :            : 
     990                 :         40 :     mpParserState->resolveTableProperties(*mpStream);
     991                 :            : 
     992                 :            : #ifdef DEBUG_CONTEXT_HANDLER
     993                 :            :     debug_logger->endElement();
     994                 :            : #endif
     995                 :         40 : }
     996                 :            : 
     997                 :         36 : void OOXMLFastContextHandler::clearTableProps()
     998                 :            : {
     999                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1000                 :            :     debug_logger->element("contexthandler.clearTableProps");
    1001                 :            : #endif
    1002                 :            : 
    1003                 :            :     mpParserState->setTableProperties(OOXMLPropertySet::Pointer_t
    1004 [ +  - ][ +  - ]:         36 :                                      (new OOXMLPropertySetImpl()));
    1005                 :         36 : }
    1006                 :            : 
    1007                 :         42 : void OOXMLFastContextHandler::sendPropertiesWithId(const Id & rId)
    1008                 :            : {
    1009                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1010                 :            :     debug_logger->startElement("contexthandler.sendPropertiesWithId");
    1011                 :            :     debug_logger->attribute("id", fastTokenToId(rId));
    1012                 :            : #endif
    1013                 :            : 
    1014 [ +  - ][ +  - ]:         42 :     OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet()));
         [ +  - ][ +  - ]
                 [ +  - ]
    1015 [ +  - ][ +  - ]:         42 :     OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySetImpl());
                 [ +  - ]
    1016                 :            : 
    1017                 :            :     OOXMLProperty::Pointer_t pProp
    1018 [ +  - ][ +  - ]:         42 :     (new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1019                 :            : 
    1020 [ +  - ][ +  - ]:         42 :     pPropertySet->add(pProp);
                 [ +  - ]
    1021 [ +  - ][ +  - ]:         42 :     mpStream->props(pPropertySet);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1022                 :            : 
    1023                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1024                 :            :     debug_logger->propertySet(getPropertySet(),
    1025                 :            :             IdToString::Pointer_t(new OOXMLIdToString()));
    1026                 :            :     debug_logger->endElement();
    1027                 :            : #endif
    1028                 :         42 : }
    1029                 :            : 
    1030                 :        358 : void OOXMLFastContextHandler::clearProps()
    1031                 :            : {
    1032                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1033                 :            :     debug_logger->element("contexthandler.clearProps");
    1034                 :            : #endif
    1035                 :            : 
    1036 [ +  - ][ +  - ]:        358 :     setPropertySet(OOXMLPropertySet::Pointer_t(new OOXMLPropertySetImpl()));
    1037                 :        358 : }
    1038                 :            : 
    1039                 :          0 : void OOXMLFastContextHandler::setDefaultBooleanValue()
    1040                 :            : {
    1041                 :          0 : }
    1042                 :            : 
    1043                 :          0 : void OOXMLFastContextHandler::setDefaultIntegerValue()
    1044                 :            : {
    1045                 :          0 : }
    1046                 :            : 
    1047                 :          0 : void OOXMLFastContextHandler::setDefaultHexValue()
    1048                 :            : {
    1049                 :          0 : }
    1050                 :            : 
    1051                 :          0 : void OOXMLFastContextHandler::setDefaultStringValue()
    1052                 :            : {
    1053                 :          0 : }
    1054                 :            : 
    1055                 :        859 : void OOXMLFastContextHandler::setDocument(OOXMLDocument * pDocument)
    1056                 :            : {
    1057                 :        859 :     mpParserState->setDocument(pDocument);
    1058                 :        859 : }
    1059                 :            : 
    1060                 :        261 : OOXMLDocument * OOXMLFastContextHandler::getDocument()
    1061                 :            : {
    1062                 :        261 :     return mpParserState->getDocument();
    1063                 :            : }
    1064                 :            : 
    1065                 :        871 : void OOXMLFastContextHandler::setForwardEvents(bool bForwardEvents)
    1066                 :            : {
    1067                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1068                 :            :     debug_logger->startElement("contexthandler.setForwardEvents");
    1069                 :            : 
    1070                 :            :     if (bForwardEvents)
    1071                 :            :         debug_logger->chars(std::string("true"));
    1072                 :            :     else
    1073                 :            :         debug_logger->chars(std::string("false"));
    1074                 :            : 
    1075                 :            :     debug_logger->endElement();
    1076                 :            : #endif
    1077                 :            : 
    1078                 :        871 :     mpParserState->setForwardEvents(bForwardEvents);
    1079                 :        871 : }
    1080                 :            : 
    1081                 :       8370 : bool OOXMLFastContextHandler::isForwardEvents() const
    1082                 :            : {
    1083                 :       8370 :     return mpParserState->isForwardEvents();
    1084                 :            : }
    1085                 :            : 
    1086                 :        859 : void OOXMLFastContextHandler::setXNoteId(const sal_Int32 nId)
    1087                 :            : {
    1088                 :        859 :     mpParserState->setXNoteId(nId);
    1089                 :        859 : }
    1090                 :            : 
    1091                 :          0 : void OOXMLFastContextHandler::setXNoteId(OOXMLValue::Pointer_t pValue)
    1092                 :            : {
    1093                 :          0 :     mpParserState->setXNoteId(sal_Int32(pValue->getInt()));
    1094                 :          0 : }
    1095                 :            : 
    1096                 :          6 : sal_Int32 OOXMLFastContextHandler::getXNoteId() const
    1097                 :            : {
    1098                 :          6 :     return mpParserState->getXNoteId();
    1099                 :            : }
    1100                 :            : 
    1101                 :          0 : void OOXMLFastContextHandler::resolveFootnote
    1102                 :            : (const sal_Int32 nId)
    1103                 :            : {
    1104                 :          0 :     mpParserState->getDocument()->resolveFootnote
    1105         [ #  # ]:          0 :         (*mpStream, 0, nId);
    1106                 :          0 : }
    1107                 :            : 
    1108                 :          0 : void OOXMLFastContextHandler::resolveEndnote(const sal_Int32 nId)
    1109                 :            : {
    1110                 :          0 :     mpParserState->getDocument()->resolveEndnote
    1111         [ #  # ]:          0 :         (*mpStream, 0, nId);
    1112                 :          0 : }
    1113                 :            : 
    1114                 :          6 : void OOXMLFastContextHandler::resolveComment(const sal_Int32 nId)
    1115                 :            : {
    1116                 :          6 :     mpParserState->getDocument()->resolveComment(*mpStream, nId);
    1117                 :          6 : }
    1118                 :            : 
    1119                 :          0 : void OOXMLFastContextHandler::resolvePicture(const OUString & rId)
    1120                 :            : {
    1121                 :          0 :     mpParserState->getDocument()->resolvePicture(*mpStream, rId);
    1122                 :          0 : }
    1123                 :            : 
    1124                 :         21 : void OOXMLFastContextHandler::resolveHeader
    1125                 :            : (const sal_Int32 type, const OUString & rId)
    1126                 :            : {
    1127                 :         21 :     mpParserState->getDocument()->resolveHeader(*mpStream, type, rId);
    1128                 :         21 : }
    1129                 :            : 
    1130                 :          9 : void OOXMLFastContextHandler::resolveFooter
    1131                 :            : (const sal_Int32 type, const OUString & rId)
    1132                 :            : {
    1133                 :          9 :     mpParserState->getDocument()->resolveFooter(*mpStream, type, rId);
    1134                 :          9 : }
    1135                 :            : 
    1136                 :          0 : void OOXMLFastContextHandler::resolveOLE(const OUString & rId)
    1137                 :            : {
    1138                 :            :     uno::Reference<io::XInputStream> xInputStream
    1139 [ #  # ][ #  # ]:          0 :         (mpParserState->getDocument()->getInputStreamForId(rId));
    1140                 :            : 
    1141 [ #  # ][ #  # ]:          0 :     OOXMLValue::Pointer_t aValue(new OOXMLInputStreamValue(xInputStream));
                 [ #  # ]
    1142                 :            : 
    1143 [ #  # ][ #  # ]:          0 :     newProperty(NS_ooxml::LN_inputstream, aValue);
         [ #  # ][ #  # ]
    1144                 :          0 : }
    1145                 :            : 
    1146                 :          0 : OUString OOXMLFastContextHandler::getTargetForId
    1147                 :            : (const OUString & rId)
    1148                 :            : {
    1149                 :          0 :     return mpParserState->getDocument()->getTargetForId(rId);
    1150                 :            : }
    1151                 :            : 
    1152                 :          0 : void OOXMLFastContextHandler::resolvePropertySetAttrs()
    1153                 :            : {
    1154                 :          0 : }
    1155                 :            : 
    1156                 :      15171 : void OOXMLFastContextHandler::sendPropertyToParent()
    1157                 :            : {
    1158                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1159                 :            :     debug_logger->element("sendPropertyToParent");
    1160                 :            : #endif
    1161                 :            : 
    1162         [ +  - ]:      15171 :     if (mpParent != NULL)
    1163                 :            :     {
    1164         [ +  - ]:      15171 :         OOXMLPropertySet::Pointer_t pProps(mpParent->getPropertySet());
    1165                 :            : 
    1166         [ +  - ]:      15171 :         if (pProps.get() != NULL)
    1167                 :            :         {
    1168                 :            :             OOXMLProperty::Pointer_t
    1169                 :      15171 :                 pProp(new OOXMLPropertyImpl(mId, getValue(),
    1170 [ +  - ][ +  - ]:      15171 :                                             OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1171 [ +  - ][ +  - ]:      15171 :             pProps->add(pProp);
         [ +  - ][ +  - ]
    1172         [ +  - ]:      15171 :         }
    1173                 :            :     }
    1174                 :      15171 : }
    1175                 :            : 
    1176                 :      24310 : void OOXMLFastContextHandler::sendPropertiesToParent()
    1177                 :            : {
    1178                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1179                 :            :     debug_logger->startElement("contexthandler.sendPropertiesToParent");
    1180                 :            : #endif
    1181         [ +  - ]:      24310 :     if (mpParent != NULL)
    1182                 :            :     {
    1183         [ +  - ]:      24310 :         OOXMLPropertySet::Pointer_t pParentProps(mpParent->getPropertySet());
    1184                 :            : 
    1185         [ +  + ]:      24310 :         if (pParentProps.get() != NULL)
    1186                 :            :         {
    1187         [ +  - ]:      21964 :             OOXMLPropertySet::Pointer_t pProps(getPropertySet());
    1188                 :            : 
    1189         [ +  - ]:      21964 :             if (pProps.get() != NULL)
    1190                 :            :             {
    1191                 :            :                 OOXMLValue::Pointer_t pValue
    1192 [ +  - ][ +  - ]:      21964 :                 (new OOXMLPropertySetValue(getPropertySet()));
         [ +  - ][ +  - ]
                 [ +  - ]
    1193                 :            : 
    1194                 :            :                 OOXMLProperty::Pointer_t pProp
    1195 [ +  - ][ +  - ]:      21964 :                 (new OOXMLPropertyImpl(getId(), pValue, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1196                 :            : 
    1197                 :            : 
    1198 [ +  - ][ +  - ]:      21964 :                 pParentProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1199                 :            : 
    1200         [ +  - ]:      21964 :             }
    1201         [ +  - ]:      24310 :         }
    1202                 :            :     }
    1203                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1204                 :            :     debug_logger->endElement();
    1205                 :            : #endif
    1206                 :      24310 : }
    1207                 :            : 
    1208                 :            : uno::Reference< uno::XComponentContext >
    1209                 :         57 : OOXMLFastContextHandler::getComponentContext()
    1210                 :            : {
    1211                 :         57 :     return m_xContext;
    1212                 :            : }
    1213                 :            : 
    1214                 :            : /*
    1215                 :            :   class OOXMLFastContextHandlerStream
    1216                 :            :  */
    1217                 :            : 
    1218                 :       2848 : OOXMLFastContextHandlerStream::OOXMLFastContextHandlerStream
    1219                 :            : (OOXMLFastContextHandler * pContext)
    1220                 :            : : OOXMLFastContextHandler(pContext),
    1221 [ +  - ][ +  - ]:       2848 :   mpPropertySetAttrs(new OOXMLPropertySetImpl())
                 [ +  - ]
    1222                 :            : {
    1223                 :       2848 : }
    1224                 :            : 
    1225         [ +  - ]:       2848 : OOXMLFastContextHandlerStream::~OOXMLFastContextHandlerStream()
    1226                 :            : {
    1227         [ -  + ]:       5696 : }
    1228                 :            : 
    1229                 :       1681 : void OOXMLFastContextHandlerStream::newProperty(const Id & rId,
    1230                 :            :                                                 OOXMLValue::Pointer_t pVal)
    1231                 :            : {
    1232         [ +  + ]:       1681 :     if (rId != 0x0)
    1233                 :            :     {
    1234                 :            :         OOXMLPropertyImpl::Pointer_t pProperty
    1235 [ +  - ][ +  - ]:        181 :             (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE));
         [ +  - ][ +  - ]
                 [ +  - ]
    1236                 :            : 
    1237 [ +  - ][ +  - ]:        181 :         mpPropertySetAttrs->add(pProperty);
         [ +  - ][ +  - ]
    1238                 :            :     }
    1239                 :       1681 : }
    1240                 :            : 
    1241                 :          0 : void OOXMLFastContextHandlerStream::sendProperty(Id nId)
    1242                 :            : {
    1243                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1244                 :            :     debug_logger->startElement("contexthandler.sendProperty");
    1245                 :            :     debug_logger->attribute("id", (*QNameToString::Instance())(nId));
    1246                 :            :     debug_logger->chars(xmlify(getPropertySetAttrs()->toString()));
    1247                 :            :     debug_logger->endElement();
    1248                 :            : #endif
    1249                 :            : 
    1250         [ #  # ]:          0 :     OOXMLPropertySetEntryToString aHandler(nId);
    1251 [ #  # ][ #  # ]:          0 :     getPropertySetAttrs()->resolve(aHandler);
                 [ #  # ]
    1252         [ #  # ]:          0 :     const OUString & sText = aHandler.getString();
    1253                 :            :     mpStream->utext(reinterpret_cast < const sal_uInt8 * >
    1254                 :          0 :                     (sText.getStr()),
    1255 [ #  # ][ #  # ]:          0 :                     sText.getLength());
    1256                 :          0 : }
    1257                 :            : 
    1258                 :            : OOXMLPropertySet::Pointer_t
    1259                 :        126 : OOXMLFastContextHandlerStream::getPropertySetAttrs() const
    1260                 :            : {
    1261                 :        126 :     return mpPropertySetAttrs;
    1262                 :            : }
    1263                 :            : 
    1264                 :          0 : void OOXMLFastContextHandlerStream::resolvePropertySetAttrs()
    1265                 :            : {
    1266                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1267                 :            :         debug_logger->startElement("contexthandler.resolvePropertySetAttrs");
    1268                 :            :         debug_logger->chars(mpPropertySetAttrs->toString());
    1269                 :            :         debug_logger->endElement();
    1270                 :            : #endif
    1271 [ #  # ][ #  # ]:          0 :     mpStream->props(mpPropertySetAttrs);
                 [ #  # ]
    1272                 :          0 : }
    1273                 :            : 
    1274                 :          0 : OOXMLPropertySet::Pointer_t OOXMLFastContextHandlerStream::getPropertySet()
    1275                 :            :     const
    1276                 :            : {
    1277                 :          0 :     return getPropertySetAttrs();
    1278                 :            : }
    1279                 :            : 
    1280                 :          0 : void OOXMLFastContextHandlerStream::handleHyperlink()
    1281                 :            : {
    1282         [ #  # ]:          0 :     OOXMLHyperlinkHandler aHyperlinkHandler(this);
    1283 [ #  # ][ #  # ]:          0 :     getPropertySetAttrs()->resolve(aHyperlinkHandler);
         [ #  # ][ #  # ]
    1284                 :          0 : }
    1285                 :            : 
    1286                 :            : /*
    1287                 :            :   class OOXMLFastContextHandlerProperties
    1288                 :            :  */
    1289                 :      26168 : OOXMLFastContextHandlerProperties::OOXMLFastContextHandlerProperties
    1290                 :            : (OOXMLFastContextHandler * pContext)
    1291                 :          0 : : OOXMLFastContextHandler(pContext), mpPropertySet(new OOXMLPropertySetImpl()),
    1292 [ +  - ][ +  - ]:      26168 :   mbResolve(false)
                 [ +  - ]
    1293                 :            : {
    1294 [ +  - ][ +  + ]:      26168 :     if (pContext->getResource() == STREAM)
    1295                 :       1858 :         mbResolve = true;
    1296                 :      26168 : }
    1297                 :            : 
    1298         [ +  - ]:      26168 : OOXMLFastContextHandlerProperties::~OOXMLFastContextHandlerProperties()
    1299                 :            : {
    1300         [ -  + ]:      51851 : }
    1301                 :            : 
    1302                 :      25746 : void OOXMLFastContextHandlerProperties::lcl_endFastElement
    1303                 :            : (Token_t Element)
    1304                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1305                 :            : {
    1306                 :      25746 :     endAction(Element);
    1307                 :            : 
    1308         [ +  + ]:      25746 :     if (mbResolve)
    1309                 :            :     {
    1310         [ +  - ]:       1436 :         if (isForwardEvents())
    1311                 :            :         {
    1312 [ +  - ][ +  - ]:       1436 :             mpStream->props(mpPropertySet);
                 [ +  - ]
    1313                 :            :         }
    1314                 :            :     }
    1315                 :            :     else
    1316                 :            :     {
    1317                 :      24310 :         sendPropertiesToParent();
    1318                 :            :     }
    1319                 :      25746 : }
    1320                 :            : 
    1321                 :       2346 : OOXMLValue::Pointer_t OOXMLFastContextHandlerProperties::getValue() const
    1322                 :            : {
    1323 [ +  - ][ +  - ]:       2346 :     return OOXMLValue::Pointer_t(new OOXMLPropertySetValue(mpPropertySet));
                 [ +  - ]
    1324                 :            : }
    1325                 :            : 
    1326                 :            : #if OSL_DEBUG_LEVEL > 1
    1327                 :            : void OOXMLFastContextHandlerProperties::dumpXml( const TagLogger::Pointer_t pLogger) const
    1328                 :            : {
    1329                 :            :     pLogger->startElement("context");
    1330                 :            : 
    1331                 :            :     static char sBuffer[128];
    1332                 :            :     snprintf(sBuffer, sizeof(sBuffer), "%p", this);
    1333                 :            : 
    1334                 :            :     pLogger->attribute("parent", std::string(sBuffer));
    1335                 :            :     pLogger->attribute("type", getType());
    1336                 :            :     pLogger->attribute("resource", resourceToString(getResource()));
    1337                 :            :     pLogger->attribute("token", fastTokenToId(getToken()));
    1338                 :            :     pLogger->attribute("id", (*QNameToString::Instance())(getId()));
    1339                 :            : 
    1340                 :            :     OOXMLValue::Pointer_t pVal(getValue());
    1341                 :            : 
    1342                 :            :     if (pVal.get() != NULL)
    1343                 :            :         pLogger->attribute("value", pVal->toString());
    1344                 :            :     else
    1345                 :            :         pLogger->attribute("value", std::string("(null)"));
    1346                 :            : 
    1347                 :            :     pLogger->attribute("resolve", mbResolve ? "resolve" : "noResolve");
    1348                 :            : 
    1349                 :            :     pLogger->propertySet(getPropertySet(),
    1350                 :            :             IdToString::Pointer_t(new OOXMLIdToString()));
    1351                 :            : 
    1352                 :            :     mpParserState->dumpXml( pLogger );
    1353                 :            : 
    1354                 :            :     pLogger->endElement();
    1355                 :            : }
    1356                 :            : #endif
    1357                 :            : 
    1358                 :      32042 : void OOXMLFastContextHandlerProperties::newProperty
    1359                 :            : (const Id & rId, OOXMLValue::Pointer_t pVal)
    1360                 :            : {
    1361         [ +  + ]:      32042 :     if (rId != 0x0)
    1362                 :            :     {
    1363                 :            :         OOXMLPropertyImpl::Pointer_t pProperty
    1364 [ +  - ][ +  - ]:      31839 :             (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE));
         [ +  - ][ +  - ]
                 [ +  - ]
    1365                 :            : 
    1366 [ +  - ][ +  - ]:      31839 :         mpPropertySet->add(pProperty);
         [ +  - ][ +  - ]
    1367                 :            :     }
    1368                 :      32042 : }
    1369                 :            : 
    1370                 :          0 : void OOXMLFastContextHandlerProperties::handleXNotes()
    1371                 :            : {
    1372      [ #  #  # ]:          0 :     switch (mnToken)
    1373                 :            :     {
    1374                 :            :     case NS_wordprocessingml|OOXML_footnoteReference:
    1375                 :            :         {
    1376         [ #  # ]:          0 :             OOXMLFootnoteHandler aFootnoteHandler(this);
    1377 [ #  # ][ #  # ]:          0 :             mpPropertySet->resolve(aFootnoteHandler);
    1378                 :            :         }
    1379                 :          0 :         break;
    1380                 :            :     case NS_wordprocessingml|OOXML_endnoteReference:
    1381                 :            :         {
    1382         [ #  # ]:          0 :             OOXMLEndnoteHandler aEndnoteHandler(this);
    1383 [ #  # ][ #  # ]:          0 :             mpPropertySet->resolve(aEndnoteHandler);
    1384                 :            :         }
    1385                 :          0 :         break;
    1386                 :            :     default:
    1387                 :          0 :         break;
    1388                 :            :     }
    1389                 :          0 : }
    1390                 :            : 
    1391                 :         30 : void OOXMLFastContextHandlerProperties::handleHdrFtr()
    1392                 :            : {
    1393      [ +  +  - ]:         30 :     switch (mnToken)
    1394                 :            :     {
    1395                 :            :     case NS_wordprocessingml|OOXML_footerReference:
    1396                 :            :         {
    1397         [ +  - ]:          9 :             OOXMLFooterHandler aFooterHandler(this);
    1398 [ +  - ][ +  - ]:          9 :             mpPropertySet->resolve(aFooterHandler);
    1399                 :            :         }
    1400                 :          9 :         break;
    1401                 :            :     case NS_wordprocessingml|OOXML_headerReference:
    1402                 :            :         {
    1403         [ +  - ]:         21 :             OOXMLHeaderHandler aHeaderHandler(this);
    1404 [ +  - ][ +  - ]:         21 :             mpPropertySet->resolve(aHeaderHandler);
    1405                 :            :         }
    1406                 :         21 :         break;
    1407                 :            :     default:
    1408                 :          0 :         break;
    1409                 :            :     }
    1410                 :         30 : }
    1411                 :            : 
    1412                 :          6 : void OOXMLFastContextHandlerProperties::handleComment()
    1413                 :            : {
    1414                 :            : #ifdef DEBUG_ELEMENT
    1415                 :            :     debug_logger->element("handleComment");
    1416                 :            : #endif
    1417                 :            : 
    1418         [ +  - ]:          6 :     OOXMLCommentHandler aCommentHandler(this);
    1419 [ +  - ][ +  - ]:          6 :     getPropertySet()->resolve(aCommentHandler);
         [ +  - ][ +  - ]
    1420                 :          6 : }
    1421                 :            : 
    1422                 :         15 : void OOXMLFastContextHandlerProperties::handlePicture()
    1423                 :            : {
    1424                 :            : #ifdef DEBUG_ELEMENT
    1425                 :            :     debug_logger->element("handlePicture");
    1426                 :            : #endif
    1427                 :            : 
    1428         [ +  - ]:         15 :     OOXMLPictureHandler aPictureHandler(this);
    1429 [ +  - ][ +  - ]:         15 :     getPropertySet()->resolve(aPictureHandler);
         [ +  - ][ +  - ]
    1430                 :         15 : }
    1431                 :            : 
    1432                 :          0 : void OOXMLFastContextHandlerProperties::handleBreak()
    1433                 :            : {
    1434                 :            : #ifdef DEBUG_ELEMENT
    1435                 :            :     debug_logger->element("handleBreak");
    1436                 :            : #endif
    1437                 :            : 
    1438         [ #  # ]:          0 :     OOXMLBreakHandler aBreakHandler(*mpStream, this);
    1439 [ #  # ][ #  # ]:          0 :     getPropertySet()->resolve(aBreakHandler);
         [ #  # ][ #  # ]
    1440                 :          0 : }
    1441                 :            : 
    1442                 :          0 : void OOXMLFastContextHandlerProperties::handleOLE()
    1443                 :            : {
    1444                 :            : #ifdef DEBUG_ELEMENT
    1445                 :            :     debug_logger->element("handleOLE");
    1446                 :            : #endif
    1447                 :            : 
    1448         [ #  # ]:          0 :     OOXMLOLEHandler aOLEHandler(this);
    1449 [ #  # ][ #  # ]:          0 :     getPropertySet()->resolve(aOLEHandler);
         [ #  # ][ #  # ]
    1450                 :          0 : }
    1451                 :            : 
    1452                 :          0 : void OOXMLFastContextHandlerProperties::setParent
    1453                 :            : (OOXMLFastContextHandler * pParent)
    1454                 :            : {
    1455                 :            : #ifdef DEBUG_ELEMENT
    1456                 :            :     debug_logger->startElement("setParent");
    1457                 :            :     debug_logger->chars(std::string("OOXMLFastContextHandlerProperties"));
    1458                 :            :     debug_logger->endElement();
    1459                 :            : #endif
    1460                 :            : 
    1461                 :          0 :     OOXMLFastContextHandler::setParent(pParent);
    1462                 :            : 
    1463         [ #  # ]:          0 :     if (mpParent->getResource() == STREAM)
    1464                 :          0 :         mbResolve = true;
    1465                 :          0 : }
    1466                 :            : 
    1467                 :        358 : void OOXMLFastContextHandlerProperties::setPropertySet
    1468                 :            : (OOXMLPropertySet::Pointer_t pPropertySet)
    1469                 :            : {
    1470         [ +  - ]:        358 :     if (pPropertySet.get() != NULL)
    1471                 :        358 :         mpPropertySet = pPropertySet;
    1472                 :        358 : }
    1473                 :            : 
    1474                 :            : OOXMLPropertySet::Pointer_t
    1475                 :      81532 : OOXMLFastContextHandlerProperties::getPropertySet() const
    1476                 :            : {
    1477                 :      81532 :     return mpPropertySet;
    1478                 :            : }
    1479                 :            : 
    1480                 :            : /*
    1481                 :            :  * class OOXMLFasContextHandlerPropertyTable
    1482                 :            :  */
    1483                 :            : 
    1484                 :        167 : OOXMLFastContextHandlerPropertyTable::OOXMLFastContextHandlerPropertyTable
    1485                 :            : (OOXMLFastContextHandler * pContext)
    1486         [ +  - ]:        167 : : OOXMLFastContextHandlerProperties(pContext)
    1487                 :            : {
    1488                 :        167 : }
    1489                 :            : 
    1490         [ +  - ]:        167 : OOXMLFastContextHandlerPropertyTable::~OOXMLFastContextHandlerPropertyTable()
    1491                 :            : {
    1492         [ -  + ]:        334 : }
    1493                 :            : 
    1494                 :        167 : void OOXMLFastContextHandlerPropertyTable::lcl_endFastElement
    1495                 :            : (Token_t Element)
    1496                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1497                 :            : {
    1498 [ +  - ][ +  - ]:        167 :     OOXMLPropertySet::Pointer_t pPropSet(mpPropertySet->clone());
    1499                 :            :     OOXMLTableImpl::ValuePointer_t pTmpVal
    1500 [ +  - ][ +  - ]:        167 :         (new OOXMLPropertySetValue(pPropSet));
         [ +  - ][ +  - ]
                 [ +  - ]
    1501                 :            : 
    1502 [ +  - ][ +  - ]:        167 :     mTable.add(pTmpVal);
                 [ +  - ]
    1503                 :            : 
    1504 [ +  - ][ +  - ]:        167 :     writerfilter::Reference<Table>::Pointer_t pTable(mTable.clone());
    1505                 :            : 
    1506                 :            : #ifdef DEBUG_PROPERTIES
    1507                 :            :     debug_logger->startElement("table");
    1508                 :            :     debug_logger->attribute("id", (*QNameToString::Instance())(mId));
    1509                 :            :     debug_logger->endElement();
    1510                 :            : #endif
    1511                 :            : 
    1512 [ +  - ][ +  - ]:        167 :     mpStream->table(mId, pTable);
                 [ +  - ]
    1513                 :            : 
    1514 [ +  - ][ +  - ]:        167 :     endAction(Element);
         [ +  - ][ +  - ]
    1515                 :        167 : }
    1516                 :            : 
    1517                 :            : /*
    1518                 :            :  class OOXMLFastContextHandlerValue
    1519                 :            : */
    1520                 :            : 
    1521                 :      15171 : OOXMLFastContextHandlerValue::OOXMLFastContextHandlerValue
    1522                 :            : (OOXMLFastContextHandler * pContext)
    1523         [ +  - ]:      15171 : : OOXMLFastContextHandler(pContext)
    1524                 :            : {
    1525                 :      15171 : }
    1526                 :            : 
    1527         [ +  - ]:      15171 : OOXMLFastContextHandlerValue::~OOXMLFastContextHandlerValue()
    1528                 :            : {
    1529         [ -  + ]:      30342 : }
    1530                 :            : 
    1531                 :      15055 : void OOXMLFastContextHandlerValue::setValue(OOXMLValue::Pointer_t pValue)
    1532                 :            : {
    1533                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1534                 :            :     debug_logger->startElement("contexthandler.setValue");
    1535                 :            :     debug_logger->attribute("value", pValue->toString());
    1536                 :            : #endif
    1537                 :            : 
    1538                 :      15055 :     mpValue = pValue;
    1539                 :            : 
    1540                 :            : #ifdef DEBUG_CONTEXT_HANDLER
    1541                 :            :     debug_logger->endElement();
    1542                 :            : #endif
    1543                 :      15055 : }
    1544                 :            : 
    1545                 :      15171 : OOXMLValue::Pointer_t OOXMLFastContextHandlerValue::getValue() const
    1546                 :            : {
    1547                 :      15171 :     return mpValue;
    1548                 :            : }
    1549                 :            : 
    1550                 :      15171 : void OOXMLFastContextHandlerValue::lcl_endFastElement
    1551                 :            : (Token_t Element)
    1552                 :            : throw (uno::RuntimeException, xml::sax::SAXException)
    1553                 :            : {
    1554                 :      15171 :     sendPropertyToParent();
    1555                 :            : 
    1556                 :      15171 :     endAction(Element);
    1557                 :      15171 : }
    1558                 :            : 
    1559                 :       2920 : void OOXMLFastContextHandlerValue::setDefaultBooleanValue()
    1560                 :            : {
    1561                 :            : #ifdef DEBUG_ELEMENT
    1562                 :            :     debug_logger->element("setDefaultBooleanValue");
    1563                 :            : #endif
    1564                 :            : 
    1565         [ +  + ]:       2920 :     if (mpValue.get() == NULL)
    1566                 :            :     {
    1567 [ +  - ][ +  - ]:       2293 :         OOXMLValue::Pointer_t pValue(new OOXMLBooleanValue(true));
                 [ +  - ]
    1568 [ +  - ][ +  - ]:       2293 :         setValue(pValue);
         [ +  - ][ +  - ]
    1569                 :            :     }
    1570                 :       2920 : }
    1571                 :            : 
    1572                 :       3152 : void OOXMLFastContextHandlerValue::setDefaultIntegerValue()
    1573                 :            : {
    1574                 :            : #ifdef DEBUG_ELEMENT
    1575                 :            :     debug_logger->element("setDefaultIntegerValue");
    1576                 :            : #endif
    1577                 :            : 
    1578         [ -  + ]:       3152 :     if (mpValue.get() == NULL)
    1579                 :            :     {
    1580 [ #  # ][ #  # ]:          0 :         OOXMLValue::Pointer_t pValue(new OOXMLIntegerValue(0));
                 [ #  # ]
    1581 [ #  # ][ #  # ]:          0 :         setValue(pValue);
         [ #  # ][ #  # ]
    1582                 :            :     }
    1583                 :       3152 : }
    1584                 :            : 
    1585                 :       1817 : void OOXMLFastContextHandlerValue::setDefaultHexValue()
    1586                 :            : {
    1587                 :            : #ifdef DEBUG_ELEMENT
    1588                 :            :     debug_logger->element("setDefaultHexValue");
    1589                 :            : #endif
    1590                 :            : 
    1591         [ -  + ]:       1817 :     if (mpValue.get() == NULL)
    1592                 :            :     {
    1593 [ #  # ][ #  # ]:          0 :         OOXMLValue::Pointer_t pValue(new OOXMLHexValue(0));
                 [ #  # ]
    1594 [ #  # ][ #  # ]:          0 :         setValue(pValue);
         [ #  # ][ #  # ]
    1595                 :            :     }
    1596                 :       1817 : }
    1597                 :            : 
    1598                 :       3872 : void OOXMLFastContextHandlerValue::setDefaultStringValue()
    1599                 :            : {
    1600                 :            : #ifdef DEBUG_ELEMENT
    1601                 :            :     debug_logger->element("setDefaultStringValue");
    1602                 :            : #endif
    1603                 :            : 
    1604         [ -  + ]:       3872 :     if (mpValue.get() == NULL)
    1605                 :            :     {
    1606 [ #  # ][ #  # ]:          0 :         OOXMLValue::Pointer_t pValue(new OOXMLStringValue(OUString()));
                 [ #  # ]
    1607 [ #  # ][ #  # ]:          0 :         setValue(pValue);
         [ #  # ][ #  # ]
    1608                 :            :     }
    1609                 :       3872 : }
    1610                 :            : /*
    1611                 :            :   class OOXMLFastContextHandlerTable
    1612                 :            : */
    1613                 :            : 
    1614                 :        465 : OOXMLFastContextHandlerTable::OOXMLFastContextHandlerTable
    1615                 :            : (OOXMLFastContextHandler * pContext)
    1616 [ +  - ][ +  - ]:        465 : : OOXMLFastContextHandler(pContext)
    1617                 :            : {
    1618                 :        465 : }
    1619                 :            : 
    1620         [ +  - ]:        465 : OOXMLFastContextHandlerTable::~OOXMLFastContextHandlerTable()
    1621                 :            : {
    1622         [ -  + ]:        930 : }
    1623                 :            : 
    1624                 :            : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
    1625                 :       2592 : OOXMLFastContextHandlerTable::createFastChildContext
    1626                 :            : (Token_t Element,
    1627                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    1628                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1629                 :            : {
    1630                 :       2592 :     addCurrentChild();
    1631                 :            : 
    1632                 :            :     mCurrentChild.set
    1633         [ +  - ]:       2592 :         (OOXMLFastContextHandler::createFastChildContext(Element, Attribs));
    1634                 :            : 
    1635                 :       2592 :     return mCurrentChild;
    1636                 :            : }
    1637                 :            : 
    1638                 :        465 : void OOXMLFastContextHandlerTable::lcl_endFastElement
    1639                 :            : (Token_t /*Element*/)
    1640                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1641                 :            : {
    1642         [ +  - ]:        465 :     addCurrentChild();
    1643                 :            : 
    1644 [ +  - ][ +  - ]:        465 :     writerfilter::Reference<Table>::Pointer_t pTable(mTable.clone());
    1645 [ +  - ][ +  - ]:        465 :     if (isForwardEvents() && mId != 0x0)
         [ +  - ][ +  - ]
    1646                 :            :     {
    1647                 :            : #ifdef DEBUG_PROPERTIES
    1648                 :            :         debug_logger->startElement("table");
    1649                 :            :         string str = (*QNameToString::Instance())(mId);
    1650                 :            :         debug_logger->attribute("id", str);
    1651                 :            :         debug_logger->endElement();
    1652                 :            : #endif
    1653                 :            : 
    1654 [ +  - ][ +  - ]:        465 :         mpStream->table(mId, pTable);
                 [ +  - ]
    1655         [ +  - ]:        465 :     }
    1656                 :        465 : }
    1657                 :            : 
    1658                 :       3057 : void OOXMLFastContextHandlerTable::addCurrentChild()
    1659                 :            : {
    1660                 :       3057 :     OOXMLFastContextHandler * pHandler = mCurrentChild.getPointer();
    1661         [ +  + ]:       3057 :     if ( pHandler != NULL)
    1662                 :            :     {
    1663         [ +  - ]:       2346 :         OOXMLValue::Pointer_t pValue(pHandler->getValue());
    1664                 :            : 
    1665         [ +  - ]:       2346 :         if (pValue.get() != NULL)
    1666                 :            :         {
    1667 [ +  - ][ +  - ]:       2346 :             OOXMLTableImpl::ValuePointer_t pTmpVal(pValue->clone());
    1668 [ +  - ][ +  - ]:       2346 :             mTable.add(pTmpVal);
         [ +  - ][ +  - ]
    1669         [ +  - ]:       2346 :         }
    1670                 :            :     }
    1671                 :       3057 : }
    1672                 :            : 
    1673                 :          0 : void OOXMLFastContextHandlerTable::newPropertySet
    1674                 :            : (OOXMLPropertySet::Pointer_t /*pPropertySet*/)
    1675                 :            : {
    1676                 :            : 
    1677                 :          0 : }
    1678                 :            : 
    1679                 :            : /*
    1680                 :            :   class OOXMLFastContextHandlerXNote
    1681                 :            :  */
    1682                 :            : 
    1683                 :          6 : OOXMLFastContextHandlerXNote::OOXMLFastContextHandlerXNote
    1684                 :            : (OOXMLFastContextHandler * pContext)
    1685                 :          6 : : OOXMLFastContextHandlerProperties(pContext), mbForwardEventsSaved(false)
    1686                 :            : {
    1687                 :          6 : }
    1688                 :            : 
    1689                 :          6 : OOXMLFastContextHandlerXNote::~OOXMLFastContextHandlerXNote()
    1690                 :            : {
    1691         [ -  + ]:         12 : }
    1692                 :            : 
    1693                 :          6 : void OOXMLFastContextHandlerXNote::lcl_startFastElement
    1694                 :            : (Token_t Element,
    1695                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
    1696                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1697                 :            : {
    1698                 :          6 :     mbForwardEventsSaved = isForwardEvents();
    1699                 :            : 
    1700         [ +  - ]:          6 :     if (mnMyXNoteId == getXNoteId())
    1701                 :          6 :         setForwardEvents(true);
    1702                 :            :     else
    1703                 :          0 :         setForwardEvents(false);
    1704                 :            : 
    1705                 :          6 :     startAction(Element);
    1706                 :          6 : }
    1707                 :            : 
    1708                 :          6 : void OOXMLFastContextHandlerXNote::lcl_endFastElement
    1709                 :            : (Token_t Element)
    1710                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1711                 :            : {
    1712                 :          6 :     endAction(Element);
    1713                 :            : 
    1714                 :          6 :     OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);
    1715                 :            : 
    1716                 :          6 :     setForwardEvents(mbForwardEventsSaved);
    1717                 :          6 : }
    1718                 :            : 
    1719                 :          6 : void OOXMLFastContextHandlerXNote::checkId(OOXMLValue::Pointer_t pValue)
    1720                 :            : {
    1721                 :            : #ifdef DEBUG_ELEMENT
    1722                 :            :     debug_logger->startElement("checkId");
    1723                 :            :     debug_logger->attribute("myId", sal_Int32(pValue->getInt()));
    1724                 :            :     debug_logger->attribute("id", getXNoteId());
    1725                 :            :     debug_logger->endElement();
    1726                 :            : #endif
    1727                 :            : 
    1728                 :          6 :     mnMyXNoteId = sal_Int32(pValue->getInt());
    1729                 :          6 : }
    1730                 :            : 
    1731                 :            : /*
    1732                 :            :   class OOXMLFastContextHandlerTextTableCell
    1733                 :            :  */
    1734                 :            : 
    1735                 :        229 : OOXMLFastContextHandlerTextTableCell::OOXMLFastContextHandlerTextTableCell
    1736                 :            : (OOXMLFastContextHandler * pContext)
    1737                 :        229 : : OOXMLFastContextHandler(pContext)
    1738                 :            : {
    1739                 :        229 : }
    1740                 :            : 
    1741                 :        229 : OOXMLFastContextHandlerTextTableCell::~OOXMLFastContextHandlerTextTableCell()
    1742                 :            : {
    1743         [ -  + ]:        458 : }
    1744                 :            : 
    1745                 :        229 : void OOXMLFastContextHandlerTextTableCell::startCell()
    1746                 :            : {
    1747                 :        229 : }
    1748                 :            : 
    1749                 :        229 : void OOXMLFastContextHandlerTextTableCell::endCell()
    1750                 :            : {
    1751         [ +  - ]:        229 :     if (isForwardEvents())
    1752                 :            :     {
    1753         [ +  - ]:        229 :         OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
    1754                 :            :         {
    1755                 :            :             OOXMLValue::Pointer_t pVal
    1756 [ +  - ][ +  - ]:        229 :                 (new OOXMLIntegerValue(mnTableDepth));
                 [ +  - ]
    1757                 :            :             OOXMLProperty::Pointer_t pProp
    1758 [ +  - ][ +  - ]:        229 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PTableDepth, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1759 [ +  - ][ +  - ]:        229 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1760                 :            :         }
    1761                 :            :         {
    1762                 :            :             OOXMLValue::Pointer_t pVal
    1763 [ +  - ][ +  - ]:        229 :                 (new OOXMLIntegerValue(1));
                 [ +  - ]
    1764                 :            :             OOXMLProperty::Pointer_t pProp
    1765 [ +  - ][ +  - ]:        229 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PFInTable, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1766 [ +  - ][ +  - ]:        229 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1767                 :            :         }
    1768                 :            :         {
    1769                 :            :             OOXMLValue::Pointer_t pVal
    1770 [ +  - ][ +  - ]:        229 :                 (new OOXMLBooleanValue(mnTableDepth > 0));
                 [ +  - ]
    1771                 :            :             OOXMLProperty::Pointer_t pProp
    1772 [ +  - ][ +  - ]:        229 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PCell, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1773 [ +  - ][ +  - ]:        229 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1774                 :            :         }
    1775                 :            : 
    1776                 :            : #ifdef DEBUG_PROPERTIES
    1777                 :            :         debug_logger->startElement("endcell");
    1778                 :            :         debug_logger->propertySet(OOXMLPropertySet::Pointer_t(pProps->clone()),
    1779                 :            :                 IdToString::Pointer_t(new OOXMLIdToString()));
    1780                 :            :         debug_logger->endElement();
    1781                 :            : #endif
    1782         [ +  - ]:        229 :         mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
    1783                 :            :     }
    1784                 :        229 : }
    1785                 :            : 
    1786                 :            : /*
    1787                 :            :   class OOXMLFastContextHandlerTextTableRow
    1788                 :            :  */
    1789                 :            : 
    1790                 :         40 : OOXMLFastContextHandlerTextTableRow::OOXMLFastContextHandlerTextTableRow
    1791                 :            : (OOXMLFastContextHandler * pContext)
    1792                 :         40 : : OOXMLFastContextHandler(pContext)
    1793                 :            : {
    1794                 :         40 : }
    1795                 :            : 
    1796                 :         40 : OOXMLFastContextHandlerTextTableRow::~OOXMLFastContextHandlerTextTableRow()
    1797                 :            : {
    1798         [ -  + ]:         80 : }
    1799                 :            : 
    1800                 :         40 : void OOXMLFastContextHandlerTextTableRow::startRow()
    1801                 :            : {
    1802                 :         40 : }
    1803                 :            : 
    1804                 :         40 : void OOXMLFastContextHandlerTextTableRow::endRow()
    1805                 :            : {
    1806                 :         40 :     startParagraphGroup();
    1807                 :            : 
    1808         [ +  - ]:         40 :     if (isForwardEvents())
    1809                 :            :     {
    1810         [ +  - ]:         40 :         OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
    1811                 :            :         {
    1812                 :            :             OOXMLValue::Pointer_t pVal
    1813 [ +  - ][ +  - ]:         40 :                 (new OOXMLIntegerValue(mnTableDepth));
                 [ +  - ]
    1814                 :            :             OOXMLProperty::Pointer_t pProp
    1815 [ +  - ][ +  - ]:         40 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PTableDepth, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1816 [ +  - ][ +  - ]:         40 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1817                 :            :         }
    1818                 :            :         {
    1819                 :            :             OOXMLValue::Pointer_t pVal
    1820 [ +  - ][ +  - ]:         40 :                 (new OOXMLIntegerValue(1));
                 [ +  - ]
    1821                 :            :             OOXMLProperty::Pointer_t pProp
    1822 [ +  - ][ +  - ]:         40 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PFInTable, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1823 [ +  - ][ +  - ]:         40 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1824                 :            :         }
    1825                 :            :         {
    1826                 :            :             OOXMLValue::Pointer_t pVal
    1827 [ +  - ][ +  - ]:         40 :                 (new OOXMLIntegerValue(1));
                 [ +  - ]
    1828                 :            :             OOXMLProperty::Pointer_t pProp
    1829 [ +  - ][ +  - ]:         40 :                 (new OOXMLPropertyImpl(NS_sprm::LN_PRow, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1830 [ +  - ][ +  - ]:         40 :             pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1831                 :            :         }
    1832                 :            : 
    1833                 :            : #ifdef DEBUG_PROPERTIES
    1834                 :            :         debug_logger->startElement("endrow");
    1835                 :            :         debug_logger->propertySet(OOXMLPropertySet::Pointer_t(pProps->clone()),
    1836                 :            :                 IdToString::Pointer_t(new OOXMLIdToString()));
    1837                 :            :         debug_logger->endElement();
    1838                 :            : #endif
    1839                 :            : 
    1840         [ +  - ]:         40 :         mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
    1841                 :            :     }
    1842                 :            : 
    1843                 :         40 :     startCharacterGroup();
    1844                 :            : 
    1845         [ +  - ]:         40 :     if (isForwardEvents())
    1846                 :         40 :         mpStream->utext(s0xd, 1);
    1847                 :            : 
    1848                 :         40 :     endCharacterGroup();
    1849                 :         40 :     endParagraphGroup();
    1850                 :         40 : }
    1851                 :            : 
    1852                 :            : /*
    1853                 :            :   class OOXMLFastContextHandlerTextTable
    1854                 :            :  */
    1855                 :            : 
    1856                 :         36 : OOXMLFastContextHandlerTextTable::OOXMLFastContextHandlerTextTable
    1857                 :            : (OOXMLFastContextHandler * pContext)
    1858                 :         36 : : OOXMLFastContextHandler(pContext)
    1859                 :            : {
    1860                 :         36 : }
    1861                 :            : 
    1862                 :         36 : OOXMLFastContextHandlerTextTable::~OOXMLFastContextHandlerTextTable()
    1863                 :            : {
    1864         [ +  - ]:         36 :     clearTableProps();
    1865         [ -  + ]:         72 : }
    1866                 :            : 
    1867                 :         36 : void OOXMLFastContextHandlerTextTable::lcl_startFastElement
    1868                 :            : (Token_t Element,
    1869                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
    1870                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1871                 :            : {
    1872         [ +  - ]:         36 :     mpParserState->startTable();
    1873                 :         36 :     mnTableDepth++;
    1874                 :            : 
    1875 [ +  - ][ +  - ]:         36 :     boost::shared_ptr<OOXMLPropertySet> pProps( new OOXMLPropertySetImpl );
                 [ +  - ]
    1876                 :            :     {
    1877                 :            :         OOXMLValue::Pointer_t pVal
    1878 [ +  - ][ +  - ]:         36 :             (new OOXMLIntegerValue(mnTableDepth));
                 [ +  - ]
    1879                 :            :         OOXMLProperty::Pointer_t pProp
    1880 [ +  - ][ +  - ]:         36 :             (new OOXMLPropertyImpl(NS_ooxml::LN_tblStart, pVal, OOXMLPropertyImpl::SPRM));
         [ +  - ][ +  - ]
                 [ +  - ]
    1881 [ +  - ][ +  - ]:         36 :         pProps->add(pProp);
         [ +  - ][ +  - ]
                 [ +  - ]
    1882                 :            :     }
    1883 [ +  - ][ +  - ]:         36 :     mpParserState->setCharacterProperties(pProps);
                 [ +  - ]
    1884                 :            : 
    1885 [ +  - ][ +  - ]:         36 :     startAction(Element);
    1886                 :         36 : }
    1887                 :            : 
    1888                 :         36 : void OOXMLFastContextHandlerTextTable::lcl_endFastElement
    1889                 :            : (Token_t Element)
    1890                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1891                 :            : {
    1892                 :         36 :     endAction(Element);
    1893                 :            : 
    1894                 :         36 :     mnTableDepth--;
    1895                 :         36 :     mpParserState->endTable();
    1896                 :         36 : }
    1897                 :            : 
    1898                 :            : /*
    1899                 :            :   class OOXMLFastContextHandlerShape
    1900                 :            :  */
    1901                 :            : 
    1902                 :         57 : OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
    1903                 :            : (OOXMLFastContextHandler * pContext)
    1904                 :            : : OOXMLFastContextHandlerProperties(pContext), m_bShapeSent( false ),
    1905                 :         57 :     m_bShapeStarted(false)
    1906                 :            : {
    1907         [ +  - ]:         57 :     uno::Reference<uno::XComponentContext> xContext(getComponentContext());
    1908         [ +  - ]:         57 :     if (xContext.is())
    1909                 :            :     {
    1910                 :            :         uno::Reference<XMultiComponentFactory> rServiceManager
    1911 [ +  - ][ +  - ]:         57 :             (xContext->getServiceManager());
    1912                 :            : 
    1913 [ +  - ][ +  - ]:         57 :         mrShapeContext.set( getDocument( )->getShapeContext( ) );
                 [ +  - ]
    1914         [ +  + ]:         57 :         if ( !mrShapeContext.is( ) )
    1915                 :            :         {
    1916                 :            :             // Define the shape context for the whole document
    1917                 :            :             mrShapeContext.set
    1918         [ +  - ]:         33 :                 (rServiceManager->
    1919                 :            :                   createInstanceWithContext
    1920                 :         33 :                   ("com.sun.star.xml.sax.FastShapeContextHandler", xContext),
    1921 [ +  - ][ +  - ]:         33 :                   uno::UNO_QUERY);
    1922 [ +  - ][ +  - ]:         33 :             getDocument()->setShapeContext( mrShapeContext );
    1923                 :            :         }
    1924                 :            : 
    1925         [ +  - ]:         57 :         if (mrShapeContext.is())
    1926                 :            :         {
    1927 [ +  - ][ +  - ]:         57 :             mrShapeContext->setModel(getDocument()->getModel());
         [ +  - ][ +  - ]
    1928 [ +  - ][ +  - ]:         57 :             mrShapeContext->setDrawPage(getDocument()->getDrawPage());
         [ +  - ][ +  - ]
    1929 [ +  - ][ +  - ]:         57 :             mrShapeContext->setInputStream(getDocument()->getStorageStream());
         [ +  - ][ +  - ]
    1930                 :            : 
    1931                 :            : #ifdef DEBUG_ELEMENT
    1932                 :            :             debug_logger->startElement("setRelationFragmentPath");
    1933                 :            :             debug_logger->attribute("path", mpParserState->getTarget());
    1934                 :            :             debug_logger->endElement();
    1935                 :            : #endif
    1936         [ +  - ]:         57 :             mrShapeContext->setRelationFragmentPath
    1937 [ +  - ][ +  - ]:         57 :                 (mpParserState->getTarget());
    1938                 :         57 :         }
    1939                 :            : #ifdef DEBUG_CONTEXT_STACK
    1940                 :            :         else
    1941                 :            :         {
    1942                 :            :             debug_logger->startElement("error");
    1943                 :            :             debug_logger->chars(std::string("failed to get shape handler"));
    1944                 :            :             debug_logger->endElement();
    1945                 :            :         }
    1946                 :            : #endif
    1947                 :         57 :     }
    1948                 :         57 : }
    1949                 :            : 
    1950                 :         57 : OOXMLFastContextHandlerShape::~OOXMLFastContextHandlerShape()
    1951                 :            : {
    1952         [ -  + ]:        114 : }
    1953                 :            : 
    1954                 :         57 : void OOXMLFastContextHandlerShape::lcl_startFastElement
    1955                 :            : (Token_t Element,
    1956                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    1957                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1958                 :            : {
    1959                 :         57 :     startAction(Element);
    1960                 :            : 
    1961         [ +  - ]:         57 :     if (mrShapeContext.is())
    1962                 :            :     {
    1963                 :         57 :         mrShapeContext->startFastElement(Element, Attribs);
    1964                 :            :     }
    1965                 :         57 : }
    1966                 :            : 
    1967                 :          0 : void SAL_CALL OOXMLFastContextHandlerShape::startUnknownElement
    1968                 :            : (const OUString & Namespace,
    1969                 :            :  const OUString & Name,
    1970                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    1971                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    1972                 :            : {
    1973         [ #  # ]:          0 :     if (mrShapeContext.is())
    1974                 :          0 :         mrShapeContext->startUnknownElement(Namespace, Name, Attribs);
    1975                 :          0 : }
    1976                 :            : 
    1977                 :         57 : void OOXMLFastContextHandlerShape::setToken(Token_t nToken)
    1978                 :            : {
    1979                 :         57 :     OOXMLFastContextHandler::setToken(nToken);
    1980                 :            : 
    1981         [ +  - ]:         57 :     if (mrShapeContext.is())
    1982                 :         57 :         mrShapeContext->setStartToken(nToken);
    1983                 :         57 : }
    1984                 :            : 
    1985                 :         69 : void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
    1986                 :            : {
    1987 [ +  - ][ +  + ]:         69 :     if ( mrShapeContext.is() && !m_bShapeSent )
                 [ +  + ]
    1988                 :            :     {
    1989 [ +  - ][ +  - ]:         57 :         uno::Reference<drawing::XShape> xShape(mrShapeContext->getShape());
    1990         [ +  + ]:         57 :         if (xShape.is())
    1991                 :            :         {
    1992                 :            :             OOXMLValue::Pointer_t
    1993 [ +  - ][ +  - ]:         48 :                 pValue(new OOXMLShapeValue(xShape));
                 [ +  - ]
    1994 [ +  - ][ +  - ]:         48 :             newProperty(NS_ooxml::LN_shape, pValue);
                 [ +  - ]
    1995                 :         48 :             m_bShapeSent = true;
    1996                 :            : 
    1997                 :         48 :             bool bIsPicture = Element == ( NS_picture | OOXML_pic );
    1998                 :            : 
    1999                 :            :             // Notify the dmapper that the shape is ready to use
    2000         [ +  + ]:         48 :             if ( !bIsPicture )
    2001                 :            :             {
    2002         [ +  - ]:         36 :                 mpStream->startShape( xShape );
    2003                 :         36 :                 m_bShapeStarted = true;
    2004         [ +  - ]:         48 :             }
    2005                 :         57 :         }
    2006                 :            :     }
    2007                 :         69 : }
    2008                 :            : 
    2009                 :         57 : void OOXMLFastContextHandlerShape::lcl_endFastElement
    2010                 :            : (Token_t Element)
    2011                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2012                 :            : {
    2013         [ +  - ]:         57 :     if (mrShapeContext.is())
    2014                 :            :     {
    2015                 :         57 :         mrShapeContext->endFastElement(Element);
    2016                 :         57 :         sendShape( Element );
    2017                 :            :     }
    2018                 :            : 
    2019                 :         57 :     OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);
    2020                 :            : 
    2021                 :            :     // Ending the shape should be the last thing to do
    2022                 :         57 :     bool bIsPicture = Element == ( NS_picture | OOXML_pic );
    2023 [ +  + ][ +  + ]:         57 :     if ( !bIsPicture && m_bShapeStarted)
    2024                 :         36 :         mpStream->endShape( );
    2025                 :         57 : }
    2026                 :            : 
    2027                 :          0 : void SAL_CALL OOXMLFastContextHandlerShape::endUnknownElement
    2028                 :            : (const OUString & Namespace,
    2029                 :            :  const OUString & Name)
    2030                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2031                 :            : {
    2032         [ #  # ]:          0 :     if (mrShapeContext.is())
    2033                 :          0 :         mrShapeContext->endUnknownElement(Namespace, Name);
    2034                 :          0 : }
    2035                 :            : 
    2036                 :            : uno::Reference< xml::sax::XFastContextHandler >
    2037                 :         99 : OOXMLFastContextHandlerShape::lcl_createFastChildContext
    2038                 :            : (Token_t Element,
    2039                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    2040                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2041                 :            : {
    2042                 :         99 :     uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
    2043                 :            : 
    2044                 :         99 :     sal_uInt32 nNamespace = Element & 0xffff0000;
    2045                 :            : 
    2046         [ -  + ]:         99 :     switch (nNamespace)
    2047                 :            :     {
    2048                 :            :         case NS_wordprocessingml:
    2049                 :            :         case NS_vml_wordprocessingDrawing:
    2050                 :            :         case NS_office:
    2051 [ #  # ][ #  # ]:          0 :             xContextHandler.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
         [ #  # ][ #  # ]
    2052                 :          0 :             break;
    2053                 :            :         default:
    2054         [ +  - ]:         99 :             if (mrShapeContext.is())
    2055                 :            :             {
    2056                 :            :                 uno::Reference<XFastContextHandler> pChildContext =
    2057 [ +  - ][ +  - ]:         99 :                 mrShapeContext->createFastChildContext(Element, Attribs);
    2058                 :            : 
    2059                 :            :                 OOXMLFastContextHandlerWrapper * pWrapper =
    2060         [ +  - ]:         99 :                 new OOXMLFastContextHandlerWrapper(this, pChildContext);
    2061                 :            : 
    2062         [ +  - ]:         99 :                 pWrapper->addNamespace(NS_wordprocessingml);
    2063         [ +  - ]:         99 :                 pWrapper->addNamespace(NS_vml_wordprocessingDrawing);
    2064         [ +  - ]:         99 :                 pWrapper->addNamespace(NS_office);
    2065         [ +  - ]:         99 :                 pWrapper->addToken( NS_vml|OOXML_textbox );
    2066                 :            : 
    2067 [ +  - ][ +  - ]:         99 :                 xContextHandler.set(pWrapper);
    2068                 :            :             }
    2069                 :            :             else
    2070         [ #  # ]:          0 :                 xContextHandler.set(this);
    2071                 :         99 :             break;
    2072                 :            :     }
    2073                 :            : 
    2074                 :            : 
    2075                 :         99 :     return xContextHandler;
    2076                 :            : }
    2077                 :            : 
    2078                 :            : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
    2079                 :          0 : OOXMLFastContextHandlerShape::createUnknownChildContext
    2080                 :            : (const OUString & Namespace,
    2081                 :            :  const OUString & Name,
    2082                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    2083                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2084                 :            : {
    2085                 :          0 :     uno::Reference< xml::sax::XFastContextHandler > xResult;
    2086                 :            : 
    2087         [ #  # ]:          0 :     if (mrShapeContext.is())
    2088         [ #  # ]:          0 :         xResult.set(mrShapeContext->createUnknownChildContext
    2089 [ #  # ][ #  # ]:          0 :             (Namespace, Name, Attribs));
    2090                 :            : 
    2091                 :          0 :     return xResult;
    2092                 :            : }
    2093                 :            : 
    2094                 :        180 : void OOXMLFastContextHandlerShape::lcl_characters
    2095                 :            : (const OUString & aChars)
    2096                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2097                 :            : {
    2098         [ +  - ]:        180 :     if (mrShapeContext.is())
    2099                 :        180 :         mrShapeContext->characters(aChars);
    2100                 :        180 : }
    2101                 :            : 
    2102                 :            : /*
    2103                 :            :   class OOXMLFastContextHandlerWrapper
    2104                 :            : */
    2105                 :            : 
    2106                 :        417 : OOXMLFastContextHandlerWrapper::OOXMLFastContextHandlerWrapper
    2107                 :            : (OOXMLFastContextHandler * pParent,
    2108                 :            :  uno::Reference<XFastContextHandler> xContext)
    2109 [ +  - ][ +  - ]:        417 : : OOXMLFastContextHandler(pParent), mxContext(xContext)
                 [ +  - ]
    2110                 :            : {
    2111         [ +  - ]:        417 :     if (pParent != NULL)
    2112                 :            :     {
    2113 [ +  - ][ +  - ]:        417 :         setId(pParent->getId());
    2114 [ +  - ][ +  - ]:        417 :         setToken(pParent->getToken());
    2115 [ +  - ][ +  - ]:        417 :         setPropertySet(pParent->getPropertySet());
                 [ +  - ]
    2116                 :            :     }
    2117                 :        417 : }
    2118                 :            : 
    2119         [ +  - ]:        417 : OOXMLFastContextHandlerWrapper::~OOXMLFastContextHandlerWrapper()
    2120                 :            : {
    2121         [ -  + ]:        834 : }
    2122                 :            : 
    2123                 :          0 : void SAL_CALL OOXMLFastContextHandlerWrapper::startUnknownElement
    2124                 :            : (const OUString & Namespace,
    2125                 :            :  const OUString & Name,
    2126                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    2127                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2128                 :            : {
    2129         [ #  # ]:          0 :     if (mxContext.is())
    2130                 :          0 :         mxContext->startUnknownElement(Namespace, Name, Attribs);
    2131                 :          0 : }
    2132                 :            : 
    2133                 :          0 : void SAL_CALL OOXMLFastContextHandlerWrapper::endUnknownElement
    2134                 :            : (const OUString & Namespace,
    2135                 :            :  const OUString & Name)
    2136                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2137                 :            : {
    2138         [ #  # ]:          0 :     if (mxContext.is())
    2139                 :          0 :         mxContext->endUnknownElement(Namespace, Name);
    2140                 :          0 : }
    2141                 :            : 
    2142                 :            : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
    2143                 :          0 : OOXMLFastContextHandlerWrapper::createUnknownChildContext
    2144                 :            : (const OUString & Namespace,
    2145                 :            :  const OUString & Name,
    2146                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    2147                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2148                 :            : {
    2149                 :          0 :     uno::Reference< xml::sax::XFastContextHandler > xResult;
    2150                 :            : 
    2151         [ #  # ]:          0 :     if (mxContext.is())
    2152         [ #  # ]:          0 :         xResult = mxContext->createUnknownChildContext
    2153 [ #  # ][ #  # ]:          0 :             (Namespace, Name, Attribs);
    2154                 :            :     else
    2155         [ #  # ]:          0 :         xResult.set(this);
    2156                 :            : 
    2157                 :          0 :     return xResult;
    2158                 :            : }
    2159                 :            : 
    2160                 :        489 : void OOXMLFastContextHandlerWrapper::attributes
    2161                 :            : (const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    2162                 :            : throw (uno::RuntimeException, xml::sax::SAXException)
    2163                 :            : {
    2164         [ +  + ]:        489 :     if (mxContext.is())
    2165                 :            :     {
    2166                 :        240 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2167         [ -  + ]:        240 :         if (pHandler != NULL)
    2168                 :          0 :             pHandler->attributes(Attribs);
    2169                 :            :     }
    2170                 :        489 : }
    2171                 :            : 
    2172                 :            : OOXMLFastContextHandler::ResourceEnum_t
    2173                 :          0 : OOXMLFastContextHandlerWrapper::getResource() const
    2174                 :            : {
    2175                 :          0 :     return UNKNOWN;
    2176                 :            : }
    2177                 :            : 
    2178                 :        297 : void OOXMLFastContextHandlerWrapper::addNamespace(const Id & nId)
    2179                 :            : {
    2180                 :        297 :     mMyNamespaces.insert(nId);
    2181                 :        297 : }
    2182                 :            : 
    2183                 :         99 : void OOXMLFastContextHandlerWrapper::addToken( Token_t Token )
    2184                 :            : {
    2185                 :         99 :     mMyTokens.insert( Token );
    2186                 :         99 : }
    2187                 :            : 
    2188                 :        489 : void OOXMLFastContextHandlerWrapper::lcl_startFastElement
    2189                 :            : (Token_t Element,
    2190                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    2191                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2192                 :            : {
    2193         [ +  + ]:        489 :     if (mxContext.is())
    2194                 :        240 :         mxContext->startFastElement(Element, Attribs);
    2195                 :        489 : }
    2196                 :            : 
    2197                 :        489 : void OOXMLFastContextHandlerWrapper::lcl_endFastElement
    2198                 :            : (Token_t Element)
    2199                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2200                 :            : {
    2201         [ +  + ]:        489 :     if (mxContext.is())
    2202                 :        240 :         mxContext->endFastElement(Element);
    2203                 :        489 : }
    2204                 :            : 
    2205                 :            : uno::Reference< xml::sax::XFastContextHandler >
    2206                 :        426 : OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
    2207                 :            : (Token_t Element,
    2208                 :            :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
    2209                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2210                 :            : {
    2211                 :        426 :     uno::Reference< xml::sax::XFastContextHandler > xResult;
    2212                 :            : 
    2213                 :        426 :     Id nNameSpace = Element & 0xffff0000;
    2214                 :            : 
    2215                 :            : #ifdef DEBUG_ELEMENT
    2216                 :            :     debug_logger->startElement("Wrapper-createChildContext");
    2217                 :            :     debug_logger->attribute("token", fastTokenToId(Element));
    2218                 :            : 
    2219                 :            :     set<Id>::const_iterator aIt(mMyNamespaces.begin());
    2220                 :            :     while (aIt != mMyNamespaces.end())
    2221                 :            :     {
    2222                 :            :         debug_logger->startElement("namespace");
    2223                 :            :         debug_logger->attribute("id", fastTokenToId(*aIt));
    2224                 :            :         debug_logger->endElement();
    2225                 :            : 
    2226                 :            :         aIt++;
    2227                 :            :     }
    2228                 :            : 
    2229                 :            :     debug_logger->endElement();
    2230                 :            : #endif
    2231                 :            : 
    2232 [ +  - ][ +  - ]:        426 :     bool bInNamespaces = mMyNamespaces.find(nNameSpace) != mMyNamespaces.end();
    2233 [ +  - ][ +  - ]:        426 :     bool bInTokens = mMyTokens.find( Element ) != mMyTokens.end( );
    2234                 :            : 
    2235                 :            :     // We have methods to _add_ individual tokens or whole namespaces to be
    2236                 :            :     // processed by writerfilter (instead of oox), but we have no method to
    2237                 :            :     // filter out a single token. Just hardwire the wrap token here till we
    2238                 :            :     // need a more generic solution.
    2239 [ +  + ][ +  + ]:        426 :     if ( bInNamespaces && Element != static_cast<sal_Int32>(NS_vml_wordprocessingDrawing | OOXML_wrap) )
    2240 [ +  - ][ +  - ]:         36 :         xResult.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
         [ +  - ][ +  - ]
    2241         [ +  + ]:        390 :     else if (mxContext.is())
    2242                 :            :     {
    2243                 :            :         OOXMLFastContextHandlerWrapper * pWrapper =
    2244                 :            :             new OOXMLFastContextHandlerWrapper
    2245 [ +  - ][ +  - ]:        318 :             (this, mxContext->createFastChildContext(Element, Attribs));
                 [ +  - ]
    2246         [ +  - ]:        318 :         pWrapper->mMyNamespaces = mMyNamespaces;
    2247 [ +  - ][ +  - ]:        318 :         pWrapper->setPropertySet(getPropertySet());
                 [ +  - ]
    2248 [ +  - ][ +  - ]:        318 :         xResult.set(pWrapper);
    2249                 :            :     }
    2250                 :            :     else
    2251         [ +  - ]:         72 :         xResult.set(this);
    2252                 :            : 
    2253         [ +  + ]:        426 :     if ( bInTokens )
    2254                 :            :     {
    2255                 :         12 :         OOXMLFastContextHandlerShape* pShapeCtx = (OOXMLFastContextHandlerShape*)mpParent;
    2256         [ +  - ]:        426 :         pShapeCtx->sendShape( Element );
    2257                 :            :     }
    2258                 :            : 
    2259                 :        426 :     return xResult;
    2260                 :            : }
    2261                 :            : 
    2262                 :        432 : void OOXMLFastContextHandlerWrapper::lcl_characters
    2263                 :            : (const OUString & aChars)
    2264                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2265                 :            : {
    2266         [ +  + ]:        432 :     if (mxContext.is())
    2267                 :        354 :         mxContext->characters(aChars);
    2268                 :        432 : }
    2269                 :            : 
    2270                 :            : OOXMLFastContextHandler *
    2271                 :       2382 : OOXMLFastContextHandlerWrapper::getFastContextHandler() const
    2272                 :            : {
    2273         [ +  - ]:       2382 :     if (mxContext.is())
    2274         [ +  - ]:       2382 :         return dynamic_cast<OOXMLFastContextHandler *>(mxContext.get());
    2275                 :            : 
    2276                 :       2382 :     return NULL;
    2277                 :            : }
    2278                 :            : 
    2279                 :          0 : void OOXMLFastContextHandlerWrapper::newProperty
    2280                 :            : (const Id & rId, OOXMLValue::Pointer_t pVal)
    2281                 :            : {
    2282         [ #  # ]:          0 :     if (mxContext.is())
    2283                 :            :     {
    2284                 :          0 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2285         [ #  # ]:          0 :         if (pHandler != NULL)
    2286         [ #  # ]:          0 :             pHandler->newProperty(rId, pVal);
    2287                 :            :     }
    2288                 :          0 : }
    2289                 :            : 
    2290                 :        735 : void OOXMLFastContextHandlerWrapper::setPropertySet
    2291                 :            : (OOXMLPropertySet::Pointer_t pPropertySet)
    2292                 :            : {
    2293         [ +  + ]:        735 :     if (mxContext.is())
    2294                 :            :     {
    2295                 :        381 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2296         [ -  + ]:        381 :         if (pHandler != NULL)
    2297         [ #  # ]:          0 :             pHandler->setPropertySet(pPropertySet);
    2298                 :            :     }
    2299                 :            : 
    2300                 :        735 :     mpPropertySet = pPropertySet;
    2301                 :        735 : }
    2302                 :            : 
    2303                 :        645 : OOXMLPropertySet::Pointer_t OOXMLFastContextHandlerWrapper::getPropertySet()
    2304                 :            :     const
    2305                 :            : {
    2306                 :        645 :     OOXMLPropertySet::Pointer_t pResult(mpPropertySet);
    2307                 :            : 
    2308         [ +  - ]:        645 :     if (mxContext.is())
    2309                 :            :     {
    2310         [ +  - ]:        645 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2311         [ -  + ]:        645 :         if (pHandler != NULL)
    2312 [ #  # ][ #  # ]:          0 :             pResult = pHandler->getPropertySet();
                 [ #  # ]
    2313                 :            :     }
    2314                 :            : 
    2315                 :        645 :     return pResult;
    2316                 :            : }
    2317                 :            : 
    2318                 :          0 : string OOXMLFastContextHandlerWrapper::getType() const
    2319                 :            : {
    2320         [ #  # ]:          0 :     string sResult = "Wrapper(";
    2321                 :            : 
    2322         [ #  # ]:          0 :     if (mxContext.is())
    2323                 :            :     {
    2324         [ #  # ]:          0 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2325         [ #  # ]:          0 :         if (pHandler != NULL)
    2326 [ #  # ][ #  # ]:          0 :             sResult += pHandler->getType();
    2327                 :            :     }
    2328                 :            : 
    2329         [ #  # ]:          0 :     sResult += ")";
    2330                 :            : 
    2331                 :          0 :     return sResult;
    2332                 :            : }
    2333                 :            : 
    2334                 :        417 : void OOXMLFastContextHandlerWrapper::setId(Id rId)
    2335                 :            : {
    2336                 :        417 :     OOXMLFastContextHandler::setId(rId);
    2337                 :            : 
    2338         [ +  + ]:        417 :     if (mxContext.is())
    2339                 :            :     {
    2340                 :        240 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2341         [ -  + ]:        240 :         if (pHandler != NULL)
    2342                 :          0 :             pHandler->setId(rId);
    2343                 :            :     }
    2344                 :        417 : }
    2345                 :            : 
    2346                 :        318 : Id OOXMLFastContextHandlerWrapper::getId() const
    2347                 :            : {
    2348                 :        318 :     Id nResult = OOXMLFastContextHandler::getId();
    2349                 :            : 
    2350         [ +  - ]:        318 :     if (mxContext.is())
    2351                 :            :     {
    2352                 :        318 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2353 [ #  # ][ -  + ]:        318 :         if (pHandler != NULL && pHandler->getId() != 0)
                 [ -  + ]
    2354                 :          0 :             nResult = pHandler->getId();
    2355                 :            :     }
    2356                 :            : 
    2357                 :        318 :     return nResult;
    2358                 :            : }
    2359                 :            : 
    2360                 :        417 : void OOXMLFastContextHandlerWrapper::setToken(Token_t nToken)
    2361                 :            : {
    2362                 :        417 :     OOXMLFastContextHandler::setToken(nToken);
    2363                 :            : 
    2364         [ +  + ]:        417 :     if (mxContext.is())
    2365                 :            :     {
    2366                 :        240 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2367         [ -  + ]:        240 :         if (pHandler != NULL)
    2368                 :          0 :             pHandler->setToken(nToken);
    2369                 :            :     }
    2370                 :        417 : }
    2371                 :            : 
    2372                 :        318 : Token_t OOXMLFastContextHandlerWrapper::getToken() const
    2373                 :            : {
    2374                 :        318 :     Token_t nResult = OOXMLFastContextHandler::getToken();
    2375                 :            : 
    2376         [ +  - ]:        318 :     if (mxContext.is())
    2377                 :            :     {
    2378                 :        318 :         OOXMLFastContextHandler * pHandler = getFastContextHandler();
    2379         [ -  + ]:        318 :         if (pHandler != NULL)
    2380                 :          0 :             nResult = pHandler->getToken();
    2381                 :            :     }
    2382                 :            : 
    2383                 :        318 :     return nResult;
    2384                 :            : }
    2385                 :            : 
    2386                 :            : 
    2387                 :            : /*
    2388                 :            :   class OOXMLFastContextHandlerLinear
    2389                 :            :  */
    2390                 :            : 
    2391                 :        255 : OOXMLFastContextHandlerLinear::OOXMLFastContextHandlerLinear(OOXMLFastContextHandler* pContext)
    2392                 :            :     : OOXMLFastContextHandlerProperties(pContext)
    2393         [ +  - ]:        255 :     , depthCount( 0 )
    2394                 :            : {
    2395                 :        255 : }
    2396                 :            : 
    2397                 :       7059 : void OOXMLFastContextHandlerLinear::lcl_startFastElement(Token_t Element,
    2398                 :            :     const uno::Reference< xml::sax::XFastAttributeList >& Attribs)
    2399                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2400                 :            : {
    2401                 :       7059 :     buffer.appendOpeningTag( Element, Attribs );
    2402                 :       7059 :     ++depthCount;
    2403                 :       7059 : }
    2404                 :            : 
    2405                 :       7050 : void OOXMLFastContextHandlerLinear::lcl_endFastElement(Token_t Element)
    2406                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2407                 :            : {
    2408                 :       7050 :     buffer.appendClosingTag( Element );
    2409         [ +  + ]:       7050 :     if( --depthCount == 0 )
    2410                 :        252 :         process();
    2411                 :       7050 : }
    2412                 :            : 
    2413                 :            : uno::Reference< xml::sax::XFastContextHandler >
    2414                 :       6804 : OOXMLFastContextHandlerLinear::lcl_createFastChildContext(Token_t,
    2415                 :            :     const uno::Reference< xml::sax::XFastAttributeList >&)
    2416                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2417                 :            : {
    2418                 :       6804 :     uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
    2419         [ +  - ]:       6804 :     xContextHandler.set( this );
    2420                 :       6804 :     return xContextHandler;
    2421                 :            : }
    2422                 :            : 
    2423                 :       1500 : void OOXMLFastContextHandlerLinear::lcl_characters(const OUString& aChars)
    2424                 :            :     throw (uno::RuntimeException, xml::sax::SAXException)
    2425                 :            : {
    2426                 :       1500 :     buffer.appendCharacters( aChars );
    2427                 :       1500 : }
    2428                 :            : 
    2429                 :            : /*
    2430                 :            :   class OOXMLFastContextHandlerLinear
    2431                 :            :  */
    2432                 :            : 
    2433                 :        255 : OOXMLFastContextHandlerMath::OOXMLFastContextHandlerMath(OOXMLFastContextHandler* pContext)
    2434                 :        255 :     : OOXMLFastContextHandlerLinear(pContext)
    2435                 :            : {
    2436                 :        255 : }
    2437                 :            : 
    2438                 :        252 : void OOXMLFastContextHandlerMath::process()
    2439                 :            : {
    2440         [ +  - ]:        252 :     SvGlobalName name( SO3_SM_CLASSID );
    2441         [ +  - ]:        252 :     comphelper::EmbeddedObjectContainer container;
    2442                 :        252 :     OUString aName;
    2443 [ +  - ][ +  - ]:        252 :     uno::Reference< embed::XEmbeddedObject > ref = container.CreateEmbeddedObject( name.GetByteSequence(), aName );
                 [ +  - ]
    2444 [ +  - ][ +  - ]:        252 :     uno::Reference< uno::XInterface > component( ref->getComponent(), uno::UNO_QUERY );
                 [ +  - ]
    2445                 :            : // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
    2446                 :            : // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
    2447                 :            : // to RTLD_GLOBAL, so most probably a gcc bug.
    2448 [ +  - ][ -  + ]:        252 :     oox::FormulaImportBase* import = dynamic_cast< oox::FormulaImportBase* >( dynamic_cast< SfxBaseModel* >(component.get()));
                 [ +  - ]
    2449                 :            :     assert( import != NULL );
    2450         [ +  - ]:        252 :     import->readFormulaOoxml( buffer );
    2451 [ +  - ][ +  - ]:        252 :     if (isForwardEvents())
    2452                 :            :     {
    2453 [ +  - ][ +  - ]:        252 :         OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
    2454 [ +  - ][ +  - ]:        252 :         OOXMLValue::Pointer_t pVal( new OOXMLStarMathValue( ref ));
                 [ +  - ]
    2455 [ +  - ][ +  - ]:        252 :         OOXMLProperty::Pointer_t pProp( new OOXMLPropertyImpl( NS_ooxml::LN_starmath, pVal, OOXMLPropertyImpl::ATTRIBUTE ));
         [ +  - ][ +  - ]
                 [ +  - ]
    2456 [ +  - ][ +  - ]:        252 :         pProps->add( pProp );
                 [ +  - ]
    2457 [ +  - ][ +  - ]:        252 :         mpStream->props( writerfilter::Reference< Properties >::Pointer_t( pProps ));
         [ +  - ][ +  - ]
                 [ +  - ]
    2458 [ +  - ][ +  - ]:        252 :     }
    2459                 :        252 : }
    2460                 :            : 
    2461 [ +  - ][ +  - ]:         60 : }}
    2462                 :            : 
    2463                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10