LCOV - code coverage report
Current view: top level - writerfilter/source/rtftok - rtfvalue.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 112 0.0 %
Date: 2014-04-14 Functions: 0 27 0.0 %
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             : 
      10             : #include <rtfreferenceproperties.hxx>
      11             : #include <rtfdocumentimpl.hxx>
      12             : 
      13             : namespace writerfilter {
      14             : namespace rtftok {
      15             : 
      16             : 
      17           0 : RTFValue::RTFValue(int nValue, const OUString& sValue, RTFSprms rAttributes,
      18             :         RTFSprms rSprms, uno::Reference<drawing::XShape> xShape,
      19             :         uno::Reference<io::XInputStream> xStream, uno::Reference<embed::XEmbeddedObject> xObject, bool bForceString,
      20             :         RTFShape aShape)
      21             :     : m_nValue(nValue),
      22             :     m_sValue(sValue),
      23             :     m_xShape(xShape),
      24             :     m_xStream(xStream),
      25             :     m_xObject(xObject),
      26           0 :     m_bForceString(bForceString)
      27             : {
      28           0 :     m_pAttributes.reset(new RTFSprms(rAttributes));
      29           0 :     m_pSprms.reset(new RTFSprms(rSprms));
      30           0 :     m_pShape.reset(new RTFShape(aShape));
      31           0 : }
      32             : 
      33           0 : RTFValue::RTFValue()
      34             :     : m_nValue(0),
      35             :     m_sValue(),
      36             :     m_xShape(),
      37             :     m_xStream(),
      38             :     m_xObject(),
      39           0 :     m_bForceString(false)
      40             : {
      41           0 :     m_pAttributes.reset(new RTFSprms());
      42           0 :     m_pSprms.reset(new RTFSprms());
      43           0 :     m_pShape.reset(new RTFShape());
      44           0 : }
      45             : 
      46           0 : RTFValue::RTFValue(int nValue)
      47             :     : m_nValue(nValue),
      48             :     m_sValue(),
      49             :     m_xShape(),
      50             :     m_xStream(),
      51             :     m_xObject(),
      52           0 :     m_bForceString(false)
      53             : {
      54           0 :     m_pAttributes.reset(new RTFSprms());
      55           0 :     m_pSprms.reset(new RTFSprms());
      56           0 :     m_pShape.reset(new RTFShape());
      57           0 : }
      58             : 
      59           0 : RTFValue::RTFValue(const OUString& sValue, bool bForce)
      60             :     : m_nValue(),
      61             :     m_sValue(sValue),
      62             :     m_xShape(),
      63             :     m_xStream(),
      64             :     m_xObject(),
      65           0 :     m_bForceString(bForce)
      66             : {
      67           0 :     m_pAttributes.reset(new RTFSprms());
      68           0 :     m_pSprms.reset(new RTFSprms());
      69           0 :     m_pShape.reset(new RTFShape());
      70           0 : }
      71             : 
      72           0 : RTFValue::RTFValue(RTFSprms rAttributes)
      73             :     : m_nValue(),
      74             :     m_sValue(),
      75             :     m_xShape(),
      76             :     m_xStream(),
      77             :     m_xObject(),
      78           0 :     m_bForceString(false)
      79             : {
      80           0 :     m_pAttributes.reset(new RTFSprms(rAttributes));
      81           0 :     m_pSprms.reset(new RTFSprms());
      82           0 :     m_pShape.reset(new RTFShape());
      83           0 : }
      84             : 
      85           0 : RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms)
      86             :     : m_nValue(),
      87             :     m_sValue(),
      88             :     m_xShape(),
      89             :     m_xStream(),
      90             :     m_xObject(),
      91           0 :     m_bForceString(false)
      92             : {
      93           0 :     m_pAttributes.reset(new RTFSprms(rAttributes));
      94           0 :     m_pSprms.reset(new RTFSprms(rSprms));
      95           0 :     m_pShape.reset(new RTFShape());
      96           0 : }
      97             : 
      98           0 : RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape)
      99             :     : m_nValue(),
     100             :     m_sValue(),
     101             :     m_xShape(rShape),
     102             :     m_xStream(),
     103             :     m_xObject(),
     104           0 :     m_bForceString(false)
     105             : {
     106           0 :     m_pAttributes.reset(new RTFSprms());
     107           0 :     m_pSprms.reset(new RTFSprms());
     108           0 :     m_pShape.reset(new RTFShape());
     109           0 : }
     110             : 
     111           0 : RTFValue::RTFValue(uno::Reference<io::XInputStream> rStream)
     112             :     : m_nValue(),
     113             :     m_sValue(),
     114             :     m_xShape(),
     115             :     m_xStream(rStream),
     116             :     m_xObject(),
     117           0 :     m_bForceString(false)
     118             : {
     119           0 :     m_pAttributes.reset(new RTFSprms());
     120           0 :     m_pSprms.reset(new RTFSprms());
     121           0 :     m_pShape.reset(new RTFShape());
     122           0 : }
     123             : 
     124           0 : RTFValue::RTFValue(uno::Reference<embed::XEmbeddedObject> xObject)
     125             :     : m_nValue(),
     126             :     m_sValue(),
     127             :     m_xShape(),
     128             :     m_xStream(),
     129             :     m_xObject(xObject),
     130           0 :     m_bForceString(false)
     131             : {
     132           0 :     m_pAttributes.reset(new RTFSprms());
     133           0 :     m_pSprms.reset(new RTFSprms());
     134           0 :     m_pShape.reset(new RTFShape());
     135           0 : }
     136             : 
     137           0 : RTFValue::RTFValue(RTFShape aShape)
     138             :     : m_nValue(),
     139             :     m_sValue(),
     140             :     m_xShape(),
     141             :     m_xStream(),
     142             :     m_xObject(),
     143           0 :     m_bForceString(false)
     144             : {
     145           0 :     m_pAttributes.reset(new RTFSprms());
     146           0 :     m_pSprms.reset(new RTFSprms());
     147           0 :     m_pShape.reset(new RTFShape(aShape));
     148           0 : }
     149             : 
     150           0 : RTFValue::~RTFValue()
     151             : {
     152           0 : }
     153             : 
     154           0 : int RTFValue::getInt() const
     155             : {
     156           0 :     return m_nValue;
     157             : }
     158             : 
     159           0 : OUString RTFValue::getString() const
     160             : {
     161           0 :     if (!m_sValue.isEmpty() || m_bForceString)
     162           0 :         return m_sValue;
     163             :     else
     164           0 :         return OUString::number(m_nValue);
     165             : }
     166             : 
     167           0 : void RTFValue::setString(const OUString& sValue)
     168             : {
     169           0 :     m_sValue = sValue;
     170           0 : }
     171             : 
     172           0 : uno::Any RTFValue::getAny() const
     173             : {
     174           0 :     uno::Any ret;
     175           0 :     if (!m_sValue.isEmpty() || m_bForceString)
     176           0 :         ret <<= m_sValue;
     177           0 :     else if (m_xShape.is())
     178           0 :         ret <<= m_xShape;
     179           0 :     else if (m_xStream.is())
     180           0 :         ret <<= m_xStream;
     181           0 :     else if (m_xObject.is())
     182           0 :         ret <<= m_xObject;
     183             :     else
     184           0 :         ret <<= static_cast<sal_Int32>(m_nValue);
     185           0 :     return ret;
     186             : }
     187             : 
     188           0 : RTFShape& RTFValue::getShape() const
     189             : {
     190           0 :     return *m_pShape;
     191             : }
     192             : 
     193           0 : writerfilter::Reference<Properties>::Pointer_t RTFValue::getProperties()
     194             : {
     195             :     writerfilter::Reference<Properties>::Pointer_t const pProperties(
     196           0 :             new RTFReferenceProperties(*m_pAttributes, *m_pSprms)
     197           0 :             );
     198           0 :     return pProperties;
     199             : }
     200             : 
     201           0 : writerfilter::Reference<Stream>::Pointer_t RTFValue::getStream()
     202             : {
     203           0 :     return writerfilter::Reference<Stream>::Pointer_t();
     204             : }
     205             : 
     206           0 : writerfilter::Reference<BinaryObj>::Pointer_t RTFValue::getBinary()
     207             : {
     208           0 :     return writerfilter::Reference<BinaryObj>::Pointer_t();
     209             : }
     210             : 
     211           0 : std::string RTFValue::toString() const
     212             : {
     213           0 :     if (!m_sValue.isEmpty() || m_bForceString)
     214           0 :         return OUStringToOString(m_sValue, RTL_TEXTENCODING_UTF8).getStr();
     215             :     else
     216           0 :         return OString::number(m_nValue).getStr();
     217             : }
     218             : 
     219           0 : RTFValue* RTFValue::Clone()
     220             : {
     221           0 :     return new RTFValue(m_nValue, m_sValue, *m_pAttributes, *m_pSprms, m_xShape, m_xStream, m_xObject, m_bForceString, *m_pShape);
     222             : }
     223             : 
     224           0 : bool RTFValue::equals(RTFValue& rOther)
     225             : {
     226           0 :     if (m_nValue != rOther.m_nValue)
     227           0 :         return false;
     228           0 :     if (m_pAttributes->size() != rOther.m_pAttributes->size())
     229           0 :         return false;
     230           0 :     if (m_pSprms->size() != rOther.m_pSprms->size())
     231           0 :         return false;
     232           0 :     return true;
     233             : }
     234             : 
     235           0 : RTFSprms& RTFValue::getAttributes()
     236             : {
     237           0 :     return *m_pAttributes;
     238             : }
     239             : 
     240           0 : RTFSprms& RTFValue::getSprms()
     241             : {
     242           0 :     return *m_pSprms;
     243             : }
     244             : 
     245             : } // namespace rtftok
     246           0 : } // namespace writerfilter
     247             : 
     248             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10