LCOV - code coverage report
Current view: top level - oox/source/helper - grabbagstack.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 47 47 100.0 %
Date: 2014-11-03 Functions: 10 10 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             :  */
      10             : 
      11             : #include "oox/helper/grabbagstack.hxx"
      12             : #include <com/sun/star/uno/Sequence.hxx>
      13             : 
      14             : namespace oox
      15             : {
      16             : 
      17             : using namespace css::beans;
      18             : using namespace css::uno;
      19             : 
      20         918 : GrabBagStack::GrabBagStack(const OUString& aName)
      21             : {
      22         918 :     mCurrentElement.maName = aName;
      23         918 : }
      24             : 
      25        1836 : GrabBagStack::~GrabBagStack()
      26        1836 : {}
      27             : 
      28         252 : bool GrabBagStack::isStackEmpty()
      29             : {
      30         252 :     return mStack.empty();
      31             : }
      32             : 
      33         918 : PropertyValue GrabBagStack::getRootProperty()
      34             : {
      35        2128 :     while(!mStack.empty())
      36         292 :         pop();
      37             : 
      38         918 :     PropertyValue aProperty;
      39         918 :     aProperty.Name = mCurrentElement.maName;
      40             : 
      41        1836 :     Sequence<PropertyValue> aSequence(mCurrentElement.maPropertyList.size());
      42         918 :     PropertyValue* pSequence = aSequence.getArray();
      43         918 :     std::vector<PropertyValue>::iterator i;
      44        2484 :     for (i = mCurrentElement.maPropertyList.begin(); i != mCurrentElement.maPropertyList.end(); ++i)
      45        1566 :         *pSequence++ = *i;
      46             : 
      47         918 :     aProperty.Value = makeAny(aSequence);
      48             : 
      49        1836 :     return aProperty;
      50             : }
      51             : 
      52       10642 : void GrabBagStack::appendElement(const OUString& aName, Any aAny)
      53             : {
      54       10642 :     PropertyValue aValue;
      55       10642 :     aValue.Name = aName;
      56       10642 :     aValue.Value = aAny;
      57       10642 :     mCurrentElement.maPropertyList.push_back(aValue);
      58       10642 : }
      59             : 
      60        5410 : void GrabBagStack::push(const OUString& aKey)
      61             : {
      62        5410 :     mStack.push(mCurrentElement);
      63        5410 :     mCurrentElement.maName = aKey;
      64        5410 :     mCurrentElement.maPropertyList.clear();
      65        5410 : }
      66             : 
      67        5410 : void GrabBagStack::pop()
      68             : {
      69        5410 :     OUString aName = mCurrentElement.maName;
      70       10820 :     Sequence<PropertyValue> aSequence(mCurrentElement.maPropertyList.size());
      71        5410 :     PropertyValue* pSequence = aSequence.getArray();
      72        5410 :     std::vector<PropertyValue>::iterator i;
      73       14486 :     for (i = mCurrentElement.maPropertyList.begin(); i != mCurrentElement.maPropertyList.end(); ++i)
      74        9076 :         *pSequence++ = *i;
      75             : 
      76        5410 :     mCurrentElement = mStack.top();
      77        5410 :     mStack.pop();
      78       10820 :     appendElement(aName, makeAny(aSequence));
      79        5410 : }
      80             : 
      81        3120 : void GrabBagStack::addInt32(const OUString& aElementName, sal_Int32 aIntValue)
      82             : {
      83        3120 :     appendElement(aElementName, makeAny(aIntValue));
      84        3120 : }
      85             : 
      86         998 : void GrabBagStack::addString(const OUString& aElementName, const OUString& aStringValue)
      87             : {
      88         998 :     appendElement(aElementName, makeAny(aStringValue));
      89         998 : }
      90             : 
      91             : } // namespace oox
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10