summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-09 20:51:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-10-10 20:01:38 +0200
commit7ca1632a402bea7568d8441524d3f6092695f3c5 (patch)
treed05f6f8845382b042b40632ae037f17de12f2361
parentc49ad87cc2b4ee5b5b20365a8f3e0f617112c406 (diff)
ofz#23505 31 seconds -> 12 seconds
Change-Id: Ib26f03bb308e4b96a0647ca3a81288b6cce5a767 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104133 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx17
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.hxx4
2 files changed, 8 insertions, 13 deletions
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 846e757ad3e3..5ea2d42db9a4 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -1408,15 +1408,10 @@ void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable,
* @param nRow - row id
* @param nCol - column id
*/
-void LwpTableLayout::SetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol,XFCell* pXFCell)
+void LwpTableLayout::SetCellsMap(sal_uInt16 nRow, sal_uInt8 nCol, XFCell* pXFCell)
{
- std::pair<std::pair<sal_uInt16,sal_uInt8>,XFCell*> cell;
- std::pair<sal_uInt16,sal_uInt8> pos;
- pos.first = nRow;
- pos.second = nCol;
- cell.first = pos;
- cell.second = pXFCell;
- m_CellsMap.insert(cell);
+ // combine the 16bit nRow and 8bit nCol into a single 32bit number
+ m_CellsMap.insert(std::make_pair((nRow << 8) | nCol, pXFCell));
}
/**
@@ -1425,11 +1420,9 @@ void LwpTableLayout::SetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol,XFCell* pXFCell)
* @param nCol - column id
* @return pXFCell
*/
-XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol)
+XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow, sal_uInt8 nCol)
{
- std::pair<sal_uInt16,sal_uInt8> pos;
- pos.first = nRow;
- pos.second = nCol;
+ RowCol pos = (nRow << 8) | nCol;
auto iter = m_CellsMap.find(pos);
if (iter == m_CellsMap.end())
return nullptr;
diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx
index 9eebb2b391c1..21ab84ec1c67 100644
--- a/lotuswordpro/source/filter/lwptablelayout.hxx
+++ b/lotuswordpro/source/filter/lwptablelayout.hxx
@@ -67,6 +67,7 @@
#include <vector>
#include <map>
#include <memory>
+#include <unordered_map>
class XFTableStyle;
class XFTable;
@@ -164,7 +165,8 @@ private:
void SplitConflictCells();
rtl::Reference<XFTable> m_pXFTable;
bool m_bConverted;
- std::map<std::pair<sal_uInt16,sal_uInt8>,XFCell*> m_CellsMap;
+ typedef sal_Int32 RowCol;
+ std::unordered_map<RowCol, XFCell*> m_CellsMap;
void PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID);
};