Blame SOURCES/0001-replace-boost-bimap-in-sdext-pdfimport.patch

9317df
From 193b49763a03d63ba79db50c1fa0563ec0d6b0c3 Mon Sep 17 00:00:00 2001
9317df
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
9317df
Date: Wed, 29 Jan 2020 12:44:52 +0000
9317df
Subject: [PATCH] replace boost::bimap in sdext pdfimport
9317df
9317df
Change-Id: Ie324a0b81931bbd427483878a87beeca455ada18
9317df
---
9317df
 sdext/source/pdfimport/inc/pdfiprocessor.hxx  | 12 ++++-------
9317df
 sdext/source/pdfimport/tree/pdfiprocessor.cxx | 21 +++++++++++--------
9317df
 2 files changed, 16 insertions(+), 17 deletions(-)
9317df
9317df
diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
9317df
index 89f9d601b7b0..9e08d6a6a765 100644
9317df
--- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx
9317df
+++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
9317df
@@ -37,9 +37,6 @@
9317df
 #include "treevisitorfactory.hxx"
9317df
 #include "genericelements.hxx"
9317df
 
9317df
-#include <boost/bimap/bimap.hpp>
9317df
-#include <boost/bimap/unordered_set_of.hpp>
9317df
-
9317df
 namespace pdfi
9317df
 {
9317df
 
9317df
@@ -160,10 +157,8 @@ namespace pdfi
9317df
         typedef std::unordered_map<sal_Int32,FontAttributes> IdToFontMap;
9317df
         typedef std::unordered_map<FontAttributes,sal_Int32,FontAttrHash> FontToIdMap;
9317df
 
9317df
-        typedef boost::bimaps::bimap<
9317df
-                             boost::bimaps::unordered_set_of<GraphicsContext, GraphicsContextHash>,
9317df
-                             boost::bimaps::unordered_set_of<sal_Int32>
9317df
-                            > GCToIdBiMap;
9317df
+        typedef std::unordered_map<sal_Int32,GraphicsContext> IdToGCMap;
9317df
+        typedef std::unordered_map<GraphicsContext, sal_Int32, GraphicsContextHash> GCToIdMap;
9317df
 
9317df
         typedef std::vector<GraphicsContext> GraphicsContextStack;
9317df
 
9317df
@@ -178,7 +173,8 @@ namespace pdfi
9317df
 
9317df
         GraphicsContextStack               m_aGCStack;
9317df
         sal_Int32                          m_nNextGCId;
9317df
-        GCToIdBiMap                        m_aGCToId;
9317df
+        IdToGCMap                          m_aIdToGC;
9317df
+        GCToIdMap                          m_aGCToId;
9317df
 
9317df
         ImageContainer                     m_aImages;
9317df
 
9317df
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
9317df
index c6baa7fee8b2..ed2eaf6510b9 100644
9317df
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
9317df
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
9317df
@@ -54,6 +54,7 @@ namespace pdfi
9317df
     m_aFontToId(),
9317df
     m_aGCStack(),
9317df
     m_nNextGCId( 1 ),
9317df
+    m_aIdToGC(),
9317df
     m_aGCToId(),
9317df
     m_aImages(),
9317df
     m_nPages(0),
9317df
@@ -65,12 +66,13 @@ namespace pdfi
9317df
     aDefFont.isBold     = false;
9317df
     aDefFont.isItalic   = false;
9317df
     aDefFont.size       = 10*PDFI_OUTDEV_RESOLUTION/72;
9317df
-    m_aIdToFont[ 0 ]    = aDefFont;
9317df
-    m_aFontToId[ aDefFont ] = 0;
9317df
+    m_aIdToFont.insert({0, aDefFont});
9317df
+    m_aFontToId.insert({aDefFont, 0});
9317df
 
9317df
     GraphicsContext aDefGC;
9317df
     m_aGCStack.push_back( aDefGC );
9317df
-    m_aGCToId.insert(GCToIdBiMap::relation(aDefGC, 0));
9317df
+    m_aGCToId.insert({aDefGC, 0});
9317df
+    m_aIdToGC.insert({0, aDefGC});
9317df
 }
9317df
 
9317df
 void PDFIProcessor::setPageNum( sal_Int32 nPages )
9317df
@@ -468,12 +470,13 @@ const FontAttributes& PDFIProcessor::getFont( sal_Int32 nFontId ) const
9317df
 sal_Int32 PDFIProcessor::getGCId( const GraphicsContext& rGC )
9317df
 {
9317df
     sal_Int32 nGCId = 0;
9317df
-    auto it = m_aGCToId.left.find( rGC );
9317df
-    if( it != m_aGCToId.left.end() )
9317df
+    auto it = m_aGCToId.find( rGC );
9317df
+    if( it != m_aGCToId.end() )
9317df
         nGCId = it->second;
9317df
     else
9317df
     {
9317df
-        m_aGCToId.insert(GCToIdBiMap::relation(rGC, m_nNextGCId));
9317df
+        m_aGCToId.insert({rGC, m_nNextGCId});
9317df
+        m_aIdToGC.insert({m_nNextGCId, rGC});
9317df
         nGCId = m_nNextGCId;
9317df
         m_nNextGCId++;
9317df
     }
9317df
@@ -483,9 +486,9 @@ sal_Int32 PDFIProcessor::getGCId( const GraphicsContext& rGC )
9317df
 
9317df
 const GraphicsContext& PDFIProcessor::getGraphicsContext( sal_Int32 nGCId ) const
9317df
 {
9317df
-    auto it = m_aGCToId.right.find( nGCId );
9317df
-    if( it == m_aGCToId.right.end() )
9317df
-        it = m_aGCToId.right.find( 0 );
9317df
+    auto it = m_aIdToGC.find( nGCId );
9317df
+    if( it == m_aIdToGC.end() )
9317df
+        it = m_aIdToGC.find( 0 );
9317df
     return it->second;
9317df
 }
9317df
 
9317df
-- 
9317df
2.24.1
9317df