LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLPropertySetImpl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 12 12 100.0 %
Date: 2015-06-13 12:38:46 Functions: 12 12 100.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             :  * 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             : #ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSETIMPL_HXX
      20             : #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSETIMPL_HXX
      21             : 
      22             : #include <vector>
      23             : #include "OOXMLPropertySet.hxx"
      24             : #include "OOXMLBinaryObjectReference.hxx"
      25             : #include <com/sun/star/embed/XEmbeddedObject.hpp>
      26             : 
      27             : namespace com {
      28             : namespace sun {
      29             : namespace star {
      30             : namespace drawing {
      31             : class XShape;
      32             : }}}}
      33             : 
      34             : namespace writerfilter {
      35             : namespace ooxml
      36             : {
      37             : 
      38     4168862 : class OOXMLValue : public Value
      39             : {
      40             : public:
      41             :     typedef std::shared_ptr<OOXMLValue> Pointer_t;
      42             :     OOXMLValue();
      43             :     virtual ~OOXMLValue();
      44             : 
      45             :     virtual int getInt() const SAL_OVERRIDE;
      46             :     virtual bool getBool() const;
      47             :     virtual OUString getString() const SAL_OVERRIDE;
      48             :     virtual css::uno::Any getAny() const SAL_OVERRIDE;
      49             :     virtual writerfilter::Reference<Properties>::Pointer_t getProperties() SAL_OVERRIDE;
      50             :     virtual writerfilter::Reference<Stream>::Pointer_t getStream() SAL_OVERRIDE;
      51             :     virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() SAL_OVERRIDE;
      52             : #ifdef DEBUG_WRITERFILTER
      53             :     virtual std::string toString() const SAL_OVERRIDE;
      54             : #endif
      55             :     virtual OOXMLValue * clone() const;
      56             : };
      57             : 
      58             : class OOXMLPropertyImpl : public OOXMLProperty
      59             : {
      60             : public:
      61             :     enum Type_t { SPRM, ATTRIBUTE };
      62             : private:
      63             :     Id mId;
      64             :     mutable OOXMLValue::Pointer_t mpValue;
      65             :     Type_t meType;
      66             : 
      67             : public:
      68             :     typedef std::shared_ptr<OOXMLProperty> Pointer_t;
      69             : 
      70             :     OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, Type_t eType);
      71             :     OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm);
      72             :     virtual ~OOXMLPropertyImpl();
      73             : 
      74             :     virtual sal_uInt32 getId() const SAL_OVERRIDE;
      75             :     virtual Value::Pointer_t getValue() SAL_OVERRIDE;
      76             :     virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() SAL_OVERRIDE;
      77             :     virtual writerfilter::Reference<Stream>::Pointer_t getStream() SAL_OVERRIDE;
      78             :     virtual writerfilter::Reference<Properties>::Pointer_t getProps() SAL_OVERRIDE;
      79             : #ifdef DEBUG_WRITERFILTER
      80             :     virtual std::string getName() const SAL_OVERRIDE;
      81             :     virtual std::string toString() const SAL_OVERRIDE;
      82             : #endif
      83             :     virtual Sprm * clone() SAL_OVERRIDE;
      84             :     virtual void resolve(Properties & rProperties) SAL_OVERRIDE;
      85             : };
      86             : 
      87             : class OOXMLBinaryValue : public OOXMLValue
      88             : {
      89             : protected:
      90             :     mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
      91             : public:
      92             :     explicit OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t pBinaryObj);
      93             :     virtual ~OOXMLBinaryValue();
      94             : 
      95             :     virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() SAL_OVERRIDE;
      96             : #ifdef DEBUG_WRITERFILTER
      97             :     virtual std::string toString() const SAL_OVERRIDE;
      98             : #endif
      99             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     100             : };
     101             : 
     102      334062 : class OOXMLBooleanValue : public OOXMLValue
     103             : {
     104             : protected:
     105             :     bool mbValue;
     106             :     explicit OOXMLBooleanValue(bool bValue);
     107             : public:
     108             :     static OOXMLValue::Pointer_t Create (bool bValue);
     109             :     static OOXMLValue::Pointer_t Create (const char *pValue);
     110             : 
     111             :     virtual ~OOXMLBooleanValue();
     112             : 
     113             :     virtual int getInt() const SAL_OVERRIDE;
     114             :     virtual bool getBool() const SAL_OVERRIDE;
     115             :     virtual css::uno::Any getAny() const SAL_OVERRIDE;
     116             : #ifdef DEBUG_WRITERFILTER
     117             :     virtual std::string toString() const SAL_OVERRIDE;
     118             : #endif
     119             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     120             : };
     121             : 
     122     1496863 : class OOXMLStringValue : public OOXMLValue
     123             : {
     124             : protected:
     125             :     OUString mStr;
     126             : public:
     127             :     explicit OOXMLStringValue(const OUString & rStr);
     128             :     virtual ~OOXMLStringValue();
     129             : 
     130             :     virtual css::uno::Any getAny() const SAL_OVERRIDE;
     131             :     virtual OUString getString() const SAL_OVERRIDE;
     132             : #ifdef DEBUG_WRITERFILTER
     133             :     virtual std::string toString() const SAL_OVERRIDE;
     134             : #endif
     135             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     136             : };
     137             : 
     138             : class OOXMLInputStreamValue : public OOXMLValue
     139             : {
     140             : protected:
     141             :     css::uno::Reference<css::io::XInputStream> mxInputStream;
     142             : 
     143             : public:
     144             :     explicit OOXMLInputStreamValue(css::uno::Reference<css::io::XInputStream> xInputStream);
     145             :     virtual ~OOXMLInputStreamValue();
     146             : 
     147             :     virtual css::uno::Any getAny() const SAL_OVERRIDE;
     148             : #ifdef DEBUG_WRITERFILTER
     149             :     virtual std::string toString() const SAL_OVERRIDE;
     150             : #endif
     151             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     152             : };
     153             : 
     154             : struct OOXMLPropertySetImplCompare
     155             : {
     156             :     bool operator()(const OOXMLProperty::Pointer_t& x,
     157             :                     const OOXMLProperty::Pointer_t& y) const;
     158             : };
     159             : 
     160      945927 : class OOXMLPropertySetImpl : public OOXMLPropertySet
     161             : {
     162             : public:
     163             :     typedef std::vector<OOXMLProperty::Pointer_t> OOXMLProperties_t;
     164             : private:
     165             :     OOXMLProperties_t mProperties;
     166             :     OString maType;
     167             : public:
     168             :     OOXMLPropertySetImpl();
     169             :     virtual ~OOXMLPropertySetImpl();
     170             : 
     171             :     virtual void resolve(Properties & rHandler) SAL_OVERRIDE;
     172             :     virtual void add(OOXMLProperty::Pointer_t pProperty) SAL_OVERRIDE;
     173             :     virtual void add(OOXMLPropertySet::Pointer_t pPropertySet) SAL_OVERRIDE;
     174             :     virtual OOXMLPropertySet * clone() const SAL_OVERRIDE;
     175             : 
     176             :     OOXMLProperties_t::iterator begin();
     177             :     OOXMLProperties_t::iterator end();
     178             :     OOXMLProperties_t::const_iterator begin() const;
     179             :     OOXMLProperties_t::const_iterator end() const;
     180             : 
     181             :     virtual void setType(const std::string & rsType) SAL_OVERRIDE;
     182             : 
     183             : #ifdef DEBUG_WRITERFILTER
     184             :     virtual std::string toString() SAL_OVERRIDE;
     185             : #endif
     186             : };
     187             : 
     188     1245991 : class OOXMLPropertySetValue : public OOXMLValue
     189             : {
     190             :     OOXMLPropertySet::Pointer_t mpPropertySet;
     191             : public:
     192             :     explicit OOXMLPropertySetValue(OOXMLPropertySet::Pointer_t pPropertySet);
     193             :     virtual ~OOXMLPropertySetValue();
     194             : 
     195             :     virtual writerfilter::Reference<Properties>::Pointer_t getProperties() SAL_OVERRIDE;
     196             : #ifdef DEBUG_WRITERFILTER
     197             :     virtual std::string toString() const SAL_OVERRIDE;
     198             : #endif
     199             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     200             : };
     201             : 
     202      807962 : class OOXMLIntegerValue : public OOXMLValue
     203             : {
     204             : protected:
     205             :     sal_Int32 mnValue;
     206             :     explicit OOXMLIntegerValue(sal_Int32 nValue);
     207             : public:
     208             :     static OOXMLValue::Pointer_t Create (sal_Int32 nValue);
     209             :     virtual ~OOXMLIntegerValue();
     210             : 
     211             :     virtual int getInt() const SAL_OVERRIDE;
     212             :     virtual css::uno::Any getAny() const SAL_OVERRIDE;
     213             : #ifdef DEBUG_WRITERFILTER
     214             :     virtual std::string toString() const SAL_OVERRIDE;
     215             : #endif
     216             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     217             : };
     218             : 
     219      110940 : class OOXMLHexValue : public OOXMLValue
     220             : {
     221             : protected:
     222             :     sal_uInt32 mnValue;
     223             : public:
     224             :     explicit OOXMLHexValue(sal_uInt32 nValue);
     225             :     explicit OOXMLHexValue(const char * pValue);
     226             :     virtual ~OOXMLHexValue();
     227             : 
     228             :     virtual int getInt() const SAL_OVERRIDE;
     229             : #ifdef DEBUG_WRITERFILTER
     230             :     virtual std::string toString() const SAL_OVERRIDE;
     231             : #endif
     232             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     233             : };
     234             : 
     235             : /// Handles OOXML's ST_UniversalMeasure value.
     236      173044 : class OOXMLUniversalMeasureValue : public OOXMLValue
     237             : {
     238             : protected:
     239             :     sal_uInt32 mnValue;
     240             : public:
     241             :     explicit OOXMLUniversalMeasureValue(const char * pValue);
     242             :     virtual ~OOXMLUniversalMeasureValue();
     243             : 
     244             :     virtual int getInt() const SAL_OVERRIDE;
     245             : #ifdef DEBUG_WRITERFILTER
     246             :     virtual std::string toString() const SAL_OVERRIDE;
     247             : #endif
     248             :     virtual OOXMLValue* clone() const SAL_OVERRIDE;
     249             : };
     250             : 
     251             : class OOXMLShapeValue : public OOXMLValue
     252             : {
     253             : protected:
     254             :     css::uno::Reference<css::drawing::XShape> mrShape;
     255             : public:
     256             :     explicit OOXMLShapeValue(css::uno::Reference<css::drawing::XShape> rShape);
     257             :     virtual ~OOXMLShapeValue();
     258             : 
     259             :     virtual css::uno::Any getAny() const SAL_OVERRIDE;
     260             : #ifdef DEBUG_WRITERFILTER
     261             :     virtual std::string toString() const SAL_OVERRIDE;
     262             : #endif
     263             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     264             : };
     265             : 
     266             : class OOXMLStarMathValue : public OOXMLValue
     267             : {
     268             : protected:
     269             :     css::uno::Reference< css::embed::XEmbeddedObject > component;
     270             : public:
     271             :     explicit OOXMLStarMathValue( css::uno::Reference< css::embed::XEmbeddedObject > component );
     272             :     virtual ~OOXMLStarMathValue();
     273             : 
     274             :     virtual css::uno::Any getAny() const SAL_OVERRIDE;
     275             : #ifdef DEBUG_WRITERFILTER
     276             :     virtual std::string toString() const SAL_OVERRIDE;
     277             : #endif
     278             :     virtual OOXMLValue * clone() const SAL_OVERRIDE;
     279             : };
     280             : 
     281        6231 : class OOXMLTableImpl : public OOXMLTable
     282             : {
     283             : public:
     284             :     typedef std::shared_ptr<OOXMLValue> ValuePointer_t;
     285             : private:
     286             :     typedef std::vector<ValuePointer_t> PropertySets_t;
     287             :     PropertySets_t mPropertySets;
     288             : 
     289             : public:
     290             :     OOXMLTableImpl();
     291             :     virtual ~OOXMLTableImpl();
     292             : 
     293             :     virtual void resolve(Table & rTable) SAL_OVERRIDE;
     294             :     void add(ValuePointer_t pPropertySet);
     295             :     virtual OOXMLTable * clone() const SAL_OVERRIDE;
     296             : };
     297             : 
     298             : class OOXMLPropertySetEntryToString : public Properties
     299             : {
     300             :     Id mnId;
     301             :     OUString mStr;
     302             : 
     303             : public:
     304             :     explicit OOXMLPropertySetEntryToString(Id nId);
     305             :     virtual ~OOXMLPropertySetEntryToString();
     306             : 
     307             :     virtual void sprm(Sprm & rSprm) SAL_OVERRIDE;
     308             :     virtual void attribute(Id nId, Value & rValue) SAL_OVERRIDE;
     309             : 
     310          39 :     const OUString & getString() const { return mStr;}
     311             : };
     312             : 
     313             : class OOXMLPropertySetEntryToInteger : public Properties
     314             : {
     315             :     Id mnId;
     316             :     int mnValue;
     317             : public:
     318             :     explicit OOXMLPropertySetEntryToInteger(Id nId);
     319             :     virtual ~OOXMLPropertySetEntryToInteger();
     320             : 
     321             :     virtual void sprm(Sprm & rSprm) SAL_OVERRIDE;
     322             :     virtual void attribute(Id nId, Value & rValue) SAL_OVERRIDE;
     323             : 
     324       10443 :     int getValue() const { return mnValue;}
     325             : };
     326             : 
     327             : class OOXMLPropertySetEntryToBool : public Properties
     328             : {
     329             :     Id mnId;
     330             :     bool mValue;
     331             : public:
     332             :     explicit OOXMLPropertySetEntryToBool(Id nId);
     333             :     virtual ~OOXMLPropertySetEntryToBool();
     334             : 
     335             :     virtual void sprm(Sprm & rSprm) SAL_OVERRIDE;
     336             :     virtual void attribute(Id nId, Value & rValue) SAL_OVERRIDE;
     337             : 
     338        3481 :     bool getValue() const { return mValue; }
     339             : };
     340             : 
     341             : }  // namespace ooxml
     342             : } // namespace writerfilter
     343             : 
     344             : #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSETIMPL_HXX
     345             : 
     346             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11