src/lib/CDRContentCollector.cpp | 31 +++++++++++++++++++++++++++---- src/lib/CDRContentCollector.h | 3 +++ 2 files changed, 30 insertions(+), 4 deletions(-)
New commits: commit 00dea16c89b68668ea1ced9601fe33b728db4234 Author: Fridrich Å trba <fridrich.st...@bluewin.ch> Date: Tue Dec 3 10:35:11 2013 +0100 Emit start/endDocument calls Change-Id: Ic8413c9f24a0fa06ed6bbb24d1be8dd638b176aa diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp index 0ce93f2..5884f51 100644 --- a/src/lib/CDRContentCollector.cpp +++ b/src/lib/CDRContentCollector.cpp @@ -48,7 +48,7 @@ #endif libcdr::CDRContentCollector::CDRContentCollector(libcdr::CDRParserState &ps, librevenge::RVNGDrawingInterface *painter) : - m_painter(painter), + m_painter(painter), m_isDocumentStarted(false), m_isPageProperties(false), m_isPageStarted(false), m_ignorePage(false), m_page(ps.m_pages[0]), m_pageIndex(0), m_currentFillStyle(), m_currentLineStyle(), m_spnd(0), m_currentObjectLevel(0), m_currentGroupLevel(0), m_currentVectLevel(0), m_currentPageLevel(0), @@ -64,20 +64,43 @@ libcdr::CDRContentCollector::~CDRContentCollector() { if (m_isPageStarted) _endPage(); + if (m_isDocumentStarted) + _endDocument(); +} + +void libcdr::CDRContentCollector::_startDocument() +{ + if (m_isDocumentStarted) + return; + librevenge::RVNGPropertyList propList; + if (m_painter) + m_painter->startDocument(propList); + m_isDocumentStarted = true; +} + +void libcdr::CDRContentCollector::_endDocument() +{ + if (!m_isDocumentStarted) + return; + if (m_isPageStarted) + _endPage(); + if (m_painter) + m_painter->endDocument(); + m_isDocumentStarted = false; } void libcdr::CDRContentCollector::_startPage(double width, double height) { if (m_ignorePage) return; + if (!m_isDocumentStarted) + _startDocument(); librevenge::RVNGPropertyList propList; propList.insert("svg:width", width); propList.insert("svg:height", height); if (m_painter) - { m_painter->startPage(propList); - m_isPageStarted = true; - } + m_isPageStarted = true; } void libcdr::CDRContentCollector::_endPage() diff --git a/src/lib/CDRContentCollector.h b/src/lib/CDRContentCollector.h index b84f84b..eca0b93 100644 --- a/src/lib/CDRContentCollector.h +++ b/src/lib/CDRContentCollector.h @@ -91,6 +91,8 @@ private: CDRContentCollector &operator=(const CDRContentCollector &); // helper functions + void _startDocument(); + void _endDocument(); void _startPage(double width, double height); void _endPage(); void _flushCurrentPath(); @@ -101,6 +103,7 @@ private: librevenge::RVNGDrawingInterface *m_painter; + bool m_isDocumentStarted; bool m_isPageProperties; bool m_isPageStarted; bool m_ignorePage;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits