LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLPropertySetImpl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 184 337 54.6 %
Date: 2012-08-25 Functions: 72 129 55.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 84 301 27.9 %

           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 "OOXMLPropertySetImpl.hxx"
      21                 :            : #include <stdio.h>
      22                 :            : #include <iostream>
      23                 :            : #include <resourcemodel/QNameToString.hxx>
      24                 :            : #include <resourcemodel/Protocol.hxx>
      25                 :            : #include <com/sun/star/drawing/XShape.hpp>
      26                 :            : #include <ooxml/OOXMLFastTokens.hxx>
      27                 :            : #include "ooxmlLoggers.hxx"
      28                 :            : 
      29                 :            : namespace writerfilter {
      30                 :            : namespace ooxml
      31                 :            : {
      32                 :            : using namespace ::std;
      33                 :            : 
      34                 :      70753 : OOXMLProperty::~OOXMLProperty()
      35                 :            : {
      36         [ -  + ]:      70753 : }
      37                 :            : 
      38                 :      46341 : OOXMLPropertySet::~OOXMLPropertySet()
      39                 :            : {
      40         [ -  + ]:      46341 : }
      41                 :            : 
      42                 :       1264 : OOXMLTable::~OOXMLTable()
      43                 :            : {
      44         [ -  + ]:       1264 : }
      45                 :            : 
      46                 :      70753 : OOXMLPropertyImpl::OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue,
      47                 :            :                                      OOXMLPropertyImpl::Type_t eType)
      48         [ +  - ]:      70753 : : mId(id), mpValue(pValue), meType(eType)
      49                 :            : {
      50                 :      70753 : }
      51                 :            : 
      52                 :          0 : OOXMLPropertyImpl::OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm)
      53         [ #  # ]:          0 : : OOXMLProperty(), mId(rSprm.mId), mpValue(rSprm.mpValue), meType(rSprm.meType)
      54                 :            : {
      55                 :          0 : }
      56                 :            : 
      57         [ +  - ]:      70753 : OOXMLPropertyImpl::~OOXMLPropertyImpl()
      58                 :            : {
      59         [ -  + ]:     141506 : }
      60                 :            : 
      61                 :     134424 : sal_uInt32 OOXMLPropertyImpl::getId() const
      62                 :            : {
      63                 :     134424 :     return mId;
      64                 :            : }
      65                 :            : 
      66                 :      74714 : Value::Pointer_t OOXMLPropertyImpl::getValue()
      67                 :            : {
      68                 :      74714 :     Value::Pointer_t pResult;
      69                 :            : 
      70         [ +  - ]:      74714 :     if (mpValue.get() != NULL)
      71 [ +  - ][ +  - ]:      74714 :         pResult = Value::Pointer_t(mpValue->clone());
      72                 :            :     else
      73 [ #  # ][ #  # ]:          0 :         pResult = Value::Pointer_t(new OOXMLValue());
      74                 :            : 
      75                 :      74714 :     return pResult;
      76                 :            : }
      77                 :            : 
      78                 :          0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLPropertyImpl::getBinary()
      79                 :            : {
      80                 :          0 :     writerfilter::Reference<BinaryObj>::Pointer_t pResult;
      81                 :            : 
      82         [ #  # ]:          0 :     if (mpValue.get() != NULL)
      83 [ #  # ][ #  # ]:          0 :         pResult = mpValue->getBinary();
                 [ #  # ]
      84                 :            : 
      85                 :          0 :     return pResult;
      86                 :            : }
      87                 :            : 
      88                 :          0 : writerfilter::Reference<Stream>::Pointer_t OOXMLPropertyImpl::getStream()
      89                 :            : {
      90                 :          0 :     writerfilter::Reference<Stream>::Pointer_t pResult;
      91                 :            : 
      92         [ #  # ]:          0 :     if (mpValue.get() != NULL)
      93 [ #  # ][ #  # ]:          0 :         pResult = mpValue->getStream();
                 [ #  # ]
      94                 :            : 
      95                 :          0 :     return pResult;
      96                 :            : }
      97                 :            : 
      98                 :      13400 : writerfilter::Reference<Properties>::Pointer_t OOXMLPropertyImpl::getProps()
      99                 :            : {
     100                 :      13400 :     writerfilter::Reference<Properties>::Pointer_t pResult;
     101                 :            : 
     102         [ +  + ]:      13400 :     if (mpValue.get() != NULL)
     103 [ +  - ][ +  - ]:      13376 :         pResult = mpValue->getProperties();
                 [ +  - ]
     104                 :            : 
     105                 :      13400 :     return pResult;
     106                 :            : }
     107                 :            : 
     108                 :          0 : string OOXMLPropertyImpl::getName() const
     109                 :            : {
     110 [ #  # ][ #  # ]:          0 :     string sResult = (*QNameToString::Instance())(mId);
     111                 :            : 
     112         [ #  # ]:          0 :     if (sResult.length() == 0)
     113 [ #  # ][ #  # ]:          0 :         sResult = (*SprmIdToString::Instance())(mId);
         [ #  # ][ #  # ]
     114                 :            : 
     115         [ #  # ]:          0 :     if (sResult.length() == 0)
     116 [ #  # ][ #  # ]:          0 :         sResult = fastTokenToId(mId);
     117                 :            : 
     118         [ #  # ]:          0 :     if (sResult.length() == 0)
     119                 :            :     {
     120                 :            :         static char sBuffer[256];
     121                 :            : 
     122                 :          0 :         snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIxUINT32, mId);
     123         [ #  # ]:          0 :         sResult = sBuffer;
     124                 :            :     }
     125                 :            : 
     126                 :          0 :     return sResult;
     127                 :            : }
     128                 :            : 
     129                 :          0 : string OOXMLPropertyImpl::toString() const
     130                 :            : {
     131         [ #  # ]:          0 :     string sResult = "(";
     132                 :            : 
     133 [ #  # ][ #  # ]:          0 :     sResult += getName();
     134         [ #  # ]:          0 :     sResult += ", ";
     135         [ #  # ]:          0 :     if (mpValue.get() != NULL)
     136 [ #  # ][ #  # ]:          0 :         sResult += mpValue->toString();
     137                 :            :     else
     138         [ #  # ]:          0 :         sResult +="(null)";
     139         [ #  # ]:          0 :     sResult +=")";
     140                 :            : 
     141                 :          0 :     return sResult;
     142                 :            : }
     143                 :            : 
     144                 :          0 : Sprm::Kind OOXMLPropertyImpl::getKind()
     145                 :            : {
     146                 :          0 :     return SprmKind(getId());
     147                 :            : }
     148                 :            : 
     149                 :          0 : Sprm * OOXMLPropertyImpl::clone()
     150                 :            : {
     151         [ #  # ]:          0 :     return new OOXMLPropertyImpl(*this);
     152                 :            : }
     153                 :            : 
     154                 :      56193 : void OOXMLPropertyImpl::resolve(writerfilter::Properties & rProperties)
     155                 :            : {
     156                 :      56193 :     writerfilter::Properties * pProperties = NULL;
     157                 :            : #ifdef DEBUG_PROTOCOL
     158                 :            :     writerfilter::PropertiesProtocol::Pointer_t pProtocol
     159                 :            :         (new writerfilter::PropertiesProtocol(&rProperties, debug_logger));
     160                 :            :     pProperties = pProtocol.get();
     161                 :            : #else
     162                 :      56193 :     pProperties = &rProperties;
     163                 :            : #endif
     164                 :            : 
     165      [ +  +  - ]:      56193 :     switch (meType)
     166                 :            :     {
     167                 :            :     case SPRM:
     168         [ +  - ]:      34051 :         if (mId != 0x0)
     169                 :      34051 :             pProperties->sprm(*this);
     170                 :      34051 :         break;
     171                 :            :     case ATTRIBUTE:
     172         [ +  - ]:      22142 :         pProperties->attribute(mId, *getValue());
     173                 :      22142 :         break;
     174                 :            :     }
     175                 :      56193 : }
     176                 :            : 
     177                 :            : /*
     178                 :            :    class OOXMLValue
     179                 :            : */
     180                 :            : 
     181                 :     121953 : OOXMLValue::OOXMLValue()
     182                 :            : {
     183                 :     121953 : }
     184                 :            : 
     185                 :     198698 : OOXMLValue::~OOXMLValue()
     186                 :            : {
     187         [ -  + ]:     198698 : }
     188                 :            : 
     189                 :          0 : bool OOXMLValue::getBool() const
     190                 :            : {
     191                 :          0 :     return false;
     192                 :            : }
     193                 :            : 
     194                 :      42120 : int OOXMLValue::getInt() const
     195                 :            : {
     196                 :      42120 :     return 0;
     197                 :            : }
     198                 :            : 
     199                 :      31072 : OUString OOXMLValue::getString() const
     200                 :            : {
     201                 :      31072 :     return OUString();
     202                 :            : }
     203                 :            : 
     204                 :          0 : uno::Any OOXMLValue::getAny() const
     205                 :            : {
     206                 :          0 :     return uno::Any();
     207                 :            : }
     208                 :            : 
     209                 :        861 : writerfilter::Reference<Properties>::Pointer_t OOXMLValue::getProperties()
     210                 :            : {
     211                 :        861 :     return writerfilter::Reference<Properties>::Pointer_t();
     212                 :            : }
     213                 :            : 
     214                 :          0 : writerfilter::Reference<Stream>::Pointer_t OOXMLValue::getStream()
     215                 :            : {
     216                 :          0 :     return writerfilter::Reference<Stream>::Pointer_t();
     217                 :            : }
     218                 :            : 
     219                 :          0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLValue::getBinary()
     220                 :            : {
     221                 :          0 :     return writerfilter::Reference<BinaryObj>::Pointer_t();
     222                 :            : }
     223                 :            : 
     224                 :          0 : string OOXMLValue::toString() const
     225                 :            : {
     226         [ #  # ]:          0 :     return "OOXMLValue";
     227                 :            : }
     228                 :            : 
     229                 :          0 : OOXMLValue * OOXMLValue::clone() const
     230                 :            : {
     231                 :          0 :     return new OOXMLValue(*this);
     232                 :            : }
     233                 :            : 
     234                 :            : /*
     235                 :            :   class OOXMLBinaryValue
     236                 :            :  */
     237                 :            : 
     238                 :          0 : OOXMLBinaryValue::OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t
     239                 :            :                                    pBinaryObj)
     240         [ #  # ]:          0 : : mpBinaryObj(pBinaryObj)
     241                 :            : {
     242                 :          0 : }
     243                 :            : 
     244         [ #  # ]:          0 : OOXMLBinaryValue::~OOXMLBinaryValue()
     245                 :            : {
     246         [ #  # ]:          0 : }
     247                 :            : 
     248                 :          0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLBinaryValue::getBinary()
     249                 :            : {
     250                 :          0 :     return mpBinaryObj;
     251                 :            : }
     252                 :            : 
     253                 :          0 : string OOXMLBinaryValue::toString() const
     254                 :            : {
     255         [ #  # ]:          0 :     return "BinaryObj";
     256                 :            : }
     257                 :            : 
     258                 :          0 : OOXMLValue * OOXMLBinaryValue::clone() const
     259                 :            : {
     260 [ #  # ][ #  # ]:          0 :     return new OOXMLBinaryValue(mpBinaryObj);
     261                 :            : }
     262                 :            : 
     263                 :            : /*
     264                 :            :   class OOXMLBooleanValue
     265                 :            : */
     266                 :            : 
     267                 :       2522 : OOXMLBooleanValue::OOXMLBooleanValue(bool bValue)
     268                 :       2522 : : mbValue(bValue)
     269                 :            : {
     270                 :       2522 : }
     271                 :            : 
     272                 :       2320 : OOXMLBooleanValue::OOXMLBooleanValue(const OUString & rValue)
     273                 :       2320 : : mbValue(false)
     274                 :            : {
     275                 :       2320 :     mbValue = (rValue == "true"
     276                 :       2050 :         || rValue == "True"
     277                 :       2050 :         || rValue == "1"
     278                 :       1062 :         || rValue == "on"
     279 [ -  + ][ +  +  :       7482 :         || rValue == "On");
          +  -  +  +  +  
                      - ]
     280                 :       2320 : }
     281                 :            : 
     282                 :      11955 : OOXMLBooleanValue::~OOXMLBooleanValue()
     283                 :            : {
     284         [ -  + ]:      23910 : }
     285                 :            : 
     286                 :          0 : bool OOXMLBooleanValue::getBool() const
     287                 :            : {
     288                 :          0 :     return mbValue;
     289                 :            : }
     290                 :            : 
     291                 :       7041 : int OOXMLBooleanValue::getInt() const
     292                 :            : {
     293         [ +  + ]:       7041 :     return mbValue ? 1 : 0;
     294                 :            : }
     295                 :            : 
     296                 :          0 : uno::Any OOXMLBooleanValue::getAny() const
     297                 :            : {
     298                 :          0 :     uno::Any aResult(mbValue);
     299                 :            : 
     300                 :          0 :     return aResult;
     301                 :            : }
     302                 :            : 
     303                 :          0 : string OOXMLBooleanValue::toString() const
     304                 :            : {
     305 [ #  # ][ #  # ]:          0 :     return mbValue ? "true" : "false";
     306                 :            : }
     307                 :            : 
     308                 :       7113 : OOXMLValue * OOXMLBooleanValue::clone() const
     309                 :            : {
     310                 :       7113 :     return new OOXMLBooleanValue(*this);
     311                 :            : }
     312                 :            : 
     313                 :            : /*
     314                 :            :   class OOXMLStringValue
     315                 :            : */
     316                 :            : 
     317                 :      39362 : OOXMLStringValue::OOXMLStringValue(const OUString & rStr)
     318                 :      39362 : : mStr(rStr)
     319                 :            : {
     320                 :      39362 : }
     321                 :            : 
     322                 :      52578 : OOXMLStringValue::~OOXMLStringValue()
     323                 :            : {
     324         [ -  + ]:     105156 : }
     325                 :            : 
     326                 :          0 : uno::Any OOXMLStringValue::getAny() const
     327                 :            : {
     328                 :          0 :     uno::Any aAny(mStr);
     329                 :            : 
     330                 :          0 :     return aAny;
     331                 :            : }
     332                 :            : 
     333                 :      11332 : OUString OOXMLStringValue::getString() const
     334                 :            : {
     335                 :      11332 :     return mStr;
     336                 :            : }
     337                 :            : 
     338                 :          0 : string OOXMLStringValue::toString() const
     339                 :            : {
     340 [ #  # ][ #  # ]:          0 :     return OUStringToOString(mStr, RTL_TEXTENCODING_ASCII_US).getStr();
     341                 :            : }
     342                 :            : 
     343                 :      13216 : OOXMLValue * OOXMLStringValue::clone() const
     344                 :            : {
     345                 :      13216 :     return new OOXMLStringValue(*this);
     346                 :            : }
     347                 :            : 
     348                 :            : /*
     349                 :            :   class OOXMLInputStreamValue
     350                 :            :  */
     351                 :          0 : OOXMLInputStreamValue::OOXMLInputStreamValue(uno::Reference<io::XInputStream> xInputStream)
     352                 :          0 : : mxInputStream(xInputStream)
     353                 :            : {
     354                 :          0 : }
     355                 :            : 
     356                 :          0 : OOXMLInputStreamValue::~OOXMLInputStreamValue()
     357                 :            : {
     358         [ #  # ]:          0 : }
     359                 :            : 
     360                 :          0 : uno::Any OOXMLInputStreamValue::getAny() const
     361                 :            : {
     362                 :          0 :     uno::Any aAny(mxInputStream);
     363                 :            : 
     364                 :          0 :     return aAny;
     365                 :            : }
     366                 :            : 
     367                 :          0 : string OOXMLInputStreamValue::toString() const
     368                 :            : {
     369         [ #  # ]:          0 :     return "InputStream";
     370                 :            : }
     371                 :            : 
     372                 :          0 : OOXMLValue * OOXMLInputStreamValue::clone() const
     373                 :            : {
     374 [ #  # ][ #  # ]:          0 :     return new OOXMLInputStreamValue(mxInputStream);
     375                 :            : }
     376                 :            : 
     377                 :            : /*
     378                 :            :   struct OOXMLPropertySetImplCompare
     379                 :            :  */
     380                 :            : 
     381                 :          0 : bool OOXMLPropertySetImplCompare::operator()(const OOXMLProperty::Pointer_t x,
     382                 :            :                                              const OOXMLProperty::Pointer_t y) const
     383                 :            : {
     384                 :          0 :     bool bResult = false;
     385                 :            : 
     386 [ #  # ][ #  # ]:          0 :     if (x.get() == NULL && y.get() != NULL)
                 [ #  # ]
     387                 :          0 :         bResult = true;
     388 [ #  # ][ #  # ]:          0 :     else if (x.get() != NULL && y.get() != NULL)
                 [ #  # ]
     389                 :          0 :         bResult = x->getId() < y->getId();
     390                 :            : 
     391                 :          0 :     return bResult;
     392                 :            : }
     393                 :            : 
     394                 :            : /**
     395                 :            :    class OOXMLPropertySetImpl
     396                 :            : */
     397                 :            : 
     398                 :      30861 : OOXMLPropertySetImpl::OOXMLPropertySetImpl()
     399 [ +  - ][ +  - ]:      30861 : : msType("OOXMLPropertySetImpl")
     400                 :            : {
     401                 :      30861 : }
     402                 :            : 
     403                 :      46341 : OOXMLPropertySetImpl::~OOXMLPropertySetImpl()
     404                 :            : {
     405         [ -  + ]:      92682 : }
     406                 :            : 
     407                 :      18338 : void OOXMLPropertySetImpl::resolve(Properties & rHandler)
     408                 :            : {
     409                 :      18338 :     size_t nIt = 0;
     410                 :            : 
     411                 :            :     // The pProp->resolve(rHandler) call below can cause elements to
     412                 :            :     // be appended to mProperties. I don't think it can cause elements
     413                 :            :     // to be deleted. But let's check with < here just to be safe that
     414                 :            :     // the indexing below works.
     415         [ +  + ]:      75133 :     while (nIt < mProperties.size())
     416                 :            :     {
     417         [ +  - ]:      56795 :         OOXMLProperty::Pointer_t pProp = mProperties[nIt];
     418                 :            : 
     419         [ +  + ]:      56795 :         if (pProp.get() != NULL)
     420         [ +  - ]:      56193 :             pProp->resolve(rHandler);
     421                 :            : #ifdef DEBUG_RESOLVE
     422                 :            :         else
     423                 :            :         {
     424                 :            :             debug_logger->startElement("error");
     425                 :            :             debug_logger->chars(std::string("zero-property"));
     426                 :            :             debug_logger->endElement();
     427                 :            :         }
     428                 :            : #endif
     429                 :            : 
     430                 :      56795 :         ++nIt;
     431         [ +  - ]:      56795 :     }
     432                 :      18338 : }
     433                 :            : 
     434                 :          0 : OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::begin()
     435                 :            : {
     436                 :          0 :     return mProperties.begin();
     437                 :            : }
     438                 :            : 
     439                 :          0 : OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::end()
     440                 :            : {
     441                 :          0 :     return mProperties.end();
     442                 :            : }
     443                 :            : 
     444                 :            : OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
     445                 :          0 : OOXMLPropertySetImpl::begin() const
     446                 :            : {
     447                 :          0 :     return mProperties.begin();
     448                 :            : }
     449                 :            : 
     450                 :            : OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
     451                 :          0 : OOXMLPropertySetImpl::end() const
     452                 :            : {
     453                 :          0 :     return mProperties.end();
     454                 :            : }
     455                 :            : 
     456                 :       2848 : string OOXMLPropertySetImpl::getType() const
     457                 :            : {
     458                 :       2848 :     return msType;
     459                 :            : }
     460                 :            : 
     461                 :      71355 : void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty)
     462                 :            : {
     463                 :            : #ifdef DEBUG_PROPERTY_SET
     464                 :            :     debug_logger->startElement("propertyset.add");
     465                 :            :     debug_logger->chars(pProperty->toString());
     466                 :            : #endif
     467                 :            : 
     468 [ +  - ][ +  + ]:      71355 :     if (pProperty.get() != NULL && pProperty->getId() != 0x0)
                 [ +  + ]
     469                 :            :     {
     470                 :      71014 :         mProperties.push_back(pProperty);
     471                 :            :     }
     472                 :            : #ifdef DEBUG_PROPERTY_SET
     473                 :            :     else
     474                 :            :     {
     475                 :            :         debug_logger->element("warning.property_not_added");
     476                 :            :     }
     477                 :            : 
     478                 :            :     debug_logger->endElement("propertyset.add");
     479                 :            : #endif
     480                 :      71355 : }
     481                 :            : 
     482                 :        256 : void OOXMLPropertySetImpl::add(OOXMLPropertySet::Pointer_t pPropertySet)
     483                 :            : {
     484         [ +  - ]:        256 :     if (pPropertySet.get() != NULL)
     485                 :            :     {
     486                 :            :         OOXMLPropertySetImpl * pSet =
     487         [ -  + ]:        256 :             dynamic_cast<OOXMLPropertySetImpl *>(pPropertySet.get());
     488                 :            : 
     489         [ +  - ]:        256 :         if (pSet != NULL)
     490                 :            :         {
     491                 :        256 :             mProperties.resize(mProperties.size() + pSet->mProperties.size());
     492 [ +  - ][ +  + ]:       1716 :             for (OOXMLProperties_t::iterator aIt = pSet->mProperties.begin();
     493                 :        858 :                  aIt != pSet->mProperties.end(); ++aIt)
     494 [ +  - ][ +  - ]:        602 :                 add(*aIt);
                 [ +  - ]
     495                 :            :         }
     496                 :            :     }
     497                 :        256 : }
     498                 :            : 
     499                 :      15480 : OOXMLPropertySet * OOXMLPropertySetImpl::clone() const
     500                 :            : {
     501         [ +  - ]:      15480 :     return new OOXMLPropertySetImpl(*this);
     502                 :            : }
     503                 :            : 
     504                 :          0 : void OOXMLPropertySetImpl::setType(const string & rsType)
     505                 :            : {
     506                 :          0 :     msType = rsType;
     507                 :          0 : }
     508                 :            : 
     509                 :          0 : string OOXMLPropertySetImpl::toString()
     510                 :            : {
     511         [ #  # ]:          0 :     string sResult = "[";
     512                 :            :     char sBuffer[256];
     513                 :          0 :     snprintf(sBuffer, sizeof(sBuffer), "%p", this);
     514         [ #  # ]:          0 :     sResult += sBuffer;
     515         [ #  # ]:          0 :     sResult += ":";
     516                 :            : 
     517                 :          0 :     OOXMLProperties_t::iterator aItBegin = begin();
     518                 :          0 :     OOXMLProperties_t::iterator aItEnd = end();
     519                 :            : 
     520 [ #  # ][ #  # ]:          0 :     for (OOXMLProperties_t::iterator aIt = aItBegin; aIt != aItEnd; ++aIt)
     521                 :            :     {
     522 [ #  # ][ #  # ]:          0 :         if (aIt != aItBegin)
     523         [ #  # ]:          0 :             sResult += ", ";
     524                 :            : 
     525         [ #  # ]:          0 :         if ((*aIt).get() != NULL)
     526 [ #  # ][ #  # ]:          0 :             sResult += (*aIt)->toString();
     527                 :            :         else
     528         [ #  # ]:          0 :             sResult += "0x0";
     529                 :            :     }
     530                 :            : 
     531         [ #  # ]:          0 :     sResult += "]";
     532                 :            : 
     533                 :          0 :     return sResult;
     534                 :            : }
     535                 :            : 
     536                 :            : /*
     537                 :            :   class OOXMLPropertySetValue
     538                 :            : */
     539                 :            : 
     540                 :      24522 : OOXMLPropertySetValue::OOXMLPropertySetValue
     541                 :            : (OOXMLPropertySet::Pointer_t pPropertySet)
     542         [ +  - ]:      24522 : : mpPropertySet(pPropertySet)
     543                 :            : {
     544                 :      24522 : }
     545                 :            : 
     546         [ +  - ]:      56561 : OOXMLPropertySetValue::~OOXMLPropertySetValue()
     547                 :            : {
     548         [ -  + ]:     113122 : }
     549                 :            : 
     550                 :      15313 : writerfilter::Reference<Properties>::Pointer_t OOXMLPropertySetValue::getProperties()
     551                 :            : {
     552                 :            :     return writerfilter::Reference<Properties>::Pointer_t
     553                 :      15313 :         (mpPropertySet->clone());
     554                 :            : }
     555                 :            : 
     556                 :          0 : string OOXMLPropertySetValue::toString() const
     557                 :            : {
     558                 :            :     char sBuffer[256];
     559                 :            : 
     560                 :          0 :     snprintf(sBuffer, sizeof(sBuffer), "t:%p, m:%p", this, mpPropertySet.get());
     561                 :            : 
     562 [ #  # ][ #  # ]:          0 :     return "OOXMLPropertySetValue(" + string(sBuffer) + ")";
                 [ #  # ]
     563                 :            : }
     564                 :            : 
     565                 :      32039 : OOXMLValue * OOXMLPropertySetValue::clone() const
     566                 :            : {
     567         [ +  - ]:      32039 :     return new OOXMLPropertySetValue(*this);
     568                 :            : }
     569                 :            : 
     570                 :            : /*
     571                 :            :   class OOXMLIntegerValue
     572                 :            : */
     573                 :            : 
     574                 :      19122 : OOXMLIntegerValue::OOXMLIntegerValue(sal_Int32 nValue)
     575                 :      19122 : : mnValue(nValue)
     576                 :            : {
     577                 :      19122 : }
     578                 :            : 
     579                 :      20114 : OOXMLIntegerValue::OOXMLIntegerValue(const OUString & rValue)
     580                 :      20114 : : mnValue(0)
     581                 :            : {
     582                 :      20114 :     mnValue = rValue.toInt32();
     583                 :      20114 : }
     584                 :            : 
     585                 :      61095 : OOXMLIntegerValue::~OOXMLIntegerValue()
     586                 :            : {
     587         [ -  + ]:     122190 : }
     588                 :            : 
     589                 :      21763 : int OOXMLIntegerValue::getInt() const
     590                 :            : {
     591                 :      21763 :     return mnValue;
     592                 :            : }
     593                 :            : 
     594                 :          0 : uno::Any OOXMLIntegerValue::getAny() const
     595                 :            : {
     596                 :          0 :     uno::Any aResult(mnValue);
     597                 :            : 
     598                 :          0 :     return aResult;
     599                 :            : }
     600                 :            : 
     601                 :      21859 : OOXMLValue * OOXMLIntegerValue::clone() const
     602                 :            : {
     603                 :      21859 :     return new OOXMLIntegerValue(*this);
     604                 :            : }
     605                 :            : 
     606                 :          0 : string OOXMLIntegerValue::toString() const
     607                 :            : {
     608                 :            :     char buffer[256];
     609                 :          0 :     snprintf(buffer, sizeof(buffer), "%" SAL_PRIdINT32, mnValue);
     610                 :            : 
     611         [ #  # ]:          0 :     return buffer;
     612                 :            : }
     613                 :            : 
     614                 :            : /*
     615                 :            :   class OOXMLHexValue
     616                 :            : */
     617                 :            : 
     618                 :          0 : OOXMLHexValue::OOXMLHexValue(sal_uInt32 nValue)
     619                 :          0 : : mnValue(nValue)
     620                 :            : {
     621                 :          0 : }
     622                 :            : 
     623                 :      13376 : OOXMLHexValue::OOXMLHexValue(const OUString & rValue)
     624                 :            : {
     625                 :      13376 :     mnValue = static_cast<sal_uInt32>(rValue.toInt32(16));
     626                 :      13376 : }
     627                 :            : 
     628                 :      15894 : OOXMLHexValue::~OOXMLHexValue()
     629                 :            : {
     630         [ -  + ]:      31788 : }
     631                 :            : 
     632                 :       2518 : int OOXMLHexValue::getInt() const
     633                 :            : {
     634                 :       2518 :     return mnValue;
     635                 :            : }
     636                 :            : 
     637                 :       2518 : OOXMLValue * OOXMLHexValue::clone() const
     638                 :            : {
     639                 :       2518 :     return new OOXMLHexValue(*this);
     640                 :            : }
     641                 :            : 
     642                 :          0 : string OOXMLHexValue::toString() const
     643                 :            : {
     644                 :            :     char buffer[256];
     645                 :          0 :     snprintf(buffer, sizeof(buffer), "0x%" SAL_PRIxUINT32, mnValue);
     646                 :            : 
     647         [ #  # ]:          0 :     return buffer;
     648                 :            : }
     649                 :            : 
     650                 :            : /*
     651                 :            :   class OOXMLShapeValue
     652                 :            :  */
     653                 :            : 
     654                 :            : 
     655                 :        111 : OOXMLShapeValue::OOXMLShapeValue(uno::Reference<XShape> rShape)
     656                 :        111 : : mrShape(rShape)
     657                 :            : {
     658                 :        111 : }
     659                 :            : 
     660                 :        111 : OOXMLShapeValue::~OOXMLShapeValue()
     661                 :            : {
     662         [ -  + ]:        222 : }
     663                 :            : 
     664                 :         48 : uno::Any OOXMLShapeValue::getAny() const
     665                 :            : {
     666                 :         48 :     return uno::Any(mrShape);
     667                 :            : }
     668                 :            : 
     669                 :          0 : string OOXMLShapeValue::toString() const
     670                 :            : {
     671         [ #  # ]:          0 :     return "Shape";
     672                 :            : }
     673                 :            : 
     674                 :         63 : OOXMLValue * OOXMLShapeValue::clone() const
     675                 :            : {
     676 [ +  - ][ +  - ]:         63 :     return new OOXMLShapeValue(mrShape);
     677                 :            : }
     678                 :            : 
     679                 :            : /*
     680                 :            :   class OOXMLStarMathValue
     681                 :            :  */
     682                 :            : 
     683                 :            : 
     684                 :        504 : OOXMLStarMathValue::OOXMLStarMathValue( uno::Reference< embed::XEmbeddedObject > c )
     685                 :        504 : : component(c)
     686                 :            : {
     687                 :        504 : }
     688                 :            : 
     689                 :        504 : OOXMLStarMathValue::~OOXMLStarMathValue()
     690                 :            : {
     691         [ -  + ]:       1008 : }
     692                 :            : 
     693                 :        504 : uno::Any OOXMLStarMathValue::getAny() const
     694                 :            : {
     695                 :        504 :     return uno::Any(component);
     696                 :            : }
     697                 :            : 
     698                 :          0 : string OOXMLStarMathValue::toString() const
     699                 :            : {
     700         [ #  # ]:          0 :     return "StarMath";
     701                 :            : }
     702                 :            : 
     703                 :        252 : OOXMLValue * OOXMLStarMathValue::clone() const
     704                 :            : {
     705 [ +  - ][ +  - ]:        252 :     return new OOXMLStarMathValue( component );
     706                 :            : }
     707                 :            : 
     708                 :            : /*
     709                 :            :   class OOXMLTableImpl
     710                 :            :  */
     711                 :            : 
     712         [ +  - ]:        632 : OOXMLTableImpl::OOXMLTableImpl()
     713                 :            : {
     714                 :        632 : }
     715                 :            : 
     716                 :       1264 : OOXMLTableImpl::~OOXMLTableImpl()
     717                 :            : {
     718         [ -  + ]:       1896 : }
     719                 :            : 
     720                 :        632 : void OOXMLTableImpl::resolve(Table & rTable)
     721                 :            : {
     722                 :            : #ifdef DEBUG_PROTOCOL
     723                 :            :     Table::Pointer_t pTable(new TableProtocol(&rTable, debug_logger));
     724                 :            : #else
     725                 :        632 :     Table * pTable = &rTable;
     726                 :            : #endif
     727                 :            : 
     728                 :        632 :     int nPos = 0;
     729                 :            : 
     730                 :        632 :     PropertySets_t::iterator it = mPropertySets.begin();
     731                 :        632 :     PropertySets_t::iterator itEnd = mPropertySets.end();
     732                 :            : 
     733 [ +  - ][ +  + ]:       3145 :     while (it != itEnd)
     734                 :            :     {
     735                 :            :         writerfilter::Reference<Properties>::Pointer_t pProperties
     736         [ +  - ]:       2513 :             ((*it)->getProperties());
     737                 :            : 
     738         [ +  - ]:       2513 :         if (pProperties.get() != NULL)
     739 [ +  - ][ +  - ]:       2513 :             pTable->entry(nPos, pProperties);
                 [ +  - ]
     740                 :            : 
     741                 :       2513 :         ++nPos;
     742                 :       2513 :         ++it;
     743         [ +  - ]:       2513 :     }
     744                 :        632 : }
     745                 :            : 
     746                 :       2513 : void OOXMLTableImpl::add(ValuePointer_t pPropertySet)
     747                 :            : {
     748         [ +  - ]:       2513 :     if (pPropertySet.get() != NULL)
     749                 :       2513 :         mPropertySets.push_back(pPropertySet);
     750                 :       2513 : }
     751                 :            : 
     752                 :          0 : string OOXMLTableImpl::getType() const
     753                 :            : {
     754         [ #  # ]:          0 :     return "OOXMLTableImpl";
     755                 :            : }
     756                 :            : 
     757                 :        632 : OOXMLTable * OOXMLTableImpl::clone() const
     758                 :            : {
     759         [ +  - ]:        632 :     return new OOXMLTableImpl(*this);
     760                 :            : }
     761                 :            : 
     762                 :            : /*
     763                 :            :   class: OOXMLPropertySetEntryToString
     764                 :            : */
     765                 :            : 
     766                 :          0 : OOXMLPropertySetEntryToString::OOXMLPropertySetEntryToString(Id nId)
     767                 :          0 : : mnId(nId)
     768                 :            : {
     769                 :          0 : }
     770                 :            : 
     771                 :          0 : OOXMLPropertySetEntryToString::~OOXMLPropertySetEntryToString()
     772                 :            : {
     773         [ #  # ]:          0 : }
     774                 :            : 
     775                 :          0 : void OOXMLPropertySetEntryToString::sprm(Sprm & /*rSprm*/)
     776                 :            : {
     777                 :          0 : }
     778                 :            : 
     779                 :          0 : void OOXMLPropertySetEntryToString::attribute(Id nId, Value & rValue)
     780                 :            : {
     781         [ #  # ]:          0 :     if (nId == mnId)
     782                 :          0 :         mStr = rValue.getString();
     783                 :          0 : }
     784                 :            : 
     785                 :          0 : const OUString & OOXMLPropertySetEntryToString::getString() const
     786                 :            : {
     787                 :          0 :     return mStr;
     788                 :            : }
     789                 :            : 
     790                 :        126 : OOXMLPropertySetEntryToInteger::OOXMLPropertySetEntryToInteger(Id nId)
     791                 :        126 : : mnId(nId), mnValue(0)
     792                 :            : {
     793                 :        126 : }
     794                 :            : 
     795                 :        126 : OOXMLPropertySetEntryToInteger::~OOXMLPropertySetEntryToInteger()
     796                 :            : {
     797         [ -  + ]:        126 : }
     798                 :            : 
     799                 :          0 : void OOXMLPropertySetEntryToInteger::sprm(Sprm & /*rSprm*/)
     800                 :            : {
     801                 :          0 : }
     802                 :            : 
     803                 :        126 : void OOXMLPropertySetEntryToInteger::attribute(Id nId, Value & rValue)
     804                 :            : {
     805         [ +  - ]:        126 :     if (nId == mnId)
     806                 :        126 :         mnValue = rValue.getInt();
     807                 :        126 : }
     808                 :            : 
     809                 :        126 : int OOXMLPropertySetEntryToInteger::getValue() const
     810                 :            : {
     811                 :        126 :     return mnValue;
     812                 :            : }
     813                 :            : 
     814 [ +  - ][ +  - ]:         60 : }}
     815                 :            : 
     816                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10