From d27133e8b7a429d98950cdc0a51f6b61eec9875c Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Wed, 25 Jul 2012 21:57:20 +0200 Subject: Revert "Drawing pages in right order" This modification is not needed anymore, since we approach the reordering of pointers differently This reverts commit 9371595a11a0858fc55ea9fce67dba12b39a6e3e. --- src/lib/VSDXCollector.h | 2 +- src/lib/VSDXContentCollector.cpp | 3 +-- src/lib/VSDXContentCollector.h | 2 +- src/lib/VSDXPages.cpp | 43 ++++++++-------------------------------- src/lib/VSDXPages.h | 3 --- src/lib/VSDXParser.cpp | 5 +---- src/lib/VSDXStylesCollector.h | 2 +- 7 files changed, 13 insertions(+), 47 deletions(-) diff --git a/src/lib/VSDXCollector.h b/src/lib/VSDXCollector.h index e1c7bc6..f401860 100644 --- a/src/lib/VSDXCollector.h +++ b/src/lib/VSDXCollector.h @@ -119,7 +119,7 @@ public: // Temporary hack virtual void startPage(unsigned pageId) = 0; virtual void endPage() = 0; - virtual void endPages(const std::vector &pageOrder) = 0; + virtual void endPages() = 0; protected: const ::WPXString getColourString(const Colour &c) const diff --git a/src/lib/VSDXContentCollector.cpp b/src/lib/VSDXContentCollector.cpp index 03ba3c4..8bc3b58 100644 --- a/src/lib/VSDXContentCollector.cpp +++ b/src/lib/VSDXContentCollector.cpp @@ -2398,9 +2398,8 @@ void libvisio::VSDXContentCollector::endPage() } } -void libvisio::VSDXContentCollector::endPages(const std::vector &pageOrder) +void libvisio::VSDXContentCollector::endPages() { - m_pages.setOrder(pageOrder); m_pages.draw(m_painter); } diff --git a/src/lib/VSDXContentCollector.h b/src/lib/VSDXContentCollector.h index 922745f..7413ab4 100644 --- a/src/lib/VSDXContentCollector.h +++ b/src/lib/VSDXContentCollector.h @@ -139,7 +139,7 @@ public: void startPage(unsigned pageId); void endPage(); - void endPages(const std::vector &pageOrder); + void endPages(); private: diff --git a/src/lib/VSDXPages.cpp b/src/lib/VSDXPages.cpp index 7701ffa..432f3b3 100644 --- a/src/lib/VSDXPages.cpp +++ b/src/lib/VSDXPages.cpp @@ -74,7 +74,7 @@ void libvisio::VSDXPage::draw(libwpg::WPGPaintInterface *painter) const } libvisio::VSDXPages::VSDXPages() - : m_pages(), m_pagesOrder() + : m_pages() { } @@ -83,47 +83,20 @@ void libvisio::VSDXPages::addPage(const libvisio::VSDXPage &page) m_pages[page.m_currentPageID] = page; } -void libvisio::VSDXPages::setOrder(const std::vector &pagesOrder) -{ - m_pagesOrder = pagesOrder; -} - void libvisio::VSDXPages::draw(libwpg::WPGPaintInterface *painter) { if (!painter) return; - std::map::iterator iter; - if (!m_pagesOrder.empty()) + for (std::map::iterator iter = m_pages.begin(); iter != m_pages.end(); ++iter) { - for (unsigned i = 0; i < m_pagesOrder.size(); i++) - { - iter = m_pages.find(m_pagesOrder[i]); - if (iter != m_pages.end()) - { - _drawPage(painter, iter->second); - m_pages.erase(iter); - } - } + WPXPropertyList pageProps; + pageProps.insert("svg:width", iter->second.m_pageWidth); + pageProps.insert("svg:height", iter->second.m_pageHeight); + painter->startGraphics(pageProps); + _drawWithBackground(painter, iter->second); + painter->endGraphics(); } - for (iter = m_pages.begin(); iter != m_pages.end(); ++iter) - _drawPage(painter, iter->second); -} - -void libvisio::VSDXPages::_drawPage(libwpg::WPGPaintInterface *painter, const libvisio::VSDXPage &page) -{ - if (!painter) - return; - - if (page.m_pageWidth == 0.0 || page.m_pageHeight == 0.0) - return; - - WPXPropertyList pageProps; - pageProps.insert("svg:width", page.m_pageWidth); - pageProps.insert("svg:height", page.m_pageHeight); - painter->startGraphics(pageProps); - _drawWithBackground(painter, page); - painter->endGraphics(); } void libvisio::VSDXPages::_drawWithBackground(libwpg::WPGPaintInterface *painter, const libvisio::VSDXPage &page) diff --git a/src/lib/VSDXPages.h b/src/lib/VSDXPages.h index dfa046b..aaea8db 100644 --- a/src/lib/VSDXPages.h +++ b/src/lib/VSDXPages.h @@ -56,13 +56,10 @@ public: VSDXPages(); ~VSDXPages(); void addPage(const VSDXPage &page); - void setOrder(const std::vector &pageOrder); void draw(libwpg::WPGPaintInterface *painter); private: void _drawWithBackground(libwpg::WPGPaintInterface *painter, const VSDXPage &page); - void _drawPage(libwpg::WPGPaintInterface *painter, const VSDXPage &page); std::map m_pages; - std::vector m_pagesOrder; }; diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp index 650dbc8..6ff537a 100644 --- a/src/lib/VSDXParser.cpp +++ b/src/lib/VSDXParser.cpp @@ -233,11 +233,8 @@ void libvisio::VSDXParser::handleStream(const Pointer &ptr, unsigned idx, unsign m_collector->endPage(); break; case VSD_PAGES: - { - std::vector pageOrder; - m_collector->endPages(pageOrder); + m_collector->endPages(); break; - } case VSD_STENCILS: m_isStencilStarted = false; break; diff --git a/src/lib/VSDXStylesCollector.h b/src/lib/VSDXStylesCollector.h index 23dc872..d32ad20 100644 --- a/src/lib/VSDXStylesCollector.h +++ b/src/lib/VSDXStylesCollector.h @@ -133,7 +133,7 @@ public: // Temporary hack void startPage(unsigned pageID); void endPage(); - void endPages(const std::vector &) {} + void endPages() {} VSDXStyles getStyleSheets() const { -- cgit v1.2.3