1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #include "oox/helper/grabbagstack.hxx"
12 #include <com/sun/star/uno/Sequence.hxx>
17 using namespace css::beans
;
18 using namespace css::uno
;
20 GrabBagStack::GrabBagStack(const OUString
& aName
)
22 mCurrentElement
.maName
= aName
;
25 GrabBagStack::~GrabBagStack()
28 bool GrabBagStack::isStackEmpty()
30 return mStack
.empty();
33 PropertyValue
GrabBagStack::getRootProperty()
35 while(!mStack
.empty())
38 PropertyValue aProperty
;
39 aProperty
.Name
= mCurrentElement
.maName
;
41 Sequence
<PropertyValue
> aSequence(mCurrentElement
.maPropertyList
.size());
42 PropertyValue
* pSequence
= aSequence
.getArray();
43 std::vector
<PropertyValue
>::iterator i
;
44 for (i
= mCurrentElement
.maPropertyList
.begin(); i
!= mCurrentElement
.maPropertyList
.end(); ++i
)
47 aProperty
.Value
= makeAny(aSequence
);
52 void GrabBagStack::appendElement(const OUString
& aName
, Any aAny
)
57 mCurrentElement
.maPropertyList
.push_back(aValue
);
60 void GrabBagStack::push(const OUString
& aKey
)
62 mStack
.push(mCurrentElement
);
63 mCurrentElement
.maName
= aKey
;
64 mCurrentElement
.maPropertyList
.clear();
67 void GrabBagStack::pop()
69 OUString aName
= mCurrentElement
.maName
;
70 Sequence
<PropertyValue
> aSequence(mCurrentElement
.maPropertyList
.size());
71 PropertyValue
* pSequence
= aSequence
.getArray();
72 std::vector
<PropertyValue
>::iterator i
;
73 for (i
= mCurrentElement
.maPropertyList
.begin(); i
!= mCurrentElement
.maPropertyList
.end(); ++i
)
76 mCurrentElement
= mStack
.top();
78 appendElement(aName
, makeAny(aSequence
));
81 void GrabBagStack::addInt32(const OUString
& aElementName
, sal_Int32 aIntValue
)
83 appendElement(aElementName
, makeAny(aIntValue
));
86 void GrabBagStack::addString(const OUString
& aElementName
, const OUString
& aStringValue
)
88 appendElement(aElementName
, makeAny(aStringValue
));
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */