summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--writerfilter/inc/dmapper/DomainMapper.hxx1
-rw-r--r--writerfilter/inc/resourcemodel/LoggedResources.hxx2
-rw-r--r--writerfilter/inc/resourcemodel/WW8ResourceModel.hxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx4
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx23
-rw-r--r--writerfilter/source/dmapper/GraphicImport.hxx5
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.cxx11
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.hxx1
-rw-r--r--writerfilter/source/ooxml/factoryimpl_ns.xsl3
-rw-r--r--writerfilter/source/ooxml/model.xml7
-rw-r--r--writerfilter/source/resourcemodel/LoggedResources.cxx14
-rw-r--r--writerfilter/source/resourcemodel/resourcemodel.hxx1
14 files changed, 76 insertions, 5 deletions
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index 4a168d9a35d3..f7d6fcb94d3b 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -142,6 +142,7 @@ private:
virtual void lcl_text(const sal_uInt8 * data, size_t len);
virtual void lcl_utext(const sal_uInt8 * data, size_t len);
+ virtual void lcl_positivePercentage(const OUString& rText) SAL_OVERRIDE;
virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref);
virtual void lcl_table(Id name,
writerfilter::Reference<Table>::Pointer_t ref);
diff --git a/writerfilter/inc/resourcemodel/LoggedResources.hxx b/writerfilter/inc/resourcemodel/LoggedResources.hxx
index 419bde775fa8..5eaa7817522a 100644
--- a/writerfilter/inc/resourcemodel/LoggedResources.hxx
+++ b/writerfilter/inc/resourcemodel/LoggedResources.hxx
@@ -64,6 +64,7 @@ public:
void endShape();
void text(const sal_uInt8 * data, size_t len);
void utext(const sal_uInt8 * data, size_t len);
+ void positivePercentage(const OUString& rText);
void props(writerfilter::Reference<Properties>::Pointer_t ref);
void table(Id name, writerfilter::Reference<Table>::Pointer_t ref);
void substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref);
@@ -80,6 +81,7 @@ protected:
virtual void lcl_endShape() = 0;
virtual void lcl_text(const sal_uInt8 * data, size_t len) = 0;
virtual void lcl_utext(const sal_uInt8 * data, size_t len) = 0;
+ virtual void lcl_positivePercentage(const OUString& /*rText*/) { }
virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref) = 0;
virtual void lcl_table(Id name, writerfilter::Reference<Table>::Pointer_t ref) = 0;
virtual void lcl_substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) = 0;
diff --git a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
index 886d2f637ea9..01106ae407f7 100644
--- a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
+++ b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
@@ -246,6 +246,8 @@ public:
*/
virtual void utext(const sal_uInt8 * data, size_t len) = 0;
+ virtual void positivePercentage(const OUString& rText) = 0;
+
/**
Receives properties of the current run of text.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index d095df8d1975..1a791297d70c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3293,6 +3293,11 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
}
}
+void DomainMapper::lcl_positivePercentage(const OUString& rText)
+{
+ m_pImpl->m_aPositivePercentages.push(rText);
+}
+
void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
{
OUString sText;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 74173fdd5e7b..8b7dc2d5d7fb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3762,7 +3762,7 @@ void DomainMapper_Impl::AddAnnotationPosition(
GraphicImportPtr DomainMapper_Impl::GetGraphicImport(GraphicImportType eGraphicImportType)
{
if(!m_pGraphicImport)
- m_pGraphicImport.reset( new GraphicImport( m_xComponentContext, m_xTextFactory, m_rDMapper, eGraphicImportType ) );
+ m_pGraphicImport.reset( new GraphicImport( m_xComponentContext, m_xTextFactory, m_rDMapper, eGraphicImportType, m_aPositivePercentages ) );
return m_pGraphicImport;
}
/*-------------------------------------------------------------------------
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index f5f1e974094d..c1025064feb6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <vector>
#include <stack>
+#include <queue>
#include <boost/optional.hpp>
#ifndef INCLUDED_RESOURCESIDS
@@ -738,6 +739,9 @@ public:
/// A sub-grabbag of m_aInteropGrabBag, like 'spacing'.
std::vector<beans::PropertyValue> m_aSubInteropGrabBag;
+
+ /// ST_PositivePercentage values we received
+ std::queue<OUString> m_aPositivePercentages;
};
} //namespace dmapper
} //namespace writerfilter
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index b76da1384c56..6087610d167c 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -255,8 +255,9 @@ public:
OUString sName;
OUString sAlternativeText;
OUString title;
+ std::queue<OUString>& m_rPositivePercentages;
- GraphicImport_Impl(GraphicImportType eImportType, DomainMapper& rDMapper) :
+ GraphicImport_Impl(GraphicImportType eImportType, DomainMapper& rDMapper, std::queue<OUString>& rPositivePercentages) :
nXSize(0)
,bXSizeValid(false)
,nYSize(0)
@@ -309,6 +310,7 @@ public:
,bVertFlip(false)
,bSizeProtected(false)
,bPositionProtected(false)
+ ,m_rPositivePercentages(rPositivePercentages)
{}
void setXSize(sal_Int32 _nXSize)
@@ -413,11 +415,12 @@ public:
GraphicImport::GraphicImport(uno::Reference < uno::XComponentContext > xComponentContext,
uno::Reference< lang::XMultiServiceFactory > xTextFactory,
DomainMapper& rDMapper,
- GraphicImportType eImportType )
+ GraphicImportType eImportType,
+ std::queue<OUString>& rPositivePercentages)
: LoggedProperties(dmapper_logger, "GraphicImport")
, LoggedTable(dmapper_logger, "GraphicImport")
, LoggedStream(dmapper_logger, "GraphicImport")
-, m_pImpl( new GraphicImport_Impl( eImportType, rDMapper ))
+, m_pImpl( new GraphicImport_Impl( eImportType, rDMapper, rPositivePercentages ))
, m_xComponentContext( xComponentContext )
, m_xTextFactory( xTextFactory)
{
@@ -884,6 +887,20 @@ void GraphicImport::lcl_sprm(Sprm & rSprm)
}
}
break;
+ case NS_ooxml::LN_CT_SizeRelH_pctWidth:
+ if (m_xShape.is() && !m_pImpl->m_rPositivePercentages.empty())
+ {
+ sal_Int16 nPositivePercentage = m_pImpl->m_rPositivePercentages.front().toInt32() / 1000;
+ m_pImpl->m_rPositivePercentages.pop();
+
+ uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
+ if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(m_xShape, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("RelativeWidth", uno::makeAny(nPositivePercentage));
+ }
+ }
+ break;
case 0x271b:
case 0x271c:
{
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index a9795125b85b..7e4cef259848 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -19,6 +19,8 @@
#ifndef INCLUDED_GRAPHICIMPORT_HXX
#define INCLUDED_GRAPHICIMPORT_HXX
+#include <queue>
+
#include <resourcemodel/LoggedResources.hxx>
namespace com{ namespace sun { namespace star {
@@ -77,7 +79,8 @@ public:
explicit GraphicImport(::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > xComponentContext,
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xTextFactory,
DomainMapper& rDomainMapper,
- GraphicImportType eGraphicImportType);
+ GraphicImportType eGraphicImportType,
+ std::queue<OUString>& rPositivePercentages);
virtual ~GraphicImport();
// BinaryObj
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index b1af30f346f2..6cfb6d79b69f 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -974,6 +974,17 @@ void OOXMLFastContextHandler::alignV(const OUString & sText)
::writerfilter::dmapper::PositionHandler::setAlignV( sText );
}
+void OOXMLFastContextHandler::positivePercentage(const OUString& rText)
+{
+#ifdef DEBUG_ELEMENT
+ debug_logger->startElement("positivePercentage");
+ debug_logger->chars(rText);
+ debug_logger->endElement();
+#endif
+ if (isForwardEvents())
+ mpStream->positivePercentage(rText);
+}
+
void OOXMLFastContextHandler::propagateCharacterProperties()
{
#ifdef DEBUG_CONTEXT_HANDLER
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index c5909bfe49df..aa1048b05434 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -214,6 +214,7 @@ public:
void positionOffset(const OUString & sText);
void alignH(const OUString & sText);
void alignV(const OUString & sText);
+ void positivePercentage(const OUString& rText);
void startTxbxContent();
void endTxbxContent();
virtual void propagateCharacterProperties();
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.xsl b/writerfilter/source/ooxml/factoryimpl_ns.xsl
index 7105901a9f25..6e3e99845c50 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.xsl
+++ b/writerfilter/source/ooxml/factoryimpl_ns.xsl
@@ -516,6 +516,9 @@ CreateElementMapPointer </xsl:text>
<xsl:when test="@action='positionOffset'">
pHandler-&gt;positionOffset(sText);
</xsl:when>
+ <xsl:when test="@action='positivePercentage'">
+ pHandler-&gt;positivePercentage(sText);
+ </xsl:when>
<xsl:when test="@action='alignH'">
pHandler-&gt;alignH(sText);
</xsl:when>
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index e899a437cf90..b6b4597b9dc1 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -4477,6 +4477,9 @@
<attribute name="val" tokenid="ooxml:CT_Percentage_val" action="setValue"/>
<action name="start" action="setDefaultIntegerValue"/>
</resource>
+ <resource name="ST_PositivePercentage" resource="Value">
+ <action name="characters" action="positivePercentage"/>
+ </resource>
<resource name="CT_PositivePercentage" resource="Value" generated="yes" tag="attribute">
<attribute name="val" tokenid="ooxml:CT_PositivePercentage_val" action="setValue"/>
</resource>
@@ -5243,6 +5246,9 @@
</choice>
</define>
<define name="CT_SizeRelH">
+ <element name="pctWidth">
+ <ref name="ST_PositivePercentage"/>
+ </element>
<attribute name="relativeFrom">
<ref name="ST_SizeRelFromH"/>
</attribute>
@@ -5262,6 +5268,7 @@
<value name="outsideMargin" tokenid="ooxml:ST_SizeRelFromH_outsideMargin">outsideMargin</value>
</resource>
<resource name="CT_SizeRelH" resource="Properties" tag="shape">
+ <element name="pctWidth" tokenid="ooxml:CT_SizeRelH_pctWidth"/>
<attribute name="relativeFrom" tokenid="ooxml:CT_SizeRelH_relativeFrom"/>
</resource>
<resource name="sizeRelH" resource="Properties" tag="shape">
diff --git a/writerfilter/source/resourcemodel/LoggedResources.cxx b/writerfilter/source/resourcemodel/LoggedResources.cxx
index f94bd921993b..0808fb8735e1 100644
--- a/writerfilter/source/resourcemodel/LoggedResources.cxx
+++ b/writerfilter/source/resourcemodel/LoggedResources.cxx
@@ -202,6 +202,20 @@ void LoggedStream::utext(const sal_uInt8 * data, size_t len)
#endif
}
+void LoggedStream::positivePercentage(const OUString& rText)
+{
+#ifdef DEBUG_LOGGING
+ mHelper.startElement("positivePercentage");
+ mHelper.chars(rText);
+#endif
+
+ lcl_positivePercentage(rText);
+
+#ifdef DEBUG_LOGGING
+ mHelper.endElement("positivePercentage");
+#endif
+}
+
void LoggedStream::props(writerfilter::Reference<Properties>::Pointer_t ref)
{
#ifdef DEBUG_LOGGING
diff --git a/writerfilter/source/resourcemodel/resourcemodel.hxx b/writerfilter/source/resourcemodel/resourcemodel.hxx
index 2e0066d9aa4f..ecaaac63864d 100644
--- a/writerfilter/source/resourcemodel/resourcemodel.hxx
+++ b/writerfilter/source/resourcemodel/resourcemodel.hxx
@@ -37,6 +37,7 @@ public:
virtual void endCharacterGroup();
virtual void text(const sal_uInt8 * data, size_t len);
virtual void utext(const sal_uInt8 * data, size_t len);
+ virtual void positivePercentage(const OUString& /*rText*/) { }
virtual void props(writerfilter::Reference<Properties>::Pointer_t ref);
virtual void table(Id name,