sd: keep a non-owning pointer to the OverridingShell
[LibreOffice.git] / oox / source / helper / grabbagstack.cxx
blob761fc9644a66d0b26e45a3a734fb043258519628
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 */
11 #include <oox/helper/grabbagstack.hxx>
12 #include <com/sun/star/uno/Sequence.hxx>
13 #include <comphelper/sequence.hxx>
15 namespace oox
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())
37 pop();
39 PropertyValue aProperty;
40 aProperty.Name = mCurrentElement.maElementName;
41 aProperty.Value <<= comphelper::containerToSequence(mCurrentElement.maPropertyList);
43 return aProperty;
46 void GrabBagStack::appendElement(const OUString& aName, const Any& aAny)
48 PropertyValue aValue;
49 aValue.Name = aName;
50 aValue.Value = 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();
66 mStack.pop();
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));
80 } // namespace oox
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */