1. 19 Eyl, 2018 40 kayıt (commit)
    • Michael Stahl's avatar
      sw_redlinehide_2: SwUndoDelete · 723728cd
      Michael Stahl yazdı
      This is problematic because of the calls to SplitNode.
      Ideally we'd want the SplitNode to create merged frames already, but
      that doesn't seem to be easy to achieve; several problems with this are:
      
      1. the redlines are only restored at the end of UndoImpl
      2. even if we store another set of SwRedlineSaveDatas right before the
         Join (while preventing the first SwRedlineSaveDatas from deleting
         them), and restore them by passing a closure to SplitNode, there
         are complaints about empty redlines, and also this case isn't
         handled properly:
      
           f<delete start>o<redline start>o
           b<redline end>a<redline start>r
           b<redline end>a<delete end>z
      
      So instead, let SplitNode create whatever frames it does, and fix it up
      at the end manually on the start node's frames.
      
      This necessitates delaying the creation of the frames on the moved nodes
      until the end too.
      
      Change-Id: I8ba2967659cc2ddbe6f7c40e0447d79601498ed6
      723728cd
    • Michael Stahl's avatar
      sw_redlinehide_2: JoinPrev() may need to move frames on deleted ... · 41d8ca96
      Michael Stahl yazdı
      ... prev. Node to the second node, if the two were merged before the
      Join.
      
      Change-Id: I047b6008c5f0bb6e79c63421a4dba09ba8cf3320
      41d8ca96
    • Michael Stahl's avatar
      sw_redlinehide_2: DelFrames is called for hidden nodes too now · 0de06872
      Michael Stahl yazdı
      Change-Id: I9933d8b8ee29bb4da74819d7d2350a5b2b04aa09
      0de06872
    • Michael Stahl's avatar
      sw_redlinehide_2: SwContentNode::DelFrames() · e0850bc1
      Michael Stahl yazdı
      ... needs to remove extents when it's called when moving nodes to
      Undo-nodes-array.
      
      Change-Id: I32cf38074d9f3d614d5f854979be6b0135d53914
      e0850bc1
    • Michael Stahl's avatar
      sw_redlinehide_2: assert calls with wrong start node · 9e1efcc8
      Michael Stahl yazdı
      Change-Id: I132ea43397b8990c5759db66f62749df8aaa45d5
      9e1efcc8
    • Michael Stahl's avatar
      sw: add a real create-no-frames flag to MakeCopy/MakeTextNode · 69d2d24b
      Michael Stahl yazdı
      SwNodes::CopyNodes calling MakeCopy() and then immediately DelFrames()
      considered silly.
      
      Apparently SwOLENode/SwGrfNode don't actually create frames anyway since
      that is done via their SwFrameFormats, so they just ignore the parameter.
      
      Change-Id: I8a8f52da1d25bb5689345e956a33aebd727e8fc7
      69d2d24b
    • Michael Stahl's avatar
      sw_redlinehide_2: tiny optimisation in SwTextFrame::SwClientNotify() · c1c3c5cd
      Michael Stahl yazdı
      If there are no items left that affect the frame (which is hard to
      predict for merged frames, nCount only refers to the incoming item set),
      skip calling SwContentFrame::Modify().
      
      Change-Id: I10bdb6420bcff9b89e73b6d57ebb762aa43a0648
      c1c3c5cd
    • Michael Stahl's avatar
      sw_redlinehide_2: quite the nuisance when it happens, better assert · f0cccc76
      Michael Stahl yazdı
      ... in SwFootnoteFrame::GetRef()
      
      Change-Id: I5cef7c2cea41a5b246268a541afd47945603ffed
      f0cccc76
    • Michael Stahl's avatar
      sw_redlinehide_2: invalidate more in DocumentRedlineManager::DeleteRedline · f947bfa1
      Michael Stahl yazdı
      To get the extents right, first invalidate old range with Remove,
      then new range with Add.
      
      Change-Id: If46954b9bb86680ae689de742ec878e0287f58d9
      f947bfa1
    • Michael Stahl's avatar
      sw_redlinehide_2: invalidate when delete redline goes away · 4faf5ce0
      Michael Stahl yazdı
      Add another new hint sw::RedlineUnDelText; the main use case is to send
      it from  DocumentRedlineManager::DeleteRedline() so the view is updated
      accordingly.
      
      Change-Id: Ia490116588dc8d3c695ec83c0c2ce8497736f76e
      4faf5ce0
    • Michael Stahl's avatar
      sw_redlinehide_2: incorrect call to lcl_SetWrong · f8cde353
      Michael Stahl yazdı
      Must not move WrongList indexes for redline ops, which do not actually
      insert/delete characters.
      
      Change-Id: I965c60dad691128125ef9cdacdb388b30c9d52f3
      f8cde353
    • Michael Stahl's avatar
      sw_redlinehide_2: force SwAttrIter::GetNextAttr to make progress · 9a5dec4a
      Michael Stahl yazdı
      ... and skip over the redline if the start position is at the beginning
      of it.
      
      Change-Id: Ib12b459b12d49e1443257ce398963ab3ec64f2a5
      9a5dec4a
    • Michael Stahl's avatar
      sw_redlinehide_2: subtlety in UnHideRedlines, delete all flys ... · 457f4151
      Michael Stahl yazdı
      ... even on nodes that have no extents any more because they were all
      deleted while the redlines were hidden.
      
      Change-Id: Id6595520b1d5db030c26905b62033db68969532c
      457f4151
    • Michael Stahl's avatar
      sw_redlinehide_2: annoying fixup in CheckParaRedlineMerge() · c7439dad
      Michael Stahl yazdı
      If the document is edited while redlines are shown, the node merge flags
      aren't updated because only CheckParaRedlineMerge() really updates the
      flags.
      
      But CheckParaRedlineMerge() knows what the last node of a merge is,
      so we can conclude that the next node then isn't merged and needs to
      have frames created for it.
      
      Change-Id: Ie9e189a2d9251910c3f5ac98a46867bbe1d91c10
      c7439dad
    • Michael Stahl's avatar
      sw_redlinehide_2: CheckParaRedlineMerge must also mark... · 70fed136
      Michael Stahl yazdı
      ... first node as not merged when there are redlines but not spanning
      nodes.
      
      Change-Id: Ieb6a5775a1f6a22874e622b10b245b7e8d61a62c
      70fed136
    • Michael Stahl's avatar
      sw_redlinehide_2: fix bug in UpdateMergedParaForDelete · 309bec70
      Michael Stahl yazdı
      Change-Id: I818a22f286f08a842295e362fa3e10fbcb37c728
      309bec70
    • Michael Stahl's avatar
      sw_redlinehide_2: JoinNext/JoinPrev may need to recreate MergedPara · 67d82abe
      Michael Stahl yazdı
      Change-Id: I17cde9fab29cf54837904db3c6e64d609aed83b0
      67d82abe
    • Michael Stahl's avatar
      sw_redlinehide_2: SplitContentNode also needs to move flys ... · b4b07e4d
      Michael Stahl yazdı
      ... and footnotes that are anchored in a node of a merged frame that
      follows the one that is being split to the new frames of the existing
      node when the existing frames are moved to the new (preceding) node.
      
      Change-Id: I759718c14130e6a3809dc2ca55243f3ff2eec50b
      b4b07e4d
    • Michael Stahl's avatar
      sw_redlinehide_2: reset node's merge flag in SwTextNode::JoinNext/JoinPrev · 83487b49
      Michael Stahl yazdı
      ... if the deleted node was the only one it was merged with.
      
      Change-Id: I7b73bb3bfa92d285c06cfb24e0bae4e81708dbb8
      83487b49
    • Michael Stahl's avatar
      sw_redlinehide_2: prevent SetRedlineFlags from messing things up · 15f1555d
      Michael Stahl yazdı
      Unfortunately it doesn't work to just let the content editing
      functions that are called by the SwRangeRedline Show function
      set up the frames because they can't do it correctly, as the redline
      that is currently being Shown doesn't have a correct position;
      the position is only patched up afterwards in MoveFromSection.
      
      Change-Id: Ie94a2eea44befce55ad16db1f9349b1582a7f73e
      15f1555d
    • Michael Stahl's avatar
      sw_redlinehide_2: move SwInsText/SwDelText hint in CutImpl before attributes · 9091522a
      Michael Stahl yazdı
      An unfortunate incident involving a footnote accessing its old anchor
      node's layout frame during InsertHint and the MapModelToViewPos needing
      to have a mapping for this index...
      
      6  SwTextFrame::MapModelToViewPos(SwPosition const&) const (this=0x8937760, rPos=SwPosition (node 41, offset 4)) at sw/source/core/text/txtfrm.cxx:1005
      7  SwTextFrame::GetFrameAtPos(SwPosition const&) (this=0x8937760, rPos=SwPosition (node 41, offset 4)) at sw/source/core/text/frmcrsr.cxx:153
      8  GetFrameOfModify(SwRootFrame const*, SwModify const&, SwFrameType, Point const*, SwPosition const*, bool) (pLayout=0x6a0a240, rMod=..., nFrameType=(SwFrameType::Txt | SwFrameType::NoTxt), pPoint=0x0, pPos=0x7ffcfa9d70a0, bCalcFrame=false) at sw/source/core/layout/frmtool.cxx:3517
      9  SwContentNode::getLayoutFrame(SwRootFrame const*, Point const*, SwPosition const*, bool) const (this=0x6a67e20, _pRoot=0x6a0a240, pPoint=0x0, pPos=0x7ffcfa9d70a0, bCalcFrame=false) at sw/source/core/docnode/node.cxx:1137
      10 SwFootnoteFrame::GetRefFromAttr() (this=0x8970a30) at sw/source/core/layout/ftnfrm.cxx:2839
      11 SwContentNode::DelFrames(SwRootFrame const*, bool) (this=0x897ead0, pLayout=0x0, fromDtor=false) at sw/source/core/docnode/node.cxx:1419
      12 SwTextNode::InsertHint(SwTextAttr*, SetAttrMode) (this=0x89ac890, pAttr=0x6a3ff60, nMode=(SetAttrMode::DONTREPLACE | SetAttrMode::NOTXTATRCHR)) at sw/source/core/txtnode/thints.cxx:1408
      13 SwTextNode::CutImpl(SwTextNode*, SwIndex const&, SwIndex const&, int, bool) (this=0x6a67e20, pDest=0x89ac890, rDestStart=SwIndex (offset 2), rStart=SwIndex (offset 0), nLen=3, bUpdate=false) at sw/source/core/txtnode/ndtxt.cxx:2374
      14 SwTextNode::CutText(SwTextNode*, SwIndex const&, int) (this=0x6a67e20, pDest=0x89ac890, rStart=SwIndex (offset 0), nLen=3) at sw/source/core/txtnode/ndtxt.cxx:2199
      15 SwTextNode::JoinNext() (this=0x89ac890) at sw/source/core/txtnode/ndtxt.cxx:812
      
      Change-Id: If0dc0f16eb124dc8a070b84684ee9ec9ab0dc70f
      9091522a
    • Michael Stahl's avatar
      sw_redlinehide_2: fix SplitNode handling of merged frames · 67296669
      Michael Stahl yazdı
      The first branch is a bit easier, because it always moves the existing
      frame onto the first node of the split anyway; the second branch may or
      may not need to do that, but it has to move it just to be sure if it
      needs to move it, which is a bit annoying...
      
      Change-Id: Ib2fc69c2bd99dffa958f1620211ec657a8cc1be8
      67296669
    • Michael Stahl's avatar
      sw_redlinehide_2: let's have MergedPara listen on hidden nodes · a4ec5d47
      Michael Stahl yazdı
      ... in particular all SwTextNodes on the same nodes-array nesting level
      as the first one; then UpdateMergedParaForInsert can handle insertions
      there.
      
      Change-Id: I59d12b87c1296c322ab1f21779240ec611919cb0
      a4ec5d47
    • Michael Stahl's avatar
      sw_redlinehide_2: fix wrong assertion · a4e20011
      Michael Stahl yazdı
      Change-Id: I8b00f406ae52c3280f9ec07c845ef7aa6e41617f
      a4e20011
    • Michael Stahl's avatar
      sw_redlinehide_2: try to keep the pLastNode updated if it's deleted... · 295c0142
      Michael Stahl yazdı
      Change-Id: Ied4ca532b336cacf3c4a8d96b9e75dcbaf47ba29
      295c0142
    • Michael Stahl's avatar
      sw_redlinehide_2: fix infinite loop caused by SwAttrIter::Seek(0) · fa3ddff2
      Michael Stahl yazdı
      The problem is if there is a delete redline that deletes the entire
      pFirstNode and ends in a different node, at the position where a
      hint starts; first m_pRedline->Seek() will be called with the wrong
      node, then the GetNextAttr() will call MapModelToView() and get 0
      back again...
      
      Change-Id: Ie3eb1250267429ea3e3f6281685c955a79d4e960
      fa3ddff2
    • Michael Stahl's avatar
      sw_redlinehide_2: check merge flag in various MakeFrames · 66b563cf
      Michael Stahl yazdı
      Change-Id: I2d54ae4069c0c6813059f90a1003387512ee9ba1
      66b563cf
    • Michael Stahl's avatar
      sw_redlinehide_2: SplitNode: move more code into restoreFunc · e6c28812
      Michael Stahl yazdı
      In DocumentContentOperationsManager::SplitNode(), ensure that all
      redline updating is done in the restoreFunc.
      
      Change-Id: I918b8f24dcda0cc181cb0f33bb2ca170a14b0e98
      e6c28812
    • Michael Stahl's avatar
      sw_redlinehide_2: MapModelToView needs to work on hidden nodes... · 71532ba5
      Michael Stahl yazdı
      ... that have no extents as well; add a pointer to the last node that
      can be used for comparing.
      
      Change-Id: Ibe7a84b523bb5921b3ca7fed2e330c54d85c5498
      71532ba5
    • Michael Stahl's avatar
      sw_redlinehide_2: also reset Merge flag in CheckParaRedlineMerge · 0fa39cb0
      Michael Stahl yazdı
      If it sets the Merge flag, it needs to reset it too.
      
      Change-Id: I0b07ca87ff9911db37166312ca07edd15e8b496c
      0fa39cb0
    • Michael Stahl's avatar
      sw_redlinehide_2: when switching show/hide, invalidate Insert redlines · a0fe386d
      Michael Stahl yazdı
      ... so that the frames are repainted with/without font color.
      
      Change-Id: I68f105868d262c9d0a88f124c98243a64159aa38
      a0fe386d
    • Michael Stahl's avatar
      sw_redlinehide_2: fix painting of "bars" in the margin · 09fd75a0
      Michael Stahl yazdı
      If the layout wants to hide redlines, these should not be painted.
      
      Change-Id: I3cc725b466ca3874a00c6b96eb0e02ff70dcc42b
      09fd75a0
    • Michael Stahl's avatar
      sw_redlinehide_2: fix init of SwRedlineIter::Mode · d784612f
      Michael Stahl yazdı
      If there are no delete redlines in a frame, the mode must be Ignore,
      otherwise the insert redlines will be colorful...
      
      Change-Id: Ibd57f2827b0805ac2fdb29ed347d9b2ed0b00737
      d784612f
    • Michael Stahl's avatar
      sw_redlinehide_2: fix ordering of SplitNode usage of ContentIdxStore 2 · 0996bff8
      Michael Stahl yazdı
      The flys have their anchor positions updated, and that causes lookups
      from the layout frame to the anchor SwTextFrame, but that isn't updated
      yet; it looks like the fly restore must be done after adapting the
      SwTextFrames, while the redline restore must be done before.
      
      Also RegisterToNode must call Check only for the 1st node.
      
      Change-Id: If87a62108f1bcaf794e5be1cc38dc936f08cd69e
      0996bff8
    • Michael Stahl's avatar
      sw_redlinehide_2: fix ordering of SplitNode usage of ContentIdxStore · ad067c36
      Michael Stahl yazdı
      The problem is that now the ctor of SwTextFrame will check the redline
      positions, but the call to MakeFramesForAdjacentContentNode()
      happens before the call to ContentIdxStore::Restore() that updates
      the SwPositions of the redlines, hence they point to the wrong node.
      
      Try to fix this by not calling Restore directly but pass in a closure
      to SwTextNode::SplitContentNode() so that it can call
      ContentIdxStore::Restore() before frames are created and redline positions
      are checked.
      
      Also remove the useless SwContentNode::SplitContentNode() - only the
      SwTextNode override actually did anything.
      
      Change-Id: I2088fd124d04cf354f4f0f691a50ff5217d778d7
      ad067c36
    • Michael Stahl's avatar
      sw_redlinehide_2: adapt SwFlyFrameFormat::MakeFrames() ... · 6386e595
      Michael Stahl yazdı
      ... and SwDrawFrameFormat::MakeFrames() to do nothing if anchored in
      hidden redline.
      
      Change-Id: Idb0668db81b20ee52cd9c0237c22f8fa72beb7b3
      6386e595
    • Michael Stahl's avatar
      sw_redlinehide_2: handle flys anchored in flys · daa952ea
      Michael Stahl yazdı
      There is no way to iterate over the nodes-array such that flys are
      ordered wrt. the flys in whose content they are anchored; this makes
      it hard to ensure that flys anchored in flys are handled only once.
      
      For the Hide implementation, when the flys anchored to a non-first
      merged SwTextNode in a fly are inserted, ensure that the content of
      the same fly is skipped if it happens to come later in the nodes-array.
      
      For the Show implementation, the ::MakeFrames() would call
      AppendAllObj() anyway; suppress that and manually call it at the end,
      which should avoid the problem.
      
      Change-Id: I7fb31cf14ef26c095fa7e09edd4ab530add9f253
      daa952ea
    • Michael Stahl's avatar
      sw_redlinehide_2: disable hiding at-char flys again · d4ca2468
      Michael Stahl yazdı
      Needs changes in Delete for consistency.
      
      Change-Id: If9382ebca9b6335ffef8c738840813837316f841
      d4ca2468
    • Michael Stahl's avatar
      sw_redlinehide_2: fix use-after-free in SwFootnoteFrame · 07611f95
      Michael Stahl yazdı
      On hide, the SwTextFootnote::DelFrames() for a note in a deleted frame
      must actually delete the frames; if there's a follow SwTextFrame, then it
      might erroneously return without deleting anything.
      
      Change-Id: I7e9473b94feaf939be72e285553a8990c2ce1a06
      07611f95
    • Michael Stahl's avatar
      sw_redlinehide_2: try to minimise invalidation on show/hide · 7adb4a7a
      Michael Stahl yazdı
      InvalidateAllContent(Size) will basically format every paragraph
      in the document from scratch; let's try to optimise this a bit
      by invalidating only the SwTextFrames that actually contain redlines
      and the SwPageFrames they're on, and also invalidate the position
      of all flys anchored at these frames as a precautionary measure.
      
      Change-Id: I22ed683dc2225992ee48faa6084f277ef8733e8b
      7adb4a7a