summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-03-05 18:43:04 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-03-05 20:24:00 +0100
commitca6e60d4c014e7471acc7a7601148fe751634f27 (patch)
tree9d5fdc2c4a3a2786e2f37a40b5f4ad60eec0e392 /writerfilter
parent85b7de13f8a8417a9dd642fe00569c45c5907a1a (diff)
writerfilter: handle anchorId and put it into the FrameGrabBag
Change-Id: I44f9a1f5b5d65ebdabd5f6d1e8d87bfadb66d664
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx50
-rw-r--r--writerfilter/source/dmapper/GraphicImport.hxx2
2 files changed, 51 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index f22d32374742..d40b57075382 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -44,6 +44,9 @@
#include <cppuhelper/implbase1.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/string.hxx>
+
#include <oox/drawingml/drawingmltypes.hxx>
#include <dmapper/DomainMapper.hxx>
@@ -258,6 +261,7 @@ public:
OUString sAlternativeText;
OUString title;
std::queue<OUString>& m_rPositivePercentages;
+ OUString sAnchorId;
GraphicImport_Impl(GraphicImportType eImportType, DomainMapper& rDMapper, std::queue<OUString>& rPositivePercentages) :
nXSize(0)
@@ -455,7 +459,37 @@ void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
}
}
+void GraphicImport::putPropertyToFrameGrabBag( const OUString& sPropertyName, const uno::Any& aPropertyValue )
+{
+ beans::PropertyValue pProperty;
+ pProperty.Name = sPropertyName;
+ pProperty.Value = aPropertyValue;
+
+ if (!m_xShape.is())
+ return;
+
+ uno::Reference< beans::XPropertySet > xSet(m_xShape, uno::UNO_QUERY_THROW);
+ if (!xSet.is())
+ return;
+
+ uno::Reference< beans::XPropertySetInfo > xSetInfo(xSet->getPropertySetInfo());
+ if (!xSetInfo.is())
+ return;
+
+ const OUString& aGrabBagPropName = OUString("FrameInteropGrabBag");
+
+ if (xSetInfo->hasPropertyByName(aGrabBagPropName))
+ {
+ uno::Sequence< beans::PropertyValue > aGrabBag;
+ xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
+
+ sal_Int32 nLength = aGrabBag.getLength();
+ aGrabBag.realloc(nLength + 1);
+ aGrabBag[nLength] = pProperty;
+ xSet->setPropertyValue(aGrabBagPropName, uno::makeAny(aGrabBag));
+ }
+}
void GraphicImport::lcl_attribute(Id nName, Value & val)
{
@@ -560,6 +594,15 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Anchor_allowOverlap: // 90993;
//enable overlapping - ignored
break;
+ case NS_ooxml::LN_CT_Anchor_wp14_anchorId:
+ {
+ OUStringBuffer aBuffer = OUString::number(nIntValue, 16);
+ OUStringBuffer aString;
+ comphelper::string::padToLength(aString, 8 - aBuffer.getLength(), '0');
+ aString.append(aBuffer.getStr());
+ m_pImpl->sAnchorId = aString.makeStringAndClear().toAsciiUpperCase();
+ }
+ break;
case NS_ooxml::LN_CT_Point2D_x: // 90405;
m_pImpl->nLeftPosition = ConversionHelper::convertTwipToMM100(nIntValue);
m_pImpl->nHoriRelation = text::RelOrientation::PAGE_FRAME;
@@ -702,6 +745,11 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
xShapeProps->setPropertyValue("RotateAngle", aRotation);
m_pImpl->bIsGraphic = true;
+
+ if (!m_pImpl->sAnchorId.isEmpty())
+ {
+ putPropertyToFrameGrabBag("AnchorId", uno::makeAny(m_pImpl->sAnchorId));
+ }
}
if (bUseShape && m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
@@ -801,7 +849,7 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
#ifdef DEBUG_DMAPPER_GRAPHIC_IMPORT
dmapper_logger->element("unhandled");
#endif
- ;
+ break;
}
}
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index 56c96806f229..52b033920e33 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -75,6 +75,8 @@ class GraphicImport : public LoggedProperties, public LoggedTable
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > createGraphicObject(
const ::com::sun::star::beans::PropertyValues& aMediaProperties );
+ void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue );
+
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,