Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3100

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/00/3100/1

fdo#60513: SwCrsrShell::Push(): take position from table cursor

If there is a table cursor, store its point/mark position on the cursor
stack instead of pCurCrsr, which in this case is just one cell in a ring
that contains a SwShellCrsr for every selected cell.

SwCrsrShell::Pop() is surprisingly able to restore the prior state,
because it calls UpdateCrsr(), which detects that the pCurCrsr spans
multiple table cells and re-creates pTblCrsr, and then later on the
first GetCrsr() call SwTableCursor::MakeBoxSels() will restore the ring
of SwShellCrsrs from the pTblCrsr selection.

Change-Id: Ibe9a7f379ece61c7dab1a6f69abaebf42a4c85ec
(cherry picked from commit b227a8e4d65e4bbfe991aed9342fe3e30eca8639)
---
M sw/source/core/crsr/crsrsh.cxx
1 file changed, 8 insertions(+), 4 deletions(-)



diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 379af07..ac00ff7 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1859,13 +1859,17 @@
 /// create a copy of the cursor and save it in the stack
 void SwCrsrShell::Push()
 {
-    pCrsrStk = new SwShellCrsr( *this, *pCurCrsr->GetPoint(),
-                                    pCurCrsr->GetPtPos(), pCrsrStk );
+    // fdo#60513: if we have a table cursor, copy that; else copy current.
+    // This seems to work because UpdateCrsr() will fix this up on Pop(),
+    // then MakeBoxSels() will re-create the current pCurCrsr cell ring.
+    SwShellCrsr *const pCurrent((pTblCrsr) ? pTblCrsr : pCurCrsr);
+    pCrsrStk = new SwShellCrsr( *this, *pCurrent->GetPoint(),
+                                    pCurrent->GetPtPos(), pCrsrStk );
 
-    if( pCurCrsr->HasMark() )
+    if (pCurrent->HasMark())
     {
         pCrsrStk->SetMark();
-        *pCrsrStk->GetMark() = *pCurCrsr->GetMark();
+        *pCrsrStk->GetMark() = *pCurrent->GetMark();
     }
 }
 

-- 
To view, visit https://gerrit.libreoffice.org/3100
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe9a7f379ece61c7dab1a6f69abaebf42a4c85ec
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Michael Stahl <mstahl@redhat.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.