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>
13 #include <comphelper/sequence.hxx>
18 using namespace css::beans
;
19 using namespace css::uno
;
21 GrabBagStack::GrabBagStack(const OUString
& aElementName
)
23 mCurrentElement
.maElementName
= aElementName
;
26 GrabBagStack::~GrabBagStack()
29 bool GrabBagStack::isStackEmpty() const
31 return mStack
.empty();
34 PropertyValue
GrabBagStack::getRootProperty()
36 while(!mStack
.empty())
39 PropertyValue aProperty
;
40 aProperty
.Name
= mCurrentElement
.maElementName
;
41 aProperty
.Value
<<= comphelper::containerToSequence(mCurrentElement
.maPropertyList
);
46 void GrabBagStack::appendElement(const OUString
& aName
, const Any
& aAny
)
51 mCurrentElement
.maPropertyList
.push_back(aValue
);
54 void GrabBagStack::push(const OUString
& aKey
)
56 mStack
.push(mCurrentElement
);
57 mCurrentElement
.maElementName
= aKey
;
58 mCurrentElement
.maPropertyList
.clear();
61 void GrabBagStack::pop()
63 OUString aName
= mCurrentElement
.maElementName
;
64 Sequence
<PropertyValue
> aSequence(comphelper::containerToSequence(mCurrentElement
.maPropertyList
));
65 mCurrentElement
= mStack
.top();
67 appendElement(aName
, Any(aSequence
));
70 void GrabBagStack::addInt32(const OUString
& aElementName
, sal_Int32 aIntValue
)
72 appendElement(aElementName
, Any(aIntValue
));
75 void GrabBagStack::addString(const OUString
& aElementName
, const OUString
& aStringValue
)
77 appendElement(aElementName
, Any(aStringValue
));
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */