Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/oox/source/helper/grabbagstack.cxx
Line
Count
Source
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
#include <comphelper/sequence.hxx>
14
15
namespace oox
16
{
17
18
using namespace css::beans;
19
using namespace css::uno;
20
21
GrabBagStack::GrabBagStack(const OUString& aElementName)
22
918
{
23
918
    mCurrentElement.maElementName = aElementName;
24
918
}
25
26
GrabBagStack::~GrabBagStack()
27
918
{}
28
29
bool GrabBagStack::isStackEmpty() const
30
0
{
31
0
    return mStack.empty();
32
0
}
33
34
PropertyValue GrabBagStack::getRootProperty()
35
918
{
36
918
    while(!mStack.empty())
37
0
        pop();
38
39
918
    PropertyValue aProperty;
40
918
    aProperty.Name = mCurrentElement.maElementName;
41
918
    aProperty.Value <<= comphelper::containerToSequence(mCurrentElement.maPropertyList);
42
43
918
    return aProperty;
44
918
}
45
46
void GrabBagStack::appendElement(const OUString& aName, const Any& aAny)
47
12.8k
{
48
12.8k
    PropertyValue aValue;
49
12.8k
    aValue.Name = aName;
50
12.8k
    aValue.Value = aAny;
51
12.8k
    mCurrentElement.maPropertyList.push_back(aValue);
52
12.8k
}
53
54
void GrabBagStack::push(const OUString& aKey)
55
5.81k
{
56
5.81k
    mStack.push(mCurrentElement);
57
5.81k
    mCurrentElement.maElementName = aKey;
58
5.81k
    mCurrentElement.maPropertyList.clear();
59
5.81k
}
60
61
void GrabBagStack::pop()
62
5.81k
{
63
5.81k
    OUString aName = mCurrentElement.maElementName;
64
5.81k
    Sequence<PropertyValue> aSequence(comphelper::containerToSequence(mCurrentElement.maPropertyList));
65
5.81k
    mCurrentElement = mStack.top();
66
5.81k
    mStack.pop();
67
5.81k
    appendElement(aName, Any(aSequence));
68
5.81k
}
69
70
void GrabBagStack::addInt32(const OUString& aElementName, sal_Int32 aIntValue)
71
3.97k
{
72
3.97k
    appendElement(aElementName, Any(aIntValue));
73
3.97k
}
74
75
void GrabBagStack::addString(const OUString& aElementName, const OUString& aStringValue)
76
918
{
77
918
    appendElement(aElementName, Any(aStringValue));
78
918
}
79
80
} // namespace oox
81
82
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */