diff options
-rw-r--r-- | src/lib/VSDXCollector.h | 2 | ||||
-rw-r--r-- | src/lib/VSDXContentCollector.cpp | 3 | ||||
-rw-r--r-- | src/lib/VSDXContentCollector.h | 2 | ||||
-rw-r--r-- | src/lib/VSDXPages.cpp | 43 | ||||
-rw-r--r-- | src/lib/VSDXPages.h | 3 | ||||
-rw-r--r-- | src/lib/VSDXParser.cpp | 5 | ||||
-rw-r--r-- | 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<unsigned> &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<unsigned> &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<unsigned> &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<unsigned> &pagesOrder) -{ - m_pagesOrder = pagesOrder; -} - void libvisio::VSDXPages::draw(libwpg::WPGPaintInterface *painter) { if (!painter) return; - std::map<unsigned, libvisio::VSDXPage>::iterator iter; - if (!m_pagesOrder.empty()) + for (std::map<unsigned, libvisio::VSDXPage>::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<unsigned> &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<unsigned, VSDXPage> m_pages; - std::vector<unsigned> 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<unsigned> 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<unsigned> &) {} + void endPages() {} VSDXStyles getStyleSheets() const { |