LCOV - code coverage report
Current view: top level - oox/source/helper - grabbagstack.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 47 47 100.0 %
Date: 2015-06-13 12:38:46 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         465 : GrabBagStack::GrabBagStack(const OUString& aName)
      21             : {
      22         465 :     mCurrentElement.maName = aName;
      23         465 : }
      24             : 
      25         930 : GrabBagStack::~GrabBagStack()
      26         930 : {}
      27             : 
      28         126 : bool GrabBagStack::isStackEmpty()
      29             : {
      30         126 :     return mStack.empty();
      31             : }
      32             : 
      33         465 : PropertyValue GrabBagStack::getRootProperty()
      34             : {
      35        1076 :     while(!mStack.empty())
      36         146 :         pop();
      37             : 
      38         465 :     PropertyValue aProperty;
      39         465 :     aProperty.Name = mCurrentElement.maName;
      40             : 
      41         930 :     Sequence<PropertyValue> aSequence(mCurrentElement.maPropertyList.size());
      42         465 :     PropertyValue* pSequence = aSequence.getArray();
      43         465 :     std::vector<PropertyValue>::iterator i;
      44        1272 :     for (i = mCurrentElement.maPropertyList.begin(); i != mCurrentElement.maPropertyList.end(); ++i)
      45         807 :         *pSequence++ = *i;
      46             : 
      47         465 :     aProperty.Value = makeAny(aSequence);
      48             : 
      49         930 :     return aProperty;
      50             : }
      51             : 
      52        5381 : void GrabBagStack::appendElement(const OUString& aName, Any aAny)
      53             : {
      54        5381 :     PropertyValue aValue;
      55        5381 :     aValue.Name = aName;
      56        5381 :     aValue.Value = aAny;
      57        5381 :     mCurrentElement.maPropertyList.push_back(aValue);
      58        5381 : }
      59             : 
      60        2735 : void GrabBagStack::push(const OUString& aKey)
      61             : {
      62        2735 :     mStack.push(mCurrentElement);
      63        2735 :     mCurrentElement.maName = aKey;
      64        2735 :     mCurrentElement.maPropertyList.clear();
      65        2735 : }
      66             : 
      67        2735 : void GrabBagStack::pop()
      68             : {
      69        2735 :     OUString aName = mCurrentElement.maName;
      70        5470 :     Sequence<PropertyValue> aSequence(mCurrentElement.maPropertyList.size());
      71        2735 :     PropertyValue* pSequence = aSequence.getArray();
      72        2735 :     std::vector<PropertyValue>::iterator i;
      73        7309 :     for (i = mCurrentElement.maPropertyList.begin(); i != mCurrentElement.maPropertyList.end(); ++i)
      74        4574 :         *pSequence++ = *i;
      75             : 
      76        2735 :     mCurrentElement = mStack.top();
      77        2735 :     mStack.pop();
      78        5470 :     appendElement(aName, makeAny(aSequence));
      79        2735 : }
      80             : 
      81        1566 : void GrabBagStack::addInt32(const OUString& aElementName, sal_Int32 aIntValue)
      82             : {
      83        1566 :     appendElement(aElementName, makeAny(aIntValue));
      84        1566 : }
      85             : 
      86         499 : void GrabBagStack::addString(const OUString& aElementName, const OUString& aStringValue)
      87             : {
      88         499 :     appendElement(aElementName, makeAny(aStringValue));
      89         499 : }
      90             : 
      91             : } // namespace oox
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11