LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLPropertySetImpl.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 219 350 62.6 %
Date: 2014-04-11 Functions: 87 135 64.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "OOXMLPropertySetImpl.hxx"
      21             : #include <stdio.h>
      22             : #include <iostream>
      23             : #include <resourcemodel/QNameToString.hxx>
      24             : #include <com/sun/star/drawing/XShape.hpp>
      25             : #include <ooxml/OOXMLFastTokens.hxx>
      26             : #include "ooxmlLoggers.hxx"
      27             : #include <ooxml/resourceids.hxx>
      28             : 
      29             : namespace writerfilter {
      30             : namespace ooxml
      31             : {
      32             : using namespace ::std;
      33             : 
      34     2111505 : OOXMLProperty::~OOXMLProperty()
      35             : {
      36     2111505 : }
      37             : 
      38     1324505 : OOXMLPropertySet::~OOXMLPropertySet()
      39             : {
      40     1324505 : }
      41             : 
      42        7270 : OOXMLTable::~OOXMLTable()
      43             : {
      44        7270 : }
      45             : 
      46     2111505 : OOXMLPropertyImpl::OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue,
      47             :                                      OOXMLPropertyImpl::Type_t eType)
      48     2111505 : : mId(id), mpValue(pValue), meType(eType)
      49             : {
      50     2111505 : }
      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     4223010 : OOXMLPropertyImpl::~OOXMLPropertyImpl()
      58             : {
      59     4223010 : }
      60             : 
      61     5901968 : sal_uInt32 OOXMLPropertyImpl::getId() const
      62             : {
      63     5901968 :     return mId;
      64             : }
      65             : 
      66     2406120 : Value::Pointer_t OOXMLPropertyImpl::getValue()
      67             : {
      68     2406120 :     Value::Pointer_t pResult;
      69             : 
      70     2406120 :     if (mpValue.get() != NULL)
      71     2405357 :         pResult = Value::Pointer_t(mpValue->clone());
      72             :     else
      73         763 :         pResult = Value::Pointer_t(new OOXMLValue());
      74             : 
      75     2406120 :     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      506310 : writerfilter::Reference<Properties>::Pointer_t OOXMLPropertyImpl::getProps()
      99             : {
     100      506310 :     writerfilter::Reference<Properties>::Pointer_t pResult;
     101             : 
     102      506310 :     if (mpValue.get() != NULL)
     103      504457 :         pResult = mpValue->getProperties();
     104             : 
     105      506310 :     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 = fastTokenToId(mId);
     114             : 
     115           0 :     if (sResult.length() == 0)
     116             :     {
     117             :         static char sBuffer[256];
     118             : 
     119           0 :         snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIxUINT32, mId);
     120           0 :         sResult = sBuffer;
     121             :     }
     122             : 
     123           0 :     return sResult;
     124             : }
     125             : 
     126           0 : string OOXMLPropertyImpl::toString() const
     127             : {
     128           0 :     string sResult = "(";
     129             : 
     130           0 :     sResult += getName();
     131           0 :     sResult += ", ";
     132           0 :     if (mpValue.get() != NULL)
     133           0 :         sResult += mpValue->toString();
     134             :     else
     135           0 :         sResult +="(null)";
     136           0 :     sResult +=")";
     137             : 
     138           0 :     return sResult;
     139             : }
     140             : 
     141           0 : Sprm::Kind OOXMLPropertyImpl::getKind()
     142             : {
     143           0 :     return SprmKind(getId());
     144             : }
     145             : 
     146           0 : Sprm * OOXMLPropertyImpl::clone()
     147             : {
     148           0 :     return new OOXMLPropertyImpl(*this);
     149             : }
     150             : 
     151     1987236 : void OOXMLPropertyImpl::resolve(writerfilter::Properties & rProperties)
     152             : {
     153     1987236 :     writerfilter::Properties * pProperties = NULL;
     154     1987236 :     pProperties = &rProperties;
     155             : 
     156     1987236 :     switch (meType)
     157             :     {
     158             :     case SPRM:
     159      870704 :         if (mId != 0x0)
     160      870704 :             pProperties->sprm(*this);
     161      870704 :         break;
     162             :     case ATTRIBUTE:
     163     1116532 :         pProperties->attribute(mId, *getValue());
     164     1116532 :         break;
     165             :     }
     166     1987236 : }
     167             : 
     168             : /*
     169             :    class OOXMLValue
     170             : */
     171             : 
     172     3739115 : OOXMLValue::OOXMLValue()
     173             : {
     174     3739115 : }
     175             : 
     176     6177846 : OOXMLValue::~OOXMLValue()
     177             : {
     178     6177846 : }
     179             : 
     180           0 : bool OOXMLValue::getBool() const
     181             : {
     182           0 :     return false;
     183             : }
     184             : 
     185      956583 : int OOXMLValue::getInt() const
     186             : {
     187      956583 :     return 0;
     188             : }
     189             : 
     190      650324 : OUString OOXMLValue::getString() const
     191             : {
     192      650324 :     return OUString();
     193             : }
     194             : 
     195           0 : uno::Any OOXMLValue::getAny() const
     196             : {
     197           0 :     return uno::Any();
     198             : }
     199             : 
     200       28048 : writerfilter::Reference<Properties>::Pointer_t OOXMLValue::getProperties()
     201             : {
     202       28048 :     return writerfilter::Reference<Properties>::Pointer_t();
     203             : }
     204             : 
     205           0 : writerfilter::Reference<Stream>::Pointer_t OOXMLValue::getStream()
     206             : {
     207           0 :     return writerfilter::Reference<Stream>::Pointer_t();
     208             : }
     209             : 
     210           0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLValue::getBinary()
     211             : {
     212           0 :     return writerfilter::Reference<BinaryObj>::Pointer_t();
     213             : }
     214             : 
     215           0 : string OOXMLValue::toString() const
     216             : {
     217           0 :     return "OOXMLValue";
     218             : }
     219             : 
     220           0 : OOXMLValue * OOXMLValue::clone() const
     221             : {
     222           0 :     return new OOXMLValue(*this);
     223             : }
     224             : 
     225             : /*
     226             :   class OOXMLBinaryValue
     227             :  */
     228             : 
     229           0 : OOXMLBinaryValue::OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t
     230             :                                    pBinaryObj)
     231           0 : : mpBinaryObj(pBinaryObj)
     232             : {
     233           0 : }
     234             : 
     235           0 : OOXMLBinaryValue::~OOXMLBinaryValue()
     236             : {
     237           0 : }
     238             : 
     239           0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLBinaryValue::getBinary()
     240             : {
     241           0 :     return mpBinaryObj;
     242             : }
     243             : 
     244           0 : string OOXMLBinaryValue::toString() const
     245             : {
     246           0 :     return "BinaryObj";
     247             : }
     248             : 
     249           0 : OOXMLValue * OOXMLBinaryValue::clone() const
     250             : {
     251           0 :     return new OOXMLBinaryValue(mpBinaryObj);
     252             : }
     253             : 
     254             : /*
     255             :   class OOXMLBooleanValue
     256             : */
     257             : 
     258       84640 : OOXMLBooleanValue::OOXMLBooleanValue(bool bValue)
     259       84640 : : mbValue(bValue)
     260             : {
     261       84640 : }
     262             : 
     263       80314 : OOXMLBooleanValue::OOXMLBooleanValue(const OUString & rValue)
     264       80314 : : mbValue(false)
     265             : {
     266       80314 :     mbValue = (rValue == "true"
     267       78784 :         || rValue == "True"
     268       78784 :         || rValue == "1"
     269       26414 :         || rValue == "on"
     270      106724 :         || rValue == "On");
     271       80314 : }
     272             : 
     273      770134 : OOXMLBooleanValue::~OOXMLBooleanValue()
     274             : {
     275      770134 : }
     276             : 
     277           0 : bool OOXMLBooleanValue::getBool() const
     278             : {
     279           0 :     return mbValue;
     280             : }
     281             : 
     282      215282 : int OOXMLBooleanValue::getInt() const
     283             : {
     284      215282 :     return mbValue ? 1 : 0;
     285             : }
     286             : 
     287           0 : uno::Any OOXMLBooleanValue::getAny() const
     288             : {
     289           0 :     uno::Any aResult(mbValue);
     290             : 
     291           0 :     return aResult;
     292             : }
     293             : 
     294           0 : string OOXMLBooleanValue::toString() const
     295             : {
     296           0 :     return mbValue ? "true" : "false";
     297             : }
     298             : 
     299      220113 : OOXMLValue * OOXMLBooleanValue::clone() const
     300             : {
     301      220113 :     return new OOXMLBooleanValue(*this);
     302             : }
     303             : 
     304             : /*
     305             :   class OOXMLStringValue
     306             : */
     307             : 
     308     1875725 : OOXMLStringValue::OOXMLStringValue(const OUString & rStr)
     309     1875725 : : mStr(rStr)
     310             : {
     311     1875725 : }
     312             : 
     313     5506092 : OOXMLStringValue::~OOXMLStringValue()
     314             : {
     315     5506092 : }
     316             : 
     317           0 : uno::Any OOXMLStringValue::getAny() const
     318             : {
     319           0 :     uno::Any aAny(mStr);
     320             : 
     321           0 :     return aAny;
     322             : }
     323             : 
     324      826330 : OUString OOXMLStringValue::getString() const
     325             : {
     326      826330 :     return mStr;
     327             : }
     328             : 
     329           0 : string OOXMLStringValue::toString() const
     330             : {
     331           0 :     return OUStringToOString(mStr, RTL_TEXTENCODING_ASCII_US).getStr();
     332             : }
     333             : 
     334      877321 : OOXMLValue * OOXMLStringValue::clone() const
     335             : {
     336      877321 :     return new OOXMLStringValue(*this);
     337             : }
     338             : 
     339             : /*
     340             :   class OOXMLInputStreamValue
     341             :  */
     342          66 : OOXMLInputStreamValue::OOXMLInputStreamValue(uno::Reference<io::XInputStream> xInputStream)
     343          66 : : mxInputStream(xInputStream)
     344             : {
     345          66 : }
     346             : 
     347         132 : OOXMLInputStreamValue::~OOXMLInputStreamValue()
     348             : {
     349         132 : }
     350             : 
     351          22 : uno::Any OOXMLInputStreamValue::getAny() const
     352             : {
     353          22 :     uno::Any aAny(mxInputStream);
     354             : 
     355          22 :     return aAny;
     356             : }
     357             : 
     358           0 : string OOXMLInputStreamValue::toString() const
     359             : {
     360           0 :     return "InputStream";
     361             : }
     362             : 
     363          44 : OOXMLValue * OOXMLInputStreamValue::clone() const
     364             : {
     365          44 :     return new OOXMLInputStreamValue(mxInputStream);
     366             : }
     367             : 
     368             : /*
     369             :   struct OOXMLPropertySetImplCompare
     370             :  */
     371             : 
     372           0 : bool OOXMLPropertySetImplCompare::operator()(const OOXMLProperty::Pointer_t x,
     373             :                                              const OOXMLProperty::Pointer_t y) const
     374             : {
     375           0 :     bool bResult = false;
     376             : 
     377           0 :     if (x.get() == NULL && y.get() != NULL)
     378           0 :         bResult = true;
     379           0 :     else if (x.get() != NULL && y.get() != NULL)
     380           0 :         bResult = x->getId() < y->getId();
     381             : 
     382           0 :     return bResult;
     383             : }
     384             : 
     385             : /**
     386             :    class OOXMLPropertySetImpl
     387             : */
     388             : 
     389      796279 : OOXMLPropertySetImpl::OOXMLPropertySetImpl()
     390      796279 : : msType("OOXMLPropertySetImpl")
     391             : {
     392      796279 : }
     393             : 
     394     2649010 : OOXMLPropertySetImpl::~OOXMLPropertySetImpl()
     395             : {
     396     2649010 : }
     397             : 
     398      646583 : void OOXMLPropertySetImpl::resolve(Properties & rHandler)
     399             : {
     400      646583 :     size_t nIt = 0;
     401             : 
     402             :     // The pProp->resolve(rHandler) call below can cause elements to
     403             :     // be appended to mProperties. I don't think it can cause elements
     404             :     // to be deleted. But let's check with < here just to be safe that
     405             :     // the indexing below works.
     406     3308525 :     while (nIt < mProperties.size())
     407             :     {
     408     2015359 :         OOXMLProperty::Pointer_t pProp = mProperties[nIt];
     409             : 
     410     2015359 :         if (pProp.get() != NULL)
     411     1987236 :             pProp->resolve(rHandler);
     412             : #ifdef DEBUG_RESOLVE
     413             :         else
     414             :         {
     415             :             debug_logger->startElement("error");
     416             :             debug_logger->chars(std::string("zero-property"));
     417             :             debug_logger->endElement();
     418             :         }
     419             : #endif
     420             : 
     421     2015359 :         ++nIt;
     422     2015359 :     }
     423      646583 : }
     424             : 
     425           0 : OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::begin()
     426             : {
     427           0 :     return mProperties.begin();
     428             : }
     429             : 
     430           0 : OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::end()
     431             : {
     432           0 :     return mProperties.end();
     433             : }
     434             : 
     435             : OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
     436           0 : OOXMLPropertySetImpl::begin() const
     437             : {
     438           0 :     return mProperties.begin();
     439             : }
     440             : 
     441             : OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
     442           0 : OOXMLPropertySetImpl::end() const
     443             : {
     444           0 :     return mProperties.end();
     445             : }
     446             : 
     447      108232 : string OOXMLPropertySetImpl::getType() const
     448             : {
     449      108232 :     return msType;
     450             : }
     451             : 
     452     2133361 : void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty)
     453             : {
     454             : #ifdef DEBUG_PROPERTY_SET
     455             :     debug_logger->startElement("propertyset.add");
     456             :     debug_logger->chars(pProperty->toString());
     457             : #endif
     458             : 
     459     2133361 :     if (pProperty.get() != NULL && pProperty->getId() != 0x0)
     460             :     {
     461             :         /*
     462             :          HACK: Ugly hack. This retarded overdesigned writerfilter thing
     463             :          processes attributes in random order (as given by boost::unordered_map
     464             :          when iterating it), but StyleSheetTable::lcl_attribute() needs
     465             :          to know whether NS_ooxml::LN_CT_Style_type is STYLE_TYPE_TABLE first.
     466             :          And all this overdesigned machinery doesn't even give a reasonable
     467             :          way to find out if an attribute is there before encountering it
     468             :          in random order in lcl_attribute(), so just make sure here that
     469             :          the attribute comes first.
     470             :         */
     471     2088778 :         if( pProperty->getId() == NS_ooxml::LN_CT_Style_type )
     472       26852 :             mProperties.insert( mProperties.begin(), pProperty );
     473             :         else
     474     2061926 :             mProperties.push_back(pProperty);
     475             :     }
     476             : #ifdef DEBUG_PROPERTY_SET
     477             :     else
     478             :     {
     479             :         debug_logger->element("warning.property_not_added");
     480             :     }
     481             : 
     482             :     debug_logger->endElement("propertyset.add");
     483             : #endif
     484     2133361 : }
     485             : 
     486        9537 : void OOXMLPropertySetImpl::add(OOXMLPropertySet::Pointer_t pPropertySet)
     487             : {
     488        9537 :     if (pPropertySet.get() != NULL)
     489             :     {
     490             :         OOXMLPropertySetImpl * pSet =
     491        9537 :             dynamic_cast<OOXMLPropertySetImpl *>(pPropertySet.get());
     492             : 
     493        9537 :         if (pSet != NULL)
     494             :         {
     495        9537 :             mProperties.resize(mProperties.size() + pSet->mProperties.size());
     496       94179 :             for (OOXMLProperties_t::iterator aIt = pSet->mProperties.begin();
     497       62786 :                  aIt != pSet->mProperties.end(); ++aIt)
     498       21856 :                 add(*aIt);
     499             :         }
     500             :     }
     501        9537 : }
     502             : 
     503      528226 : OOXMLPropertySet * OOXMLPropertySetImpl::clone() const
     504             : {
     505      528226 :     return new OOXMLPropertySetImpl(*this);
     506             : }
     507             : 
     508           0 : void OOXMLPropertySetImpl::setType(const string & rsType)
     509             : {
     510           0 :     msType = rsType;
     511           0 : }
     512             : 
     513           0 : string OOXMLPropertySetImpl::toString()
     514             : {
     515           0 :     string sResult = "[";
     516             :     char sBuffer[256];
     517           0 :     snprintf(sBuffer, sizeof(sBuffer), "%p", this);
     518           0 :     sResult += sBuffer;
     519           0 :     sResult += ":";
     520             : 
     521           0 :     OOXMLProperties_t::iterator aItBegin = begin();
     522           0 :     OOXMLProperties_t::iterator aItEnd = end();
     523             : 
     524           0 :     for (OOXMLProperties_t::iterator aIt = aItBegin; aIt != aItEnd; ++aIt)
     525             :     {
     526           0 :         if (aIt != aItBegin)
     527           0 :             sResult += ", ";
     528             : 
     529           0 :         if ((*aIt).get() != NULL)
     530           0 :             sResult += (*aIt)->toString();
     531             :         else
     532           0 :             sResult += "0x0";
     533             :     }
     534             : 
     535           0 :     sResult += "]";
     536             : 
     537           0 :     return sResult;
     538             : }
     539             : 
     540             : /*
     541             :   class OOXMLPropertySetValue
     542             : */
     543             : 
     544      583063 : OOXMLPropertySetValue::OOXMLPropertySetValue
     545             : (OOXMLPropertySet::Pointer_t pPropertySet)
     546      583063 : : mpPropertySet(pPropertySet)
     547             : {
     548      583063 : }
     549             : 
     550     2596782 : OOXMLPropertySetValue::~OOXMLPropertySetValue()
     551             : {
     552     2596782 : }
     553             : 
     554      527205 : writerfilter::Reference<Properties>::Pointer_t OOXMLPropertySetValue::getProperties()
     555             : {
     556             :     return writerfilter::Reference<Properties>::Pointer_t
     557      527205 :         (mpPropertySet->clone());
     558             : }
     559             : 
     560           0 : string OOXMLPropertySetValue::toString() const
     561             : {
     562             :     char sBuffer[256];
     563             : 
     564           0 :     snprintf(sBuffer, sizeof(sBuffer), "t:%p, m:%p", this, mpPropertySet.get());
     565             : 
     566           0 :     return "OOXMLPropertySetValue(" + string(sBuffer) + ")";
     567             : }
     568             : 
     569      715328 : OOXMLValue * OOXMLPropertySetValue::clone() const
     570             : {
     571      715328 :     return new OOXMLPropertySetValue(*this);
     572             : }
     573             : 
     574             : /*
     575             :   class OOXMLIntegerValue
     576             : */
     577             : 
     578      392016 : OOXMLIntegerValue::OOXMLIntegerValue(sal_Int32 nValue)
     579      392016 : : mnValue(nValue)
     580             : {
     581      392016 : }
     582             : 
     583      305664 : OOXMLIntegerValue::OOXMLIntegerValue(const OUString & rValue)
     584      305664 : : mnValue(0)
     585             : {
     586      305664 :     mnValue = rValue.toInt32();
     587      305664 : }
     588             : 
     589     2323004 : OOXMLIntegerValue::~OOXMLIntegerValue()
     590             : {
     591     2323004 : }
     592             : 
     593      457393 : int OOXMLIntegerValue::getInt() const
     594             : {
     595      457393 :     return mnValue;
     596             : }
     597             : 
     598           0 : uno::Any OOXMLIntegerValue::getAny() const
     599             : {
     600           0 :     uno::Any aResult(mnValue);
     601             : 
     602           0 :     return aResult;
     603             : }
     604             : 
     605      463822 : OOXMLValue * OOXMLIntegerValue::clone() const
     606             : {
     607      463822 :     return new OOXMLIntegerValue(*this);
     608             : }
     609             : 
     610           0 : string OOXMLIntegerValue::toString() const
     611             : {
     612             :     char buffer[256];
     613           0 :     snprintf(buffer, sizeof(buffer), "%" SAL_PRIdINT32, mnValue);
     614             : 
     615           0 :     return buffer;
     616             : }
     617             : 
     618             : /*
     619             :   class OOXMLHexValue
     620             : */
     621             : 
     622           0 : OOXMLHexValue::OOXMLHexValue(sal_uInt32 nValue)
     623           0 : : mnValue(nValue)
     624             : {
     625           0 : }
     626             : 
     627      262522 : OOXMLHexValue::OOXMLHexValue(const OUString & rValue)
     628             : {
     629      262522 :     mnValue = rValue.toUInt32(16);
     630      262522 : }
     631             : 
     632      665834 : OOXMLHexValue::~OOXMLHexValue()
     633             : {
     634      665834 : }
     635             : 
     636       69746 : int OOXMLHexValue::getInt() const
     637             : {
     638       69746 :     return mnValue;
     639             : }
     640             : 
     641       70395 : OOXMLValue * OOXMLHexValue::clone() const
     642             : {
     643       70395 :     return new OOXMLHexValue(*this);
     644             : }
     645             : 
     646           0 : string OOXMLHexValue::toString() const
     647             : {
     648             :     char buffer[256];
     649           0 :     snprintf(buffer, sizeof(buffer), "0x%" SAL_PRIxUINT32, mnValue);
     650             : 
     651           0 :     return buffer;
     652             : }
     653             : 
     654             : // OOXMLUniversalMeasureValue
     655             : 
     656      150938 : OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(const OUString& rValue)
     657             : {
     658      150938 :     if (rValue.endsWith("pt"))
     659          98 :         mnValue = rValue.copy(0, rValue.getLength() - 2).toInt32() * 20;
     660             :     else
     661      150840 :         mnValue = rValue.toInt32();
     662      150938 : }
     663             : 
     664      483854 : OOXMLUniversalMeasureValue::~OOXMLUniversalMeasureValue()
     665             : {
     666      483854 : }
     667             : 
     668       90986 : int OOXMLUniversalMeasureValue::getInt() const
     669             : {
     670       90986 :     return mnValue;
     671             : }
     672             : 
     673       90989 : OOXMLValue* OOXMLUniversalMeasureValue::clone() const
     674             : {
     675       90989 :     return new OOXMLUniversalMeasureValue(*this);
     676             : }
     677             : 
     678           0 : string OOXMLUniversalMeasureValue::toString() const
     679             : {
     680           0 :     return OString::number(mnValue).getStr();
     681             : }
     682             : 
     683             : /*
     684             :   class OOXMLShapeValue
     685             :  */
     686             : 
     687             : 
     688        3018 : OOXMLShapeValue::OOXMLShapeValue(uno::Reference<XShape> rShape)
     689        3018 : : mrShape(rShape)
     690             : {
     691        3018 : }
     692             : 
     693        6036 : OOXMLShapeValue::~OOXMLShapeValue()
     694             : {
     695        6036 : }
     696             : 
     697        1050 : uno::Any OOXMLShapeValue::getAny() const
     698             : {
     699        1050 :     return uno::Any(mrShape);
     700             : }
     701             : 
     702           0 : string OOXMLShapeValue::toString() const
     703             : {
     704           0 :     return "Shape";
     705             : }
     706             : 
     707        1932 : OOXMLValue * OOXMLShapeValue::clone() const
     708             : {
     709        1932 :     return new OOXMLShapeValue(mrShape);
     710             : }
     711             : 
     712             : /*
     713             :   class OOXMLStarMathValue
     714             :  */
     715             : 
     716             : 
     717         386 : OOXMLStarMathValue::OOXMLStarMathValue( uno::Reference< embed::XEmbeddedObject > c )
     718         386 : : component(c)
     719             : {
     720         386 : }
     721             : 
     722         772 : OOXMLStarMathValue::~OOXMLStarMathValue()
     723             : {
     724         772 : }
     725             : 
     726         386 : uno::Any OOXMLStarMathValue::getAny() const
     727             : {
     728         386 :     return uno::Any(component);
     729             : }
     730             : 
     731           0 : string OOXMLStarMathValue::toString() const
     732             : {
     733           0 :     return "StarMath";
     734             : }
     735             : 
     736         193 : OOXMLValue * OOXMLStarMathValue::clone() const
     737             : {
     738         193 :     return new OOXMLStarMathValue( component );
     739             : }
     740             : 
     741             : /*
     742             :   class OOXMLTableImpl
     743             :  */
     744             : 
     745        3635 : OOXMLTableImpl::OOXMLTableImpl()
     746             : {
     747        3635 : }
     748             : 
     749       10905 : OOXMLTableImpl::~OOXMLTableImpl()
     750             : {
     751       10905 : }
     752             : 
     753        3635 : void OOXMLTableImpl::resolve(Table & rTable)
     754             : {
     755        3635 :     Table * pTable = &rTable;
     756             : 
     757        3635 :     int nPos = 0;
     758             : 
     759        3635 :     PropertySets_t::iterator it = mPropertySets.begin();
     760        3635 :     PropertySets_t::iterator itEnd = mPropertySets.end();
     761             : 
     762       43071 :     while (it != itEnd)
     763             :     {
     764             :         writerfilter::Reference<Properties>::Pointer_t pProperties
     765       35801 :             ((*it)->getProperties());
     766             : 
     767       35801 :         if (pProperties.get() != NULL)
     768       35801 :             pTable->entry(nPos, pProperties);
     769             : 
     770       35801 :         ++nPos;
     771       35801 :         ++it;
     772       35801 :     }
     773        3635 : }
     774             : 
     775       35801 : void OOXMLTableImpl::add(ValuePointer_t pPropertySet)
     776             : {
     777       35801 :     if (pPropertySet.get() != NULL)
     778       35801 :         mPropertySets.push_back(pPropertySet);
     779       35801 : }
     780             : 
     781           0 : string OOXMLTableImpl::getType() const
     782             : {
     783           0 :     return "OOXMLTableImpl";
     784             : }
     785             : 
     786        3635 : OOXMLTable * OOXMLTableImpl::clone() const
     787             : {
     788        3635 :     return new OOXMLTableImpl(*this);
     789             : }
     790             : 
     791             : /*
     792             :   class: OOXMLPropertySetEntryToString
     793             : */
     794             : 
     795          33 : OOXMLPropertySetEntryToString::OOXMLPropertySetEntryToString(Id nId)
     796          33 : : mnId(nId)
     797             : {
     798          33 : }
     799             : 
     800          33 : OOXMLPropertySetEntryToString::~OOXMLPropertySetEntryToString()
     801             : {
     802          33 : }
     803             : 
     804           0 : void OOXMLPropertySetEntryToString::sprm(Sprm & /*rSprm*/)
     805             : {
     806           0 : }
     807             : 
     808          33 : void OOXMLPropertySetEntryToString::attribute(Id nId, Value & rValue)
     809             : {
     810          33 :     if (nId == mnId)
     811          33 :         mStr = rValue.getString();
     812          33 : }
     813             : 
     814          33 : const OUString & OOXMLPropertySetEntryToString::getString() const
     815             : {
     816          33 :     return mStr;
     817             : }
     818             : 
     819        8106 : OOXMLPropertySetEntryToInteger::OOXMLPropertySetEntryToInteger(Id nId)
     820        8106 : : mnId(nId), mnValue(0)
     821             : {
     822        8106 : }
     823             : 
     824        8106 : OOXMLPropertySetEntryToInteger::~OOXMLPropertySetEntryToInteger()
     825             : {
     826        8106 : }
     827             : 
     828           0 : void OOXMLPropertySetEntryToInteger::sprm(Sprm & /*rSprm*/)
     829             : {
     830           0 : }
     831             : 
     832        8106 : void OOXMLPropertySetEntryToInteger::attribute(Id nId, Value & rValue)
     833             : {
     834        8106 :     if (nId == mnId)
     835        8106 :         mnValue = rValue.getInt();
     836        8106 : }
     837             : 
     838        8106 : int OOXMLPropertySetEntryToInteger::getValue() const
     839             : {
     840        8106 :     return mnValue;
     841             : }
     842             : 
     843          42 : }}
     844             : 
     845             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10