diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-03-07 16:40:33 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-03-07 16:48:23 +0100 |
commit | 5797d7633419bb1775056d513e89d1fc0ce461e0 (patch) | |
tree | dbb5f47b493fae870a236c10a132e4e3f7eecbc6 /writerfilter/source/dmapper/TextEffectsHandler.cxx | |
parent | 25d154bbf94157f0bdf71a71964409857634c570 (diff) |
ooxml: make GrabBagStack ready for reuse and move it to oox
Change-Id: Ia7d52a003138a275860d3462382e636747343488
Diffstat (limited to 'writerfilter/source/dmapper/TextEffectsHandler.cxx')
-rw-r--r-- | writerfilter/source/dmapper/TextEffectsHandler.cxx | 90 |
1 files changed, 2 insertions, 88 deletions
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx index 2d4c32b936b6..ef8efc8b4b94 100644 --- a/writerfilter/source/dmapper/TextEffectsHandler.cxx +++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx @@ -9,107 +9,21 @@ */ #include <TextEffectsHandler.hxx> + #include <rtl/ustrbuf.hxx> #include <comphelper/string.hxx> #include <ooxml/resourceids.hxx> #include "dmapperLoggers.hxx" -#include <map> -#include <stack> -#include <vector> namespace writerfilter { namespace dmapper { using namespace std; +using namespace oox; using namespace css::uno; using namespace css::beans; -struct GrabBagStackElement -{ - OUString maName; - std::vector<beans::PropertyValue> maPropertyList; -}; - -/// Tool that is useful for construction of a nested Sequence/PropertyValue hierarchy -class GrabBagStack -{ -public: - GrabBagStack(OUString aName) - { - mCurrentElement.maName = aName; - } - - virtual ~GrabBagStack() - {} - - std::stack<GrabBagStackElement> mStack; - GrabBagStackElement mCurrentElement; - - OUString getCurrentName() - { - return mCurrentElement.maName; - } - - PropertyValue getRootProperty() - { - while(!mStack.empty()) - pop(); - - PropertyValue aProperty; - aProperty.Name = mCurrentElement.maName; - - Sequence<PropertyValue> aSequence(mCurrentElement.maPropertyList.size()); - PropertyValue* pSequence = aSequence.getArray(); - std::vector<PropertyValue>::iterator i; - for (i = mCurrentElement.maPropertyList.begin(); i != mCurrentElement.maPropertyList.end(); ++i) - *pSequence++ = *i; - - aProperty.Value = makeAny(aSequence); - - return aProperty; - } - - void appendElement(OUString aName, Any aAny) - { - PropertyValue aValue; - aValue.Name = aName; - aValue.Value = aAny; - mCurrentElement.maPropertyList.push_back(aValue); - } - - void push(OUString aKey) - { - mStack.push(mCurrentElement); - mCurrentElement.maName = aKey; - mCurrentElement.maPropertyList.clear(); - } - - void pop() - { - OUString aName = mCurrentElement.maName; - Sequence<PropertyValue> aSequence(mCurrentElement.maPropertyList.size()); - PropertyValue* pSequence = aSequence.getArray(); - std::vector<PropertyValue>::iterator i; - for (i = mCurrentElement.maPropertyList.begin(); i != mCurrentElement.maPropertyList.end(); ++i) - *pSequence++ = *i; - - mCurrentElement = mStack.top(); - mStack.pop(); - appendElement(aName, makeAny(aSequence)); - } - - void addInt32(OUString aElementName, sal_Int32 aIntValue) - { - appendElement(aElementName, makeAny(aIntValue)); - } - - void addString(OUString aElementName, OUString aStringValue) - { - appendElement(aElementName, makeAny(aStringValue)); - } -}; - namespace { |