[Libreoffice-commits] core.git: 2 commits - include/oox oox/Library_oox.mk oox/source sw/source writerfilter/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Fri Mar 7 07:48:50 PST 2014
include/oox/helper/grabbagstack.hxx | 56 ++++++++++++
oox/Library_oox.mk | 1
oox/source/helper/grabbagstack.cxx | 93 +++++++++++++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 5 -
writerfilter/source/dmapper/TextEffectsHandler.cxx | 90 --------------------
writerfilter/source/dmapper/TextEffectsHandler.hxx | 10 +-
6 files changed, 161 insertions(+), 94 deletions(-)
New commits:
commit 04cc0939abcf55debd2b15efea9b310196259093
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Mar 7 16:46:22 2014 +0100
ooxml export: add w14 namespace to styles.xml
Change-Id: I60df6ce655cb5bbb05218ec89a1597a277e7aa72
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index dad9d27..f51d892 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2889,7 +2889,10 @@ void DocxAttributeOutput::TableRowEnd( sal_uInt32 /*nDepth*/ )
void DocxAttributeOutput::StartStyles()
{
m_pSerializer->startElementNS( XML_w, XML_styles,
- FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ FSNS( XML_xmlns, XML_w14 ), "http://schemas.microsoft.com/office/word/2010/wordml",
+ FSNS( XML_xmlns, XML_mc ), "http://schemas.openxmlformats.org/markup-compatibility/2006",
+ FSNS( XML_mc, XML_Ignorable ), "w14",
FSEND );
DocDefaults();
commit 5797d7633419bb1775056d513e89d1fc0ce461e0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Fri Mar 7 16:40:33 2014 +0100
ooxml: make GrabBagStack ready for reuse and move it to oox
Change-Id: Ia7d52a003138a275860d3462382e636747343488
diff --git a/include/oox/helper/grabbagstack.hxx b/include/oox/helper/grabbagstack.hxx
new file mode 100644
index 0000000..b438ac8
--- /dev/null
+++ b/include/oox/helper/grabbagstack.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_HELPER_GRABBAGSTACK_HXX
+#define INCLUDED_OOX_HELPER_GRABBAGSTACK_HXX
+
+#include <oox/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <vector>
+#include <stack>
+
+namespace oox {
+
+struct GrabBagStackElement
+{
+ OUString maName;
+ std::vector<css::beans::PropertyValue> maPropertyList;
+};
+
+/// Tool that is useful for construction of a nested Sequence/PropertyValue hierarchy
+class OOX_DLLPUBLIC GrabBagStack
+{
+private:
+ std::stack<GrabBagStackElement> mStack;
+ GrabBagStackElement mCurrentElement;
+
+public:
+ GrabBagStack(OUString aName);
+
+ virtual ~GrabBagStack();
+
+ OUString getCurrentName();
+
+ css::beans::PropertyValue getRootProperty();
+
+ void appendElement(OUString aName, css::uno::Any aAny);
+ void push(OUString aKey);
+ void pop();
+ void addInt32(OUString aElementName, sal_Int32 aIntValue);
+ void addString(OUString aElementName, OUString aStringValue);
+};
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index d176267..cdda38a 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -217,6 +217,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
oox/source/helper/binarystreambase \
oox/source/helper/containerhelper \
oox/source/helper/graphichelper \
+ oox/source/helper/grabbagstack \
oox/source/helper/modelobjecthelper \
oox/source/helper/progressbar \
oox/source/helper/propertymap \
diff --git a/oox/source/helper/grabbagstack.cxx b/oox/source/helper/grabbagstack.cxx
new file mode 100644
index 0000000..ee7ec70
--- /dev/null
+++ b/oox/source/helper/grabbagstack.cxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include "oox/helper/grabbagstack.hxx"
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace oox
+{
+
+using namespace css::beans;
+using namespace css::uno;
+
+GrabBagStack::GrabBagStack(OUString aName)
+{
+ mCurrentElement.maName = aName;
+}
+
+GrabBagStack::~GrabBagStack()
+{}
+
+OUString GrabBagStack::getCurrentName()
+{
+ return mCurrentElement.maName;
+}
+
+PropertyValue GrabBagStack::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 GrabBagStack::appendElement(OUString aName, Any aAny)
+{
+ PropertyValue aValue;
+ aValue.Name = aName;
+ aValue.Value = aAny;
+ mCurrentElement.maPropertyList.push_back(aValue);
+}
+
+void GrabBagStack::push(OUString aKey)
+{
+ mStack.push(mCurrentElement);
+ mCurrentElement.maName = aKey;
+ mCurrentElement.maPropertyList.clear();
+}
+
+void GrabBagStack::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 GrabBagStack::addInt32(OUString aElementName, sal_Int32 aIntValue)
+{
+ appendElement(aElementName, makeAny(aIntValue));
+}
+
+void GrabBagStack::addString(OUString aElementName, OUString aStringValue)
+{
+ appendElement(aElementName, makeAny(aStringValue));
+}
+
+} // namespace oox
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx
index 2d4c32b..ef8efc8 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
{
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.hxx b/writerfilter/source/dmapper/TextEffectsHandler.hxx
index 1406359..4d402b4 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.hxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.hxx
@@ -20,6 +20,8 @@
#include <PropertyIds.hxx>
+#include <oox/helper/grabbagstack.hxx>
+
#include <boost/scoped_ptr.hpp>
#include <boost/optional.hpp>
@@ -27,15 +29,13 @@ namespace writerfilter {
namespace dmapper
{
-class GrabBagStack;
-
/// Class to process all text effects like glow, textOutline, ...
class TextEffectsHandler : public LoggedProperties
{
private:
- boost::optional<PropertyIds> maPropertyId;
- OUString maElementName;
- boost::scoped_ptr<GrabBagStack> mpGrabBagStack;
+ boost::optional<PropertyIds> maPropertyId;
+ OUString maElementName;
+ boost::scoped_ptr<oox::GrabBagStack> mpGrabBagStack;
void convertElementIdToPropertyId(sal_Int32 aElementId);
More information about the Libreoffice-commits
mailing list