summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source/dmapper')
-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
5 files changed, 34 insertions, 5 deletions
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