diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-03 09:49:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-03 14:48:49 +0000 |
commit | fa430e6b4e6f5d096bdf59db26e5d7393ca2297b (patch) | |
tree | 09f8d5fb17a4d9b090c9994c10c66a840a8003cd /sw/inc | |
parent | 79fcf0b4a86e22e541eecd6e39726fac2016750b (diff) |
Resolves: fdo#68347 fix word count with recorded changes
also see fdo#46757
a) We need to ignore redline-deleted text, but count redline-added text
b) each block of text is denoted by its end position in the model
and where that maps to in the view so a hidden portion
should record its end point not its starting point, and a non-hidden
deleted portion should always record its end point
c) when mapping a model position to the view we take the offset of
the model pos arg from the block end and use that to offset the
mapped block-end view pos to get the final view pos. But for
hidden portions that won't make a whole lot of sense, and
end up offsetting into prior portions, so map all positions within a
hidden portion to the same block-end view pos
add regression tests for these cases
Change-Id: I45c76bba47fd430bc3bccb5f919502660d415d9e
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/modeltoviewhelper.hxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sw/inc/modeltoviewhelper.hxx b/sw/inc/modeltoviewhelper.hxx index 018b67c49faa..d99c9dbd561e 100644 --- a/sw/inc/modeltoviewhelper.hxx +++ b/sw/inc/modeltoviewhelper.hxx @@ -65,19 +65,30 @@ class SwTxtNode; #define EXPANDFIELDS 0x0001 #define EXPANDFOOTNOTE 0x0002 #define HIDEINVISIBLE 0x0004 -#define HIDEREDLINED 0x0008 +#define HIDEDELETIONS 0x0008 /// do not expand to content, but replace with ZWSP #define REPLACEMODE 0x0010 class ModelToViewHelper { - /** For each field in the model string, there is an entry in the conversion - map. The first value of the ConversionMapEntry points to the field - position in the model string, the second value points to the associated - position in the view string. The last entry in the conversion map - denotes the lengths of the model resp. view string. + /** For each expanded/hidden portion in the model string, there is an entry in + the conversion map. The first value of the ConversionMapEntry points to + the start position in the model string, the second value points to the + associated start position in the view string. The last entry in the + conversion map denotes the lengths of the model resp. view string. */ - typedef std::pair< sal_Int32 , sal_Int32 > ConversionMapEntry; + struct ConversionMapEntry + { + ConversionMapEntry(sal_Int32 nModelPos, sal_Int32 nViewPos, bool bVisible) + : m_nModelPos(nModelPos) + , m_nViewPos(nViewPos) + , m_bVisible(bVisible) + { + } + sal_Int32 m_nModelPos; + sal_Int32 m_nViewPos; + bool m_bVisible; + }; typedef std::vector< ConversionMapEntry > ConversionMap; typedef std::vector<sal_Int32> Positions; |