summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--writerfilter/Library_writerfilter.mk1
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx19
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
-rw-r--r--writerfilter/source/dmapper/TextEffectsHandler.cxx226
-rw-r--r--writerfilter/source/dmapper/TextEffectsHandler.hxx52
6 files changed, 300 insertions, 0 deletions
diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk
index 855f013ea0fb..592970ec559c 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -122,6 +122,7 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/dmapper/TDefTableHandler \
writerfilter/source/dmapper/TablePositionHandler \
writerfilter/source/dmapper/TablePropertiesHandler \
+ writerfilter/source/dmapper/TextEffectsHandler \
writerfilter/source/dmapper/TblStylePrHandler \
writerfilter/source/dmapper/ThemeTable \
writerfilter/source/dmapper/WrapPolygonHandler \
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 3ac0ac334726..9d8754ab7684 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -62,6 +62,7 @@
#include <comphelper/storagehelper.hxx>
#include <filter/msfilter/util.hxx>
+#include <TextEffectsHandler.hxx>
#include <CellColorHandler.hxx>
#include <SectionColumnHandler.hxx>
#include <GraphicHelpers.hxx>
@@ -2340,6 +2341,24 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
case NS_ooxml::LN_tblEnd:
m_pImpl->m_nTableDepth--;
break;
+ case NS_ooxml::LN_glow_glow:
+ {
+ writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
+ if( pProperties.get())
+ {
+ TextEffectsHandlerPtr pTextEffectsHandlerPtr( new TextEffectsHandler );
+ sal_Bool bEnableTempGrabBag = !pTextEffectsHandlerPtr->isInteropGrabBagEnabled();
+ if( bEnableTempGrabBag )
+ pTextEffectsHandlerPtr->enableInteropGrabBag( "glow" );
+
+ pProperties->resolve(*pTextEffectsHandlerPtr);
+
+ rContext->Insert(PROP_CHAR_GLOW_TEXT_EFFECT, pTextEffectsHandlerPtr->getInteropGrabBag().Value, true, CHAR_GRAB_BAG);
+ if(bEnableTempGrabBag)
+ pTextEffectsHandlerPtr->disableInteropGrabBag();
+ }
+ }
+ break;
default:
{
#ifdef DEBUG_DOMAINMAPPER
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 9ae0d50a0ff9..ce007e230e0f 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -376,6 +376,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_TOC_NEW_LINE: sName = "TOCNewLine"; break;
case PROP_TOC_PARAGRAPH_OUTLINE_LEVEL : sName = "TOCParagraphOutlineLevel"; break;
case PROP_CHAR_THEME_COLOR_TINT : sName = "CharThemeColorTint"; break;
+ case PROP_CHAR_GLOW_TEXT_EFFECT : sName = "CharGlowTextEffect"; break;
}
::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index ce2459c6a654..c8155b1be18d 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -347,6 +347,7 @@ enum PropertyIds
,PROP_TOC_NEW_LINE
,PROP_TOC_PARAGRAPH_OUTLINE_LEVEL
,PROP_CHAR_THEME_COLOR_TINT
+ ,PROP_CHAR_GLOW_TEXT_EFFECT
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx
new file mode 100644
index 000000000000..6596a3501251
--- /dev/null
+++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx
@@ -0,0 +1,226 @@
+/* -*- 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 <TextEffectsHandler.hxx>
+#include <ooxml/resourceids.hxx>
+#include "dmapperLoggers.hxx"
+
+#include <stack>
+
+
+namespace writerfilter {
+namespace dmapper
+{
+
+using namespace std;
+using namespace css::uno;
+using namespace css::beans;
+
+struct GrabBagStackElement
+{
+ OUString maName;
+ std::vector<beans::PropertyValue> maPropertyList;
+};
+
+class GrabBagStack
+{
+public:
+ GrabBagStack(OUString aName)
+ {
+ mCurrentElement.maName = aName;
+ }
+
+ virtual ~GrabBagStack()
+ {}
+
+ std::stack<GrabBagStackElement> mStack;
+ GrabBagStackElement mCurrentElement;
+
+ 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));
+ }
+};
+
+TextEffectsHandler::TextEffectsHandler() :
+ LoggedProperties(dmapper_logger, "TextEffectsHandler"),
+ mpGrabBagStack(NULL)
+{
+}
+
+TextEffectsHandler::~TextEffectsHandler()
+{
+}
+
+void TextEffectsHandler::lcl_attribute(Id aName, Value& aValue)
+{
+ OUString sValue = aValue.getString();
+ sal_Int32 nValue = aValue.getInt();
+ switch(aName)
+ {
+ case NS_ooxml::LN_CT_Percentage_val:
+ mpGrabBagStack->appendElement("val", makeAny(nValue));
+ break;
+ case NS_ooxml::LN_CT_PositiveFixedPercentage_val:
+ mpGrabBagStack->appendElement("val", makeAny(nValue));
+ break;
+ case NS_ooxml::LN_CT_SchemeColor_val:
+ mpGrabBagStack->appendElement("val", makeAny(nValue));
+ break;
+ case NS_ooxml::LN_CT_Glow_rad:
+ mpGrabBagStack->appendElement("rad", makeAny(nValue));
+ break;
+ default:
+ break;
+ }
+}
+
+void TextEffectsHandler::lcl_sprm(Sprm& rSprm)
+{
+ sal_uInt32 nSprmId = rSprm.getId();
+
+ switch(nSprmId)
+ {
+ case NS_ooxml::LN_EG_ColorChoice_srgbClr:
+ mpGrabBagStack->push("srgbClr");
+ break;
+ case NS_ooxml::LN_EG_ColorChoice_schemeClr:
+ mpGrabBagStack->push("schemeClr");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_tint:
+ mpGrabBagStack->push("tint");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_shade:
+ mpGrabBagStack->push("shade");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_alpha:
+ mpGrabBagStack->push("alpha");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_hueMod:
+ mpGrabBagStack->push("hueMod");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_sat:
+ mpGrabBagStack->push("sat");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_satOff:
+ mpGrabBagStack->push("satOff");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_satMod:
+ mpGrabBagStack->push("satMod");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_lum:
+ mpGrabBagStack->push("lum");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_lumOff:
+ mpGrabBagStack->push("lumOff");
+ break;
+ case NS_ooxml::LN_EG_ColorTransform_lumMod:
+ mpGrabBagStack->push("lumMod");
+ break;
+
+ default:
+ break;
+ }
+
+ writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
+ if( !pProperties.get())
+ return;
+
+ pProperties.get()->resolve( *this );
+
+ switch(nSprmId)
+ {
+ case NS_ooxml::LN_EG_ColorChoice_srgbClr:
+ case NS_ooxml::LN_EG_ColorChoice_schemeClr:
+ case NS_ooxml::LN_EG_ColorTransform_tint:
+ case NS_ooxml::LN_EG_ColorTransform_shade:
+ case NS_ooxml::LN_EG_ColorTransform_alpha:
+ case NS_ooxml::LN_EG_ColorTransform_hueMod:
+ case NS_ooxml::LN_EG_ColorTransform_sat:
+ case NS_ooxml::LN_EG_ColorTransform_satOff:
+ case NS_ooxml::LN_EG_ColorTransform_satMod:
+ case NS_ooxml::LN_EG_ColorTransform_lum:
+ case NS_ooxml::LN_EG_ColorTransform_lumOff:
+ case NS_ooxml::LN_EG_ColorTransform_lumMod:
+ mpGrabBagStack->pop();
+ break;
+ }
+}
+
+beans::PropertyValue TextEffectsHandler::getInteropGrabBag()
+{
+ beans::PropertyValue aReturn = mpGrabBagStack->getRootProperty();
+ mpGrabBagStack.reset();
+ return aReturn;
+}
+
+void TextEffectsHandler::enableInteropGrabBag(OUString aName)
+{
+ mpGrabBagStack.reset(new GrabBagStack(aName));
+}
+
+void TextEffectsHandler::disableInteropGrabBag()
+{
+ mpGrabBagStack.reset();
+}
+
+bool TextEffectsHandler::isInteropGrabBagEnabled()
+{
+ return mpGrabBagStack.get() != NULL;
+}
+
+
+}//namespace dmapper
+} //namespace writerfilter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.hxx b/writerfilter/source/dmapper/TextEffectsHandler.hxx
new file mode 100644
index 000000000000..89c56260cd09
--- /dev/null
+++ b/writerfilter/source/dmapper/TextEffectsHandler.hxx
@@ -0,0 +1,52 @@
+/* -*- 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_TEXTEFFECTSHANDLER_HXX
+#define INCLUDED_TEXTEFFECTSHANDLER_HXX
+
+#include <WriterFilterDllApi.hxx>
+#include <resourcemodel/LoggedResources.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <i18nlangtag/languagetag.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace writerfilter {
+namespace dmapper
+{
+
+class GrabBagStack;
+
+class TextEffectsHandler : public LoggedProperties
+{
+private:
+ boost::scoped_ptr<GrabBagStack> mpGrabBagStack;
+
+ // LoggedProperties
+ virtual void lcl_attribute(Id aName, Value& aValue);
+ virtual void lcl_sprm(Sprm& sprm);
+
+public:
+ TextEffectsHandler();
+ virtual ~TextEffectsHandler();
+
+ css::beans::PropertyValue getInteropGrabBag();
+ void enableInteropGrabBag(OUString aName);
+ void disableInteropGrabBag();
+ bool isInteropGrabBagEnabled();
+};
+
+typedef boost::shared_ptr<TextEffectsHandler> TextEffectsHandlerPtr;
+
+}}
+
+#endif // INCLUDED_TEXTEFFECTSHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */