Kaydet (Commit) 19594315 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

oox: handle all w14 text effects at groupshape import

When dealing with groupshapes, the responsibility to process the
w14 text effects elements is in oox. This commit adds the code
to handle all elements and its children elements and attributes and
puts the values into a CharInteropGrabBag.

Change-Id: Iafb8759bd60e0ee831296dc2d9159f4311ad5403
üst d665e63b
......@@ -57,6 +57,8 @@ struct TextCharacterProperties
OptValue< bool > moUnderlineLineFollowText;
OptValue< bool > moUnderlineFillFollowText;
std::vector<css::beans::PropertyValue> maTextEffectsProperties;
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const TextCharacterProperties& rSourceProps );
......
/* -*- 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_DRAWINGML_TEXTEFFECTSCONTEXT_HXX
#define INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX
#include <com/sun/star/beans/PropertyValue.hpp>
#include <oox/helper/grabbagstack.hxx>
#include <oox/core/contexthandler2.hxx>
#include <boost/scoped_ptr.hpp>
#include <vector>
namespace oox { namespace drawingml {
class TextEffectsContext : public oox::core::ContextHandler2
{
public:
TextEffectsContext(oox::core::ContextHandler2Helper& rParent,
sal_Int32 aElementToken,
std::vector<css::beans::PropertyValue>& rTextEffectsProperties);
virtual ~TextEffectsContext();
virtual void onStartElement(const oox::AttributeList& rAttribs) SAL_OVERRIDE;
virtual void onEndElement() SAL_OVERRIDE;
virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 Element, const oox::AttributeList& rAttribs) SAL_OVERRIDE;
protected:
std::vector<css::beans::PropertyValue>& mrTextEffectsProperties;
boost::scoped_ptr<oox::GrabBagStack> mpGrabBagStack;
sal_Int32 mnCurrentElement;
private:
void processAttributes(const AttributeList& rAttribs);
void pushAttributeToGrabBag (const sal_Int32& aAttributeId, const OUString& rElementName, const AttributeList& rAttribs);
};
} }
#endif // INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -187,6 +187,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
oox/source/drawingml/textbodyproperties \
oox/source/drawingml/textcharacterpropertiescontext \
oox/source/drawingml/textcharacterproperties \
oox/source/drawingml/texteffectscontext \
oox/source/drawingml/textfieldcontext \
oox/source/drawingml/textfield \
oox/source/drawingml/textfont \
......
......@@ -63,6 +63,8 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource
moItalic.assignIfUsed( rSourceProps.moItalic );
moUnderlineLineFollowText.assignIfUsed( rSourceProps.moUnderlineLineFollowText );
moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText );
maTextEffectsProperties = rSourceProps.maTextEffectsProperties;
}
void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBase& rFilter, bool bUseOptional ) const
......@@ -159,11 +161,30 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
}
}
void TextCharacterProperties::pushToPropSet( PropertySet& rPropSet, const XmlFilterBase& rFilter, bool bUseOptional ) const
void pushToGrabBag( PropertySet& rPropSet, const std::vector<PropertyValue>& aVectorOfProperyValues )
{
Sequence<PropertyValue> aGrabBag;
Any aAnyGrabBag = rPropSet.getAnyProperty(PROP_CharInteropGrabBag);
aAnyGrabBag >>= aGrabBag;
sal_Int32 nLength = aGrabBag.getLength();
aGrabBag.realloc(nLength + aVectorOfProperyValues.size());
for (size_t i = 0; i < aVectorOfProperyValues.size(); i++)
{
PropertyValue aPropertyValue = aVectorOfProperyValues[i];
aGrabBag[nLength + i] = aPropertyValue;
}
rPropSet.setAnyProperty(PROP_CharInteropGrabBag, makeAny(aGrabBag));
}
void TextCharacterProperties::pushToPropSet( PropertySet& rPropSet, const XmlFilterBase& rFilter, bool bUseOptional ) const
{
PropertyMap aPropMap;
pushToPropMap( aPropMap, rFilter, bUseOptional );
rPropSet.setProperties( aPropMap );
pushToGrabBag(rPropSet, maTextEffectsProperties);
}
float TextCharacterProperties::getCharHeightPoints( float fDefault ) const
......
......@@ -22,6 +22,7 @@
#include "oox/helper/attributelist.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/colorchoicecontext.hxx"
#include "oox/drawingml/texteffectscontext.hxx"
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/textparagraphproperties.hxx"
#include "oox/core/relations.hxx"
......@@ -194,6 +195,22 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
mrTextCharacterProperties.moCaseMap = XML_none;
}
break;
case OOX_TOKEN(w14, glow):
case OOX_TOKEN(w14, shadow):
case OOX_TOKEN(w14, reflection):
case OOX_TOKEN(w14, textOutline):
case OOX_TOKEN(w14, textFill):
case OOX_TOKEN(w14, scene3d):
case OOX_TOKEN(w14, props3d):
case OOX_TOKEN(w14, ligatures):
case OOX_TOKEN(w14, numForm):
case OOX_TOKEN(w14, numSpacing):
case OOX_TOKEN(w14, stylisticSets):
case OOX_TOKEN(w14, cntxtAlts):
{
return new TextEffectsContext( *this, aElementToken, mrTextCharacterProperties.maTextEffectsProperties );
}
break;
default:
SAL_WARN("oox", "TextCharacterPropertiesContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
break;
......
This diff is collapsed.
......@@ -71,6 +71,7 @@ CharFontPitchComplex
CharHeight
CharHeightAsian
CharHeightComplex
CharInteropGrabBag
CharKerning
CharLocale
CharLocaleAsian
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment