ooo-build r15440 - trunk/patches/dev300
- From: cbosdo svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15440 - trunk/patches/dev300
- Date: Tue, 3 Mar 2009 10:16:01 +0000 (UTC)
Author: cbosdo
Date: Tue Mar 3 10:16:01 2009
New Revision: 15440
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15440&view=rev
Log:
Fix for the pictures import positionning in docx
Added:
trunk/patches/dev300/writerfilter-docx-import-graphics.diff
Modified:
trunk/patches/dev300/apply
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Tue Mar 3 10:16:01 2009
@@ -1909,6 +1909,7 @@
writerfilter-docx-import-tables.diff, i#90093, cbosdo
sw-docx-import-tables.diff, i#90093, cbosdo
writerfilter-source-dmapper-domainmapper-debug.diff
+writerfilter-docx-import-graphics.diff, i#96021, i#97645, cbosdo
buildfix-oox-depends-on-unotools.diff
Added: trunk/patches/dev300/writerfilter-docx-import-graphics.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/writerfilter-docx-import-graphics.diff Tue Mar 3 10:16:01 2009
@@ -0,0 +1,729 @@
+diff --git writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx
+index 7508531..ee73b1f 100644
+--- writerfilter/source/dmapper/DomainMapper_Impl.cxx
++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx
+@@ -1432,7 +1432,8 @@ void DomainMapper_Impl::PushShapeContext()
+ uno::Reference< text::XTextAppend > xShapeAppend( xTemporaryShape, uno::UNO_QUERY );
+ //insert into the document
+ uno::Reference< text::XTextContent > xShapeContent( xTemporaryShape, uno::UNO_QUERY_THROW );
+- xShapeContent->attach( GetBodyText()->getStart() );
++ // TODO Is it enought to comment this line?
++ //xShapeContent->attach( GetBodyText()->getStart() );
+ m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xShapeAppend, uno::UNO_QUERY_THROW ));
+ }
+ catch( uno::Exception& )
+diff --git writerfilter/source/dmapper/GraphicHelpers.cxx writerfilter/source/dmapper/GraphicHelpers.cxx
+new file mode 100644
+index 0000000..9dedce1
+--- /dev/null
++++ writerfilter/source/dmapper/GraphicHelpers.cxx
+@@ -0,0 +1,159 @@
++#include "ConversionHelper.hxx"
++#include "GraphicHelpers.hxx"
++
++#include <ooxml/resourceids.hxx>
++
++#include <com/sun/star/text/HoriOrientation.hpp>
++#include <com/sun/star/text/VertOrientation.hpp>
++#include <com/sun/star/text/RelOrientation.hpp>
++
++#include <iostream>
++using namespace std;
++
++namespace writerfilter {
++namespace dmapper {
++
++using namespace com::sun::star;
++
++PositionHandler::PositionHandler( ) :
++ Properties( )
++{
++ m_nOrient = text::VertOrientation::NONE;
++ m_nRelation = text::RelOrientation::FRAME;
++ m_nPosition = 0;
++}
++
++PositionHandler::~PositionHandler( )
++{
++}
++
++void PositionHandler::attribute( Id aName, Value& rVal )
++{
++ sal_Int32 nIntValue = rVal.getInt( );
++ switch ( aName )
++ {
++ case NS_ooxml::LN_CT_PosV_relativeFrom:
++ {
++ // TODO There are some other unhandled values
++ static Id pVertRelValues[] =
++ {
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line
++ };
++
++ static sal_Int16 pVertRelations[] =
++ {
++ text::RelOrientation::PAGE_PRINT_AREA,
++ text::RelOrientation::PAGE_FRAME,
++ text::RelOrientation::FRAME,
++ text::RelOrientation::TEXT_LINE
++ };
++
++ for ( int i = 0; i < 4; i++ )
++ {
++ if ( pVertRelValues[i] == sal_uInt32( nIntValue ) )
++ m_nRelation = pVertRelations[i];
++ }
++ }
++ break;
++ case NS_ooxml::LN_CT_PosH_relativeFrom:
++ {
++ // TODO There are some other unhandled values
++ static Id pHoriRelValues[] =
++ {
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_column,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_character
++ };
++
++ static sal_Int16 pHoriRelations[] =
++ {
++ text::RelOrientation::PAGE_PRINT_AREA,
++ text::RelOrientation::PAGE_FRAME,
++ text::RelOrientation::FRAME,
++ text::RelOrientation::CHAR,
++ };
++
++ for ( int i = 0; i < 4; i++ )
++ {
++ if ( pHoriRelValues[i] == sal_uInt32( nIntValue ) )
++ m_nRelation = pHoriRelations[i];
++ }
++ }
++ break;
++ default:;
++ }
++}
++
++void PositionHandler::sprm( Sprm& rSprm )
++{
++ Value::Pointer_t pValue = rSprm.getValue();
++ sal_Int32 nIntValue = pValue->getInt();
++
++ switch ( rSprm.getId( ) )
++ {
++ case NS_ooxml::LN_CT_PosV_align:
++ {
++ static Id pVertValues[] =
++ {
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_top,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_bottom,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_center,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_inside,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_outside
++ };
++
++ static sal_Int16 pVertOrients[] =
++ {
++ text::VertOrientation::TOP,
++ text::VertOrientation::BOTTOM,
++ text::VertOrientation::CENTER,
++ text::VertOrientation::NONE,
++ text::VertOrientation::NONE
++ };
++
++ for ( int i = 0; i < 5; i++ )
++ {
++ if ( pVertValues[i] == sal_uInt32( nIntValue ) )
++ m_nOrient = pVertOrients[i];
++ }
++ }
++ break;
++ case NS_ooxml::LN_CT_PosH_align:
++ {
++ static Id pHoriValues[] =
++ {
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_left,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_right,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_center,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_inside,
++ NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_outside
++ };
++
++ static sal_Int16 pHoriOrients[] =
++ {
++ text::HoriOrientation::LEFT,
++ text::HoriOrientation::RIGHT,
++ text::HoriOrientation::CENTER,
++ text::HoriOrientation::INSIDE,
++ text::HoriOrientation::OUTSIDE
++ };
++
++ for ( int i = 0; i < 5; i++ )
++ {
++ if ( pHoriValues[i] == sal_uInt32( nIntValue ) )
++ m_nOrient = pHoriOrients[i];
++ }
++ }
++ break;
++ case NS_ooxml::LN_CT_PosH_posOffset:
++ case NS_ooxml::LN_CT_PosV_posOffset:
++ m_nPosition = ConversionHelper::convertEMUToMM100( nIntValue );
++ default:;
++ }
++}
++
++} }
+diff --git writerfilter/source/dmapper/GraphicHelpers.hxx writerfilter/source/dmapper/GraphicHelpers.hxx
+new file mode 100644
+index 0000000..1335e68
+--- /dev/null
++++ writerfilter/source/dmapper/GraphicHelpers.hxx
+@@ -0,0 +1,32 @@
++#ifndef INCLUDED_GRAPHICHELPERS_HXX
++#define INCLUDED_GRAPHICHELPERS_HXX
++
++#include "PropertyMap.hxx"
++
++#include <WriterFilterDllApi.hxx>
++#include <resourcemodel/WW8ResourceModel.hxx>
++
++#include <boost/shared_ptr.hpp>
++
++namespace writerfilter {
++namespace dmapper
++{
++
++class WRITERFILTER_DLLPRIVATE PositionHandler: public Properties
++{
++public:
++ PositionHandler( );
++ ~PositionHandler( );
++
++ sal_Int16 m_nOrient;
++ sal_Int16 m_nRelation;
++ sal_Int32 m_nPosition;
++
++ virtual void attribute( Id aName, Value& rVal );
++ virtual void sprm( Sprm& rSprm );
++};
++typedef boost::shared_ptr<PositionHandler> PositionHandlerPtr;
++
++} }
++
++#endif
+diff --git writerfilter/source/dmapper/GraphicImport.cxx writerfilter/source/dmapper/GraphicImport.cxx
+index c234d69..a26da3f 100644
+--- writerfilter/source/dmapper/GraphicImport.cxx
++++ writerfilter/source/dmapper/GraphicImport.cxx
+@@ -29,7 +29,9 @@
+ *
+ ************************************************************************/
+
+-#include <GraphicImport.hxx>
++#include "GraphicImport.hxx"
++#include "GraphicHelpers.hxx"
++
+ #include <dmapper/DomainMapper.hxx>
+ #include <PropertyMap.hxx>
+ #include <doctok/resourceids.hxx>
+@@ -995,35 +997,79 @@ void GraphicImport::attribute(Id nName, Value & val)
+ case NS_ooxml::LN_shape:
+ /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
+ {
+- val.getAny() >>= m_xShape;
+-
+- if (m_xShape.is())
+- {
+- uno::Reference< beans::XPropertySet > xShapeProps
+- (m_xShape, uno::UNO_QUERY_THROW);
+-
+- PropertyNameSupplier& rPropNameSupplier =
+- PropertyNameSupplier::GetPropertyNameSupplier();
+- xShapeProps->setPropertyValue
+- (rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
+- uno::makeAny
+- (text::TextContentAnchorType_AS_CHARACTER));
+- xShapeProps->setPropertyValue
+- (rPropNameSupplier.GetName(PROP_TEXT_RANGE),
+- uno::makeAny
+- (m_pImpl->rDomainMapper.GetCurrentTextRange()));
+-
+- awt::Point aPoint(m_xShape->getPosition());
+- awt::Size aSize(m_xShape->getSize());
+-
+- if (m_pImpl->isXSizeValid())
+- aSize.Width = m_pImpl->getXSize();
+- if (m_pImpl->isYSizeValis())
+- aSize.Height = m_pImpl->getYSize();
+-
+- m_xShape->setSize(aSize);
+-
+- m_pImpl->bIsGraphic = true;
++ uno::Reference< drawing::XShape> xShape;
++ val.getAny( ) >>= xShape;
++
++ if ( xShape.is( ) )
++ {
++ // Is it a graphic image
++ bool bUseShape = true;
++ try
++ {
++ uno::Reference< beans::XPropertySet > xShapeProps
++ ( xShape, uno::UNO_QUERY_THROW );
++
++ rtl::OUString sUrl;
++ xShapeProps->getPropertyValue( rtl::OUString::createFromAscii( "GraphicURL" ) ) >>= sUrl;
++
++ ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
++ aMediaProperties[0].Name = rtl::OUString::createFromAscii( "URL" );
++ aMediaProperties[0].Value <<= sUrl;
++
++ m_xGraphicObject = createGraphicObject( aMediaProperties );
++
++ bUseShape = !m_xGraphicObject.is( );
++
++ if ( !bUseShape )
++ {
++ // Define the object size
++ uno::Reference< beans::XPropertySet > xGraphProps( m_xGraphicObject,
++ uno::UNO_QUERY );
++ awt::Size aSize = xShape->getSize( );
++ xGraphProps->setPropertyValue( rtl::OUString::createFromAscii( "Height" ),
++ uno::makeAny( aSize.Height ) );
++ xGraphProps->setPropertyValue( rtl::OUString::createFromAscii( "Width" ),
++ uno::makeAny( aSize.Width ) );
++ }
++ }
++ catch( const beans::UnknownPropertyException e )
++ {
++ // It isn't a graphic image
++ }
++
++ if ( bUseShape )
++ m_xShape = xShape;
++
++
++ if ( m_xShape.is( ) )
++ {
++ uno::Reference< beans::XPropertySet > xShapeProps
++ (m_xShape, uno::UNO_QUERY_THROW);
++
++
++ PropertyNameSupplier& rPropNameSupplier =
++ PropertyNameSupplier::GetPropertyNameSupplier();
++ xShapeProps->setPropertyValue
++ (rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
++ uno::makeAny
++ (text::TextContentAnchorType_AS_CHARACTER));
++ xShapeProps->setPropertyValue
++ (rPropNameSupplier.GetName(PROP_TEXT_RANGE),
++ uno::makeAny
++ (m_pImpl->rDomainMapper.GetCurrentTextRange()));
++
++ awt::Point aPoint(m_xShape->getPosition());
++ awt::Size aSize(m_xShape->getSize());
++
++ if (m_pImpl->isXSizeValid())
++ aSize.Width = m_pImpl->getXSize();
++ if (m_pImpl->isYSizeValis())
++ aSize.Height = m_pImpl->getYSize();
++
++ m_xShape->setSize(aSize);
++
++ m_pImpl->bIsGraphic = true;
++ }
+ }
+ }
+ break;
+@@ -1769,8 +1815,6 @@ void GraphicImport::sprm(Sprm & rSprm)
+ case NS_ooxml::LN_CT_NonVisualGraphicFrameProperties_graphicFrameLocks:// 90657
+ case NS_ooxml::LN_CT_Inline_a_graphic:// 90915
+ case NS_ooxml::LN_CT_Anchor_simplePos_elem: // 90975;
+- case NS_ooxml::LN_CT_Anchor_positionH: // 90976;
+- case NS_ooxml::LN_CT_Anchor_positionV: // 90977;
+ case NS_ooxml::LN_CT_Anchor_extent: // 90978;
+ case NS_ooxml::LN_CT_Anchor_effectExtent: // 90979;
+ case NS_ooxml::LN_EG_WrapType_wrapSquare: // 90945;
+@@ -1791,6 +1835,36 @@ void GraphicImport::sprm(Sprm & rSprm)
+ }
+ }
+ break;
++ case NS_ooxml::LN_CT_Anchor_positionH: // 90976;
++ {
++ // Use a special handler for the positionning
++ PositionHandlerPtr pHandler( new PositionHandler );
++ writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
++ if( pProperties.get( ) )
++ {
++ pProperties->resolve( *pHandler );
++
++ m_pImpl->nHoriRelation = pHandler->m_nRelation;
++ m_pImpl->nHoriOrient = pHandler->m_nOrient;
++ m_pImpl->nLeftPosition = pHandler->m_nPosition;
++ }
++ }
++ break;
++ case NS_ooxml::LN_CT_Anchor_positionV: // 90977;
++ {
++ // Use a special handler for the positionning
++ PositionHandlerPtr pHandler( new PositionHandler );
++ writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
++ if( pProperties.get( ) )
++ {
++ pProperties->resolve( *pHandler );
++
++ m_pImpl->nVertRelation = pHandler->m_nRelation;
++ m_pImpl->nVertOrient = pHandler->m_nOrient;
++ m_pImpl->nTopPosition = pHandler->m_nPosition;
++ }
++ }
++ break;
+ case 0x271b:
+ case 0x271c:
+ {
+@@ -1858,11 +1932,9 @@ void lcl_CalcCrop( sal_Int32& nCrop, sal_Int32 nRef )
+ + (((nCrop & 0xffff) * nRef ) >> 16);
+ }
+
+-/*-- 01.11.2006 09:45:02---------------------------------------------------
+-
+- -----------------------------------------------------------------------*/
+-void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t /*ref*/)
++uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const beans::PropertyValues& aMediaProperties )
+ {
++ uno::Reference< text::XTextContent > xGraphicObject;
+ try
+ {
+ uno::Reference< graphic::XGraphicProvider > xGraphicProvider(
+@@ -1870,28 +1942,22 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Referen
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")),
+ m_xComponentContext),
+ uno::UNO_QUERY_THROW );
+- uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len, m_pImpl->bIsBitmap );
+-
+- PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
+-
+- ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
+- aMediaProperties[0].Name = rPropNameSupplier.GetName(PROP_INPUT_STREAM);
+- aMediaProperties[0].Value <<= xIStream;
++
+ uno::Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( aMediaProperties );
+- //
++
+ if(xGraphic.is())
+ {
+- clog << "Graphic loaded" << endl;
++ PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
+
+ uno::Reference< beans::XPropertySet > xGraphicObjectProperties(
+ m_xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject"))),
+- uno::UNO_QUERY_THROW);
++ uno::UNO_QUERY_THROW);
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_GRAPHIC), uno::makeAny( xGraphic ));
+ xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
+ uno::makeAny( m_pImpl->eGraphicImportType == IMPORT_AS_SHAPE || m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR ?
+ text::TextContentAnchorType_AT_CHARACTER :
+ text::TextContentAnchorType_AS_CHARACTER ));
+- m_xGraphicObject = uno::Reference< text::XTextContent >( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
++ xGraphicObject = uno::Reference< text::XTextContent >( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
+
+ //shapes have only one border, PICF might have four
+ table::BorderLine aBorderLine;
+@@ -2083,11 +2149,28 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Referen
+ }
+ }
+ }
+- catch( const uno::Exception& )
++ catch( const uno::Exception& e )
+ {
+- clog << __FILE__ << __LINE__ << " failed!" << endl;
++ clog << __FILE__ << ":" << __LINE__ << " failed. Message :" ;
++ clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
+ }
++ return xGraphicObject;
++}
++
++/*-- 01.11.2006 09:45:02---------------------------------------------------
++
++ -----------------------------------------------------------------------*/
++void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t /*ref*/)
++{
++ PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
++
++ ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
++ aMediaProperties[0].Name = rPropNameSupplier.GetName(PROP_INPUT_STREAM);
++
++ uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len, m_pImpl->bIsBitmap );
++ aMediaProperties[0].Value <<= xIStream;
+
++ m_xGraphicObject = createGraphicObject( aMediaProperties );
+ }
+ /*-- 01.11.2006 09:45:03---------------------------------------------------
+
+diff --git writerfilter/source/dmapper/GraphicImport.hxx writerfilter/source/dmapper/GraphicImport.hxx
+index 99daac9..6a0d544 100644
+--- writerfilter/source/dmapper/GraphicImport.hxx
++++ writerfilter/source/dmapper/GraphicImport.hxx
+@@ -51,6 +51,11 @@ namespace com{ namespace sun { namespace star {
+ {
+ class XShape;
+ }
++ namespace beans
++ {
++ class PropertyValue;
++ typedef ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > PropertyValues;
++ }
+ }}}
+
+ namespace writerfilter {
+@@ -79,6 +84,9 @@ class WRITERFILTER_DLLPRIVATE GraphicImport : public Properties, public Table
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> m_xShape;
+ void ProcessShapeOptions(Value & val);
++
++ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > createGraphicObject(
++ const ::com::sun::star::beans::PropertyValues& aMediaProperties );
+
+ public:
+ explicit GraphicImport(::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > xComponentContext,
+diff --git writerfilter/source/dmapper/makefile.mk writerfilter/source/dmapper/makefile.mk
+index 75279c4..c1fcc36 100644
+--- writerfilter/source/dmapper/makefile.mk
++++ writerfilter/source/dmapper/makefile.mk
+@@ -44,6 +44,7 @@ ENABLE_EXCEPTIONS=TRUE
+
+ SLOFILES= $(SLO)$/BorderHandler.obj \
+ $(SLO)$/TblStylePrHandler.obj \
++ $(SLO)$/GraphicHelpers.obj \
+ $(SLO)$/TablePropertiesHandler.obj \
+ $(SLO)$/CellColorHandler.obj \
+ $(SLO)$/CellMarginHandler.obj \
+diff --git writerfilter/source/ooxml/model.xml writerfilter/source/ooxml/model.xml
+index 9539296..eb83b34 100644
+--- writerfilter/source/ooxml/model.xml
++++ writerfilter/source/ooxml/model.xml
+@@ -6505,11 +6505,17 @@
+ </element>
+ </choice>
+ </define>
++ <define name="CT_PositionOffset">
++ <ref name="ST_PositionOffset"/>
++ </define>
+ <define name="ST_PositionOffset">
+ <data type="int">
+ <xs:documentation>Absolute Position Offset Value</xs:documentation>
+ </data>
+ </define>
++ <define name="CT_AlignH">
++ <ref name="ST_AlignH"/>
++ </define>
+ <define name="ST_AlignH">
+ <list>
+ <xs:documentation>Relative Horizontal Alignment Positions</xs:documentation>
+@@ -6553,10 +6559,10 @@
+ <define name="CT_PosH">
+ <choice>
+ <element name="align">
+- <ref name="ST_AlignH"/>
++ <ref name="CT_AlignH"/>
+ </element>
+ <element name="posOffset">
+- <ref name="ST_PositionOffset"/>
++ <ref name="CT_PositionOffset"/>
+ </element>
+ </choice>
+ <attribute name="relativeFrom">
+@@ -6564,6 +6570,9 @@
+ <xs:documentation>Horizontal Position Relative Base</xs:documentation>
+ </attribute>
+ </define>
++ <define name="CT_AlignV">
++ <ref name="ST_AlignV"/>
++ </define>
+ <define name="ST_AlignV">
+ <list>
+ <xs:documentation>Vertical Alignment Definition</xs:documentation>
+@@ -6607,10 +6616,10 @@
+ <define name="CT_PosV">
+ <choice>
+ <element name="align">
+- <ref name="ST_AlignV"/>
++ <ref name="CT_AlignV"/>
+ </element>
+ <element name="posOffset">
+- <ref name="ST_PositionOffset"/>
++ <ref name="CT_PositionOffset"/>
+ </element>
+ </choice>
+ <attribute name="relativeFrom">
+@@ -6793,6 +6802,7 @@
+ <element name="wrapTopAndBottom" tokenid="ooxml:EG_WrapType_wrapTopAndBottom"/>
+ </resource>
+ <resource name="ST_PositionOffset" resource="Integer" generated="yes"/>
++ <resource name="CT_PositionOffset" resource="IntegerValue"/>
+ <resource name="ST_AlignH" resource="List" generated="yes">
+ <value name="left" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_left">left</value>
+ <value name="right" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_right">right</value>
+@@ -6800,6 +6810,7 @@
+ <value name="inside" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_inside">inside</value>
+ <value name="outside" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_outside">outside</value>
+ </resource>
++ <resource name="CT_AlignH" resource="ListValue"/>
+ <resource name="ST_RelFromH" resource="List" generated="yes">
+ <value name="margin" tokenid="ooxml:Value_wordprocessingDrawing_ST_RelFromH_margin">margin</value>
+ <value name="page" tokenid="ooxml:Value_wordprocessingDrawing_ST_RelFromH_page">page</value>
+@@ -6815,6 +6826,7 @@
+ <element name="posOffset" tokenid="ooxml:CT_PosH_posOffset"/>
+ <attribute name="relativeFrom" tokenid="ooxml:CT_PosH_relativeFrom"/>
+ </resource>
++ <resource name="CT_AlignV" resource="ListValue"/>
+ <resource name="ST_AlignV" resource="List" generated="yes">
+ <value name="top" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignV_top">top</value>
+ <value name="bottom" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignV_bottom">bottom</value>
+diff --git writerfilter/source/ooxml/resourcestools.xsl writerfilter/source/ooxml/resourcestools.xsl
+index 9b17e4d..96c34ae 100644
+--- writerfilter/source/ooxml/resourcestools.xsl
++++ writerfilter/source/ooxml/resourcestools.xsl
+@@ -92,6 +92,20 @@
+ match="rng:define" use="ancestor::rng:grammar/@application"/>
+
+ <xsl:key name="namespace-aliases" match="//namespace-alias" use="@name"/>
++
++ <!-- Tiny template helping devs to debug -->
++ <xsl:template name="dbg_path">
++ <xsl:text>/*</xsl:text>
++ <xsl:for-each select="ancestor::*">
++ <xsl:value-of select="name(.)"/>
++ <xsl:text>/</xsl:text>
++ </xsl:for-each>
++ <xsl:value-of select="name(.)"/>
++ <xsl:text>[ name=</xsl:text>
++ <xsl:value-of select="@name"/>
++ <xsl:text>]</xsl:text>
++ <xsl:text>*/</xsl:text>
++ </xsl:template>
+
+ <xsl:template name="licenseheader">
+ <xsl:text>
+@@ -1543,6 +1557,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
++
++ <xsl:template name="fastcharactersstringvalue">
++ <xsl:text>
++
++ msValue = sText;</xsl:text>
++ </xsl:template>
+
+ <xsl:template name="fastattributesstringvalue">
+ <xsl:for-each select=".//rng:attribute">
+@@ -1555,6 +1575,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
+ <xsl:text>);</xsl:text>
+ </xsl:for-each>
+ </xsl:template>
++
++ <xsl:template name="fastcharactersintvalue">
++ <xsl:text>
++
++ mnValue = sText.toInt32();</xsl:text>
++ </xsl:template>
+
+ <xsl:template name="fastattributesintvalue">
+ <xsl:for-each select=".//rng:attribute">
+@@ -1568,6 +1594,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
+ </xsl:for-each>
+ </xsl:template>
+
++ <xsl:template name="fastcharactershexvalue">
++ <xsl:text>
++
++ mnValue = sText.toInt32(16);</xsl:text>
++ </xsl:template>
++
+ <xsl:template name="fastattributeshexvalue">
+ <xsl:for-each select=".//rng:attribute">
+ <xsl:text>
+@@ -1580,6 +1612,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
+ </xsl:for-each>
+ </xsl:template>
+
++ <xsl:template name="fastcharactersboolvalue">
++ <xsl:text>
++
++ setValue( sText );</xsl:text>
++ </xsl:template>
++
+ <xsl:template name="fastattributesboolvalue">
+ <xsl:for-each select=".//rng:attribute">
+ <xsl:text>
+@@ -1592,6 +1630,35 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
+ </xsl:for-each>
+ </xsl:template>
+
++ <xsl:template name="fastcharacterslistvalue">
++ <xsl:variable name="bodywithns">
++ <xsl:for-each select="rng:ref">
++ <xsl:variable name="refname" select="@name"/>
++ <xsl:variable name="refns">
++ <xsl:call-template name="searchdefinenamespace">
++ <xsl:with-param name="name" select="@name"/>
++ </xsl:call-template>
++ </xsl:variable>
++ <xsl:variable name="valname">
++ <xsl:for-each select="/model/namespace[ name=substring-before($refns, ':')]">
++ <xsl:for-each select="./rng:grammar/rng:define[ name=substring-after($refns, ':')]">
++ <xsl:call-template name="valuenamefordefine"/>
++ </xsl:for-each>
++ </xsl:for-each>
++ </xsl:variable>
++ <xsl:text>
++ mpValue = OOXMLValue::Pointer_t (new </xsl:text>
++ <xsl:value-of select="$valname"/>
++ <xsl:text>( sText ) );</xsl:text>
++ </xsl:for-each>
++ </xsl:variable>
++ <xsl:if test="string-length($bodywithns) > 0">
++ <xsl:text>
++ </xsl:text>
++ <xsl:value-of select="$bodywithns"/>
++ </xsl:if>
++ </xsl:template>
++
+ <xsl:template name="fastattributeslistvalue">
+ <xsl:for-each select=".//rng:attribute">
+ <xsl:variable name="myfasttoken">
+@@ -1999,6 +2066,29 @@ void </xsl:text>
+
+ <xsl:template name="fastcharactersbody">
+ <xsl:variable name="name" select="@name"/>
++ <!-- ST values as text -->
++ <xsl:variable name="resource">
++ <xsl:call-template name="contextresource"/>
++ </xsl:variable>
++ <xsl:choose>
++ <xsl:when test="$resource = 'StringValue'">
++ <xsl:call-template name="fastcharactersstringvalue"/>
++ </xsl:when>
++ <xsl:when test="$resource = 'IntegerValue'">
++ <xsl:call-template name="fastcharactersintvalue"/>
++ </xsl:when>
++ <xsl:when test="$resource = 'HexValue'">
++ <xsl:call-template name="fastcharactershexvalue"/>
++ </xsl:when>
++ <xsl:when test="$resource = 'BooleanValue'">
++ <xsl:call-template name="fastcharactersboolvalue"/>
++ </xsl:when>
++ <xsl:when test="$resource = 'ListValue'">
++ <xsl:call-template name="fastcharacterslistvalue"/>
++ </xsl:when>
++ </xsl:choose>
++
++ <!-- characters action -->
+ <xsl:for-each select="ancestor::namespace/resource[ name = $name]//action[ name='characters']">
+ <xsl:call-template name="chooseaction"/>
+ </xsl:for-each>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]