summaryrefslogtreecommitdiff
path: root/sw/inc/doc.hxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2014-11-09 15:30:08 +0100
committerLuboš Luňák <l.lunak@collabora.com>2014-11-14 13:27:18 +0100
commitf679e32f892d7ac198d511d53b524d7059ff42fc (patch)
tree1dfea8a27f1a0caf5fd00787edeb45624a8b0f6f /sw/inc/doc.hxx
parent0bc4baf73ce11a777195a31c23496960f60f6dfb (diff)
faster mapping from nodes to SwFrmFmt's anchored at them
The SwFrmFmtAnchorMap class provides reverse mapping to SwFrmFmt::GetAnchor().GetCntntAnchor(), so that when code somewhere needs to update SwFrmFmt's anchored at a position, it's not necessary to iterate over all of them (which can be a large number e.g. with mail merge). One special catch with the multimap of SwNodeIndex keys is that the values of those keys change (whenever the node structure of the document changes, indexes of nodes change as a result). This makes it impossible to use any hashing container, as the hashes would change without the container noticing, but multimap should work fine, as it just requires that the keys remain sorted, and that is the case. Nevertheless, the old code in the two converted places is intentionally left there in debug mode to verify the reverse mapping is updated correctly. I intentionally went with SwNodeIndex rather than SwPosition, as SwIndex (the other component of SwPosition) was causing some trouble (see e.g. the SwPosition comparison operator< , where two same positions are different if one is registered and the other not) and it doesn't appear to be actually necessary. Conflicts: sw/inc/doc.hxx sw/inc/frmfmt.hxx sw/source/core/attr/swatrset.cxx sw/source/core/doc/docnew.cxx sw/source/core/inc/frmtool.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/txtnode/ndtxt.cxx Change-Id: I7f1768558f60155d4ba83c84aa7f9e34dc65ebf9
Diffstat (limited to 'sw/inc/doc.hxx')
-rw-r--r--sw/inc/doc.hxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index c7d7af8de5ef..fc258ef8ac21 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -128,6 +128,7 @@ class SwFmt;
class SwFmtINetFmt;
class SwFmtRefMark;
class SwFrmFmt;
+class SwFrmFmtAnchorMap;
class SwFrmFmts;
class SwFtnIdxs;
class SwFtnInfo;
@@ -297,6 +298,7 @@ class SW_DLLPUBLIC SwDoc :
SwGrfFmtColl *mpDfltGrfFmtColl;
SwFrmFmts *mpFrmFmtTbl; ///< Format table
+ SwFrmFmtAnchorMap *mpFrmFmtAnchorMap;
SwCharFmts *mpCharFmtTbl;
SwFrmFmts *mpSpzFrmFmtTbl;
SwSectionFmts *mpSectionFmtTbl;
@@ -1214,6 +1216,9 @@ public:
const SwCharFmt *GetDfltCharFmt() const { return mpDfltCharFmt;}
SwCharFmt *GetDfltCharFmt() { return mpDfltCharFmt;}
+ const SwFrmFmtAnchorMap* GetFrmFmtAnchorMap() const { return mpFrmFmtAnchorMap; }
+ SwFrmFmtAnchorMap* GetFrmFmtAnchorMap() { return mpFrmFmtAnchorMap; }
+
/// @return the interface of the management of (auto)styles
IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }