diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-07-08 16:13:35 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-07-08 17:16:10 +0200 |
commit | 6d191c06c737e4c7f3e2c5f8b871d1037b4ce783 (patch) | |
tree | 2d500bcaf7bd75a029493228ef2cb38e88842ecb /writerfilter | |
parent | a38158d3eb3b2740eb19b964a6b8b5ef5f390710 (diff) |
RTFSdrImport: support stacking of parents
Change-Id: Ie8f039ce403832e54251a751609d91b8d608ed79
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 18 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.hxx | 8 |
2 files changed, 22 insertions, 4 deletions
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 0e07a4570342..e10457ba837f 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -47,11 +47,13 @@ RTFSdrImport::RTFSdrImport(RTFDocumentImpl& rDocument, { uno::Reference<drawing::XDrawPageSupplier> xDrawings(xDstDoc, uno::UNO_QUERY); if (xDrawings.is()) - m_xDrawPage.set(xDrawings->getDrawPage(), uno::UNO_QUERY); + m_aParents.push(xDrawings->getDrawPage()); } RTFSdrImport::~RTFSdrImport() { + if (m_aParents.size()) + m_aParents.pop(); } void RTFSdrImport::createShape(OUString aStr, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet) @@ -103,6 +105,16 @@ std::vector<beans::PropertyValue> RTFSdrImport::getTextFrameDefaults(bool bNew) return aRet; } +void RTFSdrImport::pushParent(uno::Reference<drawing::XShapes> xParent) +{ + m_aParents.push(xParent); +} + +void RTFSdrImport::popParent() +{ + m_aParents.pop(); +} + void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder) { writerfilter::dmapper::DomainMapper& rMapper = (writerfilter::dmapper::DomainMapper&)m_rImport.Mapper(); @@ -544,8 +556,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) return; } - if (m_xDrawPage.is() && !bTextFrame) - m_xDrawPage->add(xShape); + if (m_aParents.size() && m_aParents.top().is() && !bTextFrame) + m_aParents.top()->add(xShape); if (bCustom && xShape.is()) { uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(xShape, uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index ab3c44c3e8e1..bb09b0093dde 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -10,6 +10,8 @@ #ifndef _RTFSDRIMPORT_HXX_ #define _RTFSDRIMPORT_HXX_ +#include <stack> + #include <rtfdocumentimpl.hxx> namespace writerfilter { @@ -32,12 +34,16 @@ namespace writerfilter { * @param bNew if the frame is new-style or old-style. */ std::vector<beans::PropertyValue> getTextFrameDefaults(bool bNew); + /// Push a new group shape to the parent stack. + void pushParent(uno::Reference<drawing::XShapes> xParent); + /// Pop the current group shape from the parent stack. + void popParent(); private: void createShape(OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet); void applyProperty(uno::Reference<drawing::XShape> xShape, OUString aKey, OUString aValue); RTFDocumentImpl& m_rImport; - uno::Reference<drawing::XDrawPage> m_xDrawPage; + std::stack< uno::Reference<drawing::XShapes> > m_aParents; uno::Reference<drawing::XShape> m_xShape; }; } // namespace rtftok |