[Libreoffice-commits] core.git: lotuswordpro/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sat Oct 10 18:02:26 UTC 2020
lotuswordpro/source/filter/lwptablelayout.cxx | 17 +++++------------
lotuswordpro/source/filter/lwptablelayout.hxx | 4 +++-
2 files changed, 8 insertions(+), 13 deletions(-)
New commits:
commit 7ca1632a402bea7568d8441524d3f6092695f3c5
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 9 20:51:17 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 10 20:01:38 2020 +0200
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 at redhat.com>
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);
};
More information about the Libreoffice-commits
mailing list