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

writerfilter: handle anchorId and put it into the FrameGrabBag

Change-Id: I44f9a1f5b5d65ebdabd5f6d1e8d87bfadb66d664
üst 85b7de13
...@@ -44,6 +44,9 @@ ...@@ -44,6 +44,9 @@
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx> #include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/string.hxx>
#include <oox/drawingml/drawingmltypes.hxx> #include <oox/drawingml/drawingmltypes.hxx>
#include <dmapper/DomainMapper.hxx> #include <dmapper/DomainMapper.hxx>
...@@ -258,6 +261,7 @@ public: ...@@ -258,6 +261,7 @@ public:
OUString sAlternativeText; OUString sAlternativeText;
OUString title; OUString title;
std::queue<OUString>& m_rPositivePercentages; std::queue<OUString>& m_rPositivePercentages;
OUString sAnchorId;
GraphicImport_Impl(GraphicImportType eImportType, DomainMapper& rDMapper, std::queue<OUString>& rPositivePercentages) : GraphicImport_Impl(GraphicImportType eImportType, DomainMapper& rDMapper, std::queue<OUString>& rPositivePercentages) :
nXSize(0) nXSize(0)
...@@ -455,7 +459,37 @@ void GraphicImport::handleWrapTextValue(sal_uInt32 nVal) ...@@ -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) void GraphicImport::lcl_attribute(Id nName, Value & val)
{ {
...@@ -560,6 +594,15 @@ 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; case NS_ooxml::LN_CT_Anchor_allowOverlap: // 90993;
//enable overlapping - ignored //enable overlapping - ignored
break; 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; case NS_ooxml::LN_CT_Point2D_x: // 90405;
m_pImpl->nLeftPosition = ConversionHelper::convertTwipToMM100(nIntValue); m_pImpl->nLeftPosition = ConversionHelper::convertTwipToMM100(nIntValue);
m_pImpl->nHoriRelation = text::RelOrientation::PAGE_FRAME; m_pImpl->nHoriRelation = text::RelOrientation::PAGE_FRAME;
...@@ -702,6 +745,11 @@ void GraphicImport::lcl_attribute(Id nName, Value & val) ...@@ -702,6 +745,11 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
xShapeProps->setPropertyValue("RotateAngle", aRotation); xShapeProps->setPropertyValue("RotateAngle", aRotation);
m_pImpl->bIsGraphic = true; 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) if (bUseShape && m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
...@@ -801,7 +849,7 @@ void GraphicImport::lcl_attribute(Id nName, Value & val) ...@@ -801,7 +849,7 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
#ifdef DEBUG_DMAPPER_GRAPHIC_IMPORT #ifdef DEBUG_DMAPPER_GRAPHIC_IMPORT
dmapper_logger->element("unhandled"); dmapper_logger->element("unhandled");
#endif #endif
; break;
} }
} }
......
...@@ -75,6 +75,8 @@ class GraphicImport : public LoggedProperties, public LoggedTable ...@@ -75,6 +75,8 @@ class GraphicImport : public LoggedProperties, public LoggedTable
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > createGraphicObject( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > createGraphicObject(
const ::com::sun::star::beans::PropertyValues& aMediaProperties ); const ::com::sun::star::beans::PropertyValues& aMediaProperties );
void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue );
public: public:
explicit GraphicImport(::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > xComponentContext, explicit GraphicImport(::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > xComponentContext,
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xTextFactory, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xTextFactory,
......
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